Skip to content

[VPD-1314] Configure PrimeV2 on BSC#712

Open
Debugger022 wants to merge 27 commits into
mainfrom
feat/VPD-1314
Open

[VPD-1314] Configure PrimeV2 on BSC#712
Debugger022 wants to merge 27 commits into
mainfrom
feat/VPD-1314

Conversation

@Debugger022

@Debugger022 Debugger022 commented May 29, 2026

Copy link
Copy Markdown
Contributor

VIP-637 [BNB Chain] PrimeV2 and PrimeLeaderboard

Summary

This proposal begins the execution of the Prime Rewards Redesign on BNB Chain — it brings the new PrimeV2 and PrimeLeaderboard contracts live and decommissions the legacy Prime program. It is the migration half of a two-proposal rollout; a companion critical proposal freezes the system beforehand so the transition from legacy Prime to PrimeV2 is seamless and nothing earned under the existing program is lost.

Description

This proposal executes the redesign set out in the Venus Tokenomics Phase II — Prime Rewards Redesign proposal; it does not change that design. PrimeV2 and the legacy Prime share one rewards vault (the PrimeLiquidityProvider), which can serve only one Prime contract at a time. Before this proposal is executed, a companion critical proposal pauses XVS Vault staking and zeroes legacy Prime emissions, and an off-chain reward settlement pays every legacy Prime holder their pending rewards in full — so repointing the vault here strands nothing.

This proposal then accepts ownership of the new contracts, grants the required ACM permissions, wires PrimeV2 and PrimeLeaderboard together, repoints the rewards vault / XVS Vault / Core pool Comptroller / VAIController from legacy Prime to the new contracts, configures the launch markets (vUSDT and vWBNB), and pauses legacy Prime. Supplying and borrowing on Venus markets are unaffected throughout; only XVS staking is temporarily paused, and is resumed by the Guardian once existing stakers are seeded into the new leaderboard off-chain.

The contracts are implemented and deployed in venus-protocol PR #676 and PR #677; the governance setup is in this PR (#712).

Actions

This proposal performs 54 transactions on BNB Chain, in the following groups.

Key addresses:

Contract Address
PrimeV2 0x059EabA8676b03e4e8f009eFb7F587C28450F50f
PrimeLeaderboard 0x55e2ccF68B7A276dc28AfA107997b8B1Be932c0b
PrimeLiquidityProvider 0x23c4F844ffDdC6161174eB32c770D4D8C07833F2
legacy Prime 0xBbCD063efE506c3D42a0Fa2dB5C08430288C71FC
Core pool Comptroller 0xfD36E2c2a6789Db23113685031d7F16329158384
VAIController 0x004065D34C6b18cE4370ced1CeBDE94865DbFAFE
  1. Accept ownershipacceptOwnership() on PrimeV2 and PrimeLeaderboard.
  2. Grant ACM permissions (43 txns) — giveCallPermission on the Access Control Manager: per-cycle ops (issue/issueBatch/burn/burnBatch/recordCycleSnapshot) to Normal Timelock + Keeper (0xe0237587acA20f9304d30FACC9Afcd5DD9a94899) + Guardian; one-time staker seeding (initializeStakers/finalizeInitialization) to Keeper + Guardian only; setMintThreshold/setLimit to Normal Timelock + Guardian only; policy levers (addMarket, removeMarket, updateAlpha, updateMultipliers, setMultiplierTiers, etc.) to Normal Timelock only; pause/unpause to all three timelocks + Guardian; circuit-breaker pause() on both PrimeV2 and the XVS Vault to the Venus team multisig (0xCCa5a587eBDBe80f23c8610F2e53B03158e62948).
  3. Wire PrimeV2 ↔ PrimeLeaderboardsetPrimeLeaderboard(address) on PrimeV2 and setPrimeV2(address) on PrimeLeaderboard.
  4. Repoint the rewards vaultsetPrimeToken(address) on the PrimeLiquidityProvider, pointing it at PrimeV2.
  5. Switch the XVS Vault hooksetPrimeToken(address,address,uint256) on the XVS Vault, pointing the prime hook at PrimeLeaderboard (reward token XVS, pool id 0 unchanged).
  6. Repoint the Core pool ComptrollersetPrimeToken(address) on the Comptroller, pointing market hooks at PrimeV2.
  7. Repoint the VAIControllersetPrimeToken(address) on the VAIController, so the Prime-holder VAI mint gate tracks PrimeV2 membership.
  8. Add Core pool marketsaddMarket(address,uint256,uint256) on PrimeV2 for vUSDT and vWBNB, each with a 2x supply multiplier and 0x borrow multiplier.
  9. Decommission legacy PrimetogglePause() on the legacy Prime contract to pause it permanently.

