Early Expiry with Penalty
Overview
Early Expiry is a feature of the veCVE system that allows users to exit their lock positions before the normal unlock time in exchange for paying a penalty. This feature provides liquidity and flexibility for veCVE holders who need to access their locked CVE tokens before the standard one-year lock duration ends.
How Early Expiry Works
Dataflow
User requests to early expire a lock by calling earlyExpireLock with their lock index
The contract calculates the penalty amount based on:
The lock amount
The current penalty multiplier (configurable by Curvance DAO)
The remaining time until unlock (linearly scaled)
The user's veCVE tokens are burned
The calculated penalty amount is sent to the Curvance DAO treasury
The remaining CVE tokens (original amount minus penalty) are returned to the user
State Changes
When a lock is early expired, the following state changes occur:
The user's veCVE balance is reduced by the lock amount (tokens are burned)
The lock entry is removed from the user's locks array
User points are reduced to reflect the removed lock
Token unlock data is updated to remove the future unlock entry
If the user has no remaining locks, their claim index is reset
Penalty Calculation
The penalty is calculated based on a linear scaling model:
For continuous locks: full penalty is applied (amount penalty multiplier)
For standard locks: penalty scales down linearly as the unlock time approaches
Formula:
amount * penalty * (remaining time / lock duration) / DENOMINATOR
This creates a fair system where the penalty decreases as the lock approaches its natural expiry.
User Functions
earlyExpireLock()
Processes an active lock as if it's expired, with a penalty applied.
Function signature:
lockIndex
uint256
The index of the lock to process early
rewardsData
RewardsData
Rewards data for desired Reward Manager action
params
bytes
Parameters for rewards claim function
aux
uint256
Auxiliary data
Requirements:
The contract must not be shut down
Lock index must be valid
Lock must not already be expired
Early unlock penalty multiplier must be greater than 0
Emits:
UnlockedWithPenalty
event with the user address, unlocked amount, and penalty amount
getUnlockPenalty()
Calculates the penalty amount for early expiring a lock.
Function signature:
user
address
The address of the user whose lock is being queried
lockIndex
uint256
The index of the lock to calculate penalty for
Returns:
The calculated penalty amount in CVE tokens
Notes:
Returns 0 if the lock is already expired
Returns 0 if early unlock is disabled (penalty multiplier = 0)
For continuous locks, returns the full penalty
For standard locks, returns a linearly scaled penalty based on remaining time
Events
Example Flow
User has a locked position of 1000 CVE for one year
After 6 months, user decides to early expire the lock
The current penalty multiplier is 5000 (50%)
Since half the lock duration remains, the penalty would be:
1000 * 5000 * (0.5 * 1 year) / 10000 = 250 CVE
5. User calls earlyExpireLock with the correct lock index
250 CVE is sent to the DAO treasury
750 CVE is returned to the user
The veCVE lock is removed and the user's veCVE balance is reduced by 1000
Technical Considerations
Early unlock penalty multiplier must be configured by the DAO (through
CentralRegistry.setEarlyUnlockPenaltyMultiplier
)Locks cannot be early expired during epoch restriction periods
For continuous locks, the penalty is applied in full since they don't have a regular expiry time
The function claims any pending rewards before processing the lock, ensuring users don't lose rewards
By providing the Early Expiry mechanism, Curvance offers flexibility to veCVE holders while maintaining economic incentives for long-term commitment, as exiting early comes with a cost that benefits the protocol.
Last updated