enzyme.offchain_metadata
Documentation for eth_defi.enzyme.offchain_metadata Python module.
Offchain profile metadata handling for Enzyme vault listings.
Enzyme Blue publishes manager-entered vault profiles in its application
backend. The app’s unauthenticated GraphQL vaultProfile query currently
exposes the vault’s tagline, descriptions and manager contact channels. This
is an undocumented application integration. Keep it isolated here and treat
both its response schema and address-only resolver contract as changeable: the
query has no deployment argument, so Enzyme currently resolves Blue VaultProxy
addresses globally.
The separate Enzyme Onyx architecture has no equivalent public profile reader. Onyx metadata is editable in its management application, but its scanner rows therefore retain an explicit unavailable marker until Enzyme publishes a supported reader.
The production scanner never makes thousands of app requests as a side effect
of scanning a chain. scripts/enzyme/migrate-offchain-metadata.py fetches
the reviewed Blue metadata and saves it in a durable, multiprocess-safe cache.
Blue adapters read this cache only; when Enzyme has no manager-entered copy,
both description fields remain absent rather than using inferred fallback text.
Module Attributes
Undocumented Enzyme application GraphQL endpoint used by the public vault detail page. |
|
Public fields returned by the app's |
|
Current durable cache schema written by the Enzyme metadata migration. |
|
Maximum public |
|
Profile hosts normalised to X/Twitter handles. |
|
Profile hosts normalised to Telegram handles. |
|
Community platforms that are valid contact URLs but not manager identities. |
|
Generic email local parts that identify an inbox rather than a manager. |
|
The exact public catalogue note used when an Onyx manager description is unavailable through a documented public source. |
|
Enzyme application network slugs for reviewed Blue and Onyx deployments. |
Functions
|
Create a pooled retrying session for bounded Enzyme metadata collection. |
|
Create an address-specific Enzyme application URL. |
Fetch public profile metadata for a bounded serial batch of Blue vaults. |
|
|
Look up cached Enzyme Blue listing metadata. |
Load durable app-profile metadata without making an HTTP request. |
|
|
Parse manager profile data from Enzyme's app GraphQL response. |
|
Atomically replace the durable Enzyme metadata cache. |
Classes
App-sourced presentation data for one Enzyme Blue vault. |
- ENZYME_APP_GRAPHQL_URL = 'https://app.enzyme.finance/api/graphql'
Undocumented Enzyme application GraphQL endpoint used by the public vault detail page. The query below is unauthenticated today, but manager updates require an authenticated owner through the app’s
updateVaultProfilemutation.
- ENZYME_APP_VAULT_PROFILE_FIELDS = ('tagline', 'description', 'managerDescription', 'contactInfo', 'email', 'telegram', 'websiteUrl', 'twitter')
Public fields returned by the app’s
vaultProfileresolver.
- ENZYME_METADATA_CACHE_VERSION = 2
Current durable cache schema written by the Enzyme metadata migration.
Version two adds manager-contact fields sourced from the app GraphQL reader.
- DEFAULT_ENZYME_METADATA_CACHE_PATH = PosixPath('/home/runner/.tradingstrategy/cache/enzyme/vault-metadata.json')
Versioned durable cache populated by the Enzyme metadata migration.
- ENZYME_APP_MAX_PROFILE_ALIASES = 5
Maximum public
vaultProfilealiases accepted by Enzyme’s app backend.
- ENZYME_TWITTER_PROFILE_DOMAINS = frozenset({'twitter.com', 'x.com'})
Profile hosts normalised to X/Twitter handles.
- ENZYME_TELEGRAM_PROFILE_DOMAINS = frozenset({'t.me', 'telegram.dog', 'telegram.me'})
Profile hosts normalised to Telegram handles.
- ENZYME_NON_MANAGER_WEBSITE_DOMAINS = frozenset({'discord.com', 'discord.gg', 'discordapp.com', 'facebook.com', 'forms.gle', 'github.com', 'instagram.com', 'linkedin.com', 'medium.com', 'members.arcrypto.io', 't.me', 'telegram.me', 'twitter.com', 'x.com', 'youtube.com'})
Community platforms that are valid contact URLs but not manager identities.
- ENZYME_GENERIC_MANAGER_EMAIL_LOCAL_PARTS = frozenset({'admin', 'contact', 'fund', 'hello', 'info', 'investors', 'manager', 'support', 'team'})
Generic email local parts that identify an inbox rather than a manager. Keep these out of the public manager field so a website domain can be used as the fallback identifier when it is available.
- ONYX_PUBLIC_DESCRIPTION_UNAVAILABLE = 'Description is not publicly available'
The exact public catalogue note used when an Onyx manager description is unavailable through a documented public source.
- ENZYME_NETWORK_SLUGS: dict[int, str] = {1: 'ethereum', 137: 'polygon', 8453: 'base', 42161: 'arbitrum'}
Enzyme application network slugs for reviewed Blue and Onyx deployments. Keep these integration-owned values separate from generic display names, which may change independently and are not URL identifiers.
- class EnzymeVaultMetadata
Bases:
objectApp-sourced presentation data for one Enzyme Blue vault.
- manager_description: Optional[str]
Manager-provided biography, separate from the vault product copy.
- __init__(description=None, short_description=None, manager_description=None, contact_info=None, contact_email=None, telegram=None, twitter=None, website_url=None, manager_name=None)
- Parameters
- Return type
None
- parse_enzyme_app_vault_metadata(payload)
Parse manager profile data from Enzyme’s app GraphQL response.
taglineis the compact catalogue description anddescriptionis the vault narrative. The app keeps the manager bio and contact channels in separate fields, which must never be merged into the strategy text.- Parameters
payload (object) – Decoded JSON returned by the app’s
vaultProfilequery.- Returns
Parsed optional listing metadata.
- Raises
ValueError – If the response is not a JSON object.
- Return type
- fetch_enzyme_app_vault_metadata_batch(session, *, shares_addresses, timeout)
Fetch public profile metadata for a bounded serial batch of Blue vaults.
- Parameters
session (requests.sessions.Session) – Shared retrying HTTP session.
shares_addresses (list[eth_typing.evm.HexAddress | str]) – Canonical Blue VaultProxy addresses to fetch.
timeout (float) – HTTP request timeout in seconds.
- Returns
Metadata keyed by each supplied lower-case VaultProxy address.
- Raises
ValueError – If the app response has a GraphQL error or invalid schema.
requests.RequestException – If the request fails.
- Return type
dict[eth_typing.evm.HexAddress, eth_defi.enzyme.offchain_metadata.EnzymeVaultMetadata]
- create_enzyme_app_session(retries=5, backoff_factor=0.5)
Create a pooled retrying session for bounded Enzyme metadata collection.
The migration submits serial app-profile batches. Retry only transient network and throttling statuses; other HTTP 4xx and schema errors must surface to the operator instead of being disguised as missing metadata.
- load_enzyme_vault_metadata_cache(cache_path=PosixPath('/home/runner/.tradingstrategy/cache/enzyme/vault-metadata.json'), *, minimum_version=1)
Load durable app-profile metadata without making an HTTP request.
A malformed cache is ignored with a warning. Blue adapters then expose no offchain copy until a successful metadata migration replaces the cache.
- Parameters
cache_path (pathlib.Path) – Versioned JSON cache written by the migration.
minimum_version (int) – Oldest compatible cache schema to accept. The scanner accepts version one to preserve existing descriptions during an upgrade; the migration requires the current version to collect contacts.
- Returns
Address-indexed Enzyme Blue app-profile metadata.
- Return type
dict[tuple[int, eth_typing.evm.HexAddress], eth_defi.enzyme.offchain_metadata.EnzymeVaultMetadata]
- write_enzyme_vault_metadata_cache(metadata, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/enzyme/vault-metadata.json'))
Atomically replace the durable Enzyme metadata cache.
Cache entries with no text are retained. They document a successful app read whose vault has not supplied descriptions, so the Blue adapter can expose no text rather than infer a strategy.
- Parameters
metadata (collections.abc.Mapping[tuple[int, eth_typing.evm.HexAddress], eth_defi.enzyme.offchain_metadata.EnzymeVaultMetadata]) – Complete address-indexed cache contents.
cache_path (pathlib.Path) – JSON cache destination.
- Returns
None after the cache is safely replaced.
- Return type
None
- create_enzyme_vault_link(chain_id, shares_address)
Create an address-specific Enzyme application URL.
Blue VaultProxy and Onyx Shares vehicles use the same application route. The canonical address selects the vault and the lower-case network query selects its deployment, so callers never need to fall back to the generic discovery catalogue.
- Parameters
chain_id (int) – EVM chain id of the Enzyme deployment.
shares_address (Union[eth_typing.evm.HexAddress, str]) – Blue VaultProxy or Onyx Shares address.
- Returns
Direct Enzyme vault-detail URL.
- Return type
- load_enzyme_blue_vault_metadata(chain_id, vault_proxy_address)
Look up cached Enzyme Blue listing metadata.
This adapter-facing function deliberately never calls the app backend. The metadata migration warms the durable cache in a bounded batch, keeping ordinary scanner cycles deterministic and independent of app availability. The cache contains successful empty responses, allowing callers to distinguish absent manager copy from a transient app failure.
- Parameters
chain_id (int) – EVM chain id of the Blue vault.
vault_proxy_address (Union[eth_typing.evm.HexAddress, str]) – Canonical Blue VaultProxy address.
- Returns
Cached app-profile metadata, or
Nonewhen no successful cache entry exists.- Return type
Optional[eth_defi.enzyme.offchain_metadata.EnzymeVaultMetadata]