Skip to content

Commit

Permalink
chore: upgrade prepare upgrade scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
viraj124 committed Sep 26, 2024
1 parent b4056e4 commit 56b08ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelChainState__factory as FuelChainState } from '../../typechain';
import { TransactionResponse, getCreateAddress } from 'ethers';
import { TransactionResponse } from 'ethers';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelERC20GatewayV4__factory as FuelERC20Gateway } from '../../typechain';
import { TransactionResponse } from 'ethers';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
Expand All @@ -11,27 +12,29 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const contractDeployment = await hre.deployments.get('FuelERC20GatewayV4');

const contract = await hre.ethers.getContractFactory('FuelERC20GatewayV4');
const factory = await hre.ethers.getContractFactory('FuelERC20GatewayV4');

const implementationAddress = await prepareUpgrade(
contractDeployment.address,
contract,
{
kind: 'uups',
constructorArgs: contractDeployment.linkedData.constructorArgs,
}
const response = (await prepareUpgrade(contractDeployment.address, factory, {
kind: 'uups',
constructorArgs: contractDeployment.linkedData.constructorArgs,
getTxResponse: true,
})) as TransactionResponse;

const receipt = await hre.ethers.provider.getTransactionReceipt(
response.hash
);

await save('FuelERC20GatewayV4', {
address: contractDeployment.address,
abi: [...FuelERC20Gateway.abi],
implementation: contractDeployment.implementation,
transactionHash: response.hash,
linkedData: {
factory: 'FuelERC20GatewayV4',
constructorArgs: contractDeployment.linkedData.constructorArgs,
initArgs: contractDeployment.linkedData.initArgs,
isProxy: false,
newImplementation: implementationAddress.toString(),
newImplementation: receipt?.contractAddress,
},
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';

import { FuelMessagePortalV3__factory as FuelMessagePortal } from '../../typechain';
import { TransactionResponse } from 'ethers';

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
Expand All @@ -11,27 +12,29 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {

const contractDeployment = await hre.deployments.get('FuelMessagePortalV3');

const contract = await hre.ethers.getContractFactory('FuelMessagePortalV3');
const factory = await hre.ethers.getContractFactory('FuelMessagePortalV3');

const implementationAddress = await prepareUpgrade(
contractDeployment.address,
contract,
{
kind: 'uups',
constructorArgs: contractDeployment.linkedData.constructorArgs,
}
const response = (await prepareUpgrade(contractDeployment.address, factory, {
kind: 'uups',
constructorArgs: contractDeployment.linkedData.constructorArgs,
getTxResponse: true,
})) as TransactionResponse;

const receipt = await hre.ethers.provider.getTransactionReceipt(
response.hash
);

await save('FuelMessagePortalV3', {
address: contractDeployment.address,
abi: [...FuelMessagePortal.abi],
implementation: contractDeployment.implementation,
transactionHash: response.hash,
linkedData: {
factory: 'FuelMessagePortalV3',
constructorArgs: contractDeployment.linkedData.constructorArgs,
initArgs: contractDeployment.linkedData.initArgs,
isProxy: false,
newImplementation: implementationAddress.toString(),
newImplementation: receipt?.contractAddress,
},
});
};
Expand Down

0 comments on commit 56b08ef

Please sign in to comment.