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
rav-ipor committed Sep 14, 2024
2 parents 0953fe3 + f7f546a commit ef98809
Show file tree
Hide file tree
Showing 10 changed files with 81 additions and 9 deletions.
6 changes: 6 additions & 0 deletions projects/accumulated-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ const config = {
"LST": "0xcba2aeec821b0b119857a9ab39e09b034249681a"
},
}
],
"oasis": [
{
"sapphire": {
"LST": "0xed57966f1566de1a90042d07403021ea52ad4724"
}}
]
}

Expand Down
31 changes: 31 additions & 0 deletions projects/cygnus-fi-ton/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const { call } = require("../helper/chain/ton")
const { get } = require('../helper/http')

// helper function of getting jetton metadata
async function getJettonMetadata(addr) {
const res = await get(`https://tonapi.io/v2/jettons/${addr}`)
return res
}

async function tvl(api) {
const CLTON_MINTER_ADDRESS = 'EQDz48al4FfPnapvXYJOfkBOIj3xvNZ0t5vSpQN-Qukqwm7W'
const CLTON_TOKEN_ADDRESS = 'EQCxd6SJQ8KiLkEpN3OoBfUIHqPE3yp0j80UnPysQqcTikNF'

const cltonMinterResult = await call({ target: CLTON_MINTER_ADDRESS, abi: "get_minter_data", stack: [] })
// exchange rate from clTON to TON: decimal 9

const cltonToTon = cltonMinterResult[4] / 1e9
const cltonMetadata = await getJettonMetadata(CLTON_TOKEN_ADDRESS)

// Now the tokens in the withdrawal vault will be correctly destroyed, so the TOTAL SUPPLY can be a true indication of tvl
const cltonTotalSupply = (cltonMetadata['total_supply']) / 1e9

const cltonTvl = cltonTotalSupply * cltonToTon
api.addCGToken("the-open-network", cltonTvl)
}

module.exports = {
ton: {
tvl
}
};
7 changes: 7 additions & 0 deletions projects/electroswap-v2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const { getUniTVL } = require('../helper/unknownTokens')

module.exports={
etn: {
tvl: getUniTVL({ factory: '0x203D550ed6fA9dAB8A4190720CF9F65138abd15B', useDefaultCoreAssets: false }),
}
}
8 changes: 8 additions & 0 deletions projects/electroswap-v3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { uniV3Export } = require("../helper/uniswapV3");

module.exports = uniV3Export({
etn: {
factory: "0xbF6Bcbe2be545135391777F3B4698be92E2EB8cA",
fromBlock: 1242016,
},
});
2 changes: 1 addition & 1 deletion projects/freestyle/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const freestyleConfig = {
base: {
token: ADDRESSES.base.USDC,
start: 1700006400,
graphUrl: "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest",
graphUrl: "https://api-v2.morphex.trade/subgraph/3KhmYXgsM3CM1bbUCX8ejhcxQCtWwpUGhP7p9aDKZ94Z",
accountSource: '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD'
},
}
Expand Down
1 change: 1 addition & 0 deletions projects/helper/chains.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
"ethereumclassic",
"ethf",
"ethpow",
"etn",
"europa",
"everscale",
"evmos",
Expand Down
1 change: 1 addition & 0 deletions projects/helper/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const DEFAULTS = {
ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01',
RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/",
IDEX_RPC: "https://xchain-rpc.idex.io",
ETN_RPC: "https://rpc.ankr.com/electroneum"
}

