From the course: Blockchain: Learning Solidity

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Add your modifiers

Add your modifiers

- [Instructor] All right, so now we need to set our conditions of the contract with the modifiers. Let's get to it. So if you remember, when we explore the modifiers, the way to declare a modifier is simply by writing modifier, and then you name what is the name of your modifier. Yeah, let's type it properly, owner, onlyOwner. So this modifier or this conditional require a condition, and the condition is that the message that sender as an owner. So we absolutely need to have an owner. And in this case, let's go ahead and write the message. I'm just going to close it here. "Only contract owner can access this function." So this is going to be the message that will be thrown at the person if there's no owner, period. And then on the underscore. Now the next conditional, and FYI, if we have errors here, wait a bit because sometimes it takes a while to compile and check the code. So if you see an error here and then you…

Contents