Staked Token (Staked SNIP20) version 0 is a specification for staked layer 2 tokens. They should not be considered compliant SNIP20s in terms of functionality as they lack the ability to transfer the tokens freely.
Additions that expand the SNIP20's functionality
Converts a standard token into a stakedToken
Notes the necessary modifications to the initializer for staking to properly work
Name | Type | Description | Optional |
---|---|---|---|
treasury | string | Where the staked funds will go | No |
unbond_time | u64 | Time it takes to unbond a token | No |
staked_token | Contract | Token that will be staked | No |
Used to receive the amount to stake. The msg
field is used for context, the amount will either be used to stake
or to increase token pool
Name | Type | Description | Optional |
---|---|---|---|
sender | string | Sender of the funds | No |
amount | string | Amount to stake | No |
msg | string | Deposit context | Yes |
Claim rewards and also unbonds the set amount, user will have to wait the time set by unbond_time
before they can call ClaimUnbond
Name | Type | Description | Optional |
---|---|---|---|
amount | string | Amount to stake | No |
Claims the unbonded tokens if available
Claims the staking rewards
Claims the staking rewards and stakes them
Queries the total tokens staked
{
"total_staked": {
"tokens": "token amount",
"shares": "share amount"
}
}
Queries a user's stake state, along with unbonding information.
Name | Type | Description | Optional |
---|---|---|---|
address | string | Amount to stake | No |
key | string | Viewing key | No |
time | u64 | Current time | Yes |
{
"staked": "user staked",
"shares": "user shares",
"pending_rewards": "claimable rewards",
"unbonding": "tokens still unbonding",
"unbonded": "claimable tokens"
}
Checks tokens being unbonded in a rage
Name | Type | Description | Optional |
---|---|---|---|
start | u64 | Range start | No |
end | u64 | Range end | No |
{
"unbonding": {
"total": "unbonding amount"
}
}
Used to keep an internal staking state and to track a user's staked amount and shares to efficiently calculate rewards
Name | Type | Description | Optional |
---|---|---|---|
shares | string | Representation of total shares owned | No |
tokens | string | Total tokens owned by the contract | No |
A single unbond transaction
Name | Type | Description | Optional |
---|---|---|---|
amount | string | Amount to unbond | No |
release | u64 | When the funds will be claimable | No |
Used to send the account's total balance instead of sending some amount, when a smart contract requires viewing total staked then this serves as a good alternative to sending a viewing key or permit.
Exposes the sender's current account balance.
Name | Type | Description | Optional |
---|---|---|---|
recipient | string | Address of balance receiver | No |
code_hash | string | Code hash of the contract | No |
msg | Base64 string | An optional message to send along | Yes |
padding | string | Ignored string used to maintain constant-length messages | Yes |
Implemented by contracts that want to handle the SendBalance function.
Name | Type | Description | Optional |
---|---|---|---|
sender | string | Address of balance receiver | No |
msg | string | Optional message to receive | Yes |
balance | string | Balance of sender | No |
Staked tokens should only be sent by allowed distributors, this prevents users from using a staked token like if it was
a normal token. Additionally, should only be allowed to send to distributors. Functions that require a distributor
check are Send
, Transfer
, SendFrom
, TransferFrom
, BatchSend
, BatchTransfer
,
BatchSendFrom
and BatchTransferFrom
.
Adds distributors to the list of allowed distributors.
Name | Type | Description | Optional |
---|---|---|---|
distributors | Array of strings | Distributors to add | No |
padding | string | Ignored string used to maintain constant-length messages | Yes |
Sets a new list of allowed distributors.
Name | Type | Description | Optional |
---|---|---|---|
distributors | Array of strings | Distributors to set | No |
padding | string | Ignored string used to maintain constant-length messages | Yes |
Returns a list of allowed distributors
{
"distributors": ["List of addresses"]
}