Pool Usage
Approving the Vault Contract (Required)
Calling increase_allowance lets the vault contract create token transactions on your behalf,
making it so that you don't have to manually ensure the exact ratio sent to the pool.
This does not raise any trust issues, because:
- The vault contract's behavior is detailed in the publicly-available source code.
- Every transaction that the vault contract sends is manually approved by you.
The increase_allowance handlemsg structure is as follows (note that 340282366920938463463374607431768211454 is MAX_INT for possible token balances):
{
"increase_allowance": {
"spender": "<vault address>",
"amount": "340282366920938463463374607431768211454"
}
}
Calling increase_allowance looks like:
secretcli tx compute execute <token address> \
'{"increase_allowance": { "spender": "<vault addr>", "amount": "..." }}' \
--from <sender account> -b block -y --gas 1500000
Weighted Pool Creation
The create_weighted_pool handlemsg structure is as follows:
{
"create_weighted_pool": {
"assets": [
{ "address": "secret123...", "token_code_hash": "..." },
{ "address": "secret123...", "token_code_hash": "..." }
],
"weights": [1, 1],
"balances": ["100", "100"]
}
}
Calling create_weighted_pool looks like:
secretcli tx compute execute <vault address> \
'{"create_weighted_pool": {"assets": [...], "weights": [...], "balances": [...] }}' \
--from <deployer account> -b block -y --gas 1500000
Stable Pool Creation
The create_stable_pool handlemsg structure is as follows:
{
"create_stable_pool": {
"assets": [
{ "address": "secret123...", "token_code_hash": "abc" },
{ "address": "secret456...", "token_code_hash": "xyz" }
],
"balances": ["100", "100"]
}
}
Calling create_stable_pool looks like:
secretcli tx compute execute <vault address> \
'{"create_stable_pool": {"assets": [...], "balances": [...] }}' \
--from <deployer account> -b block -y --gas 1500000
Provide Liquidity
The provide_liquidity handlemsg structure is as follows:
{
"provide_liquidity": {
"pool_id": 1,
"pool_amount_out": "100"
}
}
...where:
pool_idis the ID of the pool you're depositing intopool_amount_outis the number of LP shares being minted (for most users, this is calculated client-side in the exchange interface)