The following readme describes all the functions and their parameters exposed by the k2NativeDelegationRSTIncentives class of the K2 SDK. This sub-class contains all the important functions from the K2 Native Delegation RST Incentives contract of the K2 Lending protocol.

poolLength function

Get the length of the pool.

Using poolLength function

await sdk.k2NativeDelegationRSTIncentives.poolLength();

Return Parameter

Returns the length of the pool.

poolIdByRewardToken function

Get pool ID by the reward token.

Input Parameters

rewardToken: The RST reward token address.

Using poolIdByRewardToken function

await sdk.k2NativeDelegationRSTIncentives.poolIdByRewardToken(rewardToken);

Return Parameter

Return the pool ID for the RST reward token.

getRewardFromLastBlock function

Get the rewards from the last given block.

Input Parameters

poolId: The pool ID for the RST token
lastBlock: The last block number

Using getRewardFromLastBlock function

await sdk.k2NativeDelegationRSTIncentives.getRewardFromLastBlock(poolId, lastBlock);

Return Parameter

Returns the rewards received from the last given block.

pendingRewards function

Get the pending rewards of a user.

Input Parameters

poolId: The pool ID for the RST token
user: The user’s ETH Address

Using pendingRewards function

await sdk.k2NativeDelegationRSTIncentives.pendingRewards(poolId, user);

Return Parameter

Returns the pending rewards of the user.

massUpdatePools function

Update all the pools.

Using massUpdatePools function

await sdk.k2NativeDelegationRSTIncentives.massUpdatePools();

Return Parameter

Transaction details if the transaction was successful.

updatePool function

Update pool for the given pool ID.

Input Parameters

poolId: The pool ID for the pool to be updated.

Using updatePool function

await sdk.k2NativeDelegationRSTIncentives.updatePool(poolId);

Return Parameter

Transaction details if the transaction was successful.

nativeDelegationDeposit function

Farming deposit with native delegation.

Input Parameters

poolId: The pool ID

Using nativeDelegationDeposit function

await sdk.k2NativeDelegationRSTIncentives.nativeDelegationDeposit(poolId);

Return Parameter

Transaction details if the transaction was successful.

deposit function

K2 LP farming deposit function.

Input Parameters

poolId: The pool ID to be withdrawn from
amount: The withdraw amount

Using deposit function

await sdk.k2NativeDelegationRSTIncentives.deposit(poolId, amount);

Return Parameter

Transaction details if the transaction was successful.

nativeDelegationWithdraw function

Withdraw all the native delegation from a pool.

Input Parameters

poolId: The pool ID for the pool to be updated.

Using nativeDelegationWithdraw function

await sdk.k2NativeDelegationRSTIncentives.nativeDelegationWithdraw(poolId);

Return Parameter

Transaction details if the transaction was successful.

withdraw function

Withdraw the K2 LP tokens.

Input Parameters

poolId: The pool ID to be withdrawn from
amount: The withdraw amount

Using withdraw function

await sdk.k2NativeDelegationRSTIncentives.withdraw(poolId, amount);

Return Parameter

Transaction details if the transaction was successful.

claim function

Claim the pending BSN tokens.

Input Parameters

poolId: The pool ID to claim from

Using claim function

await sdk.k2NativeDelegationRSTIncentives.claim(poolId);

Return Parameter

Transaction details if the transaction was successful.

forceWithdraw function

Force withdraw K2 LP without rewards.

Input Parameters

poolId: The pool ID to withdraw from

Using forceWithdraw function

await sdk.k2NativeDelegationRSTIncentives.forceWithdraw(poolId);

Return Parameter

Transaction details if the transaction was successful.

forceWithdrawNativeDelegation function

Force withdraw K2 LP without rewards for native delegation farmers.

Input Parameters

poolId: The pool ID to withdraw from

Using forceWithdrawNativeDelegation function

await sdk.k2NativeDelegationRSTIncentives.forceWithdrawNativeDelegation(poolId);

Return Parameter

Transaction details if the transaction was successful.