IMinterGateway
Inherits: IContinuousIndexing, IERC712
Author: M^0 Labs
Functions
updateCollateral
Updates collateral for minters
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of collateral |
|
| The list of active proposeRetrieval requests to close |
|
| The hash of metadata of the collateral update, reserved for future informational use |
|
| The list of validators |
|
| The list of timestamps of validators' signatures |
|
| The list of signatures |
Returns
Name | Type | Description |
---|---|---|
|
| The minimum timestamp of all validators' signatures |
proposeRetrieval
Proposes retrieval of minter's off-chain collateral
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of collateral to retrieve |
Returns
Name | Type | Description |
---|---|---|
|
| The unique id of created retrieval proposal |
proposeMint
Proposes minting of M tokens
Parameters
Name | Type | Description |
---|---|---|
|
| The amount of M tokens to mint |
|
| The address to mint to |
Returns
Name | Type | Description |
---|---|---|
|
| The unique id of created mint proposal |
mintM
Executes minting of M tokens
Parameters
Name | Type | Description |
---|---|---|
|
| The id of outstanding mint proposal for minter |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of principal of owed M minted. |
|
| The amount of M tokens minted. |
burnM
Burns M tokens
If amount to burn is greater than minter's owedM including penalties, burn all up to owedM.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to burn M tokens for. |
|
| The max amount of M tokens to burn. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of principal of owed M burned. |
|
| The amount of M tokens burned. |
burnM
Burns M tokens
If amount to burn is greater than minter's owedM including penalties, burn all up to owedM.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to burn M tokens for. |
|
| The max amount of principal of owed M to burn. |
|
| The max amount of M tokens to burn. |
Returns
Name | Type | Description |
---|---|---|
|
| The amount of principal of owed M burned. |
|
| The amount of M tokens burned. |
cancelMint
Cancels minting request for selected minter by validator
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to cancelMint minting request for |
|
| The id of outstanding mint request |
freezeMinter
Freezes minter
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to freeze |
Returns
Name | Type | Description |
---|---|---|
|
| The timestamp until which minter is frozen |
activateMinter
Activate an approved minter.
MUST revert if minter
is not recorded as an approved minter in TTG Registrar.
MUST revert if minter
has been deactivated.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to activate |
deactivateMinter
Deactivates an active minter.
MUST revert if the minter is still approved.
MUST revert if the minter is not active.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter to deactivate. |
Returns
Name | Type | Description |
---|---|---|
|
| The inactive owed M for the deactivated minter. |
mToken
The address of M token
ttgRegistrar
The address of TTG Registrar contract.
ttgVault
The address of TTG Vault contract.
minterRate
The last saved value of Minter rate.
principalOfTotalActiveOwedM
The principal of total owed M for all active minters.
totalActiveOwedM
The total owed M for all active minters.
totalInactiveOwedM
The total owed M for all inactive minters.
totalOwedM
The total owed M for all minters.
excessOwedM
The difference between total owed M and M token total supply.
principalOfActiveOwedMOf
The principal of active owed M of minter.
activeOwedMOf
The active owed M of minter.
maxAllowedActiveOwedMOf
The max allowed active owed M of minter taking into account collateral amount and retrieval proposals.
This is the only present value that requires a uint256
since it is the result of a multiplication between a uint240
and a value that has a max of 65,000
(the mint ratio).
inactiveOwedMOf
The inactive owed M of deactivated minter.
collateralOf
The collateral of a given minter.
collateralUpdateTimestampOf
The timestamp of the last collateral update of minter.
collateralPenaltyDeadlineOf
The timestamp after which an additional penalty for a missed update interval will be charged.
collateralExpiryTimestampOf
The timestamp after which the minter's collateral is assumed to be 0 due to a missed update.
penalizedUntilOf
The timestamp until which minter is already penalized for missed collateral updates.
latestProposedRetrievalTimestampOf
The timestamp when minter
created their latest retrieval proposal.
getLastSignatureTimestamp
Returns the last signature timestamp used by validator
to update collateral for minter
.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The address of the validator. |
Returns
Name | Type | Description |
---|---|---|
|
| The last signature timestamp used. |
getUpdateCollateralDigest
Returns the EIP-712 digest for updateCollateral method.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The amount of collateral. |
|
| The list of outstanding collateral retrieval IDs to resolve. |
|
| The hash of metadata of the collateral update, reserved for future informational use. |
|
| The timestamp of the collateral update. |
mintProposalOf
The mint proposal of minters, only 1 active proposal per minter
pendingCollateralRetrievalOf
The amount of a pending retrieval request for an active minter.
totalPendingCollateralRetrievalOf
The total amount of pending retrieval requests for an active minter.
frozenUntilOf
The timestamp when minter becomes unfrozen after being frozen by validator.
isActiveMinter
Checks if minter was activated after approval by TTG
isDeactivatedMinter
Checks if minter was deactivated after removal by TTG
isFrozenMinter
Checks if minter was frozen by validator
isMinterApproved
Checks if minter was approved by TTG
isValidatorApproved
Checks if validator was approved by TTG
mintDelay
The delay between mint proposal creation and its earliest execution.
mintTTL
The time while mint request can still be processed before it is considered expired.
minterFreezeTime
The freeze time for minter.
mintRatio
The allowed activeOwedM to collateral ratio.
penaltyRate
The % that defines penalty amount for missed collateral updates or excessive owedM value
rateModel
The smart contract that defines the minter rate.
updateCollateralInterval
The interval that defines the required frequency of collateral updates.
updateCollateralValidatorThreshold
The number of signatures required for successful collateral update.
ONE
Descaler for variables in basis points. Effectively, 100% in basis points.
MAX_MINT_RATIO
Mint ratio cap. 650% in basis points.
MIN_UPDATE_COLLATERAL_INTERVAL
Update collateral interval lower cap in seconds.
UPDATE_COLLATERAL_TYPEHASH
The EIP-712 typehash for the updateCollateral
method.
Events
BurnExecuted
Emitted when M tokens are burned and an inactive minter's owed M balance decreased.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The amount of M tokens burned. |
|
| The address of the payer. |
BurnExecuted
Emitted when M tokens are burned and an active minter's owed M balance decreased.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The principal amount of M tokens burned. |
|
| The amount of M tokens burned. |
|
| The address of the payer. |
CollateralUpdated
Emitted when a minter's collateral is updated.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the minter |
|
| The latest amount of collateral |
|
| The total collateral amount of outstanding retrievals resolved. |
|
| The hash of some metadata reserved for future informational use. |
|
| The timestamp of the collateral update, minimum of given validators' signatures. |
MinterActivated
Emitted when a minter is activated.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the minter that was activated |
|
| Address who called the function |
MinterDeactivated
Emitted when a minter is deactivated.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the minter that was deactivated. |
|
| Amount of M tokens owed by the minter (in an inactive state). |
|
| Address who called the function. |
MinterFrozen
Emitted when a minter is frozen.
Parameters
Name | Type | Description |
---|---|---|
|
| Address of the minter that was frozen |
|
| Timestamp until the minter is frozen |
MintCanceled
Emitted when a mint proposal is canceled.
Parameters
Name | Type | Description |
---|---|---|
|
| The id of the canceled mint proposal. |
|
| The address of the minter for which the mint was canceled. |
|
| The address of the validator who canceled the mint proposal. |
MintExecuted
Emitted when a mint proposal is executed.
Parameters
Name | Type | Description |
---|---|---|
|
| The id of the executed mint proposal. |
|
| The address of the minter that executed the mint. |
|
| The principal amount of M tokens minted. |
|
| The amount of M tokens minted. |
MintProposed
Emitted when a mint proposal is created.
Parameters
Name | Type | Description |
---|---|---|
|
| The id of mint proposal. |
|
| The address of the minter that proposed the mint. |
|
| The amount of M tokens to mint. |
|
| The address to mint to. |
MissedIntervalsPenaltyImposed
Emitted when a penalty is imposed on minter
for missed update collateral intervals.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The number of update intervals missed. |
|
| The present amount of penalty charge. |
UndercollateralizedPenaltyImposed
Emitted when a penalty is imposed on minter
for undercollateralization.
Parameters
Name | Type | Description |
---|---|---|
|
| The address of the minter. |
|
| The present amount of owed M in excess of allowed owed M. |
|
| The span of time over which the undercollateralization penalty was applied. |
|
| The present amount of penalty charge. |
RetrievalCreated
Emitted when a collateral retrieval proposal is created.
Parameters
Name | Type | Description |
---|---|---|
|
| The id of retrieval proposal. |
|
| The address of the minter. |
|
| The amount of collateral to retrieve. |
RetrievalResolved
Emitted when a collateral retrieval proposal is resolved.
Parameters
Name | Type | Description |
---|---|---|
|
| The id of retrieval proposal. |
|
| The address of the minter. |
Errors
DeactivatedMinter
Emitted when calling activateMinter
with a minter who was previously deactivated.
ExceedsMaxRepayAmount
Emitted when repay will burn more M than the repay specified.
ExpiredMintProposal
Emitted when calling mintM
with a proposal that was created more than mintDelay + mintTTL
time ago.
FrozenMinter
Emitted when calling mintM
or proposeMint
by a minter who was frozen by validator.
FutureTimestamp
Emitted when calling updateCollateral
with any validator timestamp in the future.
InactiveMinter
Emitted when calling a function only allowed for active minters.
InvalidMintProposal
Emitted when calling cancelMint
or mintM
with invalid mintId
.
InvalidSignatureOrder
Emitted when calling updateCollateral
if validators
addresses are not ordered in ascending order.
NotApprovedMinter
Emitted when calling activateMinter
if minter was not approved by TTG.
NotApprovedValidator
Emitted when calling cancelMint
or freezeMinter
if validator
was not approved by TTG.
NotEnoughValidSignatures
Emitted when calling updateCollateral
if validatorThreshold
of signatures was not reached.
OverflowsPrincipalOfTotalOwedM
Emitted when principal of total owed M (active and inactive) will overflow a type(uint112).max
.
PendingMintProposal
Emitted when calling mintM
if mintDelay
time has not passed yet.
RetrievalsExceedCollateral
Emitted when calling proposeRetrieval
if sum of all outstanding retrievals Plus new proposed retrieval amount is greater than collateral.
SignatureArrayLengthsMismatch
Emitted when calling updateCollateral
If validators
, signatures
, timestamps
lengths do not match.
StaleCollateralUpdate
Emitted when updating collateral with a timestamp earlier than allowed.
OutdatedValidatorTimestamp
Emitted when calling updateCollateral
with any validator timestamp older than the last signature timestamp for that minter and validator.
StillApprovedMinter
Emitted when calling deactivateMinter
with a minter still approved in TTG Registrar.
Undercollateralized
Emitted when calling proposeMint
, mintM
, proposeRetrieval
If minter position becomes undercollateralized.
activeOwedM
is a uint256
because it may represent some resulting owed M from computations.
ZeroBurnAmount
Emitted when calling burnM
if amount is 0.
ZeroMToken
Emitted in constructor if M Token is 0x0.
ZeroMintAmount
Emitted when calling proposeMint
if amount is 0.
ZeroMintDestination
Emitted when calling proposeMint
if destination is 0x0.
ZeroRetrievalAmount
Emitted when calling proposeRetrieval
if collateral is 0.
ZeroTTGRegistrar
Emitted in constructor if TTG Registrar is 0x0.
ZeroTTGVault
Emitted in constructor if TTG Distribution Vault is set to 0x0 in TTG Registrar.
ZeroTimestamp
Emitted when calling updateCollateral
with any validator timestamp of 0.