Course lesson

Restrict Smart Contract Functions to a Specified Owner

Right now our sale can be open and closed by anyone. We want to take ownership of our smart contract to prevent this.

Duration
3 min
Access
Included
Transcript
Retained from source evidence

Right now our sale can be open and closed by anyone. We want to take ownership of our smart contract to prevent this.

We'll use Ownable from OpenZeppelin, Set the openSale and closeSale public functions to onlyOwner, and then set the owner of the smart contract in the deploy script.