-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
53 lines (42 loc) · 1.41 KB
/
main.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
41
42
43
44
45
46
47
48
49
50
51
52
53
from dotmap import DotMap
from brownie import *
from brownie.network.gas.strategies import GasNowStrategy
import time
import json
from dotenv import load_dotenv
import os
import requests
from rich.status import Status
from brownie.network import gas_price
load_dotenv()
wallet = os.getenv( 'wallet' )
brownie = os.getenv( 'network' )
network.connect( brownie )
me = accounts.default = accounts.load( wallet )
with open( 'accounts.json', 'r' ) as f:
accounts = DotMap( json.load( f ) )
c = Contract.from_explorer( '0xA39d1e9CBecdb17901bFa87a5B306D67f15A2391' )
def claim(r):
d = DotMap()
d.id = r['id']
d.account = r['account']
d.amount = int( '0' + r['amount'] )
d.r = int( '0' + r['r'] )
d.s = int( '0' + r['s'] )
d.v = int( '0' + r['v'] )
c.claim( d.id, d.account, d.amount, d.v, d.r, d.s )
with Status( 'API not updated..' ):
while True:
strategy = GasNowStrategy( speed='rapid' )
gas_price( strategy )
url = f'https://cu3pxr9ydi.execute-api.us-east-1.amazonaws.com/prod/distributor' \
f'/{accounts.main}'
r = requests.get( url ).json()[0]
if r['id'] != '':
claim( r )
for a in accounts.others:
url = f'https://cu3pxr9ydi.execute-api.us-east-1.amazonaws.com/prod/distributor' \
f'/{a}'
r = requests.get( url ).json()[0]
claim( r )
time.sleep(1)