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

info

Get info dictionary related to this vault deployment.

name

Vault name.

owner_address

portfolio_address

portfolio_contract

rebalance_address

share_token

ERC-20 that presents vault shares.

symbol

Vault share token symbol

token_symbol

vault_address

withdraw_manager_address

Methods summary

__init__(web3, spec[, api_url])

param spec

check_valid_contract()

Check that we have connected to a proper Velvet capital vault contract, not wrong contract.

fetch_denomination_token()

Read denomination token from onchain.

fetch_info()

Read vault parameters from the chain.

fetch_nav()

Fetch the most recent onchain NAV value.

fetch_portfolio(universe[, block_identifier])

Read the current token balances of a vault.

fetch_share_token()

Read share token details onchain.

get_flow_manager()

Get flow manager to read individial events.

has_block_range_event_support()

Does this vault support block range-based event queries for deposits and redemptions.

has_deposit_distribution_to_all_positions()

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

check_valid_contract()[source]

Check that we have connected to a proper Velvet capital vault contract, not wrong contract.

Raises

AssertionError – Looks bad

fetch_info()[source]

Read vault parameters from the chain.

Return type

eth_defi.velvet.vault.VelvetVaultInfo

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

property name: str

Vault name.

fetch_portfolio(universe, block_identifier=None)[source]

Read the current token balances of a vault.

  • SHould be supported by all implementations

Parameters
Return type

eth_defi.vault.base.VaultPortfolio

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

dict

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

dict

prepare_redemption(from_, amount, withdraw_token_address, slippage)[source]

Perform a redemption.

Returns

Ethereum transaction payload

Parameters
Return type

dict

fetch_denomination_token()[source]

Read denomination token from onchain.

Use denomination_token() for cached access.

fetch_share_token()[source]

Read share token details onchain.

Use share_token() for cached access.

fetch_nav()[source]

Fetch the most recent onchain NAV value.

Returns

Vault NAV, denominated in denomination_token()

property symbol

Vault share token symbol