You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
mds1 12:04 PM
There's a few options I can think of (no idea how implementation of these compares):
First thought was a modifier similar to the revertData modifier discussed above, e.g. expectEvent("MyEvent(uint)", 45) to look for the number 45, or expectEvent("MyEvent(uint)") to consider any uint value passing (or pass the event hash instead of it's signature as a string). One problem with this syntax is you can't specify which call in your test should emit the event
Instead of expectEvent being a modifier, it could just be a method, and when called (with the same syntax as above) it checks the most recent transaction for the event
Last idea is that it could take the target and calldata and execute the call for you, e.g. expectEvent(address target, bytes calldata, string eventSignature, bytes optionalExpectedValues). This would method would need to surface the call's return data so you can still access it if needed
mrchico 3:10 AM
these are good ideas. I think option 2 is my favorite. This could also be done in a cheat code kind of way, perhaps. Like hevm.getLog(index)(bytes), giving the bytestring of the latest-index emitted log
mds1 6:16 AM
Agreed, of those option 2 was my favorite as well. The cheat code approach seems comparable, so no objections there from me. Only question is how would you get the log's bytestring from within your test?
The text was updated successfully, but these errors were encountered:
It would be great if we could test for certain events and parameter to be emitted. Quoting from the chat on possible syntaxes: https://dapphub.chat/channel/dev?msg=GisKDrLJtiAGzznyE
The text was updated successfully, but these errors were encountered: