Checking event spawned by fallback function
See original GitHub issueRelayer:
function relay(address payable recipient, uint amount) public {
require(amount < address(this).balance, "insufficient funds");
recipient.transfer(amount);
}
EthWallet:
function() external payable {
// generate an event when receiving Eth
require(msg.value > 0, "zero deposit");
emit DepositEvent(msg.sender, msg.value);
}
return relay_instance.relay(EthWallet.address, value_out).then(function (result) {
truffleAssert.prettyPrintEmittedEvents(result);
//...
There are no events printed, even though (if the test fails) it announces that the event was emitted. I imagine this is because of the fact that the event isn’t directly emitted by the Relayer contract.
What is the work around here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Solidity 0.6.x features: fallback and receive functions
The main use case of the pre-0.6.x fallback function is to receive ... contracts to reject transfers, emit events or forward the ether....
Read more >Fallback Functions - Ethereum Smart Contract Best Practices
Fallback functions are called when a contract is sent a message with no arguments (or when no function matches), and only has access...
Read more >HackPedia: 16 Solidity Hacks/Vulnerabilities, their Fixes and ...
3. Unexpected Ether. Typically when ether is sent to a contract, it must execute either the fallback function, or another function described in...
Read more >Child process | Node.js v19.3.0 Documentation
The child_process.spawn() method spawns the child process asynchronously, without blocking the Node.js event loop. The child_process.spawnSync() function ...
Read more >Events in Chained Fallback Function Cause VirtualMachineError
I have a decent set of tests and everything passes successfully. However if I emit an event in the initial fallback function, contract...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hey @hlb8122 sorry for dropping the ball on this one, I completely forgot to get into this issue. I haven’t tested this yet, but can you try this:
@rkalis It works for me