-
Ethers Version5.6.2 Search TermsparseLog Describe the ProblemparseLog and also decodeEventLog return data out-of-bounds errors when decoding an event log. It also occurs in the ethers playground Code Snippetlet abi = [
'event Transfer(address indexed from, address indexed to, uint256 value)',
];
let iface = new ethers.utils.Interface(abi);
let transfer = {
blockNumber: 14534097,
blockHash:
'0x0e5cb049183c69e0b5b687b145d2197a7f391a4c12c7110cb058833c90cc7370',
transactionIndex: 3,
removed: false,
address: '0xB361c21cEd81AE39Ee41083ea2126936133EB20c',
data: '0x',
topics: [
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
'0x0000000000000000000000000000000000000000000000000000000000000000',
'0x00000000000000000000000026aec79cbb9aea4a71cd51bb5e858801191493da',
'0x0000000000000000000000000000000000000000000000000000000000000a17',
],
transactionHash:
'0x009b264d4e75518527259e932a195393df4cef45733bf139647550b040c1180d',
logIndex: 6,
};
iface.parseLog(transfer); Contract ABI['event Transfer(address indexed from, address indexed to, uint256 value)'] ErrorsUnhandledPromiseRejectionWarning: Error: data out-of-bounds (length=0, offset=32, code=BUFFER_OVERRUN, version=abi/5.6.0) Environmentnode.js (v12 or newer) Environment (Other)ubuntu |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Your ABI doesn't match your log. Your ABI indicates 2 indexed properties ( My guess is that your ABI should read Make sense? |
Beta Was this translation helpful? Give feedback.
Your ABI doesn't match your log. Your ABI indicates 2 indexed properties (
from
andto
), while your log has 3 indexed properties (1 topic for the event name and 3 additional topics, each mapping to an indexed property).My guess is that your ABI should read
"event Transfer(address indexed from, address indexed to, uint256 indexed value)"
(notice the addition ofindexed
to value).Make sense?