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:
Lighter deposits and withdrawals: https://apidocs.lighter.xyz/docs/deposits-transfers-and-withdrawals
Lighter L1 proxy: https://etherscan.io/address/0x3b4d794a66304f130a4db8f2551b0070dfcf5ca7
Functions
|
Sign, broadcast and wait for a transaction. |
|
Claim Lighter pending withdrawal balance back to a Lagoon Safe. |
Approve and deposit USDC from a Lagoon Safe into Lighter. |
|
|
Fetch pending Lighter L1 withdrawal balance. |
|
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
- claim_lighter_pending_balance(web3, hot_wallet, vault, usdc, expected_raw_amount, timeout)
Claim Lighter pending withdrawal balance back to a Lagoon Safe.
- Parameters
web3 (web3.main.Web3) – Web3 connection.
hot_wallet (eth_defi.hotwallet.HotWallet) – Asset-manager wallet.
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) – Lagoon vault.
usdc (eth_defi.token.TokenDetails) – USDC token details.
expected_raw_amount (int) – Expected raw USDC amount.
timeout (int) – Maximum wait in seconds.
- 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
web3 (web3.main.Web3) – Web3 connection.
hot_wallet (eth_defi.hotwallet.HotWallet) – Asset-manager wallet.
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) – Lagoon vault.
usdc (eth_defi.token.TokenDetails) – USDC token details.
deposit_usdc (decimal.Decimal) – Human-readable USDC amount.
- 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
- sweep_safe_usdc_to_hot_wallet(web3, hot_wallet, vault)
Sweep any residual Lagoon Safe USDC directly to the hot wallet.
- Parameters
web3 (web3.main.Web3) – Web3 connection.
hot_wallet (eth_defi.hotwallet.HotWallet) – Deployer and 1-of-1 Safe owner.
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) – Lagoon vault whose Safe holds residual USDC.
- Return type
None