Uniswap / v2-core

🦄 🦄 Core smart contracts of Uniswap V2
https://uniswap.org/docs
GNU General Public License v3.0
2.89k stars 3.11k forks source link

Both Amount0In and Amount0Out Present in Logs #184

Open azaidelson opened 1 year ago

azaidelson commented 1 year ago

In a lot of cases (over 6 million since inception), the UniswapV2Pair swap event is emitted with both Amount0In and Amount0Out greater than zero.

Examples:

  1. https://etherscan.io/tx/0xb91c8441ab08cd612225b4ded46054ce0a48f1e07347995ef22a4cc552c18895, log_index 69
  2. https://etherscan.io/tx/0x39b259e1ece6da2d865003875ff841cba963836458fac1bb253bb2365bcd6767, log_index 148

What does the amount0In log mean in this case? In addition, there is sometimes a mismatch between the AmounOut in the log, and the amount of token that is transferred to the next step in the route. In example 2, the amount transferred is 8755596609890 (log_index 146), while the amount_out is 9216417484093 (log_index 148).

Is there a bug in the logging mechanism?