Spool Tech Docs
Search
⌃K

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.

Methods

addToken

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

Parameters

Name
Type
Description
token
contract IERC20
undefined
rewardsDuration
uint32
undefined
reward
uint256
undefined

allowUnstakeFor

function allowUnstakeFor(address allowFor) external nonpayable
Allow unstake for allowFor address
Requirements: - the caller must be the Spool DAO or address that staked for allowFor address

Parameters

Name
Type
Description
allowFor
address
address to allow unstaking for

balances

function balances(address) external view returns (uint256)
Account SPOOL staked balance

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

canStakeFor

function canStakeFor(address) external view returns (bool)
Whitelist showing if address can stake for another address

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

compound

function compound(bool doCompoundVoSpoolRewards) external nonpayable

Parameters

Name
Type
Description
doCompoundVoSpoolRewards
bool
undefined

earned

function earned(contract IERC20 token, address account) external view returns (uint256)

Parameters

Name
Type
Description
token
contract IERC20
undefined
account
address
undefined

Returns

Name
Type
Description
_0
uint256
undefined

getActiveRewards

function getActiveRewards(bool doClaimVoSpoolRewards) external nonpayable

Parameters

Name
Type
Description
doClaimVoSpoolRewards
bool
undefined

getRewards

function getRewards(contract IERC20[] tokens, bool doClaimVoSpoolRewards) external nonpayable

Parameters

Name
Type
Description
tokens
contract IERC20[]
undefined
doClaimVoSpoolRewards
bool
undefined

getUpdatedVoSpoolRewardAmount

function getUpdatedVoSpoolRewardAmount() external nonpayable returns (uint256 rewards)

Returns

Name
Type
Description
rewards
uint256
undefined

initialize

function initialize() external nonpayable

lastTimeRewardApplicable

function lastTimeRewardApplicable(contract IERC20 token) external view returns (uint32)

Parameters

Name
Type
Description
token
contract IERC20
undefined

Returns

Name
Type
Description
_0
uint32
undefined

notifyRewardAmount

function notifyRewardAmount(contract IERC20 token, uint32 _rewardsDuration, uint256 reward) external nonpayable

Parameters

Name
Type
Description
token
contract IERC20
undefined
_rewardsDuration
uint32
undefined
reward
uint256
undefined

recoverERC20

function recoverERC20(contract IERC20 tokenAddress, uint256 tokenAmount, address recoverTo) external nonpayable

Parameters

Name
Type
Description
tokenAddress
contract IERC20
undefined
tokenAmount
uint256
undefined
recoverTo
address
undefined

removeReward

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

Parameters

Name
Type
Description
token
contract IERC20
Token address to remove

rewardConfiguration

function rewardConfiguration(contract IERC20) external view returns (uint32 rewardsDuration, uint32 periodFinish, uint192 rewardRate, uint32 lastUpdateTime, uint224 rewardPerTokenStored)
Reward token configurations

Parameters

Name
Type
Description
_0
contract IERC20
undefined

Returns

Name
Type
Description
rewardsDuration
uint32
undefined
periodFinish
uint32
undefined
rewardRate
uint192
undefined
lastUpdateTime
uint32
undefined
rewardPerTokenStored
uint224
undefined

rewardDistributor

function rewardDistributor() external view returns (contract IRewardDistributor)
Spool reward distributor

Returns

Name
Type
Description
_0
contract IRewardDistributor
undefined

rewardPerToken

function rewardPerToken(contract IERC20 token) external view returns (uint224)

Parameters

Name
Type
Description
token
contract IERC20
undefined

Returns

Name
Type
Description
_0
uint224
undefined

rewardTokens

function rewardTokens(uint256) external view returns (contract IERC20)
Reward tokens

Parameters

Name
Type
Description
_0
uint256
undefined

Returns

Name
Type
Description
_0
contract IERC20
undefined

rewardTokensCount

function rewardTokensCount() external view returns (uint256)

Returns

Name
Type
Description
_0
uint256
undefined

setCanStakeFor

function setCanStakeFor(address account, bool _canStakeFor) external nonpayable
Allow an address to stake for another address.
Requirements: - the caller must be the distributor

Parameters

Name
Type
Description
account
address
Address to allow
_canStakeFor
bool
True to allow, false to remove allowance

stake

function stake(uint256 amount) external nonpayable

Parameters

Name
Type
Description
amount
uint256
undefined

stakeFor

function stakeFor(address account, uint256 amount) external nonpayable

Parameters

Name
Type
Description
account
address
undefined
amount
uint256
undefined

stakedBy

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)

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
address
undefined

stakingToken

function stakingToken() external view returns (contract IERC20)
SPOOL token address

Returns

Name
Type
Description
_0
contract IERC20
undefined

tokenBlacklist

function tokenBlacklist(contract IERC20) external view returns (bool)
Blacklisted force-removed tokens

Parameters

Name
Type
Description
_0
contract IERC20
undefined

Returns

Name
Type
Description
_0
bool
undefined

totalStaked

function totalStaked() external view returns (uint256)
Total SPOOL staked

Returns

Name
Type
Description
_0
uint256
undefined

unstake

function unstake(uint256 amount) external nonpayable

Parameters

Name
Type
Description
amount
uint256
undefined

updatePeriodFinish

function updatePeriodFinish(contract IERC20 token, uint32 timestamp) external nonpayable

Parameters

Name
Type
Description
token
contract IERC20
undefined
timestamp
uint32
undefined

voSpool

function voSpool() external view returns (contract IVoSPOOL)
voSPOOL token address

Returns

Name
Type
Description
_0
contract IVoSPOOL
undefined

voSpoolRewards

function voSpoolRewards() external view returns (contract IVoSpoolRewards)
voSPOOL token rewards address

Returns

Name
Type
Description
_0
contract IVoSpoolRewards
undefined

Events

CanStakeForSet

event CanStakeForSet(address indexed account, bool canStakeFor)

Parameters

Name
Type
Description
account indexed
address
undefined
canStakeFor
bool
undefined

PeriodFinishUpdated

event PeriodFinishUpdated(contract IERC20 indexed token, uint32 periodFinish)

Parameters

Name
Type
Description
token indexed
contract IERC20
undefined
periodFinish
uint32
undefined

RewardAdded

event RewardAdded(contract IERC20 indexed token, uint256 amount, uint256 duration)

Parameters

Name
Type
Description
token indexed
contract IERC20
undefined
amount
uint256
undefined
duration
uint256
undefined

RewardCompounded

event RewardCompounded(address indexed user, uint256 reward)

Parameters

Name
Type
Description
user indexed
address
undefined
reward
uint256
undefined

RewardPaid

event RewardPaid(contract IERC20 token, address indexed user, uint256 reward)

Parameters

Name
Type
Description
token
contract IERC20
undefined
user indexed
address
undefined
reward
uint256
undefined

RewardRemoved

event RewardRemoved(contract IERC20 indexed token)

Parameters

Name
Type
Description
token indexed
contract IERC20
undefined

RewardUpdated

event RewardUpdated(contract IERC20 indexed token, uint256 amount, uint256 leftover, uint256 duration, uint32 periodFinish)

Parameters

Name
Type
Description
token indexed
contract IERC20
undefined
amount
uint256
undefined
leftover
uint256
undefined
duration
uint256
undefined
periodFinish
uint32
undefined

Staked

event Staked(address indexed user, uint256 amount)

Parameters

Name
Type
Description
user indexed
address
undefined