MToken
Inherits: IMToken, ContinuousIndexing, ERC20Extended
Author: M^0 Labs
ERC20 M Token.
State Variables
minterGateway
The address of the Minter Gateway contract.
ttgRegistrar
The address of the TTG Registrar contract.
totalNonEarningSupply
The total non-earning supply of M Token.
principalOfTotalEarningSupply
The principal of the total earning supply of M Token.
_balances
The balance of M for non-earner or principal of earning M balance for earners.
Functions
onlyMinterGateway
Modifier to check if caller is Minter Gateway.
constructor
Constructs the M Token contract.
Parameters
mint
Mints tokens.
Parameters
burn
Burns tokens.
Parameters
startEarning
Starts earning for caller if allowed by TTG.
stopEarning
Stops earning for caller.
stopEarning
Stops earning for caller.
rateModel
The address of TTG approved earner rate model.
earnerRate
The current value of earner rate in basis points.
totalEarningSupply
The total earning supply of M Token.
totalSupply
Returns the amount of tokens in existence.
principalBalanceOf
The principal of an earner M token balance.
Parameters
Returns
balanceOf
Returns the amount of tokens owned by account
.
isEarning
Checks if account is an earner.
Parameters
Returns
currentIndex
The current index that would be written to storage if updateIndex
is called.
_addEarningAmount
Adds principal to _balances
of an earning account.
Parameters
_addNonEarningAmount
Adds amount to _balances
of a non-earning account.
Parameters
_burn
Burns amount of earning or non-earning M from account.
Parameters
_mint
Mints amount of earning or non-earning M to account.
Parameters
_startEarning
Starts earning for account.
Parameters
_stopEarning
Stops earning for account.
Parameters
_subtractEarningAmount
Subtracts principal from _balances
of an earning account.
Parameters
_subtractNonEarningAmount
Subtracts amount from _balances
of a non-earning account.
Parameters
_transfer
Transfer M between both earning and non-earning accounts.
Parameters
_transferAmountInKind
Transfer M between same earning status accounts.
Parameters
_getPresentAmount
Returns the present amount (rounded down) given the principal amount, using the current index. All present amounts are rounded down in favor of the protocol.
Parameters
Returns
_getPresentAmount
Returns the present amount (rounded down) given the principal amount and an index. All present amounts are rounded down in favor of the protocol, since they are assets.
Parameters
Returns
_isApprovedEarner
Checks if earner was approved by TTG.
Parameters
Returns
_rate
Gets the current earner rate from TTG approved rate model contract.
Returns
_revertIfInsufficientAmount
Reverts if the amount of a mint
or burn
is equal to 0.
Parameters
_revertIfInvalidRecipient
Reverts if the recipient of a mint
or transfer
is address(0).
Parameters
Structs
MBalance
MToken balance struct.
Properties