tokenised_fund.asseto.registry

Documentation for eth_defi.tokenised_fund.asseto.registry Python module.

Build runtime Asseto adapter products from the persisted public registry.

The recurring scanner persists Asseto vault rows across process restarts, while the adapter needs an in-memory product record. This module rebuilds that runtime registry before a daily scan and registers newly published supported products from the same fresh API snapshot.

Functions

create_asseto_detection(product)

Create the minimal synthetic detection needed for metadata upserts.

create_asseto_lead(product)

Create a synthetic discovery lead for one Asseto product.

create_asseto_runtime_product(product, ...)

Create one adapter product from API identity and onchain discovery.

fetch_asseto_deployment_block(web3, address, ...)

Find the first token-code block for a newly registered product.

fetch_asseto_registry_preparation(*, ...[, ...])

Refresh Asseto metadata, register new products and rebuild adapters.

load_usd_exchange_rates(database_path, ...)

Load historical quote-currency-per-USD rates for Asseto products.

resolve_asseto_denomination_symbol(product)

Resolve the accounting denomination from Asseto's public product data.

Classes

AssetoRegistryRefreshResult

Summary of runtime registry preparation for one scanner invocation.

class AssetoRegistryRefreshResult

Bases: object

Summary of runtime registry preparation for one scanner invocation.

Variables
  • status – Registry source status, either fresh or stale.

  • runtime_product_count – Number of products installed for adapter construction.

  • registered_product_count – Number of newly persisted vault metadata records.

  • diagnostics – Non-fatal skipped-product and stale-source diagnostics.

  • available_specs – Persisted products with a runtime adapter installed for this cycle.

status: str

Registry source status, either fresh or stale.

runtime_product_count: int

Number of products installed for adapter construction.

registered_product_count: int

Number of newly persisted vault metadata records.

diagnostics: tuple[str, ...]

Non-fatal skipped-product and stale-source diagnostics.

available_specs: frozenset[eth_defi.vault.base.VaultSpec]

Persisted products with a runtime adapter installed for this cycle.

__init__(status, runtime_product_count, registered_product_count, diagnostics, available_specs=frozenset({}))
Parameters
Return type

None

resolve_asseto_denomination_symbol(product)

Resolve the accounting denomination from Asseto’s public product data.

Asseto omits the symbol on its stoken products even though their NAV series is USD-denominated. All other products need an explicit symbol so the scanner can safely select a conversion history.

Parameters

product (eth_defi.tokenised_fund.asseto.offchain_api.AssetoOffchainProduct) – Normalised product read from Asseto’s public registry.

Returns

Upper-case accounting currency, or None when it is not usable.

Return type

Optional[str]

load_usd_exchange_rates(database_path, denomination_symbols)

Load historical quote-currency-per-USD rates for Asseto products.

Asseto NAV values in non-USD currencies are divided by these rates before entering the shared USD history. The targeted backfill and daily scanner intentionally share this exact conversion rule.

Parameters
Returns

Exchange-rate history keyed by upper-case currency symbol.

Raises

RuntimeError – If required currency history is unavailable.

Return type

dict[str, tuple[tuple[int, decimal.Decimal], …]]

create_asseto_runtime_product(product, first_seen_at_block, first_seen_at, usd_exchange_rates=())

Create one adapter product from API identity and onchain discovery.

The scheduled and manual paths use this constructor so product identity, offchain NAV lookup and non-USD conversion state cannot diverge.

Parameters
Returns

Adapter-ready Asseto product record.

Return type

eth_defi.tokenised_fund.asseto.constants.AssetoProduct

fetch_asseto_deployment_block(web3, address, end_block)

Find the first token-code block for a newly registered product.

The public registry has no deployment block, so a binary search over an archive-capable provider supplies the start boundary for history scans.

Parameters
  • web3 (web3.main.Web3) – Archive-capable product-chain connection.

  • address (eth_typing.evm.HexAddress) – Asseto token contract address.

  • end_block (int) – Latest block at which the token must have deployed code.

Returns

Earliest block containing token runtime code.

Raises

ValueError – If the registry address has no code at end_block.

Return type

int

create_asseto_detection(product)

Create the minimal synthetic detection needed for metadata upserts.

Asseto products do not emit ERC-4626 discovery events, so their metadata read uses this equivalent persisted detection record.

Parameters

product (eth_defi.tokenised_fund.asseto.constants.AssetoProduct) – Adapter-ready Asseto product record.

Returns

Detection compatible with the shared vault metadata scanner.

Return type

eth_defi.erc_4626.core.ERC4262VaultDetection

create_asseto_lead(product)

Create a synthetic discovery lead for one Asseto product.

Parameters

product (eth_defi.tokenised_fund.asseto.constants.AssetoProduct) – Fully resolved Asseto adapter product.

Returns

Lead compatible with the persistent vault metadata database.

Return type

eth_defi.erc_4626.discovery_base.PotentialVaultMatch

fetch_asseto_registry_preparation(*, vault_db_path, enabled_chain_ids, cache_path=PosixPath('/home/runner/.tradingstrategy/cache/asseto/registry-cache.json'), token_cache=None)

Refresh Asseto metadata, register new products and rebuild adapters.

Fresh API data may register products and update their metadata. Stale data is deliberately limited to rebuilding runtime entries for already-persisted Asseto rows, so an outage cannot write old API values into the vault database.

Parameters
Returns

Preparation outcome and non-fatal product diagnostics.

Return type

eth_defi.tokenised_fund.asseto.registry.AssetoRegistryRefreshResult