Validator Staking
Introduction
The Staking ADO is smart contract that allows users to stake native tokens with the validator of their choice.
This ADO is not meant for general use meaning that it should not be open for the public (Have people other than the owner use it for staking). It is designed so the owner of the ADO has full control over the staking which is why most messages are restricted to the owner.
The staking message can still be called by any address. This is to allow the ADO owner to integrate this ADO with Andromeda Apps allowing the allocation of funds gained by the App to be routed to this ADO and staked.
Example
Let us assume a project is looking to start an NFT project having part of the project be that the users will get some funds over time:
This would be just one part of the benefits of buying the project's NFT.
Project is looking to launch an NFT collection.
The collection will be sold using one of the ADOs like our Marketplace ADO.
Using a splitter connection, the funds from the sale are distributed having part of the funds go to the Staking ADO and start staking automatically.
The rewards accrued from staking are then sent to another splitter that distributes the rewards back to the NFT buyers.
This gives a small idea of how you can use the Validator Staking ADO in your Andromeda Applications to achieve very usefull and cool use cases.
Ado-type: validator-staking
Version: 1.0.0
InstantiateMsg
Name | Type | Description |
---|---|---|
| Addr | The address of the validator to delegate the tokens to by default. This means when you call a Stake message without specifying the |
| String | Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts. |
| Option<String> | Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified. |
ExecuteMsg
Stake
Stakes the attached funds with the specified validator.
If the validator is not specified, then the
default_validator
specified at instantiation will be used.Make sure to attach one type of funds only.
Name | Type | Description |
---|---|---|
| Option<Addr> | The address of the validator to delegate the tokens to. |
Unstake
Unstakes the delegated tokens from the specified validator.
Only available to the contract owner.
If the validator is not specified, then the
default_validator
specified at instantiation will be used.The tokens will be released back to the ADO after the unbonding period has passed. You will need to call the WithdrawFunds message after that to get the tokens back into your wallet.
Name | Type | Description |
---|---|---|
| Option<Addr> | The address of the validator to undelegate the tokens from. |
| Option<Uint128> | The amount of tokens to unstake. Defaults to the maximum amount if not specified. |
Claim
Claim the rewards accrued from staking for a specific validator.
Only available to the contract owner.
If the validator is not specified, then the
default_validator
specified at instantiation will be used.
Name | Type | Description |
---|---|---|
| Option<Addr> | The address of the validator to claim the rewards for. |
WithdrawFunds
Withdraw unstaked tokens from the ADO.
Only available to the contract owner.
Make sure the unbonding period has passed before trying to withdraw funds.
Name | Type | Description |
---|---|---|
| Option<String> | The denom of the previously staked funds to withdraw. If not specified, all available funds are withdrawn |
| Option<AndrAddr> | An optional address to receive the withdrawn funds. Will default to the sender if not specified. |
UpdateDefaultValidator
Update the set default validator.
Only available to the contract owner.
Name | Type | Description |
---|---|---|
| Addr | The new validator address to be used by default. |
Redelegate
Moves the specified amount of staked tokens from one validator to another.
Only available to the contract owner.
Name | Type | Description |
---|---|---|
| Option<Addr> | The address of the validator to move tokens from. |
| Addr | The address of the validator to move tokens to. |
| Option<Uint128> | The amount of tokens to redelegate. Takes the maximum amount if not specified. |
Base Executes
The rest of the execute messages can be found in the ADO Base section.
QueryMsg
StakedTokens
Queries the staked tokens with the specified validator.
If the validator is not specified, then the default_validator
specified at instantiation will be used.
Name | Type | Description |
---|---|---|
| Option<Addr> | The validator to check the staked tokens for. |
FullDelegation
Returns the information of the staked tokens.
Name | Type | Description |
---|---|---|
| Addr | The address of the delegator. Will be the address of the staking ADO in our case. |
| String | The validator that the tokens are delegated to. |
| The amount of funds locked in the delegation. | |
|
| |
| Vec<Coin> | The amount of rewards accruied from the staking that can be currently withdrawn. |
UnstakedTokens
Queries the tokens that are unstaked and provides the time they can be claimed (Unbonding period is over).
UnstakingTokens
Struct containing information of the unstaked tokens.
Name | Type | Description |
---|---|---|
| The denom and amount of the token being unstaked. | |
| The time these tokens can be claimed which is the time the unbonding period is over. |
DefaultValidator
Queries the default validator address set at instantiation.
Returns the address as a string.
Base Queries
The rest of the query messages can be found in the ADO Base section.
Last updated