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's integer price-oracle scale. |
|
A valid inverse oracle must be positive and fit the EVM uint256 domain. |
|
Keep every targeted timestamp-cache request observably below one minute. |
Functions
Map stored epochs to Ethereum and persist their canonical Curve prices. |
|
|
Validate deployed Curve token order and inverse-oracle orientation for tests. |
|
Read and normalise the FT/ftUSD Curve oracle at one Ethereum block. |
Classes
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:
objectSummarise an Ethereum Curve oracle prefill for one source chain.
- 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 ofprice_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.
- fetch_curve_reward_price(web3, ethereum_block_number, block_timestamp)
Read and normalise the FT/ftUSD Curve oracle at one Ethereum block.
- Parameters
- 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-timestampcache directory.
- Returns
Price prefill diagnostics.
- Return type
eth_defi.erc_4626.vault_protocol.flying_tulip.reward_price.FlyingTulipRewardPricePrefillResult