StakingV1

Token Staking APIs support HTTP protocol. It uses stakingV1_ namespace.

stakingV1_create

Create an stakingV1 contract.

Parameters

NameTypeDescription

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

NameTypeDescription

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

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

stakingV1_stake

Add stake to staking v1 contract. Before calling, the amount of staking token must be approved as a staking contract.

Parameters

NameTypeDescription

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

NameTypeDescription

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

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

stakingV1_withdraw

Withdraw staking.

Parameters

NameTypeDescription

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

NameTypeDescription

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

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

stakingV1_claimReward

Claim reward. Sufficient reward tokens must be transferred to the staking address.

Parameters

NameTypeDescription

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

NameTypeDescription

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

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}R

stakingV1_withdrawReward

Withdraw reward balance to account. Only the owner of staking contract can do it.

Parameters

NameTypeDescription

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

NameTypeDescription

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

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "transactionId": "0xf7d37be47ce8b563b07aa5e81e17e9722bab2e71374d970a558b45c0ed51df7b"
        }
    }
}

stakingV1_getStaked

Return a staked balance.

Parameters

NameTypeDescription

stakingAddress

String

Contract address of staking

address

String

Address

Return Value

NameTypeDescription

balance

BigDecimal

staked balance of staking address.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "100.12"
        }
    }

stakingV1_getEarned

Return the earned reward.

Parameters

NameTypeDescription

stakingAddress

String

Contract address of staking

address

String

Address

Return Value

NameTypeDescription

balance

BigDecimal

Earned reward balance of reward token.

Example

{
    "jsonrpc": "2.0",
    "id": "00456",
    "result": {
        "resultCode": "200",
        "resultMessage": "Success",
        "resultData": {
            "balance": "0.00012"
        }
    }
}

Last updated