-
Notifications
You must be signed in to change notification settings - Fork 2k
getting values of emitted events #543
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
That's not currently possible but it would definitely make sense to explore a cheatcode like that. Ergonomics wise it probably wouldn't be very good since you would need to do some manual |
I just ran into a case like that too. This is also slightly related to what's been discussed in #512 as extracting parameters from loosely matched events could also be a reasonable solution for that one. |
I agree this we should have log functionality like this, though like @onbjerg mentioned UX will be probably be pretty gross unless we implement solidity pre-processing first One note is that in this specific use case you can precaclulate the expected address, then assert there's code at the address after the |
In this use case, I'd manually calculate the create2/create address via their corresponding algos using from/nonce/salt/bytecode hash. More generally, similar to how we record accessed storage slots, should we add a |
Is this in the roadmap somewhere? I was porting some Ethernaut, and while you can modify the contract I have 3 days of experience with forge 😅, @gakonst is talking above of some gotchas on implementing this, however I see that the logs are outputted at the traces.: Anyways, I'm happy to brush up my rust skills and implement this cheat code if it is in the roadmap. Where should I go? Who should I talk to? |
You can use |
Started work on implementing https://github.com/bentobox19/foundry/commits/feature/capture-logs I'd like to set a draft PR in this repository |
Alright, just started a draft PR. Hope I can squeeze the hours to get it done 😅 |
I'm looking at updating https://github.com/optionality/clone-factory and testing it with forge.
One of the functions does the following, and emits an event with the clone address (vs returning it)
the tests then pick up this address by doing
Is there a similar way to get the logged / emitted events and their arguments in forge?
The text was updated successfully, but these errors were encountered: