Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Oct 14, 2023
1 parent 1e20334 commit a3d4b88
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 30 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const getApy = async () => {
return {
pool: p,
chain: utils.formatChain('avax'),
project: 'glacier-finance',
project: 'glacier-exchange-v2',
symbol: utils.formatSymbol(s.split('-')[1]),
tvlUsd,
apyReward,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const utils = require('../utils');
const fetch = require('node-fetch');

const MARGINFI_URL = 'https://app.marginfi.com';
Expand All @@ -7,8 +6,8 @@ const SNAPSHOT_URL =

async function main() {
const snapshotResponse = await fetch(SNAPSHOT_URL);
const snapshot = snapshotResponse.json();
return snapshot;
const snapshot = await snapshotResponse.json();
return snapshot.map((p) => ({ ...p, project: 'marginfi-lending' }));
}

module.exports = {
Expand Down
34 changes: 34 additions & 0 deletions src/adaptors/taiga-acala/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const utils = require('../utils');

const getPools = async () => {
const tdotApr = await utils.getData(
'https://api.taigaprotocol.io/rewards/apr?network=acala&pool=0'
);
const tdotStats = await utils.getData(
'https://api.taigaprotocol.io/tokens/tdot/stats'
);

const priceKey = 'coingecko:polkadot';

const { coins: prices } = await utils.getData(
`https://coins.llama.fi/prices/current/${priceKey}`
);
const dotUsd = prices[priceKey].price;

const tdot = {
pool: 'acala-sa0-taiga',
chain: utils.formatChain('acala'),
project: 'taiga-acala',
symbol: 'tDOT',
tvlUsd: tdotStats.total * dotUsd,
apyBase: Number(tdotApr['sa://0']) * 100,
};

return [tdot];
};

module.exports = {
timetravel: false,
apy: getPools,
url: 'https://app.taigaprotocol.io/',
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,10 @@ const getPools = async () => {
'https://api.taigaprotocol.io/tokens/3usd/stats'
);

const tdotApr = await utils.getData(
'https://api.taigaprotocol.io/rewards/apr?network=acala&pool=0'
);
const tdotStats = await utils.getData(
'https://api.taigaprotocol.io/tokens/tdot/stats'
);

const priceKey = 'coingecko:polkadot';

const { coins: prices } = await utils.getData(
`https://coins.llama.fi/prices/current/${priceKey}`
);
const dotUsd = prices[priceKey].price;

const taiKsm = {
pool: 'karura-sa0-taiga',
chain: utils.formatChain('karura'),
project: 'taiga-protocol',
project: 'taiga-karura',
symbol: 'tKSM',
tvlUsd: taiKsmStats.data.tvl,
apyBase: taiKsmApr['sa://0'] * 100,
Expand All @@ -42,7 +28,7 @@ const getPools = async () => {
const threeUsd = {
pool: 'karura-sa1-taiga',
chain: utils.formatChain('karura'),
project: 'taiga-protocol',
project: 'taiga-karura',
symbol: '3USD',
tvlUsd: threeUsdStats.data.tvl,
apyBase: threeUsdApr['sa://1'] * 100,
Expand All @@ -55,16 +41,7 @@ const getPools = async () => {
100,
};

const tdot = {
pool: 'acala-sa0-taiga',
chain: utils.formatChain('acala'),
project: 'taiga-protocol',
symbol: 'tDOT',
tvlUsd: tdotStats.total * dotUsd,
apyBase: Number(tdotApr['sa://0']) * 100,
};

return [taiKsm, threeUsd, tdot];
return [taiKsm, threeUsd];
};

module.exports = {
Expand Down

0 comments on commit a3d4b88

Please sign in to comment.