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.

1

//constants

2

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

3

let cliffCount = 1000; // 1,000 cliffs

4

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

5

6

uint GetCVXMintAmount( uint crvEarned ){

7

//first get total supply

8

let cvxTotalSupply = await cvx.totalSupply();

9

10

//get current cliff

11

let currentCliff = cvxTotalSupply / cliffSize;

12

13

//if current cliff is under the max

14

if(currentCliff < cliffCount ){

15

//get remaining cliffs

16

let remaining = cliffCount - currentCliff;

17

18

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

19

var cvxEarned = crvEarned * remaining / cliffCount;

20

21

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

22

var amountTillMax = maxSupply - cvxTotalSupply;

23

if(cvxEarned > amountTillMax){

24

cvxEarned = amountTillMax;

25

}

26

return cvxEarned;

27

}

28

return 0;

29

}

30

Copied!

Last modified 1yr ago

Copy link

Contents

Mint formula