UpgradeableStakingLST
Staking-related Methods
stake()
Staking share into staking pool.
function stake(uint256 poolId, uint256 amount) external nonpayable returns (bool)
poolId
uint256
The index of staking pool.
amount
uint256
The share amount to be staked.
unstake()
Withdraw share from staking pool.
function unstake(uint256 poolId, uint256 amount) external nonpayable returns (bool)
poolId
uint256
The index of staking pool.
amount
uint256
The share amount to be un-staked
<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>
claimRewards()
Claim all rewards from staking pool.
function claimRewards(uint256 poolId) external nonpayable returns (bool)
poolId
uint256
The index of staking pool.
exit()
Un-stake all staked share and claim all unclaimed rewards from staking pool.
function exit(uint256 poolId) external nonpayable returns (bool)
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.
function poolIndex() external view returns (uint256)
<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.
function addPool(contract IERC20 shareType) external nonpayable
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.
function updateRewardRule(
uint256 poolId,
contract IERC20 rewardType,
uint256 rewardRate,
uint256 endTime
) external nonpayable
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.
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;
}
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.
function setRewardsDeductionRate(uint256 poolId, uint256 rate) external nonpayable
poolId
uint256
The index of staking pool.
rate
uint256
The deduction rate. 1e18 is 100%
rewardsDeductionRates()
Get the rewards deduction rate of poolId
pool.
function rewardsDeductionRates(uint256 poolId) external view returns (uint256)
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.
function shareTypes(uint256 poolId) external view returns (contract IERC20)
poolId
uint256
The pool id to be queried.
shares()
Get the share amount of who
of poolId
pool.
function shares(uint256 poolId, address who) external view returns (uint256)
poolId
uint256
The pool id to be queried.
who
address
The address of staker.
totalShares()
Get the total share amount of poolId
pool.
function totalShares(uint256 poolId) external view returns (uint256)
poolId
uint256
The pool id to be queried.
earned()
Get who
's unclaimed reward amount of specific rewardType
at poolId
pool.
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%.
function rewardPerShare(uint256 poolId, contract IERC20 rewardType) external view returns (uint256)
poolId
uint256
The index of staking pool.
rewardType
contract IERC20
The reward token address.
rewardTypes()
Get the reward token types of poolId
pool.
function rewardTypes(uint256 poolId) external view returns (contract IERC20[])
poolId
uint256
The index of staking pool.
rewards()
Get the unclaimed paid rewardType
reward amount for who
of poolId
pool.
function rewards(uint256 poolId, address who, contract IERC20 rewardType) external view returns (uint256)
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.
function lastTimeRewardApplicable(uint256 poolId, contract IERC20 rewardType) external view returns (uint256)
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.
function paidAccumulatedRates(uint256 poolId, address who, contract IERC20 rewardType) external view returns (uint256)
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
.
function convertLSTPool(uint256 poolId, enum UpgradeableStakingLSD.ConvertType convertType) external nonpayable
enum ConvertType {
LCDOT2LDOT,
LCDOT2TDOT,
DOT2LDOT,
DOT2TDOT,
LCDOT2WTDOT,
DOT2WTDOT
}
poolId
uint256
The index of staking pool.
convertType
enum UpgradeableStakingLST.ConvertType
The convert type.
convertInfos()
Get the LSD conversion info of poolId
pool.
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;
}
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.
function setPoolOperationPause(
uint256 poolId,
enum PoolOperationPausable.Operation operation,
bool paused
) external nonpayable
enum Operation {
Stake,
Unstake,
ClaimRewards
}
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 pausedPoolOperations(uint256 poolId, enum PoolOperationPausable.Operation operation) external view returns (bool)
enum Operation {
Stake,
Unstake,
ClaimRewards
}
poolId
uint256
The index of staking pool.
operation
enum PoolOperationPausable.Operation operation
The user operation.
contract config-related Methods
Last updated