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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
| import time from web3 import Web3
abi = """[ { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "isContract", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "isContract2", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "addr", "type": "address" } ], "name": "isContract4", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" } ] """
w3 = Web3(Web3.HTTPProvider("https://data-seed-prebsc-1-s1.binance.org:8545")) pancakeswap = "0xC73269f2C709F0a69435cd3582C1F35dff0cb44C" contractObj = w3.eth.contract( address=Web3.toChecksumAddress(pancakeswap), abi=abi) data1 = contractObj.functions.isHuman(Web3.toChecksumAddress("0xeD47E52c570431cd2d45F63760661EaD68167f9D")).call() data2 = contractObj.functions.isContract(Web3.toChecksumAddress("0xeD47E52c570431cd2d45F63760661EaD68167f9D")).call() data3 = contractObj.functions.isContract2(Web3.toChecksumAddress("0xeD47E52c570431cd2d45F63760661EaD68167f9D")).call()
print(data1) print(data2) print(data3) print(Web3.toText(data1))
|