Skip to content
This repository has been archived by the owner on May 13, 2022. It is now read-only.

Make Goerli work again #275

Merged
Prev Previous commit
Next Next commit
Use pending transaction count as nonce also for approve function
manuelwedler committed Jul 15, 2020
commit eef05148e652a60ca9635b30c1016415455526d2
4 changes: 0 additions & 4 deletions raiden_installer/transactions.py
Original file line number Diff line number Diff line change
@@ -67,7 +67,6 @@ def deposit_service_tokens(w3: Web3, account: Account, token: Erc20Token, amount
def approve(w3, account, allowed_address, allowance: Wei, token: Erc20Token):
token_proxy = _make_token_proxy(w3=w3, token=token)
old_allowance = token_proxy.functions.allowance(account.address, allowed_address).call()
nonce = w3.eth.getTransactionCount(account.address)

if old_allowance > 0:
send_raw_transaction(
@@ -77,9 +76,7 @@ def approve(w3, account, allowed_address, allowance: Wei, token: Erc20Token):
allowed_address,
0,
gas=GAS_REQUIRED_FOR_APPROVE,
nonce=nonce,
)
nonce += 1

transaction_receipt = send_raw_transaction(
w3,
@@ -88,7 +85,6 @@ def approve(w3, account, allowed_address, allowance: Wei, token: Erc20Token):
allowed_address,
allowance,
gas=GAS_REQUIRED_FOR_APPROVE,
nonce=nonce,
)

wait_for_transaction(w3, transaction_receipt)
2 changes: 1 addition & 1 deletion raiden_installer/utils.py
Original file line number Diff line number Diff line change
@@ -39,7 +39,7 @@ def get_contract_address(chain_id, contract_name):
def estimate_gas(w3, account, contract_function, *args, **kw):
transaction_params = {
"chainId": int(w3.net.version),
"nonce": w3.eth.getTransactionCount(account.address),
"nonce": w3.eth.getTransactionCount(account.address, "pending"),
}
transaction_params.update(**kw)
result = contract_function(*args)