From 563fc937530996e5d21e6ed77035abfcceba64f0 Mon Sep 17 00:00:00 2001 From: Eugene Yurtaev Date: Mon, 4 Apr 2016 13:34:18 +0300 Subject: [PATCH] python3.4 fixes --- connectionToContract.py => wavesPresale.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) rename connectionToContract.py => wavesPresale.py (77%) diff --git a/connectionToContract.py b/wavesPresale.py similarity index 77% rename from connectionToContract.py rename to wavesPresale.py index 7e3222b..677352a 100644 --- a/connectionToContract.py +++ b/wavesPresale.py @@ -1,4 +1,5 @@ from API import API +import binascii base_address = "0x82e1c8c4c38f5c0767f7c426e235f194010b71e9" contract_address = "0xac64a5168144734f0d688D689c730A519844D0c5" @@ -11,8 +12,9 @@ def logSale(bitcoin_tx_id, amount): definition = "newSale(bytes32,uint256)" method_id = api.getMethodId(definition) amount = abs(int(amount * (10 ** 8))) - amount_bytes = amount.to_bytes(32, byteorder='big').hex() - data = "0x" + method_id + bitcoin_tx_id + amount_bytes + amount_bytes = amount.to_bytes(32, byteorder='big') + amount_string = str(binascii.b2a_hex(amount_bytes), 'ascii') + data = "0x" + method_id + bitcoin_tx_id + amount_string gas_price = hex(api.getGasPrice()["result"]) response = api.send_transaction(base_address, contract_address,