Skip to content

Commit

Permalink
Modify renounce_roles script to renounce all roles
Browse files Browse the repository at this point in the history
  • Loading branch information
Psirex committed Dec 3, 2021
1 parent 2120146 commit 7e95442
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 47 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
70 changes: 70 additions & 0 deletions scripts/renounce_all_roles.py
Original file line number Diff line number Diff line change
@@ -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,
)
45 changes: 0 additions & 45 deletions scripts/renounce_roles.py

This file was deleted.

0 comments on commit 7e95442

Please sign in to comment.