🦥
Cozy Safety Module
  • User Guides
    • Introduction
    • User FAQs
  • Developer Guides
    • Creating a Safety Module
      • Define Safety Module Configuration
      • Deploy a Safety Module
    • Manage a Safety Module
      • Replacing Triggers
    • Safety Module Deposits
    • Safety Module Redemptions / Withdrawals
    • Safety Module States
    • Safety Module Fees
    • Safety Module Slashing
    • Shared Safety Module Functionality
    • Create a Rewards Manager
      • Define a Rewards Manager Configuration
      • Deploy a Rewards Manager
      • Reward Pool Drip Models
    • Manage a Rewards Manager
      • Deposit Rewards
      • Update a Rewards Manager Configuration
    • Stake into a Rewards Manager
      • Stake
      • Claim Rewards
      • Unstake
    • Rewards Manager Accounting
    • Rewards Manager States
    • Create a Trigger
      • UMA Trigger Factory
      • Chainlink Trigger Factory
      • Ownable Trigger Factory
    • Permissions and Authorization
    • Token Integration Guidelines
    • Contract Deployments Registry
    • Payout Vaults
  • FAQ
    • Security FAQ
Powered by GitBook
On this page
  • Using CozyRouter to unstake assets
  • Unstake mechanics
  1. Developer Guides
  2. Stake into a Rewards Manager

Unstake

Stakers can exchange their stake receipt tokens for the underlying asset they staked in the Rewards Manager (typically a Safety Module deposit receipt token). There is no delay to unstake - stakers can immediately unstake from a Rewards Manager.

Using CozyRouter to unstake assets

The recommended way to programmatically unstake assets is to call CozyRouter.unstake (see CozyRouter):

function unstake(
    IRewardsManager rewardsManager_,
    uint16 stakePoolId_,
    uint256 stakeReceiptTokenAmount,
    address receiver_
) public payable returns (uint256 stakeAssetAmount_);

This method will internally callRewardsManager.unstake.

Prior to calling this function, the user must have approved CozyRouter to a spend sufficient amount of their StakePool.stakeReceiptToken balance.

Unstake mechanics

On RewardsManager.unstake, we follow the following steps:

  • Claim rewards on behalf of the owner_, transferring the reward assets to receiver_.

  • Decrement StakePool.amount.

  • Burn the owner_'s stake receipt tokens.

  • Transfer the receiver_ the relevant amount of stake assets.

  • Emit a Unstaked event.

PreviousClaim RewardsNextRewards Manager Accounting

Last updated 9 months ago