Skip to content

[VPD-893]: Integrate DeviationBoundedOracle for conservative CF path#668

Merged
GitGuru7 merged 26 commits into
developfrom
feat/vpd-893-bounded-price-oracle
May 7, 2026
Merged

[VPD-893]: Integrate DeviationBoundedOracle for conservative CF path#668
GitGuru7 merged 26 commits into
developfrom
feat/vpd-893-bounded-price-oracle

Conversation

@GitGuru7
Copy link
Copy Markdown
Contributor

@GitGuru7 GitGuru7 commented Mar 31, 2026

Description

Integrate DeviationBoundedOracle into Comptroller for conservative CF-path pricing

  • Introduce ComptrollerV19Storage with a new deviationBoundedOracle slot
    and add setDeviationBoundedOracle admin setter in SetterFacet
  • Call dbo.updateProtectionState() for all account assets before liquidity
    checks in redeemAllowed and borrowAllowed (populates transient price cache)
  • In ComptrollerLens, use bounded collateral/debt prices from the DBO in the
    collateral-factor path; liquidation-threshold path continues to use spot prices

⚠️ for tests, please update the oracle package to use the bounded oracle changes from this PR
VenusProtocol/oracle#306

you can either:

  • use npm pack to create a local package
  • or directly link it locally using:
"@venusprotocol/oracle": "link:../oracle"

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 31, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c38590fa-faa7-4183-ac56-1145cd78d4dc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/vpd-893-bounded-price-oracle

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@GitGuru7 GitGuru7 marked this pull request as ready for review April 9, 2026 06:14
Copy link
Copy Markdown

@claude claude Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

Comment thread contracts/Lens/ComptrollerLens.sol
@fred-venus
Copy link
Copy Markdown
Contributor

I guess we will need to update the VenusLens contract as well. It's not directly used by any other contract, but I'm thinking that fe/be might have certain dependencies. Probably we could return three prices instead of just the spot price.

@fred-venus
Copy link
Copy Markdown
Contributor

I guess we will need to update the VenusLens contract as well. It's not directly used by any other contract, but I'm thinking that fe/be might have certain dependencies. Probably we could return three prices instead of just the spot price.

also same thing to SnapshotLens, better confirm with FE/BE if they are reply on it in some way

@fred-venus
Copy link
Copy Markdown
Contributor

fred-venus commented Apr 9, 2026

in VAI controller#getMintableVAI, should we update this function as well ? What I saw is that we are still using the spot price instead of the updated DeviationBoundedOracle price.

"Function that returns the amount of VAI a user can mint based on their account liquidy and the VAI mint rate"

Comment thread contracts/Comptroller/Diamond/facets/FacetBase.sol
@fred-venus
Copy link
Copy Markdown
Contributor

While I don't think this is a major issue or that it will have any substantial impact, would it be better to use a Deviation Oracle here? As thats what would actually be used in a borrowing scenario.

CleanShot 2026-04-10 at 15 15 36@2x

@GitGuru7 GitGuru7 self-assigned this May 6, 2026
@fred-venus
Copy link
Copy Markdown
Contributor

lgtm, let's fix the ci

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

Code Coverage

Package Line Rate Branch Rate Health
contracts 100% 100%
contracts.Admin 88% 41%
contracts.Comptroller 100% 90%
contracts.Comptroller.Diamond 95% 64%
contracts.Comptroller.Diamond.facets 87% 73%
contracts.Comptroller.Diamond.interfaces 100% 100%
contracts.Comptroller.Types 100% 100%
contracts.Comptroller.legacy 100% 100%
contracts.Comptroller.legacy.Diamond 0% 0%
contracts.Comptroller.legacy.Diamond.facets 0% 0%
contracts.Comptroller.legacy.Diamond.interfaces 100% 100%
contracts.DelegateBorrowers 100% 89%
contracts.FlashLoan.interfaces 100% 100%
contracts.Governance 68% 45%
contracts.InterestRateModels 74% 59%
contracts.Lens 43% 46%
contracts.Liquidator 83% 60%
contracts.Oracle 100% 100%
contracts.PegStability 88% 84%
contracts.Swap 87% 58%
contracts.Swap.interfaces 100% 100%
contracts.Swap.lib 81% 55%
contracts.Tokens 100% 100%
contracts.Tokens.Prime 96% 72%
contracts.Tokens.Prime.Interfaces 100% 100%
contracts.Tokens.Prime.libs 90% 76%
contracts.Tokens.VAI 82% 52%
contracts.Tokens.VRT 20% 9%
contracts.Tokens.VTokens 70% 52%
contracts.Tokens.VTokens.legacy 0% 0%
contracts.Tokens.VTokens.legacy.Utils 0% 0%
contracts.Tokens.XVS 19% 8%
contracts.Tokens.test 100% 100%
contracts.Utils 52% 31%
contracts.VAIVault 50% 45%
contracts.VRTVault 49% 36%
contracts.XVSVault 63% 50%
contracts.external 100% 100%
contracts.lib 89% 71%
Summary 57% (3738 / 6546) 43% (1410 / 3276)

@GitGuru7 GitGuru7 merged commit 82c3473 into develop May 7, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants