Imagine I have the following contract
contract X{
event Mint(uint v);
function mint(uint _d) {
Mint(_d);
}
}
contract Y {
X public x;
function Y(address _x) {
x = X(_x);
}
event Desposit(_v);
function deposit(uint _v) {
x.mint(_v);
Deposit(_v);
}
}
const {logs} = await y.deposit(value, { from: authorities[0] });
console.log(logs) // only 1 event
logs should provide 2 events, Mint and Deposit
before I was able to observe all event logs with truffle v3.
in truffle v4, I can only see Deposit event, but I don't see Mint event anymore
truffle test @rstormsf This problem has also been raised in #555 where a global event registry was proposed. The underlying issue is that truffle-contract looks at the contract ABI to decode events but X is not part of Y's interface.
As a stop-gap you could declare an abstract contract that defined a common event interface for X and Y? If that doesn't work for your use case you could manually decode the raw logs on the receipt using a utility like abi-decoder.
AKAIK this behavior hasn't changed between Truffle 3 / 4 but I could be wrong about that. Do you have a view about what the best long-term solution for this might be?
@rstormsf Hope you don't mind but I'm going to close this for house-keeping and we'll continue to track internal event logging at #555. Thanks for highlighting this issue.
Ran into this problem as well, also remember it working as described by @rstormsf in v3
The only workaround I had was to use the transaction receipt logs in my tests, and I don't know the best way to decode those logs using the truffle contracts either
@cgewecke we see this but also note that ERC20 Transfer events are included in the log from one of our internal contracts but not other events from the same internal contract. I went looking and can't see base support for ERC20 decoding in truffle/contract or abiDecoder. Is seeing internal Transfer events expected or is it some anomaly in our (Synthetix) environment?
Most helpful comment
Ran into this problem as well, also remember it working as described by @rstormsf in v3
The only workaround I had was to use the transaction receipt logs in my tests, and I don't know the best way to decode those logs using the truffle contracts either