Documentation Index
Fetch the complete documentation index at: https://mintlify.com/reserve-protocol/reserve-index-dtf/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The UnstakingManager contract handles time-delayed withdrawals from StakingVaults. When a user withdraws from a vault with an unstaking delay, their tokens are held in this contract until the unlock time, after which they can be claimed.Key Features
- Time-Locked Withdrawals: Holds tokens until unlock time
- Cancel Option: Users can cancel and re-stake before unlock
- Simple Lock Management: Each withdrawal creates a numbered lock
- Immutable Configuration: Tied to specific vault and token
Lock Structure
Address that owns the lock
Amount of tokens locked
Timestamp when lock becomes claimable
Timestamp when lock was claimed (0 if unclaimed)
Functions
Create Lock
Create a new time-locked withdrawal (called only by vault).Address that will own the lock
Amount of tokens to lock
Timestamp when tokens become claimable
UnstakingManager.sol
Claim Lock
Claim tokens from an unlocked withdrawal.ID of the lock to claim
UnstakingManager.sol
Anyone can call this function, but tokens are always sent to the lock’s original owner. The lock must be past its unlock time and not already claimed.
Cancel Lock
Cancel a lock and re-stake the tokens back into the vault.ID of the lock to cancel
UnstakingManager.sol
This deposits the locked tokens back into the vault on behalf of the user. This is useful if the user changes their mind about unstaking or wants to avoid the waiting period.
View Functions
Get Lock Details
Retrieve information about a specific lock.UnstakingManager.sol
Target Token
Get the token being managed.UnstakingManager.sol
Vault
Get the associated StakingVault.UnstakingManager.sol
Events
Emitted when a new lock is createdParameters:
lockId- Unique identifier for the lockuser- Address that owns the lockamount- Amount of tokens lockedunlockTime- Timestamp when claimable
Emitted when a lock is cancelled and tokens are re-stakedParameters:
lockId- ID of the cancelled lock
Emitted when a lock is claimedParameters:
lockId- ID of the claimed lock
Errors
Thrown when caller is not authorized for the operation
Thrown when trying to claim before unlock time
Thrown when trying to claim or cancel an already-claimed lock
Usage Flow
Standard Unstaking
Cancel and Re-stake
Security Considerations
Locks cannot be transferred or traded. They are permanently tied to the original user address.
Lock ID Sequence
Counter that increments for each new lock, starting at 0