> For the complete documentation index, see [llms.txt](https://docs.ecko.finance/eckodao/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ecko.finance/eckodao/eckodex/how-to-swap/x-swap.md).

# X-Swap

### X-Swap

A fork of [kadenaswap](https://github.com/kadena-io/kadenaswap) (a Uniswap V2 port to pact), with support for global exchange fees (equivalent to Uniswap's `_mintFee`) and time-weighted average price oracle data, with support for tracking the TWAP of longer swap paths like `[tokenA coin tokenB]`.

The code is in the `kadenaswap/` directory and the following are the main files:

* `exchange.pact`: The core of the exchange, represents all the pairs and includes code for adding and removing liquidity, swapping, oracles, and more.
* `tokens.pact`: Simple module for keeping track of liquidity tokens across all pairs. Each token is identified by a key, and has a similar interface to `fungible-v2` modules.
* `gas-station/gas-station.pact`: Module for managing the gas station that is used with the exchange.
* `exchange.repl`, `oracle.repl` and `gas-station/gas-station.repl`: Test files.
