Key Features and User Interactions
- Governance-Approved Yield Access: Selected accounts can earn continuous yield after Two Token Governance (TTG) approval.
- Automatic Yield: Earning balances grow continuously without requiring any user action.
- Transparency: All interest calculations occur onchain with fully transparent mechanics.
- Efficiency: A single token contract handles both stable (non-earning) and yield-generating (earning) use cases.
- Precision: Advanced mathematical techniques are employed to ensure accurate interest calculations.
- Safety Mechanisms: Protections are in place to ensure accounts removed from the
APPROVED_EARNERS
list by governance cannot continue earning.
User Interactions
Basic Token Operations
The $M token implements all standard ERC20 functions and includes additional features:
- It has 6 decimal places of precision for all operations.
- Supports standard transfers (
transfer
,transferFrom
), approvals (approve
), and balance inquiries (balanceOf
). - Includes support for EIP-2612
permit
for gasless approvals. - Includes support for EIP-3009 for transfers with authorization (
transferWithAuthorization
,receiveWithAuthorization
).
Earning Status Management
Users can interact with the earning functionality through several key functions on the MToken
contract:
startEarning()
: Converts an account's regular (non-earning) $M balance to an earning balance. This function can only be called by an account for itself, and only if that account has been approved as an Earner by M0 Governance.stopEarning()
: Converts an account's earning $M balance back to a regular (non-earning) balance. The account retains all interest accrued up to that point. This can be called by the account owner.stopEarning(address account_)
: A safety function that allows anyone to stop the earning status for a specifiedaccount_
if that account is no longer on the governance-approvedAPPROVED_EARNERS
list. This ensures that accounts cannot continue to earn yield if their approval is revoked.
Balance Querying
Several methods are available to check different aspects of $M balances:
balanceOf(address account)
: Returns the current $M balance of the account. For earning accounts, this includes all accrued interest up to the current block.principalBalanceOf(address account)
: Returns the underlying principal amount for earning accounts. For non-earning accounts, this will be 0.isEarning(address account)
: Checks if an account is currently in earning mode.totalEarningSupply()
: Returns the total amount of $M tokens (present value including accrued interest) currently held in earning balances.totalNonEarningSupply()
: Returns the total amount of $M tokens held in non-earning balances.
The totalSupply()
of $M is the sum of totalEarningSupply()
and totalNonEarningSupply()
.