SpoolStaking.sol
Implementation of the {ISpoolStaking} interface.
An adaptation of the Synthetix StakingRewards contract to support multiple tokens: https://github.com/Synthetixio/synthetix/blob/develop/contracts/StakingRewards.sol At stake, gradual voSPOOL (Spool DAO Voting Token) is minted and accumulated every week. At unstake all voSPOOL is burned. The maturing process of voSPOOL restarts.
function addToken(contract IERC20 token, uint32 rewardsDuration, uint256 reward) external nonpayable
Allows a new token to be added to the reward system
Emits an {TokenAdded} event indicating the newly added reward token and configuration Requirements: - the caller must be the reward Spool DAO - the reward duration must be non-zero - the token must not have already been added
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
rewardsDuration | uint32 | undefined |
reward | uint256 | undefined |
function allowUnstakeFor(address allowFor) external nonpayable
Allow unstake for
allowFor
addressRequirements: - the caller must be the Spool DAO or address that staked for
allowFor
addressName | Type | Description |
---|---|---|
allowFor | address | address to allow unstaking for |
function balances(address) external view returns (uint256)
Account SPOOL staked balance
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function canStakeFor(address) external view returns (bool)
Whitelist showing if address can stake for another address
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
function compound(bool doCompoundVoSpoolRewards) external nonpayable
Name | Type | Description |
---|---|---|
doCompoundVoSpoolRewards | bool | undefined |
function earned(contract IERC20 token, address account) external view returns (uint256)
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
account | address | undefined |
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function getActiveRewards(bool doClaimVoSpoolRewards) external nonpayable
Name | Type | Description |
---|---|---|
doClaimVoSpoolRewards | bool | undefined |
function getRewards(contract IERC20[] tokens, bool doClaimVoSpoolRewards) external nonpayable
Name | Type | Description |
---|---|---|
tokens | contract IERC20[] | undefined |
doClaimVoSpoolRewards | bool | undefined |
function getUpdatedVoSpoolRewardAmount() external nonpayable returns (uint256 rewards)
Name | Type | Description |
---|---|---|
rewards | uint256 | undefined |
function initialize() external nonpayable
function lastTimeRewardApplicable(contract IERC20 token) external view returns (uint32)
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
Name | Type | Description |
---|---|---|
_0 | uint32 | undefined |
function notifyRewardAmount(contract IERC20 token, uint32 _rewardsDuration, uint256 reward) external nonpayable
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
_rewardsDuration | uint32 | undefined |
reward | uint256 | undefined |
function recoverERC20(contract IERC20 tokenAddress, uint256 tokenAmount, address recoverTo) external nonpayable
Name | Type | Description |
---|---|---|
tokenAddress | contract IERC20 | undefined |
tokenAmount | uint256 | undefined |
recoverTo | address | undefined |
function removeReward(contract IERC20 token) external nonpayable
Remove reward from vault rewards configuration.
Used to sanitize vault and save on gas, after the reward has ended. Users will be able to claim rewards Requirements: - the caller must be the spool owner or Spool DAO - cannot claim vault underlying token - cannot only execute if the reward finished
Name | Type | Description |
---|---|---|
token | contract IERC20 | Token address to remove |
function rewardConfiguration(contract IERC20) external view returns (uint32 rewardsDuration, uint32 periodFinish, uint192 rewardRate, uint32 lastUpdateTime, uint224 rewardPerTokenStored)
Reward token configurations
Name | Type | Description |
---|---|---|
_0 | contract IERC20 | undefined |
Name | Type | Description |
---|---|---|
rewardsDuration | uint32 | undefined |
periodFinish | uint32 | undefined |
rewardRate | uint192 | undefined |
lastUpdateTime | uint32 | undefined |
rewardPerTokenStored | uint224 | undefined |
function rewardDistributor() external view returns (contract IRewardDistributor)
Spool reward distributor
Name | Type | Description |
---|---|---|
_0 | contract IRewardDistributor | undefined |
function rewardPerToken(contract IERC20 token) external view returns (uint224)
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
Name | Type | Description |
---|---|---|
_0 | uint224 | undefined |
function rewardTokens(uint256) external view returns (contract IERC20)
Reward tokens
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
Name | Type | Description |
---|---|---|
_0 | contract IERC20 | undefined |
function rewardTokensCount() external view returns (uint256)
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function setCanStakeFor(address account, bool _canStakeFor) external nonpayable
Allow an address to stake for another address.
Requirements: - the caller must be the distributor
Name | Type | Description |
---|---|---|
account | address | Address to allow |
_canStakeFor | bool | True to allow, false to remove allowance |
function stake(uint256 amount) external nonpayable
Name | Type | Description |
---|---|---|
amount | uint256 | undefined |
function stakeFor(address account, uint256 amount) external nonpayable
Name | Type | Description |
---|---|---|
account | address | undefined |
amount | uint256 | undefined |
function stakedBy(address) external view returns (address)
Mapping showing if and what address staked for another address
if address is 0, noone staked for address (or unstaking was permitted)
Name | Type | Description |
---|---|---|
_0 | address | undefined |
Name | Type | Description |
---|---|---|
_0 | address | undefined |
function stakingToken() external view returns (contract IERC20)
SPOOL token address
Name | Type | Description |
---|---|---|
_0 | contract IERC20 | undefined |
function tokenBlacklist(contract IERC20) external view returns (bool)
Blacklisted force-removed tokens
Name | Type | Description |
---|---|---|
_0 | contract IERC20 | undefined |
Name | Type | Description |
---|---|---|
_0 | bool | undefined |
function totalStaked() external view returns (uint256)
Total SPOOL staked
Name | Type | Description |
---|---|---|
_0 | uint256 | undefined |
function unstake(uint256 amount) external nonpayable
Name | Type | Description |
---|---|---|
amount | uint256 | undefined |
function updatePeriodFinish(contract IERC20 token, uint32 timestamp) external nonpayable
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
timestamp | uint32 | undefined |
function voSpool() external view returns (contract IVoSPOOL)
voSPOOL token address
Name | Type | Description |
---|---|---|
_0 | contract IVoSPOOL | undefined |
function voSpoolRewards() external view returns (contract IVoSpoolRewards)
voSPOOL token rewards address
Name | Type | Description |
---|---|---|
_0 | contract IVoSpoolRewards | undefined |
event CanStakeForSet(address indexed account, bool canStakeFor)
Name | Type | Description |
---|---|---|
account indexed | address | undefined |
canStakeFor | bool | undefined |
event PeriodFinishUpdated(contract IERC20 indexed token, uint32 periodFinish)
Name | Type | Description |
---|---|---|
token indexed | contract IERC20 | undefined |
periodFinish | uint32 | undefined |
event RewardAdded(contract IERC20 indexed token, uint256 amount, uint256 duration)
Name | Type | Description |
---|---|---|
token indexed | contract IERC20 | undefined |
amount | uint256 | undefined |
duration | uint256 | undefined |
event RewardCompounded(address indexed user, uint256 reward)
Name | Type | Description |
---|---|---|
user indexed | address | undefined |
reward | uint256 | undefined |
event RewardPaid(contract IERC20 token, address indexed user, uint256 reward)
Name | Type | Description |
---|---|---|
token | contract IERC20 | undefined |
user indexed | address | undefined |
reward | uint256 | undefined |
event RewardRemoved(contract IERC20 indexed token)
Name | Type | Description |
---|---|---|
token indexed | contract IERC20 | undefined |
event RewardUpdated(contract IERC20 indexed token, uint256 amount, uint256 leftover, uint256 duration, uint32 periodFinish)
Name | Type | Description |
---|---|---|
token indexed | contract IERC20 | undefined |
amount | uint256 | undefined |
leftover | uint256 | undefined |
duration | uint256 | undefined |
periodFinish | uint32 | undefined |
event Staked(address indexed user, uint256 amount)
Name | Type | Description |
---|---|---|
user indexed | address | undefined |