StakingV1
Token Staking APIs support HTTP protocol. It uses stakingV1_ namespace.
stakingV1_create
Create an stakingV1 contract.
Parameters
Name | Type | Description |
---|---|---|
sender | String | Sender Address |
stakingToken | String | Address of staking token |
rewardToken | String | Address of reward token |
limitStakingTime | Long | deadline staking time. second epoch time value |
limitRewardTime | Long | limit reward time. second epoch time value |
rewardRate | BigInteger | reward rate per second. FEI value |
tempKey | String | tempKey for "create" |
hashKey | String | hash(tempKey | secretKey) |
signature | String | sign( hash( sender | stakingToken | rewardToken | limitStakingTime | limitRewardTime | rewardRate | tempKey | hashKey ) ) by sender's privateKey using signData API |
In order to perform a transaction, the owner must have a balance of at least 4 GFEI for gas cost.
Return Value
Name | Type | Description |
---|---|---|
transactionId | String | Transaction Id |
contractAddress | String | Token contract address |
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.
Example
stakingV1_stake
Add stake to staking v1 contract. Before calling, the amount of staking token must be approved as a staking contract.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
sender | String | Sender Address |
amount | BigDecimal | Staking amount of token. |
comment | String | Comment Max length : 200 |
tempKey | String | tempKey for "stake" |
hashKey | String | hash(tempKey | secretKey) |
signature | String | sign( hash( stakingAddress | sender | amount | tempKey | hashKey ) ) by sender's privateKey using signData API |
In order to perform a transaction, the owner must have a balance of at least 400,000,000 FEI for gas cost.
Return Value
Name | Type | Description |
---|---|---|
transactionId | String | Transaction Id |
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.
Example
stakingV1_withdraw
Withdraw staking.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
sender | String | Address of request withdraw |
amount | BigDecimal | Withdraw amount of token. |
comment | String | Comment Max length : 200 |
tempKey | String | tempKey for "withdraw" |
hashKey | String | hash(tempKey | secretKey) |
signature | String | sign( hash( stakingAddress | sender | amount | tempKey | hashKey ) ) by sender's privateKey using signData API |
In order to perform a transaction, the owner must have a balance of at least 400 MFEI for gas cost.
Return Value
Name | Type | Description |
---|---|---|
transactionId | String | Transaction Id |
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.
Example
stakingV1_claimReward
Claim reward. Sufficient reward tokens must be transferred to the staking address.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
sender | String | Address of request claim. |
comment | String | Comment Max length : 200 |
tempKey | String | tempKey for "claimReward" |
hashKey | String | hash(tempKey | secretKey) |
signature | String | sign( hash( stakingAddress | sender | tempKey | hashKey ) ) by sender's privateKey using signData API |
In order to perform a transaction, the owner must have a balance of at least 400 MFEI for gas cost.
Return Value
Name | Type | Description |
---|---|---|
transactionId | String | Transaction Id |
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.
Example
stakingV1_withdrawReward
Withdraw reward balance to account. Only the owner of staking contract can do it.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
sender | String | Owner address of staking contract. |
account | String | Account address of receive reward balance |
amount | BigDecimal | Withdraw amount of reward token. |
comment | String | Comment Max length : 200 |
tempKey | String | tempKey for "withdrawReward" |
hashKey | String | hash(tempKey | secretKey) |
signature | String | sign( hash( stakingAddress | owner | account | amount | tempKey | hashKey ) ) by sender's privateKey using signData API |
In order to perform a transaction, the owner must have a balance of at least 400 MFEI for gas cost.
Return Value
Name | Type | Description |
---|---|---|
transactionId | String | Transaction Id |
A transactionId is returned, but that doesn't mean it has been added to the Block yet. You should check that the status is 1 by using net_getTransactionStatus.
Example
stakingV1_getStaked
Return a staked balance.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
address | String | Address |
Return Value
Name | Type | Description |
---|---|---|
balance | BigDecimal | staked balance of staking address. |
Example
stakingV1_getEarned
Return the earned reward.
Parameters
Name | Type | Description |
---|---|---|
stakingAddress | String | Contract address of staking |
address | String | Address |
Return Value
Name | Type | Description |
---|---|---|
balance | BigDecimal | Earned reward balance of reward token. |
Example
Last updated