0

openzeppelin-test-environment is quite a new package, it doesn't tell how to initialize the upgradeable contract

https://github.com/OpenZeppelin/openzeppelin-test-environment

Just a basic example from the link above:

const { accounts, contract } = require('@openzeppelin/test-environment');
const [ owner ] = accounts;

const { expect } = require('chai');

const MyContract = contract.fromArtifact('MyContract'); // Loads a compiled contract

describe('MyContract', function () {
  it('deployer is owner', async function () {
    const myContract = await MyContract.new({ from: owner });
    expect(await myContract.owner()).to.equal(owner);
  });
});

How to add an upgradeable contract which doesn't have constructor but initialize method?

0

What about using deployProxy?

// migrations/NN_deploy_upgradeable_box.js
const { deployProxy } = require('@openzeppelin/truffle-upgrades');

const Box = artifacts.require('Box');

module.exports = async function (deployer) {
  const instance = await deployProxy(Box, [42], { deployer });
  console.log('Deployed', instance.address);
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.