
Trading process
The LP is a pool controlled by a set of validators, coordinating in a TEE. Flashnet’s distributed validator network ensures the AMM fairness and execution, whilst Spark’s validator network ensures the swap finality and settlement. 1. Creating a poolTo swap, a pool must exist. Creation happens by signing an intent payload with information like:
- Pool type
- Assets in the pool
- Fee rates
- Misc pool details (e.g., virtual reserve parameters and graduation threshold for single‑sided)
- For single-sided pools, the creator must deposit the declared Asset A amount. The SDK transfers funds and confirms the deposit automatically.
- For constant product pools, deposit both assets in the current pool ratio. Excess amounts are atomically refunded.
- Provide
assetAMinAmountIn
andassetBMinAmountIn
to protect against price movement during deposit. - Validators validate the intent and claim funds into the LP.
- The pool becomes live after a valid deposit.
- The user can now swap against the pool. First, simulate to preview expected output and price impact. Then sign a swap intent with
maxSlippageBps
andminAmountOut
, transfer funds, and submit the signed intent. The validators validate and execute the swap atomically. - The swap settles instantly, and funds are swapped directly to the users non-custodial wallet.
Host and integrator fees are taken exclusively in Asset B of the pool. LP fees are taken as asset in.