-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwhitelist.py
executable file
·36 lines (26 loc) · 1.05 KB
/
whitelist.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
#!/usr/bin/env python3
import os
import json
import subprocess
PRIVATE_KEY = os.getenv("PRIVATE_KEY")
L1_URL = "https://sepolia.proxy.pontem.network"
ADDRESSES_PATH = "src/evm.whiteList.json"
CONTRACT_ADDRESS = os.getenv("CONTRACT_ADDRESS", "0xA2Aa3247B75923173Da2e6C4cc93dd5790030a6d")
def get_addresses():
print("Getting addresses")
with open(ADDRESSES_PATH) as addresses_file:
addresses = json.load(addresses_file)
print("Succesfully got addresses!")
return addresses
def whitelist_addresses(addresses: str, contract_address: str, trues: str):
print("Whitelisting addresses...")
command = f"cast send {contract_address} 'whitelist(address[],bool[])' '[{addresses}]' '[{trues}]' --rpc-url {L1_URL} --private-key {PRIVATE_KEY}"
subprocess.call(command, shell=True)
print("Succesfully whitelisted!")
def main():
addresses = get_addresses()
addresses_str = ",".join(addresses)
trues = ("true," * len(addresses))[:-1]
whitelist_addresses(addresses_str, CONTRACT_ADDRESS, trues)
if __name__ == "__main__":
main()