Technical Implementation

Protocol

All XFT token contracts implement the ERC-20 standard, enabling the storage and transfer of tokensbalances across individual accounts. It supports additional functionalities such as minting and burning, controlled by privileged accounts, and incorporates asset freezing mechanisms to prevent financial crimes.

All XFT tokenized products implement the following ERC-20 token logic.

FEATURES
- Access control
- Rebasing token mechanism
- Minting and burning functionality
- Block/Unblock accounts
- Pausing emergency stop mechanism
- Reward multiplier system
- EIP-2612 permit support
- OpenZeppelin UUPS upgrade pattern


PUBLIC AND EXTERNAL FUNCTIONS
initialize(string memory name_, string memory symbol_, address owner): Initializes the contract.
name(): Returns the name of the token.
symbol(): Returns the symbol of the token.
decimals(): Returns the number of decimals the token uses.
convertToShares(uint256 amount): Converts an amount of tokens to shares.
convertToTokens(uint256 shares): Converts an amount of shares to tokens.
totalShares(): Returns the total amount of shares.
totalSupply(): Returns the total supply.
balanceOf(address account): Returns the account balance.
sharesOf(address account): Returns the account shares.
mint(address to, uint256 amount): Creates new tokens to the specified address.
burn(address from, uint256 amount): Destroys tokens from the specified address.
transfer(address to, uint256 amount): Transfers tokens between addresses.
blockAccounts(address[] addresses): Blocks multiple accounts at once.
unblockAccounts(address[] addresses): Unblocks multiple accounts at once.
isBlocked(address account): Checks if an account is blocked.
pause(): Pauses the contract, halting token transfers.
unpause(): Unpauses the contract, allowing token transfers.
setRewardMultiplier(uint256 _rewardMultiplier): Sets the reward multiplier.
addRewardMultiplier(uint256 _rewardMultiplierIncrement): Adds the given amount to the current reward multiplier.
approve(address spender, uint256 amount): Approves an allowance for a spender.
allowance(address owner, address spender): Returns the allowance for a spender.
transferFrom(address from, address to, uint256 amount): Moves tokens from an address to another one using the allowance mechanism.
increaseAllowance(address spender, uint256 addedValue): Increases the allowance granted to spender by the caller.
decreaseAllowance(address spender, uint256 subtractedValue): Decreases the allowance granted to spender by the caller.
DOMAIN_SEPARATOR(): Returns the EIP-712 domain separator.
nonces(address owner): Returns the nonce for the specified address.
permit(address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s): Implements EIP-2612 permit functionality.


PRIVATE AND INTERNAL FUNCTIONS
_authorizeUpgrade(address newImplementation): Internal function to authorize an upgrade.
_mint(address to, uint256 amount): Internal function to mint tokens to the specified address.
_burn(address account, uint256 amount): Internal function to burn tokens from the specified address.
_beforeTokenTransfer(address from, address to, uint256 amount): Hook that is called before any transfer of tokens.
_afterTokenTransfer(address from, address to, uint256 amount): Hook that is called after any transfer of tokens.
_transfer(address from, address to, uint256 amount): Internal function to transfer tokens between addresses.
_blockAccount(address account): Internal function to block account.
_unblockAccount(address account): Internal function to unblock an account.
_setRewardMultiplier(uint256 _rewardMultiplier): Internal function to set the reward multiplier.
_spendAllowance(address owner, address spender, uint256 amount): Internal function to spend an allowance.
_useNonce(address owner): Increments and returns the current nonce for a given address.
_approve(address owner, address spender, uint256 amount): Internal function to approve an allowance for a spender.


EVENTS
Transfer(from indexed addr, to uint256, amount uint256): Emitted when transferring tokens.
RewardMultiplier(uint256 indexed value): Emitted when the reward multiplier has changed.
Approval(address indexed owner, address indexed spender, uint256 value): Emitted when the allowance of a spender for an owner is set.
AccountBlocked(address indexed addr): Emitted when an address is blocked.
AccountUnblocked(address indexed addr): Emitted when an address is removed from the blocklist.
Paused(address account): Emitted when the pause is triggered by account.
Unpaused(address account): Emitted when the unpause is triggered by account.
Upgraded(address indexed implementation): Emitted when the implementation is upgraded.


