-
Hello, I'm trying to implement something similar to https://ethtx.info (ex: https://ethtx.info/mainnet/0x1d8d154006fd2a49cb121695d5cc6ecd3cf98ba393af5edb0cbc37d0395b64a6/) I've reproduced this transaction locally on a mainnet fork and I'm trying to decode all the events that are emitted during the transaction.
const jsonInterface = new ethers.utils.Interface(abi);
const parsedLog = jsonInterface.parseLog(log); But in the interface that is generated by ethers.js, none of the events signatures match the one from the log, so it's failing with the error Any idea what I'm missing here? DSProxy is a fairly common pattern but I couldn't find any information on how to decode events. The signature in Thanks! Here is the log object: {
"blockHash":"0x3d61e1f12a3f6c60e0a3a6aeb6265d71feebb275497fe0b7a67504530a7e1cf3",
"address":"0x9e905F5b2b07b5e1dc71A86901de0E717eEBB12d",
"logIndex":0,
"data":"0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001241cff79cd00000000000000000000000082ecd135dce65fbc6dbdd0e4237e0af93ffd5038000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a49f6f3d5b0000000000000000000000005ef30b9986345249bc32d8928b7ee64de9435e3900000000000000000000000019c0976f590d67707e62397c87829d896dc0f1f10000000000000000000000009759a6ac90977b93b58547b4a71c78317f391a280000000000000000000000000000000000000000000000000000000000000743000000000000000000000000000000000000000000000cb49b44ba602d80000000000000000000000000000000000000000000000000000000000000",
"topics":[
"0x1cff79cd00000000000000000000000000000000000000000000000000000000",
"0x000000000000000000000000f75fcd9849d3365d436d0cd889ed500150c9482a",
"0x00000000000000000000000082ecd135dce65fbc6dbdd0e4237e0af93ffd5038",
"0x0000000000000000000000000000000000000000000000000000000000000040"
],
"transactionIndex":0,
"transactionHash":"0x2b440c0c840b6cb09e35eeca4750af876b7d62b08fd1ba5487bd265eb840e33a",
"blockNumber":9948023
} And the ABI: [
{
"outputs":[
],
"constant":false,
"inputs":[
{
"type":"address",
"name":"owner_"
}
],
"stateMutability":"nonpayable",
"type":"function",
"payable":false,
"name":"setOwner"
},
{
"outputs":[
{
"type":"bytes32",
"name":"response"
}
],
"constant":false,
"inputs":[
{
"type":"address",
"name":"_target"
},
{
"type":"bytes",
"name":"_data"
}
],
"stateMutability":"payable",
"type":"function",
"payable":true,
"name":"execute"
},
{
"outputs":[
{
"type":"address",
"name":"target"
},
{
"type":"bytes32",
"name":"response"
}
],
"constant":false,
"inputs":[
{
"type":"bytes",
"name":"_code"
},
{
"type":"bytes",
"name":"_data"
}
],
"stateMutability":"payable",
"type":"function",
"payable":true,
"name":"execute"
},
{
"outputs":[
{
"type":"address",
"name":""
}
],
"constant":true,
"inputs":[
],
"stateMutability":"view",
"type":"function",
"payable":false,
"name":"cache"
},
{
"outputs":[
],
"constant":false,
"inputs":[
{
"type":"address",
"name":"authority_"
}
],
"stateMutability":"nonpayable",
"type":"function",
"payable":false,
"name":"setAuthority"
},
{
"outputs":[
{
"type":"address",
"name":""
}
],
"constant":true,
"inputs":[
],
"stateMutability":"view",
"type":"function",
"payable":false,
"name":"owner"
},
{
"outputs":[
{
"type":"bool",
"name":""
}
],
"constant":false,
"inputs":[
{
"type":"address",
"name":"_cacheAddr"
}
],
"stateMutability":"nonpayable",
"type":"function",
"payable":false,
"name":"setCache"
},
{
"outputs":[
{
"type":"address",
"name":""
}
],
"constant":true,
"inputs":[
],
"stateMutability":"view",
"type":"function",
"payable":false,
"name":"authority"
},
{
"inputs":[
{
"type":"address",
"name":"_cacheAddr"
}
],
"stateMutability":"nonpayable",
"type":"constructor",
"payable":false
},
{
"stateMutability":"payable",
"type":"fallback",
"payable":true
},
{
"inputs":[
{
"indexed":true,
"type":"bytes4",
"name":"sig"
},
{
"indexed":true,
"type":"address",
"name":"guy"
},
{
"indexed":true,
"type":"bytes32",
"name":"foo"
},
{
"indexed":true,
"type":"bytes32",
"name":"bar"
},
{
"indexed":false,
"type":"uint256",
"name":"wad"
},
{
"indexed":false,
"type":"bytes",
"name":"fax"
}
],
"type":"event",
"name":"LogNote",
"anonymous":true
},
{
"inputs":[
{
"indexed":true,
"type":"address",
"name":"authority"
}
],
"type":"event",
"name":"LogSetAuthority",
"anonymous":false
},
{
"inputs":[
{
"indexed":true,
"type":"address",
"name":"owner"
}
],
"type":"event",
"name":"LogSetOwner",
"anonymous":false
}
] |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
This topic doesn't seem to me like a standard topic. Topic is the hash of the event signature, and it is very very unlikely that it can have so many zeros in it. There is a way in solidity to emit logs with custom topics, and when that is done, the standard that is implemented in ethers.js (as well as other libraries) cannot decode it by default, requires a bit more effort. |
Beta Was this translation helpful? Give feedback.
This topic doesn't seem to me like a standard topic.
0x1cff79cd00000000000000000000000000000000000000000000000000000000
Topic is the hash of the event signature, and it is very very unlikely that it can have so many zeros in it. There is a way in solidity to emit logs with custom topics, and when that is done, the standard that is implemented in ethers.js (as well as other libraries) cannot decode it by default, requires a bit more effort.