You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
I believe this is caused by a wrong assumption that swapping back and forth only costs 3% in fees.
/* Swapping x of testToken1 for y token of testToken2 and back should (roughly) give user x of testToken1. The following function checks this condition by assessing that the resulting x is no more than 3% from the original x. ... */
...
assert((x - xOut) *100<=3* x); // (x - xOut) / x <= 0.03; no more than 3% loss of funds
Instead, each swap takes 3%, so the back-and-forth maximum loss should be 100% - (100%-3%)*(100%-3%) = 5.91%