Inherits: IMToken, ContinuousIndexing, ERC20Extended
Author: M^0 Labs
ERC20 M Token.
The address of the Minter Gateway contract.
The address of the TTG Registrar contract.
The total non-earning supply of M Token.
The principal of the total earning supply of M Token.
The balance of M for non-earner or principal of earning M balance for earners.
Modifier to check if caller is Minter Gateway.
Constructs the M Token contract.
Parameters
ttgRegistrar_
address
The address of the TTG Registrar contract.
minterGateway_
address
The address of Minter Gateway.
Mints tokens.
Parameters
account_
address
amount_
uint256
Burns tokens.
Parameters
account_
address
amount_
uint256
Starts earning for caller if allowed by TTG.
Stops earning for caller.
Stops earning for caller.
The address of TTG approved earner rate model.
The current value of earner rate in basis points.
The total earning supply of M Token.
Returns the amount of tokens in existence.
The principal of an earner M token balance.
Parameters
account_
address
Returns
balance_
uint240
The principal balance of the account.
Returns the amount of tokens owned by account
.
Checks if account is an earner.
Parameters
account_
address
Returns
isEarning_
bool
True if account is an earner, false otherwise.
The current index that would be written to storage if updateIndex
is called.
Adds principal to _balances
of an earning account.
Parameters
account_
address
The account to add principal to.
principalAmount_
uint112
The principal amount to add.
Adds amount to _balances
of a non-earning account.
Parameters
account_
address
The account to add amount to.
amount_
uint240
The amount to add.
Burns amount of earning or non-earning M from account.
Parameters
account_
address
The account to burn from.
amount_
uint256
The present amount to burn.
Mints amount of earning or non-earning M to account.
Parameters
recipient_
address
The account to mint to.
amount_
uint256
The present amount to mint.
Starts earning for account.
Parameters
account_
address
The account to start earning for.
Stops earning for account.
Parameters
account_
address
The account to stop earning for.
Subtracts principal from _balances
of an earning account.
Parameters
account_
address
The account to subtract principal from.
principalAmount_
uint112
The principal amount to subtract.
Subtracts amount from _balances
of a non-earning account.
Parameters
account_
address
The account to subtract amount from.
amount_
uint240
The amount to subtract.
Transfer M between both earning and non-earning accounts.
Parameters
sender_
address
The account to transfer from. It can be either earning or non-earning account.
recipient_
address
The account to transfer to. It can be either earning or non-earning account.
amount_
uint256
The present amount to transfer.
Transfer M between same earning status accounts.
Parameters
sender_
address
The account to transfer from.
recipient_
address
The account to transfer to.
amount_
uint240
The amount (present or principal) to transfer.
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
principalAmount_
uint112
The principal amount.
Returns
<none>
uint240
The present amount.
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
principalAmount_
uint112
The principal amount.
index_
uint128
An index
Returns
<none>
uint240
The present amount.
Checks if earner was approved by TTG.
Parameters
account_
address
The account to check.
Returns
<none>
bool
True if approved, false otherwise.
Gets the current earner rate from TTG approved rate model contract.
Returns
rate_
uint32
The current earner rate.
Reverts if the amount of a mint
or burn
is equal to 0.
Parameters
amount_
uint256
Amount to check.
Reverts if the recipient of a mint
or transfer
is address(0).
Parameters
recipient_
address
Address of the recipient to check.
MToken balance struct.
Properties
isEarning
bool
True if the account is earning, false otherwise.
rawBalance
uint240
Balance (for a non earning account) or balance principal (for an earning account).