solidity/test/libsolidity/semanticTests/payable/no_nonpayable_circumvention_by_modifier.sol
Alex Beregszaszi 28e65bac46 Add unimplemented assert for modifiers in the IR
Also improved relevant tests for modifiers to be more strict and detect if the modifier body was skipped.
2020-11-27 18:34:17 +00:00

19 lines
524 B
Solidity

contract C {
modifier tryCircumvent {
if (false) _; // avoid the function, we should still not accept ether
}
function f() tryCircumvent public returns (uint) {
return msgvalue();
}
function msgvalue() internal returns (uint) {
return msg.value;
}
// TODO: remove this helper function once isoltest supports balance checking
function balance() external returns (uint) {
return address(this).balance;
}
}
// ----
// f(), 27 wei -> FAILURE
// balance() -> 0