Note: the Notion voting doc lists an additional "Restore reward emissions" (setTokensDistributionSpeed) group, bringing its count to 55. That command is not part of this proposal — the on-chain transaction set is the 54 above. Reward distribution speeds for the launch markets are handled outside this VIP.

References

Bring PrimeV2 + PrimeLeaderboard live on bsctestnet: accept ownership,
grant ACM perms (epoch ops to NormalTimelock + Guardian), wire the pair,
repoint PrimeLiquidityProvider, add Core pool markets, open the mint
window, and pause the legacy Prime. Includes fork simulation.
@Debugger022 Debugger022 self-assigned this May 29, 2026
Comment thread vips/vip-637/bsctestnet.ts
Comment thread simulations/vip-675/bsctestnet.ts Outdated
Comment thread simulations/vip-637/bsctestnet.ts
@GitGuru7

GitGuru7 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

missing command for XVSVault.setPrimeToken(PRIME_LEADERBOARD) ?

@GitGuru7

GitGuru7 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

also update the Prime address in the Comptroller ?
here : https://github.com/VenusProtocol/venus-protocol/blob/b531da6fd7c4cc28e2b1abca668474638b5aeded/contracts/Comptroller/ComptrollerStorage.sol#L269

Add missing XVSVault.setPrimeToken (-> PrimeLeaderboard) and
Comptroller.setPrimeToken (-> PrimeV2); extend sim assertions and
fix grant helper comment.
Add pre-VIP assertions for wiring=0 and mint window=0; tighten PLP
prime equality check; mention vault/comptroller switches in header.
@Debugger022

Copy link
Copy Markdown
Contributor Author

Extend Guardian ACM permissions to every remaining ACM-gated function on
PrimeV2 / PrimeLeaderboard, and compress the leaderboard multiplier tiers
from days (30/60/90d) to hours (1/2/3h) so testnet integration can
exercise the tier progression without long waits.
@Debugger022

Copy link
Copy Markdown
Contributor Author

Upgrades the bsctestnet PrimeV2 proxy to the new implementation deployed
via venus-protocol PR #677 and grants ACM permission for the new
recordCycleSnapshot(uint256) function to NormalTimelock and Guardian,
matching the keeper grant pattern from the original VIP-675.
Redeployed PrimeV2/PrimeLeaderboard (fresh proxies + impls), so the old
addenda's wiring is stale. Accept ownership, re-grant the full ACM set
against the new addresses (plus testnet-only resetCycle), wire the pair,
and repoint the shared PLP/XVS Vault/Comptroller hooks old→new. No legacy
togglePause — already paused by VIP-675.
@Debugger022

Copy link
Copy Markdown
Contributor Author

Wire deployed PrimeV2 / PrimeLeaderboard: accept ownership, grant cycle
ACM perms to NT + Keeper + Guardian (admin NT-only), repoint PLP / XVS
Vault / Comptroller from legacy Prime, add 6 markets, pause vault until
seeding, decommission legacy.
Add the vWBNB market to PrimeV2 on bsctestnet so FE/BE integration can
exercise the new market flow. Initializes WBNB on PrimeLiquidityProvider
and sets the distribution speed to mirror mainnet (3.47e12 wei/block)
for production-like accrual during testing. Supply/borrow multipliers
match the legacy mainnet Prime (2e18 / 0).
@Debugger022

Copy link
Copy Markdown
Contributor Author

Testnet addedum to add WBNB market: https://venus-testnet.vercel.app/#/governance/proposal/691?chainId=97

Add ACM grants so the team multisig (0xCCa5...2948) can fire pause() on
both PrimeV2 and the XVS Vault as an emergency circuit breaker, matching
the cross-chain MULTISIG_PAUSER pattern from vip-616.
Remove setMintThreshold from the Keeper's permission set on PrimeV2 —
opening/closing the permissionless mint window is sensitive and reserved
for governance and the Venus Guardian multisig. Update simulation
assertions (RoleGranted 43 -> 42) and add tests verifying NormalTimelock
and Guardian hold the role while the Keeper does not.
…issions

