erc_4626.vault_protocol.yearn.export_cleanup
Documentation for eth_defi.erc_4626.vault_protocol.yearn.export_cleanup Python module.
Best-effort Yearn attribution cleanup for public vault exports.
Yearn-compatible ERC-4626 interfaces are reusable by third parties. The official Kong registry is therefore used as the positive allow-list for public Yearn attribution. Technical Yearn features remain on the row so the scanner’s adapter behaviour is unchanged; the rule does not make an ownership or safety claim about the contract.
Module Attributes
Fail open if the positive Yearn catalogue is implausibly small. |
|
HTTP timeout shared with the scanner's Yearn registry check. |
|
Chain-neutral block explorer link used for generic ERC-4626 attribution. |
Functions
|
Best-effort cleanup of false Yearn protocol attribution. |
Fetch and validate the official Yearn catalogue for one export build. |
|
|
Parse positive Yearn chain/address keys from the official registry. |
- MINIMUM_YEARN_EXPORT_CATALOGUE_ENTRIES = 100
Fail open if the positive Yearn catalogue is implausibly small. Checking the positive set itself protects against a large but malformed registry response.
- YEARN_EXPORT_REGISTRY_REQUEST_TIMEOUT = 30
HTTP timeout shared with the scanner’s Yearn registry check.
- GENERIC_VAULT_LINK_TEMPLATE = 'https://routescan.io/address/{address}'
Chain-neutral block explorer link used for generic ERC-4626 attribution.
- parse_yearn_export_catalogue(payload)
Parse positive Yearn chain/address keys from the official registry.
The complete response is reduced to compact lookup keys. A small positive set is rejected so a partial upstream response cannot mass-reclassify otherwise valid Yearn rows.
- Parameters
payload (object) – JSON-decoded response from
YEARN_VAULT_REGISTRY_URL.- Returns
Lowercase
(chain_id, address)keys for official Yearn entries.- Raises
ValueError – If the response is not a plausible complete registry response.
- Return type
- fetch_yearn_export_catalogue()
Fetch and validate the official Yearn catalogue for one export build.
Reads Yearn’s public Kong vault registry. The surrounding hook handles availability and validation failures as a fail-open condition.
- Returns
Positive Yearn chain/address keys.
- Raises
RequestException, ValueError – If the source is unavailable or fails validation. The caller’s hook boundary catches these failures and leaves the export unchanged.
- Return type
- clean_yearn_vault_metadata(vault_db)
Best-effort cleanup of false Yearn protocol attribution.
The function performs one catalogue request and one Pandas membership operation for the current export. It considers rows currently labelled Yearn and already-generic rows carrying the exclusion marker, so stale sticky curator or homepage fields are corrected too. Any request or validation error is logged and converted to an empty change set so callers can continue publishing the rest of the vault data.
- Parameters
vault_db (eth_defi.vault.vaultdb.VaultDatabase) – In-memory database loaded for the current JSON export.
- Returns
Vault IDs whose export attribution was cleaned.
- Return type