MultiRewards
MultiRewards is the staking and rewards distribution contract. Users stake vault shares here to earn rewards.
Read Functions
Staking Balances
stakingToken() → address
Returns the vault shares token address that users stake.
totalSupply() → uint256
Returns total staked vault shares in the contract.
balanceOf(address account) → uint256
Returns the staked balance for an account.
Reward Calculations
earned(address account, address _rewardsToken) → uint256
Returns the gross earned rewards for an account (before fees).
earnedAfterFees(address account, address _rewardsToken) → uint256
Returns earned rewards after fee deduction.
- For fee tokens: returns user's rebate portion only
- For non-fee tokens: returns full amount
rewardPerToken(address _rewardsToken) → uint256
Returns the current reward per token value.
getRewardForDuration(address _rewardsToken) → uint256
Returns total rewards for the current duration period.
State
paused() → bool
Returns true if the contract is paused.
Write Functions
stake(uint256 amount)
Stakes vault shares to earn rewards.
- Requires: not paused, amount > 0
- Transfers staking tokens from caller
withdraw(uint256 amount)
Withdraws staked vault shares.
- Requires: amount > 0
- Works even when paused
getReward()
Claims all non-fee token rewards for the caller.
- Skips fee tokens (these are processed automatically by keepers)
getRewardForUser(address _user)
Claims all non-fee token rewards for a specific user.
- Anyone can call this for any user
exit()
Withdraws all staked tokens and claims all rewards in a single transaction.
Reference
sf-contracts/src/MultiRewards.sol
