-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathinsert_aggkey_sc.py
40 lines (30 loc) · 1.23 KB
/
insert_aggkey_sc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import sys
import os
sys.path.append(os.path.abspath("tests"))
from shared_tests import *
from utils import prompt_user_continue_or_break
from consts import *
from brownie import accounts, KeyManager, network
AUTONOMY_SEED = os.environ["SEED"]
cf_accs = accounts.from_mnemonic(AUTONOMY_SEED, count=10)
DEPLOYER_ACCOUNT_INDEX = int(os.environ.get("DEPLOYER_ACCOUNT_INDEX") or 0)
DEPLOYER = cf_accs[DEPLOYER_ACCOUNT_INDEX]
print(f"DEPLOYER = {DEPLOYER}")
def main():
network.priority_fee("1 gwei")
KEY_MANAGER_ADDRESS = os.environ["KEY_MANAGER_ADDRESS"]
keyManager = KeyManager.at(KEY_MANAGER_ADDRESS)
# Assumption that this is a long hex string without 0x
x = os.environ["X_AGG_KEY"]
parity = os.environ["PARITY"]
# parity should be a "Odd" or "Even" otherwise it will fail
assert parity in ["Even", "Odd"], "Parity should be Even or Odd"
parity = "00" if parity == "Even" else "01"
newAggKey = [int(x, 16), int(parity, 16)]
print(f"Setting the aggregate key to {newAggKey}")
prompt_user_continue_or_break("", False)
tx = keyManager.setAggKeyWithGovKey(
newAggKey, {"from": DEPLOYER, "required_confs": 1}
)
tx.info()
print(f"Succesfully updated the aggregate key to {newAggKey}")