Skip to content

Commit

Permalink
Merge branch 'DefiLlama:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Viyozc authored Jun 4, 2024
2 parents 7576916 + 81b557b commit 607164c
Show file tree
Hide file tree
Showing 9 changed files with 100 additions and 20 deletions.
3 changes: 0 additions & 3 deletions projects/blastfutures/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,4 @@ module.exports = {
tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}),
staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'),
},
ethereum: {
staking: staking('0x0c378FB17E87B180256a87e3f671cd83Bf3236DB', '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e'),
},
}
27 changes: 16 additions & 11 deletions projects/dinari/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
const config = {
arbitrum: {
"AAPL.d": { oracle: "0x8d0CC5f38f9E802475f2CFf4F9fc7000C2E1557c", token: '0xCe38e140fC3982a6bCEbc37b040913EF2Cd6C5a7' },
"AMZN.d": { oracle: "0xd6a77691f071E98Df7217BED98f38ae6d2313EBA", token: '0x5a8A18673aDAA0Cd1101Eb4738C05cc6967b860f' },
"GOOGL.d": { oracle: "0x1D1a83331e9D255EB1Aaf75026B60dFD00A252ba", token: '0x9bd7A08cD17d10E02F596Aa760dfE397C57668b4' },
"META.d": { oracle: "0xcd1bd86fDc33080DCF1b5715B6FCe04eC6F85845", token: '0xa40c0975607BDbF7B868755E352570454b5B2e48' },
"MSFT.d": { oracle: "0xDde33fb9F21739602806580bdd73BAd831DcA867", token: '0x20f11c1aBca831E235B15A4714b544Bb968f8CDF' },
"TSLA.d": { oracle: "0x3609baAa0a9b1f0FE4d6CC01884585d0e191C3E3", token: '0x2888c0aC959484e53bBC6CdaBf2b8b39486225C6' },
"SPY.d": { oracle: "0x46306F3795342117721D8DEd50fbcF6DF2b3cc10", token: '0xF4BD09B048248876E39Fcf2e0CDF1aee1240a9D2' },
// "COIN.d": { oracle: "", token: '0x46b979440AC257151EE5a5bC9597B76386907FA1' },
factory: "0xB4Ca72eA4d072C779254269FD56093D3ADf603b8",
getTokensAbi: "function getDShares() external view returns (address[] memory, address[] memory)",
processor: "0xFA922457873F750244D93679df0d810881E4131D",
latestPriceAbi: "function latestFillPrice(address assetToken, address paymentToken) view returns (tuple(uint256 price, uint64 blocktime))",
usdplus: "0xfc90518D5136585ba45e34ED5E1D108BD3950CFa"
}
}

Object.keys(config).forEach(chain => {
const tokens = Object.values(config[chain]).map(v => v.token)
async function getTokens(api, chain) {
return (await api.call({
chain: chain,
target: config[chain].factory,
abi: config[chain].getTokensAbi
}))[0];
}

Object.keys(config).forEach( chain => {
module.exports[chain] = {
tvl: async (api) => {
const tokens = await getTokens(api, chain)
const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens})
api.add(tokens, bals)
}
}
})
})
16 changes: 16 additions & 0 deletions projects/dunes/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const DETH_DEPOSIT_POOL = "0x8a1229eDB53f55Bb09D472aFc95D12154590108E";
const DUSD_DEPOSIT_POOL = "0x634598473B91a6870c1DB151142db0b61C5de8CC";

async function tvl(api) {
const res = await api.multiCall({ abi: 'function getTotalDeposits() external view returns (address[], uint256[])', calls: [DETH_DEPOSIT_POOL, DUSD_DEPOSIT_POOL] })
res.forEach(i => api.add(...i))
}

