VaultPortfolio
Documentation for eth_defi.vault.base.VaultPortfolio Python class.
- class VaultPortfolio[source]
Track assets and balances in a vault.
Offchain method to track what assets a vault contains
Takes
TradingUniverse
as an input and resolves all relevant balances the vault holds for this trading universeBecause of brainrotten and awful ERC-20 token standard, the vault does not know what tokens it owns and this needs to be specific offchain
Attributes summary
Get list of tokens held in this portfolio
List of tokens and their amounts
For route finding, which DEX tokens should use.
Methods summary
__init__
(spot_erc20[, dex_hints])get_position_count
()get_raw_spot_balances
(web3)Convert spot balances to raw token balances
Do we have only ERC-20 hold positions in this portfolio
- spot_erc20: eth_defi.vault.lower_case_dict.LowercaseDict
List of tokens and their amounts
Addresses not checksummed
- dex_hints: dict[eth_typing.evm.HexAddress, list[str]]
For route finding, which DEX tokens should use.
Token address -> DEX id string mapping
- property tokens: set[eth_typing.evm.HexAddress]
Get list of tokens held in this portfolio
- get_raw_spot_balances(web3)[source]
Convert spot balances to raw token balances
- Parameters
web3 (web3.main.Web3) –
- Return type
eth_defi.vault.lower_case_dict.LowercaseDict
- __init__(spot_erc20, dex_hints=<factory>)
- Parameters
spot_erc20 (eth_defi.vault.lower_case_dict.LowercaseDict) –
dex_hints (dict[eth_typing.evm.HexAddress, list[str]]) –
- Return type
None