fetch_lighter_claimed_usdc

Documentation for eth_defi.lighter.lagoon.fetch_lighter_claimed_usdc function.

fetch_lighter_claimed_usdc(web3, *, owner, usdc, from_block, to_block=None, zk_lighter='0x3B4D794a66304F130a4Db8F2551B0070dfCf5ca7', hypersync_api_key=None, use_hypersync=True, hypersync_timeout=10.0)

Read how much USDC Lighter has paid to an owner since a block.

Counts every withdrawPendingBalance paying owner, sent by us or by Lighter’s relayer. The log is the only evidence that names the payout: the owner’s USDC balance also moves with deposits and Lagoon settlement. The range is read in chunks, because providers limit eth_getLogs, and stops at the chain head, which they refuse to pass.

With an explicit API key, HyperSync reads the indexed prefix and RPC reads the unindexed tail. Failed or incomplete indexer reads fall back to the whole RPC range without counting partial results twice. Anvil always uses RPC.

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

  • owner (Union[eth_typing.evm.HexAddress, str]) – L1 owner, normally the Lagoon Safe.

  • usdc (eth_defi.token.TokenDetails) – Native Ethereum USDC token details.

  • from_block (int) – First block to include.

  • to_block (Optional[int]) – Last block to include, capped at the current head. Defaults to the head.

  • zk_lighter (Union[eth_typing.evm.HexAddress, str]) – ZkLighter L1 contract address.

  • hypersync_api_key (Optional[str]) – Explicit indexer credential. No key keeps the RPC-only behaviour.

  • use_hypersync (bool) – Allow indexed reads when a key is supplied.

  • hypersync_timeout (float) – Maximum seconds for the complete indexer attempt before RPC fallback.

Returns

USDC paid to owner in the range.

Return type

decimal.Decimal