HypersyncVaultDiscover
Documentation for eth_defi.erc_4626.hypersync_discovery.HypersyncVaultDiscover Python class.
- class HypersyncVaultDiscover
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
client – HyperSync client used to scan lead event data
max_workers – How many worker processes use in multicall probing
- Parma recv_timeout
Hypersync core reading loop timeout.
Methods summary
__init__(web3, web3factory, client[, ...])Create vault discover.
build_query(start_block, end_block)Create HyperSync query that extracts all potential lead events from the chain.
fetch_leads(start_block, end_block[, ...])Synchronous wrapper around async lead scanning.
Contracts must have at least one event of both these signatures
scan_potential_vaults(start_block, end_block)Identify smart contracts emitting 4626 like events.
scan_vaults(start_block, end_block[, ...])Scan vaults.
seed_existing_leads(leads)Seed existing leads to continue the scan where we were left last time.
- __init__(web3, web3factory, client, max_workers=8, recv_timeout=90.0)
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
client (hypersync.HypersyncClient) – HyperSync client used to scan lead event data
max_workers (int) – How many worker processes use in multicall probing
recv_timeout (float) –
- Parma recv_timeout
Hypersync core reading loop timeout.
- get_topic_signatures()
Contracts must have at least one event of both these signatures
Find contracts emitting these events
Later prod these contracts to see which of them are proper vaults
We are likely having a real ERC-4262 contract if both events match,
Depositevent might have few similar contractsAlso includes BrinkVault DepositFunds/WithdrawFunds events
- Return type
- build_query(start_block, end_block)
Create HyperSync query that extracts all potential lead events from the chain.
See example here: https://github.com/enviodev/hypersync-client-python/blob/main/examples/all-erc20-transfers.py
- fetch_leads(start_block, end_block, display_progress=True, attempts=3, retry_sleep=30)
Synchronous wrapper around async lead scanning.
- async scan_potential_vaults(start_block, end_block, display_progress=True)
Identify smart contracts emitting 4626 like events.
Scan all event matches using HyperSync
See stream() example here: https://github.com/enviodev/hypersync-client-python/blob/main/examples/all-erc20-transfers.py
- 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
- 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]) –