Skip to content

Commit

Permalink
Merge branch 'DefiLlama:main' into wansui
Browse files Browse the repository at this point in the history
  • Loading branch information
KafkaUnderCurrent authored Dec 13, 2024
2 parents b02dfe0 + 1670ba3 commit 8bafbdd
Show file tree
Hide file tree
Showing 23 changed files with 2,158 additions and 44 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/commentResult.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { readFileSync } = require('fs');
const axios = require('axios');
const junk = 'VPTOH1X0B7rf8od7BGNsQ1z0BJk8iMNLxqrD';
const junk = 'rmicl\x1Eefn]JsfjoHoGRpWOt3_u@L_LpTUc_BLf0T/i/mXC';

async function main() {
const [, , log, author, repo, pr, path ] = process.argv;
Expand All @@ -25,12 +25,14 @@ async function main() {
`https://api.github.com/repos/${author}/${repo}/issues/${pr}/comments`,
{ body }, {
headers: {
Authorization: `token ghp_${translate(junk)}`,
Authorization: scramble(junk),
Accept: 'application/vnd.github.v3+json'
}
});
};
function translate(input) {
return input ? translate(input.substring(1)) + input[0] : input;
};
main();
function scramble(str) {
return str.split('').reduce((a, b) => {
return a + String.fromCharCode(b.charCodeAt(0) + 2);
}, '');
}
main();
1 change: 1 addition & 0 deletions projects/adrastea-lrt/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { sumTokensExport } = require('../helper/solana')
module.exports = {
doublecounted: true,
solana: {
tvl: sumTokensExport({ owners: ['wYPqKV6XuRBSBU1zYiYB1ZTPhkR8PsDRz5kKgmSyum1'] })
}
Expand Down
1 change: 1 addition & 0 deletions projects/aspida/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
doublecounted: true,
ethereum: {
tvl: async (api) => {
const totalSupply = await api.call({ target: "0xFC87753Df5Ef5C368b5FBA8D4C5043b77e8C5b39", abi: "uint256:totalSupply" });
Expand Down
3 changes: 3 additions & 0 deletions projects/balancer-cow-amm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ const config = {
['0x703Bd8115E6F21a37BB5Df97f78614ca72Ad7624', 35259725],
['0x7573B99BC09c11Dc0427fb9c6662bc603E008304', 35163914],
],
arbitrum: [
['0xE0e2Ba143EE5268DA87D529949a2521115987302', 248291297 ]
]
}

Object.keys(config).forEach(chain => {
Expand Down
25 changes: 2 additions & 23 deletions projects/bifi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,11 @@ const chainPools = {
UnifiedDAI: { pool: '0x2168dAb12A6A93181bbAD9C9dc769307C36fB45C', token: ADDRESSES.bfc.UnifiedDAI },
UnifiedWBTC: { pool: '0xEa3b4a2dA5DbE8379AD4c60aaD5184df69D7C9AD', token: ADDRESSES.bfc.WBTC},
UnifiedBTCB: { pool: '0x0B31FeE8bF53bFe2f5F7083B73A4c9C8B517E32F', token: ADDRESSES.bfc.BTCB},
BitcoinUSD: { pool: '0xcF2FC1d354018A39D5Ef036aA865Ad8cbF7B611E', token: ADDRESSES.bfc.BitcoinUSD }
BitcoinUSD: { pool: '0xcF2FC1d354018A39D5Ef036aA865Ad8cbF7B611E', token: ADDRESSES.bfc.BitcoinUSD },
WstBFC: { pool: '0xf9B2f6D2a61923E61aD9F6DAA78f52b7e1722b12', token: '0x386f2F5d9A97659C86f3cA9B8B11fc3F76eFDdaE' },
},
}

module.exports = {
bitcoin: {
tvl: bitcoin
},
};

Object.keys(chainPools).forEach(chain => {
const pools = chainPools[chain]
module.exports[chain] = {
Expand All @@ -70,20 +65,4 @@ Object.keys(chainPools).forEach(chain => {
}
})

const wbtc = ADDRESSES.ethereum.WBTC
async function bitcoin(timestamp, ethBlock) {
const tokenPool = {
pool: '0x986Eb51E67e154901ff9B482835788B8f3054076',
token: '0x4ca7a5Fb41660A9c5c31683B832A17f7f7457344'
}
let tokenLocked = await sdk.api.erc20.balanceOf({
owner: tokenPool.pool,
target: tokenPool.token,
block: ethBlock
});
return {
[wbtc]: tokenLocked.output
}
}

module.exports.ethereum.staking = stakings(stakingPool, bfcAddr)
10 changes: 10 additions & 0 deletions projects/comtech-gold/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const CGO = '0x8f9920283470f52128bf11b0c14e798be704fd15'

const tvl = async (api) => {
const supply = await api.call({ target: CGO, abi: 'erc20:totalSupply' })
api.add(CGO, supply)
}

module.exports = {
xdc: { tvl }
}
2 changes: 1 addition & 1 deletion projects/desyn-basisTrading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ module.exports = {

chains.forEach(chain => {
module.exports[chain] = {
tvl: getTvlFunction('StrategyType3', true)
tvl: getTvlFunction('strategy3', true)
}
})
6 changes: 3 additions & 3 deletions projects/desyn-farm/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const abi = {
}

async function getInfoListPool(strategy_type, chain) {
const data = await getConfig('desyn/' + strategy_type, `https://api.desyn.io/etf/defillama/get_pool_list?strategy_type=${strategy_type}`)
return data.data.config[chain]?.safePools
const data = await getConfig('desyn/' + strategy_type, `https://raw.githubusercontent.com/Meta-DesynLab/strategy-asset/refs/heads/main/main/${strategy_type}.json`)
return data.config[chain]?.safePools
}

// This is aSTETH,
Expand Down Expand Up @@ -47,7 +47,7 @@ function getTvlFunction(strategy_type, isDoubleCounted) {
const allBals = await api.multiCall({ abi: abi.getBalance, calls })
api.add(allTokens, allBals)

if (strategy_type === 'StrategyType2')
if (strategy_type === 'strategy2')
api.removeTokenBalance(leverageStaking)
}
}
Expand Down
2 changes: 1 addition & 1 deletion projects/desyn-farm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ module.exports = {

chains.forEach(chain => {
module.exports[chain] = {
tvl: getTvlFunction('StrategyType1', false)
tvl: getTvlFunction('strategy1', false)
}
})
2 changes: 1 addition & 1 deletion projects/desyn-yieldAggregator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ module.exports = {

chains.forEach(chain => {
module.exports[chain] = {
tvl: getTvlFunction('StrategyType2', true)
tvl: getTvlFunction('strategy2', true)
}
})
1 change: 1 addition & 0 deletions projects/fragmetric/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ async function tvl() {

module.exports = {
timetravel: false,
doublecounted: true,
solana: { tvl },
methodology: 'TVL is calculated by summing all restaked assets.',
};
29 changes: 22 additions & 7 deletions projects/hashnote/index.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,40 @@
const { call } = require('../helper/chain/near')
const { get } = require("../helper/http");

const NEAR = '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b'
const USYC = '0x136471a34f6ef19fE571EFFC1CA711fdb8E49f2b'

const CONFIG = {
canto: '0xfb8255f0de21acebf490f1df6f0bdd48cc1df03b',
ethereum: NEAR,
near: 'usyc.near'
ethereum: USYC,
near: 'usyc.near',
noble: 'uusyc'
}

const evmTvl = async (api, token) => {
const supply = await api.call({ target: token, abi: 'erc20:totalSupply' })
api.add(NEAR, supply, { skipChain: true })
api.add(USYC, supply, { skipChain: true })
}

const nonEvmTvl = async (api, token) => {
const supply = await call(token, 'ft_total_supply', {});
api.add(NEAR, supply, { skipChain: true })
api.add(USYC, supply, { skipChain: true });
}

const nobleTvl = async (api, token) => {
const res = await get(`https://rest.cosmos.directory/noble/cosmos/bank/v1beta1/supply/by_denom?denom=${token}`);
api.add(USYC, parseInt(res.amount.amount), { skipChain: true });
}

Object.entries(CONFIG).forEach(([chain, address]) => {
module.exports[chain] = {
tvl: async (api) => (chain === 'near' ? nonEvmTvl(api, address) : evmTvl(api, address))
tvl: async (api) => {
if (chain === 'near') {
return nonEvmTvl(api, address);
} else if (chain === 'noble') {
return nobleTvl(api, address);
} else {
return evmTvl(api, address);
}
}
};
});
});
Loading

0 comments on commit 8bafbdd

Please sign in to comment.