Pauses the XVS Vault and zeroes the PLP distribution speed for every
legacy Prime underlying, so an off-chain claimInterest sweep runs against
frozen balances before PrimeV2 goes live. Executes via CriticalTimelock,
which already holds both permissions (no ACM grants).
Launch PrimeV2 with only the vUSDT and vWBNB markets instead of all six
legacy Prime markets, and re-set the PLP distribution speed for USDT and
WBNB (zeroed by the preceding critical VIP) back to their prior live
values. Sim now runs that critical VIP via CriticalTimelock in before()
so the regular VIP executes against real frozen state.

@fred-venus fred-venus 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.

Should we also consider reallocating the xvs buyback part to prime reward buyback contract ?

…st-freeze

Add a post-VIP block to the critical sim proving an arbitrary EOA can sweep
vUSDT interest on behalf of four real legacy Prime whale holders after the
freeze, confirming the off-chain claimInterest sweep pays holders directly.
@Debugger022

Copy link
Copy Markdown
Contributor Author

Should we also consider reallocating the xvs buyback part to prime reward buyback contract ?

As discussed, we will handle this through a separate VIP, where the reserve protocol configurations will be updated and the income from the XVS buyback contract will be allocated to Prime reward distribution.

…mounts

Strengthen the permissionless-claim test: assert the sweeping EOA is not a
legacy Prime holder while each whale is, and console the prime status plus the
before/after USDT balances so the sweep payout is visible in the run output.
initializeStakers and finalizeInitialization are a one-time off-chain
bootstrap, so the NormalTimelock does not need them. Grant only the Keeper
and the Guardian multisig; drops the RoleGranted count from 42 to 40.
Exercise the full end-user lifecycle (mint/borrow/accrue/claim/repay/redeem/exit)
across PrimeV2 and non-Prime markets, the PrimeV2 score hook for a real holder,
liquidation seize math, and the VAI mint gate after the legacy Prime -> PrimeV2
repoint. Repoint stale feeds to Chainlink-only to survive the testVip time-jump.
Document each scenario and ACM permission assertion inline.
Comment thread vips/vip-637/bscmainnet.ts
@GitGuru7

Copy link
Copy Markdown
Contributor

lgtm

Comment thread vips/vip-675/bscmainnet.ts Outdated
...grant(PRIME_V2, "setMaxLoopsLimit(uint256)"),
...grant(PRIME_V2, "sweepUndistributed(address,address)"),
...grant(PRIME_V2, "pause()", ALL_TIMELOCKS),
...grant(PRIME_V2, "unpause()", ALL_TIMELOCKS),

@fred-venus fred-venus Jun 29, 2026

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.

for pause and unpause, pls grant permission to guadian as well

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.

Comment thread vips/vip-675/bscmainnet.ts Outdated
...grant(PRIME_V2, "setPrimeLeaderboard(address)"),
...grant(PRIME_V2, "addMarket(address,uint256,uint256)"),
...grant(PRIME_V2, "removeMarket(address)"),
...grant(PRIME_V2, "setLimit(uint256)"),

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.

for setLimit lets have GUARDIAN as well just in case

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.

Comment thread vips/vip-637/bscmainnet.ts
Comment thread vips/vip-675/bscmainnet.ts Outdated
// The XVS Vault is already paused by the preceding critical VIP
// (vip-675/bscmainnet-critical.ts) and stays paused until the new
// PrimeLeaderboard is seeded off-chain.
export const PRIME_V2 = "0x4f5fd115Df31CC48De880a988D74aaD931851628";

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.

seems the underlying impl of this contract is not the latest ?

on-chain version:
Image

latest source code:
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.

done: 5de51fb

Comment thread vips/vip-675/bscmainnet.ts Outdated
// NormalTimelock already holds the setTokensDistributionSpeed ACM permission.
{
target: PLP,
signature: "setTokensDistributionSpeed(address[],uint256[])",

@fred-venus fred-venus Jun 29, 2026

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 seems this is gonna make no sense as when we resume the rewardDistributionSpeed the actual prime users list is empty, based on the logic the reward will be distributed nowhere but counted as undistributed which stuck until we claimUndistributed, i will suggest remove it

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

So I suggest we should get speed adjustment VIP executed earlier so that users will not wait for a long time

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Previous this decision is based on the VIP for speed adjustment would take one week. Previously, from the users' interest perspective, we need to resume emissions asap

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.

removed: 8ff356a

Debugger022 and others added 5 commits June 29, 2026 16:12
PrimeV2 has no scored members at execution (leaderboard seeded off-chain
later, XVS Vault still paused), so restoring PLP distribution speeds books
income into undistributedReward instead of reaching users. Defer the speed
restore to the off-chain seeding/resume step.
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