Pool Functions
Instantiate a pool either from StablePool or WeightedPool depending on your use-case.
Fees
In both Stable Pool and Weighted Pool, you can set the transaction fee amount in BalancerConstants.py,
Stable Pool
a) Add Liquidity
join_pool(balances: dict)Add up to 2 coins in a 50/50 pool. Populate dictionary with this key value pair (key=token: str, value=balance: number)
b) Withdraw Liquidity
exit_pool(balances: dict) Specify which assets/amount to withdraw by populating dictionary with key value pair (key=token: str, value=balance: number)
c) Swapswap(token_in: str, token_out: str, amount: Decimal, given_in: bool) Performs token swap based on given policy
case given_in = True:The default swap out-given-in.
case given_in = False:in-given-out, known amount of tokens we want to retrieve from the pool, and we calculate the amount needed in.
Weighted Pool
a) Add Liquidity
join_pool(balances: dict, weights: dict)Add up to 8 coins in a weighted pool. Populate the balances dictionary with this key value pair (key=token: str, value=balance: number), and weights using the same keys as balances (key=token: str, value=weight: number)
b) Withdraw Liquidity
exit_pool(balances: dict) Specify which assets/amount to withdraw by populating dictionary with key value pair (key=token: str, value=balance: number)
c) Swapswap(token_in: str, token_out: str, amount: Decimal, given_in: bool) Performs token swap based on given policy
case given_in = True:The default swap out-given-in.
case given_in = False:in-given-out, known amount of tokens we want to retrieve from the pool, and we calculate the amount needed in.
Last updated
Was this helpful?