Responsible for building Move script transactions for swap execution through the Hippo aggregator protocol.
- Purpose: convert swap routes into function arguments for the Hippo aggregator
DEX identifier mapping:
| Code | DEX |
|---|---|
| 8 | Pontem (Liquid) |
| 9 | Aptoswap |
| 10 | Aux |
| 11 | Animeswap |
| 12 | Cetus |
| 13 | Pancake |
| 14 | Obric |
| 15 | Thala |
Selection of the flash-loan collateral coin:
- USDC / USDT / BTC / Aptoge
- Purpose: generate function arguments and type parameters for the V1 contract (up to 3 swap steps)
- Logic:
- Convert each swap step in the route into
DexSwapInfo - Extract the first three steps (the rest default to 0)
- From each step, extract:
- DEX code, direction (
is_x_to_y), output coin, curve type
- DEX code, direction (
- Assemble the function arguments:
input_amount,min_out,num_steps, and parameters for each step - Assemble the type tags: output coins (Y, Z), curve types (C1, C2, C3), loan counter coin, loan curve
- Convert each swap step in the route into
- Purpose: generate arguments for the V2 contract (V1 + added
pool_typeparameter) - Additional logic: each step includes
pool_type(u64). Used to distinguish Thala protocol Weighted/Stable pools
- Purpose: build Move script transactions for the Hippo aggregator
| Function | Contract | Loan |
|---|---|---|
build_hippo_aggregator_script_v1() |
V1 | Yes (up to 5000 gas) |
build_hippo_aggregator_script_v1_no_loan() |
V1 | No |
build_hippo_aggregator_script_v2() |
V2 | Yes |
build_hippo_aggregator_script_v2_no_loan() |
V2 | No |
- Logic: constructs
TransactionBasefrom the Move package in thecontracts/oinori_swap_v{1|2}{|_no_loan}/directory