<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> If the pool has been converted, the withdrawn token should be the converted token. If the converted token is WTDOT, the retrieved token should be tDOT.
Un-stake all staked share and claim all unclaimed rewards from staking pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> It is the order to execute unstake + claimRewards, if any event is banned, it will be reverted。
</aside>
Pool config-related Methods
poolIndex()
Get the index of next pool.It’s equal to the current count of pools. This is zero by default.
<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> This value will be incremented by 1 whenever addPool.
</aside>
addPool()
Initialize a staking pool for shareType.
Can be called only by owner.
Parameter
Type
Description
shareType
contract IERC20
Initialize the ERC20 contract address of the pool
updateRewardRule()
Update the reward rule of rewardType for poolId pool.
Can be called only by owner.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
shareType
contract IERC20
The reward token address.
rewardRate
uint256
The reward amount per second.
endTime
uint256
The end time of rule.
rewardRules()
Get the reward rule for rewardType reward of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
rewardType
contract IERC20
The reward token address.
setRewardsDeductionRate()
Set deduction rate of claim rewards for poolId pool.
Can be called only by owner.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
rate
uint256
The deduction rate. 1e18 is 100%
rewardsDeductionRates()
Get the rewards deduction rate of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> The deduction rate. 1e18 is 100%
</aside>
shareTypes()
Get the share token of poolId pool.
Parameter
Type
Description
poolId
uint256
The pool id to be queried.
shares()
Get the share amount of who of poolId pool.
Parameter
Type
Description
poolId
uint256
The pool id to be queried.
who
address
The address of staker.
totalShares()
Get the total share amount of poolId pool.
Parameter
Type
Description
poolId
uint256
The pool id to be queried.
earned()
Get who's unclaimed reward amount of specific rewardType at poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
who
address
The address of staker.
rewardType
contract IERC20
The reward token address.
rewardPerShare()
Get the exchange rate for share to rewardType reward token of poolId pool.
The reward part is accumulated rate adds pending to accumulate rate, it's used to calculate reward. 1e18 is 100%.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
rewardType
contract IERC20
The reward token address.
rewardTypes()
Get the reward token types of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
rewards()
Get the unclaimed paid rewardType reward amount for who of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
who
address
The address of staker.
rewardType
contract IERC20
The reward token address.
lastTimeRewardApplicable()
Get latest time that can be used to accumulate rewards for rewardType reward of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
rewardType
contract IERC20
The reward token address.
paidAccumulatedRates()
Get the paid accumulated rate of rewardType for who of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
who
address
The address of staker.
rewardType
contract IERC20
The reward token address.
Pool convert-related Methods
convertLSTPool()
convert the share token of ‘poolId’ pool to LST token by convertType.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
convertType
enum UpgradeableStakingLST.ConvertType
The convert type.
convertInfos()
Get the LSD conversion info of poolId pool.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
<aside> <img src="/icons/info-alternate_gray.svg" alt="/icons/info-alternate_gray.svg" width="40px" /> If the pool has been converted, the withdrawn token should be the converted token. If the converted token is WTDOT, the retrieved token should be tDOT.
</aside>
Pool operation pause-related Methods
setPoolOperationPause()
Set the paused status of operation for poolId pool.
Can be called only by owner.
Parameter
Type
Description
poolId
uint256
The index of staking pool.
operation
enum PoolOperationPausable.Operation operation
The user operation.
paused
bool
The pause status.
pausedPoolOperations()
Get the pause status of operation for poolId pool.
function rewardRules(uint256 poolId, contract IERC20 rewardType) external view returns (struct Staking.RewardRule)
struct RewardRule {
// Reward amount per second.
uint256 rewardRate;
// The end time for reward accumulation.
uint256 endTime;
// Accumulated reward rate, this is used to calculate the reward amount of each staker.
// It mul 1e18 to avoid loss of precision.
uint256 rewardRateAccumulated;
// The last time of this rule accumulates reward.
uint256 lastAccumulatedTime;
}
function setRewardsDeductionRate(uint256 poolId, uint256 rate) external nonpayable
function rewardsDeductionRates(uint256 poolId) external view returns (uint256)
function shareTypes(uint256 poolId) external view returns (contract IERC20)
function shares(uint256 poolId, address who) external view returns (uint256)
function totalShares(uint256 poolId) external view returns (uint256)
function rewardPerShare(uint256 poolId, contract IERC20 rewardType) external view returns (uint256)
function rewardTypes(uint256 poolId) external view returns (contract IERC20[])
function convertInfos(uint256 poolId) external view returns (struct UpgradeableStakingLSD.ConvertInfo)
struct ConvertInfo {
// The converted LSD token.
IERC20 convertedShareType;
// This is a snapshot of the ratio between share amount to new share token amount at the moment of conversion. 1e18 is 1:1
uint256 convertedExchangeRate;
}