-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy path002.fuel_message_portal_v3.ts
48 lines (40 loc) · 1.44 KB
/
002.fuel_message_portal_v3.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { MaxUint256 } from 'ethers';
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';
import {
RATE_LIMIT_AMOUNT,
RATE_LIMIT_DURATION,
} from '../../protocol/constants';
import { FuelMessagePortalV3__factory as FuelMessagePortal } from '../../typechain';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const {
ethers,
upgrades: { deployProxy, erc1967 },
deployments: { get, save },
} = hre;
const [deployer] = await ethers.getSigners();
const { address: fuelChainState } = await get('FuelChainState');
const constructorArgs = [MaxUint256.toString(), RATE_LIMIT_DURATION];
const contract = await deployProxy(
new FuelMessagePortal(deployer),
[fuelChainState, RATE_LIMIT_AMOUNT.toString()],
{
initializer: 'initializerV3',
constructorArgs: constructorArgs,
}
);
await contract.waitForDeployment();
const address = await contract.getAddress();
const implementation = await erc1967.getImplementationAddress(address);
console.log('Deployed FuelMessagePortal at', address);
await save('FuelMessagePortal', {
address,
abi: [...FuelMessagePortal.abi],
implementation,
linkedData: { factory: 'FuelMessagePortalV3', constructorArgs },
});
return true;
};
func.tags = ['portal', 'message_portal', 'FuelMessagePortal'];
func.id = 'fuel_message_portal';
export default func;