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