erc_4626.discovery_base
Documentation for eth_defi.erc_4626.discovery_base Python module.
Events we use in the vault discovery.
Shared across RPC/Hypersync discovery
Supports standard ERC-4626 Deposit/Withdraw events
Supports BrinkVault DepositFunds/WithdrawFunds events
Functions
|
Get IBrinkVault interface for BrinkVault events. |
Get list of BrinkVault events we use in vault discovery. |
|
Get list of standard ERC-4626 events we use in vault discovery. |
|
Get all events used in vault discovery, including protocol-specific ones. |
|
Build a mapping from topic0 signature to event kind. |
|
|
Check if the event kind represents a deposit. |
|
Check if the event kind represents a withdrawal. |
Classes
ERC-4626 vault detection data we extract in one duty cycle. |
|
Categorise contracts that emit ERC-4626 like events. |
|
Classify vault discovery events by their type. |
- class VaultEventKind
Bases:
enum.EnumClassify vault discovery events by their type.
- deposit = 'deposit'
Deposit-like event (ERC-4626 Deposit or BrinkVault DepositFunds)
- withdraw = 'withdraw'
Withdraw-like event (ERC-4626 Withdraw or BrinkVault WithdrawFunds)
- class PotentialVaultMatch
Bases:
objectCategorise contracts that emit ERC-4626 like events.
- __init__(chain, address, first_seen_at_block, first_seen_at, deposit_count=0, withdrawal_count=0)
- Parameters
chain (int) –
address (eth_typing.evm.HexAddress) –
first_seen_at_block (int) –
first_seen_at (datetime.datetime) –
deposit_count (int) –
withdrawal_count (int) –
- Return type
None
- get_brink_vault_contract(web3)
Get IBrinkVault interface for BrinkVault events.
- get_standard_erc_4626_vault_discovery_events(web3)
Get list of standard ERC-4626 events we use in vault discovery.
Note
This returns only standard ERC-4626 events. For all vault events including protocol-specific ones, use
get_vault_discovery_events().
- get_brink_vault_discovery_events(web3)
Get list of BrinkVault events we use in vault discovery.
BrinkVault uses custom events instead of standard ERC-4626 Deposit/Withdraw:
Deposited(address caller, address recipient, uint256 assets, uint256 shares)
Withdrawal(address caller, address recipient, uint256 received, uint256 shares)
- get_vault_discovery_events(web3)
Get all events used in vault discovery, including protocol-specific ones.
This includes: - Standard ERC-4626 Deposit/Withdraw events - BrinkVault DepositFunds/WithdrawFunds events
- get_vault_event_topic_map(web3)
Build a mapping from topic0 signature to event kind.
Used by discovery implementations to classify events.
- Returns
Dict mapping topic0 hex string to VaultEventKind
- Return type
- is_deposit_event(event_kind)
Check if the event kind represents a deposit.
- Parameters
event_kind (eth_defi.erc_4626.discovery_base.VaultEventKind) –
- Return type
- is_withdraw_event(event_kind)
Check if the event kind represents a withdrawal.
- Parameters
event_kind (eth_defi.erc_4626.discovery_base.VaultEventKind) –
- Return type
- class LeadScanReport
Bases:
objectERC-4626 vault detection data we extract in one duty cycle.
- leads: dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.discovery_base.PotentialVaultMatch]
Any vault-like smart contracts
- detections: dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.core.ERC4262VaultDetection]
Confirmed ERC-4626 vaults by smart contract probing calls
- rows: dict[eth_defi.vault.base.VaultSpec, dict]
Exported vault-data as rows
- backend: eth_defi.erc_4626.discovery_base.VaultDiscoveryBase | None
Accounting / diagnostics
- __init__(leads=<factory>, detections=<factory>, rows=<factory>, old_leads=0, new_leads=0, deposits=0, withdrawals=0, backend=None, start_block=0, end_block=0)
- Parameters
leads (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.discovery_base.PotentialVaultMatch]) –
detections (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.core.ERC4262VaultDetection]) –
rows (dict[eth_defi.vault.base.VaultSpec, dict]) –
old_leads (int) –
new_leads (int) –
deposits (int) –
withdrawals (int) –
backend (eth_defi.erc_4626.discovery_base.VaultDiscoveryBase | None) –
start_block (int) –
end_block (int) –
- Return type
None
- class VaultDiscoveryBase
Bases:
abc.ABC- 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]) –
- 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
- Return type