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
ZkLightercontract (USDC_ASSET_INDEX()) and callswhitelistLighter(zkLighter, usdc, assetIndex, notes).USDC-only: a single deposit asset (USDC) is whitelisted. Multiple asset indexes are not supported yet (see
LighterDeployment). Unlikesetup_hypercore_whitelistingthis issues sequential transactions rather than a single multicall — there is only ever onewhitelistLightercall (plus an optionalallowReceiver), so batching buys little here.The Safe must be an allowed receiver (for
deposit._to/withdrawPendingBalance._owner). In the Lagoon flowsetup_guardalready callsallowReceiver(safe)globally, so this helper calls it only ifisAllowedReceiver(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
GuardV0orTradingStrategyModuleV0contract exposingwhitelistLighter/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
LighterWhitelistEntryrows.- Return type