Redemption Mechanism
The RedemptionQueue contract manages the redemption process for veMetis tokens by utilizing a queue system represented through ERC721 NFTs. This ensures that redemptions are handled in an orderly and secure manner. This part provides an overview of the redemption flow, detailing the steps users take to redeem their veMetis for METIS, as well as additional functionalities available within the contract.
Redemption Flow
The following outlines the user flow for redeeming veMetis tokens using the RedemptionQueue contract:
1. Entering the Redemption Queue
Function Involved
enterRedemptionQueue
Steps:
Approval:
The user must first approve the
RedemptionQueuecontract to transfer the desired amount ofveMetistokens on their behalf. This can be done by calling theapproveorpermitfunction on theveMetiscontract.
Initiate Redemption:
The user calls the
enterRedemptionQueuefunction, specifying the recipient address and the amount ofveMetisthey wish to redeem.Example:
redemptionQueue.enterRedemptionQueue(recipientAddress, amountToRedeem);
Token Transfer & NFT Minting:
Upon successful execution, the specified amount of
veMetisis transferred from the user to theRedemptionQueuecontract.An ERC721 NFT (
veMetisRedemptionTicket) is minted to the recipient, representing their position in the redemption queue.The NFT contains metadata such as the redemption amount, maturity timestamp, and associated fees.
Event Emitted:
EnterRedemptionQueueevent is emitted, detailing the NFT ID, sender, recipient, amount redeemed, fees, and maturity timestamp.
Outcome:
The user now holds an NFT that represents their claim to redeem
veMetisforMETISafter a specified maturity period.
2. Waiting for Maturity
Details:
Each redemption ticket NFT has a
maturitytimestamp.The user must wait until the current block timestamp surpasses the
maturitytime to proceed with redemption.
3. Redeeming the NFT for METIS
Function Involved
redeemRedemptionTicketNft
Steps:
Ensure Maturity:
The user verifies that the current time is past the
maturitytimestamp associated with their NFT.
Initiate Redemption:
The user calls the
redeemRedemptionTicketNftfunction, providing the NFT ID and the recipient address.Example:
redemptionQueue.redeemRedemptionTicketNft(nftId, recipientAddress);
Burning & Token Transfer:
The NFT is burned, marking the redemption as completed.
The corresponding amount of
METISis transferred to the recipient.
Event Emitted:
RedeemRedemptionTicketNftevent is emitted, detailing the NFT ID, sender, recipient, and amount redeemed.
Outcome:
The user receives the specified amount of
METIStokens.
4. Optional: Canceling the Redemption
Function Involved
cancelRedemptionTicketNft
Steps:
Initiate Cancellation:
Before the
maturitytimestamp, the user can choose to cancel their redemption by calling thecancelRedemptionTicketNftfunction with the NFT ID and recipient address.Example:
redemptionQueue.cancelRedemptionTicketNft(nftId, recipientAddress);
Fee Assessment:
A cancellation fee (
cancelRedemptionFee) is calculated based on the redemption amount.The fee is deducted from the redeemed amount.
Token Transfers & NFT Burning:
The remaining
veMetisis transferred back to the user after deducting the fee.The NFT is burned, marking the redemption as canceled.
Event Emitted:
CancelRedemptionTicketNftevent is emitted, detailing the NFT ID, sender, recipient, amount returned, and cancellation fee.
Outcome:
The user retrieves their
veMetisminus the cancellation fee, and the redemption queue position is revoked.
5. Optional: Reducing Redemption Maturity
Function Involved
reduceRedemptionMaturity
Steps:
Provide LP Tokens:
The user can reduce the waiting period (
maturity) by providing Liquidity Provider (LP) tokens.They must specify the NFT ID, LP token address, and the amount of LP tokens to lock.
Initiate Reduction:
Call the
reduceRedemptionMaturityfunction with the necessary parameters.Example:
redemptionQueue.reduceRedemptionMaturity(nftId, lpTokenAddress, lpAmount);
Maturity Adjustment:
The
maturitytimestamp is reduced based on the provided LP tokens and predefined factors.The LP tokens are locked in the contract until a specific lock maturity timestamp.
Event Emitted:
ReduceRedemptionMaturityevent is emitted, detailing the NFT ID, LP token details, reduced time, and new maturity timestamp.
Outcome:
The user can redeem their
METISearlier by locking up LP tokens, enhancing flexibility in managing their redemption.
6. Optional: Unlocking LP Tokens
Function Involved
unlockLpToken
Steps:
Wait for LP Lock Maturity:
After reducing the maturity, the LP tokens are locked for a specified duration (
reduceMaturityStakeSecs).
Initiate Unlock:
Once the lock period has passed, the user can call the
unlockLpTokenfunction with their NFT ID.Example:
redemptionQueue.unlockLpToken(nftId);
LP Token Transfer:
The locked LP tokens are transferred back to the user.
The NFT is burned if there are no remaining redemption claims.
Event Emitted:
UnlockLpTokenevent is emitted, detailing the NFT ID and LP token details.
Outcome:
The user retrieves their locked LP tokens after the lock period, completing the reduced maturity process.
7. Collecting Redemption Fees
Function Involved
collectRedemptionFees
Steps:
Initiate Collection:
Authorized roles (
TimeLockorAdmin) can callcollectRedemptionFeesto withdraw accrued redemption fees.
Fee Transfer:
The specified fee amount is transferred to the protocol's treasury.
Event Emitted:
CollectRedemptionFeesevent is emitted, detailing the recipient and the amount collected.
Outcome:
The protocol efficiently manages and collects fees generated from redemptions.
Summary of Events
EnterRedemptionQueue: Emitted when a user enters the redemption queue by minting an NFT.RedeemRedemptionTicketNft: Emitted upon successful redemption of the NFT forMETIS.CancelRedemptionTicketNft: Emitted when a user cancels their redemption, detailing the fees incurred.ReduceRedemptionMaturity: Emitted when a user reduces the redemption waiting period using LP tokens.UnlockLpToken: Emitted when LP tokens are unlocked and returned to the user.CollectRedemptionFees: Emitted when the protocol collects redemption fees.
Last updated