Contracts
Zest Protocol Stacks Swap runs on open Clarity smart contracts deployed on Stacks mainnet. The contracts fall into three groups.
Router Contracts (zr-*)
The routers execute swaps. Each route, whether a single pool, multi-hop, or split across DEXes, runs through one router contract in a single atomic transaction. Every router enforces the same guarantees:
- Measured output: the amount received is measured from what the pools actually delivered, never estimated
- Minimum received: if the measured output is below the minimum in the signed transaction, the swap reverts
- Deadline: a swap that confirms too late reverts instead of executing on stale prices
- Atomic settlement: routers hold zero user funds between swaps. Input is pulled from the wallet and output is delivered to the wallet within the same transaction.
On a Stacks explorer, a swap appears as a call to a contract with a name like zr-a-0 and a function like r-xs. This identifies the router and the specific route shape the swap used.
Adapter Contracts
Each supported DEX has an adapter, a thin contract that translates the router’s uniform swap interface into that DEX’s own pool interface. Adapters are stateless and never hold a balance between swaps.
| Adapter | Platform | Pool Type |
|---|---|---|
alex-adapter-1 | ALEX | Weighted AMM (amm-v2) |
arkadiko-adapter-1 | Arkadiko | Classic (constant-product) |
bitflow-adapter | Bitflow | Classic (XYK) |
stableswap-adapter | Bitflow / Velar | StableSwap |
dlmm-adapter | Bitflow | Concentrated liquidity (DLMM) |
velar-adapter | Velar | Classic (univ2) |
velar-stableswap-adapter | Velar | Curve-style StableSwap |
stacking-dao-receipt-adapter | Stacking DAO | stSTX and stSTXbtc protocol conversion |
Contract Addresses
All contracts are deployed under the Zest Protocol Stacks Swap deployer address on Stacks mainnet: SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.
| Contract | Address |
|---|---|
| Routers | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.zr-* |
| ALEX Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.alex-adapter-1 |
| Arkadiko Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.arkadiko-adapter-1 |
| Bitflow Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.bitflow-adapter |
| Stableswap Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.stableswap-adapter |
| DLMM Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.dlmm-adapter |
| Velar Adapters |
|
| StackingDAO Adapter | SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.stacking-dao-receipt-adapter |