Skip to content

Latest commit

 

History

History
43 lines (38 loc) · 2.24 KB

v2path_encode.md

File metadata and controls

43 lines (38 loc) · 2.24 KB

Run through of v2 path encoding for manual building of calldata


0x791ac94700000000000000000000000000000000000000000000000000000000004c3f88000000000000000000000000000000000000000000000000000ac2d7237640f900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000013a48c3e0a403b6cf1a59fbd600e284e620b37ed0000000000000000000000000000000000000000000000000000000065211d050000000000000000000000000000000000000000000000000000000000000002000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc800000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
Function: swapExactTokensForETHSupportingFeeOnTransferTokens(uint256 amountIn, uint256 amountOutMin, address[] path, address to, uint256 deadline)

MethodID: 0x791ac947
[0]:  00000000000000000000000000000000000000000000000000000000004c3f88
[1]:  000000000000000000000000000000000000000000000000000ac2d7237640f9
[2]:  00000000000000000000000000000000000000000000000000000000000000a0
[3]:  00000000000000000000000013a48c3e0a403b6cf1a59fbd600e284e620b37ed
[4]:  0000000000000000000000000000000000000000000000000000000065211d05
[5]:  0000000000000000000000000000000000000000000000000000000000000002
[6]:  000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8
[7]:  00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1
# Name Type Data
0 amountIn uint256 4997000
1 amountOutMin uint256 3028979035816185
2 path address[] 0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8, 0x82aF49447D8a07e3bd95BD0d56f35241523fBab1
3 to address 0x13A48c3E0A403B6CF1a59FBd600E284E620b37ED
4 deadline uint256 1696668933
  • Offset to array: [2]: 00000000000000000000000000000000000000000000000000000000000000a0
>>> round(int(0xa0)/32)
5
  • Length of array: [5]: 0000000000000000000000000000000000000000000000000000000000000002
>>> int(0x02)  # for completeness
2
  • Elements of array:
    • [6]: 000000000000000000000000ff970a61a04b1ca14834a43f5de4533ebddb5cc8
    • [7]: 00000000000000000000000082af49447d8a07e3bd95bd0d56f35241523fbab1