Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions derive_client/_bridge/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
CONTROLLER_ABI_PATH,
CONTROLLER_V0_ABI_PATH,
DEFAULT_GAS_FUNDING_AMOUNT,
DEPOSIT_GAS_LIMIT,
DEPOSIT_HELPER_ABI_PATH,
DEPOSIT_HOOK_ABI_PATH,
DERIVE_ABI_PATH,
Expand Down Expand Up @@ -565,7 +564,7 @@ def poll_bridge_progress(self, tx_result: BridgeTxResult) -> BridgeTxResult:

return tx_result

def _ensure_derive_eth_balance(self, tx:dict[str, str]):
def _ensure_derive_eth_balance(self, tx: dict[str, str]):
"""Ensure that the Derive EOA wallet has sufficient ETH balance for gas."""
balance_of_owner = self.derive_w3.eth.get_balance(self.owner)
required_gas = tx['maxFeePerGas'] * tx['gas']
Expand Down Expand Up @@ -594,8 +593,10 @@ def bridge_mainnet_eth_to_derive(self, amount: int) -> TxResult:
)
require_gas = tx['maxFeePerGas'] * tx['gas']
current_balance = w3.eth.get_balance(self.account.address)
if not current_balance >= (amount + require_gas ) * 1.1:
raise InsufficientGas(f"Insufficient ETH balance for bridging amount {amount} + gas {require_gas}. Balance: {current_balance}")
if not current_balance >= (amount + require_gas) * 1.1:
raise InsufficientGas(
f"Insufficient ETH balance for bridging amount {amount} + gas {require_gas}. Balance: {current_balance}"
)
tx_result = send_and_confirm_tx(
w3=w3, tx=tx, private_key=self.private_key, action="bridgeETH()", logger=self.logger
)
Expand Down
4 changes: 2 additions & 2 deletions derive_client/utils/w3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from derive_client.constants import ABI_DATA_DIR, DEFAULT_RPC_ENDPOINTS, GAS_FEE_BUFFER
from derive_client.data_types import ChainID, RPCEndpoints, TxResult, TxStatus
from derive_client.exceptions import NoAvailableRPC, TxSubmissionError
from derive_client.exceptions import NoAvailableRPC
from derive_client.utils.logger import get_logger
from derive_client.utils.retry import exp_backoff_retry

Expand Down Expand Up @@ -250,7 +250,7 @@ def send_and_confirm_tx(
"""Send and confirm transactions."""

try:

tx_hash = sign_and_send_tx(w3=w3, tx=tx, private_key=private_key, logger=logger)
tx_result = TxResult(tx_hash=tx_hash.to_0x_hex(), tx_receipt=None, exception=None)

Expand Down
10 changes: 5 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ rich-click = "^1.7.1"
python-dotenv = ">=0.14.0,<2"
pandas = ">=1,<=3"
eth-account = ">=0.13"
derive-action-signing = "^0.0.11"
derive-action-signing = "^0.0.12"
pydantic = "^2.11.3"
aiolimiter = "^1.2.1"

Expand Down
Loading