Swaps
Swaps executed within the vault contract by calling the swap
handlemsg. In a normal use case, routes are calculated client-side, and passed in as an array of swaps to the endpoint. An overview of the vault contract's process of executing a swap is detailed below:
flowchart subgraph User entities wc[Web client] u1(secret1...) end subgraph Vault subgraph API h[Handle Endpoint] q[Query Endpoint] end subgraph Pools p1((USDC-USDT)) p2((SCRT-USDC)) p1 -- Execute route --> p2 end end fdc{{SNO Fee Distributor}} wc -. Request .-> q wc -. "Request (permit)" .-> q q -. Simulate swap .-> Pools u1 -- Swap tx --> h u1 -- Deposit tx --> h u1 -- Withdraw tx --> h h -- Allocate balances --> Pools h -- Execute swaps --> Pools Pools -- "Send fees (sSCRT)" --> fdc
Due to the gas optimizations detailed here, swaps on Blizzard are quite efficient.