/segmented-cfmm

segmented-cfmm

Primary LanguageHaskellMIT LicenseMIT

Segmented CFMM

Implementation of a constant product market making smart-contract, which allows the curve to be defined on price segments.

Based on the ideas described in the Uniswap V3 whitepaper.

CameLIGO

The ligo directory contains a CameLIGO implementation of the smart-contract, which adhears to the contract specification.

For instructions on how to compile the contract and/or its storage, please refer to the compilation document.

Error Codes

In error scenarios, the contract fails with an error code.

See the error codes document for the list of possible error codes and their description.

Liquidity mining

An example implementation of a liquidity mining contract is also included, see the dedicated document for more info.

Frontend

A frontend application is included to interact with a deployed instance of the contract.

For more information and instructions on how to run it locally, please refer to its documentation.

Testing

This repository includes several property-based and example-based tests, implemented with the cleveland test framework in the haskell/test directory.

For more information and instructions on how to run the tests, please refer to its documentation.

Python

The python directory contains a quick and dirty implementation in Python that makes no effort to implement integer based arithmetic, in order to ensure that the general logic of the contract is sound. The mutmut mutation testing framework was used to improve the test coverage.

The compute_ladders.py script uses Sage to generate some of the constants useful to compute exponentiations in the contract and verify that the precision obtained is sufficient.