ConvexFinanceIntegration

Search…

CVX Minting

CVX is minted whenever a user claims CRV.

This means that all LP pools, as well as the cvxCRV rewards pool will mint CVX when claiming CRV rewards from the pool. Take note that CVX pool does not mint more CVX, as rewards received is cvxCRV and not vanilla CRV.

Mint formula

The amount of CVX minted is determined pro-rata for how much CRV was claimed, with the conversion rate decreasing as CVX supply increases (max 100 million) in the form of cliff drop offs.

//constants

let cliffSize = 100000 * 1e18; //new cliff every 100,000 tokens

let cliffCount = 1000; // 1,000 cliffs

let maxSupply = 100000000 * 1e18; //100 mil max supply

uint GetCVXMintAmount( uint crvEarned ){

//first get total supply

let cvxTotalSupply = await cvx.totalSupply();

//get current cliff

let currentCliff = cvxTotalSupply / cliffSize;

//if current cliff is under the max

if(currentCliff < cliffCount ){

//get remaining cliffs

let remaining = cliffCount - currentCliff;

//multiply ratio of remaining cliffs to total cliffs against amount CRV received

var cvxEarned = crvEarned * remaining / cliffCount;

//double check we have not gone over the max supply

var amountTillMax = maxSupply - cvxTotalSupply;

if(cvxEarned > amountTillMax){

cvxEarned = amountTillMax;

}

return cvxEarned;

}

return 0;

}

Last modified 1yr ago

Copy link