In this commit, we moved some events from a contract to a library that it uses. This, unfortunately, broke all of the tests that matched, with the following error: AssertionError: Expected event "AllowTarget" to be emitted, but it doesn't exist in the contract.
This is reasonable, since the contract did not contain the events. However, if I switch .to.emit(contract, 'AllowTarget') to .to.emit(library, 'Transfer'), the error changed to one saying the we expected the event to be emitted but it wasn't.
In a later commit we duplicated the events back into the original contract, but still only emit them in the library, and all of the tests pass.
My assumption is that when we defined the library contract in the listener (.to.emit(library, 'Transfer')) we must have been telling it to watch the library's address, so of course it didn't emit any events.
Is there a way to make this work without duplicating or importing the events into both contracts?
i.e. assert that the contract will emit events defined in the library.
In this commit, we moved some events from a contract to a library that it uses. This, unfortunately, broke all of the tests that matched, with the following error:
AssertionError: Expected event "AllowTarget" to be emitted, but it doesn't exist in the contract
.This is reasonable, since the contract did not contain the events. However, if I switch
.to.emit(contract, 'AllowTarget')
to.to.emit(library, 'Transfer')
, the error changed to one saying the we expected the event to be emitted but it wasn't.In a later commit we duplicated the events back into the original contract, but still only emit them in the library, and all of the tests pass.
My assumption is that when we defined the library contract in the listener (
.to.emit(library, 'Transfer')
) we must have been telling it to watch the library's address, so of course it didn't emit any events.Is there a way to make this work without duplicating or importing the events into both contracts? i.e. assert that the contract will emit events defined in the library.