[VPD-954] XVS Vault reward and prime reward adjustment#691
Conversation
📝 WalkthroughWalkthroughThis pull request introduces VIP-607, a governance proposal that adds contract interface definitions (ABIs) for PrimeLiquidityProvider, XVS, and XVSVault, along with a proposal module and integration tests. The VIP executes THE token withdrawals from treasury and converter contracts, adjusts XVS vault reward distributions, and updates Prime token distribution speeds on BNB Chain. Changes
Sequence DiagramsequenceDiagram
participant Gov as Governance<br/>(Proposal)
participant Treas as Treasury &<br/>Converters
participant OTC as OTC Wallet
participant XVSVault as XVS Vault
participant Store as XVS Store
participant Prime as Prime<br/>Liquidity Provider
Gov->>Treas: Withdraw THE tokens
Treas-->>Gov: Transfer THE
Gov->>OTC: Sweep THE to wallet
OTC-->>Gov: Confirm receipt
Gov->>Treas: Transfer XVS from<br/>vault treasury
Treas-->>Store: XVS moved
Store-->>Gov: Confirm transfer
Gov->>XVSVault: Update XVS<br/>emission speed
XVSVault-->>Gov: Speed updated
Gov->>Prime: Set USDT token<br/>distribution speed
Prime-->>Gov: Speed configured
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
vips/vip-900/bscmainnet.ts (1)
12-12: Consider using checksummed address for OTC_WALLET.The address is all lowercase (
0x5e7bb1f600e42bc227755527895a282f782555ec), which bypasses EIP-55 checksum validation. Using the checksummed version would help catch typos.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@vips/vip-900/bscmainnet.ts` at line 12, The OTC_WALLET constant is using a lowercase address which bypasses EIP-55 checksum; update the OTC_WALLET value to the EIP-55 checksummed version by computing the checksum (for example with ethers.utils.getAddress or web3.utils.toChecksumAddress) and replace the current string in the OTC_WALLET export with that checksummed address so the module uses a checksummed Ethereum address.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@vips/vip-900/bscmainnet.ts`:
- Around line 17-20: The hardcoded THE token amounts (THE_AMOUNT_TREASURY,
THE_AMOUNT_RISK_FUND_CONVERTER, THE_AMOUNT_XVS_VAULT_CONVERTER,
THE_AMOUNT_USDT_PRIME_CONVERTER) may be stale and cause withdrawTreasuryBEP20 /
sweepToken calls to revert; change the flow to read the actual on‑chain token
balances at execution time instead of using fixed constants (e.g., call the
token contract's balanceOf for the treasury/converter/vault addresses) and pass
those runtime balances into withdrawTreasuryBEP20 or use a sweep-all mechanism
that withdraws the full available balance, ensuring functions like
withdrawTreasuryBEP20 and sweepToken receive live balances rather than snapshot
constants.
---
Nitpick comments:
In `@vips/vip-900/bscmainnet.ts`:
- Line 12: The OTC_WALLET constant is using a lowercase address which bypasses
EIP-55 checksum; update the OTC_WALLET value to the EIP-55 checksummed version
by computing the checksum (for example with ethers.utils.getAddress or
web3.utils.toChecksumAddress) and replace the current string in the OTC_WALLET
export with that checksummed address so the module uses a checksummed Ethereum
address.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: b0229620-589d-46cf-be49-3dc2707c1108
📒 Files selected for processing (6)
simulations/vip-900/abi/PrimeLiquidityProvider.jsonsimulations/vip-900/abi/XVS.jsonsimulations/vip-900/abi/XVSVault.jsonsimulations/vip-900/abi/erc20.jsonsimulations/vip-900/bscmainnet.tsvips/vip-900/bscmainnet.ts
| export const THE_AMOUNT_TREASURY = parseUnits("1555897.757296354509715841", 18); | ||
| export const THE_AMOUNT_RISK_FUND_CONVERTER = parseUnits("494524.778581486569340203", 18); | ||
| export const THE_AMOUNT_XVS_VAULT_CONVERTER = parseUnits("378706.534208351568523680", 18); | ||
| export const THE_AMOUNT_USDT_PRIME_CONVERTER = parseUnits("4134.951547843396807519", 18); |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Verify THE token balances at the specified contracts match the VIP amounts
THE="0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11"
TREASURY="0xF322942f644A996A617BD29c16bd7d231d9F35E9"
RISK_FUND_CONVERTER="0xA5622D276CcbB8d9BBE3D1ffd1BB11a0032E53F0"
XVS_VAULT_CONVERTER="0xd5b9AE835F4C59272032B3B954417179573331E0"
USDT_PRIME_CONVERTER="0xD9f101AA67F3D72662609a2703387242452078C3"
# Check if amounts in VIP match expected (this is a placeholder - actual verification needs on-chain query)
echo "VIP amounts to verify:"
echo "Treasury: 1555897.757296354509715841 THE"
echo "RiskFundConverter: 494524.778581486569340203 THE"
echo "XVSVaultConverter: 378706.534208351568523680 THE"
echo "USDTPrimeConverter: 4134.951547843396807519 THE"
echo ""
echo "Note: These amounts must match the exact on-chain balances at execution time."
echo "If balances accrue or change between snapshot and execution, the sweepToken calls may fail."Repository: VenusProtocol/vips
Length of output: 442
🏁 Script executed:
# Explore VIP-900 structure
find . -path "*vip-900*" -type f | head -20Repository: VenusProtocol/vips
Length of output: 292
🏁 Script executed:
# Read the bscmainnet.ts file to see the actual code and context
cat -n vips/vip-900/bscmainnet.ts | head -50Repository: VenusProtocol/vips
Length of output: 3307
🏁 Script executed:
# Check if there's an amounts.ts or similar documentation file for VIP-900
find . -path "*vip-900*" -name "*amount*" -o -path "*vip-900*" -name "*.md"Repository: VenusProtocol/vips
Length of output: 44
🏁 Script executed:
# Search for THE token references in the VIP-900 directory
rg "THE_AMOUNT|0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11" vips/vip-900/ -A 2 -B 2Repository: VenusProtocol/vips
Length of output: 2545
🏁 Script executed:
# Check simulation files for VIP-900
ls -la simulations/vip-900/Repository: VenusProtocol/vips
Length of output: 296
🏁 Script executed:
# Look for any documentation or test that references these amounts
rg "1555897|494524|378706|4134\.95" simulations/ --type ts --type jsRepository: VenusProtocol/vips
Length of output: 44
🏁 Script executed:
# Check if there's a PR description or discussion about these amounts
git log --oneline --all | grep -i "vip-900\|THE.*withdrawal" | head -10Repository: VenusProtocol/vips
Length of output: 457
🏁 Script executed:
# Look at the full vips/vip-900/bscmainnet.ts file to understand the complete context
cat -n vips/vip-900/bscmainnet.ts | tail -100Repository: VenusProtocol/vips
Length of output: 5664
Confirm THE token amounts match the most recent on-chain balance snapshot.
The exact amounts specified (with 18 decimal precision) suggest a prior balance snapshot was taken, but verify that contract balances have not accrued or changed between that snapshot and VIP execution time. If the snapshot is stale, the withdrawTreasuryBEP20 and sweepToken calls will revert. Consider taking a final on-chain balance check immediately before execution, or use a mechanism to sweep the full available balance if the intent is to recover all THE holdings.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vips/vip-900/bscmainnet.ts` around lines 17 - 20, The hardcoded THE token
amounts (THE_AMOUNT_TREASURY, THE_AMOUNT_RISK_FUND_CONVERTER,
THE_AMOUNT_XVS_VAULT_CONVERTER, THE_AMOUNT_USDT_PRIME_CONVERTER) may be stale
and cause withdrawTreasuryBEP20 / sweepToken calls to revert; change the flow to
read the actual on‑chain token balances at execution time instead of using fixed
constants (e.g., call the token contract's balanceOf for the
treasury/converter/vault addresses) and pass those runtime balances into
withdrawTreasuryBEP20 or use a sweep-all mechanism that withdraws the full
available balance, ensuring functions like withdrawTreasuryBEP20 and sweepToken
receive live balances rather than snapshot constants.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
vips/vip-607/bscmainnet.ts (1)
11-12: Consider using checksummed address format for consistency.
OTC_WALLETuses lowercase hex (0x5e7bb1f600e42bc227755527895a282f782555ec) while other addresses in the file use mixed-case checksums. While both are valid, using checksummed addresses consistently provides an additional layer of validation against typos.🔧 Suggested fix
-export const OTC_WALLET = "0x5e7bb1f600e42bc227755527895a282f782555ec"; +export const OTC_WALLET = "0x5e7Bb1F600e42Bc227755527895A282f782555Ec";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@vips/vip-607/bscmainnet.ts` around lines 11 - 12, OTC_WALLET is stored in all-lowercase while other constants like THE use EIP-55 checksummed mixed-case; update the OTC_WALLET constant to its checksummed address (replace the lowercase 0x5e7bb1f600e42bc227755527895a282f782555ec with the EIP-55 checksummed variant) so all exported addresses in this module use a consistent checksummed format and reduce typo risk.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@vips/vip-607/bscmainnet.ts`:
- Around line 125-126: Update the proposal description to remove the incorrect
mention of ProtocolShareReserve/PSR from the "Withdraw THE from..." list or
explicitly note PSR was already released; change the sentence referencing
"Withdraw THE from Treasury, RiskFundConverter, XVSVaultConverter,
ProtocolShareReserve, and USDTPrimeConverter" to accurately list only the four
contracts (Treasury, RiskFundConverter, XVSVaultConverter, and
USDTPrimeConverter) or append "(PSR THE already released to the other
contracts)" so the description matches the actual actions in this file
(references: ProtocolShareReserve / PSR and the four sweep targets).
---
Nitpick comments:
In `@vips/vip-607/bscmainnet.ts`:
- Around line 11-12: OTC_WALLET is stored in all-lowercase while other constants
like THE use EIP-55 checksummed mixed-case; update the OTC_WALLET constant to
its checksummed address (replace the lowercase
0x5e7bb1f600e42bc227755527895a282f782555ec with the EIP-55 checksummed variant)
so all exported addresses in this module use a consistent checksummed format and
reduce typo risk.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c324a45e-7990-4bf3-86a2-bcd11721c6b8
📒 Files selected for processing (6)
simulations/vip-607/abi/PrimeLiquidityProvider.jsonsimulations/vip-607/abi/XVS.jsonsimulations/vip-607/abi/XVSVault.jsonsimulations/vip-607/abi/erc20.jsonsimulations/vip-607/bscmainnet.tsvips/vip-607/bscmainnet.ts
✅ Files skipped from review due to trivial changes (4)
- simulations/vip-607/abi/XVS.json
- simulations/vip-607/abi/PrimeLiquidityProvider.json
- simulations/vip-607/abi/erc20.json
- simulations/vip-607/abi/XVSVault.json
| - Withdraw THE from Treasury, RiskFundConverter, XVSVaultConverter, ProtocolShareReserve, and USDTPrimeConverter | ||
| - Transfer all THE to the Finance Team for OTC liquidation on a best-effort basis |
There was a problem hiding this comment.
Minor description inconsistency: PSR is listed but not actually withdrawn from.
The actions list mentions "Withdraw THE from... ProtocolShareReserve" but no corresponding proposal action exists for PSR (correctly, since PSR lacks sweepToken). Consider updating this line to reflect that PSR THE has already been released to the other four contracts as noted on line 119, and only four contracts are being swept.
📝 Suggested description fix
-- Withdraw THE from Treasury, RiskFundConverter, XVSVaultConverter, ProtocolShareReserve, and USDTPrimeConverter
+- Withdraw THE from Treasury, RiskFundConverter, XVSVaultConverter, and USDTPrimeConverter (PSR funds were previously released to these contracts)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@vips/vip-607/bscmainnet.ts` around lines 125 - 126, Update the proposal
description to remove the incorrect mention of ProtocolShareReserve/PSR from the
"Withdraw THE from..." list or explicitly note PSR was already released; change
the sentence referencing "Withdraw THE from Treasury, RiskFundConverter,
XVSVaultConverter, ProtocolShareReserve, and USDTPrimeConverter" to accurately
list only the four contracts (Treasury, RiskFundConverter, XVSVaultConverter,
and USDTPrimeConverter) or append "(PSR THE already released to the other
contracts)" so the description matches the actual actions in this file
(references: ProtocolShareReserve / PSR and the four sweep targets).
VIP-607: Apr Prime Allocation, Q2 XVS Vault Rewards & THE Token Withdrawal
Summary
This VIP bundles three protocol actions on BNB Chain:
1. [BNB Chain] Prime Rewards Allocation — April 2026
Context
In March 2026, Venus generated $164.3K in reserves revenue on BNB Chain. Of this, $32.9K (20%) is allocated to Prime and will be distributed as rewards in April 2026. This allocation is retroactive, redistributing revenue generated through March 2026.
Proposed Allocation
Analysis
2. [BNB Chain] Q2 XVS Buyback & Vault Reward Adjustment
Context
This action redistributes Q1 2026 XVS Buybacks to XVS stakers, in accordance with Tokenomics V4.1, by transferring the buybacks to the XVS Store and adjusting the reward speed on BNB Chain.
Per VIP-585, Prime Rewards and XVS Vault Rewards are only distributed on chains that generate at least $50K in average monthly revenue over a rolling 6-month period. Currently, only BNB Chain meets this threshold.
Q1 2026 Protocol Fees (BNB Chain)
Tokenomics Allocations
Q2 2026 XVS Vault Rewards
The XVS available for Vault Rewards will come from:
Any Buyback allocation in the XVS Converter that has not yet been converted to XVS ($4,813 remaining) will not be taken into account in the Rewards distribution this quarter.
Actions
3. [BNB Chain] Withdraw THE from Protocol Contracts
Context
Following the THE market incident, on-chain liquidity for THE has deteriorated significantly. The token converters are unable to swap THE into useful assets at reasonable rates, and the situation is unlikely to improve. Leaving these tokens idle in the contracts means their value will continue to erode over time.
THE Balances (queried 2026-04-02)
0xf322942f644a996a617bd29c16bd7d231d9f35e90xA5622D276CcbB8d9BBE3D1ffd1BB11a0032E53F00xd5b9AE835F4C59272032B3B954417179573331E00xCa01D5A9A248a830E9D93231e791B1afFed7c4460xD9f101AA67F3D72662609a2703387242452078C3Actions
References
Summary by CodeRabbit
New Features
Tests