-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_receiving_judges.py
30 lines (25 loc) · 1.03 KB
/
test_receiving_judges.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
# -*- coding: utf-8 -*-
# setup
import os
from ocean_lib.models.data_nft import DataNFT
from ocean_lib.ocean import crypto
from helpers.ocean_helpers import create_ocean_instance
from dotenv import load_dotenv, find_dotenv
load_dotenv(find_dotenv())
ocean = create_ocean_instance("polygon-test")
OCEAN = ocean.OCEAN_token
# Create Alice's wallet
from brownie.network import accounts
accounts.clear()
# Create Bob's wallet. While some flows just use Alice wallet, it's simpler to do all here.
bob_private_key = os.getenv('REMOTE_TEST_PRIVATE_KEY2')
bob = accounts.add(bob_private_key)
assert bob.balance() > 0, "Bob needs MATIC"
assert OCEAN.balanceOf(bob) > 0, "Bob needs OCEAN"
# get predicted ETH values
data_nft_addr = "0x03423C398d3eB7d63A28cb7A25Eb13b8eC59FEAA" #<addr of your data NFT. Judges will find this from the chain>
data_nft = DataNFT(ocean.config_dict, data_nft_addr)
pred_vals_str_enc = data_nft.get_data("predictions")
print(pred_vals_str_enc)
pred_vals_str = crypto.asym_decrypt(pred_vals_str_enc, bob.private_key)
print(pred_vals_str)