Comment on page
Vault
The purpose of the vault ADO is to provide central funds for an App. This means, it will allow the app to deposit funds to the vault, and these funds can be proxied to various yield strategies.
Since the Terra crash, no yield strategies are currently available.
Vaults accept funds from anyone and not only apps, but are usually implemented to manage app funds.
Funds can be deposited to the vault and a record of the deposited funds is stored. Then strategies can be added by the contract owner at any point by calling
UpdateStrategy
.Deposits can be made to yield strategies in partial fashion, sending part of what you would like to deposit and taking the rest from what the vault is currently holding. For example, a wallet could have 10 ANDR held within the vault, and they wish to deposit 50 ANDR to a yield strategy, in this case they can send 40 ANDR with a deposit message and 10 ANDR will be removed from their deposits and sent to the yield strategy contract.
Has the "withdraw" feature enabled.
Ado_type: vault
Rust
JSON
pub struct InstantiateMsg {
pub kernel_address: String,
pub owner: Option<String>,
}
{
"kernel_address":"andr1...",
"owner":"andr1..."
}
Name | Type | Description |
---|---|---|
kernel_address | String | Contract address of the kernel contract to be used for AMP messaging. Kernel contract address can be found in our deployed contracts. |
owner | Option<String> | Optional address to specify as the owner of the ADO being created. Defaults to the sender if not specified. |
Deposits funds to the vault or a strategy.
Rust
JSON
pub enum ExecuteMsg {
Deposit {
recipient: Option<AndrAddr>,
msg: Option<Binary>
}
{
"deposit":{
"recipient":"andr1..."
}
}
Name | Type | Description |
---|---|---|
recipient | The recipient of the deposit. Defaults to the sender if not specified. | |
msg | Optiony<Binary> | An optional base64 binary encoded message to specify the deposit options. |
strategy | The strategy to deposit the funds to. If not specified, the funds will go to the vault. |
The struct that should be encoded to base64 and attached as the message to specify the deposit options.
pub struct DepositMsg {
pub strategy: Option<StrategyType>,
pub amount: Option<Coin>,
pub deposit_msg: Option<Binary>,
}
Name | Type | Description |
---|---|---|
strategy | Optional strategy to deposit the funds to. If not specified then the funds are deposited into the vault. | |
amount | Optional amount to deposit from the sent funds. If not specified then all the sent funds are deposited. | |
deposit_msg | Option<Binary> | Optional message to attach along with the deposit.This is used to execute a message on the strategy receiving the deposit. |
pub enum StrategyType {
}
No strategy is currently supported.
Withdraw funds from the vault or one of the strategies.
The
recipient
field is not used if withdrawing from a strategy.An address can only withdraw from deposits made to their address.
Rust
JSON
pub enum ExecuteMsg{
WithdrawVault {
recipient: Option<Recipient>,
withdrawals: Vec<Withdrawal>,
strategy: Option<StrategyType>,
}
}
{
"withdraw_vault":{
"recipient":{
"address":"andr1..."
},
"withdrawals":[
{
"token":"uandr",
"withdrawal_type":{
"percentage":"0.3"
}
},
...
]
}
}
Name | Type | Text |
---|---|---|
recipient | The address to receive the withdrawn funds when withdrawing from vault. Defaults to the sender. Not used if a strategy is specified. | |
withdrawals | The funds to withdraw. | |
strategy | The strategy to withdraw from. If not specified, the funds are withdrawn from the vault. |
pub struct Withdrawal {
pub token: String,
pub withdrawal_type: Option<WithdrawalType>,
}
Name | Type | Description |
---|---|---|
token | String | The token to withdraw. |
withdrawal_type | Option<WithdrawalType> | The type of withdrawal. |
pub enum WithdrawalType {
Amount(Uint128),
Percentage(Decimal),
}
There are two main withdrawal types:
- Amount: Withdraw a flat amount from the vault/strategy.
- Percentage: Withdraw a percentage of funds found in the vault/strategy.
Updates the contract address used for the specified strategy.
The Vault needs to be an operator of the strategy contract.
Only availabe to the contract owner.
Rust
JSON
UpdateStrategy {
strategy: StrategyType,
address: AndrAddr,
}
{
"update_strategy":{
"strategy":"some-strategy",
"address":"andr1..."
}
}
Name | Type | Description |
---|---|---|
strategy | The strategy to set a new contract address for. | |
address | Reference to the ADO address of the new strategy. |
Gets the balance for the specified address. Can be either the their balance in the vault or in one of the implemented strategies.
Rust
JSON
pub enum QueryMsg {
#[returns(Binary)]
VaultBalance {
address: String,
strategy: Option<StrategyType>,
denom: Option<String>,
}
}
{
"balance":{
"address":"andr1...",
"denom":"uandr"
}
}
Name | Type | Description |
---|---|---|
address | The address to get the balance of. | |
strategy | The strategy to get the balance of. If not specified, the funds in the vault are queried. | |
denom | Option<String> | Optional denom for the funds. |
Returns the balance response corresponding to the strategy. If the strategy is not specified, it would return a
Vec<Coin>
containing the balance of the address
.Returns the contract address of the specified strategy.
Rust
JSON
pub enum QueryMsg{
#[returns(Binary)]
StrategyAddress {
strategy: StrategyType,
}
}
{
"strategy_address":{
"strategy":"anchor"
}
}
Name | Type | Description |
---|---|---|
Strategy | The strategy to get the address of. |
Rust
JSON
pub struct StrategyAddressResponse {
pub strategy: StrategyType,
pub address: String,
}
{
"strategy":"anchor",
"address":"andr1..."
}
Name | Type | Description |
---|---|---|
strategy | The strategy we want the address for. | |
address | String | The address of the strategy . |
Last modified 24d ago