Staking Pool
Last updated
Last updated
StakingPool
is one of the most important pieces of the protocol as it handles the liquid staking of tokens. When a user stakes some amount of tokens (such as LINK), they receive liquid staking tokens (such as stLINK) at a 1:1 ratio. These liquid staking tokens represent a user’s staked balance and must be burned to withdraw the underlying tokens they represent.
Once tokens have been staked into the pool, they are deposited into one or more strategy contracts controlled by the pool. These strategies then take the deposited tokens and use them to earn rewards which are distributed to stakers.
In the case of LINK staking, the tokens are deposited into the Chainlink staking contracts.
The liquid staking token issued by StakingPool
is a rebasing token so rewards will be automatically distributed to stakers without any action on their part. This is possible by using a “shares” accounting model where a share represents a certain percentage ownership of the pool. When a user stakes, they receive a number of shares determined by the ratio of total shares to total tokens in the pool. The amount of shares a user owns remains constant unless they stake or withdraw but the ratio of total shares to total tokens changes with each rebase so their shares will be worth more tokens after each rebase. The new token value of their shares will be automatically reflected in their token balance.
While unlikely, it is also possible for a rebase to be negative if strategies earned net negative rewards since the last rebase due to slashing penalties. In this case, each share will be worth less tokens so a user’s token balance will decrease.
All standard ERC20 functions are implemented for StakingPool
Returns the staking token for the pool
Name | Type | Description |
---|---|---|
Returns the address of the priority pool for this pool
Returns the total amount of shares in the pool
Returns the amount of shares owned by an account
Returns the amount of shares that corresponds to an amount of stake
Returns the amount of stake that corresponds to an amount of shares
Returns the total amount of tokens in the pool
Returns a list of all active strategies
Returns a list of all fees
Returns the maximum amount of tokens that the pool can hold
Returns the minimum amount of tokens that must remain in the pool
Returns the amount of unused asset tokens sitting in this pool outside a strategy
These tokens earn no yield and will be deposited ASAP on the next call to _depositLiquidity
Returns the sum of available deposit room across all strategies
Does not account for unused deposits sitting in pool
Returns the total available deposit room for this pool
Accounts for unused deposits sitting in pool
Returns the total available withdrawal room for this pool
Returns the amount of rewards earned since the last call to updateStrategyRewards and the amount of fees that will be paid on the rewards
Deposits staking tokens and mints liquid staking tokens
Withdraws staking tokens and burns liquid staking tokens
Transfers tokens to an address and calls onTokenTransfer
with additional data if the recipient is a contract
Manually deposits asset tokens into a specific strategy
Manually withdraws asset tokens from a strategy
Adds a new strategy
Removes a strategy
Reorders strategies
Adds a new fee
Updates an existing fee
Distributes rewards/fees based on balance changes in strategies since the last update
Transfers shares from the sender to another account
Transfers shares between accounts
Sets the address of the priority pool
Sets the maximum amount of unused deposits that can sit in the pool
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
token
address
Address of staking token
priorityPool
address
address of priority pool
sharesAmount
uint256
Total shares in the pool
_account
address
Address of account
sharesBalance
uint256
Total shares owned by account
_amount
uint256
Amount of stake
sharesAmount
uint256
Corresponding amount of shares
_amount
uint256
Amount of shares
stakeAmount
uint256
Corresponding amount of stake
stakedAmount
uint256
Total tokens in the pool
strategies
address[]
List of strategy contract addresses
fees
struct Fee[]
list of fees
maxDeposits
uint256
maximum deposit limit
minDeposits
uint256
minimum deposit limit
unusedDeposits
uint256
amount of unused tokens
strategyDepositRoom
uint256
available deposit room in strategies
canDeposit
uint256
available deposit room
canWithdraw
uint256
available withdrawal room
_strategyIdxs
uint256[]
Indexes of strategies to sum rewards/fees for
rewards
int256
Total rewards
fees
uint256
Total fees
_account
address
address of account to stake for
_amount
uint256
amount to stake
_data
bytes
list of deposit data passed to strategies
_account
address
Address of account to withdraw for
_receiver
address
Address to receive withdrawal
_amount
uint256
Amount to withdraw
_data
bytes
list of withdrawal data passed to strategies
_to
address
Address to send the tokens to
_value
uint256
Value of token transfer
_data
bytes
Calldata included in the transfer
_index
uint256
Index of strategy
_amount
uint256
Amount to deposit
_index
uint256
Index of strategy
_amount
uint256
Amount to withdraw
_strategy
address
Address of strategy contract
_index
uint256
Index of strategy
_strategyUpdateData
bytes
update data passed to strategy
_strategyWithdrawalData
bytes
withdrawal data passed to strategy
_newOrder
uint256[]
List containing strategy indexes in a new order
_receiver
address
Address of fee receiver
_feeBasisPoints
uint256
Fee in basis points
_index
uint256
Index of fee
_receiver
address
Address of fee receiver
_feeBasisPoints
uint256
Fee in basis points
_strategyIdxs
uint256[]
Indexes of strategies to update rewards for
_data
bytes
update data passed to each strategy
_receipient
address
account to transfer shares to
_sharesAmount
uint256
amount of shares to transfer
_sender
address
account to transfer shares from
_receipient
address
account to transfer shares to
_sharesAmount
uint256
amount of shares to transfer
_priorityPool
address
address of priority pool
_unusedDepositLimit
uint256
maximum amount of unused deposits