-
Notifications
You must be signed in to change notification settings - Fork 77
/
Copy path015.relinquish_ownership.ts
99 lines (88 loc) · 2.45 KB
/
015.relinquish_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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import { ZeroHash as DEFAULT_ADMIN_ROLE } from 'ethers';
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
import type { DeployFunction } from 'hardhat-deploy/dist/types';
import {
FuelChainState__factory,
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 { address: stateAddress } = await deployments.get('FuelChainState');
const gateway = FuelERC20GatewayV4__factory.connect(
gatewayAddress,
ethers.provider
);
const state = FuelChainState__factory.connect(stateAddress, ethers.provider);
const COMMITTER_ROLE = await state.COMMITTER_ROLE();
// This role is shared between the portal and the gateway
const RATE_LIMITER_ROLE = await gateway.SET_RATE_LIMITER_ROLE();
/**
* PORTAL:
* Renounce roles of current admin:
* - DEFAULT_ADMIN_ROLE (upgradability)
* - RATE_LIMITER_ROLE
*/
await deployments.execute(
'FuelMessagePortal',
{ log: true, from: deployer.address },
'renounceRole',
DEFAULT_ADMIN_ROLE,
deployer.address
);
await deployments.execute(
'FuelMessagePortal',
{ log: true, from: deployer.address },
'renounceRole',
RATE_LIMITER_ROLE,
deployer.address
);
/**
* GATEWAY:
* Renounce roles of current admin:
* - DEFAULT_ADMIN_ROLE (upgradability)
* - RATE_LIMITER_ROLE
*/
await deployments.execute(
'FuelERC20GatewayV4',
{ log: true, from: deployer.address },
'renounceRole',
DEFAULT_ADMIN_ROLE,
deployer.address
);
await deployments.execute(
'FuelERC20GatewayV4',
{ log: true, from: deployer.address },
'renounceRole',
RATE_LIMITER_ROLE,
deployer.address
);
/**
* STATE:
* Renounce roles of current admin:
* - DEFAULT_ADMIN_ROLE (upgradability)
* - COMMITTER_ROLE
*/
await deployments.execute(
'FuelChainState',
{ log: true, from: deployer.address },
'renounceRole',
DEFAULT_ADMIN_ROLE,
deployer.address
);
await deployments.execute(
'FuelChainState',
{ log: true, from: deployer.address },
'renounceRole',
COMMITTER_ROLE,
deployer.address
);
return true;
};
func.tags = ['relinquish_ownership'];
func.id = 'relinquish_ownership';
func.skip = async () => true;
export default func;