fix amendment: AMM swap should honor invariants: (#5002)

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.

Co-authored-by: Bronek Kozicki
Co-authored-by: thejohnfreeman
This commit is contained in:
seelabs
2024-04-22 11:53:47 -04:00
committed by Scott Determan
parent b65cea1984
commit 3f7ce939c8
10 changed files with 1602 additions and 702 deletions

File diff suppressed because it is too large Load Diff