Redemption Mechanism

The vault contract manages the redemption process for veSTRK tokens by utilizing a queue system represented through a redeem ticket. 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 veSTRK for STRK, as well as additional functionalities available within the contract. Redemption Flow

The following outlines the user flow for redeeming veSTRK tokens using the vault contract:

1. Entering the Redemption Queue

Function Involved

initiate_withdrawal

Steps:

  1. Approval:

    • The user must first approve the vault contract to transfer the desired amount of veSTRK tokens on their behalf. This can be done by calling the approve function on the vault contract.

  2. Initiate Redemption:

    • The user calls the initiate_withdrawal function, specifying the amount of veSTRK they wish to redeem.

    • Example:

      contract.initiate_withdrawal(amountToRedeem);
  3. Token Transfer & NFT Minting:

    • Upon successful execution, the specified amount of veSTRK is transferred from the user to the vault contract.

    • A redeem ticket is minted to the recipient, representing their position in the redemption queue.

    • The ticket contains metadata such as the redemption amount, maturity timestamp, and associated fees.

  4. Event Emitted:

    • IntitatedWithdrawlevent is emitted, detailing the ticket, sender, recipient, amount redeemed, fees, and maturity timestamp.

Outcome:

  • The user now holds a ticket that represents their claim to redeem veSTRK for STRK after a specified maturity period.

2. Waiting for Maturity

Details:

  • Each redemption ticket has a maturity timestamp.

  • The user must wait until the current block timestamp surpasses the maturity time to proceed with redemption.

3. Redeeming the Ticket for STRK

Function Involved

complete_withdrawal

Steps:

  1. Ensure Maturity:

    • The user verifies that the current time is past the maturity timestamp associated with their ticket.

  2. Initiate Redemption:

    • The user calls the complete_withdrawal function, providing the ticket ID and the recipient address.

    • Example:

      contract.complete_withdrawal(ticketId, recipientAddress);
  3. Burning & Token Transfer:

    • The ticket is burned, marking the redemption as completed.

    • The corresponding amount of STRK is transferred to the recipient.

Outcome:

  • The user receives the specified amount of STRK tokens.

Last updated