Skip to content

Commit 7e95442

Browse files
committed
Modify renounce_roles script to renounce all roles
1 parent 2120146 commit 7e95442

File tree

3 files changed

+72
-47
lines changed

3 files changed

+72
-47
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ Script requires next ENV variables to be set:
115115
- `DEPLOYER` - id of brownie's account which will deploy contracts. To create a voting account must have LDO Tokens. Might be skipped if run on a `development` network.
116116
- `EVM_SCRIPT_EXECUTOR` - address to grant permissions.
117117

118-
### `renounce_roles.py`
118+
### `renounce_all_roles.py`
119119

120-
Sends transactions to renounce roles from EasyTrack contract deployed in mainnet [`0xF0211b7660680B49De1A7E9f25C65660F0a13Fea`](https://etherscan.io/address/0xf0211b7660680b49de1a7e9f25c65660f0a13fea).
120+
Sends transactions to renounce `DEFAULT_ADMIN_ROLE`, `PAUSE_ROLE`, `UNPAUSE_ROLE`, `CANCEL_ROLE` roles from EasyTrack contract deployed in mainnet [`0xF0211b7660680B49De1A7E9f25C65660F0a13Fea`](https://etherscan.io/address/0xf0211b7660680b49de1a7e9f25c65660f0a13fea).
121121

122122
Script requires next ENV variables to be set:
123123

scripts/renounce_all_roles.py

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
from brownie import EasyTrack
2+
from utils.config import get_is_live, get_deployer_account, prompt_bool
3+
from utils import test_helpers
4+
5+
EASY_TRACK_ADDRESS = "0xF0211b7660680B49De1A7E9f25C65660F0a13Fea"
6+
7+
8+
def main():
9+
deployer = get_deployer_account(get_is_live())
10+
print("DEPLOYER:", deployer)
11+
print(
12+
f"Renounce DEFAULT_ADMIN_ROLE, PAUSE_ROLE, UNPAUSE_ROLE, CANCEL_ROLE from {deployer} on EasyTrack ({EASY_TRACK_ADDRESS})"
13+
)
14+
print("Proceed? [y/n]: ")
15+
if not prompt_bool():
16+
print("Aborting")
17+
return
18+
19+
tx_params = {"from": deployer}
20+
easy_track = EasyTrack.at(EASY_TRACK_ADDRESS)
21+
22+
# default admin role
23+
if easy_track.hasRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer):
24+
print(f"{deployer} has DEFAULT_ADMIN_ROLE, sending transaction to renounce it")
25+
easy_track.renounceRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer, tx_params)
26+
else:
27+
print(f"{deployer} has no DEFAULT_ADMIN_ROLE")
28+
29+
# pause role
30+
if easy_track.hasRole(easy_track.PAUSE_ROLE(), deployer):
31+
print(f"{deployer} has PAUSE_ROLE, sending transaction to renounce it")
32+
easy_track.renounceRole(easy_track.PAUSE_ROLE(), deployer, tx_params)
33+
else:
34+
print(f"{deployer} has no PAUSE_ROLE")
35+
36+
# unpause role
37+
if easy_track.hasRole(easy_track.UNPAUSE_ROLE(), deployer):
38+
print(f"{deployer} has UNPAUSE_ROLE, sending transaction to renounce it")
39+
easy_track.renounceRole(easy_track.UNPAUSE_ROLE(), deployer, tx_params)
40+
else:
41+
print(f"{deployer} has no UNPAUSE_ROLE")
42+
43+
# cancel role
44+
if easy_track.hasRole(easy_track.CANCEL_ROLE(), deployer):
45+
print(f"{deployer} has CANCEL_ROLE, sending transaction to renounce it")
46+
easy_track.renounceRole(easy_track.CANCEL_ROLE(), deployer, tx_params)
47+
else:
48+
print(f"{deployer} has no CANCEL_ROLE")
49+
50+
print("Validate that roles was renounced")
51+
test_helpers.assert_equals(
52+
f"{deployer} has no DEFAULT_ADMIN_ROLE",
53+
not easy_track.hasRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer),
54+
True,
55+
)
56+
test_helpers.assert_equals(
57+
f"{deployer} has no PAUSE_ROLE",
58+
not easy_track.hasRole(easy_track.PAUSE_ROLE(), deployer),
59+
True,
60+
)
61+
test_helpers.assert_equals(
62+
f"{deployer} has no UNPAUSE_ROLE",
63+
not easy_track.hasRole(easy_track.UNPAUSE_ROLE(), deployer),
64+
True,
65+
)
66+
test_helpers.assert_equals(
67+
f"{deployer} has no CANCEL_ROLE",
68+
not easy_track.hasRole(easy_track.CANCEL_ROLE(), deployer),
69+
True,
70+
)

scripts/renounce_roles.py

-45
This file was deleted.

0 commit comments

Comments
 (0)