Skip to content

[VPD-1596 + VDB-24] VIP-644: fix DAI market and upgrade FRV vault to consent implementation#736

Merged
fred-venus merged 9 commits into
mainfrom
feat/vpd-1596
Jul 15, 2026
Merged

[VPD-1596 + VDB-24] VIP-644: fix DAI market and upgrade FRV vault to consent implementation#736
fred-venus merged 9 commits into
mainfrom
feat/vpd-1596

Conversation

@GitGuru7

@GitGuru7 GitGuru7 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

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 emit ConsentRecorded (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 withdrawTreasuryBEP20 silently 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)

  1. setTokenMonitoringEnabled(DAI, false) on DeviationSentinel 0x6599C15cc8407046CD91E5c0F8B7f765fF914870 — ordered first so vDAI cannot be re-tripped around execution
  2. setActionsPaused([vDAI], [BORROW], false) on the Core Pool Comptroller 0xfD36E2c2a6789Db23113685031d7F16329158384
    3-5. resetCFSnapshot / resetBorrowCapSnapshot / resetSupplyCapSnapshot(vDAI) on EBrake 0x35eBaBB99c7Fb7ba0C90bCc26e5d55Cdf89C23Ec
  3. setVaultImplementation(0xe87A1eFCED88bBddf8CCF78EfB3bCF62cFdd5bdC) on the FRV controller 0x6D9e91cB766259af42619c14c994E694E57e6E85 (replacing 0xC25b2B657D24380eDd1a1Cff5296385541e85204)
  4. withdrawTreasuryBEP20(vUSDC, 3,960,000e8, TokenRedeemer) on the Venus Treasury 0xf322942f644a996a617bd29c16bd7d231d9f35e9
  5. redeemUnderlyingAndTransfer(vUSDC, ALLEZ_LABS, 105,000e18, VTREASURY) on the TokenRedeemer — exactly 105,000 USDC to Allez Labs 0x1757564C8C9a2c3cbE12620ea21B97d6E149F98e, vUSDC remainder back to the Treasury

Note: the voting Notion doc describes the Allez payment as a single direct withdrawTreasuryBEP20(USDC, 105000e18, ALLEZ_LABS) transfer — that command would silently underpay (Treasury liquid USDC ≈ 86K < 105K, and the treasury withdraw caps at balance without reverting). The payload here uses the vUSDC-redemption flow instead; the on-chain description matches the payload.

Simulation

npx hardhat test simulations/vip-644/bscmainnet.ts --fork bscmainnet37/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

@GitGuru7
GitGuru7 marked this pull request as ready for review July 10, 2026 10:35
@GitGuru7 GitGuru7 self-assigned this Jul 10, 2026
@Debugger022

Copy link
Copy Markdown
Contributor

LGTM.

Copilot AI left a comment

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.

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/mintWithConsent and 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 thread simulations/vip-999/bsctestnet.ts Outdated
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 thread simulations/vip-999/bsctestnet.ts Outdated
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 thread simulations/vip-999/bscmainnet.ts Outdated
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 thread simulations/vip-999/bscmainnet.ts Outdated
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);
});
fred-venus and others added 2 commits July 14, 2026 17:04
… 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]>
@fred-venus fred-venus changed the title [VPD-1596]: add VIP upgrading FRV vault to consent implementation [VPD-1596 + VDB-24] VIP-644: fix DAI market and upgrade FRV vault to consent implementation Jul 14, 2026
fred-venus and others added 2 commits July 15, 2026 10:42
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]>
@fred-venus
fred-venus merged commit 1989565 into main Jul 15, 2026
2 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.

4 participants