erc_4626.vault_protocol.lagoon.vault
Documentation for eth_defi.erc_4626.vault_protocol.lagoon.vault Python module.
Lagoon Finance vault adapter.
The adapter detects explicit Lagoon releases through version() and falls
back to the historical pendingSilo() probe for deployments without a
version getter. Lagoon v0.6 and the characterised v1.0 deployment share the
official v0.6 read interface used here. The v1 implementation is unverified,
so compatibility is limited to the calls and storage fields covered by the
fixed-block Base integration test. Lagoon v0.5.2 keeps the v0.5.0 ABI and
storage layout, but reads its whitelist flag from storage because its
isWhitelisted(0x0) always returns True.
Deployment support remains pinned to Lagoon v0.5 artefacts. See the
official Lagoon source and the
ABI provenance in eth_defi/abi/lagoon/README.md.
Module Attributes
How much gas we use for valuation post |
|
How much gas we use for valuation post |
|
Lagoon fee rates use basis points, where 10,000 is 100%. |
|
JSON-RPC error code used for an EVM execution revert. |
|
Minimal interface for the Lagoon v0.6-compatible access-policy view. |
|
Versions handled through the observed v0.6-compatible read surface. |
|
ERC-7201 |
|
ERC-7201 |
|
ERC-7201 |
|
|
|
ABI selected after |
Classes
Mixin for Safe multisig wallets with TradingStrategyModuleV0 guard. |
|
Vault-wide Lagoon v0.6-compatible account admission mode. |
|
Read Lagoon's asynchronous deposit and redemption queues. |
|
A satellite chain deployment: Safe + TradingStrategyModuleV0, no vault contract. |
|
Python interface for interacting with Lagoon Finance vaults. |
|
Capture information about Lagoon vault deployment. |
|
Figure out Lagoon version. |
- DEFAULT_LAGOON_POST_VALUATION_GAS = 500000
How much gas we use for valuation post
- DEFAULT_LAGOON_SETTLE_GAS = 500000
How much gas we use for valuation post
- LAGOON_FEE_RATE_DENOMINATOR = 10000
Lagoon fee rates use basis points, where 10,000 is 100%.
- JSON_RPC_EXECUTION_REVERT_CODE = 3
JSON-RPC error code used for an EVM execution revert.
- LAGOON_MODERN_ACCESS_ABI = [{'inputs': [{'internalType': 'address', 'name': 'account', 'type': 'address'}], 'name': 'isAllowed', 'outputs': [{'internalType': 'bool', 'name': '', 'type': 'bool'}], 'stateMutability': 'view', 'type': 'function'}]
Minimal interface for the Lagoon v0.6-compatible access-policy view.
The canonical definition is v0.6 source. The production v1 deployment is covered only through fixed-block characterisation because its implementation source is not verified.
- class LagoonVaultInfo
Bases:
eth_defi.vault.base.VaultInfoCapture information about Lagoon vault deployment.
- asset: eth_typing.evm.HexAddress
The ERC-20 token that nominates the vault assets
- safe: eth_typing.evm.HexAddress
Lagoon vault deployment info
- whitelistManager: eth_typing.evm.HexAddress
Lagoon vault deployment info
- feeReceiver: eth_typing.evm.HexAddress
Lagoon vault deployment info
- feeRegistry: eth_typing.evm.HexAddress
Lagoon vault deployment info
- valuationManager: eth_typing.evm.HexAddress
Lagoon vault deployment info
- address: eth_typing.evm.ChecksumAddress
Safe multisig core info
- fallback_handler: eth_typing.evm.ChecksumAddress
Safe multisig core info
- guard: eth_typing.evm.ChecksumAddress
Safe multisig core info
- master_copy: eth_typing.evm.ChecksumAddress
Safe multisig core info
- modules: list[eth_typing.evm.ChecksumAddress]
Safe multisig core info
- owners: list[eth_typing.evm.ChecksumAddress]
Safe multisig core info
- __init__(*args, **kwargs)
- __new__(**kwargs)
- clear()
Remove all items from the dict.
- copy()
Return a shallow copy of the dict.
- fromkeys(value=None, /)
Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
Return the value for key if key is in the dictionary, else default.
- items()
Return a set-like object providing a view on the dict’s items.
- keys()
Return a set-like object providing a view on the dict’s keys.
- pop(k[, d]) v, remove specified key and return the corresponding value.
If the key is not found, return the default if given; otherwise, raise a KeyError.
- popitem()
Remove and return a (key, value) pair as a 2-tuple.
Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
Insert key with a value of default if key is not in the dictionary.
Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from mapping/iterable E and F.
If E is present and has a .keys() method, then does: for k in E.keys(): D[k] = E[k] If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = v In either case, this is followed by: for k in F: D[k] = F[k]
- values()
Return an object providing a view on the dict’s values.
- class LagoonAccessMode
Bases:
enum.IntEnumVault-wide Lagoon v0.6-compatible account admission mode.
- blacklist = 0
All accounts are admitted except explicitly blacklisted ones.
- whitelist = 1
Only explicitly whitelisted accounts are admitted.
- __new__(value)
- as_integer_ratio()
Return a pair of integers, whose ratio is equal to the original int.
The ratio is in lowest terms and has a positive denominator.
>>> (10).as_integer_ratio() (10, 1) >>> (-10).as_integer_ratio() (-10, 1) >>> (0).as_integer_ratio() (0, 1)
- bit_count()
Number of ones in the binary representation of the absolute value of self.
Also known as the population count.
>>> bin(13) '0b1101' >>> (13).bit_count() 3
- bit_length()
Number of bits necessary to represent self in binary.
>>> bin(37) '0b100101' >>> (37).bit_length() 6
- conjugate()
Returns self, the complex conjugate of any int.
- denominator
the denominator of a rational number in lowest terms
- from_bytes(byteorder='big', *, signed=False)
Return the integer represented by the given array of bytes.
- bytes
Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Indicates whether two’s complement is used to represent the integer.
- imag
the imaginary part of a complex number
- is_integer()
Returns True. Exists for duck type compatibility with float.is_integer.
- numerator
the numerator of a rational number in lowest terms
- real
the real part of a complex number
- to_bytes(length=1, byteorder='big', *, signed=False)
Return an array of bytes representing an integer.
- length
Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.
- byteorder
The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use sys.byteorder as the byte order value. Default is to use ‘big’.
- signed
Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.
- LAGOON_MODERN_VERSIONS: frozenset[eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVersion] = frozenset({<LagoonVersion.v_1_0_0: 'v1.0.0'>, <LagoonVersion.v_0_6_0: 'v0.6.0'>})
Versions handled through the observed v0.6-compatible read surface.
- LAGOON_MODERN_ROLES_STORAGE_SLOT = 56171925046254603780718221915926596601340548488085992443906216858980556527872
ERC-7201
hopper.storage.Rolesslot from the official Lagoon v0.6 source. https://github.com/hopperlabsxyz/lagoon-v0/blob/a8e73f5a5276aa4047b901083cbce127d7f7b470/src/v0.6.0/libraries/RolesLib.sol
- LAGOON_MODERN_ACCESS_MODE_STORAGE_SLOT = 3725904602848810341325624480888955751254706770169438487030602238178713552897
ERC-7201
hopper.storage.Whitelistableslot plus theaccessModefield’s one-slot offset in the official Lagoon v0.6 storage layout. https://github.com/hopperlabsxyz/lagoon-v0/blob/a8e73f5a5276aa4047b901083cbce127d7f7b470/src/v0.6.0/libraries/AccessableLib.sol
- LAGOON_PENDING_SILO_STORAGE_SLOT = 41819201818091943875737249405530531662094757963941566717240348073315242703368
ERC-7201
hopper.storage.ERC7540slot plus thependingSilofield’s eight-slot offset in the official Lagoon v0.6 storage layout. https://github.com/hopperlabsxyz/lagoon-v0/blob/a8e73f5a5276aa4047b901083cbce127d7f7b470/src/v0.6.0/libraries/ERC7540Lib.sol
- LAGOON_V0_5_2_WHITELIST_ACTIVATED_STORAGE_SLOT = 3725904602848810341325624480888955751254706770169438487030602238178713552897
WhitelistableStorage.isActivatedin the official Lagoon v0.5.2 storage layout: the ERC-7201hopper.storage.Whitelistableslot plus a one-slot offset after theisWhitelistedmapping. This is the same slot number asLAGOON_MODERN_ACCESS_MODE_STORAGE_SLOT, but it holds abool. https://github.com/hopperlabsxyz/lagoon-v0/blob/921c038263c51658b07b3e1877cdefd465f6b734/src/v0.5.2/Whitelistable.sol
- LAGOON_VAULT_ABI_BY_VERSION: dict[eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVersion, str] = {<LagoonVersion.legacy: 'legacy'>: 'lagoon/Vault.json', <LagoonVersion.v_0_4_0: 'v0.4.0'>: 'lagoon/v0.5.0/Vault.json', <LagoonVersion.v_0_5_0: 'v0.5.0'>: 'lagoon/v0.5.0/Vault.json', <LagoonVersion.v_0_5_2: 'v0.5.2'>: 'lagoon/v0.5.0/Vault.json', <LagoonVersion.v_0_6_0: 'v0.6.0'>: 'lagoon/v0.6.0/Vault.json', <LagoonVersion.v_1_0_0: 'v1.0.0'>: 'lagoon/v0.6.0/Vault.json'}
ABI selected after
version()detection. The adapter historically used the v0.5 ABI for v0.4. Lagoon v0.5.2 exposes every v0.5.0 ABI function and keeps the v0.5.0 storage layout. The unverified v1 deployment uses the official v0.6 ABI only as a fixed-block-tested compatibility interface.
- class AutomatedSafe
Bases:
objectMixin for Safe multisig wallets with TradingStrategyModuleV0 guard.
Provides transaction wrapping through the guard module, used by both full Lagoon vaults (
LagoonVault) and satellite Safe-only deployments (LagoonSatelliteVault).Encapsulates Safe + TradingStrategyModuleV0 interaction
Independent of vault contracts (no ERC-4626 dependency)
- Parameters
web3 – Web3 connection to the chain where the Safe is deployed.
safe_address – Address of the Gnosis Safe multisig. Can be None for
LagoonVaultwhere it is lazily resolved from the vault contract.trading_strategy_module_address – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.
- __init__(web3, safe_address=None, trading_strategy_module_address=None)
- Parameters
web3 (web3.main.Web3) – Web3 connection to the chain where the Safe is deployed.
safe_address (Optional[eth_typing.evm.HexAddress]) – Address of the Gnosis Safe multisig. Can be None for
LagoonVaultwhere it is lazily resolved from the vault contract.trading_strategy_module_address (Optional[eth_typing.evm.HexAddress]) – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.
- property safe_address: eth_typing.evm.HexAddress
Get Safe multisig contract address.
- property trading_strategy_module_address: Optional[eth_typing.evm.HexAddress]
Get TradingStrategyModuleV0 contract address.
- fetch_safe(address)
Create a Safe object from an address.
Use
safeproperty for cached access.- Parameters
address (Union[eth_typing.evm.HexAddress, str]) –
- Return type
safe_eth.safe.safe.Safe
- property safe: safe_eth.safe.safe.Safe
Get the underlying Safe object used as an API from safe-eth-py library.
Wraps Safe contract using Gnosis’s in-house library
- property safe_contract: web3.contract.contract.Contract
Safe multisig as a contract.
Interact with Safe multisig ABI
- property trading_strategy_module: web3.contract.contract.Contract
Get the TradingStrategyModuleV0 contract instance.
- fetch_trading_strategy_module_version()
Perform deployed smart contract probing.
- property trading_strategy_module_version: str
Get TradingStrategyModuleV0 contract ABI version.
Subject to change, development in progress
- transact_via_exec_module(func_call, value=0, operation=0)
Create a multisig transaction using a module.
Calls
execTransactionFromModuleon Gnosis Safe contractExecutes a transaction as a multisig
Mostly used for testing w/whitelist ignore
Warning
A special gas fix is needed, because
eth_estimateGasseems to fail for these Gnosis Safe transactions.- Parameters
func_call (web3.contract.contract.ContractFunction) – Bound smart contract function call
value (int) – ETH attached to the transaction
operation –
Gnosis enum.
Call = 0, DelegateCall = 1.
- Return type
web3.contract.contract.ContractFunction
- transact_via_trading_strategy_module(func_call, value=0, abi_version=None)
Create a Safe multisig transaction using TradingStrategyModuleV0.
- Parameters
- Returns
Bound Solidity function call you need to turn to a transaction
- Return type
web3.contract.contract.ContractFunction
- class LagoonSatelliteVault
Bases:
eth_defi.erc_4626.vault_protocol.lagoon.vault.AutomatedSafeA satellite chain deployment: Safe + TradingStrategyModuleV0, no vault contract.
Used on chains that only receive bridged assets and execute trades, without deposit/redemption infrastructure (no ERC-4626 vault).
- Parameters
web3 – Web3 connection to the chain where the Safe is deployed.
safe_address – Address of the Gnosis Safe multisig. Can be None for
LagoonVaultwhere it is lazily resolved from the vault contract.trading_strategy_module_address – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.
- __init__(web3, safe_address, trading_strategy_module_address)
- Parameters
web3 (web3.main.Web3) – Web3 connection to the chain where the Safe is deployed.
safe_address (eth_typing.evm.HexAddress) – Address of the Gnosis Safe multisig. Can be None for
LagoonVaultwhere it is lazily resolved from the vault contract.trading_strategy_module_address (eth_typing.evm.HexAddress) – Address of the TradingStrategyModuleV0 guard module enabled on the Safe.
- property web3: web3.main.Web3
Get Web3 connection for this satellite chain.
- fetch_safe(address)
Create a Safe object from an address.
Use
safeproperty for cached access.- Parameters
address (Union[eth_typing.evm.HexAddress, str]) –
- Return type
safe_eth.safe.safe.Safe
- fetch_trading_strategy_module_version()
Perform deployed smart contract probing.
- property safe: safe_eth.safe.safe.Safe
Get the underlying Safe object used as an API from safe-eth-py library.
Wraps Safe contract using Gnosis’s in-house library
- property safe_address: eth_typing.evm.HexAddress
Get Safe multisig contract address.
- property safe_contract: web3.contract.contract.Contract
Safe multisig as a contract.
Interact with Safe multisig ABI
- property trading_strategy_module: web3.contract.contract.Contract
Get the TradingStrategyModuleV0 contract instance.
- property trading_strategy_module_address: Optional[eth_typing.evm.HexAddress]
Get TradingStrategyModuleV0 contract address.
- property trading_strategy_module_version: str
Get TradingStrategyModuleV0 contract ABI version.
Subject to change, development in progress
- transact_via_exec_module(func_call, value=0, operation=0)
Create a multisig transaction using a module.
Calls
execTransactionFromModuleon Gnosis Safe contractExecutes a transaction as a multisig
Mostly used for testing w/whitelist ignore
Warning
A special gas fix is needed, because
eth_estimateGasseems to fail for these Gnosis Safe transactions.- Parameters
func_call (web3.contract.contract.ContractFunction) – Bound smart contract function call
value (int) – ETH attached to the transaction
operation –
Gnosis enum.
Call = 0, DelegateCall = 1.
- Return type
web3.contract.contract.ContractFunction
- transact_via_trading_strategy_module(func_call, value=0, abi_version=None)
Create a Safe multisig transaction using TradingStrategyModuleV0.
- Parameters
- Returns
Bound Solidity function call you need to turn to a transaction
- Return type
web3.contract.contract.ContractFunction
- class LagoonVault
Bases:
eth_defi.erc_7540.vault.ERC7540Vault,eth_defi.erc_4626.vault_protocol.lagoon.vault.AutomatedSafePython interface for interacting with Lagoon Finance vaults.
Lagoon separates managed assets in a Safe from asynchronous requests held by a pending Silo. The Silo’s denomination-token balance represents pending deposits, while its vault-share balance represents pending redemptions. Settlements publish a new total-asset valuation and process queued requests.
See
VaultBasefor the common vault API and ERC-7540 for the asynchronous request lifecycle.- Parameters
spec – Address must be Lagoon vault address (not Safe address)
trading_strategy_module_address –
TradingStrategyModuleV0 enabled on Safe for automated trading.
If not given, not known.
vault_abi –
ABI filename we use.
Lagoon has different versions.
None = autodetect.
default_block_identifier –
Override block identifier for on-chain metadata reads.
See
ERC4626Vaultfor details.
- __init__(web3, spec, trading_strategy_module_address=None, token_cache=None, vault_abi=None, features=None, default_block_identifier=None, **kwargs)
- Parameters
spec (eth_defi.vault.base.VaultSpec) – Address must be Lagoon vault address (not Safe address)
trading_strategy_module_address (Optional[eth_typing.evm.HexAddress]) –
TradingStrategyModuleV0 enabled on Safe for automated trading.
If not given, not known.
ABI filename we use.
Lagoon has different versions.
None = autodetect.
default_block_identifier (Optional[Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]]) –
Override block identifier for on-chain metadata reads.
See
ERC4626Vaultfor details.web3 (web3.main.Web3) –
features (Optional[set[eth_defi.erc_4626.core.ERC4626Feature]]) –
- get_strategy_tags()
Return the maintained strategy tags for this Lagoon vault.
Lagoon supports independently managed vaults with different mandates, so classifications are maintained per vault contract address. A small chain-specific override table handles addresses reused by unrelated deployments on different chains.
- Returns
Copy of the tag set, or
Nonewhen this deployment has not been classified.- Return type
- fetch_version()
Read and classify the deployed Lagoon version.
Explicit version strings are mapped through
LagoonVersion. Deployments withoutversion()retain the historicalpendingSilo()probe: a successful call is legacy, while an empty revert identifies the v0.5-compatible family.Both probes use
default_block_identifierwhen supplied so proxy upgrades cannot mix current and historical state.- Returns
Supported Lagoon version family.
- Raises
NotImplementedError – If
version()returns a release this adapter does not support.- Return type
- check_version_compatibility()
Throw if there is mismatch between ABI and contract exposed EVM calls
- property version: eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVersion
Return the cached deployed Lagoon version.
The first access performs the network probes in
fetch_version(); subsequent accesses reuse the result.- Returns
Supported Lagoon version family.
- property lagoon_metadata: Optional[eth_defi.erc_4626.vault_protocol.lagoon.offchain_metadata.LagoonVaultMetadata]
Offchain metadata from Lagoon’s web app API.
Fetched from
app.lagoon.finance/api/vaultendpointCached on first access
Returns None if vault is not in Lagoon’s app database
- property description: Optional[str]
Return Lagoon’s full strategy description as single-line text.
Clean cached metadata on access as well as newly fetched API text.
- Returns
Full description without line breaks, or
Nonewhen unavailable.
- property short_description: Optional[str]
Return only the first sentence of Lagoon’s summary on one line.
Lagoon’s summary field may contain several sentences copied from the provider. Clean cached metadata as well as newly fetched API text.
- Returns
First summary sentence, or
Nonewhen unavailable.
- get_flags()
Get vault flags, auto-flagging vaults missing from Lagoon’s frontend.
If the vault has no metadata in Lagoon’s API, it is flagged as
unofficialReviewed private deployments can bypass this dynamic flag through an explicit chain-address allowlist
Manual flags from
VAULT_FLAGS_AND_NOTEStake precedence
- Return type
- get_notes()
Get notes for this vault.
Returns manual notes from the vault flags if set
If vault is missing from Lagoon’s frontend, returns the missing note
Otherwise falls back to the full description from Lagoon’s offchain metadata
- get_withdrawal_period()
Return Lagoon’s non-binding curator settlement estimate for backtesting.
Lagoon redemptions follow the asynchronous ERC-7540 lifecycle: a request is only claimable after the curator posts a valuation and the Safe settles the batch. The contracts do not impose a time-bound settlement deadline.
The official Lagoon app supplies
averageSettlementin its offchain vault metadata. It describes the curator’s estimated cadence for deposit and redemption settlement cycles, not a contractual promise. A curator may settle earlier, later, or not at all. Therefore the bindingmin_periodandmax_periodfields areNoneand onlyestimated_settlementis populated for backtesting.- Returns
Asynchronous withdrawal metadata with an offchain settlement estimate, or
Noneif Lagoon has no valid estimate for the vault.- Return type
- property vault_contract: web3.contract.contract.Contract
Get vault deployment.
- property whitelist_contract: web3.contract.contract.Contract
Get the stable whitelist interface at the vault address.
Lagoon’s version-specific vault ABIs do not consistently include the inherited whitelist views. The shared interface contains both selectors and can be safely bound to every Lagoon vault deployment. Unsupported selectors are translated to
NotImplementedErrorby the public accessors below.
- property access_contract: web3.contract.contract.Contract
Bind the v0.6-compatible
isAllowed(address)interface.Lagoon v0.6 replaced
Whitelistablewith the canonical Accessable contract. The characterised v1 deployment exposes the same selector. Its implementation is unverified, so the adapter does not infer any wider v1 access-control guarantees from this compatibility call.- Returns
Contract proxy exposing
isAllowed(address).
- is_whitelisted_deposit()
Determine whether a Lagoon vault uses whitelist-mode deposits.
Lagoon released
isWhitelistActivated()in v0.3.0 and retained it in the canonical v0.4.0 Whitelistable source. The getter was removed from the v0.5.0 Whitelistable source, despiteisWhitelisted(address)remaining available. For v0.5 deployments only, use the zero-address sentinel: itsFalseresult means whitelist enforcement is active, whileTruemeans deposits are permissionless. This follows the v0.5 implementation’sisWhitelistedbranch for a disabled whitelist.The v0.5.2 Whitelistable source makes
isWhitelisted(0x0)unconditionallyTrue, which would misreport every v0.5.2 vault as permissionless. For v0.5.2 the adapter instead readsWhitelistableStorage.isActivateddirectly from its unchanged ERC-7201 storage slot.Lagoon v0.6 replaces
Whitelistablewith an access layer supporting whitelist mode, blacklist mode and an external sanctions oracle. The adapter reads the canonical AccessableStorage.accessMode field directly.isAllowed(0x0)is not a valid mode sentinel because the AccessableLib.isAllowed implementation grants unconditional access to the configured protocol fee receiver and super operator, either of which can be the zero address. The v1 route uses only fixed-block-characterised storage compatibility, not verified v1 source. Individual account admission must still be checked because a blacklist-mode account may be denied.- Returns
Truewhen the vault uses whitelist mode.- Raises
NotImplementedError – If the deployed Lagoon version exposes neither the policy getter nor its version-specific account-access fallback.
- Return type
- is_account_whitelisted(address)
Determine whether an account passes Lagoon’s versioned access view.
In the versioned v0.5 implementation, the canonical isWhitelisted source returns
Truefor every account when the whitelist is disabled and returns mapping membership when it is active. Thus this probe is a reliable whitelist-admission result even where the v0.5 deployment lacksisWhitelistActivated(). It does not establish allowance, capacity, pause state, or an open ERC-7540 request window.Lagoon v0.6 instead calls
isAllowed(address). The canonical versioned AccessableLib implementation combines whitelist or blacklist mode with an optional external sanctions oracle. Thus this method’s historical name means “admitted by Lagoon’s access policy” for the v0.6-compatible route. The v1 implementation is unverified and is supported only to the extent covered by the fixed-block integration test.- Parameters
address (eth_typing.evm.HexAddress) – Account whose access status is queried.
- Returns
Truewhen Lagoon’s versioned access policy accepts the account.- Raises
NotImplementedError – If the deployed Lagoon version does not expose its expected access getter.
- Return type
- has_block_range_event_support()
Does this vault support block range-based event queries for deposits and redemptions.
If not we use chain balance polling-based approach
- has_deposit_distribution_to_all_positions()
Deposits go automatically to all open positions.
Deposits do not land into the vault as cash
Instead, smart contracts automatically increase all open positions
The behaviour of Velvet Capital
- get_flow_manager()
Get flow manager to read indiviaul settle events.
Only supported if
has_block_range_event_support()is True
- fetch_vault_info()
Get all information we can extract from the vault smart contracts.
- Return type
- fetch_info()
Use
info()property for cached access.- Returns
See
LagoonVaultInfo- Return type
eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVaultInfo
- property safe_address: eth_typing.evm.HexAddress
Get Safe multisig contract address
- property safe: safe_eth.safe.safe.Safe
Get the underlying Safe object used as an API from safe-eth-py library.
Warps Safe Contract using Gnosis’s in-house library
- property safe_contract: web3.contract.contract.Contract
Safe multisig as a contract.
Interact with Safe multisig ABI
- property valuation_manager: eth_typing.evm.HexAddress
Valuation manager role on the vault.
- property silo_address: eth_typing.evm.HexAddress
Return the pending Silo contract address.
Legacy vaults expose
pendingSilo()directly. Versioned deployments use the storage slot documented by the official v0.6 ERC7540Lib source. The v1 path is restricted to the storage field characterised by the fixed-block production test.- Returns
Checksummed Silo contract address.
- property silo_contract: web3.contract.contract.Contract
Pending Silo contract.
This contract does not have any functionality, but stores deposits (pending USDC) and redemptions (pending share token)
- post_new_valuation(total_valuation)
Update the valuations of this vault.
Lagoon vault does not currently track individual positions, but takes a “total value” number
Updating this number also allows deposits and redemptions to proceed
Notes:
How can I post a valuation commitee update 1. as the valuationManager, call the function updateNewTotalAssets(_newTotalAssets) _newTotalAssets being expressed in underlying in its smallest unit for usdc, it would with its 6 decimals. Do not take into account requestDeposit and requestRedeem in your valuation
as the safe, call the function settleDeposit()
- Parameters
total_valuation (decimal.Decimal) – The vault value nominated in
denomination_token().- Returns
Bound contract function that can be turned to a transaction
- Return type
web3.contract.contract.ContractFunction
- settle_via_trading_strategy_module(valuation=None, abi_version=None)
Settle the new valuation and deposits.
settleDeposit will also settle the redeems request if possible. If there are enough assets in the safe it will settleRedeem It there are not enough assets, it will only settleDeposit.
if there is nothing to settle: no deposit and redeem requests you can still call settleDeposit/settleRedeem to validate the new nav
If there is not enough USDC to redeem, the transaction will revert
- Parameters
raw_amount – Needed in Lagoon v0.5+
valuation (Optional[decimal.Decimal]) –
- Return type
web3.contract.contract.ContractFunction
- post_valuation_and_settle(valuation, asset_manager, gas=1000000)
Do both new valuation and settle.
Quickhand method for asset_manager code
Only after this we can read back
Broadcasts two transactions and waits for the confirmation
If there is not enough USDC to redeem, the second transaction will fail with revert
- Returns
The transaction hash of the settlement transaction
- Parameters
valuation (decimal.Decimal) –
asset_manager (eth_typing.evm.HexAddress) –
- Return type
hexbytes.main.HexBytes
- get_management_fee(block_identifier)
Get the Lagoon management fee as a fraction from zero to one.
- get_performance_fee(block_identifier)
Get the Lagoon performance fee as a fraction from zero to one.
- get_deposit_fee(block_identifier)
Get the modern Lagoon entry fee as a fraction from 0 to 1.
Lagoon v0.6 returns the entry rate in basis points, and the fixed-block v1 deployment exposes the same field. Older versions do not expose it and retain the generic zero-fee behaviour.
- get_withdraw_fee(block_identifier)
Get the modern Lagoon exit fee as a fraction from 0 to 1.
Lagoon v0.6 exposes a separate haircut rate for synchronous redemption, so it is intentionally not folded into this asynchronous exit fee. The fixed-block v1 deployment exposes the same two fields.
- get_fee_data()
Read all Lagoon fee fields at the adapter’s selected block.
Lagoon exposes the generic fee fields in one
feeRates()call. Read that tuple once so fixed-block scans cannot mix historical vault state with current fee state and ordinary scans avoid duplicate RPC calls.- Returns
Normalised management, performance, deposit and withdrawal fees.
- Return type
- has_custom_fees()
Return whether Lagoon exposes a fee outside the generic fee model.
The generic vault model has no field for Lagoon v0.6’s synchronous redemption haircut. The characterised v1 deployment exposes the same fifth rate, so a non-zero value is reported as a custom fee.
- Returns
Truewhen the modern haircut rate is non-zero.- Return type
- is_trading_strategy_module_enabled()
Check if TradingStrategyModuleV0 is enabled on the Safe multisig.
- Return type
- get_deposit_manager()
Create Lagoon’s ERC-7540 deposit manager.
Lagoon uses the generic ERC-7540 lifecycle with protocol-specific access-policy checks and an Anvil settlement driver.
- Returns
Lagoon-specific extension of the generic ERC-7540 manager.
- Return type
- get_deposit_manager_capability()
Declare Lagoon’s asynchronously settleable manager lifecycle.
Lagoon accepts the standard ERC-7540 request types and its selected manager can force-settle both ticket directions on Anvil.
Note
Trade-executor may call
force_settle()for a full-lifecycle simulation only when this capability flag is true and it holds the matching ERC-7540 request ticket. Request-only behaviour remains unchanged.- Returns
Two-way asynchronous capability with Anvil settlement support.
- Return type
- can_check_deposit()
Lagoon’s maxDeposit does not work correctly for deposit availability checks.
- Return type
- get_link(referral=None)
Get a link to the vault dashboard on its native site.
By default, give RouteScan link
- property address: eth_typing.evm.HexAddress
Get the vault smart contract address.
- can_check_redeem()
Check if maxRedeem(address(0)) can be used to check global redemption availability.
Most protocols return 0 for maxRedeem(address(0)) because that address has no balance/shares, not because redemptions are closed:
Gearbox: maxRedeem returns min(balanceOf(owner), convertToShares(availableLiquidity))
Most vaults: Return 0 because address(0) has no shares
Some protocols do use maxRedeem(address(0)) meaningfully:
Morpho, IPOR, Plutus: Return 0 when redemptions are globally blocked
Override to return True in subclasses that support address(0) redemption checks.
- Returns
True if maxRedeem(address(0)) returns meaningful values for global redemption availability checking.
- Return type
- property denomination_token: Optional[eth_defi.token.TokenDetails]
Get the token which denominates the vault valuation
Used in deposits and redemptions
Used in NAV calculation
Used in profit benchmarks
Usually USDC
- Returns
Token wrapper instance.
Maybe None for broken vaults like https://arbiscan.io/address/0x9d0fbc852deccb7dcdd6cb224fa7561efda74411#code
Note
Noneresults are not cached — the next access will retry the on-chain call. This avoids permanently caching a transient RPC failure.
- property deposit_manager: eth_defi.vault.deposit_redeem.VaultDepositManager
Deposit manager assocaited with this vault
- property erc_7540: bool
Is this ERC-7540 vault with asynchronous deposits.
For example
previewDeposit()function and other functions will revert
- fetch_available_liquidity(block_identifier='latest')
Read the adapter’s available denomination-token liquidity.
Single-market adapters report market liquidity. Multi-market adapters such as Morpho and IPOR currently report idle vault assets, which can understate redeemable liquidity in their underlying markets. A user’s withdrawal can also be limited by share ownership or protocol restrictions. Non-lending adapters should leave this method unimplemented.
maxRedeem(address(0))cannot measure market-wide liquidity because ERC-4626 caps redemptions by the owner’s share balance. The zero address normally holds no shares, so a zero result says nothing about liquidity.- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block to query. Defaults to “latest”.
- Raises
NotImplementedError – For non-lending protocol vaults.
- Returns
Amount in denomination token units (human-readable Decimal).
- Return type
- fetch_denomination_token()
Read denomination token from onchain.
Use
denomination_token()for cached access.- Return type
- fetch_denomination_token_address()
Get the
asset()denomination token address of this vault.Results are disk-cached per
(chain_id, vault_address)viaeth_defi.erc_4626.vault_tokenwhen the vault was constructed with aeth_defi.token.TokenDiskCacheand no pinneddefault_block_identifier. Current mappings expire after seven days because proxy upgrades may change relationships. These entries are not evidence of a token relationship at an arbitrary historical block.Only a definitive non-null answer is persisted. The
Nonepath taken on revert / broken contract is never cached, matching the behaviour ofeth_defi.vault.base.VaultBase.denomination_token()which explicitly avoids memoisingNoneso transient failures can be retried.To disable the cache, pass
token_cache=None(or any non-TokenDiskCachedict) when constructing the vault, or construct with a pinneddefault_block_identifier.- Returns
Denomination token address, or
Noneif the vault contract is broken and did not return a valid address.- Return type
- fetch_deposit_closed_reason()
Check if deposits are closed using maxDeposit(address(0)).
Uses the ERC-4626 standard maxDeposit function to determine if deposits are available. Returns a human-readable reason with the max deposit amount if deposits are restricted.
- fetch_deposit_next_open()
Get when deposits will next be open.
For epoch-based vaults (Ostium, D2), return calculated window open time
For non-epoch vaults (Plutus, IPOR, Morpho), return None
Override in protocol-specific subclasses
- Returns
Naive UTC datetime when deposits will next be available, or None if:
Deposits are currently open
Timing is unpredictable (manually controlled)
Protocol does not support timing information
- Return type
- fetch_deposit_open()
Fetch the current protocol-defined deposit availability.
This is deliberately a tri-state value.
TrueandFalsemean that the adapter read an authoritative vault-wide state;Nonemeans that the generic adapter cannot safely determine the state. It is separate fromfetch_deposit_closed_reason(), because an absent human-readable reason does not prove that deposits are open.
- fetch_idle_lending_snapshot(total_assets, block_identifier)
Read the idle balance once for adapters with idle-based utilisation.
This helper is opt-in: idle assets are not redeemable liquidity for every lending protocol. See the protocol’s liquidity documentation.
Morpho v1/v2 and IPOR metadata call this after reading total assets, avoiding duplicate idle-balance reads for liquidity and utilisation. Reuse the exact raw assets only when their source block and decimal value match; converting an externally supplied Decimal back to raw units is a fallback for callers that did not first fetch assets through this adapter.
- Parameters
total_assets (decimal.Decimal) – Previously fetched TVL in denomination-token units.
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]) – Numeric block used for both economic inputs.
- Returns
(idle_liquidity, utilisation): a Decimal balance in denomination token units and the unclamped fraction of total assets allocated. Both members are None when the denomination token is unavailable; zero total assets produces zero utilisation.- Return type
tuple[decimal.Decimal | None, float | None]
- fetch_minimum_deposit(block_identifier='latest')
Fetch a source-proven minimum deposit in decimal token units.
A
Noneresult means this adapter does not expose a known minimum; it does not prove the protocol accepts arbitrarily small deposits. A zero result means the adapter positively established that the vault has no minimum deposit.- Parameters
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 protocol configuration.
- Returns
Decimal denomination-token minimum, or
Nonewhen unknown.- Return type
- fetch_minimum_redemption(block_identifier='latest')
Fetch a source-proven redemption minimum in decimal share units.
A
Noneresult means this adapter does not expose a known minimum; it does not prove the protocol accepts arbitrarily small redemptions. A zero result means the adapter positively established that the vault has no minimum redemption.- Parameters
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 protocol configuration.
- Returns
Decimal vault-share minimum, or
Nonewhen unknown.- Return type
Fetch the most recent onchain NAV value.
In the case of Lagoon, this is the last value written in the contract with updateNewTotalAssets() and ` settleDeposit()`
TODO: updateNewTotalAssets() there is no way to read pending asset update on chain
- Returns
Vault NAV, denominated in
denomination_token()- Return type
- fetch_portfolio(universe, block_identifier=None, allow_fallback=True)
Read the current token balances of a vault.
SHould be supported by all implementations
- Parameters
universe (eth_defi.vault.base.TradingUniverse) –
block_identifier (Optional[Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]]) –
allow_fallback (bool) –
- Return type
- fetch_redemption_closed_reason()
Check if redemptions are closed using maxRedeem(address(0)).
Only works for protocols that implement maxRedeem in a way that returns meaningful values for address(0). Most protocols return 0 because address(0) has no shares, not because redemptions are closed.
- fetch_redemption_next_open()
Get when withdrawals/redemptions will next be open.
For epoch-based vaults (Ostium, D2), return calculated window open time
For non-epoch vaults (Plutus, IPOR, Morpho), return None
Override in protocol-specific subclasses
- Returns
Naive UTC datetime when withdrawals will next be available, or None if:
Withdrawals are currently open
Timing is unpredictable (manually controlled)
Protocol does not support timing information
- Return type
- fetch_safe(address)
Create a Safe object from an address.
Use
safeproperty for cached access.- Parameters
address (Union[eth_typing.evm.HexAddress, str]) –
- Return type
safe_eth.safe.safe.Safe
- fetch_scan_record_extra_data()
Fetch protocol-specific private scan row columns.
Some vault protocols expose structured metadata that is useful for the raw scanner output but does not fit the shared human-readable columns. Override this hook in protocol-specific subclasses instead of adding a separate branch to
eth_defi.erc_4626.scan.create_vault_scan_record().
Get the current share price.
Read share token details onchain.
Use
share_token()for cached access.- Return type
Get share token of this vault.
Vault itself (ERC-4626)
share()accessor (ERC-7575)
Results are disk-cached per
(chain_id, vault_address)viaeth_defi.erc_4626.vault_tokenwhen the vault was constructed with aeth_defi.token.TokenDiskCache. Under normal circumstances live reads reuse the current relationship until its seven-day deadline. Explicit historical reads bypass this disk cache because ERC-7575 relationships may change through proxy upgrades.Only a definitive answer from the chain is ever persisted: a successful call, or a revert matching
KNOWN_SHARE_TOKEN_ERROR_MESSAGES(which positively classifies the contract as non-ERC-7575). Transient RPC failures (ProbablyNodeHasNoBlock, HTTP 502) fall back toself.vault_addressbut are not written to the cache, so a flaky node cannot poison a real ERC-7575 vault’s entry.To disable the cache, pass
token_cache=None(or any non-TokenDiskCachedict) when constructing the vault, or construct with a pinneddefault_block_identifierto force the uncached historical-read path on every call.- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]) – Block to query. Cache is only consulted/written when the caller passes the default
"latest"and the vault instance has no pinneddefault_block_identifier.- Return type
- fetch_total_assets(block_identifier)
What is the total NAV of the vault.
Example:
assert vault.denomination_token.symbol == "USDC" assert vault.share_token.symbol == "ipUSDCfusion" assert vault.fetch_total_assets(block_identifier=test_block_number) == Decimal("1437072.77357") assert vault.fetch_total_supply(block_identifier=test_block_number) == Decimal("1390401.22652875")
- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]) –
Block number to read.
Use web3.eth.block_number for the last block.
- Returns
The vault value in underlyinh token
- Return type
- fetch_total_supply(block_identifier)
What is the current outstanding shares.
Example:
- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, hexbytes.main.HexBytes, int]) –
Block number to read.
Use web3.eth.block_number for the last block.
- Returns
The vault value in underlyinh token
- Return type
- fetch_trading_strategy_module_version()
Perform deployed smart contract probing.
- fetch_utilisation_percent(block_identifier='latest')
Read the adapter’s lending or capital-deployment utilisation.
Single-market adapters measure borrower utilisation. Multi-market adapters such as Morpho and IPOR currently measure allocation outside the vault, rather than aggregate utilisation by underlying borrowers. Non-lending adapters should leave this method unimplemented.
- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block to query. Defaults to “latest”.
- Raises
NotImplementedError – For non-lending protocol vaults.
- Returns
Utilisation as float between 0.0 and 1.0 (0% to 100%).
- Return type
- finalise_deposit(depositor, raw_amount=None)
Build the transaction that claims settled deposit shares.
This is phase two of an asynchronous deposit. The three-argument ERC-7540
deposit(assets, receiver, controller)call usesdepositoras both receiver and controller.- Parameters
depositor (eth_typing.evm.HexAddress) – Request controller and share receiver.
raw_amount (Optional[int]) – Settled underlying assets to claim. When omitted, use
maxDeposit(depositor).
- Returns
Bound ERC-7540 deposit-claim function.
- Return type
web3.contract.contract.ContractFunction
- finalise_redeem(depositor, raw_amount=None)
Build the transaction that claims settled redemption assets.
This is phase two of an asynchronous redemption. The three-argument ERC-7540
redeem(shares, receiver, controller)call usesdepositoras both receiver and controller.- Parameters
depositor (eth_typing.evm.HexAddress) – Request controller and underlying-token receiver.
raw_amount (Optional[int]) – Settled shares to claim in raw units. When omitted, use
maxRedeem(depositor).
- Returns
Bound ERC-7540 redemption-claim function.
- Return type
web3.contract.contract.ContractFunction
- property flow_manager: eth_defi.vault.base.VaultFlowManager
Flow manager associated with this vault
- get_estimated_lock_up()
Return an unknown operator-controlled ERC-7540 lock-up.
ERC-7540 standardises request state, but not the operator’s settlement schedule. A generic adapter therefore cannot provide a duration.
- Returns
Nonebecause no generic lock-up estimate exists.- Return type
- get_fee_mode()
Get how this vault accounts its fees.
- Return type
- get_historical_reader(stateful)
Get share price reader to fetch historical returns.
- Parameters
stateful – If True, use a stateful reading strategy.
- Returns
None if unsupported
- Return type
- get_risk()
Get risk profile of this vault.
- Return type
Return the standard ERC-4626 share-price source.
ERC-4626 prices are calculated from vault accounting values read at a specific block, including protocol-specific overrides that expose the same state through another contract view.
- Returns
Smart-contract state source.
- Return type
- get_synchronous_deposit_manager_capability()
Build static metadata for a verified synchronous manager.
A caller must already have established the reader class’ guarded fork evidence. This deliberately performs no RPC reads: the capability is static library metadata, not a live vault availability check.
- Returns
Synchronous two-way capability.
- Return type
- get_whitelist_notes()
Return an export caveat for the vault-wide whitelist status.
Adapters may attach a concise, stable explanation when a classification is an explicitly requested operating assumption or excludes an integration-specific permission mechanism. The note describes the policy classification only; it must not be used to report temporary deposit availability.
- property info: eth_defi.vault.base.VaultInfo
Get info dictionary related to this vault deployment.
Get cached data on the various vault parameters
- Returns
Vault protocol specific information dictionary
- is_valid()
Check if this vault is valid.
Call a known smart contract function to verify the function exists
- Return type
- request_deposit(depositor, raw_amount, check_allowance=True, check_balance=True)
Build a deposit transaction.
This is phase one of the asynchronous ERC-7540 flow. The depositor must hold enough underlying tokens and approve the vault unless the corresponding checks are disabled.
Note
Legacy. Use
get_deposit_manager()instead.- Parameters
depositor (eth_typing.evm.HexAddress) – Token owner and request controller.
raw_amount (int) – Underlying-token amount in raw units.
check_allowance – Check that the vault can transfer
raw_amountfrom the depositor.check_balance – Check that the depositor owns at least
raw_amount.
- Returns
Bound
requestDepositcontract function.- Return type
web3.contract.contract.ContractFunction
- request_redeem(depositor, raw_amount, check_enough_token=True)
Build a redemption-request transaction.
This is phase one of the asynchronous ERC-7540 redemption flow. The depositor acts as both owner and controller.
- Parameters
depositor (eth_typing.evm.HexAddress) – Share owner and request controller.
raw_amount (int) – Vault shares to redeem in raw units.
check_enough_token (bool) – Whether to verify the depositor’s current share balance. Disable only when reconstructing an already-broadcast request.
- Returns
Bound
requestRedeemcontract function.- Return type
web3.contract.contract.ContractFunction
ERC-20 that presents vault shares.
User gets shares on deposit and burns them on redemption
- supports_generic_deposit_manager()
Check whether the live vault exposes the standard ERC-4626 surface.
This is deliberately an interface check, not a public support claim. Callers must still execute a guarded fork probe before relying on the generic manager for a protocol-specific adapter.
- Returns
Truewhenassetsucceeds with a non-zero asset address. Deposit and redemption availability is established only by a guarded fork transaction, not by ERC-4626max*advisory values.- Return type
- property trading_strategy_module: web3.contract.contract.Contract
Get the TradingStrategyModuleV0 contract instance.
- property trading_strategy_module_address: Optional[eth_typing.evm.HexAddress]
Get TradingStrategyModuleV0 contract address.
- property trading_strategy_module_version: str
Get TradingStrategyModuleV0 contract ABI version.
Subject to change, development in progress
- transact_via_exec_module(func_call, value=0, operation=0)
Create a multisig transaction using a module.
Calls
execTransactionFromModuleon Gnosis Safe contractExecutes a transaction as a multisig
Mostly used for testing w/whitelist ignore
Warning
A special gas fix is needed, because
eth_estimateGasseems to fail for these Gnosis Safe transactions.- Parameters
func_call (web3.contract.contract.ContractFunction) – Bound smart contract function call
value (int) – ETH attached to the transaction
operation –
Gnosis enum.
Call = 0, DelegateCall = 1.
- Return type
web3.contract.contract.ContractFunction
- transact_via_trading_strategy_module(func_call, value=0, abi_version=None)
Create a Safe multisig transaction using TradingStrategyModuleV0.
- Parameters
- Returns
Bound Solidity function call you need to turn to a transaction
- Return type
web3.contract.contract.ContractFunction
- property underlying_token: eth_defi.token.TokenDetails
Alias for
denomination_token()
- class LagoonFlowManager
Bases:
eth_defi.vault.base.VaultFlowManagerRead Lagoon’s asynchronous deposit and redemption queues.
Lagoon follows the ERC-7540 request-settle-claim lifecycle. Pending deposits are the Silo’s denomination-token balance and pending redemptions are its vault-share balance.
- __init__(vault)
- Parameters
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) –
- Return type
None
- fetch_pending_redemption(block_identifier)
Get how much users want to redeem from the vault.
- Parameters
block_identifier (Union[Literal['latest', 'earliest', 'pending', 'safe', 'finalized'], eth_typing.evm.BlockNumber, eth_typing.evm.Hash32, eth_typing.encoding.HexStr, int]) – Block number
- Returns
Number of share tokens the users want to redeem from the vault.
Shares must be valued separately.
- Return type
- fetch_pending_deposit(block_identifier)
Get how much users want to redeem from the vault.
- fetch_pending_deposit_events(range)
Read incoming pending deposits.
- Parameters
range (Tuple[eth_typing.evm.BlockNumber, eth_typing.evm.BlockNumber]) –
- Return type
None
- fetch_pending_redemption_event(range)
Read outgoing pending withdraws.
- Parameters
range (Tuple[eth_typing.evm.BlockNumber, eth_typing.evm.BlockNumber]) –
- Return type
None
- fetch_processed_deposit_event(range)
Read incoming pending deposits.
- Parameters
range (Tuple[eth_typing.evm.BlockNumber, eth_typing.evm.BlockNumber]) –
- Return type
None
- fetch_processed_redemption_event(vault, range)
Read outgoing pending withdraws.
- Parameters
vault (eth_defi.vault.base.VaultSpec) –
range (Tuple[eth_typing.evm.BlockNumber, eth_typing.evm.BlockNumber]) –
- Return type
None
- calculate_underlying_needed_for_redemptions(block_identifier)
How much underlying token (USDC) we are going to need on the next redemption cycle.
Computed as
pendingRedemptionShares * sharePrice.Warning
This returns a human-readable
decimal.Decimaldenomination amount, not a raw integer token amount. Callers must convert withdenomination_token.convert_to_raw()before comparing against raw balances (e.g. the Anvil settlement top-up inLagoonDepositManager._provision_safe_for_settlement()depends on this). Do not “fix” this to return raw units without updating those callers.
- get_estimated_lock_up()
Return Lagoon’s legacy offchain settlement estimate.
The structured
LagoonVault.get_withdrawal_period()accessor is the source of truth. This compatibility accessor retains the estimate for callers that still use the older flow-manager API.- Returns
Non-binding expected settlement cadence, or
Nonewhen the curator has not supplied a valid estimate.- Return type