With version 0.6 the fallback function was splitted into a receive and a fallback function which are currently not supported by our grammar.
Example receive function:
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.6.0;
// This contract keeps all Ether sent to it with no way
// to get it back.
contract Sink {
event Received(address, uint);
receive() external payable {
emit Received(msg.sender, msg.value);
}
}
Example fallback function:
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.6.2 <0.7.0;
contract Test {
// This function is called for all messages sent to
// this contract (there is no other function).
// Sending Ether to this contract will cause an exception,
// because the fallback function does not have the `payable`
// modifier.
fallback() external { x = 1; }
uint x;
}
With version 0.6 the fallback function was splitted into a
receive
and afallback
function which are currently not supported by our grammar.Example receive function:
Example fallback function: