UpshiftDepositManager

Documentation for eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftDepositManager Python class.

class UpshiftDepositManager

Bases: eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftMultiAssetDepositManager

Reuse the dated Upshift lifecycle for the legacy single-asset ABI.

Deposits are ordinary ERC-4626 calls. Withdrawals always use requestRedeem(shares,receiver,holder), which pays immediately only when the configured lag is zero. Standard redeem is not supported.

Attributes summary

web3

Methods summary

__init__(vault)

analyse_deposit(claim_tx_hash, deposit_ticket)

Decode Upshift's verified protocol deposit event.

analyse_redemption(claim_tx_hash, ...)

Validate native payout evidence for a synchronous or dated withdrawal.

can_create_deposit_request(owner)

Return whether the protocol-wide deposit gate is currently open.

can_create_redemption_request(owner)

Return whether the live vault gate and owner share balance permit redemption.

can_finish_deposit(deposit_ticket)

Synchronous deposits can be finished immediately.

can_finish_redeem(redemption_ticket)

Return whether a queued ticket has an onchain claimable amount.

check_deposit_whitelist(owner)

Check allow-list membership and the legacy negative admission policy.

create_deposit_request(owner[, to, amount, ...])

Build the standard legacy deposit using the existing ERC-4626 helper.

create_deposit_request_for_guard_validation(...)

Build ERC-4626 deposit calldata after a proven global closure.

create_redemption_request(owner[, to, ...])

Build a verified Upshift instant or request/claim redemption.

create_redemption_request_for_analysis(...)

Rebuild the queued parser without repeating post-request admission.

estimate_deposit(owner, amount[, ...])

Estimate LP shares for a deposit in the withdrawal denomination.

estimate_deposit_for_asset(owner, amount, ...)

Estimate LP shares for a selected accepted asset.

estimate_redeem(owner, shares[, ...])

Estimate queued redemption assets through the verified vault preview.

estimate_redemption_delay()

Return the configured lag rather than the synchronous base default.

fetch_accepted_assets()

Return every token currently accepted by the vault.

fetch_completed_redemption_tx_hash(ticket)

Find and validate an already-paid dated claim through Hypersync.

fetch_depositable_raw_assets(owner)

Answer the generic deposit-limit hook without ERC-4626 maxDeposit.

fetch_max_deposit_for_asset(accepted_asset)

Return current deposit capacity in selected-token raw units.

fetch_pending_redemption_value(ticket[, ...])

Value one ticket without making its proceeds spendable cash.

fetch_vault_flow_events(hypersync_client, ...)

Fetch asynchronous vault request events from an indexed backend.

finish_deposit(deposit_ticket)

Can we finish the deposit process in async vault.

finish_redemption(redemption_ticket)

Build the verified dated Upshift claim call.

force_redemption_liquidity(owner, ...)

Provision an unavailable synchronous redemption on an Anvil fork.

force_settle(ticket, *[, mock, ignore_liquidity])

Advance an Anvil fork to maturity without fabricating liquidity.

get_deposit_approval_target()

Return the ERC-20 spender required for a deposit request.

get_deposit_delay_over(address)

Estimate when a pending async deposit request will settle.

get_deposit_request_status(ticket)

Query the current status of an async deposit request.

get_max_deposit(owner)

How much we can deposit

get_redemption_delay_over(address)

Estimate a new request's maturity using the vault calendar.

get_redemption_request_status(ticket[, ...])

Check exact outstanding shares, maturity, permissions and liquidity.

get_redemption_ticket_delay_over(ticket)

Expose the persisted claim epoch to the existing settlement UI.

has_synchronous_deposit()

Does this vault support synchronous deposits?

has_synchronous_redemption()

Return whether the default withdrawal pays in its request transaction.

is_deposit_in_progress(owner)

Check if the owner has an active deposit request.

is_redemption_in_progress(owner)

Check if the owner has an active 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_deposit_ticket(data)

Reconstruct a deposit ticket from a serialised dict.

reconstruct_redemption_ticket(data)

Restore a persisted Upshift receiver/date aggregate ticket.

serialize_deposit_ticket(ticket)

Serialise a deposit ticket to a dict for persistence.

serialize_redemption_ticket(ticket)

Serialise the scheduled Upshift receiver/date aggregate identity.

create_deposit_request(owner, to=None, amount=None, raw_amount=None, check_max_deposit=True, check_enough_token=True, *, accepted_asset=None)

Build the standard legacy deposit using the existing ERC-4626 helper.

The base helper retains admission, pause, capacity and balance checks. Legacy deposits currently require owner and receiver to coincide.

Parameters
Returns

Standard synchronous deposit request.

Return type

eth_defi.erc_4626.deposit_redeem.ERC4626DepositRequest

