erc_4626.vault_protocol.flying_tulip.reward_price

Documentation for eth_defi.erc_4626.vault_protocol.flying_tulip.reward_price Python module.

Onchain FT/ftUSD reward-price collection from the Ethereum Curve pool.

The deployed Curve pool quotes its price_oracle() as FT per ftUSD. The historical performance reader needs ftUSD per FT, so this module records both the raw inverse oracle and its integer-normalised reciprocal. It never falls back to a dashboard, an offchain API or a current spot quote.

The reviewed Curve pool’s verified contract interface is available at https://etherscan.io/address/0x68102ff5406475881462880a8da3c9bc9181ad6c#code. The raw Curve state reads used here are limited to the one reviewed canonical market and are covered by the fixed-block fork regression test. They value FT rewards; they are not used to discover or classify Flying Tulip vaults.

Module Attributes

CURVE_PRICE_ORACLE_SCALE

Curve's integer price-oracle scale.

MAX_UINT256

A valid inverse oracle must be positive and fit the EVM uint256 domain.

FLYING_TULIP_TIMESTAMP_WINDOW_BLOCKS

Keep every targeted timestamp-cache request observably below one minute.

Functions

fetch_and_store_flying_tulip_reward_prices(*, ...)

Map stored epochs to Ethereum and persist their canonical Curve prices.

fetch_curve_pool_configuration(web3[, ...])

Validate deployed Curve token order and inverse-oracle orientation for tests.

fetch_curve_reward_price(web3, ...)

Read and normalise the FT/ftUSD Curve oracle at one Ethereum block.

Classes

FlyingTulipRewardPricePrefillResult

Summarise an Ethereum Curve oracle prefill for one source chain.

CURVE_PRICE_ORACLE_SCALE = 1000000000000000000

Curve’s integer price-oracle scale.

MAX_UINT256 = 115792089237316195423570985008687907853269984665640564039457584007913129639935

A valid inverse oracle must be positive and fit the EVM uint256 domain.

FLYING_TULIP_TIMESTAMP_WINDOW_BLOCKS = 2000

Keep every targeted timestamp-cache request observably below one minute.

class FlyingTulipRewardPricePrefillResult

Bases: object

Summarise an Ethereum Curve oracle prefill for one source chain.

chain_id: int

sftUSD source chain whose settlements were priced.

epochs_considered: int

Number of post-Curve settlement timestamps considered.

price_blocks_resolved: int

Number of distinct Ethereum blocks selected for pricing.

prices_inserted: int

Number of previously absent price rows inserted.

prices_stale: int

Number of selected observations rejected as too old.

__init__(chain_id, epochs_considered, price_blocks_resolved, prices_inserted, prices_stale)
Parameters
  • chain_id (int) –

  • epochs_considered (int) –

  • price_blocks_resolved (int) –

  • prices_inserted (int) –

  • prices_stale (int) –

Return type

None

fetch_curve_pool_configuration(web3, block_identifier='latest')

Validate deployed Curve token order and inverse-oracle orientation for tests.

A one-FT get_dy(0, 1, 10**18) quote must agree broadly with the reciprocal of price_oracle() at a fixed regression block. This checks the token order and prevents accidentally treating the pool’s FT-per-ftUSD oracle as ftUSD per FT. It is deliberately not a production prefill gate: a live Curve spot quote and a lagging EMA can temporarily diverge during normal market conditions.

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

  • block_identifier (Union[int, str]) – Fixed validation block.

Returns

None.

Return type

None

fetch_curve_reward_price(web3, ethereum_block_number, block_timestamp)

Read and normalise the FT/ftUSD Curve oracle at one Ethereum block.

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

  • ethereum_block_number (int) – Exact historical state block.

  • block_timestamp (int) – Timestamp from the cache-aware Hypersync block map.

Returns

Raw and normalised Curve oracle provenance.

Return type

eth_defi.erc_4626.vault_protocol.flying_tulip.historical_context.RewardPriceObservation

fetch_and_store_flying_tulip_reward_prices(*, ethereum_web3, ethereum_hypersync_client, chain_id, ethereum_start_block, ethereum_end_block, context_path, timestamp_cache_path=PosixPath('/home/runner/.tradingstrategy/block-timestamp'))

Map stored epochs to Ethereum and persist their canonical Curve prices.

Only epochs at or after the canonical Curve market’s deployment timestamp are considered. The caller supplies an Ethereum range containing those epochs. Compact gaps in the shared timestamp cache are filled through Hypersync, then each foreign-chain settlement is mapped to the greatest Ethereum block whose timestamp is not later than that settlement.

Parameters
  • ethereum_web3 (web3.main.Web3) – Archive-capable Ethereum provider for historical Curve state calls.

  • ethereum_hypersync_client (eth_defi.hypersync.session.ThrottledHypersyncClient) – Throttle-aware Ethereum Hypersync client for timestamp cache fills.

  • chain_id (int) – Source sftUSD deployment chain.

  • ethereum_start_block (int) – Inclusive, timestamp-cache Ethereum range boundary.

  • ethereum_end_block (int) – Exclusive, snapped Ethereum safe head.

  • context_path (pathlib.Path) – Shared contextual cache path.

  • timestamp_cache_path (pathlib.Path) – Shared block-timestamp cache directory.

Returns

Price prefill diagnostics.

Return type

eth_defi.erc_4626.vault_protocol.flying_tulip.reward_price.FlyingTulipRewardPricePrefillResult