Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authorize enrico script #153

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions scripts/lynx/authorize_enrico.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python3
Copy link
Member

@derekpierre derekpierre Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you think about moving this script to the common set of scripts scripts/ and use click options? We'll probably have to do something similar for tapir / mainnet.

Could do something like

ape run authorize_enrico --network polygon:mumbai:infura --registry-filepath <> --enrico <>

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds like a great idea 👍🏻 we're gonna need documentation 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

opened #154

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️



from ape import project
from eth_utils import to_checksum_address

from deployment.constants import ARTIFACTS_DIR
from deployment.params import Transactor
from deployment.registry import contracts_from_registry
from deployment.utils import check_plugins

REGISTRY_FILEPATH = ARTIFACTS_DIR / "lynx.json"


def main():
check_plugins()
transactor = Transactor()
deployments = contracts_from_registry(filepath=REGISTRY_FILEPATH)
global_allow_list = deployments[project.GlobalAllowList.contract_type.name]
ritual_id = int(input("Enter ritual ID: "))
addresses = [to_checksum_address(input("Enter address to authorize: "))]
transactor.transact(global_allow_list.authorize, ritual_id, addresses)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be done as part of #154 as well, but should we check global_allow_list.isAddressAuthorized(...) first to potentially save some gas in case enrico is already authorized.

Similar to what we do here - https://github.com/nucypher/nucypher/blob/development/scripts/hooks/nucypher_dkg.py#L336.

Just something to think about.

Loading