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
BitrockChain authored Mar 29, 2024
2 parents b5fdcf2 + 1180fd9 commit d3af182
Show file tree
Hide file tree
Showing 1,679 changed files with 11,341 additions and 8,770 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Also, don't hesitate to send a message on [our discord](https://discord.defillam
1. PLEASE PLEASE **enable "Allow edits by maintainers" while putting up the PR.**
2. Once your adapter has been merged, it takes time to show on the UI. No need to notify us on Discord.
3. Sorry, We no longer accept fetch adapter for new projects (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), we prefer the tvl to computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
3. Sorry, We no longer accept fetch adapter for new projects (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), we prefer the tvl to be computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you.
4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR
5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI
6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/0xDAO/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4"

const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1"

async function tvl(time, ethBlock, chainBlocks) {
async function tvl(_, __, chainBlocks) {
// 0xDAO Master Chef
const balances = {}
const chain = 'fantom'
Expand Down
17 changes: 13 additions & 4 deletions projects/0xLend/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
const { usdCompoundExports } = require("../helper/compound");
module.exports = {
kcc: usdCompoundExports("0x337d8719f70D514367aBe780F7c1eAd1c0113Bc7", "kcc", "0x309f1639018e8B272126C4B99af442AA25Dcd1F2")
}
const { compoundExports2 } = require('../helper/compound')

const config = {
kcc: { comptroller: '0x337d8719f70D514367aBe780F7c1eAd1c0113Bc7', cether: '0x309f1639018e8b272126c4b99af442aa25dcd1f2' },
era: { comptroller: '0x599bb9202EE2D2F95EDe9f88F622854f7ef2c371', cether: '0x9dae6c8c431ffc6d21b836e0d8d113e8365defb9' },
blast: { comptroller: '0x1DD821C9E27fB2399DAb75AedB113c80C755DCa6', cether: '0xd9fcbd7b60966d013a28ff87925f75bb49e9b5ee' },
}

Object.keys(config).forEach(chain => {
module.exports[chain] = compoundExports2(config[chain])
})

module.exports.kcc.borrowed = () => ({})
63 changes: 8 additions & 55 deletions projects/0x_nodes/index.js
Original file line number Diff line number Diff line change
@@ -1,104 +1,57 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { GraphQLClient, gql } = require('graphql-request')
const { getBlock } = require('../helper/http')
const { staking } = require('../helper/staking')
const sdk = require('@defillama/sdk')

const CONFIG = {
ethereum: {
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11',
strategy_token: ADDRESSES.ethereum.WETH, //wETH
bios_token: '0xAACa86B876ca011844b5798ECA7a67591A9743C8',
kernel_addr: '0xcfcff4eb4799cda732e5b27c3a36a9ce82dbabe0'
},
bsc: {
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-bsc',
strategy_token: '0x418D75f65a02b3D53B2418FB8E1fe493759c7605', //wBNB
bios_token: '0xcf87d3d50a98a7832f5cfdf99ae1b88c7cfba4a7',
kernel_addr: '0x37c12de5367fa61ad05e2bf2d032d7ce5dd31793'
},
polygon: {
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-polygon',
strategy_token: ADDRESSES.ethereum.MATIC, //wMATIC
bios_token: '0xe20d2df5041f8ed06976846470f727295cdd4d23',
kernel_addr: '0x267720b5d8dcbdb847fc333ccc68cb284648b816'
},
fantom: {
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-fantom',
strategy_token: ADDRESSES.ethereum.FTM, //wFTM
bios_token: '0x75e0eb8e6d92ab832bb11e46c041d06a89ac5f0d',
kernel_addr: '0x9db0e84ea53c5a3c000a721bb4295a6053b3de78'
},
avax: {
uri: 'https://api.thegraph.com/subgraphs/name/0xnodes/system11-avalanche',
strategy_token: '0x85f138bfEE4ef8e540890CFb48F620571d67Eda3', //wAVAX
bios_token: '0xd7783a275e53fc6746dedfbad4a06059937502a4',
kernel_addr: '0x479ea3715682e6255234e788875bdbded6faae41'
},
metis: {
uri: 'https://andromeda-graph.metis.io/subgraphs/name/0xnodes/System11-metis',
strategy_token: '0x9E32b13ce7f2E80A01932B42553652E053D6ed8e', //METIS
bios_token: '0x3405a1bd46b85c5c029483fbecf2f3e611026e45',
kernel_addr: '0xa1DA47F6563e7B17075FcA61DeDC4622aE2F3912'
},
}
function offset(chain) {
switch (chain) {
case 'ethereum':
return 110
case 'bsc':
return 600
case 'polygon':
return 750
case 'fantom':
return 1500
case 'metis':
return 500
case 'avax':
return 750
}
}
function chainTvl(chain) {
return async (timestamp, ethBlock, chainBlocks) => {
if (timestamp > 1659527340) return {}
const { [chain]:{ uri }} = CONFIG
const { [chain]:{ strategy_token }} = CONFIG
var graphQLClient = new GraphQLClient(uri)
const block = (await getBlock(timestamp, chain, chainBlocks)) - offset(chain)
var query = gql`{strategyTokenBalances(block: {number: `+block+`}){amount}}`
const results = await graphQLClient.request(query)
let amount = 0
for (let i = 0; i < results.strategyTokenBalances.length; i++) { //loop through the array
amount += Number(results.strategyTokenBalances[i].amount); //Do the math!
}
const balances = {}
sdk.util.sumSingleBalance(balances, strategy_token, amount)
return balances
}
}

function stakingTvl(chain) {
const { [chain]:{ bios_token }} = CONFIG
const { [chain]:{ kernel_addr }} = CONFIG
return staking(kernel_addr, bios_token, chain)
return staking(kernel_addr, bios_token)
}
function chainExports(chainTvl, stakingTvl, chains){

function chainExports(chains){
const chainTvls = chains.reduce((obj, chain) => ({
...obj,
[chain]: {
tvl:chainTvl(chain),
tvl: () => ({}),
staking: stakingTvl(chain)
}
}), {})
return chainTvls
}
const tvlExports = chainExports(chainTvl, stakingTvl , ['ethereum', 'bsc', 'polygon', 'fantom', 'metis', 'avax'])
const tvlExports = chainExports(['ethereum', 'bsc', 'polygon', 'fantom', 'metis', 'avax'])
module.exports = {
hallmarks: [
[1659527340, "Protocol declared insolvent"],
],
methodology: ` Counts the number of wrapped native tokens in all yield strategies across all the chains the protocol is deployed on
+ staking counts the number of BIOS tokens staked in the kernels across all the chains (PFA: Protocol Fee Accruals by staking assets)`,
start: 1633046400, // Friday 1. October 2021 00:00:00 GMT
...tvlExports
...tvlExports,
deadFrom: 1659527340,
}

2 changes: 1 addition & 1 deletion projects/1beam/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Contracts = {
}
}

const moonbeamTvl = async (timestamp, ethBlock, chainBlocks, { api }) => {
const moonbeamTvl = async (api) => {
const pools = Object.values(Contracts.moonbeam.pools)
const tokens = await api.multiCall({ abi: Abis.getTokens, calls: pools })
const bals = await api.multiCall({ abi: Abis.getTokenBalances, calls: pools })
Expand Down
2 changes: 1 addition & 1 deletion projects/1inch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {}
Object.keys(config).forEach(chain => {
const { blacklistedTokens = [], factories } = config[chain]
module.exports[chain] = {
tvl: async (_, _b, _2, { api }) => {
tvl: async (api) => {
const ownerTokens = []
for (const { MooniswapFactory, fromBlock} of factories) {
const logs = await getLogs({
Expand Down
2 changes: 1 addition & 1 deletion projects/1swap/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const Contracts = {
};


const tvl = async (timestamp, ethBlock, chainBlocks, { api }) => {
const tvl = async (api) => {
const ownerTokens = []
const poolTvl = async (pool) => {
ownerTokens.push([await api.call({ target: pool, abi: abiMoonriver.getTokens, }), pool])
Expand Down
2 changes: 1 addition & 1 deletion projects/3a-dao/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const config = {
Object.keys(config).forEach(chain => {
const { factory, fromBlock, } = config[chain]
module.exports[chain] = {
tvl: async (_, _b, _cb, { api, }) => {
tvl: async (api) => {
const logs = await getLogs({
api,
target: factory,
Expand Down
15 changes: 15 additions & 0 deletions projects/3fmutual/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { sumTokensExport } = require("../helper/unwrapLPs");

const tokens = require("../helper/coreAssets.json");

const TOKENS = [
tokens.null,
];

const ethereumContract = [
"0x66be1bc6C6aF47900BBD4F3711801bE6C2c6CB32",
];

module.exports = {
ethereum: { tvl: sumTokensExport({ owners: ethereumContract, tokens: TOKENS }) }
};
3 changes: 1 addition & 2 deletions projects/3xcalibur/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ const { uniTvlExport } = require("../helper/calculateUniTvl.js");

module.exports = {
misrepresentedTokens: true,
timetravel: true,
start: 1667689200,
start: 1667689200,
arbitrum: {
tvl: uniTvlExport("0xD158bd9E8b6efd3ca76830B66715Aa2b7Bad2218", "arbitrum", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
},
Expand Down
2 changes: 1 addition & 1 deletion projects/88mph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const tvlExports = {};
Object.keys(config).forEach(chain => {
const { dpools, vPools = [], } = config[chain]
tvlExports[chain] = {
tvl: async (_, _b, _cb, { api, }) => {
tvl: async (api) => {
const balances = {}

const logs = await graphQuery(dpools, dPoolQuery)
Expand Down
3 changes: 2 additions & 1 deletion projects/9inch-io/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { getUniTVL } = require('../helper/unknownTokens')
const { sumTokensExport } = require('../helper/unwrapLPs')
const config = {
Expand All @@ -12,7 +13,7 @@ const staking = {
['0x8b4cfb020aF9AcAd95AD80020cE8f67FBB2C700E', '0x0e173B11523feB064FD483209d0eD534831A2a86'],
['0x9565c2036963697786705120Fc59310F747bCfD0', '0xFEF11BfA82A66e845Cb7EF815B83B2d22C324131'],
['0x52Ada28F70BC8EBe5dd4381120d3CD76863919A8', '0x8A402a93469D5820079529CA093595e0d9AF62Ac'],
['0x95B303987A60C71504D99Aa1b13B4DA07b0790ab', '0x0Ea7f06D7694058B82d46Fb5c9281e1843Aa8702'],
[ADDRESSES.pulse.PLSX, '0x0Ea7f06D7694058B82d46Fb5c9281e1843Aa8702'],
['0xDe0220b69CE3e855a0124433A8E8D093f53A6bE4', '0xa1EAee97ee29e2C80ee9F1321E0132f19b45A26A'],
]
},
Expand Down
11 changes: 11 additions & 0 deletions projects/Akitaswap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { getUniTVL } = require("../helper/unknownTokens");
module.exports = {
misrepresentedTokens: true,

blast: {
tvl: getUniTVL({
factory: "0x27C429dfF0e6d3B43B2C404C35f58C2b36cef916",
useDefaultCoreAssets: true,
}),
},
};
2 changes: 1 addition & 1 deletion projects/AnonSocial/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");

const contract = "0x76192E7cD69bb6F7992E4d996790942653b9F704";

async function tvl(time, ethBlock, _b, { api }) {
async function tvl(api) {
return sumTokens2({ tokens: [nullAddress], owner: contract, api });
}

Expand Down
2 changes: 1 addition & 1 deletion projects/ArchimedesFinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const POOL_INDEX_3CRV = 1;
const ARCHIMEDES_VAULT_OUSD = "0x4c12c57C37Ff008450A2597e810B51B2BbA0383A";
const ERC20_TOKEN_OUSD = "0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86";

async function tvl(_, _1, _2, { api }) {
async function tvl(api) {
// 3CRV liquidity in LVUSD-3CRV curve pool
const poolLiquidity3CRV = await api.call({ target: POOL_CONTRACT_LVUSD_3CRV, abi: curvePoolAbi.balances, params: POOL_INDEX_3CRV });

Expand Down
2 changes: 1 addition & 1 deletion projects/Atrofarm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = masterchefExports({
module.exports.pulse.tvl = sdk.util.sumChainTvls([module.exports.pulse.tvl, sumTokensExport({
tokensAndOwners: [[ADDRESSES.pulse.DAI, '0x5726f36e62cf761332F5c655b68bc2E5D55ED083'],
[ADDRESSES.pulse.WPLS, '0xc4d4fb6cAD2931e65C0BF44b2A3fA9C598ADd37B'],
['0x95B303987A60C71504D99Aa1b13B4DA07b0790ab', '0x8615545328F1F6c8cefe8b48ad48c231731433ea']],
[ADDRESSES.pulse.PLSX, '0x8615545328F1F6c8cefe8b48ad48c231731433ea']],
})])

8 changes: 8 additions & 0 deletions projects/AvoLend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { compoundExports2 } = require('../helper/compound');

module.exports = {
blast: compoundExports2({
comptroller: '0xe20cE0Db739e4B6Afa9989c87bE7C8C25cbeB5Ea',
cether: '0x29e15766d6b203C35c2D51AAEc4Cf964129Af088',
}),
};
2 changes: 1 addition & 1 deletion projects/AxiaProtocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const defiFundLPEth = '0x4833e8b56fc8e8a777fcc5e37cb6035c504c9478'
const oracleFundEth = '0x152959A2f50D716707fEa4897e72C554272dC584'
const oracleFundLPEth = '0xbf11db4e63c72c5dffde0f5831d667817c9e9ad5'

async function tvl(_, _b, _cb, { api, }) {
async function tvl(api) {
const balances = {}

await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion projects/BankofCronos-Loans/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
// Active Pool holds total system collateral value(deposited collateral)
const ACTIVE_POOL_ADDRESS = "0xa86Ba8b60Aa4d943D15FF2894964da4C2A8F1B03";

async function tvl(_, _b, _cb, { api, }) {
async function tvl(api) {
const [tokens] = await api.call({ target: ACTIVE_POOL_ADDRESS, abi: 'function getAllCollateral() view returns (address[], uint256[])' })
return sumTokens2({ api, owner: ACTIVE_POOL_ADDRESS, tokens })
}
Expand Down
35 changes: 35 additions & 0 deletions projects/BlastNYAN/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require('../helper/unknownTokens')
const WETH = ADDRESSES.blast.WETH
const BLNYAN = '0x9aAC39ca368D27bf03887CCe32f28b44F466072F'
const BLNYAN_WETH_SLP = '0x0E9309f32881899F6D4aC2711c6E21367A84CA26'

const stakingBLNYANContract = '0xA76D6dc805d0EbEcb3787c781ce3A18feEF020cb'
const feeDistro = '0xBC8a7a845cC7A8246EB34856Afe6f1a3d62BD9C6'
const stakeLpEarnWeth = '0xF63Ef9F4320f9d16731a40ff1f58a966ee086806'
const button = '0x00066Ed6c2F7d6CC6e66c678BaEE2C8683B632e6'
const lockPoints = '0x46B3a66ef4fAC801B455884035eF2862F01e6158'
const opts = { useDefaultCoreAssets: true, lps: [BLNYAN_WETH_SLP] }

module.exports = {
misrepresentedTokens: true,
blast: {
tvl: sumTokensExport({
owners: [lockPoints, feeDistro, button],
tokens: [WETH],
...opts,
}),
pool2: sumTokensExport({
...opts,
owners: [stakeLpEarnWeth],
tokens: [BLNYAN_WETH_SLP],
}),
staking: sumTokensExport({
owners: [stakingBLNYANContract, lockPoints],
tokens: [BLNYAN],
...opts,
}),
},
methodology:
'Counts as TVL the ETH only. blNYAN and LP assets deposited are counted as Pool2 and staking Respectively',
}
6 changes: 6 additions & 0 deletions projects/Blaster/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { uniV3Export } = require("../helper/uniswapV3");
const { mergeExports } = require('../helper/utils')

module.exports = mergeExports([
uniV3Export({ blast: { factory: "0x9792FaeA53Af241bCE57C7C8D6622d5DaAD0D4Fc", fromBlock: 693561, }, }),
])
2 changes: 1 addition & 1 deletion projects/CofferCity/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {

Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (_, _b, _cb, { api, }) => {
tvl: async (api) => {
const vaults = Object.values(config[chain])
const tokens = await api.multiCall({ abi: abi.getSupportedTokens, calls: vaults })
const ownerTokens = vaults.map((v, i) => [tokens[i], v])
Expand Down
2 changes: 1 addition & 1 deletion projects/CreampanFinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const accounts = Object.values({
account5: 'cro1hhfh6xaflg8zwhwvrs7sgur2pyfunjqeu8wsd6',
})

async function tvl(_, _1, _2, { api }) {
async function tvl(api) {
const data = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegations/${account}`, })));
const factroy_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0';
data.map(i => i.delegation_responses).flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance.amount * 1e10))
Expand Down
2 changes: 1 addition & 1 deletion projects/CthulhuFinance/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const { sumUnknownTokens } = require("../helper/unknownTokens")

function vaultTvl(vaults) {
return async (_, _b, _cb, { api, }) => {
return async (api) => {
const [tokens, bals] = await Promise.all([
api.multiCall({ abi: 'address:want', calls: vaults }),
api.multiCall({ abi: 'uint256:balance', calls: vaults }),
Expand Down
Loading

0 comments on commit d3af182

Please sign in to comment.