Skip to content

Commit

Permalink
Corner Base gas price set issues
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Jan 8, 2025
1 parent f4cff93 commit cfcd6f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
12 changes: 9 additions & 3 deletions eth_defi/hotwallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import logging
import secrets
from decimal import Decimal
from pprint import pformat
from typing import Optional, NamedTuple

from eth_account import Account
Expand Down Expand Up @@ -409,13 +410,18 @@ def transact_and_broadcast_with_contract(
if gas_limit is not None:
tx_data["gas"] = gas_limit

self.fill_in_gas_price(web3, tx_data)

if "maxFeePerGas" in tx_data and "gasPrice" in tx_data:
# We can have only one
# https://ethereum.stackexchange.com/questions/121361/web3py-issue-on-avalanche-when-using-maxpriorityfeepergas-and-maxfeepergas
del tx_data["gasPrice"]

self.fill_in_gas_price(web3, tx_data)
signed_tx = self.sign_transaction_with_new_nonce(tx_data)
try:
signed_tx = self.sign_transaction_with_new_nonce(tx_data)
except Exception as e:
# Probably mismatch between network expected gas parameter format and what we give
raise RuntimeError(f"Could not sign:\n{pformat(tx_data)}") from e

tx_hash = web3.eth.send_raw_transaction(signed_tx.raw_transaction)
return tx_hash
Expand Down Expand Up @@ -505,7 +511,7 @@ def from_private_key(key: str) -> "HotWallet":
:param key: 0x prefixed hex string
:return: Ready to go hot wallet account
"""
assert type(key) == str, f"Expectd private key as string, got {type(key)}"
assert type(key) == str, f"Expected private key as string, got {type(key)}"
assert key.startswith("0x"), f"This system assumes private keys are prefixed with 0x, your key starts with {key[0:8]}... Please add 0x prefix to your private key hex string"
account = Account.from_key(key)
return HotWallet(account)
Expand Down
7 changes: 3 additions & 4 deletions scripts/lagoon/deploy-lagoon.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ def main():
SIMULATE = os.environ.get("SIMULATE")

deployer_wallet = HotWallet.from_private_key(PRIVATE_KEY)
deployer = deployer_wallet.account
asset_manager = deployer.address
asset_manager = deployer_wallet.address
# Add some random multisig holders
multisig_owners = [deployer.address, RANDO1, RANDO2]
multisig_owners = [deployer_wallet.address, RANDO1, RANDO2]

if SIMULATE:
print("Simulation deployment with Anvil")
Expand All @@ -67,7 +66,7 @@ def main():

deploy_info = deploy_automated_lagoon_vault(
web3=web3,
deployer=deployer,
deployer=deployer_wallet,
asset_manager=asset_manager,
parameters=parameters,
safe_owners=multisig_owners,
Expand Down

0 comments on commit cfcd6f0

Please sign in to comment.