Add NAV-based balance using convertToAssets instead of AMM quote#189
Add NAV-based balance using convertToAssets instead of AMM quote#189
Conversation
|
tests are blocked by this PR: |
| access(all) fun availableBalance(ofToken: Type): UFix64 | ||
| /// Returns the NAV-based balance of the given token. Defaults to availableBalance(); strategies backed by | ||
| /// ERC-4626 vaults should override to return convertToAssets(shares) instead of an AMM quote. | ||
| access(all) fun navBalance(ofToken: Type): UFix64 { |
There was a problem hiding this comment.
navBalance should mean mark-to-market position value, not “safe-to-withdraw now”.
Right now the base Strategy.navBalance() default delegates to availableBalance(). For strategies that don’t override it, this makes navBalance health/withdrawability-constrained (as it depends on FlowALP health considerations), which is a different concept from NAV and can understate value.
There was a problem hiding this comment.
@liobrasil Good catch. My intention was that this comment would clarify what navBalance represents: Returns the NAV-based balance of the given token. Defaults to availableBalance(); strategies backed by ERC-4626 vaults should override to return convertToAssets(shares) instead of an AMM quote.
Does updating the method definition to access(all) fun navBalance(ofToken: Type): UFix64? { return nil } address your concern? If not, do you have any suggestions? The contract was already updated to mainnet to unblock enter strategy transaction failures in peak money.
Deposits into ERC-4626 vaults enter at NAV rate, but balance was measured via UniswapV3 AMM quote which undervalues positions due to simulated swap price impact, causing enter strategy post-condition failures.
navBalance()on Strategy interface (defaults toavailableBalance()), overridden in all three V1 strategies to convert AutoBalancer shares via ERC-4626convertToAssetsdry callYieldVault.getNAVBalance()exposes NAV measurement to transaction callers