Hi @MWaser,
The issue appears that the POA network you are using is Byzantium.
Have you tried creating a new POA network with a later EVM version?
We can use OpenZeppelin CLI to compile and deploy regular contracts (using CLI 2.8 Release Candidate) for EVM version Byzantium (use solc 0.5.4 or earlier).
Upgradeable contracts deploy a Proxy and a Proxy Admin, and these would need to be compiled for Byzantium.
We created a CLI version with Byzantium Proxy and Proxy Admin last year. (Deploying a token that uses 'contracts-ethereum-package' to Ethereum Classic)
In a new project install the CLI Byzantium version.
$ npm i @openzeppelin/cli@byzantium
We can deploy Box.sol from the Upgrading a Contract using the CLI guide.
$ npx oz compile --solc-version 0.5.3 --evm-version byzantium
✓ Compiled contracts with solc 0.5.3 (commit.10d17f24)
$ npx oz create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate Box
? Pick a network poa
✓ Added contract Box
✓ Contract Box deployed
All contracts have been deployed
? Call a function to initialize the instance after creating it? No
✓ Setting everything up to create contract instances
✓ Instance created at 0x67d8C554136D28EF517F1854e57568eE6e38a0d4
0x67d8C554136D28EF517F1854e57568eE6e38a0d4
$ npx oz send-tx
? Pick a network poa
? Pick an instance Box at 0x67d8C554136D28EF517F1854e57568eE6e38a0d4
? Select which function store(newValue: uint256)
? newValue (uint256): 42
✓ Transaction successful. Transaction hash: 0xd875c9223711a8f6a8fca3e8b87a6507c48fc34eadc7d4bd4b86b2b223a13c7f
Events emitted:
- ValueChanged(42)
We can then upgrade the contract:
$ npx oz compile --solc-version 0.5.3 --evm-version byzantium
✓ Compiled contracts with solc 0.5.3 (commit.10d17f24)
$ npx oz upgrade
? Pick a network poa
Nothing to compile, all contracts are up to date.
✓ Contract Box deployed
All contracts have been deployed
? Which instances would you like to upgrade? Choose by address
? Pick an instance to upgrade Box at 0x67d8C554136D28EF517F1854e57568eE6e38a0d4
? Call a function on the instance after upgrading it? No
✓ Instance upgraded at 0x67d8C554136D28EF517F1854e57568eE6e38a0d4. Transaction receipt: 0xde92fb818f61e314d02b0c6ce37bb3cec51cfe83b96c91b8a1677e3b4a01af38
✓ Instance at 0x67d8C554136D28EF517F1854e57568eE6e38a0d4 upgraded
We can install OpenZeppelin Contracts Ethereum Package (as long as we can compile with solc 0.5.4). We can’t link as this would require an EVM later than Byzantium.
$ npm i @openzeppelin/contracts-ethereum-package
We can then deploy an ERC20 token inheriting from OpenZeppelin Contracts Ethereum Package:
SimpleToken
pragma solidity ^0.5.0;
import "@openzeppelin/upgrades/contracts/Initializable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Detailed.sol";
/**
* @title SimpleToken
* @dev Very simple ERC20 Token example, where all tokens are pre-assigned to the sender.
* Note they can later distribute these tokens as they wish using `transfer` and other
* `ERC20` functions.
*/
contract SimpleToken is Initializable, ERC20, ERC20Detailed {
/**
* @dev initialize that gives msg.sender all of existing tokens.
*/
function initialize(address sender) public initializer {
ERC20Detailed.initialize("Token", "TKN", 18);
_mint(sender, 1000000 * (10 ** uint256(decimals())));
}
}
We can then compile and create SimpleToken, and then interact with it.
$ npx oz compile --solc-version 0.5.3 --evm-version byzantium
✓ Compiled contracts with solc 0.5.3 (commit.10d17f24)
$ npx oz create
Nothing to compile, all contracts are up to date.
? Pick a contract to instantiate SimpleToken
? Pick a network poa
✓ Contract SimpleToken deployed
All contracts have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize(sender: address)
? sender (address): 0x8616f9c6d59b86CEbf5b653d6f153D4c2E9441C5
✓ Setting everything up to create contract instances
✓ Instance created at 0x344Df09d15B479eD1C2cbBa30bbEddC765F5fBBD
0x344Df09d15B479eD1C2cbBa30bbEddC765F5fBBD
$ npx oz call
? Pick a network poa
? Pick an instance SimpleToken at 0x344Df09d15B479eD1C2cbBa30bbEddC765F5fBBD
? Select which function totalSupply()
✓ Method 'totalSupply()' returned: 1000000000000000000000000
1000000000000000000000000