Factory
The factory contract handles the creation and management of the pair contract. You can think of it as its parent contract. It will spawn new pairs for every new pair.
InstantiateMsg
For instantiation, we need to provide the source code id of halo_pair contract and cw-20 base contract for halo-factory contract like shown below.
{
"pair_code_id": 123,
"token_code_id": 123
}
ExecuteMsg
Below are the available ExecuteMsg (write) methods for the factory contract.
UpdateConfig
The update_config ExecuteMsg allows for updating the core values used within. It can be called as shown below.
{
"update_config": {
"owner": "aura...",
"token_code_id": 321,
"pair_code_id": 321
}
}
Where:
owneris the address of the owner of the factory contract.token_code_idis the new source code id ofcw-20 basecontract.pair_code_idis the new source code id ofhalo-paircontract.
CreatePair
The parameters in requirements include the whitelisted users who can provide liquidity for the first time when pair is empty and the minimum amount of assets that users must provide in the first time. It can be called as shown below.
To create a new pool in the factory contract, users must provide a whitelist address(es) and a minimum amount for each asset when when creating a pool for the first time using add_liquidity with the pair contract.
{
"create_pair": {
"asset_infos": [
{
"token": {
"contract_addr": "aura..."
}
},
{
"native_token": {
"denom": "uaura"
}
}
],
"requirements": {
"whitelist": [
"aura...",
"aura..."
],
"first_asset_minimum": 10000,
"second_asset_minimum": 20000
},
"commission_rate": "0.003",
"lp_token_info": {
"lp_token_name": "AURA_HALO_LP",
"lp_token_symbol": "AURA_HALO_LP",
}
},
}
Where:
asset_infosis the information of both assets in the pair.requirementsis the whitelist wallet address list and requirements for providing liquidity for the first time.commission_rateis the commission rate of the pair.lp_token_infois the information of the LP token.
AddNativeTokenDecimals
Before a native token can be added to a pair, you need to specify their decimals and denom. It can be called like shown below.
{
"add_native_token_decimals": {
"denom": "uaura",
"decimals": 6,
}
}
Where:
denomis the denom of the native token.decimalsis the decimals of the native token.
QueryMsg
Below are the available QueryMsg (read) queries for the factory contract.
Config
Displays the current configuration values for the contract. This query returns a ConfigResponse response type. It can be queried as shown below.
{
"config": {}
}
Pair
Returns the details for any token pair contract created by the factory contract. This query returns a PairInfo response type.
{
"pair": {
"asset_infos": [
{
"token": {
"contract_addr": "aura..."
}
},
{
"native_token": {
"denom": "uaura"
}
}
]
}
}
Pairs
Returns a list of the pair contracts instantiated by the factory contract. Returns a PairsResponse response type. It can be queried as shown below.
{
"pairs": { }
}
NativeTokenDecimals
Returns the native token decimals. Returns a NativeTokenDecimals response type. It can be queried as shown below.
{
"native_token_decimals": {
"denom": "uaura",
},
}