fetch_depositable_raw_assets(owner)

Answer the generic deposit-limit hook without ERC-4626 maxDeposit.

The multi-asset Upshift vault does not implement the standard ERC-4626 maxDeposit (its limit surface is maxDepositAmount / depositCap / asset-aware previewDeposit). Overriding the generic hook means a generic-path deposit preflight receives a real limit in denomination token units instead of the ABIFunctionNotFound the base would raise. The protocol-specific create_deposit_request() still uses the per-selected-asset fetch_max_deposit_for_asset() for an actual deposit.

Parameters

owner (eth_typing.evm.HexAddress) – Account checked for admission; the limit itself is vault-wide.

Returns

Deposit limit in denomination-token raw units.

Return type

Optional[int]

estimate_deposit(owner, amount, block_identifier='latest')

Estimate LP shares for a deposit in the withdrawal denomination.

Reuse the protocol preview with the denomination selected internally. Alternative input conversion remains available through estimate_deposit_for_asset() for explicit library callers.

Parameters
  • owner (Optional[eth_typing.evm.HexAddress]) – Deposit owner used for structured error context.

  • amount (decimal.Decimal) – 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 share price.

Returns

Estimated LP shares rounded down to share-token precision.

Return type

decimal.Decimal

estimate_redeem(owner, shares, block_identifier='latest')

Estimate queued redemption assets through the verified vault preview.

Parameters
  • owner (Optional[eth_typing.evm.HexAddress]) – Share owner used for structured error context.

  • shares (decimal.Decimal) – Requested LP shares.

  • 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 preview.

Returns

Estimated denomination assets after the queued redemption fee.

Return type

decimal.Decimal

analyse_deposit(claim_tx_hash, deposit_ticket)

Decode Upshift’s verified protocol deposit event.

Parameters
Returns

Executed deposit amounts or a structured transaction failure.

Raises

ValueError – If the receipt does not contain exactly one matching deposit event.

Return type

Union[eth_defi.vault.deposit_redeem.DepositRedeemEventAnalysis, eth_defi.vault.deposit_redeem.DepositRedeemEventFailure]

estimate_deposit_for_asset(owner, amount, accepted_asset, block_identifier='latest')

Estimate LP shares for a selected accepted asset.

The estimate comes from Upshift’s asset-aware previewDeposit call, avoiding local assumptions about reference-asset conversion.

Parameters
  • owner (Optional[eth_typing.evm.HexAddress]) – Deposit owner used for structured error context.

  • amount (decimal.Decimal) – Selected accepted-asset amount.

  • accepted_asset (eth_typing.evm.HexAddress) – Whitelisted deposit-token address.

  • 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 share price.

Returns

Estimated LP shares rounded down to share-token precision.

Return type

decimal.Decimal

__init__(vault)
Parameters

vault (ERC4626Vault) –

analyse_redemption(claim_tx_hash, redemption_ticket)

Validate native payout evidence for a synchronous or dated withdrawal.

Dated payouts must match calldata, exact outstanding shares immediately before the payout block, and the actual reference-token transfer. A blacklist redirection or receiver/date aggregate is never credited.

Parameters
Returns

Net executed amounts or a mined transaction failure.

Return type

Union[eth_defi.vault.deposit_redeem.DepositRedeemEventAnalysis, eth_defi.vault.deposit_redeem.DepositRedeemEventFailure]

can_create_deposit_request(owner)

Return whether the protocol-wide deposit gate is currently open.

Parameters

owner (eth_typing.evm.HexAddress) – Unused because Upshift’s pause and cap are vault-wide.

Returns

True when deposits are neither paused nor configured with a zero cap.

Return type

bool

can_create_redemption_request(owner)

Return whether the live vault gate and owner share balance permit redemption.

Parameters

owner (eth_typing.evm.HexAddress) – Share owner.

Returns

True when withdrawals are open and the owner has LP shares.

Return type

bool

can_finish_deposit(deposit_ticket)

Synchronous deposits can be finished immediately.

Parameters

deposit_ticket (eth_defi.erc_4626.deposit_redeem.ERC4626DepositTicket) –

can_finish_redeem(redemption_ticket)

Return whether a queued ticket has an onchain claimable amount.

Parameters

redemption_ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Upshift queued redemption ticket.

Returns

Whether an admitted caller can execute the mature funded claim.

Return type

bool

check_deposit_whitelist(owner)

Check allow-list membership and the legacy negative admission policy.

The shared helper handles positive whitelists. Legacy blacklists apply to both request senders and payout receivers even without an allow-list.

Parameters

owner (eth_typing.evm.HexAddress) – Account funding or receiving the flow.

Return type

None

create_deposit_request_for_guard_validation(owner, raw_amount)

