# Pledge
# Contract Specification
Built-in staking contract. Contract address is vite_0000000000000000000000000000000000000003f6af7459b9
ABI:
Delegated staking and cancelling delegated staking will return execution results in callbacks.
# pledge_getPledgeData
Generate request data for staking for quota. Equivalent to Pledge
method in ABI.
Parameters:
Address
: Quota recipient's address
Returns:
[]byte
Data
Example:
# pledge_getCancelPledgeData
Generate request data for retrieving a certain amount of tokens staked for specified quota recipient. Equivalent to CancelPledge
method in ABI.
Parameters:
Address
: Quota recipient's addressbig.int
: The amount of token to withdraw
Returns:
[]byte
Data
Example:
# pledge_getAgentPledgeData
Generate request data for staking for specified quota recipient via delegation. Equivalent to AgentPledge
method in ABI.
- Parameters:
Object
pledgeAddr
:Address
Staking addressbeneficialAddr
:Address
Quota recipient's addressbid
:uint8
Business id. Multiple staking from the same staking address and business id will be merged. As result, staking expiration will be extendedstakeHeight
:uint64
Staking duration between 259200 and 31536000. For example, a staking duration of 259200 represents the staking can be retrieved after 259200 snapshot blocks
Returns:
[]byte
Data
Example:
# pledge_getAgentCancelPledgeData
Generate request data for retrieving a certain amount of tokens staked for specified quota recipient via delegation .Equivalent to AgentCancelPledge
method in ABI.
- Parameters:
Object
pledgeAddr
:Address
Staking addressbeneficialAddr
:Address
Quota recipient's addressbid
:uint8
Business idamount
:big.Int
The amount of tokens to withdraw
Returns:
[]byte
Data
Example:
# pledge_getPledgeQuota
Return current quota and UTPS (unit transaction per second) of specified account.
Parameters:
Address
: Account address
Returns:
Object
quota
:uint64
Current quotaquotaPerSnapshotBlock
:uint64
Quota obtained per snapshot block through stakingcurrentUt
:float
: Current quota, measured in UT with 4 decimalsutpe
:float
: The maximum quota can be obtained with current staking amount, measured in UT with 4 decimalspledgeAmount
:big.Int
: The staking amount
- Example:
# pledge_getPledgeList
Return staking records of specified account, ordered by expiration snapshot block height in descending order
Parameters:
Address
: Staking addressint
: Page index, starting from 0int
: Page size
Returns:
Object
totalPledgeAmount
:big.Int
The total staking amount of the accounttotalCount
:int
The number of total staking recordspledgeInfoList
:Array<PledgeInfo>
Staking record listamount
:big.int
Staking amountwithdrawHeight
:uint64
The snapshot block height when the staking expiresbeneficialAddr
:Address
Quota recipient's addresswithdrawTime
:int64
The estimated staking expiration timeagent
:bool
Whether this is delegated staking.true
for yes andfalse
for no.agentAddress
:Address
Delegated account address. 0 for non-delegated stakingbid
:uint8
Business id. 0 for non-delegated staking
- Example:
# pledge_getAgentPledgeInfo
Get delegated staking
- Parameters:
Object
pledgeAddr
:Address
Original staking addressagentAddr
:Address
Delegated account addressbeneficialAddr
:Address
Quota recipient's addressbid
:uint8
Business id. Multiple staking from the same staking address and business id will be merged. As result, staking expiration will be extended.
- Returns:
Object
1.amount
: big.int
Staking amount
2.withdrawHeight
: uint64
The snapshot block height when the staking expires
3.beneficialAddr
: Address
Quota recipient's address
4.withdrawTime
: int64
The estimated staking expiration time
5.agent
: bool
Whether this is delegated staking. true
for yes and false
for no.
6.agentAddress
: Address
Delegated account address. 0 for non-delegated staking
7.bid
: uint8
Business id. 0 for non-delegated staking
- Example: