From 67763531e5988a86ce59667c4b9c932b152f7e53 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:30:01 +0300 Subject: [PATCH 1/6] refactor sol adapters --- projects/DropCopy/index.js | 3 +- projects/apricot.js | 2 +- projects/atrix.js | 2 +- projects/cropper.js | 2 +- projects/drift.js | 44 ++--------- projects/flashtrade/index.js | 2 +- projects/goblingold.js | 11 +-- projects/helper/solana.js | 3 +- projects/helper/treasury.js | 1 - projects/invariant/index.js | 2 +- projects/invictus/index.js | 2 +- projects/jupiter-perpetual.js | 12 +-- projects/larix.js | 6 +- projects/oxygen/index.js | 2 +- projects/portfinance/index.js | 2 +- projects/swim/index.js | 2 +- projects/synthetify/index.js | 9 +-- projects/whales-market/index.js | 130 ++++++++++++++++---------------- 18 files changed, 92 insertions(+), 145 deletions(-) diff --git a/projects/DropCopy/index.js b/projects/DropCopy/index.js index a3cd4ba31e73..60407395971f 100644 --- a/projects/DropCopy/index.js +++ b/projects/DropCopy/index.js @@ -2,10 +2,9 @@ const { sumTokens2 } = require('../helper/solana') const DROP = 'DropTpWcDmP7kVRUEoKSJaMVi62hGo9jp19Hz19JVsjh'; const PARIMUTUEL_WALLET = 'DCa1Xir4zDEtz78beFcXCHUNXdeBnrxBiRuuapHrBE3F'; -const PARIMUTUEL_ACCOUNT = 'mD62sAqPAiVbHGPTTeEianTYa1AytkKqqcxMvQxF3S3'; async function tvl() { - return sumTokens2({ owner: PARIMUTUEL_WALLET, getAllTokenAccounts: true, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]}) + return sumTokens2({ owner: PARIMUTUEL_WALLET, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]}) } module.exports = { diff --git a/projects/apricot.js b/projects/apricot.js index 3ad79d4ae27c..3a17583fde63 100644 --- a/projects/apricot.js +++ b/projects/apricot.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require('./helper/solana') async function tvl() { const owner = '7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW' - return sumTokens2({ owner, getAllTokenAccounts: true }) + return sumTokens2({ owner }) } module.exports = { diff --git a/projects/atrix.js b/projects/atrix.js index b8839065c3b1..b1a9202997ad 100644 --- a/projects/atrix.js +++ b/projects/atrix.js @@ -6,7 +6,7 @@ const { sumTokens2, getConnection , getProvider} = require('./helper/solana') async function tvl() { // previously we were incorrectly counting all tokens in serum pools as atrix tvl - return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', getAllTokenAccounts: true, }) + return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', }) /* const connection = getConnection() const provider = getProvider() const program = new Program(idl, 'HvwYjjzPbXWpykgVZhqvvfeeaSraQVnTiQibofaFw9M7', provider) diff --git a/projects/cropper.js b/projects/cropper.js index 331bd193cd9e..7f4295d4ebec 100644 --- a/projects/cropper.js +++ b/projects/cropper.js @@ -3,7 +3,7 @@ const { PublicKey } = require('@solana/web3.js') const DEX_PROGRAM_ID = 'CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh' async function fetchStaking() { - return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'], getAllTokenAccounts: true }); + return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'] }); } async function getTokenAccounts() { diff --git a/projects/drift.js b/projects/drift.js index 1f560432316b..702364a68c16 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -1,8 +1,4 @@ -const { PublicKey } = require("@solana/web3.js"); -const anchor = require("@project-serum/anchor"); const { sumTokens2, } = require("./helper/solana"); -const DRIFT_PROGRAM_ID = new PublicKey('dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH') -const { getConfig } = require('./helper/cache') module.exports = { timetravel: false, @@ -12,37 +8,11 @@ module.exports = { }, }; -async function tvl(api) { - - const legacyVaults = [ - '6W9yiHDCW9EpropkFV8R3rPiL8LVWUHSiys3YeW6AT6S', // legacy usdc vault - 'Bzjkrm1bFwVXUaV9HTnwxFrPtNso7dnwPQamhqSxtuhZ', // legacy usdc insurance fund - ]; - const getSpotMarketVaultPublicKey = marketIndex => getVaultPublicKey('spot_market_vault', marketIndex) - const getInsuranceFundVaultPublicKey = marketIndex => getVaultPublicKey('insurance_fund_vault', marketIndex) - let configFile = await getConfig('drift-config', 'https://raw.githubusercontent.com/drift-labs/protocol-v2/master/sdk/src/constants/spotMarkets.ts') - const marketIndices = []; - configFile = configFile.slice(configFile.indexOf('MainnetSpotMarkets:')) - - const regex = /marketIndex:\s*(\d+),/g - let match; - while ((match = regex.exec(configFile))) { - marketIndices.push(parseInt(match[1])); - } - - const vaults = [ - ...legacyVaults, - ...marketIndices.map(getSpotMarketVaultPublicKey), - ...marketIndices.map(getInsuranceFundVaultPublicKey), - ] - - return sumTokens2({ tokenAccounts: vaults }) -} - -function getVaultPublicKey(seed, marketIndex) { - return PublicKey.findProgramAddressSync( - [ - Buffer.from(anchor.utils.bytes.utf8.encode(seed)), - new anchor.BN(marketIndex).toArrayLike(Buffer, 'le', 2), - ], DRIFT_PROGRAM_ID)[0].toBase58() +async function tvl() { + return sumTokens2({ + owners: [ + 'CU4eFxpyCGNDEXN27Jonn7RfgwBt3cnp7TcTrJF6EW9Q', // legacy + 'JCNCMFXo5M5qwUPg2Utu1u6YWp3MbygxqBsBeXXJfrw', // Drift vault + ], + }) } diff --git a/projects/flashtrade/index.js b/projects/flashtrade/index.js index 84b4135accb5..943832c20b3e 100644 --- a/projects/flashtrade/index.js +++ b/projects/flashtrade/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require("../helper/solana"); async function tvl() { - return sumTokens2({ owner: '81xGAvJ27ZeRThU2JEfKAUeT4Fx6qCCd8WHZpujZbiiG', getAllTokenAccounts: true, }); + return sumTokens2({ owner: '81xGAvJ27ZeRThU2JEfKAUeT4Fx6qCCd8WHZpujZbiiG', }); } module.exports = { diff --git a/projects/goblingold.js b/projects/goblingold.js index c08b15095687..09d5b1905a10 100644 --- a/projects/goblingold.js +++ b/projects/goblingold.js @@ -1,5 +1,4 @@ -const { getProvider, transformBalances, } = require('./helper/solana') -const sdk = require('@defillama/sdk') +const { getProvider, } = require('./helper/solana') const { Program, } = require("@project-serum/anchor"); const vaults = { "BTC": "FvqYV2Cg7s7iWKUBTWkyybKuz1m85ny6ijDqDXEXVyNv", @@ -17,16 +16,14 @@ const vaults = { "stSOL": "47hnvWxWo4PpPNqPF78cJ4abjpT45qY9of8hokeLzEUX" } -async function tvl() { +async function tvl(api) { + const provider = getProvider() const programId = 'GGo1dnYpjKfe9omzUaFtaCyizvwpAMf3NhxSCMD61F3A' const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) const data = await program.account.vaultAccount.fetchMultiple(Object.values(vaults)) - const tokenBalances = {} - data.forEach((i, idx) => - sdk.util.sumSingleBalance(tokenBalances, i.inputMintPubkey.toString(), +i.currentTvl)) - return transformBalances({ tokenBalances }) + data.forEach(i => api.add(i.inputMintPubkey.toString(), i.currentTvl)) } module.exports = { diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 931bdd3a838d..5ca74e49f2bb 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -225,14 +225,13 @@ async function sumTokens2({ solOwners = [], blacklistedTokens = [], allowError = false, - getAllTokenAccounts = false, }) { blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() } - if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0) && getAllTokenAccounts) { + if (!tokensAndOwners.length && !tokens.length && (owner || owners.length > 0)) { const _owners = getUniqueAddresses([...owners, owner].filter(i => i), 'solana') for (const _owner of _owners) { const data = await getOwnerAllAccount(_owner) diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js index 34b066260551..c5e88e809488 100644 --- a/projects/helper/treasury.js +++ b/projects/helper/treasury.js @@ -13,7 +13,6 @@ function treasuryExports(config) { const tvlConfig = { permitFailure: true, ...config[chain], } if (chain === 'solana') { tvlConfig.solOwners = owners - tvlConfig.getAllTokenAccounts = true } else if (config[chain].fetchCoValentTokens !== false) { if (ankrChainMapping[chain]) { tvlConfig.fetchCoValentTokens = true diff --git a/projects/invariant/index.js b/projects/invariant/index.js index a79b24064a0f..0098e4a90e37 100644 --- a/projects/invariant/index.js +++ b/projects/invariant/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/solana') async function tvl() { - return sumTokens2({ owner: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt', getAllTokenAccounts: true }) + return sumTokens2({ owner: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt' }) } module.exports = { diff --git a/projects/invictus/index.js b/projects/invictus/index.js index 7f4ec2f9ab9f..0d3107254104 100644 --- a/projects/invictus/index.js +++ b/projects/invictus/index.js @@ -6,7 +6,7 @@ async function staking() { const treasury = "6qfyGvoUqGB6AQ7xLc4pVwFNdgJSbAMkTtKkBXhLRiV1" async function tvl() { - return sumTokens2({ owner: treasury, getAllTokenAccounts: true }) + return sumTokens2({ owner: treasury }) } diff --git a/projects/jupiter-perpetual.js b/projects/jupiter-perpetual.js index 04278ef2bf27..c71cc67a068a 100644 --- a/projects/jupiter-perpetual.js +++ b/projects/jupiter-perpetual.js @@ -11,14 +11,6 @@ module.exports = { }, }; -async function tvl(api) { - const vaults = [ - "BUvduFTd2sWFagCunBPLupG8fBTJqweLw9DuhruNFSCm", // SOL - "WzWUoCmtVv7eqAbU3BfKPU3fhLP6CXR8NCJH78UK9VS", // USDC - "Gex24YznvguMad1mBzTQ7a64U1CJy59gvsStQmNnnwAd", // USDT - "Bgarxg65CEjN3kosjCW5Du3wEqvV3dpCGDR3a2HRQsYJ", // ETH - "FgpXg2J3TzSs7w3WGYYE7aWePdrxBVLCXSxmAKnCZNtZ", // BTC - ]; - - return sumTokens2({ tokenAccounts: vaults }); +async function tvl() { + return sumTokens2({ owner: 'AVzP2GeRmqGphJsMxWoqjpUifPpCret7LqWhD8NWQK49' }); } diff --git a/projects/larix.js b/projects/larix.js index 20f5e80b60da..631afc5ea559 100644 --- a/projects/larix.js +++ b/projects/larix.js @@ -1,4 +1,4 @@ -const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana"); +const { getConnection, decodeAccount, } = require("./helper/solana"); const { PublicKey, } = require("@solana/web3.js"); const sdk = require('@defillama/sdk'); let programs = { @@ -34,11 +34,11 @@ async function getAllData() { } const tokenAccounts = [] - data.forEach(({ liquidity: { mintPubkey, borrowedAmountWads, supplyPubkey } }) => { + data.forEach(({ liquidity: { mintPubkey, borrowedAmountWads, supplyPubkey, availableAmount, } }) => { tokenAccounts.push(supplyPubkey) + sdk.util.sumSingleBalance(balances.tvl, mintPubkey.toString(), availableAmount, 'solana') sdk.util.sumSingleBalance(balances.borrowed, mintPubkey.toString(), borrowedAmountWads / 1e18, 'solana') }) - balances.tvl = await sumTokens2({ tokenAccounts }) return balances } } diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js index c0552ea7c795..01981a1a8057 100644 --- a/projects/oxygen/index.js +++ b/projects/oxygen/index.js @@ -2,7 +2,7 @@ const { sumTokens2 } = require('../helper/solana') async function tvl(api) { - return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq', getAllTokenAccounts: true}) + return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq'}) } module.exports = { diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js index ce741e678695..f3819fc9274e 100644 --- a/projects/portfinance/index.js +++ b/projects/portfinance/index.js @@ -6,7 +6,7 @@ async function tvl() { '8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ', // Main Pool 'GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3', // Hubble Innovation Zone 'Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa', // UXD Innovation Zone - ], getAllTokenAccounts: true, }) + ], }) } module.exports = { diff --git a/projects/swim/index.js b/projects/swim/index.js index f690659ecd83..0cce916e1bdf 100644 --- a/projects/swim/index.js +++ b/projects/swim/index.js @@ -15,7 +15,7 @@ const owners = [ ] async function tvl() { - return sumTokens2({ owners, getAllTokenAccounts: true }); + return sumTokens2({ owners }); } module.exports = { diff --git a/projects/synthetify/index.js b/projects/synthetify/index.js index 79bb4c22d9d7..795e3329dc15 100644 --- a/projects/synthetify/index.js +++ b/projects/synthetify/index.js @@ -7,16 +7,9 @@ async function tvl() { const provider = getProvider() const idl = await Program.fetchIdl(programId, provider) const program = new Program(idl, programId, provider) - const assetsList = await program.account.assetsList.all() const state = await program.account.state.all() const owners = state.map(i => i.account.exchangeAuthority.toString()) - const tokens = [] - assetsList.forEach(list => { - const { headCollaterals, collaterals } = list.account - for (let i = 0; i < headCollaterals; i++) - tokens.push(collaterals[i].collateralAddress.toString()) - }) - return sumTokens2({ tokens, owners, }) + return sumTokens2({ owners, }) } module.exports = { diff --git a/projects/whales-market/index.js b/projects/whales-market/index.js index 3b1fe2e2a37e..ac9413b92f35 100644 --- a/projects/whales-market/index.js +++ b/projects/whales-market/index.js @@ -1,76 +1,74 @@ const ADDRESSES = require('../helper/coreAssets.json'); -const { sumTokens2 } = require("../helper/solana"); -const { sumTokensExport } = require('../helper/sumTokens') +const { sumTokens2 } = require("../helper/solana"); +const { sumTokensExport } = require('../helper/sumTokens') const insuranceConfig = { - ethereum: { - owner: '0x1eCdB32e59e948C010a189a0798C674a2d0c6603', - tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], - }, - arbitrum: { - owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', - tokens: [ADDRESSES.null,ADDRESSES.arbitrum.USDC], - }, - merlin: { - owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', - tokens: [ADDRESSES.null], - }, - manta: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - starknet: { - owner: '0x04427a62f43314c0f1b171358235c04598dbc702c61a891fa1fb0cc52936cfff', - tokens: [ADDRESSES.starknet.ETH, ADDRESSES.starknet.USDC, ADDRESSES.starknet.USDT], - }, - blast: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - base: { - owner: '0xdf02eeaB3CdF6eFE6B7cf2EB3a354dCA92A23092', - tokens: [ADDRESSES.null], - }, - bsc: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - linea: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - mode: { - owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', - tokens: [ADDRESSES.null], - }, - solana: { - owner: 'GDsMbTq82sYcxPRLdQ9RHL9ZLY3HNVpXjXtCnyxpb2rQ', - tokens: [ - ADDRESSES.solana.USDC, - ADDRESSES.solana.SOL, - ADDRESSES.solana.USDT, - 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn'// jito SOL - ], - }, - + ethereum: { + owner: '0x1eCdB32e59e948C010a189a0798C674a2d0c6603', + tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC], + }, + arbitrum: { + owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', + tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDC], + }, + merlin: { + owner: '0x7a560269480ef38b885526c8bbecdc4686d8bf7a', + tokens: [ADDRESSES.null], + }, + manta: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + starknet: { + owner: '0x04427a62f43314c0f1b171358235c04598dbc702c61a891fa1fb0cc52936cfff', + tokens: [ADDRESSES.starknet.ETH, ADDRESSES.starknet.USDC, ADDRESSES.starknet.USDT], + }, + blast: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + base: { + owner: '0xdf02eeaB3CdF6eFE6B7cf2EB3a354dCA92A23092', + tokens: [ADDRESSES.null], + }, + bsc: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + linea: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + mode: { + owner: '0x7a560269480Ef38B885526C8bBecdc4686d8bF7A', + tokens: [ADDRESSES.null], + }, + solana: { + owner: 'GDsMbTq82sYcxPRLdQ9RHL9ZLY3HNVpXjXtCnyxpb2rQ', + tokens: [ + ADDRESSES.solana.USDC, + ADDRESSES.solana.SOL, + ADDRESSES.solana.USDT, + 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn'// jito SOL + ], + }, + } async function tvl() { - return sumTokens2({ owner: insuranceConfig.solana.owner, tokens: - insuranceConfig.solana.tokens - }); + return sumTokens2({ owner: insuranceConfig.solana.owner }); } module.exports = { - ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum)}, - arbitrum: { tvl: sumTokensExport(insuranceConfig.arbitrum)}, - merlin: { tvl: sumTokensExport(insuranceConfig.merlin)}, - manta: { tvl: sumTokensExport(insuranceConfig.manta)}, - blast: { tvl: sumTokensExport(insuranceConfig.blast) }, - base: { tvl: sumTokensExport(insuranceConfig.base) }, - bsc: { tvl: sumTokensExport(insuranceConfig.bsc) }, - linea: { tvl: sumTokensExport(insuranceConfig.linea) }, - mode: { tvl: sumTokensExport(insuranceConfig.mode) }, - solana: { tvl }, - starknet: { tvl: sumTokensExport(insuranceConfig.starknet)}, + ethereum: { tvl: sumTokensExport(insuranceConfig.ethereum) }, + arbitrum: { tvl: sumTokensExport(insuranceConfig.arbitrum) }, + merlin: { tvl: sumTokensExport(insuranceConfig.merlin) }, + manta: { tvl: sumTokensExport(insuranceConfig.manta) }, + blast: { tvl: sumTokensExport(insuranceConfig.blast) }, + base: { tvl: sumTokensExport(insuranceConfig.base) }, + bsc: { tvl: sumTokensExport(insuranceConfig.bsc) }, + linea: { tvl: sumTokensExport(insuranceConfig.linea) }, + mode: { tvl: sumTokensExport(insuranceConfig.mode) }, + solana: { tvl }, + starknet: { tvl: sumTokensExport(insuranceConfig.starknet) }, }; From 6fcdfdc5f6c55458651bb410db15cf367ba04c55 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 18:30:29 +0300 Subject: [PATCH 2/6] fix limitless query --- projects/limitless/index.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/projects/limitless/index.js b/projects/limitless/index.js index 6eb7584beb92..a0edc079acc5 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -9,8 +9,13 @@ const config = { linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', }, } const liquidityProvidedQuery = ` -query { - liquidityProvideds(first:1000 orderBy: blockTimestamp orderDirection: desc) { +query($lastId: String, $block: Int) { + liquidityProvideds( + first:1000 + block: { number: $block } + where: { id_gt: $lastId } + ) { + id pool recipient liquidity @@ -22,8 +27,13 @@ query { ` const liquidityWithdrawnQuery = ` -query { - liquidityWithdrawns(first:1000 orderBy: blockTimestamp orderDirection: desc) { +query($lastId: String, $block: Int) { + liquidityWithdrawns( + first:1000 + block: { number: $block } + where: { id_gt: $lastId } + ) { + id pool recipient liquidity From a80d41a684bf65b2e39af364788b111fa1b0b669 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 19 Jul 2024 20:06:59 +0100 Subject: [PATCH 3/6] pro-bit adapter (#11050) --- projects/probit/index.js | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 projects/probit/index.js diff --git a/projects/probit/index.js b/projects/probit/index.js new file mode 100644 index 000000000000..7777210d33cd --- /dev/null +++ b/projects/probit/index.js @@ -0,0 +1,61 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0x72e5263ff33d2494692d7f94a758aa9f82062f73", + "0xaD285fDEDFC0D5f944A33e478356524293c7eC68", + "0xf71afe21cd32959113fc47ae2ef886b43a9413d5" + ], + }, + bsc: { + owners: [ + "0xd6a4452eebde830888cee4a395126831ab16250c", + "0xf4be044ba7461d8444ed53f9ec7490781e08e3b7", + "0x898fce2414a1347c0e12bde6b28b75843fd9bbad" + ], + }, + bitcoin: { + owners: [ + "19EgVpboqNjortWyhJSDAGRvHDtduqiSfr", + "19AtrEvJv7UY75tvWkXMxLUAYibxpZhFfN", + "17PpCEuQUT7xxP1ocfhvFdwQyrB5dG1dQP" + ], + }, + fantom: { + owners: [ + "0xc78600a92caf0fcf6990e7ea7381bf4297054f86", + "0x06ffd89a07b078d4a1a1d9947a28e95825f9c35c", + "0x813e711993fc8ec29e9e45fb3a7e47f8c33ca64f" + ], + }, + polygon: { + owners: [ + "0xfaef9cc9bf46c386c58a3e86ffffbf77969ca149", + "0x29b6e9abf51fc7d4581f6cbd1a9d5392fa7fa78f", + "0xdba24f19bce0f32ea4273faea7c01d7f9d4f91d6" + ], + }, + tron: { + owners: [ + "TPkn5zpxXr8jaNqvgVoFanTsvXCbNXJ8GB", + "TGEwJxVErWagXnriZATPMBFFbbeuad9m3h", + "TYiFSQG4dfdWh8RWETsvJn4fvXdZ8bEL7t" + ], + }, + ripple: { + owners: [ + "rwXEHNNuf3nctzXLtvL5JnQJGMyUZYGrVc", + "rsA9ijHjo7hAkitc9GsXsiwXzqGs7eoeqr", + "rEa9cAYavjfxvmdJExr1PMGxoPYzAUZXGb" + ], + }, + solana: { + owners: [ + "BX145kKanqBmeud72ir44iMFVAfaak4y933rgbMc2H52", + "FavWP1KXVVNZLTYjfSBWPanxbVeCW4A3pJ96hn2GRWGR", + ], + }, +} + +module.exports = cexExports(config) From 1b76447441a1506e0d194642eb03f1277bcb527a Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:59:31 +0300 Subject: [PATCH 4/6] update fyde (#11046) --- projects/fyde/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/projects/fyde/index.js b/projects/fyde/index.js index c099c960cd7a..ca92d3c59305 100644 --- a/projects/fyde/index.js +++ b/projects/fyde/index.js @@ -1,6 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') + const FYDE_CONTRACT = "0x87Cc45fFF5c0933bb6aF6bAe7Fc013b7eC7df2Ee"; const RESTAKING_AGGREGATOR = "0x3f69F62e25441Cf72E362508f4d6711d53B05341"; +const DEPOSIT_ESCROW = "0x63ec950633Eb85797477166084AD0a7121910470"; const ORACLE = "0x05198327206123E89c24ABd9A482316449bD2aEe" const WETH = ADDRESSES.ethereum.WETH; @@ -33,10 +35,14 @@ async function tvl(api) { } else api.add(tokens[i], bals[i]) } + + // add assets in the deposit escrow + const tokensEscrow = await api.fetchList({ lengthAbi: 'getAssetListLength', itemAbi: 'assetList', target: DEPOSIT_ESCROW }) + return api.sumTokens({ tokens: tokensEscrow, owner: DEPOSIT_ESCROW }) } module.exports = { - methodology: 'Read out balances from internal accounting for each asset in Fyde in the YieldModule. Add ETH staked in LRT Aggregator.', + methodology: 'Read out balances from internal accounting for each asset in Fyde, the YieldModule and the DepositEscrow. Add ETH staked in LRT Aggregator.', ethereum: { tvl } From fe5409df1e9d9ea7bf0a4bb4c1c7ce74076531a3 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Sat, 20 Jul 2024 00:22:07 +0300 Subject: [PATCH 5/6] Add Shezmu (#11049) --- projects/shezmu/index.js | 42 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 projects/shezmu/index.js diff --git a/projects/shezmu/index.js b/projects/shezmu/index.js new file mode 100644 index 000000000000..fbf30f43a06d --- /dev/null +++ b/projects/shezmu/index.js @@ -0,0 +1,42 @@ +const { staking } = require('../helper/staking') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const SHEZ = "0x5fE72ed557d8a02FFf49B3B826792c765d5cE162" +const SHEZ_ETH_LP = "0x74E6cAc32234133Fe06bD0f4D8237dEe1dedE057" + +// erc20 vaults +const vaults = [ + "0xF89127a7839Ae1918e742A99E39182adec9C7e48", // USDC_SHEZUSD_VAULT + "0xd116641185B1BD999b92B513657C95f78C8ae872", // wstETH_SHEZUSD_VAULT + "0x092dBbFCb19D1763798CD46bA1635Eaf3C9BA1cD", // wstETH_SHEZETH_VAULT + "0x5439046DC57EdE3Ff6aBA8563108326AdDE9C33b", // weETH_SHEZUSD_VAULT + "0x7648cff49EBa2631Ea4Ae8013Dc6Eb54C1c783f2", // weETH_SHEZETH_VAULT + "0x4DBBDF30BC801a65f6978ab629EAd5267Ac02497", // sUSDe_SHEZETH_VAULT + "0x8A8355317936Ef99E4515567b1c9CC8B86e52a3b", // sfrxETH_SHEZETH_VAULT + "0x84D45BF4a70605fc84D618e1809E90f73dA8f369", // ptUniETH_SHEZETH_VAULT + "0xF00A9f21a72FabCfBAeEfa70D08D947f61B2D16C", // wOETH_SHEZUSD_VAULT + "0x95D970fa98bf608862aE76b5492E53E701210E9F", // wOETH_SHEZETH_VAULT + "0x6625364D0499EcEB5C9308c90eb660B96dFd0746", // WETH_SHEZUSD_VAULT + "0x6261a4a8776343192f3bdeC04F7909591c375cfb", // WETH_SHEZETH_VAULT + "0x3d0D2bDd6f0118ad6194aab84f10Fde688502d16", // WBTC_SHEZUSD_VAULT + "0xED3529B182292f2e33988D852e1a9da0821FBC6e", // CRV_SHEZUSD_VAULT +] + +// SHEZ single staking v1 +const SHEZ_SINGLE_STAKING_V1 = "0xB775f1c426849Ba75891258abA496F69D2e6F570"; + +// SHEZ-ETH LP pool +const SHEZ_ETH_LP_POOL = "0x4574220A54b0306c2CBEc22A3B6C69158b27f1da"; + +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:tokenContract', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) +} + +module.exports = { + ethereum: { + tvl, + pool2: staking(SHEZ_ETH_LP_POOL, SHEZ_ETH_LP), + staking: staking(SHEZ_SINGLE_STAKING_V1, SHEZ), + }, +} \ No newline at end of file From 05cd12adcecc3899364ad299c7bbe164193d8302 Mon Sep 17 00:00:00 2001 From: Milan Steiner <69144826+msteiner96@users.noreply.github.com> Date: Fri, 19 Jul 2024 23:23:40 +0200 Subject: [PATCH 6/6] Phoenix DeFi Hub TVL Adapter (#11047) * Phoenix DeFi Hub TVL Adapter * Add newline to end of file --- projects/phoenix-hub/index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 projects/phoenix-hub/index.js diff --git a/projects/phoenix-hub/index.js b/projects/phoenix-hub/index.js new file mode 100644 index 000000000000..772a0bb729c1 --- /dev/null +++ b/projects/phoenix-hub/index.js @@ -0,0 +1,18 @@ +const utils = require("../helper/utils"); +const {toUSDTBalances} = require("../helper/balances"); + +async function tvl() { + // Fetch all tickers + const tickers = await utils.fetchURL("https://api-phoenix.decentrio.ventures/tickers"); + + // Sum up the tvl + const totalTVL = tickers.data.reduce((acc, t) => acc + t.liquidity_in_usd, 0); + return toUSDTBalances(totalTVL); +} + +module.exports = { + methodology: 'counts the liquidity on all Phoenix Hub AMM Pools.', + stellar: { + tvl, + } +};