/spot

Demo of a spot DEX built with Sway for the Fuel L2 scaling solution

Primary LanguageRustGNU General Public License v3.0GPL-3.0

Spot 🐕 License: LGPL3.0

Spot is a multi-pool type DEX built on Fuel.

Package Description
@spot/abis Contract ABIs used throughout the whole repo
@spot/factory_registry The contract where all Spot factories are whitelisted
@spot/fee_swapper The contract where all protocol fees are swapped to a single token
@spot/pools/constant_product The XYK pool type and its associated factory
@spot/pools/stable The stableswap pool type and its associated factory
@spot/router The contract used to swap tokens as well as LP and withdraw liquidity from Spot pools

Usage ⚒️

To compile the smart contracts, you need to have fuelup and the Fuel toolkit installed locally and then execute the following (in any of the smart contract packages):

$ forc build

Requirements

  • fuelup 0.2.2
  • rustc 1.62.1 (e092d0b6b 2022-07-16)
  • forc 0.20.2

Clean

To clean up smart contract builds, run the following in either of the packages:

$ forc clean

Test

To run tests in any package, execute:

$ forc test

TODOs 💻

  • Lots and lots of unit/integration tests
  • Check contract binaries when adding pools in factories
  • Add logic to handle block timestamps in pool contracts
  • Remove unnecessary casting to u64 in pool code to avoid precision loss
  • Implement sqrt directly for U128 instead of casting to u64 before applying it
  • Use u256 for math