Tokens Gateway

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.

Key Features of the T-REX Gateway

  1. 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.

  2. Role-Based Access Control:

    • The T-REX Gateway defines several roles:

      • 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.

  3. 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.

  4. 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.

  5. 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.

How the T-REX Gateway Works

  1. 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.

  2. Defining Deployment Rules:

    • The Gateway allows the owner to set detailed rules for deployment, including enabling or disabling public deployments, setting deployment fees, and applying discounts. This flexibility ensures that deployment conditions can be tailored to meet specific requirements.

  3. 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.

Interaction with Other Components

  • 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.

Benefits of the T-REX Gateway

  1. 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.

  2. Enhanced Security:

    • The controlled generation of deployment salts and role-based access control prevent unauthorized deployments and mitigate cross-chain vulnerabilities.

  3. Interoperability:

    • Deployed at the same address across multiple chains, the Gateway ensures consistent and seamless token deployment, enhancing interoperability within the T-REX ecosystem.

Last updated

Logo

ERC3643 ASBL - 2024 - contact@erc3643.org