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.UpshiftMultiAssetDepositManagerReuse 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. Standardredeemis not supported.Attributes summary
web3Methods 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.
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.
Build ERC-4626 deposit calldata after a proven global closure.
create_redemption_request(owner[, to, ...])Build a verified Upshift instant or request/claim redemption.
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.
Return the configured lag rather than the synchronous base default.
Return every token currently accepted by the vault.
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.
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.
Does this vault support synchronous deposits?
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 a deposit ticket from a serialised dict.
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
owner (eth_typing.evm.HexAddress) – Depositor and share receiver.
to (Optional[eth_typing.evm.HexAddress]) – Optional receiver, required to equal owner.
amount (Optional[decimal.Decimal]) – Decimal amount, exclusive with raw amount.
check_max_deposit (bool) – Whether to preflight capacity.
check_enough_token (bool) – Whether to preflight the owner’s balance.
accepted_asset (Optional[eth_typing.evm.HexAddress]) – Optional denomination address; legacy pools accept no alternative.
- Returns
Standard synchronous deposit request.
- Return type
- 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 ismaxDepositAmount/depositCap/ asset-awarepreviewDeposit). Overriding the generic hook means a generic-path deposit preflight receives a real limit in denomination token units instead of theABIFunctionNotFoundthe base would raise. The protocol-specificcreate_deposit_request()still uses the per-selected-assetfetch_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
- 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
- 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
- analyse_deposit(claim_tx_hash, deposit_ticket)
Decode Upshift’s verified protocol deposit event.
- Parameters
claim_tx_hash (Union[hexbytes.main.HexBytes, str]) – Mined deposit transaction hash.
deposit_ticket (Optional[eth_defi.vault.deposit_redeem.DepositTicket]) – Unused synchronous deposit ticket.
- 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
previewDepositcall, 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
- __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
claim_tx_hash (Union[hexbytes.main.HexBytes, str]) – Mined claim, public batch, or zero-lag request.
redemption_ticket (Optional[eth_defi.vault.deposit_redeem.RedemptionTicket]) – Request whose proceeds are being recognised.
- 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
Truewhen deposits are neither paused nor configured with a zero cap.- Return type
- 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
Truewhen withdrawals are open and the owner has LP shares.- Return type
- 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
- 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
UnsupportedVaultSimulation – If the provider is not Anvil or the vault is not globally closed.
WhitelistingRequired – If the protocol admission policy excludes
owner.
- Return type
- 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
- 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
- fetch_accepted_assets()
Return every token currently accepted by the vault.
- Returns
Accepted tokens in the protocol whitelist order.
- Return type
- 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
Noneif 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
maxDepositAmountand total vault assets throughdepositCap. 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
- 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
ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Request being valued.
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 floating valuation.
- Returns
Net denomination-token value.
- Return type
- 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
- 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
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
- 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
ticket (Optional[Union[eth_defi.vault.deposit_redeem.DepositTicket, eth_defi.vault.deposit_redeem.RedemptionTicket]]) – Queued ticket, or
Nonefor a synchronous no-op.mock (Optional[object]) – Unused; real fork contracts are exercised.
ignore_liquidity (bool) – Unsupported liquidity-bypass request.
- Returns
Observed status before and after advancing local time.
- Return type
- 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_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. distinguishingreclaimablefrompending).- Parameters
ticket (eth_defi.vault.deposit_redeem.DepositTicket) –
- Return type
- get_max_deposit(owner)
How much we can deposit
- Parameters
owner (eth_typing.evm.HexAddress) –
- Return type
- 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
- 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
ticket (eth_defi.erc_4626.vault_protocol.upshift.deposit_redeem.UpshiftQueuedRedemptionTicket) – Persisted withdrawal identity.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block used consistently for all reads.
- Returns
Missing, pending, or executable claim.
- Return type
- 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
- has_synchronous_deposit()
Does this vault support synchronous deposits?
E.g. ERC-4626 vaults
- Return type
- 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
- 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
- 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
- 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 a serialised dict.
Default returns a base
DepositTicket. Subclasses override for protocol-specific ticket types.- Parameters
data (dict) –
- Return type
- 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_dataso that the settlement retry module can reconstruct the ticket after a process restart.Default implementation stores base
DepositTicketfields. Subclasses override to add protocol-specific fields (e.g.settlement_idfor Ostium,requestIdfor ERC-7540).- Parameters
ticket (eth_defi.vault.deposit_redeem.DepositTicket) –
- Return type
- 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