Skip to content

Commit

Permalink
Start Lagoon valuation work
Browse files Browse the repository at this point in the history
  • Loading branch information
miohtama committed Nov 28, 2024
1 parent 5961def commit 41d5410
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
2 changes: 2 additions & 0 deletions eth_defi/lagoon/valuation_commitee.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"""Lagoon vault NAV handling."""

3 changes: 3 additions & 0 deletions eth_defi/lagoon/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,6 @@ def transact_through_module(
operation,
)
return bound_func

def calculate_nav(self):

47 changes: 47 additions & 0 deletions eth_defi/vault/valuation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
"""EVM Vault valuation."""
from eth_typing import HexAddress
from web3.contract import Contract

from eth_defi.vault.base import VaultPortfolio


def map_best_routes(
quoter: Contract,
tokens: set[HexAddress],
target_asset: HexAddress,
intermedia_tokens: set[HexAddress],
):
"""Find best available routes to sell assets.
- Use Uniswap v2 and brute force loop to figure out routes for each asset.
"""




def calculate_nav_on_market_sell(
portfolio: VaultPortfolio,
quoter: Contract,
valuation_asset: HexAddress,
intermedia_tokens: set[HexAddress],
):
"""Calculate valuation of all vault spot assets, assuming we would sell them on Uniswap market sell.
:param portfolio:
The gathered portfolio of current assets
:param quoter:
Uniswap QuoterV2 smart contract.
:param intermedia_token:
The supported intermediate token if we cannot do direct market sell.
:param valuation_asset:
The asset in which we value the portfolio.
E.g. `USDC`.
"""

calls = []
for token in portfolio.spot_erc20:
pass

0 comments on commit 41d5410

Please sign in to comment.