Assignment 4 – modifier, error handling
Write a smart contract with a function called setName. It should take a string as parameter and save it in a public state variable called name.
Restrict the access to this function via a modifier so that only the account that created (deployed) this contract can set the name. You can call this modifier onlyOwner.
The modifier should return an error message.
Implement this by using:
- require() or
- custom error