IMinterGateway
Inherits: IContinuousIndexing, IERC712
Author: M^0 Labs
Functions
updateCollateral
Updates collateral for minters
Parameters
collateral
uint256
The amount of collateral
retrievalIds
uint256[]
The list of active proposeRetrieval requests to close
metadataHash
bytes32
The hash of metadata of the collateral update, reserved for future informational use
validators
address[]
The list of validators
timestamps
uint256[]
The list of timestamps of validators' signatures
signatures
bytes[]
The list of signatures
Returns
minTimestamp
uint40
The minimum timestamp of all validators' signatures
proposeRetrieval
Proposes retrieval of minter's off-chain collateral
Parameters
collateral
uint256
The amount of collateral to retrieve
Returns
retrievalId
uint48
The unique id of created retrieval proposal
proposeMint
Proposes minting of M tokens
Parameters
amount
uint256
The amount of M tokens to mint
destination
address
The address to mint to
Returns
mintId
uint48
The unique id of created mint proposal
mintM
Executes minting of M tokens
Parameters
mintId
uint256
The id of outstanding mint proposal for minter
Returns
principalAmount
uint112
The amount of principal of owed M minted.
amount
uint240
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
minter
address
The address of the minter to burn M tokens for.
maxAmount
uint256
The max amount of M tokens to burn.
Returns
principalAmount
uint112
The amount of principal of owed M burned.
amount
uint240
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
minter
address
The address of the minter to burn M tokens for.
maxPrincipalAmount
uint256
The max amount of principal of owed M to burn.
maxAmount
uint256
The max amount of M tokens to burn.
Returns
principalAmount
uint112
The amount of principal of owed M burned.
amount
uint240
The amount of M tokens burned.
cancelMint
Cancels minting request for selected minter by validator
Parameters
minter
address
The address of the minter to cancelMint minting request for
mintId
uint256
The id of outstanding mint request
freezeMinter
Freezes minter
Parameters
minter
address
The address of the minter to freeze
Returns
frozenUntil
uint40
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
minter
address
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
minter
address
The address of the minter to deactivate.
Returns
inactiveOwedM
uint240
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
minter
address
The address of the minter.
validator
address
The address of the validator.
Returns
<none>
uint256
The last signature timestamp used.
getUpdateCollateralDigest
Returns the EIP-712 digest for updateCollateral method.
Parameters
minter
address
The address of the minter.
collateral
uint256
The amount of collateral.
retrievalIds
uint256[]
The list of outstanding collateral retrieval IDs to resolve.
metadataHash
bytes32
The hash of metadata of the collateral update, reserved for future informational use.
timestamp
uint256
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
minter
address
The address of the minter.
amount
uint240
The amount of M tokens burned.
payer
address
The address of the payer.
BurnExecuted
Emitted when M tokens are burned and an active minter's owed M balance decreased.
Parameters
minter
address
The address of the minter.
principalAmount
uint112
The principal amount of M tokens burned.
amount
uint240
The amount of M tokens burned.
payer
address
The address of the payer.
CollateralUpdated
Emitted when a minter's collateral is updated.
Parameters
minter
address
Address of the minter
collateral
uint240
The latest amount of collateral
totalResolvedCollateralRetrieval
uint240
The total collateral amount of outstanding retrievals resolved.
metadataHash
bytes32
The hash of some metadata reserved for future informational use.
timestamp
uint40
The timestamp of the collateral update, minimum of given validators' signatures.
MinterActivated
Emitted when a minter is activated.
Parameters
minter
address
Address of the minter that was activated
caller
address
Address who called the function
MinterDeactivated
Emitted when a minter is deactivated.
Parameters
minter
address
Address of the minter that was deactivated.
inactiveOwedM
uint240
Amount of M tokens owed by the minter (in an inactive state).
caller
address
Address who called the function.
MinterFrozen
Emitted when a minter is frozen.
Parameters
minter
address
Address of the minter that was frozen
frozenUntil
uint40
Timestamp until the minter is frozen
MintCanceled
Emitted when a mint proposal is canceled.
Parameters
mintId
uint48
The id of the canceled mint proposal.
minter
address
The address of the minter for which the mint was canceled.
canceller
address
The address of the validator who canceled the mint proposal.
MintExecuted
Emitted when a mint proposal is executed.
Parameters
mintId
uint48
The id of the executed mint proposal.
minter
address
The address of the minter that executed the mint.
principalAmount
uint112
The principal amount of M tokens minted.
amount
uint240
The amount of M tokens minted.
MintProposed
Emitted when a mint proposal is created.
Parameters
mintId
uint48
The id of mint proposal.
minter
address
The address of the minter that proposed the mint.
amount
uint240
The amount of M tokens to mint.
destination
address
The address to mint to.
MissedIntervalsPenaltyImposed
Emitted when a penalty is imposed on minter
for missed update collateral intervals.
Parameters
minter
address
The address of the minter.
missedIntervals
uint40
The number of update intervals missed.
penaltyAmount
uint240
The present amount of penalty charge.
UndercollateralizedPenaltyImposed
Emitted when a penalty is imposed on minter
for undercollateralization.
Parameters
minter
address
The address of the minter.
excessOwedM
uint240
The present amount of owed M in excess of allowed owed M.
timeSpan
uint40
The span of time over which the undercollateralization penalty was applied.
penaltyAmount
uint240
The present amount of penalty charge.
RetrievalCreated
Emitted when a collateral retrieval proposal is created.
Parameters
retrievalId
uint48
The id of retrieval proposal.
minter
address
The address of the minter.
amount
uint240
The amount of collateral to retrieve.
RetrievalResolved
Emitted when a collateral retrieval proposal is resolved.
Parameters
retrievalId
uint48
The id of retrieval proposal.
minter
address
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.