API reference v2

This section describes different op codes of AMM smart contracts v2

API reference

Overview

The section contains separate documents for each smart contract used in AMM:

Definitions of terminology used can be found in Glossary

Example schemes

Example schemes can be found here:

Op code list

A table with DEX v2 op codes:

New DEX v2 features:

Swap

  • custom payload & nested operations after swaps

  • chain multiple swaps on the same Router

  • chain multiple swaps on different v2 Routers

  • custom refund address and payload on swap failure

Liquidity

  • custom payload after liquidly provision

  • chained swap and liquidity provision on the same Router

  • improved initial liquidity locking management, no coins are lost anymore

  • now always mints a maximum possible amount of lp tokens to user even if provision ratio is different from current one in Pool

  • single side liquidity provision

Referral

  • referral fees are stored in Vault contract

  • custom referral fee value in each swap (maximum 1%)

pTON v2

  • now uses a custom op code for ton transfers

  • ton transfer to user is non-bouncable

  • improved gas management

  • can chain ton transfers between 2 pTON wallets (to chain pTON swaps on v2 Routers)

Other

  • LpAccount and Vault are deleted if they have 0 tokens on balance to avoid paying storage cost

  • better error management: no coins are lost if Pool doesn't exist / payload is not correct

  • complete refactoring of the codebase and usage of libs in masterchain to make all operations cheaper

  • fixed various excesses issues

  • fixed some Pools having broken get_jetton_data

Removed

Pool

  • off-chain get_expected_outputs

  • off-chain get_expected_tokens

  • off-chain get_expected_liquidity

  • on-chain getter_expected_outputs

  • on-chain getter_expected_tokens

  • on-chain getter_expected_liquidity

  • user-called collect_fees

Last updated