Skip to content

[VPD-1314] Configure PrimeV2 on BSC#712

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

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

Conversation

@Debugger022
Copy link
Copy Markdown
Contributor

Summary

  • Add VIP-675 (bsctestnet) bringing the new PrimeV2 and PrimeLeaderboard contracts live and decommissioning the legacy Prime.
  • Contracts deployed via venus-protocol PR #677; this VIP performs the on-chain governance setup the deploy scripts intentionally leave to governance.
  • Includes a fork simulation covering the full lifecycle and post-state.

Changes

VIP (vips/vip-675/bsctestnet.ts)

  • Accept ownership of PrimeV2 + PrimeLeaderboard (deploy initiates transfer to NormalTimelock; acceptance is governance).
  • Grant ACM permissions: config functions to NormalTimelock; epoch ops (issue/issueBatch/burn/burnBatch, setMintThreshold, initializeStakers, finalizeInitialization) to NormalTimelock + Guardian; pause/unpause to all three timelocks.
  • Wire PrimeV2 ↔ PrimeLeaderboard (ACM-gated, not done at deploy on live nets).
  • Repoint existing PrimeLiquidityProvider at PrimeV2 (setPrimeToken).
  • Add Core pool markets (vUSDT, vUSDC, vBTC, vETH) mirroring legacy supply/borrow multipliers.
  • Open permissionless mint window via setMintThreshold (1 XVS effective stake, no deadline).
  • Decommission legacy Prime via togglePause() (note: setLimit(0,0) reverts InvalidLimit — tokens already minted).
  • Tiers (30/60/90d → 1.3/1.6/2.0x) and tokenLimit (500) come from initializers; staker seeding done off-chain by Guardian.

Simulation (simulations/vip-675/bsctestnet.ts)

  • Pre-state, command execution, proposal lifecycle, post-state (ownership, wiring, PLP, tokenLimit, mint window, Guardian ACM roles, legacy paused, markets), and event assertions.

Test plan

  • npx hardhat test simulations/vip-675/bsctestnet.ts --fork bsctestnet → 62 passing (verified at block 110244560).
  • yarn tsc --noEmit, npx eslint, npx prettier --check on both files → clean.

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
const ALL_TIMELOCKS = [NORMAL_TIMELOCK, FAST_TRACK_TIMELOCK, CRITICAL_TIMELOCK];

// Grant a single ACM permission for `target.signature` to every timelock in `accounts`.
const grant = (target: string, signature: string, accounts: string[] = [NORMAL_TIMELOCK]) =>
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.

The comment mentions "for every timelock," but the permission is actually assigned only to NT.

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 simulations/vip-675/bsctestnet.ts Outdated
});

it("Guardian can call issue / burn / setMintThreshold on PrimeV2", async () => {
for (const sig of ["issue(address)", "burn(address)", "setMintThreshold(uint256,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.

missing assertions for
"issueBatch(address[])"
"burnBatch(address[])"

can also add the event check for the ACM commands

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.

});

it("Guardian can seed stakers on PrimeLeaderboard", async () => {
for (const sig of ["initializeStakers(address[],uint256[],uint64[])", "finalizeInitialization()"]) {
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.

missing for

setMultiplierTiers(uint256[],uint256[])
setPrimeV2(address)
setMaxLoopsLimit(uint256)

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.

@GitGuru7
Copy link
Copy Markdown
Contributor

GitGuru7 commented Jun 1, 2026

missing command for XVSVault.setPrimeToken(PRIME_LEADERBOARD) ?

@GitGuru7
Copy link
Copy Markdown
Contributor

GitGuru7 commented Jun 1, 2026

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.
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.

2 participants