SIP-236: Fix Exchange before fee reclaimation evaluation

Author
StatusImplemented
TypeGovernance
NetworkEthereum & Optimism
ImplementorMEB (@barrasso)
ReleaseAlpheratz
ProposalLoading status...
Created2022-05-11

Simple Summary

Exchanger.exchange does not use the post-reclaim amount to calculate the amount of exchange for the user trade. This leads to the user being left with more of their source token then they should have had.

Abstract

Exchanger.exchange does not use the post-reclaim amount to calculate the amount of exchange for the user trade. This leads to the user being left with more of their source token then they should have had.

A similar bug has been found ExchangerWithFeeRecAlternatives that would affect L1, and will be similarly patched.

Tests

In Exchanger tests, the following are added:

  • settlement tests
    • trade sUSD->sEUR
      • sEUR price doubles
        • -> trade from sEUR->sBTC results in amount after fee reclamation
      • sEUR price halves
        • -> trade from sBTC->sEUR results in amount after fee reclamation

N/A

Copyright and related rights waived via CC0.