0

I am trying to switch my contract to use the 'import "@openzeppelin/contracts/access/Ownable.sol”’, but I am getting the following error

contracts/InvoiceTracker.sol:93:9: DeclarationError: Undeclared identifier. ownerOnly()

for this code: function addClient(address _clientID, string memory _name) public ownerOnly() noDupClient(_clientID, _name) {}

I have installed: "@openzeppelin/cli": "^2.8.2", "@openzeppelin/contracts": "^3.1.0", "@openzeppelin/test-helpers": "^0.5.6”

Can you give me a clue as to why this is happening?

DenisMP
  • 973
  • 2
  • 16
  • 31

2 Answers2

1

you should call onlyOwner() and not ownerOnly()

Emmanuel Collin
  • 2,556
  • 2
  • 10
  • 17
1

You must Call the onlyOwner() if you are importing the @openzeppelin/contracts/access/Ownable.sol. You can't change onlyOwner() to ownerOnly().