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
Autoscan the chain for 4626 vaults. |
- class JSONRPCVaultDiscover
Bases:
eth_defi.erc_4626.discovery_base.VaultDiscoveryBaseAutoscan 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
- build_query(executor, start_block, end_block)
Create a read_events_concurrent arguments to discover new vaults.
Includes standard ERC-4626 events and all configured protocol-specific vault flow and configuration events.
- build_mellow_factory_query(executor, start_block, end_block)
Create a JSON-RPC event-reader query for Mellow factory leads.
Mellow Core Vault discovery is factory-led. The JSON-RPC fallback mirrors the Hypersync path by scanning only configured factory addresses and storing decoded candidates as normal
PotentialVaultMatchleads for the sharedprobe_vaults()pass.- Parameters
- Returns
Query keyword arguments, or
Nonewhen the chain has no configured Mellow Core factory.- Return type
- scan_mellow_factory_leads(report, chain, leads, mellow_query)
Populate Mellow factory leads using the JSON-RPC fallback.
- Parameters
report (eth_defi.erc_4626.discovery_base.LeadScanReport) – Mutable scan report whose counters are updated.
chain (int) – EVM chain id.
leads (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.discovery_base.PotentialVaultMatch]) – Mutable shared lead map to receive Mellow factory leads.
mellow_query (Optional[dict]) – Query keyword arguments from
build_mellow_factory_query(), orNoneif the chain has no configured factory.
- Return type
None
- fetch_leads(start_block, end_block, display_progress=True)
Identify smart contracts emitting 4626 like events.
Scan all event matches using RPC
- Parameters
- Return type
- scan_vaults(start_block, end_block, display_progress=True, hardcoded_lead_sources=None)
Scan vaults.
Detect vault leads by events using
scan_potential_vaults()Then perform multicall probing for each vault smart contract to detect protocol
- Parameters
hardcoded_lead_sources (Optional[tuple[tuple[str, tuple[tuple[int, eth_typing.evm.HexAddress, int, datetime.datetime], ...]], ...]]) – Protocol-labelled deployments that cannot be discovered from supported vault events. Uses the production protocol set by default.
start_block (int) –
end_block (int) –
- Return type
- 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]) –