def update_address(api, contract_address, hex_value): address = hex_to_address(hex_value) print "ADDRESS", address record = get_address_record(api, contract_address, xint(hex_value)) epoch_time = int(time.time()) if epoch_time - record['last_updated'] > UPDATE_INTERVAL: value = getreceivedbyaddress(address) print "VALUE", value api.transact(contract_address, funid=6, data=[xint(hex_value), value]) print "updated" else: print "not updating, already recently updated"
def cmd_watch(args): hex_value = address_to_hex(args.address) print "Watching", hex_value args.api.transact(args.contract_address, funid=3, data=[xint(hex_value)]) if args.wait: args.api.wait_for_next_block(verbose=True)
def cmd_getreceivedbyaddress(args): hex_value = address_to_hex(args.address) record = get_address_record(args.api, args.contract_address, xint(hex_value)) pprint(record)