Fix: Invariant emitted in swap event is incorrect
Alexangelj opened this issue · comments
Description
In swap, the next invariant is computed in the invariant check:
portfolio/contracts/Portfolio.sol
Lines 526 to 532 in 7320ddd
However, while this nextInvariant is the valid invariant without the fees being considered, the actual invariant should include the fees that were added to the pool, which is not updated until after this amount is computed:
portfolio/contracts/Portfolio.sol
Lines 552 to 556 in 7320ddd
Update the nextInvariantWad to use the nextIndependent
value for either X or Y reserves.
Closing for now. Emits the pre-fee invariant.