Skip to content

getting values of emitted events #543

Closed
@stillmatic

Description

@stillmatic

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)

    function createThing(string memory _name, uint256 _value) public {
        address clone = createClone(libraryAddress);
        Thing(clone).init(_name, _value);
        emit ThingCreated(clone, libraryAddress);
    }

the tests then pick up this address by doing

 _factory.createThing(name, value)
          .then(tx => {
            return Thing.at(tx.logs[0].args.newThingAddress);
          })

Is there a similar way to get the logged / emitted events and their arguments in forge?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions