Created
July 11, 2018 15:30
-
-
Save janfilips/c1630920f7cc56835d079d4b3276e5be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from web3 import Web3 | |
import json | |
from web3.providers.rpc import HTTPProvider | |
CONTRACT_ABI = ''' | |
[{"constant": false,"inputs": [{"name": "hash","type": "bytes32"}],"name": "apply","outputs": [],"payable": false,"stateMutability": "nonpayable","type": "function"},{"constant": true,"inputs": [{"name": "email","type": "string"}],"name": "getApplicationID","outputs": [{"name": "","type": "uint256"}],"payable": false,"stateMutability": "view","type": "function"}] | |
''' | |
CONTRACT_ADDRESS = '0xcbbfbafedb0eb83016d2a96a4e80d30b20fa3e30' | |
CONTRACT_ADDRESS = Web3.toChecksumAddress(CONTRACT_ADDRESS) | |
KECCAK_EMAIL = 'c7bc0131ea86844c4e8dd297d806f065e3e4d59a18becfedd254a74cf6e20f69' | |
w3 = Web3(HTTPProvider('https://ropsten.infura.io')) | |
CONTRACT_ABI = json.loads(CONTRACT_ABI) | |
contract_instance = w3.eth.contract(address=CONTRACT_ADDRESS, abi=CONTRACT_ABI,) | |
print ('block number', w3.eth.blockNumber) | |
#print ('Creator',contract_instance.call().creator) | |
#print ('Contracts',contract_instance.call().newContracts) | |
#print ('OracleName',contract_instance.call().oracleName) | |
print ('-'*100) | |
print ('1. Submit a hash (Keccak-256) of your email address using the apply() function.') | |
apply_res = contract_instance.functions.apply(KECCAK_EMAIL).call() | |
print ('apply response:', apply_res) | |
print ('2. Retrieve your application ID using the getApplicationID() function.') | |
application_id = contract_instance.functions.getApplicationID(KECCAK_EMAIL).call() | |
print ('appliation_id', application_id) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment