# README
Yield Aggregator
The yield-aggregator
module provides the function for yield aggregation.
Users deposit their funds to the Vault, and then this module uses the funds to earn yield automatically.
This module is the first yield aggregator that supports "interchain" yield aggregation. So this is also called as Interchain Yield Aggregator (IYA).
Contents
Concepts
This yield aggregator module provides an automatic earning function. This allows users to manage their own assets according to their preferences.
Vault
-
One token many Vaults There can be multiple vaults for a single token. You can choose the Vault that best suits your preferences and manage your assets.
-
Users can create Vaults Users can create Vaults without governance. However, it needs a fee and deposit. The fee is to prevent spam and the deposit is to provide an incentive to remove unnecessary vaults.
The vault creator can configure the commission rate. It makes the vault creation competitive and creates an incentive for creation.
-
One Vault has a combination of many strategies The Vault can be created by combining the strategies described below. You can create a Vault by selecting the strategies to be used and their weights. The strategy weights cannot be changed. If you want to change the weights, abolish the vault and let them go to another vault of the same token.
Strategy
Strategies are methods of how the tokens will be managed to earn a yield. Users can add available strategies through governance with proposals. Strategies can be developed using the CosmWasm smart contract.
The following endpoints must be exposed in the strategy contract.
Message
pub enum ExecuteMsg {
Stake(StakeMsg),
Unstake(UnstakeMsg),
}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct StakeMsg {}
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
pub struct UnstakeMsg {
pub amount: Uint128,
}
- Stake
The staking amount is configured on
info.funds
- Unstake
The unstaking amount is put Uint128 variable on
UnstakeMsg
Query
pub enum QueryMsg {
Bonded { addr: String },
Unbonding { addr: String },
Fee {},
}
-
Bonded It returns the value of
addr
's bonded tokens. Hereaddr
is the address of vault, or individual addresses that deposit funds to the strategy. -
Unbonding It returns the value of
addr
's unbonding tokens. -
Fee It returns
FeeInfo
object that has configuration of fees.pub struct FeeInfo { pub deposit_fee_rate: Decimal, pub withdraw_fee_rate: Decimal, pub interest_fee_rate: Decimal, }
Network-parameters
Field | Type | Label | Description |
---|---|---|---|
commission_rate | cosmos.Dec | Default commission rate | |
vault_creation_fee | cosmos.base.v1beta1.Coin | The fee to create a vault | |
vault_creation_deposit | cosmos.base.v1beta1.Coin | The deposit to create a vault |
Messages
MsgDepositToVault
MsgWithdrawFromVault
MsgCreateVault
MsgDeleteVault
MsgTransferVaultOwnership
Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint |
---|---|---|---|---|---|
DepositToVault | MsgDepositToVault | MsgDepositToVaultResponse | |||
WithdrawFromVault | MsgWithdrawFromVault | MsgWithdrawFromVaultResponse | |||
CreateVault | MsgCreateVault | MsgCreateVaultResponse | |||
DeleteVault | MsgDeleteVault | MsgDeleteVaultResponse | |||
TransferVaultOwnership | MsgTransferVaultOwnership | MsgTransferVaultOwnershipResponse |
Transactions
Deposit to Vault
deposit tokens to a vault.
ununifid tx yieldaggregator deposit-to-vault [id] [principal-amount] --from --chain-id
::: details Example
Deposit 50uguu
to the vault #1
.
ununifid tx yieldaggregator deposit-to-vault 1 50uguu --from user --chain-id test
Withdraw from Vault
withdraw tokens from a vault.
ununifid tx yieldaggregator withdraw-from-vault [id] [principal-amount] --from --chain-id
::: details Example
Withdraw 50uguu
from the vault #1
.
ununifid tx yieldaggregator withdraw-from-vault 1 50uguu --from user --chain-id test
Create Vault
Create a new vault.
ununifid tx yieldaggregator create-vault [denom] [commission-rate] [withdraw-reserve-rate] [fee] [deposit] [strategyWeights] --from --chain-id
::: details Example
Create a GUU
vault.
- Its commission rate is
1%
. - Its reserve rate for withdrawing is
30%
. - Its fee is
10000uguu
& its deposit is20000uguu
. - It contains strategies #1:
10%
& #2:90%
.
ununifid tx yieldaggregator create-vault uguu 0.01 0.3 10000uguu 20000uguu 1:0.1,2:0.9 --from user --chain-id test
Delete Vault
Delete own vault.
ununifid tx yieldaggregator delete-vault [id] --from --chain-id
::: details Example
Delete the vault #1
.
ununifid tx yieldaggregator delete-vault 1 --from user --chain-id test
Transfer Vault Ownership
Transfer the own vault ownership to another address.
ununifid tx yieldaggregator transfer-vault-ownership [id] [recipient] --from --chain-id
::: details Example
Transfer the ownership of the vault #1
to the address ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w
.
ununifid tx yieldaggregator transfer-vault-ownership 1 ununifi155u042u8wk3al32h3vzxu989jj76k4zcu44v6w --from user --chain-id test
Queries
list_vault
Show all vaults
ununifid query yieldaggregator list-vault
ununifi/yield-aggregator/vaults
Response
{
"vaults": [
{
"id": "string",
"denom": "string",
"owner": "string",
"owner_deposit": {
"denom": "string",
"amount": "string"
},
"withdraw_commission_rate": "string",
"withdraw_reserve_rate": "string",
"strategy_weights": [
{
"strategy_id": "string",
"weight": "string"
}
]
}
],
"pagination": {
"next_key": "string",
"total": "string"
}
}
show_vault
Show a vault
ununifid query yieldaggregator show-vault [id]
ununifi/yield-aggregator/vaults/{id}
Response
{
"vault": {
"id": "string",
"denom": "string",
"owner": "string",
"owner_deposit": {
"denom": "string",
"amount": "string"
},
"withdraw_commission_rate": "string",
"withdraw_reserve_rate": "string",
"strategy_weights": [
{
"strategy_id": "string",
"weight": "string"
}
]
},
"strategies": [
{
"denom": "string",
"id": "string",
"contract_address": "string",
"name": "string"
}
]
}
list_strategy
Show all strategies
ununifid query yieldaggregator list-strategy [vault-denom]
ununifi/yield-aggregator/strategies/{denom}
Response
{
"strategies": [
{
"denom": "string",
"id": "string",
"contract_address": "string",
"name": "string"
}
],
"pagination": {
"next_key": "string",
"total": "string"
}
}
show_strategy
Show a strategy
ununifid query yieldaggregator show-strategy [vault-denom] [id]
ununifi/yield-aggregator/strategies/{denom}/{id}
Response
{
"strategy": {
"denom": "string",
"id": "string",
"contract_address": "string",
"name": "string"
}
}
params
shows yield-aggregator params
ununifid query yieldaggregator params
ununifi/yield-aggregator/params
Response
{
"params": {
"commission_rate": "string",
"vault_creation_fee": {
"denom": "string",
"amount": "string"
},
"vault_creation_deposit": {
"denom": "string",
"amount": "string"
}
}
}