ROLES 
DEFAULT_ADMIN_ROLE: Grants the ability to grant roles.
MINTER_ROLE: Grants the ability to mint tokens.
BURNER_ROLE: Grants the ability to burn tokens.
BLOCKLIST_ROLE: Grants the ability to manage the blocklist.
ORACLE_ROLE: Grants the ability to update the reward multiplier.
UPGRADE_ROLE: Grants the ability to upgrade the contract.
PAUSE_ROLE: Grants the ability to pause/unpause the contract.
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"sharesNeeded","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint256","name":"blockTimestamp","type":"uint256"}],"name":"ERC2612ExpiredDeadline","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"ERC2612InvalidSignature","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"USDXBlockedSender","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"sharesNeeded","type":"uint256"}],"name":"USDXInsufficientBurnBalance","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"USDXInvalidBlockedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"USDXInvalidBurnSender","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"USDXInvalidMintReceiver","type":"error"},{"inputs":[{"internalType":"uint256","name":"rewardMultiplier","type":"uint256"}],"name":"USDXInvalidRewardMultiplier","type":"error"},{"inputs":[],"name":"USDXPausedTransfers","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"AccountBlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addr","type":"address"}],"name":"AccountUnblocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"value","type":"uint256"}],"name":"RewardMultiplier","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"BLOCKLIST_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BURNER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ORACLE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PAUSE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPGRADE_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardMultiplierIncrement","type":"uint256"}],"name":"addRewardMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"blockAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"convertToShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"}],"name":"convertToTokens","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"address","name":"owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"isBlocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rewardMultiplier","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_rewardMultiplier","type":"uint256"}],"name":"setRewardMultiplier","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"sharesOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"}],"name":"unblockAccounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]

Dependencies

The contracts build their foundation on top of OpenZeppelin Contracts library, widely used and recognized battle-tested components throughout the Ethereum ecosystem:

  • AccessControlUpgradeable.sol

  • PausableUpgradeable.sol

  • UUPSUpgradeable.sol

  • CountersUpgradeable.sol

  • ECDSAUpgradeable.sol

  • EIP712Upgradeable.sol

  • IERC20PermitUpgradeable.sol

  • IERC20MetadataUpgradeable.sol

Income & Yield Distribution

XFT uses a process called "rebasing" or changing the total supply of tokens, a reward multiplier, and share-based accounting to distribute bond income to token holders. Under the hood, USDX holders own a fixed amount of shares in a mutual fund.

balanceOf(account) = shares[account] * rewardMultiplier

When underlying mutual fund assets accrue yield, XFT increases the reward multiplier. This proportionally mints additional USDX tokens to each holder's wallet based on the number of shares they own.

  • shares - map of account share of the total supply.

  • rewardMultiplier - sum of addRewardMultiplier.

Rebasing Example

If a user purchased 100 USDX tokens when the reward multiplier was 1.00, that user would receive 100 shares. If the reward multiplier was updated to reflect a 3.8% return, that user would then have 103.8 USDX tokens but still have the same 100 shares.

Time
USDX (balanceOf)
Shares
rewardMultiplier

1

100

100

1

2

103.8

100

1.038

Role-Based Access Control

The USDX contract implements a simple Role-Based Access Control (RBAC) system. This ensures that only authorized accounts can perform certain actions, enhancing security and operational integrity.

  • DEFAULT_ADMIN_ROLE: Grants the ability to grant roles.

  • MINTER_ROLE: Grants the ability to mint tokens.

  • BURNER_ROLE: Grants the ability to burn tokens.

  • BLOCKLIST_ROLE: Grants the ability to manage the blocklist.

  • ORACLE_ROLE: Grants the ability to update the reward multiplier.

  • UPGRADE_ROLE: Grants the ability to upgrade the contract.

  • PAUSE_ROLE: Grants the ability to pause/unpause the contract.

Example role assignments

Role
Function
Participants

DEFAULT_ADMIN_ROLE

Grant roles

XFT

MINTER_ROLE

Mint tokens

• Principal Underwriter • Distributor • Customer • Robinhood • Bridge • Securitize

BURNER_ROLE

Burn tokens

• Principal Underwriter • Distributor • Customer • Robinhood • Bridge • Securitize

BLOCKLIST_ROLE

Manage blocklist

Fund Administrator, KYC/AML

ORACLE_ROLE

Update reward multiplier

Investment Advisor, portfolio management

UPGRADE_ROLE

Upgrade contract

XFT

PAUSE_ROLE

Pause/unpause

• NYSE, market close • DTCC, market close • Custodian, redemption pressure • Circuit breaker mechanisms

Bond Protocol

  • Symbol: ISIN

  • Name: [issuer] [coupon] [maturity]

Example:

  • Symbol = ISIN = US48251W5004

  • Name = Ticker = KKR 6.25 03/01/28

Last updated