Pool Functions

a) Add Liquidity = join policy

  • p_join_pool (all-asset deposit)

  • p_join_swap_extern_amount_in (single-asset deposit, known amount of tokens going in the pool and calculating pool shares as a result)

b) Withdraw Liquidity = exit policy

  • p_exit_pool (all-asset withdrawal)

  • p_exit_swap_extern_amount_out (single-asset withdrawal, known amount of tokens out of the pool) # NOTE, next version will use p_exit_swap_pool_amount_in, most used method.

c) Swap = swap policy

  • p_swap_exact_amount_in (out-given-in)

Balancer Pools offer additional transaction types:

  • p_swap_exact_amount_out (in-given-out, known amount of tokens we want out of the pool, calculate needed tokens in)

  • p_join_swap_pool_amount_out (pool_out_given_single_in, known amount of pool shares we want, calculate needed amounts of 1 token in)

  • p_exit_swap_pool_amount_in(single_out_given_pool_in, known amount of pool shares to send to the pool and burn, single asset withdrawal calculated)

  • These transactions are not implemented in Balancer Simulations V1.0 since we are using data from LOG_JOIN, LOG_EXIT and LOG_SWAP events from the BPool contract. These sources don't provide information on the exact method selected by a pool user.

Fees

In Balancer Pools, swap, join_swap and exit_swap transactions are subject to a fee. This fee is defined by the swap_fee pool variable. In our model, we compute the token fee value as defined in BMath methods and store it in generated_fee_(tokensymbol) state variables to make it accessible for simulations.

For details how we map on-chain transaction data to Balancer Pool functions, please visit the section system_policies.py.

Last updated