From 4ecc050623f4a10dceb10c27c2c386556724b772 Mon Sep 17 00:00:00 2001 From: Nicolas Menendez Date: Fri, 16 Aug 2024 21:19:31 +0200 Subject: [PATCH 1/5] Add Capyfi protocol (#11332) * add capyfi protocol * code refactor --------- Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/capyfi/index.js | 6 ++++++ projects/helper/tokenMapping.js | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 projects/capyfi/index.js diff --git a/projects/capyfi/index.js b/projects/capyfi/index.js new file mode 100644 index 0000000000..8dfbc1567c --- /dev/null +++ b/projects/capyfi/index.js @@ -0,0 +1,6 @@ +const { compoundExports2, methodology } = require('../helper/compound') + +module.exports = { + methodology, + lac: compoundExports2({ comptroller: '0x123Abe3A273FDBCeC7fc0EBedc05AaeF4eE63060', cether: '0x465ebfceb3953e2922b686f2b4006173664d16ce' }) +} diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index e059bcd931..d3fbf64100 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -46,6 +46,12 @@ const fixBalancesTokens = { cronos_zkevm: { '0xc1bf55ee54e16229d9b369a5502bfe5fc9f20b6d': { coingeckoId: 'crypto-com-chain', decimals: 18 }, }, + lac: { + [ADDRESSES.null]: { coingeckoId: "la-coin", decimals: 18 }, + '0x2911a1AB18546cb501628Be8625C7503a2A7DB54': { coingeckoId: "la-coin", decimals: 18 }, + '0x42c8c9c0f0a98720dacdaeac0c319cb272b00d7e': { coingeckoId: "ethereum", decimals: 18 }, + '0xf54b8cb8eeee3823a55dddf5540ceaddf9724626': { coingeckoId: "wrapped-bitcoin", decimals: 8 }, + } } ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) From 88221ee1017e84f744168c6375af43e2e89622e0 Mon Sep 17 00:00:00 2001 From: 0xBraunGuy <105317789+0xBraunGuy@users.noreply.github.com> Date: Sat, 17 Aug 2024 05:46:37 -0400 Subject: [PATCH 2/5] lulo tvl adapter with timetravel (#11333) --- projects/lulo/index.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 projects/lulo/index.js diff --git a/projects/lulo/index.js b/projects/lulo/index.js new file mode 100644 index 0000000000..084fb15f92 --- /dev/null +++ b/projects/lulo/index.js @@ -0,0 +1,33 @@ +const sdk = require('@defillama/sdk') + +const endpoint = 'http://api.flexlend.fi/stats' +const startTimestamp = 1704067200 // 2024-01-01 + +async function tvl(options) { + const balances = {} + const request = { + method: 'GET', + headers: { + accept: 'application/json', + 'x-lulo-api-key': String(process.env.LULO_API_KEY || ''), + }, + } + + const response = await fetch(`${endpoint}?timestamp=${options.timestamp}`, request) + + const { data } = await response.json() + + data.map(d => { + sdk.util.sumSingleBalance(balances, d.mintAddress, d.tokens, 'solana') + }) + return balances +} + +module.exports = { + doublecounted: true, + timetravel: true, + start: startTimestamp, + methodology: + 'Volume is calculated by summing the total USD value of deposited funds in Lulo across all tokens', + solana: { tvl }, +} From 4f69138e3322302fc7fc22c13c53d6f360d396c7 Mon Sep 17 00:00:00 2001 From: 0xpeluche <110820448+0xpeluche@users.noreply.github.com> Date: Sat, 17 Aug 2024 12:11:20 +0200 Subject: [PATCH 3/5] feat: Adapter, defi.money (#11330) * feat:Adapter, defi-money * add methodology * add yield part * doublecounted: true * split project in two different products * code refactor * remove pool2 --------- Co-authored-by: 0xpeluche <0xpeluche@protonmail.com> Co-authored-by: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> --- projects/defi-money/index.js | 51 ++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 projects/defi-money/index.js diff --git a/projects/defi-money/index.js b/projects/defi-money/index.js new file mode 100644 index 0000000000..ed6010732e --- /dev/null +++ b/projects/defi-money/index.js @@ -0,0 +1,51 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const config = { + optimism: { + controller: "0x1337F001E280420EcCe9E7B934Fa07D67fdb62CD", + MONEY: "0x7e803F4edd6528caFBf5C5d03Cc106b04379C24b", + stakeLPs: [ + // "0x7e803F4edd6528caFBf5C5d03Cc106b04379C24b", // MONEY - already included in tvl + "0xE8f00491afa68B4A653C77e5f92DBA0F8df3a185", // crvUSD/MONEY + "0xa398a48C2738fd6c79F5654823Fb93456B0fDaF6", // USDT/MONEY + "0x36afCD1083eE9186A2b984E10d75C1E14b99B75e", // USDC/MONEY + "0xcf38a66DeD7825cfEF66046c256Aa0EDbd41BEf5", // DAI/MONEY + "0x73C3eC2b8e00929824a529e60fb6ed8aF193c7cc", // FRAX/MONEY + ], + }, + arbitrum: { + controller: "0x1337F001E280420EcCe9E7B934Fa07D67fdb62CD", + MONEY: "0xEbE54BEE7A397919C53850bA68E126b0A6b295ed", + stakeLPs: [ + // "0xEbE54BEE7A397919C53850bA68E126b0A6b295ed", // MONEY - already included in tvl + "0xF2852d7e810d3EC7094bFE1D7DDCa5044c259c25", // crvUSD/MONEY + "0x6e59b326984fC132F16a977cd20E38641A9043De", // USDT/MONEY + "0xdE718A791226c93B53C77D60E5D4693C05a31422", // USDC/MONEY + "0xE3763d545707F435e21eeBbe75070495c806B744", // DAI/MONEY + "0x07aDF588508b923B8eA0389d27b61b9CB8a197Cb", // FRAX/MONEY + ], + }, +} + +const tvl = async (api) => { + const { controller, } = config[api.chain] + const colls = await api.call({ target: controller, abi: 'address[]:get_all_collaterals' }) + const amms = await api.multiCall({ abi: 'function get_amm(address) view returns (address)', calls: colls, target: controller }) + return sumTokens2({ api, tokensAndOwners2: [colls, amms]}) +} + +const pool2 = async (api) => { + const { stakeLPs = [], } = config[api.chain] + const tokens = await api.multiCall({ abi: 'address:STAKE_TOKEN', calls: stakeLPs }) + return sumTokens2({ api, tokensAndOwners2: [tokens, stakeLPs]}) +} + +module.exports = { + methodology: "TVL corresponds to the collateral deposited in the markets", +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl, pool2, + } +}) From 14d5e7f0a18036c816d04f450cabcc10edd84038 Mon Sep 17 00:00:00 2001 From: cgi-bin/ <6095048+sven-hash@users.noreply.github.com> Date: Sat, 17 Aug 2024 12:14:41 +0200 Subject: [PATCH 4/5] update: add new ayin pool (#11334) Co-authored-by: cgi-bin --- projects/ayin/index.js | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/projects/ayin/index.js b/projects/ayin/index.js index 33c05f2320..375005468d 100644 --- a/projects/ayin/index.js +++ b/projects/ayin/index.js @@ -3,15 +3,26 @@ const alephium = require('../helper/chain/alephium') const Addresses = { alphAyinPool: '25ywM8iGxKpZWuGA5z6DXKGcZCXtPBmnbQyJEsjvjjWTy', alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX', + alphUsdcPool: '283R192Z8n6PhXSpSciyvCsLEiiEVFkSE6MbRBA4KSaAj', alphWethPool: 'yXMFxdoKcE86W9NAyajc8Z3T3k2f5FGiHqHtuA69DYT1', - ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m', alphWbtcPool: '28XY326TxvSekaAwiWDLFg2QBRfacSga8dyNJCYGUYNbq', + alphApadPool: 'vFpZ1DF93x1xGHoXM8rsDBFjpcoSsCi5ZEuA5NG5UJGX', + alphChengPool: '25b5aNfdrNRjJ7ugPTkxThT51L1NSvf8igQyDHKZhweiK', + alphAnsdPool: 'uM4QJwHqFoTF2Pou8TqwhaDiHYLk4SHG65uaQG8r7KkT', + alphAlphagaPool: '23cXw23ZjRqKc7i185ZoH8vh9KT4XTumVRWpVLUecgLMd', + ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m', + ayinUsdcPool: '2961aauvprhETv6TXGQRc3zZY4FbLnqKon2a4wK6ABH9q', + ayinApadPool: '247rZysrruj8pj2GnFyK2bqB2nU4JsUj7k2idksAp4XMy', usdtUsdcPool: '27C75V9K5o9CkkGTMDQZ3x2eP82xnacraEqTYXA35Xuw5', usdt: 'zSRgc7goAYUgYsEBYdAzogyyeKv3ne3uvWb3VDtxnaEK', weth: 'vP6XSUyjmgWCB2B9tD5Rqun56WJqDdExWnfwZVEqzhQb', ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy', wbtc: 'xUTp3RXGJ1fJpCGqsAY6GgyfRQ3WQ1MdcYR1SiwndAbR', - usdc: '22Nb9JajRpAh9A2fWNgoKt867PA6zNyi541rtoraDfKXV' + usdc: '22Nb9JajRpAh9A2fWNgoKt867PA6zNyi541rtoraDfKXV', + apad: '27HxXZJBTPjhHXwoF1Ue8sLMcSxYdxefoN2U6d8TKmZsm', + cheng: '27DP28mGQzSrHGZgnRvYQH1VAWYZVVLUjGALazLrtrRJF', + ansd: '2AhEaQiUYtAF6g1vtRQHsPR7xTkMY1PRr3k7QkXuisynF', + alphaga: '26Mirs33zojnVMRkqVDJtMZvVZcbAFVyxGojGw7UtWp2K' } const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3' @@ -21,7 +32,10 @@ const TokenIds = { weth: alephium.contractIdFromAddress(Addresses.weth), ayin: alephium.contractIdFromAddress(Addresses.ayin), wbtc: alephium.contractIdFromAddress(Addresses.wbtc), - usdc: alephium.contractIdFromAddress(Addresses.usdc) + usdc: alephium.contractIdFromAddress(Addresses.usdc), + apad: alephium.contractIdFromAddress(Addresses.apad), + cheng: alephium.contractIdFromAddress(Addresses.cheng), + ansd: alephium.contractIdFromAddress(Addresses.ansd) } async function ayinTvlForXAyin() { @@ -37,12 +51,12 @@ async function ayinTvlForXAyin() { async function tvl() { const alphTvls = await Promise.all([ - Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool + Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphUsdcPool, Addresses.alphWethPool, Addresses.alphApadPool, Addresses.alphChengPool, Addresses.alphAnsdPool, Addresses.alphAlphagaPool ].map(poolAddress => alephium.getAlphBalance(poolAddress))) const alphTvl = alphTvls.reduce((tvl, res) => tvl + Number(res.balance), 0) const tokensTvls = await Promise.all([ Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool, Addresses.ayinUsdtPool, - Addresses.alphWbtcPool, Addresses.usdtUsdcPool + Addresses.ayinUsdcPool,Addresses.alphWbtcPool, Addresses.usdtUsdcPool,Addresses.alphApadPool, Addresses.alphChengPool, Addresses.ayinApadPool, Addresses.alphAnsdPool, Addresses.alphAlphagaPool ].map(poolAddress => alephium.getTokensBalance(poolAddress))) const tokensTvl = tokensTvls.reduce((res, tokenTvls) => { tokenTvls.forEach(tokenTvl => { @@ -51,14 +65,18 @@ async function tvl() { } }); return res - }, { [TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0, [TokenIds.wbtc]: 0, [TokenIds.usdc]: 0 }) + }, { [TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0, [TokenIds.wbtc]: 0, [TokenIds.usdc]: 0, [TokenIds.apad]: 0, [TokenIds.cheng]: 0, [TokenIds.ansd]: 0, [TokenIds.ansd]: 0, [TokenIds.alphaga]: 0 }) return { alephium: alphTvl / 1e18, ayin: tokensTvl[TokenIds.ayin] / 1e18, weth: tokensTvl[TokenIds.weth] / 1e18, tether: tokensTvl[TokenIds.usdt] / 1e6, usdc: tokensTvl[TokenIds.usdc] / 1e6, - bitcoin: tokensTvl[TokenIds.wbtc] / 1e8 + bitcoin: tokensTvl[TokenIds.wbtc] / 1e8, + alphpad: tokensTvl[TokenIds.apad] / 1e18, + gigacheng: tokensTvl[TokenIds.cheng] / 1e6, + alephiumdomains: tokensTvl[TokenIds.ansd] / 1e18, + alphaga: tokensTvl[TokenIds.alphaga] / 1e18 } } From 24dd550493f5a408a96af9c95de84e1fe2da55c0 Mon Sep 17 00:00:00 2001 From: mdcryptonfts <105838382+mdcryptonfts@users.noreply.github.com> Date: Sat, 17 Aug 2024 06:15:23 -0400 Subject: [PATCH 5/5] Added waxdao project (#11286) * added waxdao project * separate staking for waxdao * removed dao.waxdao contract --------- Co-authored-by: Mike D --- projects/waxdao/index.js | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 projects/waxdao/index.js diff --git a/projects/waxdao/index.js b/projects/waxdao/index.js new file mode 100644 index 0000000000..ed2f776ee9 --- /dev/null +++ b/projects/waxdao/index.js @@ -0,0 +1,30 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +const staking_accounts = ["waxdaofarmer", "farms.waxdao", "tf.waxdao"]; + +const tokens = [ + ["eosio.token", "WAX", "wax"], + ["wuffi", "WUF", "wuffi"], + ["alien.worlds", "TLM", "alien-worlds"], +]; + + +// WaxDAO +// https://waxdao.io +async function wax() { + const accounts = ["waxdaolocker", "waxdaomarket", "waxdaobacker", "waxdaoescrow", "waxdaosynths"]; + + return await get_account_tvl(accounts, tokens, "wax"); +} + +async function staking() { + return await get_account_tvl(staking_accounts, tokens, "wax"); +} + +module.exports = { + methodology: `WaxDAO TVL is achieved by querying token balances from vesting, farming, and market contract(s)`, + wax: { + tvl: wax, + staking + }, +} \ No newline at end of file