Skip to content

Trade-Private Token Smart Contract (ERC-3643) ​

Overview ​

The TradeToken smart contract is the ERC-3643 implementation (an extension of ERC-20), deployed on the private EVM network. It serves as the TRADE-P token for the SecureTrade platform, operating in a 1:1 peg with TRADE-S tokens locked in individual user Collateral Vaults on the public EVM network. TRADE-P tokens are minted when TRADE-S tokens are deposited into user Collateral Vaults, and burned when they are withdrawn. The minting and burning process is managed by the Treasury Service.

This contract interacts with:

  • Trusted Treasury Service, which triggers minting, burning, and listens for withdrawals.
  • Depositors (e.g., buyer), who receive TRADE-P tokens in their Pledge Credit after depositing TRADE-S tokens in their Collateral Vaults.
  • Withdrawers (e.g., sellers), who burn Trade Tokens to withdraw underlying crypto collateral.
  • CollateralManager smart contract, for collateral token operations.

Key Functionalities ​

1. ERC-3643 Compliance ​

  • Extends ERC-20 with ERC-3643 features (e.g., identity management, compliance).
  • Supports standard ERC-20 functions (transfer, approve, transferFrom).

2. 1:1 Peg with Collateral Vaults ​

  • Mints TRADE-P tokens 1:1 when TRADE-S tokens are deposited into user Collateral Vaults on the public EVM network.
  • Burns TRADE-P tokens via withdraw or burn when the underlying TRADE-S tokens are withdrawn from Collateral Vaults.
  • Managed by the Treasury Service for secure cross-chain operations.

3. Treasury Service Management ​

  • Restricts minting and burning to the Treasury Service through Safe contracts .
  • Allows the Platform Admin to update the Treasury Service address.

4. Token Metadata ​

  • Maintains metadata like Name, symbol, and decimals: 18.

5. Overleverage Tracking ​

  • Tracks overleveraged amounts for users when burns due to defaults cause capital erosion.

Roles ​

  • Platform Admin (admin): Sets and updates the Treasury Service address.
  • Treasury Service (TreasuryService): Triggers minting, burning, and listens to withdrawals.
  • Buyers: Receive TRADE-P tokens in Pledge Credit after depositing TRADE-S tokens in Collateral Vaults.
  • Sellers: Receive TRADE-P tokens in Escrow when PayPledges are issued to them.
  • Collateral Vault Contract (collateralVault): Holds TRADE-S tokens in individual user vaults on the public EVM network.

Events ​

  • Minted(address indexed to, uint256 amount): Emitted on minting TRADE-P tokens.
  • Burned(address indexed from, uint256 amount): Emitted on burning TRADE-P tokens.
  • Withdraw(address indexed from, uint256 amount): Emitted when a user burns tokens to request a withdrawal, listened for by the Treasury Service.
  • BalanceAdjusted(address indexed from, uint256 burnedAmount, uint256 overleveragedAmount): Emitted when the Treasury Service burns tokens and tracks overleverage.

Contract Structure ​

State Variables ​

  • address public admin: Contract admin (Platform Admin) address.
  • string public name: "Trade Private".
  • string public symbol: "TRADE-P".
  • uint8 public decimals: 18.
  • uint256 public totalSupply: Total TRADE-P tokens.
  • mapping(address => uint256) public balanceOf: Token balances.
  • mapping(address => mapping(address => uint256)) public allowance: Spender allowances.
  • mapping(address => uint256) public overleveragedAmounts: Overleveraged balances.

Functions ​

Constructor ​

  • constructor(address _admin, address _collateralVault):
    • Sets admin, collateralVault, name, symbol, decimals.

Public Functions ​

  • withdraw(uint256 amount):
    • Burns amount from caller to request a withdrawal.
    • Emits Burned, Withdraw.

ERC-20/ERC-3643 Functions ​

  • transfer(address to, uint256 amount) external returns (bool): Transfers tokens, reduces overleveragedAmounts if applicable.
  • approve(address spender, uint256 amount) external returns (bool): Approves spending.
  • transferFrom(address from, address to, uint256 amount) external returns (bool): Transfers via allowance.

Security Considerations ​

  • Token Safety: ERC-3643 compliance; overleverage tracking prevents abuse.
  • Reentrancy: Protected via ReentrancyGuard.

Dependencies ​

  • OpenZeppelin: Ownable, ReentrancyGuard, ERC20.
  • External: CollateralVault on public EVM network.

Deployment ​

  • Network: Private EVM network.
  • Parameters: _admin.