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.
Copy {
"owner" : "inj1..." ,
"vault_id" : 123 ,
"token_id" : 456 ,
"fee_collector_addr" : "inj1..."
}
Migrate
Migrates the vault factory.
ExecuteMsg
Create vault (native/ibc)
Creates a vault. Includes token info and vault fees.
Native/IBC token CW20 token
Copy {
"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
}
}
Copy {
"create_vault" : {
"asset_info" : {
"token" : {
"contract_addr" : "inj1..."
}
} ,
"fees" : {
"protocol_fee" : {
"share" : "0.01"
} ,
"flash_loan_fee" : {
"share" : "0.02"
} ,
"burn_fee" : {
"share" : "0.0"
}
} ,
"token_factory_lp" : false
}
}
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.
Copy {
"migrate_vaults" : {
"vault_addr" : "inj1..." ,
"vault_code_id" : 666
}
}
Update config
Updates the configuration of the vault factory.
Copy {
"update_config" : {
"owner" : "inj1..." ,
"fee_collector_addr" : "inj1..." ,
"vault_id" : 123 ,
"token_id" : 456
}
}
Remove vault
Removes a vault from the factory's registry.
Native token Vault CW20 token Vault
Copy {
"remove_vault" : {
"asset_info" : {
"native_token" : {
"denom" : "uluna"
}
}
}
}
Copy {
"remove_vault" : {
"asset_info" : {
"token" : {
"contract_addr" : "terra1..."
}
}
}
}
Update vault config
Updates the configuration of the given vault with the provided UpdateConfigParams
.
Copy {
"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..."
}
}
}
Queries
Config
Retrieves the configuration of the contract in a Config
response.
Query Response (Config)
Copy {
"owner" : "inj1..." ,
"vault_id" : 999 ,
"token_id" : 888 ,
"fee_collector_addr" : "inj1..."
}
Vault
Retrieves the vault address given the AssetInfo
.
Query (native/IBC token) Query (cw20 token) Response (Option<String>)
Copy {
"vault" : {
"asset_info" : {
"native_token" : {
"denom" : "uwhale"
}
}
}
}
Copy {
"vault" : {
"asset_info" : {
"token" : {
"contract_addr" : "migaloo1..."
}
}
}
}
Copy {
"data" : "migaloo1..."
}
Vaults
Retrieves the addresses for all the vaults. Returns an Option<Vec<String>>
.
Query Response (VaultsResponse)
Copy {
"vaults" : {
"start_after" : [
117 ,
106 ,
117 ,
110 ,
111
] ,
"limit" : 10
}
}
Copy {
"vaults" : [
{
"vault" : "migaloo1..." ,
"asset_info" : {
"native_token" : {
"denom" : "usdc"
}
} ,
"asset_info_reference" : [
1 ,
2 ,
3 ,
4 ,
5 ,
6
]
} ,
{
"vault" : "migaloo1..." ,
"asset_info" : {
"native_token" : {
"denom" : "uwhale"
}
} ,
"asset_info_reference" : [
1 ,
2 ,
3 ,
4 ,
5 ,
6
]
}
]
}
Last updated 5 months ago