function_fallback_and_receive.sol 336 B

123456789101112131415
  1. contract test {
  2. int32 bar;
  3. function foo(int32 x) public {
  4. bar = x;
  5. }
  6. fallback() external {
  7. // execute if function selector does not match "foo(uint32)" and no value sent
  8. }
  9. receive() external payable {
  10. // execute if function selector does not match "foo(uint32)" and value sent
  11. }
  12. }