erc_4626.vault_protocol.d2.settlement
Documentation for eth_defi.erc_4626.vault_protocol.d2.settlement Python module.
D2 Finance settlement and phase event reader.
D2 vaults are epoch based. The contract emits lifecycle events that explain historical phase transitions:
EpochStartedNew funding/epoch schedule was published. The event payload contains the funding start, epoch start, and epoch end timestamps used to infer when deposits and redemptions are expected to be open.
FundsCustodiedVault funds were moved to the trading account for the epoch.
FundsReturnedVault funds were returned after the epoch, making redemption checks open again when
notCustodiedAndNotDuringEpoch()is true.NewMaxDepositsDeposit capacity changed.
Functions
|
Build generic settlement rows from D2 settlement and phase logs. |
|
Fetch D2 settlement and phase transition events for a vault. |
Return D2 settlement and phase event classes keyed by topic0. |
|
|
Fetch and store D2 settlement and phase transition events. |
- fetch_d2_settlements(vault, start_block, end_block, use_hypersync=None, chunk_size=50000)
Fetch D2 settlement and phase transition events for a vault.
- Parameters
vault (eth_defi.erc_4626.vault_protocol.d2.vault.D2Vault) – D2 vault adapter.
start_block (int) – Inclusive start block.
end_block (int) – Inclusive end block.
use_hypersync (Optional[bool]) – Whether to use Hypersync.
Noneauto-detects based on environment.chunk_size (int) – JSON-RPC
eth_getLogschunk size used by the fallback reader.
- Returns
Generic settlement rows sorted by block and transaction hash.
- Return type
- update_d2_settlement_database(database, vault, start_block, end_block, use_hypersync=None, chunk_size=50000)
Fetch and store D2 settlement and phase transition events.
- Parameters
database (eth_defi.vault.settlement_data.VaultSettlementDatabase) – Generic settlement database.
vault (eth_defi.erc_4626.vault_protocol.d2.vault.D2Vault) – D2 vault adapter.
start_block (int) – Inclusive start block.
end_block (int) – Inclusive end block.
use_hypersync (Optional[bool]) – Whether to use Hypersync.
Noneauto-detects.chunk_size (int) – JSON-RPC fallback chunk size.
- Returns
Number of settlement rows written.
- Return type
- get_d2_settlement_events_by_topic(vault)
Return D2 settlement and phase event classes keyed by topic0.
- Parameters
vault (eth_defi.erc_4626.vault_protocol.d2.vault.D2Vault) – D2 vault adapter.
- Returns
Mapping from topic0 to event class.
- Return type
- build_d2_settlement_rows_from_logs(vault, logs, event_by_topic=None)
Build generic settlement rows from D2 settlement and phase logs.
- Parameters
vault (eth_defi.erc_4626.vault_protocol.d2.vault.D2Vault) – D2 vault adapter.
logs (list[web3.datastructures.AttributeDict]) – Web3-compatible logs.
event_by_topic (Optional[dict[str, web3.contract.contract.ContractEvent | str]]) – Optional event topic0 to event class/name mapping used to populate
event_name.
- Returns
Settlement rows sorted by block and transaction hash.
- Return type