Claims and withdrawals
Take principal, claim rewards, or close a position without a scheduled unlock period.
Choose an action
| Method | Effect |
|---|---|
| withdrawPrincipal(amount, receiver) | Withdraws that exact principal amount and burns the required shares, rounding shares upward. |
| claimRewards(receiver) | Pays currently claimable rewards while retaining enough shares for remaining principal. |
| withdrawAll(receiver) | Burns the entire position and pays principal plus compounded rewards. |
Principal withdrawals
The caller can withdraw only its own tracked principal. The receiver can be another nonzero address. If share rounding would erase residual value or leave remaining principal insufficiently backed, the contract reverts SharePrecisionExceeded rather than silently orphaning assets.
Withdrawing all principal does not necessarily close your position: shares representing rewards can remain. Use withdrawAll when you intend to close everything.
Reward claims
Claiming rewards reduces your share count and active assets by the paid amount. Principal remains staked. Unclaimed rewards continue to participate proportionally in reward accrual because they are part of share value. Claims with zero claimable amount revert.
Closing a position
withdrawAll clears both internal shares and tracked principal. If the withdrawing account owns all remaining shares, it receives the complete active asset balance, including rounding remainder. Locked future rewards are not part of that payment.
When the final share leaves, stream release pauses. Other accounts cannot claim your position; withdrawal and claim methods always use msg.sender as the account owner.
Practical sequence
- Read principalOf, stakedBalanceOf, and claimableRewardsOf at a recent block.
- Choose the method that matches the desired result and a valid token receiver.
- Simulate the call and submit from the wallet that owns the stake. No ERC-20 approval is needed for these vault-to-user payouts.
- Confirm the receipt and the PrincipalWithdrawn, RewardsClaimed, or PositionClosed event.
Source reference
Checked against the source shipped with this documentation. Contract calls and units are detailed in the contract reference.
Imported source files 14
Supporting contracts, interfaces, and libraries imported by the sources above, including their dependencies.