A basic solver to find the optimal trading distribution between 3 given UniV2 style exchanges.
To run basic tests:
make test
This is a nile project. So to setup run:
pip install cairo-nile
nile install
basic_solver.cairo
implements a basic gradient descent algorithm to find the amount trading input required for each DEX to receive the maximum output.
This implementation is extremely inflexible and not close to production ready. It is also overkill for the task that is being solved. However, it has been a good first step for me in getting more accustomed with cairo and is the first step in creating more powerful solvers that:
- Utilizes Uint256
- Utilizes a larger and flexible number of DEXes
- Finds an optimal route and performs multiple jumps
With this implementation I have also prioritized performance over readability. Future iterations will include a document that explains the execution process and the math behind the model.