Skip to Content
Stacks SwapContractsContracts

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.

AdapterPlatformPool Type
alex-adapter-1ALEXWeighted AMM (amm-v2)
arkadiko-adapter-1ArkadikoClassic (constant-product)
bitflow-adapterBitflowClassic (XYK)
stableswap-adapterBitflow / VelarStableSwap
dlmm-adapterBitflowConcentrated liquidity (DLMM)
velar-adapterVelarClassic (univ2)
velar-stableswap-adapterVelarCurve-style StableSwap
stacking-dao-receipt-adapterStacking DAOstSTX and stSTXbtc protocol conversion

Contract Addresses

All contracts are deployed under the Zest Protocol Stacks Swap deployer address on Stacks mainnet: SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.

ContractAddress
RoutersSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.zr-*
ALEX AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.alex-adapter-1
Arkadiko AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.arkadiko-adapter-1
Bitflow AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.bitflow-adapter
Stableswap AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.stableswap-adapter
DLMM AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.dlmm-adapter
Velar Adapters

SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.velar-adapter
SP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.velar-stableswap-adapter

StackingDAO AdapterSP3EWCDA3V8HCP64CSETSNYXZ25WC4AJ95EC0ZEST.stacking-dao-receipt-adapter
Last updated on