Post
Share your knowledge.
Counter.sol not found in Openzeppelin Contracts
What is the replacement for Counter.sol in Openzeppelin contracts?
I get this error when I try to run my contract:
lib/openzeppelin-contracts/contracts/utils/Counters.sol": No such file or directory (os error 2)
- discussion
- expert q&a
Answers
2It has been removed in openzeppelin v5 and most likely not coming back. You can either downgrade OZ version to 4.x, which is not recommended since a lot of patches have been merged since then fixing various vulnurabilities, or you can replace counter with something else, in most cases a single variable will do the trick. For more details I'll advise to check out the PR which removed Counters.sol from OZ codebase - it contains the reasoning behind this move and different strategies how one can move on without it
Oh ok, thanks a lot for the heads up. Will check the repo out now
Do you know the answer?
Please log in and share it.
Peera is a decentralized questions and answers protocol for Web3 where users can organize and store their interests and skills, creating a common community platform