ERC-7641 Token
The ERC-7641 token is an upgradeable revenue-sharing token standard that extends ERC-20. It enables proportional revenue distribution via two mechanisms:
Claim-based revenue sharing (Gold tier only).
Burn-to-redeem mechanism (all holders).
The contract uses a snapshot mechanism to track token balances and revenue distribution at specific points in time.
Key Features
Upgradeable implementation using transparent proxy pattern.
Dual revenue pool system (claim pool and burn pool).
Tier-based revenue claiming rights.
Snapshot-based revenue distribution.
Revenue token-agnostic design.
Contract Details
Inheritance Structure
State Variables
Functions
Initialization and Setup
initialize(string name, string symbol, uint256 _percentClaimable, address _stakingContract, address revToken)
Purpose: Initializes the upgradeable token contract.
Access: Public, can only be called once.
Parameters:
name
: Token name.symbol
: Token symbol._percentClaimable
: Percentage for claim pool._stakingContract
: Staking contract address.revToken
: Revenue token address.
Validations:
_percentClaimable
≤ 100_stakingContract
andrevToken
contract addresses must be non-zero addresses
Revenue Distribution
snapshot()
Purpose: Creates a new revenue distribution checkpoint.
Process Flow:
Creates a new ERC-20 snapshot.
Calculates and records new revenue.
Updates the claim and burn pools.
Records current Gold tier balances.
Constraints: Minimum 1000 blocks between snapshots (configurable).
Returns: New snapshot ID.
Events Triggered:
SnapshotTaken
.
claim(uint256 snapshotId)
Purpose: Claims revenue for Gold tier holders.
Access: Gold tier only.
Process Flow:
Verifies that the caller has Gold tier status.
Calculates the claimable revenue amount for the caller.
Transfers the calculated amount of revenue tokens to the caller.
Updates the claim status to prevent duplicate claims.
Events Triggered:
RevenueClaimed
.
burn(uint256 amount)
Purpose: Burns tokens for revenue redemption.
Access: Any token holder.
Process Flow:
Calculates the redeemable revenue amount based on the
amount
of tokens to be burned.Burns the specified
amount
of IMO tokens from the caller’s balance.Transfers the corresponding amount of revenue tokens to the caller.
Events Triggered:
RevenueBurned
.
Calculation Functions
claimableRevenue(address account, uint256 snapshotId)
Purpose: Calculates claimable revenue.
Formula:
(goldBalance * claimable) / goldTotalSupply
.Returns: Claimable amount for the snapshot.
redeemableOnBurn(uint256 amount)
Purpose: Calculates redeemable amount for burning.
Formula:
burnableFromNewRevenue + burnableFromPool
.Returns: Total redeemable amount.
Administrative Functions
mint(address account, uint256 amount)
Purpose:
Mints new IMO tokens to the specified address.
Tracks Gold tier status for revenue claiming.
Primarily used during IMO token distribution.
Who can mint?
During Initial Distribution:
The
IMOSale
contract viadistributeTokens().
After Distribution:
The
IMOSale
owner can mint via proxy.
Access:
Additional:
Updates the total token supply.
Updates the recipient's balance.
Tracks the Gold tier status of the recipient for revenue claiming eligibility.
Events Triggered
Transfer
.
View Functions
claimPool()
Purpose: Returns the current claim pool balance.
burnPool()
Purpose: Returns the current burn pool balance.
revenueToken()
Purpose: Returns the revenue token address.
getCurrentSnapshotId()
Purpose: Returns the latest snapshot ID.
Events
Security Features
Access Control
onlyProxy
modifier: Restricts certain functions to proxy-only calls.onlyOwner
modifier: Limits administrative functions to the contract owner.Tier-based access: Controls access for claims based on investor tier level.
Safety Checks
Overflow protection: Prevents numerical overflow and underflow issues.
Transfer success verification: Ensures that all token transfers are successfully completed.
Revenue pool balance validation: Confirms sufficient balance in revenue pools before distribution.
Snapshot spacing requirements: Enforces minimum block spacing between snapshots.
Upgradeability
The contract uses OpenZeppelin's transparent proxy pattern:
Logic contract:
ERC7641Upgradeable
(contains the core functionality).Proxy contract:
ERC7641Proxy
(handles interactions with the logic contract).Admin contract:
ProxyAdmin
(manages proxy upgrades).
Last updated