Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
222 commits
Select commit Hold shift + click to select a range
17be07d
fix: improve facet-cut-generator
GitGuru7 Sep 24, 2025
1784726
chore: fix some minor issues in the comments
goldlinker Oct 23, 2025
1bd7262
feat: update repayAmount logic
Debugger022 Nov 3, 2025
84a199d
feat: add testnet deployment for PT-slisBNBx-24JUN2026 market
Debugger022 Jan 5, 2026
178b03a
feat: updating deployment files
Debugger022 Jan 5, 2026
39dab7d
feat: redeploy market for bsctestnet
Debugger022 Jan 9, 2026
0bb1d96
feat: add mainnet deployments for PT-clisBNB-25JUN2026 market
Debugger022 Jan 9, 2026
24b52b8
Merge pull request #660 from VenusProtocol/main
fred-venus Jan 14, 2026
ff2d7cf
Merge pull request #643 from goldlinker/develop
fred-venus Jan 14, 2026
2e1f342
Merge branch 'develop' into feat/vpd-404
Debugger022 Jan 14, 2026
eb1ee25
feat: updating deployment files
Debugger022 Jan 14, 2026
3c3abf6
fix: initial supply value
Debugger022 Jan 16, 2026
01414e3
Merge pull request #656 from VenusProtocol/feat/vpd-404
fred-venus Jan 21, 2026
31ab4d0
chore(release): 10.2.0-dev.1 [skip ci]
toolsvenus Jan 21, 2026
22b0bfb
feat: init
Debugger022 Feb 10, 2026
9497560
feat(prime): add PrimeLeaderboard contract for time-weighted scoring
Debugger022 Feb 10, 2026
38b7a24
test(prime): add unit tests for PrimeLeaderboard
Debugger022 Feb 10, 2026
20adb68
feat(xvsvault): integrate PrimeLeaderboard for deposit/withdrawal tra…
Debugger022 Feb 10, 2026
116c0a3
feat(prime): add PrimeV2 contract with leaderboard-based token distri…
Debugger022 Feb 10, 2026
8c63b19
test(prime): add unit tests for PrimeV2 contract
Debugger022 Feb 10, 2026
a31b34d
revert(xvsvault): remove PrimeLeaderboard integration from XVSVault
Debugger022 Feb 11, 2026
3afdfb4
refactor(prime): replace epochs with rounds and xvsUpdated pattern
Debugger022 Feb 11, 2026
e1e4227
refactor(prime): remove syncPrimeStatus from PrimeV2
Debugger022 Feb 11, 2026
313afc4
test(prime): rewrite PrimeLeaderboard unit tests for v2 architecture
Debugger022 Feb 11, 2026
a3a2cb8
test(prime): update PrimeV2 tests for round-based architecture
Debugger022 Feb 11, 2026
de3373e
test(prime): add PrimeV2 end-to-end integration tests
Debugger022 Feb 12, 2026
455161f
test(prime): add PrimeV2 E2E fork test against BSC mainnet
Debugger022 Feb 12, 2026
3a4833b
feat(prime): add PrimeV2Keeper automation contract
Debugger022 Feb 12, 2026
e2ab7ee
fix(prime): fix security findings across PrimeV2 contracts
Debugger022 Feb 16, 2026
53d00f9
test(prime): update tests for security fix changes
Debugger022 Feb 16, 2026
4a3aa4e
docs(prime): add @custom:event, @custom:error, @custom:access NatSpec…
Debugger022 Feb 16, 2026
3b5eb36
feat: add PrimeV2 and PrimeLeaderboard deployment scripts
Debugger022 Feb 17, 2026
c78e817
refactor(prime): remove epoch/round management, decouple withdrawn sc…
Debugger022 Feb 19, 2026
b5bcc8f
feat: add XAUM market deployments on bsctestnet
GitGuru7 Feb 19, 2026
9ee9c91
feat: updating deployment files
GitGuru7 Feb 19, 2026
7d1cf0f
feat: add XAUM market deployments on bscmainnet
GitGuru7 Feb 19, 2026
1b75fde
feat: updating deployment files
GitGuru7 Feb 19, 2026
d76fbf5
refactor(prime): rename withdrawnScoreCurrentRound to withdrawnScore
Debugger022 Feb 20, 2026
79d7041
test(prime): update fork tests for backend-driven withdrawn score
Debugger022 Feb 20, 2026
63fcc3f
test(prime): add deposit compaction and market management tests
Debugger022 Feb 20, 2026
5247e2a
test(prime): add PrimeV2Keeper unit tests and deployment script
Debugger022 Feb 20, 2026
4dff8b1
fix(prime): subtract pendingWithdrawals in xvsUpdated and remove when…
Debugger022 Feb 25, 2026
a5a887d
refactor(prime): optimize PrimeLeaderboard storage writes and cleanup
Debugger022 Feb 25, 2026
7e4fb6f
fix(prime): remove unused errors, redundant check, and fix NatSpec
Debugger022 Feb 25, 2026
fe862d6
refactor(prime): remove unused MaxLoopsLimitHelper from PrimeLeaderboard
Debugger022 Feb 25, 2026
fbdbeff
refactor(prime): address review findings across PrimeV2 and PrimeLead…
Debugger022 Feb 25, 2026
1d6842a
refactor(prime): use seconds-based scoring, simplify addMarket, and f…
Debugger022 Feb 26, 2026
406d8dd
test(prime): align tests with seconds-based scoring and addMarket cha…
Debugger022 Feb 26, 2026
4035faf
refactor(prime): cleanup PrimeLeaderboard per review findings
Debugger022 Feb 26, 2026
5f14e94
refactor(prime): address review findings on PrimeLeaderboard
Debugger022 Feb 26, 2026
a33aef3
feat: deploy VBep20Delegate with updated repayAmount logic
Debugger022 Feb 27, 2026
2c5431e
chore: remove list-markets script
Debugger022 Feb 27, 2026
6d29baf
Merge pull request #662 from VenusProtocol/feat/vpd-606
fred-venus Feb 27, 2026
88ad10e
chore(release): 10.2.0-dev.2 [skip ci]
toolsvenus Feb 27, 2026
d3c78a7
Merge branch 'develop' into feat/VPD-233
Debugger022 Mar 2, 2026
9f22dad
feat: updating deployment files
Debugger022 Mar 2, 2026
9c7680c
refactor(prime): remove irrevocable token type from PrimeV2
Debugger022 Mar 2, 2026
2977ecb
fix(prime): allow non-holders to claim previously accrued rewards
Debugger022 Mar 2, 2026
6b52bf0
feat: Redeploy VBep20Delegate on bscmainnet and bsctestnet
Debugger022 Mar 2, 2026
eb0d728
feat: updating deployment files
Debugger022 Mar 2, 2026
68dda6e
fix(prime): accrue interest on XVS stake change via xvsUpdated
Debugger022 Mar 2, 2026
bf1fc75
refactor(prime): rename withdrawnScore to withdrawnStake
Debugger022 Mar 2, 2026
17083f5
refactor(prime): remove redundant _lastKnownStake variable
Debugger022 Mar 2, 2026
daba2b4
refactor(prime): make vault config immutable and fix compaction times…
Debugger022 Mar 2, 2026
b05c425
refactor(prime): replace manual resetWithdrawnStake with auto-expirin…
Debugger022 Mar 2, 2026
05d3cd3
docs: add HashDit audit report for repay improvisation
Debugger022 Mar 3, 2026
8f2c1bb
Merge pull request #646 from VenusProtocol/feat/VPD-233
fred-venus Mar 3, 2026
9c6467d
chore(release): 10.2.0-dev.3 [skip ci]
toolsvenus Mar 3, 2026
3576006
feat(prime): add tier-based fallback compaction and increase deposit …
Debugger022 Mar 3, 2026
bf7b662
refactor(prime): remove withdrawn stake tracking from PrimeLeaderboard
Debugger022 Mar 3, 2026
a2767ab
refactor(prime): remove minimumStake variable from PrimeLeaderboard
Debugger022 Mar 5, 2026
5abf8c2
refactor(prime): remove redundant token.exists check in _mint
Debugger022 Mar 5, 2026
cdacaed
feat(prime): add burnBatch function to PrimeV2
Debugger022 Mar 5, 2026
28b7362
refactor(prime): hoist accrueInterest out of per-user loops
Debugger022 Mar 5, 2026
2b79c49
fix(prime): move rewardIndex update inside token holder check
Debugger022 Mar 5, 2026
56b4158
refactor(prime): simplify pendingScoreUpdates guard in issue/burn
Debugger022 Mar 5, 2026
821c4da
feat(prime): add initializeStakers and finalizeInitialization
Debugger022 Mar 5, 2026
9161327
fix(prime): use weighted average timestamp in tier compaction
Debugger022 Mar 5, 2026
ce25b09
refactor(prime): make vault config immutable in PrimeV2
Debugger022 Mar 5, 2026
c9f9df9
refactor(prime): remove PrimeV2Keeper contract
Debugger022 Mar 5, 2026
77a6f92
fix(prime): fix CI/CD issues in deploy scripts and formatting
Debugger022 Mar 5, 2026
8e953d3
feat(prime): add single issue(address) and rename batch to issueBatch
Debugger022 Mar 5, 2026
98bc0fd
fix(prime): add missing events and fix event indexing in PrimeV2 cont…
Debugger022 Mar 5, 2026
92dcfe5
refactor(prime): hoist accrueAllMarkets out of burnBatch loop
Debugger022 Mar 5, 2026
9c37f9d
refactor(prime): gas optimizations and storage simplification
Debugger022 Mar 5, 2026
b2b5c91
fix(prime): add maxLoops guard, removeMarket, and NatSpec improvements
Debugger022 Mar 5, 2026
bd06d9d
refactor(prime): add MaxLoopsLimitHelper to PrimeLeaderboard and merg…
Debugger022 Mar 5, 2026
8aacdf0
fix(prime): prevent removeMarket when market has active members
Debugger022 Mar 5, 2026
7032cd0
test(prime): add interest accrual, claiming, and score update tests
Debugger022 Mar 5, 2026
dd05f07
refactor(test): modularize PrimeV2 and PrimeLeaderboard test suites
Debugger022 Mar 5, 2026
de8c966
fix(prime): allow claiming residual interest after market removal
Debugger022 Mar 5, 2026
bf0260c
test(prime): add 36 integration tests for PrimeV2 + PrimeLeaderboard
Debugger022 Mar 5, 2026
e3f9fbd
fix(prime): add _ensureMaxLoops guard to _accrueInterestAndUpdateScor…
Debugger022 Mar 5, 2026
b2c548e
docs(prime): add NatSpec for permissionless claimInterest and oracle …
Debugger022 Mar 5, 2026
0d0dd31
refactor(test): clean up vague comments and dead code in PrimeV2 tests
Debugger022 Mar 5, 2026
20fe62f
fix(prime): move isPrimeHolder check from _burnWithoutAccrual to burn…
Debugger022 Mar 5, 2026
f614ae1
test(prime): add 48 fork tests covering batch ops, market removal, co…
Debugger022 Mar 5, 2026
105766b
fix: update VBep20 and VToken interfaces for internal cash tracking
Debugger022 Mar 16, 2026
8d7f003
test: update unit tests for internal cash tracking changes
Debugger022 Mar 16, 2026
38f7492
test: add fork tests for donation attack and internal cash upgrade
Debugger022 Mar 16, 2026
761c400
test(fork): improve internalCashUpgrade tests with descriptive error …
Debugger022 Mar 16, 2026
5afbd42
feat: add sweepToken in assembly and optimize VBep20 for contract size
Debugger022 Mar 16, 2026
04f6231
refactor: simplify sweepToken by removing redundant token parameter
Debugger022 Mar 16, 2026
0f01777
fix(VBep20): use correct selector for isAllowedToCall in sweepToken
Debugger022 Mar 16, 2026
610ad07
fix(VBep20): restore free memory pointer in sweepToken assembly
Debugger022 Mar 16, 2026
e81b0bf
test: add sweepToken and syncCash unit tests and vXAUM to fork markets
Debugger022 Mar 16, 2026
cf48a2a
test(fork): reorganize donationAttack tests with listed markets
Debugger022 Mar 16, 2026
05db3e5
chore(test): clean up formatting and remove unused imports
Debugger022 Mar 16, 2026
2f578e9
refactor(VBep20): merge syncCash and sweepToken into sweepTokenAndSync
Debugger022 Mar 16, 2026
7dcd781
test: consolidate and improve donation attack and sweep tests
Debugger022 Mar 16, 2026
94373fe
docs(VBep20): update natspec to reflect internalCash tracking
Debugger022 Mar 17, 2026
c88b6e4
chore(deploy): deploy VBep20Delegate to BSC mainnet
Debugger022 Mar 17, 2026
0a905ab
feat: updating deployment files
Debugger022 Mar 17, 2026
5c311b0
chore: remove duplicate import and unused typechain imports
Debugger022 Mar 19, 2026
373e97c
test(fork): improve storage checks and move upgrade guard to before()
Debugger022 Mar 19, 2026
e1b9231
docs(audits): add VBep20 donation patch audit reports
Debugger022 Mar 20, 2026
7c95843
Merge pull request #664 from VenusProtocol/feat/VPD-808
fred-venus Mar 20, 2026
3c4d06f
chore(release): 10.2.0-dev.4 [skip ci]
toolsvenus Mar 20, 2026
feb5489
docs(audits): rename and add donation attack patch audit reports
Debugger022 Mar 26, 2026
ab5a760
feat: (WIP) integrate DeviationBoundedOracle for conservative CF-path…
GitGuru7 Mar 31, 2026
23d27d6
feat: integrate DeviationBoundedOracle with minimal local interface f…
GitGuru7 Apr 2, 2026
2ce8bfc
refactor: clean up DBO integration — fix oracle fetch, remove _getAcc…
GitGuru7 Apr 2, 2026
06e23f9
refactor: improve DBO docs, add getBoundedPricesView, guard setDeviat…
GitGuru7 Apr 2, 2026
7813c58
feat: add tests
GitGuru7 Apr 7, 2026
ed84af4
feat: deployment scripts and fork tests
GitGuru7 Apr 7, 2026
d5291d3
refactor: minor cleanup
GitGuru7 Apr 8, 2026
91182b8
feat: improve fork tests
GitGuru7 Apr 9, 2026
f53589e
feat: integrate DBO bounded prices into lens contracts and borrowAllowed
GitGuru7 Apr 10, 2026
95b8c6a
feat: wire bounded prices into VAIController mint Allowance
GitGuru7 Apr 13, 2026
792dcae
test(unit): fix unit tests for deviation bounded oracle changes
GitGuru7 Apr 15, 2026
c856c36
refactor: revert venus lens changes
GitGuru7 Apr 16, 2026
a066e96
docs: [I03] Document DBO dependency for claimVenus CF path
GitGuru7 Apr 20, 2026
7357754
fix: [L01] Update DBO State For Entered Markets On mintVAI
GitGuru7 Apr 20, 2026
8999c8d
feat: redeploy comptroller facets and lenses on bsctestnet
GitGuru7 Apr 21, 2026
fea3e83
Merge pull request #667 from VenusProtocol/feat/audit
Debugger022 Apr 23, 2026
6400a06
chore(release): 10.2.0-dev.5 [skip ci]
toolsvenus Apr 23, 2026
2ea0346
refactor(PrimeV2): remove unused primeLeaderboard storage and setter
Debugger022 Apr 27, 2026
07a7f09
docs(PrimeV2): complete NatSpec coverage and simplify accounting vars
Debugger022 Apr 27, 2026
e52ed46
chore(deploy): remove setPrimeLeaderboard wiring from PrimeV2 deploy …
Debugger022 Apr 27, 2026
a1bdbfd
Merge pull request #669 from VenusProtocol/fix/vpd-893-hashdit
GitGuru7 Apr 30, 2026
5d3a8a3
fix: rework facet-cut generator with etherscan resolution and diff ou…
GitGuru7 Apr 30, 2026
a4d345e
Merge pull request #629 from VenusProtocol/feat/facet-cut-script
GitGuru7 Apr 30, 2026
a3561a1
chore: redeploy Comptroller and VAI implementation on bscmainnet
GitGuru7 Apr 30, 2026
7d67782
feat: updating deployment files
GitGuru7 May 1, 2026
0e03631
feat(prime-v2): add permissionless claimPrime with epoch threshold gate
Debugger022 May 1, 2026
01a16a3
Merge branch 'feat/vpd-893-comptroller-deployment' into feat/vpd-893-…
GitGuru7 May 1, 2026
d47d978
chore: run prettier
GitGuru7 May 1, 2026
1156d8f
feat: updating deployment files
GitGuru7 May 1, 2026
7713507
chore: bump oracle package version
GitGuru7 May 7, 2026
3dc2475
test: minor test fix
GitGuru7 May 7, 2026
82c3473
Merge pull request #668 from VenusProtocol/feat/vpd-893-bounded-price…
GitGuru7 May 7, 2026
77590fc
chore(release): 10.2.0-dev.6 [skip ci]
toolsvenus May 7, 2026
99c9435
feat(prime): add script to drain pendingScoreUpdates after addMarket
Debugger022 May 11, 2026
9a6aa2a
refactor(prime-v2): remove MAXIMUM_XVS_CAP from score calculation
Debugger022 May 11, 2026
dbf0369
refactor: parallelize isScoreUpdated, default FROM_BLOCK
Debugger022 May 12, 2026
71884cc
fix(prime-update-scores): harden for BSC mainnet
fred-venus May 17, 2026
7bb5c03
Merge pull request #671 from VenusProtocol/feat/VPD-1182
fred-venus May 17, 2026
f64be61
chore(release): 10.2.0-dev.7 [skip ci]
toolsvenus May 17, 2026
ce7d47e
fix: [L02]
Debugger022 May 19, 2026
027abf8
fix: [L03]
Debugger022 May 20, 2026
7c05ebd
fix: [I03]
Debugger022 May 20, 2026
b96facb
fix: [I04]
Debugger022 May 20, 2026
9ad4f33
fix: [I05]
Debugger022 May 20, 2026
f73bf9e
fix: [I11]
Debugger022 May 20, 2026
4449a25
fix: [I13]
Debugger022 May 20, 2026
5fcc3f8
fix: [M01]
Debugger022 May 21, 2026
649c015
fix: [M02]
Debugger022 May 21, 2026
85b7951
fix: [L04]
Debugger022 May 21, 2026
9456254
fix: [I06]
Debugger022 May 21, 2026
95faa37
chore: fix wrong path in comment
caltechustc May 23, 2026
61625b1
fix: carry-forward PLP income when sumOfMembersScore is zero
Debugger022 May 27, 2026
e421dda
fix: ceil weighted timestamp on deposit compaction
Debugger022 May 28, 2026
d8e6f8d
docs: add PrimeV2 hashdit audit report
Debugger022 May 28, 2026
b531da6
Merge pull request #675 from caltechustc/develop
fred-venus May 29, 2026
9afff69
chore(deploy): split PrimeLeaderboard into its own deploy script
Debugger022 May 29, 2026
ed036db
chore(deploy): add PrimeV2 and PrimeLeaderboard bsctestnet deployments
Debugger022 May 29, 2026
c0b1d35
chore(deploy): transfer PrimeV2/PrimeLeaderboard ownership in deploy …
Debugger022 May 29, 2026
2f809a8
revert: carry-forward PLP income when sumOfMembersScore is zero
Debugger022 Jun 1, 2026
b4fca63
feat(prime): track and reclaim undistributed PLP income via sweep
Debugger022 Jun 2, 2026
789a6eb
Merge branch 'feat/VPD-1292' into feat/VPD-1313
Debugger022 Jun 2, 2026
bd8f68c
chore(deploy): redeploy PrimeV2 on bsctestnet after sweep + carry-for…
Debugger022 Jun 2, 2026
c3e0866
feat(prime): track lifetime accrued per (market, user) with cycle sna…
Debugger022 Jun 4, 2026
d1a77fa
Merge branch 'feat/VPD-1292' into feat/VPD-1313
Debugger022 Jun 4, 2026
c33d138
chore(deploy): add PrimeV2 impl-only deploy script + bsctestnet impl
Debugger022 Jun 4, 2026
acfafd3
test(prime): add PrimeV2 bsctestnet end-to-end fork test
Debugger022 Jun 4, 2026
3b8b10a
fix: [VLP-02]
Debugger022 Jun 5, 2026
a1fc829
fix: [VLP-05]
Debugger022 Jun 8, 2026
99357f7
fix(deployments): rename PT-USDe-30Oct2025 testnet artifacts to canon…
GitGuru7 Jun 8, 2026
54e5255
feat: deploy new markets on testnet
GitGuru7 Jun 8, 2026
ac0e1ce
feat: updating deployment files
GitGuru7 Jun 8, 2026
9e2811d
feat: deploy new core markets for bscmainnet and bsctestnet
GitGuru7 Jun 9, 2026
bbd4545
feat: updating deployment files
GitGuru7 Jun 9, 2026
4efd603
docs: add PrimeV2 certik audit report
Debugger022 Jun 10, 2026
3bc5db6
Merge pull request #678 from VenusProtocol/feat/VPD-1366
Debugger022 Jun 10, 2026
a06660b
docs: add PrimeV2 sherlock audit report
Debugger022 Jun 10, 2026
4b5866b
Merge pull request #676 from VenusProtocol/feat/VPD-1292
Debugger022 Jun 10, 2026
d78ca10
Merge pull request #674 from VenusProtocol/feat/VPD-1247
Debugger022 Jun 10, 2026
34cc699
chore(deploy): sync bsctestnet PrimeV2 + PrimeLeaderboard deployments…
Debugger022 Jun 11, 2026
434df1e
fix(hashdit): [I02]
Debugger022 Jun 15, 2026
019f60f
feat: deploy SPCXB market on bnb chain
GitGuru7 Jun 16, 2026
48184e0
feat: updating deployment files
GitGuru7 Jun 16, 2026
615781b
feat: add BNB Core deprecation interest rate model
Debugger022 Jun 16, 2026
b778211
feat: updating deployment files
Debugger022 Jun 16, 2026
1bbfe13
Merge pull request #679 from VenusProtocol/feat/vpd-1341
fred-venus Jun 17, 2026
d4a33b8
chore(release): 10.2.0-dev.8 [skip ci]
toolsvenus Jun 17, 2026
81ea8e6
chore(deploy): add bscmainnet PrimeV2 + PrimeLeaderboard deployments
Debugger022 Jun 23, 2026
6341f41
feat(prime-v2): add PrimeLens for off-chain APR queries
Debugger022 Jun 23, 2026
284eb8c
feat(prime-v2): primeLens native market support + deploy script
Debugger022 Jun 23, 2026
8a2d7d8
chore(deploy): add bsctestnet PrimeLens deployment
Debugger022 Jun 23, 2026
818a219
test(prime-v2): fork test for WBNB reward distribution on bsctestnet
Debugger022 Jun 24, 2026
bd55802
chore(deploy): record PrimeLens deployment on bscmainnet
Debugger022 Jun 25, 2026
17e0340
Merge pull request #677 from VenusProtocol/feat/VPD-1313
fred-venus Jun 29, 2026
f179ba2
feat: updating deployment files
fred-venus Jun 29, 2026
092a43f
Merge pull request #682 from VenusProtocol/feat/VPD-1168
fred-venus Jun 29, 2026
63a80b3
chore(release): 10.2.0-dev.9 [skip ci]
toolsvenus Jun 29, 2026
0d7c970
chore(deploy): redeploy PrimeV2 implementation on bscmainnet
Debugger022 Jun 29, 2026
b35e769
feat: updating deployment files
Debugger022 Jun 29, 2026
0b2349f
chore(deploy): redeploy PrimeLens on bscmainnet
Debugger022 Jun 29, 2026
710d8ef
feat: updating deployment files
Debugger022 Jun 29, 2026
a729326
test(prime): fix fork fixture wiring and pin lens block
Debugger022 Jun 29, 2026
9a71ef5
Merge pull request #670 from VenusProtocol/feat/prime-v2
fred-venus Jun 30, 2026
55a6bc3
chore(release): 10.2.0-dev.10 [skip ci]
toolsvenus Jun 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ junit.xml
.saddle_history
contracts/generated

