Closed seelabs closed 2 months ago
fix amendment: AMM swap should honor invariants:
The AMM has an invariant for swaps where:
new_balance_1*new_balance_2 >= old_balance_1*old_balance_2
Due to rounding, this invariant could sometimes be violated (although by very small amounts).
This patch introduces an amendment fixAMMRounding that changes the rounding to always favor the AMM. Doing this should maintain the invariant.
fixAMMRounding
.gitignore
Attention: Patch coverage is 60.52632% with 30 lines in your changes are missing coverage. Please review.
60.52632%
30 lines
Project coverage is 70.9%. Comparing base (b422e71) to head (b90f58d).
b422e71
b90f58d
High Level Overview of Change
fix amendment: AMM swap should honor invariants:
The AMM has an invariant for swaps where:
Due to rounding, this invariant could sometimes be violated (although by very small amounts).
This patch introduces an amendment
fixAMMRounding
that changes the rounding to always favor the AMM. Doing this should maintain the invariant.Type of Change
.gitignore
, formatting, dropping support for older tooling)