Build ERC-4626 deposit calldata after a proven global closure.

This Anvil-only diagnostic path is available only when the selected vault’s authoritative global closure reader reports that deposits are unavailable to every account. It preserves the normal protocol admission preflight and all permanent amount constraints, while omitting the temporary closed-deposit capacity and token-balance checks needed to encode the production-equivalent deposit call.

Parameters
  • owner (eth_typing.evm.HexAddress) – Safe/SimpleVault address that would own the minted shares.

  • raw_amount (int) – Raw denomination-token amount from the rejected real-deposit attempt.

Returns

Single ERC-4626 deposit request for isolated GuardV0 validation.

Raises
Return type

eth_defi.erc_4626.deposit_redeem.ERC4626DepositRequest

create_redemption_request(owner, to=None, shares=None, raw_shares=None, check_max_deposit=True, check_enough_token=True, *, instant=False)

Build a verified Upshift instant or request/claim redemption.

Parameters
  • owner (eth_typing.evm.HexAddress) – Share owner used for structured error context.

  • to (Optional[eth_typing.evm.HexAddress]) – Asset receiver, defaulting to the share owner.

  • shares (Optional[decimal.Decimal]) – Decimal LP shares, exclusive with raw_shares.

  • raw_shares (Optional[int]) – Native LP shares, exclusive with shares.

  • check_max_deposit (bool) – Retained base-interface compatibility flag.

  • check_enough_token (bool) – Check the owner’s LP share balance.

  • instant (bool) – Select the verified fee-bearing multi-asset instant path explicitly. The default follows the configured lag. Legacy instant selectors remain unsupported; zero-lag legacy requests already pay directly.

Returns

Synchronous standard request for instant redemption, or a queued request that parses a dated redemption ticket.

Return type

eth_defi.vault.deposit_redeem.RedemptionRequest

create_redemption_request_for_analysis(owner, raw_shares)

Rebuild the queued parser without repeating post-request admission.

Shares have already moved to escrow and the date obligation now exists. Only original call metadata is rebuilt; receipt parsing validates it.

Parameters
  • owner (eth_typing.evm.HexAddress) – Original custody owner and receiver.

  • raw_shares (int) – Exact native shares from persisted trade metadata.

Returns

Queued parser with the original approval/request call count.

Return type

eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionRequest

estimate_redemption_delay()

Return the configured lag rather than the synchronous base default.

The calendar liquidation boundary can extend the actual wait. A parsed ticket supplies the exact scheduled date through the ticket ETA hook.

Returns

Configured minimum lag.

Return type

datetime.timedelta

fetch_accepted_assets()

Return every token currently accepted by the vault.

Returns

Accepted tokens in the protocol whitelist order.

Return type

tuple[eth_defi.token.TokenDetails, …]

fetch_completed_redemption_tx_hash(ticket)

Find and validate an already-paid dated claim through Hypersync.

A missing or lagging indexer leaves the ticket unresolved. Candidate events must pass the same calldata and transfer analysis as our claims.

Parameters

ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Persisted request identity.

Returns

Attributable payout hash, or None if none is indexed.

Return type

Optional[hexbytes.main.HexBytes]

fetch_max_deposit_for_asset(accepted_asset, block_identifier='latest')

Return current deposit capacity in selected-token raw units.

Upshift constrains both one deposit through maxDepositAmount and total vault assets through depositCap. The lower current reference capacity is converted with the protocol’s asset-aware preview.

Parameters
  • accepted_asset (eth_typing.evm.HexAddress) – Whitelisted token selected for the deposit.

  • 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 cap.

Returns

Current maximum selected-token amount in native raw units.

Raises

ValueError – If the protocol reports a zero reference value for one token.

Return type

int

fetch_pending_redemption_value(ticket, block_identifier='latest')

Value one ticket without making its proceeds spendable cash.

Legacy entitlement is fixed by the request event. Multi-asset requests retain escrowed shares whose net value changes until the claim.

Parameters
Returns

Net denomination-token value.

Return type

decimal.Decimal

fetch_vault_flow_events(hypersync_client, start_block, end_block)

Fetch asynchronous vault request events from an indexed backend.

The base implementation returns no events for vault managers that do not have a two-phase deposit or redemption flow.

Parameters
  • hypersync_client – Configured Hypersync client for this vault’s chain.

  • start_block (int) – Inclusive start block.

  • end_block (int) – Inclusive end block.

Returns

Iterator of protocol-neutral pending vault flow events.

Return type

collections.abc.Iterator[eth_defi.vault.flow_events.PendingVaultFlow]

finish_deposit(deposit_ticket)

Can we finish the deposit process in async vault.

  • We can claim our shares from the vault now

Parameters

deposit_ticket (eth_defi.vault.deposit_redeem.DepositTicket) –

