Skip to content
Discussion options

You must be logged in to vote

The 4 booleans in vm.expectEmit map directly to the event's topics and data:

vm.expectEmit(checkTopic1, checkTopic2, checkTopic3, checkData);

In Solidity events, indexed parameters become topics (topic1, topic2, topic3) and non-indexed parameters go into the data field. Topic0 is always the event signature hash and is checked automatically.

So for your event:

event Staked(address indexed user, uint256 indexed poolId, uint256 amount, uint256 timestamp);

The mapping is:

Position What Your event
topic0 Event signature (auto-checked) keccak256("Staked(address,uint256,uint256,uint256)")
topic1 → checkTopic1 1st indexed param user (address)
topic2 → checkTopic2 2nd indexed param po…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by NekoCrypto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants