diff --git a/erc20/bridge/token/token_withdraw.py b/erc20/foreign_withdraw.py similarity index 100% rename from erc20/bridge/token/token_withdraw.py rename to erc20/foreign_withdraw.py diff --git a/erc20/home_deposit.py b/erc20/home_deposit.py index f7cafb7..0c0c310 100755 --- a/erc20/home_deposit.py +++ b/erc20/home_deposit.py @@ -29,8 +29,6 @@ gas_price = b.home_bridge.functions.gasPrice().call() gas_limit = 50000 net_id = int(web3.version.network) -op_num = web3.eth.getTransactionCount(b.actor_address) - tx_templ = { 'to': b.home_bridge_address, 'gas': gas_limit, @@ -44,6 +42,11 @@ op_num = web3.eth.getTransactionCount(actor.address) if tx_value == None: tx_value = b.home_bridge.functions.minPerTx().call() +balance_needed = ((gas_price * gas_limit + tx_value) * tx_num) +balance_current = web3.eth.getBalance(actor.address) +if balance_needed > balance_current: + exit(f'{actor.address} balance is lower than needed ({balance_needed} > {balance_current})') + ################################################################################ # Preparing batch of transactions to the bridge contract with ether sending ################################################################################