[VPD-1596 + VDB-24] VIP-644: fix DAI market and upgrade FRV vault to consent implementation#736
Merged
Conversation
GitGuru7
marked this pull request as ready for review
July 10, 2026 10:35
Contributor
|
LGTM. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds VIP-999 governance proposals (BNB Chain + BNB Chain Testnet) to upgrade the Institutional Fixed Rate Vault controller’s clone-source implementation to a new version that supports optional on-chain consent recording during supplier deposit/mint flows. It also adds fork-based simulations to validate pre-/post-VIP behavior and exercise the full vault lifecycle using both the legacy ERC-4626 entrypoints and the new *WithConsent variants.
Changes:
- Add VIP-999 proposals to call
setVaultImplementation(newImplementation)on the FRV controller on testnet and mainnet. - Add fork simulations to verify the implementation switch and execute a full “new vault” lifecycle, including
depositWithConsent/mintWithConsentand the zero-hash no-op case. - Add ABI JSON files required by the new simulations (controller, vault, oracle, ERC20/faucet token).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| vips/vip-999/bsctestnet.ts | Defines the testnet VIP proposal to update the controller’s vault implementation address. |
| vips/vip-999/bscmainnet.ts | Defines the mainnet VIP proposal to update the controller’s vault implementation address. |
| simulations/vip-999/bsctestnet.ts | Fork simulation validating pre/post implementation and exercising new consent entrypoints + vault lifecycle on testnet. |
| simulations/vip-999/bscmainnet.ts | Fork simulation validating pre/post implementation and exercising new consent entrypoints + vault lifecycle on mainnet (including oracle pinning). |
| simulations/vip-999/abi/ResilientOracle.json | ABI used by mainnet simulation to pin prices via the resilient oracle. |
| simulations/vip-999/abi/InstitutionalVaultController.json | ABI used by simulations to interact with the vault controller and assert events/state. |
| simulations/vip-999/abi/InstitutionalLoanVault.json | ABI used by simulations to interact with the vault, including depositWithConsent/mintWithConsent. |
| simulations/vip-999/abi/FaucetToken.json | ABI used on testnet simulation to allocate faucet USDT to accounts. |
| simulations/vip-999/abi/ERC20.json | Generic ERC20 ABI used for BTCB/USDT interactions in simulations. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+179
to
+186
| it("depositWithConsent records the consent hash and mints shares", async () => { | ||
| const receiver = await lenderC.getAddress(); | ||
| await usdt.connect(lenderC).approve(vault.address, lenderFunding); | ||
| await expect(vault.connect(lenderC).depositWithConsent(depositAmount, receiver, consentHash)) | ||
| .to.emit(vault, "ConsentRecorded") | ||
| .withArgs(receiver, receiver, consentHash); | ||
| expect(await vault.balanceOf(receiver)).to.be.gt(0); | ||
| }); |
Comment on lines
+188
to
+196
| it("mintWithConsent records the consent hash and pulls assets", async () => { | ||
| const receiver = await lenderD.getAddress(); | ||
| const shares = await vault.previewDeposit(depositAmount); | ||
| await usdt.connect(lenderD).approve(vault.address, lenderFunding); | ||
| await expect(vault.connect(lenderD).mintWithConsent(shares, receiver, consentHash)) | ||
| .to.emit(vault, "ConsentRecorded") | ||
| .withArgs(receiver, receiver, consentHash); | ||
| expect(await vault.balanceOf(receiver)).to.equal(shares); | ||
| }); |
Comment on lines
+181
to
+188
| it("depositWithConsent records the consent hash and mints shares", async () => { | ||
| const receiver = await lenderC.getAddress(); | ||
| await usdt.connect(lenderC).approve(vault.address, lenderFunding); | ||
| await expect(vault.connect(lenderC).depositWithConsent(depositAmount, receiver, consentHash)) | ||
| .to.emit(vault, "ConsentRecorded") | ||
| .withArgs(receiver, receiver, consentHash); | ||
| expect(await vault.balanceOf(receiver)).to.be.gt(0); | ||
| }); |
Comment on lines
+190
to
+198
| it("mintWithConsent records the consent hash and pulls assets", async () => { | ||
| const receiver = await lenderD.getAddress(); | ||
| const shares = await vault.previewDeposit(depositAmount); | ||
| await usdt.connect(lenderD).approve(vault.address, lenderFunding); | ||
| await expect(vault.connect(lenderD).mintWithConsent(shares, receiver, consentHash)) | ||
| .to.emit(vault, "ConsentRecorded") | ||
| .withArgs(receiver, receiver, consentHash); | ||
| expect(await vault.balanceOf(receiver)).to.equal(shares); | ||
| }); |
… execution Fold PR #737 (VDB-24: disable DeviationSentinel monitoring for DAI, resume vDAI borrowing, reset EBrake snapshots) into the mainnet VIP so both changes execute in a single proposal. - vips/vip-999/bscmainnet.ts: commands 1-5 = DAI fix (sentinel disable first, unpause BORROW, three EBrake snapshot resets), command 6 = FRV setVaultImplementation. No cap restore: EBrake never snapshotted vDAI caps (marketStates(vDAI) = (0,0,false,false) on-chain), live caps intact. - simulations/vip-999/bscmainnet.ts: fork block 109660000 (both pre-states verified on-chain: FRV controller on old impl, vDAI BORROW paused, sentinel monitoring on, EBrake snapshots empty); merged pre/post suites and event expectations; DAI behavioral borrow proof runs after the FRV lifecycle with Chainlink-pinned prices. 31 passing on bscmainnet fork. - ABIs: add Comptroller/DeviationSentinel/EBrake/VToken; ResilientOracle replaced by its superset from PR #737. Testnet VIP and sim unchanged (DAI fix is mainnet-only); 16 passing. Co-Authored-By: Claude Fable 5 <[email protected]>
Renumber vip-999 placeholder to VIP-644 (on-chain proposalCount 642; 643 reserved for the preceding proposal). Mainnet simulation re-run: 31 passing. Co-Authored-By: Claude Fable 5 <[email protected]>
Treasury liquid USDC (~86K) does not cover the payment, so vUSDC is redeemed through the TokenRedeemer (VIP-594 flow): withdraw 3.96M vUSDC to the redeemer, redeemUnderlyingAndTransfer exactly 105,000 USDC to Allez Labs, remainder vUSDC returned to the treasury. Co-Authored-By: Claude Fable 5 <[email protected]>
Title and description from the voting Notion doc, with Part 3 / Actions corrected to describe the actual vUSDC-redemption payment commands. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
VIP-644: [BNB Chain] Fix DAI Market, Upgrade Institutional Fixed Rate Vault, and Pay Allez Labs Q3
Summary
This VIP (1) stops DeviationSentinel monitoring of DAI, resumes vDAI borrowing and clears the related Emergency Brake snapshots, (2) upgrades the Institutional Fixed Rate Vault to an implementation that adds optional on-chain disclaimer-consent recording to the deposit/mint flow, and (3) transfers 105,000 USDC from the Venus Treasury to Allez Labs for Q3 2026 risk-management services, sourced by redeeming Treasury-held vUSDC.
Description
Part 1 — DAI market. DAI's thin, volatile DEX liquidity makes its price noisy against the ResilientOracle, repeatedly tripping DeviationSentinel false positives on vDAI (most recently last weekend). Monitoring is disabled and borrowing resumed; no collateral factor or cap is restored because EBrake never reduced any (vDAI's collateral factor was already 0).
Part 2 — Fixed Rate Vault. A new implementation adds
depositWithConsent/mintWithConsent— ERC-4626 wrappers that emitConsentRecorded(a zero hash skips it). Plain deposit/mint and existing vaults are unaffected; only vaults created after execution use it.Part 3 — Allez Labs Q3 payment. Allez Labs provides risk-management services to Venus, billed quarterly in advance. This pays the Q3 2026 fee of 105,000 USDC ($35,000/month × 3, covering 26 July 2026 – 25 October 2026) — same amount as the Q2 payment (VIP-612), paid in USDC. The Treasury's liquid USDC (~86K) does not cover the amount (and
withdrawTreasuryBEP20silently caps at balance instead of reverting), so the USDC is sourced by redeeming Treasury-held vUSDC through the Token Redeemer (0xC53ffda840B51068C64b2E052a5715043f634bcd, same flow as VIP-594): the redemption pays Allez Labs exactly 105,000 USDC and returns the unused vUSDC remainder to the Treasury. The vUSDC exchange rate only increases over time, so the withdrawn 3,960,000 vUSDC always covers the payment at execution time.Actions (8 commands)
setTokenMonitoringEnabled(DAI, false)on DeviationSentinel0x6599C15cc8407046CD91E5c0F8B7f765fF914870— ordered first so vDAI cannot be re-tripped around executionsetActionsPaused([vDAI], [BORROW], false)on the Core Pool Comptroller0xfD36E2c2a6789Db23113685031d7F163291583843-5.
resetCFSnapshot/resetBorrowCapSnapshot/resetSupplyCapSnapshot(vDAI)on EBrake0x35eBaBB99c7Fb7ba0C90bCc26e5d55Cdf89C23EcsetVaultImplementation(0xe87A1eFCED88bBddf8CCF78EfB3bCF62cFdd5bdC)on the FRV controller0x6D9e91cB766259af42619c14c994E694E57e6E85(replacing0xC25b2B657D24380eDd1a1Cff5296385541e85204)withdrawTreasuryBEP20(vUSDC, 3,960,000e8, TokenRedeemer)on the Venus Treasury0xf322942f644a996a617bd29c16bd7d231d9f35e9redeemUnderlyingAndTransfer(vUSDC, ALLEZ_LABS, 105,000e18, VTREASURY)on the TokenRedeemer — exactly 105,000 USDC to Allez Labs0x1757564C8C9a2c3cbE12620ea21B97d6E149F98e, vUSDC remainder back to the TreasurySimulation
npx hardhat test simulations/vip-644/bscmainnet.ts --fork bscmainnet— 37/37 passing at fork block 109660000, including exact-amount assertions for the Allez payment (Allez +105,000 USDC exactly, Treasury liquid USDC untouched, redeemer retains nothing, vUSDC remainder returned).🤖 Generated with Claude Code