Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @main.route('/refresh', methods=['GET', 'POST'])
- @login_required
- def refresh():
- token_addr = '0x8e30ea2329d95802fd804f4291220b0e2f579812'
- receive_addr = '580c6b022a3d1c31d348fc5a8d03d516da8ba312'
- result = requests.get('http://api.etherscan.io/api?module=account&action=txlist&address='+token_addr+'&startblock=0&endblock=99999999&sort=desc&apikey=V6I4169BS1CFDZHTC7C8UNPF9WNW7XGVWU',timeout=30).json()
- for tx in result["result"]:
- method = tx["input"][:10]
- if method=="0xa9059cbb" and tx["txreceipt_status"]=="1": #ETH false Top-up?
- transfer_to_addr = tx["input"][10:64+10]
- transfer_to_value = int('0x'+tx["input"][10+64:10+64+64],16)/1000000000000000000
- if receive_addr in transfer_to_addr:
- if tx["hash"] in open('txlist.txt').read():
- continue
- current_user.balance += transfer_to_value
- open('txlist.txt','a').write(tx["hash"]+'\n')
- return make_response("<script>alert('已刷新');location.href='/'</script>")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement