Skip to content

Commit

Permalink
Merge branch 'main' into add-pryzm
Browse files Browse the repository at this point in the history
# Conflicts:
#	projects/helper/chain/cosmos.js
#	projects/helper/tokenMapping.js
  • Loading branch information
madrezaz committed Dec 25, 2024
2 parents 52eb659 + d416c5a commit 69aac02
Show file tree
Hide file tree
Showing 148 changed files with 2,550 additions and 387 deletions.
6 changes: 3 additions & 3 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/1155Tech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ const MARKET_1155TECH_CONTRACT = '0x33b77fAf955Ed3eDAf939ae66C4D7a2D78bc30C6';
module.exports = {
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
canto: {
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: [ADDRESSES.canto.NOTE] })
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: ['0x4e71a2e537b7f9d9413d3991d37958c0b5e1e503'] })
}
};
12 changes: 12 additions & 0 deletions projects/9mm-v2/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { getUniTVL } = require('../helper/unknownTokens')

module.exports = {
misrepresentedTokens: true,
methodology: "Factory addresses (0x3a0Fa7884dD93f3cd234bBE2A0958Ef04b05E13b for PulseChain) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.",
pulse: {
tvl: getUniTVL({
factory: '0x3a0Fa7884dD93f3cd234bBE2A0958Ef04b05E13b',
useDefaultCoreAssets: true,
}),
},
}
6 changes: 6 additions & 0 deletions projects/9mm-v3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const { uniV3Export } = require('../helper/uniswapV3')

