-
Notifications
You must be signed in to change notification settings - Fork 135
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"""Lagoon vault NAV handling.""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -167,3 +167,6 @@ def transact_through_module( | |
operation, | ||
) | ||
return bound_func | ||
|
||
def calculate_nav(self): | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |