2. Inaccurate CVX Lock Amount Derived from Ratio Difference
Severity
Finding ID BH-2021-09-bvecvx-02
Target veCVX/contracts/veCVXStrategy.sol
Function name manualRebalance
Description
The function calculates the CVX amount to lock using cvxToLock = newLockRatio.sub(currentLockRatio),
where both variables are derived from a flawed comparison
of ratios. Even if these ratios were correctly unit-aligned (which they are not), subtracting ratios and assuming the result maps directly to a CVX token
amount introduces significant inaccuracies. The actual CVX amount needed to achieve the target lock percentage should be calculated directly based on
totalCVXBalance and
balanceInLock, not the difference in their relative ratios.
veCVX/contracts/veCVXStrategy.sol
2. Inaccurate CVX Lock Amount Derived from Ratio Difference
Severity
Finding ID BH-2021-09-bvecvx-02
Target veCVX/contracts/veCVXStrategy.sol
Function name manualRebalance
Description
The function calculates the CVX amount to lock using cvxToLock = newLockRatio.sub(currentLockRatio),
where both variables are derived from a flawed comparison
of ratios. Even if these ratios were correctly unit-aligned (which they are not), subtracting ratios and assuming the result maps directly to a CVX token
amount introduces significant inaccuracies. The actual CVX amount needed to achieve the target lock percentage should be calculated directly based on
totalCVXBalance and
balanceInLock, not the difference in their relative ratios.
Upload Code Drag-and-drop zip or link GitHub repo.
Automated Review
Bug Hunter's engine analyzes your code.
Get Report
Receive a comprehensive PDF audit.
Blogs
BugHunter Quick-Start Guide: Automate Your Solidity Security Reviews in Minutes
Step-by-step guide to submitting and tracking smart contract reviews using Bug Hunter.
Bug Hunter Analysis of NFT Protocols
With an overall 50% accuracy, Bug Hunter surfaced roughly half of all auditor-confirmed issues.
Bug Hunter Analysis of Yield-Farming Protocols
With an overall 46.5% hit rate, Bug Hunter removes nearly half the auditor workload on first pass.