VaultBase
Documentation for eth_defi.vault.base.VaultBase Python class.
- class VaultBase[source]
Base class for vault protocol adapters.
Allows automated interaction with different vault protocols.
Contains various abstract methods that the implementation class must override
Supported protocols include
Lagoon Finance:
eth_defi.lagoon.vault.LagoonVault
Velvet Capital:
eth_defi.velvet.vault.VelvetVault
Code exists, but does not confirm the interface yet:
Enzyme Finance:
eth_defi.enzyme.vault.Vault
Vault covered functionality
Fetching the current balances, deposits or redemptions
Either using naive polling approach with
fetch_portfolio()
Listen to vault events for deposits and redemptions using
get_flow_manager()
- Get vault information with
fetch_info()
No standardised data structures or functions yet
- Get vault information with
- Build a swap through a vault
No standardised data structure yet
- Update vault position valuations
No standardised data structure yet
Integration check list
Integration tests needed for:
☑️ read vault core info
☑️ read vault investors
☑️ read vault share price
☑️ read vault share token
☑️ read all positions
☑️ read NAV
☑️ read pending redemptions to know how much USDC we will need for the next settlement cycles
☑️ deposit integration test
☑️ redemption integration
☑️ swap integration test
☑️ re-valuation integration test
☑️ only asset manager allowed to swap negative test
☑️ only valuation commitee allowed to update vault valuations (if applicable)
☑️ can redeem if enough USDC to settle
☑️ cannot redeem not enough USDC to settle
For code examples see tests/lagoon and tests/velvet on the Github repository.
Attributes summary
Get the token which denominates the vault valuation
Get info dictionary related to this vault deployment.
Vault name.
ERC-20 that presents vault shares.
Vault share token symbol
Methods summary
__init__
()Read denomination token from onchain.
Read vault parameters from the chain.
Fetch the most recent onchain NAV value.
fetch_portfolio
(universe[, block_identifier])Read the current token balances of a vault.
Read share token details onchain.
Get flow manager to read individial events.
Does this vault support block range-based event queries for deposits and redemptions.
Deposits go automatically to all open positions.
- abstract has_block_range_event_support()[source]
Does this vault support block range-based event queries for deposits and redemptions.
If not we use chain balance polling-based approach
- Return type
- abstract has_deposit_distribution_to_all_positions()[source]
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
- Return type
- abstract fetch_portfolio(universe, block_identifier=None)[source]
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, int]]) –
- Return type
- abstract fetch_info()[source]
Read vault parameters from the chain.
Use
info()
property for cached access.- Return type
- abstract get_flow_manager()[source]
Get flow manager to read individial events.
Only supported if
has_block_range_event_support()
is True
- Return type
- abstract fetch_denomination_token()[source]
Read denomination token from onchain.
Use
denomination_token()
for cached access.- Return type
Fetch the most recent onchain NAV value.
- Returns
Vault NAV, denominated in
denomination_token()
- Return type
- property denomination_token: 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
Read share token details onchain.
Use
share_token()
for cached access.- Return type
ERC-20 that presents vault shares.
User gets shares on deposit and burns them on redemption
- 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