Skip to content

Instantly share code, notes, and snippets.

@janfilips
Created July 11, 2018 11:11
Show Gist options
  • Save janfilips/c1df95e0877196beae4f99435aee37a6 to your computer and use it in GitHub Desktop.
Save janfilips/c1df95e0877196beae4f99435aee37a6 to your computer and use it in GitHub Desktop.
import json
import web3
from web3 import Web3, HTTPProvider, TestRPCProvider
from solc import compile_source
from web3.contract import ConciseContract
#w3 = Web3(TestRPCProvider())
etherscan_provider = Web3.HTTPProvider( 'https://api.etherscan.io/api')
w3 = Web3(etherscan_provider)
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 = w3.toChecksumAddress(CONTRACT_ADDRESS)
contract_instance = w3.eth.contract(address=CONTRACT_ADDRESS, abi=ABI)
# XXX ??? which account?
keccak_email_bytes32 = w3.toBytes(text=KECCAK_EMAIL)
contract_instance.functions.apply(keccak_email_bytes32).call()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment