---
title: "fluxswap: Decentralised exchange in Solidity | VulCode"
description: "fluxswap is a decentralised exchange (DEX) protocol in Solidity: contracts for swapping tokens directly on the blockchain, with no intermediary."
url: "https://vulcode.com/en/portfolio/other/fluxswap"
lang: "en"
---

[Other](https://vulcode.com/en/portfolio/other)

# fluxswap

Decentralised exchange in Solidity

A set of smart contracts for a decentralised exchange (DEX), written in Solidity and built with Foundry. It covers liquidity pools, a router, staking and a timelock.

## About the project

fluxswap is a decentralised exchange (DEX) protocol in Solidity: contracts for swapping tokens directly on the blockchain, with no intermediary. It consists of liquidity pools (contracts that hold the funds to be swapped), a router that directs operations to the pools, staking and a timelock, which delays the execution of operations. It is built with Foundry, a toolkit for building and testing contracts, and has full test coverage plus invariants: conditions that must hold after every operation.

## The challenge

In a DEX protocol the contracts move real funds, so a bug in the code is not a defect to fix in the next release, it is lost money. That is why invariants and full test coverage mattered, rather than the mere impression that a contract works.

## What we did

- 01 Liquidity pool contracts

- 02 A router that directs operations to the right pools

- 03 A staking contract

- 04 A timelock that delays the execution of operations

- 05 Invariant tests and full test coverage in Foundry

## Related projects

- [**gambit** A chess engine written in Scala 3 and built with the scala-cli tool. It generates moves, evaluates positions and picks the move to play on its own.](https://vulcode.com/en/portfolio/other/gambit)

- [**warren** A roguelike game written in Lua and played in the terminal. Every run is generated afresh, and part of your progress stays with you between runs.](https://vulcode.com/en/portfolio/other/warren)

- [**kite** A Scheme interpreter written in Swift, with an interactive REPL console and a runner for .scm files. It supports continuations, macros and exact arithmetic on arbitrarily large numbers.](https://vulcode.com/en/portfolio/other/kite)

## Describe your project.

A free quote comes back within an hour during working hours.

### Rather skip the form?

Ask in the chat or write to us directly.

Open the chat

- **Email**: [hello@vulcode.com](mailto:hello@vulcode.com)
- **Phone**: [+48 576 043 920](tel:+48576043920)
- **Discord**: [discord.gg/vulcode](https://discord.gg/vulcode)

## Tell us what you want to build.

A free quote comes back within an hour during working hours. You talk to the person who writes the code.

[Free quote](https://vulcode.com/en/quote) [Free consultation](https://vulcode.com/en/consultation)

- [hello@vulcode.com](mailto:hello@vulcode.com)

- [+48 576 043 920](tel:+48576043920)

- [discord.gg/vulcode](https://discord.gg/vulcode)
