Getting math library error while inheriting ERC4626 contract

Hey I'm trying to inherit ERC4626 contract "import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol";" and getting this math library error from the inherited contract - TypeError: Member "Floor" not found or not visible after argument-dependent lookup in type(enum Math.Rounding).
--> @openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol:122:41:
|
122 | return _convertToShares(assets, Math.Rounding.Floor);
| ^^^^^^^^^^^^^^^^^^^
any solution for this?

Math.Rounding.Floor is available only from version 5.0.

You are probably using an older version, e.g., version 4.9.

2 Likes

If you're using Remix, maybe cleaning the cache would work.

Perhaps Remix kept OZ Contracts 4.9 cached.

1 Like

It worked when I specify the v5 version in import url, thanks

1 Like