receive() external payable
— for empty calldata (and any value)fallback() external payable
— when no other function matches (not even the receive function). Optionally payable
.It executes on
calldata
)
send()
or transfer()
.■ Features
external
visibility and payable
state mutabilityTo replicate the example above under 0.6.0, use the following code:
pragma solidity ^0.5.0;
contract Charity {
receive() external payable {
// React to receiving ether
}
}
https://ethereum.stackexchange.com/questions/81994/what-is-the-receive-keyword-in-solidity