The T-REX Factory is a pivotal smart contract in the T-REX protocol, deployed at the same address on every EVM-compatible chain where the ERC-3643 association has implemented the protocol. It enables users to deploy the entire T-REX suite (Token, Identity Registry, Identity Registry Storage, Claim Topics Registry, Trusted Issuers Registry, and Compliance) in a single transaction, streamlining the setup process and ensuring consistency across multiple blockchains.
Efficiency and Consistency:
The single transaction deployment process ensures that all components of the T-REX suite are deployed consistently and efficiently. This reduces the complexity and potential errors associated with manual deployments.
Future-Proof Design:
The use of upgradeable proxies ensures that deployed contracts can be updated without needing redeployment. This future-proof design allows the T-REX protocol to adapt to new standards and requirements seamlessly.
Enhanced Interoperability:
The cross-chain consistency provided by the T-REX Factory enhances the interoperability of the T-REX ecosystem. It ensures that claims and credentials can be used across different networks, reducing the need for redundant verification processes.
Single Transaction Deployment:
The T-REX Factory allows the deployment of the entire T-REX suite in one transaction. This includes the Token, Identity Registry (IR), Identity Registry Storage (IRS), Claim Topics Registry (CTR), Trusted Issuers Registry (TIR), and Compliance contracts.
Predefined Settings:
Deployment Process:
The T-REX Factory deploys a new T-REX token and sets all the parameters as required. It handles the deployment of the Token, IR, IRS (if not provided), CTR, TIR, and Compliance contracts, setting owners, agents, required claims, and trusted issuers in a single transaction.
Predefined Configurations:
Reuse of Existing IRS:
The T-REX Factory can reuse an existing IRS if it needs to be shared with other tokens. If not, it will create a new IRS. This flexibility allows for efficient use of resources and better integration with existing infrastructure.
Upgradeable Proxies:
All contracts deployed by the T-REX Factory are implemented as upgradeable proxies (beacon proxies). This design ensures that contracts can be updated without requiring redeployment, providing a future-proof solution.
Cross-Chain Consistency:
Using the CREATE2 opcode, the T-REX Factory ensures that contracts can be deployed at the same address across different EVM chains. This consistency is crucial for cross-chain interoperability and seamless integration.
Linked to IdFactory:
The T-REX Factory is linked to the IdFactory, which it uses to deploy ONCHAINID contracts. When deploying a T-REX suite, the factory generates an AssetID (the onchain identity of the tokenized asset), ensuring that each tokenized asset has a unique and verifiable identity.
Cross-Chain Deployment:
By leveraging the CREATE2 opcode, the T-REX Factory deploys contracts at predetermined addresses, ensuring that the same address can be used across different EVM chains. This feature supports the seamless use of claims and credentials across multiple networks.
Integration with Other Components:
The T-REX Factory integrates with the IdFactory to deploy ONCHAINIDs, generating unique identities for tokenized assets. It also interacts with implementation authority contracts to ensure that the correct contract versions are used.
The T-REX Factory interface defines the set of functions and events used to deploy and manage the T-REX suite of contracts. Below is a detailed breakdown of each function and event, explaining its purpose, source, and functionality. Additionally, the structs TokenDetails and ClaimDetails are defined to provide a comprehensive understanding of how to interact with the T-REX Factory contract.
Structs
TokenDetails
Description: This struct holds all the necessary details for deploying a new T-REX token and its associated contracts.
ClaimDetails
Description: This struct holds all the necessary details regarding the claims and claim issuers.
Deployed
Event
Description: Emitted whenever a single contract is deployed by the factory.
IdFactorySet
Event
Description: Emitted when the Identity Factory is set.
ImplementationAuthoritySet
Event
Description: Emitted when the implementation authority of the factory contract is set.
TREXSuiteDeployed
Event
Description: Emitted by the factory when a full suite of T-REX contracts is deployed.
setImplementationAuthority
Source: ITREXFactory
Description: Sets the implementation authority contract address. This contract contains the addresses of all implementation contracts. The proxies created by the factory will use the different implementations available in the implementation authority contract. Only callable by the owner of the T-REX Factory contract. Emits an ImplementationAuthoritySet event.
setIdFactory
Source: ITREXFactory
Description: Sets the identity factory contract address. The identity factory contract is used by the T-REX Factory to deploy the ONCHAINID of the token in case the ONCHAINID is not specified. Only callable by the owner of the T-REX Factory contract. Emits an IdFactorySet event.
deployTREXSuite
Source: ITREXFactory
Description: Deploys a new T-REX token and sets all the parameters as required by the issuer paperwork. This function will deploy and set the Token, Identity Registry (IR), Identity Registry Storage (IRS), Claim Topics Registry (CTR), Trusted Issuers Registry (TIR), and Compliance contracts. All contracts are deployed using the CREATE2 opcode, ensuring that they are deployed at a predetermined address. Only callable by the owner of the T-REX Factory contract. Emits a TREXSuiteDeployed event.
recoverContractOwnership
Source: ITREXFactory
Description: Recovers the ownership of contracts owned by the factory. Typically used for IRS contracts owned by the factory. Only callable by the owner of the T-REX Factory contract.
getImplementationAuthority
Source: ITREXFactory
Description: Returns the address of the implementation authority contract.
getIdFactory
Source: ITREXFactory
Description: Returns the address of the identity factory contract.
getToken
Source: ITREXFactory
Description: Returns the address of the token corresponding to a given salt string.
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
}struct ClaimDetails {
uint256[] claimTopics; // Claim topics required
address[] issuers; // Trusted issuers addresses
uint256[][] issuerClaims; // Claims that issuers are allowed to emit
}event Deployed(address indexed _addr);event IdFactorySet(address _idFactory);event ImplementationAuthoritySet(address _implementationAuthority);event TREXSuiteDeployed(address indexed _token, address _ir, address _irs, address _tir, address _ctr, address _mc, string indexed _salt);function setImplementationAuthority(address _implementationAuthority) external;function setIdFactory(address _idFactory) external;function deployTREXSuite(
string memory _salt,
TokenDetails calldata _tokenDetails,
ClaimDetails calldata _claimDetails
) external;function recoverContractOwnership(address _contract, address _newOwner) external;function getImplementationAuthority() external view returns(address);function getIdFactory() external view returns(address);function getToken(string calldata _salt) external view returns(address);The T-REX Gateway is an essential smart contract in the T-REX protocol, designed to provide flexible and secure access to the T-REX Factory. By acting as an intermediary, the T-REX Gateway manages who can deploy tokens, under what conditions, and with what specific rules. This architecture not only enhances security but also allows for dynamic access management without modifying the factory itself.
Flexibility and Control:
By managing access and deployment rules, the Gateway provides a flexible and secure way to control token deployment without modifying the T-REX Factory.
Enhanced Security:
The controlled generation of deployment salts and role-based access control prevent unauthorized deployments and mitigate cross-chain vulnerabilities.
Interoperability:
Deployed at the same address across multiple chains, the Gateway ensures consistent and seamless token deployment, enhancing interoperability within the T-REX ecosystem.
Access Management:
The T-REX Gateway acts as the owner of the T-REX Factory, granting it the ability to control token deployment. It defines multiple roles with different permissions, ensuring that only authorized entities can deploy tokens.
Role-Based Access Control:
Managing Deployment Access:
The Gateway sets the factory contract address, controls public deployment status, and manages deployment fees. It adds and removes deployers and agents, ensuring that only authorized addresses can deploy tokens.
Defining Deployment Rules:
T-REX Factory: The Gateway acts as the owner of the Factory, controlling who can deploy tokens and under what conditions.
Utility Token: The Gateway manages the payment of deployment fees in a specified utility token or stablecoin, ensuring a standardized process for all deployments.
Owner Role: Super admin with full control, including transferring ownership of the Factory to a new gateway.
Agent Role: Agents can add deployers, deploy tokens, and apply fee discounts. They can operate even when public deployments are disabled.
Deployer Role: Deployers can deploy tokens for token owners, subject to applicable fees and discounts.
Public Address: General users who can deploy tokens when public deployments are enabled. They must pay the required fees and can only deploy for themselves.
Fee Management:
The Gateway can define fees for deploying tokens, which must be paid in a specified utility token or stablecoin. It also allows for discounts to be applied by agents, making the deployment free if necessary.
Enhanced Security:
To prevent cross-chain vulnerabilities, the Gateway controls the salt used in deployments. By generating the salt from a hash of the token owner address and the token name, it ensures that tokens cannot be duplicated across different chains.
Cross-Chain Consistency:
Like the T-REX Factory, the Gateway is deployed at the same address on every EVM-compatible chain where the protocol is implemented. This consistency ensures seamless integration and interoperability across multiple networks.
Deploying Tokens:
When a deployment request is made, the Gateway checks the caller's permissions, calculates any applicable fees, and processes the deployment through the T-REX Factory. The salt used for deployment is derived to ensure unique and secure token addresses.
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.
ClaimDetails
Description: Holds all necessary details regarding the claims and claim issuers.
Fee
Description: Holds the details for deployment fees.
FactorySet
Event
Description: Emitted when the factory variable is set or modified.
PublicDeploymentStatusSet
Event
Description: Emitted when the public deployment status is set or modified.
DeploymentFeeSet
Event
Description: Emitted when the deployment fees details are set or modified.
DeploymentFeeEnabled
Event
Description: Emitted when the deployment fees are enabled or disabled.
DeployerAdded
Event
Description: Emitted when an address is flagged as a deployer.
DeployerRemoved
Event
Description: Emitted when a deployer address loses deployment privileges.
FeeDiscountApplied
Event
Description: Emitted when a discount on deployment fees is granted for an address.
GatewaySuiteDeploymentProcessed
Event
Description: Emitted whenever a TREX token has been deployed by the TREX factory through the use of the Gateway.
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.
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.
transferFactoryOwnership
Description: Transfers the ownership of the Factory contract. Only the owner can call this method.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
getPublicDeploymentStatus
Description: Retrieves the current public deployment status.
getFactory
Description:
Retrieves the address of the current Factory contract.
getDeploymentFee
Description: Retrieves the current deployment fee details.
isDeploymentFeeEnabled
Description: Checks if the deployment fee is currently enabled.
isDeployer
Description: Checks if the provided address is an approved deployer.
calculateFee
Description: Calculates the deployment fee for a given deployer after accounting for any discounts.
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
}All ERC3643 association members have access to our official contract factories and gateways deployed across all supported networks. These contracts are deployed with the same addresses on every chain, ensuring a consistent deployment environment for all members.
Our production deployments are available on the following networks:
Ethereum
Polygon
Hedera
Arbitrum
Avalanche
Telos EVM
Base
Kaia
Note: In addition, we maintain deployments on various testing networks. However, for production use only whitelisted wallets from association members are permitted to deploy contracts.
We have separated our deployments into two distinct suites designed for different use cases:
ONCHAINID is our standard identity solution. It is supported by the following official contracts:
Factory: IdFactory
Address: 0x23b64FBc42Ef1775F8A099965659c4c5C91e0CeC
Gateway: Gateway
Address: 0xa974c2e2fa9bbc14f4d13413e1AAcB5Fe446Cdac
Deployment Details: The ONCHAINID Gateway features a public function that allows the deployment of identities. However, note that this function can only be triggered by the ONCHAINID owner. To deploy ONCHAINIDs on behalf of end users, only whitelisted association members are permitted to perform such actions.
T-REX is the main protocol within ERC-3643. The official T-REX Factory and Gateway enable users to deploy the complete ERC-3643 token suite in one single transaction—ensuring that everything is properly configured and that the token is ready to be used immediately.
This streamlined deployment process is designed to eliminate technical hurdles for developers. By using the official factory, you benefit from deployments that are properly executed, audited, and battle tested, which significantly enhances trust and reliability within the ecosystem. It is supported by the following official contracts:
Factory: TREXFactory
Address: 0x7F1fD450a5c4d91286f00F3297dCD5C12767f17f
Gateway: TREXGateway
Address: 0x5FCC3D713dbc8252095E62Af98e62D14D0Be27dB
For now, public deployments are not enabled on the official factories and gateways. Deployments are restricted to wallets that have been explicitly whitelisted for association members. This measure applies to both ONCHAINID and T-REX.
If you are a member of the ERC3643 association and wish to deploy via these official channels, please follow these steps:
Contact Your Point of Contact: Reach out to your association representative with your wallet address and the networks you want to get access to.
Provide Required Details: Include any necessary identification or association credentials along with your request.
Await Whitelisting: Once your details have been verified, your wallet will be added to the authorized list.
After being whitelisted, you will be able to deploy contracts from the official factories through their respective gateways.
struct ClaimDetails {
uint256[] claimTopics; // Claim topics required
address[] issuers; // Trusted issuers addresses
uint256[][] issuerClaims; // Claims that issuers are allowed to emit
}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
}event FactorySet(address indexed factory);event PublicDeploymentStatusSet(bool indexed publicDeploymentStatus);event DeploymentFeeSet(uint256 indexed fee, address indexed feeToken, address indexed feeCollector);event DeploymentFeeEnabled(bool indexed isEnabled);event DeployerAdded(address indexed deployer);event DeployerRemoved(address indexed deployer);event FeeDiscountApplied(address indexed deployer, uint16 discount);event GatewaySuiteDeploymentProcessed(address indexed requester, address intendedOwner, uint256 feeApplied);function setFactory(address factory) external;function setPublicDeploymentStatus(bool _isEnabled) external;function transferFactoryOwnership(address _newOwner) external;function enableDeploymentFee(bool _isEnabled) external;function setDeploymentFee(uint256 _fee, address _feeToken, address _feeCollector) external;function addDeployer(address deployer) external;function batchAddDeployer(address[] calldata deployers) external;function removeDeployer(address deployer) external;function batchRemoveDeployer(address[] calldata deployers) external;function applyFeeDiscount(address deployer, uint16 discount) external;function batchApplyFeeDiscount(address[] calldata deployers, uint16[] calldata discounts) external;function deployTREXSuite(
ITREXFactory.TokenDetails memory _tokenDetails,
ITREXFactory.ClaimDetails memory _claimDetails
) external;function batchDeployTREXSuite(
ITREXFactory.TokenDetails[] memory _tokenDetails,
ITREXFactory.ClaimDetails[] memory _claimDetails
) external;function getPublicDeploymentStatus() external view returns(bool);function getFactory() external view returns(address);function getDeploymentFee() external view returns(Fee memory);function isDeploymentFeeEnabled() external view returns(bool);function isDeployer(address deployer) external view returns(bool);function calculateFee(address deployer) external view returns(uint256);