From 67b6a06ac750936dad004e28863d01dc8f771ee0 Mon Sep 17 00:00:00 2001 From: Patrick Date: Wed, 18 May 2022 10:31:02 -0400 Subject: [PATCH] use defender and update added pools --- contracts/init/UpdateStartBlockInit.sol | 3 +++ scripts/upgrades/upgrade-startBlock.ts | 19 +++++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/contracts/init/UpdateStartBlockInit.sol b/contracts/init/UpdateStartBlockInit.sol index 3c58cef..ad11748 100644 --- a/contracts/init/UpdateStartBlockInit.sol +++ b/contracts/init/UpdateStartBlockInit.sol @@ -8,5 +8,8 @@ contract UpdateStartBlockInit { function init(uint256 startBlock) external { FarmStorage.Layout storage s = FarmStorage.layout(); s.startBlock = startBlock; + for (uint256 i; i < s.poolInfo.length; i++) { + s.poolInfo[i].lastRewardBlock = startBlock; + } } } diff --git a/scripts/upgrades/upgrade-startBlock.ts b/scripts/upgrades/upgrade-startBlock.ts index fc7d96c..9e77e15 100644 --- a/scripts/upgrades/upgrade-startBlock.ts +++ b/scripts/upgrades/upgrade-startBlock.ts @@ -10,6 +10,10 @@ import { diamondOwner, maticDiamondAddress, } from "../helperFunctions"; +import { + DefenderRelaySigner, + DefenderRelayProvider, +} from "defender-relay-client/lib/ethers"; import { UpdateStartBlockInit__factory } from "../../typechain-types"; import { @@ -18,10 +22,20 @@ import { } from "../../typechain-types/UpdateStartBlockInit"; export async function upgrade() { + const credentials = { + apiKey: process.env.DEFENDER_API_KEY, + apiSecret: process.env.DEFENDER_API_SECRET, + }; + const provider = new DefenderRelayProvider(credentials); + const owner = new DefenderRelaySigner(credentials, provider, { + speed: "fast", + }); const UpdateStartBlockInit = await ethers.getContractFactory( "UpdateStartBlockInit" ); - const updateStartBlockInit = await UpdateStartBlockInit.deploy(); + const updateStartBlockInit = await UpdateStartBlockInit.connect( + owner + ).deploy(); await updateStartBlockInit.deployed(); console.log( "UpdateStartBlockInit: " + updateStartBlockInit.address @@ -29,7 +43,8 @@ export async function upgrade() { const diamondCutFacet = await hre.ethers.getContractAt( "DiamondCutFacet", - "0x1fE64677Ab1397e20A1211AFae2758570fEa1B8c" + "0x1fE64677Ab1397e20A1211AFae2758570fEa1B8c", + owner ); let iface: UpdateStartBlockInitInterface =