contracts/scripts/upgrade-example.js
Râu Cao d63f7ca743
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Release Drafter / Update release notes draft (pull_request) Successful in 4s
Add reinitializer for upgrades to Contributor
In order to be able to re-initialize the upgraded contract with the
profile manager address, we need a new re-initializer function that is
automatically allowed to only be executed once per contract
implementation version.

Co-authored-by: Michael Bumann <hello@michaelbumann.com>
2023-04-27 11:11:30 +02:00

30 lines
778 B
JavaScript

const { ethers, upgrades } = require("hardhat");
const Kredits = require('../lib/kredits');
async function main() {
const network = await hre.ethers.provider.getNetwork();
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner());
await kredits.init();
const ContributorV2 = await ethers.getContractFactory("Contributor");
const contributor = await upgrades.upgradeProxy(
kredits.Contributor.address,
ContributorV2,
{
call: {
fn: "reinitialize",
args: [
"0xc80d2513277FA04B10403E2D1d7dAa86F931f4d1"
]
}
});
console.log("Contributor upgraded");
console.log(`Contributor address: ${contributor.address}`);
await contributor.deployTransaction.wait();
console.log("DONE!");
}
main()