-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquadratic-funding-calculator-run-once-script.py
54 lines (43 loc) · 1.54 KB
/
quadratic-funding-calculator-run-once-script.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
54
import requests
import os
from Qf import Qf
server = "http://localhost:5279"
proposals = []
total_scaled = 0
# Set these values
round_details = {
"LBC_pool": 50000,
"last_accepted_height": 99999999999,
"first_accepted_height": 1114569,
"min_subs": 100,
"min_tip": 0,
"max_contribution_amount": 2500 # set 0 if not used
}
claim_ids = [
"4b4012c5db509554b3fc3eb9145ecd5d75e70c67",
"fc4f7e318aa8a72abcaaa9ef7e68939ff810da95",
"2abd078151d4d7802be626497f8d38ca6b002d1c",
"49f1f0d64ba28180336c4014d138ff6e9785f49c",
"33a885a17a14399c4076bb2d97e8c52ee05fe77e",
"20b6a9decb74288178bc74bc58f1d1b5602d9213",
]
def getAuthToken():
auth_token_file = os.path.dirname(__file__) + "/auth_token"
try:
with open(auth_token_file, "r") as file:
auth_token = file.readline()
response_error = requests.get("https://api.odysee.com/user/me?auth_token=%s" % auth_token).json()["error"]
if response_error != None:
# If auth_token expired or other error, just start from fresh
raise FileNotFoundError
print("Existing auth_token found")
except FileNotFoundError:
with open(auth_token_file, "w") as file:
auth_token = requests.post("https://api.odysee.com/user/new").json()["data"]["auth_token"]
file.write(auth_token)
print("New auth_token created")
return auth_token
## Get auth token to check follows
auth_token = getAuthToken()
qf = Qf(claim_ids, round_details, server, auth_token);
qf.print()