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_compatibility(web3, vault, ...[, ...])

Check if the token is compatible with Lagoon Vault.

check_lagoon_compatibility_with_database(...)

Check multiple tokens for compatibility with Lagoon Vault.

Classes

LagoonTokenCheckDatabase

Database for storing Lagoon token compatibility checks.

LagoonTokenCompatibilityData

Was an ERC-20 compatible with Lagoon Vault?

class LagoonTokenCheckDatabase

Bases: object

Database 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

get_diagnostics(max_cell_width=30)

Prepare table output for manual output.

Return type

list[dict]

class LagoonTokenCompatibilityData

Bases: object

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

None

get_round_trip_cost()

Get round trip cost in percents.

E.g. 0.005 means we paid 50 bps

Returns

Round trip cost in percents or None if not avail

Return type

Optional[float]

is_buy_success()

Was the buy operation successful?

Return type

bool

is_compatible()

Is the token compatible with Lagoon Vault?

Return type

bool

is_sell_success()

Was the sell operation successful?

Return type

bool

pformat()

Diagnostics dump for debug

Return type

str

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

eth_defi.erc_4626.vault_protocol.lagoon.lagoon_compatibility.LagoonTokenCheckDatabase