-
Notifications
You must be signed in to change notification settings - Fork 121
Open
Description
expectEvent() is not capturing an expected event (SmartContract is correct and tested in other ways)
in expectEvent() I has to put:
return ({ event: receipt.events[name].event, args: receipt.events[name].args });
instead of:
return ({ event: name, args: receipt.events[name].returnValues });
I guess because of the different Event format expected. In concrete, Event names are expected to be the array keys (which are not: they are _item_.event), and args are expected to be _item.returnValues (I have _item_.args instead)
I attach here a sample of the transaction receipt I get:
{
to: '...',
from: '0x709...97970C51812dc3A010C7d01b50e0d17dc79C8',
...
logs: [
...,
{
transactionIndex: 0,
blockNumber: 23,
transactionHash: '0xe8fe248cc5334ee1bb2b3fabf069409724ff05dde5594316387864fd871d7bd8',
address: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
topics: [Array],
data: '0x',
logIndex: 2,
blockHash: '0x7a8251b36220cdc989df062d06f882b0560d174ac43baa27e63fe3601badf8a6'
}
],
...
events: [
...,
{
transactionIndex: 0,
blockNumber: 23,
transactionHash: '0xe8fe248cc5334ee1bb2b3fabf069409724ff05dde5594316387864fd871d7bd8',
address: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9',
topics: [Array],
data: '0x',
logIndex: 2,
blockHash: '0x7a8251b36220cdc989df062d06f882b0560d174ac43baa27e63fe3601badf8a6',
args: [Array],
decode: [Function (anonymous)],
event: 'MintElementsEvent',
eventSignature: 'MintElementsEvent(uint32[],address)',
removeListener: [Function (anonymous)],
getBlock: [Function (anonymous)],
getTransaction: [Function (anonymous)],
getTransactionReceipt: [Function (anonymous)]
}
]
}
My environment:
Solidity: 0.8.17
"hardhat": "^2.12.4",
"ts-node": "^10.9.1",
"typescript": "^4.9.4"
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomiclabs/hardhat-ethers": "^2.2.2",
"@openzeppelin/test-helpers": "^0.5.16",
"@typechain/hardhat": "^6.1.5",
"ethers": "^5.0.0",
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels