How to use OpenZeppelin SafeMath library in Hardhat?

I am writing a smart contract using the OpenZeppelin SafeMath, but I got some error that I can not import the necessary library.

I was going to use these libraries.


And got this error message.
Error HH404: File @openzeppelin/contracts/math/SafeMath.sol, imported from contracts/Presale.sol, not found.

How can I solve this error?

Install them locally ?

Did you install the @openzeppelin/contracts dependency? What version?

Thanks, I have fixed.
As the solidity version upgrade, the library is updated.
So the link was wrong.
I have fixed and thanks.

1 Like