-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: upgrade devnet and testnet portals (#398)
Closes #395
- Loading branch information
Showing
8 changed files
with
784 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@fuel-bridge/solidity-contracts': patch | ||
--- | ||
|
||
Upgraded portal implementations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
packages/solidity-contracts/deploy/devnet/018.portal_upgrade.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { MaxUint256, type TransactionResponse } from 'ethers'; | ||
import type { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
import type { DeployFunction } from 'hardhat-deploy/dist/types'; | ||
|
||
import { FuelMessagePortalV3__factory as FuelMessagePortalV3 } from '../../typechain'; | ||
|
||
const RATE_LIMIT_DURATION = 3600 * 24 * 7; | ||
const RATE_LIMIT_AMOUNT = 0n; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const { | ||
ethers, | ||
upgrades: { upgradeProxy, prepareUpgrade }, | ||
deployments: { get, save }, | ||
} = hre; | ||
const [deployer] = await ethers.getSigners(); | ||
|
||
const fuelMessagePortal = await get('FuelMessagePortal'); | ||
const constructorArgs = [MaxUint256, RATE_LIMIT_DURATION]; | ||
const tx = (await prepareUpgrade( | ||
fuelMessagePortal.address, | ||
new FuelMessagePortalV3(deployer), | ||
{ | ||
constructorArgs, | ||
getTxResponse: true, | ||
unsafeSkipStorageCheck: true, | ||
} | ||
)) as TransactionResponse; | ||
const receipt = await tx.wait(); | ||
|
||
const implementation = receipt?.contractAddress; | ||
|
||
if (!implementation) { | ||
throw new Error('No contract in receipt'); | ||
} | ||
|
||
await upgradeProxy( | ||
fuelMessagePortal.address, | ||
new FuelMessagePortalV3(deployer), | ||
{ | ||
unsafeAllow: ['constructor'], | ||
constructorArgs, | ||
call: { fn: 'reinitializeV3', args: [RATE_LIMIT_AMOUNT] }, | ||
unsafeSkipStorageCheck: true, | ||
} | ||
); | ||
|
||
console.log('Upgraded FuelMessagePortal to', implementation); | ||
await save('FuelMessagePortal', { | ||
address: fuelMessagePortal.address, | ||
abi: [...FuelMessagePortalV3.abi], | ||
implementation, | ||
}); | ||
|
||
return true; | ||
}; | ||
|
||
func.tags = ['018_portal_upgrade']; | ||
func.id = '018_portal_upgrade'; | ||
export default func; |
Oops, something went wrong.