I'm using oz check
on my project, which has one upgradable contract and one non-upgradable contract (Hello.sol
), which produces the following issue in red:
Contract Hello or an ancestor has a constructor. Change it to an initializer function. See https://docs.openzeppelin.com/upgrades/2.6//writing-upgradeable#initializers.
and warning in yellow:
Contract Hello imports access/Ownable.sol, GSN/Context.sol, token/ERC20/IERC20.sol, token/ERC20/SafeERC20.sol, math/SafeMath.sol, utils/Address.sol from @openzeppelin/contracts. Use @openzeppelin/contracts-ethereum-package instead. See https://docs.openzeppelin.com/cli/2.6/dependencies#linking-the-contracts-ethereum-package.
// Hello.sol
pragma solidity ^0.6.12;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
import "@openzeppelin/contracts/math/SafeMath.sol";
contract Hello is Ownable {
using SafeERC20 for IERC20;
using SafeMath for uint256;
constructor() public {};
}
Why doesn't oz
check Hello.sol
as a non-upgradable contract? Could it concern the fact that the issues/warnings are pointing to CLI 2.6 docs, while IIRC non-upgradable contracts are only supported from the CLI in 2.8? I've npm installed @openzeppelin/cli: "^2.8.2"
.