check if the actor has enough funds to deposit added
This commit is contained in:
parent
1e6df73bbe
commit
116ab15a20
|
@ -29,8 +29,6 @@ gas_price = b.home_bridge.functions.gasPrice().call()
|
||||||
gas_limit = 50000
|
gas_limit = 50000
|
||||||
net_id = int(web3.version.network)
|
net_id = int(web3.version.network)
|
||||||
|
|
||||||
op_num = web3.eth.getTransactionCount(b.actor_address)
|
|
||||||
|
|
||||||
tx_templ = {
|
tx_templ = {
|
||||||
'to': b.home_bridge_address,
|
'to': b.home_bridge_address,
|
||||||
'gas': gas_limit,
|
'gas': gas_limit,
|
||||||
|
@ -44,6 +42,11 @@ op_num = web3.eth.getTransactionCount(actor.address)
|
||||||
if tx_value == None:
|
if tx_value == None:
|
||||||
tx_value = b.home_bridge.functions.minPerTx().call()
|
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
|
# Preparing batch of transactions to the bridge contract with ether sending
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in New Issue