Hi @jeeza1,
That does sound strange. I assume that you are initializing the upgradeable contract.
You may want to try running the following simple example to see if that generates the issue to help track this down. I wonder if it is gas, otherwise is it EVM version.
MyContract.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.6.0;
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";
contract MyContract is Initializable, OwnableUpgradeSafe {
event DoneStuff();
function initialize() public initializer {
__Ownable_init();
}
function doStuff(address someAddress) public onlyOwner {
emit DoneStuff();
}
}
Deploy
$ npx oz deploy
✓ Compiled contracts with solc 0.6.12 (commit.27d51765)
Compilation warnings:
@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol: Warning: SPDX license identifier not provided in source file. Before publishing, consider adding a comment containing "SPDX-License-Identifier: <SPDX-License>" to each source file. Use "SPDX-License-Identifier: UNLICENSED" for non-open-source code. Please see https://spdx.org for more information.
contracts/MyContract.sol:15:22: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function doStuff(address someAddress) public onlyOwner {
^-----------------^
? Choose the kind of deployment upgradeable
? Pick a network development
? Pick a contract to deploy MyContract
✓ Added contract MyContract
✓ Contract MyContract deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize()
✓ Setting everything up to create contract instances
✓ Instance created at 0xCfEB869F69431e42cdB54A4F4f105C19C080A601
To upgrade this instance run 'oz upgrade'
0xCfEB869F69431e42cdB54A4F4f105C19C080A601
Based on the Learn guide:
https://docs.openzeppelin.com/learn/deploying-and-interacting#interacting-programmatically
index.js
// src/index.js
const Web3 = require('web3');
const { setupLoader } = require('@openzeppelin/contract-loader');
async function main() {
// Set up web3 object, connected to the local development network, and a contract loader
const web3 = new Web3('http://localhost:8545');
const loader = setupLoader({ provider: web3 }).web3;
// Set up a web3 contract, representing our deployed MyContract instance, using the contract loader
const address = '0xCfEB869F69431e42cdB54A4F4f105C19C080A601';
const myContract = loader.fromArtifact('MyContract', address);
// Retrieve accounts from the local node, we'll use the first one to send the transaction
const accounts = await web3.eth.getAccounts();
const someAddress = '0x1df62f291b2e969fb0849d99d9ce41e2f137006e';
// Send a transaction to doStuff()
const tx = await myContract.methods.doStuff(someAddress).send({ from: accounts[0], gas: 50000, gasPrice: 1e6 });
console.log(tx);
}
main();
Run index.js
$ node src/index.js
{ transactionHash:
'0x35fff93067437dad2ac9434eb1a8d82071f4c4cc1f3d020b2ddb8447b0c80e70',
transactionIndex: 0,
blockHash:
'0xca44f5b95c9937ac6b5941cd32256b266860d23b178821a6a37a34981385cac0',
blockNumber: 4,
from: '0x90f8bf6a479f320ead074411a4b0e7944ea8c9c1',
to: '0xcfeb869f69431e42cdb54a4f4f105c19c080a601',
gasUsed: 26148,
cumulativeGasUsed: 26148,
contractAddress: null,
status: true,
logsBloom:
'0x00000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000400000001000000000000004000000000000000000000000000000000000000000000000000000',
events:
{ DoneStuff:
{ logIndex: 0,
transactionIndex: 0,
transactionHash:
'0x35fff93067437dad2ac9434eb1a8d82071f4c4cc1f3d020b2ddb8447b0c80e70',
blockHash:
'0xca44f5b95c9937ac6b5941cd32256b266860d23b178821a6a37a34981385cac0',
blockNumber: 4,
address: '0xCfEB869F69431e42cdB54A4F4f105C19C080A601',
type: 'mined',
id: 'log_5373efdd',
returnValues: Result {},
event: 'DoneStuff',
signature:
'0xb5a7dd393f3ac16b00dc254f20234aa9070f4e7a82d61c5e1930a633d07768a1',
raw: [Object] } } }