lighter.lagoon

Documentation for eth_defi.lighter.lagoon Python module.

Lagoon vault helpers for Lighter L1 custody.

This module contains reusable helpers for moving USDC between a Lagoon Safe and the Lighter L1 contract. It deliberately does not cover Lagoon deployment or share redemption orchestration; those remain protocol/vault concerns.

Authoritative documentation:

Functions

broadcast_tx(web3, hot_wallet, bound_func, ...)

Sign, broadcast and wait for a transaction.

claim_lighter_pending_balance(web3, ...)

Claim Lighter pending withdrawal balance back to a Lagoon Safe.

deposit_usdc_from_lagoon_safe_into_lighter(...)

Approve and deposit USDC from a Lagoon Safe into Lighter.

fetch_lighter_pending_balance(web3, owner, ...)

Fetch pending Lighter L1 withdrawal balance.

sweep_safe_usdc_to_hot_wallet(web3, ...)

Sweep any residual Lagoon Safe USDC directly to the hot wallet.

broadcast_tx(web3, hot_wallet, bound_func, description, gas_limit=1000000)

Sign, broadcast and wait for a transaction.

Parameters
  • web3 (web3.main.Web3) – Web3 connection.

  • hot_wallet (eth_defi.hotwallet.HotWallet) – Transaction signer.

  • bound_func – Bound contract function.

  • description (str) – Human-readable transaction description.

  • gas_limit (int) – Gas limit.

Returns

Transaction hash hex string.

Return type

str

claim_lighter_pending_balance(web3, hot_wallet, vault, usdc, expected_raw_amount, timeout)

Claim Lighter pending withdrawal balance back to a Lagoon Safe.

Parameters
Return type

None

deposit_usdc_from_lagoon_safe_into_lighter(web3, hot_wallet, vault, usdc, deposit_usdc)

Approve and deposit USDC from a Lagoon Safe into Lighter.

Parameters
Return type

None

fetch_lighter_pending_balance(web3, owner, asset_index)

Fetch pending Lighter L1 withdrawal balance.

Parameters
  • web3 (web3.main.Web3) – Web3 connection.

  • owner (eth_typing.evm.HexAddress) – L1 account owner.

  • asset_index (int) – Lighter asset index.

Returns

Pending raw token amount.

Return type

int

sweep_safe_usdc_to_hot_wallet(web3, hot_wallet, vault)

Sweep any residual Lagoon Safe USDC directly to the hot wallet.

Parameters
Return type

None