@@ -2,7 +2,19 @@ import hre from "hardhat";
22import { HardhatRuntimeEnvironment } from "hardhat/types" ;
33import { Deployment , DeploymentSubmission } from "hardhat-deploy/types" ;
44import { getContractFactory } from "./utils" ;
5+ import { CHAIN_IDs } from "@across-protocol/constants" ;
56
7+ type unsafeAllowTypes = (
8+ | "delegatecall"
9+ | "state-variable-immutable"
10+ | "constructor"
11+ | "selfdestruct"
12+ | "state-variable-assignment"
13+ | "external-library-linking"
14+ | "struct-definition"
15+ | "enum-definition"
16+ | "missing-public-upgradeto"
17+ ) [ ] ;
618/**
719 * @description Resolve the HubPool deployment, as well as the HubPool and SpokePool chain IDs for a new deployment.
820 * @dev This function relies on having companionNetworks defined in the HardhatUserConfig.
@@ -30,20 +42,25 @@ export async function deployNewProxy(
3042 initArgs : FnArgs [ ] ,
3143 implementationOnly = false
3244) : Promise < void > {
33- const { deployments, run, upgrades } = hre ;
45+ const { deployments, run, upgrades, getChainId } = hre ;
46+ let chainId = Number ( await getChainId ( ) ) ;
3447
3548 let instance : string ;
49+ let unsafeAllowArgs = [ "delegatecall" ] ; // Remove after upgrading openzeppelin-contracts-upgradeable post v4.9.3.
50+ if ( [ CHAIN_IDs . BLAST , CHAIN_IDs . BLAST_SEPOLIA ] . includes ( chainId ) ) {
51+ unsafeAllowArgs . push ( "state-variable-immutable" ) ;
52+ }
3653 if ( implementationOnly ) {
3754 instance = ( await upgrades . deployImplementation ( await getContractFactory ( name , { } ) , {
3855 constructorArgs,
3956 kind : "uups" ,
40- unsafeAllow : [ "delegatecall" , "state-variable-immutable" ] ,
57+ unsafeAllow : unsafeAllowArgs as unsafeAllowTypes ,
4158 } ) ) as string ;
4259 console . log ( `New ${ name } implementation deployed @ ${ instance } ` ) ;
4360 } else {
4461 const proxy = await upgrades . deployProxy ( await getContractFactory ( name , { } ) , initArgs , {
4562 kind : "uups" ,
46- unsafeAllow : [ "delegatecall" , "state-variable-immutable" ] , // Remove after upgrading openzeppelin-contracts-upgradeable post v4.9.3.
63+ unsafeAllow : unsafeAllowArgs as unsafeAllowTypes ,
4764 constructorArgs,
4865 initializer : "initialize" ,
4966 } ) ;
0 commit comments