You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
587 B
43 lines
587 B
pragma solidity ^0.6.0;
|
|
|
|
import "./ModifiersB.sol";
|
|
|
|
/**
|
|
* New syntaxes in solc 0.6.x
|
|
*/
|
|
contract ModifiersC {
|
|
uint counter;
|
|
address owner;
|
|
bool flag = true;
|
|
|
|
constructor() public {
|
|
owner = msg.sender;
|
|
}
|
|
|
|
modifier flippable {
|
|
require(flag);
|
|
_;
|
|
}
|
|
|
|
function flip() public {
|
|
flag = !flag;
|
|
}
|
|
|
|
function simpleSetFlip(uint i) flippable public {
|
|
counter = counter + i;
|
|
}
|
|
|
|
modifier onlyOwner {
|
|
require(msg.sender == owner);
|
|
_;
|
|
}
|
|
|
|
function set(uint i)
|
|
onlyOwner
|
|
public
|
|
payable
|
|
virtual
|
|
{
|
|
counter = counter + i;
|
|
}
|
|
}
|
|
|