Submitted by 0xAlix2
/contracts/pool-manager/src/queries.rs#L117-L120
Mantra only allows exact-in swaps; however, it provides a way for traders to compute a required amount to get an exact amount out. This could be done using query_reverse_simulation, from the code comments:
query_reverse_simulation considers all the variable factors that affect the amounts in and out, most importantly fees. However, the issue is that for stable swaps it doesnt consider extra fees, it just account swap, protocol, and burn fees:
This leads to a wrong offer_amount returned, leading to a wrong ask return_amount, ultimately leading to unexpected results for traders and unexpected reverts to contracts built on top of this.
Add the following test in contracts/pool-manager/src/tests/integration_tests.rs:
Make sure extra fees are accounted for in the before_fees calculation:
3docSec (judge) commented:
jvr0x (MANTRA) disputed and commented:
3docSec (judge) commented:
