T3trisDepositManager
Documentation for eth_defi.erc_4626.vault_protocol.t3tris.deposit_redeem.T3trisDepositManager Python class.
- class T3trisDepositManager
Bases:
eth_defi.erc_7540.deposit_redeem.ERC7540DepositManagerAsynchronous T3tris request, settlement and claim flow.
Deposit process. Asynchronous. The owner approves the denomination token to the vault, then
create_deposit_request()buildsrequestDeposit(owner, false, assets, ""). The vault-wide epoch id is read from theDepositRequestevent into anERC7540DepositTicket. After the curator settles the epoch,finish_deposit()buildsclaimDeposit(owner).Redemption process. Asynchronous.
create_redemption_request()buildsrequestRedeem(owner, owner, owner, false, shares); after settlementfinish_redemption()buildsclaimRedeem(owner, owner, false).Queues and settlement. Request ids are vault-wide epochs and the per-owner state is keyed by
(owner, requestId). Claims are owner-wide, and a new request first claims any settled request in the same direction. This manager therefore refuses a new request while the owner has a pending or claimable one, and reads every ticket’s status for its own request id.Whitelisting / access control. Deposits use the shared
check_deposit_whitelist()preflight backed byisDepositWhitelisted. Redemptions checkisWithdrawWhitelistedwhen the withdrawal whitelist is enabled.Unsupported surfaces. Open-mode synchronous vaults, Permit2 deposits,
unsafeflows and request decreases are not implemented.Anvil settlement.
force_settle()impersonates the oracle owner to refresh the valuation and the curator to callsettle().Initialise the manager for a T3tris vault.
- Parameters
vault – T3tris vault adapter. It is not an
ERC7540Vaultbecause its request and claim ABI differs from the standard.
Attributes summary
web3Methods summary
__init__(vault)Initialise the manager for a T3tris vault.
analyse_deposit(claim_tx_hash, deposit_ticket)Analyse a
claimDeposittransaction.analyse_redemption(claim_tx_hash, ...)Analyse a
claimRedeemtransaction.can_create_deposit_request(owner)Return whether a deposit request would pass the preflight.
Return whether a redemption request would pass the preflight.
can_finish_deposit(deposit_ticket)Check whether the ticket's deposit epoch has been settled.
can_finish_redeem(redemption_ticket)Check whether the ticket's redemption epoch has been settled.
check_deposit_whitelist(owner)Reject a deposit when the vault's whitelist excludes the owner.
create_deposit_request(owner[, to, amount, ...])Build a T3tris
requestDeposittransaction.Build deposit calldata for a closed-vault GuardV0 policy check.
create_redemption_request(owner[, to, ...])Build a T3tris
requestRedeemtransaction.Rebuild a mined redemption request without rerunning preflights.
estimate_deposit(owner, amount[, ...])Estimate shares for a denomination-token amount.
estimate_redeem(owner, shares[, ...])Estimate denomination tokens for a vault-share amount.
Return no deterministic protocol-level redemption delay.
Find an operator-owned terminal redemption transaction when available.
fetch_pending_redemption_value(ticket[, ...])Quote a ticket when ordinary share valuation no longer represents it.
fetch_vault_flow_events(hypersync_client, ...)Fetch standard ERC-7540 request events using Hypersync.
finish_deposit(deposit_ticket)Build
claimDeposit(receiver)for a settled request.finish_redemption(redemption_ticket)Build
claimRedeem(owner, receiver, false)for a settled request.force_redemption_liquidity(owner, ...)Provision an unavailable synchronous redemption on an Anvil fork.
force_settle(ticket, *[, mock, ignore_liquidity])Settle the current T3tris epoch on an Anvil fork.
Return the ERC-20 spender required for a deposit request.
get_deposit_delay_over(address)Estimate when a pending async deposit request will settle.
Return accepted claim-deposit event signatures.
get_deposit_request_status(ticket)Map the ticket's own request epoch to the generic status.
Return the vault's non-binding settlement estimate.
get_max_deposit(owner)How much we can deposit
get_redemption_delay_over(address)Return the legacy sentinel for an unknown account deadline.
Return accepted claim-redemption event signatures.
get_redemption_request_status(ticket)Map the ticket's own request epoch to the generic status.
Report that deposits use the asynchronous request lifecycle.
Report that redemptions use the asynchronous request lifecycle.
is_deposit_in_progress(owner)Check whether the owner has a pending or claimable deposit request.
is_redemption_in_progress(owner)Check whether the owner has a pending or claimable redemption request.
reclaim_deposit(ticket)Return a function to recover funds after a failed async deposit settlement.
reclaim_withdrawal(ticket)Return a function to recover shares after a failed async withdrawal settlement.
Reconstruct a deposit ticket from persistent data.
Reconstruct a redemption ticket from persistent data.
serialize_deposit_ticket(ticket)Serialise an ERC-7540 deposit ticket.
serialize_redemption_ticket(ticket)Serialise an ERC-7540 redemption ticket.
- __init__(vault)
Initialise the manager for a T3tris vault.
- Parameters
vault (eth_defi.erc_4626.vault_protocol.t3tris.vault.T3trisVault) – T3tris vault adapter. It is not an
ERC7540Vaultbecause its request and claim ABI differs from the standard.
- is_deposit_in_progress(owner)
Check whether the owner has a pending or claimable deposit request.
- Parameters
owner (eth_typing.evm.HexAddress) – Request owner.
- Returns
Truewhen the owner’s latest deposit request is open.- Return type
- is_redemption_in_progress(owner)
Check whether the owner has a pending or claimable redemption request.
- Parameters
owner (eth_typing.evm.HexAddress) – Request owner.
- Returns
Truewhen the owner’s latest redemption request is open.- Return type
- can_create_deposit_request(owner)
Return whether a deposit request would pass the preflight.
- Parameters
owner (eth_typing.evm.HexAddress) – Request owner.
- Returns
Truewhen no preflight refusal applies.- Return type
- can_create_redemption_request(owner)
Return whether a redemption request would pass the preflight.
- Parameters
owner (eth_typing.evm.HexAddress) – Share owner.
- Returns
Truewhen no preflight refusal applies.- Return type
- create_deposit_request(owner, to=None, amount=None, raw_amount=None, check_max_deposit=True, check_enough_token=True)
Build a T3tris
requestDeposittransaction.- Parameters
owner (eth_typing.evm.HexAddress) – Asset owner and share receiver.
to (eth_typing.evm.HexAddress) – Must be
Noneorowner; T3tris claims to the request receiver.amount (decimal.Decimal) – Human-readable denomination-token amount.
raw_amount (int) – Raw denomination-token amount, overriding
amount.check_max_deposit (bool) – Ignored.
maxDepositdescribes only the open-mode flow.check_enough_token (bool) – Verify that the owner holds the denomination tokens.
- Returns
Request wrapper ready for signing and parsing.
- Raises
VaultFlowUnavailable – If a preflight refuses the request.
- Return type
- create_redemption_request(owner, to=None, shares=None, raw_shares=None, check_max_deposit=True, check_enough_token=True)
Build a T3tris
requestRedeemtransaction.- Parameters
owner (eth_typing.evm.HexAddress) – Share owner and asset receiver.
to (eth_typing.evm.HexAddress) – Must be
Noneorowner.shares (decimal.Decimal) – Human-readable vault-share amount.
raw_shares (int) – Raw vault-share amount, overriding
shares.check_max_deposit (bool) – Ignored; kept for the common manager API.
check_enough_token (bool) – Verify that the owner holds the requested shares.
- Returns
Request wrapper ready for signing and parsing.
- Raises
VaultFlowUnavailable – If a preflight refuses the request.
- Return type
- create_redemption_request_for_analysis(owner, raw_shares)
Rebuild a mined redemption request without rerunning preflights.
The open-request preflight would reject the very request being analysed.
- Parameters
owner (eth_typing.evm.HexAddress) – Original share owner.
raw_shares (int) – Requested raw shares.
- Returns
Request parser with the original call shape.
- Return type
- get_deposit_request_status(ticket)
Map the ticket’s own request epoch to the generic status.
- Parameters
ticket (eth_defi.erc_7540.deposit_redeem.ERC7540DepositTicket) – Deposit ticket.
- Returns
Claimable, pending or empty request status.
- Return type
- get_redemption_request_status(ticket)
Map the ticket’s own request epoch to the generic status.
- Parameters
ticket (eth_defi.erc_7540.deposit_redeem.ERC7540RedemptionTicket) – Redemption ticket.
- Returns
Claimable, pending or empty request status.
- Return type
- can_finish_deposit(deposit_ticket)
Check whether the ticket’s deposit epoch has been settled.
- Parameters
deposit_ticket (eth_defi.erc_7540.deposit_redeem.ERC7540DepositTicket) – Deposit ticket.
- Returns
Truewhen shares are claimable.- Return type
- can_finish_redeem(redemption_ticket)
Check whether the ticket’s redemption epoch has been settled.
- Parameters
redemption_ticket (eth_defi.erc_7540.deposit_redeem.ERC7540RedemptionTicket) – Redemption ticket.
- Returns
Truewhen assets are claimable.- Return type
- finish_deposit(deposit_ticket)
Build
claimDeposit(receiver)for a settled request.- Parameters
deposit_ticket (eth_defi.vault.deposit_redeem.DepositTicket) – Settled deposit ticket.
- Returns
Bound claim function.
- Return type
web3.contract.contract.ContractFunction
- finish_redemption(redemption_ticket)
Build
claimRedeem(owner, receiver, false)for a settled request.- Parameters
redemption_ticket (eth_defi.vault.deposit_redeem.RedemptionTicket) – Settled redemption ticket.
- Returns
Bound claim function.
- Return type
web3.contract.contract.ContractFunction
- analyse_deposit(claim_tx_hash, deposit_ticket)
Analyse a
claimDeposittransaction.- Parameters
claim_tx_hash (Union[hexbytes.main.HexBytes, str]) – Claim transaction hash.
deposit_ticket (Optional[eth_defi.vault.deposit_redeem.DepositTicket]) – Original request ticket.
- Returns
Shares received and assets deposited, or a failure.
- Return type
Union[eth_defi.vault.deposit_redeem.DepositRedeemEventAnalysis, eth_defi.vault.deposit_redeem.DepositRedeemEventFailure]
- analyse_redemption(claim_tx_hash, redemption_ticket)
Analyse a
claimRedeemtransaction.- Parameters
claim_tx_hash (Union[hexbytes.main.HexBytes, str]) – Claim transaction hash.
redemption_ticket (Optional[eth_defi.vault.deposit_redeem.RedemptionTicket]) – Original request ticket.
- Returns
Shares burned and assets received, or a failure.
- Return type
Union[eth_defi.vault.deposit_redeem.DepositRedeemEventAnalysis, eth_defi.vault.deposit_redeem.DepositRedeemEventFailure]
- get_estimated_lock_up()
Return the vault’s non-binding settlement estimate.
T3trisVault.get_withdrawal_period()is the source of truth; this keeps the estimate available through the manager API, as Lagoon’s manager does.- Returns
Average settlement interval, or
Nonewhen unknown.- Return type
- force_settle(ticket, *, mock=None, ignore_liquidity=False)
Settle the current T3tris epoch on an Anvil fork.
Refreshes the oracle valuation as the oracle owner, at unchanged total assets, then settles as the curator. Settlement processes every pending request in the epoch, not only the ticket’s. A redemption settlement pulls assets from the curator wallet, so it fails as a typed result when the curator cannot pay.
- Parameters
ticket (Optional[Union[eth_defi.vault.deposit_redeem.DepositTicket, eth_defi.vault.deposit_redeem.RedemptionTicket]]) – Pending deposit or redemption ticket.
mock (Optional[object]) – Unsupported; T3tris has no local mock settlement driver.
ignore_liquidity (bool) – Unsupported; curator liquidity is never synthesised.
- Returns
Before/after status and the two settlement transaction hashes.
- Raises
UnsupportedVaultSimulation – If the provider is not Anvil, an unsupported option is given, the ticket is not pending or the settlement does not complete.
- Return type
- check_deposit_whitelist(owner)
Reject a deposit when the vault’s whitelist excludes the owner.
Shared deposit-preflight helper implementing the whitelisting contract every manager must honour: when a vault applies a deposit whitelist policy that is applicable and queryable, and
owneris not a member of it, raiseWhitelistingRequiredbefore any transaction is broadcast so the caller can surface a “whitelisting required” state instead of paying gas for a guaranteed revert.The check is intentionally conservative — it only raises when the whitelist information can be obtained and is applicable:
if
is_whitelisted_deposit()raisesNotImplementedError, the vault-wide policy cannot be determined for this adapter/version, so no exception is raised;if the vault is permissionless, no exception is raised;
if
is_account_whitelisted()raisesNotImplementedError, per-account membership cannot be queried, so no exception is raised;only when the policy is applicable and the owner is provably not admitted is
WhitelistingRequiredraised.
Adapters that need a stricter fail-closed policy for an unknown admission state should override their own preflight and raise
VaultFlowUnavailablein addition to calling this helper (see the Lagoon manager for an example).- Parameters
owner (eth_typing.evm.HexAddress) – Deposit owner and controller whose whitelist membership is checked.
- Raises
WhitelistingRequired – When the vault applies an applicable, queryable whitelist policy and
owneris not permitted to deposit.- Return type
None
- create_deposit_request_for_guard_validation(owner, raw_amount)
Build deposit calldata for a closed-vault GuardV0 policy check.
This Anvil-only diagnostic path is for a consumer that has already received a typed
deposit_closedordeposit_pausedpreflight result. Adapters must override it only after proving that their typed result represents a temporary vault closure rather than a capacity or amount restriction. The returned calls must be supplied individually toGuardV0.validateCall(); callers must never broadcast them to the closed protocol vault.- Parameters
owner (eth_typing.evm.HexAddress) – SimpleVaultV0/Safe address that would own the shares.
raw_amount (int) – Denomination-token amount in the selected asset’s raw unit.
- Returns
Manager-generated deposit request suitable only for isolated GuardV0 validation.
- Raises
UnsupportedVaultSimulation – Unless the protocol-specific manager implements this diagnostic path.
- Return type
- deposit_request_class
alias of
eth_defi.erc_7540.deposit_redeem.ERC7540DepositRequest
- estimate_deposit(owner, amount, block_identifier='latest')
Estimate shares for a denomination-token amount.
ERC-7540 retains the ERC-4626
convertToSharespreview used here; the estimate does not imply that the request is currently admissible.- Parameters
owner (eth_typing.evm.HexAddress) – Request controller. The standard preview is not owner-specific.
amount (decimal.Decimal) – Human-readable denomination-token amount.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block at which to read the conversion rate.
- Returns
Estimated human-readable share amount.
- Return type
- estimate_redeem(owner, shares, block_identifier='latest')
Estimate denomination tokens for a vault-share amount.
ERC-7540 retains the ERC-4626
convertToAssetspreview used here; the estimate does not imply that the request is currently admissible.- Parameters
owner (eth_typing.evm.HexAddress) – Request controller. The standard preview is not owner-specific.
shares (decimal.Decimal) – Human-readable vault-share amount.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block at which to read the conversion rate.
- Returns
Estimated human-readable denomination-token amount.
- Return type
- estimate_redemption_delay()
Return no deterministic protocol-level redemption delay.
Settlement timing is controlled by each vault operator and is outside the ERC-7540 standard.
- Returns
Zero-duration sentinel for an unspecified delay.
- Return type
- fetch_completed_redemption_tx_hash(ticket)
Find an operator-owned terminal redemption transaction when available.
Claim-based protocols finish through
finish_redemption()and do not need this lookup. Operator-finalised protocols override the hook to find and validate the transaction that paid the requested receiver.- Parameters
ticket (eth_defi.vault.deposit_redeem.RedemptionTicket) – Persisted redemption request to locate.
- Returns
Terminal transaction hash, or
Noneif the protocol has not observed one yet.- Return type
Optional[hexbytes.main.HexBytes]
- fetch_pending_redemption_value(ticket, block_identifier='latest')
Quote a ticket when ordinary share valuation no longer represents it.
The default retains normal share valuation. Protocols with fixed request-time entitlements or burned pending shares override this hook. Returning a value does not recognise cash or complete settlement.
- Parameters
ticket (eth_defi.vault.deposit_redeem.RedemptionTicket) – Persisted request belonging to one trade.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block used for all valuation reads.
- Returns
Net denomination value, or
Noneto value ordinary shares.- Return type
- fetch_vault_flow_events(hypersync_client, start_block, end_block)
Fetch standard ERC-7540 request events using Hypersync.
ERC-7540 vaults emit
DepositRequestfor deposit requests andRedeemRequestfor redemption requests. Protocol-specific legacy events must be handled by a protocol manager subclass.- Parameters
- Returns
Iterator of indexed pending vault flow events in chain order.
- Return type
collections.abc.Iterator[eth_defi.vault.flow_events.PendingVaultFlow]
- force_redemption_liquidity(owner, raw_shares, failure)
Provision an unavailable synchronous redemption on an Anvil fork.
Concrete managers may implement this only for a source-proven liquidity failure. The default is deliberately unsupported: this hook must never bypass admission, minimums, maturity or time locks.
- Parameters
owner (eth_typing.evm.HexAddress) – Redemption owner.
raw_shares (int) – Exact raw share quantity requested.
failure (eth_defi.vault.deposit_redeem.VaultFlowUnavailable) – Typed preflight failure that prompted the intervention request.
- Returns
Structured intervention evidence from a concrete manager.
- Raises
UnsupportedVaultSimulation – Always for managers without a protocol-specific implementation.
- Return type
eth_defi.vault.deposit_redeem.VaultRedemptionSimulationIntervention
- get_deposit_approval_target()
Return the ERC-20 spender required for a deposit request.
Standard ERC-4626 and the currently supported async adapters pull denomination tokens from the vault address itself. An adapter using a different router or silo must override this method; guarded callers use it to whitelist and validate the exact approval calldata.
- Returns
ERC-20 approval spender address.
- Return type
- get_deposit_delay_over(address)
Estimate when a pending async deposit request will settle.
Mirror of
get_redemption_delay_over()for the deposit side.Used to show an estimated settlement time for unsettled deposits (e.g. in the trade-executor
trade-uitable).Default returns
None: the protocol has no deterministic onchain settlement schedule (e.g. operator-driven ERC-7540 vaults like Lagoon). Subclasses with a predictable settlement cadence (e.g. Ostium V1.5) override this to return an estimated UTC timestamp.
- Parameters
address (Union[eth_typing.evm.HexAddress, str]) – Owner of the pending deposit request.
- Returns
Naive UTC timestamp when the deposit is expected to settle, or
Nonewhen no onchain estimate is available.- Return type
- get_deposit_event_signatures()
Return accepted claim-deposit event signatures.
ERC-7540 claims retain the ERC-4626
Depositevent shape.- Returns
Standard ERC-4626
Deposittopic emitted by ERC-7540 claims.- Return type
- get_max_deposit(owner)
How much we can deposit
- Parameters
owner (eth_typing.evm.HexAddress) –
- Return type
- get_redemption_delay_over(address)
Return the legacy sentinel for an unknown account deadline.
Generic ERC-7540 vaults do not expose a deterministic per-account settlement deadline.
- Parameters
address (Union[eth_typing.evm.HexAddress, str]) – Request controller.
- Returns
Naive Unix epoch sentinel retained for backwards compatibility.
- Return type
- get_redemption_event_signatures()
Return accepted claim-redemption event signatures.
ERC-7540 claims retain the ERC-4626
Withdrawevent shape.- Returns
Standard ERC-4626
Withdrawtopic emitted by ERC-7540 claims.- Return type
- has_synchronous_deposit()
Report that deposits use the asynchronous request lifecycle.
- Returns
Always
Falsefor ERC-7540.- Return type
- has_synchronous_redemption()
Report that redemptions use the asynchronous request lifecycle.
- Returns
Always
Falsefor ERC-7540.- Return type
- reclaim_deposit(ticket)
Return a function to recover funds after a failed async deposit settlement.
Returns
Noneif the protocol does not support reclaim.- Parameters
ticket (eth_defi.vault.deposit_redeem.DepositTicket) –
- Return type
Optional[web3.contract.contract.ContractFunction]
- reclaim_withdrawal(ticket)
Return a function to recover shares after a failed async withdrawal settlement.
Returns
Noneif the protocol does not support reclaim.- Parameters
- Return type
Optional[web3.contract.contract.ContractFunction]
- reconstruct_deposit_ticket(data)
Reconstruct a deposit ticket from persistent data.
Both the current string form and the legacy integer form of raw token amounts are accepted for backwards compatibility.
- Parameters
data (dict) – Data produced by
serialize_deposit_ticket().- Returns
Reconstructed ERC-7540 deposit ticket.
- Return type
- reconstruct_redemption_ticket(data)
Reconstruct a redemption ticket from persistent data.
Both the current string form and the legacy integer form of raw share amounts are accepted for backwards compatibility.
- Parameters
data (dict) – Data produced by
serialize_redemption_ticket().- Returns
Reconstructed ERC-7540 redemption ticket.
- Return type
- redemption_request_class
alias of
eth_defi.erc_7540.deposit_redeem.ERC7540RedemptionRequest
- serialize_deposit_ticket(ticket)
Serialise an ERC-7540 deposit ticket.
The generic base ticket payload is extended with the ERC-7540 request identifier needed for later status checks.
- Parameters
ticket (eth_defi.erc_7540.deposit_redeem.ERC7540DepositTicket) – Deposit ticket to serialise.
- Returns
Persistent ticket data including
vault_request_id.- Return type
- serialize_redemption_ticket(ticket)
Serialise an ERC-7540 redemption ticket.
The ERC-7540 request identifier is retained so a restarted process can query the request-specific claimable amount.
- Parameters
ticket (eth_defi.erc_7540.deposit_redeem.ERC7540RedemptionTicket) – Redemption ticket to serialise.
- Returns
Persistent ticket data including
vault_request_id.- Return type