|
| 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 | + ) |
0 commit comments