Skip to content

Commit

Permalink
Add fraxtal cvxFXS
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-monk committed Aug 14, 2024
1 parent 3a348b5 commit 80b02c1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
18 changes: 18 additions & 0 deletions src/api/stats/fraxtal/getConvexCvxFxsApys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import BigNumber from 'bignumber.js';
import getApyBreakdown from '../common/getApyBreakdown';

export const getConvexCvxFxsApys = async () => {
let apy = new BigNumber(0);
try {
const apyData = await fetch('https://frax.convexfinance.com/api/frax/staked-cvxfxs').then(res =>
res.json()
);
apyData?.rewards?.forEach(r => {
const apr = (r?.apr || 0) / 100;
apy = apy.plus(new BigNumber(apr));
});
} catch (e) {
console.error('Convex fraxtal cvxFXS apy failed', e.message);
}
return getApyBreakdown([{ name: 'convex-fraxtal-cvxfxs', address: '' }], {}, [apy], 0);
};
3 changes: 2 additions & 1 deletion src/api/stats/fraxtal/index.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
const { getCurveApys } = require('./getCurveApys');
const { getConvexApys } = require('./getConvexApys');
const { getConvexCvxFxsApys } = require('./getConvexCvxFxsApys');
const getRaApys = require('./getRaApys');

const getApys = [getCurveApys, getConvexApys, getRaApys];
const getApys = [getCurveApys, getConvexApys, getConvexCvxFxsApys, getRaApys];

const getFraxtalApys = async () => {
const start = Date.now();
Expand Down

0 comments on commit 80b02c1

Please sign in to comment.