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.
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 JUNO held within the vault, they wish to deposit 50 JUNO to a yield strategy, in this case they can send 40 JUNO with a deposit message and 10 JUNO will be removed from their deposits and sent to the yield strategy contract.
Withdrawals are done in similar fashion using our
Withdrawal
struct. Withdrawals can be made from the vault itself or from its according yield strategies.Ado_type: vault
Rust
pub struct InstantiateMsg {}
Deposits funds to the vault/strategy by sending them to the contract.
Rust
pub enum ExecuteMsg{
{
AndrReceive(AndromedaMsg),
}
}
The
AndromedaMsg
needs to be of type receive
to deposit funds to the vault. It will then execute a Deposit with the recipient
being the sender, the amount
is the amount of funds sent. The funds are deposited to the central vault.If the
AndromedaMsg
is not of type receive, then it is used to execute one of the default AndrReceive messages.Allocates funds from the vault to the specified strategy for the specified recipient. If the recipient is not specified, then it will default to the sender.
Rust
JSON
pub enum ExecuteMsg {
Deposit {
recipient: Option<Recipient>,
amount: Option<Coin>,
strategy: Option<StrategyType>,
}
{
"deposit":{
"recipient":{
"addr":"andr1...",
}
}
}
Name | Type | Description |
---|---|---|
recipient | The recipient of the deposit. Defaults to the sender if not specified. | |
amount | The amount to deposit. If not specified then the sent funds are used as the amount. | |
strategy | The strategy to deposit the funds to. If not specified, the funds will go to the vault. |
pub enum StrategyType {
Anchor,
}
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.Rust
JSON
pub enum ExecuteMsg{
Withdraw {
recipient: Option<Recipient>,
withdrawals: Vec<Withdrawal>,
strategy: Option<StrategyType>,
}
}
{
"withdraw":{
"recipient":{
"addr":"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. |
Updates the contract address used for the specified strategy.
The Vault needs to be an operator of the strategy contract.
Rust
JSON
UpdateStrategy {
strategy: StrategyType,
address: AndrAddress,
}
{
"update_strategy":{
"strategy":"anchor",
"address":{
"identifier":"andr1..."
}
}
}
Name | Type | Description |
---|---|---|
strategy | The strategy to set a new contract address for. | |
address | The new contract address |
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)]
Balance {
address: String,
strategy: Option<StrategyType>,
denom: Option<String>,
}
}
{
"balance":{
"address":"andr1...",
"denom":"uandr"
}
}
Name | Type | Description |
---|---|---|
address | String | 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 . |
pub enum QueryMsg {
AndrQuery(AndromedaQuery),
}
If the
AndromedaQuery
is of type Get
, the contract will query the balance of the specified address(data). fn handle_andromeda_query(
deps: Deps,
env: Env,
msg: AndromedaQuery,
) -> Result<Binary, ContractError> {
match msg {
AndromedaQuery::Get(data) => {
let address: String = parse_message(&data)?;
encode_binary(&query_balance(deps, env, address, None, None)?)
}
_ => ADOContract::default().query(deps, env, msg, query),
}
}
Last modified 11d ago