mirror of
https://github.com/logos-messaging/waku-rlnv1-contract.git
synced 2026-01-05 15:53:13 +00:00
chore: add upgrade script
This commit is contained in:
parent
886891b57a
commit
2e828c37c6
@ -1,5 +1,5 @@
|
||||
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
||||
import { DeployFunction, DeploymentSubmission } from "hardhat-deploy/types";
|
||||
import { DeployFunction } from "hardhat-deploy/types";
|
||||
|
||||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
const { deployments, getUnnamedAccounts } = hre;
|
||||
@ -26,5 +26,11 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
};
|
||||
|
||||
export default func;
|
||||
func.skip = async (hre: HardhatRuntimeEnvironment) => {
|
||||
if (hre.network.name === "sepolia") {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
func.tags = ["WakuRlnRegistry"];
|
||||
func.dependencies = ["PoseidonHasher"];
|
||||
|
||||
56
deploy/003_deploy_rln_v2.ts
Normal file
56
deploy/003_deploy_rln_v2.ts
Normal file
@ -0,0 +1,56 @@
|
||||
import { HardhatRuntimeEnvironment } from "hardhat/types";
|
||||
import { DeployFunction } from "hardhat-deploy/types";
|
||||
|
||||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
||||
const { deployments, getUnnamedAccounts } = hre;
|
||||
const { deploy } = deployments;
|
||||
|
||||
const [deployer] = await getUnnamedAccounts();
|
||||
|
||||
const implRes = await deploy("WakuRlnRegistry_Implementation", {
|
||||
contract: "WakuRlnRegistry",
|
||||
from: deployer,
|
||||
log: true,
|
||||
skipIfAlreadyDeployed: false,
|
||||
});
|
||||
|
||||
const existingProxy = await deployments.get("WakuRlnRegistry_Proxy");
|
||||
existingProxy.abi.push({
|
||||
inputs: [
|
||||
{
|
||||
internalType: "address",
|
||||
name: "newImplementation",
|
||||
type: "address",
|
||||
},
|
||||
],
|
||||
name: "upgradeTo",
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
type: "function",
|
||||
});
|
||||
existingProxy.abi.push({
|
||||
inputs: [],
|
||||
name: "initialize",
|
||||
outputs: [],
|
||||
stateMutability: "nonpayable",
|
||||
type: "function",
|
||||
});
|
||||
const existingProxyContract = new hre.ethers.Contract(
|
||||
existingProxy.address,
|
||||
existingProxy.abi,
|
||||
hre.ethers.provider.getSigner(deployer)
|
||||
);
|
||||
|
||||
const upgradeTx = await existingProxyContract.upgradeTo(implRes.address);
|
||||
await upgradeTx.wait();
|
||||
const implContract = new hre.ethers.Contract(
|
||||
implRes.address,
|
||||
implRes.abi,
|
||||
hre.ethers.provider.getSigner(deployer)
|
||||
);
|
||||
await implContract.initialize();
|
||||
};
|
||||
|
||||
export default func;
|
||||
func.tags = ["WakuRlnRegistry_v2"];
|
||||
func.dependencies = ["WakuRlnRegistry"];
|
||||
Loading…
x
Reference in New Issue
Block a user