-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbera.py
36 lines (24 loc) · 1.03 KB
/
bera.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
import json
from web3 import Web3
def create_contract(address, abi, api):
w3 = Web3(Web3.HTTPProvider(api))
contract_address = Web3.to_checksum_address(address)
with open(abi) as abi_file:
abi_file = json.load(abi_file)
return w3.eth.contract(address=contract_address, abi=abi_file)
def get_bera_boosts(bgt_address, wallet, api):
bgt = create_contract(bgt_address, "./abi/BGT.json", api)
result = bgt.functions.boosts(wallet).call()
return result
def get_bera_boostees(bgt_address, wallet, api):
bgt = create_contract(bgt_address, "./abi/BGT.json", api)
result = bgt.functions.boostees(wallet).call()
return result
def get_bera_unboosted(bgt_address, wallet, api):
bgt = create_contract(bgt_address, "./abi/BGT.json", api)
result = bgt.functions.unboostedBalanceOf(wallet).call()
return result
def get_bera_queued_boost(bgt_address, wallet, api):
bgt = create_contract(bgt_address, "./abi/BGT.json", api)
result = bgt.functions.queuedBoost(wallet).call()
return result