Complete the code to declare a function modifier named onlyOwner.
modifier [1]() {
_;
}modifier keyword.The modifier name is onlyOwner as declared in the code.
Complete the code to require that the caller is the owner inside the onlyOwner modifier.
modifier onlyOwner() {
require(msg.sender [1] owner, "Not owner");
_;
}!= which would reject the owner.The require statement checks if msg.sender is equal to owner.
Fix the error in the modifier usage in the function declaration.
function withdraw() public [1] {
// withdraw logic
}Modifiers are used without parentheses if they have no parameters.
Fill both blanks to create a modifier that checks if the caller is the owner and then executes the function.
modifier [1]() { require(msg.sender [2] owner, "Caller is not owner"); _; }
!= which rejects the owner.The modifier name is onlyOwner and the require condition uses == to check ownership.
Fill all three blanks to create a modifier named onlyOwner that requires the caller to be the owner and then executes the function.
modifier [1]() { require(msg.sender [2] owner, "Not owner"); [3]; }
_; statement.The modifier is named onlyOwner, uses == to check ownership, and _; to continue execution.