Return type

web3.contract.contract.ContractFunction

finish_redemption(redemption_ticket)

Build the verified dated Upshift claim call.

Parameters

redemption_ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Claimable Upshift ticket.

Returns

claim(year, month, day, receiver) call.

Return type

web3.contract.contract.ContractFunction

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
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

force_settle(ticket, *, mock=None, ignore_liquidity=False)

Advance an Anvil fork to maturity without fabricating liquidity.

Ordinary claim execution remains with the caller and its custody signer. A funded mature request becomes claimable without operator processing.

Parameters
Returns

Observed status before and after advancing local time.

Return type

eth_defi.vault.deposit_redeem.VaultForcedSettlementResult

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

eth_typing.evm.HexAddress

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-ui table).

  • 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 None when no onchain estimate is available.

Return type

Optional[datetime.datetime]

get_deposit_request_status(ticket)

Query the current status of an async deposit request.

Default implementation probes via can_finish_deposit(). Subclasses should override for more accurate status reporting (e.g. distinguishing reclaimable from pending).

Parameters

ticket (eth_defi.vault.deposit_redeem.DepositTicket) –

Return type

eth_defi.vault.deposit_redeem.AsyncVaultRequestStatus

get_max_deposit(owner)

How much we can deposit

Parameters

owner (eth_typing.evm.HexAddress) –

Return type

Optional[decimal.Decimal]

get_redemption_delay_over(address)

Estimate a new request’s maturity using the vault calendar.

Existing requests use the ticket hook instead of current configuration.

Parameters

address (Union[eth_typing.evm.HexAddress, str]) – Interface-compatible account; the calendar is global.

Returns

Naive UTC scheduled maturity.

Return type

datetime.datetime

get_redemption_request_status(ticket, block_identifier='latest')

Check exact outstanding shares, maturity, permissions and liquidity.

A missing obligation needs receipt recovery. It is never proof of a zero payout. Outside additions violate the single-request invariant.

Parameters
Returns

Missing, pending, or executable claim.

Return type

eth_defi.vault.deposit_redeem.AsyncVaultRequestStatus

get_redemption_ticket_delay_over(ticket)

Expose the persisted claim epoch to the existing settlement UI.

This date is a maturity estimate, not a guarantee of funded payout.

Parameters

ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Parsed request with its original claim date.

Returns

Naive UTC maturity timestamp.

Return type

datetime.datetime

has_synchronous_deposit()

Does this vault support synchronous deposits?

  • E.g. ERC-4626 vaults

Return type

bool

has_synchronous_redemption()

Return whether the default withdrawal pays in its request transaction.

Both families support zero-lag exits, using different call signatures. The answer follows the current configured lag, not the protocol label.

Returns

Whether there is no request/claim delay.

Return type

bool

is_deposit_in_progress(owner)

Check if the owner has an active deposit request.

Parameters

owner (eth_typing.evm.HexAddress) – Owner of the shares

Returns

True if there is an active redemption request

Return type

bool

is_redemption_in_progress(owner)

Check if the owner has an active redemption request.

Parameters

owner (eth_typing.evm.HexAddress) – Owner of the shares

Returns

True if there is an active redemption request

Return type

bool

reclaim_deposit(ticket)

Return a function to recover funds after a failed async deposit settlement.

Returns None if 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 None if the protocol does not support reclaim.

Parameters

ticket (eth_defi.vault.deposit_redeem.RedemptionTicket) –

Return type

Optional[web3.contract.contract.ContractFunction]

reconstruct_deposit_ticket(data)

Reconstruct a deposit ticket from a serialised dict.

Default returns a base DepositTicket. Subclasses override for protocol-specific ticket types.

Parameters

data (dict) –

Return type

eth_defi.vault.deposit_redeem.DepositTicket

reconstruct_redemption_ticket(data)

Restore a persisted Upshift receiver/date aggregate ticket.

Parameters

data (dict) – Data produced by serialize_redemption_ticket().

Returns

Queued Upshift redemption ticket.

Return type

eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket

serialize_deposit_ticket(ticket)

Serialise a deposit ticket to a dict for persistence.

The trade-executor stores this in trade.other_data so that the settlement retry module can reconstruct the ticket after a process restart.

Default implementation stores base DepositTicket fields. Subclasses override to add protocol-specific fields (e.g. settlement_id for Ostium, requestId for ERC-7540).

Parameters

ticket (eth_defi.vault.deposit_redeem.DepositTicket) –

Return type

dict

serialize_redemption_ticket(ticket)

Serialise the scheduled Upshift receiver/date aggregate identity.

Parameters

ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Queued Upshift redemption ticket.

Returns

JSON-compatible base and calendar/epoch fields.

Return type

dict