alchemistcoin / sandwiched-backend

GNU General Public License v3.0
25 stars 7 forks source link

Compute profits in both directions #32

Closed henridf closed 3 years ago

henridf commented 3 years ago

Previously, we only considered the case where the trader made a profit in the 'natural' forward direction:

where y-x is the profit (in tok1). This makes most sense when tok1 is ETH.

But it is also possible to take a profit in the other direction:

where x-y is the profit (in tok2). This makes most sense when tok2 is ETH, and the transaction being sandwiched is swapExactTokensForEth.

henridf commented 3 years ago

close #28