Uniswap / v3-core

🦄 🦄 🦄 Core smart contracts of Uniswap v3
https://uniswap.org
Other
4.37k stars 2.67k forks source link

Decompilation of methods/functions provided via multicall() function #580

Open kapisolec opened 1 year ago

kapisolec commented 1 year ago

Hello, I was wondering if there is any SDK or library that would help me with decompiling/parsing data parameter (which is bytes[]) provided in multicall() function? I'm writing a transaction aggregator and only thing I really need is swap function with tokens in and out and amounts.

Eg.

Function: multicall(uint256 deadline,bytes[] data)

MethodID: 0x5ae401dc
[0]:  0000000000000000000000000000000000000000000000000000000063387ccb
[1]:  0000000000000000000000000000000000000000000000000000000000000040
[2]:  0000000000000000000000000000000000000000000000000000000000000002
[3]:  0000000000000000000000000000000000000000000000000000000000000040
[4]:  0000000000000000000000000000000000000000000000000000000000000160
[5]:  00000000000000000000000000000000000000000000000000000000000000e4
[6]:  04e45aaf0000000000000000000000009d71ce49ab8a0e6d2a1e7bfb89374c93
[7]:  92fd6804000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead908
[8]:  3c756cc200000000000000000000000000000000000000000000000000000000
[9]:  0000271000000000000000000000000000000000000000000000000000000000
[10]: 00000002000000000000000000000000000000000000000000000a968163f0a5
[11]: 7b400000000000000000000000000000000000000000000000000000241c969b
[12]: 1d3252dc00000000000000000000000000000000000000000000000000000000
[13]: 0000000000000000000000000000000000000000000000000000000000000000
[14]: 0000000000000000000000000000000000000000000000000000000000000044
[15]: 49404b7c000000000000000000000000000000000000000000000000241c969b
[16]: 1d3252dc00000000000000000000000034414694c4e99c7e2bd1de6649949807
[17]: bcbc710f00000000000000000000000000000000000000000000000000000000
vladweat commented 1 year ago

https://pypi.org/project/web3-input-decoder/

Jonkrua commented 1 year ago

https://pypi.org/project/web3-input-decoder/

It seems to decode the UniV3 multicall function failed?

decodeUniV3Router2SwapData decoded_data:[('uint256', 'deadline', 1684440993), ('bytes[]', 'data', (b"\xb8X\x18?\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00h\xb3FX3\xfbr\xa7\x0e\xcd\xf4\x85\xe0\xe4\xc7\xbd\x86e\xfcE\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xac\xe4'\x99\x7f\xe2\xba\xa4V[J\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06K\x9e\x89\xa8@\xd7x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00+\x1e\x91~vK\xc3M;\xc3\x13\xfe\x81Y\xa6\xbd\x9d\x9f\xfdE\r\x00\x0b\xb8\xc0*\xaa9\xb2#\xfe\x8d\n\x0e\\O'\xea\xd9\x08<ul\xc2\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", b'I@K|\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06K\x9e\x89\xa8@\xd7x\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xaf#X\xe9\x86\x83&\\\xbd:HP\x91#\xd3\x90\xdd\xf5E4'))]