function_multiple_modifiers.sol 388 B

12345678910111213141516171819
  1. contract example {
  2. address owner;
  3. // a modifier with no arguments does not need "()" in its declaration
  4. modifier only_owner() {
  5. require(msg.sender == owner);
  6. _;
  7. }
  8. modifier check_price(int64 price) {
  9. if (price >= 50) {
  10. _;
  11. }
  12. }
  13. function foo(int64 price) public only_owner check_price(price) {
  14. // ...
  15. }
  16. }