Skip to content

Commit

Permalink
Add encryptors function
Browse files Browse the repository at this point in the history
  • Loading branch information
manumonti committed Jul 15, 2024
1 parent 1c937a5 commit 6881165
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions scripts/bqeth_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ def initiate_ritual(
print(f"Transaction receipt: {tx_receipt}")


def add_encryptors(global_allow_list_contract, account, encryptors_addresses, ritual_id):
tx = global_allow_list_contract.functions.authorize(
ritual_id,
encryptors_addresses,
).build_transaction(
{
"from": account.address,
"nonce": nonce, # TODO: update nonce consequently
}
)

signed_tx = w3.eth.account.sign_transaction(tx, private_key=PRIVATE_KEY)
tx_hash = w3.eth.send_raw_transaction(signed_tx.rawTransaction)
tx_receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
print(f"Added encryptors to the global allow list for ritual {ritual_id}.")

if __name__ == "__main__":
ritual_id = 1
num_nodes = 2
Expand All @@ -166,8 +182,21 @@ def initiate_ritual(
).call()

approve_erc20_transfer(erc20_contract, account, nonce, base_fees, encryptor_fees)
input("Press Enter to continue...")
pay_for_subscription_and_slots(subscription_contract, account, nonce, encryptor_slots)
input("Press Enter to continue...")
pay_for_new_slots(subscription_contract, account, nonce, extra_encryptor_slots)
input("Press Enter to continue...")
initiate_ritual(
coordinator_contract, account, nonce, subscription_contract, ritual_id, num_nodes
)
input("Press Enter to continue...")

# Randomly generated addresses
encryptors = [
"0x1feDcec87aE951454cB45fc7FbedbE6f3BD434be",
# "0x09f5FF03d0117467b4556FbEC4cC74b475358654",
# "0x47285b814A360f5c39454bc35eEBeA469d1619b3",
# "0xaa764B4F33097A3d5CA0c9e5FeAFAb8694f02B3E",
]
add_encryptors(global_allow_list_contract, account, encryptors, 11)

0 comments on commit 6881165

Please sign in to comment.