📜Scenarios

Scenarios

Deploy/Init Pool

Pool deployment is triggered by the administrator of the AMM (this person is also the administrator of the router contract - router::admin_address) by invoking the operation CREATE_POOL. Pool deployment leads to the processing of the POOLV3_INIT operation inside the pool contract. This operation is used both - during the initial pool deployment and when the pool administrator wants to change some crucial parameters. Pool deployment consists of two stages

I. Forming and sending state_init data that holds

  • Router address

  • Jetton0/Jetton1 wallet addresses (these are attached to the router)

  • Account contract code

  • Position NFT contract code

Next newly created pool would only accept the init message from the router and admin(which is set to BLACK_HOLE_ADDRESS in state_init). No operations (except for POOLV3_INIT) would be processed while the administrator address is equal to BLACK_HOLE_ADDRESS.

This ensures that the only thing that could activate the pool is the init operation sent by the pool

II. state_init message holds as a body POOLV3_INIT operation

This message will be accepted and sets all the data that is needed for pool operation, including an optional flag that would activate the pool and make it available for mints and swaps

Mint

Position minting is done by sending two jettons to the router. Generally user calls pool::getMintEstimate to estimate the amount of the jettons that the person needs to send to mint a particular amount of liquidity in the given price range (tick range). Optionally user may send more jettons than needed to account for possible slippage.

While sending both jettons to router wallets, the user sends the payload that contains the position parameters. On receiving the jettons (operation JETTON_TRANSFER_NOTIFICATION ) router would compute the pool address and forward the operation to the pool (POOLV3_FUND_ACCOUNT)

Swap

Generally user calls pool::getSwapEstimate to estimate the amount of the jettons that he/she needs to send to swap

Burn and Collect

Last updated