tokenised_fund.ondo.backfill
Documentation for eth_defi.tokenised_fund.ondo.backfill Python module.
Backfill reviewed Ondo tokenised-fund leads and NAV history.
This is a targeted migration for the reviewed Ethereum USDY and OUSG tokens. It upserts only those two leads and rewrites only their raw and cleaned price histories. Existing vault database rows and reader states belonging to other protocols are retained.
Run with source .local-test.env && PROTOCOLS=ondo poetry run python
scripts/backfill-tokenised-funds.py. Set DRY_RUN=true to print the plan
without writes. ONDO_SCAN_PRICES=false updates metadata only;
ONDO_CLEAN_PRICES=false skips the selected cleaned-history replacement.
START_BLOCK, END_BLOCK, MAX_WORKERS, FREQUENCY and the normal
vault database path environment variables use the same semantics as other
targeted vault migrations.
Functions
|
Create a scanner detection from the reviewed deployment registry. |
|
Create a hardcoded lead without re-discovering the whole chain. |
|
Run the safe, address-scoped Ondo lead and price-history migration. |
|
Read a conventional boolean environment variable. |
|
Read an optional database-path environment override. |
|
Load existing reader state without discarding unrelated vaults. |
|
Remove only reviewed Ondo states while retaining cross-chain matches. |
Upsert reviewed Ondo metadata without changing discovery state. |
|
|
Atomically persist the complete post-scan reader-state mapping. |
- parse_bool_env(name, default)
Read a conventional boolean environment variable.
- parse_path_env(name, default)
Read an optional database-path environment override.
- Parameters
name (str) –
default (pathlib.Path) –
- Return type
- read_reader_states(path)
Load existing reader state without discarding unrelated vaults.
- Parameters
path (pathlib.Path) –
- Return type
- write_reader_states(path, states)
Atomically persist the complete post-scan reader-state mapping.
- Parameters
path (pathlib.Path) –
states (dict[eth_defi.vault.base.VaultSpec, dict]) –
- Return type
None
- remove_ondo_reader_states(states)
Remove only reviewed Ondo states while retaining cross-chain matches.
- Parameters
states (dict[eth_defi.vault.base.VaultSpec, dict]) – Complete shared reader-state mapping.
- Returns
Mapping without the exact reviewed Ondo vault specs.
- Return type
- create_detection(product)
Create a scanner detection from the reviewed deployment registry.
- Parameters
product (eth_defi.tokenised_fund.ondo.constants.OndoProduct) –
- Return type
- create_lead(product)
Create a hardcoded lead without re-discovering the whole chain.
- Parameters
product (eth_defi.tokenised_fund.ondo.constants.OndoProduct) –
- Return type
- upsert_ondo_metadata_preserving_discovery_cursor(vault_db, leads, rows)
Upsert reviewed Ondo metadata without changing discovery state.
A targeted migration must preserve both an existing Ethereum discovery cursor and the absence of one. Advancing or initialising that chain-wide cursor could skip unrelated contracts that have not yet been discovered.
- Parameters
vault_db (eth_defi.vault.vaultdb.VaultDatabase) – Existing vault metadata database.
leads (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.discovery_base.PotentialVaultMatch]) – Reviewed Ondo leads keyed by token address.
rows (dict[eth_defi.vault.base.VaultSpec, eth_defi.vault.vaultdb.VaultRow]) – Fresh Ondo scan rows keyed by
VaultSpec.
- Returns
None.
- Return type
None
- main()
Run the safe, address-scoped Ondo lead and price-history migration.
- Return type
None