tokenised_fund.securitize.settlement
Documentation for eth_defi.tokenised_fund.securitize.settlement Python module.
Reconstruct Securitize fund NAV from asynchronous subscription settlements.
Some Securitize funds, such as the tokenised ARK Venture Fund, sell DSTokens
through an ERC-7540-style AsyncFundVault. Investors request deposits in
USDC, the requests are batched into generations, and a settler later calls
fulfillDeposits(generationId, navPriceWAD) with the price at which the
generation converts into fund shares. The contract emits:
event DepositGenerationFulfilled(uint256 indexed generationId, uint256 navPrice, uint256 totalDeposits);
event RedemptionGenerationFulfilled(uint256 indexed generationId, uint256 navPrice, uint256 fulfillmentRate, uint256 totalLiquidity);
When the vault has no onchain navProvider, these settlement prices are the
only authoritative onchain fund value. The settler grosses the deposit price
up by the tokenised-route subscription fee, so the fund NAV/share is
navPrice * (1 - subscription_fee) rounded to the fund’s published NAV
precision. Settlements are streamed with Hypersync, never eth_getLogs.
The historical multicall reader has a static call set, so it cannot look up the latest fulfilled generation at each block from contract state. Instead the adapter fetches the settlement timeline once per scan and picks the latest settlement at or before each sampled block.
See the verified AsyncFundVault implementation:
https://etherscan.io/address/0x23848fc9b4da2b686358d39403d07256b51a3e9c#code
Module Attributes
Topic of |
|
Topic of |
|
Hypersync attempts before a rate-limited historical settlement fetch fails. |
|
Seconds added to the server-stated |
|
Fallback wait in seconds when a rate-limit error has no |
|
Reviewed Securitize products priced from subscription settlements. |
Functions
Convert a deposit settlement price to fund NAV/share. |
|
|
Decode settlement logs into a block-ordered NAV timeline. |
|
Fetch the settlement NAV timeline with Hypersync. |
|
Find the latest settlement at or before a block. |
Classes
One reviewed Securitize subscription vault used as a NAV source. |
|
One fulfilled deposit generation converted to fund NAV/share. |
Exceptions
Raised when no settlement price is available for a block. |
- DEPOSIT_GENERATION_FULFILLED_TOPIC = '0x34380a1beae99170d09780fb25d293a753fea59b75ed07d0c9ff5e2c0ff1a40e'
Topic of
DepositGenerationFulfilled(uint256,uint256,uint256).
- REDEMPTION_GENERATION_FULFILLED_TOPIC = '0x43bb6d61de60d191110824522001029a5201ae48550e6874dcdd508407261918'
Topic of
RedemptionGenerationFulfilled(uint256,uint256,uint256,uint256).
- WAD = Decimal('1000000000000000000')
Fixed-point scale of
navPricevalues.
- SETTLEMENT_NAV_JUMP_WARNING_THRESHOLD = Decimal('0.20')
Relative settlement-to-settlement NAV move that is logged for review.
A venture fund NAV rarely moves this much in one business day. A larger move more likely means the settler changed its fee gross-up, which would shift the whole reconstructed series.
- SETTLEMENT_FETCH_ATTEMPTS = 3
Hypersync attempts before a rate-limited historical settlement fetch fails.
Bounded so a saturated API key delays the sequential tokenised-fund scheduler by at most a few minutes; the item is retried on the next tick.
- SETTLEMENT_FETCH_RESET_MARGIN = 5
Seconds added to the server-stated
resets_inbefore retrying.resets_inis reported in whole seconds, so wait a little past it. A shared API key that another consumer saturates can still lose the race.
- SETTLEMENT_FETCH_RETRY_SLEEP = 61
Fallback wait in seconds when a rate-limit error has no
resets_in.Longer than Hypersync’s 60-second rate-limit window.
- exception SecuritizeSettlementError
Bases:
RuntimeErrorRaised when no settlement price is available for a block.
- __init__(*args, **kwargs)
- __new__(**kwargs)
- add_note(note, /)
Add a note to the exception
- with_traceback(tb, /)
Set self.__traceback__ to tb and return self.
- class SecuritizeSettlementFeed
Bases:
objectOne reviewed Securitize subscription vault used as a NAV source.
- token: eth_typing.evm.HexAddress
Lower-case DSToken address.
- vault: eth_typing.evm.HexAddress
Lower-case
AsyncFundVaultproxy address emitting settlement events.
Decimal places of the fund’s published NAV/share.
- __init__(chain_id, token, vault, first_block, subscription_fee, nav_decimals=2)
- Parameters
chain_id (int) –
token (eth_typing.evm.HexAddress) –
vault (eth_typing.evm.HexAddress) –
first_block (int) –
subscription_fee (float) –
nav_decimals (int) –
- Return type
None
- class SecuritizeSettlementPrice
Bases:
objectOne fulfilled deposit generation converted to fund NAV/share.
- settlement_price: decimal.Decimal
Settlement price as emitted, in USD per share, including the fee gross-up.
Fund NAV/share in USD after removing the subscription fee.
- classmethod from_wad(block_number, generation_id, nav_price_wad, feed)
Create a settlement price from an emitted WAD
navPrice.- Parameters
block_number (int) – Block where the generation was fulfilled.
generation_id (int) – Deposit generation id.
nav_price_wad (int) –
navPricewith 18 decimals.feed (eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementFeed) – Reviewed settlement feed with the fee and NAV precision.
- Returns
Settlement price with the fee-adjusted NAV/share.
- Return type
eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementPrice
- __init__(block_number, generation_id, settlement_price, share_price)
- Parameters
block_number (int) –
generation_id (int) –
settlement_price (decimal.Decimal) –
share_price (decimal.Decimal) –
- Return type
None
- SECURITIZE_SETTLEMENT_FEEDS: dict[tuple[int, eth_typing.evm.HexAddress], eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementFeed] = {(1, '0xdf1c8e71cbdf48af50b36f96ad2eb6f5094ba72a'): SecuritizeSettlementFeed(chain_id=1, token='0xdf1c8e71cbdf48af50b36f96ad2eb6f5094ba72a', vault='0xef312d033ed52e2796ba604fef12b4a56053b292', first_block=26005046, subscription_fee=0.02, nav_decimals=2)}
Reviewed Securitize products priced from subscription settlements.
Convert a deposit settlement price to fund NAV/share.
The settler back-computes
navPricefrom each generation’s USDC total and its share amount rounded to 0.001 shares, so the raw value carries rounding noise. Rounding half-up to the fund’s published precision removes the noise and reproduces the published NAV.Example:
61.7224302451 * 0.98 = 60.48798...becomes60.49.- Parameters
nav_price_wad (int) –
navPricefromDepositGenerationFulfilled, with 18 decimals.feed (eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementFeed) – Reviewed settlement feed with the fee and NAV precision.
- Returns
Fund NAV/share in USD.
- Return type
- decode_settlement_prices(logs, feed)
Decode settlement logs into a block-ordered NAV timeline.
Only deposit settlements are priced. A fulfilled redemption generation logs a warning: its
navPricehas not yet been checked against a published NAV, and ignoring it could leave the deposit-only series stale if deposits stop settling.- Parameters
logs (collections.abc.Iterable[eth_defi.vault.flow_events.IndexedVaultFlowLog]) –
DepositGenerationFulfilledandRedemptionGenerationFulfilledlogs offeed.vault, sorted by block and log index as returned byfetch_vault_flow_logs_hypersync().feed (eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementFeed) – Reviewed settlement feed.
- Returns
Deposit settlement prices sorted by block number.
- Return type
list[eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementPrice]
- fetch_settlement_prices(hypersync_client, feed, end_block, attempts=3)
Fetch the settlement NAV timeline with Hypersync.
Hypersync is a hard requirement: there is no RPC or archive-state fallback. The repository’s Hypersync client disables internal retries, so a rate-limited request is retried here. Each wait lasts until the server-stated
resets_in, because a shared API key’s quota is usually only available right after its 60-second window resets.- Parameters
hypersync_client (ThrottledHypersyncClient) – Hypersync client for
feed.chain_id, created witheth_defi.hypersync.utils.configure_hypersync_from_env().feed (eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementFeed) – Reviewed settlement feed.
end_block (int) – Inclusive last block to read.
attempts (int) – Maximum Hypersync attempts when rate limited.
- Returns
Deposit settlement prices sorted by block number.
- Raises
RuntimeError – If Hypersync stays rate limited after all attempts, or If Hypersync returns no deposit settlement although
end_blockis at or after the known first settlement. An incomplete index must abort the scan rather than rewrite priced history as unpriced rows.- Return type
list[eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementPrice]
- find_settlement_price_at(prices, block_number)
Find the latest settlement at or before a block.
A settlement’s NAV stays in force until the next settlement, so rows between settlements repeat the last struck value.
- Parameters
prices (collections.abc.Sequence[eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementPrice]) – Settlement prices sorted by block number.
block_number (int) – Sampled block.
- Returns
Latest settlement no later than
block_number, orNonebefore the first settlement.- Return type
Optional[eth_defi.tokenised_fund.securitize.settlement.SecuritizeSettlementPrice]