erc_4626.rpc_discovery

Documentation for eth_defi.erc_4626.rpc_discovery Python module.

Find ERC-4626 vaults onchain using JSON-RPC.

  • Slow fallback method using only standard JSON-RPC calls when Hypersync server is not available

Classes

JSONRPCVaultDiscover

Autoscan the chain for 4626 vaults.

class JSONRPCVaultDiscover

Bases: eth_defi.erc_4626.discovery_base.VaultDiscoveryBase

Autoscan the chain for 4626 vaults.

  • First build map of potential contracts using scan_potential_vaults()

  • Then probe given contracts and determine their ERC-4626 vault properties

See scan-erc_4626_vaults for usage.

Create vault discover.

Parameters
  • web3 – Current process web3 connection

  • web3factory – Used to initialise connection in created worker threads/processes

  • max_workers – How many worker processes use in multicall probing

__init__(web3, web3factory, max_workers=8, max_getlogs_range=None)

Create vault discover.

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

  • web3factory (eth_defi.event_reader.web3factory.Web3Factory) – Used to initialise connection in created worker threads/processes

  • max_workers (int) – How many worker processes use in multicall probing

  • max_getlogs_range (int | None) –

build_query(executor, start_block, end_block)

Create a read_events_concurrent arguments to discover new vaults.

Includes both standard ERC-4626 events and BrinkVault events.

See eth_defi.event_reader.reader.read_events_concurrent()

Parameters
  • executor (concurrent.futures.thread.ThreadPoolExecutor) –

  • start_block (int) –

  • end_block (int) –

Return type

dict

fetch_leads(start_block, end_block, display_progress=True)

Identify smart contracts emitting 4626 like events.

  • Scan all event matches using RPC

Parameters
  • start_block (int) –

  • end_block (int) –

Return type

eth_defi.erc_4626.discovery_base.LeadScanReport

scan_vaults(start_block, end_block, display_progress=True)

Scan vaults.

  • Detect vault leads by events using scan_potential_vaults()

  • Then perform multicall probing for each vault smart contract to detect protocol

Parameters
  • start_block (int) –

  • end_block (int) –

Return type

eth_defi.erc_4626.discovery_base.LeadScanReport

seed_existing_leads(leads)

Seed existing leads to continue the scan where we were left last time.

Parameters

leads (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.discovery_base.PotentialVaultMatch]) –