@swapx-lib/v3-sdk / Exports / Staker
Class: Staker
Table of contents
Constructors
Properties
Methods
Constructors
constructor
• Protected new Staker()
Defined in
staker.ts:72
Properties
INCENTIVE_KEY_ABI
▪ Static Private INCENTIVE_KEY_ABI: string = 'tuple(address rewardToken, address pool, uint256 startTime, uint256 endTime, address refundee)'
Defined in
staker.ts:73
INTERFACE
▪ Static INTERFACE: Interface
Defined in
staker.ts:70
Methods
_encodeIncentiveKey
▸ Static Private _encodeIncentiveKey(incentiveKey): Object
Parameters
| Name | Type | Description |
|---|---|---|
incentiveKey | IncentiveKey | An IncentiveKey which represents a unique staking program. |
Returns
Object
An encoded IncentiveKey to be read by ethers
Defined in
staker.ts:194
collectRewards
▸ Static collectRewards(incentiveKeys, options): MethodParameters
Note: A tokenId can be staked in many programs but to claim rewards and continue the program you must unstake, claim, and then restake.
Parameters
| Name | Type | Description |
|---|---|---|
incentiveKeys | IncentiveKey | IncentiveKey[] | An IncentiveKey or array of IncentiveKeys that tokenId is staked in. Input an array of IncentiveKeys to claim rewards for each program. |
options | ClaimOptions | ClaimOptions to specify tokenId, recipient, and amount wanting to collect. Note that you can only specify one amount and one recipient across the various programs if you are collecting from multiple programs at once. |
Returns
MethodParameters
Defined in
staker.ts:107
encodeClaim
▸ Static Private encodeClaim(incentiveKey, options): string[]
To claim rewards, must unstake and then claim.
Parameters
| Name | Type | Description |
|---|---|---|
incentiveKey | IncentiveKey | The unique identifier of a staking program. |
options | ClaimOptions | Options for producing the calldata to claim. Can't claim unless you unstake. |
Returns
string[]
The calldatas for 'unstakeToken' and 'claimReward'.
Defined in
staker.ts:82
encodeDeposit
▸ Static encodeDeposit(incentiveKeys): string
Parameters
| Name | Type | Description |
|---|---|---|
incentiveKeys | IncentiveKey | IncentiveKey[] | A single IncentiveKey or array of IncentiveKeys to be encoded and used in the data parameter in safeTransferFrom |
Returns
string
An IncentiveKey as a string
Defined in
staker.ts:173
withdrawToken
▸ Static withdrawToken(incentiveKeys, withdrawOptions): MethodParameters
Parameters
| Name | Type | Description |
|---|---|---|
incentiveKeys | IncentiveKey | IncentiveKey[] | A list of incentiveKeys to unstake from. Should include all incentiveKeys (unique staking programs) that options.tokenId is staked in. |
withdrawOptions | FullWithdrawOptions | Options for producing claim calldata and withdraw calldata. Can't withdraw without unstaking all programs for tokenId. |
Returns
MethodParameters
Calldata for unstaking, claiming, and withdrawing.
Defined in
staker.ts:136