solidity/test/libsolidity/semanticTests/functionCall/send_zero_ether.sol
2021-11-15 16:32:45 +01:00

26 lines
574 B
Solidity

// Sending zero ether to a contract should still invoke the receive ether function
// (it previously did not because the gas stipend was not provided by the EVM)
contract Receiver {
receive() external payable {}
}
contract Main {
constructor() payable {}
function s() public returns (bool) {
Receiver r = new Receiver();
return payable(r).send(0);
}
}
// ====
// compileToEwasm: also
// compileViaYul: also
// ----
// constructor(), 20 wei ->
// gas irOptimized: 102862
// gas legacy: 116691
// gas legacyOptimized: 100361
// s() -> true