Skip to content

Commit

Permalink
fix: remove options APR (DefiLlama#737)
Browse files Browse the repository at this point in the history
  • Loading branch information
clement-ux authored May 2, 2023
1 parent 7b59a2c commit a736c1a
Showing 1 changed file with 19 additions and 40 deletions.
59 changes: 19 additions & 40 deletions src/adaptors/stakedao/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const utils = require('../utils');

const LOCKERS_ENDPOINT = 'https://lockers.stakedao.org/api/lockers/cache';
const STRATEGIES_ENDPOINT = 'https://lockers.stakedao.org/api/strategies/cache';
const OPTIONS_ENDPOINT = 'https://app.stakedao.org/api/defillama';
const SDT_ADDRESS = '0x73968b9a57c6e53d41345fd57a6e6ae27d6cdb2f';

const symbolMapping = {
Expand Down Expand Up @@ -31,15 +30,13 @@ const poolsFunction = async () => {
utils.getData(`${STRATEGIES_ENDPOINT}/curve`),
utils.getData(`${STRATEGIES_ENDPOINT}/balancer`),
utils.getData(`${STRATEGIES_ENDPOINT}/fraxv2`),
utils.getData(`${LOCKERS_ENDPOINT}`),
// utils.getData(`${OPTIONS_ENDPOINT}`)
utils.getData(`${LOCKERS_ENDPOINT}`)
]);
const angleStrategies = resp[0];
const curveStrategies = resp[1];
const balancerStrategies = resp[2];
const fraxv2Strategies = resp[3];
const lockers = resp[4];
// const optionsData = resp[5].data;

const allStrats = angleStrategies
.concat(curveStrategies)
Expand Down Expand Up @@ -85,7 +82,7 @@ const poolsFunction = async () => {
}
return acc;
}, 0.0) * 100;
apyBase =
apyBase =
strat?.aprBreakdown?.reduce((acc, t) => {
if (t.token.address === SDT_ADDRESS) {
return acc;
Expand All @@ -94,9 +91,9 @@ const poolsFunction = async () => {
}, 0.0) * 100;

if (strat?.aprBreakdown[2]?.isBribe) {
apyBase += strat.aprBreakdown[2]?.minApr *100;
apyBase += strat.aprBreakdown[2]?.minApr * 100;
}
}
}
// calcul for strategies APR
else {
apyReward =
Expand All @@ -115,34 +112,34 @@ const poolsFunction = async () => {
symbol = Object.keys(symbolMapping).includes(symbol)
? symbolMapping[symbol]
: symbol.includes('san')
? symbol.replace('san', '').split('-')[0]
: symbol.replace('FRAXBP', '-crvFRAX');
? symbol.replace('san', '').split('-')[0]
: symbol.replace('FRAXBP', '-crvFRAX');


let underlyingTokens = [];
if(strat?.underlyingTokens?.length > 0) {
underlyingTokens =
strat?.underlyingTokens?.map((t) =>
t?.symbol === 'ETH'
? '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
: t?.address
);
} else if(strat?.underlyingToken?.address) {
underlyingTokens = [strat?.underlyingToken?.address];
if (strat?.underlyingTokens?.length > 0) {
underlyingTokens =
strat?.underlyingTokens?.map((t) =>
t?.symbol === 'ETH'
? '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
: t?.address
);
} else if (strat?.underlyingToken?.address) {
underlyingTokens = [strat?.underlyingToken?.address];
} else {
underlyingTokens = [];
underlyingTokens = [];
}
if (underlyingTokens.length === 0 || strat.key === 'bal') {

underlyingTokens = [strat?.tokenReceipt?.address];
}
const sdTknTknPool = ['factory-v2-109','factory-v2-101','factory-v2-239','b_80ldo_20weth_sdbal']
const sdTknTknPool = ['factory-v2-109', 'factory-v2-101', 'factory-v2-239', 'b_80ldo_20weth_sdbal']
if (sdTknTknPool.includes(strat?.key) && symbol.includes('-')) {
symbol = symbol.replaceAll('-', '')
}
return acc.concat([
{
pool: strat.key,
pool: "sd-" + strat.key,
chain: utils.formatChain('ethereum'),
project: 'stakedao',
symbol: utils.formatSymbol(symbol),
Expand All @@ -156,25 +153,7 @@ const poolsFunction = async () => {
]);
}, []);

// const options = optionsData.map((option) => {
// const rewardTokens = option.underlyingTokens.map((token) => token.address || '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE')
// return {
// pool: option.key,
// chain: utils.formatChain('ethereum'),
// project: 'stakedao',
// symbol: utils.formatSymbol(option.symbol),
// poolMeta: utils.formatChain('Opyn'),
// tvlUsd: parseFloat(option.tvlUSD),
// apyReward: 0,
// apyBase: option.apy,
// rewardTokens,
// underlyingTokens: rewardTokens
// }
// })
const options = []

// duplicated pool ID
return strats.concat(options).filter(i => i.pool !== '2');
return strats;
};

module.exports = {
Expand Down

0 comments on commit a736c1a

Please sign in to comment.