aztec-packages
aztec-packages copied to clipboard
feat: AMM
This is an implementation of a Uni v2 style DEX pool. One of the main goals of this PR was to figure out what kind of token flows we will need.
Note for reviewers
I put a lot of comments and some questions in the code. The code does not yet compile as the token is not yet updated with the flows we need but I have a high confidence that it's very close to final.
Problems
There were a couple problems I have stumbled upon:
- The need for having the liquidity token be separate from the DEX/pair contract itself. This is because we don't have inheritance in Noir and copying the contract code into the DEX is not something I am willing to go through.
- We don't have a large enough integer type that is not terrible - (
U128is too cumbersome to use because of #8271). I currently useu64everywhere but that is not sufficiently large for DeFi.
This stack of pull requests is managed by Graphite. Learn more about stacking.
Join @benesjan and the rest of your teammates on
Graphite
Superceded by https://github.com/AztecProtocol/aztec-packages/pull/8644