module.exports = {
doublecounted: true,
methodology:
"Deposited assets (LSTs, LRTs, stables, Pendle tokens, Karak tokens, etc.) in deposit pools",
ethereum: {
tvl,
},
};
9 changes: 8 additions & 1 deletion projects/helper/coreAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1755,7 +1755,14 @@
"bsquared": {
"WBTC": "0x4200000000000000000000000000000000000006",
"USDT": "0x681202351a488040fa4fdcc24188afb582c9dd62",
"USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5"
"USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5",
"ETH": "0xD48d3A551757ac47655fCe25BDE1B0B6b1Cb2a5A",
"MATIC": "0xc3ee2Df14B1Bc526c24ED802f1873d49664a0d5c",
"FDUSD": "0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5",
"BSTONE": "0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462",
"ORDI": "0xa0f4470B714677AEEcE0d20074c540b3Cf6a477E",
"SATS": "0x7eBFcE05E418C380a2b6EB0F65995cA04ef4bc00",
"UBTC": "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2"
},
"planq": {
"WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a"
Expand Down
18 changes: 18 additions & 0 deletions projects/icpex/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

const { get } = require('../helper/http')
const { toUSDTBalances } = require('../helper/balances')

module.exports = {
misrepresentedTokens: true,
icp: { tvl },
}

async function tvl() {
let result = await get('https://metrics.icpex.org/llama/tvl');
if (result.retCode === 1 && result.retMsg === "success") {
const tvl = result.data;
return toUSDTBalances(tvl);
} else {
throw new Error(`API error! message: ${result.retMsg}`);
}
}
2 changes: 1 addition & 1 deletion projects/native/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");

module.exports = {
methodology:
"TVL: Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol",
"Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol",
};

const config = {
Expand Down
23 changes: 20 additions & 3 deletions projects/sovryn-dex/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const { staking } = require('../helper/staking')
const { request, gql } = require("graphql-request");
const { sumTokens2 } = require('../helper/unwrapLPs');
const { getConfig } = require('../helper/cache')
const { getUniqueAddresses } = require('../helper/utils')
const { transformDexBalances } = require('../helper/portedTokens')
Expand All @@ -8,8 +10,10 @@ async function tvl(api) {

// const impl = await api.call({ abi: 'address:swapsImpl', target: '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' })

const protocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'
const RSKprotocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'

const res = await getConfig('sovryn', 'https://backend.sovryn.app/tvl')

let pools = Object.values(res.tvlAmm).map(i => i?.contract).filter(i => i)
pools = getUniqueAddresses(pools)
const ownerTokens = []
Expand All @@ -31,14 +35,27 @@ async function tvl(api) {
})
await Promise.all(promises)

ownerTokens.push([allTokens, protocolContract])
ownerTokens.push([allTokens, RSKprotocolContract])
await api.sumTokens({ ownerTokens })
return transformDexBalances({ data, api, })
}

module.exports = {
misrepresentedTokens: true,
bob: {
tvl: async () => { const query = gql`
{
pools { base quote }
}
`
pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query)
const tokens = pools.pools.map(i => [i.base, i.quote]).flat()
return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, });
},
//staking: staking('0xc17C6462cEAFE9A8819258c6bA168BEF5544Fc21') // does not work
},
rsk: {
tvl,
staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd')
}
}
}
4 changes: 3 additions & 1 deletion projects/treasury/zunami.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { nullAddress, treasuryExports } = require("../helper/treasury");
const ADDRESSES = require("../helper/coreAssets.json");

const treasury = "0xb056b9a45f09b006ec7a69770a65339586231a34";
const ZUN = "0x6b5204b0be36771253cc38e88012e02b752f0f36"

module.exports = treasuryExports({
ethereum: {
Expand All @@ -16,6 +17,7 @@ module.exports = treasuryExports({
"0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT
"0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS
],
owners: [treasury]
owners: [treasury],
ownTokens: [ZUN]
}
});
18 changes: 18 additions & 0 deletions projects/tymio/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const config = {
ethereum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6',
arbitrum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6',
};

module.exports = {
methodology: 'Obtaining all authorized assets on deployed project contracts',
}

Object.keys(config).forEach(chain => {
const contract = config[chain]
module.exports[chain] = {
tvl: async (api) => {
const tokens = await api.fetchList({ lengthAbi: 'acceptableTokensArrayLength', itemAbi: 'acceptableTokensArray', target: contract})
return api.sumTokens({ tokens, owner: contract })
}
}
})

0 comments on commit 607164c

Please sign in to comment.