erc_4626.vault_protocol.arcadia.offchain_metadata

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

Arcadia-maintained lending pool metadata.

The public pools API lists lending pools and their ERC-4626 tranches. The scanner indexes the tranche address, not the parent lending pool address. Addresses can be shared across chains. Only descriptive fields are retained; live rates are not website copy.

Module Attributes

POOLS_API_URL

Official API endpoint, queried with chain_id.

DEFAULT_CACHE_DURATION

Descriptive metadata refresh interval.

UNAVAILABLE_RETRY_DELAY

Backoff after an unavailable or malformed response.

Functions

fetch_arcadia_vault_metadata(chain_id, ...)

Look up an Arcadia tranche without requesting each vault separately.

fetch_arcadia_vaults(chain_id, *[, ...])

Fetch the complete Arcadia tranche index once per chain and day.

normalise_text(value)

Trim optional API text without coercing malformed objects to strings.

parse_arcadia_pools(chain_id, payload)

Index all tranches in one complete pool response.

Classes

ArcadiaVaultMetadata

Describe one ERC-4626 tranche using its parent pool record.

POOLS_API_URL = 'https://api.arcadia.finance/v1/api/pools'

Official API endpoint, queried with chain_id.

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

Persistent cache of complete per-chain API responses.

DEFAULT_CACHE_DURATION = datetime.timedelta(days=1)

Descriptive metadata refresh interval.

UNAVAILABLE_RETRY_DELAY = datetime.timedelta(seconds=300)

Backoff after an unavailable or malformed response.

class ArcadiaVaultMetadata

Bases: object

Describe one ERC-4626 tranche using its parent pool record.

Fields are normalised from the official API, with optional text left unknown when absent. Financial metrics are deliberately excluded.

chain_id: int

Chain on which the tranche is deployed.

tranche_address: eth_typing.evm.HexAddress

Lowercase tranche address, matching the scanner’s vault identity.

pool_address: eth_typing.evm.HexAddress

Lowercase parent lending pool address.

pool_name: Optional[str]

Pool display name, normally the underlying token symbol.

tranche_name: Optional[str]

Explicit tranche display name, such as Senior USDG.

description: Optional[str]

Provider copy, which may be only a label like Arcadia USDG Pool.

__init__(chain_id, tranche_address, pool_address, pool_name, tranche_name, description)
Parameters
Return type

None

normalise_text(value)

Trim optional API text without coercing malformed objects to strings.

Missing and whitespace-only fields remain unknown.

Parameters

value (object) – Raw optional text field.

Returns

Trimmed text, or None.

Return type

Optional[str]

parse_arcadia_pools(chain_id, payload)

Index all tranches in one complete pool response.

An empty array is a valid chain without pools. Invalid identity fields or malformed record shapes reject the response rather than caching bad data.

Parameters
  • chain_id (int) – Chain requested from the API.

  • payload (object) – Decoded API response array.

Returns

Lowercase tranche-address index for this chain.

Raises

ValueError – If the response does not contain valid pool records.

Return type

dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.vault_protocol.arcadia.offchain_metadata.ArcadiaVaultMetadata]

fetch_arcadia_vaults(chain_id, *, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/arcadia'), api_url='https://api.arcadia.finance/v1/api/pools', now_=None)

Fetch the complete Arcadia tranche index once per chain and day.

Requests use a 30-second timeout. A failed refresh preserves a valid older index and delays further requests for five minutes. Without an index, adapters can still generate copy from their onchain metadata.

Parameters
  • chain_id (int) – EVM chain ID, passed as the API’s chain_id parameter.

  • cache_path (pathlib.Path) – Directory for atomic JSON response caches.

  • api_url (str) – Official pools endpoint, overridable for testing.

  • now – Optional naive UTC clock for deterministic expiry tests.

  • now_ (Optional[datetime.datetime]) –

Returns

Tranche index, or None when no valid response is available.

Return type

Optional[dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.vault_protocol.arcadia.offchain_metadata.ArcadiaVaultMetadata]]

fetch_arcadia_vault_metadata(chain_id, vault_address)

Look up an Arcadia tranche without requesting each vault separately.

A miss in a successful index remains cached for the normal daily refresh.

Parameters
  • chain_id (int) – Chain on which the tranche is deployed.

  • vault_address (eth_typing.evm.HexAddress) – ERC-4626 tranche address, in any case.

Returns

Provider metadata when listed, otherwise None.

Return type

Optional[eth_defi.erc_4626.vault_protocol.arcadia.offchain_metadata.ArcadiaVaultMetadata]