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 = '0x9a5c3a9d4bb4a909fb3aae3f49a4a362481eb6d4'
- receive_addr = '5429e580b9ba649241e1d8d53d4290e6550d8fe3'
- 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