const ENV_KEYS = [
Expand Down
4 changes: 4 additions & 0 deletions projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { decimals } = require('@defillama/sdk/build/erc20')
let coreAssets = require('./coreAssets.json')
const ADDRESSES = coreAssets
const nullAddress = ADDRESSES.null
Expand Down Expand Up @@ -127,6 +128,9 @@ const fixBalancesTokens = {
'0x6c76971f98945ae98dd7d4dfca8711ebea946ea6': { coingeckoId: "wrapped-steth", decimals: 18 },
'0xaf204776c7245bf4147c2612bf6e5972ee483701': { coingeckoId: "savings-dai", decimals: 18 },
},
etn: {
'0x138dafbda0ccb3d8e39c19edb0510fc31b7c1c77': { coingeckoId: "electroneum", decimals: 18 }
}
}

ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })
Expand Down
4 changes: 3 additions & 1 deletion projects/visor/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const HYPE_REGISTRY = {
],
optimism: [
["0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", 6538026], // Uniswap
["0xF802D5c44dC4E3bB0eCcf680a6bA82Cbd24B9F33", 125319599], // Velodrome
],
arbitrum: [
["0x66CD859053c458688044d816117D5Bdf42A56813", 10617223], // Uniswap
Expand Down Expand Up @@ -87,6 +88,7 @@ const HYPE_REGISTRY = {
["0x8118C33513feC13f8cf488CCb4509190650F0e92", 7310111], // Baseswap
["0xf1DF4F17e34Ba710DfFC487F73f1e19476E815a6", 8743213], // Thick
["0xe1cd1c2d2e4B44dE211D554649BC7dc49eF07784", 15063294], // Kinetix
["0x6809f4881707459Ad0287C6467365E3C910e9373", 19631061], // Aerodrome
],
kava: [
["0x683292172E2175bd08e3927a5e72FC301b161300", 6384272], // Kinetix
Expand Down Expand Up @@ -141,7 +143,7 @@ const HYPE_REGISTRY = {
],
core: [
["0x32e27fF479454e32868ff67Ee9F06BAFDC1E908F", 17268275], // Glyph
["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 17164390], // Glyph
["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 17164390], // CoreX
],
};

Expand Down
26 changes: 19 additions & 7 deletions projects/zerolend/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
const sdk = require('@defillama/sdk')
const { aaveExports } = require("../helper/aave");
const { staking } = require("../helper/staking");
const { pool2s } = require("../helper/pool2");

const config = {
era: "0xB73550bC1393207960A385fC8b34790e5133175E",
manta: "0x67f93d36792c49a4493652B91ad4bD59f428AD15",
blast: "0xc6DF4ddDBFaCb866e78Dcc01b813A41C15A08C10",
linea: "0x67f93d36792c49a4493652B91ad4bD59f428AD15",
xlayer: "0x97e59722318F1324008484ACA9C343863792cBf6",
ethereum: "0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf",
era: ["0xB73550bC1393207960A385fC8b34790e5133175E"],
manta: ["0x67f93d36792c49a4493652B91ad4bD59f428AD15"],
blast: ["0xc6DF4ddDBFaCb866e78Dcc01b813A41C15A08C10"],
linea: [
"0x67f93d36792c49a4493652B91ad4bD59f428AD15", // main linea market
'0x9aFB91a3cfB9aBc8Cbc8429aB57b6593FE36E173', // croak linea market
'0xEe9ec60657B714E3FAC5255a5443AC5EC7Ba5bB0', // foxy linea market
],
xlayer: ["0x97e59722318F1324008484ACA9C343863792cBf6"],
ethereum: [
"0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf", // ethereum lrt market
'0x31063F7CA8ef4089Db0dEdf8D6e35690B468A611' // bitcoin lrt market
],
};

const linea = {
Expand All @@ -23,7 +31,11 @@ const linea = {

const data = {};
Object.keys(config).forEach((chain) => {
data[chain] = aaveExports(chain, undefined, undefined, [config[chain]]);
const chainExports = config[chain].map((address) => aaveExports(chain, undefined, undefined, [address]))
data[chain] = {
tvl: sdk.util.sumChainTvls(chainExports.map(i => i.tvl)),
borrowed: sdk.util.sumChainTvls(chainExports.map(i => i.borrowed))
}
});

data.linea.staking = staking(linea.zeroLocker, linea.zero, "linea");
Expand Down

0 comments on commit ef98809

Please sign in to comment.