compound-finance / compound-protocol

The Compound On-Chain Protocol
https://compound.finance/developers
BSD 3-Clause "New" or "Revised" License
1.89k stars 1.21k forks source link

APY calculation method #98

Closed smarteasy closed 3 years ago

smarteasy commented 3 years ago

The calculation method is different in Calculating the APY Using Rate Per Block at https://compound.finance/docs#networks.

APY = ((((Rate / ETH Mantissa Blocks Per Day + 1) ^ Days Per Year-1))-1) 100

supplyApy = (((Math.pow((supplyRatePerBlock / ethMantissa blocksPerDay) + 1, daysPerYear-1)))-1) 100;

Is it correct to correct this as follows? APY = ((((Rate / ETH Mantissa Blocks Per Day + 1) ^ (Days Per Year-1)))-1) 100

Or is it the opposite? supplyApy = (((Math.pow((supplyRatePerBlock / ethMantissa blocksPerDay) + 1, daysPerYear))-1)-1) 100;

smarteasy commented 3 years ago

doc is updated.