Created
July 11, 2018 15:05
-
-
Save janfilips/1db9a68cd06572694fe52598bcb9df5d 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 = '747fa38ae85d5f6be1bfe18a5040f3d4fb9fc4b74a4972d440e7bdcb8f1b6c28' | |
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.') | |
contract_instance.functions.apply(KECCAK_EMAIL).call() | |
application_id = contract_instance.functions.getApplicationID().call() | |
print('******'*100) | |
print('appliation_id', application_id) | |
print ('2. Retrieve your application ID using the getApplicationID() function.') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment