2

Look at this tx : https://etherscan.io/tx/0x9854f2249f86802cb0edcff0aa6747de6c49d89b0ba0dc2038b00372b949356b

it says 0.3RTH send to uniswap and 6,447.815435380239985848 L3P got from uniswap.

However at the end when you lookd at the input data there is only

#   Name    Type    Data
0   amountOutMin    uint256 6383975678594297015691
1   path    address[]   0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
0xdeF1da03061DDd2A5Ef6c59220C135dec623116d
2   to  address 0x71749AF1e6A25DdF6F5C9711eA46FcBEbfd1FB75
3   deadline    uint256 1616231233

How did it found out (etherscan) that 0.3 eth were swapped for 6,447.815435380239985848 L3P?

Thanks

2 Answers 2

1

The Uniswap pairs contracts emit Events when a swap is performed. Emitting events is something built in the code of ethereum smart contracts.

Etherscan is only displaying these events.

4
  • 1
    Ok I'm seeing the event tabs; but since it's the contract code that emmit those events, does it means that etherscan was updated to be able to decode those events (in order to present us what kind of swap happened) or does those events follow some kind of ethereum standard?
    – Heetola
    Commented Mar 20, 2021 at 19:41
  • 1
    Events are standard to Ethereum. Etherscan shows all events for all smart contracts automatically. Here is the doc regarding Events: docs.soliditylang.org/en/v0.8.2/contracts.html#events
    – Undead8
    Commented Mar 21, 2021 at 0:22
  • 1
    yes event are standard, but are the content of the uniswap event standard or does each Dapp emmit its own kind of events and you have to adapt your program to be able to understand what is being done?
    – Heetola
    Commented Mar 21, 2021 at 8:21
  • 1
    The content of the event can change from Dapp to Dapp. The ERC20 tokens all have the same events (they are supposed to) by choice. But other Dapp may have totally custom and unique events.
    – Undead8
    Commented Mar 21, 2021 at 13:44
0

What you are looking at is a Uniswap Router transaction. People usually integrate Uniswap V2 or V3 into their contracts for setting up liquidity pool for their token.

When they import Uniswap contracts, the standard contracts are used which are industrial level and emit any changes in the state of the contract.

However, a solidity developer can edit the contracts to make functions public/private and edit the setup for emitting events wherever they like to.

It's all in the code. If you got to the contract address, click on contracts with the green tick, and select read contracts, you'll see all the functions in the contract and the contract this transaction used.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.