setup_lighter_whitelisting

Documentation for eth_defi.lighter.deployment.setup_lighter_whitelisting function.

setup_lighter_whitelisting(web3, module, owner, deployment, safe_address, notes='Lighter deposits', broadcast=None)

Whitelist the Lighter L1 contract on a guard / module.

Reads the USDC asset index from the ZkLighter contract (USDC_ASSET_INDEX()) and calls whitelistLighter(zkLighter, usdc, assetIndex, notes).

USDC-only: a single deposit asset (USDC) is whitelisted. Multiple asset indexes are not supported yet (see LighterDeployment). Unlike setup_hypercore_whitelisting this issues sequential transactions rather than a single multicall — there is only ever one whitelistLighter call (plus an optional allowReceiver), so batching buys little here.

The Safe must be an allowed receiver (for deposit._to / withdrawPendingBalance._owner). In the Lagoon flow setup_guard already calls allowReceiver(safe) globally, so this helper calls it only if isAllowedReceiver(safe) is currently false — avoiding a duplicate receiver event. Standalone/test callers still get the Safe whitelisted.

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

  • module (web3.contract.contract.Contract) – Deployed GuardV0 or TradingStrategyModuleV0 contract exposing whitelistLighter / allowReceiver / isAllowedReceiver.

  • owner (Union[eth_typing.evm.HexAddress, str]) – Guard owner address (used by the default broadcaster).

  • deployment (eth_defi.lighter.deployment.LighterDeployment) – Lighter deployment configuration (contract + USDC addresses).

  • safe_address (Union[eth_typing.evm.HexAddress, str]) – The Safe address — the Lighter account owner and the allowed receiver.

  • notes (str) – Annotation stored in the whitelisting event logs.

  • broadcast (Optional[Callable[[web3.contract.contract.ContractFunction], hexbytes.main.HexBytes]]) – Optional transaction broadcaster taking a bound contract function and returning a tx hash (lets the Lagoon flow reuse its own broadcaster). Defaults to func.transact({"from": owner}) + success assertion.

Returns

Lagoon-independent LighterWhitelistEntry rows.

Return type

list[eth_defi.lighter.deployment.LighterWhitelistEntry]