Replies: 1 comment
-
// prepare your interface, it should contain all the functions that the multicall may call
const uniswapInterface = new ethers.utils.Interface([
'function multicall(bytes[] data)',
'function selfPermit(address, uint256, uint256, uint8, bytes32, bytes32)',
'function exactInput(tuple(bytes,address,uint256,uint256,uint256))',
'function unwrapWETH9(uint256, address)'
])
// decoding the top level multicall
const tx = await provider.getTransaction('0x58baef119f9ccfdea7288b43d0153347837f673f9902dfc0b8ac1d0f6b1ed0ff');
// gives an array of hex strings
const calldataArray = uniswapInterface.decodeFunctionData(tx.data.slice(0,10), tx.data)
// decoding individual call
for(const calldata of calldataArray) {
// decoding each log. if you don't have the function in the uniswapInterface, this would throw
console.log(uniswapInterface.decodeFunctionData(calldata.slice(0,10), calldata));
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Uniswap v3 makes use of a multicall method. Etherscan somehow shows the fully decoded input data:

I'm trying to figure to decode the input with ethers.js to get the same result.
Here is example tx: https://etherscan.io/tx/0x58baef119f9ccfdea7288b43d0153347837f673f9902dfc0b8ac1d0f6b1ed0ff
Someone made a demo here, but that's written in GoLang. Hard to get my head around.
Beta Was this translation helpful? Give feedback.
All reactions