How to verify upgradeable contract?

Hi @lustig,

You should be able to use https://github.com/rkalis/truffle-plugin-verify#debugging with the implementation address. If you get stuck, please create a new topic with your Solidity, address etc.

In your migrations you are actually deploying a new contract using deployProxy.

https://github.com/technoplato/nash/blob/upgrading/migrations/3_nash_v3.js#L7

You need to get the address of the proxy and just call upgradeProxy.

See the following example from the documentation:

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

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

module.exports = async function (deployer) {
  const existing = await Box.deployed();
  const instance = await upgradeProxy(existing.address, BoxV2, { deployer });
  console.log("Upgraded", instance.address);
};

_From: https://docs.openzeppelin.com/upgrades-plugins/1.x/truffle-upgrades#migrations-usage_

We can unit test our implementation contracts, just like any other contract and deploy using .new.

We can also write higher level tests using deployProxy and upgradeProxy.

For an example please see OpenZeppelin Upgrades: Step by Step Tutorial for Truffle

Also the example in the documentation: https://docs.openzeppelin.com/upgrades-plugins/1.x/truffle-upgrades#test-usage


As an aside, I recommend creating a new topic per major question so that anyone can answer.

1 Like