Skip to content

[VPD-898]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC#697

Open
GitGuru7 wants to merge 10 commits intomainfrom
feat/VIP-665
Open

[VPD-898]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC#697
GitGuru7 wants to merge 10 commits intomainfrom
feat/VIP-665

Conversation

@GitGuru7
Copy link
Copy Markdown
Contributor

@GitGuru7 GitGuru7 commented Apr 21, 2026

Summary

Roll out the new DeviationBoundedOracle (DBO) on BNB Chain (testnet + mainnet) and wire it into the Core Pool Comptroller. The DBO wraps the existing ResilientOracle with a per-market rolling min/max price window — when spot deviates beyond a configured threshold, collateral is valued at min(spot, windowMin) and debt at max(spot, windowMax), protecting CF/debt-path pricing against short-duration manipulation on low-liquidity collateral tokens.

VIPs included

vips/vip-665/bsctestnet.ts

Ships the DBO and Comptroller upgrade on testnet without per-asset configs. Yet to be updated to mirror the mainnet structure (ACMCommandsAggregator batching, Keeper role, Guardian-callable setters, asset-config seeding).

vips/vip-665/bscmainnet.ts — Phase 1 of 2

Ships DBO live but inactive for 23 of 24 assets: each is initialized with isBoundedPricingEnabled = false, so DBO returns (spot, spot) and behaviour is unchanged. TRX ships enabled (isBoundedPricingEnabled = true) as a low-liquidity validation market for the protection logic in production. Phase 2 will flip the remaining assets once keepers and parameters are validated.

  • Steps 1–4 — ACM permissions (42 grants) via ACMCommandsAggregator. Push batch → grant aggregator DEFAULT_ADMIN_ROLE → execute → revoke. Adds Keeper role + Guardian-callable governance setters on top of the testnet set. Audit: governance-contracts/audits/118_ACMCommandsAggregator_certik_20241007.pdf.
  • Steps 5–6 — Unitroller implementation upgrade.
  • Step 7 — diamondCut (same shape as testnet).
  • Step 8 — Wire new ComptrollerLens.
  • Steps 9–10 — VAIController implementation upgrade.
  • Step 11 — Accept DBO ownership.
  • Step 12 — Wire DBO into Comptroller.
  • Step 13 — Seed per-asset configs via setTokenConfigs, populated from vips/vip-665/asset-configs-bscmainnet.json.

Deployed contracts

Contract Testnet Mainnet
DeviationBoundedOracle (proxy) 0xE0dafC97895B3c98d3B96D3f8739AaC73166beB8 0xc79Cb7efEBd121DC4B39eA141C214606595D665A
ComptrollerLens 0xdBD0992dEd0a1EC14CE0532e60ea023F79372eD9 0x75A71Ad878f6f24616A2AE21d046C0C8E72f67F8
VAIController implementation 0xd2848305b0ee7646C930240D79549D50d6Ed024F 0x8A7d8589A597619A7842d3BC284b9a5a276FaE56
Unitroller implementation (new Diamond) 0xf00Ba2930E43C96719Ca40c8B5a48F4c9A004c52 0x82cA18785BBbacBeD1C4f482921E2B2E989D8C08
Keeper 0xCab91EBcbf5d242758e22fd436AB568343463A9c (TBD — replace before proposal)

Test plan

  • npx hardhat test simulations/vip-665/bsctestnet.ts --fork bsctestnet
  • npx hardhat test simulations/vip-665/bscmainnet.ts --fork bscmainnet

@GitGuru7 GitGuru7 changed the title [VIP-665]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC testnet [VPD-898]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC testnet Apr 21, 2026
@GitGuru7 GitGuru7 self-assigned this Apr 30, 2026
@GitGuru7 GitGuru7 changed the title [VPD-898]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC testnet [VPD-898]: VIP to roll out DeviationBoundedOracle and upgrade Comptroller on BSC Apr 30, 2026
@GitGuru7 GitGuru7 marked this pull request as ready for review May 1, 2026 07:46
@GitGuru7 GitGuru7 requested review from Debugger022 and fred-venus May 1, 2026 07:46
Comment thread vips/vip-665/bscmainnet.ts Outdated
export const COMPTROLLER_LENS = "0x75A71Ad878f6f24616A2AE21d046C0C8E72f67F8";
export const VAI_CONTROLLER_IMPL = "0x8A7d8589A597619A7842d3BC284b9a5a276FaE56";
export const UNITROLLER_IMPLEMENTATION = "0x82cA18785BBbacBeD1C4f482921E2B2E989D8C08";
export const KEEPER = "0xCab91EBcbf5d242758e22fd436AB568343463A9c"; // TBD — REPLACE WITH KEEPER ADDRESS ON MAINNET
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this be replaced with another address?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets use 0xa44eb88198a7a94dc6d2507bc0e5a216c2410d79

// DBO keeper actions → 3 timelocks + Guardian + K (20)
...buildAcmGrants(DEVIATION_BOUNDED_ORACLE, DBO_KEEPER_FUNCTIONS, KEEPER_CALLERS),
// Comptroller setDBO → Normal + Guardian ( 2)
...buildAcmGrants(UNITROLLER, [COMPTROLLER_DBO_SETTER], [NORMAL_TIMELOCK, GUARDIAN]),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be granted to all 3 timelocks?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Since the oracle is upgradeable, the setter is expected to be used only during initial setup or in emergency situations. Therefore, it’s better to avoid granting unnecessary permissions.

"isBoundedPricingEnabled": false,
"cachingEnabled": false
},
{
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lets remove FIL, this is going to be delist

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,244 @@
{
"assetConfigs": [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

let's add vPT-clisBNB-25JUN2026 as well

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

also i notice some of the assets with temp CF = 0 we are using ~16% here, i think it's fine to use a conservative value, we can do further adjustment the trigger is annoying

"asset": "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",
"vToken": "0x86aC3974e2BD0d60825230fa6F355fF11409df5c",
"cooldownPeriod": 3600,
"triggerThreshold": "409090909090909090",
Copy link
Copy Markdown
Contributor

@fred-venus fred-venus May 6, 2026

Choose a reason for hiding this comment

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

for CAKE lets use 30% so that it could get trigger more aggressively

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

3 participants