-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy path014.gateway_transfer_ownership.ts
55 lines (46 loc) · 1.48 KB
/
014.gateway_transfer_ownership.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
49
50
51
52
53
54
55
import { ZeroHash as DEFAULT_ADMIN_ROLE } from 'ethers';
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';
import { MAINNET_MULTISIG_ADDRESS } from '../../protocol/constants';
import { FuelERC20GatewayV4__factory } from '../../typechain';
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { ethers, deployments } = hre;
const [deployer] = await ethers.getSigners();
const { address: gatewayAddress } = await deployments.get(
'FuelERC20GatewayV4'
);
const portal = FuelERC20GatewayV4__factory.connect(
gatewayAddress,
ethers.provider
);
const PAUSER_ROLE = await portal.PAUSER_ROLE();
const RATE_LIMITER_ROLE = await portal.SET_RATE_LIMITER_ROLE();
// Give admin role to multisig
await deployments.execute(
'FuelERC20GatewayV4',
{ log: true, from: deployer.address },
'grantRole',
DEFAULT_ADMIN_ROLE,
MAINNET_MULTISIG_ADDRESS
);
// Give pauser role to multisig
await deployments.execute(
'FuelERC20GatewayV4',
{ log: true, from: deployer.address },
'grantRole',
PAUSER_ROLE,
MAINNET_MULTISIG_ADDRESS
);
// Give rate limit role to multisig
await deployments.execute(
'FuelMessagePortal',
{ log: true, from: deployer.address },
'grantRole',
RATE_LIMITER_ROLE,
MAINNET_MULTISIG_ADDRESS
);
return true;
};
func.tags = ['gateway_ownership'];
func.id = 'gateway_ownership';
export default func;