# Claude-generated summaries
.claude-docs/

# yarn
.yarn/*
!.yarn/patches
Expand Down
242 changes: 242 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,5 +195,3 @@ MNEMONIC="<>" BSC_API_KEY="<>" npx hardhat run ./script/hardhat/deploy.ts --netw
For any concerns with the protocol, open an issue or visit us on [Telegram](https://t.me/venusprotocol) to discuss.

For security concerns, please contact the administrators of our telegram chat.

© Copyright 2023, Venus Protocol
Binary file added audits/156_PrimeV2_hashdit_20260522.pdf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added audits/157_PrimeV2_Certik_20260610.pdf
Binary file not shown.
Binary file not shown.
Binary file added audits/158_PrimeV2_Sherlock_20260610.pdf
Binary file not shown.
Binary file not shown.
3 changes: 3 additions & 0 deletions contracts/Comptroller/ComptrollerInterface.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity 0.8.25;

import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
import { IDeviationBoundedOracle } from "@venusprotocol/oracle/contracts/interfaces/IDeviationBoundedOracle.sol";

import { VToken } from "../Tokens/VTokens/VToken.sol";
import { VAIControllerInterface } from "../Tokens/VAI/VAIControllerInterface.sol";
Expand Down Expand Up @@ -132,6 +133,8 @@ interface ComptrollerInterface {

function oracle() external view returns (ResilientOracleInterface);

function deviationBoundedOracle() external view returns (IDeviationBoundedOracle);

function getAccountLiquidity(address) external view returns (uint, uint, uint);

function getAssetsIn(address) external view returns (VToken[] memory);
Expand Down
6 changes: 6 additions & 0 deletions contracts/Comptroller/ComptrollerStorage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity 0.8.25;

import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
import { IDeviationBoundedOracle } from "@venusprotocol/oracle/contracts/interfaces/IDeviationBoundedOracle.sol";
import { PoolMarketId } from "./Types/PoolMarketId.sol";

import { VToken } from "../Tokens/VTokens/VToken.sol";
Expand Down Expand Up @@ -328,3 +329,8 @@ contract ComptrollerV18Storage is ComptrollerV17Storage {
/// @notice Whether flash loans are paused system-wide
bool public flashLoanPaused;
}

contract ComptrollerV19Storage is ComptrollerV18Storage {
/// @notice DeviationBoundedOracle for conservative pricing in CF path
IDeviationBoundedOracle public deviationBoundedOracle;
}
6 changes: 3 additions & 3 deletions contracts/Comptroller/Diamond/Diamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ pragma solidity 0.8.25;

import { IDiamondCut } from "./interfaces/IDiamondCut.sol";
import { Unitroller } from "../Unitroller.sol";
import { ComptrollerV18Storage } from "../ComptrollerStorage.sol";
import { ComptrollerV19Storage } from "../ComptrollerStorage.sol";

/**
* @title Diamond
* @author Venus
* @notice This contract contains functions related to facets
*/
contract Diamond is IDiamondCut, ComptrollerV18Storage {
contract Diamond is IDiamondCut, ComptrollerV19Storage {
/// @notice Emitted when functions are added, replaced or removed to facets
event DiamondCut(IDiamondCut.FacetCut[] _diamondCut);

Expand Down Expand Up @@ -72,7 +72,7 @@ contract Diamond is IDiamondCut, ComptrollerV18Storage {
*/
function facetAddress(
bytes4 functionSelector
) external view returns (ComptrollerV18Storage.FacetAddressAndPosition memory) {
) external view returns (ComptrollerV19Storage.FacetAddressAndPosition memory) {
return _selectorToFacetAndPosition[functionSelector];
}

Expand Down
108 changes: 69 additions & 39 deletions contracts/Comptroller/Diamond/facets/FacetBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { VToken } from "../../../Tokens/VTokens/VToken.sol";
import { ComptrollerErrorReporter } from "../../../Utils/ErrorReporter.sol";
import { ExponentialNoError } from "../../../Utils/ExponentialNoError.sol";
import { IVAIVault, Action } from "../../../Comptroller/ComptrollerInterface.sol";
import { ComptrollerV18Storage } from "../../../Comptroller/ComptrollerStorage.sol";
import { ComptrollerV19Storage } from "../../../Comptroller/ComptrollerStorage.sol";
import { IDeviationBoundedOracle } from "@venusprotocol/oracle/contracts/interfaces/IDeviationBoundedOracle.sol";
import { PoolMarketId } from "../../../Comptroller/Types/PoolMarketId.sol";
import { IFacetBase, WeightFunction } from "../interfaces/IFacetBase.sol";

Expand All @@ -19,7 +20,7 @@ import { IFacetBase, WeightFunction } from "../interfaces/IFacetBase.sol";
* @author Venus
* @notice This facet contract contains functions related to access and checks
*/
contract FacetBase is IFacetBase, ComptrollerV18Storage, ExponentialNoError, ComptrollerErrorReporter {
contract FacetBase is IFacetBase, ComptrollerV19Storage, ExponentialNoError, ComptrollerErrorReporter {
using SafeERC20 for IERC20;

/// @notice The initial Venus index for a market
Expand Down Expand Up @@ -134,26 +135,69 @@ contract FacetBase is IFacetBase, ComptrollerV18Storage, ExponentialNoError, Com
}

/**
* @notice Determine what the account liquidity would be if the given amounts were redeemed/borrowed
* @param vTokenModify The market to hypothetically redeem/borrow in
* @notice Computes hypothetical account liquidity after applying the given redeem/borrow amounts.
* Use this in state-changing contexts (hooks, claim flows, pool selection).
* When `weightingStrategy` is USE_COLLATERAL_FACTOR, calls `_updateProtectionStates` before
* delegating to the lens, which updates the bounded price and enables protection if the deviation
* exceeds the threshold.
* @param account The account to determine liquidity for
* @param redeemTokens The number of tokens to hypothetically redeem
* @param vTokenModify The market to hypothetically redeem/borrow in
* @param redeemTokens The number of vTokens to hypothetically redeem
* @param borrowAmount The amount of underlying to hypothetically borrow
* @param weightingStrategy The weighting strategy to use:
* - `WeightFunction.USE_COLLATERAL_FACTOR` to use collateral factor
* - `WeightFunction.USE_LIQUIDATION_THRESHOLD` to use liquidation threshold
* @dev Note that we calculate the exchangeRateStored for each collateral vToken using stored data,
* without calculating accumulated interest.
* @return (possible error code,
hypothetical account liquidity in excess of collateral requirements,
* hypothetical account shortfall below collateral requirements)
* @param weightingStrategy USE_COLLATERAL_FACTOR for borrow/entry checks; USE_LIQUIDATION_THRESHOLD for liquidation checks
* @return err Possible error code
* @return liquidity Hypothetical excess liquidity above collateral requirements (0 if in shortfall)
* @return shortfall Hypothetical shortfall below collateral requirements (0 if solvent)
*/
function getHypotheticalAccountLiquidityInternal(
address account,
VToken vTokenModify,
uint256 redeemTokens,
uint256 borrowAmount,
WeightFunction weightingStrategy
) internal returns (Error, uint256, uint256) {
// Populate the DBO transient price cache (EIP-1153) for all entered assets.
// Required on the CF path so bounded prices are computed once and reused
// by view functions (e.g. getBoundedCollateralPriceView / getBoundedDebtPriceView)
// within the same transaction.
if (weightingStrategy == WeightFunction.USE_COLLATERAL_FACTOR) {
_updateProtectionStates(account);
}
(uint256 err, uint256 liquidity, uint256 shortfall) = comptrollerLens.getHypotheticalAccountLiquidity(
address(this),
account,
vTokenModify,
redeemTokens,
borrowAmount,
weightingStrategy
);
return (Error(err), liquidity, shortfall);
}

/**
* @notice View-only variant: reads bounded prices from the DeviationBoundedOracle without updating
* the transient cache. Use this only in external view functions where state mutation is not
* permitted. On write paths use `getHypotheticalAccountLiquidityInternal` instead.
* @dev If `getHypotheticalAccountLiquidityInternal` (or any code that calls `_updateProtectionStates`)
* was already executed earlier in the same transaction, the DBO transient cache will already be
* populated and this function will read from it gas-efficiently — no recomputation occurs.
* If called in a standalone view context (cold cache), the DBO must compute bounded prices from
* scratch on each call; results are still correct but cost more gas.
* @param account The account to determine liquidity for
* @param vTokenModify The market to hypothetically redeem/borrow in
* @param redeemTokens The number of vTokens to hypothetically redeem
* @param borrowAmount The amount of underlying to hypothetically borrow
* @param weightingStrategy USE_COLLATERAL_FACTOR for borrow/entry checks; USE_LIQUIDATION_THRESHOLD for liquidation checks
* @return err Possible error code
* @return liquidity Hypothetical excess liquidity above collateral requirements (0 if in shortfall)
* @return shortfall Hypothetical shortfall below collateral requirements (0 if solvent)
*/
function getHypotheticalAccountLiquidityInternalView(
address account,
VToken vTokenModify,
uint256 redeemTokens,
uint256 borrowAmount,
WeightFunction weightingStrategy
) internal view returns (Error, uint256, uint256) {
(uint256 err, uint256 liquidity, uint256 shortfall) = comptrollerLens.getHypotheticalAccountLiquidity(
address(this),
Expand Down Expand Up @@ -200,11 +244,7 @@ contract FacetBase is IFacetBase, ComptrollerV18Storage, ExponentialNoError, Com
* @param redeemTokens Amount of tokens to redeem
* @return Success indicator for redeem is allowed or not
*/
function redeemAllowedInternal(
address vToken,
address redeemer,
uint256 redeemTokens
) internal view returns (uint256) {
function redeemAllowedInternal(address vToken, address redeemer, uint256 redeemTokens) internal returns (uint256) {
ensureListed(getCorePoolMarket(vToken));
/* If the redeemer is not 'in' the market, then we can bypass the liquidity check */
if (!getCorePoolMarket(vToken).accountMembership[redeemer]) {
Expand Down Expand Up @@ -260,27 +300,17 @@ contract FacetBase is IFacetBase, ComptrollerV18Storage, ExponentialNoError, Com
}

/**
* @notice Determine the current account liquidity wrt collateral requirements
* @param account The account to get liquidity for
* @param weightingStrategy The weighting strategy to use:
* - `WeightFunction.USE_COLLATERAL_FACTOR` to use collateral factor
* - `WeightFunction.USE_LIQUIDATION_THRESHOLD` to use liquidation threshold
* @return (possible error code (semi-opaque),
* account liquidity in excess of collateral requirements,
* account shortfall below collateral requirements)
* @notice Updates the DeviationBoundedOracle protection state for all assets the account has entered
* @dev This populates the transient price cache so subsequent view calls in the same transaction
* are gas-efficient. Should be called before any liquidity calculation in the CF path.
* @param account The account whose collateral assets need protection state updates
*/
function _getAccountLiquidity(
address account,
WeightFunction weightingStrategy
) internal view returns (uint256, uint256, uint256) {
(Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(
account,
VToken(address(0)),
0,
0,
weightingStrategy
);

return (uint256(err), liquidity, shortfall);
function _updateProtectionStates(address account) internal {
IDeviationBoundedOracle boundedOracle = deviationBoundedOracle;
VToken[] memory assets = accountAssets[account];
uint256 len = assets.length;
for (uint256 i; i < len; ++i) {
boundedOracle.updateProtectionState(address(assets[i]));
}
}
}
13 changes: 9 additions & 4 deletions contracts/Comptroller/Diamond/facets/MarketFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,15 @@ contract MarketFacet is IMarketFacet, FacetBase {

userPoolId[msg.sender] = poolId;

(uint256 error, , uint256 shortfall) = _getAccountLiquidity(msg.sender, WeightFunction.USE_COLLATERAL_FACTOR);

if (error != 0 || shortfall > 0) {
revert LiquidityCheckFailed(error, shortfall);
(Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(
msg.sender,
VToken(address(0)),
0,
0,
WeightFunction.USE_COLLATERAL_FACTOR
);
if (err != Error.NO_ERROR || shortfall > 0) {
revert LiquidityCheckFailed(uint256(err), shortfall);
}
}

Expand Down
25 changes: 20 additions & 5 deletions contracts/Comptroller/Diamond/facets/PolicyFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ contract PolicyFacet is IPolicyFacet, XVSRewardsHelper {
}
}

if (oracle.getUnderlyingPrice(vToken) == 0) {
(uint256 collateralPrice, uint256 debtPrice) = deviationBoundedOracle.getBoundedPricesView(vToken);
if (collateralPrice == 0 || debtPrice == 0) {
return uint256(Error.PRICE_ERROR);
}

Expand Down Expand Up @@ -258,7 +259,7 @@ contract PolicyFacet is IPolicyFacet, XVSRewardsHelper {
}

/* The borrower must have shortfall in order to be liquidatable */
(Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternal(
(Error err, , uint256 shortfall) = getHypotheticalAccountLiquidityInternalView(
borrower,
VToken(address(0)),
0,
Expand Down Expand Up @@ -426,7 +427,14 @@ contract PolicyFacet is IPolicyFacet, XVSRewardsHelper {
* account shortfall below collateral requirements)
*/
function getBorrowingPower(address account) external view returns (uint256, uint256, uint256) {
return _getAccountLiquidity(account, WeightFunction.USE_COLLATERAL_FACTOR);
(Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternalView(
account,
VToken(address(0)),
0,
0,
WeightFunction.USE_COLLATERAL_FACTOR
);
return (uint256(err), liquidity, shortfall);
}

/**
Expand All @@ -437,7 +445,14 @@ contract PolicyFacet is IPolicyFacet, XVSRewardsHelper {
* account shortfall below liquidation threshold requirements)
*/
function getAccountLiquidity(address account) external view returns (uint256, uint256, uint256) {
return _getAccountLiquidity(account, WeightFunction.USE_LIQUIDATION_THRESHOLD);
(Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternalView(
account,
VToken(address(0)),
0,
0,
WeightFunction.USE_LIQUIDATION_THRESHOLD
);
return (uint256(err), liquidity, shortfall);
}

/**
Expand All @@ -456,7 +471,7 @@ contract PolicyFacet is IPolicyFacet, XVSRewardsHelper {
uint256 redeemTokens,
uint256 borrowAmount
) external view returns (uint256, uint256, uint256) {
(Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternal(
(Error err, uint256 liquidity, uint256 shortfall) = getHypotheticalAccountLiquidityInternalView(
account,
VToken(vTokenModify),
redeemTokens,
Expand Down
4 changes: 4 additions & 0 deletions contracts/Comptroller/Diamond/facets/RewardFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,10 @@ contract RewardFacet is IRewardFacet, XVSRewardsHelper {

/**
* @notice Claim all xvs accrued by the holders
* @dev The shortfall probe uses the CF path, which reads DeviationBoundedOracle (DBO) bounded prices.
* When DBO protection mode is active, a holder with a position that is healthy at spot prices may still
* show a positive shortfall here, and in that case XVS earned will not be granted as collateral even when
* `collateral` is true. This is consistent with the borrow/redeem CF paths under DBO.
* @param holders The addresses to claim XVS for
* @param vTokens The list of markets to claim XVS in
* @param borrowers Whether or not to claim XVS earned by borrowing
Expand Down
27 changes: 27 additions & 0 deletions contracts/Comptroller/Diamond/facets/SetterFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity 0.8.25;

import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
import { IDeviationBoundedOracle } from "@venusprotocol/oracle/contracts/interfaces/IDeviationBoundedOracle.sol";

import { VToken } from "../../../Tokens/VTokens/VToken.sol";
import { Action } from "../../ComptrollerInterface.sol";
Expand Down Expand Up @@ -42,6 +43,12 @@ contract SetterFacet is ISetterFacet, FacetBase {
/// @notice Emitted when price oracle is changed
event NewPriceOracle(ResilientOracleInterface oldPriceOracle, ResilientOracleInterface newPriceOracle);

/// @notice Emitted when deviation bounded oracle is changed
event NewDeviationBoundedOracle(
IDeviationBoundedOracle oldDeviationBoundedOracle,
IDeviationBoundedOracle newDeviationBoundedOracle
);

/// @notice Emitted when borrow cap for a vToken is changed
event NewBorrowCap(VToken indexed vToken, uint256 newBorrowCap);

Expand Down Expand Up @@ -764,6 +771,26 @@ contract SetterFacet is ISetterFacet, FacetBase {
m.isBorrowAllowed = borrowAllowed;
}

/**
* @notice Sets the DeviationBoundedOracle for conservative CF-path pricing
* @param newDeviationBoundedOracle The new DeviationBoundedOracle contract
* @return uint256 0=success, otherwise a failure
*/
function setDeviationBoundedOracle(
IDeviationBoundedOracle newDeviationBoundedOracle
) external compareAddress(address(deviationBoundedOracle), address(newDeviationBoundedOracle)) returns (uint256) {
ensureAllowed("setDeviationBoundedOracle(address)");

ensureNonzeroAddress(address(newDeviationBoundedOracle));

IDeviationBoundedOracle oldDeviationBoundedOracle = deviationBoundedOracle;
deviationBoundedOracle = newDeviationBoundedOracle;

emit NewDeviationBoundedOracle(oldDeviationBoundedOracle, newDeviationBoundedOracle);

return uint256(Error.NO_ERROR);
}

/**
* @dev Updates the valid price oracle. Used by _setPriceOracle and setPriceOracle
* @param newOracle The new price oracle to be set
Expand Down
4 changes: 1 addition & 3 deletions contracts/Comptroller/Diamond/interfaces/IRewardFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
pragma solidity 0.8.25;

import { VToken } from "../../../Tokens/VTokens/VToken.sol";
import { Action } from "../../ComptrollerInterface.sol";
import { IFacetBase } from "./IFacetBase.sol";

interface IRewardFacet is IFacetBase {
interface IRewardFacet {
function claimVenus(address holder) external;

function claimVenus(address holder, VToken[] calldata vTokens) external;
Expand Down
3 changes: 3 additions & 0 deletions contracts/Comptroller/Diamond/interfaces/ISetterFacet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pragma solidity 0.8.25;

import { ResilientOracleInterface } from "@venusprotocol/oracle/contracts/interfaces/OracleInterface.sol";
import { IDeviationBoundedOracle } from "@venusprotocol/oracle/contracts/interfaces/IDeviationBoundedOracle.sol";
import { VToken } from "../../../Tokens/VTokens/VToken.sol";
import { Action } from "../../ComptrollerInterface.sol";
import { VAIControllerInterface } from "../../../Tokens/VAI/VAIControllerInterface.sol";
Expand Down Expand Up @@ -105,4 +106,6 @@ interface ISetterFacet {
function setAllowCorePoolFallback(uint96 poolId, bool allowFallback) external;

function setFlashLoanPaused(bool paused) external;

function setDeviationBoundedOracle(IDeviationBoundedOracle newDeviationBoundedOracle) external returns (uint256);
}
Loading