VelvetVault
Documentation for eth_defi.velvet.vault.VelvetVault Python class.
- class VelvetVault[source]
Python interface for interacting with Velvet Capital vaults.
Attributes summary
chain_id
denomination_token
Get the token which denominates the vault valuation
deposit_manager_address
Get info dictionary related to this vault deployment.
Vault name.
owner_address
portfolio_address
portfolio_contract
rebalance_address
share_token
ERC-20 that presents vault shares.
Vault share token symbol
token_symbol
vault_address
withdraw_manager_address
Methods summary
__init__
(web3, spec[, api_url])- param spec
Check that we have connected to a proper Velvet capital vault contract, not wrong contract.
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.
prepare_deposit_with_enso
(from_, ...)Prepare a deposit transaction with Enso intents.
prepare_redemption
(from_, amount, ...)Perform a redemption.
prepare_swap_with_enso
(token_in, token_out, ...)Prepare a swap transaction using Enso intent engine and Vevlet API.
- __init__(web3, spec, api_url='https://eventsapi.velvetdao.xyz/api/v3')[source]
- Parameters
spec (eth_defi.vault.base.VaultSpec) – Address must be Velvet portfolio address (not vault address)
web3 (web3.main.Web3) –
api_url (str) –
- 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
- 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
- get_flow_manager()[source]
Get flow manager to read individial events.
Only supported if
has_block_range_event_support()
is True
- check_valid_contract()[source]
Check that we have connected to a proper Velvet capital vault contract, not wrong contract.
- Raises
AssertionError – Looks bad
- property info: eth_defi.velvet.vault.VelvetVaultInfo
Get info dictionary related to this vault deployment.
Get cached data on the various vault parameters
- Returns
Vault protocol specific information dictionary
- 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
- prepare_swap_with_enso(token_in, token_out, swap_amount, slippage, remaining_tokens, swap_all=False, from_=None, retries=5, manage_token_list=True, swap_all_tripwire_pct=0.01)[source]
Prepare a swap transaction using Enso intent engine and Vevlet API.
- Parameters
from –
Fill int the from field for the tx data.
Used with Anvil and unlocked accounts.
token_in (Union[eth_typing.evm.HexAddress, str]) –
token_out (Union[eth_typing.evm.HexAddress, str]) –
swap_amount (int) –
slippage (float) –
from_ (Optional[Union[eth_typing.evm.HexAddress, str]]) –
- Return type
- prepare_deposit_with_enso(from_, deposit_token_address, amount, slippage)[source]
Prepare a deposit transaction with Enso intents.
Velvet trades any incoming assets and distributes them on open positions
- Returns
Ethereum transaction payload
- Parameters
from_ (Union[eth_typing.evm.HexAddress, str]) –
deposit_token_address (Union[eth_typing.evm.HexAddress, str]) –
amount (int) –
slippage (float) –
- Return type
- prepare_redemption(from_, amount, withdraw_token_address, slippage)[source]
Perform a redemption.
- Returns
Ethereum transaction payload
- Parameters
from_ (Union[eth_typing.evm.HexAddress, str]) –
amount (int) –
withdraw_token_address (Union[eth_typing.evm.HexAddress, str]) –
slippage (float) –
- Return type
- fetch_denomination_token()[source]
Read denomination token from onchain.
Use
denomination_token()
for cached access.
Read share token details onchain.
Use
share_token()
for cached access.
Fetch the most recent onchain NAV value.
- Returns
Vault NAV, denominated in
denomination_token()
- property symbol
Vault share token symbol