execute_swap_operationsfunction to perform multi-hop swap operations. Hopes execute one-by-one and the last swap will return the ask (requested) token.
execute_swap_operationsfunction can takes in
operationsparameter. The former performs a swap with non-native tokens via one of the Astroport pools while the latter performs native swaps using Terra's built-in market module. The function also takes in an
askinfo for both swaps in the operation, as well as additional parameters:
minimum_received- Used to guarantee that the ask amount is above a minimum amount
to- This is the recipient of the ask tokens
max_spread- The spread is calculated as the difference between the ask amount (using the constant pool price) before and after the swap operation. Once
max_spreadis set, it will be compared against the actual swap spread. In case the swap spread exceeds the provided max limit, the swap will fail. Note that the spread is calculated before commission deduction in order to properly represent the pool's ratio change
minimum_receive. This is an internal function.
simulate_swap_operationsquery to simulate a one or multi-hop swap operation. The query takes in
operationsparameter. The function also takes in an
askfor both tokens in the operation, as well as additional parameters:
offer_amount- This is the number of offer assets being swapped.