Hi, I understand that a contract has an address. When someone transfers ETH to the contract, is there a way to execute a certain function in the contract? Something like an event?

Dec 5, 2021, 5:33 PM
That’s an option, but if I can create something “simple” in pure Solidity without a dependency, I would prefer that.
Dec 5, 2021, 5:37 PM
receive() external payable {



}
inside do whatever you want
Dec 5, 2021, 5:38 PM
Thanks, that looks nice! . Thanks @advisosupport and @glooty too. These are good options. In order of preference, I’ll explore
receive() external payable, then fallback functions, then Openzeppelin ’s onReceive.sol.
Dec 5, 2021, 5:39 PM
receive() is new name for fallback function
Dec 5, 2021, 5:42 PM

© 2024 Draquery.com All rights reserved.