๐ŸญVault Factory

The vault factory contract is used to create vaults. Similarly to the pool factory, the vault factory acts as a directory for the vaults that have been created through the factory. Note that the vault factory is permissioned, meaning the messages can only be executed by the owner of the contract.

The code for the vault factory contract can be found here .


The following are the messages that can be executed on the vault factory:

Instantiate

Instantiates the vault factory. Requires storing the vault and token contracts in advance so that the contract code ids can be provided.

{
  "owner": "inj1...",
  "vault_id": 123,
  "token_id": 456,
  "fee_collector_addr": "inj1..."
}
KeyTypeDescription

owner

String

The owner of the factory

vault_id

u64

The code ID for the vault contract

token_id

u64

The code ID for the liquidity token contract

fee_collector_addr

String

The address where fees get collected

Migrate

Migrates the vault factory.

{}

ExecuteMsg

Create vault (native/ibc)

Creates a vault. Includes token info and vault fees.

{
  "create_vault": {
    "asset_info": {
      "native_token": {
        "denom": "uluna"
      }
    },
    "fees": {
      "protocol_fee": {
        "share": "0.01"
      },
      "flash_loan_fee": {
        "share": "0.02"
      },
      "burn_fee": {
        "share": "0.0"
      }
    },
    "token_factory_lp": true
  }
}
KeyTypeDescription

asset_info

AssetInfo

Asset info to create a vault with

fees

VaultFee

Fees for the vault

token_factory_lp

bool

If true, the factory will use the token factory to create the LP token for the vault. If false, it will use a cw20 token instead

Migrate vaults

Migrates vault contracts to the given vault code id. If vault_addr is provided, the message migrates only that given vault. Otherwise, it migrates all the vaults created by the factory.

{
  "migrate_vaults": {
    "vault_addr": "inj1...",
    "vault_code_id": 666
  }
}
KeyTypeDescription

vault_addr

Option<String>

Vault address to migrate

vault_code_id

u64

Code id of the vault contract to migrate to

Update config

Updates the configuration of the vault factory.

{
  "update_config": {
    "owner": "inj1...",
    "fee_collector_addr": "inj1...",
    "vault_id": 123,
    "token_id": 456
  }
}
KeyTypeDescription

owner

Option<String>

New owner of the factory

fee_collector_addr

Option<String>

New fee collector address

vault_id

Option<u64>

New code id for creating vault contracts with

token_id

Option<u64>

New code id for the token contract

Remove vault

Removes a vault from the factory's registry.

{
  "remove_vault": {
    "asset_info": {
      "native_token": {
        "denom": "uluna"
      }
    }
  }
}
KeyTypeDescription

asset_info

AssetInfo

The asset_info of the vault to be removed

Update vault config

Updates the configuration of the given vault with the provided UpdateConfigParams.

{
  "update_vault_config": {
    "vault_addr": "inj1...",
    "params": {
      "flash_loan_enabled": true,
      "deposit_enabled": true,
      "withdraw_enabled": true,
      "new_owner": "inj1...",
      "new_vault_fees": {
        "protocol_fee": {
          "share": "0.02"
        },
        "flash_loan_fee": {
          "share": "0.03"
        },
        "burn_fee": {
          "share": "0.0"
        }
      },
      "new_fee_collector_addr": "inj1..."
    }
  }
}
KeyTypeDescription

vault_addr

String

Vault address

params

UpdateConfigParams

Parameters to update the config with

Queries

Config

Retrieves the configuration of the contract in a Config response.

{
  "config": {}
}

Vault

Retrieves the vault address given the AssetInfo.

{
  "vault": {
    "asset_info": {
      "native_token": {
        "denom": "uwhale"
      }
    }
  }
}
KeyTypeDescription

asset_info

AssetInfo

Asset info of the vault to retrieve the address of

Vaults

Retrieves the addresses for all the vaults. Returns an Option<Vec<String>>.

{
  "vaults": {
    "start_after": [
      117,
      106,
      117,
      110,
      111
    ],
    "limit": 10
  }
}
KeyTypeDescription

start_after

Option<Vec>

Asset info reference (as bytes) to paginate from

limit

Option<u32>

How many items to fetch at once. Default is 10, max 30

Last updated