diff --git a/README.md b/README.md index ea692bca..5a94d31e 100644 --- a/README.md +++ b/README.md @@ -115,9 +115,9 @@ Script requires next ENV variables to be set: - `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. - `EVM_SCRIPT_EXECUTOR` - address to grant permissions. -### `renounce_roles.py` +### `renounce_all_roles.py` -Sends transactions to renounce roles from EasyTrack contract deployed in mainnet [`0xF0211b7660680B49De1A7E9f25C65660F0a13Fea`](https://etherscan.io/address/0xf0211b7660680b49de1a7e9f25c65660f0a13fea). +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). Script requires next ENV variables to be set: diff --git a/scripts/renounce_all_roles.py b/scripts/renounce_all_roles.py new file mode 100644 index 00000000..6703e94c --- /dev/null +++ b/scripts/renounce_all_roles.py @@ -0,0 +1,70 @@ +from brownie import EasyTrack +from utils.config import get_is_live, get_deployer_account, prompt_bool +from utils import test_helpers + +EASY_TRACK_ADDRESS = "0xF0211b7660680B49De1A7E9f25C65660F0a13Fea" + + +def main(): + deployer = get_deployer_account(get_is_live()) + print("DEPLOYER:", deployer) + print( + f"Renounce DEFAULT_ADMIN_ROLE, PAUSE_ROLE, UNPAUSE_ROLE, CANCEL_ROLE from {deployer} on EasyTrack ({EASY_TRACK_ADDRESS})" + ) + print("Proceed? [y/n]: ") + if not prompt_bool(): + print("Aborting") + return + + tx_params = {"from": deployer} + easy_track = EasyTrack.at(EASY_TRACK_ADDRESS) + + # default admin role + if easy_track.hasRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer): + print(f"{deployer} has DEFAULT_ADMIN_ROLE, sending transaction to renounce it") + easy_track.renounceRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer, tx_params) + else: + print(f"{deployer} has no DEFAULT_ADMIN_ROLE") + + # pause role + if easy_track.hasRole(easy_track.PAUSE_ROLE(), deployer): + print(f"{deployer} has PAUSE_ROLE, sending transaction to renounce it") + easy_track.renounceRole(easy_track.PAUSE_ROLE(), deployer, tx_params) + else: + print(f"{deployer} has no PAUSE_ROLE") + + # unpause role + if easy_track.hasRole(easy_track.UNPAUSE_ROLE(), deployer): + print(f"{deployer} has UNPAUSE_ROLE, sending transaction to renounce it") + easy_track.renounceRole(easy_track.UNPAUSE_ROLE(), deployer, tx_params) + else: + print(f"{deployer} has no UNPAUSE_ROLE") + + # cancel role + if easy_track.hasRole(easy_track.CANCEL_ROLE(), deployer): + print(f"{deployer} has CANCEL_ROLE, sending transaction to renounce it") + easy_track.renounceRole(easy_track.CANCEL_ROLE(), deployer, tx_params) + else: + print(f"{deployer} has no CANCEL_ROLE") + + print("Validate that roles was renounced") + test_helpers.assert_equals( + f"{deployer} has no DEFAULT_ADMIN_ROLE", + not easy_track.hasRole(easy_track.DEFAULT_ADMIN_ROLE(), deployer), + True, + ) + test_helpers.assert_equals( + f"{deployer} has no PAUSE_ROLE", + not easy_track.hasRole(easy_track.PAUSE_ROLE(), deployer), + True, + ) + test_helpers.assert_equals( + f"{deployer} has no UNPAUSE_ROLE", + not easy_track.hasRole(easy_track.UNPAUSE_ROLE(), deployer), + True, + ) + test_helpers.assert_equals( + f"{deployer} has no CANCEL_ROLE", + not easy_track.hasRole(easy_track.CANCEL_ROLE(), deployer), + True, + ) diff --git a/scripts/renounce_roles.py b/scripts/renounce_roles.py deleted file mode 100644 index 6345f292..00000000 --- a/scripts/renounce_roles.py +++ /dev/null @@ -1,45 +0,0 @@ -from brownie import EasyTrack -from utils.config import get_is_live, get_deployer_account, prompt_bool -from utils import test_helpers - -EASY_TRACK_ADDRESS = "0xF0211b7660680B49De1A7E9f25C65660F0a13Fea" - - -def main(): - deployer = get_deployer_account(get_is_live()) - print("DEPLOYER:", deployer) - print( - f"Renounce PAUSE_ROLE, UNPAUSE_ROLE, CANCEL_ROLE from {deployer} on EasyTrack ({EASY_TRACK_ADDRESS})" - ) - print("Proceed? [y/n]: ") - if not prompt_bool(): - print("Aborting") - return - - tx_params = {"from": deployer} - easy_track = EasyTrack.at(EASY_TRACK_ADDRESS) - renounce_roles(easy_track, tx_params) - - print("Validate that roles was renounced") - test_helpers.assert_equals( - f"{deployer} has no PAUSE_ROLE", - not easy_track.hasRole(easy_track.PAUSE_ROLE(), deployer), - True, - ) - test_helpers.assert_equals( - f"{deployer} has no UNPAUSE_ROLE", - not easy_track.hasRole(easy_track.UNPAUSE_ROLE(), deployer), - True, - ) - test_helpers.assert_equals( - f"{deployer} has no CANCEL_ROLE", - not easy_track.hasRole(easy_track.CANCEL_ROLE(), deployer), - True, - ) - - -def renounce_roles(easy_track, tx_params): - account = tx_params["from"] - easy_track.renounceRole(easy_track.PAUSE_ROLE(), account, tx_params) - easy_track.renounceRole(easy_track.UNPAUSE_ROLE(), account, tx_params) - easy_track.renounceRole(easy_track.CANCEL_ROLE(), account, tx_params)