module.exports = uniV3Export({
pulse: { factory: '0xe50dbdc88e87a2c92984d794bcf3d1d76f619c68', fromBlock: 18942139, } ,
base: { factory: '0x7b72C4002EA7c276dd717B96b20f4956c5C904E7', fromBlock: 15754625, }
})
1 change: 1 addition & 0 deletions projects/Delea/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const ownersList = [

module.exports = {
methodology: 'Counts Delea smartcontract balance as TVL.',
misrepresentedTokens: true,
ton: {
tvl: sumTokensExport({ owners: ownersList, tokens: [ADDRESSES.null]}),
}
Expand Down
30 changes: 28 additions & 2 deletions projects/FeeFree/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const { getLogs2 } = require('../helper/cache/getLogs')
const { sumTokens2 } = require('../helper/unwrapLPs')

const EVENT_ABI = 'event Initialize(bytes32 id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks)'
const EVENT_ABI_OLD = 'event Initialize(bytes32 id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks)'

const config = {
const configOLD = {
zora: {
pool: "0xB43287b2106BC044F07aE674794f5492E851d3dC",
router: "0x0Fee97363deEFBE4De038D437D805A98dbEbA400",
Expand All @@ -16,6 +16,24 @@ const config = {
}
}

const EVENT_ABI = 'event Initialize(bytes32 indexed id, address indexed currency0, address indexed currency1, uint24 fee, int24 tickSpacing, address hooks, uint160 sqrtPriceX96, int24 tick)'

const config = {
zora: {
pool: "0x2BB2DeAeF5D4E62D3798Ce67C3D623da09188AB9",
fromBlock: 23864003,
},
base: {
pool: "0x60B393a76cEa4a3AFff00e1Fb08d0F63A8F4A314",
fromBlock: 23809396,
},
scroll: {
pool: "0xA407e0637b22e1F64395D177C8EAD26C03dC3294",
fromBlock: 11975196,
}
}


module.exports = {
start: '2024-04-25', // Apr 26 2024
}
Expand All @@ -24,6 +42,14 @@ Object.keys(config).forEach(chain => {
const { pool, fromBlock, } = config[chain]
module.exports[chain] = {
tvl: async (api) => {

if (configOLD[chain]) {
const { pool, fromBlock, } = configOLD[chain]
const logs = await getLogs2({ api, factory: pool, eventAbi: EVENT_ABI_OLD, fromBlock, })
const tokens = logs.map(i => [i.currency0, i.currency1]).flat()
await sumTokens2({ api, owner: pool, tokens, })
}

const logs = await getLogs2({ api, factory: pool, eventAbi: EVENT_ABI, fromBlock, })
const tokens = logs.map(i => [i.currency0, i.currency1]).flat()
return sumTokens2({ api, owner: pool, tokens, })
Expand Down
4 changes: 3 additions & 1 deletion projects/abracadabra/market.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"0x49De724D7125641F56312EBBcbf48Ef107c8FA57": "0x2f2a2543B76A4166549F7aaB2e75Bef0aefC5B0f",
"0x780db9770dDc236fd659A39430A8a7cC07D0C320": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
"0x6B04C535C852AD19345571247ee12B5BF23dAcB6": "0x6985884C4392D348587B19cb9eAAf157F13271cd",
"0xFCE0b2fe7d7d5057C82A896e4D8EC0e4b813f71f": "0x58538e6A46E07434d7E7375Bc268D3cb839C0133"
"0xFCE0b2fe7d7d5057C82A896e4D8EC0e4b813f71f": "0x58538e6A46E07434d7E7375Bc268D3cb839C0133",
"0x9fF8b4C842e4a95dAB5089781427c836DAE94831": "0x7C11F78Ce78768518D743E81Fdfa2F860C6b9A77",
"0x625Fe79547828b1B54467E5Ed822a9A8a074bD61": "0x450bb6774Dd8a756274E0ab4107953259d2ac541"
},
"avax": {
"0x35fA7A723B3B39f15623Ff1Eb26D8701E7D6bB21": "0x0da67235dD5787D67955420C84ca1cEcd4E5Bb3b",
Expand Down
58 changes: 58 additions & 0 deletions projects/agoric/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
const { post } = require('../helper/http')

const query = `
query {
vaultManagerMetrics {
nodes {
liquidatingCollateralBrand
totalCollateral
}
}
oraclePrices {
nodes {
typeInAmount
typeOutAmount
typeInName
}
}
boardAuxes {
nodes {
allegedName
decimalPlaces
}
}
}
`

const coingeckoMapping = {
'stATOM': 'stride-staked-atom',
'stkATOM': 'stkatom',
'ATOM': 'cosmos',
'stOSMO': 'stride-staked-osmo',
'stTIA': 'stride-staked-tia',
}
const decimals = {}

const tvl = async (api) => {
const { data: { vaultManagerMetrics, boardAuxes } } = await post('https://api.subquery.network/sq/agoric-labs/agoric-mainnet-v2', { query })

boardAuxes.nodes.forEach(board => {
decimals[board.allegedName] = 10 ** board.decimalPlaces
})

vaultManagerMetrics.nodes.forEach(vault => {
const key = vault.liquidatingCollateralBrand
if (!coingeckoMapping[key]) {
throw new Error(`Unknown coin ${key} (coingecko mapping is missing)`)
}
const decimal = decimals[key] ?? 1e6
const balance = vault.totalCollateral / decimal
api.addCGToken(coingeckoMapping[key], balance)
})
}

module.exports = {
agoric: {
tvl,
},
}
5 changes: 1 addition & 4 deletions projects/ainn-layer2/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
const sdk = require('@defillama/sdk');
const { sumTokensExport } = require('../helper/sumTokens');
const bitcoinAddressBook = require('../helper/bitcoin-book/index.js')


module.exports = {
methodology: "Staking tokens via AINN Layer2 Dataset counts as TVL.",
bitcoin: {
tvl: sdk.util.sumChainTvls([
sumTokensExport({ owners: bitcoinAddressBook.ainn }),
]),
tvl: sumTokensExport({ owners: bitcoinAddressBook.ainn }),
},
zklink: {
tvl: sumTokensExport({
Expand Down
25 changes: 25 additions & 0 deletions projects/aixcb/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const ADDRESSES = require('../helper/coreAssets.json');
const { staking } = require("../helper/staking");

// Token addresses
const AIXCB_TOKEN = "0x76C71F1703Fbf19FFdcF3051E1e684Cb9934510f";
const WETH = ADDRESSES.base.WETH;

// LP and staking addresses
const AERODROME_LP_TOKEN = "0x19C3c7EEfb070EE00ddE367A9768De1DF52cbE5d";
const LP_STAKING = "0xEE5C223aD4055beE465244d8Cb344fb22DaDa570";
const AIXCB_STAKING = "0xF5acA5c3a0B70f847dE4652AC77BD601ccFE8339";

async function stakingTvl(api) {
const totalStaked = await api.call({ abi: 'uint256:getTotalStaked', target: AIXCB_STAKING, });
api.add(AIXCB_TOKEN, totalStaked);
}

module.exports = {
methodology: 'TVL consists of aixCB tokens staked in the AIXCBStaking contract (getTotalStaked) and Aerodrome vAMM-aixCB/WETH LP tokens staked in the AIXCBLPStaking contract (totalStakedAmount).',
base: {
tvl: () => ({}),
staking: stakingTvl,
pool2: staking(LP_STAKING, AERODROME_LP_TOKEN),
},
};
80 changes: 80 additions & 0 deletions projects/alphafi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,76 @@ const ALPHAFI_BLUEFIN_TVL_IDS = [
token0Type: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD",
token1Type: ADDRESSES.sui.USDC_CIRCLE
},
{ //sui ausd
poolID: "0x89793208211927a4d1458a59d34b775aaec17af8c98a59a1ba97f7b005c0e587",
parentPoolID: "0xb30df44907da6e9f3c531563f19e6f4a203d70f26f8a33ad57881cd7781e592d",
investorID: "0x275e4df83f6f7b9dc75504d02e5d32f21ca03a5a8b017c622a8b42d3671e2888",
token0Type: ADDRESSES.sui.SUI,
token1Type: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD"
},
{ //alpha usdc
poolID: "0x4540c5e7de64088c0c2c30abc51f7e6bbe6bc48703667c108aa1de23f6aa40e6",
parentPoolID: "0x6595edf6d8c8b6894a5c6760843ae2fde81cb37d8586984dd1345b0f00bfecd8",
investorID: "0x187ca6f373d20465a730125c93e62a96c6a73354a1a8b35cbdd2b39278b7b141",
token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA",
token1Type: ADDRESSES.sui.USDC_CIRCLE
},
{ //wbtc usdc
poolID: "0xbc0de037958d7988710c40f4e7317f8f3ffca4fa3cc9e1c18bc1ebd7ec65cd6e",
parentPoolID: "0x38282481e3a024c50254c31ebfc4710e003fe1b219c0aa31482a860bd58c4ab0",
investorID: "0x9d14a391953d5b853fb22c4135657da341f4db3b341dd4d5f603cfb008e91745",
token0Type: ADDRESSES.sui.WBTC,
token1Type: ADDRESSES.sui.USDC_CIRCLE
},
{ //navx vsui
poolID: "0xf495b997ae10b8bb0996c1ee56a1cc7832daec36a9380e0932e41256d97cabad",
parentPoolID: "0xa0b4fef70ccef039b94512d6384806979d4c201c5e12af9a4b0458454b80da35",
investorID: "0x3672719d64416d0f04575b500e853d9101dfca6488f705856c59ace1999e99d1",
token0Type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX",
token1Type: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT"
},
{ //blue sui
poolID: "0xddecab961380225c95e6a6089660de2e6028170fbc2cd07ab79b8bf45e3c2645",
parentPoolID: "0xde705d4f3ded922b729d9b923be08e1391dd4caeff8496326123934d0fb1c312",
investorID: "0x56f05fc7b81cf45b8b223de9daba1ba82bf4ce32ba0bfa46c2780d78216b2b92",
token0Type: "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE",
token1Type: ADDRESSES.sui.SUI
},
{ //blue usdc
poolID: "0x4b28663453af487a81d4fb2ba7c96cccd63978b83f950d3dcf60dd88116e3e91",
parentPoolID: "0x3717c637003c4274f20cde8c4eeadbffa2bbf16d995a0fe0f7bf99c03cf52e61",
investorID: "0xb1a991064c4cbf1d7fb64a01ce8b2e3aa2f7d25b3ff8de7cabc1cb9ccc0fc12f",
token0Type: "0xe1b45a0e641b9955a20aa0ad1c1f4ad86aad8afb07296d4085e349a50e90bdca::blue::BLUE",
token1Type: ADDRESSES.sui.USDC_CIRCLE
},
{ //send usdc
poolID: "0xd5757d9f00db3f21a0fa38a86a5c1d52ae44828cc59f1798550e2ccf260b2a34",
parentPoolID: "0xbd5b29a952040ccd47ce2822bddd4aba3affaae9d6ccdaf65aded5528e39b837",
investorID: "0xa57b9da796a2848853de7478ec64db63213cb409bfdf182c8b20c7a64896cbcc",
token0Type: "0xb45fcfcc2cc07ce0702cc2d229621e046c906ef14d9b25e8e4d25f6e8763fef7::send::SEND",
token1Type: ADDRESSES.sui.USDC_CIRCLE
},
{ //wbtc sui
poolID: "0x31cc72ec8a332d5e0ecd65c8d5d778333e1c8432a8826a88a8c51eb4e7dc6fac",
parentPoolID: "0xe71aa89df60e737f1b687f8dfbd51e2a9b35706e9e5540ce9b053bd53fcb9ec3",
investorID: "0x68d23ee66a167e39513747a75dd4af3fd2b5728a4653566bf3e813f684cf748b",
token0Type: ADDRESSES.sui.WBTC,
token1Type: ADDRESSES.sui.SUI
},
{ //deep sui
poolID: "0x46de57bfaa096c674492c3892caa261cf34cc46a2e539ece91f0db3e46e3f6c3",
parentPoolID: "0x1b06371d74082856a1be71760cf49f6a377d050eb57afd017f203e89b09c89a2",
investorID: "0x92454fe9c315328efb29607c30f6fb7b5ec55c0a8d9944285075386e381bbca0",
token0Type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP",
token1Type: ADDRESSES.sui.SUI
},
{ //stsui sui
poolID: "0xf5e643282e76af102aada38c67aae7eaec1ba2fe3301871f9fcca482893f96f2",
parentPoolID: "0x73549e0918d10727e324ebeed11ab81ab46f8fadb11078a0641f117d9097b725",
investorID: "0xe348b843a54463afe5438fa76df127b2b78bc89caa9018ba70b3c2ba043f6a1e",
token0Type: "0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI",
token1Type: ADDRESSES.sui.SUI
},

]

Expand Down Expand Up @@ -208,6 +278,16 @@ const ALPHAFI_NAVI_TVL_IDS = [
tokenType: ADDRESSES.sui.ETH,
expo: 8
},
{
poolID: "0x55b7ae7eb570d3d2ee89a92dd8d958794f1e39c4ee067b28655359c0a152b3aa",
tokenType: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS",
expo: 6
},
{
poolID: "0x35f7260fefe3dde7fa5b4bf1319f15554934a94c74acd4ba54161f99470c348f",
tokenType: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX",
expo: 9
},
]
const ALPHAFI_NAVI_LOOP_TVL_IDS = [
{ //sui vsui
Expand Down
7 changes: 5 additions & 2 deletions projects/ambient-finance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ const vault = {
scroll: "0xaaaaAAAACB71BF2C8CaE522EA5fa455571A74106",
blast: "0xaAaaaAAAFfe404EE9433EEf0094b6382D81fb958",
ethereum: "0xAaAaAAAaA24eEeb8d57D431224f73832bC34f688",
canto: "0x9290c893ce949fe13ef3355660d07de0fb793618"
canto: "0x9290c893ce949fe13ef3355660d07de0fb793618",
swellchain: "0xaAAaAaaa82812F0a1f274016514ba2cA933bF24D",
}

const subgraphs = {
scroll: 'https://ambindexer.net/scroll-gcgo/pool_list?chainId=0x82750',
blast: 'https://ambindexer.net/blast-gcgo/pool_list?chainId=0x13e31',
canto: "https://ambient-graphcache.fly.dev/gcgo/pool_list?chainId=0x1e14",
ethereum: sdk.graph.modifyEndpoint('DyHaLYK1keqcv3YD3VczKGYvxQGfGgV6bGTbZLMj5xME')
ethereum: sdk.graph.modifyEndpoint('DyHaLYK1keqcv3YD3VczKGYvxQGfGgV6bGTbZLMj5xME'),
swellchain: 'https://ambindexer.net/swell-gcgo/pool_list?chainId=0x783',
}


async function tvl(api) {
let pools
if (subgraphs[api.chain].includes("gcgo")) {
Expand Down
1 change: 1 addition & 0 deletions projects/amphor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,5 @@ module.exports.hallmarks = [
[1710115200, 'Beta test closing'],
[1712361600, 'ETH Boosted Vault Release'],
[1718927999, 'Symbiotic LRT Vault Release'],
[1734454404, 'Migration to InceptionLRT'],
];
Loading

0 comments on commit 69aac02

Please sign in to comment.