Modifiers
A New Type of Function
modifier modifierName(P) {
// Insert logic here
}contract Bank {
address owner;
function withdraw() public {
// Withdraw logic goes here
}
}modifier onlyOwner() {
require(msg.sender == owner, "You are not the owner!");
_;
}Last updated