erc_4626.vault_protocol.lagoon.lagoon_compatibility
Documentation for eth_defi.erc_4626.vault_protocol.lagoon.lagoon_compatibility Python module.
Lagoon token compatibility checks.
Functions
|
Check if the token is compatible with Lagoon Vault. |
Check multiple tokens for compatibility with Lagoon Vault. |
Classes
Database for storing Lagoon token compatibility checks. |
|
Was an ERC-20 compatible with Lagoon Vault? |
- class LagoonTokenCheckDatabase
Bases:
objectDatabase for storing Lagoon token compatibility checks.
- __init__(report_by_token=<factory>)
- Parameters
report_by_token (dict[eth_typing.evm.HexAddress, eth_defi.erc_4626.vault_protocol.lagoon.lagoon_compatibility.LagoonTokenCompatibilityData]) –
- Return type
None
- class LagoonTokenCompatibilityData
Bases:
objectWas an ERC-20 compatible with Lagoon Vault?
Vault can buy and sell the token
Only applicable to Uniswap v2 kind AMMs
- __init__(created_at, token_address, pair_address, path, tokens, available_liquidity, minimum_liquidity_threshold, buy_block_number, estimate_buy_received, buy_amount_raw, buy_result, buy_real_received, sell_block_number=None, estimate_sell_received=None, sell_result=None, revert_reason=None, cached=False)
- Parameters
created_at (datetime.datetime) –
token_address (str) –
pair_address (str) –
available_liquidity (decimal.Decimal) –
minimum_liquidity_threshold (decimal.Decimal) –
buy_block_number (int) –
estimate_buy_received (int) –
buy_amount_raw (int) –
buy_result (Optional[eth_defi.trade.TradeSuccess]) –
buy_real_received (int) –
sell_result (Optional[eth_defi.trade.TradeSuccess]) –
cached (bool) –
- Return type
None
- get_round_trip_cost()
Get round trip cost in percents.
E.g. 0.005 means we paid 50 bps
- check_compatibility(web3, vault, asset_manager, uniswap_v2, path, sell_delay=datetime.timedelta(seconds=3600))
Check if the token is compatible with Lagoon Vault.
Attempt to buy and sell the token on Uniswap v2 like instance and see it works
- Parameters
path (list[str]) – Uniswap routing path: [reserve token, intermediate token, base token]
web3 (web3.main.Web3) –
vault (eth_defi.erc_4626.vault_protocol.lagoon.vault.LagoonVault) –
asset_manager (eth_typing.evm.HexAddress) –
uniswap_v2 (eth_defi.uniswap_v2.deployment.UniswapV2Deployment) –
- Return type
eth_defi.erc_4626.vault_protocol.lagoon.lagoon_compatibility.LagoonTokenCompatibilityData
- check_lagoon_compatibility_with_database(web3, paths, vault_address, trading_strategy_module_address, asset_manager_address, database_file=PosixPath('/home/runner/.tradingstrategy/token-checks/lagoon_token_check.pickle'), fork_block_number=None, retries=3)
Check multiple tokens for compatibility with Lagoon Vault.
Uses a local pickle-file database to remember previous checks
- Parameters
web3 (web3.main.Web3) –
paths (list[list[eth_typing.evm.HexAddress]]) –
vault_address (eth_typing.evm.HexAddress) –
trading_strategy_module_address (eth_typing.evm.HexAddress) –
asset_manager_address (eth_typing.evm.HexAddress) –
database_file (pathlib.Path) –
- Return type
eth_defi.erc_4626.vault_protocol.lagoon.lagoon_compatibility.LagoonTokenCheckDatabase