erc_4626.vault_protocol.symbiotic.offchain_metadata

Documentation for eth_defi.erc_4626.vault_protocol.symbiotic.offchain_metadata Python module.

Symbiotic Core V2 vault metadata from the official metadata API.

Symbiotic curators submit vault and curator descriptions to the reviewed metadata-mainnet repository. The Symbiotic application uses the merged repository data to display vault metadata. This module retrieves an individual vault through GitHub’s public contents API and stores the normalised result in a two-day local cache.

See Submit Metadata.

Module Attributes

DEFAULT_API_BASE_URL

Official GitHub contents API for the metadata repository used by Symbiotic's app.

DEFAULT_APP_API_BASE_URL

Symbiotic application's public mainnet data API.

DEFAULT_APP_CHAIN_NAME

Chain represented by the public application API.

DEFAULT_CACHE_DURATION

How long to reuse an official metadata response before refresh.

HTTP_NOT_FOUND_STATUS

HTTP status returned by the GitHub contents API for an unregistered entity.

Functions

fetch_symbiotic_offchain_vaults(*[, ...])

Yield vault rows from Symbiotic's public application data API.

fetch_symbiotic_vault_metadata(vault_address, *)

Fetch official offchain metadata for a Symbiotic Ethereum vault.

Classes

SymbioticMetadataLink

A user-facing link published in Symbiotic metadata.

SymbioticOffchainVault

A vault record from Symbiotic's public application data API.

SymbioticVaultMetadata

Normalised official metadata for an individual Symbiotic vault.

DEFAULT_CACHE_PATH = PosixPath('/home/runner/.tradingstrategy/cache/symbiotic')

Cache directory for official Symbiotic metadata.

DEFAULT_API_BASE_URL = 'https://api.github.com/repos/symbioticfi/metadata-mainnet/contents'

Official GitHub contents API for the metadata repository used by Symbiotic’s app.

DEFAULT_APP_API_BASE_URL = 'https://app.symbiotic.fi/api/v3'

Symbiotic application’s public mainnet data API.

DEFAULT_APP_CHAIN_NAME = 'Ethereum'

Chain represented by the public application API.

DEFAULT_CACHE_DURATION = datetime.timedelta(days=2)

How long to reuse an official metadata response before refresh.

HTTP_NOT_FOUND_STATUS = 404

HTTP status returned by the GitHub contents API for an unregistered entity.

Bases: TypedDict

A user-facing link published in Symbiotic metadata.

type: str

Link category such as website or externalLink.

name: str

User-facing label.

url: str

Destination URL.

__init__(*args, **kwargs)
__new__(**kwargs)
clear()

Remove all items from the dict.

copy()

Return a shallow copy of the dict.

fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

class SymbioticVaultMetadata

Bases: TypedDict

Normalised official metadata for an individual Symbiotic vault.

name: str

Vault display name.

description: Optional[str]

Curator-provided strategy description.

tags: list[str]

Tags selected by the curator.

Vault-specific user-facing links.

curator_id: Optional[str]

Curator identifier from the official metadata repository.

curator_name: Optional[str]

Curator display name, when its metadata record exists.

curator_description: Optional[str]

Curator description, when its metadata record exists.

Curator user-facing links, when its metadata record exists.

__init__(*args, **kwargs)
__new__(**kwargs)
clear()

Remove all items from the dict.

copy()

Return a shallow copy of the dict.

fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

class SymbioticOffchainVault

Bases: TypedDict

A vault record from Symbiotic’s public application data API.

address: eth_typing.evm.HexAddress

ERC-4626 vault address.

name: Optional[str]

User-facing vault name, if the curator has submitted it.

chain_name: str

Human-readable chain name for the application API deployment.

curator_name: Optional[str]

Curator display name, or its identifier if no display name is available.

tvl: Optional[decimal.Decimal]

Current USD total value locked as calculated by Symbiotic’s API.

vault_type: str

Symbiotic vault implementation category, such as v2.

__init__(*args, **kwargs)
__new__(**kwargs)
clear()

Remove all items from the dict.

copy()

Return a shallow copy of the dict.

fromkeys(value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(key, default=None, /)

Return the value for key if key is in the dictionary, else default.

items()

Return a set-like object providing a view on the dict’s items.

keys()

Return a set-like object providing a view on the dict’s keys.

pop(k[, d]) v, remove specified key and return the corresponding value.

If the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]

values()

Return an object providing a view on the dict’s values.

fetch_symbiotic_vault_metadata(vault_address, *, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/symbiotic'), api_base_url='https://api.github.com/repos/symbioticfi/metadata-mainnet/contents', now_=None, max_cache_duration=datetime.timedelta(days=2))

Fetch official offchain metadata for a Symbiotic Ethereum vault.

The official repository stores directory names as EIP-55 checksum addresses. A vault response may refer to an optional curator record, which is fetched at the same time so callers can display a curator name.

Parameters
  • vault_address (str) – Symbiotic Ethereum vault address.

  • cache_path (pathlib.Path) – Directory for this module’s per-vault JSON cache files.

  • api_base_url (str) – Official contents API base URL, overridable for tests.

  • now – Naive UTC current time override for deterministic cache tests.

  • max_cache_duration (datetime.timedelta) – Cache time-to-live.

  • now_ (Optional[datetime.datetime]) –

Returns

Vault metadata, or None when no official record exists or the API cannot be reached.

Return type

Optional[eth_defi.erc_4626.vault_protocol.symbiotic.offchain_metadata.SymbioticVaultMetadata]

fetch_symbiotic_offchain_vaults(*, api_base_url='https://app.symbiotic.fi/api/v3', chain_name='Ethereum', vault_type='v2')

Yield vault rows from Symbiotic’s public application data API.

The application API currently serves Ethereum mainnet. It publishes its USD TVL calculation and joins curator display names in a separate curators response, so this function retrieves both small payloads and yields a normalised reporting record for each vault.

Parameters
  • api_base_url (str) – Symbiotic application API base URL, overridable for testing.

  • chain_name (str) – Human-readable name for the chain served by api_base_url.

  • vault_type (Optional[str]) – Optional implementation category filter. The default "v2" limits results to vaults that this integration can index; use None to yield every API vault type.

Returns

Iterator yielding normalised offchain vault records.

Return type

collections.abc.Iterator[eth_defi.erc_4626.vault_protocol.symbiotic.offchain_metadata.SymbioticOffchainVault]