How Can I decode the follwing input.
asmitbhantana opened this issue · comments
`
#. | name | type | data |
---|---|---|---|
0 | commands | bytes | 0x0a00 |
1 | input | bytes[] | 0x000000000000000000000000d87ba7a50b2e7e660f678a895e4b72e7cb4ccd9c000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000063f466c700000000000000000000000000000000000000000000000000000000000000000000000000000000000000004648a43b2c14da09fdf82b161150d3f634f404910000000000000000000000000000000000000000000000000000000063cce0cf00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000414531ca58fc18b39c7cc536418799f22b4cb41b9b520a1f2a1de874b005a9781c2946401a8ff84c773ec83880e3b80e089cfa403d3b82cde1157ac587c8be29031c00000000000000000000000000000000000000000000000000000000000000 |
2 | input | bytes[] | 0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000001fe1172bf000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bd87ba7a50b2e7e660f678a895e4b72e7cb4ccd9c000bb8b4fbf271143f4fbf7b91a5ded31805e42b2208d6000000000000000000000000000000000000000000 |
3 | deadline | uint256 | 1674371292 |
` |
I can see inside of the dispatcher we have following code
if (command < 0x20) {
if (command < 0x10) {
// 0x00 <= command < 0x08
if (command < 0x08) {
if (command == Commands.V3_SWAP_EXACT_IN) {
(address recipient, uint256 amountIn, uint256 amountOutMin, bytes memory path, bool payerIsUser)
= abi.decode(inputs, (address, uint256, uint256, bytes, bool));
address payer = payerIsUser ? msg.sender : address(this);
v3SwapExactInput(recipient.map(), amountIn, amountOutMin, path, payer);
`
Although I tried to use the web3 to decode but could not decode the correct values.
Here is what I tried.
const Web3 = require('web3');
const web3 = new Web3('http://localhost:8545');
const input1 = "0x000000000000000000000000d87ba7a50b2e7e660f678a895e4b72e7cb4ccd9c000000000000000000000000ffffffffffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000063f466c700000000000000000000000000000000000000000000000000000000000000000000000000000000000000004648a43b2c14da09fdf82b161150d3f634f404910000000000000000000000000000000000000000000000000000000063cce0cf00000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000414531ca58fc18b39c7cc536418799f22b4cb41b9b520a1f2a1de874b005a9781c2946401a8ff84c773ec83880e3b80e089cfa403d3b82cde1157ac587c8be29031c00000000000000000000000000000000000000000000000000000000000000";
const input2 = "00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000005f5e1000000000000000000000000000000000000000000000000000000001fe1172bf000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002bd87ba7a50b2e7e660f678a895e4b72e7cb4ccd9c000bb8b4fbf271143f4fbf7b91a5ded31805e42b2208d6000000000000000000000000000000000000000000";
console.log(web3.eth.abi.decodeParameters(['address', 'uint256', 'uint256', 'address', 'address', 'bool' ], input1+input2));
Is there any solution on how we can decode the inputs ?
Hi! Sorry for the slow response. Do you still need help with this?