T-REX Gateway Interface

The T-REX Gateway interface defines the set of functions and events used to manage and control the deployment of T-REX tokens. This page provides a detailed breakdown of each function and event, explaining its purpose, source, and functionality. Additionally, the TokenDetails, ClaimDetails, and Fee structs are defined to ensure a comprehensive understanding of how to interact with the T-REX Gateway contract.

Structs

TokenDetails

Description: Holds all necessary details for deploying a new T-REX token and its associated contracts.

struct TokenDetails {
    address owner;          // Address of the owner of all contracts
    string name;            // Name of the token
    string symbol;          // Symbol / ticker of the token
    uint8 decimals;         // Decimals of the token (can be between 0 and 18)
    address irs;            // Identity registry storage address
    address ONCHAINID;      // ONCHAINID of the token
    address[] irAgents;     // List of agents of the identity registry
    address[] tokenAgents;  // List of agents of the token
    address[] complianceModules; // Modules to bind to the compliance
    bytes[] complianceSettings;  // Settings calls for compliance modules
}

ClaimDetails

Description: Holds all necessary details regarding the claims and claim issuers.

struct ClaimDetails {
    uint256[] claimTopics;        // Claim topics required
    address[] issuers;            // Trusted issuers addresses
    uint256[][] issuerClaims;     // Claims that issuers are allowed to emit
}

Fee

Description: Holds the details for deployment fees.

struct Fee {
    uint256 fee;        // Amount of fee tokens to pay for 1 deployment
    address feeToken;   // Address of the token used to pay fees
    address feeCollector; // Address collecting fees
}

FactorySet

Event

Description: Emitted when the factory variable is set or modified.

event FactorySet(address indexed factory);

PublicDeploymentStatusSet

Event

Description: Emitted when the public deployment status is set or modified.

event PublicDeploymentStatusSet(bool indexed publicDeploymentStatus);

DeploymentFeeSet

Event

Description: Emitted when the deployment fees details are set or modified.

event DeploymentFeeSet(uint256 indexed fee, address indexed feeToken, address indexed feeCollector);

DeploymentFeeEnabled

Event

Description: Emitted when the deployment fees are enabled or disabled.

event DeploymentFeeEnabled(bool indexed isEnabled);

DeployerAdded

Event

Description: Emitted when an address is flagged as a deployer.

event DeployerAdded(address indexed deployer);

DeployerRemoved

Event

Description: Emitted when a deployer address loses deployment privileges.

event DeployerRemoved(address indexed deployer);

FeeDiscountApplied

Event

Description: Emitted when a discount on deployment fees is granted for an address.

event FeeDiscountApplied(address indexed deployer, uint16 discount);

GatewaySuiteDeploymentProcessed

Event

Description: Emitted whenever a TREX token has been deployed by the TREX factory through the use of the Gateway.

event GatewaySuiteDeploymentProcessed(address indexed requester, address intendedOwner, uint256 feeApplied);

setFactory

Description: Sets the factory contract address used for deploying TREX smart contracts. Only the owner can call this method. Emits a FactorySet event upon successful execution.

function setFactory(address factory) external;

setPublicDeploymentStatus

Description: Sets the status for public deployments of TREX contracts. Enables or disables public deployments. Only the owner can call this method. Emits a PublicDeploymentStatusSet event upon successful execution.

function setPublicDeploymentStatus(bool _isEnabled) external;

transferFactoryOwnership

Description: Transfers the ownership of the Factory contract. Only the owner can call this method.

function transferFactoryOwnership(address _newOwner) external;

enableDeploymentFee

Description: Toggles the deployment fee status for TREX contracts. Enables or disables the deployment fees. Only the owner can call this method. Emits a DeploymentFeeEnabled event upon successful execution.

function enableDeploymentFee(bool _isEnabled) external;

setDeploymentFee

Description: Sets the deployment fee details for TREX contracts. Establishes the amount, token type, and collector address for the deployment fee. Only the owner can call this method. Emits a DeploymentFeeSet event upon successful execution.

function setDeploymentFee(uint256 _fee, address _feeToken, address _feeCollector) external;

addDeployer

Description: Adds an address to the list of approved deployers. Only an admin (owner or agent) can call this method. Emits a DeployerAdded event upon successful addition.

function addDeployer(address deployer) external;

batchAddDeployer

Description: Adds multiple addresses to the list of approved deployers in a single transaction. Only an admin (owner or agent) can call this method. Emits a DeployerAdded event for each successfully added deployer.

function batchAddDeployer(address[] calldata deployers) external;

removeDeployer

Description: Removes an address from the list of approved deployers. Only an admin (owner or agent) can call this method. Emits a DeployerRemoved event upon successful removal.

function removeDeployer(address deployer) external;

batchRemoveDeployer

Description: Removes multiple addresses from the list of approved deployers in a single transaction. Only an admin (owner or agent) can call this method. Emits a DeployerRemoved event for each successfully removed deployer.

function batchRemoveDeployer(address[] calldata deployers) external;

applyFeeDiscount

Description: Applies a fee discount to a specific deployer's address. Only an admin (owner or agent) can call this method. The fee discount is expressed per 10,000 (10000 = 100%, 1000 = 10%, etc.). Emits a FeeDiscountApplied event upon successful application.

function applyFeeDiscount(address deployer, uint16 discount) external;

batchApplyFeeDiscount

Description: Applies fee discounts to multiple deployers in a single transaction. Only an admin (owner or agent) can call this method. Emits a FeeDiscountApplied event for each successfully applied discount.

function batchApplyFeeDiscount(address[] calldata deployers, uint16[] calldata discounts) external;

deployTREXSuite

Description: Deploys a TREX suite of contracts using provided token and claim details. If public deployments are disabled, only approved deployers can execute this function. If public deployments are enabled, an external entity can deploy only on its behalf and not for other addresses unless it's an approved deployer. If deployment fees are enabled and applicable (after considering any discounts for the deployer), the fee is collected from the deployer's address. Emits a GatewaySuiteDeploymentProcessed event upon successful deployment.

function deployTREXSuite(
    ITREXFactory.TokenDetails memory _tokenDetails,
    ITREXFactory.ClaimDetails memory _claimDetails
) external;

batchDeployTREXSuite

Description: Deploys multiple TREX suites of contracts in a single transaction using provided arrays of token and claim details. This batch function allows deploying up to 5 TREX suites at once. Performs the same checks as deployTREXSuite for each suite. Emits a GatewaySuiteDeploymentProcessed event for each deployed suite.

function batchDeployTREXSuite(
    ITREXFactory.TokenDetails[] memory _tokenDetails,
    ITREXFactory.ClaimDetails[] memory _claimDetails
) external;

getPublicDeploymentStatus

Description: Retrieves the current public deployment status.

function getPublicDeploymentStatus() external view returns(bool);

getFactory

Description:

Retrieves the address of the current Factory contract.

function getFactory() external view returns(address);

getDeploymentFee

Description: Retrieves the current deployment fee details.

function getDeploymentFee() external view returns(Fee memory);

isDeploymentFeeEnabled

Description: Checks if the deployment fee is currently enabled.

function isDeploymentFeeEnabled() external view returns(bool);

isDeployer

Description: Checks if the provided address is an approved deployer.

function isDeployer(address deployer) external view returns(bool);

calculateFee

Description: Calculates the deployment fee for a given deployer after accounting for any discounts.

function calculateFee(address deployer) external view returns(uint256);

Last updated

Logo

ERC3643 ASBL - 2024 - contact@erc3643.org