diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000000..37184e3d9f
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,2 @@
+# Ignore all files
+*
\ No newline at end of file
diff --git a/liquidations/aave-v2/index.ts b/liquidations/aave-v2/index.ts
index c546df97ec..cc80860cb0 100644
--- a/liquidations/aave-v2/index.ts
+++ b/liquidations/aave-v2/index.ts
@@ -1,3 +1,4 @@
+import * as sdk from "@defillama/sdk";
import { gql, request } from "graphql-request";
import { Liq } from "../utils/types";
import { getPagedGql } from "../utils/gql";
@@ -75,14 +76,14 @@ const rc: { [chain in Chains]: AaveAdapterResource } = {
name: "aave",
chain: Chains.ethereum,
usdcAddress: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
- subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v2",
+ subgraphUrl: sdk.graph.modifyEndpoint('8wR23o1zkS4gpLqLNU4kG3JHYVucqGyopL5utGxP2q1N'),
explorerBaseUrl: "https://etherscan.io/address/",
},
// [Chains.polygon]: {
// name: "aave",
// chain: Chains.polygon,
// usdcAddress: "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
- // subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/aave-v2-matic",
+ // subgraphUrl: sdk.graph.modifyEndpoint('H1Et77RZh3XEf27vkAmJyzgCME2RSFLtDS2f4PPW6CGp'),
// explorerBaseUrl: "https://polygonscan.com/address/",
// },
};
diff --git a/liquidations/benqi/index.ts b/liquidations/benqi/index.ts
index 4b3e2b70b4..ec14a98cc0 100644
--- a/liquidations/benqi/index.ts
+++ b/liquidations/benqi/index.ts
@@ -1,3 +1,4 @@
+import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
@@ -12,7 +13,7 @@ import {
totalCollateralValueInUsd,
} from "../utils/compound-helpers";
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/yhayun/benqi";
+const subgraphUrl = sdk.graph.modifyEndpoint('HcTvZi3fwucvRJvVmtFzNDTnomvMBk64xCLNQQg6GPAV');
const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
diff --git a/liquidations/compound/index.ts b/liquidations/compound/index.ts
index d87100ba7b..e646fd6a79 100644
--- a/liquidations/compound/index.ts
+++ b/liquidations/compound/index.ts
@@ -1,3 +1,4 @@
+import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
@@ -12,7 +13,7 @@ import {
totalCollateralValueInUsd,
} from "../utils/compound-helpers";
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/graphprotocol/compound-v2";
+const subgraphUrl = sdk.graph.modifyEndpoint('AAva7YSZBLar4MaxQ3MqdJDFXkkHEaCDeibKTnraex1x');
const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
diff --git a/liquidations/euler/index.ts b/liquidations/euler/index.ts
index 5ef58aa3ad..d0cac4c0d7 100644
--- a/liquidations/euler/index.ts
+++ b/liquidations/euler/index.ts
@@ -1,9 +1,10 @@
+import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/types";
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/euler-xyz/euler-mainnet";
+const subgraphUrl = sdk.graph.modifyEndpoint('EQBXhrF4ppZy9cBYnhPdrMCRaVas6seNpqviih5VRGmU');
const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
diff --git a/liquidations/mimo-protocol/index.ts b/liquidations/mimo-protocol/index.ts
index 9d0bc72c79..6f72b712cd 100644
--- a/liquidations/mimo-protocol/index.ts
+++ b/liquidations/mimo-protocol/index.ts
@@ -49,16 +49,16 @@ const getSubgraphUrl = (chain: Chain) => {
switch (chain) {
case Chain.ethereum: {
- subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titan";
+ subgraphUrl = sdk.graph.modifyEndpoint('FV3Dw1zMs97LpVPegWZKJv4bsbsZdrob2EqLCPxdcoDS');
break;
}
case Chain.polygon: {
- subgraphUrl = "https://api.thegraph.com/subgraphs/name/m19/titanpolygon";
+ subgraphUrl = sdk.graph.modifyEndpoint('EfFLqiwngmmtE5su2t1EsFoEttoj8KWervocfab1ofYT');
break;
}
// case Chain.fantom: {
// subgraphUrl =
- // "https://api.thegraph.com/subgraphs/name/rayxpub/titanfantom";
+ // sdk.graph.modifyEndpoint('DkSQLWkkiNfeNG43NJnHsW9hfih8hDt4SHFTNMQgPHJH');
// break;
// }
}
diff --git a/liquidations/trader-joe-lend/index.ts b/liquidations/trader-joe-lend/index.ts
index d922f5c999..2e94750979 100644
--- a/liquidations/trader-joe-lend/index.ts
+++ b/liquidations/trader-joe-lend/index.ts
@@ -1,9 +1,10 @@
+import * as sdk from "@defillama/sdk";
import { gql } from "graphql-request";
import { getPagedGql } from "../utils/gql";
import BigNumber from "bignumber.js";
import { Liq } from "../utils/types";
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/traderjoe-xyz/lending";
+const subgraphUrl = sdk.graph.modifyEndpoint('JB5EdQqbddMjawMLYe3C5ifmhN9WKYvLdgAKoUy1CyYy');
const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
diff --git a/liquidations/venus/index.ts b/liquidations/venus/index.ts
index b654f3312c..7d6f154a59 100644
--- a/liquidations/venus/index.ts
+++ b/liquidations/venus/index.ts
@@ -15,7 +15,7 @@ import {
} from "../utils/compound-helpers";
const sdk = require("@defillama/sdk");
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/venusprotocol/venus-subgraph";
+const subgraphUrl = sdk.graph.modifyEndpoint('7h65Zf3pXXPmf8g8yZjjj2bqYiypVxems5d8riLK1DyR');
const accountsQuery = gql`
query accounts($lastId: ID, $pageSize: Int) {
diff --git a/package-lock.json b/package-lock.json
index 4f1deb45ac..cce95c6119 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -51,9 +51,9 @@
}
},
"node_modules/@adraffy/ens-normalize": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz",
- "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q=="
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
+ "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="
},
"node_modules/@aws-crypto/crc32": {
"version": "3.0.0",
@@ -886,11 +886,12 @@
}
},
"node_modules/@defillama/sdk": {
- "version": "5.0.56",
- "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.56.tgz",
- "integrity": "sha512-91dDh9+EbZ8ABDz4SYhPj/eV8vjobh0uQ7+OkgfHH9V1zH/ajJ2DbN40NJqRL+rMzZqu0CX062wNaxPYmcwASw==",
+ "version": "5.0.76",
+ "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.76.tgz",
+ "integrity": "sha512-9aU+dFZjtWpkq9ESn84jg2C5QZDYd7lSyh49IKzWqVt065XIsOiUPm4BiF3htr0e8AzsWFlkUwvqYCr0z32oqA==",
"dependencies": {
"@aws-sdk/client-s3": "^3.400.0",
+ "@elastic/elasticsearch": "^8.13.1",
"@supercharge/promise-pool": "^2.1.0",
"axios": "^1.6.5",
"ethers": "^6.0.0",
@@ -898,6 +899,39 @@
"tron-format-address": "^0.1.11"
}
},
+ "node_modules/@elastic/elasticsearch": {
+ "version": "8.13.1",
+ "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.13.1.tgz",
+ "integrity": "sha512-2G4Vu6OHw4+XTrp7AGIcOEezpPEoVrWg2JTK1v/exEKSLYquZkUdd+m4yOL3/UZ6bTj7hmXwrmYzW76BnLCkJQ==",
+ "dependencies": {
+ "@elastic/transport": "~8.4.1",
+ "tslib": "^2.4.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@elastic/transport": {
+ "version": "8.4.1",
+ "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.4.1.tgz",
+ "integrity": "sha512-/SXVuVnuU5b4dq8OFY4izG+dmGla185PcoqgK6+AJMpmOeY1QYVNbWtCwvSvoAANN5D/wV+EBU8+x7Vf9EphbA==",
+ "dependencies": {
+ "debug": "^4.3.4",
+ "hpagent": "^1.0.0",
+ "ms": "^2.1.3",
+ "secure-json-parse": "^2.4.0",
+ "tslib": "^2.4.0",
+ "undici": "^5.22.1"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@elastic/transport/node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
+ },
"node_modules/@eslint-community/eslint-utils": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz",
@@ -954,6 +988,14 @@
"node": "^12.22.0 || ^14.17.0 || >=16.0.0"
}
},
+ "node_modules/@fastify/busboy": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
+ "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/@humanwhocodes/config-array": {
"version": "0.11.13",
"resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz",
@@ -2363,7 +2405,6 @@
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
- "dev": true,
"dependencies": {
"ms": "2.1.2"
},
@@ -2607,9 +2648,9 @@
}
},
"node_modules/ethers": {
- "version": "6.9.2",
- "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.9.2.tgz",
- "integrity": "sha512-YpkrtILnMQz5jSEsJQRTpduaGT/CXuLnUIuOYzHA0v/7c8IX91m2J48wSKjzGL5L9J/Us3tLoUdb+OwE3U+FFQ==",
+ "version": "6.13.1",
+ "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz",
+ "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==",
"funding": [
{
"type": "individual",
@@ -2621,13 +2662,13 @@
}
],
"dependencies": {
- "@adraffy/ens-normalize": "1.10.0",
+ "@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",
"@noble/hashes": "1.3.2",
"@types/node": "18.15.13",
"aes-js": "4.0.0-beta.5",
"tslib": "2.4.0",
- "ws": "8.5.0"
+ "ws": "8.17.1"
},
"engines": {
"node": ">=14.0.0"
@@ -2934,6 +2975,14 @@
"resolved": "https://registry.npmjs.org/hi-base32/-/hi-base32-0.5.1.tgz",
"integrity": "sha512-EmBBpvdYh/4XxsnUybsPag6VikPYnN30td+vQk+GI3qpahVEG9+gTkG0aXVxTjBqQ5T6ijbWIu77O+C5WFWsnA=="
},
+ "node_modules/hpagent": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz",
+ "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==",
+ "engines": {
+ "node": ">=14"
+ }
+ },
"node_modules/humanize-ms": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/humanize-ms/-/humanize-ms-1.2.1.tgz",
@@ -3095,9 +3144,9 @@
"integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ=="
},
"node_modules/jayson/node_modules/ws": {
- "version": "7.5.9",
- "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz",
- "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==",
+ "version": "7.5.10",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz",
+ "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==",
"engines": {
"node": ">=8.3.0"
},
@@ -3584,6 +3633,11 @@
}
]
},
+ "node_modules/secure-json-parse": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz",
+ "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw=="
+ },
"node_modules/shebang-command": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
@@ -3811,6 +3865,17 @@
"node": ">=14.17"
}
},
+ "node_modules/undici": {
+ "version": "5.28.4",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.28.4.tgz",
+ "integrity": "sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==",
+ "dependencies": {
+ "@fastify/busboy": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.0"
+ }
+ },
"node_modules/undici-types": {
"version": "5.26.5",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz",
@@ -3898,15 +3963,15 @@
"dev": true
},
"node_modules/ws": {
- "version": "8.5.0",
- "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz",
- "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==",
+ "version": "8.17.1",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz",
+ "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==",
"engines": {
"node": ">=10.0.0"
},
"peerDependencies": {
"bufferutil": "^4.0.1",
- "utf-8-validate": "^5.0.2"
+ "utf-8-validate": ">=5.0.2"
},
"peerDependenciesMeta": {
"bufferutil": {
diff --git a/projects/01/index.js b/projects/01/index.js
index d7c4101cef..d51a7e9052 100644
--- a/projects/01/index.js
+++ b/projects/01/index.js
@@ -1,27 +1,12 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokens2 } = require('../helper/solana')
+const { sumTokensExport } = require('../helper/solana')
-async function tvl() {
- const tokens = [
- ADDRESSES.solana.USDC,
- ADDRESSES.solana.SOL,
- ADDRESSES.solana.USDT,
- "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs",
- "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",
- "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
- "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i",
- ]
- const owner = 'HjHSNe8hhvZ8hKCRrhKg1DGiGPd9NYQbUjT1SQRDo4kZ'
-
- return sumTokens2({ owner, tokens })
-}
module.exports = {
hallmarks:[
[1667865600, "FTX collapse"]
],
timetravel: false,
solana: {
- tvl,
+ tvl: sumTokensExport({ owner: 'HjHSNe8hhvZ8hKCRrhKg1DGiGPd9NYQbUjT1SQRDo4kZ' }),
},
methodology: `To obtain the tvl we're getting the vault accounts information where user deposited collateral is stored.`,
}
diff --git a/projects/21-co/index.js b/projects/21-co/index.js
index 7dcd5740a2..1d5299a08a 100644
--- a/projects/21-co/index.js
+++ b/projects/21-co/index.js
@@ -3,7 +3,8 @@ const { cexExports } = require('../helper/cex')
const config = {
bitcoin: {
owners: [
- '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW'
+ '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW',
+ '12WZhMFFLHQ4rCMSkeBfbJXRk7aGWyBh1M',
],
},
solana: {
diff --git a/projects/3jane/index.js b/projects/3jane/index.js
new file mode 100644
index 0000000000..8fdb9233fd
--- /dev/null
+++ b/projects/3jane/index.js
@@ -0,0 +1,27 @@
+const abi = {
+ vaultParams: "function vaultParams() view returns (bool isPut, uint8 decimals, address asset, address underlying, uint56 minimumSupply, uint104 cap)"
+}
+
+const config = {
+ ethereum: {
+ vaults: [
+ "0xAcD147A5bbCB7166c5BB13A9354ad7a59b99fB4d", // weETH call vault
+ ]
+ }
+}
+
+module.exports = {
+ methodology: "Sums the totalBalance of all 3Jane Theta Vaults",
+};
+
+Object.keys(config).forEach(chain => {
+ const { vaults } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const balances = await api.multiCall({ abi: "uint256:totalBalance", calls: vaults })
+ const data = await api.multiCall({ abi: abi.vaultParams, calls: vaults })
+ const tokens = data.map(d => d.asset)
+ api.add(tokens, balances)
+ }
+ }
+})
diff --git a/projects/88mph/index.js b/projects/88mph/index.js
index 215d749e08..a931e7e9ed 100644
--- a/projects/88mph/index.js
+++ b/projects/88mph/index.js
@@ -2,10 +2,26 @@ const sdk = require('@defillama/sdk')
const { staking } = require('../helper/staking')
const { getUniqueAddresses } = require('../helper/utils')
-const { graphQuery } = require('../helper/http')
const config = {
- ethereum: { dpools: 'https://api.thegraph.com/subgraphs/name/bacon-labs/eighty-eight-mph', vPools: [
+ ethereum: { dpools: [
+ "0x19e10132841616ce4790920d5f94b8571f9b9341",
+ "0x22e6b9a65163ce1225d1f65ef7942a979d093039",
+ "0x23fa6b36e870ca5753853538d17c3ca7f5269e84",
+ "0x2f3efd1a90a2336ab8fa1b9060380dc37361ca55",
+ "0x303cb7ede0c3ad99ce017cdc3abacd65164ff486",
+ "0x35966201a7724b952455b73a36c8846d8745218e",
+ "0x374226dbaa3e44bf3923afb63f5fd83928b7e148",
+ "0x3f5611f7762cc39fc11e10c864ae38526f650e9d",
+ "0x6712baab01fa2dc7be6635746ec2da6f8bd73e71",
+ "0x681aaa7cf3f7e1f110842f0149ba8a4af53ef2fd",
+ "0x904f81eff3c35877865810cca9a63f2d9cb7d4dd",
+ "0xb1abaac351e06d40441cf2cd97f6f0098e6473f2",
+ "0xd4837145c7e13d580904e8431cfd481f9794fc41",
+ "0xdc86ac6140026267e0873b27c8629efe748e7146",
+ "0xe615e59353f70ca2424aa0f24f49c639b8e924d3",
+ "0xe8c52367b81113ed32bb276184e521c2fbe9393a",
+ ], vPools: [
"0x062214fbe3f15d217512deb14572eb01face0392",
"0x085d70ca0dade4683d0f59d5a5b7d3298011b4de",
"0x0f834c3601088d1b060c47737a2f5ce4ffa5ac1d",
@@ -40,8 +56,36 @@ const config = {
"0x8eb1b3ac29e0dcbd7f519c86f1eb76a3aea41b76",
"0xc1f147db2b6a9c9fbf322fac3d1fbf8b8aaeec10"
] },
- avax: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-avalanche' },
- fantom: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-fantom', vPools: [
+ avax: { dpools: [
+ "0x2252185532317932b1883b3429407296a2c69244",
+ "0x336c38657837aa2b5fd21d41ea651b6d792291d9",
+ "0x4f28fc2be45682d1be1d0f155f4a52d4509db629",
+ "0x58e65f624c5ecf595824c96b3853ea8da2f9adf1",
+ "0x747cdec7d885ca961baec11481cda651bf4d1004",
+ "0xa78276c04d8d807feb8271fe123c1f94c08a414d",
+ "0xbcd1571761c2f3d8e0ae93651753aa968e357425",
+ "0xc7cbb403d1722ee3e4ae61f452dc36d71e8800de",
+ "0xd1fea1b2dc4e0be1f5f16bacf1dfeb7fc3434b5f",
+ "0xd9f46096801799f59f34c95e0b4df0f6a76bfcf3",
+ "0xeb706249f3b4640839e64211336b2063a3cdfbb9",
+ "0xf0ca068be757e61cdfa6314bf59f5243767f1bfd"
+ ] },
+ fantom: { dpools: [
+ "0x23fe5a2ba80ea2251843086ec000911cfc79c864",
+ "0x2744b79c985ae0c6b81f1da8eed1a4c67eb4b732",
+ "0x3cab1cb5a9b68350b39ddf7ce23518d609a8bc78",
+ "0x7e4697f650934ea6743b8b0619fc2454db02405a",
+ "0xa1857578cec558eaed9120739b0c533549bdcb61",
+ "0xa78276c04d8d807feb8271fe123c1f94c08a414d",
+ "0xbdf43e9c6cf68359deff9292098622643ede5ec3",
+ "0xc0710b3564fd4768f912150d39d519b66f2952d4",
+ "0xc7cbb403d1722ee3e4ae61f452dc36d71e8800de",
+ "0xc80cc61910c6f8f47aadc69e40ab8d1b2fa2c4df",
+ "0xc91c2255525e80630eee710e7c0637bce7d98978",
+ "0xcb29ce2526ff5f80ad1536c6a1b13238d615b4b9",
+ "0xd62f71937fca1c7c05da08cec4c451f12fc64964",
+ "0xf7fb7f095c8d0f4ee8ffbd142fe0b311491b45f3"
+ ], vPools: [
"0x3cab1cb5a9b68350b39ddf7ce23518d609a8bc78",
"0xa1857578cec558eaed9120739b0c533549bdcb61",
"0xa78276c04d8d807feb8271fe123c1f94c08a414d",
@@ -57,26 +101,24 @@ const config = {
"0x2744b79c985ae0c6b81f1da8eed1a4c67eb4b732",
"0xc91c2255525e80630eee710e7c0637bce7d98978"
] },
- polygon: { dpools: 'https://api.thegraph.com/subgraphs/name/88mphapp/88mph-polygon' },
+ polygon: { dpools: [
+ "0x0e99145166e2982bb67054a1e5d3a902fc4d2b59",
+ "0x3933baac41f04d0ffa0977b0e879bc56482ad667",
+ "0x3b79eb9675ed29554f57b719dc66a461a4c84970",
+ "0x4f28fc2be45682d1be1d0f155f4a52d4509db629",
+ "0xa78276c04d8d807feb8271fe123c1f94c08a414d",
+ "0xf5ef24a27f35cbe8a2b0a954acf81d7064ce6b70"
+ ] },
}
-const dPoolQuery = `{
- dpools {
- id
- address
- }
-}`
-
const tvlExports = {};
Object.keys(config).forEach(chain => {
- const { dpools, vPools = [], } = config[chain]
+ let { dpools: pools, vPools = [], } = config[chain]
tvlExports[chain] = {
tvl: async (api) => {
const balances = {}
- const logs = await graphQuery(dpools, dPoolQuery)
- let pools = logs.dpools.map(i => i.address)
pools.push(...vPools)
pools = getUniqueAddresses(pools)
const tokens = await api.multiCall({ abi: 'address:stablecoin', calls: pools })
diff --git a/projects/BBQSwap/index.js b/projects/BBQSwap/index.js
new file mode 100644
index 0000000000..7db1599e9a
--- /dev/null
+++ b/projects/BBQSwap/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require('../helper/unknownTokens')
+
+module.exports = uniTvlExport('ham', '0x7304e5751973113fA7c4FFf677871B926258f27e')
diff --git a/projects/DropCopy/index.js b/projects/DropCopy/index.js
index 6e11175d70..6040739597 100644
--- a/projects/DropCopy/index.js
+++ b/projects/DropCopy/index.js
@@ -1,34 +1,10 @@
-const { getOwnerAllAccount, getTokenAccountBalance,getSolBalance } = require('../helper/solana')
-const ADDRESSES = require('../helper/coreAssets.json')
-
-const sdk = require('@defillama/sdk')
-const { PublicKey } = require("@solana/web3.js")
+const { sumTokens2 } = require('../helper/solana')
const DROP = 'DropTpWcDmP7kVRUEoKSJaMVi62hGo9jp19Hz19JVsjh';
-const PYTH = 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3';
const PARIMUTUEL_WALLET = 'DCa1Xir4zDEtz78beFcXCHUNXdeBnrxBiRuuapHrBE3F';
-const PARIMUTUEL_ACCOUNT = 'mD62sAqPAiVbHGPTTeEianTYa1AytkKqqcxMvQxF3S3';
-
-const predictionTokens = [
- DROP,
- PYTH
-]
-async function tvl(api) {
- // get the total tokens deposited in the games
- const tokensInAccount = await getOwnerAllAccount(PARIMUTUEL_WALLET);
- tokensInAccount.forEach((pToken) => {
- const total = pToken.uiAmount;
- const tokenMint = pToken.mint;
- // check to make sure it's one of the tokens used for predicting
- if (predictionTokens.includes(tokenMint))
- {
- //sdk.log('#found',tokenMint)
- api.add(tokenMint,total);
- }
- });
- const sols = await getSolBalance(PARIMUTUEL_WALLET);
- api.add(ADDRESSES.solana.SOL,sols);
+async function tvl() {
+ return sumTokens2({ owner: PARIMUTUEL_WALLET, solOwners: [PARIMUTUEL_WALLET], blacklistedTokens: [DROP]})
}
module.exports = {
diff --git a/projects/E3/index.js b/projects/E3/index.js
index c70c70fe64..96b3aa1e8b 100644
--- a/projects/E3/index.js
+++ b/projects/E3/index.js
@@ -1,37 +1,7 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { joeV2Export } = require('../helper/traderJoeV2')
-const factories = {
+module.exports = joeV2Export({
fantom: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B',
arbitrum: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B',
base: '0x8597dB3ba8dE6BAAdEDa8cBa4dAC653E24a0e57B'
- ///zkevm: tbd
-}
-async function tvl(api) {
- const pools = await api.fetchList({
- target: factories[api.chain],
- itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)',
- lengthAbi: 'uint256:getNumberOfLBPairs',
- })
- const tokenA = await api.multiCall({
- abi: 'address:getTokenX',
- calls: pools,
- })
- const tokenB = await api.multiCall({
- abi: 'address:getTokenY',
- calls: pools,
- })
- const toa = []
- tokenA.map((_, i) => {
- toa.push([tokenA[i], pools[i]])
- toa.push([tokenB[i], pools[i]])
- })
- return sumTokens2({ api, tokensAndOwners: toa, })
-}
-
-module.exports = {
- methodology: 'Only the tokens inside E3 Liquidity Pools are counted in our TVL.',
-}
-
-Object.keys(factories).forEach(chain => {
- module.exports[chain] = { tvl }
-})
+})
\ No newline at end of file
diff --git a/projects/MantraProtocol/index.js b/projects/MantraProtocol/index.js
new file mode 100644
index 0000000000..20836e6984
--- /dev/null
+++ b/projects/MantraProtocol/index.js
@@ -0,0 +1,66 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const sdk = require('@defillama/sdk')
+
+const NATIVE_TOKEN_INTERNAL_ADDRESS = ADDRESSES.null
+
+const MANTRA_CONTRACT_PER_CHAIN = {
+ shibarium: '0xf27B9704a15fFe47818fD48660D952235e9C39aF',
+ dogechain: '0xf27B9704a15fFe47818fD48660D952235e9C39aF',
+ cronos: '0xf27B9704a15fFe47818fD48660D952235e9C39aF',
+ smartbch: '0xA39F586a9F4f68e43F0443A6E966eFe096eb8C88'
+}
+
+async function tvl(api) {
+
+ const MANTRA_CONTRACT = MANTRA_CONTRACT_PER_CHAIN[api.chain]
+
+ // Get all whitelisted tokens (includes native coin as 0x0000000000000000000000000000000000000000)
+ const whitelistedTokens = await api.call({
+ abi: 'function getWhitelistedCurrencies() external view returns (address[] memory currencies)',
+ target: MANTRA_CONTRACT
+ })
+
+
+ // -- BALANCE OF NATIVE COIN
+ const balanceNative = await sdk.api.eth.getBalance({
+ target: MANTRA_CONTRACT,
+ chain: api.chain
+ })
+
+ api.add(NATIVE_TOKEN_INTERNAL_ADDRESS, balanceNative.output)
+
+
+ // -- BALANCE OF OTHER TOKENS (non native)
+
+ // Filter out native coin from whitelistedTokens
+ const nonNativeTokens = whitelistedTokens.filter(t => t != NATIVE_TOKEN_INTERNAL_ADDRESS)
+
+ const balanceCalls = []
+ for (let i = 0; i < nonNativeTokens.length; i++) {
+ balanceCalls.push({
+ abi: 'erc20:balanceOf',
+ target: nonNativeTokens[i],
+ params: [MANTRA_CONTRACT],
+ });
+ }
+
+ const balances = await api.batchCall(balanceCalls)
+
+ api.addTokens(nonNativeTokens, balances)
+}
+
+module.exports = {
+ methodology: 'Counts the balance of each of the whitelisted tokens in the Mantra contract',
+ shibarium: {
+ tvl,
+ },
+ dogechain: {
+ tvl,
+ },
+ cronos: {
+ tvl,
+ },
+ smartbch: {
+ tvl,
+ },
+};
\ No newline at end of file
diff --git a/projects/MorpheusAI/index.js b/projects/MorpheusAI/index.js
index 5df8e26842..9166275130 100644
--- a/projects/MorpheusAI/index.js
+++ b/projects/MorpheusAI/index.js
@@ -16,7 +16,11 @@ module.exports = {
timetravel: true,
misrepresentedTokens: false,
methodology: 'Calculates TVL based on stETH deposits in the project contract.',
+ start: 1707378815, // Feb-08-2024 07:33:35 AM UTC in Unix timestamp
ethereum: {
- tvl,
+ tvl
},
+ hallmarks: [
+ [1712400000, "MOR token launch"], // May-08-2024 12:00:00 AM UTC in Unix timestamp
+ ],
};
diff --git a/projects/SecuredFinance/index.js b/projects/SecuredFinance/index.js
index 927411c5dd..d8b7edaf73 100644
--- a/projects/SecuredFinance/index.js
+++ b/projects/SecuredFinance/index.js
@@ -6,6 +6,7 @@ const config = {
tokenVault: '0x0896AC8B9e2DC3545392ff65061E5a8a3eD68824',
currencyController: '0x9E1254292195F241FA2DF1aA51af23796627A74B',
},
+ filecoin: {}
};
Object.keys(config).forEach(chain => {
diff --git a/projects/Solily/index.js b/projects/Solily/index.js
index d72e86d38b..e5a764f276 100644
--- a/projects/Solily/index.js
+++ b/projects/Solily/index.js
@@ -5,6 +5,7 @@ module.exports = {
[1655251200, "Rug Pull"]
],
timetravel: false,
+ deadFrom: 1655251200,
solana: {
tvl: () => 0,
},
diff --git a/projects/SubstanceX/index.js b/projects/SubstanceX/index.js
index 5ac5fd3fdc..c9df830842 100644
--- a/projects/SubstanceX/index.js
+++ b/projects/SubstanceX/index.js
@@ -8,7 +8,15 @@ const USDT = ADDRESSES.arbitrum.USDT
const USDCe = ADDRESSES.arbitrum.USDC
const DAI = ADDRESSES.optimism.DAI
+// zetaChain
+const USDC_zeta = ADDRESSES.zeta.USDC
+const USDT_zeta = ADDRESSES.zeta.USDT_1
+const dai_zeta = ADDRESSES.zeta.USDC_1
+const usdce_zeta = ADDRESSES.zeta.USDT
+const USDX_zeta = '0x64663c58D42BA8b5Bb79aD924621e5742e2232D8'
+
module.exports = {
arbitrum: { tvl: sumTokensExport({ owner: USDX, tokens: [USDC, USDT, USDCe, DAI], }), },
+ zeta: { tvl: sumTokensExport({ owner: USDX_zeta, tokens: [USDC_zeta, USDT_zeta, dai_zeta, usdce_zeta], }),},
methodology: `The TVL of SubstanceX is equal to the total value of underlying assets locked in the USDX contract.`,
};
diff --git a/projects/a51-finance-v3/index.js b/projects/a51-finance-v3/index.js
index 6d2cfa5633..7d3e171b29 100644
--- a/projects/a51-finance-v3/index.js
+++ b/projects/a51-finance-v3/index.js
@@ -12,17 +12,34 @@ const getStrategyReserves = "function getStrategyReserves(address, int24, int24,
const DEFAULT_STRATEGY_CREATION_TOPIC = "StrategyCreated(bytes32)"
const config = {
+ // uniswap
arbitrum: [{ target: "0x3e0aa2e17fe3e5e319f388c794fdbc3c64ef9da6", helper: "0x9d80597d9403bdb35b3d7d9f400377e790b01053", startBlock: 190945156 },],
+ // uniswap
blast: [{ target: "0x5a8e82c4b3Dbd7579fD198A3276cF75CEA2Df63D", helper: "0xbA13be69628d12963b28de8E7Ba04C3C4c1eaceA", startBlock: 1709947 },],
base: [
+ // uniswap
{ target: "0x3e0AA2e17FE3E5e319f388C794FdBC3c64Ef9da6", helper: "0xA1d8180F4482359CEb7Eb7437FCf4a2616830F81", startBlock: 12765695 },
+ // BaseSwap
{ target: "0xDFb179526ae303Eea49AC99DD360159C39105828", helper: "0x6e7e838E20ED6657Aaf1166f9B7a845565956F51", startBlock: 13890566 },
],
+ // uniswap
optimism: [{ target: "0x525c80e91efe9222de3eae86af69a480fbced416", helper: "0x965356eb2c208ce4130e267342ca720042cce7b2", startBlock: 118360616 },],
- polygon: [{ target: "0xD4798F142FDb87738eF4eBE82Bd56Eccde19A88C", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 55506149 },],
+ polygon: [
+ // uniswap
+ { target: "0xD4798F142FDb87738eF4eBE82Bd56Eccde19A88C", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 55506149 },
+ // quickswap
+ { target: "0xED19D4A923930F6B0348fE06be694FeC56a70b86", helper: "0x6c8b11476475FA487e2bfa6fE00244160F80213e", startBlock: 56237007, },
+ ],
+ // quickswap
+ polygon_zkevm: [{target: "0xBd7887e11A9356957680A34955a135cf465e7052",helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2",startBlock: 11928029,},],
+ // uniswap
bsc: [{ target: "0x6F2b186e9392042B1edE2D1D1706a3DC4a4725d8", helper: "0x9c225a02426e3229C073A6132E083561e95000b5", startBlock: 37623104 },],
+ // uniswap
scroll: [{ target: "0xA8Dc31c8C9F93dB2e42A5472F580689794639576", helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2", startBlock: 4846051 },],
+ // quickswap
manta: [{ target: "0x69317029384c3305fC04670c68a2b434e2D8C44C", helper: "0xa1d8180f4482359ceb7eb7437fcf4a2616830f81", startBlock: 1834975 },],
+ // lynex
+ linea: [{target: "0xA8Dc31c8C9F93dB2e42A5472F580689794639576",helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2",startBlock: 4518443,},],
}
module.exports = {
diff --git a/projects/accumulated-finance/index.js b/projects/accumulated-finance/index.js
index 48eebdbcd4..95eed412e7 100644
--- a/projects/accumulated-finance/index.js
+++ b/projects/accumulated-finance/index.js
@@ -37,24 +37,31 @@ const config = {
}
],
"zeta": [
- {
- "zeta": {
- "baseToken": '0xf091867ec603a6628ed83d274e835539d82e9cc8',
- "LST": '0xcba2aeec821b0b119857a9ab39e09b034249681a'
- }
- },
- {
- "bsc": {
- "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8",
- "LST": "0xcf123d8638266629fb02fc415ad47bd47de01a6b"
+ {
+ "zeta": {
+ "baseToken": '0xf091867ec603a6628ed83d274e835539d82e9cc8',
+ "LST": '0xcba2aeec821b0b119857a9ab39e09b034249681a'
+ }
+ },
+ {
+ "bsc": {
+ "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8",
+ "LST": "0xcf123d8638266629fb02fc415ad47bd47de01a6b"
+ },
},
- },
- {
- "ethereum": {
- "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8",
- "LST": "0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc"
+ {
+ "ethereum": {
+ "baseToken": "0xf091867ec603a6628ed83d274e835539d82e9cc8",
+ "LST": "0xf38feedb0c85c1e1d6864c7513ac646d28bb0cfc"
+ }
+ },
+ ],
+ "sei": [
+ {
+ "sei": {
+ "LST": "0xcba2aeec821b0b119857a9ab39e09b034249681a"
+ },
}
- },
]
}
diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js
index b3ad679c36..8ef3d10fba 100644
--- a/projects/adamantfinance/index.js
+++ b/projects/adamantfinance/index.js
@@ -16,6 +16,19 @@ const vaultsUrl = {
"https://raw.githubusercontent.com/eepdev/vaults/main/arbitrum_vaults.json",
cronos:
"https://raw.githubusercontent.com/eepdev/vaults/main/cronos_vaults.json",
+ fraxtal:
+ "https://raw.githubusercontent.com/eepdev/vaults/main/current_vaults_all_chains.json"
+};
+
+const allVaultsUrl = "https://raw.githubusercontent.com/eepdev/vaults/main/current_vaults_all_chains.json";
+
+const NetworkID = {
+ ETH_MAINNET: 1,
+ POLYGON: 137,
+ ARBITRUM: 42161,
+ CRONOS: 25,
+ FRAXTAL: 252,
+ OPTIMISM: 10
};
/*** Polygon Addresses ***/
@@ -28,6 +41,7 @@ const vaultAddresses_polygon = ["0xF7661EE874Ec599c2B450e0Df5c40CE823FEf9d3"]; /
const lpAddresses_polygon = ["0xa5bf14bb945297447fe96f6cd1b31b40d31175cb"]; //ADDY/WETH
const ADDY = "0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539";
+const adMESH = "0x459dc0fB79653A48469F2C3c375d0A522750Dd40";
/*** Arbitrum Addresses ***/
const stakingContracts_Arbitrum = [
@@ -66,7 +80,7 @@ async function pool2Polygon(api) {
}
async function polygonTvl(timestamp, block, chainBlocks) {
- return await tvl(timestamp, "polygon", chainBlocks, lpAddresses_polygon);
+ return await tvl2(timestamp, "polygon", NetworkID.POLYGON, chainBlocks, lpAddresses_polygon);
}
async function arbitrumTvl(timestamp, block, chainBlocks) {
@@ -74,7 +88,11 @@ async function arbitrumTvl(timestamp, block, chainBlocks) {
}
async function cronosTvl(timestamp, block, chainBlocks) {
- return await tvl(timestamp, "cronos", chainBlocks, lpAddresses_cronos);
+ return await tvl2(timestamp, "cronos", NetworkID.CRONOS, chainBlocks, lpAddresses_cronos);
+}
+
+async function fraxtalTvl(timestamp, block, chainBlocks) {
+ return await tvl2(timestamp, "fraxtal", NetworkID.FRAXTAL, chainBlocks, []); //no Adamant platform token on Fraxtal
}
async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress = (a) => a) {
@@ -98,7 +116,6 @@ async function uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, tra
sdk.util.sumSingleBalance(balances, chain + ':' + v.lpAddress, vault_balances[idx])
}
});
-
await unwrapLPsAuto({ balances, block, chain, });
return balances;
}
@@ -114,7 +131,7 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => {
let uniVaults = resp
.filter(
(vault) =>
- vault.vaultAddress !== '0x459dc0fB79653A48469F2C3c375d0A522750Dd40' &&
+ vault.vaultAddress !== adMESH &&
vault.platform !== "dodo"
)
.map((vault) => ({
@@ -126,6 +143,32 @@ const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => {
return balances;
};
+const tvl2 = async (timestamp, chain, chainId, chainBlocks, lpAddressesIgnored) => {
+
+ const block = chainBlocks[chain];
+ const transformAddress = await getChainTransform(chain)
+ let balances = {};
+
+ let resp = await getConfig('adamant-fi/'+chain, allVaultsUrl);
+
+ let uniVaults = resp
+ .filter(
+ (vault) =>
+ vault.vaultAddress !== adMESH &&
+ vault.vaultAddress !== "0x01d2833e6d86D5Ad8380044DEb2cA520fc60D326" && //adMESH related token/deposit
+ vault.vaultAddress !== "0xbe6aa0AF32984fE3f65a73071DECC09Ab607e310" && //adMESH related token/deposit
+ vault.platform !== "dodo" &&
+ vault.chainId == chainId
+ )
+ .map((vault) => ({
+ vaultAddress: vault.vaultAddress,
+ lpAddress: vault.lpAddress,
+ }));
+
+ balances = await uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress);
+ return balances;
+};
+
module.exports = {
polygon: {
staking: stakings(stakingContracts_polygon, ADDY),
@@ -140,6 +183,9 @@ module.exports = {
staking: stakingUnknown({ owners: stakingContracts_cronos, tokens: [CADDY], chain: 'cronos', lps: lpAddresses_cronos, useDefaultCoreAssets: true }),
tvl: cronosTvl,
},
+ fraxtal: {
+ tvl: fraxtalTvl,
+ },
methodology:
"The current vaults on Adamant Finance are found on the Github. Once we have the vaults, we filter out the LP addresses of each vault and unwrap the LPs so that each token can be accounted for. Coingecko is used to price the tokens and the sum of all tokens is provided as the TVL",
};
diff --git a/projects/aelin/index.js b/projects/aelin/index.js
index ce32d40dc9..9470314fdf 100644
--- a/projects/aelin/index.js
+++ b/projects/aelin/index.js
@@ -10,7 +10,6 @@ const aelin_data = {
{ target: '0x2c0979b0de5f99c2bde1e698aeca13b55695951e', fromBlock: 13996006 },
{ target: '0x5541da82549d732878c4104c9887c408790397af', fromBlock: 13846412 },
],
- 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/aelin',
'AELIN_ETH_LP': '0x974d51fafc9013e42cbbb9465ea03fe097824bcc',
'AELIN_ETH_staking': '0x944cb90082fc1416d4b551a21cfe6d7cc5447c80',
'AELIN': '0xa9c125bf4c8bb26f299c00969532b66732b1f758'
@@ -21,7 +20,6 @@ const aelin_data = {
{ target: '0x87525307974a312AF13a78041F88B0BAe23ebb10', fromBlock: 1487918 },
{ target: '0x914ffc8dc0678911aae77f51b8489d6e214da20f', fromBlock: 1971285 },
],
- 'graphUrl': 'https://api.thegraph.com/subgraphs/name/aelin-xyz/optimism',
'AELIN': '0x61BAADcF22d2565B0F471b291C475db5555e0b76',
'AELIN_staking': '0xfe757a40f3eda520845b339c698b321663986a4d',
'AELIN_ETH_LP': '0x665d8D87ac09Bdbc1222B8B9E72Ddcb82f76B54A',
diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js
index 3d20533405..5b2b9a5fae 100644
--- a/projects/aevo-xyz/index.js
+++ b/projects/aevo-xyz/index.js
@@ -27,7 +27,12 @@ module.exports = {
'0x7711C90bD0a148F3dd3f0e587742dc152c3E9DDB', // Native USDC
'0x90bFB3C35ddfBbA42D998414F0ff1eADD430E161', // WETH
],
- fetchCoValentTokens: true,
+ tokens: [
+ ADDRESSES.arbitrum.USDC,
+ ADDRESSES.arbitrum.USDT,
+ ADDRESSES.arbitrum.WETH,
+ ADDRESSES.arbitrum.USDC_CIRCLE,
+ ]
})
},
optimism: {
diff --git a/projects/affine-defi-liquid/index.js b/projects/affine-defi-liquid/index.js
new file mode 100644
index 0000000000..694da7fc8c
--- /dev/null
+++ b/projects/affine-defi-liquid/index.js
@@ -0,0 +1,14 @@
+const { sumERC4626VaultsExport } = require('../helper/erc4626')
+
+module.exports = {
+ doublecounted: true,
+ ethereum: {
+ tvl: sumERC4626VaultsExport({
+ vaults: [
+ '0x0D53bc2BA508dFdf47084d511F13Bb2eb3f8317B',
+ '0x47657094e3AF11c47d5eF4D3598A1536B394EEc4',
+ ],
+ isOG4626: true,
+ }),
+ },
+}
\ No newline at end of file
diff --git a/projects/agentfi/ca.js b/projects/agentfi/ca.js
new file mode 100644
index 0000000000..4017cfec77
--- /dev/null
+++ b/projects/agentfi/ca.js
@@ -0,0 +1,36 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const tokenAddress = {
+ USDB: ADDRESSES.blast.USDB,
+ WETH: ADDRESSES.blast.WETH,
+ ETH: ADDRESSES.null
+};
+
+const collection = {
+ genesis: "0x5066A1975BE96B777ddDf57b496397efFdDcB4A9",
+ explorer: "0xFB0B3C31eAf58743603e8Ee1e122547EC053Bf18",
+ strategy: "0x73E75E837e4F3884ED474988c304dE8A437aCbEf"
+}
+
+const agentRegistry = "0x12F0A3453F63516815fe41c89fAe84d218Af0FAF"
+const balanceFetcher = "0x3f8Dc480BEAeF711ecE5110926Ea2780a1db85C5"
+
+const uniV2Lp = {
+ thruster: '0x12c69BFA3fb3CbA75a1DEFA6e976B87E233fc7df',
+ blasterswap: '0x3b5d3f610Cc3505f4701E9FB7D0F0C93b7713adD',
+ ring: '0x9BE8a40C9cf00fe33fd84EAeDaA5C4fe3f04CbC3'
+}
+
+const uniV3NftManager = {
+ blasterswap: '0xa761d82F952e9998fE40a6Db84bD234F39122BAD',
+ blasterswap2: '0x1e60C4113C86231Ef4b5B0b1cbf689F1b30e7966',
+ thruster: '0x434575EaEa081b735C985FA9bf63CD7b87e227F9',
+}
+
+module.exports = {
+ tokenAddress,
+ collection,
+ agentRegistry,
+ uniV2Lp,
+ uniV3NftManager,
+ balanceFetcher
+}
diff --git a/projects/agentfi/index.js b/projects/agentfi/index.js
new file mode 100644
index 0000000000..527b2990e3
--- /dev/null
+++ b/projects/agentfi/index.js
@@ -0,0 +1,46 @@
+const { tokenAddress, uniV2Lp, uniV3NftManager } = require('./ca')
+const { getTvlForLooperWithOrbit } = require('./strategies/looper')
+const { getTvlForDexBalancer } = require('./strategies/dex-balancer')
+const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");
+const { getAllAgent } = require("./utils");
+const { getTvlForBladeSwapCLM } = require("./strategies/bladeswap");
+
+
+async function tvl(api) {
+ const allAgents = await getAllAgent(api)
+ const allAgentsAddress = allAgents.map(i => i.agentAddress)
+ const dexBalancerAgents = allAgents.filter(i => i.moduleType === "DexBalancer")
+ const concentratedLiquidityAgents = allAgents.filter(i => i.moduleType === "ConcentratedLiquidity")
+ const bladeSwapConcentratedLiquidityAgentAddresses = allAgents.filter(i => i.moduleType === "BladeSwapLiquidityManager").map(i => i.agentAddress)
+ const looperAgentsAddresses = allAgents.filter(i => i.moduleType === "Looper").map(i => i.agentAddress)
+
+
+ const thrusterv2 = dexBalancerAgents.map(i => [uniV2Lp.thruster, i.agentAddress])
+ const blasterswapv2 = dexBalancerAgents.map(i => [uniV2Lp.blasterswap, i.agentAddress])
+ const ringv2 = dexBalancerAgents.map(i => [uniV2Lp.ring, i.agentAddress])
+
+ const agents = concentratedLiquidityAgents.map(i => i.agentAddress)
+ await sumTokens2({ api, owners: agents, uniV3ExtraConfig: { nftAddress: [uniV3NftManager.blasterswap, uniV3NftManager.blasterswap2, uniV3NftManager.thruster]}})
+
+ await getTvlForDexBalancer(dexBalancerAgents.map(i => i.agentAddress), api)
+ await getTvlForLooperWithOrbit(looperAgentsAddresses, api)
+ await getTvlForBladeSwapCLM(bladeSwapConcentratedLiquidityAgentAddresses, api)
+ await sumTokens2({
+ tokensAndOwners: [
+ ...thrusterv2,
+ ...blasterswapv2,
+ ...ringv2,
+ ],
+ resolveLP: true,
+ api,
+ })
+ await api.sumTokens({ owners: allAgentsAddress, tokens: [tokenAddress.USDB, tokenAddress.WETH, nullAddress], })
+}
+
+module.exports = {
+ methodology: 'The TVL consists of the underlying capital held by all agents(ERC6551 token bound account)',
+ doublecounted: true,
+ blast: {
+ tvl,
+ }
+};
diff --git a/projects/agentfi/strategies/bladeswap.js b/projects/agentfi/strategies/bladeswap.js
new file mode 100644
index 0000000000..704752bafa
--- /dev/null
+++ b/projects/agentfi/strategies/bladeswap.js
@@ -0,0 +1,56 @@
+async function getTvlForBladeSwapCLM(agentAddresses, api) {
+ const calls = agentAddresses.map(agent => ({
+ target: agent, params: []
+ }))
+
+ const safelyGetStateOfAMMPromise = api.multiCall({
+ abi: 'function safelyGetStateOfAMM() view returns (uint160 sqrtPrice, int24 tick, uint16 lastFee, uint8 pluginConfig, uint128 activeLiquidity, int24 nextTick, int24 previousTick)',
+ calls: calls,
+ withMetadata: true,
+ permitFailure: true,
+ })
+ const positionPromise = api.multiCall({
+ abi: 'function position() view returns (uint96 nonce, address operator, address token0, address token1, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)',
+ calls: calls,
+ withMetadata: true,
+ permitFailure: true,
+ })
+ const [positionData, safelyGetStateOfAMMData] = await Promise.all([positionPromise, safelyGetStateOfAMMPromise])
+ agentAddresses.forEach((address) => {
+ const positionResult = positionData.find(b => b.input.target === address)
+ const safelyGetStateOfAMMResult = safelyGetStateOfAMMData.find(b => b.input.target === address)
+ if (safelyGetStateOfAMMResult.success && positionResult.success) {
+ const position = positionResult.output
+ const safelyGetStateOfAMM = safelyGetStateOfAMMResult.output
+ const tickToPrice = (tick) => 1.0001 ** tick
+ const token0 = position.token0
+ const token1 = position.token1
+ const liquidity = position.liquidity
+ const bottomTick = +position.tickLower
+ const topTick = +position.tickUpper
+ const tick = safelyGetStateOfAMM.tick
+ const sa = tickToPrice(bottomTick / 2)
+ const sb = tickToPrice(topTick / 2)
+ let amount0 = 0
+ let amount1 = 0
+ if (tick < bottomTick) {
+ amount0 = liquidity * (sb - sa) / (sa * sb)
+ } else if (tick < topTick) {
+ const price = tickToPrice(tick)
+ const sp = price ** 0.5
+
+ amount0 = liquidity * (sb - sp) / (sp * sb)
+ amount1 = liquidity * (sp - sa)
+ } else {
+ amount1 = liquidity * (sb - sa)
+ }
+
+ api.add(token0, amount0)
+ api.add(token1, amount1)
+ }
+ })
+}
+
+module.exports = {
+ getTvlForBladeSwapCLM
+}
diff --git a/projects/agentfi/strategies/dex-balancer.js b/projects/agentfi/strategies/dex-balancer.js
new file mode 100644
index 0000000000..db3b650f4b
--- /dev/null
+++ b/projects/agentfi/strategies/dex-balancer.js
@@ -0,0 +1,83 @@
+const ADDRESSES = require('../../helper/coreAssets.json')
+const { balanceFetcher, uniV2Lp, tokenAddress } = require('../ca')
+const BigNumber = require("bignumber.js");
+
+
+// underlying token mapping
+const RingTokenMappings = {
+ // fwUSDB -> USDB
+ [ADDRESSES.blast.fwUSDB]: tokenAddress.USDB,
+ // fwWETH -> WETH
+ [ADDRESSES.blast.fwWETH]: tokenAddress.WETH,
+};
+
+async function getTvlForDexBalancer(agentAddresses, api) {
+ // fetch pool info from balanceFetcher utility function
+ const ringPoolPromise = api.call({
+ abi: 'function fetchPoolInfoV2(address poolAddress) public view returns (uint256 total, address address0, address address1, uint112 reserve0, uint112 reserve1)',
+ target: balanceFetcher,
+ params: [uniV2Lp.ring],
+ })
+ const thrusterPoolPromise = api.call({
+ abi: 'function fetchPoolInfoV2(address poolAddress) public view returns (uint256 total, address address0, address address1, uint112 reserve0, uint112 reserve1)',
+ target: balanceFetcher,
+ params: [uniV2Lp.thruster],
+ })
+
+ const ringlpBalancePromise = api.multiCall({
+ abi: 'function balanceOf(uint256 index, address account) returns (uint256)',
+ calls: agentAddresses.map(agent => ({
+ target: "0xEff87A51f5Abd015F1AFCD5737BBab450eA15A24", // ring staking contract
+ params: [3, agent],
+ })),
+ withMetadata: true,
+ permitFailure: true,
+ })
+
+ const hyperlocklpBalancePromise = api.multiCall({
+ abi: 'function staked(address account, address token) returns (uint256)',
+ calls: agentAddresses.map(agent => ({
+ target: "0xC3EcaDB7a5faB07c72af6BcFbD588b7818c4a40e", // hyperlock staking contract
+ params: [agent, "0x12c69BFA3fb3CbA75a1DEFA6e976B87E233fc7df"],
+ })),
+ withMetadata: true,
+ permitFailure: true,
+ })
+
+ const [ringPoolData, thrusterPoolData, ringlpBalances, hyperlocklpBalances] = await Promise.all([ringPoolPromise, thrusterPoolPromise, ringlpBalancePromise, hyperlocklpBalancePromise])
+
+ agentAddresses.forEach((address) => {
+ const ringlpBalance = ringlpBalances.find(b => b.input.params[1] === address)
+ if (ringlpBalance.success) {
+ const lpBalance = ringlpBalance.output
+ const [total, address0, address1, reserve0, reserve1] = ringPoolData;
+ const lpBalanceBigN = BigNumber(lpBalance)
+ const totalBigN = BigNumber(total)
+ const reserve0BigN = BigNumber(reserve0)
+ const reserve1BigN = BigNumber(reserve1)
+ const token0Balance = lpBalanceBigN.times(reserve0BigN).div(totalBigN)
+ const token1Balance = lpBalanceBigN.times(reserve1BigN).div(totalBigN)
+ api.add(RingTokenMappings[address0.toLowerCase()], token0Balance.toFixed(0))
+ api.add(RingTokenMappings[address1.toLowerCase()], token1Balance.toFixed(0))
+ }
+ const hyperlocklpBalance = hyperlocklpBalances.find(b => b.input.params[0] === address)
+ if (hyperlocklpBalance.success) {
+ const lpBalance = hyperlocklpBalance.output
+ const [total, address0, address1, reserve0, reserve1] = thrusterPoolData;
+ const lpBalanceBigN = BigNumber(lpBalance)
+ const totalBigN = BigNumber(total)
+ const reserve0BigN = BigNumber(reserve0)
+ const reserve1BigN = BigNumber(reserve1)
+ const token0Balance = lpBalanceBigN.times(reserve0BigN).div(totalBigN)
+ const token1Balance = lpBalanceBigN.times(reserve1BigN).div(totalBigN)
+ api.add(address0, token0Balance.toFixed(0))
+ api.add(address1, token1Balance.toFixed(0))
+ }
+ })
+
+
+}
+
+module.exports = {
+ getTvlForDexBalancer
+}
diff --git a/projects/agentfi/strategies/looper.js b/projects/agentfi/strategies/looper.js
new file mode 100644
index 0000000000..1461966b20
--- /dev/null
+++ b/projects/agentfi/strategies/looper.js
@@ -0,0 +1,45 @@
+const BigNumber = require("bignumber.js");
+const { nullAddress } = require("../../helper/unwrapLPs");
+
+async function getTvlForLooperWithOrbit(agentAddresses, api) {
+ const calls = agentAddresses.map(agent => ({
+ target: agent, params: []
+ }))
+
+ const borrowBalancePromise = api.multiCall({
+ abi: 'function borrowBalance() view returns (uint256)',
+ calls: calls,
+ withMetadata: true,
+ permitFailure: true,
+ })
+ const supplyBalancePromise = api.multiCall({
+ abi: 'function supplyBalance() view returns (uint256)',
+ calls: calls,
+ withMetadata: true,
+ permitFailure: true,
+ })
+ const underlyingPromise = api.multiCall({
+ abi: 'function underlying() view returns (address)',
+ calls: calls,
+ withMetadata: true,
+ permitFailure: true,
+ })
+ const [borrowBalance, supplyBalance, underlying] = await Promise.all([borrowBalancePromise, supplyBalancePromise, underlyingPromise])
+ agentAddresses.forEach((address) => {
+ const borrowBalanceResult = borrowBalance.find(b => b.input.target === address)
+ const supplyBalanceResult = supplyBalance.find(b => b.input.target === address)
+ const underlyingResult = underlying.find(b => b.input.target === address)
+ if (borrowBalanceResult.success && supplyBalanceResult.success && underlyingResult.success) {
+ const borrowBalance = borrowBalanceResult.output
+ const supplyBalance = supplyBalanceResult.output
+ const underlying = underlyingResult.output
+ const isEth = underlying === "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"
+ const tokenToAdd = isEth ? nullAddress : underlying
+ api.add(tokenToAdd, BigNumber(supplyBalance).minus(borrowBalance))
+ }
+ })
+}
+
+module.exports = {
+ getTvlForLooperWithOrbit
+}
diff --git a/projects/agentfi/utils.js b/projects/agentfi/utils.js
new file mode 100644
index 0000000000..d9e24955e3
--- /dev/null
+++ b/projects/agentfi/utils.js
@@ -0,0 +1,110 @@
+const { collection, agentRegistry } = require("./ca");
+
+async function getAllAgent(api) {
+ const [genesisTotalSupply, explorerTotalSupply, strategyTotalSupply] = await api.multiCall({
+ abi: 'uint256:totalSupply', calls: [collection.genesis, collection.explorer, collection.strategy]
+ })
+ const genesisCalls = Array.from({ length: genesisTotalSupply }, (_, i) => i).map(i => ({
+ target: agentRegistry, params: [collection.genesis, i + 1]
+ }))
+ const explorerCalls = Array.from({ length: explorerTotalSupply }, (_, i) => i).map(i => ({
+ target: agentRegistry, params: [collection.explorer, i + 1]
+ }))
+ const strategyCalls = Array.from({ length: strategyTotalSupply }, (_, i) => i).map(i => ({
+ target: agentRegistry, params: [collection.strategy, i + 1]
+ }))
+
+
+ const rootAgentAddressPromise = api.multiCall({
+ permitFailure: true,
+ abi: "function getTbasOfNft(address collection, uint256 agentID) view returns (tuple(address agentAddress, address implementationAddress)[] tbas)",
+ calls: [...genesisCalls, ...explorerCalls],
+ requery: true,
+ })
+ const strategyAgentAddressPromise = api.multiCall({
+ permitFailure: true,
+ abi: "function getTbasOfNft(address collection, uint256 agentID) view returns (tuple(address agentAddress, address implementationAddress)[] tbas)",
+ calls: strategyCalls,
+ requery: true,
+ })
+
+ const [rootAgentAddresses, strategyAgentAddresses] = await Promise.all([rootAgentAddressPromise, strategyAgentAddressPromise])
+
+ const moduleCall = strategyAgentAddresses.map(i => i[0].agentAddress).map(i => ({
+ target: i, params: ['0x82ccd330']
+ }))
+ const moduleCall2 = strategyAgentAddresses.map(i => i[0].agentAddress).map(i => ({
+ target: i, params: ['0x7bb485dc']
+ }))
+ const modulePromise = api.multiCall({
+ permitFailure: true,
+ abi: "function overrides(bytes4) view returns (address implementation, bool isProtected)",
+ calls: moduleCall,
+ withMetadata: true,
+ requery: true,
+ })
+ const module2Promise = api.multiCall({
+ permitFailure: true,
+ abi: "function overrides(bytes4) view returns (address implementation, bool isProtected)",
+ calls: moduleCall2,
+ withMetadata: true,
+ requery: true,
+ })
+ const moduleResult = await Promise.all([modulePromise, module2Promise])
+ const allAgentAddress = [...rootAgentAddresses, ...strategyAgentAddresses].map(i => ({
+ agentAddress: i[0].agentAddress,
+ implementationAddress: i[0].implementationAddress,
+ }))
+
+ const addressWithModuleType = allAgentAddress.map((i) => {
+ const agentAddress = i.agentAddress
+ const modules = moduleResult.flat().filter(x => x.success).filter(j => j.input.target === agentAddress).map(j => j.output[0])
+ const DexBalancerModules = ["0x7e8280f5Ee5137f89d09FA61B356fa322a93415a", "0x35a4B9B95bc1D93Bf8e3CA9c030fc15726b83E6F", "0x067299A9C3F7E8d4A9d9dD06E2C1Fe3240144389"]
+ const MultioliooorModule = ["0x54D588243976F7fA4eaf68d77122Da4e6C811167"]
+ const ConcentratedLiquidityModule = ["0x10C02a975a748Db5B749Dc420154dD945e2e8657", "0x41D68d86545D6b931c1232f1E0aBB5844Ada4967", "0xa11D4dcD5a9ad75c609E1786cf1FD88b53C83A5E"]
+ const BladeSwapConcentratedLiquidityModule = [
+ "0x5dBC01F3F1310E36454C43cA1d2c84F44b8094F2",
+ "0xa28299bfbf44450CbA73a1eAdcE461AF62181a02",
+ "0xD18eD95286316a359291b21d02e8d46C59986302",
+ ]
+ const pacLooperModule = '0x5E38765FF50D9b8932441Cd668c1fDA365D358b5'
+ const Looper = ["0x6A9D21A09A76808C444a89fE5fCc0a5f38dc0523", "0xe5fe6f280CEadc5c4DDE69eF2DF6234dd7Bd82E2", "0x8220512520db5D3295EA41308601FD0974405975", pacLooperModule]
+ if (modules.some(i => DexBalancerModules.includes(i))) {
+ return {
+ ...i,
+ moduleType: "DexBalancer"
+ }
+ } else if (modules.some(i => MultioliooorModule.includes(i))) {
+ return {
+ ...i,
+ moduleType: "Multipliooor"
+ }
+ } else if (modules.some(i => ConcentratedLiquidityModule.includes(i))) {
+ return {
+ ...i,
+ moduleType: "ConcentratedLiquidity"
+ }
+ } else if (modules.some(i => BladeSwapConcentratedLiquidityModule.includes(i))) {
+ return {
+ ...i,
+ moduleType: "BladeSwapLiquidityManager"
+ }
+ } else if (modules.some(i => Looper.includes(i))) {
+ return {
+ ...i,
+ moduleType: "Looper"
+ }
+ } else {
+ return {
+ ...i,
+ moduleType: "Unknown"
+ }
+ }
+ })
+
+ return addressWithModuleType
+}
+
+module.exports = {
+ getAllAgent
+}
diff --git a/projects/ainnswap/index.js b/projects/ainnswap/index.js
new file mode 100644
index 0000000000..4efe43244e
--- /dev/null
+++ b/projects/ainnswap/index.js
@@ -0,0 +1,10 @@
+const { iziswapExport } = require('../helper/iziswap')
+
+const poolHelpers = {
+ 'ailayer': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'],
+} // iziswap liquidityManager contracts
+
+
+Object.keys(poolHelpers).forEach(chain => {
+ module.exports[chain] = { tvl: iziswapExport({ poolHelpers: poolHelpers[chain], }), }
+})
\ No newline at end of file
diff --git a/projects/airdao-bridge/index.js b/projects/airdao-bridge/index.js
new file mode 100644
index 0000000000..1b956ea39f
--- /dev/null
+++ b/projects/airdao-bridge/index.js
@@ -0,0 +1,24 @@
+const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs");
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const CHAINS = {
+ ethereum: {
+ locker: "0x0De2669e8A7A6F6CC0cBD3Cf2D1EEaD89e243208",
+ tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH]
+ },
+ bsc: {
+ locker: "0x92fa52d3043725D00Eab422440C4e9ef3ba180d3",
+ tokens: [ADDRESSES.bsc.USDC, ADDRESSES.bsc.USDT, ADDRESSES.bsc.WBNB, ADDRESSES.bsc.BUSD]
+ },
+}
+
+module.exports = {
+ methodology:
+ "Adds up the total value locked as collateral on the Bridge platform"
+}
+
+Object.keys(CHAINS).forEach(chain => {
+ module.exports[chain] = {
+ tvl: sumTokensExport({ owner: CHAINS[chain].locker, tokens: CHAINS[chain].tokens })
+ }
+})
diff --git a/projects/airdao-hera-pool/index.js b/projects/airdao-hera-pool/index.js
new file mode 100644
index 0000000000..d14949b826
--- /dev/null
+++ b/projects/airdao-hera-pool/index.js
@@ -0,0 +1,11 @@
+async function tvl(api) {
+ const totalStake = await api.call({abi: 'uint256:totalStake', target: '0x0E051C8C1cd519d918DB9b631Af303aeC85266BF'})
+ api.addCGToken('amber', totalStake/1e18)
+}
+
+module.exports = {
+ methodology: `TVL counts deposits made to Hera pool on AirDAO.`,
+ airdao: {
+ tvl
+ }
+}
diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js
index ab58f104ba..f2189acf57 100644
--- a/projects/airpuff/index.js
+++ b/projects/airpuff/index.js
@@ -1,6 +1,7 @@
const { staking } = require("../helper/staking");
const ADDRESSES = require("../helper/coreAssets.json");
const contractAbis = {
+ getDeposits: "function getDeposits(address) view returns (address[], address[], uint256[], uint256[])",
readOraclePrice: "function read() view returns (int224 value, uint32 timestamp)",
balanceOf: "function balanceOf(address) external view returns (uint256)",
getPrice: "function answer() external view returns (uint256)",
@@ -12,11 +13,73 @@ const contractAbis = {
getUnderlyingPrice: "function getUnderlyingPrice(address cToken) view returns (uint256)",
getUniswapPrice:
"function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 observationCardinalityNext, uint8 observationCardinalityNext)",
+ getMantleBalance: "function balances(address) view returns (uint256)",
};
module.exports = {
misrepresentedTokens: true,
+ mantle: {
+ tvl: async (api) => {
+ const mantle = {
+ vault: "0xf9B484901BCA34A8615c90E8C4933f1Bd553B639",
+ lending: "0x08ccF72358B44D9d45438Fc703962A0a2FD5c978",
+ staking: "0x9f39dC8eA0a73ab462d23104699AFAE9c30d1E4f",
+ };
+
+ const stakedBalance = await api.call({
+ abi: contractAbis.getMantleBalance,
+ target: mantle.staking,
+ params: [mantle.vault],
+ });
+
+ api.add(ADDRESSES.mantle.WMNT, stakedBalance);
+
+ await api.sumTokens({
+ tokensAndOwners: [[ADDRESSES.mantle.WMNT, mantle.lending]],
+ });
+ },
+ },
+
+ karak: {
+ tvl: async (api) => {
+ const KUSDC = {
+ vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741",
+ token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D",
+ };
+
+ const KWETH = {
+ vault: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db",
+ token: "0x4200000000000000000000000000000000000006",
+ };
+
+ const wethLending = {
+ vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb",
+ token: "0x4200000000000000000000000000000000000006",
+ };
+
+ const usdcLending = {
+ vault: "0x475820E4bCE0E3d233Ad7f6A8c9DD1f66974c5d6",
+ token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D",
+ };
+
+ const KarakUSDCBal = await api.call({ target: KUSDC.vault, abi: contractAbis.getTotalSupply });
+
+ const KarakWETHbal = await api.call({ target: KWETH.vault, abi: contractAbis.getTotalSupply });
+
+ const strategies = [wethLending, usdcLending];
+
+ const tokensAndOwners = [];
+
+ strategies.forEach(({ vault, token }) => tokensAndOwners.push([token, vault]));
+
+ await api.sumTokens({ tokensAndOwners });
+
+ api.add(KUSDC.token, KarakUSDCBal);
+ api.add(KWETH.token, KarakWETHbal);
+ },
+ },
+
zklink: {
tvl: async (api) => {
const pufEth1x = {
diff --git a/projects/akronswap/index.js b/projects/akronswap/index.js
new file mode 100644
index 0000000000..fea9a6e6af
--- /dev/null
+++ b/projects/akronswap/index.js
@@ -0,0 +1,17 @@
+const { getUniTVL } = require('../helper/unknownTokens');
+
+module.exports = {
+ misrepresentedTokens: true,
+ ethereum:{
+ tvl: getUniTVL({ factory: '0x6624Ac5F9abFA36174511607860e81C8dB9e84E9', useDefaultCoreAssets: true, fetchBalances: true, }),
+ },
+ arbitrum:{
+ tvl: getUniTVL({ factory: '0x40Cbdf84475f8Dd7C9a9c665eDE551EeaaF21F8d', useDefaultCoreAssets: true, fetchBalances: true, }),
+ },
+ base:{
+ tvl: getUniTVL({ factory: '0xD2156Bb9ed200FE88705443BfFcA788BA8b205f6', useDefaultCoreAssets: true, fetchBalances: true, }),
+ },
+ bsc:{
+ tvl: getUniTVL({ factory: '0x40Cbdf84475f8Dd7C9a9c665eDE551EeaaF21F8d', useDefaultCoreAssets: true, fetchBalances: true, }),
+ },
+}
\ No newline at end of file
diff --git a/projects/aktionariat/index.js b/projects/aktionariat/index.js
index 38c548467a..44ba41bf2c 100644
--- a/projects/aktionariat/index.js
+++ b/projects/aktionariat/index.js
@@ -1,18 +1,16 @@
-const { request, gql } = require('graphql-request');
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const sdk = require("@defillama/sdk");
+const { cachedGraphQuery } = require('../helper/cache')
const graphs = {
- ethereum: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot",
- optimism: "https://api.thegraph.com/subgraphs/name/aktionariat/brokerbot-optimism",
+ ethereum: sdk.graph.modifyEndpoint('2ZoJCp4S7YP7gbYN2ndsYNjPeZBV1PMti7BBoPRRscNq'),
+ optimism: sdk.graph.modifyEndpoint('3QfEXbPfP23o3AUzcmjTfRtUUd4bfrFj3cJ4jET57CTX'),
+ polygon: sdk.graph.modifyEndpoint('7camBLZckE5TLKha372tqawpDs8Lkez6yYiri7PykRak'),
}
function tvlPaged(chain) {
return async (api) => {
- const block = await api.getBlock()
const size = 1000
- let lastId = ''
- let brokerbots
- let graphQueryPaged = gql`
+ let graphQueryPaged = `
query brokerbotQuery($lastId: String, $block: Int) {
brokerbots(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: 100}) {
id
@@ -21,14 +19,9 @@ function tvlPaged(chain) {
}
}
`
-
- do {
- const res = await request(graphs[chain], graphQueryPaged, { lastId, block: block - 5000 });
- brokerbots = res.brokerbots
- const tokensAndOwners = brokerbots.map(i => ([[i.token.id, i.id], [i.base.id, i.id]])).flat()
- await sumTokens2({ tokensAndOwners, api })
- lastId = brokerbots[brokerbots.length - 1]?.id
- } while (brokerbots.length === size)
+ const data = await cachedGraphQuery('aktionariat-brokerbot/' + chain, graphs[chain], graphQueryPaged, { useBlock: true, api, fetchById: true, })
+ const ownerTokens = data.map(i => [[i.token.id, i.base.id], i.id])
+ return api.sumTokens({ ownerTokens })
}
}
@@ -37,7 +30,7 @@ module.exports = {
timetravel: false,
hallmarks: []
}
-const chains = ['ethereum', 'optimism']
+const chains = ['ethereum', 'optimism', 'polygon']
chains.forEach(chain => {
module.exports[chain] = {
diff --git a/projects/alchemix/contracts.json b/projects/alchemix/contracts.json
index 320372f36e..e5b7eb6cab 100644
--- a/projects/alchemix/contracts.json
+++ b/projects/alchemix/contracts.json
@@ -1,4 +1,42 @@
{
+ "arbitrum": {
+ "tokenHolders": {
+ "alUSDAlchemist": "0xb46eE2E4165F629b4aBCE04B7Eb4237f951AC66F",
+ "alUSDTransmuterBuffer": "0x00E33722ba54545667E76a18CE9D544130eEAbcC",
+ "alUSDTransmuter": "0xe7ec71B894583E9C1b07873fA86A7e81f3940eA8",
+ "alETHAlchemist": "0x654e16a0b161b150F5d1C8a5ba6E7A7B7760703A",
+ "alETHTransmuterBuffer": "0xECAd08EE07f1AA87f3E080997eBa6d02d28bb9D2",
+ "alETHTransmuter": "0x1EB7D78d7f6D73e5de67Fa62Fd8b55c54Aa9c0D4"
+ },
+ "underlyingTokens": {
+ "USDC": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
+ "WETH": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",
+ "wstETH": "0x5979D7b546E38E414F7E9822514be443A4800529"
+ },
+ "yvTokens": {
+ "aUSDC": "0x248a431116c6f6FCD5Fe1097d16d0597E24100f5"
+ },
+ "cvxLPpools": {
+ "crAMM-FRAX-alUSD": {
+ "poolAddress": "0x43fbf34df6da5fC66E15E023D3b690Fd0dE33cD7",
+ "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043",
+ "tokenAddress": "0xfd599DB360Cd9713657C95dF66650A427d213010",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "crAMM-GRAI-alUSD": {
+ "poolAddress": "0x72B6594a0c8D9eE9725ce780f87F9E00615D4b10",
+ "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043",
+ "tokenAddress": "0x510a496b2443ba52A3B269Fee5A241a4ED4cCA58",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "crAMM-alETH-frxETH": {
+ "poolAddress": "0xC3f26d2Fa16129a8d4A5A0f94D25F2cdd9005CDb",
+ "holder": "0x7e108711771DfdB10743F016D46d75A9379cA043",
+ "tokenAddress": "0xfB4fE921F724f3C7B610a826c827F9F6eCEf6886",
+ "alToken": "0x17573150d67d820542EFb24210371545a4868B03"
+ }
+ }
+ },
"fantom": {
"tokenHolders": {
"alUSDAlchemist": "0x76b2E3c5a183970AAAD2A48cF6Ae79E3e16D3A0E",
@@ -26,13 +64,73 @@
"DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",
"USDC": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607",
"USDT": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
- "WETH": "0x4200000000000000000000000000000000000006"
+ "WETH": "0x4200000000000000000000000000000000000006",
+ "wstETH": "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb"
},
"yvTokens": {
"aDAI": "0x43A502D7e947c8A2eBBaf7627E104Ddcc253aBc6",
"aUSDC": "0x4186Eb285b1efdf372AC5896a08C346c7E373cC4",
"aUSDT": "0x2680b58945A31602E4B6122C965c2849Eb76Dd3B",
- "aWETH": "0x337B4B933d60F40CB57DD19AE834Af103F049810"
+ "aWETH": "0x337B4B933d60F40CB57DD19AE834Af103F049810",
+ "ysUSDC": "0x059Eaa296B18E0d954632c8242dDb4a271175EeD",
+ "ysDAI": "0x0A86aDbF58424EE2e304b395aF0697E850730eCD",
+ "ysWETH": "0xE62DDa84e579e6A37296bCFC74c97349D2C59ce3"
+ },
+ "cvxLPpools": {
+ "aAMM-USDC-alUSD": {
+ "poolAddress": "0xE8b219c285e4e4ec28ac80Fdc4b9739b18cB8890",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0x124D69DaeDA338b1b31fFC8e429e39c9A991164e",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "sAMM-DOLA-alUSD": {
+ "poolAddress": "0x13bAeC9C12544066a7918efc3D8b626dBbFE1615",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0x67C253eB6C2e69F9E1114aEeAD0DB4FA8F417AC3",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "sAMM-FRAX-alUSD": {
+ "poolAddress": "0xA8E0754dd8Ef3700Ac8478Fdb8d4B8473de3817C",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0xaF03f51DE7a0E62BF061F6Fc3931cF79166B0a29",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "sAMM-alUSD-MAI": {
+ "poolAddress": "0xA688080CA069231C6D5713CD009662Ea54437A02",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0xfA09479d72E2b3f8B6dF63399772237Ad6658D76",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "vAMM-OP-alUSD": {
+ "poolAddress": "0x6101236Fd0E04427952799323D89B99BE0eab52f",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0x60BE3FB22DDF30C17604b86eC005F6173B1170Aa",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "sAMMM-USDC.e-alUSD": {
+ "poolAddress": "0x4d7959d17B9710BE87e3657e69d946914221BB88",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0x4d7959d17B9710BE87e3657e69d946914221BB88",
+ "alToken": "0xCB8FA9a76b8e203D8C3797bF438d8FB81Ea3326A"
+ },
+ "sAMM-alETH-WETH": {
+ "poolAddress": "0xc16adBf2d01d6524B79CbB610cE31d5db80eee3C",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0xa1055762336F92b4B8d2eDC032A0Ce45ead6280a",
+ "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04"
+ },
+ "sAMM-alETH-frxETH": {
+ "poolAddress": "0xFc0B9A9C2b63E6ACACa91A77A80bfa83C615e6C5",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0x1AD06Ca54de04DBe9e2817F4C13eCB406DCbeAf0",
+ "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04"
+ },
+ "vAMM-alETH-OP": {
+ "poolAddress": "0xB715D27CCe97e869Cff840072ce1Eab1d982791E",
+ "holder": "0xb29617209961DB995dD30a4AB94BA0034A4284f9",
+ "tokenAddress": "0xA5EDb0EF932f7c2f37B8FC75CB01948F6258a4f8",
+ "alToken": "0x3E29D3A9316dAB217754d13b28646B76607c5f04"
+ }
}
},
"ethereum": {
@@ -57,13 +155,24 @@
"USDT": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"wstETH": "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",
"rETH": "0xae78736Cd615f374D3085123A210448E74Fc6393",
- "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
+ "WETH": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
+ "FRAX": "0x853d955aCEf822Db058eb8505911ED77F175b99e",
+ "sfrxETH": "0xac3E018457B222d93114458476f3E3416Abbe38F"
},
"yvTokens": {
"yvDAI": "0xda816459f1ab5631232fe5e97a05bbbb94970c95",
"yvUSDC": "0xa354f35829ae975e850e23e9615b11da1b3dc4de",
"yvUSDT": "0x7da96a3891add058ada2e826306d812c638d87a7",
- "yvWETH": "0xa258c4606ca8206d8aa700ce2143d7db854d168c"
+ "yvWETH": "0xa258c4606ca8206d8aa700ce2143d7db854d168c",
+ "aDAI": "0xcE4a49d7ed99C7c8746B713EE2f0C9aA631688d8",
+ "aUSDC": "0xf591D878608e2e5c7D4f1E499330f4AB9BbaE37a",
+ "aUSDT": "0xBC11De1F20e83F0a6889B8c7A7868E722694E315",
+ "vaUSDC": "0xa8b607Aa09B6A2E306F93e74c282Fb13f6A80452",
+ "vaDAI": "0x0538C8bAc84E95A9dF8aC10Aad17DbE81b9E36ee",
+ "vaFRAX": "0xc14900dFB1Aa54e7674e1eCf9ce02b3b35157ba5",
+ "aFRAX": "0x318334A6dD21d16A8442aB0b7204E81Aa3FB416E",
+ "aWETH": "0x61134511187a9a2DF38D10DBe07Ba2e8E5563967",
+ "vaETH": "0xd1C117319B3595fbc39b471AB1fd485629eb05F2"
},
"staking": {
"token": "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF",
@@ -73,7 +182,7 @@
"cvxLPpools": {
"alUSD+FRAXBP": {
"poolAddress": "0x26598e3E511ADFadefD70ab2C3475Ff741741104",
- "holder": "0xBE1C919cA137299715e9c929BC7126Af14f76091",
+ "holder": "0x06378717d86B8cd2DBa58c87383dA1EDA92d3495",
"tokenAddress": "0xb30da2376f63de30b42dc055c93fa474f31330a5",
"alToken": "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9"
},
diff --git a/projects/alchemix/index.js b/projects/alchemix/index.js
index 53b41fc787..2a2e6c492e 100644
--- a/projects/alchemix/index.js
+++ b/projects/alchemix/index.js
@@ -2,45 +2,41 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
const { staking } = require("../helper/staking.js");
const contracts = require("./contracts");
-function tvl(chain) {
- return async (api) => {
- const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens))
- await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) })
- if (api.chain !== 'ethereum') return api.getBalances()
+async function tvl(api) {
+ const chain = api.chain
+ const tokens = Object.values(contracts[chain].underlyingTokens).concat(Object.values(contracts[chain].yvTokens ?? []))
+ await sumTokens2({ tokens, api, owners: Object.values(contracts[chain].tokenHolders) })
+ if (api.chain !== 'ethereum') return api.getBalances()
- await Promise.all(
- Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => {
- const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, })
- const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", })
- // console.log({poolAddress, holder, tokenAddress, alToken, lpTokenBalance, supply, ratio: lpTokenBalance / supply})
- if (+supply === 0) return;
- const ratio = lpTokenBalance / supply
- const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] })
- const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] })
- alToken = alToken.toLowerCase()
- tokens.forEach((token, i) => {
- if (token.toLowerCase() !== alToken) {
- if (!isNaN(tokenBalances[i] * ratio))api.add(token, tokenBalances[i] * ratio)
- }
- })
+ await Promise.all(
+ Object.values(contracts.cvxLPpools).map(async ({ poolAddress, holder, tokenAddress, alToken }) => {
+ const lpTokenBalance = await api.call({ target: poolAddress, abi: "erc20:balanceOf", params: holder, })
+ const supply = await api.call({ target: tokenAddress, abi: "erc20:totalSupply", })
+ // console.log({poolAddress, holder, tokenAddress, alToken, lpTokenBalance, supply, ratio: lpTokenBalance / supply})
+ if (+supply === 0) return;
+ const ratio = lpTokenBalance / supply
+ const tokenBalances = await api.multiCall({ target: tokenAddress, abi: 'function balances(uint256) view returns (uint256)', calls: [0, 1] })
+ const tokens = await api.multiCall({ target: tokenAddress, abi: 'function coins(uint256) view returns (address)', calls: [0, 1] })
+ alToken = alToken.toLowerCase()
+ tokens.forEach((token, i) => {
+ if (token.toLowerCase() !== alToken) {
+ if (!isNaN(tokenBalances[i] * ratio)) api.add(token, tokenBalances[i] * ratio)
+ }
})
- );
- };
+ })
+ )
}
module.exports = {
doublecounted: true,
ethereum: {
- tvl: tvl("ethereum"),
+ tvl,
staking: staking(
contracts.ethereum.staking.holder,
contracts.ethereum.staking.token
),
},
- fantom: {
- tvl: tvl("fantom"),
- },
- optimism: {
- tvl: tvl("optimism"),
- },
-};
+ fantom: { tvl, },
+ optimism: { tvl, },
+ arbitrum: { tvl },
+}
diff --git a/projects/alexar/index.js b/projects/alexar/index.js
index d58c0311cd..f35001a02d 100644
--- a/projects/alexar/index.js
+++ b/projects/alexar/index.js
@@ -11,13 +11,13 @@ const chainMapping = {
};
const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2'];
-const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum',];
+const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum', 'base'];
chainListSupply.concat(chainListTotal).forEach(chain => {
module.exports[chain] = { tvl };
async function tvl(api) {
- const config = await getConfig('alexar', 'https://api.axelarscan.io/cross-chain/tvl')
+ const config = await getConfig('alexar', 'https://api.axelarscan.io/api/getTVL')
const tokensAndOwners = []
const owners = []
const mappedChain = chainMapping[chain] || chain;
@@ -25,9 +25,12 @@ chainListSupply.concat(chainListTotal).forEach(chain => {
if (!assetTvl) return;
const isEVM = assetTvl.gateway_address?.startsWith('0x')
+ const data = assetTvl.contract_data
if (isEVM) {
- if (assetTvl.contract_data.symbol.startsWith('axl')) return;
- tokensAndOwners.push([assetTvl.contract_data.address, assetTvl.gateway_address])
+ if (data.symbol.startsWith('axl')) return;
+ tokensAndOwners.push([data.address, assetTvl.gateway_address])
+ if (data.token_manager_address)
+ tokensAndOwners.push([data.address, data.token_manager_address])
} else {
if (assetTvl.denom_data.symbol.startsWith('axl')) return;
owners.push(...assetTvl.source_escrow_addresses)
diff --git a/projects/alien-finance/index.js b/projects/alien-finance/index.js
index 2ccc980a92..ba6bff29a8 100644
--- a/projects/alien-finance/index.js
+++ b/projects/alien-finance/index.js
@@ -1,11 +1,31 @@
-const { sumTokensExport } = require("../helper/unwrapLPs")
-const ADDRESSES = require('../helper/coreAssets.json')
-
-const owner = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022"
+const DAPP_POOL = "0x50454acC07bf8fC78100619a1b68e9E8d28cE022"
+const BLAST_POOL = "0x02B7BF59e034529d90e2ae8F8d1699376Dd05ade"
+const BLAST_POOL_LAUNCH = 1719390003
module.exports = {
blast: {
- tvl: sumTokensExport({ owner, tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}),
+ tvl, borrowed,
},
start: 1709630412,
};
+
+async function tvl(api) {
+ const dappPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: DAPP_POOL});
+ const blastPoolTokens = api.timestamp > BLAST_POOL_LAUNCH ? await api.call({ abi: 'address[]:getAllMarkets', target: BLAST_POOL}) : [];
+
+ return api.sumTokens({ tokensAndOwners: [
+ ...dappPoolTokens.map(token => [token, DAPP_POOL]),
+ ...blastPoolTokens.map(token => [token, BLAST_POOL]),
+ ] })
+}
+async function borrowed(api) {
+ const dappPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: DAPP_POOL});
+ const dappPoolBorrow = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: dappPoolTokens, target: DAPP_POOL})
+ api.add(dappPoolTokens, dappPoolBorrow)
+
+ if (api.timestamp > BLAST_POOL_LAUNCH) {
+ const blastPoolTokens = await api.call({ abi: 'address[]:getAllMarkets', target: BLAST_POOL});
+ const blastPoolBorrow = await api.multiCall({ abi: 'function getTotalBorrow(address) view returns (uint256)', calls: blastPoolTokens, target: BLAST_POOL})
+ api.add(blastPoolTokens, blastPoolBorrow)
+ }
+}
diff --git a/projects/allbridge/index.js b/projects/allbridge/index.js
index 51f32af495..a6225a6b19 100644
--- a/projects/allbridge/index.js
+++ b/projects/allbridge/index.js
@@ -211,8 +211,7 @@ async function solanaTvl() {
}
async function solanaStaking() {
- const balance = await solana.getTokenAccountBalance(solanaData.staking.tokenAccount);
- return {allbridge: toNumber(0, balance)}
+ return solana.sumTokens2({ tokenAccounts: [solanaData.staking.tokenAccount] })
}
async function terraTvl() {
diff --git a/projects/allspark/index.js b/projects/allspark/index.js
new file mode 100644
index 0000000000..e59b148d7b
--- /dev/null
+++ b/projects/allspark/index.js
@@ -0,0 +1,13 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const {staking} = require("../helper/staking");
+
+module.exports = {
+ methodology: 'allspark counts the staking values as tvl',
+ start: 1690371,
+ zklink:{
+ tvl: staking(
+ ["0xD06B5A208b736656A8F9cD04ed43744C738BD8A9"],
+ [ADDRESSES.null]
+ )
+ }
+};
diff --git a/projects/allstake/idls/strategy_manager.json b/projects/allstake/idls/strategy_manager.json
new file mode 100644
index 0000000000..c543451595
--- /dev/null
+++ b/projects/allstake/idls/strategy_manager.json
@@ -0,0 +1,82 @@
+{
+ "version": "0.1.0",
+ "name": "strategy_manager",
+ "instructions": [],
+ "accounts": [
+ {
+ "name": "StrategyManager",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "data",
+ "type": {
+ "defined": "VersionedStrategyManager"
+ }
+ }
+ ]
+ }
+ }
+ ],
+ "types": [
+ {
+ "name": "StrategyManagerV1",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "owner",
+ "docs": [
+ "owner of strategy manager program"
+ ],
+ "type": "publicKey"
+ },
+ {
+ "name": "strategyMints",
+ "docs": [
+ "list of supported strategies' mint address"
+ ],
+ "type": {
+ "array": [
+ "publicKey",
+ 32
+ ]
+ }
+ },
+ {
+ "name": "strategyMintsLen",
+ "docs": [
+ "size of the list above"
+ ],
+ "type": "u8"
+ },
+ {
+ "name": "minWithdrawDelay",
+ "docs": [
+ "min withdraw queueing delay length in seconds"
+ ],
+ "type": "i64"
+ }
+ ]
+ }
+ },
+ {
+ "name": "VersionedStrategyManager",
+ "type": {
+ "kind": "enum",
+ "variants": [
+ {
+ "name": "V1",
+ "fields": [
+ {
+ "defined": "StrategyManagerV1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ],
+ "events": [],
+ "errors": []
+}
\ No newline at end of file
diff --git a/projects/allstake/index.js b/projects/allstake/index.js
new file mode 100644
index 0000000000..a685108ede
--- /dev/null
+++ b/projects/allstake/index.js
@@ -0,0 +1,56 @@
+const { getUniqueAddresses } = require('../helper/utils');
+const { call, sumTokens } = require('../helper/chain/near');
+const { sumTokens2, getProvider } = require('../helper/solana');
+const { Program } = require('@coral-xyz/anchor');
+const { PublicKey } = require('@solana/web3.js');
+
+const ALLSTAKE_NEAR_CONTRACT = 'allstake.near';
+const ALLSTAKE_SOLANA_PROGRAM = new PublicKey('a11zL6Uxue6mYG3JD3APmnVhS4RVjGTJZbENY7L6ZfD');
+const ALLSTAKE_SOLANA_PROGRAM_IDL = require('./idls/strategy_manager.json');
+
+async function nearTvl() {
+ const strategies = await call(ALLSTAKE_NEAR_CONTRACT, 'get_strategies', {});
+ const tokens = getUniqueAddresses(strategies.map(s => s.underlying_token));
+ return sumTokens({
+ owners: [ALLSTAKE_NEAR_CONTRACT],
+ tokens,
+ });
+}
+
+async function solanaTvl() {
+ const provider = getProvider();
+ const programId = ALLSTAKE_SOLANA_PROGRAM;
+ // const idl = await Program.fetchIdl(programId, provider)
+ const program = new Program(ALLSTAKE_SOLANA_PROGRAM_IDL, programId, provider);
+ const state = await program.account.strategyManager.all();
+ const strategyManager = state[0].account.data.v1[0];
+ const tokens = getUniqueAddresses(strategyManager.strategyMints.slice(0, strategyManager.strategyMintsLen).map(mint => mint.toBase58()), true);
+
+ const tokensAndOwners = [];
+ for (const token of tokens) {
+ const pubKey = new PublicKey(token);
+ const owner = PublicKey.findProgramAddressSync(
+ [
+ Buffer.from('STRATEGY'),
+ pubKey.toBuffer(),
+ ],
+ ALLSTAKE_SOLANA_PROGRAM
+ )[0].toBase58();
+ tokensAndOwners.push([token, owner]);
+ }
+
+ return sumTokens2({
+ tokensAndOwners
+ });
+}
+
+module.exports = {
+ near: {
+ tvl: nearTvl,
+ },
+ solana: {
+ tvl: solanaTvl,
+ },
+ timetravel: false,
+ methodology: 'Summed up all the tokens deposited in the contract',
+}
diff --git a/projects/alpha-homora/v2.js b/projects/alpha-homora/v2.js
index d7aa9b9814..ab58294362 100644
--- a/projects/alpha-homora/v2.js
+++ b/projects/alpha-homora/v2.js
@@ -10,40 +10,40 @@ const { getConfig } = require('../helper/cache')
const chainParams = {
optimism: {
safeBoxApi: "https://api.homora.alphaventuredao.io/v2/10/safeboxes",
- latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/mintcnn/optimism`,
+ latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('B3g98fbbStVKtff6QUY6iMUqp7rxqrdDyGdrXAmcWG6B'),
poolsJsonUrl: "https://api.homora.alphaventuredao.io/v2/10/pools",
instances: [ ]
},
avax: {
safeBoxApi: "https://homora-api.alphafinance.io/v2/43114/safeboxes",
- latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-avax`,
+ latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'),
poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools",
instances: [
{
wMasterChefAddress: "0xb41de9c1f50697cc3fd63f24ede2b40f6269cbcb",
wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", // wrong
poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools",
- graphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-avax`,
+ graphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'),
},
]
},
fantom: {
safeBoxApi: "https://homora-api.alphafinance.io/v2/250/safeboxes",
- latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-fantom`,
+ latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'),
poolsJsonUrl: "https://homora-api.alphafinance.io/v2/250/pools",
instances: [
{
wMasterChefAddress: "0x5FC20fCD1B50c5e1196ac790DADCfcDD416bb0C7",
wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", // wrong
poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools",
- graphUrl: `https://api.thegraph.com/subgraphs/name/alphafinancelab/alpha-homora-v2-fantom`,
+ graphUrl: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'),
},
]
},
ethereum: {
safeBoxApi: "https://homora-api.alphafinance.io/v2/1/safeboxes",
coreOracleAddress: "0x6be987c6d72e25f02f6f061f94417d83a6aa13fc",
- latestAlphaHomoraV2GraphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-mainnet`,
+ latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'),
instances: [
{
// Current
@@ -53,7 +53,7 @@ const chainParams = {
wStakingRewardIndex: "0x011535fd795fd28c749363e080662d62fbb456a7",
wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63",
poolsJsonUrl: "https://homora-api.alphafinance.io/v2/1/pools",
- graphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-relaunch`,
+ graphUrl: sdk.graph.modifyEndpoint('37CbUUxwQC7uTqQquQXtQQF8b2bU7L3VBrkEntiHxf4r'),
},
{
// Legacy
@@ -64,7 +64,7 @@ const chainParams = {
wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63",
poolsJsonUrl:
"local",
- graphUrl: `https://api.thegraph.com/subgraphs/name/hermioneeth/alpha-homora-v2-mainnet`,
+ graphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'),
}
]
}
diff --git a/projects/alphafi/index.js b/projects/alphafi/index.js
new file mode 100644
index 0000000000..93ca307327
--- /dev/null
+++ b/projects/alphafi/index.js
@@ -0,0 +1,94 @@
+const sui = require("../helper/chain/sui")
+const { addUniV3LikePosition } = require("../helper/unwrapLPs")
+
+const ALPHAFI_TVL_IDS = [
+ {
+
+ poolID: "0x30066d9879374276dc01177fbd239a9377b497bcd347c82811d75fcda35b18e5",
+ cetusPoolID: "0xc8d7a1503dc2f9f5b05449a87d8733593e2f0f3e7bffd90541252782e4d2ca20",
+ investorID: "0x87a76889bf4ed211276b16eb482bf6df8d4e27749ebecd13017d19a63f75a6d5",
+ token0Type: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN",
+ token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
+ },
+ {
+ poolID: "0xa7239a0c727c40ee3a139689b16b281acfd0682a06c23531b184a61721ece437",
+ cetusPoolID: "0x0e809689d04d87f4bd4e660cd1b84bf5448c5a7997e3d22fc480e7e5e0b3f58d",
+ investorID: "0x1b923520f19660d4eb013242c6d03c84fdea034b8f784cfd71173ef72ece50e1",
+ token0Type: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY",
+ token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
+ },
+ {
+ poolID: "0xee6f6392cbd9e1997f6e4cf71db0c1ae1611f1f5f7f23f90ad2c64b8f23cceab",
+ cetusPoolID: "0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630",
+ investorID: "0xb6ca8aba0fb26ed264a3ae3d9c1461ac7c96cdcbeabb01e71086e9a8340b9c55",
+ token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
+ token1Type: "0x2::sui::SUI"
+ },
+ {
+ poolID: "0x676fc5cad79f51f6a7d03bfa3474ecd3c695d322380fc68e3d4f61819da3bf8a",
+ cetusPoolID: "0xaa57c66ba6ee8f2219376659f727f2b13d49ead66435aa99f57bb008a64a8042",
+ investorID: "0x9ae0e56aa0ebc27f9d8a17b5a9118d368ba262118d878977b6194a10a671bbbc",
+ token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN",
+ token1Type: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN"
+ },
+ {
+ poolID: "0xbdf4f673b34274f36be284bca3f765083380fefb29141f971db289294bf679c6",
+ cetusPoolID: "0x5b0b24c27ccf6d0e98f3a8704d2e577de83fa574d3a9060eb8945eeb82b3e2df",
+ investorID: "0x05fa099d1df7b5bfb2e420d5ee2d63508db17c40ce7c4e0ca0305cd5df974e43",
+ token0Type: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN",
+ token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN"
+ },
+]
+
+const ALPHAFI_POOL2_IDS = [{
+ poolID: "0x594f13b8f287003fd48e4264e7056e274b84709ada31e3657f00eeedc1547e37",
+ cetusPoolID: "0xda7347c3192a27ddac32e659c9d9cbed6f8c9d1344e605c71c8886d7b787d720",
+ investorID: "0x46d901d5e1dba34103038bd2ba789b775861ea0bf4d6566afd5029cf466a3d88",
+ token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA",
+ token1Type: "0x2::sui::SUI"
+},
+]
+
+const ALPHA_POOL_ID = "0x6ee8f60226edf48772f81e5986994745dae249c2605a5b12de6602ef1b05b0c1"
+const ALPHA_COIN_TYPE = "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA"
+
+function asIntN(int, bits = 32) {
+ return Number(BigInt.asIntN(bits, BigInt(int)))
+}
+
+async function addPoolTVL(api, pools) {
+ for (const { poolID, cetusPoolID, investorID, token0Type, token1Type } of pools) {
+ let investorObject = await sui.getObject(investorID)
+ let poolObject = await sui.getObject(poolID)
+ let cetusPoolObject = await sui.getObject(cetusPoolID)
+ addUniV3LikePosition({
+ api,
+ tickLower: asIntN(investorObject.fields.lower_tick),
+ tickUpper: asIntN(investorObject.fields.upper_tick),
+ tick: asIntN(cetusPoolObject.fields.current_tick_index.fields.bits),
+ liquidity: poolObject.fields.tokensInvested,
+ token0: token0Type,
+ token1: token1Type
+ })
+ }
+}
+
+async function tvl(api) {
+ await addPoolTVL(api, ALPHAFI_TVL_IDS)
+}
+async function pool2(api) {
+ await addPoolTVL(api, ALPHAFI_POOL2_IDS)
+}
+
+async function staking(api) {
+ let alphaPoolObject = await sui.getObject(ALPHA_POOL_ID)
+ api.addToken(ALPHA_COIN_TYPE, Number(alphaPoolObject.fields.alpha_bal))
+}
+
+module.exports = {
+ timetravel: false,
+ doublecounted: true,
+ sui: {
+ tvl, pool2, staking,
+ },
+}
\ No newline at end of file
diff --git a/projects/alta-finance/index.js b/projects/alta-finance/index.js
index 8a7a0128c0..ed7d6ec0e9 100644
--- a/projects/alta-finance/index.js
+++ b/projects/alta-finance/index.js
@@ -5,7 +5,7 @@ module.exports = {
const config = {
polygon: { investments: ['0xcf152E9f60E197A44FAdce961c6B822Dcb6c9dcc'], debts: [], token: ADDRESSES.polygon.USDC },
- base: { investments: ['0xF36d1AdDA798Ea9340069207806dcBB137d31212'], debts: [], token: ADDRESSES.base.USDC }
+ base: { investments: [], debts: [], token: ADDRESSES.base.USDC }
}
Object.keys(config).forEach(chain => {
diff --git a/projects/altr-lend/index.js b/projects/altr-lend/index.js
index 7da6e46a0b..6ae0ea96e5 100644
--- a/projects/altr-lend/index.js
+++ b/projects/altr-lend/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
// const LendingContract = "0xdc93413cbe690a1643d285c9f075b271372c9b36"
const { graphQuery } = require('../helper/http')
const ADDRESSES = require('../helper/coreAssets.json')
@@ -9,7 +10,7 @@ async function borrowed(api) {
}
}`
- const { loans } = await graphQuery("https://api.thegraph.com/subgraphs/name/lucidao-developer/altr-lend", query);
+ const { loans } = await graphQuery(sdk.graph.modifyEndpoint('AVmBsxjouEH6wvG2HCGPCNNt9eDeX2esaRZ7L7jJaTnD'), query);
api.add(ADDRESSES.polygon.USDT, loans.map(i => i.amount));
return api.getBalances()
}
diff --git a/projects/ambient-finance/index.js b/projects/ambient-finance/index.js
index 4ac8955c98..4739b3da09 100644
--- a/projects/ambient-finance/index.js
+++ b/projects/ambient-finance/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { sumTokens2 } = require('../helper/unwrapLPs');
const { cachedGraphQuery, getConfig } = require("../helper/cache");
@@ -13,7 +14,7 @@ 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: `https://api.thegraph.com/subgraphs/name/crocswap/croc-mainnet`
+ ethereum: sdk.graph.modifyEndpoint('DyHaLYK1keqcv3YD3VczKGYvxQGfGgV6bGTbZLMj5xME')
}
async function tvl(api) {
diff --git a/projects/amped/index.js b/projects/amped/index.js
index 31b346899d..04f69f4f22 100644
--- a/projects/amped/index.js
+++ b/projects/amped/index.js
@@ -1,14 +1,14 @@
const {staking} = require('../helper/staking')
const { gmxExports } = require('../helper/gmx')
-//Cronos
-const phoenixVaultAddress = '0x976156BE19D35ac616c67737258EEc973202E6D6';
-const phoenixStakingAddress = '0x48f206bED002fae4EcB522Dfe36e5A10F15e9f47';
-const phoenixAlpAddress = '0x6c6647B3E6AfA27B8Fb9BEDe728A3603eB6c0fC7';
+const phoenixVaultAddress = '0xa6b88069EDC7a0C2F062226743C8985FF72bB2Eb';
+const phoenixStakingAddress = '0x3c9586567a429BA0467Bc63FD38ea71bB6B912E0';
+const phoenixAmpAddress = '0xca7F14F14d975bEFfEe190Cd3cD232a3a988Ab9C';
module.exports = {
+ start: 1717674114,
lightlink_phoenix: {
- staking: staking(phoenixStakingAddress, phoenixAlpAddress),
+ staking: staking(phoenixStakingAddress, phoenixAmpAddress),
tvl: gmxExports({ vault: phoenixVaultAddress, })
},
};
diff --git a/projects/amphor/index.js b/projects/amphor/index.js
index 891a5b603b..878b3c5968 100644
--- a/projects/amphor/index.js
+++ b/projects/amphor/index.js
@@ -1,3 +1,4 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { sumERC4626VaultsExport } = require('../helper/erc4626');
const { sumTokensExport } = require('../helper/unwrapLPs');
const sdk = require('@defillama/sdk');
@@ -5,32 +6,46 @@ const sdk = require('@defillama/sdk');
const config = {
ethereum: {
lvTokens: {
- 'ampr-LP-USD': '0x3b022EdECD65b63288704a6fa33A8B9185b5096b',
- 'ampr-LP-ETH': '0x2791EB5807D69Fe10C02eED6B4DC12baC0701744',
- 'ampr-LP-BTC': '0xC4A324fDF8a2495776B4d6cA46599B5a52f96489',
- amprPTweETH: '0xf97ecda5F9ff31d83f635a6EA70D2D3B9C8f2e00',
- amprPTrsETH: '0x0498b85FB4EC85EF5EFe82513aa9DaF767358A15',
- amprPTezETH: '0x920F17e741029D904936c58a545DFFC72f82C079',
- amprETH: '0xcdc51f2b0e5f0906f2fd5f557de49d99c34df54e',
+ totalAssets: [
+ '0x3b022EdECD65b63288704a6fa33A8B9185b5096b', // ampr-LP-USD
+ '0x2791EB5807D69Fe10C02eED6B4DC12baC0701744', // ampr-LP-ETH
+ '0xC4A324fDF8a2495776B4d6cA46599B5a52f96489', // ampr-LP-BTC
+ '0xf97ecda5F9ff31d83f635a6EA70D2D3B9C8f2e00', // amprPTweETH
+ '0x0498b85FB4EC85EF5EFe82513aa9DaF767358A15', // amprPTrsETH
+ '0x920F17e741029D904936c58a545DFFC72f82C079', // amprPTezETH
+ '0xcdc51f2b0e5f0906f2fd5f557de49d99c34df54e', // amprETH
+ ],
+ totalSupply: [
+ '0x06824C27C8a0DbDe5F72f770eC82e3c0FD4DcEc3', // amphrLRT
+ ],
},
},
};
const claimableSilo = '0x06eCFaAde8fcb8C1bC58CB05104604282f8a8144';
const pendingSilo = '0x361a027e660844f336d5fa07E4cb38c40d5880d9';
-const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';
+const WETH = ADDRESSES.ethereum.WETH;
+
+const totalAssetsVaults = config.ethereum.lvTokens.totalAssets;
+const totalSupplyVaults = config.ethereum.lvTokens.totalSupply;
const tvl = sdk.util.sumChainTvls([
sumERC4626VaultsExport({
- vaults: Object.values(config.ethereum.lvTokens),
+ vaults: totalAssetsVaults,
tokenAbi: 'asset',
balanceAbi: 'totalAssets',
}),
+ sumERC4626VaultsExport({
+ vaults: totalSupplyVaults,
+ tokenAbi: 'asset',
+ balanceAbi: 'totalSupply',
+ }),
sumTokensExport({ owners: [claimableSilo, pendingSilo], tokens: [WETH] }),
]);
module.exports['ethereum'] = { tvl };
module.exports.hallmarks = [
[1710115200, 'Beta test closing'],
- [1712361600, 'LRT vault release'],
+ [1712361600, 'ETH Boosted Vault Release'],
+ [1718927999, 'Symbiotic LRT Vault Release'],
];
diff --git a/projects/amulet-protocol/index.js b/projects/amulet-protocol/index.js
index 1f6e591836..58eee69a48 100644
--- a/projects/amulet-protocol/index.js
+++ b/projects/amulet-protocol/index.js
@@ -1,23 +1,16 @@
const BN = require("bn.js");
const { PublicKey } = require("@solana/web3.js")
-const { getConnection } = require("../helper/solana");
+const { getConnection, sumTokens2 } = require("../helper/solana");
async function tvl() {
const connection = getConnection();
const stakingInstanceState = await connection.getAccountInfo(new PublicKey("HNhPNHkp3RobeJzepNzyVyewtAaoF3QCCvtBTxKJVnRX"));
const liqStakedAmtSOLAmount = stakingInstanceState.data.slice(203, 211);
liqStakedAmtSOLAmount.reverse();
-
- const amtsolStakedAmount = (await connection.getTokenAccountBalance(new PublicKey("BQUHYmLH8St7j9kTWExd19QjoDuxrha7Mgp32M7zvS84"))).value.amount
- const pcuvAmtSOLAmount = (await connection.getTokenAccountBalance(new PublicKey("9QPcNgmkRAQncEnTBDXvWq2H7LY4VLNJfiVYD9c3eL8D"))).value.amount
-
- const amtSOLAmount = [new BN(liqStakedAmtSOLAmount), new BN(amtsolStakedAmount), new BN(pcuvAmtSOLAmount)]
-
- const tvlAmtSOL = amtSOLAmount.reduce((acc,x) => acc.add(x), new BN(0)).div(new BN(1000000000)).toNumber()
-
- return {
- 'amulet-staked-sol': tvlAmtSOL
+ const balances = {
+ 'solana:SoLW9muuNQmEAoBws7CWfYQnXRXMVEG12cQhy6LE2Zf': new BN(liqStakedAmtSOLAmount).toString()
}
+ return sumTokens2({ balances, tokenAccounts: ['BQUHYmLH8St7j9kTWExd19QjoDuxrha7Mgp32M7zvS84', '9QPcNgmkRAQncEnTBDXvWq2H7LY4VLNJfiVYD9c3eL8D'] })
}
module.exports = {
diff --git a/projects/anzen-v2/index.js b/projects/anzen-v2/index.js
new file mode 100644
index 0000000000..be764330c2
--- /dev/null
+++ b/projects/anzen-v2/index.js
@@ -0,0 +1,50 @@
+const sdk = require('@defillama/sdk')
+
+// Anzen USDz - digital dollar backed by Real World Assets
+
+const USDz = '0xa469b7ee9ee773642b3e93e842e5d9b5baa10067';
+const Base_USDz = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938';
+const Blast_USDz = '0x52056ed29fe015f4ba2e3b079d10c0b87f46e8c6';
+const Manta_USDz = '0x73d23f3778a90be8846e172354a115543df2a7e4';
+const SPCT = '0xf30a29f1c540724fd8c5c4be1af604a6c6800d29'; // Secured collateral
+
+const mainnet_tvl = async (api) => {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: USDz })
+ api.add(USDz, supply)
+}
+
+const base_tvl = async (api) => {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: Base_USDz })
+ api.add(Base_USDz, supply)
+}
+
+const blast_tvl = async (api) => {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: Blast_USDz })
+ api.add(Blast_USDz, supply)
+}
+
+const manta_tvl = async (api) => {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: Manta_USDz })
+ api.add(Manta_USDz, supply)
+}
+
+const collateral_assets = async (api) => {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: SPCT })
+ api.add(SPCT, supply)
+}
+
+module.exports = {
+ methodology: "Sums total USDz in circulation across all chains",
+ ethereum: {
+ tvl: mainnet_tvl,
+ },
+ base: {
+ tvl: base_tvl,
+ },
+ blast: {
+ tvl: blast_tvl,
+ },
+ manta: {
+ tvl: manta_tvl,
+ },
+};
diff --git a/projects/apestore/index.js b/projects/apestore/index.js
index 1efd12a64c..f4350642fb 100644
--- a/projects/apestore/index.js
+++ b/projects/apestore/index.js
@@ -4,7 +4,9 @@ const coreAssets = require("../helper/coreAssets.json");
const routers = [
"0xF6Af6C034E92694A4c79569B03543d580df402D7",
"0x992D40d9ED8937Bb0Ad3c0Ba99713072Ae0a05b3",
- "0x135De7F9223C76b7d0278FFe854eC480D37FE906"
+ "0x135De7F9223C76b7d0278FFe854eC480D37FE906",
+ "0x3ccC78545F675A188B7521F7f4b4791995752635",
+ "0x0bf8edd756ff6caf3f583d67a9fd8b237e40f58a"
];
const tokens = [coreAssets.null];
diff --git a/projects/apex-omni/index.js b/projects/apex-omni/index.js
new file mode 100644
index 0000000000..74ecad0c41
--- /dev/null
+++ b/projects/apex-omni/index.js
@@ -0,0 +1,31 @@
+const ADDRESSES = require('../helper/coreAssets.json');
+const { sumTokensExport } = require('../helper/unwrapLPs');
+
+const tokens = [
+ ADDRESSES.ethereum.USDC,
+ ADDRESSES.ethereum.USDT,
+];
+
+const walletAddresses = {
+ bsc: ['0xb8d9f005654b7b127b34dae8f973ba729ca3a2d9'],
+ ethereum: ['0x35D173cdfE4d484BC5985fDa55FABad5892c7B82'],
+ arbitrum: ['0x3169844a120c0f517b4eb4a750c08d8518c8466a']
+
+};
+
+const tokenAddress = {
+ bsc: [ADDRESSES.bsc.USDT],
+ arbitrum: [ADDRESSES.arbitrum.USDT],
+}
+
+module.exports = {
+ ethereum: {
+ tvl: sumTokensExport({ owners: walletAddresses.ethereum, tokens }),
+ },
+ bsc: {
+ tvl: sumTokensExport({ owners: walletAddresses.bsc, tokens: tokenAddress.bsc }),
+ },
+ arbitrum: {
+ tvl: sumTokensExport({ owners: walletAddresses.arbitrum, tokens: tokenAddress.arbitrum }),
+ },
+};
\ No newline at end of file
diff --git a/projects/apricot.js b/projects/apricot.js
index af44d6dcff..3a17583fde 100644
--- a/projects/apricot.js
+++ b/projects/apricot.js
@@ -1,53 +1,14 @@
-const ADDRESSES = require('./helper/coreAssets.json')
-const { sumTokens2, sumOrcaLPs } = require('./helper/solana')
+const { sumTokens2 } = require('./helper/solana')
async function tvl() {
- const orcaPoolsTVL = await sumOrcaLPs([
- //usdt/usdc
- ["GjpXgKwn4VW4J2pZdS3dovM58hiXWLJtopTfqG83zY2f", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //SOL/USDC
- ["FFdjrSvNALfdgxANNpt3x85WpeVMdQSH5SEP2poM8fcK", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //ETH/USDC
- ["HDP2AYFmvLz6sWpoSuNS62JjvW4HjMKp7doXucqpWN56", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //SOL/USDT
- ["71vZ7Jvu8fTyFzpX399dmoSovoz24rVbipLrRn2wBNzW", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //ORCA/USDC
- ["Gc7W5U66iuHQcC1cQyeX9hxkPF2QUVJPTf1NWbW8fNrt", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //ORCA/SOL
- ["B5waaKnsmtqFawPspUwcuy1cRjAC7u2LrHSwxPSxK4sZ", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //mSOL/USDC[aquafarm]
- ["9y3QYM5mcaB8tU7oXRzAQnzHVa75P8riDuPievLp64cY", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //BTC/mSOL[aquafarm]
- ["6uA1ADUJbvwYJZpzUn9z9LuyKoRVngBKcQTKdXsSivA8", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //ETH/SOL
- ["CGFTRh4jKLPbS9r4hZtbDfaRuC7qcA8rZpbLnVTzJBer", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- //mSOL/SOL[stable][aquafarm]
- ["576ABEdvLG1iFU3bLC8AMJ3mo5LhfgPPhMtTeVAGG6u7", "7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW"],
- ])
- const balances = {
- tether: orcaPoolsTVL
- }
const owner = '7Ne6h2w3LpTNTa7CNYcUs7UkjeJT3oW7jcrXWfVScTXW'
- const tokens = [
- ADDRESSES.solana.USDC,
- '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E',
- '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk',
- 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So',
- ADDRESSES.solana.USDT,
- '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
- ADDRESSES.solana.SOL,
- '9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i',
- 'orcaEKTdK7LKz57vaAYr9QeNsVEPfiu6QeMU1kektZE',
- ]
- return sumTokens2({ balances, owner, tokens })
-
+ return sumTokens2({ owner })
}
module.exports = {
timetravel: false,
- misrepresentedTokens: true,
solana: {
tvl,
},
- methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted. Coingecko is used to price tokens.',
+ methodology: 'TVL consists of deposits made to the protocol and like other lending protocols, borrowed tokens are not counted',
}
diff --git a/projects/arbitrum/index.js b/projects/arbitrum/index.js
index d59dd9f85c..df07c4dfb7 100644
--- a/projects/arbitrum/index.js
+++ b/projects/arbitrum/index.js
@@ -12,6 +12,7 @@ module.exports = {
"0xA10c7CE4b876998858b1a9E12b10092229539400",
],
fetchCoValentTokens: true,
+ permitFailure: true
}),
},
};
diff --git a/projects/arca-labs/index.js b/projects/arca-labs/index.js
new file mode 100644
index 0000000000..3a115b626a
--- /dev/null
+++ b/projects/arca-labs/index.js
@@ -0,0 +1,21 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const RCOIN = "0x252739487c1fa66eaeae7ced41d6358ab2a6bca9"
+
+module.exports = {
+ ethereum: {
+ tvl: async (api) => {
+ const [usdcDecimals, rcoinDecimals,totalSupply] = await Promise.all([
+ api.call({target: ADDRESSES.ethereum.USDC, abi:'erc20:decimals'}),
+ api.call({target: RCOIN, abi:'erc20:decimals'}),
+ api.call({target: RCOIN, abi:'erc20:totalSupply'})
+ ])
+ // Adjusting the total supply of RCOIN to match the decimal places of USDC
+ // USDC has 6 decimals, whereas RCOIN has 8 decimals
+ const rcoinDecimalAdjustment = Math.pow(10, usdcDecimals) / Math.pow(10, rcoinDecimals);
+ const adjustedSupply = totalSupply * rcoinDecimalAdjustment
+
+ return api.add(ADDRESSES.ethereum.USDC, adjustedSupply)
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js
index 7341b5eb24..561698f436 100644
--- a/projects/arcadia-finance-v2/index.js
+++ b/projects/arcadia-finance-v2/index.js
@@ -1,4 +1,4 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { sumTokens2, unwrapSlipstreamNFT, } = require("../helper/unwrapLPs");
const config = {
base: {
@@ -7,21 +7,83 @@ const config = {
wethPool: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2",
usdcPool: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1",
},
- uniNFT: '0x03a520b32c04bf3beef7beb72e919cf822ed34f1',
+ uniNFT: "0x03a520b32c04bf3beef7beb72e919cf822ed34f1",
+ slipNFT: "0x827922686190790b37229fd06084350e74485b72",
+ wAeroNFT: "0x17B5826382e3a5257b829cF0546A08Bd77409270".toLowerCase(),
+ sAeroNFT: "0x9f42361B7602Df1A8Ae28Bf63E6cb1883CD44C27".toLowerCase(),
+ sSlipNFT: "0x1Dc7A0f5336F52724B650E39174cfcbbEdD67bF1".toLowerCase(),
},
+};
+
+async function unwrapArcadiaAeroLP({ api, ownerIds, }) {
+ const { wAeroNFT, sAeroNFT, sSlipNFT } = config[api.chain]
+ const wAERONFTIds = []
+ const sAERONFTIds = []
+ const sSlipNftIds = []
+
+ // for each asset address owned by an account
+ // check if the asset is the wrapped or staked aero asset module
+ // if so, fetch the amount of lp wrapped or staked
+ // create object with aerodrome v1 (=univ2) lp tokens
+ for (const ownerId of ownerIds) {
+ const [nftAddresses, ids] = ownerId;
+ for (let i = 0; i < nftAddresses.length; i++) {
+ const nftAddress = nftAddresses[i].toLowerCase()
+ switch (nftAddress) {
+ case wAeroNFT:
+ wAERONFTIds.push(ids[i]);
+ break;
+ case sAeroNFT:
+ sAERONFTIds.push(ids[i]);
+ break;
+ case sSlipNFT:
+ sSlipNftIds.push(ids[i]);
+ break;
+ }
+ }
+ }
+
+ const wrappedData = await api.multiCall({ abi: abi.wrappedAeroPositionState, calls: wAERONFTIds, target: wAeroNFT, });
+ const stakedData = await api.multiCall({ abi: abi.stakedAeroPositionState, calls: sAERONFTIds, target: sAeroNFT, });
+ wrappedData.forEach((data) => api.add(data.pool, data.amountWrapped));
+ stakedData.forEach((data) => api.add(data.pool, data.amountStaked));
+
+ await uwrapStakedSlipstreamLP({api, sSlipNftIds, });
}
+async function uwrapStakedSlipstreamLP( {api, sSlipNftIds, }) {
+ const { slipNFT } = config[api.chain];
+ const balances = api.getBalances();
+
+ // Arcadia's staked slipstream NFT wrapper issues a position with the same ID as the wrapped NFT
+ // -> fetch the values of the wrapped IDs by simply fetching the values of those IDs on the native slipstream NFT
+ await unwrapSlipstreamNFT({balances:balances, positionIds:sSlipNftIds, nftAddress:slipNFT, chain:'base', blacklistedTokens:[], whitelistedTokens:[], uniV3ExtraConfig:{} });
+ }
+
async function tvl(api) {
- let { factory, pools, uniNFT, } = config[api.chain];
+ let { factory, pools, uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT } =
+ config[api.chain];
pools = Object.values(pools);
- const uTokens = await api.multiCall({ abi: "address:asset", calls: pools })
- await api.sumTokens({ tokensAndOwners2: [uTokens, pools] })
+ const uTokens = await api.multiCall({ abi: "address:asset", calls: pools });
+ await api.sumTokens({ tokensAndOwners2: [uTokens, pools] });
const accounts = await api.fetchList({ lengthAbi: 'allAccountsLength', itemAbi: 'allAccounts', target: factory, });
const assetData = await api.multiCall({ abi: abi.assetData, calls: accounts, });
const ownerTokens = accounts.map((account, i) => [assetData[i].assets, account])
- await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT] })
- return sumTokens2({ api, owners: accounts, resolveUniV3: true })
+ const ownerIds = accounts.map((account, i) => [
+ assetData[i][0],
+ assetData[i][1],
+ account,
+ ]);
+ // add all simple ERC20s
+ await api.sumTokens({ ownerTokens, blacklistedTokens: [uniNFT, slipNFT, wAeroNFT, sAeroNFT, sSlipNFT], });
+
+ // add all Arcadia-wrapped LP positions
+ await unwrapArcadiaAeroLP({ api, ownerIds });
+
+ // add all native LP positions
+ return sumTokens2({ api, owners: accounts, resolveUniV3: true, resolveSlipstream: true })
+
}
module.exports = {
@@ -35,5 +97,10 @@ module.exports = {
};
const abi = {
- "assetData": "function generateAssetData() view returns (address[] assets, uint256[], uint256[])",
-}
\ No newline at end of file
+ assetData:
+ "function generateAssetData() view returns (address[] assets, uint256[], uint256[])",
+ wrappedAeroPositionState:
+ "function positionState(uint256 tokenId) view returns ((uint128 fee0PerLiquidity, uint128 fee1PerLiquidity, uint128 fee0, uint128 fee1, uint128 amountWrapped, address pool))",
+ stakedAeroPositionState:
+ "function positionState(uint256 tokenId) view returns ((address pool, uint128 amountStaked, uint128 lastRewardPerTokenPosition, uint128 lastRewardPosition))",
+};
diff --git a/projects/arcadia-finance-v2/slipstreamNftABI.json b/projects/arcadia-finance-v2/slipstreamNftABI.json
new file mode 100644
index 0000000000..8a88c4ea6e
--- /dev/null
+++ b/projects/arcadia-finance-v2/slipstreamNftABI.json
@@ -0,0 +1,5 @@
+{
+ "positions": "function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)",
+ "slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)",
+ "getPool": "function getPool(address, address, int24) view returns (address)"
+}
\ No newline at end of file
diff --git a/projects/arcana/index.js b/projects/arcana/index.js
new file mode 100644
index 0000000000..e5705c741f
--- /dev/null
+++ b/projects/arcana/index.js
@@ -0,0 +1,9 @@
+module.exports = {
+ misrepresentedTokens: true,
+ real: { tvl }
+}
+
+async function tvl(api) {
+ const supply = await api.call({ abi: 'uint256:circulatingSupply', target: '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143' })
+ api.addCGToken('tether', supply / 1e18)
+}
\ No newline at end of file
diff --git a/projects/asa-gold/index.js b/projects/asa-gold/index.js
new file mode 100644
index 0000000000..3da3e89173
--- /dev/null
+++ b/projects/asa-gold/index.js
@@ -0,0 +1,40 @@
+const { tokens, getAssetInfo } = require('../helper/chain/algorand')
+const sdk = require('@defillama/sdk')
+
+async function tvl() {
+ const abi = 'function latestRoundData() view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)'
+ const api = new sdk.ChainApi({})
+ let totalMeldMarketCap = 0
+
+ // Gold is priced in tory oz, silver is priced in oz, but Meld Tokens are both priced in grams
+ const ozToGrams = 31.10347687
+
+ // ASA.Gold tokens
+ const assetInfo = [
+ {
+ assetId: tokens.ASAGold,
+ grams: ozToGrams,
+ priceFeed: '0x214eD9Da11D2fbe465a6fc601a91E62EbEc1a0D6',
+ }
+ ]
+
+ // Get total market cap of all Meld tokens
+ for (const asset of assetInfo) {
+ const { assetId, grams, priceFeed } = asset
+ const { answer: price } = await api.call({ abi, target: priceFeed })
+ const assetInfo = await getAssetInfo(assetId)
+ const circulatingSupply = assetInfo.circulatingSupply
+ const marketCap = (circulatingSupply / grams / 10 ** 6) * (price / 10 ** 8)
+ totalMeldMarketCap += marketCap
+ }
+
+ return { tether: totalMeldMarketCap }
+}
+
+module.exports = {
+ timetravel: false,
+ misrepresentedTokens: true,
+ algorand: {
+ tvl,
+ },
+}
diff --git a/projects/asol/index.js b/projects/asol/index.js
index 349eafd7db..274e66d364 100644
--- a/projects/asol/index.js
+++ b/projects/asol/index.js
@@ -1,10 +1,7 @@
-const {getTokenAccountBalance} = require('../helper/solana')
+const { sumTokens2 } = require('../helper/solana')
async function tvl() {
- return {
- "solana": await getTokenAccountBalance("4Bo98VrTYkHLbE9zoXx3tCD3qEDcGZFCZFksgyYPKdG9"),
- "msol": await getTokenAccountBalance("7n1AmrpywC84MdALohPBipAx1SYhjpSLjYFb2EuTV9wm"),
- }
+ return sumTokens2({ tokenAccounts: ['4Bo98VrTYkHLbE9zoXx3tCD3qEDcGZFCZFksgyYPKdG9', '7n1AmrpywC84MdALohPBipAx1SYhjpSLjYFb2EuTV9wm'] })
}
module.exports = {
diff --git a/projects/astar-dapps-staking/api.js b/projects/astar-dapps-staking/api.js
new file mode 100644
index 0000000000..1d1d743a21
--- /dev/null
+++ b/projects/astar-dapps-staking/api.js
@@ -0,0 +1,16 @@
+const { ApiPromise, WsProvider } = require("@polkadot/api");
+
+async function tvl() {
+ const polkadotProvider = new WsProvider("wss://rpc.astar.network");
+ const polkadotApi = await ApiPromise.create({ provider: polkadotProvider });
+ const currentEraInfo = await polkadotApi.query.dappStaking.currentEraInfo();
+ const tvl = currentEraInfo.totalLocked.toString()
+ return {
+ astar: tvl / 1e18,
+ };
+}
+
+module.exports = {
+ timetravel: false,
+ astar: { tvl },
+};
\ No newline at end of file
diff --git a/projects/astar-dapps-staking/index.js b/projects/astar-dapps-staking/index.js
index ba6b548906..37b1546c4d 100644
--- a/projects/astar-dapps-staking/index.js
+++ b/projects/astar-dapps-staking/index.js
@@ -1,34 +1,9 @@
-// const { ApiPromise, WsProvider } = require("@polkadot/api");
-// const ASTR_DECIMALS = 18;
-
-// async function tvl() {
-// const provider = new WsProvider("wss://astar.api.onfinality.io/public-ws");
-// const api = new ApiPromise({
-// provider,
-// });
-
-// await api.isReady;
-// const era = await api.query.dappsStaking.currentEra();
-// const result = await api.query.dappsStaking.generalEraInfo(era);
-// const tvl = result.unwrap().staked.valueOf();
-// const AstrLocked = tvl / 10 ** ASTR_DECIMALS;
-
-// return {
-// astar: AstrLocked,
-// };
-// }
-
-// module.exports = {
-// methodology:
-// "TVL considers ASTR tokens deposited to the Dapps-Staking program",
-// astar: { tvl },
-// };
-
-// This has been delisted
+const { getExports } = require("../helper/heroku-api");
module.exports = {
- astar: {
- tvl: () => ({})
- }
-}
+ timetravel: false,
+ methodology:
+ "Total value locked is the total amount of ASTR tokens deposited to the dApp Staking program",
+ ...getExports("astar-dapps-staking", ["astar"]),
+};
\ No newline at end of file
diff --git a/projects/astaria-v2/index.js b/projects/astaria-v2/index.js
index 1e83bbd687..6af422d549 100644
--- a/projects/astaria-v2/index.js
+++ b/projects/astaria-v2/index.js
@@ -1,8 +1,6 @@
const { treasuryExports } = require("../helper/treasury");
-const ADDRESSES = require('../helper/coreAssets.json')
module.exports = treasuryExports({
- base: {
- owners: ["0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D"],
- },
+ base: { owners: ["0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D"], },
+ ethereum: { owners: ['0x0000000000A6F0986c92cf1EC4d2e77aFBE1466D'], },
})
\ No newline at end of file
diff --git a/projects/astherus/index.js b/projects/astherus/index.js
new file mode 100644
index 0000000000..e3e924285f
--- /dev/null
+++ b/projects/astherus/index.js
@@ -0,0 +1,21 @@
+const { getConfig } = require('../helper/cache')
+
+const config = {
+ bsc: '0x128463A60784c4D3f46c23Af3f65Ed859Ba87974',
+ ethereum: '0x604DD02d620633Ae427888d41bfd15e38483736E'
+}
+
+module.exports = {
+ start: 1706716800, // 02/01/2024 @ 00:00:00pm (UTC)
+}
+
+Object.keys(config).forEach(chain => {
+ const vault = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const { data } = await getConfig(`astherus/${api.chain}`, `https://astherus.finance/bapi/futures/v1/public/future/web3/ae-deposit-asset?chainId=${api.chainId}`)
+ const tokens = data.map(i => i.contractAddress)
+ return api.sumTokens({ owner: vault, tokens })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/astroport/index.js b/projects/astroport/index.js
index 02573dbacc..ed71d81eda 100644
--- a/projects/astroport/index.js
+++ b/projects/astroport/index.js
@@ -16,4 +16,7 @@ module.exports = {
sei: {
tvl: getFactoryTvl("sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl")
},
-} // node test.js projects/astroport/index.js
\ No newline at end of file
+ osmosis: {
+ tvl: getFactoryTvl("osmo1246fnsutktuqqzrru673pqwtt64n288004j5fauyuezwr54llw5sl6drp6")
+ },
+} // node test.js projects/astroport/index.js
diff --git a/projects/atlendis/index.js b/projects/atlendis/index.js
index 218c42d3fd..974018c13e 100644
--- a/projects/atlendis/index.js
+++ b/projects/atlendis/index.js
@@ -1,81 +1,12 @@
-const { GraphQLClient, gql } = require('graphql-request')
-const { getBlock } = require('../helper/http')
-const sdk = require('@defillama/sdk')
-
-
-async function fetchData(block, balances, transform, borrowed = false) {
- const baseUrl = 'https://api.thegraph.com/subgraphs/name/atlendis';
- const urlPolygon = `${baseUrl}/atlendis-hosted-service-polygon`;
- const graphQLClient = new GraphQLClient(urlPolygon)
-
- const query = gql`
- query get_tvl($block: Int) {
- poolStatuses (block: { number: $block }) {
- state
- pool {
- id
- identifier
- parameters {
- underlyingToken
- }
- }
- normalizedAvailableAmount
- normalizedBorrowedAmount
- adjustedPendingAmount
- }
- }
- `;
-
- // pull data
- const data = await graphQLClient.request(query, {
- block: block - 50
- });
-
- // calculate TVL
- const agEUR = 'polygon:0xe0b52e49357fd4daf2c15e02058dce6bc0057db4'.toLowerCase()
- if (!borrowed) {
- for (let i = 0; i < data.poolStatuses.length; i++) {
- let amount = parseInt(data.poolStatuses[i].normalizedAvailableAmount)
- let assetAddress = data.poolStatuses[i].pool.parameters.underlyingToken;
-
- assetAddress = transform(assetAddress);
- if (assetAddress === agEUR) amount *= 1e12
- sdk.util.sumSingleBalance(balances, assetAddress, amount / 1e12)
- }
- } else {
- for (let i = 0; i < data.poolStatuses.length; i++) {
- let amount = parseInt(data.poolStatuses[i].normalizedBorrowedAmount)
- + parseInt(data.poolStatuses[i].adjustedPendingAmount);
- let assetAddress = data.poolStatuses[i].pool.parameters.underlyingToken;
-
- assetAddress = transform(assetAddress);
- if (assetAddress === agEUR) amount *= 1e12
- sdk.util.sumSingleBalance(balances, assetAddress, amount / 1e12)
- }
- }
-}
-
-
-async function tvl(timestamp, _, chainBlocks) {
- const balances = {};
- const block = await getBlock(timestamp, 'polygon', chainBlocks)
- const transform = i => `polygon:${i}`;
- await fetchData(block, balances, transform);
- return balances;
-}
-
-async function borrowed(timestamp, _, chainBlocks) {
- const balances = {};
- const transform = i => `polygon:${i}`;
- const block = await getBlock(timestamp, 'polygon', chainBlocks)
- await fetchData(block, balances, transform, true);
- return balances;
-}
-
+const { sumTokensExport } = require('../helper/unwrapLPs');
module.exports = {
- polygon: {
- tvl,
- borrowed,
+ polygon: {
+ tvl: sumTokensExport({ owners: ['0xbc13e1B5DA083b10622Ff5B52c9cFa1912F10B1F', '0x2fA375961A0cB525dB0f00af4E081a806A8639Fd'], tokens: [
+ '0x60D55F02A771d515e077c9C2403a1ef324885CeC',
+ '0x1a13f4ca1d028320a707d99520abfefca3998b7f',
+ '0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4',
+ ], }),
+ borrowed: () => ({}),
}
};
\ No newline at end of file
diff --git a/projects/atrix.js b/projects/atrix.js
index 6c17bf09f6..b1a9202997 100644
--- a/projects/atrix.js
+++ b/projects/atrix.js
@@ -1,9 +1,30 @@
-const { sumTokens2 } = require('./helper/solana')
-const { getConfig } = require('./helper/cache')
+const { sumTokens2, getConnection , getProvider} = require('./helper/solana')
+// const { getConfig } = require('./helper/cache')
+// const { PublicKey, } = require("@solana/web3.js");
+// const { TokenAmountLayout, } = require("./helper/utils/solana/layouts/raydium-layout");
+// const { Program } = require('@project-serum/anchor');
async function tvl() {
- const { pools } = await getConfig('atrix-v1', 'https://api.atrix.finance/api/all')
- return sumTokens2({ tokenAccounts: pools.map(({ marketData: { coinVault, pcVault } }) => [coinVault, pcVault]).flat() })
+ // previously we were incorrectly counting all tokens in serum pools as atrix tvl
+ return sumTokens2({ owner: '3uTzTX5GBSfbW7eM9R9k95H7Txe32Qw3Z25MtyD2dzwC', })
+/* const connection = getConnection()
+ const provider = getProvider()
+ const program = new Program(idl, 'HvwYjjzPbXWpykgVZhqvvfeeaSraQVnTiQibofaFw9M7', provider)
+
+ const acc = await program.account.poolAccount.all()
+ const tokenAccounts = acc.map(({ account:i}) => [i.poolCoinAccount, i.poolPcAccount, ]).flat()
+
+ console.log(tokenAccounts, tokenAccounts.length)
+ return sumTokens2({ tokenAccounts })
+ return {}
+ const auth = 'CmiPgGfWeteicRisWRuJzn7L649zWpw9Qya8g3ey9cZt'
+
+ console.time('raydium: ammV4Tvl fetching vault balances')
+ const allPoolVaultAmount = await connection.getProgramAccounts(new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'), { filters: [{ dataSize: 165 }, { memcmp: { offset: 32, bytes: auth } }], dataSlice: { offset: 64, length: TokenAmountLayout.span } })
+ console.timeEnd('raydium: ammV4Tvl fetching vault balances')
+ console.log(allPoolVaultAmount.length, 'fetched vault amounts')
+ return {} */
+
}
module.exports = {
@@ -14,3 +35,256 @@ module.exports = {
[1667865600, "FTX collapse"]
],
}
+/*
+const idl = {
+ "version": "0.0.0",
+ "name": "atrix",
+ "instructions": [],
+ "accounts": [
+ {
+ "name": "ProtocolAccount",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "authority",
+ "type": "publicKey"
+ },
+ {
+ "name": "bump",
+ "type": "u8"
+ },
+ {
+ "name": "lpFeeNumerator",
+ "type": "u16"
+ },
+ {
+ "name": "protocolFeeNumerator",
+ "type": "u16"
+ },
+ {
+ "name": "feeDenominator",
+ "type": "u16"
+ },
+ {
+ "name": "maxCancelPerIx",
+ "type": "u8"
+ },
+ {
+ "name": "maxPlacePerIx",
+ "type": "u8"
+ },
+ {
+ "name": "maxPlacePostLiq",
+ "type": "u8"
+ },
+ {
+ "name": "orderProportionNumerators",
+ "type": {
+ "array": [
+ "u16",
+ 12
+ ]
+ }
+ },
+ {
+ "name": "orderProportionLen",
+ "type": "u8"
+ },
+ {
+ "name": "orderProportionDenominator",
+ "type": "u16"
+ },
+ {
+ "name": "crankSolAccount",
+ "type": "publicKey"
+ },
+ {
+ "name": "poolInitCrankFee",
+ "type": "u64"
+ },
+ {
+ "name": "solBond",
+ "type": "u64"
+ }
+ ]
+ }
+ },
+ {
+ "name": "PoolAccount",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "coinMint",
+ "type": "publicKey"
+ },
+ {
+ "name": "pcMint",
+ "type": "publicKey"
+ },
+ {
+ "name": "market",
+ "type": "publicKey"
+ },
+ {
+ "name": "openOrders",
+ "type": "publicKey"
+ },
+ {
+ "name": "poolCoinAccount",
+ "type": "publicKey"
+ },
+ {
+ "name": "poolPcAccount",
+ "type": "publicKey"
+ },
+ {
+ "name": "poolLpAccount",
+ "type": "publicKey"
+ },
+ {
+ "name": "lpMint",
+ "type": "publicKey"
+ },
+ {
+ "name": "firstPlaced",
+ "type": "bool"
+ },
+ {
+ "name": "orderIndex",
+ "type": "u8"
+ },
+ {
+ "name": "lpFee",
+ "type": "u64"
+ },
+ {
+ "name": "stableFee",
+ "type": "u64"
+ },
+ {
+ "name": "ixi",
+ "type": "u8"
+ },
+ {
+ "name": "icx",
+ "type": "u8"
+ },
+ {
+ "name": "clientOrderId",
+ "type": "u64"
+ },
+ {
+ "name": "orderProportionNumerators",
+ "type": {
+ "array": [
+ "u16",
+ 12
+ ]
+ }
+ },
+ {
+ "name": "poolType",
+ "type": "u8"
+ },
+ {
+ "name": "stableswapAmpCoef",
+ "type": "u64"
+ },
+ {
+ "name": "coinDecimals",
+ "type": "u8"
+ },
+ {
+ "name": "pcDecimals",
+ "type": "u8"
+ },
+ {
+ "name": "lastAskCoin",
+ "type": "u64"
+ },
+ {
+ "name": "lastAskPc",
+ "type": "u64"
+ },
+ {
+ "name": "lastBidCoin",
+ "type": "u64"
+ },
+ {
+ "name": "lastBidPc",
+ "type": "u64"
+ },
+ {
+ "name": "version",
+ "type": "u64"
+ },
+ {
+ "name": "placedAsks",
+ "type": {
+ "array": [
+ {
+ "defined": "PlacedOrder"
+ },
+ 12
+ ]
+ }
+ },
+ {
+ "name": "placedBids",
+ "type": {
+ "array": [
+ {
+ "defined": "PlacedOrder"
+ },
+ 12
+ ]
+ }
+ },
+ {
+ "name": "pca",
+ "type": "u64"
+ },
+ {
+ "name": "ppca",
+ "type": "u64"
+ },
+ {
+ "name": "mmActive",
+ "type": "bool"
+ }
+ ]
+ }
+ }
+ ],
+ "types": [
+ {
+ "name": "PlacedOrder",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "limitPrice",
+ "type": "u64"
+ },
+ {
+ "name": "coinQty",
+ "type": "u64"
+ },
+ {
+ "name": "maxNativePcQtyIncludingFees",
+ "type": "u64"
+ },
+ {
+ "name": "clientOrderId",
+ "type": "u64"
+ }
+ ]
+ }
+ }
+ ],
+ "events": [],
+ "errors": []
+}
+ */
diff --git a/projects/augmented-finance/index.js b/projects/augmented-finance/index.js
index a849bc956e..50fd9f6676 100644
--- a/projects/augmented-finance/index.js
+++ b/projects/augmented-finance/index.js
@@ -9,7 +9,7 @@ const config = {
module.exports = {
methodology: methodologies.lendingMarket,
- // deadFrom: 2024-02-22
+ deadFrom: "2024-02-22"
};
Object.keys(config).forEach(chain => {
diff --git a/projects/augur/index.js b/projects/augur/index.js
index b04181bee3..e270d9d8d6 100644
--- a/projects/augur/index.js
+++ b/projects/augur/index.js
@@ -26,4 +26,7 @@ module.exports = {
ethereum: {
tvl,
},
+ hallmarks:[
+ [1613091600, "Election market resolves"]
+ ]
}
diff --git a/projects/aurus/index.js b/projects/aurus/index.js
new file mode 100644
index 0000000000..e7094e6b1b
--- /dev/null
+++ b/projects/aurus/index.js
@@ -0,0 +1,15 @@
+const ASSETS = [
+ '0xe4a6f23fb9e00fca037aa0ea0a6954de0a6c53bf', // TXAU - gold
+ '0x34abce75d2f8f33940c721dca0f562617787bff3', // TXAG - silver
+ '0x19b22dbadc298c359a1d1b59e35f352a2b40e33c' // TXPT - platinum
+]
+
+module.exports = {
+ methodology: "TVL corresponds to the total amount of Assets minted",
+ ethereum: {
+ tvl: async (api) => {
+ const totalSupplies = await api.multiCall({calls: ASSETS, abi: 'erc20:totalSupply'})
+ api.add(ASSETS, totalSupplies)
+ }
+ }
+}
diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js
index 578bf4a14a..47dc1ec950 100644
--- a/projects/avalon-finance/index.js
+++ b/projects/avalon-finance/index.js
@@ -4,14 +4,19 @@ const methodologies = require('../helper/methodologies')
const { mergeExports } = require('../helper/utils')
const mainMarket = {
- merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], { v3: true }),
- btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], { v3: true }),
- arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'], { v3: true }),
- bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'], { v3: true }),
+ merlin: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], {v3: true}),
+ btr: aaveExports('', '0x6aB5d5E96aC59f66baB57450275cc16961219796', undefined, ['0x5F314b36412765f3E1016632fD1Ad528929536CA'], {v3: true}),
+ arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'],{v3: true}),
+ bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'],{v3: true}),
+ core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }),
+ scroll: aaveExports('', '0xFBb77A68ee35e7902F1ABE0Bd34B263023e90c70', undefined, ['0x18cbe70602Ee17f79D56971F685E9EaF49DA53F2'], { v3: true }),
+ ethereum: aaveExports('', '0xff12470a969Dd362EB6595FFB44C82c959Fe9ACc', undefined, ['0xfabb0fDca4348d5A40EB1BB74AEa86A1C4eAd7E2'], { v3: true }),
+ mantle: aaveExports('', '0xc6517002bE432e60DEb311c2FD264aBdC7CC74F2', undefined, ['0xc8651Bc174A1f9c29dCDc0651917379d29aBE13F'], { v3: true }),
}
const innovativeMarket = {
merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'], { v3: true }),
+ btr: aaveExports('', '0x90EA8C92AddE4D3f323Dad9E36f0E0395dbc929d', undefined, ['0x4c25c261Fe47bC216113D140BaF72B05E151bcE4'], { v3: true }),
}
module.exports = mergeExports(mainMarket, innovativeMarket)
diff --git a/projects/awaken/index.js b/projects/awaken/index.js
new file mode 100644
index 0000000000..b40ea52d2c
--- /dev/null
+++ b/projects/awaken/index.js
@@ -0,0 +1,45 @@
+const { request, gql } = require("graphql-request");
+const { toUSDTBalances } = require("../helper/balances");
+
+const GRAPH_QUERY = gql`
+ query get_tvl($dto: GetTotalValueLockedDto) {
+ totalValueLocked(dto: $dto) {
+ value
+ }
+ }
+`;
+
+function getChainTvl(graphUrls) {
+ return (chain) => {
+ return async (api) => {
+ const result = await request(
+ graphUrls[chain],
+ GRAPH_QUERY,
+ {
+ dto: {
+ chainId: "tDVV",
+ timestamp: api.timestamp * 1000,
+ },
+ },
+ {
+ Accept: "*/*, application/json",
+ }
+ );
+
+ return toUSDTBalances(result.totalValueLocked.value);
+ };
+ };
+}
+
+const v2graph = getChainTvl({
+ aelf: "https://dapp.awaken.finance/AElfIndexer_Swap/SwapIndexerSchema/graphql",
+});
+
+module.exports = {
+ misrepresentedTokens: true,
+ methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'AElfIndexer_Swap' subgraph`,
+ start: 1706745600,
+ aelf: {
+ tvl: v2graph("aelf"),
+ },
+};
diff --git a/projects/ayin/index.js b/projects/ayin/index.js
index dc66dfeb53..33c05f2320 100644
--- a/projects/ayin/index.js
+++ b/projects/ayin/index.js
@@ -5,9 +5,13 @@ const Addresses = {
alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX',
alphWethPool: 'yXMFxdoKcE86W9NAyajc8Z3T3k2f5FGiHqHtuA69DYT1',
ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m',
+ alphWbtcPool: '28XY326TxvSekaAwiWDLFg2QBRfacSga8dyNJCYGUYNbq',
+ usdtUsdcPool: '27C75V9K5o9CkkGTMDQZ3x2eP82xnacraEqTYXA35Xuw5',
usdt: 'zSRgc7goAYUgYsEBYdAzogyyeKv3ne3uvWb3VDtxnaEK',
weth: 'vP6XSUyjmgWCB2B9tD5Rqun56WJqDdExWnfwZVEqzhQb',
- ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy'
+ ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy',
+ wbtc: 'xUTp3RXGJ1fJpCGqsAY6GgyfRQ3WQ1MdcYR1SiwndAbR',
+ usdc: '22Nb9JajRpAh9A2fWNgoKt867PA6zNyi541rtoraDfKXV'
}
const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3'
@@ -15,13 +19,15 @@ const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3'
const TokenIds = {
usdt: alephium.contractIdFromAddress(Addresses.usdt),
weth: alephium.contractIdFromAddress(Addresses.weth),
- ayin: alephium.contractIdFromAddress(Addresses.ayin)
+ ayin: alephium.contractIdFromAddress(Addresses.ayin),
+ wbtc: alephium.contractIdFromAddress(Addresses.wbtc),
+ usdc: alephium.contractIdFromAddress(Addresses.usdc)
}
async function ayinTvlForXAyin() {
const results = await alephium.contractMultiCall([
{ group: 0, address: XAyinAddress, methodIndex: 3 },
- { group: 0, address: XAyinAddress, methodIndex: 11}
+ { group: 0, address: XAyinAddress, methodIndex: 11 }
])
const totalSupply = results[0].returns[0].value
@@ -35,21 +41,24 @@ async function tvl() {
].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.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool, Addresses.ayinUsdtPool,
+ Addresses.alphWbtcPool, Addresses.usdtUsdcPool
].map(poolAddress => alephium.getTokensBalance(poolAddress)))
const tokensTvl = tokensTvls.reduce((res, tokenTvls) => {
tokenTvls.forEach(tokenTvl => {
- if (res[tokenTvl.tokenId] !== undefined) {
- res[tokenTvl.tokenId] = Number(res[tokenTvl.tokenId]) + Number(tokenTvl.balance)
- }
+ if (res[tokenTvl.tokenId] !== undefined) {
+ res[tokenTvl.tokenId] = Number(res[tokenTvl.tokenId]) + Number(tokenTvl.balance)
+ }
});
return res
- }, {[TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0})
+ }, { [TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0, [TokenIds.wbtc]: 0, [TokenIds.usdc]: 0 })
return {
- alephium: alphTvl / 1e18,
+ alephium: alphTvl / 1e18,
ayin: tokensTvl[TokenIds.ayin] / 1e18,
weth: tokensTvl[TokenIds.weth] / 1e18,
- tether: tokensTvl[TokenIds.usdt] / 1e6
+ tether: tokensTvl[TokenIds.usdt] / 1e6,
+ usdc: tokensTvl[TokenIds.usdc] / 1e6,
+ bitcoin: tokensTvl[TokenIds.wbtc] / 1e8
}
}
diff --git a/projects/azuro/index.js b/projects/azuro/index.js
index 300286103d..606edfa18a 100644
--- a/projects/azuro/index.js
+++ b/projects/azuro/index.js
@@ -8,6 +8,7 @@ const config = {
xdai: {
factory: '0x8ea1a7241537f10fa73363fdc6380f3fc8619c03', fromBlock: 26026402, tokensAndOwners: [[ADDRESSES.xdai.WXDAI, '0xac004b512c33D029cf23ABf04513f1f380B3FD0a']], // v1
},
+ chz: { factory: '0xC57DC3acf7834D0dc4B2F73a5fb81dD9609D347A', fromBlock: 12285532 }
}
async function tvl(api) {
@@ -17,7 +18,8 @@ async function tvl(api) {
module.exports = {
xdai: { tvl },
polygon: { tvl },
- methodology: `TVL is the total amount of WXDAI and USDC held on Liquidity pools’ smart-contracts.`
+ chz: { tvl },
+ methodology: `TVL is the total amount of WXDAI, USDC, USDT and CHZ held on Liquidity pools’ smart-contracts.`
}
Object.keys(config).forEach(chain => {
diff --git a/projects/backed/index.js b/projects/backed/index.js
index 97e5d428ba..a12f59da60 100644
--- a/projects/backed/index.js
+++ b/projects/backed/index.js
@@ -13,17 +13,22 @@ const contracts = [
"0xAde6057FcAfa57d6d51FFa341C64ce4814995995", // bZPR1
].map(i => i.toLowerCase())
+const bNVDA = "0xA34C5e0AbE843E10461E2C9586Ea03E55Dbcc495".toLowerCase() // Deployed atm only on Ethereum
+
const blacklistedOwners = [
'0x5F7A4c11bde4f218f0025Ef444c369d838ffa2aD', // working capital
'0x43624c744A4AF40754ab19b00b6f681Ca56F1E5b', // treasury/cold wallet
]
-
+
async function tvl(api) {
let tokens = [...contracts]
if (api.chain === 'base') {
tokens.push('0xC3cE78B037DDA1B966D31EC7979d3f3a38571A8E')
tokens = tokens.filter(i => i !== '0x1e2c4fb7ede391d116e6b41cd0608260e8801d59')
}
+ if (api.chain === 'ethereum') {
+ tokens.push(bNVDA)
+ }
const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens })
const balances = {}
await sumTokens2({ api, tokens, owners: blacklistedOwners, balances, transformAddress: i => i})
@@ -39,4 +44,4 @@ const chains = ["ethereum", "polygon", 'xdai', 'bsc', "avax", "fantom", "base",
chains.forEach(chain => {
module.exports[chain] = { tvl }
-})
\ No newline at end of file
+})
diff --git a/projects/backpack/index.js b/projects/backpack/index.js
index 5a3e8aa66f..f41da2a4a7 100644
--- a/projects/backpack/index.js
+++ b/projects/backpack/index.js
@@ -1,26 +1,13 @@
-const ADDRESSES = require('../helper/coreAssets.json')
const { cexExports } = require('../helper/cex')
// https://dune.com/21co/backpack-exchange
const config = {
- solana: {
- owners: [
- '43DbAvKxhXh1oSxkJSqGosNw3HpBnmsWiak6tB5wpecN',
- 'BbHG9GvPActFGogv3iNrpDAj4qpXr8t3jF16uGxXcKci'
- ],
- tokens: [
- 'hntyVP6YFm1Hg25TN9WGLqM12b8TQmcknKrdu1oxWux', // HNT
- 'jtojtomepa8beP8AuQc6eXt5FriJwfFMwQx2v2f9mCL', // JTO
- ADDRESSES.solana.USDT, // USDT
- 'HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3', // PYTH
- 'rndrizKT3MK1iimdxRdWabcF7Zg7AR5T4nud4EkHBof', // RNDR
- 'mb1eu7TzEc71KxDpsmsKoucSSuuoGLv1drys1oP2jh6', // MOBILE
- 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm', // WIF
- ADDRESSES.solana.BONK, // BONK
- ADDRESSES.solana.USDC, // USDC
- 'JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN' // JUP
- ]
- },
+ solana: {
+ owners: [
+ '43DbAvKxhXh1oSxkJSqGosNw3HpBnmsWiak6tB5wpecN',
+ 'BbHG9GvPActFGogv3iNrpDAj4qpXr8t3jF16uGxXcKci'
+ ],
+ },
}
module.exports = cexExports(config)
\ No newline at end of file
diff --git a/projects/bakerfi/index.js b/projects/bakerfi/index.js
index 2df658e5c0..11aaf5cb15 100644
--- a/projects/bakerfi/index.js
+++ b/projects/bakerfi/index.js
@@ -2,6 +2,9 @@ const config = {
"arbitrum": {
vaults: ["0x5c1b2312FaE6c0d61B6A15A8093842E9fE5b1e44"]
},
+ base: {
+ vaults: ["0x37327c99bBc522e677a97d01021dB20227faF60A"]
+ },
}
async function getVaultTVL(api, vaults) {
diff --git a/projects/balanced/helper.js b/projects/balanced/helper.js
index bd68fe5d28..68a9223e44 100644
--- a/projects/balanced/helper.js
+++ b/projects/balanced/helper.js
@@ -40,6 +40,8 @@ const networkIdentifiers = {
"0xa86a.avax": "avalanche",
"archway-1": "archway",
"injective-1/inj": "injective",
+ "0xa4b1.arbitrum": "arbitrum",
+ "0x2105.base": "base"
}
// Get decimals of cross-chain Balanced assets in balancedAssetManagerContract
@@ -71,7 +73,7 @@ async function getExternalChainDeposits() {
try {
const priceData = await call(balancedOracle, "getPriceDataInUSD", { symbol: tokenSymbol, })
const rateHex = priceData.rate
- rateDecimal = parseInt(rateHex, 16) / decimals[tokenNetworkAddress]
+ rateDecimal = parseInt(rateHex, 16) / 1e18 // price value always has 18 decimals no matter the token decimals
} catch (error) {
// console.log(
// `No price data available for ${tokenSymbol}, moving to Peg Stability pricing`
diff --git a/projects/balanced/index.js b/projects/balanced/index.js
index 9e960219da..bfa389909e 100644
--- a/projects/balanced/index.js
+++ b/projects/balanced/index.js
@@ -35,4 +35,10 @@ module.exports = {
injective: {
tvl: async () => await computeTVL("injective"),
},
+ base: {
+ tvl: async () => await computeTVL("base"),
+ },
+ arbitrum: {
+ tvl: async () => await computeTVL("arbitrum"),
+ },
};
diff --git a/projects/balancer/onchain.js b/projects/balancer/onchain.js
index 0009056f6e..33b90fd916 100644
--- a/projects/balancer/onchain.js
+++ b/projects/balancer/onchain.js
@@ -23,6 +23,8 @@ const config = {
polygon_zkevm: { fromBlock: 203079, },
base: { fromBlock: 1196036, },
avax: { fromBlock: 26386141, },
+ mode: { fromBlock: 8110317, },
+ fraxtal: { fromBlock: 4708596 }
}
module.exports = {};
diff --git a/projects/bancor/index.js b/projects/bancor/index.js
index d73bdfdd7e..835254bea2 100644
--- a/projects/bancor/index.js
+++ b/projects/bancor/index.js
@@ -1,51 +1,27 @@
-const ADDRESSES = require('../helper/coreAssets.json')
+const ADDRESSES = require('../helper/coreAssets.json');
+const { sumTokens2 } = require('../helper/unwrapLPs');
const abi = require('./abi.json');
-const sdk = require('@defillama/sdk');
-const { sumTokens } = require('../helper/unwrapLPs');
-const ethAddress = ADDRESSES.null;
-const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'];
-
-async function generateCallsByBlockchain(block) {
+async function generateCallsByBlockchain(api) {
+ const block = api.block
const registryAddress = '0x52Ae12ABe5D8BD778BD5397F99cA900624CfADD4';
const converterRegistryHex = '0x42616e636f72436f6e7665727465725265676973747279000000000000000000';
- let result;
let converterRegistryAddress;
- if (block < 9195218) {
+ if (block && block < 9195218) {
converterRegistryAddress = '0xf6E2D7F616B67E46D708e4410746E9AAb3a4C518';
}
else {
// get converter registry address
- result = await sdk.api.abi.call({
- target: registryAddress,
- abi: abi['abiContractRegistryAddressOf'],
- params: [converterRegistryHex],
- block
- });
-
- converterRegistryAddress = result.output;
+ converterRegistryAddress = await api.call({ abi: abi.abiContractRegistryAddressOf, target: registryAddress, params: [converterRegistryHex] });
}
// get pool anchor addresses
- result = await sdk.api.abi.call({
- target: converterRegistryAddress,
- abi: abi['abiConverterRegistryGetPools'],
- block
- });
-
- // get converter addresses
- result = await sdk.api.abi.call({
- target: converterRegistryAddress,
- abi: abi['abiRegistryGetConvertersBySmartTokens'],
- params: [result.output],
- block
- });
-
- // get reserve token addresses (currently limited to 2)
- const converterAddresses = result.output;
+ const poolAnchorAddresses = await api.call({ abi: abi.abiConverterRegistryGetPools, target: converterRegistryAddress });
+ const converterAddresses = await api.call({ abi: abi.abiRegistryGetConvertersBySmartTokens, target: converterRegistryAddress, params: [poolAnchorAddresses] });
const reserveTokenCalls = [];
+ const owners = [];
for (let i = 0; i < converterAddresses.length; i++) {
reserveTokenCalls.push({
target: converterAddresses[i],
@@ -55,62 +31,22 @@ async function generateCallsByBlockchain(block) {
target: converterAddresses[i],
params: [1]
});
+ owners.push(converterAddresses[i]);
+ owners.push(converterAddresses[i]);
}
- result = await sdk.api.abi.multiCall({
- calls: reserveTokenCalls,
- abi: abi['abiConverterConnectorTokens'],
- block
- });
-
- // create reserve balance calls
- const balanceCalls = [];
- for (let i = 0; i < result.output.length; i++) {
- const item = result.output[i];
- balanceCalls.push({
- target: item.output,
- params: [item.input.target]
- });
- }
-
- return balanceCalls;
-}
-
-/*==================================================
- TVL
- ==================================================*/
-
-async function tvl(timestamp, block) {
- let balanceCalls = await generateCallsByBlockchain(block);
-
- // get ETH balances
- let balances = {};
-
- const ethBalanceCalls = balanceCalls.filter((call) => ethReserveAddresses.includes(call.target.toLowerCase())).map(call => call.params[0])
- ethBalanceCalls.push('0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315')
-
-
- const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceCalls, block })
- ethBalances.forEach(bal => sdk.util.sumSingleBalance(balances, ethAddress, bal.balance))
-
- // get reserve balances
- let result = await sdk.api.abi.multiCall({
- calls: balanceCalls.filter(c => c.target.toLowerCase() !== "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE".toLowerCase()),
- abi: 'erc20:balanceOf',
- block
- });
-
- sdk.util.sumMultiBalanceOf(balances, result);
-
- return balances;
+ const tokens = await api.multiCall({ calls: reserveTokenCalls, abi: abi['abiConverterConnectorTokens'], });
+ tokens.push(ADDRESSES.null);
+ owners.push('0xc0829421C1d260BD3cB3E0F06cfE2D52db2cE315');
+ return sumTokens2({ api, tokensAndOwners2: [tokens, owners] })
}
module.exports = {
start: 1501632000, // 08/02/2017 @ 12:00am (UTC)
ethereum: {
- tvl,
+ tvl: generateCallsByBlockchain,
},
- hallmarks:[
+ hallmarks: [
[1588114800, "V2.0 Launch"], // 29/04/2020 @ 12:00am (UTC)
[1602457200, "V2.1 Launch"] // 12/10/2020 @ 12:00am (UTC)
],
diff --git a/projects/bancor/v3.js b/projects/bancor/v3.js
index 37fbea3109..266cd459a2 100644
--- a/projects/bancor/v3.js
+++ b/projects/bancor/v3.js
@@ -1,47 +1,21 @@
-const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokens2 } = require('../helper/unwrapLPs');
const abi = require('./abi.json');
-const sdk = require('@defillama/sdk');
-const { sumTokens } = require('../helper/unwrapLPs');
-const ethAddress = ADDRESSES.null;
-const ethReserveAddresses = ['0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'];
const bancor = '0x1f573d6fb3f13d689ff844b4ce37794d79a7ff1c'
-async function addV3Balance(balances, block) {
+async function addV3Balance(api) {
const masterVault = '0x649765821D9f64198c905eC0B2B037a4a52Bc373'
const networkSettings = '0xeEF417e1D5CC832e619ae18D2F140De2999dD4fB'
- const { output: tokens } = await sdk.api.abi.call({
- target: networkSettings, block, abi: abi.liquidityPools
- })
-
+ const tokens = await api.call({ abi: abi.liquidityPools, target: networkSettings})
tokens.push(bancor)
-
- const toa = tokens
- .filter(t => !ethReserveAddresses.includes(t.toLowerCase()))
- .map(t => [t, masterVault])
-
- const { output: balance } = await sdk.api.eth.getBalance({ target: masterVault, block })
- sdk.util.sumSingleBalance(balances, ethAddress, balance)
- return sumTokens(balances, toa, block)
-}
-
-/*==================================================
- TVL
- ==================================================*/
-
-async function tvl(timestamp, block) {
-
- // get ETH balances
- let balances = {};
-
- return addV3Balance(balances, block)
+ return sumTokens2({ api, owner: masterVault, tokens })
}
module.exports = {
start: 1650283200, // 18/04/2022 @ 1:00pm (UTC)
methodology: `Counts the tokens in the Master Vault Contract.`,
ethereum: {
- tvl,
+ tvl: addV3Balance,
},
hallmarks:[
[1650322800, "V3 Beta"], // 19/04/2022 @ 12:00am (UTC)
diff --git a/projects/banx/index.js b/projects/banx/index.js
index 2f87f287ba..02c5ddea41 100644
--- a/projects/banx/index.js
+++ b/projects/banx/index.js
@@ -13,7 +13,7 @@ async function getData() {
async function getAllData() {
const programId = '4tdmkuY6EStxbS6Y8s5ueznL3VPMSugrvQuDeAHGZhSt'
const provider = getProvider()
- const idl = await getConfig('banx-idl', 'https://raw.githubusercontent.com/frakt-solana/banx-public-sdk/master/src/fbond-protocol/idl/bonds.json')
+ const idl = await getConfig('banx-idl', 'https://api.banx.gg/idl')
const program = new Program(idl, programId, provider)
const bondOfferOffset = 32 + 8;
@@ -22,7 +22,7 @@ async function getData() {
bondOffers,
bondTradeTxn,
] = await Promise.all([
- getFilteredAccounts(program, 'bondOfferV2', bondOfferOffset, [5, 7,]),
+ getFilteredAccounts(program, 'bondOfferV3', bondOfferOffset, [5, 7,]),
getFilteredAccounts(program, 'bondTradeTransactionV3', bondTradeTxnOffset, [2, 6, 9]),
])
diff --git a/projects/baseline/index.js b/projects/baseline/index.js
index fa6eddf3d5..4023b2adf9 100644
--- a/projects/baseline/index.js
+++ b/projects/baseline/index.js
@@ -1,4 +1,6 @@
const BASELINE_CONTRACT = "0x14eB8d9b6e19842B5930030B18c50B0391561f27";
+const BASELINE_CONTRACT_V2 = "0x1a49351bdB4BE48C0009b661765D01ed58E8C2d8";
+const CREDT_CONTRACT = "0x158d9270F7931d0eB48Efd72E62c0E9fFfE0E67b";
async function tvl(api) {
//floor, anchor, discovery
@@ -9,19 +11,36 @@ async function tvl(api) {
//return managed positions from baseline contract
const baselinePositionBalances = await api.multiCall({ target: BASELINE_CONTRACT, calls: position.map(i => ({ params: [i], })), abi: abi.getBalancesForPosition, });
//sum the reserve balances
- api.addGasToken(baselinePositionBalances.map(i => i.reserves))
+ api.addGasToken(baselinePositionBalances.map(i => i.reserves));
+
+ //baseline V2 Positions
+ const v2Positions = await api.multiCall({ target: BASELINE_CONTRACT_V2, calls: positions, abi: v2Abi.getPosition });
+ //account for collateral now locked in protocol from borrowing activity
+
+ api.addGasToken(v2Positions.map(i => i.reserves));
}
async function borrowed(api) {
const lentReserves = await api.call({ abi: abi.totalLentReserves, target: BASELINE_CONTRACT, });
+ const lentReservesV2 = await api.call({ abi: credtAbi.totalCreditIssues, target: CREDT_CONTRACT });
api.addGasToken(lentReserves)
+ api.addGasToken(lentReservesV2)
+}
+
+async function staking(api) {
+ const v2CollateralLocked = await api.call({ target: CREDT_CONTRACT, abi: credtAbi.totalCollateralized });
+ api.add(BASELINE_CONTRACT_V2, v2CollateralLocked); // collateral deposited into protocol by EOA in exchange for a loan
}
module.exports = {
+ hallmarks: [
+ [1714251306, "self-whitehack"]
+ ],
doublecounted: true,
blast: {
tvl,
borrowed,
+ staking,
},
};
@@ -32,3 +51,12 @@ const abi = {
getBalancesForPosition:
"function getBalancesForPosition(tuple(uint8,int24,int24)) view returns (uint256 reserves, uint256 bAsset)",
};
+
+const v2Abi = {
+ getPosition: "function getPosition(uint8) view returns (tuple(uint128 liquidity, uint160 sqrtPriceL, uint160 sqrtPriceU, uint256 bAssets, uint256 reserves, uint256 capacity))",
+}
+
+const credtAbi = {
+ totalCreditIssues: "function totalCreditIssued() view returns (uint256)",
+ totalCollateralized: "function totalCollateralized() view returns (uint256)",
+}
diff --git a/projects/basin/index.js b/projects/basin/index.js
new file mode 100644
index 0000000000..f7b341d6c7
--- /dev/null
+++ b/projects/basin/index.js
@@ -0,0 +1,34 @@
+const { getLogs2 } = require('../helper/cache/getLogs');
+
+// Aquifer
+const FACTORY = "0xba51aaaa95aeefc1292515b36d86c51dc7877773";
+const BORE_WELL_ABI = "event BoreWell (address well, address implementation, address[] tokens, (address, bytes) wellFunction, (address, bytes)[] pumps, bytes wellData)";
+
+const startBlocks = {
+ ethereum: 17977905
+}
+
+function chainTvl(chain) {
+ return async (api) => {
+ // Find all BoreWell events
+ const START_BLOCK = startBlocks[chain];
+ const logs = await getLogs2({
+ api,
+ target: FACTORY,
+ fromBlock: START_BLOCK,
+ eventAbi: BORE_WELL_ABI,
+ topics: ['0xff64a5823907c85a1e7c0400576024f76bd1640c74350033bd0d689f793202f2'],
+ });
+
+ const ownerTokens = logs.map(log => [log.tokens, log.well])
+ return api.sumTokens({ ownerTokens })
+ }
+}
+
+module.exports = {
+ methodology: "Counts the value of token reserves inside all deployed Wells.",
+ start: 17977905,
+ ethereum: {
+ tvl: chainTvl('ethereum')
+ }
+};
diff --git a/projects/basis-market/index.js b/projects/basis-market/index.js
index 20c721b24e..c7846afa96 100644
--- a/projects/basis-market/index.js
+++ b/projects/basis-market/index.js
@@ -1,14 +1,11 @@
-const {getTokenAccountBalance} = require('../helper/solana')
+const {sumTokens2} = require('../helper/solana')
-const basis = "Basis9oJw9j8cw53oMV7iqsgo6ihi9ALw4QR31rcjUJa";
const basis_staking = "3sBX8hj4URsiBCSRV26fEHkake295fQnM44EYKKsSs51";
async function stakingTVL(){
- const stakedBasis = await getTokenAccountBalance(basis_staking)
- return {"basis-markets": stakedBasis}
+ return sumTokens2({tokenAccounts: [basis_staking]})
}
-
module.exports = {
methodology: `TVL for basis market is staking for now`,
solana:{
diff --git a/projects/bean/index.js b/projects/bean/index.js
index c7743075b2..c19f8559c8 100644
--- a/projects/bean/index.js
+++ b/projects/bean/index.js
@@ -1,53 +1,262 @@
-const { sumTokens } = require('../helper/unwrapLPs');
+const ADDRESSES = require('../helper/coreAssets.json')
+const BEANSTALK = "0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5";
-const BEAN_DIA_ADDR = "0xC1E088fC1323b20BCBee9bd1B9fC9546db5624C5";
+const BEAN_ERC20_V1 = "0xdc59ac4fefa32293a95889dc396682858d52e5db";
+const BEANETH_V1 = "0x87898263b6c5babe34b4ec53f22d98430b91e371";
+const BEAN3CRV_V1 = "0x3a70dfa7d2262988064a2d051dd47521e43c9bdd";
+const BEANLUSD_V1 = "0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d";
-const BEAN_TOKEN_ADDR = "0xdc59ac4fefa32293a95889dc396682858d52e5db";
-const NEW_BEAN_TOKEN_ADDR = "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab";
-const BEAN_ETH_ADDR = "0x87898263B6C5BABe34b4ec53F22d98430b91e371";
+const BEAN_ERC20 = "0xbea0000029ad1c77d3d5d23ba2d8893db9d1efab";
+const UNRIPE_BEAN_ERC20 = "0x1bea0050e63e05fbb5d8ba2f10cf5800b6224449";
+const UNRIPE_LP_ERC20 = "0x1bea3ccd22f4ebd3d37d731ba31eeca95713716d";
+const BEAN3CRV_V2 = "0xc9c32cd16bf7efb85ff14e0c8603cc90f6f2ee49";
+const BEANETH_V2 = "0xbea0e11282e2bb5893bece110cf199501e872bad";
-// To add new curve pools to the TVL:
-// add their LP token address and the number of tokens in the pool
-const BEAN_CRV_POOLS = [
- { addr: "0xD652c40fBb3f06d6B58Cb9aa9CFF063eE63d465D", numToken: 2 },
- { addr: "0x3a70DfA7d2262988064A2D051dd47521E43c9BdD", numToken: 2 },
- { addr: "0xc9C32cd16Bf7eFB85Ff14e0c8603cc90F6F2eE49", numToken: 2 }
-];
+// Underlying non-bean tokens
+const WETH = ADDRESSES.ethereum.WETH;
+const CRV3 = "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490";
+const LUSD = ADDRESSES.ethereum.LUSD;
-async function staking(time, block) {
- const balances = {};
- // add balance of siloed Beans
- await sumTokens(balances, [[NEW_BEAN_TOKEN_ADDR,BEAN_TOKEN_ADDR,],[NEW_BEAN_TOKEN_ADDR, BEAN_DIA_ADDR] ], block)
+/// REFERENCE BLOCKS TIMESTAMPS
+// Whitelist BEANETH_V1 12974075 1628288832
+// Dewhitelist BEANETH_V1 14602790 165019825s6
+// Whitelist BEAN3CRV_V1 14218934 1645038020
+// dewhitelist BEAN3CRV_V1 14602790 1650198256
+// whitelist BEANLUSD_V1 14547427 1649451979
+// dewhitelist BEANLUSD_V1 14602790 1650198256
+// EXPLOIT_BLOCK 14602790 1650198256
+// REPLANT_BLOCK 15278963 1659657966
+// whitelist BEAN3CRV_V2 15278082 1659645914
+// dewhitelist BEAN3CRV_V2 19927634 1716407627
+// whitelist BEANETH_V2 18028591 1693412759
+// dewhitelist BEANETH_V2 x
- return balances;
+const EXPLOIT_TIME = 1650198256;
+const REPLANT_TIME = 1659657966;
+const BIP12_TIME = 1645038020;
+
+// List of pools and time time periods they were valid within beanstalk
+const ALL_POOLS = {
+ [BEANETH_V1]: {
+ startTime: 1628288832,
+ endTime: EXPLOIT_TIME,
+ underlying: [BEAN_ERC20_V1, WETH]
+ },
+ [BEAN3CRV_V1]: {
+ startTime: 1645038020,
+ endTime: EXPLOIT_TIME,
+ underlying: [BEAN_ERC20_V1, CRV3]
+ },
+ [BEANLUSD_V1]: {
+ startTime: 1649451979,
+ endTime: EXPLOIT_TIME,
+ underlying: [BEAN_ERC20_V1, LUSD]
+ },
+ [BEAN3CRV_V2]: {
+ startTime: 1659645914,
+ endTime: 999999999999,
+ // endTime: 1716407627, // Dewhitelisted upon BIP-45 deployment, but some tokens are still deposited and receive yield
+ underlying: [BEAN_ERC20, CRV3]
+ },
+ [BEANETH_V2]: {
+ startTime: 1693412759,
+ endTime: 999999999999,
+ underlying: [BEAN_ERC20, WETH]
+ }
+};
+
+// Returns the relevant tokens for the given timestamp
+function getBean(timestamp) {
+ if (timestamp <= EXPLOIT_TIME) {
+ return BEAN_ERC20_V1;
+ } else if (timestamp >= REPLANT_TIME) {
+ return BEAN_ERC20;
+ }
+ throw new Error("There was no Bean token during the requested timestamp");
+}
+
+// Returns the relevant pools for the given timestamp
+function getPools(timestamp) {
+ const pools = [];
+ for (const contract in ALL_POOLS) {
+ const pool = ALL_POOLS[contract];
+ if (timestamp >= pool.startTime && timestamp <= pool.endTime) {
+ pools.push(contract);
+ }
+ }
+ return pools;
+}
+
+// Gets the total supply of the given erc20 token
+async function getTotalSupply(api, token) {
+ return await api.call({
+ abi: 'erc20:totalSupply',
+ target: token
+ });
+}
+
+// Gets the reserves (for simplicity, contract balances) of the requested pool
+async function getPoolReserves(api, pool) {
+
+ pool = pool.toLowerCase();
+ const poolBalances = await api.multiCall({
+ calls: ALL_POOLS[pool].underlying.map(token => ({
+ target: token,
+ params: pool
+ })),
+ abi: 'erc20:balanceOf'
+ });
+
+ return poolBalances.map((balance, i) => ({ token: ALL_POOLS[pool].underlying[i], balance }));
+}
+
+// Returns the total silo'd amount of the requested token
+async function getSiloDeposited(api, token) {
+
+ let result;
+ if (api.timestamp <= BIP12_TIME) {
+ // Prior to BIP12, there was no generalized deposit getter
+ result = await api.call({
+ abi:
+ token === BEAN_ERC20_V1
+ ? "function totalDepositedBeans() public view returns (uint256)"
+ : "function totalDepositedLP() public view returns (uint256)",
+ target: BEANSTALK
+ });
+ } else {
+ result = await api.call({
+ abi: "function getTotalDeposited(address) external view returns (uint256)",
+ target: BEANSTALK,
+ params: token
+ });
+ }
+ return parseInt(result);
+}
+
+/**
+ * Returns the balances of the underlying tokens in the given pools of the given ratios
+ * @param {*} api
+ * @param {string[]} pools - the pools to calculate the balances for
+ * @param {number[]} ratios - proportions of the pool underlying to credit towards the resulting balance
+ */
+async function getPooledBalances(api, pools, ratios) {
+
+ const pooledTokenBalances = {};
+
+ const poolReserves = await Promise.all(pools.map(pool => getPoolReserves(api, pool)));
+
+ for (let i = 0; i < pools.length; ++i) {
+ const reserves = poolReserves[i];
+ for (const reserve of reserves) {
+ const ratioAmount = reserve.balance * ratios[i];
+ pooledTokenBalances[reserve.token] = (pooledTokenBalances[reserve.token] ?? 0) + ratioAmount;
+ }
+ }
+ return pooledTokenBalances;
}
-async function pool2(time, block) {
- const balances = {};
+// Gets the balances associated with the ripe portion of deposited unripe tokens
+async function getRipePooledBalances(api, unripeToken) {
- // add balance of siloed BEAN:ETH from uniswap pool
- const toa = [[BEAN_ETH_ADDR, BEAN_DIA_ADDR]]
+ const ripePooledTokenBalances = {};
- // add balances of all siloed curve pools
- // this is the block when SiloV2Facet with getTotalDeposited() was introduced
- if (block >= 14218934) {
- BEAN_CRV_POOLS.forEach(i => toa.push([i.addr, BEAN_DIA_ADDR]))
+ // Gets unripe's underlying token and amounts
+ const [underlyingToken, underlyingPerUnripe, depositedUnripe] = await Promise.all([
+ api.call({
+ abi: "function getUnderlyingToken(address) external view returns (address)",
+ target: BEANSTALK,
+ params: unripeToken
+ }),
+ api.call({
+ abi: "function getUnderlyingPerUnripeToken(address) external view returns (uint256)",
+ target: BEANSTALK,
+ params: unripeToken
+ }),
+ getSiloDeposited(api, unripeToken),
+ ]);
+
+ // Add the underlying pooled token balances
+ const underlyingAmount = underlyingPerUnripe * depositedUnripe / Math.pow(10, 6);
+ if (underlyingToken.toLowerCase() == BEAN_ERC20) {
+ ripePooledTokenBalances[BEAN_ERC20] = (ripePooledTokenBalances[BEAN_ERC20] ?? 0) + underlyingAmount;
+ } else {
+ const underlyingSupply = await getTotalSupply(api, underlyingToken);
+ const ratio = underlyingAmount / underlyingSupply;
+ const balances = await getPooledBalances(api, [underlyingToken], [ratio]);
+ for (const token in balances) {
+ ripePooledTokenBalances[token] = (ripePooledTokenBalances[token] ?? 0) + balances[token];
}
+ }
+ return ripePooledTokenBalances;
+}
+
+// Beans deposited in the silo
+async function staking(api) {
+ if (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) {
+ return {};
+ }
+
+ // Bean deposits + ripe beans from unripe beans
+ const bean = getBean(api.timestamp);
+ const [siloBeans, unripeSiloBeans] = await Promise.all([
+ getSiloDeposited(api, bean),
+ getRipePooledBalances(api, UNRIPE_BEAN_ERC20)
+ ]);
+ const totalStaked = siloBeans + unripeSiloBeans[BEAN_ERC20];
+
+ return {
+ [`ethereum:${bean.toLowerCase()}`]: totalStaked
+ }
+}
+
+// Tokens in liquidity pools corresponding to lp tokens that are deposited in the silo
+async function pool2(api) {
+ if (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) {
+ return {};
+ }
+
+ // Get the amount of lp tokens deposited in the silo
+ const pools = getPools(api.timestamp);
+ const poolPromises = pools.map(pool => [
+ getSiloDeposited(api, pool),
+ getTotalSupply(api, pool)
+ ]);
+ // And determine how much of the pooled tokens correspond to those deposits
+ const flatResolved = await Promise.all(poolPromises.flat());
+ const ratios = [];
+ for (let i = 0; i < flatResolved.length; i += 2) {
+ ratios.push(flatResolved[i] / flatResolved[i + 1]);
+ }
+
+ // Gets the underlying token balances for both regular and unripe deposits
+ const balancesResults = await Promise.all([
+ getPooledBalances(api, pools, ratios),
+ getRipePooledBalances(api, UNRIPE_LP_ERC20)
+ ]);
+
+ const pool2Balances = balancesResults[0];
+ for (const token in balancesResults[1]) {
+ pool2Balances[token] = (pool2Balances[token] ?? 0) + balancesResults[1][token];
+ }
+
+ // Add chain info
+ const retval = {};
+ for (const token in pool2Balances) {
+ retval[`ethereum:${token.toLowerCase()}`] = pool2Balances[token];
+ }
+ return retval;
+}
- return sumTokens(balances, toa, block,)
-}
-
-module.exports={
- doublecounted: true,
- methodology: "Counts all beans and current LPs in the silo.",
- start: 12974077,
- ethereum: {
- tvl: async () => ({}),
- pool2,
- staking,
- },
- hallmarks: [
- [1650153600, "Governance proposal hack"],
- [1659602715, "Replant"]
- ]
-};
\ No newline at end of file
+module.exports = {
+ methodology: "Counts the value of deposited Beans and LP tokens in the silo.",
+ start: 12974077,
+ ethereum: {
+ tvl: () => ({}),
+ pool2,
+ staking
+ },
+ hallmarks: [
+ [1650153600, "Governance Exploit"],
+ [1659602715, "Replant"]
+ ]
+};
diff --git a/projects/beefy/index.js b/projects/beefy/index.js
index 0354c20680..57cd2993ee 100644
--- a/projects/beefy/index.js
+++ b/projects/beefy/index.js
@@ -39,9 +39,10 @@ const chains = {
fuse: 122,
heco: 128,
polygon: 137,
+ manta: 169,
fantom: 250,
fraxtal: 252,
- zksync: 324,
+ era: 324,
metis: 1088,
polygon_zkevm: 1101,
moonbeam: 1284,
@@ -50,6 +51,7 @@ const chains = {
mantle: 5000,
canto: 7700,
base: 8453,
+ mode: 34443,
arbitrum: 42161,
celo: 42220,
oasis: 42262,
diff --git a/projects/behodler/index.js b/projects/behodler/index.js
index 5965599a20..42234bdf24 100644
--- a/projects/behodler/index.js
+++ b/projects/behodler/index.js
@@ -1,36 +1,7 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const { request, gql } = require("graphql-request");
-const { toUSDTBalances } = require('../helper/balances');
const { sumTokensExport } = require("../helper/unwrapLPs");
-const graphUrl = 'https://api.thegraph.com/subgraphs/name/arrenv/behodler'
-const graphQuery = gql`
-query get_tvl($block: Int) {
- behodlers(
- block: { number: $block }
- ) {
- id
- usdVolume
- usdLiquidity
- }
-}
-`;
-
-async function tvl(timestamp, block) {
- const {behodlers} = await request(
- graphUrl,
- graphQuery,
- {
- block,
- }
- );
- const usdTvl = Number(behodlers[0].usdLiquidity)
-
- return toUSDTBalances(usdTvl)
-}
-
module.exports = {
- methodology: `ERC20 tokens deposited as liquidity on the AMM. You can see this on https://analytics.behodler.io/#/, pulling the data from the 'arrenv/behodler' subgraph`,
ethereum:{
tvl: sumTokensExport({
owner: '0x1B8568FbB47708E9E9D31Ff303254f748805bF21',
diff --git a/projects/beluga-protocol/index.js b/projects/beluga-protocol/index.js
index 7585ba8932..fe04945c29 100644
--- a/projects/beluga-protocol/index.js
+++ b/projects/beluga-protocol/index.js
@@ -1,27 +1,10 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokens2, } = require('../helper/solana')
-
-const tokens = {
- usdt: ADDRESSES.solana.USDT,
- usdc: ADDRESSES.solana.USDC,
-}
-
-const pools = {
- '2usd': {
- owner: '37YxD3yze3v92pFdER4X5ymUbLSmRoMP99WDgA18Gt8k',
- tokens: [tokens.usdc, tokens.usdt,],
- }
-}
-
-async function tvl() {
- const tokensAndOwners = Object.values(pools).map(({ owner, tokens}) => tokens.map(i => ([i, owner]))).flat()
- return sumTokens2({ tokensAndOwners })
-}
+const { sumTokensExport, } = require('../helper/solana')
module.exports = {
timetravel: false,
solana: {
- tvl,
+ tvl: sumTokensExport({ owner: '37YxD3yze3v92pFdER4X5ymUbLSmRoMP99WDgA18Gt8k' }),
},
+ deadFrom: '2022-11-13',
methodology: 'TVL consists of staked tokens',
}
diff --git a/projects/benqi/index.js b/projects/benqi/index.js
index 34d42abf70..91882701b7 100644
--- a/projects/benqi/index.js
+++ b/projects/benqi/index.js
@@ -1,10 +1,18 @@
-const {compoundExports} = require('../helper/compound')
-const {pool2} = require('../helper/pool2')
+const { compoundExports } = require('../helper/compound')
+const { pool2 } = require('../helper/pool2')
+const sdk = require('@defillama/sdk');
-module.exports={
- methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets",
- avax:{
- ...compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax"),
+module.exports = {
+ methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets",
+ avax: {
+ tvl: sdk.util.sumChainTvls([
+ compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax").tvl,
+ compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F", "avax").tvl,
+ ]),
+ borrowed: sdk.util.sumChainTvls([
+ compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax").borrowed,
+ compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F", "avax").borrowed,
+ ]),
pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c")
}
-}
+}
\ No newline at end of file
diff --git a/projects/betfolio/index.js b/projects/betfolio/index.js
index c328ab6abe..e321d49224 100644
--- a/projects/betfolio/index.js
+++ b/projects/betfolio/index.js
@@ -6,8 +6,11 @@ const config = {
}
async function getContracts() {
- const { data: { list } } = await getConfig('betfolio', 'https://api.betfolio.co/api/v1/user/predictionList?limit=1000&duration=&type=')
- return list.map(i => i.contract_address)
+ const [list0Res, list1Res] = await Promise.all([
+ getConfig('betfolio', 'https://api.betfolio.co/api/v1/user/predictionList?limit=1000&duration=&type='),
+ getConfig('betfolioSoloPrediction', 'https://api.betfolio.co/api/v1/user/getSoloPredictions?limit=1000&type=All&theme=All&solo_type=All')
+ ]);
+ return [...list0Res.data.list, ...list1Res.data.list].map(i => i.contract_address)
}
Object.keys(config).forEach(chain => {
diff --git a/projects/bigone/index.js b/projects/bigone/index.js
new file mode 100644
index 0000000000..08ad8d6874
--- /dev/null
+++ b/projects/bigone/index.js
@@ -0,0 +1,29 @@
+const { cexExports } = require('../helper/cex')
+
+const config = {
+ ethereum: {
+ owners: [
+ '0xd4dcd2459bb78d7a645aa7e196857d421b10d93f',
+ '0x88e343f4599292c2cffe683c1bb93cd3480bdbab',
+ '0xa30d8157911ef23c46c0eb71889efe6a648a41f7'
+ ],
+ },
+ bitcoin: {
+ owners: [
+ 'bc1qu02z43yduyjx6saeea4l54qqulvz568qnzgaes',
+ '1L5D4Eq2RkEKuN717Gc817MH1Sxs5WwMQh'
+ ]
+ },
+ solana: {
+ owners: [
+ '7BCp5XUXtKzZWYCvGR2fzFqoyKiJ7ozN8eCEHscpSMnB'
+ ]
+ },
+ tron: {
+ owners: [
+ 'TNrPUjc47JU1fgaQZPa1odQnD5RTdH3NSu'
+ ]
+ },
+}
+
+module.exports = cexExports(config)
\ No newline at end of file
diff --git a/projects/binance/config.js b/projects/binance/config.js
index abdbd461a8..4b945b4df6 100644
--- a/projects/binance/config.js
+++ b/projects/binance/config.js
@@ -22,6 +22,8 @@ const assetList = [
['ARB', 'ARB', '0xa7c0d36c4698981fab42a7d8c783674c6fe2592d'],
['ARB', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'],
['ARB', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
+ ['ARB', 'ARB', '0x25681ab599b4e2ceea31f8b498052c53fc2d74db'],
+ ['ARB', 'ARB', '0x3931dab967c3e2dbb492fe12460a66d0fe4cc857'],
['ARB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['BNB', 'BEP2', 'bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg'],
['BNB', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
@@ -49,13 +51,13 @@ const assetList = [
['BNB', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['BNB', 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'],
['BNB', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
+ ['BNB', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['BNB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
+ ['BNB', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['BNB', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['BNB', 'OPBNB', '0x001ceb373c83ae75b9f5cf78fc2aba3e185d09e2'],
['BNB', 'OPBNB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
- ['BTC', 'BEP2', 'bnb17jky4rwhu9rzgrx7exrfc3pcd5z290ga8qfm0j'],
['BTC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['BTC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['BTC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['BTC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['BTC', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -145,8 +147,6 @@ const assetList = [
['CHZ', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
['CHZ', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'],
['CHZ', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
- // ['CHZ', 'CHZ2', '0x87917d879ba83ce3ada6e02d49a10c1ec1988062'],
- // ['CHZ', 'CHZ2', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['CHZ', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['CHZ', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['CHZ', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'],
@@ -159,13 +159,13 @@ const assetList = [
['CRV', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['CVP', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['CVP', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
+ ['CVP', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['CVP', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['CVP', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['CVP', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['CVP', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['CVP', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['DOGE', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['DOGE', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['DOGE', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['DOGE', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['DOGE', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -174,6 +174,7 @@ const assetList = [
['DOGE', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['DOGE', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['DOGE', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
+ /*
['DOGE', 'DOGE', 'D73RQLGWW9TBT2AKspEP24wLiXFrXvnTqX'],
['DOGE', 'DOGE', 'D7BrtudMAdwz2U7vSGumVDuxZsZNibJuzw'],
['DOGE', 'DOGE', 'D7D2f2WuEkwhTWqBkisZ5sM3JagaBcNWBs'],
@@ -209,10 +210,10 @@ const assetList = [
['DOGE', 'DOGE', 'DRweGdMgohChLBn2TamjCNicKYEncRgj5a'],
['DOGE', 'DOGE', 'DTGrjpvJXQU2zSpUDsnk9b4PAQW5Pwtg4K'],
['DOGE', 'DOGE', 'DTSop4ycWkpmDqpncVZ3jwKp3z7B4kW4T3'],
+ ['DOGE', 'DOGE', 'DTbG3RJRejnM99g8MSnhSbJxJVW8X7YXy9'],
['DOGE', 'DOGE', 'DU8gPC5mh4KxWJARQRxoESFark2jAguBr5'],
- ['DOT', 'BEP2', 'bnb17jky4rwhu9rzgrx7exrfc3pcd5z290ga8qfm0j'],
+ */
['DOT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['DOT', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['DOT', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['DOT', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['DOT', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -230,7 +231,7 @@ const assetList = [
['DOT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['DOT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['DOT', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
- // ['ENJ', 'ENJ', 'enC1zkqfU5X4x84LMKSzcRdsSSiF7M1Nt7ovm62jRXr78uT1h'],
+ ['ENJ', 'ENJ', 'enC1zkqfU5X4x84LMKSzcRdsSSiF7M1Nt7ovm62jRXr78uT1h'],
['ENJ', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['ENJ', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['ENJ', 'ETH', '0x56eddb7aa87536c09ccc2793473599fd21a8b17f'],
@@ -245,7 +246,6 @@ const assetList = [
['ETH', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'],
['ETH', 'BASE', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['ETH', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['ETH', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['ETH', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'],
['ETH', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['ETH', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'],
@@ -255,6 +255,7 @@ const assetList = [
['ETH', 'BEP20', '0x3c783c21a0383057d128bae431894a5c19f9cf06'],
['ETH', 'BEP20', '0x515b72ed8a97f42c568d6a143232775018f133c8'],
['ETH', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
+ ['ETH', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
['ETH', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['ETH', 'BEP20', '0xa180fe01b906a1be37be6c534a3300785b20d947'],
['ETH', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
@@ -279,7 +280,7 @@ const assetList = [
['ETH', 'OP', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['ETH', 'OP', '0xacd03d601e5bb1b275bb94076ff46ed9d753435a'],
['ETH', 'OP', '0xf977814e90da44bfa03b6295a0616a897441acec'],
- ['ETH', 'STK', '0x0213c67ed78bc280887234fe5ed5e77272465317978ae86c25a71531d9332a2d'],
+ // ['ETH', 'STK', ' 0x0213c67ed78bc280887234fe5ed5e77272465317978ae86c25a71531d9332a2d'],
['ETH', 'ERA', '0x7aed074ca56f5050d5a2e512ecc5bf7103937d76'],
['ETH', 'ERA', '0xa84fd90d8640fa63d194601e0b2d1c9094297083'],
['ETH', 'ERA', '0xf977814e90da44bfa03b6295a0616a897441acec'],
@@ -287,19 +288,21 @@ const assetList = [
['FDUSD', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['FDUSD', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
['FDUSD', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
+ ['FDUSD', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['FDUSD', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
- ['FDUSD', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['FDUSD', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['FDUSD', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['FDUSD', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'],
['FDUSD', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['FDUSD', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
['FDUSD', 'ETH', '0xa7c0d36c4698981fab42a7d8c783674c6fe2592d'],
+ ['FDUSD', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['FDUSD', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['FDUSD', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['FDUSD', 'OPBNB', '0x001ceb373c83ae75b9f5cf78fc2aba3e185d09e2'],
['FDUSD', 'OPBNB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['GRT', 'ARB', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
+ ['GRT', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'],
['GRT', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['GRT', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['GRT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
@@ -318,10 +321,10 @@ const assetList = [
['HFT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['HFT', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['LINK', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['LINK', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['LINK', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['LINK', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['LINK', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
+ ['LINK', 'BEP20', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
['LINK', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['LINK', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['LINK', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
@@ -334,7 +337,6 @@ const assetList = [
['LINK', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['LINK', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['LTC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['LTC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['LTC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['LTC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['LTC', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -346,30 +348,23 @@ const assetList = [
['LTC', 'LTC', 'LbmGksLBwtwRXyxeazCZqKiAHX6cWN2AzN'],
['LTC', 'LTC', 'LhzEoDXHXASi4hSMxrKeVoSGrED9QsBpPq'],
['LTC', 'LTC', 'M8T1B2Z97gVdvmfkQcAtYbEepune1tzGua'],
- ['LTC', 'LTC', 'MB8nnFMvR5cgvpzQ1QXTDVfUM91BcsLH3k'],
- ['LTC', 'LTC', 'MBjKmoDwkuUbtnVd4vjymxjJx7Crca2s1z'],
- ['LTC', 'LTC', 'MDwD5wYdeuoisfoaWKgeHK4Gq3YkbaCypJ'],
['LTC', 'LTC', 'MEhAHYijouCinmGKL6n1bRTXYznH1X24rD'],
['LTC', 'LTC', 'MG9aFQgTH5C4UPcur8S2bh5duKYMfaJFUS'],
['LTC', 'LTC', 'MGvUTN1PuWgBxuoFgTfkk4eJDzYgRivR8F'],
['LTC', 'LTC', 'MJto5wFLrE9t4TDXCgdSet8W6mxYqGijC3'],
['LTC', 'LTC', 'MJwFHGandYUFJTTHHSXg3q6u7ge4af1n4N'],
['LTC', 'LTC', 'MLjHNHuJy8VxxPzkL2MmYNoxG8b6BH4J4R'],
- ['LTC', 'LTC', 'MLkNzCps6cXou2DELVfxDuRC4uZGwr397o'],
['LTC', 'LTC', 'MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS'],
['LTC', 'LTC', 'MSeDRiNoH5Afr9b9rNo837hYzpxBXXqMZf'],
['LTC', 'LTC', 'MWGTiJBNEQSfxTCrdC2VKEa55Lck27wr67'],
- ['LTC', 'LTC', 'MWkX1ZaFbrRPtcQvVpjvigxWU17JoinePy'],
['MASK', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['MASK', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
- ['MASK', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['MASK', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['MASK', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['MASK', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['MASK', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['MASK', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['MATIC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['MATIC', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['MATIC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['MATIC', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'],
['MATIC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
@@ -408,7 +403,6 @@ const assetList = [
['SHIB', 'BEP20', '0xdccf3b77da55107280bd850ea519df3705d1a75a'],
['SHIB', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['SHIB', 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'],
- ['SHIB', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['SHIB', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['SHIB', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['SHIB', 'ETH', '0x4976a4a02f38326660d17bf34b431dc6e2eb2327'],
@@ -438,8 +432,6 @@ const assetList = [
['SSV', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['SSV', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['SSV', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
- ['TUSD', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['TUSD', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['TUSD', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['TUSD', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['TUSD', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
@@ -451,13 +443,12 @@ const assetList = [
['TUSD', 'TRX', 'TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G'],
['TUSD', 'TRX', 'TWd4WrZ9wn84f5x1hZhL4DHvk738ns5jwb'],
['UNI', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['UNI', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['UNI', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['UNI', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
+ ['UNI', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['UNI', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['UNI', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['UNI', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
- ['UNI', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['UNI', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['UNI', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['UNI', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -472,7 +463,9 @@ const assetList = [
['USDC', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['USDC', 'AVAX', '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8'],
['USDC', 'AVAX', '0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9'],
+ ['AVAX', 'AVAX', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
['USDC', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
+ ['USDC', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['USDC', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['USDC', 'BEP20', '0x1fbe2acee135d991592f167ac371f3dd893a508b'],
['USDC', 'BEP20', '0x3c783c21a0383057d128bae431894a5c19f9cf06'],
@@ -487,14 +480,13 @@ const assetList = [
['USDC', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
['USDC', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'],
['USDC', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'],
- ['USDC', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
+ ['USDC', 'ETH', '0xbe0eb53f46cd790cd13851d5eff43d12404d33e8'],
['USDC', 'ETH', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'],
['USDC', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
- ['USDC', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['USDC', 'MATIC', '0xe7804c37c13166ff0b37f5ae0bb07a3aebb6e245'],
['USDC', 'NEAR', '5c33c6218d47e00ef229f60da78d0897e1ee9665312550b8afd5f9c7bc6957d2'],
+ ['USDC', 'NEAR', 'binancecold3.near'],
['USDC', 'OP', '0xacd03d601e5bb1b275bb94076ff46ed9d753435a'],
- // ['USDC', 'RON', '0xb32e9a84ae0b55b8ab715e4ac793a61b277bafa3'],
['USDC', 'SOL', '2ojv9BAiHUrvsm9gxDe7fJSzbNZSJcxZvf8dqmWGHG8S'],
['USDC', 'SOL', '5tzFkiKscXHK5ZXCGbXZxdw7gTjjD1mBwuoFbhUvuAi9'],
['USDC', 'SOL', '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM'],
@@ -502,15 +494,14 @@ const assetList = [
['USDC', 'TRX', 'TKoMMAMrDCUY212N6M4pzmYABtgkgo7XZn'],
['USDC', 'TRX', 'TNXoiAJ3dct8Fjg4M9fkLFh9S2v9TXc32G'],
['USDC', 'TRX', 'TVGDpgtCs45PJE7ZMHhiC76L3v77qAwJW9'],
- // ['USDC', 'XLM', 'GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA'],
- // ['USDC', 'XLM', 'GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH'],
+ ['USDC', 'XLM', 'GBAIA5U6E3FSRUW55AXACIVGX2QR5JYAS74OWLED3S22EGXVYEHPLGPA'],
+ ['USDC', 'XLM', 'GC5LF63GRVIT5ZXXCXLPI3RX2YXKJQFZVBSAO6AUELN3YIMSWPD6Z6FH'],
['USDT', 'ARB', '0xb38e8c17e38363af6ebdcb3dae12e0243582891d'],
['USDT', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['USDT', 'AVAX', '0x4aefa39caeadd662ae31ab0ce7c8c2c9c0a013e8'],
['USDT', 'AVAX', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['USDT', 'AVAX', '0x9f8c163cba728e99993abe7495f06c0a3c8ac8b9'],
['USDT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['USDT', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['USDT', 'BEP2', 'bnb1m5amny2gs3xdyta6pksmr43zu4727w24syyks7'],
['USDT', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['USDT', 'BEP2', 'bnb1xrfwzlu9c5208lhtn7ywt0mjrhjh4nt4fjyqxy'],
@@ -568,8 +559,8 @@ const assetList = [
['USDT', 'TRX', 'TYASr5UV6HEcXatwdFQfmLVUqQQQMUxHLS'],
['WRX', 'BEP2', 'bnb142q467df6jun6rt5u2ar58sp47hm5f9wvz2cvg'],
['WRX', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['WRX', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['WRX', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
+ ['WRX', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
['WRX', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'],
['WRX', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'],
['WRX', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'],
@@ -577,7 +568,6 @@ const assetList = [
['WRX', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'],
['WRX', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'],
['XRP', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'],
- ['XRP', 'BEP2', 'bnb1lsmt5a8vqqus5fwslx8pyyemgjtg4y6ugj308t'],
['XRP', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'],
['XRP', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'],
['XRP', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'],
@@ -599,18 +589,35 @@ const assetList = [
['XRP', 'XRP', 'rP3mUZyCDzZkTSd1VHoBbFt8HGm8fyq8qV'],
['XRP', 'XRP', 'rPJ5GFpyDLv7gqeB1uZVUBwDwi41kaXN5A'],
['XRP', 'XRP', 'rPz2qA93PeRCyHyFCqyNggnyycJR1N4iNf'],
+ ['XRP', 'XRP', 'rarG6FaeYhnzSKSS5EEPofo4gFsPn2bZKk'],
+ ['XRP', 'XRP', 'rfQ9EcLkU6WnNmkS3EwUkFeXeN47Rk8Cvi'],
+ ['XRP', 'XRP', 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'],
['XRP', 'XRP', 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'],
- ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'],
- // added on the 22/04/2024
- ['USDT', 'TRX', 'TJ5usJLLwjwn7Pw3TPbdzreG7dvgKzfQ5y'],
- ['TRX', 'TRX', 'TJ5usJLLwjwn7Pw3TPbdzreG7dvgKzfQ5y'],
- ['USDT', 'TRX', 'TK4ykR48cQQoyFcZ5N4xZCbsBaHcg6n3gJ'],
- ['TRX', 'TRX', 'TK4ykR48cQQoyFcZ5N4xZCbsBaHcg6n3gJ'],
- ['TRX', 'TRX', 'TCLgK89AnXbC9rewvhNb9UgXCc2qJJpBXh'],
- ['USDT', 'TRX', 'TCLgK89AnXbC9rewvhNb9UgXCc2qJJpBXh'],
- ['USDT', 'TRX', 'TJqwA7SoZnERE4zW5uDEiPkbz4B66h9TFj'],
- ['TRX', 'TRX', 'TJqwA7SoZnERE4zW5uDEiPkbz4B66h9TFj'],
-
+ ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'],
+ ['USDT', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
+ ['ETH', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'],
+ ['ETH', 'ARB', '0xf92402bb795fd7cd08fb83839689db79099c8c9c'],
+ ['AVAX', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'],
+ ['USDC', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'],
+ ['USDT', 'AVAX', '0x978b21a854dbefcd6d51dfd269875d158046240b'],
+ ['AVAX', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'],
+ ['USDC', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'],
+ ['USDT', 'AVAX', '0xcddc5d0ebeb71a08fff26909aa6c0d4e256b4fe1'],
+ ['AVAX', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'],
+ ['USDC', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'],
+ ['USDT', 'AVAX', '0x6d8be5cdf0d7dee1f04e25fd70b001ae3b907824'],
+ ['AVAX', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'],
+ ['USDC', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'],
+ ['USDT', 'AVAX', '0x3bce63c6c9abf7a47f52c9a3a7950867700b0158'],
+ ['AVAX', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'],
+ ['USDC', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'],
+ ['USDT', 'AVAX', '0xaba2d404c5c41da5964453a368aff2604ae80a14'],
+ ['ETH', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'],
+ ['USDC', 'BASE', '0x3304e22ddaa22bcdc5fca2269b418046ae7b566a'],
+ ['ETH', 'ETH', '0x1b46970cfe6a271e884f636663c257a5a571fb2c'],
+ ['MATIC', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'],
+ ['USDT', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'],
+ ['USDT', 'TRX', 'TRGCqsUXeynKTgynp2j9g3sg7Nux2KtB3u'],
]
function getAddresses(chain) {
@@ -697,7 +704,9 @@ module.exports = {
near: {
owners: getOwners('NEAR')
},
+ /*
doge: {
owners: getOwners('DOGE')
},
+ */
}
\ No newline at end of file
diff --git a/projects/bing-cex/index.js b/projects/bing-cex/index.js
new file mode 100644
index 0000000000..103fb69b2e
--- /dev/null
+++ b/projects/bing-cex/index.js
@@ -0,0 +1,44 @@
+const { cexExports } = require('../helper/cex')
+
+const config = {
+ bitcoin: {
+ owners: [
+ 'bc1qr8e6kmev99jxnk7hpyhex434t59ke5tpvmnyd3',
+ 'bc1qzzn5tszxn3ha87xfke540k8pr4favsk9cusakq'
+ ]
+ },
+ arbitrum: {
+ owners: [
+ '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8',
+ ]
+ },
+ bsc: {
+ owners: [
+ '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8',
+ ]
+ },
+ ethereum: {
+ owners: [
+ '0xd3D3a295bE556Cf8cef2a7FF4cda23D22c4627E8',
+ '0x909C1c195FC0a31758C7169B321B707C9F44886B',
+ '0xF7b7775f6D31eC2d14984f1cA3e736F5FB896DA2',
+ '0xAd8E5cEb7D77e10403Be8430717c515273c31b8d',
+ '0x74E7Fd0b532f88cf8cC50922F7a8f51e3F320Fa7',
+ '0xA1195F0d9B010F86633E1553F1286d74F80eF52B',
+ ]
+ },
+ tron: {
+ owners: [
+ 'TC8WxPjG7VDdeCK2FriRZwiPTFBayS9PHy',
+ 'TB1xcvdYDgWwqzCvVJV6mKxSdjjq8pvwRn',
+ 'TSCC14Y9nxdL4kLfbqwaUw2rX32n1sUpzB'
+ ]
+ },
+ ripple: {
+ owners: [
+ 'rsbENGVE1pXuM6AQT3VQweLhYdsxR6ZESj'
+ ]
+ },
+}
+
+module.exports = cexExports(config)
\ No newline at end of file
diff --git a/projects/binlayer/index.js b/projects/binlayer/index.js
new file mode 100644
index 0000000000..ce82ce2927
--- /dev/null
+++ b/projects/binlayer/index.js
@@ -0,0 +1,15 @@
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const { getConfig } = require('../helper/cache')
+
+const chains = ['bsc']
+
+chains.forEach(chain => {
+ module.exports[chain] = {
+ tvl: async function (api) {
+ const { result } = await getConfig(`binlayer/${api.chain}`, `https://api.binlayer.xyz/v1/stakeList?chainId=${api.chainId}`)
+ const vaults = result.map(f => f.strategyAddress)
+ const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: vaults })
+ return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], })
+ }
+ }
+})
diff --git a/projects/bishares/config.js b/projects/bishares/config.js
index ea8301d2b2..d62ab01cdd 100644
--- a/projects/bishares/config.js
+++ b/projects/bishares/config.js
@@ -1,8 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
// data taken from
-// https://api.thegraph.com/subgraphs/name/toffick/bisharesfunds
-// https://api.thegraph.com/subgraphs/name/bisharesindexfund/bisharesfunds-ybf-fantom
-// https://api.thegraph.com/subgraphs/name/toffick/bisharesfunds-fantom
module.exports = {
toa: {
diff --git a/projects/bit-reserve/index.js b/projects/bit-reserve/index.js
index 10191c1208..580a2ea6a9 100644
--- a/projects/bit-reserve/index.js
+++ b/projects/bit-reserve/index.js
@@ -1,4 +1,4 @@
-const rBTC_CONTRACT = '0xBf4df43f72d27a7b1D2fC295aeca58e0853f922F';
+const rBTC_CONTRACT = '0x473286faD076c050FB48a449c77d7434d947cE00';
async function tvl(api) {
const tokens = await api.fetchList({ lengthAbi: 'approvedTokens', itemAbi: 'approvedRestakedLSTs', target: rBTC_CONTRACT })
@@ -11,4 +11,4 @@ module.exports = {
core: {
tvl
}
-}
\ No newline at end of file
+}
diff --git a/projects/bitfi/index.js b/projects/bitfi/index.js
new file mode 100644
index 0000000000..4421b9d984
--- /dev/null
+++ b/projects/bitfi/index.js
@@ -0,0 +1,31 @@
+const sdk = require('@defillama/sdk');
+const { sumTokensExport } = require('../helper/sumTokens');
+
+const owners = [
+'1JA46eiDpfx589wawn5RvtEXgwc518QfhZ',
+'368vZZKUWDFZRLWMFNRJzHo1HnibNeAJir',
+'33hE9Wq65kjbiLsGD1NYwwNatP6hbsZv5H',
+'32GU8Jux7SbsEbaAaLUnEQmc6JemLF6BUb',
+'3CP5WJ2JSLCew7SETWUe5FxpBGrekMBiwk',
+'39Fvw2Ho1fEkyDsos5sNTN5iMJZKzTL526',
+'3Kptt4TZZRcjuGH8ikoQ8mV1TVxq45dnuS',
+'335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei',
+'3G4sMXWAAVTvTXTksr8u9zuu7W8RKsicEz',
+'bc1qu4ru2sph5jatscx5xuf0ttka36yvuql7hl5h4c',
+'bc1q3smt9ut40eld6tgn42sdlp9yrx98s90unqw3pl',
+'bc1q3q7afjarz7l6v49538qs2prffhtawf38ss85k8',
+'bc1qw4vp94e9egkaxc04qsu5z9aq5pqpku2p6pzer8',
+'bc1qqg3cdyadq25zn99sdprr4lgpsxg2za998eygy8',
+'bc1q6dtp7ayaj5k2zv0z5ayhkdsvmtvdqgyaa9zs53',
+'bc1qaajdlp5yrj5f77wq2ndtfqnmsamvvxhpy95662zkzykn9qhvdgys580hcs',
+'bc1qcmmkxfp2rawrp6yx55rez9jcqdnxtam8jhu2v2d9kz46upf948wq2usauv',
+]
+
+module.exports = {
+ methodology: "BTC on btc chain",
+ bitcoin: {
+ tvl: sdk.util.sumChainTvls([
+ sumTokensExport({ owners }),
+ ]),
+ },
+};
diff --git a/projects/bitflow/index.js b/projects/bitflow/index.js
index e593034ac1..16de10f164 100644
--- a/projects/bitflow/index.js
+++ b/projects/bitflow/index.js
@@ -9,6 +9,8 @@ const PAIRS = [
`${BITFLOW_ADDRESS}.stableswap-abtc-xbtc-v-1-2`,
`${BITFLOW_ADDRESS}.stableswap-aeusdc-susdt-v-1-2`,
`${BITFLOW_ADDRESS}.stableswap-usda-aeusdc-v-1-2`,
+ `${BITFLOW_ADDRESS}.stableswap-usda-aeusdc-v-1-4`,
+ `SM1793C4R5PZ4NS4VQ4WMP7SKKYVH8JZEWSZ9HCCR.xyk-pool-stx-aeusdc-v-1-1`,
];
module.exports = {
diff --git a/projects/bitgenie/index.js b/projects/bitgenie/index.js
index 8653bd7faf..94c85ffa80 100644
--- a/projects/bitgenie/index.js
+++ b/projects/bitgenie/index.js
@@ -12,6 +12,10 @@ const stakingContracts = [
"0x0b0659bC906cB62179FDD2B6008BA729baa79126",
"0xF57A28168401f9c386c7723C2BA4e579A2F3818a",
"0x82cf7644BD07002217EFB2563D361a0b0c245978",
+ "0x8Ab52b92C31bd16e9e091c42FaCA01358717b8A4",
+ "0x0Bf2C32E2045b50AD772E8F758484aF3BbA75738",
+ "0xeC986eE93884ca3e20AA8a11C72f5c57085893F3",
+ "0xFf090ED319D3B89DD3ee2CB94F590272A6866cD9",
];
diff --git a/projects/bitget/index.js b/projects/bitget/index.js
index 54b01f512a..82a4da501b 100644
--- a/projects/bitget/index.js
+++ b/projects/bitget/index.js
@@ -31,6 +31,17 @@ const config = {
'0x842ea89f73add9e4fe963ae7929fdc1e80acdb52', //add on 12/01/2024
'0x1a96e5da1315efcf9b75100f5757d5e8b76abb0c', //add on 12/01/2024
'0x4dfc15890972ecea7a213bda2b478dabc382e7a1', //add on 12/01/2024
+ '0x70213959a644baa94840bbfb4129550bceceb3c2', // add on 27/05/2024
+ '0x54a679e853281a440911f72eae0e24107e9413dc', // add on 27/05/2024
+ '0x1ab4973a48dc892cd9971ece8e01dcc7688f8f23', // add on 27/05/2024
+ '0x0edd5b0de0fe748be331186bf0aa878f47f601db', // add on 27/05/2024
+ '0x4121217c238db06e942f3d87371106d30d0f8c84', // add on 27/05/2024
+ '0xed470553f61f23cd30ccf51ab066dc1598ed0c4f', // add on 27/05/2024
+ '0x59708733fbbf64378d9293ec56b977c011a08fd2', // add on 27/05/2024
+ '0xaab0039de2a8dba8696ee4d42c0d1aa30d7e1059', // add on 27/05/2024
+ '0xf207b2f9f9417fc73cad069f7aa5ae1c6a5b428d', // add on 27/05/2024
+ '0x4d216d2682f3997f6c19420beee4530d08d0ea5f', // add on 27/05/2024
+ '0xdbe46a02322e636b92296954637e1d7db9d5ed26', // add on 27/05/2024
]
},
tron: {
@@ -46,6 +57,10 @@ const config = {
'TBM2FK4KBEEsMVYjm4WAW2Q8Es2NKdmUB8', //add on 12/01/2024
'TCvfZC9h6fFXnF7KbHPgY4jgfen93VkfVW', //add on 12/01/2024
'TGp7SNzjrctsWNwaFFN2PNTh3b1Kgxdtib', //add on 12/01/2024
+ 'TBpo1Sh7vKCLrfxocZHd8CA5wc2R75kSJM', // add on 27/05/2024
+ 'TMauqkA78pfysSTn8jD1dvEUkjme2gEEdn', // add on 27/05/2024
+ 'TKPqvBMU2v23RyjjViKvp16kiHPx7FnrHQ', // add on 27/05/2024
+ 'TVSdtELybCCa9DPDH15CMAPjeRcENAmDJZ', // add on 27/05/2024
]
},
bitcoin: {
@@ -56,6 +71,12 @@ const config = {
'3HcSp9sR23w6MxeRrLqqyDzLqThtSMaypQ',
'3MdofQ2ouxom9MzC9kKazGUShoL5R3cVLG',
'3Jxc4zsvEruEVAFpvwj818TfZXq5y2DLyF', //add on 12/01/2024
+ '3KUwtHc5UhWQ76z6WrZRQHHVTZMuUWiZcU', // add on 27/05/2024
+ '3H6JnFoz5jcoATKQ83BuQ3cUUCHswqfgtG', // add on 27/05/2024
+ '3AZHcgLnJL5C5xKo33mspyHpQX7x4H5bBw', // add on 27/05/2024
+ '3DSST4myyyRbiGzgCBE1RVHY7GRjDCh4n9', // add on 27/05/2024
+ '3Nu84pbqfcfaFztQ74qc9ni2PH5HGM1bzS', // add on 27/05/2024
+ '34hatYbZ27CLLoZWhuJHzBgoTCwXEv8GwT', // add on 27/05/2024
]
},
arbitrum: {
diff --git a/projects/bitindi-dex/index.js b/projects/bitindi-dex/index.js
index 1361308727..f2d20355d2 100644
--- a/projects/bitindi-dex/index.js
+++ b/projects/bitindi-dex/index.js
@@ -1,5 +1,4 @@
const { uniTvlExport } = require('../helper/unknownTokens')
module.exports = uniTvlExport('bitindi', '0x87cef801D44D6eDa8106087e7676153c30e36950', true)
module.exports.bitindi.tvl = () => ({})
-
- // deadFrom: '2023-12-20',
\ No newline at end of file
+module.exports.deadFrom = '2023-12-20'
\ No newline at end of file
diff --git a/projects/bitindi/index.js b/projects/bitindi/index.js
index 1f778d8611..934a9979f1 100644
--- a/projects/bitindi/index.js
+++ b/projects/bitindi/index.js
@@ -1,4 +1,3 @@
-const ADDRESSES = require('../helper/coreAssets.json')
const { staking } = require('../helper/staking')
module.exports = {
@@ -11,5 +10,5 @@ module.exports = {
staking: () => ({}),
// staking: staking('0x140c312c8841B0a7152946C0Bc2BD343bA51bbcc', ADDRESSES.bitindi.WBNI),
},
- // deadFrom: '2023-12-20',
+ deadFrom: '2023-12-20',
};
diff --git a/projects/bitlen/index.js b/projects/bitlen/index.js
index 89c4c904d9..418bdaf206 100644
--- a/projects/bitlen/index.js
+++ b/projects/bitlen/index.js
@@ -3,19 +3,21 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
const WBTC_POOL = '0x6996c446b1bfb8cc2ef7a4bc32979de613bcefe1';
const USDT_POOL = '0xad9b8b6c60ca112ab10670d87d53e6ff86ec3c2a';
const USDC_POOL = '0x779bddc3cBc62617093CB1E27436C78DA015508E';
+const UBTC_POOL = '0xfAa5376d7A04cb111d5a1601CB083408c167d299'
const CORE_POOL = '0xfE345fF60ACB262848FBf3Cb11bf5811c8293Aa9';
const COREBTC_POOL = '0x95fBbAf7Ad1DB1Ee6D1Ee2ea9ddca2cda23af832';
const CORE_USDT_POOL = '0xeC225F71C065E2abD06C5C69BF0FB06C857E46cB';
const CORE_USDC_POOL = '0x514C4876e239a248dD6d40F54491Cc1C7b2D044A';
+const CORE_ABTC_POOL = '0xeC81EBCEb627120FeF942e53587940277f764E93'
const config = {
bsquared: {
- pools: [WBTC_POOL, USDT_POOL, USDC_POOL,]
+ pools: [WBTC_POOL, USDT_POOL, USDC_POOL,UBTC_POOL]
},
core: {
- pools: [CORE_POOL, COREBTC_POOL, CORE_USDT_POOL, CORE_USDC_POOL]
+ pools: [CORE_POOL, COREBTC_POOL, CORE_USDT_POOL, CORE_USDC_POOL, CORE_ABTC_POOL]
}
}
diff --git a/projects/bitparty/index.js b/projects/bitparty/index.js
new file mode 100644
index 0000000000..c5a0a6e70a
--- /dev/null
+++ b/projects/bitparty/index.js
@@ -0,0 +1,25 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
+
+module.exports = {
+ btr: {
+ tvl: sumTokensExport({
+ owners: ['0xb002b938d63fe8762f2a0eff9e49a8e20a0078e8',],
+ tokens: [
+ nullAddress,
+ ADDRESSES.btr.ETH,
+ '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2',
+ '0x9827431e8b77e87c9894bd50b055d6be56be0030',
+ '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F',
+ '0x07373d112edc4570b46996ad1187bc4ac9fb5ed0',
+ '0x2729868df87d062020e4a4867ff507fb52ee697c',
+ '0x68879ca2af24941fc3b6eb89fdb26a98aa001fc1',
+ '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3',
+ '0xe277aed3ff3eb9824edc52fe7703df0c5ed8b313',
+ '0xf6fa83e30c7d3978f86141016ee9471d77f48ae0',
+ '0xbb0cb5c5e49d5c3903932d07831fb8c1bb1651d2',
+ '0xab7f136bbb18808f0c981d0307d3360ca92ad171'
+ ],
+ }),
+ }
+}
diff --git a/projects/bitswap/index.js b/projects/bitswap/index.js
deleted file mode 100644
index b3b7004b20..0000000000
--- a/projects/bitswap/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const { getUniTVL } = require("../helper/unknownTokens")
-
-module.exports={
- misrepresentedTokens: true,
- bitchain:{
- tvl: getUniTVL({ useDefaultCoreAssets: true, factory: '0x357F77c780c3423d62c203B72383C77A58a92a4F' }),
- },
-}
\ No newline at end of file
diff --git a/projects/bitu/index.js b/projects/bitu/index.js
new file mode 100644
index 0000000000..1e7f88e794
--- /dev/null
+++ b/projects/bitu/index.js
@@ -0,0 +1,55 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+const { request, gql } = require("graphql-request");
+const BigNumber = require("bignumber.js");
+const { sumUnknownTokens } = require("../helper/unknownTokens");
+
+const graphUrl = "https://api.studio.thegraph.com/query/70783/bitu-protocol/version/latest";
+const graphQuery = gql`
+ query GET_COLLAERTAL_ASSETS {
+ collateralAssets(first: 100) {
+ id
+ symbol
+ name
+ decimals
+ totalValueLocked
+ bituLiquidated
+ }
+ }
+`;
+
+const USDT = ADDRESSES.bsc.USDT;
+
+module.exports = {
+ bsc: {
+ tvl: async (api) => {
+ const { collateralAssets } = await request(graphUrl, graphQuery);
+
+ let liquidated = new BigNumber(0);
+
+ for (const item of collateralAssets) {
+ if (item.id.toLocaleLowerCase() !== USDT.toLocaleLowerCase()) liquidated = liquidated.plus(item.bituLiquidated);
+ }
+
+ const nativeToken = collateralAssets.find((p) => p.id === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee");
+
+ const erc20Tokens = collateralAssets
+ .filter((p) => p.id !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
+ .map((p) => {
+ if (p.id.toLocaleLowerCase() === USDT.toLocaleLowerCase()) {
+ p.totalValueLocked = liquidated.plus(p.totalValueLocked).multipliedBy(Math.pow(10, p.decimals)).toString();
+ } else {
+ p.totalValueLocked = new BigNumber(p.totalValueLocked).multipliedBy(Math.pow(10, p.decimals)).toString();
+ }
+
+ return p;
+ });
+ api.addTokens(
+ erc20Tokens.map((p) => p.id),
+ erc20Tokens.map((p) => p.totalValueLocked)
+ );
+ if (nativeToken) {
+ api.add("coingecko:binancecoin", parseInt(nativeToken.totalValueLocked), { skipChain: true });
+ }
+ },
+ },
+};
diff --git a/projects/blackwing/index.js b/projects/blackwing/index.js
index a3e6beeefd..f2fc33008e 100644
--- a/projects/blackwing/index.js
+++ b/projects/blackwing/index.js
@@ -17,7 +17,6 @@ const ETHEREUM_MAINNET_RSETH = "0xa1290d69c65a6fe4df752f95823fae25cb99e5a7";
const ETHEREUM_MAINNET_WEETH = "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee";
const ETHEREUM_MAINNET_EZETH = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110";
-
const ETHEREUM_MAINNET_PENDLE_RSWETH_27JUN2024 = "0x5cb12D56F5346a016DBBA8CA90635d82e6D1bcEa";
const ETHEREUM_MAINNET_PT_EZETH_26DEC2024 = "0xf7906f274c174a52d444175729e3fa98f9bde285";
const ETHEREUM_MAINNET_PT_RSETH_27JUN2024 = "0xb05cabcd99cf9a73b19805edefc5f67ca5d1895e";
@@ -28,6 +27,14 @@ const ETHEREUM_MAINNET_PT_SUSDE_25JUL2024 = "0xd810362556296c834e30c9a61d8e21a5c
const ETHEREUM_MAINNET_PT_WEETH_26DEC2024 = "0x6ee2b5e19ecba773a352e5b21415dc419a700d1d";
const ETHEREUM_MAINNET_PT_WEETH_27JUN2024 = "0xc69ad9bab1dee23f4605a82b3354f8e40d1e5966";
+const ETHEREUM_MAINNET_SHIB_ADDRESS = ADDRESSES.ethereum.INU;
+const ETHEREUM_MAINNET_PEPE_ADDRESS = "0x6982508145454Ce325dDbE47a25d4ec3d2311933";
+const ETHEREUM_MAINNET_EGETH_ADDRESS = "0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9";
+const ETHEREUM_MAINNET_PUFETH_ADDRESS = "0xD9A442856C234a39a81a089C06451EBAa4306a72";
+const ETHEREUM_MAINNET_MSTETH_ADDRESS = "0x49446A0874197839D15395B908328a74ccc96Bc0";
+const ETHEREUM_MAINNET_APXETH_ADDRESS = "0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6";
+const ETHEREUM_MAINNET_MSWETH_ADDRESS = "0x32bd822d615A3658A68b6fDD30c2fcb2C996D678";
+
module.exports = {
arbitrum: {
tvl: sumTokensExport({ tokens: [
@@ -63,6 +70,13 @@ module.exports = {
ETHEREUM_MAINNET_PT_SUSDE_25JUL2024,
ETHEREUM_MAINNET_PT_WEETH_26DEC2024,
ETHEREUM_MAINNET_PT_WEETH_27JUN2024,
+ ETHEREUM_MAINNET_SHIB_ADDRESS,
+ ETHEREUM_MAINNET_PEPE_ADDRESS,
+ ETHEREUM_MAINNET_EGETH_ADDRESS,
+ ETHEREUM_MAINNET_PUFETH_ADDRESS,
+ ETHEREUM_MAINNET_MSTETH_ADDRESS,
+ ETHEREUM_MAINNET_APXETH_ADDRESS,
+ ETHEREUM_MAINNET_MSWETH_ADDRESS
], owner: BLACKWING_VAULT_ETH, fetchCoValentTokens: true,
})
},
@@ -70,7 +84,8 @@ module.exports = {
tvl: sumTokensExport({
tokens: [
ADDRESSES.bsc.USDT,
- ADDRESSES.bsc.WBNB],
+ ADDRESSES.bsc.WBNB
+ ],
owner: BLACKWING_VAULT_BSC, fetchCoValentTokens: true,
})
}
diff --git a/projects/bladeswap-CL/index.js b/projects/bladeswap-CL/index.js
new file mode 100644
index 0000000000..b5dec6bc44
--- /dev/null
+++ b/projects/bladeswap-CL/index.js
@@ -0,0 +1,14 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ blast: {
+ factory: "0xA87DbF5082Af26c9A6Ab2B854E378f704638CCa5",
+ fromBlock: 4466565,
+ isAlgebra: true,
+ blacklistedTokens: [
+ '0xD1FedD031b92f50a50c05E2C45aF1aDb4CEa82f4',
+ '0xF8f2ab7C84CDB6CCaF1F699eB54Ba30C36B95d85',
+ ]
+
+ },
+});
diff --git a/projects/blasterswap-v3/index.js b/projects/blasterswap-v3/index.js
new file mode 100644
index 0000000000..e741dead56
--- /dev/null
+++ b/projects/blasterswap-v3/index.js
@@ -0,0 +1,9 @@
+const sdk = require('@defillama/sdk')
+const { uniV3Export } = require("../helper/uniswapV3");
+const { mergeExports } = require('../helper/utils')
+
+module.exports = mergeExports([
+ uniV3Export({ blast: { factory: "0x1A8027625C830aAC43aD82a3f7cD6D5fdCE89d78", fromBlock: 4308657, }, }),
+])
+
+module.exports.blast.tvl = sdk.util.sumChainTvls([module.exports.blast.tvl])
diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js
new file mode 100644
index 0000000000..8bde49169e
--- /dev/null
+++ b/projects/blasterswap-vaults/index.js
@@ -0,0 +1,11 @@
+const { staking } = require("../helper/staking.js");
+
+const vaults = ['0xC52fb7E613e401a0195C2fdB369618580D58C91D', '0x013249266842e078999088807033D80531A84260'];
+const tokens = ['0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcAB044c0f0a26A45Cb62fa29c06'];
+
+module.exports = {
+ blast: {
+ tvl: staking('0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad'),
+ staking: staking(vaults, tokens)
+ },
+}
diff --git a/projects/blastoff/index.js b/projects/blastoff/index.js
index 82fc8af05e..3a253451e7 100644
--- a/projects/blastoff/index.js
+++ b/projects/blastoff/index.js
@@ -1,5 +1,6 @@
const { sumTokensExport } = require('../helper/unwrapLPs')
const ADDRESSES = require('../helper/coreAssets.json')
+const { staking } = require('../helper/staking')
const LOCKED_STAKING = "0xd95773e5b1eedc7ff302a70acd0eb370927397d2";
const NONLOCK_STAKING = "0xd9747a98624f0B64B4412632C420672E16432334";
@@ -7,6 +8,7 @@ const NONLOCK_STAKING = "0xd9747a98624f0B64B4412632C420672E16432334";
module.exports = {
blast: {
tvl: sumTokensExport({ owners: [LOCKED_STAKING, NONLOCK_STAKING], tokens: [ADDRESSES.null, ADDRESSES.blast.USDB] }),
+ staking: staking('0xC9B6c67af496E92F64b1C136B3FaD15e3b02cbb4', '0xD55eDfc79c0d14084260D16f38BdA75e28AbFb6A')
},
methodology: "counts the amount of USDB and ETH locked in 2 staking contracts",
};
diff --git a/projects/blastup/index.js b/projects/blastup/index.js
new file mode 100644
index 0000000000..a44fce37bd
--- /dev/null
+++ b/projects/blastup/index.js
@@ -0,0 +1,10 @@
+const { staking } = require("../helper/staking")
+const stakingpool = "0x0E84461a00C661A18e00Cab8888d146FDe10Da8D"
+
+const ADDRESSES = require("../helper/coreAssets.json")
+
+module.exports = {
+ blast: {
+ tvl: staking(stakingpool, [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]),
+ },
+}
diff --git a/projects/blazestake/index.js b/projects/blazestake/index.js
index 44d2d23bee..f5d6c79208 100644
--- a/projects/blazestake/index.js
+++ b/projects/blazestake/index.js
@@ -1,14 +1,12 @@
-const { getTokenSupply } = require("../helper/solana")
+const { getStakedSol } = require("../helper/solana")
async function tvl(api) {
- const bSOL = 'bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1'
- const supply = await getTokenSupply(bSOL)
- api.add(bSOL, supply * 1e9)
+ // https://stake-docs.solblaze.org/developers/addresses
+ await getStakedSol('6WecYymEARvjG5ZyqkrVQ6YkhPfujNzWpSPwNKXHCbV2', api)
}
module.exports = {
timetravel: false,
- methodology: "bSOL total supply as it's equal to the SOL staked",
solana: {
tvl
},
diff --git a/projects/blend-backstop/api.js b/projects/blend-backstop/api.js
new file mode 100644
index 0000000000..7bb971541e
--- /dev/null
+++ b/projects/blend-backstop/api.js
@@ -0,0 +1,30 @@
+const { BackstopConfig, BackstopToken } = require("@blend-capital/blend-sdk");
+
+const BACKSTOP_ID = "CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3";
+
+const network = {
+ rpc: "https://soroban-rpc.creit.tech/",
+ passphrase: "Public Global Stellar Network ; September 2015",
+};
+
+async function tvl(api) {
+ let backstop = await BackstopConfig.load(network, BACKSTOP_ID);
+ let backstop_token = await BackstopToken.load(
+ network,
+ backstop.backstopTkn,
+ backstop.blndTkn,
+ backstop.usdcTkn
+ );
+
+ // backstop token is a 80% BLND 20% USDC Comet pool (Balancer v1 fork)
+ // since BLND has no coingecko price, use USDC held in LP shares by the
+ // backstop to approximate total USDC held
+ api.addCGToken("usd-coin", (Number(backstop_token.usdc) / 1e7) * 5);
+ return api.getBalances();
+}
+
+module.exports = {
+ stellar: {
+ tvl,
+ },
+};
diff --git a/projects/blend-backstop/index.js b/projects/blend-backstop/index.js
new file mode 100644
index 0000000000..2d3fc4f32d
--- /dev/null
+++ b/projects/blend-backstop/index.js
@@ -0,0 +1,8 @@
+const { getExports } = require("../helper/heroku-api");
+
+module.exports = {
+ timetravel: false,
+ misrepresentedTokens: true,
+ methodology: `Counts the total amount of BLND-USDC LP shares held by the Blend backstop contract. The shares are converted to a USDC value based on the liquidity pool weights.`,
+ ...getExports("blend-backstop", ['stellar'])
+};
diff --git a/projects/blend-pools/api.js b/projects/blend-pools/api.js
new file mode 100644
index 0000000000..fa85d3cb59
--- /dev/null
+++ b/projects/blend-pools/api.js
@@ -0,0 +1,60 @@
+const {
+ PoolConfig,
+ ReserveData,
+ BackstopConfig,
+} = require("@blend-capital/blend-sdk");
+const { PromisePool } = require("@supercharge/promise-pool");
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+const BACKSTOP_ID = "CAO3AGAMZVRMHITL36EJ2VZQWKYRPWMQAPDQD5YEOF3GIF7T44U4JAL3";
+
+const network = {
+ rpc: "https://soroban-rpc.creit.tech/",
+ passphrase: "Public Global Stellar Network ; September 2015",
+};
+
+async function getReserveDeposits(poolId, reserveId, isBorrowed = false) {
+ const data = await ReserveData.load(network, poolId, reserveId)
+ const rate = Number(data.bRate) / 1e9
+ const supply = Number(data.bSupply)
+ const borrowed = Number(data.dSupply)
+ if (isBorrowed)
+ return borrowed * rate
+ return (supply - borrowed) * rate
+}
+
+
+async function addPoolTVL(poolId, api, isBorrowed = false) {
+ let pool_config = await PoolConfig.load(network, poolId);
+ const { errors } = await PromisePool.withConcurrency(4)
+ .for(pool_config.reserveList)
+ .process(async (reserveId) => {
+ // pools have unique reserves
+ let pool_deposit = await getReserveDeposits(poolId, reserveId, isBorrowed);
+ api.add(reserveId, pool_deposit)
+ });
+ if (errors.length > 0)
+ throw new Error(errors)
+}
+
+async function tvl(api) {
+ let backstop = await BackstopConfig.load(network, BACKSTOP_ID);
+ for (const pool of backstop.rewardZone)
+ await addPoolTVL(pool, api);
+
+ return sumTokens2({ api })
+}
+
+async function borrowed(api) {
+ let backstop = await BackstopConfig.load(network, BACKSTOP_ID);
+ for (const pool of backstop.rewardZone)
+ await addPoolTVL(pool, api, true);
+
+ return sumTokens2({ api })
+}
+
+module.exports = {
+ stellar: {
+ tvl, borrowed,
+ },
+};
diff --git a/projects/blend-pools/index.js b/projects/blend-pools/index.js
new file mode 100644
index 0000000000..a50560012b
--- /dev/null
+++ b/projects/blend-pools/index.js
@@ -0,0 +1,8 @@
+const { getExports } = require("../helper/heroku-api");
+const methodologies = require("../helper/methodologies");
+
+module.exports = {
+ timetravel: false,
+ methodology: `${methodologies.lendingMarket}. TVL is calculated and totaled for all Blend pools in the Blend reward zone.`,
+ ...getExports("blend-pools", ['stellar'], ['borrowed'])
+};
diff --git a/projects/blueberry/index.js b/projects/blueberry/index.js
index f0bc883cd0..535d5bad63 100644
--- a/projects/blueberry/index.js
+++ b/projects/blueberry/index.js
@@ -8,7 +8,8 @@ const sdk = require('@defillama/sdk');
const BANK = '0xa34F59F634d48E2c3606048f2367326c46a4B5fA';
async function tvl(timestamp, block, chainBlocks, {api}) {
- const positionValues = await api.fetchList({ lengthAbi: abi.getNextPositionId, itemAbi: abi.getPositionValue, target: BANK})
+ const positionValuesRes = await api.fetchList({ lengthAbi: abi.getNextPositionId, itemAbi: abi.getPositionValue, target: BANK, permitFailure: true})
+ const positionValues = positionValuesRes.filter(value => value != null)
api.addCGToken('tether', positionValues.reduce((acc, i) => acc + i/1e18, 0))
return api.getBalances()
}
diff --git a/projects/bluelotusdao/index.js b/projects/bluelotusdao/index.js
new file mode 100644
index 0000000000..fb24fa08ec
--- /dev/null
+++ b/projects/bluelotusdao/index.js
@@ -0,0 +1,3 @@
+
+const { uniTvlExport } = require('../helper/unknownTokens')
+module.exports = uniTvlExport('genesys', '0x5c4619104985163b3839dA465232B6D2a9588E7B')
\ No newline at end of file
diff --git a/projects/blueshift/index.js b/projects/blueshift/index.js
index 2903fd2147..734f6b54d3 100644
--- a/projects/blueshift/index.js
+++ b/projects/blueshift/index.js
@@ -5,6 +5,7 @@ const { registry, manualPool, blueschain, } = require("./config.json");
async function staking(api) {
const chain = api.chain
+ if (chain === 'milkomeda_a1') return {}
if (!manualPool[chain]) return {}
const value = await api.call({ abi: abi.BlueshiftEarning.getAccDeposit, target: manualPool[chain], })
const tokenAddress = await api.call({ abi: abi.BlueshiftEarning.getToken, target: manualPool[chain], })
@@ -14,6 +15,7 @@ async function staking(api) {
async function tvl(api) {
const chain = api.chain
+ if (chain === 'milkomeda_a1') return {}
const { reserve, tokens } = blueschain[chain] ?? {}
// Blueschain reserves
diff --git a/projects/bmx/index.js b/projects/bmx/index.js
index 3be3d0e836..727c569a47 100644
--- a/projects/bmx/index.js
+++ b/projects/bmx/index.js
@@ -1,12 +1,27 @@
const { staking } = require("../helper/staking");
const { gmxExports } = require("../helper/gmx");
-const sdk = require('@defillama/sdk')
-const vaultAddress = "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C";
+const vaultAddresses = {
+ base: "0xec8d8D4b215727f3476FF0ab41c406FA99b4272C",
+ mode: "0xff745bdB76AfCBa9d3ACdCd71664D4250Ef1ae49"
+};
+const stakingAddresses = {
+ base: "0x3085F25Cbb5F34531229077BAAC20B9ef2AE85CB",
+ mode: "0x773F34397d5F378D993F498Ee646FFe4184E00A3"
+};
+const tokenAddresses = {
+ base: "0x548f93779fBC992010C07467cBaf329DD5F059B7",
+ mode: "0x66eEd5FF1701E6ed8470DC391F05e27B1d0657eb"
+};
module.exports = {
- methodology: "BMX liquidity is calculated by the value of tokens in the BLT pool.",
+ methodology: "BMX Classic liquidity is calculated by the value of tokens in the BLT/MLT pool. TVL also includes BMX staked.",
base: {
- tvl: gmxExports({ vault: vaultAddress })
+ tvl: gmxExports({ vault: vaultAddresses.base }),
+ staking: staking(stakingAddresses.base, tokenAddresses.base)
},
+ mode: {
+ tvl: gmxExports({ vault: vaultAddresses.mode }),
+ staking: staking(stakingAddresses.mode, tokenAddresses.mode)
+ }
};
diff --git a/projects/bob/index.js b/projects/bob/index.js
index 4639d756a3..07184113b5 100644
--- a/projects/bob/index.js
+++ b/projects/bob/index.js
@@ -10,10 +10,12 @@ const tokens = [
ADDRESSES.ethereum.WSTETH,
ADDRESSES.ethereum.USDT,
ADDRESSES.ethereum.DAI,
+ ADDRESSES.ethereum.WETH,
"0x7122985656e38BDC0302Db86685bb972b145bD3C", // STONE
"0xbdBb63F938c8961AF31eaD3deBa5C96e6A323DD1", // eDLLR
"0xbdab72602e9AD40FC6a6852CAf43258113B8F7a5", // eSOV
"0xe7c3755482d0dA522678Af05945062d4427e0923", // ALEX
+
];
module.exports = {
@@ -25,7 +27,8 @@ module.exports = {
owners: [
"0x3F6cE1b36e5120BBc59D0cFe8A5aC8b6464ac1f7",
"0x091dF5E1284E49fA682407096aD34cfD42B95B72",
- "0x450D55a4B4136805B0e5A6BB59377c71FC4FaCBb"
+ "0x450D55a4B4136805B0e5A6BB59377c71FC4FaCBb",
+ "0x8AdeE124447435fE03e3CD24dF3f4cAE32E65a3E"
],
fetchCoValentTokens: true,
}),
diff --git a/projects/boson/index.js b/projects/boson/index.js
new file mode 100644
index 0000000000..73a6519fdb
--- /dev/null
+++ b/projects/boson/index.js
@@ -0,0 +1,17 @@
+const { staking } = require("../helper/staking");
+
+module.exports = {
+ ethereum: {
+ tvl: () => ({}),
+ staking: staking(
+ [
+ "0x6244bc0d4b661526c0c62c3610571cd1ac9df2dd",
+ "0xbacc083795846a67b0782327a96622447ddafe6c",
+ "0x081a52f02e51978ad419dd7894d7ae3555f8bc26",
+ "0x3ed0c99c8e8eb94438837cc8a08ca3bb187424cf",
+ "0x3810d9d6685812af6ef4257de0542ecdba9bfd95"
+ ],
+ "0xC477D038d5420C6A9e0b031712f61c5120090de9"
+ ),
+ },
+};
diff --git a/projects/bouncebit-EasyBTC/index.js b/projects/bouncebit-EasyBTC/index.js
new file mode 100644
index 0000000000..c6507609f9
--- /dev/null
+++ b/projects/bouncebit-EasyBTC/index.js
@@ -0,0 +1,38 @@
+const { sumTokens, sumTokensExport } = require('../helper/sumTokens');
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const ETH_EasyBTC_USD_Contract = '0xFe32277D00e57D864B8BC687d0a442D663Aa1dF6'
+
+const BNB_EasyBTC_USD_Contract = '0xF3FB36F32Dad91627f688e7332472d69F6C985c6'
+const BNB_EasyBTC_BTC_Contract = '0x38D239a8D33BF7424A1Df6d39cb8523cCc25DE0e'
+
+const STAKE_ABI =
+ "function totalStaked() view returns (uint256)";
+
+async function ETHTvl(api, ...args) {
+ const EasyBTC_USD_Staked = await api.call({ abi: STAKE_ABI, target: ETH_EasyBTC_USD_Contract})
+ // usdt
+ api.add(ADDRESSES.ethereum.USDT, EasyBTC_USD_Staked)
+ return sumTokens({
+ api
+ })
+}
+
+async function BNBTvl(api, ...args) {
+ const EasyBTC_USD_Staked = await api.call({ abi: STAKE_ABI, target: BNB_EasyBTC_USD_Contract})
+ const EasyBTC_BTC_Staked = await api.call({ abi: STAKE_ABI, target: BNB_EasyBTC_BTC_Contract})
+ // usdt
+ api.add(ADDRESSES.bsc.USDT, EasyBTC_USD_Staked)
+ // btc
+ api.add(ADDRESSES.bsc.BTCB, EasyBTC_BTC_Staked)
+ return sumTokens({ api })
+}
+
+module.exports = {
+ ethereum: {
+ tvl: ETHTvl,
+ },
+ bsc: {
+ tvl: BNBTvl,
+ }
+};
diff --git a/projects/bouncebit-ethena/index.js b/projects/bouncebit-ethena/index.js
new file mode 100644
index 0000000000..24fe61eaf0
--- /dev/null
+++ b/projects/bouncebit-ethena/index.js
@@ -0,0 +1,16 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require('../helper/sumTokens');
+
+const USDe = ADDRESSES.ethereum.USDe
+const USDT = ADDRESSES.ethereum.USDT
+
+const contractAddress = '0x96E65d1ae193A15b19500AEA8F7f739989C810ea'
+
+module.exports = {
+ ethereum: {
+ tvl: sumTokensExport({
+ owners: [contractAddress],
+ tokens: [USDe, USDT]
+ }),
+ }
+}
diff --git a/projects/bouncebit-premium/index.js b/projects/bouncebit-premium/index.js
index e60eea7a28..fde3876f9d 100644
--- a/projects/bouncebit-premium/index.js
+++ b/projects/bouncebit-premium/index.js
@@ -1,14 +1,29 @@
-const { sumTokensExport } = require('../helper/sumTokens');
+const { sumTokens, sumTokensExport } = require('../helper/sumTokens');
const BBTC = '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC'
const BBUSD = '0x77776b40C3d75cb07ce54dEA4b2Fd1D07F865222'
-const stBBTC = '0x7F150c293c97172C75983BD8ac084c187107eA19'
+// const stBBTC = '0x7F150c293c97172C75983BD8ac084c187107eA19'
+
+const stBBTC_STAKE_ABI =
+ "function totalStaked() view returns (uint256)";
+
+async function bouncebitTvl(api, ...args) {
+ const stBBTCStaked = await api.call({ abi: stBBTC_STAKE_ABI, target: '0x7F26aB9263E33de947654F44C5AB439090cfAaf7'})
+ // stBBTC
+ api.add(BBTC, stBBTCStaked)
+ return sumTokens({
+ owners: ["0xd4def93a10ada7e14cAdc6920b6CDE01148D1813", "0x426CD147ff93f31BB18F1Acd19DAb9c32d934131"],
+ tokens: [BBTC, BBUSD],
+ api,
+ ...args
+ })
+}
module.exports = {
ethereum: {
tvl: sumTokensExport({
owners: ["0x1ddD6E5eA766511CC0f348DC8d17578a821B680F", "0xa2B283e4dbdFEA5461C36a59E3B94b3ef2883085"],
- tokens: [BBTC, BBUSD]
+ tokens: [BBTC] // removed BBUSD because its tracked on bouncebit ethena listing
}),
},
bsc: {
@@ -18,9 +33,6 @@ module.exports = {
}),
},
bouncebit: {
- tvl: sumTokensExport({
- owners: ["0xd4def93a10ada7e14cAdc6920b6CDE01148D1813", "0x426CD147ff93f31BB18F1Acd19DAb9c32d934131", '0x7F26aB9263E33de947654F44C5AB439090cfAaf7'],
- tokens: [BBTC, BBUSD, stBBTC]
- }),
+ tvl: bouncebitTvl
},
};
diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js
new file mode 100644
index 0000000000..c5e4cb897b
--- /dev/null
+++ b/projects/bridgers-ai/index.js
@@ -0,0 +1,180 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { nullAddress, sumTokensExport, } = require('../helper/sumTokens')
+
+const getBridgeContract = (chain) => {
+ switch (chain) {
+ case 'ethereum':
+ return '0x92e929d8b2c8430bcaf4cd87654789578bb2b786';
+ case 'bsc':
+ return '0x1ed5685f345b2fa564ea4a670de1fde39e484751';
+ case 'heco':
+ return '0xaeAE2CBb1E024E27e80cc61eE9A8B300282209B4';
+ case 'okexchain':
+ return '0x37809F06F0Daf8f1614e8a31076C9bbEF4992Ff9';
+ case 'polygon':
+ return '0x242Ea2A8C4a3377A738ed8a0d8cC0Fe8B4D6C36E';
+ case 'fantom':
+ return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1';
+ case 'arbitrum':
+ return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1';
+ case 'tron':
+ return 'TEorZTZ5MHx8SrvsYs1R3Ds5WvY1pVoMSA';
+ case 'solana':
+ return 'AL89We2CN1RdEJhUAtUs8ZhdQhkdECg6WX6qq7QntoWH';
+ case 'base':
+ return '0xa18968cc31232724f1dbd0d1e8d0b323d89f3501';
+ case 'sui':
+ return '0x5b64222ecff7e41abe28d48667fe81b13afa526d2490324080db9430f053052e';
+ case 'aptos':
+ return '0x4512ba8a4862edcb20d5027a8d1b47129299d4bed9e41a8a727b78808d6faef4';
+ case 'ton':
+ return 'EQBueUEMhTXyX4ugA_sJ-sCchXU29W9VIwW2hNIlDQkUE8xq';
+ case 'era':
+ return '0x2042ecdc71f9ffb2eb9cda7f801eccc5c6c8b7eb';
+ case 'linea':
+ return '0x8159891dfe9de7fc3bf1b665eb1adda60f2acd0e';
+ case 'optimism':
+ return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1';
+ case 'avax':
+ return '0x8f957ed3f969d7b6e5d6df81e61a5ff45f594dd1';
+ default:
+ throw new Error('Missing bridgers contract');
+ }
+}
+
+const tokensConf = {
+ ethereum: {
+ ETH: nullAddress,
+ BUSD: ADDRESSES.ethereum.BUSD,
+ USDC: ADDRESSES.ethereum.USDC,
+ USDT: ADDRESSES.ethereum.USDT,
+ DAI: ADDRESSES.ethereum.DAI,
+ WBTC: ADDRESSES.ethereum.WBTC,
+ WETH: ADDRESSES.ethereum.WETH,
+ AAVE: ADDRESSES.ethereum.AAVE,
+ // SWFTC: "0x0bb217e40f8a5cb79adf04e1aab60e5abd0dfc1e",
+ HT: "0x6f259637dcd74c767781e37bc6133cd6a68aa161",
+ PEPE: "0x6982508145454Ce325dDbE47a25d4ec3d2311933",
+ WLD: "0x163f8C2467924be0ae7B5347228CABF260318753",
+ },
+ bsc: {
+ BNB: nullAddress,
+ BUSD: ADDRESSES.bsc.BUSD,
+ USDC: ADDRESSES.bsc.USDC,
+ USDT: ADDRESSES.bsc.USDT,
+ DAI: "0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3",
+ WBNB: ADDRESSES.bsc.WBNB,
+ BTCB: ADDRESSES.bsc.BTCB,
+ ETH: ADDRESSES.bsc.ETH,
+ // SWFTC: "0xe64e30276c2f826febd3784958d6da7b55dfbad3",
+ DOGE: "0xba2ae424d960c26247dd6c32edc70b295c744c43",
+ },
+ /*heco: {
+ HT: nullAddress,
+ USDC: ADDRESSES.heco.USDC_HECO,
+ USDT: ADDRESSES.heco.USDT,
+ HUSD: "0x0298c2b32eae4da002a15f36fdf7615bea3da047",
+ ETH: "0x64ff637fb478863b7468bc97d30a5bf3a428a1fd",
+ // SWFTC: "0x329dda64Cbc4DFD5FA5072b447B3941CE054ebb3",
+ },*/
+ okexchain: {
+ OKT: nullAddress,
+ USDC: ADDRESSES.okexchain.USDC,
+ USDT: ADDRESSES.okexchain.USDT,
+ ETH: ADDRESSES.okexchain.ETHK,
+ OKB: ADDRESSES.okexchain.OKB,
+ },
+ polygon: {
+ MATIC: nullAddress,
+ USDC: ADDRESSES.polygon.USDC,
+ USDT: ADDRESSES.polygon.USDT,
+ WMATIC: ADDRESSES.polygon.WMATIC_2,
+ DAI: ADDRESSES.polygon.DAI,
+ },
+ fantom: {
+ FTM: nullAddress,
+ USDC: ADDRESSES.fantom.USDC,
+ USDT: ADDRESSES.fantom.fUSDT,
+ DAI: ADDRESSES.fantom.DAI,
+ WETH: "0x74b23882a30290451A17c44f4F05243b6b58C76d",
+ },
+ arbitrum: {
+ ETH: nullAddress,
+ ARB: ADDRESSES.arbitrum.ARB,
+ USDC_CIRCLE: ADDRESSES.arbitrum.USDC_CIRCLE,
+ USDC: ADDRESSES.arbitrum.USDC,
+ USDT: ADDRESSES.arbitrum.USDT,
+ },
+ tron: {
+ TRX: nullAddress,
+ USDT: ADDRESSES.tron.USDT,
+ USDC: ADDRESSES.tron.USDC,
+ USDD: ADDRESSES.tron.USDD,
+ BUSD: ADDRESSES.tron.BUSD,
+ TUSD: ADDRESSES.tron.TUSD,
+ USDJ: ADDRESSES.tron.USDJ,
+ BTT: ADDRESSES.tron.BTT,
+ JST: ADDRESSES.tron.JST,
+ },
+ solana: {
+ },
+ base: {
+ ETH: nullAddress,
+ WETH: ADDRESSES.base.WETH,
+ USDT: ADDRESSES.base.USDbC,
+ USDC: ADDRESSES.base.USDC,
+ },
+ sui: {
+ SUI: ADDRESSES.sui.SUI,
+ USDT: ADDRESSES.sui.USDT,
+ USDC: ADDRESSES.sui.USDC,
+ // SSWP: '0x361dd589b98e8fcda9a7ee53b85efabef3569d00416640d2faa516e3801d7ffc::TOKEN::TOKEN',
+ },
+ aptos: {
+ APT: ADDRESSES.aptos.APT,
+ },
+ ton: {
+ TON: ADDRESSES.ton.TON,
+ USDT: ADDRESSES.ton.USDT,
+ USDC: ADDRESSES.ton.USDC,
+ NOT: 'EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT',
+ },
+ era: {
+ ETH: nullAddress,
+ USDT: ADDRESSES.era.USDT,
+ USDC: ADDRESSES.era.USDC,
+ },
+ linea: {
+ ETH: nullAddress,
+ USDT: ADDRESSES.linea.USDT,
+ USDC: ADDRESSES.linea.USDC,
+ },
+ optimism: {
+ ETH: nullAddress,
+ OP: ADDRESSES.optimism.OP,
+ USDC_CIRCLE: ADDRESSES.optimism.USDC_CIRCLE,
+ USDT: ADDRESSES.optimism.USDT,
+ USDC: ADDRESSES.optimism.USDC,
+ },
+ avax: {
+ AVAX: nullAddress,
+ USDt: ADDRESSES.avax.USDt,
+ USDC: ADDRESSES.avax.USDC,
+ USDT_e: ADDRESSES.avax.USDT_e,
+ USDC_e: ADDRESSES.avax.USDC_e,
+ DAI: ADDRESSES.avax.DAI,
+ ETH: '0xf20d962a6c8f70c731bd838a3a388d7d48fa6e15',
+ },
+};
+
+module.exports = {
+ methodology: "Assets staked in the pool and trading contracts",
+}
+for (const network of Object.keys(tokensConf)) {
+ const owner = getBridgeContract(network)
+ let tokens = Object.values(tokensConf[network])
+ if (network === 'solana') tokens = undefined
+ module.exports[network] = {
+ tvl: sumTokensExport({ owner, tokens }),
+ };
+}
diff --git a/projects/brightside/index.js b/projects/brightside/index.js
index d2d2d91d7d..34737f3d02 100644
--- a/projects/brightside/index.js
+++ b/projects/brightside/index.js
@@ -1,6 +1,7 @@
const { getUniTVL } = require('../helper/unknownTokens')
module.exports = {
+ deadFrom: '04-04-2024', // chain is shutting down
misrepresentedTokens: true,
milkomeda_a1: {
tvl: getUniTVL({
diff --git a/projects/brine/index.js b/projects/brine/index.js
index de87774c27..89402f9301 100644
--- a/projects/brine/index.js
+++ b/projects/brine/index.js
@@ -3,6 +3,11 @@ const { sumTokensExport } = require("../helper/unwrapLPs");
const ethereumContracts = ["0x1390f521A79BaBE99b69B37154D63D431da27A07", "0xe17F8e501bF5e968e39D8702B30c3A8b955d8f52"];
const polygonContracts = ["0x2714C5958e2b1417B3f2b7609202FFAD359a5965"];
+const optimismContracts = ["0xBdd40916bBC43bE14dd7183C30a64EE4A893D97f"];
+const arbitrumContracts = ["0x149e2C169f10914830EF39B9d184AE62BbCdF526"];
+const lineaContracts = ["0x508f001baa00976fc1d679af880267555900ab09"];
+const modeContracts = ["0xB884389d818046F48Ca63d4cCAF303ba65f6DbC1"];
+const scrollContracts = ["0x1e4a1a0d31cFDDC722965a0c2d3bBecF748252d6"];
const ethereumTokens = [
ADDRESSES.null,
@@ -10,17 +15,60 @@ const ethereumTokens = [
ADDRESSES.ethereum.USDT,
ADDRESSES.ethereum.WBTC,
ADDRESSES.ethereum.MATIC,
- '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1',
+ '0xB50721BCf8d664c30412Cfbc6cf7a15145234ad1', // arb
ADDRESSES.ethereum.LINK,
ADDRESSES.ethereum.AAVE,
ADDRESSES.ethereum.MKR,
+ ADDRESSES.ethereum.LIDO,
+ "0xD33526068D116cE69F19A9ee46F0bd304F21A51f", // rpl
+ "0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766", // strk
+ "0xc00e94cb662c3520282e6f5717214004a7f26888" // comp
];
const polygonTokens = [
+ ADDRESSES.null,
ADDRESSES.polygon.USDC,
+ ADDRESSES.polygon.USDT,
+]
+
+const optimismTokens = [
+ ADDRESSES.null,
+ ADDRESSES.optimism.USDC,
+ ADDRESSES.optimism.USDC_CIRCLE,
+ ADDRESSES.optimism.USDT,
+]
+
+const arbitrumTokens = [
+ ADDRESSES.null,
+ ADDRESSES.arbitrum.USDC,
+ ADDRESSES.arbitrum.USDC_CIRCLE,
+ ADDRESSES.arbitrum.USDT,
+]
+
+const lineaTokens = [
+ ADDRESSES.null,
+ ADDRESSES.linea.USDC,
+ ADDRESSES.linea.USDT,
+]
+
+const modeTokens = [
+ ADDRESSES.null,
+ ADDRESSES.mode.USDC,
+ ADDRESSES.mode.USDT
+]
+
+const scrollTokens = [
+ ADDRESSES.null,
+ ADDRESSES.scroll.USDC,
+ ADDRESSES.scroll.USDT
]
module.exports = {
start: 1685817000,
ethereum: { tvl: sumTokensExport({ owners: ethereumContracts, tokens: ethereumTokens, }) },
polygon: { tvl: sumTokensExport({ owners: polygonContracts, tokens: polygonTokens}) },
+ optimism: { tvl: sumTokensExport({ owners: optimismContracts, tokens: optimismTokens}) },
+ arbitrum: { tvl: sumTokensExport({ owners: arbitrumContracts, tokens: arbitrumTokens}) },
+ linea: { tvl: sumTokensExport({ owners: lineaContracts, tokens: lineaTokens}) },
+ mode: { tvl: sumTokensExport({ owners: modeContracts, tokens: modeTokens}) },
+ scroll: { tvl: sumTokensExport({ owners: scrollContracts, tokens: scrollTokens}) },
};
diff --git a/projects/bsquared/index.js b/projects/bsquared/index.js
index 9ef51a5925..9cb2cef416 100644
--- a/projects/bsquared/index.js
+++ b/projects/bsquared/index.js
@@ -4,12 +4,18 @@ const { sumTokensExport } = require('../helper/sumTokens');
const ADDRESSES = require('../helper/coreAssets.json')
const BTCOwners = [
+ // pre deposited wallets //Bitcoin Multisig Addresses
"bc1q4fsk5pgnmnu7ngp79xclsw2t0yk46sjqw22ffz",
- "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m",
- "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs",
+ "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m", //Bitcoin Multisig Addresses
+ "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs", //Bitcoin Multisig Addresses
+ //Bitcoin Custodian Addresses
+ "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg",
+ "bc1qr4cpjazz6hhjh44yrshqw4xs4e3eld60wnsq2m",
+ "14UwPgMLZY6rLZRDxxvmNWQ9rMkg2iraHG",
+ "bc1quetqhxs809mwgms0rhae4cw98chzqe0er8fryr",
];
const BRC20Owners = [
- "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc",
+ "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc", //Bitcoin Multisig Addresses
];
const ADDRESSES_ETHEREUM_STONE = '0x7122985656e38BDC0302Db86685bb972b145bD3C';
@@ -28,7 +34,7 @@ module.exports = {
ethereum: {
tvl: sumTokensExport({
ownerTokens: [
- [[ADDRESSES_ETHEREUM_STONE, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WBTC], "0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c",],
+ [[ADDRESSES_ETHEREUM_STONE, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WBTC], "0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c",], //Ethereum Multisignature Address (WBTC)
]
}),
},
@@ -42,7 +48,7 @@ module.exports = {
bsc: {
tvl: sumTokensExport({
ownerTokens: [
- [[ADDRESSES.bsc.BTCB, ADDRESSES.ethereum.FDUSD], "0x0A80028d73Faaee6e57484E3335BeFda0de7f455",],
+ [[ADDRESSES.bsc.BTCB, ADDRESSES.ethereum.FDUSD], "0x0A80028d73Faaee6e57484E3335BeFda0de7f455",], //BNB Chain Multisig Address (BTCB)
]
}),
},
diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js
index 3e1f1899d5..040f879c68 100644
--- a/projects/bucket-protocol/index.js
+++ b/projects/bucket-protocol/index.js
@@ -50,6 +50,34 @@ const CETABLE_PSM =
const STAPEARL_PSM =
"0xccdaf635eb1c419dc5ab813cc64c728a9f5a851202769e254f348bff51f9a6dc";
+const afSUI_sLP_ID =
+ "0x508da82c0b6785653f638b95ebf7c89d720ecffae15c4d0526228a2edae7d429";
+
+const vSUI_sLP_ID =
+ "0xa68124b518290f430f2133bcb679c519e51c99045e622cd6bcb00374c97f6d9d";
+
+const haSUI_sLP_ID =
+ "0xa8993bf1c1e717b7c0f164c51346fa99a4e771c50d90c14e755adc48e39b7768";
+
+const navi_sLP_ID =
+ "0xcbe804c8c334dcadecd4ba05ee10cffa54dad36f279ab4ec9661d67f9372881c";
+
+const scallop_sUSDC_LP_ID =
+ "0x7b16192d63e6fa111b0dac03f99c5ff965205455089f846804c10b10be55983c";
+
+const scallop_sUSDT_LP_ID =
+ "0x6b68b42cbb4efccd9df30466c21fff3c090279992c005c45154bd1a0d87ac725";
+
+async function getStakingLPAmount(id) {
+ const stakingLPObject = await sui.getObject(id);
+ return stakingLPObject.fields.output_volume;
+}
+
+async function getScallopsLPAmount(id) {
+ const stakingLPObject = await sui.getObject(id);
+ return stakingLPObject.fields.coin_balance;
+}
+
async function tvl(api) {
const protocolFields = await sui.getDynamicFieldObjects({
parent: MAINNET_PROTOCOL_ID,
@@ -184,6 +212,37 @@ async function tvl(api) {
`0x${afsuiSuiTokenNames[1]}`,
Math.floor(afsuiPercentage * afsuiSuiLpBucketStaked)
);
+
+ //Staking LPs
+ const safSUILPAmount = await getStakingLPAmount(afSUI_sLP_ID);
+ api.add(
+ "0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc::afsui::AFSUI",
+ safSUILPAmount
+ );
+
+ const svSUILPAmount = await getStakingLPAmount(vSUI_sLP_ID);
+ api.add(
+ "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
+ svSUILPAmount
+ );
+
+ const shaSUILPAmount = await getStakingLPAmount(haSUI_sLP_ID);
+ api.add(
+ "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI",
+ shaSUILPAmount
+ );
+
+ const snaviLPAmount = await getStakingLPAmount(navi_sLP_ID);
+ api.add(
+ "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT",
+ snaviLPAmount
+ );
+
+ const scallopUSDC_LPAmount = await getScallopsLPAmount(scallop_sUSDC_LP_ID);
+ api.add(USDC, scallopUSDC_LPAmount);
+
+ const scallopUSDT_LPAmount = await getScallopsLPAmount(scallop_sUSDT_LP_ID);
+ api.add(USDT, scallopUSDT_LPAmount);
}
module.exports = {
diff --git a/projects/buffer/index.js b/projects/buffer/index.js
index 0384e3b2d1..f5195dea68 100644
--- a/projects/buffer/index.js
+++ b/projects/buffer/index.js
@@ -5,6 +5,7 @@ const { sumTokensExport } = require("../helper/unwrapLPs");
const tokens = {
BFR: "0x1A5B0aaF478bf1FDA7b934c76E7692D722982a6D",
USDC_ARB: ADDRESSES.arbitrum.USDC,
+ USDC_CIRCLE: ADDRESSES.arbitrum.USDC_CIRCLE,
USDC_POLY: ADDRESSES.polygon.USDC,
ARB: ADDRESSES.arbitrum.ARB,
};
@@ -16,6 +17,7 @@ const contracts = {
USDC_POOL_V4: "0xfD9f8841C471Fcc55f5c09B8ad868BdC9eDeBDE1",
POLY_POOL_V1: "0x6FD5B386d8bed29b3b62C0856250cdD849b3564d",
ARB_POOL_V1: "0xaE0628C88EC6C418B3F5C005f804E905f8123833",
+ USDC_POOL_V5: "0x9501a00d7d4BC7558196B2e4d61c0ec5D16dEfb2",
BFR_STAKING: "0x173817F33f1C09bCb0df436c2f327B9504d6e067",
};
@@ -23,13 +25,14 @@ module.exports = {
arbitrum: {
staking: staking(contracts.BFR_STAKING, tokens.BFR),
tvl: sumTokensExport({
- tokens: [tokens.USDC_ARB, tokens.ARB],
+ tokens: [tokens.USDC_ARB, tokens.ARB, tokens.USDC_CIRCLE],
owners: [
contracts.USDC_POOL_V1,
contracts.USDC_POOL_V2,
contracts.USDC_POOL_V3,
contracts.ARB_POOL_V1,
contracts.USDC_POOL_V4,
+ contracts.USDC_POOL_V5,
],
}),
},
@@ -53,5 +56,7 @@ module.exports = {
],
[Math.floor(new Date("2023-09-01") / 1e3), "Debuted Version 2.5"],
[Math.floor(new Date("2024-01-03") / 1e3), "Launched above/below options"],
+ [Math.floor(new Date("2024-05-30") / 1e3), "Debuted Version 2.6"],
+
],
};
diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js
index 538e54a77b..7ab2ca1e54 100644
--- a/projects/bunicorn/index.js
+++ b/projects/bunicorn/index.js
@@ -1,79 +1,25 @@
-const BigNumber = require("bignumber.js");
-const { toUSDTBalances } = require("../helper/balances");
const sdk = require("@defillama/sdk");
-const { request, gql } = require("graphql-request");
-const tokenSubgraphUrl =
- "https://api.thegraph.com/subgraphs/name/bunicorndefi/buni-token";
-const stableSubgraphUrl =
- "https://api.thegraph.com/subgraphs/name/bunicorndefi/buni-stablecoins";
+const { v1Tvl } = require("../helper/balancer");
+const { uniTvlExport } = require("../helper/unknownTokens");
const BUNI_CONTRACT_ADDRESS = "0x0e7beec376099429b85639eb3abe7cf22694ed49";
-const MASTERCHEF_CONTRACT_ADDRESS =
- "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24";
+const MASTERCHEF_CONTRACT_ADDRESS = "0xA12c974fE40ea825E66615bA0Dc4Fd19be4D7d24";
-const graphTotalTokenTVLQuery = gql`
-{\n bunis(where: {id: \"1\"}) {\n totalLiquidity\n }\n}
-`;
-
-const graphTotalStableTVLQuery = gql`
-{\n buniCornFactories( where: {id: \"0x86873f85bc12ce40321340392c0ff39c3bdb8d68\"}) {\n id\n totalLiquidityUSD\n }\n\n}
-`;
-
-async function getTotalFarmTVL(timestamp, ethBlock, chainBlocks) {
- try {
- const balances = {};
- const stakedBuni = sdk.api.erc20.balanceOf({
- target: BUNI_CONTRACT_ADDRESS,
- owner: MASTERCHEF_CONTRACT_ADDRESS,
- chain: "bsc",
- block: chainBlocks.bsc,
- });
- sdk.util.sumSingleBalance(
- balances,
- "bsc:" + BUNI_CONTRACT_ADDRESS,
- (await stakedBuni).output
- );
- return balances;
- } catch (e) {
- throw new Error("getTotalFarmTVL has exception:" + e.message);
- }
-}
-async function getTotalTokenTVL(timestamp, ethBlock, chainBlocks) {
- try {
- const { bunis } = await request(tokenSubgraphUrl, graphTotalTokenTVLQuery, {
- block: chainBlocks.bsc,
- });
- return (bunis[0] && bunis[0].totalLiquidity) || 0;
- } catch (e) {
- throw new Error("getTotalTokenTVL has exception:" + e.message);
- }
-}
-async function getTotalStableTVL(timestamp, ethBlock, chainBlocks) {
- try {
- const { buniCornFactories } = await request(
- stableSubgraphUrl,
- graphTotalStableTVLQuery,
- {
- block: chainBlocks.bsc,
- }
- );
- return (
- (buniCornFactories[0] && buniCornFactories[0].totalLiquidityUSD) || 0
- );
- } catch (e) {
- throw new Error("getTotalStableTVL has exception:" + e.message);
- }
-}
-async function getTotalTVL(timestamp, ethBlock, chainBlocks) {
- const [tokensSummary, stableSummary] = await Promise.all([
- getTotalTokenTVL(timestamp, ethBlock, chainBlocks),
- getTotalStableTVL(timestamp, ethBlock, chainBlocks),
- ]);
- return toUSDTBalances(new BigNumber(tokensSummary).plus(stableSummary));
+async function staking(api) {
+ return api.sumTokens({
+ owner: MASTERCHEF_CONTRACT_ADDRESS,
+ tokens: [BUNI_CONTRACT_ADDRESS],
+ });
}
+
module.exports = {
- misrepresentedTokens: true,
bsc: {
- tvl: getTotalTVL,
- staking: getTotalFarmTVL,
+ tvl: sdk.util.sumChainTvls([v1Tvl('0x48ab312150E1802D57639859d7C3107aE751FE35', 8973039), uniTvlExport('bsc', '0x86873f85bc12ce40321340392c0ff39c3bdb8d68', {
+ abis: {
+ allPairsLength: 'uint256:allPoolsLength',
+ allPairs: 'function allPools(uint256) view returns (address)',
+ },
+ fetchBalances: true,
+ }).bsc.tvl]),
+ staking,
},
};
diff --git a/projects/bunnyswap/index.js b/projects/bunnyswap/index.js
index f86a7b0de5..340bcc6842 100644
--- a/projects/bunnyswap/index.js
+++ b/projects/bunnyswap/index.js
@@ -1,10 +1,11 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require("../helper/unwrapLPs")
module.exports={
base: {
tvl: sumTokensExport({
tokens:[
- "0x4200000000000000000000000000000000000006",
+ ADDRESSES.optimism.WETH_1,
"0x0bD4887f7D41B35CD75DFF9FfeE2856106f86670"
],
owners:[
diff --git a/projects/butternetwork/index.js b/projects/butternetwork/index.js
index 047c6b2eba..1432096f63 100644
--- a/projects/butternetwork/index.js
+++ b/projects/butternetwork/index.js
@@ -1,9 +1,11 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokensExport } = require('../helper/sumTokens')
+const {sumTokensExport} = require('../helper/sumTokens')
const config = {
bsc: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
USDT: ADDRESSES.bsc.USDT,
USDC: ADDRESSES.bsc.USDC,
@@ -13,7 +15,9 @@ const config = {
}
},
polygon: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
USDT: ADDRESSES.polygon.USDT,
USDC: ADDRESSES.polygon.USDC,
@@ -23,7 +27,9 @@ const config = {
}
},
ethereum: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
USDT: ADDRESSES.ethereum.USDT,
USDC: ADDRESSES.ethereum.USDC,
@@ -33,7 +39,9 @@ const config = {
}
},
near: {
- mosContract: "mosv21.mfac.butternetwork.near",
+ mosContract: {
+ v2: "mosv21.mfac.butternetwork.near",
+ },
tokens: {
USDT: "dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near",
USDC: "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near",
@@ -43,7 +51,10 @@ const config = {
}
},
map: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ v3: "0x1ad1a4a19bc9983a98f5d9ac8442c6dfc4276167"
+ },
tokens: {
// USDT: "0x33daba9618a75a7aff103e53afe530fbacf4a3dd",
// USDC: ADDRESSES.map.USDC,
@@ -53,7 +64,9 @@ const config = {
}
},
merlin: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
WBTC: ADDRESSES.merlin.WBTC,
WBTC_1: ADDRESSES.merlin.WBTC_1,
@@ -62,7 +75,9 @@ const config = {
}
},
klaytn: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
WKLAY: ADDRESSES.klaytn.WKLAY,
oETH: ADDRESSES.klaytn.oETH,
@@ -92,7 +107,9 @@ const config = {
}
},
base: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
WETH: ADDRESSES.base.WETH,
USDbC: ADDRESSES.base.USDbC,
@@ -115,11 +132,12 @@ const config = {
"USD+": "0xb79dd08ea68a908a97220c76d19a6aa9cbde4376",
ZRX: "0x3bb4445d30ac020a84c1b5a8a2c6248ebc9779d0",
USDC: ADDRESSES.base.USDC
-
}
},
conflux: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
USDT: ADDRESSES.conflux.USDT,
USDC: ADDRESSES.conflux.USDC,
@@ -135,13 +153,99 @@ const config = {
}
},
blast: {
- mosContract: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
tokens: {
MIM: "0x76DA31D7C9CbEAE102aff34D3398bC450c8374c1",
OMNI: "0x9e20461bc2c4c980f62f1B279D71734207a6A356",
USDB: ADDRESSES.blast.USDB,
+ WBTC: "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692",
WETH: ADDRESSES.blast.WETH
}
+ },
+ arbitrum: {
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
+ tokens: {
+ USDT: ADDRESSES.arbitrum.USDT,
+ USDC: ADDRESSES.arbitrum.USDC,
+ WBTC: ADDRESSES.arbitrum.WBTC,
+ WETH: ADDRESSES.arbitrum.WETH,
+ DAI: ADDRESSES.arbitrum.DAI,
+ }
+ },
+ optimism: {
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
+ tokens: {
+ USDT: ADDRESSES.optimism.USDT,
+ USDC: ADDRESSES.optimism.USDC,
+ WBTC: ADDRESSES.optimism.WBTC,
+ WETH: ADDRESSES.optimism.WETH_1,
+ DAI: ADDRESSES.optimism.DAI,
+ }
+ },
+ era: {
+ mosContract: {
+ v2: "0xBEf06a32166C4B819fF04cCfa887733B8bb67eB5",
+ },
+ tokens: {
+ USDT: ADDRESSES.era.USDT,
+ USDC: ADDRESSES.era.USDC,
+ WETH: ADDRESSES.era.WETH
+ },
+ },
+ // ainn: {
+ // mosContract: {
+ // v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ // },
+ // tokens: {
+ // USDT: "0x0663C09Bd0911181B39D66ec4bfAC9d89c8516BA",
+ // USDC: "0xfaBc451eA1Fd9707c6Ba1769F570E760101C7f22",
+ // }
+ // },
+ mantle: {
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
+ tokens: {
+ USDT: ADDRESSES.mantle.USDT,
+ USDC: ADDRESSES.mantle.USDC,
+ }
+ },
+ tron: {
+ mosContract: {
+ v2: "TYMpgB8Q9vSoGtkyE3hXsvUrpte3KCDGj6",
+ },
+ tokens: {
+ USDT: ADDRESSES.tron.USDT,
+ USDC: ADDRESSES.tron.USDC,
+ }
+ },
+ scroll: {
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
+ tokens: {
+ USDT: ADDRESSES.scroll.USDT,
+ USDC: ADDRESSES.scroll.USDC,
+ WBTC: "0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1",
+ WETH: ADDRESSES.scroll.WETH,
+ DAI: "0xcA77eB3fEFe3725Dc33bccB54eDEFc3D9f764f97",
+ }
+ },
+ linea: {
+ mosContract: {
+ v2: "0xfeB2b97e4Efce787c08086dC16Ab69E063911380",
+ },
+ tokens: {
+ USDT: ADDRESSES.linea.USDT,
+ USDC: ADDRESSES.linea.USDC,
+ WETH: ADDRESSES.linea.WETH,
+ }
}
}
@@ -150,8 +254,8 @@ module.exports = {
};
Object.keys(config).forEach(chain => {
- const { mosContract, tokens } = config[chain]
+ const {mosContract, tokens} = config[chain]
module.exports[chain] = {
- tvl:sumTokensExport({ owner: mosContract, tokens: Object.values(tokens), logCalls: true })
+ tvl: sumTokensExport({owners: Object.values(mosContract), tokens: Object.values(tokens), logCalls: true})
}
})
diff --git a/projects/buzz-farming/index.js b/projects/buzz-farming/index.js
new file mode 100644
index 0000000000..158f1ddda7
--- /dev/null
+++ b/projects/buzz-farming/index.js
@@ -0,0 +1,22 @@
+const {sumTokensExport} = require('../helper/sumTokens');
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const ADDRESSES_BSQUARED_BSTONE = '0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462';
+const ADDRESSES_BSQUARED_FDUSD = '0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5';
+const ADDRESSES_BSQUARED_MATIC = '0xc3ee2Df14B1Bc526c24ED802f1873d49664a0d5c';
+const ADDRESSES_BSQUARED_ORDI = '0xa0f4470B714677AEEcE0d20074c540b3Cf6a477E';
+const ADDRESSES_BSQUARED_SATS = '0x7eBFcE05E418C380a2b6EB0F65995cA04ef4bc00';
+const ADDRESSES_BSQUARED_FBTC = '0x5d247f32b792a61f7b4078cf7752a878aff152e2';
+const ADDRESSES_BSQUARED_UBTC = '0x796e4d53067ff374b89b2ac101ce0c1f72ccaac2';
+const ADDRESSES_BSQUARED_USDA = '0x46fecc5bef70615ee3bfdbd2b278944368b78cf5';
+const ADDRESSES_BSQUARED_ETH = '0xd48d3a551757ac47655fce25bde1b0b6b1cb2a5a';
+
+const tokenList = [ADDRESSES.null, ADDRESSES.bsquared.USDT, ADDRESSES.bsquared.USDC, ADDRESSES.bsquared.WBTC, ADDRESSES_BSQUARED_BSTONE, ADDRESSES_BSQUARED_FDUSD, ADDRESSES_BSQUARED_MATIC, ADDRESSES_BSQUARED_ORDI, ADDRESSES_BSQUARED_SATS, ADDRESSES_BSQUARED_FBTC, ADDRESSES_BSQUARED_UBTC, ADDRESSES_BSQUARED_USDA, ADDRESSES_BSQUARED_ETH,];
+
+
+module.exports = {
+ hallmarks: [],
+ methodology: "Buzz Farming collaborates with well-known BTCFi projects such as Babylon, Lombard, and Bedrock, as well as prominent blockchains, offering users a variety of multifaceted profit strategies. Users can conveniently select and operate investment strategies through Buzz Farming.",
+
+ bsquared: {tvl: sumTokensExport({owner: '0xe677F4B6104726D76DeBc681d7a862CE269aA8F3', tokens: tokenList})},
+}
diff --git a/projects/bybit/index.js b/projects/bybit/index.js
index 401232ace7..dfbdf54ffa 100644
--- a/projects/bybit/index.js
+++ b/projects/bybit/index.js
@@ -16,7 +16,9 @@ const config = {
'bc1q9w4g79ndel72lygvwtqzem67z6uqv4yncvqjz3yn8my9swnwflxsutg4cx',
'bc1qjysjfd9t9aspttpjqzv68k0ydpe7pvyd5vlyn37868473lell5tqkz456m',
'1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC',
- 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f'
+ 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f',
+ // added on the 15th of july 2024.
+ 'bc1qa2eu6p5rl9255e3xz7fcgm6snn4wl5kdfh7zpt05qp5fad9dmsys0qjg0e'
]
},
bsc: {
diff --git a/projects/c3/index.js b/projects/c3/index.js
new file mode 100644
index 0000000000..53e741f598
--- /dev/null
+++ b/projects/c3/index.js
@@ -0,0 +1,55 @@
+const { sumTokens } = require("../helper/chain/algorand")
+const { chainExports } = require("../helper/exports")
+
+const coreContractAddress = 'XGE65UPXAFATPMTKGPA2VNHLMDY2URHD7NNPI3XJ3ZOXEAU6E4ZGH7PWZY'
+
+const chainMap = {
+ 'algorand': {
+ 'algorand:1': { name: 'algorand', decimals: 6 },
+ },
+ 'avax': {
+ 'algorand:893309613': { name: 'avalanche-2', decimals: 8 },
+ 'algorand:1007352535': { name: 'usd-coin', decimals: 6 },
+ },
+ 'bitcoin': {
+ 'algorand:1058926737': { name: 'bitcoin', decimals: 8 },
+ },
+ 'ethereum': {
+ 'algorand:887406851': { name: 'ethereum', decimals: 8 },
+ },
+ 'arbitrum': {
+ 'algorand:1221549217': { name: 'arbitrum', decimals: 8 },
+ },
+ 'bsc': {
+ 'algorand:891648844': { name: 'binancecoin', decimals: 8 },
+ },
+ 'solana': {
+ 'algorand:887648583': { name: 'solana', decimals: 8 },
+ 'algorand:1684682524': { name: 'pyth-network', decimals: 6 },
+ 'algorand:1703994770': { name: 'wormhole', decimals: 6 },
+ },
+}
+
+function chainTvl(chain) {
+ return async () => {
+ // Read contract token balances
+ const contractData = await sumTokens({ owner: coreContractAddress })
+
+ // Remap assets to their common names and normalize values
+ const result = {}
+ for (const asset in contractData) {
+ // Skip if asset is not mapped
+ const assetData = chainMap[chain]?.[asset]
+ if (assetData !== undefined) {
+ // Normalize value to the correct number of decimals for the asset
+ const normalized = contractData[asset] / (10 ** assetData.decimals)
+ result[assetData.name] = normalized.toString()
+ }
+ }
+
+ return result
+ }
+}
+
+module.exports = chainExports(chainTvl, Object.keys(chainMap))
+module.exports.methodology = 'Calculates the TVL from the contract, then remaps assets for accurate value source'
diff --git a/projects/cake-defi/index.js b/projects/cake-defi/index.js
index da5cdbe650..8d2bcba9dd 100644
--- a/projects/cake-defi/index.js
+++ b/projects/cake-defi/index.js
@@ -3,11 +3,22 @@ const { cexExports } = require('../helper/cex')
const config = {
ethereum: {
owners: [
+ '0xc5a0a17eabbb0e64dcd567b5670c8c5d5c34128c',
'0x94fa70d079d76279e1815ce403e9b985bccc82ac',
+ '0xb5e2d774c4672aa4297272f62d61e8a041175cb5',
+ '0x3ec49e613ae70beb0631d7666f46d4ff2813932e',
+ '0xC889Faf456439Fb932B9Ce3d4F43D8078177fD29',
+ '0x883C4599C455Fc337CA43BF9d63eBA45F995a769',
+
],
},
+ polygon: {
+ owners: [
+ '0xaa6c7eAF827E04185D7A6a6A6156195AB5BDBE4c',
+ ]
+ },
bitcoin: {
- owners: ['38pZuWUti3vSQuvuFYs8Lwbyje8cmaGhrT']
+ owners: ['3GcSHxkKY8ADMWRam51T1WYxYSb2vH62VL']
},
litecoin: {
owners: ['MLYQxJfnUfVqRwfYXjDJfmLbyA77hqzSXE']
@@ -15,7 +26,8 @@ const config = {
}
module.exports = cexExports(config)
-module.exports.methodology = 'As Cake DeFi is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $121.4M in DFI chain (nodes), and around $24.7M in ETH chain (nodes) as of 31 March 2023. The calculation methodology are as follows: DFI: 10846 (nodes) * 20K (collateral per node) *$0.56 = $121.4M. ETH: 430 * 32 *$1800 = $24.7M, We also do not track bitcoincash and doge chain. Cake DeFi publishes information on all its nodes on its Transparency page here: https://cakedefi.com/transparency.',
+module.exports.methodology = 'As Bake.io (formerly Cake DeFi) is a CeDeFi platform, its assets associated to the staking nodes are not included for the purposes of the TVL calculation. In this case, there are approximately $121.4M in DFI chain (nodes), and around $24.7M in ETH chain (nodes) as of 31 March 2023. The calculation methodology are as follows: DFI: 10846 (nodes) * 20K (collateral per node) *$0.56 = $121.4M. ETH: 430 * 32 *$1800 = $24.7M, we also do not track Bitcoin Cash and Dogecoin. Bake.io publishes information on all its nodes on its Transparency page here: https://bake.io/transparency.',
module.exports.hallmarks = [
[1680516000, "Change Of Wallets"],
+ [1700784000, "Change Of Wallets"]
]
\ No newline at end of file
diff --git a/projects/cakepie/index.js b/projects/cakepie/index.js
index 566838e4ee..720231d56c 100644
--- a/projects/cakepie/index.js
+++ b/projects/cakepie/index.js
@@ -1,3 +1,4 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const CakepieReaderAbi = require("./abis/CakepieReader.json");
const MasterCakepieAbi = require("./abis/MasterCakepie.json");
const config = require("./config")
@@ -12,7 +13,7 @@ async function tvl(api) {
token = token.toLowerCase()
switch (token) {
case '0x581fa684d0ec11ccb46b1d92f1f24c8a3f95c0ca': return CakeAddress // mcake -> cake
- case '0x7dc91cbd6cb5a3e6a95eed713aa6bf1d987146c8': return '0x2170ed0880ac9a755fd29b2688956bd959f933f8' // mwbeth -> eth
+ case '0x7dc91cbd6cb5a3e6a95eed713aa6bf1d987146c8': return ADDRESSES.bsc.ETH // mwbeth -> eth
default: return token
}
}
diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js
index 736a4682aa..dd0b50fbc1 100644
--- a/projects/camelot-v2/index.js
+++ b/projects/camelot-v2/index.js
@@ -3,11 +3,14 @@ const { uniV3Export } = require('../helper/uniswapV3')
const { mergeExports } = require('../helper/utils');
const export1 = uniV3Export({
- arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, },
+ arbitrum: { factory: '0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B', fromBlock: 75633510, isAlgebra: true, },
})
const export2 = uniV3Export({
- arbitrum: { factory: '0x1a3c9B1d2F0529D97f2afC5136Cc23e58f1FD35B', fromBlock: 75633510, isAlgebra: true, },
+ xai: { factory: '0xD8676fBdfa5b56BB2298D452c9768f51e80e34AE', fromBlock: 2398999, isAlgebra: true},
+ rari: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 340548, isAlgebra: true},
+ sanko: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 51, isAlgebra: true},
+ arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, },
})
-module.exports = mergeExports([export1, export2]);
\ No newline at end of file
+module.exports = mergeExports([export1, export2 ])
\ No newline at end of file
diff --git a/projects/camelot/index.js b/projects/camelot/index.js
index 060254dd45..87e43be12c 100644
--- a/projects/camelot/index.js
+++ b/projects/camelot/index.js
@@ -6,4 +6,13 @@ module.exports = {
arbitrum: {
tvl: getUniTVL({ factory: '0x6EcCab422D763aC031210895C81787E87B43A652', useDefaultCoreAssets: true,}),
},
+ sanko: {
+ tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true})
+ },
+ xai: {
+ tvl: getUniTVL({factory: '0x18E621B64d7808c3C47bccbbD7485d23F257D26f', useDefaultCoreAssets: true})
+ },
+ rari: {
+ tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true})
+ }
};
\ No newline at end of file
diff --git a/projects/capy-finance/index.js b/projects/capy-finance/index.js
new file mode 100644
index 0000000000..9dedd33d17
--- /dev/null
+++ b/projects/capy-finance/index.js
@@ -0,0 +1,17 @@
+const CAPY_STAKING_CONTRACT = '0x67D171A673FfDBd5BBce01dE1489f9E57F3d911b';
+const CAPY_RESTAKING_CONTRACT = '0x12178d2B86031dD293274A0E25c8908521F3d27C';
+
+async function tvl(api) {
+ const contracts = [CAPY_STAKING_CONTRACT, CAPY_RESTAKING_CONTRACT]
+ const tokens = await api.multiCall({ abi: 'address[]:getSupportedTokens', calls: contracts })
+ const ownerTokens = contracts.map((contract, i) => [tokens[i], contract])
+ return api.sumTokens({ ownerTokens })
+}
+
+module.exports = {
+ methodology: 'The TVL of the Capy Finance project in USD.',
+ start: 1000235,
+ bsquared: {
+ tvl,
+ },
+}
\ No newline at end of file
diff --git a/projects/capybara-exchange/config.js b/projects/capybara-exchange/config.js
new file mode 100644
index 0000000000..f5272a6610
--- /dev/null
+++ b/projects/capybara-exchange/config.js
@@ -0,0 +1,8 @@
+module.exports = {
+ klaytn: {
+ pools: {
+ mainPool: "0x540cce8ed7d210f71eeabb9e7ed7698ac745e077",
+ volatilePool: "0x6389dbfa1427a3b0a89cddc7ea9bbda6e73dece7",
+ },
+ },
+};
diff --git a/projects/capybara-exchange/index.js b/projects/capybara-exchange/index.js
new file mode 100644
index 0000000000..9810ad1be6
--- /dev/null
+++ b/projects/capybara-exchange/index.js
@@ -0,0 +1,24 @@
+const config = require("./config");
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+Object.keys(config).forEach((chain) => {
+ const arg = config[chain];
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const pools = Object.values(arg["pools"]);
+
+ let allUnderlying = await api.multiCall({ abi: "address[]:getTokens", calls: pools, });
+
+ const tokens = [];
+ const calls = [];
+ pools.forEach((v, i) => {
+ allUnderlying[i].forEach((t) => {
+ tokens.push(t);
+ calls.push({ target: v, params: t });
+ });
+ });
+ const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, });
+ return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], });
+ },
+ };
+});
diff --git a/projects/carbondefi/index.js b/projects/carbondefi/index.js
index 2d36567267..85a5897ddf 100644
--- a/projects/carbondefi/index.js
+++ b/projects/carbondefi/index.js
@@ -1,21 +1,27 @@
-const { getLogs } = require('../helper/cache/getLogs')
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { sumTokens2 } = require("../helper/unwrapLPs");
-const controller = '0xC537e898CD774e2dCBa3B14Ea6f34C93d5eA45e1'
+const config = {
+ ethereum: {
+ fromBlock: 17087375,
+ controller: "0xC537e898CD774e2dCBa3B14Ea6f34C93d5eA45e1",
+ },
+ sei: {
+ fromBlock: 79146720,
+ controller: "0xe4816658ad10bF215053C533cceAe3f59e1f1087",
+ },
+};
-async function tvl(api) {
- const logs = await getLogs({
- api,
- target: controller,
- topic: 'PairCreated(uint128,address,address)',
- eventAbi: 'event PairCreated(uint128 indexed pairId, address indexed token0, address indexed token1)',
- onlyArgs: true,
- fromBlock: 17087375,
- })
- const tokens = logs.map(i => [i.token0, i.token1]).flat()
+Object.keys(config).forEach((chain) => {
+ const { controller, fromBlock } = config[chain];
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const pairs = await api.call({
+ target:controller,
+ abi: 'function pairs() view returns (address[2][])',
+ })
+ const tokens = pairs.flat()
- return sumTokens2({ api, owner: controller, tokens, })
-}
-
-
-module.exports = { ethereum: { tvl } }
\ No newline at end of file
+ return sumTokens2({ api, owner: controller, tokens });
+ },
+ };
+});
diff --git a/projects/cashio/index.js b/projects/cashio/index.js
index 2c3d5fb6a3..6af54195ec 100644
--- a/projects/cashio/index.js
+++ b/projects/cashio/index.js
@@ -1,133 +1,10 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const SUNNY_POOLS = [{
- "poolName": "quarry_saber_usdc_usdt",
- "relevantAccounts": {
- "sunnyPool": "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp",
- "tokenAMint": ADDRESSES.solana.USDC,
- "tokenBMint": ADDRESSES.solana.USDT,
- "tokenAReserve": "CfWX7o2TswwbxusJ4hCaPobu2jLCb1hfXuXJQjVq3jQF",
- "tokenBReserve": "EnTrdMMpdhugeH6Ban6gYZWXughWxKtVGfCwFn78ZmY3",
- "lpTokenSPL": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf"
- },
- "tokenA": "usd-coin",
- "tokenB": "tether",
- "tvlReader": "sunnyQuarrySaberPoolReader"
-}];
-
-const {
- getMultipleAccountBuffers,
- getMultipleAccountsRaw,
-} = require("../helper/solana");
-
-const readTVL = async ({
- tokenA,
- tokenB,
- tokenAReserve,
- tokenBReserve,
- poolMint,
- tokenAccounts,
-}) => {
- const accountData = await getMultipleAccountBuffers({
- tokenAReserve,
- tokenBReserve,
- poolMint,
- });
- if (accountData.sunnyPool === null) {
- return {};
- }
-
- const decimals = accountData.poolMint.readUInt8(44);
- const divisor = 10 ** decimals;
-
- const tokenAccountsData = (await getMultipleAccountsRaw(tokenAccounts))
- .map((account) => {
- if (account !== null) {
- return Buffer.from(account.data[0], account.data[1]);
- }
- return null;
- })
- .filter((d) => !!d);
- const totalTokens = tokenAccountsData
- .map((tad) =>
- // sorry, this code is a tad hacky
- Number(tad.readBigUInt64LE(64))
- )
- .reduce((acc, el) => acc + el, 0);
- const lpTokenTotalSupply = Number(accountData.poolMint.readBigUInt64LE(36));
- const poolShare = totalTokens / lpTokenTotalSupply;
-
- const reserveAAmount =
- Number(accountData.tokenAReserve.readBigUInt64LE(64)) / divisor;
- const reserveBAmount =
- Number(accountData.tokenBReserve.readBigUInt64LE(64)) / divisor;
-
- const poolTvlCoins = {};
-
- if (tokenA === tokenB) {
- poolTvlCoins[tokenA] =
- poolShare * reserveAAmount + poolShare * reserveBAmount;
- } else {
- poolTvlCoins[tokenA] = poolShare * reserveAAmount;
- poolTvlCoins[tokenB] = poolShare * reserveBAmount;
- }
-
- return poolTvlCoins;
-};
-
-async function tvl() {
- // a mapping of coin name to coin amount
- const tvlResult = {};
-
- // contains a list of all token accounts + their associated sunny pool or coingecko ID
- // more details: https://github.com/cashioapp/treasury
- const cashioTreasuryAccounts = {
- "sunnyPools": {
- "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp": [
- "D67ZNjaRERdc7Ej8SjbpyGwJT4MnadgzfGnwgCmMJAa1",
- "CJdU6oLxuzuDffqtrzv3YvQjdjQ7egCkuRshwmKXNYjM"
- ]
- }
- }
-
-
- const { sunnyPools } = cashioTreasuryAccounts;
-
- // Run these serially to avoid rate limiting issues
- for (const [sunnyPoolKey, tokenAccounts] of Object.entries(sunnyPools)) {
- const sunnyPool = SUNNY_POOLS.find(
- (pool) => pool.relevantAccounts.sunnyPool === sunnyPoolKey
- );
- if (!sunnyPool) {
- continue;
- }
-
- const poolTVL = await readTVL({
- tokenA: sunnyPool.tokenA,
- tokenB: sunnyPool.tokenB,
- tokenAReserve: sunnyPool.relevantAccounts.tokenAReserve,
- tokenBReserve: sunnyPool.relevantAccounts.tokenBReserve,
- poolMint: sunnyPool.relevantAccounts.lpTokenSPL,
- tokenAccounts,
- });
-
- for (const [tokenId, amount] of Object.entries(poolTVL)) {
- if (!tvlResult[tokenId]) {
- tvlResult[tokenId] = amount;
- } else {
- tvlResult[tokenId] += amount;
- }
- }
- }
-
- return tvlResult;
-}
-
module.exports = {
timetravel: false,
hallmarks: [
[1647993600, "Infinite mint glitch"]
-],
+ ],
+ deadFrom: 1667993600,
methodology:
"TVL counts LP token deposits made to Cashio and accrued reward tokens to its bank. CoinGecko is used to find the price of tokens in USD.",
- solana: { tvl },
+ solana: { tvl: () => ({}) },
};
diff --git a/projects/catalist/index.js b/projects/catalist/index.js
new file mode 100644
index 0000000000..319d091e1e
--- /dev/null
+++ b/projects/catalist/index.js
@@ -0,0 +1,14 @@
+const aceContract = "0xec46d5a0ee47e585fab59a15976d0f2413bfbb82";
+
+async function ace(api) {
+ const pooledACE = await api.call({ target: aceContract, abi: "uint256:getTotalPooledAce", })
+ api.addCGToken('endurance', pooledACE / 1e18)
+}
+
+module.exports = {
+ methodology:
+ "Staked tokens are counted as TVL based on the chain that they are staked on and where the liquidity tokens are issued.",
+ ace: {
+ tvl: ace,
+ },
+};
diff --git a/projects/catalyst/index.js b/projects/catalyst/index.js
new file mode 100644
index 0000000000..591292a259
--- /dev/null
+++ b/projects/catalyst/index.js
@@ -0,0 +1,24 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+
+const config = {
+ optimism: { fromBlock: 120302044, },
+ blast: { fromBlock: 3696521, },
+ base: { fromBlock: 14706751, },
+ arbitrum: { fromBlock: 223877881, },
+}
+
+Object.keys(config).forEach(chain => {
+ const { factory = '0x00000000E5E81E25aeaD7fCCb4C9560C6b5b718F', fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs2({
+ api,
+ factory,
+ eventAbi: 'event VaultDeployed (address indexed vaultTemplate, address indexed chainInterface, address indexed deployer, address vaultAddress, address[] assets, uint256 k)',
+ fromBlock,
+ })
+
+ return api.sumTokens({ ownerTokens: logs.map(i => [i.assets, i.vaultAddress]) })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/cellana/index.js b/projects/cellana/index.js
index 640767ecb3..04bc636c58 100644
--- a/projects/cellana/index.js
+++ b/projects/cellana/index.js
@@ -1,20 +1,20 @@
-const { getResources, } = require("../helper/chain/aptos");
-const ADDRESSES = require('../helper/coreAssets.json')
-const CELL_fungible_asset_address = '0x2ebb2ccac5e027a87fa0e2e5f656a3a4238d6a48d93ec9b610d570fc0aa0df12'
-const APT_fungible_asset_address = '0xedc2704f2cef417a06d1756a04a16a9fa6faaed13af469be9cdfcac5a21a8e2e'
-
+const { getResources, function_view } = require("../helper/chain/aptos");
+let resourcesCache;
+let poolsCache;
async function _getResources() {
- let resourcesCache;
if (!resourcesCache) resourcesCache = getResources("0x3b38735644d0be8ac37ebd84a1e42fa5c2487495ef8782f6c694b1a147f82426")
return resourcesCache
}
-
+async function _getPools() {
+ if (!poolsCache) poolsCache = function_view({ functionStr: "0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1::liquidity_pool::all_pool_addresses", type_arguments: [], args: [] })
+ return poolsCache
+}
const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">"));
const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore")
-async function _getCELLbalances(api) {
- const data = await getResources('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1')
- const poolsAddresses = data.find(i => i.type.includes('::liquidity_pool::LiquidityPoolConfigs'))?.data.all_pools?.inline_vec
+async function getfungibleAssetBalances(api) {
+ const data = await _getPools('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1')
+ const poolsAddresses = data[0];
for (const pool of poolsAddresses) {
const fungibleAssetPoolStore = (await getResources(pool.inner)).find(i => i.type.includes('liquidity_pool::LiquidityPool'))?.data
const fungibleAssetAddressToken1 = fungibleAssetPoolStore?.token_store_1?.inner
@@ -24,16 +24,8 @@ async function _getCELLbalances(api) {
const fungibleAssetTokenStore_2 = (await getResources(fungibleAssetAddressToken2)).find(i => i.type.includes('fungible_asset::FungibleStore'))?.data
const token_1_address = fungibleAssetTokenStore_1?.metadata?.inner
const token_2_address = fungibleAssetTokenStore_2?.metadata?.inner
- if (token_1_address == CELL_fungible_asset_address) {
- addBalance(token_2_address, fungibleAssetTokenStore_2?.balance || 0);
- } else if (token_2_address == CELL_fungible_asset_address) {
- addBalance(token_1_address, fungibleAssetTokenStore_1?.balance || 0);
- }
- }
-
- async function addBalance(token, balance) {
- if (token === APT_fungible_asset_address)
- api.add(ADDRESSES.aptos.APT, balance)
+ api.add(token_2_address, fungibleAssetTokenStore_2?.balance || 0);
+ api.add(token_1_address, fungibleAssetTokenStore_1?.balance || 0);
}
}
@@ -42,7 +34,9 @@ module.exports = {
methodology:
"Counts the lamports in each coin container in the Cellena contract account.",
aptos: {
- tvl: async (api) => {
+
+ tvl: async (_, _1, _2, { api }) => {
+
const data = await _getResources()
const coinContainers = data.filter(reserveContrainerFilter)
.map((i) => ({
@@ -53,7 +47,9 @@ module.exports = {
coinContainers.forEach(({ lamports, tokenAddress }) => {
api.add(tokenAddress, lamports);
});
- await _getCELLbalances(api)
+ //get funible asset balance
+ await getfungibleAssetBalances(api)
+ console.log(api)
}
}
}
\ No newline at end of file
diff --git a/projects/chad-finance/index.js b/projects/chad-finance/index.js
index d764e1ca54..ac55244613 100644
--- a/projects/chad-finance/index.js
+++ b/projects/chad-finance/index.js
@@ -5,4 +5,6 @@ const masterchad = "0xDA094Ee6bDaf65c911f72FEBfC58002e5e2656d1";
module.exports = {
...masterChefExports(masterchad, "fantom", chad, false)
-}
\ No newline at end of file
+}
+
+module.exports.deadFrom = '2022-01-26'
\ No newline at end of file
diff --git a/projects/chadfinance/index.js b/projects/chadfinance/index.js
new file mode 100644
index 0000000000..c2ec8199a7
--- /dev/null
+++ b/projects/chadfinance/index.js
@@ -0,0 +1,7 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+const factory = '0x0DF45d6e3BC41fd8e50d9e227215413053c003Ad' // same on all chains
+
+module.exports = uniV3Export({
+ scroll: { factory, fromBlock: 5288937, }
+})
\ No newline at end of file
diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js
index c0df864050..fab8d065e0 100644
--- a/projects/chaingpt/index.js
+++ b/projects/chaingpt/index.js
@@ -8,57 +8,89 @@ const stakingpool2 = "0x62A402DEf6Ca37E9CA7a544bE34954748088CCEE";
const stakingpool3 = "0x6eE8D743Eb8bEc665AaCdb535f2F100f040Ca6C5";
const config = {
- ethereum: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 17003869 },
- polygon: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 45136100 },
- bsc: { factory: '0xc263365D628568C23d61BDDa24C8EB27CEF4E917', fromBlock: 30004999 },
- arbitrum: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 111699000 },
- avax: { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 32665049 }
+ ethereum: [
+ { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 17003869 },
+ { factory: '0xa433b2748d718108323316f460F449453C36420E', fromBlock: 19003869 },
+ ],
+ polygon: [
+ { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 45136100 },
+ { factory: '0x9A6f649e421398eeab450b164D9b81Cc4A55A0eA', fromBlock: 57562100 },
+ ],
+ bsc: [
+ { factory: '0xc263365D628568C23d61BDDa24C8EB27CEF4E917', fromBlock: 30004999 },
+ { factory: '0x5fC22396a063cabb5E09BA6ba449C9646155Ed3f', fromBlock: 39171504 },
+ ],
+ arbitrum: [
+ { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 111699000 },
+ { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 216556000 },
+ ],
+ avax: [
+ { factory: '0xF276Bf68Dde58904439f11f6eD1511e89A7f5a4A', fromBlock: 32665049 },
+ { factory: '0x2D47310bB0C6A9D4ae2a1d6625eC0BEe4F473Bb6', fromBlock: 46082883 },
+ ],
+ core: [
+ { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 15191500 },
+ ],
+ base: [
+ { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 15137100 },
+ ],
+ xlayer: [
+ { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 2353300 },
+ ],
+ linea: [
+ { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 5006600 },
+ ],
+ era: [
+ { factory: '0xf25F7c9522cdCD839697F1644CFCA1312306885C', fromBlock: 37458600 },
+ ]
}
async function tvl(api) {
- const { factory, fromBlock } = config[api.chain]
-
- const logs2 = await getLogs({
- api,
- target: factory,
- eventAbi: 'event PresalePoolCreated (address registedBy, address indexed token, address indexed pool, uint256 poolId)',
- fromBlock: fromBlock,
-
- })
- const pools = []
- const poolFromBlocks = {}
- logs2.forEach((i) => {
- pools.push(i.args.pool)
- poolFromBlocks[i.args.pool] = i.blockNumber
- })
-
+ const chainConfigs = config[api.chain]
const ownerTokens = []
const poolTokenMapping = {}
- await PromisePool
- .withConcurrency(7)
- .for(pools)
- .process(async pool => {
- const fromBlock = poolFromBlocks[pool]
- if (!fromBlock) return;
- const logs = await getLogs({
- api,
- target: pool,
- eventAbi: 'event PresalePoolCreated (address token, uint256 openTime, uint256 closeTime, address offeredCurrency, uint256 offeredCurrencyDecimals, uint256 offeredCurrencyRate, address wallet, address owner)',
- fromBlock,
- })
- logs.forEach(({ args: i }) => {
- const key = i.token + '-' + i.owner
- if (!poolTokenMapping[key]) poolTokenMapping[key] = []
- poolTokenMapping[key].push(i.offeredCurrency)
- })
+ for (const chainConfig of chainConfigs) {
+ const { factory, fromBlock } = chainConfig
+
+ const logs2 = await getLogs({
+ api,
+ target: factory,
+ eventAbi: 'event PresalePoolCreated (address registedBy, address indexed token, address indexed pool, uint256 poolId)',
+ fromBlock: fromBlock,
+
+ })
+ const pools = []
+ const poolFromBlocks = {}
+ logs2.forEach((i) => {
+ pools.push(i.args.pool)
+ poolFromBlocks[i.args.pool] = i.blockNumber
})
+ await PromisePool
+ .withConcurrency(7)
+ .for(pools)
+ .process(async pool => {
+ const fromBlock = poolFromBlocks[pool]
+ if (!fromBlock) return;
+ const logs = await getLogs({
+ api,
+ target: pool,
+ eventAbi: 'event PresalePoolCreated (address token, uint256 openTime, uint256 closeTime, address offeredCurrency, uint256 offeredCurrencyDecimals, uint256 offeredCurrencyRate, address wallet, address owner)',
+ fromBlock,
+ })
+ logs.forEach(({ args: i }) => {
+ const key = i.token + '-' + i.owner
+ if (!poolTokenMapping[key]) poolTokenMapping[key] = []
+ poolTokenMapping[key].push(i.offeredCurrency)
+ })
+ })
- logs2.forEach(({ args: i }) => {
- const key = i.token + '-' + i.registedBy
- if (!poolTokenMapping[key]) return;
+ logs2.forEach(({ args: i }) => {
+ const key = i.token + '-' + i.registedBy
+ if (!poolTokenMapping[key]) return;
- ownerTokens.push([poolTokenMapping[key], i.pool])
- })
+ ownerTokens.push([poolTokenMapping[key], i.pool])
+ })
+ }
return api.sumTokens({ ownerTokens })
}
diff --git a/projects/chi-protocol/index.js b/projects/chi-protocol/index.js
index a2914a14e1..117d14ce92 100644
--- a/projects/chi-protocol/index.js
+++ b/projects/chi-protocol/index.js
@@ -1,3 +1,4 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require('../helper/unwrapLPs');
const { pool2s } = require("../helper/pool2");
@@ -6,8 +7,8 @@ const USC_STAKING = '0x60aBb55c8488698153dB0AF2af362EdB25A505e3';
const CHI_STAKING = '0xaB1dCa1C0f948c268652eedC676966002Ae241c6';
const CHI_LOCKING = '0xE3dD17ff009bAC84e32130fcA5f01C908e956603';
const CHI_VESTING = '0x426DBAa2B33cE1B833C13b72503F5128AFef79fC';
-const STETH = '0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84';
-const WETH = '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2'
+const STETH = ADDRESSES.ethereum.STETH;
+const WETH = ADDRESSES.ethereum.WETH
const USC = '0x38547D918b9645F2D94336B6b61AEB08053E142c';
const CHI = '0x3b21418081528845a6DF4e970bD2185545b712ba';
diff --git a/projects/chickenswap/index.js b/projects/chickenswap/index.js
index a26158a4c6..4e70c59465 100644
--- a/projects/chickenswap/index.js
+++ b/projects/chickenswap/index.js
@@ -67,7 +67,4 @@ module.exports = {
pool2: pool2(chickenChefContract, WETH_KFC_UNIV2),
tvl: sdk.util.sumChainTvls([dexTVL, ethTvl,]),
},
- methodology:
- `We count liquidity on the Vaults (only single tokens) through ChickenChef Contract and the liquuidity on the AMM Pools (only pairs)
- pulling data from the subgraph at https://api.thegraph.com/subgraphs/name/chickenswap/graph`,
};
\ No newline at end of file
diff --git a/projects/chiliz-governance-staking/index.js b/projects/chiliz-governance-staking/index.js
new file mode 100644
index 0000000000..02b9552918
--- /dev/null
+++ b/projects/chiliz-governance-staking/index.js
@@ -0,0 +1,9 @@
+const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs");
+const STAKING_CONTRACT = '0x0000000000000000000000000000000000001000';
+
+module.exports = {
+ methodology: 'Total CHZ Locked in Staking System Contract.',
+ chz: {
+ tvl: sumTokensExport({ owner: STAKING_CONTRACT, tokens: [nullAddress] }),
+ }
+}
\ No newline at end of file
diff --git a/projects/cian-lst/index.js b/projects/cian-lst/index.js
index 426b6bedf8..8c63ebd905 100644
--- a/projects/cian-lst/index.js
+++ b/projects/cian-lst/index.js
@@ -1,23 +1,25 @@
const config = {
ethereum: [
- '0xcDd374F491fBF3f4FcF6E9023c99043774005137',
- '0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34',
- '0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C',
+ "0xcDd374F491fBF3f4FcF6E9023c99043774005137",
+ "0xB8c0c50D255B93f5276549cbA7F4bf78751A5D34",
+ "0x88508306E43FCe43F7f2c1e7D73c88cf6a523f6C",
+ "0xD34f59E172cF3915f56C96A3037Ac554A7399D77", // PYUSD Optimized Long-Short (variant 1)
],
- optimism: ['0x907883da917ca9750ad202ff6395C4C6aB14e60E'],
- bsc: ['0xEa5f10A0E612316A47123D818E2b597437D19a17'],
- arbitrum: ['0xE946Dd7d03F6F5C440F68c84808Ca88d26475FC5'],
- base: ['0x9B2316cfe980515de7430F1c4E831B89a5921137'],
-}
+ optimism: ["0x907883da917ca9750ad202ff6395C4C6aB14e60E"],
+ bsc: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"],
+ arbitrum: ["0xE946Dd7d03F6F5C440F68c84808Ca88d26475FC5", "0xED5f727107BdAC99443bAE317E0eF38239719e87"],
+ base: ["0x9B2316cfe980515de7430F1c4E831B89a5921137"],
+ scroll: ["0xEa5f10A0E612316A47123D818E2b597437D19a17"],
+};
module.exports = {
doublecounted: true,
};
-Object.keys(config).forEach(chain => {
+Object.keys(config).forEach((chain) => {
module.exports[chain] = {
tvl: async (api) => {
- return api.erc4626Sum({ calls: config[chain], isOG4626: true })
- }
- }
-})
+ return api.erc4626Sum({ calls: config[chain], isOG4626: true, permitFailure:true });
+ },
+ };
+});
diff --git a/projects/cketh/index.js b/projects/cketh/index.js
index d9e7d0c8ba..0a12acb973 100644
--- a/projects/cketh/index.js
+++ b/projects/cketh/index.js
@@ -1,9 +1,16 @@
const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");
+// const { get } = require('../helper/http')
+const ADDRESSES = require('../helper/coreAssets.json')
const contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80";
async function tvl(api) {
- return sumTokens2({ tokens: [nullAddress], owner: contract, api });
+ // var end = api.timestamp
+ // let start = end - 24 * 60 * 60;
+ // const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/xevnm-gaaaa-aaaar-qafnq-cai/total-supply?start=${start}&end=${end}&step=1`);
+ // let [_, bal] = data.pop()
+ // api.add(ADDRESSES.ethereum.USDC, bal/1e2)
+ return sumTokens2({ tokens: [nullAddress, ADDRESSES.ethereum.USDC], owner: contract, api });
}
module.exports = {
diff --git a/projects/clearpool-rwa/index.js b/projects/clearpool-rwa/index.js
new file mode 100644
index 0000000000..9d2fecc999
--- /dev/null
+++ b/projects/clearpool-rwa/index.js
@@ -0,0 +1,21 @@
+const { sumTokens2 } = require("../helper/unwrapLPs")
+
+const config = {
+ ethereum: [
+ '0x7a486f809c952a6f8dec8cb0ff68173f2b8ed56c', // USDX
+ ],
+ flare: [
+ '0x4a771cc1a39fdd8aa08b8ea51f7fd412e73b3d2b', // USDX
+ ]
+}
+
+Object.keys(config).forEach(chain => {
+ const tokens = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const supply = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens})
+ api.add(tokens, supply)
+ return sumTokens2({ api })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js
index 0fd614a23b..1de97ee2fb 100644
--- a/projects/clearpool/index.js
+++ b/projects/clearpool/index.js
@@ -1,14 +1,15 @@
-const abi = require("./abi.json");
+const abi = require("./abi.json")
-const { stakings } = require("../helper/staking");
-const { getLogs } = require("../helper/cache/getLogs");
+const { stakings } = require("../helper/staking")
+const { getLogs } = require("../helper/cache/getLogs")
+const { sumTokens2 } = require("../helper/unwrapLPs")
-const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"];
-const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5";
+const singleStakingContracts = ["0x629E39da1Db5654fe59cAE31d48CAEBB8dC2A9c6"]
+const CPOOL = "0x66761fa41377003622aee3c7675fc7b5c1c2fac5"
module.exports = {
methodology: "We count liquidity by Stables deposited on the pools contracts",
-};
+}
const CHAIN = {
ARBITRUM: "arbitrum",
@@ -20,7 +21,11 @@ const CHAIN = {
FLARE: "flare",
BASE: "base",
MANTLE: "mantle",
-};
+}
+
+const blacklistedTokens = {
+ flare: ['0x4a771cc1a39fdd8aa08b8ea51f7fd412e73b3d2b'],
+}
const config = {
[CHAIN.ETHEREUM]: {
@@ -60,6 +65,10 @@ const config = {
factory: "0x99C10A7aBd93b2db6d1a2271e69F268a2c356b80",
fromBlock: 113112037,
},
+ prime: {
+ factory: "0x44fEF0fAB3A96CA34b06d5142350Ef9223F65A7e",
+ fromBlock: 226174706,
+ },
},
[CHAIN.MANTLE]: {
dynamic: {
@@ -97,55 +106,47 @@ const config = {
fromBlock: 23711495,
},
},
-};
+}
const getEventAndABI = (protocol) => {
- let borrowFn = "";
- let abi = "";
+ let borrowFn
+ let abi
switch (protocol) {
case "dynamic":
- (abi =
- "event PoolCreated(address indexed pool, address indexed owner, address indexed token)"),
- (borrowFn = "uint256:borrows");
- break;
+ abi = "event PoolCreated(address indexed pool, address indexed owner, address indexed token)";
+ borrowFn = "uint256:borrows"; break;
case "vaults":
- (abi =
- "event PoolCreated(uint256 depositCap, uint256 repaymentFrequency, uint256 minimumNoticePeriod, uint256 minDeposit, uint256 lendAPR, address indexed asset, address indexed borrower, address pool, address bondNft, bool indexed kycRequired)"),
- (borrowFn = "uint256:poolSize");
- break;
+ abi = "event PoolCreated(uint256 depositCap, uint256 repaymentFrequency, uint256 minimumNoticePeriod, uint256 minDeposit, uint256 lendAPR, address indexed asset, address indexed borrower, address pool, address bondNft, bool indexed kycRequired)";
+ borrowFn = "uint256:poolSize"; break;
case "treasury":
- (abi =
- "event PoolCreated(address asset, address treasuryYieldAddress, address manager, bool kycRequired)"),
- (borrowFn = "uint256:cash");
- break;
+ abi = "event PoolCreated(address asset, address treasuryYieldAddress, address manager, bool kycRequired)";
+ borrowFn = "uint256:cash"; break;
case "prime":
- abi =
- "event PoolCreated(address pool, address indexed borrower, bool isBulletLoan, address indexed asset, uint256 size, uint256 rateMantissa, uint256 tenor, uint256 depositWindow, uint256 spreadRate, uint256 originationRate, uint256 incrementPerRoll, uint256 penaltyRatePerYear)";
- borrowFn = "uint256:currentSize";
- break;
+ abi = "event PoolCreated(address pool, address indexed borrower, bool isBulletLoan, address indexed asset, uint256 size, uint256 rateMantissa, uint256 tenor, uint256 depositWindow, uint256 spreadRate, uint256 originationRate, uint256 incrementPerRoll, uint256 penaltyRatePerYear)"
+ borrowFn = "uint256:currentSize"; break;
}
- return { borrowFn, abi };
-};
+ return { borrowFn, abi }
+}
const prepareProtocolsPerChain = (chain) => {
- let contracts = [];
- const protocols = Object.keys(config[chain]);
+ let contracts = []
+ const protocols = Object.keys(config[chain])
protocols.forEach((protocol) => {
- const { fromBlock, factory } = config[chain][protocol];
- const { abi, borrowFn } = getEventAndABI(protocol);
+ const { fromBlock, factory } = config[chain][protocol]
+ const { abi, borrowFn } = getEventAndABI(protocol)
contracts.push({
fromBlock,
factory,
abi,
borrowFn,
protocol,
- });
- });
- return contracts;
-};
+ })
+ })
+ return contracts
+}
Object.keys(config).forEach((chain) => {
- const dataPerChain = prepareProtocolsPerChain(chain);
+ const dataPerChain = prepareProtocolsPerChain(chain)
const _getLogs = async (api, factory, fromBlock, abi, protocol) => {
const logs = await getLogs({
api,
@@ -153,43 +154,43 @@ Object.keys(config).forEach((chain) => {
fromBlock,
eventAbi: abi,
onlyArgs: true,
- });
+ })
const pools = logs.map((log) =>
protocol == "treasury" ? log.treasuryYieldAddress : log.pool
- );
+ )
const tokens = logs.map((log) =>
protocol == "dynamic" ? log.token : log.asset
- );
- return { pools, tokens };
- };
+ )
+ return { pools, tokens }
+ }
const tvl = async (api) => {
- let allTokens = [];
- let allPools = [];
+ let allTokens = []
+ let allPools = []
const promiseArray = dataPerChain.map(
- async ({ factory, fromBlock, abi, borrowFn, protocol }) => {
+ async ({ factory, fromBlock, abi, protocol }) => {
const { pools, tokens } = await _getLogs(
api,
factory,
fromBlock,
abi,
protocol
- );
- allTokens.push(...tokens);
- allPools.push(...pools);
+ )
+ allTokens.push(...tokens)
+ allPools.push(...pools)
}
- );
+ )
- await Promise.all(promiseArray);
+ await Promise.all(promiseArray)
- return api.sumTokens({ tokensAndOwners2: [allTokens, allPools] });
- };
+ return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools], blacklistedTokens: blacklistedTokens[chain]})
+ }
const borrowed = async (api) => {
- const balances = [];
- const allTokens = [];
+ const balances = []
+ const allTokens = []
const promiseArray = dataPerChain.map(
async ({ factory, fromBlock, abi, borrowFn, protocol }) => {
@@ -199,17 +200,20 @@ Object.keys(config).forEach((chain) => {
fromBlock,
abi,
protocol
- );
- const bals = await api.multiCall({ abi: borrowFn, calls: pools });
- balances.push(...bals);
- allTokens.push(...tokens);
+ )
+ const bals = await api.multiCall({ abi: borrowFn, calls: pools })
+ balances.push(...bals)
+ allTokens.push(...tokens)
}
- );
- await Promise.all(promiseArray);
+ )
+ await Promise.all(promiseArray)
- return api.addTokens(allTokens, balances);
- };
- module.exports[chain] = { tvl, borrowed };
-});
+ api.addTokens(allTokens, balances)
+ if (blacklistedTokens[chain]) {
+ blacklistedTokens[chain].forEach((token) => api.removeTokenBalance(token))
+ }
+ }
+ module.exports[chain] = { tvl, borrowed }
+})
-module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL);
+module.exports.ethereum.staking = stakings(singleStakingContracts, CPOOL)
\ No newline at end of file
diff --git a/projects/clearpool/readme.md b/projects/clearpool/readme.md
new file mode 100644
index 0000000000..3848cc0968
--- /dev/null
+++ b/projects/clearpool/readme.md
@@ -0,0 +1,31 @@
+# Add a new protocol and network
+
+## To add a new protocol or network
+```
+1. Open https://squid.subsquid.io/cpool-squid/v/v1/graphql on browser
+```
+
+```
+2. Query `defillamaInfo`
+
+ex. query MyQuery {
+ defillamaInfo {
+ poolFactory
+ protocol
+ }
+}
+```
+
+```
+3. Check the newly added protocols and networks, and proceed to hardcode their values in index.js, following the approach used for the existing networks and protocols.
+```
+```
+4. run `npm i -f` to install dependencies.
+```
+
+```
+5. run `node test.js projects/clearpool/index.js` to test.
+```
+
+
+
diff --git a/projects/clip-finance/index.js b/projects/clip-finance/index.js
index 618798dd48..f52cb9124c 100644
--- a/projects/clip-finance/index.js
+++ b/projects/clip-finance/index.js
@@ -18,15 +18,18 @@ const VaultType = {
MendiLending: 3,
Aero: 4,
LynexAlgebra: 5,
+ NileCl: 6,
};
const typesDataInterfaces = {
any: ["uint256"], // has only vaultType
+ amm: ["uint256", "address"], // vaultType, amm pool address
[VaultType.PancakeV3]: ["uint256", "address"], // vaultType, v3 pool address
[VaultType.Stargate]: ["uint256"], // vaultType
[VaultType.MendiLending]: ["uint256", "address"], //vaultType, mendiLeverage address
[VaultType.Aero]: ["uint256"], //vaultType
[VaultType.LynexAlgebra]: ["uint256", "address"], // vaultType, algebra pool address
+ [VaultType.NileCl]: ["uint256", "address", "address"], // vaultType, nileCl pool address, stacking contract address
};
const tvl = async (api) => {
@@ -38,14 +41,16 @@ const tvl = async (api) => {
const vaults = vaultDatas.map((i) => ({ ...i, vaultType: decoder.decode(typesDataInterfaces.any, i.data) }));
//ammVaults
- const appTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra];
- const ammVaults = vaults.filter((i) => appTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault);
+ const ammTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra, VaultType.NileCl];
+ const ammVaults = vaults.filter((i) => ammTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault);
const ammPools = vaults
- .filter((i) => appTypes.includes(Number(i.vaultType.toString())))
- .map((i) => "0x" + i.data.slice(-40));
+ .filter((i) => ammTypes.includes(Number(i.vaultType.toString())))
+ .map((i) => decoder.decode(typesDataInterfaces.amm, i.data)[1]);
+
const ammBalances = await api.multiCall({ abi: abis.getTotalAmounts, calls: ammVaults });
const ammToken0s = await api.multiCall({ abi: "address:token0", calls: ammPools });
const ammToken1s = await api.multiCall({ abi: "address:token1", calls: ammPools });
+
ammBalances.forEach((pool, i) => {
api.add(ammToken0s[i], pool.total0);
api.add(ammToken1s[i], pool.total1);
diff --git a/projects/clober-v2/index.js b/projects/clober-v2/index.js
new file mode 100644
index 0000000000..84fd0a8586
--- /dev/null
+++ b/projects/clober-v2/index.js
@@ -0,0 +1,25 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+
+const abi = {
+ openEvent: 'event Open(uint192 indexed id, address indexed base, address indexed quote, uint64 unitSize, uint24 makerPolicy, uint24 takerPolicy, address hooks)',
+}
+
+const config = {
+ base: { factory: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76', fromBlock: 14528050, },
+ era: { factory: '0xAaA0e933e1EcC812fc075A81c116Aa0a82A5bbb8', fromBlock: 34448160, },
+}
+
+async function tvl(api) {
+ const { factory, fromBlock } = config[api.chain]
+ const logs = await getLogs2({ api, factory, eventAbi: abi.openEvent, fromBlock, })
+ const tokens = logs.map(({ base, quote }) => [base, quote]).flat()
+ return api.sumTokens({ owner: factory, tokens, })
+}
+
+module.exports = {
+ methodology: "TVL consists of assets deposited into the Clober Book Manager contract",
+};
+
+Object.keys(config).forEach(chain => {
+ module.exports[chain] = { tvl }
+})
\ No newline at end of file
diff --git a/projects/clone/index.js b/projects/clone/index.js
index 88136f79d8..13dabc9eaf 100644
--- a/projects/clone/index.js
+++ b/projects/clone/index.js
@@ -1,16 +1,17 @@
-const anchor = require("@coral-xyz/anchor");
+const { Program } = require("@project-serum/anchor");
const { sumTokens2, getProvider, } = require("../helper/solana");
+const { PublicKey } = require("@solana/web3.js")
-const programId = new anchor.web3.PublicKey('C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr')
+const programId = new PublicKey('C1onEW2kPetmHmwe74YC1ESx3LnFEpVau6g2pg4fHycr')
async function tvl() {
const provider = getProvider()
- const idl = await anchor.Program.fetchIdl(programId, provider)
- const program = new anchor.Program(idl, programId, provider)
+ const idl = await Program.fetchIdl(programId, provider)
+ const program = new Program(idl, programId, provider)
let tokenAccounts = []
- const cloneAccountAddress = anchor.web3.PublicKey.findProgramAddressSync(
+ const cloneAccountAddress = PublicKey.findProgramAddressSync(
[Buffer.from("clone")], programId)[0]
const cloneAccount = await program.account.clone.fetch(cloneAccountAddress)
diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js
index 7932a5dde4..dae13fed8e 100644
--- a/projects/compound-v3/index.js
+++ b/projects/compound-v3/index.js
@@ -5,16 +5,22 @@ module.exports = compoundV3Exports({
markets: [
'0xc3d688B66703497DAA19211EEdff47f25384cdc3', // USDC Market
'0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market
+ '0x3Afdc9BCA9213A35503b077a6072F3D0d5AB0840', // USDT Market
],
},
arbitrum: {
markets: [
'0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA', // USDC.e Market
'0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDC Market
+ '0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486', // WETH Market
+ '0x5C58d4479A1E9b2d19EE052143FA73F0ee79A36e', // USDT Market
],
},
polygon: {
- markets: ['0xF25212E676D1F7F89Cd72fFEe66158f541246445'], // USDC.e Market
+ markets: [
+ '0xF25212E676D1F7F89Cd72fFEe66158f541246445', // USDC.e Market
+ '0xaeB318360f27748Acb200CE616E389A6C9409a07', // USDT Market
+ ],
},
base: {
markets: [
@@ -27,6 +33,10 @@ module.exports = compoundV3Exports({
markets: ['0xB2f97c1Bd3bf02f5e74d13f02E3e26F93D77CE44'], // USDC Market
},
optimism: {
- markets: ['0x2e44e174f7D53F0212823acC11C01A11d58c5bCB'], // USDC Matket
+ markets: [
+ '0x2e44e174f7D53F0212823acC11C01A11d58c5bCB', // USDC Market
+ '0x995E394b8B2437aC8Ce61Ee0bC610D617962B214', // USDT Market
+ '0xE36A30D249f7761327fd973001A32010b521b6Fd', // ETH Market
+ ],
}
})
diff --git a/projects/concentrator/abis/AladdinRUSD.json b/projects/concentrator/abis/AladdinRUSD.json
new file mode 100644
index 0000000000..cdfb2cd32c
--- /dev/null
+++ b/projects/concentrator/abis/AladdinRUSD.json
@@ -0,0 +1,3 @@
+{
+ "getTotalAssets": "uint256:getTotalAssets"
+}
diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js
index 47e722850c..10500adb55 100644
--- a/projects/concentrator/index.js
+++ b/projects/concentrator/index.js
@@ -1,61 +1,77 @@
-const ADDRESSES = require('../helper/coreAssets.json')
+const ADDRESSES = require("../helper/coreAssets.json");
const sdk = require("@defillama/sdk");
-const abi = require('./abis/abi.json')
+const abi = require("./abis/abi.json");
const { default: BigNumber } = require("bignumber.js");
-const AladdinConvexVaultABI = require('./abis/AladdinConvexVault.json')
-const AladdinCRVABI = require('./abis/AladdinCRV.json')
-const AladdinAFXSABI = require('./abis/AladdinAFXS.json')
-const AladdinCVXABI = require('./abis/AladdinCVX.json')
-const AladdinSdCRVABI = require('./abis/AladdinSdCRV.json')
-const { farmConfig } = require('./config.js');
+const AladdinConvexVaultABI = require("./abis/AladdinConvexVault.json");
+const AladdinCRVABI = require("./abis/AladdinCRV.json");
+const AladdinAFXSABI = require("./abis/AladdinAFXS.json");
+const AladdinCVXABI = require("./abis/AladdinCVX.json");
+const AladdinSdCRVABI = require("./abis/AladdinSdCRV.json");
+const AladdinRUSDABI = require("./abis/AladdinRUSD.json");
+const { farmConfig } = require("./config.js");
-
-const concentratorVault = '0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8';
-const concentratorAcrv = '0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884';
-const concentratorAFXS = '0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9';
+const concentratorVault = "0xc8fF37F7d057dF1BB9Ad681b53Fa4726f268E0e8";
+const concentratorAcrv = "0x2b95A1Dcc3D405535f9ed33c219ab38E8d7e0884";
+const concentratorAFXS = "0xDAF03D70Fe637b91bA6E521A32E1Fb39256d3EC9";
const concentratorAFrxETH = "0xb15Ad6113264094Fd9BF2238729410A07EBE5ABa";
const cvxcrvAddress = ADDRESSES.ethereum.cvxCRV;
-const concentratorAbcCVXAddress = '0xDEC800C2b17c9673570FDF54450dc1bd79c8E359';
-const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922"
+const concentratorAbcCVXAddress = "0xDEC800C2b17c9673570FDF54450dc1bd79c8E359";
+const concentratorAsdCRVAddress = "0x43E54C2E7b3e294De3A155785F52AB49d87B9922";
const aladdinCVXAddress = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777";
+const arUSDAddress = "0x549716F858aefF9CB845d4C78c67A7599B0Df240";
+const arUSD4626Address = "0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a";
+const rUSDAddress = "0x65D72AA8DA931F047169112fcf34f52DbaAE7D18";
-const concentratorNewVault = '0x3Cf54F3A1969be9916DAD548f3C084331C4450b5';
-const concentratorAfxsVault = '0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1';
-const concentratorAfrxETHVault = '0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D';
+const concentratorNewVault = "0x3Cf54F3A1969be9916DAD548f3C084331C4450b5";
+const concentratorAfxsVault = "0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1";
+const concentratorAfrxETHVault = "0x50B47c4A642231dbe0B411a0B2FBC1EBD129346D";
const concentratorAsdCRVVault = "0x59866EC5650e9BA00c51f6D681762b48b0AdA3de";
const usdtAddress = ADDRESSES.ethereum.USDT;
-const aladdinBalancerLPGauge = '0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0';
-const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904"
-const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6"
-const sdCRVAddress = '0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5'
+const aladdinBalancerLPGauge = "0x33e411ebE366D72d058F3eF22F1D0Cf8077fDaB0";
+const clevCVXAddress = "0xf05e58fCeA29ab4dA01A495140B349F8410Ba904";
+const clevCVXCVXAddress = "0xF9078Fb962A7D13F55d40d49C8AA6472aBD1A5a6";
+const sdCRVAddress = "0xD1b5651E55D4CeeD36251c61c50C889B36F6abB5";
const cvxAddress = ADDRESSES.ethereum.CVX;
-const chain = 'ethereum';
+const chain = "ethereum";
async function getBalancerLpTvl(balances, block) {
- const ctrLpTotalSupply = (await sdk.api.abi.call({
- target: aladdinBalancerLPGauge,
- block,
- abi: 'erc20:totalSupply',
- params: []
- })).output;
- sdk.util.sumSingleBalance(balances, usdtAddress, (BigNumber(ctrLpTotalSupply).shiftedBy(-12)).toFixed(0))
+ const ctrLpTotalSupply = (
+ await sdk.api.abi.call({
+ target: aladdinBalancerLPGauge,
+ block,
+ abi: "erc20:totalSupply",
+ params: [],
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ usdtAddress,
+ BigNumber(ctrLpTotalSupply).shiftedBy(-12).toFixed(0)
+ );
}
async function getFarmLpTvl(balances, block) {
- const farmData = farmConfig[0]
- const ctrLpTotalSupply = (await sdk.api.abi.call({
- target: farmData.addresses.gauge,
- block,
- abi: 'erc20:totalSupply',
- params: []
- })).output;
- sdk.util.sumSingleBalance(balances, farmData.addresses.lpToken, ctrLpTotalSupply, chain)
+ const farmData = farmConfig[0];
+ const ctrLpTotalSupply = (
+ await sdk.api.abi.call({
+ target: farmData.addresses.gauge,
+ block,
+ abi: "erc20:totalSupply",
+ params: [],
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ farmData.addresses.lpToken,
+ ctrLpTotalSupply,
+ chain
+ );
}
async function tvl(api) {
- const block = api.block
- let balances = {}
+ const block = api.block;
+ let balances = {};
await Promise.all([
getBalancerLpTvl(balances, block),
getFarmLpTvl(balances, block),
@@ -64,39 +80,44 @@ async function tvl(api) {
getAbcCVXInfo(balances, block),
getAsdCRVInfo(balances, block),
getAladdinCVXInfo(balances, block),
- getVaultInfo('old', balances, block),
- getVaultInfo('New', balances, block),
- getVaultInfo('afxs', balances, block),
- getVaultInfo('afrxETH', balances, block),
+ getAladdinRUSDInfo(balances, block),
+ getVaultInfo("old", balances, block),
+ getVaultInfo("New", balances, block),
+ getVaultInfo("afxs", balances, block),
+ getVaultInfo("afrxETH", balances, block),
getVaultInfo("asdCRV", balances, block),
addACRVbalance(balances, api),
- ])
- return balances
+ ]);
+ return balances;
}
async function addACRVbalance(balances, api) {
const acrvTotalUnderlying = await api.call({
target: concentratorAcrv,
abi: AladdinCRVABI.totalUnderlying,
- })
- sdk.util.sumSingleBalance(balances, cvxcrvAddress, acrvTotalUnderlying, api.chain)
-
+ });
+ sdk.util.sumSingleBalance(
+ balances,
+ cvxcrvAddress,
+ acrvTotalUnderlying,
+ api.chain
+ );
}
async function getVaultInfo(type, balances, block) {
let _target = concentratorVault;
let _abi = AladdinConvexVaultABI.poolInfo;
switch (type) {
- case 'old':
+ case "old":
_target = concentratorVault;
break;
- case 'New':
+ case "New":
_target = concentratorNewVault;
break;
- case 'afxs':
+ case "afxs":
_target = concentratorAfxsVault;
break;
- case 'afrxETH':
+ case "afrxETH":
_target = concentratorAfrxETHVault;
_abi = AladdinConvexVaultABI.afraxETHPoolInfo;
break;
@@ -105,63 +126,114 @@ async function getVaultInfo(type, balances, block) {
_abi = AladdinConvexVaultABI.asdCRVPoolInfo;
break;
}
- let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: abi.poolLength, itemAbi: _abi, target: _target })
+ let poolInfo = await sdk.api2.abi.fetchList({
+ chain,
+ block,
+ lengthAbi: abi.poolLength,
+ itemAbi: _abi,
+ target: _target,
+ });
poolInfo.forEach((item) => {
- if (type == 'afrxETH' || type == 'asdCRV') {
- sdk.util.sumSingleBalance(balances, item.strategy.token, item.supply.totalUnderlying, chain)
+ if (type == "afrxETH" || type == "asdCRV") {
+ sdk.util.sumSingleBalance(
+ balances,
+ item.strategy.token,
+ item.supply.totalUnderlying,
+ chain
+ );
} else {
- sdk.util.sumSingleBalance(balances, item.lpToken, item.totalUnderlying, chain)
+ sdk.util.sumSingleBalance(
+ balances,
+ item.lpToken,
+ item.totalUnderlying,
+ chain
+ );
}
- })
+ });
}
async function getAFXSInfo(balances, block) {
const cvxfxsCrvInfo = {
- lpToken: '0xF3A43307DcAFa93275993862Aae628fCB50dC768'
- }
- const aFXSTotalUnderlying = (await sdk.api.abi.call({
- target: concentratorAFXS,
- block,
- abi: AladdinAFXSABI.totalAssets,
- })).output;
+ lpToken: "0xF3A43307DcAFa93275993862Aae628fCB50dC768",
+ };
+ const aFXSTotalUnderlying = (
+ await sdk.api.abi.call({
+ target: concentratorAFXS,
+ block,
+ abi: AladdinAFXSABI.totalAssets,
+ })
+ ).output;
- sdk.util.sumSingleBalance(balances, cvxfxsCrvInfo.lpToken, aFXSTotalUnderlying, chain)
+ sdk.util.sumSingleBalance(
+ balances,
+ cvxfxsCrvInfo.lpToken,
+ aFXSTotalUnderlying,
+ chain
+ );
}
async function getAfrxETHInfo(balances, block) {
const ethFrxETHCrvInfo = {
- lpToken: '0xf43211935C781D5ca1a41d2041F397B8A7366C7A'
- }
- const aFrxETHTotalUnderlying = (await sdk.api.abi.call({
- target: concentratorAFrxETH,
- block,
- abi: AladdinAFXSABI.totalAssets,
- })).output;
- sdk.util.sumSingleBalance(balances, ethFrxETHCrvInfo.lpToken, aFrxETHTotalUnderlying, chain)
+ lpToken: "0xf43211935C781D5ca1a41d2041F397B8A7366C7A",
+ };
+ const aFrxETHTotalUnderlying = (
+ await sdk.api.abi.call({
+ target: concentratorAFrxETH,
+ block,
+ abi: AladdinAFXSABI.totalAssets,
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ ethFrxETHCrvInfo.lpToken,
+ aFrxETHTotalUnderlying,
+ chain
+ );
}
async function getAbcCVXInfo(balances, block) {
- const totalClevCVXAmount = (await sdk.api.abi.call({
- target: concentratorAbcCVXAddress,
- block,
- abi: AladdinCVXABI.totalDebtToken,
- })).output;
- const totalCurveLpTokenAmount = (await sdk.api.abi.call({
- target: concentratorAbcCVXAddress,
- block,
- abi: AladdinCVXABI.totalCurveLpToken,
- })).output;
- sdk.util.sumSingleBalance(balances, clevCVXAddress, totalClevCVXAmount, chain)
- sdk.util.sumSingleBalance(balances, clevCVXCVXAddress, totalCurveLpTokenAmount, chain)
+ const totalClevCVXAmount = (
+ await sdk.api.abi.call({
+ target: concentratorAbcCVXAddress,
+ block,
+ abi: AladdinCVXABI.totalDebtToken,
+ })
+ ).output;
+ const totalCurveLpTokenAmount = (
+ await sdk.api.abi.call({
+ target: concentratorAbcCVXAddress,
+ block,
+ abi: AladdinCVXABI.totalCurveLpToken,
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ clevCVXAddress,
+ totalClevCVXAmount,
+ chain
+ );
+ sdk.util.sumSingleBalance(
+ balances,
+ clevCVXCVXAddress,
+ totalCurveLpTokenAmount,
+ chain
+ );
}
async function getAsdCRVInfo(balances, block) {
- const asdCRVTotalUnderlying = (await sdk.api.abi.call({
- target: concentratorAsdCRVAddress,
- block,
- abi: AladdinSdCRVABI.totalAssets,
- })).output;
- sdk.util.sumSingleBalance(balances, sdCRVAddress, asdCRVTotalUnderlying, chain)
+ const asdCRVTotalUnderlying = (
+ await sdk.api.abi.call({
+ target: concentratorAsdCRVAddress,
+ block,
+ abi: AladdinSdCRVABI.totalAssets,
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ sdCRVAddress,
+ asdCRVTotalUnderlying,
+ chain
+ );
}
async function getAladdinCVXInfo(balances, block) {
@@ -180,9 +252,25 @@ async function getAladdinCVXInfo(balances, block) {
);
}
+async function getAladdinRUSDInfo(balances, block) {
+ const aladdinRUSDTotalUnderlying = (
+ await sdk.api.abi.call({
+ target: arUSDAddress,
+ block,
+ abi: AladdinRUSDABI.getTotalAssets,
+ })
+ ).output;
+ sdk.util.sumSingleBalance(
+ balances,
+ rUSDAddress,
+ aladdinRUSDTotalUnderlying,
+ chain
+ );
+}
+
module.exports = {
doublecounted: true,
ethereum: {
- tvl
- }
-}
\ No newline at end of file
+ tvl,
+ },
+};
diff --git a/projects/contango-v2/index.js b/projects/contango-v2/index.js
index 8cd411efc6..cf64a0e03b 100644
--- a/projects/contango-v2/index.js
+++ b/projects/contango-v2/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { blockQuery } = require("../helper/http");
const { cachedGraphQuery } = require("../helper/cache");
@@ -8,27 +9,27 @@ const config = {
arbitrum: {
contango: CONTANGO_PROXY,
contango_lens: CONTANGO_LENS_PROXY,
- grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-arbitrum",
+ grapUrl: sdk.graph.modifyEndpoint('BmHqxUxxLuMoDYgbbXU6YR8VHUTGPBf9ghD7XH6RYyTQ'),
},
optimism: {
contango: CONTANGO_PROXY,
contango_lens: CONTANGO_LENS_PROXY,
- grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-optimism",
+ grapUrl: sdk.graph.modifyEndpoint('PT2TcgYqhQmx713U3KVkdbdh7dJevgoDvmMwhDR29d5'),
},
ethereum: {
contango: CONTANGO_PROXY,
contango_lens: CONTANGO_LENS_PROXY,
- grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-mainnet",
+ grapUrl: sdk.graph.modifyEndpoint('FSn2gMoBKcDXEHPvshaXLPC1EJN7YsfCP78swEkXcntY'),
},
polygon: {
contango: CONTANGO_PROXY,
contango_lens: CONTANGO_LENS_PROXY,
- grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-polygon",
+ grapUrl: sdk.graph.modifyEndpoint('5t3rhrAYt79iyjm929hgwyiaPLk9uGxQRMiKEasGgeSP'),
},
xdai: {
contango: CONTANGO_PROXY,
contango_lens: CONTANGO_LENS_PROXY,
- grapUrl: "https://api.thegraph.com/subgraphs/name/contango-xyz/v2-gnosis",
+ grapUrl: sdk.graph.modifyEndpoint('9h1rHUKJK9CGqztdaBptbj4Q9e2zL9jABuu9LpRQ1XkC'),
},
base: {
contango: CONTANGO_PROXY,
diff --git a/projects/contrax-finance/index.js b/projects/contrax-finance/index.js
index 60d1d69d72..4ad4b22c7c 100644
--- a/projects/contrax-finance/index.js
+++ b/projects/contrax-finance/index.js
@@ -26,28 +26,47 @@ const Vaults = [
const HOP_MAGIC_VAULT = "0x2d79B76841191c9c22238535a93Ee8169096A5Cc";
const GMX_VAULT = "0x8CdF8d10ea6Cd3492e67C4250481A695c2a75C4a";
const GMX = ADDRESSES.arbitrum.GMX;
-const STEER_VAULTS = ["0x3fB6C1C5b7319Af78608570F97b920a553aB0Ed3", "0xe41586C416D8fAb3ee01e8a29DaD6f3a8655097d"];
+const STEER_VAULTS = [
+ "0x404148F0B94Bc1EA2fdFE98B0DbF36Ff3E015Bb5",
+ "0x84f35729fF344C76FA73989511735c85E1F7487D",
+ "0x79deCB182664B1E7809a7EFBb94B50Db4D183310",
+ "0x4fFD588241Fa9183f5cDd57C4CACCac3817A380d",
+];
async function getHopMagicData(api) {
- const tokenAddress = await api.call({
- abi: "function token() view returns (address token)",
- target: HOP_MAGIC_VAULT,
- params: [],
- });
- const balance = await api.call({
- abi: "uint256:balance",
- target: HOP_MAGIC_VAULT,
- });
+ const [tokenAddress, balance] = await Promise.all([
+ api.call({ abi: "function token() view returns (address token)", target: HOP_MAGIC_VAULT,params: [] }),
+ api.call({ abi: "uint256:balance", target: HOP_MAGIC_VAULT })
+ ])
api.add(tokenAddress, balance);
}
async function getSteerData(api) {
- let tokens = await api.multiCall({ abi: "address:steerVault", calls: STEER_VAULTS });
- let bals = await api.multiCall({
- abi: "uint256:balance",
- calls: STEER_VAULTS,
- });
- api.addTokens(tokens, bals);
+ const tokens = await api.multiCall({ abi: "address:token", calls: STEER_VAULTS });
+ const [token0s, token1s, supplies, reserves, bals] = await Promise.all([
+ api.multiCall({ abi: "address:token0", calls: tokens }),
+ api.multiCall({ abi: "address:token1", calls: tokens }),
+ api.multiCall({ abi: "uint256:totalSupply", calls: tokens }),
+ api.multiCall({
+ abi: "function getTotalAmounts() view returns (uint256 total0, uint256 total1)",
+ calls: tokens,
+ }),
+ api.multiCall({
+ abi: "uint256:balance",
+ calls: STEER_VAULTS,
+ permitFailure: true
+ }),
+ ]);
+
+
+ for (const [i, bal] of bals.entries()) {
+ if (!bal) continue
+ const ratio = bal / supplies[i];
+ const token0Bal = reserves[i][0] * ratio;
+ const token1Bal = reserves[i][1] * ratio;
+ api.addToken(token0s[i], token0Bal);
+ api.addToken(token1s[i], token1Bal);
+ }
}
async function getGMXData(api) {
@@ -59,19 +78,18 @@ async function getGMXData(api) {
}
async function tvl(api) {
- let tokens = await api.multiCall({ abi: "address:token", calls: Vaults });
- let bals = await api.multiCall({
- abi: "uint256:balance",
- calls: Vaults,
- });
+ const [tokens, bals] = await Promise.all([
+ api.multiCall({ abi: "address:token", calls: Vaults }),
+ api.multiCall({ abi: "uint256:balance", calls: Vaults }),
+ getHopMagicData(api),
+ getGMXData(api),
+ getSteerData(api)
+ ])
// const bals = await api.multiCall({
// abi: "erc20:balanceOf",
// calls: tokens.map((t, i) => ({ target: targets[i], params: [t] })),
// });
- await getHopMagicData(api);
- await getGMXData(api);
- await getSteerData(api);
api.addTokens(tokens, bals);
return sumTokens2({ api, resolveLP: true });
diff --git a/projects/convergence-fi/index.js b/projects/convergence-fi/index.js
new file mode 100644
index 0000000000..140814ebf0
--- /dev/null
+++ b/projects/convergence-fi/index.js
@@ -0,0 +1,82 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+const tower = "0xB0Afc8363b8F36E0ccE5D54251e20720FfaeaeE7";
+const viewer = "0xA3A8cDA21f50b6737385E46FC9495a9998B05Ff0";
+const CVG = "0x97efFB790f2fbB701D88f89DB4521348A2B77be8";
+
+const stkCVGETH = "0x4b3Bd8906083bDE267A79E4131AF7a6f723960c8";
+const stkCVGCVGSDT = "0x865E59EBc3EE9EdD5656cD79b382f5153E466545";
+const cvgCVX = "0x2191DF768ad71140F9F3E96c1e4407A4aA31d082";
+
+const abi = {
+ getSdtStakings: `function getSdtStakings(uint256 _cursorStart, uint256 _lengthDesired) view returns (tuple(address stakingContract, string stakingName)[])`,
+ getGlobalViewCvgSdtStaking:
+ "function getGlobalViewCvgSdtStaking(address _stakingContract) view returns (tuple(address cvgSdt, address stakingAddress, uint256 cvgCycle, uint256 previousTotal, uint256 actualTotal, uint256 nextTotal) globalViewCvgSdtStaking)",
+ staking_token: "function staking_token() view returns (address)",
+ token: "function token() view returns (address)",
+};
+
+const getSdtStakingsAddresses = async (api, tower, limit) => {
+ const addresses = await api.call({
+ target: tower,
+ params: [0, limit],
+ abi: abi.getSdtStakings,
+ });
+
+ return addresses.map(({ stakingContract }) => stakingContract);
+};
+
+const getsdtStakingViews = async (api, viewer, sdtStakings) => {
+ const stakingdatasRes = await api.multiCall({
+ target: viewer,
+ calls: sdtStakings,
+ abi: abi.getGlobalViewCvgSdtStaking,
+ });
+
+ const stakingDatas = stakingdatasRes.map(({ cvgSdt, actualTotal }) => ({
+ staking: cvgSdt,
+ balance: actualTotal,
+ }));
+
+ const stakingTokens = await api.multiCall({
+ calls: stakingDatas.map(({ staking }) => ({ target: staking })),
+ abi: abi.staking_token,
+ });
+
+
+ const deeperUnwrapTokens = await api.multiCall({
+ calls: stakingTokens,
+ abi: abi.token,
+ permitFailure: true,
+ });
+
+ return deeperUnwrapTokens.map((deeperToken, index) => {
+ const token = deeperToken ?? stakingTokens[index];
+ const balance = stakingDatas[index].balance;
+ api.add(token, balance);
+ });
+};
+
+const tvl = async (api) => {
+ const getSdtStakings = await getSdtStakingsAddresses(api, tower, 1000);
+ await getsdtStakingViews(api, viewer, getSdtStakings);
+ api.removeTokenBalance(CVG);
+ return sumTokens2({ api, resolveLP: true });
+};
+
+const staking = async (api) => {
+ return api.sumTokens({
+ token: CVG,
+ owners: [stkCVGETH, stkCVGCVGSDT, cvgCVX],
+ });
+};
+
+module.exports = {
+ doublecounted: true,
+ methodology:
+ "TVL represents the values deposited in each of the StakeDao and Convex strategies",
+ ethereum: {
+ tvl,
+ staking,
+ },
+};
diff --git a/projects/convex/index.js b/projects/convex/index.js
index b45440ae19..10505a93fb 100644
--- a/projects/convex/index.js
+++ b/projects/convex/index.js
@@ -1,13 +1,16 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require("@defillama/sdk");
const ABI = require('./abi.json')
-const { sumTokensExport } = require('../helper/unwrapLPs')
+const { stakings } = require('../helper/staking');
+
+const boosterAddresses = {
+ fraxtal: '0xd3327cb05a8E0095A543D582b5B3Ce3e19270389',
+ default: '0xF403C135812408BFbE8713b5A23a04b3D48AAE31',
+};
-const boosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
const staker = '0x989aeb4d175e16225e39e87d0d97a3360524ad80'
-const cvxAddress = ADDRESSES.ethereum.CVX;
const cvxRewardsAddress = "0xCF50b810E57Ac33B91dCF525C6ddd9881B139332";
-const crvAddress = ADDRESSES.ethereum.CRV;
+const cvxLockerAddress = "0x72a19342e8F1838460eBFCCEf09F6585e32db86E";
const arbiPoolInfoABI = 'function poolInfo(uint256) view returns (address lptoken, address gauge, address rewards, bool shutdown, address factory)'
@@ -22,26 +25,64 @@ async function tvl(chain, block) {
params: staker,
abi: 'erc20:balanceOf', block,
})
- sdk.util.sumSingleBalance(balances, crvAddress, crvLocked)
+ sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.CRV, crvLocked)
//cvxfxs supply
const { output: fxsLocked } = await sdk.api.abi.call({
target: '0xc8418af6358ffdda74e09ca9cc3fe03ca6adc5b0', // veFXS
- params: '0x59cfcd384746ec3035299d90782be065e466800b',
+ params: '0x59cfcd384746ec3035299d90782be065e466800b', // Convex Frax vote proxy
+ abi: 'erc20:balanceOf', block,
+ })
+ sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXS, fxsLocked)
+
+ //cvxprisma supply
+ const { output: [prismaLocked] } = await sdk.api.abi.call({
+ target: '0x3f78544364c3eCcDCe4d9C89a630AEa26122829d', // PRISMA locker
+ params: '0x8ad7a9e2B3Cd9214f36Cb871336d8ab34DdFdD5b', // Convex Prisma vote proxy
+ abi: 'function getAccountBalances(address) view returns (uint256, uint256)', block,
+ })
+ sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.PRISMA, prismaLocked * 1e18)
+
+ //cvxfxn supply
+ const { output: fxnLocked } = await sdk.api.abi.call({
+ target: '0xEC6B8A3F3605B083F7044C0F31f2cac0caf1d469', // veFXN
+ params: '0xd11a4Ee017cA0BECA8FA45fF2abFe9C6267b7881', // Convex F(x) vote proxy
abi: 'erc20:balanceOf', block,
})
- sdk.util.sumSingleBalance(balances, '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', fxsLocked)
+ sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXN, fxnLocked)
} else {
+ if (chain === 'fraxtal') {
+ //cvxfxs supply on fraxtal
+ const { output: fxsLockedFraxtal } = await sdk.api.abi.call({
+ target: '0x007FD070a7E1B0fA1364044a373Ac1339bAD89CF', // veFXS
+ params: '0x59CFCD384746ec3035299D90782Be065e466800B', // Convex Frax Fraxtal vote proxy
+ abi: 'erc20:balanceOf', block, chain
+ })
+ sdk.util.sumSingleBalance(balances, ADDRESSES.ethereum.FXS, fxsLockedFraxtal)
+ }
+
abiPoolInfo = arbiPoolInfoABI
}
- let poolInfo = await sdk.api2.abi.fetchList({ chain, block, lengthAbi: ABI.poolLength, itemAbi: abiPoolInfo, target: boosterAddress })
+ const poolInfo = await sdk.api2.abi.fetchList({
+ chain,
+ block,
+ lengthAbi: ABI.poolLength,
+ itemAbi: abiPoolInfo,
+ target: boosterAddresses[chain] ?? boosterAddresses.default,
+ })
+
const { output: gaugeBalances } = await sdk.api.abi.multiCall({
abi: 'erc20:balanceOf',
- calls: Array.from(new Set(poolInfo.map(p=>p.gauge))).map(i => ({ target: i, params: staker })),
- chain, block,
+ calls: Array.from(new Set(poolInfo.map(p => p.gauge))).map(i => ({ target: i, params: staker })),
+ chain,
+ block,
})
- gaugeBalances.forEach(({ output, input }, i) => sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo.find(p=>p.gauge.toLowerCase()===input.target.toLowerCase()).lptoken, output))
+
+ gaugeBalances.forEach(({ output, input }, i) => {
+ sdk.util.sumSingleBalance(balances, chain + ':' + poolInfo.find(p => p.gauge.toLowerCase() === input.target.toLowerCase()).lptoken, output)
+ })
+
return balances
}
@@ -49,13 +90,20 @@ const chains = [
'ethereum',
'arbitrum',
'polygon',
+ 'fraxtal',
]
module.exports = {
doublecounted: true,
hallmarks: [
[1640164144, "cvxFXS Launched"],
- [1651881600, "UST depeg"]
+ [1642374675, "MIM depeg"],
+ [1651881600, "UST depeg"],
+ [1654822801, "stETH depeg"],
+ [1667692800, "FTX collapse"],
+ [1690715622, "Curve reentrancy hack"],
+ [1695705887, "cvxFXN Launched"],
+ [1698409703, "cvxPRISMA Launched"],
]
};
@@ -65,4 +113,4 @@ chains.forEach(chain => {
}
})
-module.exports.ethereum.staking = sumTokensExport({ owner: cvxRewardsAddress, tokens: [cvxAddress] })
+module.exports.ethereum.staking = stakings([cvxLockerAddress, cvxRewardsAddress], ADDRESSES.ethereum.CVX)
diff --git a/projects/convex/pools-crv.js b/projects/convex/pools-crv.js
deleted file mode 100644
index 06082a5be6..0000000000
--- a/projects/convex/pools-crv.js
+++ /dev/null
@@ -1,1240 +0,0 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const REFERENCE_ASSETS = {};
-const coins = {};
-
-module.exports = [{
- dataIndex: 0,
- id: 'compound',
- name: 'Compound',
- pageMetaData: {
- title: 'Compounded',
- description: 'A curve.fi portal for swapping cDAI/cUSDC',
- },
- lpTokenInfo: {
- name: 'cCurve',
- symbol: 'cCrv',
- },
- coingeckoInfo: {
- id: 'compound',
- symbol: 'COMP',
- },
- assets: 'cDAI+cUSDC',
- coins: [
- coins.cdai,
- coins.cusdc,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- ],
- isLendingPool: true,
- addresses: {
- swap: '0xA2B47E3D5c44877cca798226B7B8118F9BFb7A56',
- lpToken: '0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2',
- gauge: '0x7ca5b0a2910B33e9759DC7dDB0413949071D7575',
- deposit: '0xeB21209ae4C2c9FF2a86ACA31E123764A3B6Bc06',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 1,
- id: 'usdt',
- name: 'USDT',
- pageMetaData: {
- title: 'Tethered',
- description: 'A curve.fi Tethered portal for swapping cDAI/cUSDC/USDT',
- },
- lpTokenInfo: {
- name: 'tCurve',
- symbol: 'tCrv',
- },
- coingeckoInfo: {
- id: 'tether',
- symbol: 'USDT',
- },
- assets: 'cDAI+cUSDC+USDT',
- coins: [
- coins.cdai,
- coins.cusdc,
- coins.usdt,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- isLendingPool: true,
- addresses: {
- swap: '0x52EA46506B9CC5Ef470C5bf89f17Dc28bB35D85C',
- lpToken: '0x9fC689CCaDa600B6DF723D9E47D84d76664a1F23',
- gauge: '0xBC89cd85491d81C6AD2954E6d0362Ee29fCa8F53',
- deposit: '0xac795D2c97e60DF6a99ff1c814727302fD747a80',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 5,
- id: 'pax',
- name: 'PAX',
- lpTokenInfo: {
- name: 'pCurve',
- symbol: 'pCrv',
- },
- coingeckoInfo: {
- id: 'paxos-standard',
- symbol: 'PAX',
- },
- assets: 'ycDAI+ycUSDC+ycUSDT+PAX',
- coins: [
- coins.ycdai,
- coins.ycusdc,
- coins.ycusdt,
- coins.pax,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- coins.pax,
- ],
- isLendingPool: true,
- // Additional context we might want to include for yctokens: `ycTokens are forked yTokens without owner and Compound lending available for ycUSDT`
- addresses: {
- swap: '0x06364f10B501e868329afBc005b3492902d6C763',
- lpToken: '0xD905e2eaeBe188fc92179b6350807D8bd91Db0D8',
- gauge: '0x64E3C23bfc40722d3B649844055F1D51c1ac041d',
- deposit: '0xA50cCc70b6a011CffDdf45057E39679379187287',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 2,
- id: 'iearn',
- idAlias: 'y',
- name: 'Y',
- pageMetaData: {
- title: 'Yield',
- description: 'A curve.fi yTokens portal for swapping DAI/USDC/USDT/TUSD',
- },
- lpTokenInfo: {
- name: 'yCurve',
- symbol: 'yCrv',
- },
- coingeckoInfo: {
- id: 'yearn-finance',
- symbol: 'YFI',
- },
- assets: 'yDAI+yUSDC+yUSDT+yTUSD',
- coins: [
- coins.ydai,
- coins.yusdc,
- coins.yusdt,
- coins.ytusd,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- coins.tusd,
- ],
- isLendingPool: true,
- addresses: {
- swap: '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51',
- lpToken: '0xdF5e0e81Dff6FAF3A7e52BA697820c5e32D806A8',
- gauge: '0xFA712EE4788C042e2B7BB55E6cb8ec569C4530c1',
- deposit: '0xbBC81d23Ea2c3ec7e56D39296F0cbB648873a5d3',
- stakingRewards: '0x0001FB050Fe7312791bF6475b96569D83F695C9f',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 3,
- id: 'busd',
- name: 'BUSD',
- pageMetaData: {
- title: 'bUSD',
- description: 'A curve.fi portal for swapping BUSD and other stablecoins',
- },
- lpTokenInfo: {
- name: 'bCurve',
- symbol: 'bCrv',
- },
- coingeckoInfo: {
- id: 'binance-usd',
- symbol: 'BUSD',
- },
- assets: 'yDAI+yUSDC+yUSDT+yBUSD',
- coins: [
- coins.ydai,
- coins.yusdc,
- coins.yusdt,
- coins.ybusd,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- coins.busd,
- ],
- isLendingPool: true,
- addresses: {
- swap: '0x79a8C46DeA5aDa233ABaFFD40F3A0A2B1e5A4F27',
- lpToken: '0x3B3Ac5386837Dc563660FB6a0937DFAa5924333B',
- gauge: '0x69Fb7c45726cfE2baDeE8317005d3F94bE838840',
- deposit: '0xb6c057591E073249F2D9D88Ba59a46CFC9B59EdB',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 4,
- id: 'susdv2',
- name: 'sUSD',
- lpTokenInfo: {
- name: 'sCurve',
- symbol: 'sCrv',
- },
- coingeckoInfo: {
- id: 'nusd',
- symbol: 'SUSD',
- },
- assets: 'DAI+USDC+USDT+sUSD',
- coins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- coins.susd,
- ],
- additionalRewards: [{
- name: 'SNX',
- amountDataKey: 'snxRewards',
- rewardTokenCoingeckoId: 'havven',
- }],
- addresses: {
- swap: '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD',
- lpToken: '0xC25a3A3b969415c80451098fa907EC722572917F',
- gauge: '0xA90996896660DEcC6E997655E065b23788857849',
- deposit: '0xFCBa3E75865d2d561BE8D220616520c171F12851',
- },
- hasAMultiplier: false,
- isOldPool: true,
-}, {
- dataIndex: 7,
- id: 'ren',
- name: 'ren',
- lpTokenInfo: {
- name: 'renCurve',
- symbol: 'renCrv',
- },
- coingeckoInfo: {
- id: 'renbtc',
- symbol: 'RENBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'renBTC+wBTC',
- coins: [
- coins.renbtc,
- coins.wbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- addresses: {
- swap: '0x93054188d876f558f4a66B2EF1d97d16eDf0895B',
- lpToken: '0x49849C98ae39Fff122806C06791Fa73784FB3675',
- gauge: '0xB1F2cdeC61db658F091671F5f199635aEF202CAC',
- adapter: '0x73aB2Bd10aD10F7174a1AD5AFAe3ce3D991C5047',
- },
- hasAMultiplier: false,
-}, {
- dataIndex: 8,
- id: 'sbtc',
- name: 'sbtc',
- lpTokenInfo: {
- name: 'sbtcCurve',
- symbol: 'sbtcCrv',
- },
- coingeckoInfo: {
- id: 'sbtc',
- symbol: 'SBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'renBTC+wBTC+sBTC',
- coins: [
- coins.renbtc,
- coins.wbtc,
- coins.sbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- oldAdditionalRewards: [{
- name: 'SNX',
- rewardTokenCoingeckoId: 'havven',
- }],
- addresses: {
- swap: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714',
- lpToken: '0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3',
- gauge: '0x705350c4BcD35c9441419DdD5d2f097d7a55410F',
- stakingRewards: '0x13C1542A468319688B89E323fe9A3Be3A90EBb27',
- adapter: '0xAEade605D01FE9a8e9C4B3AA0130A90d62167029',
- },
- hasAMultiplier: false,
-}, {
- dataIndex: 9,
- id: 'hbtc',
- name: 'hbtc',
- lpTokenInfo: {
- name: 'hbtcCurve',
- symbol: 'hbtcCrv',
- },
- coingeckoInfo: {
- id: 'huobi-btc',
- symbol: 'HBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'hBTC+wBTC',
- coins: [
- coins.hbtc,
- coins.wbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- addresses: {
- swap: '0x4CA9b3063Ec5866A4B82E437059D2C43d1be596F',
- lpToken: '0xb19059ebb43466C323583928285a49f558E572Fd',
- gauge: '0x4c18E409Dc8619bFb6a1cB56D114C3f592E0aE79',
- },
- hasAMultiplier: false,
-}, {
- dataIndex: 10,
- id: '3pool',
- name: '3pool',
- lpTokenInfo: {
- name: '3poolCurve',
- symbol: '3poolCrv',
- },
- assets: 'DAI+USDC+USDT',
- coins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7',
- lpToken: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
- gauge: '0xbFcF63294aD7105dEa65aA58F8AE5BE2D9d0952A',
- },
- hasAMultiplier: false,
-}, {
- dataIndex: 11,
- id: 'gusd',
- name: 'gusd',
- lpTokenInfo: {
- name: 'gusdCurve',
- symbol: 'gusdCrv',
- },
- coingeckoInfo: {
- id: 'gemini-dollar',
- symbol: 'GUSD',
- },
- assets: 'GUSD+3pool',
- isMetaPool: true,
- coins: [
- coins.gusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x4f062658EaAF2C1ccf8C8e36D6824CDf41167956',
- lpToken: '0xD2967f45c4f384DEEa880F807Be904762a3DeA07',
- gauge: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023',
- deposit: '0x64448B78561690B70E17CBE8029a3e5c1bB7136e',
- },
-}, {
- dataIndex: 12,
- id: 'husd',
- name: 'husd',
- lpTokenInfo: {
- name: 'husdCurve',
- symbol: 'husdCrv',
- },
- coingeckoInfo: {
- id: 'husd',
- symbol: 'HUSD',
- },
- assets: 'HUSD+3pool',
- isMetaPool: true,
- coins: [
- coins.husd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604',
- lpToken: '0x5B5CFE992AdAC0C9D48E05854B2d91C73a003858',
- gauge: '0x2db0E83599a91b508Ac268a6197b8B14F5e72840',
- deposit: '0x09672362833d8f703D5395ef3252D4Bfa51c15ca',
- },
-}, {
- dataIndex: 13,
- id: 'usdk',
- name: 'usdk',
- lpTokenInfo: {
- name: 'usdkCurve',
- symbol: 'usdkCrv',
- },
- coingeckoInfo: {
- id: 'usdk',
- symbol: 'USDK',
- },
- assets: 'USDK+3pool',
- isMetaPool: true,
- coins: [
- coins.usdk,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb',
- lpToken: '0x97E2768e8E73511cA874545DC5Ff8067eB19B787',
- gauge: '0xC2b1DF84112619D190193E48148000e3990Bf627',
- deposit: '0xF1f85a74AD6c64315F85af52d3d46bF715236ADc',
- },
-}, {
- dataIndex: 14,
- id: 'usdn',
- name: 'usdn',
- lpTokenInfo: {
- name: 'usdnCurve',
- symbol: 'usdnCrv',
- },
- coingeckoInfo: {
- id: 'neutrino',
- symbol: 'USDN',
- },
- assets: 'USDN+3pool',
- isMetaPool: true,
- coins: [
- coins.usdn,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x0f9cb53Ebe405d49A0bbdBD291A65Ff571bC83e1',
- lpToken: '0x4f3E8F405CF5aFC05D68142F3783bDfE13811522',
- gauge: '0xF98450B5602fa59CC66e1379DFfB6FDDc724CfC4',
- deposit: '0x094d12e5b541784701FD8d65F11fc0598FBC6332',
- },
-}, {
- dataIndex: 15,
- id: 'linkusd',
- name: 'linkusd',
- lpTokenInfo: {
- name: 'linkusdCurve',
- symbol: 'linkusdCrv',
- },
- coingeckoInfo: {
- id: 'linkusd',
- symbol: 'LINKUSD',
- },
- assets: 'LINKUSD+3pool',
- isMetaPool: true,
- coins: [
- coins.linkusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- isRiskier: true,
- hasNoGauge: true,
- addresses: {
- swap: '0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171',
- lpToken: '0x6D65b498cb23deAba52db31c93Da9BFFb340FB8F',
- deposit: '0x1de7f0866e2c4adAC7b457c58Cc25c8688CDa1f2',
- },
- riskLevel: 3,
-}, {
- dataIndex: 16,
- id: 'musd',
- name: 'musd',
- lpTokenInfo: {
- name: 'musdCurve',
- symbol: 'musdCrv',
- },
- coingeckoInfo: {
- id: 'musd',
- symbol: 'MUSD',
- },
- assets: 'musd+3pool',
- isMetaPool: true,
- coins: [
- coins.musd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- oldAdditionalRewards: [{
- name: 'MTA',
- rewardTokenCoingeckoId: 'meta',
- }],
- addresses: {
- swap: '0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6',
- lpToken: '0x1AEf73d49Dedc4b1778d0706583995958Dc862e6',
- gauge: '0x5f626c30EC1215f4EdCc9982265E8b1F411D1352',
- deposit: '0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2',
- },
-}, {
- dataIndex: 17,
- id: 'rsv',
- name: 'rsv',
- lpTokenInfo: {
- name: 'rsvCurve',
- symbol: 'rsvCrv',
- },
- coingeckoInfo: {
- id: 'reserve',
- symbol: 'RSV',
- },
- assets: 'rsv+3pool',
- isMetaPool: true,
- coins: [
- coins.rsv,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- additionalRewards: [{
- name: 'RSR',
- amountDataKey: 'rsrRewards',
- rewardTokenCoingeckoId: 'reserve-rights-token',
- }],
- addresses: {
- swap: '0xC18cC39da8b11dA8c3541C598eE022258F9744da',
- lpToken: '0xC2Ee6b0334C261ED60C72f6054450b61B8f18E35',
- gauge: '0x4dC4A289a8E33600D8bD4cf5F6313E43a37adec7',
- deposit: '0xBE175115BF33E12348ff77CcfEE4726866A0Fbd5',
- },
-}, {
- dataIndex: 18,
- id: 'tbtc',
- name: 'tbtc',
- lpTokenInfo: {
- name: 'tbtcCurve',
- symbol: 'tbtcCrv',
- },
- coingeckoInfo: {
- id: 'tbtc',
- symbol: 'TBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'tbtc+sbtcCrv',
- isMetaPool: true,
- coins: [
- coins.tbtc,
- coins.sbtccrv,
- ],
- metaCoins: [
- coins.renbtc,
- coins.wbtc,
- coins.sbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- oldAdditionalRewards: [{
- name: 'KEEP',
- rewardTokenCoingeckoId: 'keep-network',
- }],
- addresses: {
- swap: '0xC25099792E9349C7DD09759744ea681C7de2cb66',
- lpToken: '0x64eda51d3Ad40D56b9dFc5554E06F94e1Dd786Fd',
- gauge: '0x6828bcF74279eE32f2723eC536c22c51Eed383C6',
- deposit: '0xaa82ca713D94bBA7A89CEAB55314F9EfFEdDc78c',
- },
-}, {
- dataIndex: 19,
- id: 'dusd',
- name: 'dusd',
- lpTokenInfo: {
- name: 'dusdCurve',
- symbol: 'dusdCrv',
- },
- coingeckoInfo: {
- id: 'defidollar',
- symbol: 'DUSD',
- },
- assets: 'dusd+3pool',
- isMetaPool: true,
- coins: [
- coins.dusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- additionalRewards: [{
- name: 'DFD',
- amountDataKey: 'dfdRewards',
- rewardTokenCoingeckoId: 'defidollar-dao',
- }],
- addresses: {
- swap: '0x8038C01A0390a8c547446a0b2c18fc9aEFEcc10c',
- lpToken: '0x3a664Ab939FD8482048609f652f9a0B0677337B9',
- gauge: '0xAEA6c312f4b3E04D752946d329693F7293bC2e6D',
- deposit: '0x61E10659fe3aa93d036d099405224E4Ac24996d0',
- },
-}, {
- dataIndex: 20,
- id: 'pbtc',
- name: 'pbtc',
- lpTokenInfo: {
- name: 'pbtcCurve',
- symbol: 'pbtcCrv',
- },
- coingeckoInfo: {
- id: 'ptokens-btc',
- symbol: 'PBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'pbtc+sbtcCrv',
- isMetaPool: true,
- coins: [
- coins.pbtc,
- coins.sbtccrv,
- ],
- metaCoins: [
- coins.renbtc,
- coins.wbtc,
- coins.sbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- additionalRewards: [{
- name: 'PNT',
- amountDataKey: 'pntRewards',
- rewardTokenAddress: '0x89Ab32156e46F46D02ade3FEcbe5Fc4243B9AAeD',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'pnetwork',
- }],
- addresses: {
- swap: '0x7F55DDe206dbAD629C080068923b36fe9D6bDBeF',
- lpToken: '0xDE5331AC4B3630f94853Ff322B66407e0D6331E8',
- gauge: '0xd7d147c6Bb90A718c3De8C0568F9B560C79fa416',
- deposit: '0x11F419AdAbbFF8d595E7d5b223eee3863Bb3902C',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 21,
- id: 'bbtc',
- name: 'bbtc',
- lpTokenInfo: {
- name: 'bbtcCurve',
- symbol: 'bbtcCrv',
- },
- coingeckoInfo: {
- referenceAssetId: 'bitcoin',
- },
- assets: 'bbtc+sbtcCrv',
- isMetaPool: true,
- coins: [
- coins.bbtc,
- coins.sbtccrv,
- ],
- metaCoins: [
- coins.renbtc,
- coins.wbtc,
- coins.sbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- addresses: {
- swap: '0x071c661B4DeefB59E2a3DdB20Db036821eeE8F4b',
- lpToken: '0x410e3E86ef427e30B9235497143881f717d93c2A',
- gauge: '0xdFc7AdFa664b08767b735dE28f9E84cd30492aeE',
- deposit: '0xC45b2EEe6e09cA176Ca3bB5f7eEe7C47bF93c756',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 22,
- id: 'obtc',
- name: 'obtc',
- lpTokenInfo: {
- name: 'obtcCurve',
- symbol: 'obtcCrv',
- },
- coingeckoInfo: {
- id: 'boringdao-btc',
- symbol: 'OBTC',
- referenceAssetId: 'bitcoin',
- },
- assets: 'obtc+sbtcCrv',
- isMetaPool: true,
- coins: [
- coins.obtc,
- coins.sbtccrv,
- ],
- metaCoins: [
- coins.renbtc,
- coins.wbtc,
- coins.sbtc,
- ],
- referenceAsset: REFERENCE_ASSETS.BTC,
- additionalRewards: [{
- name: 'BOR',
- amountDataKey: 'borRewards',
- rewardTokenAddress: '0x3c9d6c1C73b31c837832c72E04D3152f051fc1A9',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'boringdao',
- }],
- addresses: {
- swap: '0xd81dA8D904b52208541Bade1bD6595D8a251F8dd',
- lpToken: '0x2fE94ea3d5d4a175184081439753DE15AeF9d614',
- gauge: '0x11137B10C210b579405c21A07489e28F3c040AB1',
- deposit: '0xd5BCf53e2C81e1991570f33Fa881c49EEa570C8D',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 23,
- id: 'ust',
- name: 'ust',
- lpTokenInfo: {
- name: 'ustCurve',
- symbol: 'ustCrv',
- },
- coingeckoInfo: {
- id: 'terrausd',
- symbol: 'UST',
- },
- assets: 'ust+3pool',
- isMetaPool: true,
- coins: [
- coins.ust,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x890f4e345B1dAED0367A877a1612f86A1f86985f',
- lpToken: '0x94e131324b6054c0D789b190b2dAC504e4361b53',
- gauge: '0x3B7020743Bc2A4ca9EaF9D0722d42E20d6935855',
- deposit: '0xB0a0716841F2Fc03fbA72A891B8Bb13584F52F2d',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 24,
- id: 'eurs',
- name: 'eurs',
- lpTokenInfo: {
- name: 'eursCurve',
- symbol: 'eursCrv',
- },
- coingeckoInfo: {
- id: 'stasis-eurs',
- symbol: 'EURS',
- referenceAssetId: 'stasis-eurs', // Using stasis-eurs as the oracle for EUR/USD
- },
- assets: 'eurs+seur',
- coins: [
- coins.eurs,
- coins.seur,
- ],
- referenceAsset: REFERENCE_ASSETS.EUR,
- oldAdditionalRewards: [{
- name: 'SNX',
- rewardTokenAddress: ADDRESSES.ethereum.SNX,
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'havven',
- }],
- addresses: {
- swap: '0x0Ce6a5fF5217e38315f87032CF90686C96627CAA',
- lpToken: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1',
- gauge: '0x90Bb609649E0451E5aD952683D64BD2d1f245840',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 25,
- id: 'seth',
- name: 'seth',
- lpTokenInfo: {
- name: 'sethCurve',
- symbol: 'eCrv',
- },
- coingeckoInfo: {
- id: 'seth',
- symbol: 'SETH',
- referenceAssetId: 'ethereum',
- },
- assets: 'eth+seth',
- coins: [
- coins.eth,
- coins.seth,
- ],
- referenceAsset: REFERENCE_ASSETS.ETH,
- addresses: {
- swap: '0xc5424b857f758e906013f3555dad202e4bdb4567',
- lpToken: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c',
- gauge: '0x3C0FFFF15EA30C35d7A85B85c0782D6c94e1d238',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 26,
- id: 'aave',
- name: 'aave',
- lpTokenInfo: {
- name: 'aaveCurve',
- symbol: 'a3Crv',
- },
- coingeckoInfo: {
- id: 'aave',
- symbol: 'AAVE',
- },
- assets: 'aDAI+aUSDC+aUSDT',
- coins: [
- coins.adai,
- coins.ausdc,
- coins.ausdt,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- isLendingPool: true,
- isModernLendingPool: true,
- addresses: {
- swap: '0xDeBF20617708857ebe4F679508E7b7863a8A8EeE',
- lpToken: '0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900',
- gauge: '0xd662908ADA2Ea1916B3318327A97eB18aD588b5d',
- },
- gaugeVersion: 2,
- additionalRewards: [{
- name: 'STKAAVE',
- amountDataKey: 'aaveRewards',
- rewardTokenAddress: '0x4da27a545c0c5b758a6ba100e3a049001de870f5',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'aave',
- }],
-}, {
- dataIndex: 27,
- id: 'steth',
- name: 'steth',
- lpTokenInfo: {
- name: 'stethCurve',
- symbol: 'stethCrv',
- },
- coingeckoInfo: {
- id: 'staked-ether',
- symbol: 'STETH',
- referenceAssetId: 'ethereum',
- },
- assets: 'eth+steth',
- coins: [
- coins.eth,
- coins.steth,
- ],
- referenceAsset: REFERENCE_ASSETS.ETH,
- additionalRewards: [{
- name: 'LDO',
- amountDataKey: 'ldoRewards',
- rewardTokenAddress: ADDRESSES.ethereum.LIDO,
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'lido-dao',
- }],
- addresses: {
- swap: '0xDC24316b9AE028F1497c275EB9192a3Ea0f67022',
- lpToken: '0x06325440D014e39736583c165C2963BA99fAf14E',
- gauge: '0x182B723a58739a9c974cFDB385ceaDb237453c28',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 28,
- id: 'saave',
- name: 'saave',
- lpTokenInfo: {
- name: 'saaveCurve',
- symbol: 'saCrv',
- },
- coingeckoInfo: {
- id: 'aave',
- symbol: 'AAVE',
- },
- assets: 'aDAI+asUSD',
- coins: [
- coins.adai,
- coins.asusd,
- ],
- underlyingCoins: [
- coins.dai,
- coins.susd,
- ],
- isLendingPool: true,
- isModernLendingPool: true,
- addresses: {
- swap: '0xEB16Ae0052ed37f479f7fe63849198Df1765a733',
- lpToken: '0x02d341CcB60fAaf662bC0554d13778015d1b285C',
- gauge: '0x462253b8F74B72304c145DB0e4Eebd326B22ca39',
- },
- gaugeVersion: 2,
- additionalRewards: [{
- key: 'STKAAVES',
- name: 'STKAAVE',
- amountDataKey: 'saaveRewards',
- rewardTokenAddress: '0x4da27a545c0c5b758a6ba100e3a049001de870f5',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'aave',
- }],
-}, {
- dataIndex: 29,
- id: 'ankreth',
- name: 'ankreth',
- lpTokenInfo: {
- name: 'ankrethCurve',
- symbol: 'aethCrv',
- },
- coingeckoInfo: {
- id: 'ankreth',
- symbol: 'AETH',
- referenceAssetId: 'ethereum',
- },
- assets: 'eth+ankreth',
- coins: [
- coins.eth,
- coins.ankreth,
- ],
- referenceAsset: REFERENCE_ASSETS.ETH,
- additionalRewards: [{
- name: 'ANKR',
- amountDataKey: 'ankrRewards',
- rewardTokenAddress: '0x8290333cef9e6d528dd5618fb97a76f268f3edd4',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'ankr',
- }, {
- name: 'ONX',
- amountDataKey: 'onxRewards',
- rewardTokenAddress: '0xe0ad1806fd3e7edf6ff52fdb822432e847411033',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'onx-finance',
- }],
- addresses: {
- swap: '0xA96A65c051bF88B4095Ee1f2451C2A9d43F53Ae2',
- lpToken: '0xaA17A236F2bAdc98DDc0Cf999AbB47D47Fc0A6Cf',
- gauge: '0x6d10ed2cf043e6fcf51a0e7b4c2af3fa06695707',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 30,
- id: 'usdp',
- name: 'usdp',
- lpTokenInfo: {
- name: 'usdpCurve',
- symbol: 'usdpCrv',
- },
- coingeckoInfo: {
- id: 'usdp',
- symbol: 'USDP',
- },
- assets: 'usdp+3pool',
- isMetaPool: true,
- coins: [
- coins.usdp,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x42d7025938bEc20B69cBae5A77421082407f053A',
- lpToken: '0x7Eb40E450b9655f4B3cC4259BCC731c63ff55ae6',
- gauge: '0x055be5DDB7A925BfEF3417FC157f53CA77cA7222',
- deposit: '0x3c8cAee4E09296800f8D29A68Fa3837e2dae4940',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 31,
- id: 'ib',
- name: 'ironbank',
- lpTokenInfo: {
- name: 'ibCurve',
- symbol: 'ib3Crv',
- },
- coingeckoInfo: {
- id: 'cream-2',
- symbol: 'CREAM',
- },
- assets: 'cyDAI+cyUSDC+cyUSDT',
- coins: [
- coins.cydai,
- coins.cyusdc,
- coins.cyusdt,
- ],
- underlyingCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- isLendingPool: true,
- isModernLendingPool: true,
- addresses: {
- swap: '0x2dded6Da1BF5DBdF597C45fcFaa3194e53EcfeAF',
- lpToken: '0x5282a4eF67D9C33135340fB3289cc1711c13638C',
- gauge: '0xF5194c3325202F456c95c1Cf0cA36f8475C1949F',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 32,
- id: 'link',
- name: 'link',
- lpTokenInfo: {
- name: 'linkCurve',
- symbol: 'linkCrv',
- },
- coingeckoInfo: {
- id: 'chainlink',
- symbol: 'LINK',
- referenceAssetId: 'chainlink',
- },
- referenceAsset: REFERENCE_ASSETS.LINK,
- assets: 'LINK+sLINK',
- coins: [
- coins.link,
- coins.slink,
- ],
- addresses: {
- swap: '0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0',
- lpToken: '0xcee60cfa923170e4f8204ae08b4fa6a3f5656f3a',
- gauge: '0xfd4d8a17df4c27c1dd245d153ccf4499e806c87d',
- },
- gaugeVersion: 2,
-}, {
- dataIndex: 33,
- id: 'tusd',
- name: 'tusd',
- lpTokenInfo: {
- name: 'tusdCurve',
- symbol: 'tusdCrv',
- },
- assets: 'tusd+3pool',
- isMetaPool: true,
- coins: [
- coins.tusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0xecd5e75afb02efa118af914515d6521aabd189f1',
- lpToken: '0xecd5e75afb02efa118af914515d6521aabd189f1',
- gauge: '0x359FD5d6417aE3D8D6497d9B2e7A890798262BA4',
- deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
- },
- gaugeVersion: 2,
-},{
- dataIndex: 34,
- id: 'frax',
- name: 'frax',
- lpTokenInfo: {
- name: 'fraxCurve',
- symbol: 'fraxCrv',
- },
- coingeckoInfo: {
- id: 'frax',
- symbol: 'FRAX',
- },
- assets: 'frax+3pool',
- isMetaPool: true,
- coins: [
- coins.frax,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B',
- lpToken: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B',
- deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
- gauge: '0x72e158d38dbd50a483501c24f792bdaaa3e7d55c'
- },
- isRiskier: true,
- riskLevel: 2,
- },{
- dataIndex: 35,
- id: 'lusd',
- name: 'lusd',
- lpTokenInfo: {
- name: 'lusdCurve',
- symbol: 'lusdCrv',
- },
- coingeckoInfo: {
- id: 'liquity-usd',
- symbol: 'LUSD',
- },
- assets: 'lusd+3pool',
- isMetaPool: true,
- coins: [
- coins.lusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA',
- lpToken: '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA',
- deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
- gauge: '0x9b8519a9a00100720ccdc8a120fbed319ca47a14'
- },
- additionalRewards: [{
- name: 'LQTY',
- amountDataKey: 'lqtyRewards',
- rewardTokenCoingeckoId: 'liquity',
- rewardTokenAddress: '0x6dea81c8171d0ba574754ef6f8b412f2ed88c54d',
- rewardTokenDecimals: 18,
- }],
- gaugeVersion: 2,
- },{
- dataIndex: 36,
- id: 'busdv2',
- name: 'busdv2',
- lpTokenInfo: {
- name: 'busdCurve',
- symbol: 'busdCrv',
- },
- coingeckoInfo: {
- id: 'binance-usd',
- symbol: 'BUSD',
- },
- assets: 'busd+3pool',
- isMetaPool: true,
- coins: [
- coins.busd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a',
- lpToken: '0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a',
- gauge: '0xd4b22fedca85e684919955061fdf353b9d38389b',
- deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
- },
- gaugeVersion: 2,
- },{
- dataIndex: 37,
- id: 'tricrypto',
- name: 'TriCrypto',
- lpTokenInfo: {
- name: '3CrvCrypto',
- symbol: '3CrvCrypto',
- },
- assets: 'usdt+weth+wbtc',
- coins: [
- coins.usdt,
- coins.wbtc,
- coins.weth,
- ],
- addresses: {
- swap: '0x80466c64868E1ab14a1Ddf27A676C3fcBE638Fe5',
- lpToken: '0xcA3d75aC011BF5aD07a98d02f18225F9bD9A6BDF',
- },
- gaugeVersion: 2,
- hasNoGauge: true,
- cryptoPool: true
- },{
- dataIndex: 38,
- id: 'alusd',
- name: 'alisd',
- lpTokenInfo: {
- name: 'alusdCurve',
- symbol: 'alusdCrv',
- },
- coingeckoInfo: {
- id: 'alchemix-usd',
- symbol: 'ALUSD',
- },
- assets: 'alusd+3pool',
- isMetaPool: true,
- coins: [
- coins.alusd,
- coins.tricrv,
- ],
- metaCoins: [
- coins.dai,
- coins.usdc,
- coins.usdt,
- ],
- addresses: {
- swap: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c',
- lpToken: '0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c',
- gauge: '0x9582C4ADACB3BCE56Fea3e590F05c3ca2fb9C477',
- deposit: '0xA79828DF1850E8a3A3064576f380D90aECDD3359',
- },
- gaugeVersion: 2,
- }, {
- dataIndex: 39,
- id: 'reth',
- name: 'reth',
- lpTokenInfo: {
- name: 'rethCurve',
- symbol: 'rethCrv',
- },
- coingeckoInfo: {
- id: 'reth',
- symbol: 'RETH',
- referenceAssetId: 'ethereum',
- },
- assets: 'eth+reth',
- coins: [
- coins.eth,
- coins.reth,
- ],
- referenceAsset: REFERENCE_ASSETS.ETH,
- additionalRewards: [{
- name: 'FIS',
- amountDataKey: 'rethRewards',
- rewardTokenAddress: '0xef3A930e1FfFFAcd2fc13434aC81bD278B0ecC8d',
- rewardTokenDecimals: 18,
- rewardTokenCoingeckoId: 'stafi',
- }],
- addresses: {
- swap: '0xF9440930043eb3997fc70e1339dBb11F341de7A8',
- lpToken: '0x53a901d48795C58f485cBB38df08FA96a24669D5',
- gauge: '0x824F13f1a2F29cFEEa81154b46C0fc820677A637',
- },
- gaugeVersion: 2,
- }
-
- ];
diff --git a/projects/core-earn/index.js b/projects/core-earn/index.js
new file mode 100644
index 0000000000..ef1dfdc74f
--- /dev/null
+++ b/projects/core-earn/index.js
@@ -0,0 +1,11 @@
+const Earn = "0xf5fA1728bABc3f8D2a617397faC2696c958C3409";
+
+async function tvl(api) {
+ let amount = await api.call({ abi: "uint256:getTotalDelegateAmount", target: Earn })
+ api.addGasToken(amount)
+}
+
+module.exports = {
+ methodology: "Total Core staking Value.",
+ core: { tvl, },
+}
\ No newline at end of file
diff --git a/projects/cream/index.js b/projects/cream/index.js
index 9de10783b7..3f60a31e7b 100644
--- a/projects/cream/index.js
+++ b/projects/cream/index.js
@@ -1,178 +1,18 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require("@defillama/sdk");
-const utils = require("../helper/utils");
-const { unwrapUniswapLPs, nullAddress } = require("../helper/unwrapLPs");
-const { getCompoundV2Tvl, compoundExports } = require("../helper/compound");
-const { getConfig } = require('../helper/cache')
-
-const abiCerc20 = require("./cerc20.json");
-const abiCereth2 = require("./creth2.json");
-const BigNumber = require("bignumber.js");
-
-//
-const wETH = ADDRESSES.ethereum.WETH;
-const CRETH2 = "0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd";
-const crvIB = "0x27b7b1ad7288079A66d12350c828D3C00A6F07d7";
-
-const replacements = {
- "0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7": wETH, // yWETH -> WETH
- //'0x27b7b1ad7288079A66d12350c828D3C00A6F07d7': ADDRESSES.ethereum.DAI, // yearn: yCRV-IB -> DAI
- "0x986b4AFF588a109c09B50A03f42E4110E29D353F": wETH, // yearn: yCRV/sETH
- "0xdCD90C7f6324cfa40d7169ef80b12031770B4325": wETH, // yearn: yCRV/stETH
- "0x9cA85572E6A3EbF24dEDd195623F188735A5179f":
- "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // yearn: y3Crv -> 3Crv
-};
-
-async function ethereumTvl(timestamp, block) {
- let balances = {};
-
- let tokens_ethereum = (
- await getConfig('cream/ethereum',
- "https://api.cream.finance/api/v1/crtoken?comptroller=eth"
- )
- );
-
- // --- Grab all the getCash values of crERC20 (Lending Contract Addresses) ---
- let cashValues = (
- await sdk.api.abi.multiCall({
- block,
- calls: tokens_ethereum.map((token) => ({ target: token.token_address })),
- abi: abiCerc20["getCash"],
- })
- ).output;
-
- let underlyings = (
- await sdk.api.abi.multiCall({
- block,
- calls: tokens_ethereum.map((token) => ({ target: token.token_address })),
- abi: abiCerc20["underlying"],
- permitFailure: true,
- })
- ).output;
-
- const lpPositions = [];
- cashValues.map((cashVal, idx) => {
- if (underlyings[idx].output === null) {
- // It's ETH
- sdk.util.sumSingleBalance(
- balances,
- ADDRESSES.null,
- cashVal.output
- );
- } else if (
- tokens_ethereum[idx].underlying_symbol === "UNI-V2" ||
- tokens_ethereum[idx].underlying_symbol === "SLP"
- ) {
- lpPositions.push({
- token: underlyings[idx].output,
- balance: cashVal.output,
- });
- } else if (underlyings[idx].output === crvIB || underlyings[idx].output === CRETH2) {
- return; // Exclude CRETH2 //https://twitter.com/0xngmi/status/1398565590856515585
- } else {
- const token =
- replacements[underlyings[idx].output] || underlyings[idx].output;
- sdk.util.sumSingleBalance(balances, token, cashVal.output);
- }
- });
-
- await unwrapUniswapLPs(balances, lpPositions, block);
-
-
- return balances;
-}
-
-async function lending(block, chain, borrowed) {
- let balances = {};
-
- let tokens_bsc = (
- await getConfig('cream/'+chain,
- `https://api.cream.finance/api/v1/crtoken?comptroller=${chain}`
- )
- );
-
- let cashValues = (
- await sdk.api.abi.multiCall({
- block,
- calls: tokens_bsc.map((token) => ({ target: token.token_address })),
- abi: borrowed ? abiCerc20.totalBorrows : abiCerc20["getCash"],
- chain,
- })
- ).output;
-
- let underlyings = (
- await sdk.api.abi.multiCall({
- block,
- calls: tokens_bsc.map((token) => ({ target: token.token_address })),
- abi: abiCerc20["underlying"],
- permitFailure: true,
- chain,
- })
- ).output;
-
- const transformAdress = i => `bsc:${i}`
- const lpPositions = [];
- cashValues.map((cashVal, idx) => {
- if (tokens_bsc[idx].underlying_symbol === "Cake-LP") {
- lpPositions.push({
- token: underlyings[idx].output,
- balance: cashVal.output,
- });
- } else if (tokens_bsc[idx].symbol === "crBNB") {
- sdk.util.sumSingleBalance(
- balances,
- "bsc:" + ADDRESSES.bsc.WBNB,
- cashVal.output
- ); // BNB
- } else {
- const tokenAddr = underlyings[idx].output;
- sdk.util.sumSingleBalance(balances, transformAdress(tokenAddr), cashVal.output);
- }
- });
- await unwrapUniswapLPs(balances, lpPositions, block, 'bsc', transformAdress);
- return balances
-}
-
-const bscTvl = async (timestamp, ethBlock, chainBlocks) => {
- const block = chainBlocks["bsc"]; // req for the block type
- const balances = await lending(block, "bsc", false)
-
- // --- Staking bsc service ---
- const bsc_staking_service = await utils.fetchURL(
- "https://api.binance.org/v1/staking/chains/bsc/validators/bva1asktsxqny35hwxltpzqsvr64s5vr2ph2t2vlnw/"
- );
-
- sdk.util.sumSingleBalance(
- balances,
- "bsc:" + ADDRESSES.bsc.WBNB, // -- Apparently it auto-merges balances (check on output) ---
- BigNumber(bsc_staking_service.data.votingPower)
- .multipliedBy(10 ** 18)
- .toFixed(0)
- );
-
- return balances;
-};
-
-const bscBorrowed = async (timestamp, ethBlock, chainBlocks) => {
- const block = chainBlocks["bsc"]; // req for the block type
- return lending(block, "bsc", true)
-}
+const ADDRESSES = require("../helper/coreAssets.json");
+const { compoundExports } = require("../helper/compound");
module.exports = {
- hallmarks: [
- [1635292800, "Flashloan exploit"]
- ],
+ hallmarks: [[1635292800, "Flashloan exploit"]],
timetravel: false, // bsc and fantom api's for staked coins can't be queried at historical points
start: 1599552000, // 09/08/2020 @ 8:00am (UTC)
- ethereum: {
- tvl: ethereumTvl,
- },
- bsc: {
- tvl: bscTvl,
- borrowed: bscBorrowed
- //getCompoundV2Tvl("0x589de0f0ccf905477646599bb3e5c622c84cc0ba", "bsc", addr=>`bsc:${addr}`, "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", ADDRESSES.bsc.WBNB, true),
- },
- // ethereum:compoundExports("0x3d5BC3c8d13dcB8bF317092d84783c2697AE9258", "ethereum", "0xd06527d5e56a3495252a528c4987003b712860ee", nullAddress),
+ ethereum: compoundExports("0xbdC857eae1D15ad171E11af6FC3e99413Ed57Ec4", "ethereum"),
+ bsc: compoundExports(
+ "0x589DE0F0Ccf905477646599bb3E5C622C84cC0BA",
+ "bsc",
+ "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A",
+ ADDRESSES.bsc.WBNB
+ ),
polygon: compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"),
arbitrum: compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee", "arbitrum"),
+ base: compoundExports("0x94d31f92a7f85b51F0B628467B3E660BA3e8D799", "base"),
};
diff --git a/projects/credbull/index.js b/projects/credbull/index.js
new file mode 100644
index 0000000000..aeeb7c6c6b
--- /dev/null
+++ b/projects/credbull/index.js
@@ -0,0 +1,24 @@
+const { getConfig } = require('../helper/cache');
+
+async function tvl(api) {
+ let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults")
+ vaults = vaults[api.chain]
+ const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults })
+ return api.sumTokens({ tokensAndOwners2: [tokens, vaults] })
+}
+
+async function borrowed(api) {
+ let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults")
+ vaults = vaults[api.chain]
+ const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults })
+ const bals = await api.multiCall({ abi: 'address:totalAssets', calls: vaults })
+ api.add(tokens, bals)
+ const tBals = (await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map((t,i) => ({ target: t, params: vaults[i] })) })).map(i => i * -1)
+ api.add(tokens, tBals)
+}
+
+module.exports = {
+ methodology: 'TVL consist of the sum of every deposit of all vaults for a given asset.',
+ btr: { tvl, borrowed, },
+ arbitrum: { tvl, borrowed },
+};
diff --git a/projects/creditguild/index.js b/projects/creditguild/index.js
index cee9d0c8a9..3aad117bbf 100644
--- a/projects/creditguild/index.js
+++ b/projects/creditguild/index.js
@@ -12,7 +12,6 @@ Object.keys(config).forEach(chain => {
const owners = [...PSMs]
const logs = await getLogs2({
- skipCacheRead: true,
api,
factory,
eventAbi: 'event TermCreated(uint256 indexed when, uint256 indexed gaugeType, address indexed term, bytes params)',
diff --git a/projects/cropper.js b/projects/cropper.js
index 6fa54a9d33..7f4295d4eb 100644
--- a/projects/cropper.js
+++ b/projects/cropper.js
@@ -1,11 +1,9 @@
-const { getTokenBalance, getConnection, exportDexTVL, } = require("./helper/solana");
+const { getConnection, exportDexTVL, sumTokens2, } = require("./helper/solana");
const { PublicKey } = require('@solana/web3.js')
const DEX_PROGRAM_ID = 'CTMAxxk34HjKWxQ3QLZK1HpaLXmBveao3ESePXbiyfzh'
async function fetchStaking() {
- return {
- cropperfinance: await getTokenBalance('DubwWZNWiNGMMeeQHPnMATNj77YZPZSAz2WVR5WjLJqz', '5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o')
- };
+ return sumTokens2({ owners: ['5mEH7a7abQwUEXqfusVepc3z9cHVQg8uhqTXdq47J91o'] });
}
async function getTokenAccounts() {
@@ -35,4 +33,4 @@ module.exports = {
tvl: exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts),
staking: fetchStaking
}
-}; // node test.js projects/cropper.js
\ No newline at end of file
+}
\ No newline at end of file
diff --git a/projects/crust-finance-v2/index.js b/projects/crust-finance-v2/index.js
new file mode 100644
index 0000000000..245f218407
--- /dev/null
+++ b/projects/crust-finance-v2/index.js
@@ -0,0 +1,8 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ mantle: {
+ factory: "0xEaD128BDF9Cff441eF401Ec8D18a96b4A2d25252",
+ fromBlock: 62692352,
+ },
+})
\ No newline at end of file
diff --git a/projects/curve/contracts.json b/projects/curve/contracts.json
index 66c36b1cfc..bdbd6ed78e 100644
--- a/projects/curve/contracts.json
+++ b/projects/curve/contracts.json
@@ -124,9 +124,6 @@
"stableFactory": "0x3093f9B57A428F3EB6285a589cb35bEA6e78c336",
"cryptoFactory": "0x5EF72230578b3e399E6C6F4F6360edF95e83BBfd"
},
- "blacklist": [
- "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93"
- ],
"CurveStableswapFactoryNG": "0xd2002373543Ce3527023C75e7518C274A51ce712"
},
"optimism": {
@@ -164,5 +161,20 @@
"wrapped": "0xc86c7c0efbd6a49b35e8714c5f59d99de09a225b",
"metapoolBases": {},
"CurveStableswapFactoryNG": "0x1764ee18e8B3ccA4787249Ceb249356192594585"
+ },
+ "xlayer": {
+ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
+ "metapoolBases": {},
+ "CurveStableswapFactoryNG": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e"
+ },
+ "bsc": {
+ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
+ "metapoolBases": {},
+ "CurveStableswapFactoryNG": "0xd7e72f3615aa65b92a4dbdc211e296a35512988b"
+ },
+ "mantle": {
+ "gasTokenDummy": "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
+ "metapoolBases": {},
+ "CurveStableswapFactoryNG": "0x5eee3091f747e60a045a2e715a4c71e600e31f6e"
}
}
\ No newline at end of file
diff --git a/projects/curve/index.js b/projects/curve/index.js
index 4844798d5e..c53dc8ecc7 100644
--- a/projects/curve/index.js
+++ b/projects/curve/index.js
@@ -23,7 +23,10 @@ const chains = [
"celo",
"kava",
"base",
- "fraxtal"
+ "fraxtal",
+ "xlayer",
+ "bsc",
+ "mantle"
]; // Object.keys(contracts);
const registryIds = {
stableswap: 0,
@@ -181,7 +184,7 @@ async function unwrapPools({ poolList, registry, chain, block }) {
}
const blacklists = {
- ethereum: ['0x6b8734ad31d42f5c05a86594314837c416ada984', '0x95ECDC6caAf7E4805FCeF2679A92338351D24297', '0x5aa00dce91409b58b6a1338639b9daa63eb22be7', '0xEf1385D2b5dc6D14d5fecB86D53CdBefeCA20fcC', ADDRESSES.ethereum.CRVUSD, '0x29b41fe7d754b8b43d4060bb43734e436b0b9a33'],
+ ethereum: ['0x6b8734ad31d42f5c05a86594314837c416ada984', '0x29b41fe7d754b8b43d4060bb43734e436b0b9a33'],
arbitrum: ['0x3aef260cb6a5b469f970fae7a1e233dbd5939378'],
}
diff --git a/projects/cygnus-finance/index.js b/projects/cygnus-finance/index.js
index f8ea66b611..a4a696fe38 100644
--- a/projects/cygnus-finance/index.js
+++ b/projects/cygnus-finance/index.js
@@ -1,14 +1,45 @@
-const CGUSD_CONTRACT = "0xCa72827a3D211CfD8F6b00Ac98824872b72CAb49";
-const START_TIME = 1708351200;
+const { call } = require("../helper/chain/ton")
+const { get } = require('../helper/http')
-async function tvl(api) {
- await api.erc4626Sum({ calls: [CGUSD_CONTRACT], balanceAbi: 'getTotalPooledAssets', tokenAbi: "asset" });
+const CGUSD_CONTRACT = "0xCa72827a3D211CfD8F6b00Ac98824872b72CAb49"
+const START_TIME = 1708351200
+
+async function baseTvl(api) {
+ await api.erc4626Sum({ calls: [CGUSD_CONTRACT], balanceAbi: 'getTotalPooledAssets', tokenAbi: "asset" })
+}
+
+// helper function of getting jetton metadata
+async function getJettonMetadata(addr) {
+ const res = await get(`https://tonapi.io/v2/jettons/${addr}`)
+ return res
+}
+
+async function tonTvl() {
+ const MINTER_ADDRESS = "EQCfvQW-thWpqKgyqtXCFbYayDlHqS0-frkyP6VD70paLFZa"
+ const CGUSDT_ADDRESS = 'EQBIBw3mF_TDMJqWAZihVsyUBMWpWw_deftZLiCxTmrCUOKy'
+
+
+ const minterResult = await call({ target: MINTER_ADDRESS, abi: "get_minter_data", stack: [] })
+ // exchange rate from cgUSDT to USDT: decimal 9
+ const cgusdtTousdt = (minterResult[5]) / 10 ** 9
+
+ // cgUSDT total supply: decimal 6
+ const jettonResult = await getJettonMetadata(CGUSDT_ADDRESS)
+ const cgUsdtTotalSupply = jettonResult['total_supply']
+
+ // caculate tvl
+ const tvl = (cgUsdtTotalSupply) / 10 ** 6 * cgusdtTousdt
+ return { "coingecko:tether": tvl }
}
+
module.exports = {
- methodology: "Calculates the total cgUSD Supply",
+ methodology: "Calculates the total cgUSD and cgUSDT Supply",
start: START_TIME,
base: {
- tvl,
+ tvl: baseTvl,
},
+ ton: {
+ tvl: tonTvl
+ }
};
diff --git a/projects/cykura/index.js b/projects/cykura/index.js
index 7e9b367715..008088bde0 100644
--- a/projects/cykura/index.js
+++ b/projects/cykura/index.js
@@ -91,13 +91,7 @@ async function tvl() {
const provider = getProvider()
const program = new Program(idl, idl.metadata.address, provider)
const amms = await program.account.poolState.all()
- const toa = []
- amms.forEach(amm => {
- toa.push([amm.account.token0.toString(), amm.publicKey.toString()])
- toa.push([amm.account.token1.toString(), amm.publicKey.toString()])
- })
-
- return sumTokens2({ tokensAndOwners: toa, });
+ return sumTokens2({ owners: amms.map(i => i.publicKey.toString()), });
}
module.exports = {
diff --git a/projects/d2finance/index.js b/projects/d2finance/index.js
new file mode 100644
index 0000000000..975a89d36b
--- /dev/null
+++ b/projects/d2finance/index.js
@@ -0,0 +1,22 @@
+const { sumERC4626VaultsExport } = require("../helper/erc4626");
+
+const vaultTvl = sumERC4626VaultsExport({
+ vaults: [
+ "0x27D22Eb71f00495Eccc89Bb02c2B68E6988C6A42",
+ "0x183424d5ae5ec9fd486634bc566d0f75ad9c9109",
+ "0x80c403807b1032d7cb19b6d612ce23f05a213d36",
+ "0x5b49d7fae00de64779ddcd6b067c8eb046bd9a0b",
+ "0x291344FBaaC4fE14632061E4c336Fe3B94c52320",
+ "0xEd80C858D43a1D043E86Cf1F20384e189cf23BDA",
+ "0x4ada76cc8755f62508a2df65d7fafa4fd26e76c6",
+ "0x1c17a39B156189BF40905425170a3Ff62fb650DA",
+ "0x7348925D3C63e4E61e9F5308eEec0f06EaA3bB7b",
+ ],
+ isOG4626: true,
+});
+
+module.exports = {
+ arbitrum: {
+ tvl: vaultTvl,
+ },
+};
diff --git a/projects/d8x/index.js b/projects/d8x/index.js
index 0c891e7497..474940d709 100644
--- a/projects/d8x/index.js
+++ b/projects/d8x/index.js
@@ -1,9 +1,10 @@
const abi = require("./abi-poolInfo.json");
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { sumTokens2 } = require("../helper/unwrapLPs");
const config = {
- polygon_zkevm: { factory: "0xaB7794EcD2c8e9Decc6B577864b40eBf9204720f", },
- xlayer: { factory: "0xb24dB543749277E8625a59C061aE7574C8235475", },
+ polygon_zkevm: { factory: "0xaB7794EcD2c8e9Decc6B577864b40eBf9204720f" },
+ xlayer: { factory: "0xb24dB543749277E8625a59C061aE7574C8235475" },
+ arbitrum: { factory: "0x8f8BccE4c180B699F81499005281fA89440D1e95" },
};
async function tvl(api) {
@@ -15,13 +16,14 @@ async function tvl(api) {
});
const marginTokens = exchangeInfo[2];
- return sumTokens2({ api, owner: factory, tokens: marginTokens, });
+ return sumTokens2({ api, owner: factory, tokens: marginTokens });
}
module.exports = {
- methodology: "adds up the balances of all liquidity pools in the D8X exchange",
+ methodology:
+ "adds up the balances of all liquidity pools in the D8X exchange",
};
-Object.keys(config).forEach(chain => {
+Object.keys(config).forEach((chain) => {
module.exports[chain] = { tvl };
-});
\ No newline at end of file
+});
diff --git a/projects/daiko-dex/index.js b/projects/daiko-dex/index.js
new file mode 100644
index 0000000000..f3b68c6790
--- /dev/null
+++ b/projects/daiko-dex/index.js
@@ -0,0 +1,6 @@
+const { uniTvlExport } = require('../helper/unknownTokens')
+
+module.exports = uniTvlExport('taiko', '0x2cFAe8F731D6a04f3E868deB03ad73576695271A'),
+module.exports.hallmarks = [
+ [1717777624,"Rug Pull"]
+ ]
\ No newline at end of file
diff --git a/projects/danzo-arena/index.js b/projects/danzo-arena/index.js
new file mode 100644
index 0000000000..b7084cb67d
--- /dev/null
+++ b/projects/danzo-arena/index.js
@@ -0,0 +1,15 @@
+const { sumTokensExport } = require("../helper/chain/cardano");
+
+const scriptAdresses = [
+ "addr1vx4caaf06swdn7cdfc7pu3sw235zvuhd02tw2np4uac9mwcp2vt4y", //Danzo Tokens locked inside the address for the DeFi game DANZO ARENA: https://cardanzoada.com/arena/
+];
+
+module.exports = {
+ methodology:
+ "Calculates the total of idle tokens held in the above mentioned address",
+ timetravel: false,
+ cardano: {
+ tvl: ()=>({}),
+ staking: sumTokensExport({ scripts: scriptAdresses }),
+ }
+};
diff --git a/projects/daolama/tvl.js b/projects/daolama/tvl.js
index 2a016f9e84..e431da19e9 100644
--- a/projects/daolama/tvl.js
+++ b/projects/daolama/tvl.js
@@ -3,5 +3,5 @@ const { POOL_ADDRESS } = require("./constants");
const { sumTokensExport } = require("../helper/chain/ton");
module.exports = {
- tvl: sumTokensExport({ owner: POOL_ADDRESS, tokens: [ADDRESSES.null]}),
+ tvl: sumTokensExport({ owner: POOL_ADDRESS, tokens: [ADDRESSES.ton.TON, ADDRESSES.ton.USDT]}),
}
diff --git a/projects/davos-protocol/index.js b/projects/davos-protocol/index.js
index 6cdac9fca1..d5f310e020 100644
--- a/projects/davos-protocol/index.js
+++ b/projects/davos-protocol/index.js
@@ -1,3 +1,4 @@
+const { nullAddress } = require('../helper/unwrapLPs')
const config = {
arbitrum: {
@@ -31,6 +32,11 @@ Object.keys(config).forEach(chain => {
const { mvts,} = config[chain]
module.exports[chain] = {
tvl: async (api) => {
+ if (chain === 'polygon') {
+ const token = '0x77F4C841cb87fDFa43aB909cf56f7710Af648a8e'
+ const deposits = await api.call({ abi: 'function deposits(address) view returns (uint256)', target: '0xdd0BdF5749e300f946cdb1dDFE1ffa828eC0dB72', params: token })
+ api.add(nullAddress, deposits)
+ }
const assets = await api.multiCall({ abi: 'address:asset', calls: mvts})
return api.sumTokens({ tokensAndOwners2: [assets, mvts]})
}
diff --git a/projects/defiedge/index.js b/projects/defiedge/index.js
index 3b6dcf6465..b6fa4ce46e 100644
--- a/projects/defiedge/index.js
+++ b/projects/defiedge/index.js
@@ -27,14 +27,19 @@ module.exports = {
const config = {
arbitrum: { network: "arbitrum" },
+ astrzk: { network: "astarZkEVM" },
avax: { network: "avalanche" },
base: { network: "base" },
bsc: { network: "bsc" },
era: { network: "zksyncEra" },
ethereum: { network: "mainnet" },
+ linea: { network: "linea" },
+ mantle : { network: "mantle" },
+ moonbeam: { network: "moonbeam" },
optimism: { network: "optimism" },
polygon_zkevm: { network: "zkEVM" },
polygon: { network: "polygon" },
+ xlayer: { network: "xLayer" },
};
Object.keys(config).forEach((chain) => {
diff --git a/projects/definitely/index.js b/projects/definitely/index.js
index b37d5d982f..206bd1e484 100644
--- a/projects/definitely/index.js
+++ b/projects/definitely/index.js
@@ -1,14 +1,22 @@
const { sumTokens2, nullAddress } = require('../helper/unwrapLPs')
const contract = "0x6aB5242fCaCd0d37c39F77Ff7EabdCcac5e8D450"
+const contract1 = "0x4703B92dFCb0Ad403030BF783c8EC067297B55fA"
async function tvl(time, ethBlock, _b, {api}) {
return sumTokens2({ tokens: [nullAddress], owner: contract, api })
}
+async function tvlsei(time, ethBlock, _b, {api}) {
+ return sumTokens2({ tokens: [nullAddress], owner: contract1, api })
+}
+
module.exports = {
- methodology: `We count the ETH on ${contract}`,
+ methodology: `We count the SEI on ${contract}`,
arbitrum: {
tvl
+ },
+ sei: {
+ tvl:tvlsei
}
}
\ No newline at end of file
diff --git a/projects/defiplaza.js b/projects/defiplaza.js
index d915d241e9..3da8a98f9a 100644
--- a/projects/defiplaza.js
+++ b/projects/defiplaza.js
@@ -1,11 +1,11 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('./helper/cache');
const { sumTokens, queryAddresses } = require('./helper/chain/radixdlt');
const { getConfig } = require('./helper/cache');
const { get } = require('./helper/http');
-const sdk = require('@defillama/sdk');
-const graphUrl = 'https://api.thegraph.com/subgraphs/name/omegasyndicate/defiplaza';
+const graphUrl = sdk.graph.modifyEndpoint('4z9FBF12CrfoQJhAkWicqzY2fKYN9QRmuzSsizVXhjKa');
module.exports = {
ethereum: {
diff --git a/projects/defusion/index.js b/projects/defusion/index.js
new file mode 100644
index 0000000000..ecd1cb2f07
--- /dev/null
+++ b/projects/defusion/index.js
@@ -0,0 +1,9 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+async function tvl(api) {
+ const supply = await api.call({ abi: 'erc20:totalSupply', target: '0xCdde1f5D971A369eB952192F9a5C367f33a0A891'})
+ api.add(ADDRESSES.tomochain.TOMO, supply)
+}
+
+module.exports.tomochain = {
+ tvl
+}
diff --git a/projects/dehive/abi.json b/projects/dehive/abi.json
deleted file mode 100644
index dc64d452a8..0000000000
--- a/projects/dehive/abi.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "poolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused)",
- "totalSupply": "uint256:totalSupply",
- "balanceOf": "function balanceOf(address account) view returns (uint256)",
- "getUnderlyingsAmountsFromClusterAmount": "function getUnderlyingsAmountsFromClusterAmount(uint256 _clusterAmount) view returns (uint256[])",
- "getUnderlyings": "address[]:getUnderlyings",
- "impulseMultiPoolInfo": "function poolInfo(uint256) view returns (address assetToken, uint256 lastRewardBlock, uint256 poolSupply, bool paused, address strategy)",
- "wantLockedTotal": "uint256:wantLockedTotal",
- "listUnderlying": "address[]:listUnderlying",
- "wantPriceInUnderlying": "function wantPriceInUnderlying(uint256 _wantAmt) view returns (uint256[])",
- "wantPriceInUsd": "function wantPriceInUsd(uint256 _wantAmt) view returns (uint256)",
- "usdToken": "address:usdToken"
-}
\ No newline at end of file
diff --git a/projects/dehive/assetsInfo.js b/projects/dehive/assetsInfo.js
deleted file mode 100644
index c68fa85945..0000000000
--- a/projects/dehive/assetsInfo.js
+++ /dev/null
@@ -1,419 +0,0 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-// Auto generated at 9-2-2022 16:14
-module.exports = {
- 'ethereum' : [
- {//DHV (solo)
- meta: {
- stakingAddress: '0x04595f9010F79422a9b411ef963e4dd1F7107704', // StakingDHV
- tokenAddress: '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', // DHV
- poolId: 0
- },
- tvl: "stakingDhvTvl"
- },
- {//DHV/ETH (lp)
- meta: {
- stakingAddress: '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', // StakingPools
- lpAddress: '0x60c5bf43140d6341bebfe13293567fafbe01d65b', // UNI-DHV-WETH
- dhvToken: '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A',
- underlying: [
- '0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', // DHV
- ADDRESSES.ethereum.WETH, // WETH
- ],
- isPool2: true,
- poolId: 0
- },
- tvl: "lpStakingTvl"
- },
- {//DECR (cluster)
- meta: {
- clusterAddress: '0x6Bc3F65Fc50E49060e21eD6996be96ee4B404752', // DECR
- },
- tvl: "clusterTvl"
- },
- ],
- 'polygon' : [
- {//DHV (solo)
- meta: {
- stakingAddress: '0x88cFC1bc9aEb80f6C8f5d310d6C3761c2a646Df7', // StakingDHV
- tokenAddress: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // DHV
- poolId: 0
- },
- tvl: "stakingDhvTvl"
- },
- {//Stable Curve 3-Pool (impulse-multiple)
- meta: {
- stakingAddress: '0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', // ImpulseMultiStaking
- poolId: 1
- },
- tvl: "crvStakingTvl"
- },
- {//Curve 5-Pool (impulse-multiple)
- meta: {
- stakingAddress: '0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', // ImpulseMultiStaking
- poolId: 0
- },
- tvl: "crvStakingTvl"
- },
- {//DHV/QUICK (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0xfd0E242c95b271844bf6860D4bC0E3e136bC0f7C', // QCK-DHV-QUICK
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', // DHV
- '0x831753DD7087CaC61aB5644b308642cc1c33Dc13', // QUICK
- ],
- poolId: 0
- },
- tvl: "impulseStakingTvl"
- },
- {//WETH/DAI (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0x4A35582a710E1F4b2030A3F826DA20BfB6703C09', // QCK-WETH-DAI
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- ADDRESSES.polygon.WETH_1, // WETH
- ADDRESSES.polygon.DAI, // DAI
- ],
- poolId: 1
- },
- tvl: "impulseStakingTvl"
- },
- // COMMENTED THIS OUT BECAUSE 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'
- // {//USDC/QUICK (impulse)
- // meta: {
- // stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- // lpAddress: '0x1F1E4c845183EF6d50E9609F16f6f9cAE43BC9Cb', // QCK-USDC-QUICK
- // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- // underlying: [
- // ADDRESSES.polygon.USDC, // USDC
- // '0x831753DD7087CaC61aB5644b308642cc1c33Dc13', // QUICK
- // ],
- // poolId: 2
- // },
- // tvl: "impulseStakingTvl"
- // },
- // COMMENTED THIS OUT BECAUSE 'UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT'
- // {//USDT/MAI (impulse)
- // meta: {
- // stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- // lpAddress: '0xE89faE1B4AdA2c869f05a0C96C87022DaDC7709a', // QCK-MAI-USDT
- // dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- // underlying: [
- // ADDRESSES.polygon.USDT, // USDT
- // '0xa3fa99a148fa48d14ed51d610c367c61876997f1', // MAI
- // ],
- // poolId: 4
- // },
- // tvl: "impulseStakingTvl"
- // },
- {//AVAX/WETH (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0x1274De0DE2e9D9b1d0E06313c0E5EdD01CC335eF', // SUSHI-AVAX-WETH
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- '0x2C89bbc92BD86F8075d1DEcc58C7F4E0107f286b', // AVAX
- ADDRESSES.polygon.WETH_1, // WETH
- ],
- poolId: 5
- },
- tvl: "impulseStakingTvl"
- },
- {//WMATIC/WETH (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0xc4e595acDD7d12feC385E5dA5D43160e8A0bAC0E', // SUSHI-WMATIC-WETH
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- ADDRESSES.polygon.WMATIC_2, // WMATIC
- ADDRESSES.polygon.WETH_1, // WETH
- ],
- poolId: 6
- },
- tvl: "impulseStakingTvl"
- },
- {//CRV/WETH (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0x396E655C309676cAF0acf4607a868e0CDed876dB', // SUSHI-CRV-WETH
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- '0x172370d5Cd63279eFa6d502DAB29171933a610AF', // CRV
- ADDRESSES.polygon.WETH_1, // WETH
- ],
- poolId: 7
- },
- tvl: "impulseStakingTvl"
- },
- {//SNX/WETH (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0x116Ff0d1Caa91a6b94276b3471f33dbeB52073E7', // SUSHI-SNX-WETH
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- '0x50B728D8D964fd00C2d0AAD81718b71311feF68a', // SNX
- ADDRESSES.polygon.WETH_1, // WETH
- ],
- poolId: 8
- },
- tvl: "impulseStakingTvl"
- },
- {//WMATIC/GHST (impulse)
- meta: {
- stakingAddress: '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868', // ImpulseStaking
- lpAddress: '0xf69e93771F11AECd8E554aA165C3Fe7fd811530c', // SUSHI-WMATIC-GHST
- dhvToken: '0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26',
- underlying: [
- ADDRESSES.polygon.WMATIC_2, // WMATIC
- '0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7', // GHST
- ],
- poolId: 9
- },
- tvl: "impulseStakingTvl"
- },
- {//DPOL (cluster)
- meta: {
- clusterAddress: '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', // DPOL
- },
- tvl: "clusterTvl"
- },
- {//DGAME (cluster)
- meta: {
- clusterAddress: '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a', // DGAME
- },
- tvl: "clusterTvl"
- },
- ],
- 'bsc' : [
- {//DHV (solo)
- meta: {
- stakingAddress: '0x35f28aA0B2F34eFF17d2830135312ab2a777De36', // StakingDHV
- tokenAddress: '0x58759dd469ae5631c42cf8a473992335575b58d7', // DHV
- poolId: 0
- },
- tvl: "stakingDhvTvl"
- },
- {//DHV/BUSD (lp)
- meta: {
- stakingAddress: '0xF2e8CD1c40C766FEe73f56607fDffa526Ba8fa6c', // StakingPools
- lpAddress: '0x72ba008B631D9FD5a8E8013023CB3c05E19A7CA9', // PANCAKE-DHV-BUSD
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x58759dd469ae5631c42cf8a473992335575b58d7', // DHV
- ADDRESSES.bsc.BUSD, // BUSD
- ],
- isPool2: true,
- poolId: 0
- },
- tvl: "lpStakingTvl"
- },
- {//CAKE/BUSD (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x804678fa97d91B974ec2af3c843270886528a9E6', // PANCAKE-CAKE-BUSD
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE
- ADDRESSES.bsc.BUSD, // BUSD
- ],
- poolId: 0
- },
- tvl: "impulseStakingTvl"
- },
- {//USDT/USDC (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0xEc6557348085Aa57C72514D67070dC863C0a5A8c', // PANCAKE-BUSDT-USDC
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- ADDRESSES.bsc.USDT, // BUSDT
- ADDRESSES.bsc.USDC, // BUSDC
- ],
- poolId: 1
- },
- tvl: "impulseStakingTvl"
- },
- {//USDT/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x16b9a82891338f9bA80E2D6970FddA79D1eb0daE', // PANCAKE-BUSDT-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- ADDRESSES.bsc.USDT, // BUSDT
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 2
- },
- tvl: "impulseStakingTvl"
- },
- {//XVS/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x7EB5D86FD78f3852a3e0e064f2842d45a3dB6EA2', // PANCAKE-XVS-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0xcF6BB5389c92Bdda8a3747Ddb454cB7a64626C63', // XVS
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 3
- },
- tvl: "impulseStakingTvl"
- },
- {//ALPACA/BUSD (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x7752e1FA9F3a2e860856458517008558DEb989e3', // PANCAKE-ALPACA-BUSD
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F', // ALPACA
- ADDRESSES.bsc.BUSD, // BUSD
- ],
- poolId: 4
- },
- tvl: "impulseStakingTvl"
- },
- {//LINK/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x824eb9faDFb377394430d2744fa7C42916DE3eCe', // PANCAKE-LINK-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD', // LINK
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 5
- },
- tvl: "impulseStakingTvl"
- },
- {//CAKE/USDT (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0xA39Af17CE4a8eb807E076805Da1e2B8EA7D0755b', // PANCAKE-CAKE-BUSDT
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', // CAKE
- ADDRESSES.bsc.USDT, // BUSDT
- ],
- poolId: 6
- },
- tvl: "impulseStakingTvl"
- },
- {//DODO/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0xA9986Fcbdb23c2E8B11AB40102990a08f8E58f06', // PANCAKE-DODO-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x67ee3Cb086F8a16f34beE3ca72FAD36F7Db929e2', // DODO
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 7
- },
- tvl: "impulseStakingTvl"
- },
- {//BANANA/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0xF65C1C0478eFDe3c19b49EcBE7ACc57BB6B1D713', // APE-BANANA-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 8
- },
- tvl: "impulseStakingTvl"
- },
- {//BANANA/BUSD (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x7Bd46f6Da97312AC2DBD1749f82E202764C0B914', // APE-BANANA-BUSD
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95', // BANANA
- ADDRESSES.bsc.BUSD, // BUSD
- ],
- poolId: 9
- },
- tvl: "impulseStakingTvl"
- },
- {//TWT/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x4c48D692e3de076C7b844B956b28cdd1DD5C0945', // APE-TWT-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x4B0F1812e5Df2A09796481Ff14017e6005508003', // TWT
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 10
- },
- tvl: "impulseStakingTvl"
- },
- {//AVAX/WBNB (impulse)
- meta: {
- stakingAddress: '0xA9c97Ff825dB9dd53056d65aE704031B4959d99a', // ImpulseStaking
- lpAddress: '0x40aFc7CBd0Dc2bE5860F0035b717d20Afb4827b2', // APE-AVAX-WBNB
- dhvToken: '0x58759dd469ae5631c42cf8a473992335575b58d7',
- underlying: [
- '0x1CE0c2827e2eF14D5C4f29a091d735A204794041', // AVAX
- ADDRESSES.bsc.WBNB, // WBNB
- ],
- poolId: 11
- },
- tvl: "impulseStakingTvl"
- },
- {//DBSC (cluster)
- meta: {
- clusterAddress: '0x0a684421ef48b431803BFd75F38675EAb1e38Ed5', // DBSC
- },
- tvl: "clusterTvl"
- },
- ],
- 'xdai' : [
- {//DHV (solo)
- meta: {
- stakingAddress: '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a', // StakingDHV
- tokenAddress: '0xFbdd194376de19a88118e84E279b977f165d01b8', // DHV
- poolId: 0
- },
- tvl: "stakingDhvTvl"
- },
- {//DHV/XDAI (lp)
- meta: {
- stakingAddress: '0xa4E7BE054000603B82B79208aC3eE5428554CaF6', // StakingPools
- lpAddress: '0x14EE6d20B8167eacb885F4F2F45C3Bf2d4FD06f4', // HONEY-DHV-WXDAI
- dhvToken: '0xFbdd194376de19a88118e84E279b977f165d01b8',
- underlying: [
- '0xFbdd194376de19a88118e84E279b977f165d01b8', // DHV
- ADDRESSES.xdai.WXDAI, // WXDAI
- ],
- isPool2: true,
- poolId: 1
- },
- tvl: "lpStakingTvl"
- },
- {//Stable Curve 3-Pool (impulse-multiple)
- meta: {
- stakingAddress: '0xfa7Ca14a28CD419a69E45e8416cA4FA87457aCE8', // ImpulseMultiStaking
- poolId: 0
- },
- tvl: "crvStakingTvl"
- },
- {//DXDC (cluster)
- meta: {
- clusterAddress: '0xF557B2B73b872E6d2F43826f9D77B7402A363Bc0', // DXDC
- },
- tvl: "clusterTvl"
- },
- {//DXIN (cluster)
- meta: {
- clusterAddress: '0xA6C090c5572f54d529B0839b8fd2D50a4afB1E6B', // DXIN
- },
- tvl: "clusterTvl"
- },
- ],
-};
-
diff --git a/projects/dehive/index.js b/projects/dehive/index.js
index d3c800c2aa..336a058449 100644
--- a/projects/dehive/index.js
+++ b/projects/dehive/index.js
@@ -1,298 +1,76 @@
-const sdk = require("@defillama/sdk");
-const BigNumber = require("bignumber.js");
-const abi = require('./abi.json')
-
-const assetsInfo = require("./assetsInfo");
-
-const EXPORT_TYPE_TVL = 0;
-const EXPORT_TYPE_DHV_STAKING = 1;
-const EXPORT_TYPE_POOL2 = 2;
-
-async function stakingTvl(chain, meta, ethBlock) {
- return (await sdk.api.abi.call({
- target: meta.stakingAddress,
- abi: abi.poolInfo,
- params: meta.poolId,
- chain,
- block: ethBlock
- })).output.poolSupply;
-}
-
-async function stakingDhvTvl(chain, meta, ethBlock) {
- return (await sdk.api.abi.call({
- target: meta.tokenAddress,
- abi: abi.balanceOf,
- params: meta.stakingAddress,
- chain,
- block: ethBlock
- })).output;
-}
-
-async function lpStakingTvl(chain, meta, ethBlock) {
- const { poolSupply } = (await sdk.api.abi.call({
- target: meta.stakingAddress,
- abi: abi.poolInfo,
- params: meta.poolId,
- chain,
- block: ethBlock
- })).output;
- const poolSupplyBN = new BigNumber(poolSupply);
-
- const lpTotalSupply = (await sdk.api.abi.call({
- target: meta.lpAddress,
- abi: abi.totalSupply,
- chain,
- block: ethBlock
- })).output;
- const lpTotalSupplyBN = new BigNumber(lpTotalSupply);
-
- const tvl = [];
- for (let i = 0; i < meta.underlying.length; i++) {
- const underlyingLpBalance = (await sdk.api.abi.call({
- target: meta.underlying[i],
- abi: abi.balanceOf,
- params: meta.lpAddress,
- chain,
- block: ethBlock
- })).output;
- const underlyingLpBalanceBN = new BigNumber(underlyingLpBalance);
- const underlyingTvl = poolSupplyBN.multipliedBy(underlyingLpBalanceBN).div(lpTotalSupplyBN);
-
- tvl.push([meta.underlying[i], underlyingTvl.integerValue().toFixed()]);
- }
-
- if (meta.dhvToken) {
- const dhvBalance = (await sdk.api.abi.call({
- target: meta.dhvToken,
- abi: abi.balanceOf,
- params: meta.stakingAddress,
- chain,
- block: ethBlock
- })).output;
- tvl.push([meta.dhvToken, dhvBalance]);
- }
- return tvl;
-}
-
-async function crvStakingTvl(chain, meta, ethBlock) {
- const { strategy } = (await sdk.api.abi.call({
- target: meta.stakingAddress,
- abi: abi.impulseMultiPoolInfo,
- params: meta.poolId,
- chain,
- block: ethBlock
- })).output;
-
- const wantLockedTotal = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.wantLockedTotal,
- chain,
- block: ethBlock
- })).output;
-
- const underlyingList = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.listUnderlying,
- chain,
- block: ethBlock
- })).output;
-
- const underlyingAmount = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.wantPriceInUnderlying,
- params: wantLockedTotal,
- chain,
- block: ethBlock
- })).output;
-
- return underlyingList.map((_, i) => [underlyingList[i], underlyingAmount[i]]);
-}
-
-async function impulseStakingTvl(chain, meta, ethBlock) {
- if (chain === 'bsc') {
- return await lpStakingTvl(chain, meta, ethBlock); // from staking pool
- }
- const { strategy } = (await sdk.api.abi.call({
- target: meta.stakingAddress,
- abi: abi.impulseMultiPoolInfo,
- params: meta.poolId,
- chain,
- block: ethBlock
- })).output;
-
- const wantLockedTotal = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.wantLockedTotal,
- chain,
- block: ethBlock
- })).output;
-
- const usdToken = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.usdToken,
- chain,
- block: ethBlock
- })).output;
-
- const wantPrice = (await sdk.api.abi.call({
- target: strategy,
- abi: abi.wantPriceInUsd,
- params: wantLockedTotal,
- chain,
- block: ethBlock
- })).output;
-
- let tvl = await lpStakingTvl(chain, meta, ethBlock); // from staking pool
- tvl.push([usdToken, wantPrice]); // from strategy
-
- return tvl;
-}
-
-async function clusterTvl(chain, meta, ethBlock) {
- const poolSupply = (await sdk.api.abi.call({
- target: meta.clusterAddress,
- abi: "erc20:totalSupply",
- chain,
- block: ethBlock
- })).output;
-
- const underlyingList = (await sdk.api.abi.call({
- target: meta.clusterAddress,
- abi: abi.getUnderlyings,
- chain,
- block: ethBlock
- })).output;
-
- const underlyingAmount = (await sdk.api.abi.call({
- target: meta.clusterAddress,
- abi: abi.getUnderlyingsAmountsFromClusterAmount,
- params: poolSupply,
- chain,
- block: ethBlock
- })).output;
-
- return underlyingList.map((_, i) => [underlyingList[i], underlyingAmount[i]]);
-}
-
-async function chainTvl(chain, chainBlocks, exportType) {
- const tvl = {};
- const transform = addr => `${chain}:${addr}`
- const block = chainBlocks[chain]
- await Promise.all(assetsInfo[chain].map(async (staking) => {
- {
- let calculateTvlFunction = undefined;
- switch (staking.tvl) {
- case "stakingTvl":
- calculateTvlFunction = stakingTvl;
- break;
- case "stakingDhvTvl":
- calculateTvlFunction = stakingDhvTvl;
- break;
- case "lpStakingTvl":
- calculateTvlFunction = lpStakingTvl;
- break;
- case "crvStakingTvl":
- calculateTvlFunction = crvStakingTvl;
- break;
- case "clusterTvl":
- calculateTvlFunction = clusterTvl;
- break;
- case "impulseStakingTvl":
- calculateTvlFunction = impulseStakingTvl;
- break;
- default:
- sdk.log('unknown tvl type', JSON.stringify(staking, null, 4));
- return;
- }
- if (
- (staking.tvl === "stakingDhvTvl" && exportType !== EXPORT_TYPE_DHV_STAKING)
- || (staking.tvl !== "stakingDhvTvl" && exportType === EXPORT_TYPE_DHV_STAKING)
- || (staking.tvl === "lpStakingTvl" && exportType === EXPORT_TYPE_POOL2 && (staking.isPool2 !== true))
- || (staking.tvl === "lpStakingTvl" && exportType !== EXPORT_TYPE_POOL2 && (staking.isPool2 === true))
- ) {
- return;
- }
- const tvls = await calculateTvlFunction(chain, staking.meta, block);
- if (typeof tvls === 'string') {
- sdk.util.sumSingleBalance(tvl, transform(staking.meta.tokenAddress), tvls)
- } else {
- for (let i = 0; i < tvls.length; i++) {
- sdk.util.sumSingleBalance(tvl, transform(tvls[i][0]), tvls[i][1])
- }
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const config = {
+ ethereum: {
+ clusters: ['0x6Bc3F65Fc50E49060e21eD6996be96ee4B404752'],
+ pool2s: [['0x60c5bf43140d6341bebfe13293567fafbe01d65b', '0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0']],
+ stakings: [['0x62Dc4817588d53a056cBbD18231d91ffCcd34b2A', '0x04595f9010F79422a9b411ef963e4dd1F7107704']],
+ },
+ polygon: {
+ stakings: [['0x5fCB9de282Af6122ce3518CDe28B7089c9F97b26', '0x88cFC1bc9aEb80f6C8f5d310d6C3761c2a646Df7']],
+ pool2s: [['0xfd0E242c95b271844bf6860D4bC0E3e136bC0f7C', '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868']],
+ impulses: ['0xE6E6982fb5dDF4fcc74cCCe4e4eea774E002D17F', '0xf4feb23531EdBe471a4493D432f8BB29Bf0A3868'],
+ clusters: ['0x4964B3B599B82C3FdDC56e3A9Ffd77d48c6AF0f0', '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a'],
+ },
+ bsc: {
+ stakings: [['0x58759dd469ae5631c42cf8a473992335575b58d7', '0x35f28aA0B2F34eFF17d2830135312ab2a777De36']],
+ pool2s: [['0x72ba008B631D9FD5a8E8013023CB3c05E19A7CA9', '0xF2e8CD1c40C766FEe73f56607fDffa526Ba8fa6c']],
+ impulses: ['0xA9c97Ff825dB9dd53056d65aE704031B4959d99a'],
+ clusters: ['0x0a684421ef48b431803BFd75F38675EAb1e38Ed5'],
+ },
+ xdai: {
+ stakings: [['0xFbdd194376de19a88118e84E279b977f165d01b8', '0x589Ea336092184d9eD74b8263c4eecA73Ed0cE7a']],
+ pool2s: [['0x14EE6d20B8167eacb885F4F2F45C3Bf2d4FD06f4', '0xa4E7BE054000603B82B79208aC3eE5428554CaF6']],
+ impulses: ['0xfa7Ca14a28CD419a69E45e8416cA4FA87457aCE8'],
+ clusters: ['0xF557B2B73b872E6d2F43826f9D77B7402A363Bc0', '0xA6C090c5572f54d529B0839b8fd2D50a4afB1E6B'],
+ },
+}
+
+Object.keys(config).forEach(chain => {
+ const { clusters, pool2s, stakings, impulses } = config[chain]
+
+ const blacklistedTokens = []
+ if (pool2s) pool2s.forEach(p => blacklistedTokens.push(p[0]))
+ if (stakings) stakings.forEach(s => blacklistedTokens.push(s[0]))
+
+ const blacklistedSet = new Set(blacklistedTokens.map(i => i.toLowerCase()))
+
+ const exportObj = {
+ tvl: async (api) => {
+ if (clusters) {
+ const tokens = await api.multiCall({ abi: 'address[]:getUnderlyings', calls: clusters })
+ const ownerTokens = tokens.map((t, i) => [t, clusters[i]])
+ await api.sumTokens({ ownerTokens })
+ }
+
+ if (impulses) {
+ for (const impulse of impulses) {
+ let i = 0
+ let length = 5
+ let moreTokens = true
+ do {
+ const calls = []
+ for (let j = 0; j < length; j++) {
+ calls.push(i + j)
+ i += length
}
+ const data = await api.multiCall({ abi: 'function poolInfo(uint256) view returns (address token, uint256 lastReward, uint256 poolSupply, bool paused, address strategy)', calls, target: impulse, permitFailure: true })
+ moreTokens = data.some(d => !d)
+ data.forEach(i => {
+ if (!i) return;
+ if (blacklistedSet.has(i.token.toLowerCase())) return;
+ api.add(i.token, i.poolSupply)
+ })
+ } while (moreTokens)
}
- }))
- return tvl
-}
-
-async function ethereumTvl(timestamp, ethBlock, chainBlocks) {
- return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_TVL);
-}
-
-async function polygonTvl(timestamp, ethBlock, chainBlocks) {
- return chainTvl('polygon', chainBlocks, EXPORT_TYPE_TVL);
-}
-
-async function bscTvl(timestamp, ethBlock, chainBlocks) {
- return chainTvl('bsc', chainBlocks, EXPORT_TYPE_TVL);
-}
-
-async function xdaiTvl(timestamp, ethBlock, chainBlocks) {
- return chainTvl('xdai', chainBlocks, EXPORT_TYPE_TVL);
-}
-
-async function ethereumStaking(timestamp, ethBlock, chainBlocks) {
- return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_DHV_STAKING);
-}
-
-async function polygonStaking(timestamp, ethBlock, chainBlocks) {
- return chainTvl('polygon', chainBlocks, EXPORT_TYPE_DHV_STAKING);
-}
-
-async function bscStaking(timestamp, ethBlock, chainBlocks) {
- return chainTvl('bsc', chainBlocks, EXPORT_TYPE_DHV_STAKING);
-}
-
-async function xdaiStaking(timestamp, ethBlock, chainBlocks) {
- return chainTvl('xdai', chainBlocks, EXPORT_TYPE_DHV_STAKING);
-}
-
-async function ethereumPool2(timestamp, ethBlock, chainBlocks) {
- return chainTvl('ethereum', chainBlocks, EXPORT_TYPE_POOL2);
-}
-
-async function polygonPool2(timestamp, ethBlock, chainBlocks) {
- return chainTvl('polygon', chainBlocks, EXPORT_TYPE_POOL2);
-}
-
-async function bscPool2(timestamp, ethBlock, chainBlocks) {
- return chainTvl('bsc', chainBlocks, EXPORT_TYPE_POOL2);
-}
-
-async function xdaiPool2(timestamp, ethBlock, chainBlocks) {
- return chainTvl('xdai', chainBlocks, EXPORT_TYPE_POOL2);
-}
+ }
+ }
+ }
+ if (pool2s)
+ exportObj.pool2 = sumTokensExport({ tokensAndOwners: pool2s, resolveLP: true, })
-module.exports = {
- ethereum: {
- tvl: ethereumTvl,
- pool2: ethereumPool2,
- staking: ethereumStaking
- },
- polygon: {
- tvl: polygonTvl,
- pool2: polygonPool2,
- staking: polygonStaking
- },
- bsc: {
- tvl: bscTvl,
- pool2: bscPool2,
- staking: bscStaking
- },
- xdai: {
- tvl: xdaiTvl,
- pool2: xdaiPool2,
- staking: xdaiStaking
- }
-};
+ if (stakings)
+ exportObj.staking = sumTokensExport({ tokensAndOwners: stakings, })
+ module.exports[chain] = exportObj
+})
diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js
index 6799e5e6a9..649aa73e1f 100644
--- a/projects/deltaprime/index.js
+++ b/projects/deltaprime/index.js
@@ -9,6 +9,11 @@ const ggAVAXBalancerBalanceAbi = "function balancerGgAvaxBalance() view returns
const yyAVAXBalancerBalanceAbi = "function balancerYyAvaxBalance() view returns (uint256)"
const sAVAXBalancerBalanceAbi = "function balancerSAvaxBalance() view returns (uint256)"
+const yieldYakWombatAvaxBalanceInWombatAvaxSavaxLP = "function avaxBalanceAvaxSavaxYY() view returns (uint256)"
+const yieldYakWombatSAvaxBalanceInWombatAvaxSavaxLP = "function sAvaxBalanceAvaxSavaxYY() view returns (uint256)"
+const yieldYakWombatsAvaxBalanceInWombatAvaxGgavaxLP = "function avaxBalanceAvaxGgavaxYY() view returns (uint256)"
+const yieldYakWombatsGgavaxBalanceInWombatAvaxGgavaxLP = "function ggAvaxBalanceAvaxGgavaxYY() view returns (uint256)"
+
const assetToAddressMappingAvalanche = require('./mappings/assetToAddressMappingAvalanche.json')
const assetToAddressMappingArbitrum = require('./mappings/assetToAddressMappingArbitrum.json')
@@ -76,9 +81,22 @@ async function tvlAvalanche(api) {
let yyAvaxBalancerBalances = await api.multiCall({ abi: yyAVAXBalancerBalanceAbi, calls: accounts })
let sAvaxBalancerBalances = await api.multiCall({ abi: sAVAXBalancerBalanceAbi, calls: accounts })
+ let avaxYYWombatAvaxSAvaxLPBalances = await api.multiCall({ abi: yieldYakWombatAvaxBalanceInWombatAvaxSavaxLP, calls: accounts })
+ let savaxYYWombatAvaxSAvaxLPBalances = await api.multiCall({ abi: yieldYakWombatSAvaxBalanceInWombatAvaxSavaxLP, calls: accounts })
+ let avaxYYWombatAvaxGgavaxLPBalances = await api.multiCall({ abi: yieldYakWombatsAvaxBalanceInWombatAvaxGgavaxLP, calls: accounts })
+ let ggAaxYYWombatAvaxGgavaxLPBalances = await api.multiCall({ abi: yieldYakWombatsGgavaxBalanceInWombatAvaxGgavaxLP, calls: accounts })
+
ggAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_ggAVAX_AVAX"], i, api.chain))
yyAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_yyAVAX_AVAX"], i, api.chain))
sAvaxBalancerBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["BAL_sAVAX_AVAX"], i, api.chain))
+
+ avaxYYWombatAvaxSAvaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_sAVAX_AVAX_LP_AVAX"], i, api.chain))
+ savaxYYWombatAvaxSAvaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_sAVAX_AVAX_LP_sAVAX"], i, api.chain))
+ avaxYYWombatAvaxGgavaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_ggAVAX_AVAX_LP_AVAX"], i, api.chain))
+ ggAaxYYWombatAvaxGgavaxLPBalances.forEach(i => sdk.util.sumSingleBalance(balances, assetToAddressMappingAvalanche["WOMBAT_ggAVAX_AVAX_LP_ggAVAX"], i, api.chain))
+
+ console.log(`Balances: ${JSON.stringify(balances)}`)
+
return balances;
}
diff --git a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json
index 57f7c7368b..d822bd88f8 100644
--- a/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json
+++ b/projects/deltaprime/mappings/assetToAddressMappingAvalanche.json
@@ -36,11 +36,18 @@
"YY_TJ_AVAX_USDC_LP": "0xDEf94a13fF31FB6363f1e03bF18fe0F59Db83BBC",
"YY_TJ_AVAX_ETH_LP": "0x5219558ee591b030E075892acc41334A1694fd8A",
"YY_TJ_AVAX_sAVAX_LP": "0x22EDe03f1115666CF05a4bAfafaEe8F43D42cD56",
+ "WOMBAT_ggAVAX_AVAX_LP_AVAX": "0x960c66dda302f4a496d936f693e083b1e9ace306",
+ "WOMBAT_ggAVAX_AVAX_LP_ggAVAX": "0x2ddfdd8e1bec473f07815fa3cfea3bba4d39f37e",
+ "WOMBAT_sAVAX_AVAX_LP_AVAX": "0x29eeb257a2a6ecde2984acedf80a1b687f18ec91",
+ "WOMBAT_sAVAX_AVAX_LP_sAVAX": "0xc096ff2606152ed2a06dd12f15a3c0466aa5a9fa",
"MOO_TJ_AVAX_USDC_LP": "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c",
"GM_BTC_BTCb_USDC": "0xFb02132333A79C8B5Bd0b64E3AbccA5f7fAf2937",
"GM_ETH_WETHe_USDC": "0xB7e69749E3d2EDd90ea59A4932EFEa2D41E245d7",
"GM_AVAX_WAVAX_USDC": "0x913C1F46b48b3eD35E7dc3Cf754d4ae8499F31CF",
"GM_SOL_SOL_USDC": "0xd2eFd1eA687CD78c41ac262B3Bc9B53889ff1F70",
+ "GM_BTC_BTCb": "0x3ce7BCDB37Bf587d1C17B930Fa0A7000A0648D12",
+ "GM_ETH_WETHe": "0x2A3Cf4ad7db715DF994393e4482D6f1e58a1b533",
+ "GM_AVAX_WAVAX": "0x08b25A2a89036d298D6dB8A74ace9d1ce6Db15E5",
"GLP": "0x9e295B5B976a184B14aD8cd72413aD846C299660",
"DAIe": "0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",
"USDCe": "0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664",
diff --git a/projects/deri-v4/index.js b/projects/deri-v4/index.js
index adca15cd19..2107b324e6 100644
--- a/projects/deri-v4/index.js
+++ b/projects/deri-v4/index.js
@@ -28,6 +28,9 @@ const config = {
scroll: { fromBlock: 1384607, factory: '0x7B56Af65Da221A40B48bEDcCb67410D6C0bE771D', },
manta: { fromBlock: 1132047, factory: '0xc8fa78f6b68ab22239222b4249b1ff968d154ae9', },
polygon_zkevm: { fromBlock: 8978690, factory: '0xc7e484c20d5dc5d33299afb430bfb5d17085ee98', },
+ taiko: { fromBlock: 130174, factory: '0xd4E08C940dDeC162c2D8f3034c75c3e08f1f6032', },
+ bsc: { fromBlock: 37069498, factory: '0x2c2E1eE20C633EAe18239c0BF59cEf1FC44939aC', },
+ blast: { fromBlock: 2304573, factory: '0x60138081198b75aAF15ACA3A17Ec7f5Ffc5D4605', },
}
Object.keys(config).forEach(chain => {
diff --git a/projects/deribit/index.js b/projects/deribit/index.js
index 0cc893762a..eb71c2aab7 100644
--- a/projects/deribit/index.js
+++ b/projects/deribit/index.js
@@ -12,6 +12,11 @@ const config = {
"1MdrdcEzfiJdvs6eVSwUx6bWboPX8if5U3",
"35WHp4Hid61peyH4tuhNunwRj2gtNB41Lo",
"34ZHV8dd6uucEUABUydWpKi6F4qKQntEUf",
+ //added on the 26/06/2024
+ "bc1qzwhw94uldd3c8736lsxrda6t6x56030f8zk8nr",
+ "bc1qrmuxak470z7zch5f3gz05dc6h4ngwqdq4wx80w",
+ "bc1qf6lm99tp5p27hsmyskve236nsv32lnfwt4h8wk",
+ "14HeA1YRUiJGb95HVpVTBuavMUBYGk6y7R",
],
},
ethereum:{
@@ -26,18 +31,36 @@ const config = {
"0xA0F6121319a34f24653fB82aDdC8dD268Af5b9e1",
"0x904cC2B2694FFa78F04708D6F7dE205108213126",
"0x63F41034871535ceE49996Cc47719891Fe03dff9",
+ //added on the 26/06/2024
+ "0x58F56615180A8eeA4c462235D9e215F72484B4A3",
+ "0x1baE874af9f81B8F93315b27F080260Da4702D3a",
+ "0x2563328d58AC7eE9e930E89C29Ce96046a291207",
+ "0x866c9a77d8Ab71d2874703e80cb7aD809b301e8e",
+ "0xCf2027AAB22980820F0767d9f214CDBD2AA2428D"
]
},
solana: {
owners:[
"H8z2yZcrKo7ngiMz3Vsuw823nYo11qdCqs3sJDDjeTdD",
- "A5ANHizfayJUDBSwV5Cm7CNXCj6E6AAda49wzzdYPons"
+ "A5ANHizfayJUDBSwV5Cm7CNXCj6E6AAda49wzzdYPons",
+ //added on the 26/06/2024
+ "BZo9RRbgsWaLMxyaYiJK9D27j2FAVgHrhMJBvAj7GiyG",
+ "DL165xn6SrdupXGA2MW6woz35B3ssVqpYfwS1xAKdyx"
]
},
ethpow: {
owners:[
"0x77021d475E36b3ab1921a0e3A8380f069d3263de",
]
+ },
+ ripple: {
+ owners:[
+ //added on the 26/06/2024
+ "rpFXRE1LPyS48a4LMqyksG2sjDg8wmQD5e",
+ "rE4y6xhfo9QUV2oAxpHtnVkMmGEk632T7R",
+ "rK6enCZ6sMs84wMhTUgLhnPr9eyrTTNA6W",
+ "rKK7VZnnqovrh5Gka1ANartX9Usx2aBAZd",
+ ]
}
}
diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js
new file mode 100644
index 0000000000..9e773382f8
--- /dev/null
+++ b/projects/desyn-farm/index.js
@@ -0,0 +1,28 @@
+const { getLogs } = require('../helper/cache/getLogs')
+
+module.exports = {
+ doublecounted: true,
+ methodology: 'On-chain restaking',
+}
+
+const config = {
+ merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440},
+}
+
+Object.keys(config).forEach(chain => {
+ const {factory, fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs({
+ api,
+ target: factory,
+ eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)',
+ onlyArgs: true,
+ fromBlock,
+ })
+ const pools = logs.map(i=>i.pool)
+ const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools})
+ return api.sumTokens({ ownerTokens: tokens.map((tokens, i) => [tokens, pools[i]])})
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/desyn-farm1/index.js b/projects/desyn-farm1/index.js
new file mode 100644
index 0000000000..13e1629278
--- /dev/null
+++ b/projects/desyn-farm1/index.js
@@ -0,0 +1,28 @@
+const { getLogs } = require('../helper/cache/getLogs')
+
+module.exports = {
+ methodology: 'On-chain restaking',
+}
+
+const config = {
+ btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247},
+ mode: { factory: '0x09Dfee598d5217da799bEAd56206beC0fDB0D17B', fromBlock: 9912410}
+}
+
+Object.keys(config).forEach(chain => {
+ const {factory, fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs({
+ api,
+ target: factory,
+ eventAbi: 'event LOG_NEW_POOL (address indexed caller, address indexed pool)',
+ onlyArgs: true,
+ fromBlock,
+ })
+ const pools = logs.map(i=>i.pool)
+ const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools})
+ return api.sumTokens({ ownerTokens: tokens.map((tokens, i) => [tokens, pools[i]])})
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/desyn/index.js b/projects/desyn/index.js
index a7d43249a7..75f12cba84 100644
--- a/projects/desyn/index.js
+++ b/projects/desyn/index.js
@@ -1,11 +1,22 @@
const { getLogs } = require('../helper/cache/getLogs')
module.exports = {
- methodology: 'RWA STBT is an investment portfolio that focuses on US short-term treasury bond digital assets and operates in a fully decentralized manner.',
+ doublecounted: true,
+ hallmarks: [
+ [1719734400, "Launched on Merlin Chain"],
+ [1718092800, "DeSyn KelpDAO Restaking Fund Launched"],
+ [1713340800, "Restaking Fund Series Launched"],
+ ],
+ methodology: 'Liquid restaking strategy',
}
const config = {
ethereum: { factory: '0x01a38B39BEddCD6bFEedBA14057E053cBF529cD2', fromBlock: 17335174},
+ arbitrum: { factory: '0xdE6b117384452b21F5a643E56952593B88110e78', fromBlock: 175985457},
+ //merlin chain is tracked under a new listing for farm
+ // merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440},
+ //bitlayer chain is tracked under a new listing for farm
+ // btr: { factory: '0x09eFC8C8F08B810F1F76B0c926D6dCeb37409665', fromBlock: 2393247},
}
Object.keys(config).forEach(chain => {
diff --git a/projects/devil-finance/index.js b/projects/devil-finance/index.js
index 627b6ae592..e21ba8637d 100644
--- a/projects/devil-finance/index.js
+++ b/projects/devil-finance/index.js
@@ -16,6 +16,7 @@ module.exports = {
pool2: tvl("nativeLP"),
staking: tvl("native"),
},
+ deadFrom: '2023-01-01',
};
module.exports.fantom = { tvl: () => 0}
\ No newline at end of file
diff --git a/projects/dexfinance-etf/index.js b/projects/dexfinance-etf/index.js
new file mode 100644
index 0000000000..62605fd51e
--- /dev/null
+++ b/projects/dexfinance-etf/index.js
@@ -0,0 +1,43 @@
+const config = {
+ fantom: '0x9b7e30644a9b37eebaa7158129b03f5a3088659d',
+ pulse: '0xac297968c97ef5686c79640960d106f65c307a37',
+ base: '0x714c94b9820d7d73e61510e4c18b91f995a895c1',
+ optimism: '0xd4f1a99212e5be72426bde45abadef66d7d6edf3',
+ manta: '0x714c94b9820d7d73e61510e4c18b91f995a895c1',
+ arbitrum: '0xe31fceaf93667365ce1e9edad3bed4a7dd0fc01a',
+ avax: '0x6b714e6296b8b977e1d5ecb595197649e10a3db1',
+ bsc: '0x3ace08b10b5c08a17d1c46277d65c81249e65f44',
+}
+
+const blackListTokens = [
+ '0x6386704cd6f7a584ea9d23ccca66af7eba5a727e',
+ '0xaa2c47a35c1298795b5271490971ec4874c8e53d',
+ '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af',
+ '0x4117ec0a779448872d3820f37ba2060ae0b7c34b',
+]
+
+Object.keys(config).forEach(chain => {
+ const factory= config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const profitTokens = await api.fetchList({ lengthAbi: 'profitTokensWhitelistCount', itemAbi: 'profitTokensWhitelist', target: factory})
+ const connectors = await api.multiCall({ abi: 'function profitTokenConnector(address) view returns (address)', calls: profitTokens, target: factory})
+ let underlyings = await api.multiCall({ abi: 'address:underlying', calls: connectors})
+ underlyings = underlyings.filter(address => !blackListTokens.includes(address.toLowerCase()))
+ const tokenCounts = await api.multiCall({ abi: 'uint256:tokensCount', calls: underlyings})
+ const owners = []
+ const calls = []
+ for(let i = 0; i < underlyings.length; i++){
+ for(let j = 0; j < tokenCounts[i]; j++){
+ calls.push({
+ target: underlyings[i],
+ params: j
+ })
+ owners.push(underlyings[i])
+ }
+ }
+ const tokens = await api.multiCall({ abi: 'function tokens(uint256) view returns (address)', calls })
+ return api.sumTokens({ tokensAndOwners2: [tokens, owners]})
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/dexfinance-vault/abi.js b/projects/dexfinance-vault/abi.js
new file mode 100644
index 0000000000..079d42ce27
--- /dev/null
+++ b/projects/dexfinance-vault/abi.js
@@ -0,0 +1,25 @@
+exports.abi = {
+ factory: {
+ vaultsLength: "function vaultsCount() view returns (uint256)",
+ vaults: "function vaults(uint256 index) view returns (address)",
+ farmCalculationConnector:
+ "function farmCalculationConnector(address) view returns (address)",
+ },
+ vault: {
+ liquidity: "function liquidity(address) view returns (uint256 liquidity_)",
+ farmsLength: "uint256:farmsCount",
+ farmConnector: "function farmConnector(address) view returns (address)",
+ farms:
+ "function farms(uint256 index) view returns (tuple(address beacon, uint256 percent, bytes data))",
+ },
+ farm: {
+ stakingToken: "function stakingToken() view returns (address)",
+ farm: "address:farm",
+ type: "string:stakingTokenType",
+ tokenId: "uint256:tokenId",
+ stakingTokenLiquidity:
+ "function stakingTokenLiquidity(uint256 tokenId_) view returns (uint256 liquidity_)",
+ stakingTokenData:
+ "function stakingTokenData() view returns ((string stakingTokenType, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, (uint256 sqrtPriceX96LowInit, uint256 sqrtPriceX96UpInit, uint256 sqrtPriceX96LowLimit, uint256 sqrtPriceX96UpLimit, uint256 sqrtPriceX96ApproxPricePercent, uint256 sqrtPriceX96ShiftPercentLow, uint256 sqrtPriceX96ShiftPercentUp, uint256 sqrtPriceX96DefaultShiftPercentLow, uint256 sqrtPriceX96DefaultShiftPercentUp) pricesData, (address tokenIn, address tokenOut)[] swapsToken0ToNative, (address tokenIn, address tokenOut)[] swapsToken1ToNative, (address tokenIn, address tokenOut)[] swapsNativeToToken0, (address tokenIn, address tokenOut)[] swapsNativeToToken1))",
+ }
+};
diff --git a/projects/dexfinance-vault/index.js b/projects/dexfinance-vault/index.js
new file mode 100644
index 0000000000..6132575bf4
--- /dev/null
+++ b/projects/dexfinance-vault/index.js
@@ -0,0 +1,133 @@
+const { sumTokens2, addUniV3LikePosition } = require("../helper/unwrapLPs");
+const { abi } = require("./abi");
+
+const CONFIG = {
+ optimism: {
+ factory: "0xd4f1a99212e5be72426bde45abadef66d7d6edf3",
+ },
+ fantom: {
+ factory: "0x9b7e30644a9b37eebaa7158129b03f5a3088659d",
+ },
+ pulse: {
+ factory: "0xac297968C97EF5686c79640960D106f65C307a37",
+ USDEX_PLUS: "0xaa2c47a35c1298795b5271490971ec4874c8e53d",
+ },
+ base: {
+ factory: "0x714c94b9820d7d73e61510e4c18b91f995a895c1",
+ },
+ arbitrum: {
+ factory: "0xe31fceaf93667365ce1e9edad3bed4a7dd0fc01a",
+ USDEX_PLUS: "0x4117EC0A779448872d3820f37bA2060Ae0B7C34B",
+ gDEX: "0x92a212d9f5eef0b262ac7d84aea64a0d0758b94f"
+ },
+ avax: {
+ factory: "0x6b714e6296b8b977e1d5ecb595197649e10a3db1",
+ },
+ bsc: {
+ factory: "0x3ace08b10b5c08a17d1c46277d65c81249e65f44",
+ },
+ manta: {
+ factory: "0x714C94B9820D7D73e61510e4C18B91F995A895C1",
+ USDEX_PLUS: '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af',
+ },
+};
+
+const getVaults = async (api, factory) => {
+ const vaults = await api.fetchList({ lengthAbi: abi.factory.vaultsLength, itemAbi: abi.factory.vaults, target: factory, });
+ const farmsAll = await api.fetchList({ lengthAbi: abi.vault.farmsLength, itemAbi: abi.vault.farms, targets: vaults, groupedByInput: true })
+ const items = []
+ vaults.map((vault, i) => items.push(farmsAll[i].map((farm) => ({ vault, farm }))))
+ return items.flat()
+};
+
+const getVaultsConnectors = async (api, factory, vaultFarms) => {
+ const connectorsCalls = vaultFarms.map(({ farm, vault }) => ({ params: farm.beacon, target: vault, }));
+ const calculationConnectorCalls = vaultFarms.map(({ farm }) => farm.beacon);
+ const connectors = await api.multiCall({ abi: abi.vault.farmConnector, calls: connectorsCalls })
+ const calculationConnectors = await api.multiCall({ abi: abi.factory.farmCalculationConnector, calls: calculationConnectorCalls, target: factory })
+
+ vaultFarms.forEach((item, i) => {
+ delete item.farm.data
+ item.connector = connectors[i]
+ item.calculationConnector = calculationConnectors[i]
+ })
+}
+
+const getVaultsDatas = async (api, vaultFarms) => {
+ const calls = vaultFarms.map(({ connector }) => connector)
+ const liquidityCalls = vaultFarms.map(({ calculationConnector, connector }) => ({ target: calculationConnector, params: [connector] }))
+
+ const [types, stakingTokens, liquidities] =
+ await Promise.all([
+ api.multiCall({ calls, abi: abi.farm.type }),
+ api.multiCall({ calls, abi: abi.farm.stakingToken }),
+ api.multiCall({ calls: liquidityCalls, abi: abi.vault.liquidity }),
+ ]);
+
+ vaultFarms.forEach((item, i) => {
+ item.type = types[i]
+ item.stakingToken = stakingTokens[i]
+ item.liquidity = liquidities[i]
+ })
+};
+
+const groupBy = (array, keyFn) => {
+ return array.reduce((acc, item) => {
+ const key = keyFn(item);
+ if (!acc[key]) {
+ acc[key] = [];
+ }
+ acc[key].push(item);
+ return acc;
+ }, {});
+};
+
+const lpv2Balances = async (api, farms) => {
+ farms.forEach(({ stakingToken, liquidity }) => {
+ api.add(stakingToken, liquidity);
+ });
+};
+
+async function addERC721Data(api, vaultFarms) {
+ const positionIds = await api.multiCall({ abi: abi.farm.tokenId, calls: vaultFarms.map(i => i.connector) })
+ const nftPositionMapping = {}
+ vaultFarms.forEach((item, i) => {
+ if (!+positionIds[i])
+ return;
+
+ const nft = item.stakingToken.toLowerCase()
+ if (!nftPositionMapping[nft]) nftPositionMapping[nft] = []
+ nftPositionMapping[nft].push(positionIds[i])
+ })
+ for (const [nftAddress, positionIds] of Object.entries(nftPositionMapping))
+ await sumTokens2({ api, uniV3ExtraConfig: { nftAddress, positionIds, } })
+}
+
+const tvl = async (api) => {
+ const { factory, USDEX_PLUS, gDEX } = CONFIG[api.chain];
+ const vaultFarms = await getVaults(api, factory);
+ await getVaultsConnectors(api, factory, vaultFarms);
+ await getVaultsDatas(api, vaultFarms);
+ const sortedFarms = groupBy(vaultFarms, ({ type }) => `${type}`);
+
+ const lpv2Farms = Object.keys(sortedFarms)
+ .filter((key) => !key.includes("ERC721"))
+ .flatMap((key) => sortedFarms[key]);
+
+ const lpv3Farms = Object.keys(sortedFarms)
+ .filter((key) => key.includes("ERC721"))
+ .flatMap((key) => sortedFarms[key]);
+
+ await Promise.all([
+ lpv2Balances(api, lpv2Farms),
+ addERC721Data(api, lpv3Farms)
+ ])
+
+ await sumTokens2({ api, resolveLP: true });
+ if (USDEX_PLUS) api.removeTokenBalance(USDEX_PLUS);
+ if (gDEX) api.removeTokenBalance(gDEX);
+};
+
+Object.keys(CONFIG).forEach((chain) => {
+ module.exports[chain] = { tvl, };
+})
\ No newline at end of file
diff --git a/projects/dinari/index.js b/projects/dinari/index.js
index 76fbbd368e..829e3dbfcf 100644
--- a/projects/dinari/index.js
+++ b/projects/dinari/index.js
@@ -1,22 +1,43 @@
const config = {
arbitrum: {
- "AAPL.d": { oracle: "0x8d0CC5f38f9E802475f2CFf4F9fc7000C2E1557c", token: '0xCe38e140fC3982a6bCEbc37b040913EF2Cd6C5a7' },
- "AMZN.d": { oracle: "0xd6a77691f071E98Df7217BED98f38ae6d2313EBA", token: '0x5a8A18673aDAA0Cd1101Eb4738C05cc6967b860f' },
- "GOOGL.d": { oracle: "0x1D1a83331e9D255EB1Aaf75026B60dFD00A252ba", token: '0x9bd7A08cD17d10E02F596Aa760dfE397C57668b4' },
- "META.d": { oracle: "0xcd1bd86fDc33080DCF1b5715B6FCe04eC6F85845", token: '0xa40c0975607BDbF7B868755E352570454b5B2e48' },
- "MSFT.d": { oracle: "0xDde33fb9F21739602806580bdd73BAd831DcA867", token: '0x20f11c1aBca831E235B15A4714b544Bb968f8CDF' },
- "TSLA.d": { oracle: "0x3609baAa0a9b1f0FE4d6CC01884585d0e191C3E3", token: '0x2888c0aC959484e53bBC6CdaBf2b8b39486225C6' },
- "SPY.d": { oracle: "0x46306F3795342117721D8DEd50fbcF6DF2b3cc10", token: '0xF4BD09B048248876E39Fcf2e0CDF1aee1240a9D2' },
- // "COIN.d": { oracle: "", token: '0x46b979440AC257151EE5a5bC9597B76386907FA1' },
+ factory: "0xB4Ca72eA4d072C779254269FD56093D3ADf603b8",
+ usdplus: "0xfc90518D5136585ba45e34ED5E1D108BD3950CFa"
+ },
+ ethereum: {
+ factory: "0x60B5E7eEcb2AEE0382db86491b8cFfA39347c747",
+ usdplus: "0x98C6616F1CC0D3E938A16200830DD55663dd7DD3"
+ },
+ blast: {
+ factory: "0x6Aa1BDa7e764BC62589E64F371A4022B80B3c72a",
+ },
+ kinto: {
+ factory: "0xE4Daa69e99F48AD0C4D4843deF4447253248A906",
+ usdplus: "0x6F086dB0f6A621a915bC90295175065c9e5d9b8c"
}
}
-Object.keys(config).forEach(chain => {
- const tokens = Object.values(config[chain]).map(v => v.token)
+async function getTokens(api) {
+ const abi = config[api.chain].getTokensAbi ?? "function getDShares() external view returns (address[] memory, address[] memory)"
+ return (await api.call({
+ target: config[api.chain].factory,
+ abi
+ }))[0];
+}
+
+Object.keys(config).forEach( chain => {
module.exports[chain] = {
tvl: async (api) => {
- const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: tokens})
+ // get dShare tokens
+ const tokens = await getTokens(api, chain)
+ const bals = await api.multiCall({ chain: chain, abi: 'erc20:totalSupply', calls: tokens})
+ // add USD+
+ const usdplus = config[chain].usdplus
+ if (usdplus) {
+ const usdplusBal = await api.call({chain: chain, target: usdplus, abi: 'erc20:totalSupply'})
+ tokens.push(usdplus)
+ bals.push(usdplusBal)
+ }
api.add(tokens, bals)
}
}
-})
\ No newline at end of file
+})
diff --git a/projects/dinero/index.js b/projects/dinero/index.js
index e5f80edc31..31c114114f 100644
--- a/projects/dinero/index.js
+++ b/projects/dinero/index.js
@@ -1,13 +1,15 @@
const { nullAddress } = require("../helper/unwrapLPs");
+const { sumERC4626VaultsExport } = require("../helper/erc4626");
module.exports = {
ethereum: {
tvl: async (api) => {
- const totalSupply = await api.call({ target: '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6', abi: 'uint256:totalSupply'});
-
+ const totalSupply = await api.call({ target: '0x04C154b66CB340F3Ae24111CC767e0184Ed00Cc6', abi: 'uint256:totalSupply' });
+
return {
[nullAddress]: totalSupply
};
- }
+ },
+ staking: sumERC4626VaultsExport({ vaults: ['0x55769490c825CCb09b2A6Ae955203FaBF04857fd'], isOG4626: true, })
}
};
diff --git a/projects/dinopool/index.js b/projects/dinopool/index.js
index 86bf08fec4..0a3d344a34 100644
--- a/projects/dinopool/index.js
+++ b/projects/dinopool/index.js
@@ -15,3 +15,5 @@ const lps = [
module.exports = {
...tombTvl(bond, share, rewardPool, boardroom, lps, "cronos", undefined, false, lps[1])
};
+
+module.exports.deadFrom = "2023-05-30"
\ No newline at end of file
diff --git a/projects/divvy-bet/index.js b/projects/divvy-bet/index.js
new file mode 100644
index 0000000000..3f56141cc4
--- /dev/null
+++ b/projects/divvy-bet/index.js
@@ -0,0 +1,48 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { Program } = require("@project-serum/anchor");
+const { PublicKey } = require("@solana/web3.js");
+const { getProvider, sumTokens2 } = require("../helper/solana");
+
+async function tvl() {
+ function findHouseAuthorityAddress(houseKey, programId) {
+ return PublicKey.findProgramAddressSync(
+ [Buffer.from("House Authority"), houseKey.toBuffer()],
+ programId
+ )[0];
+ }
+
+ const NATIVE_MINT = ADDRESSES.solana.SOL;
+ const DIVVY_ADMIN = "AHf1MX99d31ebLfAydVPe2vVdgzZGuUaW972znWPNzZY";
+
+ const programId = new PublicKey("dvyFwAPniptQNb1ey4eM12L8iLHrzdiDsPPDndd6xAR");
+ const provider = getProvider();
+ const idl = await Program.fetchIdl(programId, provider);
+ const program = new Program(idl, programId, provider);
+ const houses = await program.account.house.all([
+ {
+ memcmp: {
+ offset: 8,
+ bytes: DIVVY_ADMIN, // houses governed by Divvy's multisig
+ },
+ },
+ ]);
+ const tokensAndOwners = houses
+ .filter((house) => house.account.currency.toBase58() !== NATIVE_MINT)
+ .map((house) => {
+ const owner = findHouseAuthorityAddress(house.publicKey, programId);
+ return [house.account.currency, owner];
+ });
+ const solOwners = houses
+ .filter((house) => house.account.currency.toBase58() === NATIVE_MINT)
+ .map((house) => {
+ return findHouseAuthorityAddress(house.publicKey, programId);
+ });
+ return sumTokens2({ tokensAndOwners, solOwners });
+}
+
+module.exports = {
+ timetravel: false,
+ solana: {
+ tvl,
+ },
+};
diff --git a/projects/dnadollar/index.js b/projects/dnadollar/index.js
index fa560a6995..39a44ab4ef 100644
--- a/projects/dnadollar/index.js
+++ b/projects/dnadollar/index.js
@@ -1,105 +1,3 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require("@defillama/sdk");
-const abi = require("./abi.json");
-const { unwrapUniswapLPs } = require("../helper/unwrapLPs");
-const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs");
-
-const treasuryContract = "0x1420287565FD5Ebec8FbD720c17Cd911600449d3";
-
-const FundDAO = "0x3e1Aa19FA59c9B474f6d2F37976a84DeD64af4Bf";
-const USDT = ADDRESSES.cronos.USDT;
-const USDC = ADDRESSES.cronos.USDC;
-const USDC_DSHARE_meerkatLP = "0xFe0F0d50175789C1F69B41dB797cc9ABd8Ab0120";
-
-const DShareRewardPool = "0x1A4bb8E03C35e2B672A0fcE18cab920aa023d7FC";
-// node test.js projects/dnadollar/index.js
-const stakingContracts = [
- "0xed94536A27922e2BD0eE661abF5fB030228d9D72",
- FundDAO,
- DShareRewardPool,
-];
-const DSHARE = "0x0e98dc462ff438b802fad0d68ff7f111a0674bb5";
-const DNA = "0xcc57f84637b441127f2f74905b9d99821b47b20c";
-
-async function Staking(timestamp, chainBlocks) {
- const balances = {};
-
- await sumTokensAndLPsSharedOwners(
- balances,
- [
- [DNA, false],
- [DSHARE, false],
- ],
- stakingContracts,
- chainBlocks["cronos"],
- "cronos",
- (addr) => `cronos:${addr}`
- );
-
- return balances;
-}
-
-const pool2 = async (chainBlocks) => {
- const balances = {};
-
- const lpPositions = [];
- for (let i = 0; i < 5; i++) {
- const token = (
- await sdk.api.abi.call({
- abi: abi.poolInfo,
- target: DShareRewardPool,
- params: i,
- chain: "cronos",
- block: chainBlocks["cronos"],
- })
- ).output.token;
-
- const getTokenBalance = (
- await sdk.api.abi.call({
- abi: 'erc20:balanceOf',
- target: token,
- params: DShareRewardPool,
- chain: "cronos",
- block: chainBlocks["cronos"],
- })
- ).output;
-
- lpPositions.push({
- token: token,
- balance: getTokenBalance,
- });
- }
-
- await unwrapUniswapLPs(
- balances,
- lpPositions,
- chainBlocks["cronos"],
- "cronos",
- (addr) => `cronos:${addr}`
- );
-
- return balances;
-};
-
-async function cronosTvl(timestamp, chainBlocks) {
- const balances = {};
-
- await sumTokensAndLPsSharedOwners(
- balances,
- [
- [USDT, false],
- [USDC, false],
- [USDC_DSHARE_meerkatLP, true],
- ],
- [FundDAO],
- chainBlocks["cronos"],
- "cronos",
- (addr) => `cronos:${addr}`
- );
-
- return balances;
-}
-
module.exports = {
misrepresentedTokens: true,
cronos: {
diff --git a/projects/dodo/index.js b/projects/dodo/index.js
index 518429908e..f2fd2fac38 100644
--- a/projects/dodo/index.js
+++ b/projects/dodo/index.js
@@ -1,92 +1,6 @@
-const { request, } = require("graphql-request");
-const { getBlock } = require('../helper/http')
-const sdk = require('@defillama/sdk')
const { getLogs } = require('../helper/cache/getLogs')
const ADDRESSES = require('../helper/coreAssets.json')
-const graphEndpoints = {
- // ethereum: "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2",
- // "bsc": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-bsc",
- // //"heco": "https://q.hg.network/subgraphs/name/dodoex/heco",
- // "polygon": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-polygon",
- // "arbitrum": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-arbitrum",
- // "aurora": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-aurora",
- // "avax": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-avax",
- // "optimism": "https://api.thegraph.com/subgraphs/name/dodoex/dodoex-v2-optimism",
- // "base": "https://api.studio.thegraph.com/query/2860/dodoex_v2_base/v0.0.5",
- // "linea": "https://api.dodoex.io/graphql?chainId=59144&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof",
- // "scroll": "https://api.dodoex.io/graphql?chain=src&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof", // ChainId mapping error, so using chain
- // "manta": "https://api.dodoex.io/graphql?chainId=169&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof",
- // "mantle": "https://api.dodoex.io/graphql?chainId=5000&schemaName=dodoex&apikey=graphqldefiLlamadodoYzj5giof"
-}
-const graphQuery = `query get_pairs($lastId: ID, $block: Int!) {
- pairs(
- first: 1000
- block: {number: $block}
- where: {and: [{id_gt: $lastId}, {or: [{baseReserve_gt: 0}, {quoteReserve_gt: 0}]}]}
- ) {
- id
- baseReserve
- quoteReserve
- baseToken {
- id
- symbol
- usdPrice
- decimals
- }
- quoteToken {
- id
- symbol
- usdPrice
- decimals
- }
- }
-}`
-
-Object.keys(graphEndpoints).forEach(chain => {
- module.exports[chain] = {
- tvl: async (ts, _, chainBlocks) => {
-
- const block = await getBlock(ts, chain, chainBlocks)
- let allPairs = []
- let lastId = ""
- let response;
- do {
- response = await request(
- graphEndpoints[chain],
- graphQuery,
- { lastId, block: block - 500, }
- );
- allPairs = allPairs.concat(response.pairs)
- lastId = response.pairs[response.pairs.length - 1].id
- } while (response.pairs.length >= 1000);
-
- const balances = {}
- const blacklist = [
- '0xd79d32a4722129a4d9b90d52d44bf5e91bed430c',
- '0xdb1e780db819333ea79c9744cc66c89fbf326ce8', // this token is destroyed
- '0xa88c5693c9c2549a75acd2b44f052f6a5568e918', // this token is destroyed
- '0x738076a6cb6c30d906bcb2e9ba0e0d9a58b3292e', // SRSB is absuredly priced
- '0x95e7c70b58790a1cbd377bc403cd7e9be7e0afb1', // YSL is absuredly priced
- '0x2b1e9ded77ff8ecd81f71ffc5751622e6f1291c3', // error querying balance
- '0x272c2CF847A49215A3A1D4bFf8760E503A06f880', // abnb LP mispriced
- '0xd4ca5c2aff1eefb0bea9e9eab16f88db2990c183', // XRPC
- ].map(i => i.toLowerCase())
-
- allPairs.forEach(pair => {
- if (pair.id.includes('-'))
- return null
- if (!blacklist.includes(pair.baseToken.id.toLowerCase()) && +pair.baseReserve > 1 && +pair.baseToken.usdPrice > 0)
- sdk.util.sumSingleBalance(balances, chain + ':' + pair.baseToken.id, pair.baseReserve * (10 ** pair.baseToken.decimals))
- if (!blacklist.includes(pair.quoteToken.id.toLowerCase()) && +pair.quoteReserve > 1 && +pair.quoteToken.usdPrice > 0)
- sdk.util.sumSingleBalance(balances, chain + ':' + pair.quoteToken.id, pair.quoteReserve * (10 ** pair.quoteToken.decimals))
- })
-
- return balances
- }
- }
-})
-
const config = {
ethereum: { dvmFactory: '0x72d220cE168C4f361dD4deE5D826a01AD8598f6C', dodoBirthFactory: '0x3a97247df274a17c59a3bd12735ea3fcdfb49950', fromBlock: 10613640, dspFactory: '0x6fddb76c93299d985f4d3fc7ac468f9a168577a4', dppFactory: ['0x5336ede8f971339f6c0e304c66ba16f1296a2fbe', '0xb5dc5e183c2acf02ab879a8569ab4edaf147d537', '0x6b4fa0bc61eddc928e0df9c7f01e407bfcd3e5ef'] },
arbitrum: { dvmFactory: '0xDa4c4411c55B0785e501332354A036c04833B72b', fromBlock: 226578, dspFactory: '0xC8fE2440744dcd733246a4dB14093664DEFD5A53', dodoBirthFactory: '0xbcc3401e16c25eaf4d3fed632ce3288503883b1f', dppFactory: ['0xDdB13e6dd168E1a68DC2285Cb212078ae10394A9', '0xa6cf3d163358af376ec5e8b7cc5e102a05fde63d'] },
diff --git a/projects/dogsofelon/index.js b/projects/dogsofelon/index.js
index 31db5325c5..310e4245d4 100644
--- a/projects/dogsofelon/index.js
+++ b/projects/dogsofelon/index.js
@@ -21,3 +21,6 @@ module.exports = {
},
methodology: "Counts liquidty on the staking and pool2 only",
};
+
+
+module.exports.deadFrom = "2023-01-19"
\ No newline at end of file
diff --git a/projects/dopex-clamm/index.js b/projects/dopex-clamm/index.js
index 1ef388f526..2c0ee7ac86 100644
--- a/projects/dopex-clamm/index.js
+++ b/projects/dopex-clamm/index.js
@@ -1,94 +1,89 @@
-const { blockQuery } = require("../helper/http");
-const wildCreditABI = require('../wildcredit/abi.json');
-const { getLogs } = require('../helper/cache/getLogs')
-const DopexV2ClammFeeStrategy = '0xC808AcB06077174333b31Ae123C33c6559730035'
-
-const query = (skip = 0, limit = 1000) => `query ($block: Int) {
- strikes(
- block: {number: $block}
- first: ${limit}
- skip: ${skip}
- where: {totalLiquidity_gt: 100}
- orderBy: totalLiquidity
- orderDirection: desc
- ) {
- pool
- token0 { id }
- token1 { id }
- tickLower
- tickUpper
- totalLiquidity
+const { gql, request } = require('graphql-request');
+
+const endpoint = 'https://api.0xgraph.xyz/subgraphs/name/dopex-v2-clamm-public';
+const abi = "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)"
+
+const query = gql`
+ query strikes($limit: Int!, $skip: Int!) {
+ strikes(
+ first: $limit
+ skip: $skip
+ where: { totalLiquidity_gt: "100" }
+ orderBy: totalLiquidity
+ orderDirection: desc
+ ) {
+ pool
+ token0 {id}
+ token1 {id}
+ tickLower
+ tickUpper
+ totalLiquidity
+ }
+ }
+`;
+
+async function fetchStrikes(limit, skip, allData = []) {
+ const variables = { limit, skip };
+ const { strikes } = await request(endpoint, query, variables);
+ allData.push(...strikes);
+
+ if (strikes.length === limit) {
+ return fetchStrikes(limit, skip + limit, allData);
+ }
+
+ return allData;
+}
+
+function addV3PositionBalances(strike, sqrtPricesMap) {
+ const tickToPrice = (tick) => 1.0001 ** tick
+ const token0 = strike.token0.id
+ const token1 = strike.token1.id
+ const liquidity = strike.totalLiquidity
+ const bottomTick = +strike.tickLower
+ const topTick = +strike.tickUpper
+ const tick = +sqrtPricesMap[strike.pool.toLowerCase()].tick
+ const sa = tickToPrice(bottomTick / 2)
+ const sb = tickToPrice(topTick / 2)
+
+ let amount0 = 0
+ let amount1 = 0
+
+ if (tick < bottomTick) {
+ amount0 = liquidity * (sb - sa) / (sa * sb)
+ } else if (tick < topTick) {
+ const price = tickToPrice(tick)
+ const sp = price ** 0.5
+
+ amount0 = liquidity * (sb - sp) / (sp * sb)
+ amount1 = liquidity * (sp - sa)
+ } else {
+ amount1 = liquidity * (sb - sa)
}
-}`
+
+ return { token0, amount0, token1, amount1 }
+}
async function tvl(api) {
- const allData = []
- let hasMore = true
- let skip = 0
- let limit = 1000
- do {
- const { strikes } = await blockQuery("http://api.0xgraph.xyz/subgraphs/name/dopex-v2-clamm-public", query(skip, limit), { api })
- skip += limit
- allData.push(...strikes)
- hasMore = strikes.length === limit
- } while (hasMore)
+ const limit = 1000;
+ const allData = await fetchStrikes(limit, 0);
let pools = allData.map(strike => strike.pool.toLowerCase())
pools = [...new Set(pools)]
- const sqrtPrices = await api.multiCall({ calls: pools, abi: wildCreditABI.slot0, })
+ const sqrtPrices = await api.multiCall({ calls: pools, abi })
const sqrtPricesMap = sqrtPrices.reduce((acc, item, i) => {
return { ...acc, [pools[i]]: item, }
}, {});
- allData.map(addV3PositionBalances)
-
- // const logs = await getLogs({
- // api,
- // target: DopexV2ClammFeeStrategy,
- // eventAbi: 'event OptionMarketRegistered (address optionMarket)',
- // onlyArgs: true,
- // fromBlock: 149751550,
- // })
- // const markets = logs.map(log => log.optionMarket)
- // const callAssets = await api.multiCall({ abi: 'address:callAsset', calls: markets })
- // const putAssets = await api.multiCall({ abi: 'address:putAsset', calls: markets })
- // const ownerTokens = markets.map((v, i) => [[callAssets[i], putAssets[i]], v])
- // return api.sumTokens({ ownerTokens})
-
- return api.getBalances()
-
-
- function addV3PositionBalances(strike) {
- const tickToPrice = (tick) => 1.0001 ** tick
-
- const token0 = strike.token0.id
- const token1 = strike.token1.id
- const liquidity = strike.totalLiquidity
- const bottomTick = +strike.tickLower
- const topTick = +strike.tickUpper
- const tick = +sqrtPricesMap[strike.pool.toLowerCase()].tick
- const sa = tickToPrice(bottomTick / 2)
- const sb = tickToPrice(topTick / 2)
-
- let amount0 = 0
- let amount1 = 0
-
- if (tick < bottomTick) {
- amount0 = liquidity * (sb - sa) / (sa * sb)
- } else if (tick < topTick) {
- const price = tickToPrice(tick)
- const sp = price ** 0.5
-
- amount0 = liquidity * (sb - sp) / (sp * sb)
- amount1 = liquidity * (sp - sa)
- } else {
- amount1 = liquidity * (sb - sa)
- }
- api.add(token0, amount0)
- api.add(token1, amount1)
- }
+ allData.forEach((strike) => {
+ const { token0, amount0, token1, amount1 } = addV3PositionBalances(strike, sqrtPricesMap);
+ api.add(token0, amount0);
+ api.add(token1, amount1);
+ });
}
+
module.exports = {
doublecounted: true, // tokens are stored in UNI-V3 pools
arbitrum: { tvl, },
};
+
+
diff --git a/projects/dorian/index.js b/projects/dorian/index.js
new file mode 100644
index 0000000000..bea9b6756b
--- /dev/null
+++ b/projects/dorian/index.js
@@ -0,0 +1,18 @@
+const { aaveV2Export } = require("../helper/aave");
+const { staking } = require("../helper/staking");
+const methodologies = require("../helper/methodologies");
+
+const LPConfiguratorContract = "0x29604bF5D09bcb714D13549f98CC4Bb49c2Ff672";
+const StakingContract = "0x3C57d20A70d4D34331d442Cd634B0ccAF6Ad89A4";
+const TokenContract = "0x6191F90724cD0aa791B7476e804ae00146618Ab6";
+
+module.exports = {
+ core: {
+ ...aaveV2Export(LPConfiguratorContract, {
+ fromBlock: 15251455,
+ }),
+ staking: staking(StakingContract, TokenContract),
+ },
+};
+
+module.exports.methodology = methodologies.lendingMarket;
diff --git a/projects/doubler/index.js b/projects/doubler/index.js
new file mode 100644
index 0000000000..4ecc77fbf9
--- /dev/null
+++ b/projects/doubler/index.js
@@ -0,0 +1,17 @@
+const WETH_CONTRACT = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1';
+const DOUBLER_CONTRACT = '0x56386f04111057a5D8DF8d719827038B716333F0';
+
+async function tvl(api) {
+ const collateralBalance = await api.call({
+ abi: 'erc20:balanceOf',
+ target: WETH_CONTRACT,
+ params: [DOUBLER_CONTRACT],
+ });
+ api.add(WETH_CONTRACT, collateralBalance)
+}
+
+module.exports = {
+ arbitrum: {
+ tvl,
+ }
+};
\ No newline at end of file
diff --git a/projects/drachma-exchange/index.js b/projects/drachma-exchange/index.js
index 13ba76064c..ff19803bde 100644
--- a/projects/drachma-exchange/index.js
+++ b/projects/drachma-exchange/index.js
@@ -7,4 +7,5 @@ module.exports = {
solana: {
tvl: () => 0
},
+ deadFrom: 1660392000,
};
diff --git a/projects/dradex/index.js b/projects/dradex/index.js
index c528127ae7..5e9553fd8e 100644
--- a/projects/dradex/index.js
+++ b/projects/dradex/index.js
@@ -7,7 +7,7 @@ module.exports = {
},
}
-async function tvl(api) {
+async function tvl() {
const provider = getProvider()
const programId = 'dp2waEWSBy5yKmq65ergoU3G6qRLmqa6K7We4rZSKph'
const idl = await Program.fetchIdl(programId, provider)
diff --git a/projects/dragon/index.js b/projects/dragon/index.js
new file mode 100644
index 0000000000..366d1e7f19
--- /dev/null
+++ b/projects/dragon/index.js
@@ -0,0 +1,13 @@
+const { staking } = require("../helper/unknownTokens")
+
+const ETH_DRAGON_UNIV2 = "0xd53881caee96d3a94fd0e2eb027a05fd44d8c470";
+const DRAGON = "0x528757e34a5617aa3aabe0593225fe33669e921c";
+
+module.exports = {
+ misrepresentedTokens: true,
+ base: {
+ staking: staking({ owner: '0xbb595F34190c6eA1adD1C78F6d12DF181542763c', tokens: [DRAGON], lps: [ETH_DRAGON_UNIV2], useDefaultCoreAssets: true, chain: 'ethereum' }),
+ pool2: staking({ owner: '0x5F020174baEe486d88bea279195a0A3bCD40A41E', tokens: [ETH_DRAGON_UNIV2], lps: [ETH_DRAGON_UNIV2], useDefaultCoreAssets: true, chain: 'ethereum' }),
+ tvl: () => ({}),
+ },
+}
\ No newline at end of file
diff --git a/projects/dragonswap-sei/index.js b/projects/dragonswap-sei/index.js
new file mode 100644
index 0000000000..a26d9a7cac
--- /dev/null
+++ b/projects/dragonswap-sei/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require("../helper/unknownTokens");
+
+module.exports = uniTvlExport('sei', '0x71f6b49ae1558357bbb5a6074f1143c46cbca03d')
diff --git a/projects/drift.js b/projects/drift.js
index 1f56043231..702364a68c 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/dsu-money/index.js b/projects/dsu-money/index.js
index cb047b6c10..9f67265778 100644
--- a/projects/dsu-money/index.js
+++ b/projects/dsu-money/index.js
@@ -12,6 +12,7 @@ module.exports = {
arbitrum: {
tvl: sumTokensExport({ tokensAndOwners: [
[ADDRESSES.arbitrum.USDC, '0x0d49c416103cbd276d9c3cd96710db264e3a0c27'],
+ [ADDRESSES.arbitrum.USDC_CIRCLE, '0x0d49c416103cbd276d9c3cd96710db264e3a0c27'],
]})
}
}
diff --git a/projects/dtx-dex/index.js b/projects/dtx-dex/index.js
new file mode 100644
index 0000000000..a9afb34a4b
--- /dev/null
+++ b/projects/dtx-dex/index.js
@@ -0,0 +1,4 @@
+const { uniTvlExports } = require('../helper/unknownTokens')
+module.exports = uniTvlExports({
+ taiko: '0x2EA9051d5a48eA2350b26306f2b959D262cf67e1'
+})
diff --git a/projects/dtx/index.js b/projects/dtx/index.js
index c2fcfa9561..9f72076e0a 100644
--- a/projects/dtx/index.js
+++ b/projects/dtx/index.js
@@ -1,31 +1,55 @@
const { sumERC4626VaultsExport } = require("../helper/erc4626")
-const sdk = require("@defillama/sdk")
const { sumTokensExport } = require("../helper/unwrapLPs")
-const ADDRESSES = require("../helper/coreAssets.json")
-
-const vaultTvl = sumERC4626VaultsExport({
- vaults: [
- "0x56e0f6DF03883611C9762e78d4091E39aD9c420E",
- "0x3D4621fa5ff784dfB2fcDFd5B293224167F239db",
- "0xe97D34E531E1b299047A94Fc6854289830362d8f",
- "0xBa95FCe6c2683C29bD963dd201CA8ee8f3605801",
- "0x037A168876d3027b1384FD1752fEAa52407726dB",
- "0x3031F6c8958Cf093377c11b3871BD23AEA5e5865",
- "0x802B1f8e092AC4469B30C7560266F9a6f8CA450F",
- ],
- isOG4626: true,
-})
-const otherTvl = sumTokensExport({
- tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.ezETH],
- owners: [
- "0x9AdF2b330697C6816176491E1fd5503BB746d1d8",
- "0x0E5b7DDbF37d92B21512Ae5A6CE66aEfA7A7828F",
- ],
-})
+const sdk = require("@defillama/sdk")
+const ADDRESSES = require("../helper/coreAssets.json")
-module.exports = {
+const config = {
blast: {
- tvl: sdk.util.sumChainTvls([vaultTvl, otherTvl]),
+ vaults: [
+ "0x56e0f6DF03883611C9762e78d4091E39aD9c420E",
+ "0x3D4621fa5ff784dfB2fcDFd5B293224167F239db",
+ "0xe97D34E531E1b299047A94Fc6854289830362d8f",
+ "0xBa95FCe6c2683C29bD963dd201CA8ee8f3605801",
+ "0x037A168876d3027b1384FD1752fEAa52407726dB",
+ "0x3031F6c8958Cf093377c11b3871BD23AEA5e5865",
+ "0x802B1f8e092AC4469B30C7560266F9a6f8CA450F",
+ ],
+ tokenConfig: {
+ tokens: [
+ ADDRESSES.blast.USDB,
+ ADDRESSES.blast.WETH,
+ ADDRESSES.blast.ezETH,
+ ],
+ owners: [
+ "0x9AdF2b330697C6816176491E1fd5503BB746d1d8",
+ "0x0E5b7DDbF37d92B21512Ae5A6CE66aEfA7A7828F",
+ ],
+ },
+ },
+ taiko: {
+ vaults: [
+ "0xdA6a745740Bbdbe5F588b79FEe57f2e10ad4Da11",
+ "0xE3e6818bbC193D454f38772D34FA4cf8C19684d5",
+ ],
+ tokenConfig: {
+ tokens: [ADDRESSES.taiko.USDC, ADDRESSES.taiko.WETH],
+ owners: [
+ "0xc0ab776604059D10880dbD219758FF7B82997cc0",
+ "0xB00231B308B01Dbb90f16F966F62d86fBc78c450",
+ ],
+ },
},
}
+
+Object.keys(config).forEach((chain) => {
+ const { vaults, tokenConfig, factory } = config[chain]
+ const vaultTvl = sumERC4626VaultsExport({ vaults, isOG4626: true })
+ const otherTvl = sumTokensExport(tokenConfig)
+
+ let tvlCalculators = [vaultTvl, otherTvl]
+
+ module.exports[chain] = {
+ tvl: sdk.util.sumChainTvls(tvlCalculators),
+ }
+})
diff --git a/projects/ducata/index.js b/projects/ducata/index.js
new file mode 100644
index 0000000000..47b8fe04f3
--- /dev/null
+++ b/projects/ducata/index.js
@@ -0,0 +1,11 @@
+const { onChainTvl } = require('../helper/balancer')
+
+const vault = "0x25898DEe0634106C2FcBB51B3DB5b14aA1c238a4";
+const launchBlock = 230182440;
+
+module.exports = {
+ methodology: 'TVL counts the external assets deposited in the vaults',
+ arbitrum: {
+ tvl: onChainTvl(vault, launchBlock),
+ }
+ };
\ No newline at end of file
diff --git a/projects/duckgang/index.js b/projects/duckgang/index.js
new file mode 100644
index 0000000000..d7d52600ee
--- /dev/null
+++ b/projects/duckgang/index.js
@@ -0,0 +1,17 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
+
+module.exports = {
+ methodology: 'SEI in vaults',
+ sei: {
+ tvl: sumTokensExport({ owners:
+ [
+ "0x325a0E5C84B4d961B19161956f57Ae8bA5Bb3c26", //No lock-up
+ "0x4F636e75B0b56DF397c8a7E47041e1E6b9738a4e", // 30 days
+ "0xE4c779eDD8FE0e232d460273945b6b7A8c097EA2", // 60 days
+ "0x3D75916B2d8279282C5e25A24fe2Ed57111C22ed", // 90 days
+ ], tokens: [
+ nullAddress
+ ]}),
+ }
+};
\ No newline at end of file
diff --git a/projects/dunes/index.js b/projects/dunes/index.js
new file mode 100644
index 0000000000..628a2e924d
--- /dev/null
+++ b/projects/dunes/index.js
@@ -0,0 +1,16 @@
+const DETH_DEPOSIT_POOL = "0x8a1229eDB53f55Bb09D472aFc95D12154590108E";
+const DUSD_DEPOSIT_POOL = "0x634598473B91a6870c1DB151142db0b61C5de8CC";
+
+async function tvl(api) {
+ const res = await api.multiCall({ abi: 'function getTotalDeposits() external view returns (address[], uint256[])', calls: [DETH_DEPOSIT_POOL, DUSD_DEPOSIT_POOL] })
+ res.forEach(i => api.add(...i))
+}
+
+module.exports = {
+ doublecounted: true,
+ methodology:
+ "Deposited assets (LSTs, LRTs, stables, Pendle tokens, Karak tokens, etc.) in deposit pools",
+ ethereum: {
+ tvl,
+ },
+};
\ No newline at end of file
diff --git a/projects/dusa/index.js b/projects/dusa/index.js
new file mode 100644
index 0000000000..8729b65d47
--- /dev/null
+++ b/projects/dusa/index.js
@@ -0,0 +1,33 @@
+const { queryKey, u8ArrayToString, getTokenBalances, } = require('../helper/chain/massa.js');
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+const factoryAddress = 'AS1rahehbQkvtynTomfoeLmwRgymJYgktGv5xd1jybRtiJMdu8XX'
+
+const getPairAddress = async (factoryAddress) => {
+ const transform = val => {
+ let poolAddresses = u8ArrayToString(val)
+ if (poolAddresses.startsWith(":"))
+ poolAddresses = poolAddresses.substring(1);
+
+ const pools = poolAddresses.split(":");
+ return pools
+ }
+ return (await queryKey([factoryAddress], "ALL_PAIRS", transform))[0]
+}
+
+async function tvl(api) {
+ const pools = await getPairAddress(factoryAddress)
+ const tokenXs = await queryKey(pools, "TOKEN_X")
+ const tokenYs = await queryKey(pools, "TOKEN_Y")
+ const tokenXBalances = await getTokenBalances(tokenXs, pools)
+ const tokenYBalances = await getTokenBalances(tokenYs, pools)
+ api.add(tokenXs, tokenXBalances)
+ api.add(tokenYs, tokenYBalances)
+ return sumTokens2({ api })
+}
+
+module.exports = {
+ timetravel: false,
+ massa: { tvl, }
+};
+
diff --git a/projects/dyad/index.js b/projects/dyad/index.js
index d8f921d39d..ec95d77124 100644
--- a/projects/dyad/index.js
+++ b/projects/dyad/index.js
@@ -1,19 +1,21 @@
const ADDRESSES = require("../helper/coreAssets.json");
-const { sumTokensExport } = require("../helper/unwrapLPs");
+const vaults = [
+ "0x7aE80418051b2897729Cbdf388b07C5158C557A1",
+ "0x4fde0131694ae08c549118c595923ce0b42f8299",
+ "0x7e5f2b8f089a4cd27f5b6b846306020800df45bd",
+ // "0xf3768D6e78E65FC64b8F12ffc824452130BD5394", // Kerosene is own token
+ "0x3D72f7Fc3A9537e1fcC6FBF91AF55CcF2c5C4ed0",
+]
+
+async function tvl(api) {
+ const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults })
+ tokens.push(ADDRESSES.null)
+ vaults.push('0xdc400bbe0b8b79c07a962ea99a642f5819e3b712')
+ return api.sumTokens({ tokensAndOwners2: [tokens, vaults] })
+}
module.exports = {
ethereum: {
- tvl: sumTokensExport({
- owners: [
- "0xdc400bbe0b8b79c07a962ea99a642f5819e3b712",
- "0xcF97cEc1907CcF9d4A0DC4F492A3448eFc744F6c",
- "0x7aE80418051b2897729Cbdf388b07C5158C557A1",
- ],
- tokens: [
- ADDRESSES.null,
- ADDRESSES.ethereum.WETH,
- ADDRESSES.ethereum.WSTETH,
- ],
- }),
+ tvl,
},
-};
+}
diff --git a/projects/earlyfans/index.js b/projects/earlyfans/index.js
new file mode 100644
index 0000000000..e7801fcb37
--- /dev/null
+++ b/projects/earlyfans/index.js
@@ -0,0 +1,18 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+const ADDRESSES = require('../helper/coreAssets.json')
+const { staking } = require('../helper/staking')
+
+const contract = "0x4b17a9318238403ddac8E3a790C3b06D18132Bf4";
+const early = "0x7135B32e9903BdB4e19a8b1D22fC2038964B8451";
+
+async function tvl(api) {
+ return sumTokens2({ tokens: [ADDRESSES.null], owners: [contract], api });
+}
+
+module.exports = {
+ methodology: `TVL counts the EARLY on ${early} and ETH on ${contract}`,
+ blast: {
+ tvl,
+ staking: staking(contract, early) // early token
+ },
+};
diff --git a/projects/electrowizy/index.js b/projects/electrowizy/index.js
new file mode 100644
index 0000000000..1bc784f1e6
--- /dev/null
+++ b/projects/electrowizy/index.js
@@ -0,0 +1,7 @@
+const { sumERC4626VaultsExport } = require('../helper/erc4626')
+
+module.exports = {
+ polygon: {
+ tvl: sumERC4626VaultsExport({ vaults: [ '0x663819aB31cB6204a2A732996549B702DeC38aa9'], balanceAbi: 'uint256:totalStaked', tokenAbi: 'address:stakingToken' }),
+ }
+}
diff --git a/projects/elektrik/index.js b/projects/elektrik/index.js
index 1720939bb7..c817693b4b 100644
--- a/projects/elektrik/index.js
+++ b/projects/elektrik/index.js
@@ -10,7 +10,7 @@ const query = `{
}`
async function tvl(api) {
- const { pools } = await cachedGraphQuery('elektrik-1', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH-V2', query)
+ const { pools } = await cachedGraphQuery('elektrik-2', 'https://subgraph.elektrik.network/subgraphs/name/ELEKTRIK-GRAPH-V2', query)
const ownerTokens = pools.map(i => [[i.token0.id, i.token1.id], i.id])
return sumTokens2({ api, ownerTokens, })
}
diff --git a/projects/elocks/index.js b/projects/elocks/index.js
new file mode 100644
index 0000000000..400caf55ff
--- /dev/null
+++ b/projects/elocks/index.js
@@ -0,0 +1,23 @@
+const { sumTokens2 } = require("../helper/unwrapLPs")
+
+const IELOCKS = {
+ lockedAssets: "function lockedAssets(uint) public view returns (address token, uint balance, uint)"
+}
+
+const elocks = {
+ fantom: "0x2f20A659601d1c161A108E0725FEF31256a907ad"
+}
+
+module.exports = {
+ misrepresentedTokens: true,
+}
+
+Object.keys(elocks).forEach(chain => {
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const data = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: IELOCKS.lockedAssets, target: elocks[api.chain], startFromOne: true, })
+ data.forEach(i => api.addToken(i.token, i.balance))
+ return sumTokens2({ api, resolveLP: true})
+ },
+ }
+})
\ No newline at end of file
diff --git a/projects/enso-finance/index.js b/projects/enso-finance/index.js
index 7cacc68372..10f6ea4e26 100644
--- a/projects/enso-finance/index.js
+++ b/projects/enso-finance/index.js
@@ -1,48 +1,17 @@
-const sdk = require('@defillama/sdk');
-const { request, gql } = require('graphql-request');
+const { sumTokensExport } = require('../helper/unwrapLPs');
// Enso finance TVL lies for now in the index tokens held by the liquidityMigration contracts
const liquidityMigrationV2_contract = '0x0c6D898ac945E493D25751Ea43BE2c8Beb881D8C';
-const graphUrl = 'https://api.thegraph.com/subgraphs/name/ensofinance/enso-liquidity-migration'
-const graphQuery = gql`
-query GET_WHITELISTED_TOKENS($block: Int) {
- tokens (
- first: 1000
- skip: 0
- block: { number: $block }
- ) {
- id
- name
- stakedAmount
- }
-}`
-
-async function tvl(timestamp, block) {
- const { tokens } = await request(
- graphUrl,
- graphQuery,
- {block}
- );
- const tokens_contracts = tokens.map(t => t.id)
-
- const tokenBalances = await sdk.api.abi.multiCall({
- calls: tokens_contracts.map((t) => ({
- target: t,
- params: [liquidityMigrationV2_contract],
- })),
- abi: 'erc20:balanceOf',
- block,
- chain: 'ethereum',
- })
-
- const balances = {};
- sdk.util.sumMultiBalanceOf(balances, tokenBalances);
- return balances;
-}
module.exports = {
ethereum: {
- tvl,
+ tvl: sumTokensExport({ owner: liquidityMigrationV2_contract, fetchCoValentTokens: true, tokens: [
+ '0x0327112423f3a68efdf1fcf402f6c5cb9f7c33fd',
+ '0x126c121f99e1e211df2e5f8de2d96fa36647c855',
+ '0x7b18913d945242a9c313573e6c99064cd940c6af',
+ '0xad6a626ae2b43dcb1b39430ce496d2fa0365ba9c',
+ '0xe5feeac09d36b18b3fa757e5cf3f8da6b8e27f4c',
+ ] }),
},
methodology:
`Get the list of whitelisted index tokens from accepted adapters - TokenSet IndexCoop Indexed PowerPool and PieDAO - and query the amounts held by the vampire LiquidityMigrationV2 contract`,
diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js
index e6c1a9a1ad..47ac5caf04 100644
--- a/projects/ensuro/index.js
+++ b/projects/ensuro/index.js
@@ -7,6 +7,7 @@ const addressBook = {
aave_v3_usdc: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aPolUSDC
aave_v2_usdc: "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", // amUSDC
compound_v3_usdc: "0xF25212E676D1F7F89Cd72fFEe66158f541246445", // Compound USDC
+ mountain_usdm: "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C", // Mountain USDM
reserves: [
// eTokens
{name: "eToken Junior Koala", address: "0x8d2Ee82c4172B2138B06b8037d769cBfAf9C0274"},
@@ -21,6 +22,8 @@ const addressBook = {
{name: "eToken Junior DLT", address: "0x9078dDdeA2F82c27791EF78A9ec9ab0f66bfb6F9"},
{name: "eToken Junior Otonomi", address: "0x32a9CBeb2cA148E55F327c6B4673351dD03eD858"},
{name: "eToken Junior Bliss", address: "0x71d390C243706b713B5D2b077E942223f7A55d00"},
+ {name: "eToken Junior InsureHero", address: "0x15F76F59A29C7c12b4a67751CA525bf9167C1AaB"},
+ {name: "eToken Junior Clerity", address: "0x1c7F0c8ba10Db7f2e1c7B5B0A024b66b6baceb45"},
// PremiumsAccounts
{name: "PremiumsAccount Koala", address: "0xCCf5C404d32eB6E777088AB13837a1b8dCBA9328"},
{name: "PremiumsAccount Innov Zone", address: "0x4f43B8F252887F814ED689346fdb5Bd266394520"},
@@ -32,6 +35,8 @@ const addressBook = {
{name: "PremiumsAccount DLT", address: "0x8908d99a4E2fF6b7Bf4563593B02AcBc7bBfaBC1"},
{name: "PremiumsAccount Otonomi", address: "0xE43587386E6e8FA127dd008770cdC07dE2Df91E9"},
{name: "PremiumsAccount Bliss", address: "0x11b490292799a0edFE37797592F77151C4483442"},
+ {name: "PremiumsAccount InsureHero", address: "0x41B5a105C850014eC594879E8511994F25092460"},
+ {name: "PremiumsAccount Clerity", address: "0xD26d5015C57C197AE5e7BC866B49837d22364eAB"},
// MultiStrategy Vault - Vault that aggregates assets of several reserves
{name: "MultiStrategy Vault", address: "0x1EE585dcea25cbDa16BE8cfeFa381A1F32acA418"},
],
@@ -40,7 +45,7 @@ const addressBook = {
async function tvl(api) {
const addresses = addressBook[api.chain];
- const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc, addresses.compound_v3_usdc], i.address])
+ const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc, addresses.compound_v3_usdc, addresses.mountain_usdm], i.address])
return sumTokens2({ api, ownerTokens, });
}
diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js
index cb3128d075..121fe8240f 100644
--- a/projects/enzyme/index.js
+++ b/projects/enzyme/index.js
@@ -1,9 +1,10 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const { sumTokens2 } = require('../helper/unwrapLPs')
const config = {
- polygon: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core-polygon' },
- ethereum: { endpoint: 'https://api.thegraph.com/subgraphs/name/enzymefinance/enzyme-core' },
+ polygon: { endpoint: sdk.graph.modifyEndpoint('GCAHDyqvZBLMwqdb9U7AqWAN4t4TSwR3aXMHDoUUFuRV') },
+ ethereum: { endpoint: sdk.graph.modifyEndpoint('9DLBBLep5UyU16kUQRvxBCMqko4q9XzuE4XsMMpARhKK') },
}
const query = `query get_accounts($lastId: String!) {
vaults(
diff --git a/projects/ergodex.js b/projects/ergodex.js
index e7caf7509a..fb17071d94 100644
--- a/projects/ergodex.js
+++ b/projects/ergodex.js
@@ -1,21 +1,9 @@
const { sumTokensExport } = require('./helper/chain/ergo')
-const { sumTokensExport: steCardano } = require('./helper/chain/cardano')
-const { get } = require('./helper/http');
-
-async function cardanoTVL() {
- let { tvlAda } = await get('https://api.splash.trade/platform-api/v1/platform/stats')
-
- return { cardano: tvlAda };
-}
module.exports = {
timetravel: false,
misrepresentedTokens: true,
ergo: {
tvl: sumTokensExport({ owner: '5vSUZRZbdVbnk4sJWjg2uhL94VZWRg4iatK9VgMChufzUgdihgvhR8yWSUEJKszzV7Vmi6K8hCyKTNhUaiP8p5ko6YEU9yfHpjVuXdQ4i5p4cRCzch6ZiqWrNukYjv7Vs5jvBwqg5hcEJ8u1eerr537YLWUoxxi1M4vQxuaCihzPKMt8NDXP4WcbN6mfNxxLZeGBvsHVvVmina5THaECosCWozKJFBnscjhpr3AJsdaL8evXAvPfEjGhVMoTKXAb2ZGGRmR8g1eZshaHmgTg2imSiaoXU5eiF3HvBnDuawaCtt674ikZ3oZdekqswcVPGMwqqUKVsGY4QuFeQoGwRkMqEYTdV2UDMMsfrjrBYQYKUBFMwsQGMNBL1VoY78aotXzdeqJCBVKbQdD3ZZWvukhSe4xrz8tcF3PoxpysDLt89boMqZJtGEHTV9UBTBEac6sDyQP693qT3nKaErN8TCXrJBUmHPqKozAg9bwxTqMYkpmb9iVKLSoJxG7MjAj72SRbcqQfNCVTztSwN3cRxSrVtz4p87jNFbVtFzhPg7UqDwNFTaasySCqM', })
- },
- cardano: {
- tvl: cardanoTVL,
- // tvl: steCardano({ owner: 'addr1x94ec3t25egvhqy2n265xfhq882jxhkknurfe9ny4rl9k6dj764lvrxdayh2ux30fl0ktuh27csgmpevdu89jlxppvrst84slu'})
}
}
diff --git a/projects/etcswap-v3/index.js b/projects/etcswap-v3/index.js
new file mode 100644
index 0000000000..a358219cc4
--- /dev/null
+++ b/projects/etcswap-v3/index.js
@@ -0,0 +1,8 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ ethereumclassic: {
+ factory: "0x2624E907BcC04f93C8f29d7C7149a8700Ceb8cDC",
+ fromBlock: 19714286,
+ },
+});
diff --git a/projects/ethalend/index.js b/projects/ethalend/index.js
index 79d7fe5394..cf8f95e3d8 100644
--- a/projects/ethalend/index.js
+++ b/projects/ethalend/index.js
@@ -1,10 +1,10 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require('@defillama/sdk')
const abi = require('./abi.json')
const { unwrapUniswapLPs } = require('../helper/unwrapLPs')
const { staking } = require('../helper/staking')
const { pool2 } = require('../helper/pool2')
const { getConfig } = require('../helper/cache')
+const sdk = require('@defillama/sdk')
const { gql, request } = require('graphql-request')
const { default: BigNumber } = require('bignumber.js')
@@ -49,7 +49,7 @@ async function avaxTvl(_, _block, cb) {
async function tvl(chain, block, chainId) {
const balances = {}
if (chain === 'polygon') {
- const globalData = (await request("https://api.thegraph.com/subgraphs/name/ethalend/etha-v1", globalDataQuery, { block: block - 100 })).globalDatas
+ const globalData = (await request(sdk.graph.modifyEndpoint('3fJ6wwsbCeMUrsohMRsmzgzrWwRMWnEac8neYkYQuJaz'), globalDataQuery, { block: block - 100 })).globalDatas
await Promise.all(globalData.filter(v => v.type === "lending").map(async v => {
if (v.address === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee") {
v.address = ADDRESSES.polygon.WMATIC_2
diff --git a/projects/etherfi-liquid/index.js b/projects/etherfi-liquid/index.js
index 1498bdcc48..2ffb2b3b8d 100644
--- a/projects/etherfi-liquid/index.js
+++ b/projects/etherfi-liquid/index.js
@@ -4,8 +4,8 @@ const sdk = require('@defillama/sdk')
async function tvl(api) {
const optimismApi = new sdk.ChainApi({ chain: 'optimism', timestamp: api.timestamp })
const balETH = await api.call({
- abi: "uint256:totalAssets",
- target: '0xea1a6307d9b18f8d1cbf1c3dd6aad8416c06a221',
+ abi: "uint256:totalSupply",
+ target: '0xf0bb20865277aBd641a307eCe5Ee04E79073416C',
});
await optimismApi.getBlock()
const wethBal = await optimismApi.call({
@@ -22,7 +22,7 @@ async function tvl(api) {
throw new Error('Data is outdated')
}
console.log(updatedTimestamp, api.timestamp)
- api.add(ADDRESSES.ethereum.EETH, balETH - wethBal);
+ api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) - BigInt(wethBal));
api.add(ADDRESSES.ethereum.WETH, wethBal)
const balUSD = await api.call({
abi: "uint256:totalSupply",
diff --git a/projects/etherfi-lrt/index.js b/projects/etherfi-lrt/index.js
new file mode 100644
index 0000000000..576cdac1e0
--- /dev/null
+++ b/projects/etherfi-lrt/index.js
@@ -0,0 +1,17 @@
+const ADDRESSES = require('../helper/coreAssets.json');
+const sdk = require('@defillama/sdk');
+
+async function tvl(api) {
+ const balETH2 = await api.call({
+ abi: "uint256:totalSupply",
+ target: '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88',
+ });
+ api.add(ADDRESSES.ethereum.EETH, BigInt(balETH2));
+}
+
+module.exports = {
+ doublecounted: true,
+ ethereum: {
+ tvl,
+ },
+};
diff --git a/projects/ethosx/index.js b/projects/ethosx/index.js
new file mode 100644
index 0000000000..adbad62cd4
--- /dev/null
+++ b/projects/ethosx/index.js
@@ -0,0 +1,61 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require("../helper/unwrapLPs");
+const ETH_PUT_CONTROLLER_ADDRESS = "0x55E008E3b0Aa6808Ca8B8Ba1DC319EC132554aCd";
+const ETH_CALL_CONTROLLER_ADDRESS =
+ "0x2eEFcBCa065bE1763be58276AFA41627A82dfa2D";
+const BTC_PUT_CONTROLLER_ADDRESS = "0x3273C69432b2B0D808499F4Cc56113Be6c7A673F";
+const BTC_CALL_CONTROLLER_ADDRESS =
+ "0x18AadF2a220D3FEb958Ed161263185f0805D11a1";
+const PEPE_PUT_CONTROLLER_ADDRESS =
+ "0x9c50C12d3A569cD4285c62cd7A889cE7BCfC12e9";
+const PEPE_CALL_CONTROLLER_ADDRESS =
+ "0x176a49747a97dD0735a2186aEbe1d1400E3eBf8b";
+const WIF_PUT_CONTROLLER_ADDRESS = "0xA1269bF2F05aA11363352eA0cf4E5a071Ef9cF29";
+const WIF_CALL_CONTROLLER_ADDRESS =
+ "0x47D5710A4ABd8B47e9ec48f6cB04cDBcfBFCA382";
+const DOGE_PUT_CONTROLLER_ADDRESS =
+ "0x9c50C12d3A569cD4285c62cd7A889cE7BCfC12e9";
+const DOGE_CALL_CONTROLLER_ADDRESS =
+ "0x176a49747a97dD0735a2186aEbe1d1400E3eBf8b";
+const FLOKI_PUT_CONTROLLER_ADDRESS =
+ "0xA1269bF2F05aA11363352eA0cf4E5a071Ef9cF29";
+const FLOKI_CALL_CONTROLLER_ADDRESS =
+ "0x47D5710A4ABd8B47e9ec48f6cB04cDBcfBFCA382";
+
+const USDC_ARB_ADDRESS = ADDRESSES.arbitrum.USDC_CIRCLE;
+const USDC_BSC_ADDRESS = ADDRESSES.bsc.USDC;
+
+module.exports = {
+ methodology: "TVL counts the USDC held in the controller contracts.",
+ start: 1715693000,
+ arbitrum: {
+ tvl: sumTokensExport({
+ owners: [
+ ETH_PUT_CONTROLLER_ADDRESS,
+ ETH_CALL_CONTROLLER_ADDRESS,
+ BTC_PUT_CONTROLLER_ADDRESS,
+ BTC_CALL_CONTROLLER_ADDRESS,
+ PEPE_PUT_CONTROLLER_ADDRESS,
+ PEPE_CALL_CONTROLLER_ADDRESS,
+ WIF_PUT_CONTROLLER_ADDRESS,
+ WIF_CALL_CONTROLLER_ADDRESS,
+ ],
+ tokens: [USDC_ARB_ADDRESS],
+ }),
+ },
+ bsc: {
+ tvl: sumTokensExport({
+ owners: [
+ ETH_PUT_CONTROLLER_ADDRESS,
+ ETH_CALL_CONTROLLER_ADDRESS,
+ BTC_PUT_CONTROLLER_ADDRESS,
+ BTC_CALL_CONTROLLER_ADDRESS,
+ DOGE_CALL_CONTROLLER_ADDRESS,
+ DOGE_PUT_CONTROLLER_ADDRESS,
+ FLOKI_CALL_CONTROLLER_ADDRESS,
+ FLOKI_PUT_CONTROLLER_ADDRESS,
+ ],
+ tokens: [USDC_BSC_ADDRESS],
+ }),
+ },
+}; // node test.js projects/mint-club/index.js
diff --git a/projects/everdex/index.js b/projects/everdex/index.js
index c412a4a9f8..cf025fc2d0 100644
--- a/projects/everdex/index.js
+++ b/projects/everdex/index.js
@@ -11,6 +11,10 @@ const tokensAndOwners = [
[ADDRESSES.bfc.UnifiedDAI, '0xa455434802d8B530C77d2B7547eF93C798896581'],
[ADDRESSES.bfc.UnifiedUSDC, '0xa455434802d8B530C77d2B7547eF93C798896581'],
[ADDRESSES.bfc.UnifiedUSDT, '0xa455434802d8B530C77d2B7547eF93C798896581'],
+
+ // BitcoinUSD - USDC Pool
+ [ADDRESSES.bfc.BitcoinUSD, '0x840Cf4522ED96CBBEB0924672Ea170456eea3a4c'],
+ [ADDRESSES.bfc.UnifiedUSDC, '0x840Cf4522ED96CBBEB0924672Ea170456eea3a4c']
]
async function tvl() {
diff --git a/projects/everyfinance/index.js b/projects/everyfinance/index.js
new file mode 100644
index 0000000000..d782e9014c
--- /dev/null
+++ b/projects/everyfinance/index.js
@@ -0,0 +1,20 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+const config = {
+ ethereum: { managers: ['0xbebbaE6f1062E4Cd5652B9d8e1B8aECBEE993A9E', '0x19d6D19a034BB886507DC08dF99716f418bD61a3', '0xbE721812442C648c191Bc267659374036fd68918'] },
+ bsc: { managers: ['0xbebbaE6f1062E4Cd5652B9d8e1B8aECBEE993A9E', '0x19d6D19a034BB886507DC08dF99716f418bD61a3', '0x8849FCE3fB3d82BBF14e1FC9D7E82EAfEB4b2904'] },
+ polygon: { managers: ['0x8849FCE3fB3d82BBF14e1FC9D7E82EAfEB4b2904', '0xbE49a740c48F9D4347De8994c488333d492a4e19', '0x9C1A18A734dFAe6e6f89942f358e7270BecdB002'] },
+}
+
+Object.keys(config).forEach(chain => {
+ const { managers, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const safeHouses = await api.multiCall({ abi: 'address:safeHouse', calls: managers })
+ const assetBooks = await api.multiCall({ abi: 'address:assetBook', calls: safeHouses })
+ const tokens = await api.fetchList({ lengthAbi: 'getAssetsListSize', itemAbi: 'assetsList', calls: assetBooks, groupedByInput: true, })
+ const ownerTokens = tokens.map((t, i) => [t, safeHouses[i]])
+ return sumTokens2({ api, ownerTokens, permitFailure: true })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/factor-leverage-vault/index.js b/projects/factor-leverage-vault/index.js
index 33853aebb3..88dfcb90d4 100644
--- a/projects/factor-leverage-vault/index.js
+++ b/projects/factor-leverage-vault/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { blockQuery } = require('../helper/http')
const queryBlock = `query data($block: Int){
@@ -11,7 +12,7 @@ const queryBlock = `query data($block: Int){
}`
const SUBGRAPH_URL =
- "https://api.thegraph.com/subgraphs/name/dimasriat/factor-leverage-vault";
+ sdk.graph.modifyEndpoint('BZhGLLFicmKB9N9oMgDEAP8HmhVxTTjjxQA3ctGewAFc');
async function tvl(api) {
const { leverageVaultPairStates } = await blockQuery(SUBGRAPH_URL, queryBlock, { api })
diff --git a/projects/factor/index.js b/projects/factor/index.js
index 03023d259d..7e161dfc93 100644
--- a/projects/factor/index.js
+++ b/projects/factor/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { staking } = require("../helper/staking");
const { sumTokens2 } = require('../helper/unwrapLPs');
const { cachedGraphQuery } = require('../helper/cache');
@@ -6,7 +7,7 @@ const FCTR = "0x6dD963C510c2D2f09d5eDdB48Ede45FeD063Eb36"
const veFCTR = "0xA032082B08B2EF5A6C3Ea80DaEac58300F68FB73"
async function tvl(api) {
- const endpoint = 'https://api.thegraph.com/subgraphs/name/yanuar-ar/factor-arbitrum'
+ const endpoint = sdk.graph.modifyEndpoint('2ZavYD1JPYUy8HMheuYcyKCswHR5djpEq2xuWs7PzPRe')
const res = await cachedGraphQuery('factor-v1', endpoint, `{vaultGeneses { id }}`)
const indices = res.vaultGeneses.map(v => v.id)
const uBalances = await api.multiCall({ abi: 'uint256[]:underlyingAssetsBalance', calls: indices })
diff --git a/projects/fathom-CDP/index.js b/projects/fathom-CDP/index.js
index d738ba16a4..3c762b4e48 100644
--- a/projects/fathom-CDP/index.js
+++ b/projects/fathom-CDP/index.js
@@ -1,9 +1,10 @@
-const WXDCHolders = [
- '0x9B4aCeFE2dB986Ca080Dc01d137e6566dBE0aA3a', // CDP Vault CollateralPoolId "0x5844430000000000000000000000000000000000000000000000000000000000"
+const Vaults = [
+ '0x9B4aCeFE2dB986Ca080Dc01d137e6566dBE0aA3a', // CDP Vault CollateralPoolId "0x5844430000000000000000000000000000000000000000000000000000000000" XDC
+ '0x14F2d15cdB7255A7c96973Ce54a269Ac1988cfcf' // CDP Vault CollateralPoolId "0x43474f0000000000000000000000000000000000000000000000000000000000" CGO
];
const { sumTokensExport } = require('../helper/unwrapLPs')
const ADDRESSES = require('../helper/coreAssets.json')
module.exports = {
- xdc: { tvl: sumTokensExport({ owners: WXDCHolders, tokens: [ADDRESSES.xdc.WXDC]}) },
+ xdc: { tvl: sumTokensExport({ owners: Vaults, tokens: [ADDRESSES.xdc.WXDC, '0x8f9920283470f52128bf11b0c14e798be704fd15']}) },
}
diff --git a/projects/fenix-v2/index.js b/projects/fenix-v2/index.js
new file mode 100644
index 0000000000..25e428c98e
--- /dev/null
+++ b/projects/fenix-v2/index.js
@@ -0,0 +1,12 @@
+const { getUniTVL } = require('../helper/unknownTokens')
+
+module.exports = {
+ misrepresentedTokens: true,
+ blast: {
+ tvl: getUniTVL({
+ factory: '0xa19c51d91891d3df7c13ed22a2f89d328a82950f',
+ useDefaultCoreAssets: true,
+ hasStablePools: true
+ })
+ },
+};
\ No newline at end of file
diff --git a/projects/fixes-coins/index.js b/projects/fixes-coins/index.js
new file mode 100644
index 0000000000..4cf80a4fc2
--- /dev/null
+++ b/projects/fixes-coins/index.js
@@ -0,0 +1,91 @@
+// Fixes Inscription Protocol - 𝔉rc20 Treasury Pool: https://fixes.world/
+const { post } = require("../helper/http");
+
+let queryTVLCode = `
+import LiquidStaking from 0xd6f80565193ad727
+import stFlowToken from 0xd6f80565193ad727
+// Fixes Imports
+import FRC20AccountsPool from 0xd2abb5dbf5e08666
+import FixesFungibleTokenInterface from 0xd2abb5dbf5e08666
+import FixesTokenLockDrops from 0xd2abb5dbf5e08666
+import FixesTradablePool from 0xd2abb5dbf5e08666
+import FRC20Indexer from 0xd2abb5dbf5e08666
+
+access(all)
+fun main(): UFix64 {
+ // singleton resource and constants
+ let acctsPool = FRC20AccountsPool.borrowAccountsPool()
+ let frc20Indexer = FRC20Indexer.getIndexer()
+ let stFlowTokenKey = "@".concat(Type<@stFlowToken.Vault>().identifier)
+
+ // dictionary of addresses
+ let addrsDict = acctsPool.getAddresses(type: FRC20AccountsPool.ChildAccountType.FungibleToken)
+ // dictionary of tickers and total locked token balances
+ let tickerTotal: {String: UFix64} = {}
+ // This is the soft burned LP value which is fully locked in the BlackHole Vault
+ var flowLockedInBondingCurve = 0.0
+ addrsDict.forEachKey(fun (key: String): Bool {
+ if let addr = addrsDict[key] {
+ // sum up all locked token balances in LockDrops Pool
+ if let dropsPool = FixesTokenLockDrops.borrowDropsPool(addr) {
+ let lockedTokenSymbol = dropsPool.getLockingTokenTicker()
+ tickerTotal[lockedTokenSymbol] = (tickerTotal[lockedTokenSymbol] ?? 0.0) + dropsPool.getTotalLockedTokenBalance()
+ }
+ // sum up all burned LP value in Tradable Pool
+ if let tradablePool = FixesTradablePool.borrowTradablePool(addr) {
+ flowLockedInBondingCurve = flowLockedInBondingCurve + tradablePool.getFlowBalanceInPool()
+ }
+ }
+ return true
+ })
+ // sum up all locked token balances in LockDrops Pool
+ var totalLockingTokenTVL = 0.0
+ tickerTotal.forEachKey(fun (key: String): Bool {
+ let lockedAmount = tickerTotal[key]!
+ if key == "" {
+ // this is locked FLOW
+ totalLockingTokenTVL = totalLockingTokenTVL + lockedAmount
+ } else if key == "fixes" {
+ // this is locked FIXES
+ let price = frc20Indexer.getBenchmarkValue(tick: "fixes")
+ totalLockingTokenTVL = totalLockingTokenTVL + lockedAmount * price
+ } else if key == stFlowTokenKey {
+ // this is locked stFlow
+ totalLockingTokenTVL = totalLockingTokenTVL + LiquidStaking.calcFlowFromStFlow(stFlowAmount: lockedAmount)
+ }
+ return true
+ })
+ return totalLockingTokenTVL + flowLockedInBondingCurve
+}
+`;
+
+const queryCodeBase64 = Buffer.from(queryTVLCode, "utf-8").toString("base64");
+
+async function tvl() {
+ try {
+ const response = await post(
+ "https://rest-mainnet.onflow.org/v1/scripts",
+ { script: queryCodeBase64 },
+ {
+ headers: { "content-type": "application/json" },
+ }
+ );
+ let resEncoded = response;
+ let resString = Buffer.from(resEncoded, "base64").toString("utf-8");
+ let resJson = JSON.parse(resString);
+ let flowTokenTVL = Number(resJson.value);
+
+ return { flow: flowTokenTVL };
+ } catch (error) {
+ throw new Error("Couln't query scripts of Fixes coins", error);
+ }
+}
+
+module.exports = {
+ timetravel: false,
+ methodology:
+ "Counting the $FLOW token locked in Fixes Coins' Bonding Curve, and Fixes Coins' LockDrop Pool.",
+ flow: {
+ tvl,
+ },
+};
diff --git a/projects/flarefarm/flare.js b/projects/flarefarm/flare.js
index 8e6a9dda21..6b18d43e93 100644
--- a/projects/flarefarm/flare.js
+++ b/projects/flarefarm/flare.js
@@ -18,7 +18,13 @@ const LPs ={
WFLR_eQNT_LP: '0x80A08BbAbB0A5C51A9ae53211Df09EF23Debd4f3',
HLN_eQNT_LP: '0xEd920325b7dB1e909DbE2d562fCD07f714395e10',
eQNT_APS_LP: '0x33E2354928002766C27F7424EcA6f9B133E922a5',
- WFLR_BNZ_LP: '0x2C934BbBD152A40419d3330e4d79f362Bc6691D6'
+ WFLR_BNZ_LP: '0x2C934BbBD152A40419d3330e4d79f362Bc6691D6',
+ sFLR_WFLR_LP: '0x7E8EB77Feb4b3Fe2C58B493DF6Ce38875806bebb',
+ sFLR_eUSDT_LP: '0xDf243D5631A68fDa74Db6572D7649aD341470c82',
+ sFLR_eETH_LP: '0x68cB5Bf8c9A54d664d9b6b483fC6A6401448223e',
+ sFLR_eQNT_LP: '0xb7C6F8cff4D5B7266225f624e03a27BE0998C726',
+ sFLR_HLN_LP: '0x6CbF760115F66502838B5622423D68DBCb4A9757',
+ sFLR_APS_LP: '0xf06eeBF7A66C80760Bd8343A6BCe84c9D61879ee',
}
const chain = 'flare'
@@ -40,8 +46,14 @@ async function farmTvl(timestamp, ethblock, { [chain]: block }) {
[LPs.eETH_APS_LP, "0x05B623fd361109D0e47169eBa9e0514c80c40409"],
[LPs.WFLR_eQNT_LP, "0xc786B4a2F9c314743Ed713184e5c94c244fF6c8D"],
[LPs.HLN_eQNT_LP, "0x02321f8030208de54dBd3e2DbdEfbd07cc88Ad6D"],
- [LPs.eQNT_APS_LP, "0x5E69aD043AE8941969617aeF4487f15445D774C6"],
- [LPs.WFLR_BNZ_LP, "0x8246A727510F471f8a61CBc218B60e5cf85739F6"]
+ [LPs.eQNT_APS_LP, "0x5E69aD043AE8941969617aeF4487f15445D774C6"],
+ [LPs.WFLR_BNZ_LP, "0x8246A727510F471f8a61CBc218B60e5cf85739F6"],
+ [HLN, "0x9032Cf50B469Eec548654E060d1c14fe5AA7038b"],
+ [LPs.sFLR_WFLR_LP, "0xeb4ed8662828735E2871493b957b29fD5Cb44fEB"],
+ [LPs.sFLR_eUSDT_LP, "0x31b3086D005a266864C014d4Ae09F5fc0F9Ea15d"],
+ [LPs.sFLR_eETH_LP, "0x03a9Fed1a21382d84c0c57eebba7DF293aca4e65"],
+ [LPs.sFLR_eQNT_LP, "0xcE5D8BB190eE88A96A23e69A50670907873f00e9"],
+ [LPs.sFLR_HLN_LP, "0xd06FFFb1908EAcC059d94cbA4004091dE4164e51"],
];
return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, })
@@ -52,6 +64,8 @@ async function pool2(timestamp, ethblock, { [chain]: block }) {
const tokens = [
['0xef24D5155818d4bD16AF0Cea1148A147eb620743', "0x3DA590b357Cf17a413ec8db70FeB02119AfE707f"],
['0x87E0E33558c8e8EAE3c1E9EB276e05574190b48a', "0x2de4bC38f012DC90478f570083d3Da45B05659A9"],
+ [LPs.sFLR_APS_LP,'0xded2decC3028B700B8d124292868F195bb8F6467']
+
]
return sumUnknownTokens({ tokensAndOwners: tokens, chain, block, useDefaultCoreAssets: true, })
}
diff --git a/projects/flashtrade/index.js b/projects/flashtrade/index.js
index 84b4135acc..943832c20b 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/flex-powercity-io/index.js b/projects/flex-powercity-io/index.js
new file mode 100644
index 0000000000..6e6c7f8899
--- /dev/null
+++ b/projects/flex-powercity-io/index.js
@@ -0,0 +1,28 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { getLiquityTvl } = require("../helper/liquity.js");
+const { sumTokensExport } = require("../helper/unknownTokens.js");
+
+// TroveManager holds total system collateral (deposited HEX)
+const TROVE_MANAGER_ADDRESS = "0xC2D0720721d48cE85e20Dc9E01B8449D7eDd14CE";
+const HEX_ADDRESS = ADDRESSES.pulse.HEX;
+
+// Staking holds LQTY tokens and receive share of protocol revenue
+const STAKING_ADDRESS = "0xCeC2c718ceFdb3A515D3CC22e430b46933922CE4";
+const FLEX_ADDRESS = "0x9c6fA17D92898B684676993828143596894AA2A6";
+
+const HEXDC_FARMING_ADDRESS = "0x63D134B47692d154C78053117D803e22cB1F7593";
+const LP_HEXDC_HEX_ADDRESS = "0x9756F095DfA27D4c2EAE0937a7b8a6603D99Affb";
+
+const FLEX_FARMING_ADDRESS = "0x74F8A9dFefe855Dc97a4A4962b7c6cEc074aED62";
+const LP_FLEX_HEX_ADDRESS = "0x476d63aB94B4E86614Df0C3D5A27E9e22631D062";
+const lps = [LP_HEXDC_HEX_ADDRESS, LP_FLEX_HEX_ADDRESS]
+
+module.exports = {
+ start: 1714534195,
+ methodology: "Total Value Locked includes all Troves, Stability Pool, Staking Pool and LP Farming Pools",
+ pulse: {
+ tvl: getLiquityTvl(TROVE_MANAGER_ADDRESS, { collateralToken: HEX_ADDRESS }),
+ staking: sumTokensExport({ owner: STAKING_ADDRESS, tokens: [FLEX_ADDRESS], lps, useDefaultCoreAssets: true, }),
+ pool2: sumTokensExport({ owners: [HEXDC_FARMING_ADDRESS, FLEX_FARMING_ADDRESS], tokens: lps, useDefaultCoreAssets: true, }),
+ }
+}
\ No newline at end of file
diff --git a/projects/flipster/index.js b/projects/flipster/index.js
index 51d21361bb..e980af38f1 100644
--- a/projects/flipster/index.js
+++ b/projects/flipster/index.js
@@ -56,6 +56,12 @@ const config = {
'0xfA705a98FA89134F460Bf79457D4fbd3d8E118d9'
]
},
+ ton: {
+ owners: [
+ 'EQDQpuuVQI6Vzpewyll_xSP_SAlSNjXo9RngD9y99C8MVJri',
+ 'EQBlnb9GCDGnJ5XEqamHL7Sj5_0wJ4MGja5T6PKlwVAISgrW',
+ ]
+ },
}
module.exports = cexExports(config)
diff --git a/projects/fluid/index.js b/projects/fluid/index.js
index e4505e99cb..1f4e067c8c 100644
--- a/projects/fluid/index.js
+++ b/projects/fluid/index.js
@@ -1,36 +1,79 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const methodologies = require("../helper/methodologies")
+const ADDRESSES = require("../helper/coreAssets.json");
+const methodologies = require("../helper/methodologies");
const abi = {
- "getOverallTokensData": "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)"
-}
+ getOverallTokensDataLegacy:
+ "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)",
+ getOverallTokensData:
+ "function getOverallTokensData(address[] tokens_) view returns ((uint256 borrowRate, uint256 supplyRate, uint256 fee, uint256 lastStoredUtilization, uint256 storageUpdateThreshold, uint256 lastUpdateTimestamp, uint256 supplyExchangePrice, uint256 borrowExchangePrice, uint256 supplyRawInterest, uint256 supplyInterestFree, uint256 borrowRawInterest, uint256 borrowInterestFree, uint256 totalSupply, uint256 totalBorrow, uint256 revenue, uint256 maxUtilization, (uint256 version, (address token, uint256 kink, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink, uint256 rateAtUtilizationMax) rateDataV1, (address token, uint256 kink1, uint256 kink2, uint256 rateAtUtilizationZero, uint256 rateAtUtilizationKink1, uint256 rateAtUtilizationKink2, uint256 rateAtUtilizationMax) rateDataV2) rateData)[] overallTokensData_)",
+};
-module.exports = {
- methodology: methodologies.lendingMarket,
+const config = {
+ liquidity: "0x52aa899454998be5b000ad077a46bbe360f4e497",
ethereum: {
- tvl: async (api) => {
- const tokens = await api.call({ target: "0x741c2Cd25f053a55fd94afF1afAEf146523E1249", abi: "function listedTokens() public view returns (address[] memory listedTokens_)" })
- api.add("0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", await api.call({
- target: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6",
- abi: "function balance(address, address) public view returns (uint256 balance)",
- params: ["0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", "0x52aa899454998be5b000ad077a46bbe360f4e497"]
- }))
- return api.sumTokens({
- owner: "0x52aa899454998be5b000ad077a46bbe360f4e497", tokens: [
- ADDRESSES.null,
- ...tokens.filter(t => t.toLowerCase() !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee")
- ]
- })
+ liquidityResolver: (block) => {
+ if (block < 19992056) {
+ return "0x741c2Cd25f053a55fd94afF1afAEf146523E1249";
+ }
+ return "0xD7588F6c99605Ab274C211a0AFeC60947668A8Cb";
},
- borrowed: async (api) => {
- const fluidLiquidityResolver = "0x645C84DeA082328e456892D2E68d434b61AD7dBF";
- const tokens = await api.call({
- target: "0x741c2Cd25f053a55fd94afF1afAEf146523E1249",
- abi: "function listedTokens() public view returns (address[] memory listedTokens_)",
- });
+ weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
+ zircuit: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6",
+ },
+ arbitrum: {
+ liquidityResolver: (block) => "0x46859d33E662d4bF18eEED88f74C36256E606e44",
+ },
+};
- const borrowed = await api.call({ target: fluidLiquidityResolver, abi: abi.getOverallTokensData, params: [tokens], })
- api.add(tokens, borrowed.map(x => x.totalBorrow));
- },
+async function getListedTokens(api) {
+ return await api.call({
+ target: config[api.chain].liquidityResolver(api.block),
+ abi: "function listedTokens() public view returns (address[] memory listedTokens_)",
+ });
+}
+
+async function tvl(api) {
+ const tokens = await getListedTokens(api);
+ const chain = api.chain;
+
+ if (chain == "ethereum") {
+ // add WeETH deployed to Zircuit
+ api.add(
+ config.ethereum.weETH,
+ await api.call({
+ target: config.ethereum.zircuit,
+ abi: "function balance(address, address) public view returns (uint256 balance)",
+ params: [config.ethereum.weETH, config.liquidity],
+ })
+ );
}
+
+ return api.sumTokens({
+ owner: config.liquidity,
+ tokens: [
+ ADDRESSES.null,
+ ...tokens.filter(
+ (t) => t.toLowerCase() !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
+ ),
+ ],
+ });
+}
+
+async function borrowed(api) {
+ const tokens = await getListedTokens(api);
+ const borrowed = await api.call({
+ target: config[api.chain].liquidityResolver(api.block),
+ abi: api.block < 19992056 ? abi.getOverallTokensDataLegacy : abi.getOverallTokensData,
+ params: [tokens],
+ });
+ api.add(
+ tokens,
+ borrowed.map((x) => x.totalBorrow)
+ );
}
-// node test.js projects/fluid/index.js
\ No newline at end of file
+
+module.exports = {
+ methodology: methodologies.lendingMarket,
+ ethereum: { tvl, borrowed },
+ arbitrum: { tvl, borrowed },
+};
+// node test.js projects/fluid/index.js
diff --git a/projects/follows/index.js b/projects/follows/index.js
new file mode 100644
index 0000000000..affd1f26ec
--- /dev/null
+++ b/projects/follows/index.js
@@ -0,0 +1,31 @@
+const { PublicKey } = require('@solana/web3.js');
+const { getConnection } = require('../helper/solana');
+
+async function tvl() {
+ const programId = new PublicKey(
+ 'FoLLukXuiZ5kSq3YWCxEmRUt7yDiE9WJCnh76sdC8RTc'
+ );
+ const connection = getConnection();
+
+ const accounts = await connection.getProgramAccounts(programId, {
+ filters: [{
+ dataSize: 88
+ }],
+ dataSlice: { offset: 0, length: 0 }
+ });
+
+ return {
+ solana: accounts.reduce((tvl, { account }) => {
+ return tvl + account.lamports / 1e9;
+ }, 0),
+ };
+}
+
+module.exports = {
+ timetravel: false,
+ methodology:
+ 'To fetch the total supply of deposited SOL into the Follows Program',
+ solana: {
+ tvl,
+ },
+};
diff --git a/projects/fountain.js b/projects/fountain.js
deleted file mode 100644
index 41f47558ed..0000000000
--- a/projects/fountain.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const ADDRESSES = require('./helper/coreAssets.json')
-const { compoundExports } = require("./helper/compound");
-
-module.exports = {
- oasis: {
- ...compoundExports(
- '0xA7684aE7e07Dac91113900342b3ef25B9Fd1D841',
- 'oasis',
- '0xD7d588bAbFb99E82Cd6dd0cA7677A5599AA678B5',
- ADDRESSES.oasis.wROSE,
- )
- },
-}; // node test.js projects/fountain.js
\ No newline at end of file
diff --git a/projects/frakt/index.js b/projects/frakt/index.js
index 19e438ad8c..6e280a96e7 100644
--- a/projects/frakt/index.js
+++ b/projects/frakt/index.js
@@ -1,5 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const { getProvider, getSolBalances, } = require('../helper/solana')
+const { getProvider, sumTokens2, } = require('../helper/solana')
const { Program, } = require("@project-serum/anchor");
const { getConfig } = require('../helper/cache')
@@ -18,7 +18,7 @@ async function getData() {
const pbPools = await program.account.priceBasedLiquidityPool.all()
const liquidityPools = await program.account.liquidityPool.all()
const solOwners = [...liquidityPools.map(i => i.account.liqOwner), ...pbPools.map(i => i.account.liqOwner)].map(i => i.toString())
- const poolsTVL = (await getSolBalances(solOwners))
+ const poolsTVL = (await sumTokens2({ solOwners }))['solana:' + ADDRESSES.solana.SOL] ?? 0
const loans = await program.account.loan.all()
const loanSum = loans.filter(i => i.account.loanStatus.activated).reduce((a, i) => a + +i.account.originalPrice, 0)
diff --git a/projects/franklinTempleton-finance/index.js b/projects/franklinTempleton-finance/index.js
new file mode 100644
index 0000000000..bbbaf4b883
--- /dev/null
+++ b/projects/franklinTempleton-finance/index.js
@@ -0,0 +1,28 @@
+const { toUSDTBalances } = require('../helper/balances');
+
+const BENJI_STELLAR = {ticker: "BENJI", address: 'GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5'}
+const BENJI_POLYGON = '0x408a634b8a8f0de729b48574a3a7ec3fe820b00a'
+
+const stellarTvl = async (api) => {
+ const stellarApi = `https://api.stellar.expert/explorer/public/asset/${BENJI_STELLAR.ticker}-${BENJI_STELLAR.address}`
+ const response = await fetch(stellarApi)
+ const {supply, toml_info} = await response.json()
+ const adjustedSupply = toUSDTBalances((supply / Math.pow(10, toml_info.decimals)))
+ const [[tokenAddress, tokenBalance]] = Object.entries(adjustedSupply);
+ return api.add(tokenAddress, tokenBalance, { skipChain: true })
+}
+
+const polygonTvl = async (api) => {
+ const [decimals, totalSupply] = await Promise.all([
+ api.call({target: BENJI_POLYGON, abi:'erc20:decimals'}),
+ api.call({target: BENJI_POLYGON, abi:'erc20:totalSupply'})
+ ])
+ const adjustedSupply = toUSDTBalances((totalSupply / Math.pow(10, decimals)))
+ const [[tokenAddress, tokenBalance]] = Object.entries(adjustedSupply);
+ api.add(tokenAddress, tokenBalance, {skipChain: true} )
+}
+
+module.exports = {
+ stellar: {tvl: stellarTvl},
+ polygon: {tvl: polygonTvl},
+}
diff --git a/projects/free-protocol/index.js b/projects/free-protocol/index.js
index a4a848fbe7..dafeb2b17b 100644
--- a/projects/free-protocol/index.js
+++ b/projects/free-protocol/index.js
@@ -1,3 +1,4 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require('../helper/unwrapLPs');
module.exports = {
@@ -10,23 +11,26 @@ module.exports = {
'0xE12382e046DB998DE89aF19Ca799CbB757106781',
],
tokens: [
- '0xB880fd278198bd590252621d4CD071b1842E9Bcd',
+ ADDRESSES.merlin.WBTC_1,
'0xC5BD913eE3BEFD4721C609177F29a8770ACD7242',
'0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71',
- '0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71',
],
}),
},
ethereum: {
tvl: sumTokensExport({
owners: [
+ '0x1B5668Ca8edfC8AF5DcB9De014b4B08ed5d0615F',
+ '0x3111653DB0e7094b111b8e435Df9193b62C2C576',
'0xd6572c7cd671ecf75d920adcd200b00343959600',
'0xa97Fe3E9c1d3Be7289030684eD32A6710d2d02bA',
'0xeea3A032f381AB1E415e82Fe08ebeb20F513c42c',
],
tokens: [
+ ADDRESSES.ethereum.USDC,
'0x7122985656e38bdc0302db86685bb972b145bd3c',
- '0xdac17f958d2ee523a2206206994597c13d831ec7',
+ ADDRESSES.ethereum.USDT,
+ '0x7122985656e38BDC0302Db86685bb972b145bD3C',
]
})
},
@@ -37,9 +41,8 @@ module.exports = {
'0xBA43F3C8733b0515B5C23DFF46F47Af6EB46F85C',
],
tokens: [
- '0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9',
- '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
- '0xaf88d065e77c8cc2239327c5edb3a432268e5831',
+ ADDRESSES.arbitrum.USDT,
+ ADDRESSES.arbitrum.USDC_CIRCLE,
]
})
},
@@ -56,13 +59,16 @@ module.exports = {
bsc: {
tvl: sumTokensExport({
owners: [
+ '0x40a25786937eCc0643e78ca40Df02Db4dff27bb0',
+ '0xF8aeD4da2598d3dF878488F40D982d6EcC8B13Ad',
'0xBA43F3C8733b0515B5C23DFF46F47Af6EB46F85C',
'0x0A80028d73Faaee6e57484E3335BeFda0de7f455',
],
tokens: [
- '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409',
- '0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c',
- '0xc5f0f7b66764F6ec8C8Dff7BA683102295E16409',
+ ADDRESSES.ethereum.FDUSD,
+ ADDRESSES.bsc.BTCB,
+ ADDRESSES.ethereum.FDUSD,
+ '0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7',
]
})
},
@@ -77,4 +83,7 @@ module.exports = {
]
})
},
+ kroma: {
+ tvl: () => ({})
+ }
};
\ No newline at end of file
diff --git a/projects/freestyle/index.js b/projects/freestyle/index.js
new file mode 100644
index 0000000000..4aadb02a6e
--- /dev/null
+++ b/projects/freestyle/index.js
@@ -0,0 +1,46 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { request, } = require("graphql-request");
+
+const freestyleConfig = {
+ base: {
+ token: ADDRESSES.base.USDC,
+ start: 1700006400,
+ graphUrl: "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest",
+ accountSource: '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD'
+ },
+}
+
+async function tvl(api) {
+ const { token, graphUrl, start, accountSource } = freestyleConfig[api.chain]
+
+ const query = `
+ query stats($from: String!, $to: String!) {
+ dailyHistories(
+ where: {
+ timestamp_gte: $from
+ timestamp_lte: $to
+ accountSource: "${accountSource}"
+ }
+ ) {
+ timestamp
+ platformFee
+ accountSource
+ tradeVolume
+ deposit
+ withdraw
+ }
+ }
+ `
+ const { dailyHistories } = await request(graphUrl, query, {
+ from: start.toString(),
+ to: api.timestamp.toString(),
+ });
+
+ let total = dailyHistories.reduce((acc, cur) => acc + (Number(cur.deposit) - Number(cur.withdraw)), 0);
+
+ api.add(token, total)
+}
+
+Object.keys(freestyleConfig).forEach(chain => {
+ module.exports[chain] = { tvl }
+})
\ No newline at end of file
diff --git a/projects/fusefi-lending/index.js b/projects/fusefi-lending/index.js
index 79b5685fc1..dacc669eb4 100644
--- a/projects/fusefi-lending/index.js
+++ b/projects/fusefi-lending/index.js
@@ -11,11 +11,11 @@ const olalending = usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298
module.exports = {
fuse:{
tvl: olalending.tvl,
- borrowed: async function(timestamp, ...otherParams){
- if(timestamp >= 1648684800){
+ borrowed: async function(api){
+ if(api.timestamp >= 1648684800){
return {}
}
- return olalending.borrowed(timestamp, ...otherParams)
+ return olalending.borrowed(api)
}
},
hallmarks: [
diff --git a/projects/fusefi/index.js b/projects/fusefi/index.js
index e80a3e353f..f66c14ab69 100644
--- a/projects/fusefi/index.js
+++ b/projects/fusefi/index.js
@@ -1,7 +1,8 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const swap = require("./swap");
const { stakings } = require("../helper/staking");
-const VOLT_TOKEN = "0x34Ef2Cc892a88415e9f02b91BfA9c91fC0bE6bD4".toLowerCase();
+const VOLT_TOKEN = ADDRESSES.fuse.VOLT.toLowerCase();
const VOLT_BAR = "0x97a6e78c9208c21afaDa67e7E61d7ad27688eFd1".toLowerCase();
const VOLT_VOTE_ESCROW = "0xB0a05314Bd77808269e2E1E3D280Bff57Ba85672".toLowerCase()
diff --git a/projects/fwx/index.js b/projects/fwx/index.js
index 9875315810..20fe4a4eaa 100644
--- a/projects/fwx/index.js
+++ b/projects/fwx/index.js
@@ -1,60 +1,37 @@
-const { sumTokensExport } = require("../helper/unwrapLPs");
-const ADDRESSES = require("../helper/coreAssets.json");
-const VECTOR = require("../vector/vectorContracts.json");
+const { getLogs2 } = require('../helper/cache/getLogs')
+const { getConfig } = require('../helper/cache')
-const coreModuleProxy = "0xceE74C8c242047c85e6833633AbB7A4Cd8465757";
-const xliplessDex = "0x82E90fB94fd9a5C19Bf38648DD2C9639Bde67c74";
-
-const tokens = {
- USDC: {
- pool: "0x94732A5319e1feAcc7d08e08Fdc4C2c7f5123143",
- contractAddr: ADDRESSES.avax.USDC,
- },
- WAVAX: {
- pool: "0x7F91272ff1A0114743D2df95F5905F9613Fd92b3",
- contractAddr: ADDRESSES.avax.WAVAX,
- },
- SAVAX: {
- pool: "0xe57a4042eA63Df072B2cf6352F9779E4D2445A92",
- contractAddr: VECTOR.tokens.SAVAX.address,
- },
- WETH_e: {
- pool: "0xcc7BcEf73d2e57d80d0F42D41088dB2A4C1F9146",
- contractAddr: ADDRESSES.avax.WETH_e,
- },
- COQ: {
- pool: "0xc97d9B3971BfE1B8Ac8EA7f990Df721d8f695223",
- contractAddr: "0x420FcA0121DC28039145009570975747295f2329",
- },
- QI: {
- pool: "0xCfc3d8465cfde6747B8b94968e1893F6E5680045",
- contractAddr: "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5",
- },
- JOE: {
- pool: "0xCB4bd69524A1a398e2112Dc22593F18eD5B3eCD6",
- contractAddr: ADDRESSES.avax.JOE,
- },
- GMX: {
- pool: "0xDBbA61EE0770c99Adc9150c1C98cbd4DEA2F925A",
- contractAddr: "0x62edc0692BD897D2295872a9FFCac5425011c661",
- },
- PNG: {
- pool: "0x0599C838422Ed46681C41b563AAf179a24316F09",
- contractAddr: "0x60781C2586D68229fde47564546784ab3fACA982",
- },
-};
-
-let tokenAndOwners = [];
-for (const [symbol, token] of Object.entries(tokens)) {
- tokenAndOwners.push([token.contractAddr, token.pool]);
- tokenAndOwners.push([token.contractAddr, coreModuleProxy]);
- tokenAndOwners.push([token.contractAddr, xliplessDex]);
-}
+const xliplessDex = "0x82E90fB94fd9a5C19Bf38648DD2C9639Bde67c74"
module.exports = {
avax: {
- tvl: sumTokensExport({
- tokensAndOwners: tokenAndOwners,
- }),
+ tvl,
},
-};
+}
+
+async function tvl(api) {
+ const { assets } = await getConfig('fwx/'+api.chain, "https://app.fwx.finance/api/v2/assets?chain_id=43114")
+
+ let tokensAndOwners = [];
+ for (let i = 0; i < assets.length; i++) {
+ const asset = assets[i]
+ tokensAndOwners.push(
+ [asset.token_address, asset.pool_address],
+ [asset.token_address, asset.core_address],
+ [asset.token_address, xliplessDex],
+ );
+ }
+
+ const FACTORY_SUB_MODULE_PROXY = '0x54b048eB204B7CbBb469901fdb5BbfB80d0F0CD1'
+ const logs = await getLogs2({
+ api,
+ factory: FACTORY_SUB_MODULE_PROXY,
+ eventAbi: "event CreateMarket(address indexed creator, address core, address collateralPool, address collateralToken, address underlyingPool, address underlyingToken, bytes32 pairbytes)",
+ fromBlock: 46125548,
+ })
+ logs.forEach(i => {
+ tokensAndOwners.push([i.collateralToken, i.collateralPool])
+ tokensAndOwners.push([i.underlyingToken, i.underlyingPool])
+ })
+ return api.sumTokens({ tokensAndOwners })
+}
diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js
index ad6d12f9e2..a4f998796b 100644
--- a/projects/fx-Protocol/index.js
+++ b/projects/fx-Protocol/index.js
@@ -5,6 +5,7 @@ const treasuries = [
"0x781BA968d5cc0b40EB592D5c8a9a3A4000063885",
"0x38965311507D4E54973F81475a149c09376e241e",
"0x63Fe55B3fe3f74B42840788cFbe6229869590f83",
+ "0xdFac83173A96b06C5D6176638124d028269cfCd2"
];
module.exports = {
diff --git a/projects/fyde/index.js b/projects/fyde/index.js
index 2ed9adbc38..ca92d3c593 100644
--- a/projects/fyde/index.js
+++ b/projects/fyde/index.js
@@ -1,12 +1,14 @@
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;
async function tvl(api) {
const tokens = await api.fetchList({ lengthAbi: 'getAssetsListLength', itemAbi: 'assetsList', target: FYDE_CONTRACT })
const bals = await api.multiCall({ abi: 'function totalAssetAccounting(address) view returns (uint256)', calls: tokens, target: FYDE_CONTRACT })
- api.addTokens(tokens, bals)
// add restaking aggregator TVL
const amountStakedETH = await api.call({
@@ -16,10 +18,31 @@ async function tvl(api) {
});
api.add(WETH, amountStakedETH)
+
+ // add tokens deployed to yield module. Check which token from tokens is a yield-token, map to the underlying and
+ // add balances to TVL
+ const response = await api.multiCall({
+ target: ORACLE,
+ calls: tokens,
+ abi: 'function yieldTokenToToken(address) external view returns (address)',
+ })
+ const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens})
+
+ for (let i = 0; i < tokens.length; i++) {
+ if (response[i] !== ADDRESSES.null) {
+ const balance = bals[i] / 10 ** (decimals[i] - 18)
+ api.add(response[i], balance)
+ } 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. 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
}
diff --git a/projects/gammaswap-deltaswap/index.js b/projects/gammaswap-deltaswap/index.js
index 0a86883034..c59fd0ceab 100644
--- a/projects/gammaswap-deltaswap/index.js
+++ b/projects/gammaswap-deltaswap/index.js
@@ -3,4 +3,10 @@ module.exports = {
arbitrum: {
tvl: getUniTVL({ factory: "0xcb85e1222f715a81b8edaeb73b28182fa37cffa8", }),
},
+ base: {
+ tvl: getUniTVL({ factory: "0x9a9a171c69cc811dc6b59bb2f9990e34a22fc971", }),
+ },
+ ethereum: {
+ tvl: getUniTVL({ factory: "0x5fbe219e88f6c6f214ce6f5b1fcaa0294f31ae1b", }),
+ },
};
diff --git a/projects/gammaswap-v2/index.js b/projects/gammaswap-v2/index.js
index 4e50e9c1cb..c26d9dd113 100644
--- a/projects/gammaswap-v2/index.js
+++ b/projects/gammaswap-v2/index.js
@@ -12,6 +12,13 @@ const config = {
factories: [
{ factory: '0xfd513630f697a9c1731f196185fb9eba6eaac20b', fromBlock: 12475877 },
],
+ deltaswapFactory: '0x9a9a171c69cc811dc6b59bb2f9990e34a22fc971'
+ },
+ ethereum: {
+ factories: [
+ { factory: '0xfd513630f697a9c1731f196185fb9eba6eaac20b', fromBlock: 19961383 },
+ ],
+ deltaswapFactory: '0x5fbe219e88f6c6f214ce6f5b1fcaa0294f31ae1b'
},
}
diff --git a/projects/garden/index.js b/projects/garden/index.js
new file mode 100644
index 0000000000..a5244db1cc
--- /dev/null
+++ b/projects/garden/index.js
@@ -0,0 +1,33 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+const { sumTokensExport } = require("../helper/sumTokens");
+const sdk = require("@defillama/sdk");
+
+const SEED_TOKEN_ADDRESS = "0x86f65121804D2Cdbef79F9f072D4e0c2eEbABC08"; // SEED TOKEN (Garden's Governance Token) Address
+const STAKING_CONTRACT_ADDRESS = "0xe2239938Ce088148b3Ab398b2b77Eedfcd9d1AfC";
+
+const BTC_LIQUIDITY_ADDRESS = "bc1qhww67feqfdf6xasjat88x5stqa6vzx0c6fgtnj";
+const WBTC_LIQUIDITY_ADDRESS = "0x9DD9C2D208B07Bf9A4eF9CA311F36d7185749635";
+
+module.exports = {
+ bitcoin: {
+ tvl: sdk.util.sumChainTvls([
+ sumTokensExport({ owners: [BTC_LIQUIDITY_ADDRESS] }),
+ ]),
+ },
+ ethereum: {
+ tvl: sumTokensExport({
+ owners: [WBTC_LIQUIDITY_ADDRESS],
+ tokens: [ADDRESSES.ethereum.WBTC],
+ }),
+ },
+ arbitrum: {
+ tvl: sumTokensExport({
+ owners: [WBTC_LIQUIDITY_ADDRESS],
+ tokens: [ADDRESSES.arbitrum.WBTC],
+ }),
+ staking: sumTokensExport({
+ owners: [STAKING_CONTRACT_ADDRESS],
+ tokens: [SEED_TOKEN_ADDRESS],
+ }),
+ },
+};
diff --git a/projects/gardensdao/index.js b/projects/gardensdao/index.js
index 2c27b67ad8..d9261a3f90 100644
--- a/projects/gardensdao/index.js
+++ b/projects/gardensdao/index.js
@@ -1,18 +1,9 @@
-const { request, gql } = require("graphql-request");
-const sdk = require('@defillama/sdk')
+const SUBGRAPH_GARDENS_XDAI = "G4EbcSW588SUy8CdprPPxCN69VN8mxvnwt4oyR6YpGza";
+const { cachedGraphQuery } = require('../helper/cache')
-const SUBGRAPH_HONEYSWAP_V2 =
- "https://api.thegraph.com/subgraphs/name/1hive/honeyswap-v2";
-const SUBGRAPH_GARDENS_XDAI =
- "https://api.thegraph.com/subgraphs/name/1hive/gardens-xdai";
-
-
-const balanceAbi = 'function balance(address _token) view returns (uint256)'
-
-
-const ALL_ORGS_GQL = gql`
- query allOrgs($lastID: ID) {
- organizations(first: 1000, where: { id_gt: $lastID, active: true }) {
+const ALL_ORGS_GQL = `
+ query allOrgs($lastId: ID) {
+ organizations(first: 1000, where: { id_gt: $lastId, active: true }) {
id
token {
name
@@ -31,100 +22,22 @@ const ALL_ORGS_GQL = gql`
active
}
}
-`;
-
-const ALL_TOKEN_PRICE_QUERY = gql`
- query pricesTokens($tokenAddress: [ID]) {
- tokens(where: { id_in: $tokenAddress }) {
- id
- derivedETH
- tradeVolume
- tradeVolumeUSD
- untrackedVolumeUSD
- totalLiquidity
- }
- }
-`;
-
-async function getAllOrgs() {
- let allFound = false;
- let lastID = "";
- let data = [];
-
- while (!allFound) {
- const orgs = await request(
- SUBGRAPH_GARDENS_XDAI,
- ALL_ORGS_GQL,
- { lastID }
- );
-
- const numOrgs = orgs.organizations.length;
-
- if (numOrgs < 1000) {
- allFound = true;
- }
- lastID = orgs.organizations[numOrgs - 1].id;
- data = data.concat(orgs.organizations);
- }
- return data;
-}
-
-const chain = 'xdai'
-
-async function tvl(timestamp, _block, { xdai: block }) {
- const balances = {};
-
- const orgs = await getAllOrgs()
- const calls = orgs.map(org => {
- return { params: org.config.conviction?.requestToken.id, target: org.config.conviction?.fundsManager, }
- }).filter(i => i.params && i.target)
-
- const { output } = await sdk.api.abi.multiCall({
- abi: balanceAbi,
- calls, chain, block,
- permitFailure: true,
- })
-
- output.forEach(({ input, output }) => {
- if (output) sdk.util.sumSingleBalance(balances, input.params[0].toLowerCase(), output)
- })
-
- const tokens = Object.keys(balances)
- const calls2 = tokens.map(i => ({ target: i }))
-
- const { output: decimals } = await sdk.api.abi.multiCall({
- abi: 'erc20:decimals',
- calls: calls2,
- chain, block,
+`
+
+async function tvl(api) {
+ const orgs = await cachedGraphQuery('gardensdao', SUBGRAPH_GARDENS_XDAI, ALL_ORGS_GQL, { fetchById: true})
+ const toa = []
+ orgs.forEach(({config: { conviction } = {}} = {}) => {
+ const token = conviction?.requestToken.id
+ const owner = conviction?.fundsManager
+ if (token && owner)
+ toa.push([token, owner])
})
+ return api.sumTokens({ tokensAndOwners: toa })
- decimals.forEach(({ input: { target: token }, output: decimal }) => {
- balances[token] /= 10 ** +decimal
- })
-
- const tokenPrices = await request(
- SUBGRAPH_HONEYSWAP_V2,
- ALL_TOKEN_PRICE_QUERY,
- { tokenAddress: tokens }
- )
-
- let tvl = 0
-
- tokenPrices.tokens.forEach(({ id, totalLiquidity, derivedETH }) => {
- if (+totalLiquidity < 1e4 || !balances[id] || !derivedETH) // if liquidity is below 10k or token not found or price is missing, ignore and move on
- return;
- tvl += +balances[id] * +derivedETH
- })
-
- return {
- tether: tvl
- }
}
module.exports = {
- methodology:
- '"Uses Gardens and Honeyswap Subgraph to finds USD value of Common Pool treasuries for tokens with greater than $10k of liquidity on Honeyswap"',
- misrepresentedTokens: true,
xdai: {
tvl,
},
diff --git a/projects/gasturbo-io-dex/index.js b/projects/gasturbo-io-dex/index.js
new file mode 100644
index 0000000000..8181f05a11
--- /dev/null
+++ b/projects/gasturbo-io-dex/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require('../helper/unknownTokens')
+
+module.exports = uniTvlExport('arbitrum', '0x7e299DdF7E12663570dBfA8F3F20CB54f8fD04fA')
\ No newline at end of file
diff --git a/projects/gdl/index.js b/projects/gdl/index.js
index faa400e3dc..144466efc0 100644
--- a/projects/gdl/index.js
+++ b/projects/gdl/index.js
@@ -40,9 +40,9 @@ async function poolBalance(owner, targets, block) {
async function tvl(timestamp, ethereumBlock, chainBlocks) {
const block = chainBlocks['avax'];
let balances = {};
- balances['tether'] = await poolBalance(GDL_USD_POOL, [USDT, zUSDT], block);
- balances['dai'] = await poolBalance(GDL_DAI_POOL, [DAI, zDAI], block);
- balances['ethereum'] = await poolBalance(GDL_ETH_POOL, [ETH, zETH], block);
+ balances['tether'] = await poolBalance(GDL_USD_POOL, [USDT], block);
+ balances['dai'] = await poolBalance(GDL_DAI_POOL, [DAI], block);
+ balances['ethereum'] = await poolBalance(GDL_ETH_POOL, [ETH], block);
balances['gondola-finance'] = await poolBalance(GDL_POOL, [GDL], block);
return balances;
}
diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js
index 6ffe93e7c1..c524bc3bd5 100644
--- a/projects/gearbox/index.js
+++ b/projects/gearbox/index.js
@@ -3,7 +3,7 @@
**
**
** This file has been generated from source code in https://github.com/Gearbox-protocol/defillama repo
- ** Binary release: https://github.com/Gearbox-protocol/defillama/releases/tag/v1.3.1
+ ** Binary release: https://github.com/Gearbox-protocol/defillama/releases/tag/v1.3.2
**
**
**
@@ -144,7 +144,6 @@ async function getV1CAs(creditManager, block, api) {
const topics = [];
cm.interface.forEachEvent((e) => topics.push(e.topicHash));
const rawLogs = await getLogs.getLogs({
- skipCache: true,
target: creditManager,
fromBlock: 13854983,
toBlock: block,
@@ -356,6 +355,11 @@ var v3Abis = {
"function getCreditManagersV3List() view returns (tuple(address addr, string name, uint256 cfVersion, address creditFacade, address creditConfigurator, address underlying, address pool, uint256 totalDebt, uint256 totalDebtLimit, uint256 baseBorrowRate, uint256 minDebt, uint256 maxDebt, uint256 availableToBorrow, address[] collateralTokens, tuple(address targetContract, address adapter)[] adapters, uint256[] liquidationThresholds, bool isDegenMode, address degenNFT, uint256 forbiddenTokenMask, uint8 maxEnabledTokensLength, uint16 feeInterest, uint16 feeLiquidation, uint16 liquidationDiscount, uint16 feeLiquidationExpired, uint16 liquidationDiscountExpired, tuple(address token, uint16 rate, uint16 quotaIncreaseFee, uint96 totalQuoted, uint96 limit, bool isActive)[] quotas, tuple(address interestModel, uint256 version, uint16 U_1, uint16 U_2, uint16 R_base, uint16 R_slope1, uint16 R_slope2, uint16 R_slope3, bool isBorrowingMoreU2Forbidden) lirm, bool isPaused)[])",
getCreditAccountsByCreditManager:
"function getCreditAccountsByCreditManager(address creditManager, (address token, bytes callData)[] priceUpdates) returns ((bool isSuccessful, address[] priceFeedsNeeded, address addr, address borrower, address creditManager, string cmName, address creditFacade, address underlying, uint256 debt, uint256 cumulativeIndexLastUpdate, uint128 cumulativeQuotaInterest, uint256 accruedInterest, uint256 accruedFees, uint256 totalDebtUSD, uint256 totalValue, uint256 totalValueUSD, uint256 twvUSD, uint256 enabledTokensMask, uint256 healthFactor, uint256 baseBorrowRate, uint256 aggregatedBorrowRate, (address token, uint256 balance, bool isForbidden, bool isEnabled, bool isQuoted, uint256 quota, uint16 quotaRate, uint256 quotaCumulativeIndexLU)[] balances, uint64 since, uint256 cfVersion, uint40 expirationDate, address[] activeBots)[])",
+ creditAccounts: "function creditAccounts() view returns (address[])",
+ collateralTokensCount:
+ "function collateralTokensCount() view returns (uint8)",
+ getTokenByMask:
+ "function getTokenByMask(uint256 tokenMask) view returns (address token)",
};
// src/adapter/v3/index.ts
@@ -386,22 +390,65 @@ async function getCreditManagersV3(dc300, block, api) {
});
}
async function getV3CAs(dc300, creditManager, block, api) {
+ try {
+ const accs = await api.call({
+ // IDataCompressorV3_00__factory.createInterface().getFunction("getCreditAccountsByCreditManager").format(ethers.utils.FormatTypes.full)
+ target: dc300,
+ abi: v3Abis["getCreditAccountsByCreditManager"],
+ params: [creditManager, []],
+ block,
+ });
+ const result = [];
+ for (const acc of accs) {
+ for (const { balance, token } of acc.balances) {
+ if (balance !== "0" && balance !== "1") {
+ result.push({
+ addr: acc.addr,
+ bal: balance,
+ token,
+ });
+ }
+ }
+ }
+ return result;
+ } catch (e) {
+ return getV3CAsWithoutCompressor(creditManager, block, api);
+ }
+}
+async function getV3CAsWithoutCompressor(creditManager, block, api) {
const accs = await api.call({
- // IDataCompressorV3_00__factory.createInterface().getFunction("getCreditAccountsByCreditManager").format(ethers.utils.FormatTypes.full)
- target: dc300,
- abi: v3Abis["getCreditAccountsByCreditManager"],
- params: [creditManager, []],
+ target: creditManager,
+ abi: v3Abis["creditAccounts"],
+ params: [],
+ block,
+ });
+ const collateralTokensCount = await api.call({
+ target: creditManager,
+ abi: v3Abis["collateralTokensCount"],
+ });
+ const bitMasks = [];
+ for (let i = 0; i < collateralTokensCount; i++) {
+ bitMasks.push(1 << i);
+ }
+ const collateralTokens = await api.multiCall({
+ abi: v3Abis["getTokenByMask"],
+ calls: bitMasks.map((bm) => ({
+ target: creditManager,
+ params: [bm],
+ })),
block,
});
const result = [];
- for (const acc of accs) {
- for (const { balance, token } of acc.balances) {
- if (balance !== "0" && balance !== "1") {
- result.push({
- addr: acc.addr,
- bal: balance,
- token,
- });
+ for (const token of collateralTokens) {
+ const balances = await api.multiCall({
+ abi: "erc20:balanceOf",
+ calls: accs.map((owner) => ({ target: token, params: [owner] })),
+ permitFailure: true,
+ });
+ for (let i = 0; i < balances.length; i++) {
+ const bal = balances[i];
+ if (bal) {
+ result.push({ token, addr: accs[i], bal });
}
}
}
diff --git a/projects/genesis-lrt/index.js b/projects/genesis-lrt/index.js
index e9ad2da809..9f7799cc39 100644
--- a/projects/genesis-lrt/index.js
+++ b/projects/genesis-lrt/index.js
@@ -1,7 +1,6 @@
const ADDRESSES = require('../helper/coreAssets.json')
async function tvl(api) {
- if (api.timestamp > 1715181240) return {}
const staked = await api.call({ abi: 'uint256:totalAssets', target: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C' })
api.add(ADDRESSES.null, staked)
}
@@ -11,5 +10,5 @@ module.exports = {
[1714953600,"Genesis Merges with InceptionLRT"]
],
doublecounted: true,
- ethereum: { tvl, },
-}
\ No newline at end of file
+ ethereum: { tvl: tvl, }
+}
diff --git a/projects/glyph-fi/index.js b/projects/glyph-fi/index.js
new file mode 100644
index 0000000000..8f2617e94e
--- /dev/null
+++ b/projects/glyph-fi/index.js
@@ -0,0 +1,5 @@
+const { aaveExports } = require('../helper/aave')
+
+module.exports = {
+ fraxtal: aaveExports("fraxtal", "0xcD0c5BA79018F37898A58eF56d197828d84f36Ad"),
+}
\ No newline at end of file
diff --git a/projects/glyph-v4/index.js b/projects/glyph-v4/index.js
new file mode 100644
index 0000000000..1313cce073
--- /dev/null
+++ b/projects/glyph-v4/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ core: { factory: '0x74EfE55beA4988e7D92D03EFd8ddB8BF8b7bD597', fromBlock: 15770796, isAlgebra: true },
+})
\ No newline at end of file
diff --git a/projects/goblingold.js b/projects/goblingold.js
index c08b150956..09d5b1905a 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/goldlink/index.js b/projects/goldlink/index.js
new file mode 100755
index 0000000000..d698d4a491
--- /dev/null
+++ b/projects/goldlink/index.js
@@ -0,0 +1,10 @@
+const { sumERC4626VaultsExport } = require('../helper/erc4626')
+
+module.exports = {
+ methodology: 'Delta neutral farming in GMX Vault',
+ start: 1716638498,
+ doublecounted: true,
+ arbitrum: {
+ tvl: sumERC4626VaultsExport({ vaults: ['0xd8dd54df1a7d2ea022b983756d8a481eea2a382a',], isOG4626: true, }),
+ },
+}
\ No newline at end of file
diff --git a/projects/grace/index.js b/projects/grace/index.js
new file mode 100644
index 0000000000..49c598bd59
--- /dev/null
+++ b/projects/grace/index.js
@@ -0,0 +1,30 @@
+const CORE_CONTRACTS = {
+ base:'0x1522ad0a3250eb0f64e0acfe090ca40949330cc1',
+ ethereum:'0x164dd1f4174020642967bea521e56fc776742b49'
+}
+
+async function tvl(api) {
+ const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACTS[api.chain] })
+ const collaterals = await api.fetchList({ lengthAbi: 'collateralCount', itemAbi: 'collateralList', target: CORE_CONTRACTS[api.chain] })
+ const poolUnderlyings = await api.multiCall({ abi: 'address:asset', calls: pools })
+ const collateralUnderlyings = await api.multiCall({ abi: 'address:asset', calls: collaterals })
+ return api.sumTokens({ tokensAndOwners2: [[...poolUnderlyings, ...collateralUnderlyings], [...pools, ...collaterals]] })
+}
+
+async function borrowed(api) {
+ const pools = await api.fetchList({ lengthAbi: 'poolCount', itemAbi: 'poolList', target: CORE_CONTRACTS[api.chain] })
+ const poolUnderlyings = await api.multiCall({ abi: 'address:asset', calls: pools })
+ const borrowed = await api.multiCall({ abi: 'uint256:totalDebt', calls: pools })
+ api.add(poolUnderlyings, borrowed)
+}
+
+module.exports = {
+ methodology: 'Fetches the list of pools and collaterals from the Core and sums up their balances',
+ start: 14684731,
+ base: {
+ tvl, borrowed
+ },
+ ethereum: {
+ tvl, borrowed
+ },
+};
\ No newline at end of file
diff --git a/projects/gudchain/index.js b/projects/gudchain/index.js
new file mode 100644
index 0000000000..3d6d22fec1
--- /dev/null
+++ b/projects/gudchain/index.js
@@ -0,0 +1,22 @@
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const launchBridge = "0xd759e176DEF0F14e5C2D300238d41b1CBB5585BF";
+
+module.exports = {
+ ethereum: {
+ tvl: sumTokensExport({
+ owner: launchBridge,
+ start: 20203960,
+ tokens: [
+ "0x0000000000000000000000000000000000000000",
+ "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84",
+ "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
+ "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa",
+ "0x6B175474E89094C44Da98b954EedeAC495271d0F",
+ "0x83F20F44975D03b1b09e64809B757c47f942BEeA",
+ "0xdAC17F958D2ee523a2206206994597C13D831ec7",
+ "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
+ ]
+ })
+ }
+};
diff --git a/projects/gullnetwork-amm/index.js b/projects/gullnetwork-amm/index.js
new file mode 100644
index 0000000000..441fa41b47
--- /dev/null
+++ b/projects/gullnetwork-amm/index.js
@@ -0,0 +1,6 @@
+const { getUniTVL } = require('../helper/unknownTokens')
+
+module.exports = {
+ misrepresentedTokens: true,
+ manta: { tvl: getUniTVL({ factory: '0x31a78894a2B5dE2C4244cD41595CD0050a906Db3', useDefaultCoreAssets: true, }) }
+}
\ No newline at end of file
diff --git a/projects/gullnetwork/index.js b/projects/gullnetwork/index.js
index 7c2553ee15..b48859486b 100644
--- a/projects/gullnetwork/index.js
+++ b/projects/gullnetwork/index.js
@@ -1,21 +1,40 @@
+const FACTORY_SINGLETON_ADDR = '0xFc6387f581d2A827F183A9ea68f07063F99744dE'
-const FACTORY_SINGLETON_ADDR = '0xFc6387f581d2A827F183A9ea68f07063F99744dE';
+const getStakingVaultTvl = async (api, stakingVaultFactory) => {
+ if (!stakingVaultFactory) return
+ const vaults = await api.fetchList({ lengthAbi: 'length', itemAbi: 'stakingVaults', target: stakingVaultFactory })
+ const stakedTokens = await api.multiCall({ calls: vaults, abi: 'address:stakedToken' })
+ await api.sumTokens({ tokensAndOwners2: [stakedTokens, vaults] })
+}
+
+const getRewardTvl = async (api, rewardFactory) => {
+ if (!rewardFactory) return
+ const stakeRewarders = await api.fetchList({ lengthAbi: 'uint:stakeRewarderLength', itemAbi: 'stakeRewarders', target: rewardFactory })
+ const tokensAndOwners = []
+ await Promise.all(stakeRewarders.map(async (stakeRewarder) => {
+ const rewardTokens_ = await api.fetchList({ lengthAbi: 'rewardLength', itemAbi: 'rewardTokens', target: stakeRewarder })
+ tokensAndOwners.push(...rewardTokens_.map(token => [token, stakeRewarder]))
+ }))
+ await api.sumTokens({ tokensAndOwners })
+}
const tvl = async (api) => {
- const vaults = await api.fetchList({ lengthAbi: 'length', itemAbi: 'stakingVaults', target: FACTORY_SINGLETON_ADDR })
- const stakedTokens = await api.multiCall({ calls: vaults, abi: 'address:stakedToken', })
- return api.sumTokens({ tokensAndOwners2: [stakedTokens, vaults] });
+ const { stakingVaultFactory = FACTORY_SINGLETON_ADDR, rewardFactory } = config[api.chain]
+ await getStakingVaultTvl(api, stakingVaultFactory)
+ await getRewardTvl(api, rewardFactory)
}
module.exports = {
start: 1710844331, // May-17-2024 12:45:31 PM +UTC
- methodology: 'GullNetwork TVL including total values of assets staked in our staking vaults.',
+ methodology: 'GullNetwork TVL including total values of assets staked in our staking vaults, and assets in the liquidity pool.',
}
const config = {
ethereum: {},
bsc: {},
- manta: {},
+ manta: {
+ rewardFactory: '0x2a18164B5e84d9C1B03ddbb5A1982A35cF75E506'
+ },
base: {},
}
diff --git a/projects/gyroscope/index.js b/projects/gyroscope/index.js
index fa3a803dc3..39e7a22c3d 100644
--- a/projects/gyroscope/index.js
+++ b/projects/gyroscope/index.js
@@ -93,6 +93,13 @@ const config = {
fromBlock: 5147666,
},
],
+ xdai: [
+ {
+ name: "Gyro E-CLP V2 Factory",
+ factory: "0x5d3Be8aaE57bf0D1986Ff7766cC9607B6cC99b89",
+ fromBlock: 33759936,
+ },
+ ],
};
Object.keys(config).forEach((chain) => {
diff --git a/projects/hana-finance/index.js b/projects/hana-finance/index.js
new file mode 100644
index 0000000000..fb9a3b73d3
--- /dev/null
+++ b/projects/hana-finance/index.js
@@ -0,0 +1,16 @@
+const { aaveExports } = require("../helper/aave");
+
+const config = {
+ taiko: {
+ "addressProviderRegistry": "0x47EC2cEF8468dbaC060410E2BDde35A3B8f725e5",
+ "poolDataProvider":"0x9E3D95b518f68349464da1b6dbd0B94DB59addc1",
+ }
+};
+
+const data = {};
+Object.keys(config).forEach((chain) => {
+ data[chain] = aaveExports(chain, config[chain]["addressProviderRegistry"], undefined, [config[chain]["poolDataProvider"]]);
+});
+
+
+module.exports = data;
\ No newline at end of file
diff --git a/projects/harmonix/index.js b/projects/harmonix/index.js
new file mode 100644
index 0000000000..f0a7bb5b75
--- /dev/null
+++ b/projects/harmonix/index.js
@@ -0,0 +1,21 @@
+module.exports = {
+ misrepresentedTokens: true,
+ start: 1709251200, // Friday, March 1, 2024 12:00:00 AM
+ methodology: "Aggregates total value of each Harmonix vault"
+}
+
+const config = {
+ arbitrum: "0x7274463BF93E0058481042Cbd6e0cc73042E6285",
+ ethereum: "0xC7C8Cdd1E9817Fc98AD1b05cD3633c6471A9473b",
+ base: "0x45dC73fB760f2382Cfd11e28C0Dd0a3A8d3E4C31",
+}
+
+Object.keys(config).forEach(chain => {
+ const factory = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const bal = await api.call({ abi: 'uint256:getVaultsTVL', target: factory })
+ api.addCGToken("tether", bal/1e6)
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/hashkey-exchange/index.js b/projects/hashkey-exchange/index.js
new file mode 100644
index 0000000000..2786278e13
--- /dev/null
+++ b/projects/hashkey-exchange/index.js
@@ -0,0 +1,40 @@
+const { cexExports } = require("../helper/cex");
+
+const config = {
+ avax: {
+ owners: [
+ "0xb016ebc8a1440aff7bf098b8f165af65eb898738",
+ "0xa108b99c315c22673f7f5b5ca172a21628cf8334",
+ ],
+ },
+ bitcoin: {
+ owners: [
+ "bc1qqe394jlqq86muq23d4vrnhzzvcv8jnepgt8lx7",
+ "1NfJSiqBw4fb74KgVQrPsk5W5aqitAD1Xv",
+ // "bc1qlrawqecuwgpzzwh04pkhtfsqsk33kald22ds3c", // bosera funds https://www.bosera.com/english/index.html
+ "18oxobhCNKnHjb7nEFDmPdXbCZthFWezrm",
+ ],
+ },
+ ethereum: {
+ owners: [
+ "0x7ffbafdc1e4f0a4b97130b075fb4a25f807a1807", //cold
+ "0xffe15ff598e719d29dfe5e1d60be1a5521a779ae",
+ // "0x7269bc4a66c755b951f068626201090f0c3098e9", // bosera funds https://www.bosera.com/english/index.html
+ "0x48ee4a557e291c2a48d227e8a8dbe2217a825682",
+ ],
+ },
+ litecoin: {
+ owners: [
+ "ltc1qh6w8epz4ycm2smpmnhfauqach28qr4ge6jffyv",
+ "LSNjwQ1RGR5rbVDzCwrWiMQF8rdqVRGcPu",
+ ],
+ },
+ polygon: {
+ owners: [
+ "0xecd094b51bafbd7bffdf1f4fef067c5d197a1b75",
+ "0xee4f6df29617f00b12f85ee56c68962cbeac16aa",
+ ],
+ },
+};
+
+module.exports = cexExports(config);
diff --git a/projects/hashkey/index.js b/projects/hashkey/index.js
new file mode 100644
index 0000000000..5694e7c5e0
--- /dev/null
+++ b/projects/hashkey/index.js
@@ -0,0 +1,46 @@
+const { cexExports } = require('../helper/cex')
+
+const config = {
+ ethereum: {
+ owners: [
+ "0x5569fd6991d1802dbee9bdd67e763fe7be67c7a9",
+ "0xcBEA7739929cc6A2B4e46A1F6D26841D8d668b9E"
+ ],
+ },
+ bitcoin: {
+ owners: [
+ "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h",
+ "1DywJMqHHMWuP7xyfkRqJZCEe7GdEKFRcp"
+ ],
+ },
+ litecoin: {
+ owners: [
+ "ltc1qzjsgswkenmy9v6vm2jvkddeczwfuy9q7rshtxh",
+ "LXeSRVh6WPan3u5AxEZkvvn1srKnN5BiAm"
+ ],
+ },
+ optimism: {
+ owners: [
+ "0x5691a157ce38f1b362ab4a686ec7616fb04ba6f1",
+ "0xC7556Bb9EB188888b1cce25c3587C36Be0809EC4"
+ ],
+ },
+ arbitrum: {
+ owners: [
+ "0x03248f4759Ef5c4FdDd959aa07a5294e00B03e44",
+ "0x25a58cee7928b3d6c1d392ebe1a97318aa5ff2f2"
+ ],
+ },
+ avax: {
+ owners: [
+ "0x9bc72c8bb18d27bad9d0936be5d5e68fe2d37a29",
+ ],
+ },
+ polygon: {
+ owners: [
+ "0xAa0400E5a90f697230638DbE76D9C49e4aC745B4",
+ ],
+ },
+}
+
+module.exports = cexExports(config)
diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js
index 14518e17f3..a780961f14 100644
--- a/projects/helio-money/index.js
+++ b/projects/helio-money/index.js
@@ -2,7 +2,7 @@ const ADDRESSES = require("../helper/coreAssets.json");
const { sumTokensExport } = require("../helper/unknownTokens");
module.exports = {
- methodology: "count the amount of ankr BNB in the vault",
+ methodology: "The TVL is calculated by summing the values of tokens held in the specified vault addresses",
hallmarks: [
[1669939200, "aBNBc exploit"],
//[1670544000,"aBNBc to AnkrBNB swap & HAY buyback"]
@@ -42,22 +42,22 @@ module.exports = {
// BTCB
[
- "0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",
+ ADDRESSES.bsc.BTCB,
"0xad9eAAe95617c39019aCC42301a1dCa4ea5b6f65",
],
// ezETH
[
- "0x2416092f143378750bb29b79ed961ab195cceea5",
+ ADDRESSES.blast.ezETH,
"0xd7E33948e2a43e7C1ec2F19937bf5bf8BbF9BaE8",
],
// weETH
[
- "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A",
+ ADDRESSES.blast.weETH,
"0x2367f2Da6fd39De6944218CC9EC706BCdc9a6918",
],
// STONE
[
- "0x80137510979822322193fc997d400d5a6c747bf7",
+ ADDRESSES.scroll.STONE,
"0x876cd9a380Ee7712129b52f8293F6f06056c3104",
],
],
diff --git a/projects/helper/balancer.js b/projects/helper/balancer.js
index e8f6beeade..8ab6be241d 100644
--- a/projects/helper/balancer.js
+++ b/projects/helper/balancer.js
@@ -1,7 +1,7 @@
const { sumTokens2 } = require('./unwrapLPs');
const { getLogs } = require('./cache/getLogs')
-function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache } = {}) {
+function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache, permitFailure } = {}) {
return async (api) => {
const logs = await getLogs({
api,
@@ -29,7 +29,7 @@ function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [
const pools = logs.map(i => i.poolAddress)
blacklistedTokens = [...blacklistedTokens, ...pools]
- return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, })
+ return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, permitFailure })
}
}
diff --git a/projects/helper/cache.js b/projects/helper/cache.js
index 2af57d6be6..3563714604 100644
--- a/projects/helper/cache.js
+++ b/projects/helper/cache.js
@@ -106,6 +106,7 @@ async function configPost(project, endpoint, data) {
async function cachedGraphQuery(project, endpoint, query, { api, useBlock = false, variables = {}, fetchById, safeBlockLimit, } = {}) {
if (!project || !endpoint) throw new Error('Missing parameters')
+ endpoint = sdk.graph.modifyEndpoint(endpoint)
const key = 'config-cache'
const cacheKey = getKey(key, project)
if (!configCache[cacheKey]) configCache[cacheKey] = _cachedGraphQuery()
@@ -137,6 +138,7 @@ async function cachedGraphQuery(project, endpoint, query, { api, useBlock = fals
async function graphFetchById({ endpoint, query, params = {}, api, options: { useBlock = false, safeBlockLimit = 500 } = {} }) {
if (useBlock && !params.block)
params.block = await api.getBlock() - safeBlockLimit
+ endpoint = sdk.graph.modifyEndpoint(endpoint)
let data = []
let lastId = ""
diff --git a/projects/helper/cache/sumUnknownTokens.js b/projects/helper/cache/sumUnknownTokens.js
index c3cdbfcdce..e494f6871c 100644
--- a/projects/helper/cache/sumUnknownTokens.js
+++ b/projects/helper/cache/sumUnknownTokens.js
@@ -365,6 +365,7 @@ async function getTokenPrices({
async function sumUnknownTokens({ api, tokensAndOwners = [], balances,
coreAssets = [], owner, tokens, chain = 'ethereum', block, restrictTokenRatio, blacklist = [], skipConversion = false, onlyLPs, minLPRatio,
log_coreAssetPrices = [], log_minTokenValue = 1e6, owners = [], lps = [], useDefaultCoreAssets = false, cache = {}, resolveLP = false, abis,
+ ownerTokens = [],
}) {
if (api) {
chain = api.chain ?? chain
@@ -381,6 +382,8 @@ async function sumUnknownTokens({ api, tokensAndOwners = [], balances,
tokensAndOwners = owners.map(o => tokens.map(t => [t, o])).flat()
else if (owner)
tokensAndOwners = tokens.map(t => [t, owner])
+ else if (ownerTokens.length)
+ ownerTokens.forEach(([tokens, owner]) => tokens.forEach(i => tokensAndOwners.push([i, owner])))
tokensAndOwners = tokensAndOwners.filter(t => !blacklist.includes(t[0]))
await sumTokens2({ api, balances, chain, block, tokensAndOwners, skipFixBalances: true, resolveLP, abis })
const { updateBalances, } = await getTokenPrices({ cache, coreAssets, lps: [...tokensAndOwners.map(t => t[0]), ...lps,], chain, block, restrictTokenRatio, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio, abis, })
diff --git a/projects/helper/cache/uniswap.js b/projects/helper/cache/uniswap.js
index fb804fa65e..b2edf4eff7 100644
--- a/projects/helper/cache/uniswap.js
+++ b/projects/helper/cache/uniswap.js
@@ -29,8 +29,7 @@ function getUniTVL({ coreAssets, blacklist = [], factory, blacklistedTokens,
let chain = api?.chain
if (!chain)
chain = _chain
- // const supply = await api.call({ abi: 'erc20:totalSupply', target: ADDRESSES.area.WAREA })
- // console.log(await sdk.api.eth.getBalance({ target: ADDRESSES.area.WAREA, chain: api.chain }), supply)
+ // console.log(await api.call({ target: factory, abi: 'address:factory' }))
factory = normalizeAddress(factory, chain)
blacklist = (blacklistedTokens || blacklist).map(i => normalizeAddress(i, chain))
const key = `${factory}-${chain}`
diff --git a/projects/helper/cex.js b/projects/helper/cex.js
index 81bd5add7d..3c4210a714 100644
--- a/projects/helper/cex.js
+++ b/projects/helper/cex.js
@@ -106,6 +106,9 @@ const defaultTokens = {
'0x3a856d4effa670c54585a5d523e96513e148e95d', //trias
'0x1495bc9e44af1f8bcb62278d2bec4540cf0c05ea', //deia
'0x4cff49d0a19ed6ff845a9122fa912abcfb1f68a6', //wtk
+ "0x23878914efe38d27c4d67ab83ed1b93a74d4086a", //aEthUSDT
+ "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", // aEthWETH
+ "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c", // aEthUSDC
],
tron: [
nullAddress,
@@ -169,6 +172,7 @@ const defaultTokens = {
'0xfe1d7f7a8f0bda6e415593a2e4f82c64b446d404', //blp
'0xe9d78bf51ae04c7e1263a76ed89a65537b9ca903', // GMEX
'0x59769630b236398c2471eb26e6a529448030d94f', //NKYC nonkyc exchange token
+ '0xbf5140a22578168fd562dccf235e5d43a02ce9b1', // UNI
],
eos: [
["eosio.token", "EOS", "eos"],
@@ -241,6 +245,13 @@ const defaultTokens = {
ADDRESSES.cronos.WBTC,
"0xe44fd7fcb2b1581822d0c862b68222998a0c299a" //weth
],
+ ton: [
+ nullAddress,
+ ADDRESSES.ton.USDT,
+ ADDRESSES.ton.TON_1,
+ ADDRESSES.ton.TON_2,
+ ADDRESSES.ton.TON_3,
+ ],
}
function cexExports(config) {
@@ -251,7 +262,7 @@ function cexExports(config) {
chains.forEach(chain => {
let { tokensAndOwners, owners, tokens, blacklistedTokens, } = config[chain]
- if (!tokensAndOwners && !tokens) {
+ if (!tokensAndOwners && !tokens && chain !== 'solana') {
tokens = defaultTokens[chain]
if (!tokens) {
// log(chain, 'Missing default token list, counting only native token balance',)
diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js
index f59755bd1b..9a36d84581 100644
--- a/projects/helper/chain/algorand.js
+++ b/projects/helper/chain/algorand.js
@@ -159,6 +159,7 @@ const tokens = {
gard: 684649988,
gold$: 246516580,
silver$: 246519683,
+ ASAGold: 1241944285
};
// store all asset ids as string
diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js
index c7b392745c..fda290201e 100644
--- a/projects/helper/chain/cosmos.js
+++ b/projects/helper/chain/cosmos.js
@@ -41,7 +41,8 @@ const endPoints = {
sifchain: "https://sifchain-api.polkachu.com",
nolus: "https://pirin-cl.nolus.network:1317",
nibiru: "https://lcd.nibiru.fi",
- bostrom: "https://lcd.bostrom.cybernode.ai"
+ bostrom: "https://lcd.bostrom.cybernode.ai",
+ joltify: "https://lcd.joltify.io"
};
const chainSubpaths = {
@@ -50,6 +51,7 @@ const chainSubpaths = {
comdex: "comdex",
umee: "umee",
kava: "kava",
+ joltify: "joltify",
};
// some contract calls need endpoint with higher gas limit
diff --git a/projects/helper/chain/massa.js b/projects/helper/chain/massa.js
new file mode 100644
index 0000000000..fb514c5ff2
--- /dev/null
+++ b/projects/helper/chain/massa.js
@@ -0,0 +1,106 @@
+const axios = require("axios");
+
+// https://github.com/massalabs/massa-web3/blob/main/packages/massa-web3/src/web3/PublicApiClient.ts
+const RPC_ENDPOINT = "https://mainnet.massa.net/api/v2";
+const client = axios.create({ baseURL: RPC_ENDPOINT });
+
+async function request(method, params) {
+ params.forEach((param) => {
+ if (param.key)
+ param.key = convertUnit8ArrayToNumberArray(param.key);
+ })
+
+ const response = await client.post("/", {
+ jsonrpc: "2.0",
+ method,
+ params: [params],
+ id: 1,
+ })
+
+ return response.data.result;
+
+ function convertUnit8ArrayToNumberArray(unit8Array) {
+ return Array.from(unit8Array, (byte) => byte)
+ }
+}
+
+function u8ArrayToString(array) {
+ let str = "";
+ for (const byte of array) {
+ str += String.fromCharCode(byte);
+ }
+ return str;
+}
+
+function strToBytes(str) {
+ if (!str.length) {
+ return new Uint8Array(0);
+ }
+ return new Uint8Array(Buffer.from(str, 'utf-8'));
+}
+
+
+/**
+ * Converts a Uint8Array into an unsigned 64-bit integer (u64) BigInt.
+ *
+ * @param arr - The array to convert
+ * @param offset - The optional offset in the Uint8Array at which to start reading the u64 value (default: 0)
+ *
+ * @returns The deserialized u64 BigInt value
+ *
+ */
+function bytesToU64(arr, offset = 0) {
+ if (!arr?.length) return '0'
+ arr = new Uint8Array(arr);
+ const view = new DataView(arr.buffer);
+ return view.getBigUint64(offset, true);
+}
+
+/**
+ * Converts a Uint8Array into an unsigned 256-bit integer (u256) BigInt.
+ *
+ * @param arr - The array to convert
+ * @param offset - The optional offset in the Uint8Array at which to start reading the u256 value (default: 0)
+ *
+ * @returns The deserialized u256BigInt value
+ *
+ */
+function bytesToU256(arr, offset = 0) {
+ if (!arr?.length) return '0'
+ arr = new Uint8Array(arr);
+ const view = new DataView(arr.buffer, offset);
+ const p0 = view.getBigUint64(0, true);
+ const p1 = view.getBigUint64(8, true);
+ const p2 = view.getBigUint64(16, true);
+ const p3 = view.getBigUint64(24, true);
+ return (p3 << 192n) | (p2 << 128n) | (p1 << 64n) | p0;
+}
+
+
+async function queryKey(addresses, key, transform = val => u8ArrayToString(val)) {
+ const res = await request('get_datastore_entries', addresses.map((address) => ({ address, key: strToBytes(key) })))
+ return res.map((entry) => transform(entry.candidate_value));
+}
+
+const bytesToBigInt = (bytes) => {
+ try {
+ return bytesToU256(bytes);
+ } catch (e) {
+ return bytesToU64(bytes);
+ }
+};
+
+async function getTokenBalances(tokenAddresses, ownerAddresses) {
+ const params = tokenAddresses.map((tokenAddress, i) => ({
+ address: tokenAddress,
+ key: strToBytes(`BALANCE${ownerAddresses[i]}`)
+ }))
+ const res = await request('get_datastore_entries', params)
+ return res.map((entry) => bytesToBigInt(entry.candidate_value).toString());
+}
+
+module.exports = {
+ queryKey,
+ u8ArrayToString,
+ getTokenBalances,
+};
\ No newline at end of file
diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js
index e688c0d2d8..01b1749635 100644
--- a/projects/helper/chain/sui.js
+++ b/projects/helper/chain/sui.js
@@ -4,7 +4,7 @@ const sdk = require('@defillama/sdk')
const http = require('../http')
const { getEnv } = require('../env')
const { transformDexBalances } = require('../portedTokens')
-const { sliceIntoChunks } = require('../utils')
+const { sliceIntoChunks, getUniqueAddresses } = require('../utils')
//https://docs.sui.io/sui-jsonrpc
@@ -20,13 +20,13 @@ async function getObject(objectId) {
async function queryEvents({ eventType, transform = i => i }) {
let filter = {}
- if (eventType) filter.MoveEventType = eventType
+ if (eventType) filter.MoveEventType = eventType
const items = []
let cursor = null
do {
- const { data , nextCursor, hasNextPage } = await call('suix_queryEvents', [filter, cursor], { withMetadata: true, })
- cursor = hasNextPage ? nextCursor : null
- items.push(...data)
+ const { data, nextCursor, hasNextPage } = await call('suix_queryEvents', [filter, cursor], { withMetadata: true, })
+ cursor = hasNextPage ? nextCursor : null
+ items.push(...data)
} while (cursor)
return items.map(i => i.parsedJson).map(transform)
}
@@ -70,11 +70,12 @@ async function getDynamicFieldObjects({ parent, cursor = null, limit = 48, items
return getDynamicFieldObjects({ parent, cursor: nextCursor, items, limit, idFilter, addedIds })
}
-async function call(method, params, { withMetadata = false} = {}) {
+async function call(method, params, { withMetadata = false } = {}) {
if (!Array.isArray(params)) params = [params]
const {
result
} = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method, params, })
+ if (['suix_getAllBalances'].includes(method)) return result
return withMetadata ? result : result.data
}
@@ -130,6 +131,14 @@ function dexExport({
}
}
+
+async function sumTokens({ balances = {}, owners = [], blacklistedTokens = [], tokens = [], api }) {
+ owners = getUniqueAddresses(owners, true)
+ const bals = await call('suix_getAllBalances', owners)
+ bals.forEach(i => api.add(i.coinType, i.totalBalance))
+ return api.getBalances()
+}
+
module.exports = {
endpoint: endpoint(),
call,
@@ -140,4 +149,5 @@ module.exports = {
getDynamicFieldObject,
getDynamicFieldObjects,
dexExport,
+ sumTokens,
};
diff --git a/projects/helper/chains.json b/projects/helper/chains.json
index 0b3671661b..e813d66cb9 100644
--- a/projects/helper/chains.json
+++ b/projects/helper/chains.json
@@ -1,6 +1,9 @@
[
"acala",
"ace",
+ "aelf",
+ "aeternity",
+ "ailayer",
"airdao",
"alephium",
"algorand",
@@ -100,6 +103,7 @@
"equilibrium",
"era",
"ergo",
+ "etlk",
"ethereum",
"ethereumclassic",
"ethf",
@@ -128,6 +132,7 @@
"gravitybridge",
"grove",
"harmony",
+ "ham",
"heco",
"hedera",
"heiko",
@@ -142,6 +147,7 @@
"inevm",
"injective",
"interlay",
+ "iotaevm",
"iotex",
"islm",
"jbc",
@@ -172,6 +178,7 @@
"lukso",
"lung",
"manta",
+ "massa",
"manta_atlantic",
"mantle",
"map",
@@ -184,6 +191,7 @@
"migaloo",
"milkomeda",
"milkomeda_a1",
+ "mint",
"mixin",
"mode",
"moonbeam",
@@ -200,6 +208,7 @@
"neutron",
"new",
"nibiru",
+ "noble",
"nolus",
"nos",
"nova",
@@ -227,6 +236,7 @@
"planq",
"pokt",
"polis",
+ "polkadex",
"polkadot",
"polygon",
"polygon_zkevm",
@@ -238,6 +248,8 @@
"quasar",
"quicksilver",
"radixdlt",
+ "rari",
+ "real",
"reef",
"regen",
"rei",
@@ -250,6 +262,7 @@
"rsk",
"rss3_vsl",
"rvn",
+ "saakuru",
"sapphire",
"scroll",
"secret",
@@ -276,6 +289,7 @@
"svm",
"sx",
"syscoin",
+ "taiko",
"telos",
"tenet",
"terra",
@@ -315,5 +329,8 @@
"zklink",
"zksync",
"zora",
- "zyx"
-]
\ No newline at end of file
+ "zyx",
+ "joltify",
+ "sanko",
+ "ox_chain"
+]
diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json
index d5ba1ab6e7..9fd47702a7 100644
--- a/projects/helper/coreAssets.json
+++ b/projects/helper/coreAssets.json
@@ -19,6 +19,7 @@
"DAI": "0x6b175474e89094c44da98b954eedeac495271d0f",
"SAI": "0x89d24A6b4CcB1B6fAA2625fE562bDD9a23260359",
"SDAI": "0x83f20f44975d03b1b09e64809b757c47f942beea",
+ "FXS": "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0",
"cvxFXS": "0xfeef77d3f69374f66429c91d732a244f074bdf74",
"cvxCRV": "0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7",
"vlCVX": "0x72a19342e8f1838460ebfccef09f6585e32db86e",
@@ -49,6 +50,8 @@
"AEVO": "0xB528edBef013aff855ac3c50b381f253aF13b997",
"STONE": "0x4d831e22f062b5327dfdb15f0b6a5df20e2e3dd0",
"USDM": "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C",
+ "PRISMA": "0xdA47862a83dac0c112BA89c6abC2159b95afd71C",
+ "FXN": "0x365accfca291e7d3914637abf1f7635db165bb09",
"USDe": "0x4c9edd5852cd905f086c759e8383e09bff1e68b3"
},
"fantom": {
@@ -148,7 +151,8 @@
"YIN": "0x794baab6b878467f93ef17e2f2851ce04e3e34c8",
"BNB": "0x5c4b7ccbf908e64f32e12c6650ec0c96d717f03f",
"BUSD": "0x9c9e5fd8bbc25984b178fdce6117defa39d2db39",
- "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80"
+ "WORK": "0x6002410dda2fb88b4d0dc3c1d562f7761191ea80",
+ "FRAX": "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89"
},
"xdai": {
"WXDAI": "0xe91d153e0b41518a2ce8dd3d7944fa863463a97d",
@@ -270,7 +274,8 @@
"GMX": "0xfc5A1A6EB076a2C7aD06eD22C90d7E710E35ad0a",
"WSTETH": "0x5979D7b546E38E414F7E9822514be443A4800529",
"plvGLP": "0x5326e71ff593ecc2cf7acae5fe57582d6e74cff1",
- "USDe": "0x5d3a1ff2b6bab83b63cd9ad0787074081a52ef34"
+ "USDe": "0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34",
+ "FRAX": "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F"
},
"fuse": {
"WFUSE": "0x0be9e53fd7edac9f859882afdda116645287c629",
@@ -281,7 +286,14 @@
"USDT": "0xfadbbf8ce7d5b7041be672561bba99f79c532e10",
"KNC": "0x43b17749b246fd2a96de25d9e4184e27e09765b0",
"BUSD": "0x6a5f6a8121592becd6747a38d67451b310f7f156",
- "null": "0x0000000000000000000000000000000000000000"
+ "null": "0x0000000000000000000000000000000000000000",
+ "USDC_2": "0x28c3d1cd466ba22f6cae51b1a4692a831696391a",
+ "USDT_2": "0x68c9736781e9316ebf5c3d49fe0c1f45d2d104cd",
+ "VOLT": "0x34ef2cc892a88415e9f02b91bfa9c91fc0be6bd4",
+ "FUSD_3": "0xce86a1cf3cff48139598de6bf9b1df2e0f79f86f",
+ "WETH_2": "0x5622f6dc93e08a8b717b149677930c38d5d50682",
+ "BNB": "0x6acb34b1df86e254b544189ec32cf737e2482058",
+ "BNB_2": "0x117c0419352ddb6fe575a67faa70315bdc4a93f3"
},
"evmos": {
"WEVMOS": "0xd4949664cd82660aae99bedc034a0dea8a0bd517",
@@ -368,7 +380,9 @@
"DAI": "0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd",
"NCT": "0x02de4766c272abc10bc88c220d214a26960a7e92",
"cMCO2": "0x32a9fe697a32135bfd313a6ac28792dae4d9979d",
- "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546"
+ "USDT": "0x617f3112bf5397d0467d315cc709ef968d9ba546",
+ "STEUR": "0x004626A008B1aCdC4c74ab51644093b155e59A23",
+ "USDT_1": "0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e"
},
"boba": {
"WETH": "0xd203de32170130082896b4111edf825a4774c18e",
@@ -1253,6 +1267,7 @@
"starknet": {
"STRK": "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
"DAI": "0x00da114221cb83fa859dbdb4c44beeaa0bb37c7537ad5ae66fe5e0efd20e6eb3",
+ "DAI_1": "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",
"USDC": "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
"USDT": "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
"WBTC": "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
@@ -1262,7 +1277,8 @@
"RETH": "0x0319111a5037cbec2b3e638cc34a3474e2d2608299f3e62866e9cc683208c610",
"UNO": "0x0719b5092403233201aa822ce928bd4b551d0cdb071a724edd7dc5e5f57b7f34",
"NSTSTRK": "0x04619e9ce4109590219c5263787050726be63382148538f3f936c22aa87d2fc2",
- "ZEND": "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34"
+ "ZEND": "0x00585c32b625999e6e5e78645ff8df7a9001cf5cf3eb6b80ccdd16cb64bd3a34",
+ "NSTR": "0x00c530f2c0aa4c16a0806365b0898499fba372e5df7a7172dc6fe9ba777e8007"
},
"ton": {
"TON": "0x0000000000000000000000000000000000000000",
@@ -1458,13 +1474,16 @@
},
"sei": {
"SEI": "usei",
+ "WSEI": "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7",
"WETH": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/4tLQqCLaoKKfNFuPjA9o39YbKUwhR1F8N29Tz3hEbfP2",
"USDCet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/Hq4tuDzhRBnxw3tFA5n6M52NVMVcC19XggbyDiJKCD6H",
"USDCso": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/9fELvUhFo6yWL34ZaLgPbCPzdk9MD1tAzMycgH45qShH",
"USDCar": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7edDfnf4mku8So3t4Do215GNHwASEwCWrdhM5GqD51xZ",
"USDTet": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/HktfLoADCk9mnjv7XJiN4YXK9ayE6xinLzt8wzcsR2rY",
"USDTbs": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/871jbn9unTavWsAe83f2Ma9GJWSv6BKsyWYLiQ6z3Pva",
- "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br"
+ "WBTC": "factory/sei189adguawugk3e55zn63z8r9ll29xrjwca636ra7v7gxuzn98sxyqwzt47l/7omXa4gryZ5NiBmLep7JsTtTtANCVKXwT9vbN91aS1br",
+ "USDC": "0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1",
+ "USDT": "0xB75D0B03c06A926e488e2659DF1A861F860bD3d1"
},
"op_bnb": {
"WBNB": "0x4200000000000000000000000000000000000006",
@@ -1555,12 +1574,14 @@
"SAT": "0x17102AC78a02a98fC78B0c29B7b0506f035A99E5",
"BIFI": "0x047938C3aD13c1eB821C8e310B2B6F889b6d0003",
"WBTC": "0x7b8FAC5F29E101BaaB33c5f9c39d4F85ba2cc7C1",
- "BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E"
+ "BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E",
+ "BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555"
},
"scroll": {
"WETH": "0x5300000000000000000000000000000000000004",
"USDT": "0xf55bec9cafdbe8730f096aa55dad6d22d44099df",
- "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4"
+ "USDC": "0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4",
+ "STONE": "0x80137510979822322193FC997d400D5A6C747bf7"
},
"darwinia": {
"RING": "0xe7578598aac020abfb918f33a20fad5b71d670b4"
@@ -1622,7 +1643,8 @@
},
"airdao": {
"SAMB": "0x2b2d892c3fe2b4113dd7ac0d2c1882af202fb28f",
- "BUSD": "0x7a477aa8ed4884509387dba81ba6f2b7c97597e2"
+ "BUSD": "0x7a477aa8ed4884509387dba81ba6f2b7c97597e2",
+ "USDC": "0xFF9F502976E7bD2b4901aD7Dd1131Bb81E5567de"
},
"acala": {
"DOT": "0x0000000000000000000100000000000000000002",
@@ -1648,10 +1670,12 @@
"fwUSDB": "0x866f2c06b83df2ed7ca9c2d044940e7cd55a06d6",
"WETH": "0x4300000000000000000000000000000000000004",
"ezETH": "0x2416092f143378750bb29b79eD961ab195CcEea5",
- "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A"
+ "weETH": "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A",
+ "BLAST": "0xb1a5700fA2358173Fe465e6eA4Ff52E36e88E2ad"
},
"chz": {
- "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946"
+ "WCHZ": "0x721ef6871f1c4efe730dce047d40d1743b886946",
+ "WCHZ_1": "0x677F7e16C7Dd57be1D4C8aD1244883214953DC47"
},
"bitrock": {
"WBR": "0x413f0e3a440aba7a15137f4278121450416882d5",
@@ -1672,7 +1696,10 @@
},
"xai": {
"XAI": "0x36be1fd6ff2a6beb34b500a04f89103a524516d8",
- "USDC": "0x300a7b57dc85b6a9776e249614abf0fe5c9905fb"
+ "USDC": "0x300a7b57dc85b6a9776e249614abf0fe5c9905fb",
+ "WXAI": "0x3fb787101dc6be47cfe18aeee15404dcc842e6af",
+ "WETH": "0xbee82cfdaff4a6aa4e4793cb81eb1c2e79ac463c",
+ "USDC_1": "0x1e3769bd5fb2e9e9e7d4ed8667c947661f9a82e3"
},
"merlin": {
"SATS": "0x4dcb91cc19aadfe5a6672781eb09abad00c19e4c",
@@ -1689,7 +1716,9 @@
"q": {
"WBTC": "0xde397e6C442A3E697367DecBF0d50733dc916b79",
"WDAI": "0xDeb87c37Dcf7F5197026f574cd40B3Fc8Aa126D1",
- "WUSDC": "0x79Cb92a2806BF4f82B614A84b6805963b8b1D8BB"
+ "WUSDC": "0x79Cb92a2806BF4f82B614A84b6805963b8b1D8BB",
+ "WETH": "0xd56F9ffF3fe3BD0C7B52afF9A42eb70E05A287Cc",
+ "ELK": "0xeEeEEb57642040bE42185f49C52F7E9B38f8eeeE"
},
"zklink": {
"WBTC": "0xda4aaed3a53962c83b35697cd138cc6df43af71f",
@@ -1753,10 +1782,19 @@
"bsquared": {
"WBTC": "0x4200000000000000000000000000000000000006",
"USDT": "0x681202351a488040fa4fdcc24188afb582c9dd62",
- "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5"
+ "USDC": "0xe544e8a38add9b1abf21922090445ba93f74b9e5",
+ "ETH": "0xD48d3A551757ac47655fCe25BDE1B0B6b1Cb2a5A",
+ "MATIC": "0xc3ee2Df14B1Bc526c24ED802f1873d49664a0d5c",
+ "FDUSD": "0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5",
+ "BSTONE": "0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462",
+ "ORDI": "0xa0f4470B714677AEEcE0d20074c540b3Cf6a477E",
+ "SATS": "0x7eBFcE05E418C380a2b6EB0F65995cA04ef4bc00",
+ "UBTC": "0x796e4D53067FF374B89b2Ac101ce0c1f72ccaAc2"
},
"planq": {
- "WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a"
+ "WPLANQ": "0x5ebcdf1de1781e8b5d41c016b0574ad53e2f6e1a",
+ "USDC": "0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265",
+ "USDC_1": "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B"
},
"lac": {
"LAC": "0x2911a1ab18546cb501628be8625c7503a2a7db54"
@@ -1773,5 +1811,54 @@
},
"btr": {
"ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2"
+ },
+ "taiko": {
+ "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b",
+ "USDT": "0x2def195713cf4a606b49d07e520e22c17899a736",
+ "USDC_e": "0x19e26b0638bf63aa9fa4d14c6baf8d52ebe86c5c",
+ "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6"
+ },
+ "stellar": {
+ "XLM": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA",
+ "USDC": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75"
+ },
+ "lukso": {
+ "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472"
+ },
+ "defichain_evm": {
+ "DFI": "0x49febbf9626b2d39aba11c01d83ef59b3d56d2a4",
+ "USDT": "0xff0000000000000000000000000000000000000d",
+ "USDC": "0xff00000000000000000000000000000000000003",
+ "ETH": "0xff00000000000000000000000000000000000001",
+ "DUSD": "0xff0000000000000000000000000000000000000f"
+ },
+ "ailayer": {
+ "ABTC": "0x1470a4831F76954686BfB4dE8180F7469EA8dE6F",
+ "bBTC": "0xEAa3C2fa77c306592750C9220a8f52DA8A849Ede"
+ },
+ "mint": {
+ "WETH": "0x4200000000000000000000000000000000000006",
+ "USDC": "0xb62F35B9546A908d11c5803ecBBA735AbC3E3eaE",
+ "USDT": "0x05D032ac25d322df992303dCa074EE7392C117b9",
+ "WBTC": "0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3"
+ },
+ "fraxtal": {
+ "WETH": "0xA8a59D73388D0c4344a7b0Ba287ddb654227c38a",
+ "FRAX": "0xfc00000000000000000000000000000000000001"
+ },
+ "aeternity": {
+ "WAE": "ct_J3zBY8xxjsRr3QojETNw48Eb38fjvEuJKkQ6KzECvubvEcvCa",
+ "WETH": "ct_WVqAvLQpvZCgBg4faZLXA1YBj43Fxj91D33Z8K7pFsY8YCofv",
+ "WBTC": "ct_26Q5MYFKE4z4GaYLmhZiZ9AHsSVqVNZiiyzySSHTorWyr4od4K",
+ "USDT": "ct_2AiMceYFXnUdA6A9Lu2ZQ2tr2TpfbGVfkxLfBnceoWgHTKZYvc",
+ "USDC": "ct_U1i8dzJTVWdnU2cv59TZQfLFpLfjqf7MQQC5ygSMKphn8Yew2"
+ },
+ "etlk": {
+ "OGV1WXTZ": "0x3571aed54ccea5b69b00516d5a149a6baea77118",
+ "WXTZ": "0xc9B53AB2679f573e480d01e0f49e2B5CFB7a3EAb"
+ },
+ "rari": {
+ "WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0",
+ "USDC.e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6"
}
-}
\ No newline at end of file
+}
diff --git a/projects/helper/env.js b/projects/helper/env.js
index 67e111830f..a5dd7389b1 100644
--- a/projects/helper/env.js
+++ b/projects/helper/env.js
@@ -16,6 +16,13 @@ const DEFAULTS = {
BTR_RPC_MULTICALL: '0xc8818aaeaBF0dF9f3f3ffF54Ab185705177A6234',
DEFICHAIN_EVM_RPC_MULTICALL: '0x7fEf77CDe3B41221Cff54B84Ea89D2EBc6b53352',
BOUNCEBIT_RPC_MULTICALL: '0x493d616f5F9a64e5B3D527120E406439bdF29272',
+ ZKLINK_RPC_MULTICALL: '0xa8738F57538E3Bb73872d1133F2358c7Fe56FD35',
+ REAL_RPC: 'https://real.drpc.org', // added manually short name is re-al
+ TAIKO_RPC: 'https://rpc.taiko.xyz', // added manually short name is tko-mainnet
+ REAL_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11',
+ SEI_RPC_MULTICALL: '0xcA11bde05977b3631167028862bE2a173976CA11',
+ SEI_RPC: 'https://evm-rpc.sei-apis.com/',
+ ETLK_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11",
}
const ENV_KEYS = [
@@ -23,10 +30,12 @@ const ENV_KEYS = [
...Object.keys(DEFAULTS),
'GETBLOCK_KEY',
'LOFTY_API',
+ 'SOLANA_RPC_CLIENT',
'OLYMPUS_GRAPH_API_KEY',
'SUMMER_HISTORY_ENDPOINT',
'SUMMER_AJNA_ENDPOINT',
'SUMMER_CONFIRMED_VAULTS_ENDPOINT',
+ 'ETHEREUM_TOKENS_ENDPOINT',
'UNISAT_AUTH'
]
diff --git a/projects/helper/erc4626.js b/projects/helper/erc4626.js
index 0ea9385689..6813fcc3bb 100644
--- a/projects/helper/erc4626.js
+++ b/projects/helper/erc4626.js
@@ -1,12 +1,14 @@
+const { sumTokens2 } = require("./unwrapLPs")
async function sumERC4626Vaults({ api, ...options }) {
await api.erc4626Sum({ ...options })
return api.getBalances()
}
-function sumERC4626VaultsExport({ vaults, ...options}) {
+function sumERC4626VaultsExport({ vaults, ...options }) {
return async (api) => {
- return sumERC4626Vaults({ ...options, api, calls: vaults })
+ await sumERC4626Vaults({ ...options, api, calls: vaults })
+ return sumTokens2({ api }) // hack to transform tokens
}
}
diff --git a/projects/helper/getUniSubgraphTvl.js b/projects/helper/getUniSubgraphTvl.js
index 2958f96523..d48eefa6f8 100644
--- a/projects/helper/getUniSubgraphTvl.js
+++ b/projects/helper/getUniSubgraphTvl.js
@@ -1,6 +1,7 @@
const { request, gql } = require("graphql-request");
const { toUSDTBalances } = require('../helper/balances');
const { blockQuery, getBlock, } = require('./http')
+const sdk = require('@defillama/sdk')
function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD", blockCatchupLimit = 500) {
const graphQuery = gql`
@@ -17,11 +18,12 @@ query get_tvl($block: Int) {
await api.getBlock()
const block = api.block
let uniswapFactories
+ const endpoint = sdk.graph.modifyEndpoint(graphUrls[chain])
if (!blockCatchupLimit) {
- uniswapFactories = (await request(graphUrls[chain], graphQuery, { block, }))[factoriesName];
+ uniswapFactories = (await request(endpoint, graphQuery, { block, }))[factoriesName];
} else {
- uniswapFactories = (await blockQuery(graphUrls[chain], graphQuery, { api, blockCatchupLimit, }))[factoriesName];
+ uniswapFactories = (await blockQuery(endpoint, graphQuery, { api, blockCatchupLimit, }))[factoriesName];
}
const usdTvl = Number(uniswapFactories[0][tvlName])
diff --git a/projects/helper/heroku-api.js b/projects/helper/heroku-api.js
index aecb1ec9a4..1cbe02f416 100644
--- a/projects/helper/heroku-api.js
+++ b/projects/helper/heroku-api.js
@@ -1,35 +1,41 @@
const { get } = require('./http')
const endpoint = "https://sushi-analytics.llama.fi"
+let data
+async function getData() {
+ if (!data) data = get(endpoint)
+ return data
+}
+
function getTvl(protocol, chain) {
- return async (timestamp) => {
- if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp
- if(Math.abs(Date.now()/1000-timestamp) > 3600){
- throw new Error("Can't refill adapters moved to heroku")
- }
- const data = await get(`${endpoint}?project=${protocol}&chain=${chain}`)
- if(data[protocol]?.[chain] === undefined){
- throw new Error(`Data for protocol ${protocol} on chain ${chain} is undefined on heroku`)
- }
- return data[protocol][chain]
+ return async (timestamp) => {
+ if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp
+ if (Math.abs(Date.now() / 1000 - timestamp) > 3600) {
+ throw new Error("Can't refill adapters moved to heroku")
}
+ const data = await getData()
+ if (data[protocol]?.[chain] === undefined) {
+ throw new Error(`Data for protocol ${protocol} on chain ${chain} is undefined on heroku`)
+ }
+ return data[protocol][chain]
+ }
}
function getExports(protocol, chains, exportKeys = []) {
- const chainTvls = chains.reduce((obj, chain) => {
- obj[chain] = {
- tvl: getTvl(protocol, chain)
- }
- exportKeys.forEach(key => {
- obj[chain][key] = getTvl(`${protocol}-${key}`, chain)
- })
- return obj
- }, {})
+ const chainTvls = chains.reduce((obj, chain) => {
+ obj[chain] = {
+ tvl: getTvl(protocol, chain)
+ }
+ exportKeys.forEach(key => {
+ obj[chain][key] = getTvl(`${protocol}-${key}`, chain)
+ })
+ return obj
+ }, {})
- return chainTvls
+ return chainTvls
}
-module.exports={
- getExports
+module.exports = {
+ getExports
}
diff --git a/projects/helper/http.js b/projects/helper/http.js
index a33215ba15..e682d45ac4 100644
--- a/projects/helper/http.js
+++ b/projects/helper/http.js
@@ -49,6 +49,8 @@ async function post(endpoint, body, options) {
}
async function graphQuery(endpoint, graphQuery, params = {}, { api, timestamp, chain, chainBlocks, useBlock = false } = {}) {
+
+ endpoint = sdk.graph.modifyEndpoint(endpoint)
if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp
if (api) {
if (!timestamp) timestamp = api.timestamp
@@ -63,6 +65,7 @@ async function graphQuery(endpoint, graphQuery, params = {}, { api, timestamp, c
}
async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) {
+ endpoint = sdk.graph.modifyEndpoint(endpoint)
const graphQLClient = new GraphQLClient(endpoint)
await api.getBlock()
const block = api.block
@@ -70,6 +73,7 @@ async function blockQuery(endpoint, query, { api, blockCatchupLimit = 500, }) {
const results = await graphQLClient.request(query, { block })
return results
} catch (e) {
+ e.chain = api.chain
if (!block) throw e
const errorString = e.toString()
const isBlockCatchupIssue = /Failed to decode.*block.number.*has only indexed up to block number \d+/.test(errorString)
diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js
index 10b8ee84c3..1db3a4f770 100644
--- a/projects/helper/portedTokens.js
+++ b/projects/helper/portedTokens.js
@@ -104,11 +104,13 @@ async function getChainTransform(chain) {
if ([...ibcChains, 'ton', 'mvc', 'defichain', 'waves'].includes(chain)) return chainStr
if (chain === 'cardano' && addr === 'ADA') return 'coingecko:cardano'
if (chain === 'near' && addr.endsWith('.near')) return chainStr
+ if (chain === 'aeternity' && addr.startsWith('ct_')) return chainStr
if (chain === 'tron' && addr.startsWith('T')) return chainStr
if (chain === 'stacks' && addr.startsWith('SP')) return chainStr
if (chain === 'tezos' && addr.startsWith('KT1')) return chainStr
if (chain === 'terra2' && addr.startsWith('terra1')) return chainStr
if (chain === 'aura' && addr.startsWith('aura')) return chainStr
+ if (chain === 'massa' && addr.startsWith('AS1')) return chainStr
if (chain === 'algorand' && /^\d+$/.test(addr)) return chainStr
if (addr.startsWith('0x') || ['solana', 'kava', 'renec'].includes(chain)) return chainStr
return addr
diff --git a/projects/helper/proxyRequest.js b/projects/helper/proxyRequest.js
new file mode 100644
index 0000000000..8fedad1e7a
--- /dev/null
+++ b/projects/helper/proxyRequest.js
@@ -0,0 +1,24 @@
+const axios = require('axios');
+const https = require('https');
+
+const agent = new https.Agent({
+ rejectUnauthorized: false
+});
+
+async function fetchThroughProxy(rawUrl) {
+ const url = new URL(rawUrl)
+ const response = await axios({
+ method: 'get',
+ url: `https://pr.oxylabs.io:7777${url.pathname}`,
+ httpsAgent: agent,
+ headers: {
+ 'Proxy-Authorization': 'Basic ' + Buffer.from(`${process.env.PROXY_AUTH}`).toString('base64'),
+ Host: url.host
+ }
+ });
+ return response.data
+}
+
+module.exports = {
+ fetchThroughProxy
+}
diff --git a/projects/helper/solana.js b/projects/helper/solana.js
index 909acd71c6..04b20842c1 100644
--- a/projects/helper/solana.js
+++ b/projects/helper/solana.js
@@ -3,13 +3,13 @@ const http = require('./http')
const { getEnv } = require('./env')
const { transformBalances: transformBalancesOrig, transformDexBalances, } = require('./portedTokens.js')
const { getUniqueAddresses } = require('./tokenMapping')
-const { Connection, PublicKey, Keypair } = require("@solana/web3.js")
+const { Connection, PublicKey, Keypair, StakeProgram, } = require("@solana/web3.js")
const { AnchorProvider: Provider, Wallet, } = require("@project-serum/anchor");
const { sleep, sliceIntoChunks, log, } = require('./utils')
const { decodeAccount } = require('./utils/solana/layout')
const sdk = require('@defillama/sdk');
-const { TOKEN_PROGRAM_ID } = require('@project-serum/anchor/dist/cjs/utils/token');
+const { TOKEN_PROGRAM_ID, ASSOCIATED_PROGRAM_ID, } = require('@project-serum/anchor/dist/cjs/utils/token');
const blacklistedTokens_default = [
'CowKesoLUaHSbAMaUxJUj7eodHHsaLsS65cy8NFyRDGP',
@@ -24,7 +24,11 @@ const blacklistedTokens_default = [
let connection, provider
-const endpoint = () => getEnv('SOLANA_RPC')
+const endpoint = (isClient) => {
+ if (isClient) return getEnv('SOLANA_RPC_CLIENT') ?? getEnv('SOLANA_RPC')
+ return getEnv('SOLANA_RPC')
+}
+
const renecEndpoint = () => getEnv('RENEC_RPC')
const endpointMap = {
solana: endpoint,
@@ -32,40 +36,20 @@ const endpointMap = {
}
function getConnection(chain = 'solana') {
- if (!connection) connection = new Connection(endpointMap[chain]())
+ if (!connection) connection = new Connection(endpointMap[chain](true))
return connection
}
-function getProvider() {
+function getProvider(chain = 'solana') {
if (!provider) {
const dummy_keypair = Keypair.generate();
const wallet = new Wallet(dummy_keypair);
- provider = new Provider(
- getConnection(), wallet
- );
+ provider = new Provider(getConnection(chain), wallet)
}
return provider;
}
-
-async function getSolBalances(accounts) {
- const formBody = key => ({ "jsonrpc": "2.0", "id": 1, "method": "getBalance", "params": [key] })
- const tokenBalances = []
- const chunks = sliceIntoChunks(accounts, 99)
- for (let chunk of chunks) {
- const bal = await http.post(endpoint(), chunk.map(formBody))
- tokenBalances.push(...bal)
- }
- return tokenBalances.reduce((a, i) => a + i.result.value, 0)
-}
-
-async function getSolBalance(account) {
- return getSolBalances([account])
-}
-
-const TOKEN_LIST_URL = "https://cdn.jsdelivr.net/gh/solana-labs/token-list@main/src/tokens/solana.tokenlist.json"
-
async function getTokenSupply(token) {
const tokenSupply = await http.post(endpoint(), {
jsonrpc: "2.0",
@@ -76,237 +60,40 @@ async function getTokenSupply(token) {
return tokenSupply.result.value.uiAmount;
}
-async function getGeckoSolTokens() {
- const tokens = await getTokenList()
- const tokenSet = new Set()
- tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101).forEach(i => tokenSet.add(i.address))
- return tokenSet
-}
-
-
-async function getValidGeckoSolTokens() {
- const tokens = await getTokenList()
- const tokenSet = new Set()
- tokens.filter(i => i.extensions?.coingeckoId && i.chainId === 101 && !i.name.includes('(Wormhole v1)')).forEach(i => tokenSet.add(i.address))
- return tokenSet
-}
-
-async function getTokenDecimals(tokens) {
- const calls = tokens => tokens.map((t, i) => ({ jsonrpc: '2.0', id: t, method: 'getTokenSupply', params: [t] }))
- const res = {}
- const chunks = sliceIntoChunks(tokens, 99)
- for (const chunk of chunks) {
- const tokenSupply = await http.post(endpoint(), calls(chunk))
- tokenSupply.forEach(({ id, result }) => res[id] = result.value.decimals)
- }
- return res
-}
-
-function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) {
- return {
- jsonrpc: "2.0",
- id: 1,
- method: "getTokenAccountsByOwner",
- params: [
- owner,
- { programId: String(programId) },
- { encoding: "jsonParsed", },
- ],
- }
-}
-async function getOwnerAllAccount(owner) {
- const tokenBalance = await http.post(endpoint(), formOwnerBalanceQuery(owner));
- return tokenBalance.result.value.map(i => ({
- account: i.pubkey,
- mint: i.account.data.parsed.info.mint,
- amount: i.account.data.parsed.info.tokenAmount.amount,
- uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount,
- decimals: i.account.data.parsed.info.tokenAmount.decimals,
- }))
-}
-
-function formTokenBalanceQuery(token, account, id = 1) {
- return {
- jsonrpc: "2.0",
- id,
- method: "getTokenAccountsByOwner",
- params: [
- account,
- { mint: token, },
- { encoding: "jsonParsed", },
- ],
- }
-}
-async function getTokenBalance(token, account) {
- const tokenBalance = await http.post(endpoint(), formTokenBalanceQuery(token, account));
- return tokenBalance.result.value.reduce(
- (total, account) =>
- total + account.account.data.parsed?.info.tokenAmount.uiAmount ?? 0,
- 0
- );
-}
-
-async function getTokenBalances(tokensAndAccounts) {
- const body = tokensAndAccounts.map(([token, account], i) => formTokenBalanceQuery(token, account, i))
- const tokenBalances = await http.post(endpoint(), body);
- const balances = {}
- // if (!tokenBalances) {
- // sdk.log('missing response', tokenBalances, tokensAndAccounts)
- // return balances
- // }
- // tokenBalances.forEach((v, i )=> {
- // if (!v.result) sdk.log('missing response', v, tokensAndAccounts[i])
- // } )
- tokenBalances.forEach(({ result: { value } = {} } = {}) => {
- if (!value) return;
- value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => {
- sdk.util.sumSingleBalance(balances, mint, amount)
- })
- })
- return balances
-}
-
-async function getTokenAccountBalances(tokenAccounts, { individual = false, chunkSize = 99, allowError = false, chain = 'solana' } = {}) {
+async function getTokenAccountBalances(tokenAccounts, { individual = false, allowError = false, chain = 'solana' } = {}) {
log('total token accounts: ', tokenAccounts.length)
- const formBody = account => ({ method: "getAccountInfo", jsonrpc: "2.0", params: [account, { encoding: "jsonParsed", commitment: "confirmed" }], id: account })
+ tokenAccounts.forEach((val, i) => {
+ if (typeof val === 'string') tokenAccounts[i] = new PublicKey(val)
+ })
+ const connection = getConnection(chain)
const balancesIndividual = []
const balances = {}
- const chunks = sliceIntoChunks(tokenAccounts, chunkSize)
- for (const chunk of chunks) {
- const body = chunk.map(formBody)
- const data = await http.post(endpointMap[chain](), body);
- if (data.length !== chunk.length) {
- throw new Error(`Mismatched returned for getTokenAccountBalances()`)
+ const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk))
+ res.forEach((data, idx) => {
+ if (!data) {
+ sdk.log(`Invalid account: ${tokenAccounts[idx]}`)
+ if (allowError) return;
+ else throw new Error(`Invalid account: ${tokenAccounts[idx]}`)
}
- data.forEach(({ result: { value } }, i) => {
- if (!value || !value.data?.parsed) {
- if (tokenAccounts[i].toString() === '11111111111111111111111111111111') {
- log('Null account: skipping it')
- return;
- }
- if (allowError) return;
- else throw new Error(`Invalid account: ${tokenAccounts[i]}`)
- }
- const { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } = value
- sdk.util.sumSingleBalance(balances, mint, amount)
+ data = decodeAccount('tokenAccount', data)
+ const mint = data.mint.toString()
+ const amount = data.amount.toString()
+ if (individual)
balancesIndividual.push({ mint, amount })
- })
- if (chunks.length > 4) {
- // log('waiting before more calls')
- await sleep(400)
- }
- }
- if (individual) return balancesIndividual
- return balances
-}
-
-
-async function getTokenAccountBalance(account) {
- const tokenBalance = await http.post(
- endpoint(),
- {
- jsonrpc: "2.0",
- id: 1,
- method: "getTokenAccountBalance",
- params: [account],
- },
- {
- headers: { "Content-Type": "application/json" },
- }
- );
- return tokenBalance.result?.value?.uiAmount;
-}
-
-let tokenList
-let _tokenList
-
-async function getTokenList() {
- if (!_tokenList)
- _tokenList = http.get(TOKEN_LIST_URL)
- tokenList = (await _tokenList).tokens
- return tokenList
-}
-
-// Example: [[token1, account1], [token2, account2], ...]
-async function sumTokens(tokensAndOwners, balances = {}) {
- return sumTokens2({ balances, tokensAndOwners, })
-}
-
-// Example: [[token1, account1], [token2, account2], ...]
-async function sumTokensUnknown(tokensAndOwners) {
- return sumTokens2({ tokensAndOwners, })
-}
-
-// accountsArray is an array of base58 address strings
-async function getMultipleAccountsRaw(accountsArray) {
- if (
- !Array.isArray(accountsArray) ||
- accountsArray.length === 0 ||
- typeof accountsArray[0] !== "string"
- ) {
- throw new Error("Expected accountsArray to be an array of strings");
- }
- const res = []
- const chunks = sliceIntoChunks(accountsArray, 99)
- for (const chunk of chunks) {
- const accountsInfo = await http.post(endpoint(), {
- jsonrpc: "2.0",
- id: 1,
- method: "getMultipleAccounts",
- params: [chunk],
- })
- res.push(...accountsInfo.result.value)
- }
-
- return res;
-}
-
-// Gets data in Buffers of all addresses, while preserving labels
-// Example: labeledAddresses = { descriptiveLabel: "9xDUcgo8S6DdRjvrR6ULQ2zpgqota8ym1a4tvxiv2dH8", ... }
-async function getMultipleAccountBuffers(labeledAddresses) {
- let labels = [];
- let addresses = [];
-
- for (const [label, address] of Object.entries(labeledAddresses)) {
- labels.push(label);
- addresses.push(address);
- }
- const accountsData = await getMultipleAccountsRaw(addresses);
-
- const results = {};
- accountsData.forEach((account, index) => {
- if (account === null) {
- results[labels[index]] = null;
- } else {
- results[labels[index]] = Buffer.from(account.data[0], account.data[1]);
- }
-
- // Uncomment and paste into a hex editor to do some reverse engineering
- });
+ else
+ sdk.util.sumSingleBalance(balances, mint, amount)
+ })
- return results;
+ return individual ? balancesIndividual : balances
}
-// Example: [[token1, account1], [token2, account2], ...]
-async function sumOrcaLPs(tokensAndAccounts) {
- const [tokenlist, orcaPools] = await Promise.all([
- getTokenList(),
- http.get("https://api.orca.so/pools"),
- ]);
- let totalUsdValue = 0;
- await Promise.all(
- tokensAndAccounts.map(async ([token, owner]) => {
- const balance = await getTokenBalance(token, owner);
- const symbol = tokenlist
- .find((t) => t.address === token)
- ?.symbol?.replace("[stable]", "");
- const supply = await getTokenSupply(token);
- const poolLiquidity =
- orcaPools.find((p) => p.name2 === symbol)?.liquidity ?? 0;
- totalUsdValue += (balance * poolLiquidity) / supply;
- })
- );
- return totalUsdValue;
+async function getMultipleAccounts(accountsArray) {
+ const connection = getConnection()
+ if (!accountsArray.length) return []
+ accountsArray.forEach((val, i) => {
+ if (typeof val === 'string') accountsArray[i] = new PublicKey(val)
+ })
+ return runInChunks(accountsArray, chunk => connection.getMultipleAccountsInfo(chunk))
}
function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') {
@@ -327,8 +114,7 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') {
data.push({ token0: tokenA.mint, token0Bal: tokenA.amount, token1: tokenB.mint, token1Bal: tokenB.amount, })
}
- const coreTokens = chain === 'solana' ? await getGeckoSolTokens() : null
- return transformDexBalances({ chain, data, blacklistedTokens: blacklistedTokens_default, coreTokens, })
+ return transformDexBalances({ chain, data, blacklistedTokens: blacklistedTokens_default, })
}
async function _getTokenAccounts() {
@@ -349,6 +135,10 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') {
}
}
+function sumTokensExport({ tokenAccounts, owner, owners, tokens, solOwners, blacklistedTokens, allowError, tokensAndOwners, ...rest }) {
+ return (api) => sumTokens2({ api, chain: api.chain, tokenAccounts, owner, owners, tokens, solOwners, blacklistedTokens, allowError, tokensAndOwners, ...rest })
+}
+
async function sumTokens2({
balances = {},
tokensAndOwners = [],
@@ -359,41 +149,41 @@ async function sumTokens2({
solOwners = [],
blacklistedTokens = [],
allowError = false,
- getAllTokenAccounts = false,
+ computeTokenAccount = 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) {
const _owners = getUniqueAddresses([...owners, owner].filter(i => i), 'solana')
- for (const _owner of _owners) {
- const data = await getOwnerAllAccount(_owner)
- for (const item of data) {
- if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue;
- sdk.util.sumSingleBalance(balances, 'solana:' + item.mint, item.amount)
- }
+
+ const data = await getOwnerAllAccounts(_owners)
+ for (const item of data) {
+ if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue;
+ sdk.util.sumSingleBalance(balances, 'solana:' + item.mint, item.amount)
}
}
tokensAndOwners = tokensAndOwners.filter(([token]) => !blacklistedTokens.includes(token))
+ //
- if (tokensAndOwners.length) {
+ if (computeTokenAccount) {
+ const computedTokenAccounts = computeTokenAccounts(tokensAndOwners)
+ tokenAccounts.push(...computedTokenAccounts)
+ } else if (tokensAndOwners.length) {
tokensAndOwners = getUnique(tokensAndOwners)
log('total balance queries: ', tokensAndOwners.length)
- const chunks = sliceIntoChunks(tokensAndOwners, 99)
- for (const chunk of chunks) {
- await _sumTokens(chunk)
- if (chunks.length > 2) {
- // log('waiting before more calls')
- await sleep(400)
- }
- }
+ await runInChunks(tokensAndOwners, async (chunk) => {
+ const tokenBalances = await getTokenBalances(chunk)
+ transformBalances({ tokenBalances, balances, })
+ }, { sleepTime: 400 })
}
if (tokenAccounts.length) {
tokenAccounts = getUniqueAddresses(tokenAccounts, 'solana')
+
const tokenBalances = await getTokenAccountBalances(tokenAccounts, { allowError })
await transformBalances({ tokenBalances, balances, })
}
@@ -407,11 +197,6 @@ async function sumTokens2({
return balances
- async function _sumTokens(tokensAndAccounts) {
- const tokenBalances = await getTokenBalances(tokensAndAccounts)
- return transformBalances({ tokenBalances, balances, })
- }
-
function getUnique(tokensAndOwners) {
const set = new Set()
tokensAndOwners.forEach(i => {
@@ -419,6 +204,86 @@ async function sumTokens2({
})
return [...set].map(i => i.split('$'))
}
+
+ async function getOwnerAllAccounts(owners) {
+ console.log('fetching sol token balances for', owners.length, 'owners')
+ return runInChunks(owners, async (chunk) => {
+ const body = chunk.map(i => formOwnerBalanceQuery(i))
+ const tokenBalances = await http.post(endpoint(), body)
+ return tokenBalances.map(i => i.result.value).flat().map(i => ({
+ account: i.pubkey,
+ mint: i.account.data.parsed.info.mint,
+ amount: i.account.data.parsed.info.tokenAmount.amount,
+ uiAmount: i.account.data.parsed.info.tokenAmount.uiAmount,
+ decimals: i.account.data.parsed.info.tokenAmount.decimals,
+ }))
+
+ })
+ }
+
+ function formOwnerBalanceQuery(owner, programId = TOKEN_PROGRAM_ID) {
+ return {
+ jsonrpc: "2.0",
+ id: 1,
+ method: "getTokenAccountsByOwner",
+ params: [
+ owner,
+ { programId: String(programId) },
+ { encoding: "jsonParsed", },
+ ],
+ }
+ }
+
+ async function getSolBalances(accounts) {
+ const connection = getConnection()
+
+ const balances = await runInChunks(accounts, async (chunk) => {
+ chunk = chunk.map(i => typeof i === 'string' ? new PublicKey(i) : i)
+ const accountInfos = await connection.getMultipleAccountsInfo(chunk)
+ return accountInfos.map(account => account?.lamports ?? 0)
+ })
+ return balances.reduce((a, b) => a + +b, 0)
+ }
+
+ function computeTokenAccounts(tokensAndOwners) {
+ tokensAndOwners.forEach(([token, account], i) => {
+ if (typeof token === 'string') tokensAndOwners[i][0] = new PublicKey(token)
+ if (typeof account === 'string') tokensAndOwners[i][1] = new PublicKey(account)
+ })
+ const programBuffer = TOKEN_PROGRAM_ID.toBuffer()
+ return tokensAndOwners.map(([mint, owner]) => {
+ return PublicKey.findProgramAddressSync(
+ [owner.toBuffer(), programBuffer, mint.toBuffer(),],
+ ASSOCIATED_PROGRAM_ID
+ )[0]
+ })
+ }
+
+ async function getTokenBalances(tokensAndAccounts) {
+ const body = tokensAndAccounts.map(([token, account], i) => formTokenBalanceQuery(token, account, i))
+ const tokenBalances = await http.post(endpoint(), body);
+ const balances = {}
+ tokenBalances.forEach(({ result: { value } = {} } = {}) => {
+ if (!value) return;
+ value.forEach(({ account: { data: { parsed: { info: { mint, tokenAmount: { amount } } } } } }) => {
+ sdk.util.sumSingleBalance(balances, mint, amount)
+ })
+ })
+ return balances
+
+ function formTokenBalanceQuery(token, account, id = 1) {
+ return {
+ jsonrpc: "2.0",
+ id,
+ method: "getTokenAccountsByOwner",
+ params: [
+ account,
+ { mint: token, },
+ { encoding: "jsonParsed", },
+ ],
+ }
+ }
+ }
}
async function transformBalances({ tokenBalances, balances = {}, }) {
@@ -439,31 +304,53 @@ function readBigUInt64LE(buffer, offset) {
return BigInt(lo) + (BigInt(hi) << BigInt(32));
}
+async function getStakedSol(solAddress, api) {
+ const stakeAccounts = await getConnection().getProgramAccounts(StakeProgram.programId, {
+ filters: [{
+ memcmp: { bytes: solAddress, offset: 4 + 8 }
+ }],
+ dataSlice: { offset: 0, length: 1 } // we dont care about the data, just the lamports
+ })
+ const totalStakedSol = stakeAccounts.reduce((tvl, { account }) => { return tvl + account.lamports }, 0)
+ if (api) {
+ api.add(ADDRESSES.solana.SOL, totalStakedSol)
+ return api
+ }
+ return totalStakedSol
+}
+
+async function getSolBalanceFromStakePool(address, api) {
+ const connection = getConnection()
+ if (typeof address === 'string') address = new PublicKey(address)
+ const accountInfo = await connection.getAccountInfo(address);
+ const deserializedAccountInfo = decodeAccount('stakePool', accountInfo)
+ return api.add(ADDRESSES.solana.SOL, +deserializedAccountInfo.totalLamports)
+}
+
+async function runInChunks(inputs, fn, { chunkSize = 99, sleepTime } = {}) {
+ const chunks = sliceIntoChunks(inputs, chunkSize)
+ const results = []
+ for (const chunk of chunks) {
+ results.push(...(await fn(chunk) ?? []))
+ if (sleepTime) await sleep(sleepTime)
+ }
+
+ return results.flat()
+}
+
module.exports = {
endpoint: endpoint(),
getTokenSupply,
- getTokenBalance,
- getTokenAccountBalance,
- sumTokens,
- getMultipleAccountsRaw,
- getMultipleAccountBuffers,
- sumOrcaLPs,
- getSolBalance,
- sumTokensUnknown,
+ getMultipleAccounts,
exportDexTVL,
getProvider,
getConnection,
sumTokens2,
- getTokenBalances,
+ sumTokensExport,
transformBalances,
- getSolBalances,
- getTokenDecimals,
- getGeckoSolTokens,
- getTokenAccountBalances,
- getTokenList,
readBigUInt64LE,
decodeAccount,
- getValidGeckoSolTokens,
- getOwnerAllAccount,
blacklistedTokens_default,
+ getStakedSol,
+ getSolBalanceFromStakePool,
};
diff --git a/projects/helper/streamingHelper.js b/projects/helper/streamingHelper.js
index 82feff3b98..441ba2ffff 100644
--- a/projects/helper/streamingHelper.js
+++ b/projects/helper/streamingHelper.js
@@ -10,9 +10,12 @@ function isStableToken(symbol = '', address = '') {
return stableTokenAddresses.includes(address.toLowerCase()) || stableTokens.includes(symbol.toUpperCase())
}
-async function getWhitelistedTokens({ api, tokens, isVesting }) {
- tokens = getUniqueAddresses(tokens)
- const symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true})
+async function getWhitelistedTokens({ api, tokens, isVesting }) {
+ tokens = getUniqueAddresses(tokens, api.chain)
+ let symbols = []
+ if (!['solana', 'sui', 'aptos'].includes(api.chain)) {
+ symbols = await api.multiCall({ abi: 'string:symbol', calls: tokens, permitFailure: true})
+ }
tokens = tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting))
return tokens
}
@@ -87,6 +90,24 @@ const stableTokenAddresses = [
ADDRESSES.meter.BUSD_bsc,
ADDRESSES.meter.USDT_eth,
'0x687A6294D0D6d63e751A059bf1ca68E4AE7B13E2',
+
+ ADDRESSES.solana.SOL,
+ ADDRESSES.solana.USDC,
+ ADDRESSES.solana.USDT,
+
+ ADDRESSES.sui.SUI,
+ ADDRESSES.sui.USDC,
+ ADDRESSES.sui.WETH,
+ ADDRESSES.sui.USDT,
+
+ ADDRESSES.aptos.APT,
+ ADDRESSES.aptos.USDC,
+ ADDRESSES.aptos.USDC_1,
+ ADDRESSES.aptos.USDC_2,
+ ADDRESSES.aptos.USDT,
+ ADDRESSES.aptos.USDT_2,
+
+
].map(i => i.toLowerCase())
module.exports = {
diff --git a/projects/helper/sumTokens.js b/projects/helper/sumTokens.js
index c973223ba4..c376231260 100644
--- a/projects/helper/sumTokens.js
+++ b/projects/helper/sumTokens.js
@@ -13,6 +13,7 @@ const helpers = {
"cosmos": require("./chain/cosmos"),
"solana": require("./solana"),
"aptos": require("./chain/aptos"),
+ "sui": require("./chain/sui"),
"tezos": require("./chain/tezos"),
"zilliqa": require("./chain/zilliqa"),
"near": require("./chain/near"),
diff --git a/projects/helper/token.js b/projects/helper/token.js
index af51880dcc..f122188e89 100644
--- a/projects/helper/token.js
+++ b/projects/helper/token.js
@@ -71,7 +71,7 @@ const ankrChainMapping = {
syscoin: 'syscoin',
}
-async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) {
+async function ankrGetTokens(address, { onlyWhitelisted = true, skipCacheRead = false } = {}) {
address = address.toLowerCase()
if (!ankrTokenCalls[address]) ankrTokenCalls[address] = _call()
@@ -83,9 +83,9 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) {
const timeNow = Math.floor(Date.now() / 1e3)
const THREE_DAYS = 3 * 24 * 3600
const cache = (await getCache(project, key)) ?? {}
- if (cache.timestamp && (timeNow - cache.timestamp) < THREE_DAYS)
+ if (!skipCacheRead && cache.timestamp && (timeNow - cache.timestamp) < THREE_DAYS)
return cache.tokens
-
+
sdk.log('Pulling tokens for ' + address)
const options = {
@@ -97,6 +97,7 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) {
jsonrpc: '2.0',
method: 'ankr_getAccountBalance',
params: {
+ blockchain: Object.values(ankrChainMapping).filter(i => i !== 'eth'),
onlyWhitelisted,
nativeFirst: true,
skipSyncCheck: true,
@@ -116,12 +117,27 @@ async function ankrGetTokens(address, { onlyWhitelisted = true } = {}) {
for (const [chain, values] of Object.entries(tokens)) {
tokens[chain] = getUniqueAddresses(values)
}
+ tokens.eth = await getETHTokens(address, onlyWhitelisted)
await setCache(project, key, tokenCache)
return tokens
}
}
+async function getETHTokens(address, onlyWhitelisted) {
+ const endpoint = getEnv('ETHEREUM_TOKENS_ENDPOINT')
+ if (!endpoint) throw new Error('Missing endpoint for ethereum tokens')
+ const url = `${endpoint}/v1/1/address/${address}/balances_v2/`
+ const { data: { items } } = await get(url)
+ const tokenSet = new Set()
+ items.forEach(i => {
+ const token = i.native_token ? ADDRESSES.null : i.contract_address
+ if (i.is_spam && onlyWhitelisted) return;
+ tokenSet.add(token)
+ })
+ return Array.from(tokenSet)
+}
+
async function getComplexTreasury(owners) {
const networks = ["ethereum", "polygon", "optimism", "gnosis", "binance-smart-chain", "fantom", "avalanche", "arbitrum",
"celo", "harmony", "moonriver", "bitcoin", "cronos", "aurora", "evmos"]
diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js
index 20b905a541..6318ae76a8 100644
--- a/projects/helper/tokenMapping.js
+++ b/projects/helper/tokenMapping.js
@@ -17,8 +17,9 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets))
// carbon: https://api-insights.carbon.network/info/denom_gecko_map
// orbit brige: https://bridge.orbitchain.io/open/v1/api/monitor/rawTokenList
-const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom']
-const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge']
+
+const ibcChains = ['ibc', 'terra', 'terra2', 'crescent', 'osmosis', 'kujira', 'stargaze', 'juno', 'injective', 'cosmos', 'comdex', 'umee', 'orai', 'persistence', 'fxcore', 'neutron', 'quasar', 'chihuahua', 'sei', 'archway', 'migaloo', 'secret', 'aura', 'xpla', 'bostrom', 'joltify']
+const caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', ]
const transformTokens = {
// Sample Code
@@ -35,81 +36,43 @@ const ibcMappings = {
}
const fixBalancesTokens = {
- defichain_evm: {
- '0x49febbf9626b2d39aba11c01d83ef59b3d56d2a4': { coingeckoId: "defichain", decimals: 18 },
- '0xff0000000000000000000000000000000000000d': { coingeckoId: "usd-coin", decimals: 18 },
- '0xff00000000000000000000000000000000000003': { coingeckoId: "tether", decimals: 18 },
- '0xff00000000000000000000000000000000000001': { coingeckoId: "ethereum", decimals: 18 },
- '0xff0000000000000000000000000000000000000f': { coingeckoId: "decentralized-usd", decimals: 18 },
- },
- ace: {
- [nullAddress]: { coingeckoId: "endurance", decimals: 18 },
- '0x85119527cf38f6ccf7b1b8f8fad05145358aaa81': { coingeckoId: "endurance", decimals: 18 },
- },
// Sample Code
ozone: {
// '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain
},
- scroll: {
- [ADDRESSES.mode.STONE]: { coingeckoId: "ethereum:0x7122985656e38bdc0302db86685bb972b145bd3c", decimals: 0 },
+ xdc: {
+ '0x8f9920283470f52128bf11b0c14e798be704fd15': { coingeckoId: 'comtech-gold', decimals: 18 },
},
- tezos: {
- "KT1PnUZCp3u2KzWr93pn4DD7HAJnm3rWVrgn": { coingeckoId: "tezos", decimals: 6 },
- "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17": { coingeckoId: "usd-coin", decimals: 6 },
- "KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18": { coingeckoId: "tether", decimals: 6 },
- },
-
- acala: {
- ACA: { coingeckoId: "acala", decimals: 12 },
- LDOT: { coingeckoId: "liquid-staking-dot", decimals: 10 },
- DOT: { coingeckoId: "polkadot", decimals: 10 },
- },
- karura: {
- KSM: { coingeckoId: "kusama", decimals: 12 },
- LKSM: { coingeckoId: "liquid-ksm", decimals: 12 },
- KAR: { coingeckoId: "karura", decimals: 12 },
- BNC: { coingeckoId: "bifrost-native-coin", decimals: 12 },
- PHA: { coingeckoId: "pha", decimals: 12 },
- KINT: { coingeckoId: "kintsugi", decimals: 12 },
- KBTC: { coingeckoId: "kintsugi-btc", decimals: 8 },
+
+ real: {
+ '0x4644066f535ead0cde82d209df78d94572fcbf14': { coingeckoId: 're-al', decimals: 18 },
+ '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 },
+ '0xce1581d7b4ba40176f0e219b2cac30088ad50c7a': { coingeckoId: 'pearl', decimals: 18 },
},
- blast: {
- '0xf7bc58b8d8f97adc129cfc4c9f45ce3c0e1d2692': { coingeckoId: "wrapped-bitcoin", decimals: 8 },
- '0x9e0d7d79735e1c63333128149c7b616a0dc0bbdb': { coingeckoId: "weth", decimals: 18 }, //pirex eth
- '0xde55b113a27cc0c5893caa6ee1c020b6b46650c0': { coingeckoId: "deus-finance-2", decimals: 18 }, // deus
+ airdao: {
+ [ADDRESSES.null]: { coingeckoId: 'amber', decimals: 18 },
+ [ADDRESSES.airdao.USDC]: { coingeckoId: 'usd-coin', decimals: 18 },
},
- solana: {
- 'AZsHEMXd36Bj1EMNXhowJajpUXzrKcK57wW4ZGXVa7yR': { coingeckoId: "guacamole", decimals: 5 },
+ lukso: {
+ [ADDRESSES.null]: { coingeckoId: "lukso-token-2", decimals: 18 },
+ [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 },
},
- chz: {
- '0x677F7e16C7Dd57be1D4C8aD1244883214953DC47': { coingeckoId: "wrapped-chiliz", decimals: 18 }
+ bfc: {
+ '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, },
},
- zklink: {
- '0xbEAf16cFD8eFe0FC97C2a07E349B9411F5dC272C': { coingeckoId: "solv-btc", decimals: 18 },
- '0xFb8dBdc644eb54dAe0D7A9757f1e6444a07F8067': { coingeckoId: "bitcoin-trc20", decimals: 18 },
- '0x85D431A3a56FDf2d2970635fF627f386b4ae49CC': { coingeckoId: "merlin-s-seal-btc", decimals: 18 },
+ pulse: {
+ '0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 },
},
- btr: {
- '0x0000000000000000000000000000000000000000': { coingeckoId: 'bitcoin', decimals: 18 },
- '0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f': { coingeckoId: 'wrapped-bitcoin', decimals: 18 },
- '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2': { coingeckoId: 'tether', decimals: 6 },
- '0x9827431e8b77e87c9894bd50b055d6be56be0030': { coingeckoId: 'usd-coin', decimals: 6 },
- },
- cyeth: {
- '0x4200000000000000000000000000000000000006': { coingeckoId: 'ethereum', decimals: 18 },
+ saakuru: {
+ '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 },
+ '0x739222D8A9179fE05129C77a8fa354049c088CaA': { coingeckoId: 'usd-coin', decimals: 6 }
},
bouncebit: {
- '0x0000000000000000000000000000000000000000': { coingeckoId: 'bouncebit', decimals: 18 },
- '0xf4c20e5004c6fdcdda920bdd491ba8c98a9c5863': { coingeckoId: 'bouncebit', decimals: 18 },
- '0x77776b40c3d75cb07ce54dea4b2fd1d07f865222': { coingeckoId: 'tether', decimals: 18 },
- '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC': { coingeckoId: 'bitcoin', decimals: 18 },
+ '0x8f083eafcbba2e126ad9757639c3a1e25a061a08': { coingeckoId: 'bouncebit-btc', decimals: 18 }
},
- linea: {
- '0x63ba74893621d3d12f13cec1e86517ec3d329837': { coingeckoId: 'liquity-usd', decimals: 18 },
+ ripple: {
+ "XRP": { coingeckoId: "ripple", decimals: 6 },
},
- bevm: {
- '0x2967e7bb9daa5711ac332caf874bd47ef99b3820': { coingeckoId: 'wrapped-stbtc', decimals: 18 },
- }
}
ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })
@@ -151,6 +114,7 @@ function getCoreAssets(chain = 'ethereum') {
function normalizeAddress(address, chain, extractChain = false) {
if (!chain && extractChain && address.includes(':')) chain = address.split(':')[0]
+ if (chain === 'sei' && address?.startsWith('0x')) return address.toLowerCase()
if (caseSensitiveChains.includes(chain)) return address
return address.toLowerCase()
}
diff --git a/projects/helper/traderJoeV2.js b/projects/helper/traderJoeV2.js
new file mode 100644
index 0000000000..a80a48a61a
--- /dev/null
+++ b/projects/helper/traderJoeV2.js
@@ -0,0 +1,38 @@
+const { sumTokens2 } = require("./unwrapLPs")
+
+function joeV2Export(config) {
+ const exports = {
+ methodology: 'We count the token balances in in different liquidity book contracts',
+ }
+
+ Object.keys(config).forEach(chain => {
+ let factory = config[chain]
+ let blacklistedTokens = []
+ if (typeof factory !== 'string' && typeof factory.factory === 'string') {
+ blacklistedTokens = factory.blacklistedTokens || []
+ factory = factory.factory
+ }
+
+ exports[chain] = {
+ tvl: async (api) => {
+ const pools = await api.fetchList({ target: factory, itemAbi: 'getLBPairAtIndex', lengthAbi: 'getNumberOfLBPairs', })
+ const tokenA = await api.multiCall({ abi: 'address:getTokenX', calls: pools, })
+ const tokenB = await api.multiCall({ abi: 'address:getTokenY', calls: pools, })
+
+ const toa = []
+ tokenA.map((_, i) => {
+ toa.push([tokenA[i], pools[i]])
+ toa.push([tokenB[i], pools[i]])
+ })
+ return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens, permitFailure: true, })
+ }
+ }
+ })
+
+ return exports
+}
+
+
+module.exports = {
+ joeV2Export,
+}
diff --git a/projects/helper/treasury.js b/projects/helper/treasury.js
index 34b0662605..c5e88e8094 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/helper/uniswapV3.js b/projects/helper/uniswapV3.js
index f3f6fd0b2b..726e43b289 100644
--- a/projects/helper/uniswapV3.js
+++ b/projects/helper/uniswapV3.js
@@ -1,7 +1,6 @@
const { sumTokens2 } = require('./unwrapLPs')
const { getLogs } = require('./cache/getLogs')
const { cachedGraphQuery } = require('./cache')
-const { request, } = require('graphql-request')
const uniswapConfig = {
eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool)',
diff --git a/projects/helper/unknownTokens.js b/projects/helper/unknownTokens.js
index c722bc96ee..cf07b1d5f9 100644
--- a/projects/helper/unknownTokens.js
+++ b/projects/helper/unknownTokens.js
@@ -9,6 +9,16 @@ const { getTokenPrices, sumUnknownTokens, getLPData, } = require('./cache/sumUnk
const { getUniTVL } = require('./cache/uniswap')
const { getUniqueAddresses, } = require('./utils')
+function uniTvlExports(config, commonOptions) {
+ const exportsObj = {
+ misrepresentedTokens: true,
+ }
+ Object.keys(config).forEach(chain => {
+ exportsObj[chain] = uniTvlExport(chain, config[chain],commonOptions )[chain]
+ })
+ return exportsObj
+}
+
function unknownTombs({ token = [], shares = [], rewardPool = [], masonry = [], lps, chain = "ethereum", coreAssets = [],
useDefaultCoreAssets = false, }) {
let getPrices
@@ -256,4 +266,5 @@ module.exports = {
sumTokensExport,
yieldHelper,
uniTvlExport,
+ uniTvlExports,
};
\ No newline at end of file
diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js
index 4d3293e302..dc96b0908f 100644
--- a/projects/helper/unwrapLPs.js
+++ b/projects/helper/unwrapLPs.js
@@ -11,6 +11,7 @@ const creamAbi = require('./abis/cream.json')
const { isLP, log, sliceIntoChunks, isICHIVaultToken, createIncrementArray } = require('./utils')
const { sumArtBlocks, whitelistedNFTs, } = require('./nft')
const wildCreditABI = require('../wildcredit/abi.json');
+const slipstreamNftABI = require('../arcadia-finance-v2/slipstreamNftABI.json');
const { covalentGetTokens, } = require("./token");
const SOLIDLY_VE_NFT_ABI = require('./abis/solidlyVeNft.json');
@@ -192,6 +193,8 @@ async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tok
const PANCAKE_NFT_ADDRESS = '0x46A15B0b27311cedF172AB29E4f4766fbE7F4364'
async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, chain = 'ethereum', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {} }) {
+ nftAddress = nftAddress ?? uniV3ExtraConfig.nftAddress
+ const commonConfig = { balances, owner, owners, chain, block, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, }
// https://docs.uniswap.org/contracts/v3/reference/deployments
if (!nftsAndOwners.length) {
if (!nftAddress)
@@ -208,15 +211,13 @@ async function unwrapUniswapV3NFTs({ balances = {}, nftsAndOwners = [], block, c
default: throw new Error('missing default uniswap nft address chain: ' + chain)
}
- if ((!owners || !owners.length) && owner)
- owners = [owner]
- owners = getUniqueAddresses(owners, chain)
- if (Array.isArray(nftAddress))
- nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat()
- else
- nftsAndOwners = owners.map(o => [nftAddress, o])
- }
- await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, })))
+ if (Array.isArray(nftAddress)) {
+ await Promise.all(nftAddress.map((addr) => unwrapUniswapV3NFT({ ...commonConfig, nftAddress: addr, })))
+ } else
+ await unwrapUniswapV3NFT({ ...commonConfig, nftAddress, })
+
+ } else
+ await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ ...commonConfig, owner, nftAddress, })))
return balances
}
@@ -224,23 +225,37 @@ const factories = {}
const getFactoryKey = (chain, nftAddress) => `${chain}:${nftAddress}`.toLowerCase()
-async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) {
+async function unwrapUniswapV3NFT({ balances, owner, owners, nftAddress, block, chain = 'ethereum', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) {
blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain)
whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain)
let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress
- const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output
const factoryKey = getFactoryKey(chain, nftAddress)
if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })
let factory = (await factories[factoryKey]).output
if (factory.toLowerCase() === '0xa08ae3d3f4da51c22d3c041e468bdf4c61405aab') // thruster finance has a bug where they set the pool deployer instead of the factory
factory = '0x71b08f13B3c3aF35aAdEb3949AFEb1ded1016127'
- const positionIds = (await sdk.api.abi.multiCall({
- block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher,
- calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })),
- })).output.map(positionIdCall => positionIdCall.output)
+ let positionIds = uniV3ExtraConfig.positionIds
+ if (!positionIds) {
+ if (!owners && owner) owners = [owner]
+ owners = getUniqueAddresses(owners, chain)
+ const { output: lengths } = await sdk.api.abi.multiCall({
+ block, chain, abi: wildCreditABI.balanceOf,
+ calls: owners.map((params) => ({ target: nftIdFetcher, params, })),
+ })
+ const positionIDCalls = []
+ for (let i = 0; i < owners.length; i++) {
+ const length = lengths[i].output
+ positionIDCalls.push(...createIncrementArray(length).map(j => ({ params: [owners[i], j] })))
+ }
+
+ positionIds = (await sdk.api.abi.multiCall({
+ block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher,
+ calls: positionIDCalls,
+ })).output.map(positionIdCall => positionIdCall.output)
+ }
const positions = (await sdk.api.abi.multiCall({
block, chain, abi: wildCreditABI.positions, target: nftAddress,
@@ -302,6 +317,108 @@ async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain =
}
}
+async function unwrapSlipstreamNFTs({ balances = {}, nftsAndOwners = [], block, chain = 'base', owner, nftAddress, owners, blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {} }) {
+ // https://velodrome.finance/security#contracts
+ // https://aerodrome.finance/security#contracts
+ if (!nftsAndOwners.length) {
+ if (!nftAddress)
+ switch (chain) {
+ case 'optimism': nftAddress = '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4'; break;
+ case 'base': nftAddress = '0x827922686190790b37229fd06084350e74485b72'; break;
+ default: throw new Error('missing default uniswap nft address chain: ' + chain)
+ }
+
+ if ((!owners || !owners.length) && owner)
+ owners = [owner]
+ owners = getUniqueAddresses(owners, chain)
+ if (Array.isArray(nftAddress))
+ nftsAndOwners = nftAddress.map(nft => owners.map(o => [nft, o])).flat()
+ else
+ nftsAndOwners = owners.map(o => [nftAddress, o])
+ }
+ await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapSlipstreamNFT({ balances, owner, nftAddress, block, chain, blacklistedTokens, whitelistedTokens, uniV3ExtraConfig, })))
+ return balances
+}
+
+async function unwrapSlipstreamNFT({ balances, owner, positionIds = [], nftAddress, block, chain = 'base', blacklistedTokens = [], whitelistedTokens = [], uniV3ExtraConfig = {}, }) {
+
+ blacklistedTokens = getUniqueAddresses(blacklistedTokens, chain)
+ whitelistedTokens = getUniqueAddresses(whitelistedTokens, chain)
+ let nftIdFetcher = uniV3ExtraConfig.nftIdFetcher ?? nftAddress
+
+ const factoryKey = getFactoryKey(chain, nftAddress)
+ if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })
+ let factory = (await factories[factoryKey]).output
+
+ if (!positionIds) {
+ const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftIdFetcher, owner, block, chain })).output
+ positionIds = (await sdk.api.abi.multiCall({
+ block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftIdFetcher,
+ calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })),
+ })).output.map(positionIdCall => positionIdCall.output)
+ }
+
+ const positions = (await sdk.api.abi.multiCall({
+ block, chain, abi: slipstreamNftABI.positions, target: nftAddress,
+ calls: positionIds.map((position) => ({ params: [position] })),
+ })).output.map(positionsCall => positionsCall.output)
+
+ const lpInfo = {}
+ positions.forEach(position => lpInfo[getKey(position)] = position)
+ const lpInfoArray = Object.values(lpInfo)
+
+ const poolInfos = (await sdk.api.abi.multiCall({
+ block, chain,
+ abi: slipstreamNftABI.getPool, target: factory,
+ calls: lpInfoArray.map((info) => ({ params: [info.token0, info.token1, info.tickSpacing] })),
+ })).output.map(positionsCall => positionsCall.output)
+
+ const slot0 = await sdk.api.abi.multiCall({ block, chain, abi: slipstreamNftABI.slot0, calls: poolInfos.map(i => ({ target: i })) })
+
+ slot0.output.forEach((slot, i) => lpInfoArray[i].tick = slot.output.tick)
+
+ positions.map(addV3PositionBalances)
+ return balances
+
+ function getKey(position) {
+ let { token0, token1, tickSpacing } = position
+ token0 = token0.toLowerCase()
+ token1 = token1.toLowerCase()
+ return `${token0}-${token1}-${tickSpacing}`
+ }
+
+ function addV3PositionBalances(position) {
+ const tickToPrice = (tick) => 1.0001 ** tick
+
+ const token0 = position.token0
+ const token1 = position.token1
+ const liquidity = position.liquidity
+ const bottomTick = +position.tickLower
+ const topTick = +position.tickUpper
+ const tick = +lpInfo[getKey(position)].tick
+ const sa = tickToPrice(bottomTick / 2)
+ const sb = tickToPrice(topTick / 2)
+
+ let amount0 = 0
+ let amount1 = 0
+
+ if (tick < bottomTick) {
+ amount0 = liquidity * (sb - sa) / (sa * sb)
+ } else if (tick < topTick) {
+ const price = tickToPrice(tick)
+ const sp = price ** 0.5
+
+ amount0 = liquidity * (sb - sp) / (sp * sb)
+ amount1 = liquidity * (sp - sa)
+ } else {
+ amount1 = liquidity * (sb - sa)
+ }
+
+ addToken({ balances, token: token0, amount: amount0, chain, blacklistedTokens, whitelistedTokens })
+ addToken({ balances, token: token1, amount: amount1, chain, blacklistedTokens, whitelistedTokens })
+ }
+}
+
function addToken({ balances, token, amount, chain, blacklistedTokens = [], whitelistedTokens = [] }) {
const addr = normalizeAddress(token, chain)
if (blacklistedTokens.length && blacklistedTokens.includes(addr)) return;
@@ -515,6 +632,7 @@ const cvx_abi = {
cvxBRP_userRewardPerTokenPaid: "function userRewardPerTokenPaid(address) view returns (uint256)",
cvxBRP_stakingToken: "address:stakingToken",
cvxBooster_poolInfo: "function poolInfo(uint256) view returns (address lptoken, address token, address gauge, address crvRewards, address stash, bool shutdown)",
+ cvxFraxFarm_lockedLiquidityOf: "function lockedLiquidityOf(address) view returns (uint256)",
}
const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31";
@@ -530,7 +648,7 @@ async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, cha
params: [holder],
chain, block
}),
- // const {output: pool_id} = await
+ // const {output: pool_id} = await
sdk.api.abi.call({
abi: cvx_abi['cvxBRP_pid'],
target: cvx_BaseRewardPool,
@@ -568,6 +686,43 @@ async function genericUnwrapCvxRewardPool({ api, owner, pool, balances }) {
return balances
}
+async function genericUnwrapCvxFraxFarm({ api, owner, farm, balances }) {
+ if (!balances) balances = await api.getBalances()
+ const [bal, fraxToken] = await api.batchCall([
+ { target: farm, params: owner, abi: cvx_abi.cvxFraxFarm_lockedLiquidityOf },
+ { target: farm, abi: 'address:stakingToken' },
+ ])
+ const [curveToken] = await api.batchCall([
+ { target: fraxToken, abi: 'address:curveToken' },
+ ])
+ sdk.util.sumSingleBalance(balances, curveToken, bal, api.chain)
+ return balances
+}
+
+
+async function genericUnwrapCvxPrismaPool({ api, owner, pool, balances }) {
+ if (!balances) balances = await api.getBalances()
+ const [bal, cToken] = await api.batchCall([
+ { target: pool, params: owner, abi: 'erc20:balanceOf' },
+ { target: pool, abi: 'address:lpToken' },
+ ])
+ sdk.util.sumSingleBalance(balances, cToken, bal, api.chain)
+ return balances
+}
+
+async function genericUnwrapCvxCurveLendRewardPool({ api, owner, rewardsContract, lendVault, balances }) {
+ if (!balances) balances = await api.getBalances()
+
+ const [bal, asset, pricePerShare] = await api.batchCall([
+ { target: rewardsContract, params: owner, abi: 'erc20:balanceOf' },
+ { target: lendVault, abi: 'address:asset' },
+ { target: lendVault, abi: 'uint256:pricePerShare' },
+ ])
+ const balance = BigNumber(bal).times(pricePerShare).div(1e18).toFixed(0)
+ sdk.util.sumSingleBalance(balances, asset, balance, api.chain)
+ return balances
+}
+
async function unwrapLPsAuto({ api, balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [], abis = {} }) {
if (api) {
chain = api.chain ?? chain
@@ -695,6 +850,7 @@ async function sumTokens2({
abis = {},
api,
resolveUniV3 = false,
+ resolveSlipstream = false,
uniV3WhitelistedTokens = [],
uniV3nftsAndOwners = [],
resolveArtBlocks = false,
@@ -704,7 +860,11 @@ async function sumTokens2({
fetchCoValentTokens = false,
tokenConfig = {},
sumChunkSize = undefined,
- uniV3ExtraConfig = {},
+ uniV3ExtraConfig = {
+ // positionIds
+ // nftAddress
+ // nftIdFetcher
+ },
resolveICHIVault = false,
solidlyVeNfts = [],
}) {
@@ -775,6 +935,9 @@ async function sumTokens2({
if (resolveUniV3 || uniV3nftsAndOwners.length || Object.keys(uniV3ExtraConfig).length)
await unwrapUniswapV3NFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, })
+ if (resolveSlipstream)
+ await unwrapSlipstreamNFTs({ balances, chain, block, owner, owners, blacklistedTokens, whitelistedTokens: uniV3WhitelistedTokens, nftsAndOwners: uniV3nftsAndOwners, uniV3ExtraConfig, })
+
blacklistedTokens = blacklistedTokens.map(t => normalizeAddress(t, chain))
tokensAndOwners = tokensAndOwners.map(([t, o]) => [normalizeAddress(t, chain), o]).filter(([token]) => !blacklistedTokens.includes(token))
tokensAndOwners = getUniqueToA(tokensAndOwners)
@@ -835,8 +998,8 @@ async function sumTokens2({
}
}
-function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, logCalls, ...args }) {
- return async (api) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args, })
+function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveSlipstream, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, logCalls, ...args }) {
+ return async (api) => sumTokens2({ api, balances, tokensAndOwners, tokensAndOwners2, tokens, owner, owners, transformAddress, unwrapAll, resolveLP, blacklistedLPs, blacklistedTokens, skipFixBalances, ownerTokens, resolveUniV3, resolveSlipstream, resolveArtBlocks, resolveNFTs, fetchCoValentTokens, ...args, })
}
async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances, isBPool = false, isV2 = true }) {
@@ -967,6 +1130,7 @@ async function unwrapSolidlyVeNft({ api, baseToken, veNft, owner, hasTokensOfOwn
module.exports = {
PANCAKE_NFT_ADDRESS,
unwrapUniswapLPs,
+ unwrapSlipstreamNFT,
addTokensAndLPs,
sumTokensAndLPsSharedOwners,
sumTokensAndLPs,
@@ -985,6 +1149,9 @@ module.exports = {
sumTokensExport,
genericUnwrapCvxDeposit,
genericUnwrapCvxRewardPool,
+ genericUnwrapCvxFraxFarm,
+ genericUnwrapCvxPrismaPool,
+ genericUnwrapCvxCurveLendRewardPool,
unwrapMakerPositions,
unwrap4626Tokens,
unwrapConvexRewardPools,
diff --git a/projects/helper/utils.js b/projects/helper/utils.js
index e4c8cbda8c..153da04c3d 100644
--- a/projects/helper/utils.js
+++ b/projects/helper/utils.js
@@ -84,6 +84,7 @@ function isLP(symbol, token, chain) {
if (chain === 'functionx' && ['FX-V2'].includes(symbol)) return true
if (chain === 'mantle' && ['MoeLP'].includes(symbol)) return true
if (chain === 'blast' && ['RING-V2'].includes(symbol)) return true
+ if (chain === 'fraxtal' && ['FS-V2'].includes(symbol)) return true
if (chain === 'era' && /(ZFLP)$/.test(symbol)) return true // for syncswap
if (chain === 'flare' && symbol.endsWith('_LP')) return true // for enosys dex
if (chain === 'songbird' && ['FLRX', 'OLP'].includes(symbol)) return true
@@ -262,7 +263,7 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = '
labelMapping[label] = token
})
- if (tokens.length > 100) {
+ if (tokens.length > 400) {
sdk.log('too many unknowns')
return;
}
diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js
index c5803bc346..b7523fd96e 100644
--- a/projects/helper/utils/solana/layout.js
+++ b/projects/helper/utils/solana/layout.js
@@ -6,10 +6,11 @@ const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } =
const { INVESTIN_FUND_DATA, } = require('./layouts/investin-layout')
const { MARKET_STATE_LAYOUT_V3, OPEN_ORDERS_LAYOUT_V2, MARKET_STATE_LAYOUT_V3_MINIMAL } = require('./layouts/openbook-layout')
const { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, } = require('./layouts/mixed-layout');
-const { SCN_STAKE_POOL } = require("./layouts/scnSOL");
+const { SCN_STAKE_POOL, TOKEN_LAYOUT, } = require("./layouts/scnSOL");
const { SANCTUM_INFINITY } = require("./layouts/sanctum-infinity-layout");
const { parseSanctumLstStateList } = require("./layouts/sanctum-validators-lsts-layout");
const { STAKE_POOL_PARTIAL } = require("./layouts/stake-pool-partial-layout");
+const { STAKE_POOL_LAYOUT } = require("./layouts/stakePool");
const parseReserve = (info) => {
const pubkey = PublicKey.default
@@ -39,6 +40,7 @@ const defaultParseLayout = Layout => info => {
}
const customDecoders = {
+ tokenAccount: defaultParseLayout(TOKEN_LAYOUT),
reserve: parseReserve,
lido: parseLido,
lidoValidatorList: parseLidoValidatorList,
@@ -59,7 +61,8 @@ const customDecoders = {
phoenix: parsePhoenix,
sanctumInfinity: defaultParseLayout(SANCTUM_INFINITY),
sanctumValidatorLsts: parseSanctumLstStateList,
- stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL)
+ stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL),
+ stakePool: defaultParseLayout(STAKE_POOL_LAYOUT),
}
function decodeAccount(layout, accountInfo) {
diff --git a/projects/helper/utils/solana/layouts/scnSOL.js b/projects/helper/utils/solana/layouts/scnSOL.js
index cbb43310ed..cdbbc2a24c 100644
--- a/projects/helper/utils/solana/layouts/scnSOL.js
+++ b/projects/helper/utils/solana/layouts/scnSOL.js
@@ -2,6 +2,21 @@ const {
struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128, option,
} = require('./layout-base')
+
+const TOKEN_LAYOUT = struct([
+ publicKey('mint'),
+ publicKey('owner'),
+ uint64('amount'),
+ u32('delegateOption'),
+ publicKey('delegate'),
+ u8('state'),
+ u32('isNativeOption'),
+ uint64('isNative'),
+ uint64('delegatedAmount'),
+ u32('closeAuthorityOption'),
+ publicKey('closeAuthority')
+])
+
const Fee = [
u64("denominator"),
u64("numerator"),
@@ -43,5 +58,6 @@ const SCN_STAKE_POOL = struct([
]);
module.exports = {
+ TOKEN_LAYOUT,
SCN_STAKE_POOL,
};
\ No newline at end of file
diff --git a/projects/helper/utils/solana/layouts/stakePool.js b/projects/helper/utils/solana/layouts/stakePool.js
new file mode 100644
index 0000000000..52b1107d0c
--- /dev/null
+++ b/projects/helper/utils/solana/layouts/stakePool.js
@@ -0,0 +1,133 @@
+const {
+ struct, s32, u8, u16, seq, blob, Layout, bits, u32, publicKey, uint64, u64, uint128, u128,
+} = require('./layout-base')
+
+// https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/js/src/layouts.ts
+
+const feeFields = [u64('denominator'), u64('numerator')];
+
+// https://github.com/solana-labs/solana-program-library/blob/master/stake-pool/js/src/codecs.ts
+class OptionLayout extends Layout {
+ // layout;
+ // discriminator;
+
+ constructor(layout, property) {
+ super(-1, property);
+ this.layout = layout;
+ this.discriminator = u8();
+ }
+
+ encode(src, b, offset = 0) {
+ if (src === null || src === undefined) {
+ return this.discriminator.encode(0, b, offset);
+ }
+ this.discriminator.encode(1, b, offset);
+ return this.layout.encode(src, b, offset + 1) + 1;
+ }
+
+ decode(b, offset = 0) {
+ const discriminator = this.discriminator.decode(b, offset);
+ if (discriminator === 0) {
+ return null;
+ } else if (discriminator === 1) {
+ return this.layout.decode(b, offset + 1);
+ }
+ throw new Error('Invalid option ' + this.property);
+ }
+
+ getSpan(b, offset = 0) {
+ const discriminator = this.discriminator.decode(b, offset);
+ if (discriminator === 0) {
+ return 1;
+ } else if (discriminator === 1) {
+ return this.layout.getSpan(b, offset + 1) + 1;
+ }
+ throw new Error('Invalid option ' + this.property);
+ }
+}
+
+function option(layout, property) {
+ return new OptionLayout(layout, property);
+}
+
+class FutureEpochLayout extends Layout {
+ // layout: Layout;
+ // discriminator: Layout;
+
+ constructor(layout, property) {
+ super(-1, property);
+ this.layout = layout;
+ this.discriminator = u8();
+ }
+
+ encode(src, b, offset = 0) {
+ if (src === null || src === undefined) {
+ return this.discriminator.encode(0, b, offset);
+ }
+ // This isn't right, but we don't typically encode outside of tests
+ this.discriminator.encode(2, b, offset);
+ return this.layout.encode(src, b, offset + 1) + 1;
+ }
+
+ decode(b, offset = 0) {
+ const discriminator = this.discriminator.decode(b, offset);
+ if (discriminator === 0) {
+ return null;
+ } else if (discriminator === 1 || discriminator === 2) {
+ return this.layout.decode(b, offset + 1);
+ }
+ throw new Error('Invalid future epoch ' + this.property);
+ }
+
+ getSpan(b, offset = 0) {
+ const discriminator = this.discriminator.decode(b, offset);
+ if (discriminator === 0) {
+ return 1;
+ } else if (discriminator === 1 || discriminator === 2) {
+ return this.layout.getSpan(b, offset + 1) + 1;
+ }
+ throw new Error('Invalid future epoch ' + this.property);
+ }
+}
+
+function futureEpoch(layout, property) {
+ return new FutureEpochLayout(layout, property);
+}
+
+const STAKE_POOL_LAYOUT = struct([
+ u8('accountType'),
+ publicKey('manager'),
+ publicKey('staker'),
+ publicKey('stakeDepositAuthority'),
+ u8('stakeWithdrawBumpSeed'),
+ publicKey('validatorList'),
+ publicKey('reserveStake'),
+ publicKey('poolMint'),
+ publicKey('managerFeeAccount'),
+ publicKey('tokenProgramId'),
+ u64('totalLamports'),
+ u64('poolTokenSupply'),
+ u64('lastUpdateEpoch'),
+ struct([u64('unixTimestamp'), u64('epoch'), publicKey('custodian')], 'lockup'),
+ struct(feeFields, 'epochFee'),
+ futureEpoch(struct(feeFields), 'nextEpochFee'),
+ option(publicKey(), 'preferredDepositValidatorVoteAddress'),
+ option(publicKey(), 'preferredWithdrawValidatorVoteAddress'),
+ struct(feeFields, 'stakeDepositFee'),
+ struct(feeFields, 'stakeWithdrawalFee'),
+ futureEpoch(struct(feeFields), 'nextStakeWithdrawalFee'),
+ u8('stakeReferralFee'),
+ option(publicKey(), 'solDepositAuthority'),
+ struct(feeFields, 'solDepositFee'),
+ u8('solReferralFee'),
+ option(publicKey(), 'solWithdrawAuthority'),
+ struct(feeFields, 'solWithdrawalFee'),
+ futureEpoch(struct(feeFields), 'nextSolWithdrawalFee'),
+ u64('lastEpochPoolTokenSupply'),
+ u64('lastEpochTotalLamports'),
+]);
+
+module.exports = {
+ STAKE_POOL_LAYOUT
+}
+
diff --git a/projects/henjin/index.js b/projects/henjin/index.js
new file mode 100644
index 0000000000..d0542c8ac2
--- /dev/null
+++ b/projects/henjin/index.js
@@ -0,0 +1,9 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ taiko: {
+ factory: "0x42B08e7a9211482d3643a126a7dF1895448d3509",
+ fromBlock: 400,
+ isAlgebra: true,
+ },
+});
diff --git a/projects/hibt/index.js b/projects/hibt/index.js
new file mode 100644
index 0000000000..f2544d5e6a
--- /dev/null
+++ b/projects/hibt/index.js
@@ -0,0 +1,21 @@
+const { cexExports } = require('../helper/cex')
+
+const config = {
+ ethereum: {
+ owners: [
+ '0x89a7f48b79516125c5521d5922a6dc0a085b3b95'
+ ],
+ },
+ bitcoin: {
+ owners: [
+ 'bc1qpxntlx09kqvpwl7vmjw9f28yvytdqkdx8xh63w'
+ ]
+ },
+ tron: {
+ owners: [
+ 'TWVCro8i15sJjmwRKfV53gPnCsgz2ThQSc'
+ ]
+ },
+}
+
+module.exports = cexExports(config)
\ No newline at end of file
diff --git a/projects/hinkal/hinkalUtils.js b/projects/hinkal/hinkalUtils.js
new file mode 100644
index 0000000000..d1eb07baea
--- /dev/null
+++ b/projects/hinkal/hinkalUtils.js
@@ -0,0 +1,63 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const sdk = require("@defillama/sdk");
+const ownerByChain = require("./owners.js");
+
+const nullAddress = ADDRESSES.null;
+
+const nativeVolatileChains = ["blast"];
+
+const getAllTokenBalances = async (tokenList, chain) => {
+ let balanceCalls = tokenList.map((token) => ({
+ target: token,
+ params: nativeVolatileChains.includes(chain)
+ ? ownerByChain[chain].owner ?? ""
+ : ownerByChain[chain],
+ }));
+
+ if (nativeVolatileChains.includes(chain)) {
+ const volatileBalanceCalls = tokenList.map((token) => ({
+ target: token,
+ params: ownerByChain[chain].volatileOwner ?? "",
+ }));
+
+ balanceCalls = [...balanceCalls, ...volatileBalanceCalls];
+ }
+
+ const balances = (
+ await sdk.api.abi.multiCall({
+ calls: balanceCalls,
+ abi: "erc20:balanceOf",
+ chain,
+ })
+ ).output;
+
+ const tokenBalances = balances.map((bal) => {
+ const token = bal.input.target;
+ const tokenBalance = bal.output;
+
+ return {
+ balance: tokenBalance,
+ address: token,
+ };
+ });
+
+ const nativeTokenBalance = (
+ await sdk.api.eth.getBalance({
+ target: nativeVolatileChains.includes(chain)
+ ? ownerByChain[chain].volatileOwner ?? ""
+ : ownerByChain[chain],
+ chain,
+ })
+ ).output;
+
+ tokenBalances.push({
+ address: nullAddress,
+ balance: nativeTokenBalance,
+ });
+
+ return tokenBalances.filter((tokenBal) => Number(tokenBal.balance) > 0);
+};
+
+module.exports = {
+ getAllTokenBalances,
+};
diff --git a/projects/hinkal/index.js b/projects/hinkal/index.js
index 423a7ddd25..91a310be26 100644
--- a/projects/hinkal/index.js
+++ b/projects/hinkal/index.js
@@ -1,17 +1,57 @@
-const { sumTokensExport } = require('../helper/unwrapLPs')
+const registryTokensByChain = require("./registryTokens.js");
+const registryTokensWithUnderlyingAddressesByChain = require("./registryTokensWithUnderlyingAddresses.js");
+const { getAllTokenBalances } = require("./hinkalUtils.js");
+const { toUSDTBalances } = require("../helper/balances.js");
-const config = {
- ethereum: "0x2ea81946fF675d5Eb88192144ffc1418fA442E28",
- arbitrum: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De",
- optimism: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De",
- polygon: "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5",
- avax: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De",
- bsc: "0x0036E884Cab4F427193839788EDEBB4B92B9a069",
- base: "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De",
-}
+const tvl = async (_, _1, _2, { chain, api }) => {
+ const tokenBalances = await getAllTokenBalances(
+ registryTokensByChain[chain],
+ chain
+ );
-Object.keys(config).forEach(chain => {
- module.exports[chain] = {
- tvl: sumTokensExport({ owner: config[chain], fetchCoValentTokens: true, tokenConfig: { onlyWhitelisted: false, } })
- }
-})
\ No newline at end of file
+ const chainTokensWithUnderlyingAddresses =
+ registryTokensWithUnderlyingAddressesByChain[chain];
+
+ const mappedTokens = tokenBalances.map((token) => {
+ const tokenUnderlyingAddress = chainTokensWithUnderlyingAddresses
+ ? chainTokensWithUnderlyingAddresses[token.address]
+ : undefined;
+
+ return {
+ address: tokenUnderlyingAddress ? tokenUnderlyingAddress : token.address,
+ balance: token.balance,
+ };
+ });
+
+ return api.addTokens(
+ mappedTokens.map((token) => token.address),
+ mappedTokens.map((token) => token.balance)
+ );
+};
+
+module.exports = {
+ ethereum: {
+ tvl,
+ },
+ base: {
+ tvl,
+ },
+ arbitrum: {
+ tvl,
+ },
+ optimism: {
+ tvl,
+ },
+ polygon: {
+ tvl,
+ },
+ avax: {
+ tvl,
+ },
+ bsc: {
+ tvl,
+ },
+ blast: {
+ tvl,
+ },
+};
diff --git a/projects/hinkal/owners.js b/projects/hinkal/owners.js
new file mode 100644
index 0000000000..893c5de86d
--- /dev/null
+++ b/projects/hinkal/owners.js
@@ -0,0 +1,25 @@
+const ETHEREUM_OWNER = "0x2ea81946fF675d5Eb88192144ffc1418fA442E28";
+const ARBITRUM_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De";
+const OPTIMISM_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De";
+const POLYGON_OWNER = "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5";
+const AVALANCHE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De";
+const BNB_OWNER = "0x0036E884Cab4F427193839788EDEBB4B92B9a069";
+const BASE_OWNER = "0x41658B0DaF59Bb2FbB2D9A5249207011d2B364De";
+const BLAST_OWNER = "0x9606ebb543972fd8aed764341ead8ec94888b7b7";
+const BLAST_VOLATILE_OWNER = "0xba65d50cf4e6e739b2735338a964c3354faf9b19";
+
+const ownerByChain = {
+ ethereum: ETHEREUM_OWNER,
+ arbitrum: ARBITRUM_OWNER,
+ optimism: OPTIMISM_OWNER,
+ polygon: POLYGON_OWNER,
+ avax: AVALANCHE_OWNER,
+ bsc: BNB_OWNER,
+ base: BASE_OWNER,
+ blast: {
+ owner: BLAST_OWNER,
+ volatileOwner: BLAST_VOLATILE_OWNER,
+ },
+};
+
+module.exports = ownerByChain;
diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js
new file mode 100644
index 0000000000..338d3f06a3
--- /dev/null
+++ b/projects/hinkal/registryTokens.js
@@ -0,0 +1,989 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const ETHEREUM_REGISTRY_TOKENS = [
+ ADDRESSES.ethereum.USDC,
+ ADDRESSES.ethereum.USDT,
+ ADDRESSES.ethereum.WETH,
+ ADDRESSES.ethereum.WBTC,
+ ADDRESSES.ethereum.DAI,
+ "0x8E870D67F660D95d5be530380D0eC0bd388289E1",
+ ADDRESSES.ethereum.SDAI,
+ "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
+ "0xc4AD29ba4B3c580e6D59105FFf484999997675Ff",
+ ADDRESSES.ethereum.FRAX,
+ "0xFC2838a17D8e8B1D5456E0a351B0708a09211147",
+ "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC",
+ "0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd",
+ "0xf43211935C781D5ca1a41d2041F397B8A7366C7A",
+ "0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B",
+ ADDRESSES.ethereum.CRV,
+ "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",
+ "0x5a6A4D54456819380173272A5E8E9B9904BdF41B",
+ ADDRESSES.ethereum.sUSD,
+ "0xC25a3A3b969415c80451098fa907EC722572917F",
+ "0xb2C35aC676F4A002669e195CF4dc50DDeDF6F0fA",
+ "0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb",
+ "0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c",
+ "0xFCc5c47bE19d06BF83eB04298b026F81069ff65b",
+ "0x99f5aCc8EC2Da2BC0771c32814EFF52b712de1E5",
+ "0xfE18be6b3Bd88A2D2A7f928d00292E7a9963CfC6",
+ "0x051d7e5609917Bd9b73f04BAc0DED8Dd46a74301",
+ ADDRESSES.ethereum.LUSD,
+ "0x5E8422345238F34275888049021821E8E08CAa1f",
+ ADDRESSES.ethereum.CVX,
+ "0x865377367054516e17014CcdED1e7d814EDC9ce4",
+ "0x3A283D9c08E8b55966afb64C515f5143cf907611",
+ "0x06325440D014e39736583c165C2963BA99fAf14E",
+ "0x4d9f9D15101EEC665F77210cB999639f760F831E",
+ ADDRESSES.ethereum.RETH,
+ "0x6c38cE8984a890F5e46e6dF6117C26b3F1EcfC9C",
+ ADDRESSES.ethereum.cvxCRV,
+ "0x971add32Ea87f10bD192671630be3BE8A11b8623",
+ ADDRESSES.ethereum.TUSD,
+ "0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1",
+ "0xb40b6608B2743E691C9B54DdBDEe7bf03cd79f1c",
+ "0x68934F60758243eafAf4D2cFeD27BF8010bede3a",
+ "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6",
+ "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1",
+ "0x9D0464996170c6B9e75eED71c68B99dDEDf279e8",
+ "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",
+ ADDRESSES.ethereum.cvxFXS,
+ "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9",
+ "0xB30dA2376F63De30b42dC055C93fa474F31330A5",
+ "0x828b154032950C8ff7CF8085D841723Db2696056",
+ "0x2A8e1E676Ec238d8A992307B495b45B3fEAa5e86",
+ "0x87650D7bbfC3A9F10587d7778206671719d9910D",
+ "0x1cEB5cB57C4D4E2b2433641b95Dd330A33185A44",
+ "0x4647B6D835f3B393C7A955df51EEfcf0db961606",
+ "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6",
+ ADDRESSES.ethereum.LIDO,
+ "0xb79565c01b7Ae53618d9B847b9443aAf4f9011e7",
+ ADDRESSES.ethereum.YFI,
+ "0x29059568bB40344487d62f7450E78b8E6C74e0e5",
+ ADDRESSES.ethereum.cbETH,
+ "0x5b6C539b224014A09B3388e51CaAA8e354c959C8",
+ "0xd7C9F0e536dC865Ae858b0C0453Fe76D13c3bEAc",
+ "0x326290A1B0004eeE78fa6ED4F1d8f4b2523ab669",
+ "0xBEA0000029AD1c77D3d5D23Ba2D8893dB9d1Efab",
+ "0xc9C32cd16Bf7eFB85Ff14e0c8603cc90F6F2eE49",
+ "0x836A808d4828586A69364065A1e064609F5078c7",
+ "0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c",
+ "0x21E27a5E5513D6e65C4f830167390997aA84843a",
+ "0xdB25f211AB05b1c97D595516F45794528a807ad8",
+ "0x3D229E1B4faab62F621eF2F6A610961f7BD7b23B",
+ "0x856c4Efb76C1D1AE02e20CEB03A2A6a08b0b8dC3",
+ "0x94B17476A93b3262d87B9a326965D1E91f9c13E7",
+ "0xF95AAa7EBB1620e46221B73588502960Ef63dBa0",
+ ADDRESSES.ethereum.tBTC,
+ "0xa2E3356610840701BDf5611a53974510Ae27E2e1",
+ "0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643",
+ "0x39AA39c021dfbaE8faC545936693aC917d5E7563",
+ "0x845838DF265Dcd2c412A1Dc9e959c7d08537f8a2",
+ "0x0316EB71485b0Ab14103307bf65a021042c6d380",
+ "0xb19059ebb43466C323583928285a49f558E572Fd",
+ "0x8e595470Ed749b85C6F7669de83EAe304C2ec68F",
+ "0x76Eb2FE28b36B3ee97F3Adae0C69606eeDB2A37c",
+ "0x48759F220ED983dB51fA7A8C0D2AAb8f3ce4166a",
+ "0x5282a4eF67D9C33135340fB3289cc1711c13638C",
+ "0x075b1bb99792c9E1041bA13afEf80C91a1e70fB3",
+ "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D",
+ "0x49849C98ae39Fff122806C06791Fa73784FB3675",
+ "0xA0d69E286B938e21CBf7E51D71F6A4c8918f482F",
+ ADDRESSES.ethereum.CRVUSD,
+ "0x3835a58CA93Cdb5f912519ad366826aC9a752510",
+ "0x892D701d94a43bDBCB5eA28891DaCA2Fa22A690b",
+ "0x5Ca135cB8527d76e932f34B5145575F9d8cbE08E",
+ "0x4704aB1fb693ce163F7c9D3A31b3FF4eaF797714",
+ "0xD2967f45c4f384DEEa880F807Be904762a3DeA07",
+ "0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA",
+ "0xF3A43307DcAFa93275993862Aae628fCB50dC768",
+ "0xE57180685E3348589E9521aa53Af0BCD497E884d",
+ "0x1539c2461d7432cc114b0903f1824079BfCA2C92",
+ "0xd4D620B23E91031fa08045b6083878f42558d6b9",
+ "0xe17D6212eAa54D98187026A770dee96f7C264feC",
+ "0xD1BeaD7CadcCC6b6a715A6272c39F1EC54F6EC99",
+ "0x047c41817954b51309a2bd6f60e47bC115C23f1F",
+ "0x6853691Ca8Da03Da16194E468068bE5A80F103b0",
+ "0xCc19786F91BB1F3F3Fd9A2eA9fD9a54F7743039E",
+ "0x4dE81AD42E9651755716177fAe9911c54F5b055B",
+ "0x06c1e90eeb34e7Fa6d78B8E58348Ae15C1a615E4",
+ "0xe50e2fe90745A8510491F89113959a1EF01AD400",
+ "0x8cB4f56e9bAa398b6F6a6Fb1B2C4E8ca8cda6ae5",
+ "0xd5bAd7c89028B3F7094e40DcCe83D4e6b3Fd9AA4",
+ "0x7f3F33B42b9734e61cb44424D130B5f6e09C9Db3",
+ "0x15780E0e9618c26dA679740C43bEc76830Ff187b",
+ "0xFc6a9D39b44a174B5Ba708dBaa437632d78B8585",
+ "0x83BE6565c0758f746c09f95559B45Cfb9a0FFFc4",
+ "0xfE5716D0C141F3d800995420e1d3fB0D0CFFCC31",
+ "0x4115150523599D1F6C6Fa27F5A4C27D578Fd8ce5",
+ "0x49b562bDcd28dB124f6bA51DEB8Ca483563c067a",
+ "0xBE2bD093B8F342e060E79Fad6059B1057F016Ba4",
+ "0x3fe43D4ba0a5BAcC800c7E7E782466a27ab108bf",
+ "0x4dd0cF20237deb5F2bE76340838B9e2D7c70E852",
+ "0xE0d5f9DA3613C047003b77cAa31270aBE3EdA6b0",
+ "0xB9911AB699FD781efDA446e7FD995d375B437c8B",
+ "0x37925b6319cD41014583A6476a7a1d52Ea404b2f",
+ "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF",
+ "0x42ED016F826165C2e5976fe5bC3df540C5aD0Af7",
+ "0x1E19CF2D73a72Ef1332C882F20534B6519Be0276",
+ "0x3FA8C89704e5d07565444009e5d9e624B40Be813",
+ "0x32296969Ef14EB0c6d29669C550D4a0449130230",
+ "0x7F86Bf177Dd4F3494b841a37e810A34dD56c829B",
+ "0xe6b5CC1B4b47305c58392CE3D359B10282FC36Ea",
+ "0x2863a328A0B7fC6040f11614FA0728587DB8e353",
+ "0x642431623AE5d73C19fC931aAeA0d4677303880c",
+ "0xa2847348b58CEd0cA58d23c7e9106A49f1427Df6",
+ "0xeaCADc656c9394fb09af25AeBc0897fDfFe484A1",
+ "0x380aAbE019ed2a9C2d632b51eDDD30fd804d0fAD",
+ "0x101816545F6bd2b1076434B54383a1E633390A2E",
+ "0x4d224452801ACEd8B2F0aebE155379bb5D594381",
+ "0x20a61B948E33879ce7F23e535CC7BAA3BC66c5a9",
+ "0x5870700f1272a1adbb87c3140bd770880a95e55d",
+ "0x93ce650b8d3a7a7e44121db82a0429a3884db599",
+ "0xE49127B7AEfc043847caDd85B8a41973854D30f5",
+ "0x8A31A94bF0926B82083C80E18B331085B84E92D7",
+ "0xcc26a5246c6a04a85e997d6581c1b4f14363841a",
+ "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71",
+ "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8",
+ "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2",
+ "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f",
+ "0xD1105d6502d3c562B447A75149B00aD366b3212d",
+ "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9",
+ "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3",
+ "0x9ee91F9f426fA633d227f7a9b000E28b9dfd8599",
+ ADDRESSES.ethereum.MATIC,
+ ADDRESSES.ethereum.STETH,
+ ADDRESSES.ethereum.EETH,
+ ADDRESSES.ethereum.WSTETH,
+ "0xa0Cd8B83B63381895C1854A605315fa7eF50e026",
+ "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550",
+ "0x9434722bf29750B44649eb1b1A10a335d40edFc1",
+ "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe",
+ "0x5F1894e4b409D7199Ea209b9e43C996640BCB691",
+ "0xa653510227752632ebf692a77e5032d4afFaB3a2",
+ "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee",
+ "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e",
+ "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247",
+ "0x94cc50e4521bd271c1a997a3a4dc815c2f920b41",
+ "0xfef79304c80a694dfd9e603d624567d470e1a0e7",
+ "0x8272e1a3dbef607c04aa6e5bd3a1a134c8ac063b",
+ "0xc794c6a95f30d0ebf7b3bbe85e8a0a95c9e411c1",
+ "0xaeda92e6a3b1028edc139a4ae56ec881f3064d4f",
+ "0xacdf0dba4b9839b96221a8487e9ca660a48212be",
+ ADDRESSES.ethereum.LINK,
+ "0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32",
+ "0x04c154b66cb340f3ae24111cc767e0184ed00cc6",
+ "0xf8fde8a259a3698902c88bdb1e13ff28cd7f6f09",
+ "0x76237BCfDbe8e06FB774663add96216961df4ff3",
+ "0x0dE54CFdfeD8005176f8b7A9D5438B45c4F1df1e",
+ "0xb27D1729489d04473631f0AFAca3c3A7389ac9F8",
+ "0x38D64ce1Bdf1A9f24E0Ec469C9cAde61236fB4a0",
+ "0x9961BdBE8B7091E584c2bF9D0a160C583f564A8c",
+ "0xe2Ed1dAc3A9547BC6057e32bf8133b5268D7d987",
+ "0x6307e6688819951cf8d6b6066018243d2496952f",
+ "0xe035e27a8ed6842b478933820f90093d205f7098",
+ "0x4ef4c7519023f30a78647eeab321d6cfabc2513c",
+ "0x4253ac4046fbfdafcfe125d067b6d89f6923843e",
+ "0x67701d67b60a96473bfc4873e7a484035c8609b0",
+ "0x6685fcfce05e7502bf9f0aa03b36025b09374726",
+ "0xe3e637f8acc097244a065791142c29fbf5877d18",
+ "0x1BB9b64927e0C5e207C9DB4093b3738Eef5D8447",
+ "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65",
+ "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E",
+ "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D",
+ "0x26dA2546602f63b84B3C4dF36476364f6350706E",
+ "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C",
+ "0xA27fa5E11B121277423aC0b8b372596f2805e36a",
+ "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16",
+ "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
+ "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
+ "0xbf5495efe5db9ce00f80364c8b423567e58d2110",
+ "0xD9A442856C234a39a81a089C06451EBAa4306a72",
+ "0xAC0047886a985071476a1186bE89222659970d65",
+ "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677",
+ "0xc69Ad9baB1dEE23F4605a82b3354F8E40d1E5966",
+ "0x730A5E2AcEbccAA5e9095723B3CB862739DA793c",
+ "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C",
+ "0xB05cABCd99cf9a73b19805edefC5f67CA5d1895E",
+ "0x253008ba4aE2f3E6488DC998a5321D4EB1a0c905",
+ "0x391B570e81e354a85a496952b66ADc831715f54f",
+ "0xC58aa33Ce619c7f7Ac4929DF357D0Ef762edbD23",
+ "0x7a493be5c2ce014cd049bf178a1ac0db1b434744",
+ "0x98601E27d41ccff643da9d981dc708cf9eF1F150",
+ "0xDDFD5e912C1949B4bDb12579002c44B7A83F9E88",
+ "0xD7DF7E085214743530afF339aFC420c7c720BFa7",
+ "0x7C2D26182adeEf96976035986cF56474feC03bDa",
+ "0x4AE5411F3863CdB640309e84CEDf4B08B8b33FfF",
+ "0x34349c5569e7b846c3558961552d2202760a9789",
+ "0x029aad400f6092dc735a65be95102efcc2fe64bf",
+ "0x094be6bd31d7b860f7d2c1f280fd09f0463d7e67",
+ "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E",
+ "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F",
+ "0x4E0854085bC5a2fa8031ea5819863BD280e610F3",
+ "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019",
+ "0x223026549740E2672b3f05c867Fd2B31207338A2",
+ "0x3e0A917d4d914e432B82825e6FBEe039b89f4477",
+ "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8",
+ "0x0B925eD163218f6662a35e0f0371Ac234f9E9371",
+ "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8",
+ "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c",
+ "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a",
+ "0x018008bfb33d285247A21d44E50697654f754e63",
+ "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656",
+ "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e",
+ "0xBcca60bB61934080951369a648Fb03DF4F96263C",
+ "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811",
+ "0x028171bCA77440897B824Ca71D1c56caC55b68A3",
+ "0x582d872a1b094fc48f5de31d3b73f2d9be47def1",
+ "0x2af5d2ad76741191d15dfe7bf6ac92d4bd912ca3",
+ "0x3c3a81e81dc49a522a592e7622a7e711c06bf354",
+ "0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b",
+ "0x75231f58b43240c9718dd58b4967c5114342a86c",
+ "0x6de037ef9ad2725eb40118bb1702ebb27e4aeb24",
+ "0xf57e7e7c23978c3caec3c3548e3d615c346e79ff",
+ "0xc944e90c64b2c07662a292be6244bdf05cda44a7",
+ "0xe28b3b32b6c345a34ff64674606124dd5aceca30",
+ ADDRESSES.ethereum.USDe,
+ "0xaea46a60368a7bd060eec7df8cba43b7ef41ad85",
+ "0x4a220e6096b25eadb88358cb44068a3248254675",
+ "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce",
+ "0x57e114b691db790c35207b2e685d4a43181e6061",
+ ADDRESSES.ethereum.AAVE,
+ ADDRESSES.ethereum.UNI,
+ "0xEEda34A377dD0ca676b9511EE1324974fA8d980D",
+ "0x0d86883faf4ffd7aeb116390af37746f45b6f378",
+ "0x73a15fed60bf67631dc6cd7bc5b6e8da8190acf5",
+];
+
+const ARBITRUM_REGISTRY_TOKENS = [
+ ADDRESSES.arbitrum.USDC,
+ ADDRESSES.arbitrum.USDC_CIRCLE,
+ ADDRESSES.arbitrum.USDT,
+ ADDRESSES.arbitrum.WETH,
+ ADDRESSES.arbitrum.WBTC,
+ ADDRESSES.optimism.DAI,
+ ADDRESSES.arbitrum.MIM,
+ "0x7f90122BF0700F9E7e1F688fe926940E8839F353",
+ "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F",
+ "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978",
+ "0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17",
+ "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb",
+ ADDRESSES.kava.axlUSDC,
+ "0xC9B8a3FDECB9D5b218d02555a8Baf332E5B740d5",
+ ADDRESSES.arbitrum.WSTETH,
+ "0x8616E8EA83f048ab9A5eC513c9412Dd2993bcE3F",
+ ADDRESSES.fantom.renBTC,
+ "0x93FC1235119c554576D8AB23583371fc25B803ee",
+ "0xaE6aab43C4f3E0cea4Ab83752C278f8dEbabA689",
+ "0xb1781BF9C582A71269c6098E4155Ea8b15B35305",
+ "0xf94a05257D3Dd44f30799F03D190988d59aae868",
+ "0x59bF0545FCa0E5Ad48E13DA269faCD2E8C886Ba4",
+ "0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1",
+ "0x8e0B8c8BB9db49a46697F3a5Bb8A308e744821D2",
+ "0xDbcD16e622c95AcB2650b38eC799f76BFC557a0b",
+ "0x30dF229cefa463e991e29D42DB0bae2e122B2AC7",
+ "0x2ce5Fd6f6F4a159987eac99FF5158B7B62189Acf",
+ "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
+ "0x755D6688AD74661Add2FB29212ef9153D40fcA46",
+ "0x3E01dD8a5E1fb3481F0F589056b428Fc308AF0Fb",
+ "0xaB174fFA530C888649C44C4d21C849BBAaBc723F",
+ "0xae0babD1483ed944BeEd2e112021Ed01301A83aC",
+ "0xd92Be5A1c565Db5256cDD537B875ED46111Bd8b0",
+ "0xfC78eAFf2E8290D3d608B689e93ec6954E21B6C2",
+ "0xB27c433C1cdb1B42E2601Af2d40dD442fbf1cdc3",
+ "0x9dbbBaecACEDf53d5Caa295b8293c1def2055Adc",
+ "0x9E75f8298e458B76382870982788988A0799195b",
+ "0xDa2307A45D298e855415675bF388e2bd64351D5b",
+ "0xEc7c0205a6f426c2Cb1667d783B5B4fD2f875434",
+ "0x07Db98358D58Ba9bE90cd0A18cd86AF807ac3B4E",
+ "0x8cbaAC87FDD9Bb6C3FdB5b3C870b2443D0284fa6",
+ "0x71c15610F11D669d4A9e02a64e43c6D1E27c6Cad",
+ "0xBDF4e730ED5152a7AC646BB7b514Ed624E1147C4",
+ "0xf6a1284Dc2ce247Bca885ac4F36b37E91d3bD032",
+ "0x994Ff2ab544D00aD4EC0380a1Be8F75f4EC47Cf9",
+ "0x46034C63ad03254D6E96c655e82393E6C31E07C3",
+ "0xD496eA90a454eA49e30A8fD9E053C186D4FC897D",
+ "0xd37025aC6227334C7762AeD5929Ce3272fbb6fdC",
+ "0xFCb0101503f399B4752E5160ccd5EcE3a71719bd",
+ "0xa7fC98760331409c1FC0177dECF083cE9d5aed87",
+ "0x5A8beF2fEb83057bBCcC81cea985a94a62A86208",
+ "0x5B904f19fb9ccf493b623e5c8cE91603665788b0",
+ "0xA98070C4a600678a93cEaF4bF629eE255F46f64F",
+ "0x0594Ec32240C78e056304b4A60f48a67c69179b4",
+ "0xB2DefC5c3A69abe2B681C714b080A892825B2073",
+ "0x4D323f77c32EDdC62BF8eAbA11E5C573FD0a2ccd",
+ "0xeD29730F9FF29ea50D63462D8EC84307d36b8954",
+ "0x12c997FAdca32dB01E3145DE7Bf9cdB06455391D",
+ "0x85B10228cd93A6e5E354Ff0f2c60875E8E62F65A",
+ "0xCF297A94d527A34081Db2A20Eb1c87248cD1ea81",
+ "0xa0d758b81f8ed6635CDE1DA91C8fe1bD48C28A09",
+ "0xfd421d60905d2f7cabd49e6a5703a3499367b8f4",
+ "0xe20F93279fF3538b1ad70D11bA160755625e3400",
+ "0x4a2f6ae7f3e5d715689530873ec35593dc28951b",
+ "0xb67c014fa700e69681a673876eb8bafaa36bff71",
+ ADDRESSES.arbitrum.GMX,
+ "0x3c6ef5ed8ad5df0d5e3d05c6e607c60f987fb735",
+ "0x9cb911cbb270cae0d132689ce11c2c52ab2dedbc",
+ "0x9791d590788598535278552eecd4b211bfc790cb",
+ "0xade4a71bb62bec25154cfc7e6ff49a513b491e81",
+ "0xced06c9330b02c378c31c7b12570b1c38abfcea6",
+ "0x423a1323c871abc9d89eb06855bf5347048fc4a5",
+ "0xbf6cbb1f40a542af50839cad01b0dc1747f11e18",
+ "0x5892bA611fdC1598b72a30D087d28c989d429eF7",
+ "0x3fd4954a851ead144c2ff72b1f5a38ea5976bd54",
+ "0x8bc65eed474d1a00555825c91feab6a8255c2107",
+ "0x892785f33cdee22a30aef750f285e18c18040c3e",
+ "0x36bf227d6bac96e2ab1ebb5492ecec69c691943f",
+ "0x5402b5f40310bded796c7d0f3ff6683f5c0cffdf",
+ "0x905dfcd5649217c42684f23958568e533c711aa3",
+ "0xB7E50106A5bd3Cf21AF210A755F9C8740890A8c9",
+ "0xc9f52540976385a84bf416903e1ca3983c539e34",
+ "0x542f16da0efb162d20bf4358efa095b70a100f9e",
+ "0x59745774ed5eff903e615f5a2282cae03484985a",
+ "0xce3b19d820cb8b9ae370e423b0a329c4314335fe",
+ "0x539bdE0d7Dbd336b79148AA742883198BBF60342",
+ "0x99c409e5f62e4bd2ac142f17cafb6810b8f0baae",
+ ADDRESSES.arbitrum.ARB,
+ "0xC3691c157D1B3A431B841230a7B11d5a373097e1",
+ "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee",
+ "0xCC26A5246C6A04a85E997d6581C1b4f14363841a",
+ "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5",
+ "0x59eC3043D7314B9650294Fd800149b53007f804E",
+ "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053",
+ "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19",
+ "0x886867993080DC3bBFC39CDfc343A0e083bB34E0",
+ "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215",
+ "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed",
+ ADDRESSES.arbitrum.LINK,
+ "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0",
+ "0x9623063377ad1b27544c965ccd7342f7ea7e88c7",
+ "0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91",
+ "0x13ad51ed4f1b7e9dc168d8a00cb3f4ddd85efa60",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
+ "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf",
+ "0x078f358208685046a11C85e8ad32895DED33A249",
+ "0x724dc807b04555b71ed48a6896b6F41593b8C637",
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
+ "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe",
+ "0x4186BFC76E2E237523CBC30FD220FE055156b41F",
+ ADDRESSES.blast.ezETH,
+];
+
+const OPTIMISM_REGISTRY_TOKENS = [
+ ADDRESSES.optimism.USDC_CIRCLE,
+ ADDRESSES.optimism.USDC,
+ ADDRESSES.optimism.USDT,
+ ADDRESSES.optimism.WETH_1,
+ ADDRESSES.optimism.WBTC,
+ ADDRESSES.optimism.DAI,
+ ADDRESSES.optimism.sUSD,
+ "0x061b87122Ed14b9526A813209C8a59a633257bAb",
+ ADDRESSES.optimism.WSTETH,
+ "0xEfDE221f306152971D8e9f181bFe998447975810",
+ "0x298B9B95708152ff6968aafd889c6586e9169f1D",
+ "0x9F2fE3500B1a7E285FDc337acacE94c480e00130",
+ "0x1337BedC9D22ecbe766dF105c9623922A27963EC",
+ "0x0994206dfe8de6ec6920ff4d779b0d950605fb53",
+ ADDRESSES.optimism.sETH,
+ "0x7Bc5728BC2b59B45a58d9A576E2Ffc5f0505B35E",
+ "0xB153FB3d196A8eB25522705560ac152eeEc57901",
+ "0x810D1AaA4Cd8F21c23bB648F2dfb9DC232A01F09",
+ "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40",
+ "0x1Dc5c0f8668a9F54ED922171d578011850ca0341",
+ "0x0892a178c363b4739e5Ac89E9155B9c30214C0c0",
+ "0xD09B5a0650d68Aae6B1666eE5E770a383d29A97C",
+ "0x56770b94279539416855fe29Ef14b26438B5e421",
+ "0x95a05D06Decf8e1Eb93aE09B612FbD342F2F9E2E",
+ "0x7Ca75bdEa9dEde97F8B13C6641B768650CB83782",
+ "0x4Fd63966879300caFafBB35D157dC5229278Ed23",
+ "0xd16232ad60188B68076a235c65d692090caba155",
+ "0xE54e4020d1C3afDB312095D90054103E68fe34B0",
+ "0x6dA98Bde0068d10DDD11b468b197eA97D96F96Bc",
+ "0xbcFa4cfA97f74a6AbF80b9901569BBc8654F4315",
+ "0x0b28C2e41058EDc7D66c516c617b664Ea86eeC5d",
+ "0x3f42Dc59DC4dF5cD607163bC620168f7FF7aB970",
+ "0xFF5318f81Dd791e92d51b8A54fA3538832D2890D",
+ "0xBE418771bC91F75C4d2BcE1d5E2b7286F50992da",
+ "0x2e17b8193566345a2Dd467183526dEdc42d2d5A8",
+ "0x5C2048094bAaDe483D0b1DA85c3Da6200A88a849",
+ "0xBD08972Cef7C9a5A046C9Ef13C9c3CE13739B8d6",
+ "0xa1055762336F92b4B8d2eDC032A0Ce45ead6280a",
+ "0xB720FBC32d60BB6dcc955Be86b98D8fD3c4bA645",
+ "0x2B47C794c3789f499D8A54Ec12f949EeCCE8bA16",
+ "0x6e57B9E54ea043a829584B22182ad22bF446926C",
+ "0xe8B8bfF1E415258eb3d5FA8DeeE9C38406e609cd",
+ "0x1f8b46abe1EAbF5A60CbBB5Fb2e4a6A46fA0b6e6",
+ "0x8134A2fDC127549480865fB8E5A9E8A8a95a54c5",
+ "0xE5F28Fc43Bb40CDF7202ebe406793815b6f07FbD",
+ "0x4d7959d17B9710BE87e3657e69d946914221BB88",
+ "0xB280D03909Cc18640621955Cb3bC30948DF2Fa9a",
+ "0x22D63A26c730d49e5Eab461E4f5De1D8BdF89C92",
+ "0x19715771E30c93915A5bbDa134d782b81A820076",
+ "0x0df083de449F75691fc5A36477a6f3284C269108",
+ "0x3DD9556a521d6e57bE480c94da102fedf0429aba",
+ "0x107Dbf9c9C0EF2Df114159e5C7DC2baf7C444cFF",
+ "0x54214d0C7772eb6f71ED4De294b3f809691005C9",
+ "0xF731390c889d9a2089C5bC1d4640F3BA0708D82B",
+ "0xbe7dC3d2457BBff03943d962F7E4cEE34DFBA69d",
+ "0x25DE69dA4469A96974FaE79d0C41366A63317FDC",
+ "0x06E0A84c71dBD037c618CCf90798474E0e6f9C91",
+ "0x88F72d1f49Ea88f86fc52bebB0c1d0Ef232AE483",
+ "0x35775aA87b4CA1c04a6c579c90cE9add09247958",
+ "0xE2f035f59De6a952FF699b4EDD0f99c466f25fEc",
+ "0xef8D6dDE0a0f0CCdaDB678366a94D93f1C449689",
+ "0x2232455bf4622002c1416153EE59fd32B239863B",
+ "0xdCC5DC90A803928Dc21556590D4620030966270F",
+ "0x3b4DdC7888F752a96290344a1A926E73b80423c0",
+ "0xcAa74e50428bDC4Af6A7Ead65fFFf77F0D231E80",
+ "0x062F29e2b5bD99523DD3508207eb2C2CbAf98D50",
+ "0x7c2967C20B03a8004ea81e86Ac1847D00e7B4CD1",
+ "0x52cC5B5CB98C9a7fb8cCe7d4b4e8F41E26ce04a8",
+ "0x6B47afc8bf3b2e013b5e9178e8015Cc620983b51",
+ "0x011028aB93B355308E4350D109F42aeCfA075604",
+ "0x8a21Ea69300Fe56ee19fE974e9791a212114573F",
+ "0xa85F2DeBc911c54414f99103123965c94e351873",
+ "0x746c19A336A3131fD85D3AB5F16576b1b047F512",
+ "0x1973ef31F2A82B3f73b8C9Ee1c440615084d5242",
+ "0x6Fb45a8183660F30EA1c6cDFDDBFdC7ef7925801",
+ "0xfE1C64D42B7d6554Cc2ACD0D74e2983a2dE4A62f",
+ "0x8aD01c3a425987c508A69149185383BAf6F47534",
+ "0x453f61390ce6DfB668bbF4D93E58c94BB0ae81f3",
+ "0x1A1F0Db1050D1cAD52eEB72371EbFD7716b53a2f",
+ "0x718A66F21415a5f75F5e8652e8Be55FCF1D1df05",
+ "0x1910CCeCC57869F1Ff2337dda001246B92E8418A",
+ "0xB8Ce10759feb3B63B75557f5f9933bD22127f0eC",
+ "0x100Cd460D7f549B4cc2Ed35d4ff20ac71B377C96",
+ "0x2bC96f9e07Edc7F1aA9Aa26E85dc7dd30ACe59a6",
+ "0x2793AF2c7db9f0A06d2727Dd392Ab4Bb1b82a98D",
+ "0x00557e194B717dCfEbaE6222091C5F806DF99698",
+ "0x182fe51442C7D65360eD1511f30be6261c2C20C1",
+ "0xD019FD6267F93ebE5A92DEBB760135a4F02a75F7",
+ "0xf92129fE0923d766C2540796d4eA31Ff9FF65522",
+ "0x79149B500f0d796aA7f85e0170d16C7e79BAd3C5",
+ "0x92651E1bBfE0f8423119AfC4B0610C747Fa125a1",
+ "0x738CDf563C41aAF8aA350D0a3c24bF614FfD75dC",
+ "0x669fBdda8553edeAEdd7272391aC966a8AABEC21",
+ "0x797c35a8032CE0A8dFcA308ac1b2276359cd463b",
+ "0xD9E277eA320C53dE06C535f0D922A76a68CB9A9C",
+ "0x9B280aD674d35008482F94a673f8017B961C29F6",
+ "0x972F747285c2f32699CEFFEbdcF2Ae74F4b58D0c",
+ "0x935A64d0825D86c1ca57Fe8f270e635AC1a0878A",
+ "0xdD84190aF336Ee2831eea88B6783958e8F269de9",
+ "0xB708038C1b4cF9f91CcB918DAD1B9fD757ADa5C1",
+ "0x81F2F132465Ffb4B3C5d11f3d94582cC5c281c04",
+ "0x613f54c8836FD2C09B910869AC9d4de5e49Db1d8",
+ "0x0980C3171E32c4508f614ceC15A3819B6cCf372c",
+ "0xf659Fe930eEa70Bc49B6DD53d828CBaD12673a2a",
+ "0x642F04eCAa00D443fBf2de2AaC9A9e0ACfA4FCE7",
+ "0x0414BA5d3991a7B901d4e3f18b694a62414aC7Db",
+ "0x28F4cc9552F578B5C6e3a9204D6277cBa49a9416",
+ "0x4E60495550071693bc8bDfFC40033d278157EAC7",
+ "0x6387765fFA609aB9A1dA1B16C455548Bfed7CbEA",
+ "0xfA09479d72E2b3f8B6dF63399772237Ad6658D76",
+ "0xc37a0a37664aeB3848f98C5dD5d7AE286A1E9Ebd",
+ "0x47029bc8f5CBe3b464004E87eF9c9419a48018cd",
+ "0xe8537b6FF1039CB9eD0B71713f697DDbaDBb717d",
+ "0x79c912FEF520be002c2B6e57EC4324e260f38E50",
+ "0xf3C45b45223Df6071a478851B9C17e0630fDf535",
+ "0xC5c247580A4A6E4d3811c0DA6215057aaC480bAc",
+ "0xf04458f7B21265b80FC340dE7Ee598e24485c5bB",
+ "0x8F47041aDbeF5BF321c9F63A0660326614ab6B60",
+ "0x77b6d0279c9cEF559Ef7c32c31d9a5d8Acb664FE",
+ "0x8542DD4744edEa38b8a9306268b08F4D26d38581",
+ "0xDB61f9B480f0a8B817811cFAA89A1c219c355224",
+ "0x4BE2CBE40521279b8fc561e65Bb842bf73ec3a80",
+ "0xd22363e3762cA7339569F3d33EADe20127D5F98C",
+ "0xFd7FddFc0A729eCF45fB6B12fA3B71A575E1966F",
+ "0x667002F9DC61ebcBA8Ee1Cbeb2ad04060388f223",
+ "0xe63337211DdE2569C348D9B3A0acb5637CFa8aB3",
+ "0xF753A50fc755c6622BBCAa0f59F0522f264F006e",
+ "0x6d5BA400640226e24b50214d2bBb3D4Db8e6e15a",
+ "0xd25711EdfBf747efCE181442Cc1D8F5F8fc8a0D3",
+ "0x7B50775383d3D6f0215A8F290f2C9e2eEBBEceb2",
+ "0xd95E98fc33670dC033424E7Aa0578D742D00f9C7",
+ "0x1AD06Ca54de04DBe9e2817F4C13eCB406DCbeAf0",
+ "0x296f55f8fb28e498b858d0bcda06d955b2cb3f97",
+ "0x73cb180bf0521828d8849bc8CF2B920918e23032",
+ "0x970D50d09F3a656b43E11B0D45241a84e3a6e011",
+ "0x1DB2466d9F5e10D7090E7152B68d62703a2245F0",
+ "0xc40F949F8a4e094D1b49a23ea9241D289B7b2819",
+ ADDRESSES.optimism.alUSD,
+ ADDRESSES.moonbeam.MAI,
+ "0x3c8B650257cFb5f272f799F5e2b4e65093a11a05",
+ ADDRESSES.optimism.OP,
+ ADDRESSES.optimism.FRAX,
+ "0xfdb794692724153d1488ccdbe0c56c252596735f",
+ "0x1e925De1c68ef83bD98eE3E130eF14a50309C01B",
+ "0xC03b43d492d904406db2d7D57e67C7e8234bA752",
+ "0x920cf626a271321c151d027030d5d08af699456b",
+ "0x484c2D6e3cDd945a8B2DF735e079178C1036578c",
+ "0x6806411765Af15Bddd26f8f544A34cC40cb9838B",
+ "0x3E29D3A9316dAB217754d13b28646B76607c5f04",
+ "0x8aE125E8653821E851F12A49F7765db9a9ce7384",
+ "0x217D47011b23BB961eB6D93cA9945B7501a5BB11",
+ "0x9485aca5bbBE1667AD97c7fE7C4531a624C8b1ED",
+ ADDRESSES.base.DAI,
+ "0x79af5dd14e855823fa3e9ecacdf001d99647d043",
+ "0x9560e827aF36c94D2Ac33a39bCE1Fe78631088Db",
+ "0x4e720dd3ac5cfe1e1fbde4935f386bb1c66f4642",
+ "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8",
+ "0xDaA24E888432b5aa607105e256919Ddfc8b327E9",
+ "0xC3691c157D1B3A431B841230a7B11d5a373097e1",
+ "0xCC26A5246C6A04a85E997d6581C1b4f14363841a",
+ "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5",
+ "0x59eC3043D7314B9650294Fd800149b53007f804E",
+ "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19",
+ "0x6fd9d7ad17242c41f7131d257212c54a0e816691",
+ "0x76fb31fb4af56892a25e32cfc43de717950c9278",
+ "0x8700daec35af8ff88c16bdf0418774cb3d7599b4",
+ "0x23ee2343b892b1bb63503a4fabc840e0e2c6810f",
+ "0x350a791bfc2c21f9ed5d10980dad2e2638ffa7f6",
+ "0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
+ "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA",
+ "0x078f358208685046a11C85e8ad32895DED33A249",
+ "0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5",
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
+ "0x4186BFC76E2E237523CBC30FD220FE055156b41F",
+ "0x346e03F8Cce9fE01dCB3d0Da3e9D00dC2c0E08f0",
+];
+
+const POLYGON_REGISTRY_TOKENS = [
+ ADDRESSES.polygon.USDC,
+ ADDRESSES.polygon.USDC_CIRCLE,
+ ADDRESSES.polygon.USDT,
+ ADDRESSES.polygon.WETH_1,
+ ADDRESSES.polygon.WBTC,
+ ADDRESSES.polygon.DAI,
+ "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171",
+ "0x87ff96aba480f1813aF5c780387d8De7cf7D8261",
+ "0x2088C47Fc0c78356c622F79dBa4CbE1cCfA84A91",
+ "0xdAb529f40E671A1D4bF91361c21bf9f0C9712ab7",
+ ADDRESSES.fantom.renBTC,
+ "0xD6DF932A45C0f255f85145f286eA0b292B21C90B",
+ "0xa3FC7E0021970f5AF674aD837a8dc09e2F12F37B",
+ "0x7D645CBbCAdE2A130bF1bf0528b8541d32D3f8Cf",
+ "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756",
+ "0x20D3922b4a1A8560E1aC99FBA4faDe0c849e2142",
+ "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c",
+ ADDRESSES.polygon.WMATIC_2,
+ "0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49",
+ "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89",
+ "0xA691D34Abf93C0A77998e53B564bEcfaf46Dae27",
+ "0xaA91CDD7abb47F821Cf07a2d38Cc8668DEAf1bdc",
+ "0x8343091F2499FD4b6174A46D067A920a3b851FF9",
+ "0x431D5dfF03120AFA4bDf332c61A6e1766eF37BDB",
+ "0xAd326c253A84e9805559b73A08724e11E49ca651",
+ "0xE2Aa7db6dA1dAE97C5f5C6914d285fBfCC32A128",
+ "0x7BDF330f423Ea880FF95fC41A280fD5eCFD3D09f",
+ "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99",
+ "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1",
+ "0x750e4C4984a9e0f12978eA6742Bc1c5D248f40ed",
+ "0xb5DFABd7fF7F83BAB83995E72A52B97ABb7bcf63",
+ "0x361a5a4993493ce00f61c32d4ecca5512b82ce90",
+ "0x2C2D8a078B33bf7782a16AcCE2C5BA6653a90D5f",
+ "0x172370d5Cd63279eFa6d502DAB29171933a610AF",
+ "0xdAD97F7713Ae9437fa9249920eC8507e5FbB23d3",
+ "0x8096ac61db23291252574D49f036f0f9ed8ab390",
+ "0xA73EdCf18421B56D9AF1cE08A34E102E23b2C4B6",
+ "0x3A58a54C066FdC0f2D55FC9C89F0415C92eBf3C4",
+ "0x600743B1d8A96438bD46836fD34977a00293f6Aa",
+ "0x447646e84498552e62eCF097Cc305eaBFFF09308",
+ "0xa138341185a9D0429B0021A11FB717B225e13e1F",
+ "0xb0658482b405496C4EE9453cD0a463b134aEf9d0",
+ "0xb61Ecec987a9529dbA13a8Dd10ea24446ccBB6ae",
+ "0xe7CEA2F6d7b120174BF3A9Bc98efaF1fF72C997d",
+ "0xBed1d474DdA97edcEB7b9af13be4cbf1Bb98A2D3",
+ "0xfBA3b7Bb043415035220b1c44FB4756434639392",
+ "0x7BD9757FbAc089d60DaFF1Fa6bfE3BC99b0F5735",
+ "0xAdf577B69eEaC9Df325536cf1aF106372f2Da263",
+ "0x81c86081d533f280A8DAaE17F672Fb84B6ed65e3",
+ "0xbb1b19495b8fe7c402427479b9ac14886cbbaaee",
+ "0x20759F567BB3EcDB55c817c9a1d13076aB215EdC",
+ "0x8D9649e50A0d1da8E939f800fB926cdE8f18B47D",
+ "0xa7de0D88D02B9589d3b02cE52174431275169b77",
+ "0x40379a439D4F6795B6fc9aa5687dB461677A2dBa",
+ "0x00e8c0E92eB3Ad88189E7125Ec8825eDc03Ab265",
+ "0x97B2632DB51967b2AedF4c50FfC3a9D965940bEd",
+ "0x5A0801BAd20B6c62d86C566ca90688A6b9ea1d3f",
+ "0x1C480521100c962F7da106839a5A504B5A7457a1",
+ "0x108c7a293162Adff86DA216AB5F91e56723125dc",
+ "0x4C98CB046c3eb7e3ae7Eb49a33D6f3386Ec2b9D9",
+ "0x2520D50bfD793D3C757900D81229422F70171969",
+ "0x2F4BBA9fC4F77F16829F84181eB7C8b50F639F95",
+ "0x06b73b12421C667A07877B0740bA299e1de73B15",
+ "0xa0FdCDDA62C4C6a0109A702a7Efe59B4E8807e3f",
+ "0x108a7474461dC3059E4a6f9F8c7C8612056195A7",
+ "0xc65E5b6084FAd2F20e289b0d4e64F450cf386E6c",
+ "0xf0695B22d8F416FEC35E02668aE01B9EEAF96a0D",
+ "0xAA7C2879DaF8034722A0977f13c343aF0883E92e",
+ "0x01a8F2E5BfB8679C82442F90e1166469a2E530c8",
+ "0xB476B7A027da3D9fB5A5c9CB6078A34f7289B476",
+ "0x67Ecbe3a67624c80356386413E068bfFc03ad228",
+ "0xeD2905F595B6Ba103d8dF047Aa6dA3708FE6548b",
+ "0x1A723371f9dc30653dafd826B60d9335bf867E35",
+ "0x23c65213458A2dcc1321f84Ab42dCaECD79C2215",
+ "0x4BDA6C4d2f53B2Cd7F7FAc9287902a9928002e7B",
+ "0x944A5C12cD4399ABC6883fF1ba40A14c23B2Fd37",
+ "0xb87e2D83DB70599B14818C931DE0A656bf620e77",
+ "0x449533BcF3Fc5963515f87c17CDfE762b7Ab89fb",
+ "0x6F79CA179FE1cD131574a08B96e92744B6649128",
+ "0x99AB491471FBcB7D9d2b69729462fe223a4cCdab",
+ "0x2eac840950F1FF53d03A55A0255ea787fE84a4b5",
+ "0xe7B6CB2BfaB7C886CAA97fd3f181bBDad664A19B",
+ "0x3eEcd5FeD0900451A95537De7F3543cA4Ed926a7",
+ "0x2FbE43adaf91EE9A6B8252A017297007Acf696a3",
+ "0x346c16e7a76D224b9955c0F67e93b413Fc63ba3E",
+ "0x81cec323bf8c4164c66ec066f53cc053a535f03d",
+ "0x1d34Db65C4fe0f6A73194DBDC4a44ae05B46e6c5",
+ "0x04d521e2c414e6d898c6f2599fdd863edf49e247",
+ "0x8AAc0f2a6cAE626b656Ca16c58A50C87CBBC7ff5",
+ "0xcdedc76bcc6351275acdef823190453ec43b4edf",
+ "0x184a51465925ab8a0025e47a00cab6d3769b5487",
+ "0x964eA598DF006F692105A951a774ff9825a454Fe",
+ "0x4ec61a96738564CaD591841df0c8B5b6eA785E4C",
+ "0x3f35705479d9d77c619b2aac9dd7a64e57151506",
+ "0x4252Da0559960a50FDd50D5bDDe1B78659B7Ea2A",
+ "0x98b6a5eedc9382e2c4f8a38f985f2e9ac0b0e84c",
+ "0x3325a25A2608EA723cB5D72E27af65AACFfb810e",
+ "0xb4d852b92148eaa16467295975167e640e1fe57a",
+ "0x02203f2351E7aC6aB5051205172D3f772db7D814",
+ "0xb759b56d82C88806bbcBcD60767E39Af5cc51F32",
+ "0xBD02973b441Aa83c8EecEA158b98B5984bb1036E",
+ "0x2C6d11e756986f1537a2c71c851e9a1F7A0008b2",
+ "0xD74B5df80347cE9c81b91864DF6a50FfAfE44aa5",
+ "0x5268F5F2a9799f747A55f193d2E266c77653E518",
+ "0xd17cb0f162f133e339c0bbfc18c36c357e681d6b",
+ "0xe058e1ffff9b13d3fcd4803fdb55d1cc2fe07ddc",
+ "0x8711a1a52c34EDe8E61eF40496ab2618a8F6EA4B",
+ "0x67FEe70c32097c53B5aeAaCdbee7544eaE2194f8",
+ "0xbe4e30b74b558e41f5837dc86562df44af57a013",
+ "0x0fC4f2DB534Bf7525710DBf64B7081e1a3A6428f",
+ ADDRESSES.polygon.MATICX,
+ "0x40c03Cd0B5D1571608D09e6279B4C63660e431F1",
+ "0x2ee50c34392e7e7a1d17b0a42328a8d1ad6894e3",
+ "0x1205f31718499dbf1fca446663b532ef87481fe1",
+ "0xb95E1C22dd965FafE926b2A793e9D6757b6613F4",
+ "0x29e38769f23701a2e4a8ef0492e19da4604be62c",
+ "0x3f69055f203861abfd5d986dc81a2efa7c915b0c",
+ "0xbfe9584228BBcB21EAA64a878c28c5cBFd0F6304",
+ "0x74c64d1976157e7aaeeed46ef04705f4424b27ec",
+ "0x3cc20a6795c4b57d9817399f68e83e71c8626580",
+ "0xe7806b5ba13d4b2ab3eab3061cb31d4a4f3390aa",
+ "0xD97FA4474084350D2c96285E1Fca07A9D515c800",
+ "0x513cdee00251f39de280d9e5f771a6eafebcc88e",
+ "0xAb4E02911A7d09BC8300F39332F087d51c183038",
+ "0xa7565dfeb16010153d3368e002ec53cbfaf96e05",
+ "0x8D0663d2d738e6078Bb77589dE4231eD9fcFd014",
+ "0xf0ad209e2e969eaaa8c882aac71f02d8a047d5c2",
+ "0xec74671f95F0942358016da627b912143100DAF2",
+ "0x2589469b7a72802ce02484f053cb6df869eb2689",
+ "0xFe2f5e215C0Fe9b5D4fF99cA7cBB5F5a77f5C515",
+ "0xE193C653B6030a9BB443AE7c6Ef6e35d93348f98",
+ "0xFbdd194376de19a88118e84E279b977f165d01b8",
+ "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172",
+ "0x1057a796C66ca87EC1e6494f5486006396756083",
+ "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629",
+ "0xf742B69Bd460F14EB5d8335e06954eba694B552E",
+ "0xc44F1103A271BEFF26bB245D760bFbe182CCf121",
+ "0x195888B86db69C52b54362DB2D71c2d3e411A0bA",
+ "0x22301937028310Cef6530eF3C3Bfe14581eb679F",
+ "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f",
+ "0xb33eaad8d922b1083446dc23f610c2567fb5180f",
+ "0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39",
+ "0x61299774020da444af134c82fa83e3810b309991",
+ "0x5fe2b58c013d7601147dcdd68c143a77499f5531",
+ "0xbbba073c31bf03b8acf7c28ef0738decf3695683",
+ "0xc3c7d422809852031b44ab29eec9f1eff2a58756",
+ "0x50b728d8d964fd00c2d0aad81718b71311fef68a",
+ "0x6e4e624106cb12e168e6533f8ec7c82263358940",
+ "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
+ "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40",
+ "0x078f358208685046a11C85e8ad32895DED33A249",
+ "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD",
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
+ "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4",
+ "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390",
+ "0x5c2ed810328349100A66B82b78a1791B101C9D61",
+ "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F",
+ "0x60D55F02A771d515e077c9C2403a1ef324885CeC",
+ "0x27F8D03b3a2196956ED754baDc28D73be8830A6e",
+ ADDRESSES.polygon.WSTETH,
+];
+
+const AVALANCHE_REGISTRY_TOKENS = [
+ ADDRESSES.avax.WAVAX,
+ ADDRESSES.avax.USDC,
+ ADDRESSES.avax.USDC_e,
+ ADDRESSES.avax.USDt,
+ ADDRESSES.avax.USDT_e,
+ ADDRESSES.avax.DAI,
+ ADDRESSES.avax.WETH_e,
+ ADDRESSES.avax.WBTC_e,
+ ADDRESSES.avax.BTC_b,
+ "0x111111111111ed1D73f860F57b2798b683f2d325",
+ "0x130966628846BFd36ff31a822705796e8cb8C18D",
+ "0x40b393cecf8F7D7Fc79b83e8fA40e850511817f6",
+ "0x28690ec942671aC8d9Bc442B667EC338eDE6dFd3",
+ "0x5c49b268c9841AFF1Cc3B0a418ff5c3442eE3F3b",
+ "0xb599c3590F42f8F995ECfa0f85D2980B76862fc1",
+ "0xF14f4CE569cB3679E99d5059909E23B07bd2F387",
+ "0x1337BedC9D22ecbe766dF105c9623922A27963EC",
+ "0x0974D9d3bc463Fa17497aAFc3a87535553298FbE",
+ "0x1da20Ac34187b2d9c74F729B85acB225D3341b25",
+ "0x6BF6fc7EaF84174bb7e1610Efd865f0eBD2AA96D",
+ "0xD79138c49c49200a1Afc935171D1bDAd084FDc95",
+ "0xb0D2EB3C2cA3c6916FAb8DCbf9d9c165649231AE",
+ "0xAEA2E71b631fA93683BCF256A8689dFa0e094fcD",
+ "0x6a4aC4DE3bF6bCD2975E2cb15A46954D9bA43fDb",
+ "0x943F3B750447AbDd61cdF68AE6c3912cd3bedA04",
+ "0xd39016475200ab8957e9C772C949Ef54bDA69111",
+ "0x79F26046D122d2F26B1D37237D5C056fB580447A",
+ "0x7E5bC7088aB3Da3e7fa1Aa7ceF1dC73F5B00681c",
+ "0x1205f31718499dBf1fCa446663B532Ef87481fe1",
+ "0xf4003F4efBE8691B60249E6afbD307aBE7758adb",
+ "0xe1a8EeA58D63Ea64d00365531D266C2AD1f62FC4",
+ "0x1dab6560494b04473a0be3e7d83cf3fdf3a51828",
+ "0x22EafB9C7E2858cfDA712940896464DdAA83d053",
+ "0xae64d55a6f09e4263421737397d1fdfa71896a69",
+ "0x68866acc5C940938B373F55F7009f824c7662F5B",
+ "0xFE15c2695F1F920da45C30AAE47d11dE51007AF9",
+ "0xf3340EdF16563D52C7E7C576F2fCC8f3D52464aB",
+ "0x0e0100ab771e9288e0aa97e11557e6654c3a9665",
+ "0x595786A3848B1de66C6056C87BA91977935fBC46",
+ "0x32833a12ed3fd5120429fb01564c98ce3c60fc1d",
+ "0xA27BF4d56870A37e37a687B8ab3740d8487Ee2C6",
+ "0x29e38769f23701A2e4A8Ef0492e19dA4604Be62c",
+ "0xFeA7976733f47557860f4483f2147a3e99C76b58",
+ "0x3D81A269E05e6057e4dF9E2D76E254E65a65Eb66",
+ "0x454E67025631C065d3cFAD6d71E6892f74487a15",
+ "0x282B11E65f0B49363D4505F91c7A44fBEe6bCc0b",
+ ADDRESSES.avax.JOE,
+ "0x3C2131A02659343d68c211aAa686750bE37d88c4",
+ "0x813aB5B3FDc59B143C42284665864b24B794C324",
+ "0xd6070ae98b8069de6b494332d1a1a81b6179d960",
+ "0x47536f17f4ff30e64a96a7555826b8f9e66ec468",
+ "0x5947bb275c521040051d82396192181b413227a3",
+ "0x8ebaf22b6f053dffeaf46f4dd9efa95d89ba8580",
+ "0x8a0cac13c7da965a312f08ea4229c37869e85cb9",
+ "0x63a72806098bd3d9520cc43356dd78afe5d386d9",
+ "0xbec243c995409e6520d7c41e404da5deba4b209b",
+ "0x44c784266cf024a60e8acf2427b9857ace194c5d",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
+ "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97",
+ "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692",
+ "0x625E7708f30cA75bfd92586e17077590C60eb4cD",
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
+ "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21",
+ "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B",
+ "0x46A51127C3ce23fb7AB1DE06226147F446e4a857",
+ "0x532E6537FEA298397212F09A61e03311686f548e",
+ "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a",
+];
+
+const BNB_REGISTRY_TOKENS = [
+ ADDRESSES.bsc.WBNB,
+ ADDRESSES.bsc.USDC,
+ ADDRESSES.bsc.USDT,
+ ADDRESSES.bsc.ETH,
+ ADDRESSES.bsc.BTCB,
+ ADDRESSES.bsc.BUSD,
+ "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",
+ "0x31e77776b924Cd5f0E624771C9B3d2bD6B9c919E",
+ "0x577d005912C49B1679B4c21E334FdB650E92C077",
+ "0x4a9945B75E5c860f511CD223E838b213828a0583",
+ "0x0827841963Cc8a0515b5baa59782b0a0870b5f88",
+ "0x684d86518e6E7d622d24854cBb1C179d6C0E3f75",
+ "0x483653bcF3a10d9a1c334CE16a19471a614F4385",
+ "0x62ef49280c0f155afd374fC5Efd1F06318648700",
+ "0x5dc30Bb8D7F02eFEf28f7E637D17Aea13Fa96906",
+ "0x1542885D6EeD4EE3AC1a110d3f159003a0774101",
+ "0x804678fa97d91B974ec2af3c843270886528a9E6",
+ "0x68c39886eA459b4a59758F1e94c3d20C93d47133",
+ "0x0FB881c078434b1C0E4d0B64d8c64d12078b7Ce2",
+ "0x2ea77B1d17C9e2a99a2C019abC8eA2f6A59A1044",
+ "0x63b30de1A998e9E64FD58A21F68D323B9BcD8F85",
+ "0x6eb020663898c72F8E25958F5f7bcDC732279201",
+ "0x66FDB2eCCfB58cF098eaa419e5EfDe841368e489",
+ "0xa4113209bD56f534A24CADc3E3778B5D4B806180",
+ "0xa987f0b7098585c735cD943ee07544a84e923d1D",
+ "0xC341DFb9B634a3aD1AEF70B490eA92CACcddf805",
+ "0x93B32a8dfE10e9196403dd111974E325219aec24",
+ "0xe47E724c0b4EE9fbC16097AC103b97dc6642fd18",
+ "0x153dC2eBcB551799b13D4E6Ff84fC34C7AEDf241",
+ "0x9A10Cc2024744681fBce1F93Aeee3fd7863B1A12",
+ "0xC7e9d76ba11099AF3F330ff829c5F442d571e057",
+ "0xD411121C948Cff739857513E1ADF25ED448623f8",
+ "0x90C97F71E18723b0Cf0dfa30ee176Ab653E89F40",
+ "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d",
+ ADDRESSES.bsc.beltBTC,
+ "0xbCFcE18C5c33463316f93A067b1f50d75b00dc09",
+ "0x10bf6e7B28b1cfFb1c047D7F815953931e5Ee947",
+ "0x56ec6031dC969CfA035F6D65e65D8595d5660fB4",
+ "0x5c73804FeDd39f3388E03F4aa1fE06a1C0e60c8e",
+ "0x77c9a64C88Ad5e5467B53E20E66AD2F8800BBf3d",
+ "0x2ecBD508c00Bbc8aA0cdc9100bf3956fCabE7677",
+ "0xC34Ae91312A3c3F9420691922040a5DEe1698E52",
+ ADDRESSES.bsc.beltBNB,
+ "0xeDe45f9dC994a66F1aD1ac68974Abb28086f909d",
+ "0x6321B57b6fdc14924be480c54e93294617E672aB",
+ "0xc1fcf50ccaCd1583BD9d3b41657056878C94e592",
+ ADDRESSES.bsc.Belt4,
+ "0xb26642B6690E4c4c9A6dAd6115ac149c700C7dfE",
+ "0x0eD7e52944161450477ee417DE9Cd3a859b14fD0",
+ "0x33D0F945F77660F4A9e56949500265313f6D08fb",
+ "0x86b481fCe116DCd01fBeBb963f1358bcc466668C",
+ "0x164fb78cAf2730eFD63380c2a645c32eBa1C52bc",
+ "0xDA8ceb724A06819c0A5cDb4304ea0cB27F8304cF",
+ "0x0383E88A19E5c387FeBafbF51E5bA642d2ad8bE0",
+ "0x9aA83081AA06AF7208Dcc7A4cB72C94d057D2cda",
+ "0xf2064C230b285AA6Cf45c6267DA86a8E3505D0AA",
+ ADDRESSES.bsc.beltETH,
+ "0x960eE6caC56912D94cE5c83D7Fb0CD873b5c5099",
+ "0xD3C480EC7a47596fF8D63396227d1F7dC728A7f0",
+ "0xe0Af98A11DB57c7282c1f6066d116E13F02BF0E9",
+ "0xF7369B1D005F2cbB1887233B5aa0CB0B39fB9891",
+ "0x72fC82b9955f04b20166b0Da7e1af4f893F6316a",
+ "0x5c15842fCC12313C4f94dFB6fad1Af3f989D33e9",
+ "0xf867cD98F3762D899F5F26FF5Dd62A5C566A3E0C",
+ "0x1B6E11c5DB9B15DE87714eA9934a6c52371CfEA9",
+ "0x9B429B6bb5aBfD97869d6D302676a3885e9b0B2b",
+ "0x8A420aACA0c92e3f97CDcFdd852e01Ac5b609452",
+ "0x836C6BffB0B08aCa20b9380330D2532A51aA0eAD",
+ "0x3ec1FFd5dc29190588608Ae9Fd4f93750e84CDA2",
+ "0xe2AD2c5702f6c9073f85b00E4743066E1D1035f8",
+ "0x8840C6252e2e86e545deFb6da98B2a0E26d8C1BA",
+ "0xEeB87e7bAbF17cA97F0Eb897F24Bf475e0A9Aef7",
+ "0x6216E04cd40DB2c6FBEd64f1B5830A98D3A91740",
+ "0x220711F15D09bdDFD1f0ba0dfC905074Ea204C4E",
+ "0x98a5737749490856b401DB5Dc27F522fC314A4e1",
+ "0x93DB73f79D4fdc5be42C0bd2812e94A271aDC7e2",
+ "0x854805dc490271B362cc758D94b69eed157070A5",
+ "0x8860922Eb2795aB0D57363653Dd7EBf18D7c0A42",
+ "0xB78b6A0137ad8745784D3B23c16abeA8F527ff54",
+ "0x754Fd74e22255780a58F125300008781D8318e3A",
+ "0x49ad051F4263517BD7204f75123b7C11aF9Fd31C",
+ "0x5D83D13Fa899451b75f7c465C0A2590Bb3f9067f",
+ "0xac109C8025F272414fd9e2faA805a583708A017f",
+ "0x3b3bc8AE6dcAcCeaaC3C19E196ebD3341Cfe9c4e",
+ "0xCa3F508B8e4Dd382eE878A314789373D80A5190A",
+ "0xbf5140a22578168fd562dccf235e5d43a02ce9b1",
+ "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",
+ "0x64048a7eecf3a2f1ba9e144aac3d7db6e58f555e",
+ "0x90c97f71e18723b0cf0dfa30ee176ab653e89f40",
+ "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47",
+ "0x1d2f0da169ceb9fc7b3144628db156f3f6c60dbe",
+ "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5",
+ "0x76a797a59ba2c17726896976b7b3747bfd1d220f",
+ "0xf8a0bf9cf54bb92f17374d9e9a321e6a111a51bd",
+ "0x0eb3a705fc54725037cc9e008bdede697f62f335",
+ "0xa2b726b1145a4773f68593cf171187d8ebe4d495",
+ "0x031b41e504677879370e9dbcf937283a8691fa7f",
+ "0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce",
+ "0xfb5b838b6cfeedc2873ab27866079ac55363d37e",
+ "0xfb6115445bff7b52feb98650c87f44907e58f802",
+ "0x715d400f88c167884bbcc41c5fea407ed4d2f8a0",
+ "0x2E94171493fAbE316b6205f1585779C887771E2F",
+ "0x56a7ddc4e848EbF43845854205ad71D5D5F72d3D",
+ "0x9B00a09492a626678E5A3009982191586C444Df9",
+ "0x00901a076785e0906d1028c7d6372d247bec7d61",
+ "0xa9251ca9DE909CB71783723713B21E4233fbf1B1",
+ ADDRESSES.blast.ezETH,
+];
+
+const BASE_REGISTRY_TOKENS = [
+ ADDRESSES.base.USDC,
+ ADDRESSES.base.USDbC,
+ "0x4621b7A9c75199271F773Ebd9A499dbd165c3191",
+ "0x8Ee73c484A26e0A5df2Ee2a4960B789967dd0415",
+ "0x417Ac0e078398C154EdFadD9Ef675d30Be60Af93",
+ ADDRESSES.kava.axlUSDC,
+ ADDRESSES.optimism.WETH_1,
+ "0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b",
+ ADDRESSES.base.DAI,
+ "0xd07379a755A8f11B57610154861D694b2A0f615a",
+ "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
+ "0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c",
+ "0x9EaF8C1E34F05a589EDa6BAfdF391Cf6Ad3CB239",
+ "0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f",
+ "0x6e53131F68a034873b6bFA15502aF094Ef0c5854",
+ "0x6DfE79cecE4f64c1a34F48cF5802492aB595257E",
+ "0xbE3F14312B08E9c6AEe6AeB27B37c08B661A7F83",
+ "0x5A47993216fa6ACaf93418f9830cee485e82d0ba",
+ "0xd0c3E7f86338403Df99DEa1996f6C9Ed8f9D3d07",
+ "0xB614A6E6c21202De79DceB95AE2dd4817DD7e14b",
+ "0xB62F13126fCD0dD49dE8fF811406554197Bd0E11",
+ "0x507094549509Efdf63ecA34B795094065cB04008",
+ "0x8bd6dF821513aECDbbaa29C1d5212b43fdCe7819",
+ "0x98bEAa72230788572e3e3Be58D91C232dda315d4",
+ "0x74251C0d0B74Fba6e3B3EDe8533D9Da82B4EC4a4",
+ "0xc005B9833deBcF5fe6cc5bC9ba4fD74Bb382ae55",
+ "0xC3a5b142a144135D900FC5Ef2Bb7E92a3bcB46F1",
+ "0x09139A80454609B69700836a9eE12Db4b5DBB15f",
+ "0x4Fc0E7cDfe0CF92762eaf3CEE9133239A2197391",
+ "0x06a613d3a056d4b04D7523C11d82c67Bebf9d850",
+ "0xFB6864F1c14A90E85398B853701B01ef6a0CA3E5",
+ "0xf213F2D02837012dC0236cC105061e121bB03e37",
+ "0x0B25c51637c43decd6CC1C1e3da4518D54ddb528",
+ "0x44Ecc644449fC3a9858d2007CaA8CFAa4C561f91",
+ "0x6B87B8663eE63191887F18225F79D9eEb2DE0d34",
+ "0xb5E331615FdbA7DF49e05CdEACEb14Acdd5091c3",
+ "0xA6385c73961dd9C58db2EF0c4EB98cE4B60651e8",
+ "0x7A034374C89C463DD65D8C9BCfe63BcBCED41f4F",
+ "0x61366A4e6b1DB1b85DD701f2f4BFa275EF271197",
+ "0xA6F8A6bc3deA678d5bA786f2Ad2f5F93d1c87c18",
+ "0x6cDcb1C4A4D1C3C6d054b27AC5B77e89eAFb971d",
+ "0x323121CD6F6274c9aeB9f87e0664C8FDa5d343A5",
+ "0xcDAC0d6c6C59727a65F871236188350531885C43",
+ "0x27a8Afa3Bd49406e48a074350fB7b2020c43B2bD",
+ "0x82a0c1a0d4EF0c0cA3cFDA3AD1AA78309Cc6139b",
+ "0x5BfB340FA9305abB164Fb0248D0D82FC3D82C3bb",
+ "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca",
+ "0x1f0dbEcDA414F401dB46464864273CaD19368706",
+ "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96",
+ "0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91",
+ "0x23ee2343b892b1bb63503a4fabc840e0e2c6810f",
+ "0x940181a94a35a4569e4529a3cdfb74e38fd98631",
+ "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7",
+ "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D",
+ "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB",
+ ADDRESSES.blast.ezETH,
+ "0x1Bc71130A0e39942a7658878169764Bbd8A45993",
+ "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
+];
+
+const BLAST_REGISTRY_TOKENS = [
+ ADDRESSES.blast.WETH,
+ ADDRESSES.blast.USDB,
+ "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692",
+ "0x9D020B1697035d9d54f115194c9e04a1e4Eb9aF7",
+ "0x96F6b70f8786646E0FF55813621eF4c03823139C",
+ "0x5ffd9ebd27f2fcab044c0f0a26a45cb62fa29c06",
+ "0xa4c7aa67189ec5623121c6c94ec757dfed932d4b",
+ "0x764933fbAd8f5D04Ccd088602096655c2ED9879F",
+ "0x9e20461bc2c4c980f62f1B279D71734207a6A356",
+ "0x837fe561e9c5dfa73f607fda679295dbc2be5e40",
+ "0xb9dfCd4CF589bB8090569cb52FaC1b88Dbe4981F",
+ "0x42e12d42b3d6c4a74a88a61063856756ea2db357",
+ "0x76da31d7c9cbeae102aff34d3398bc450c8374c1",
+ "0x47c337bd5b9344a6f3d6f58c474d9d8cd419d8ca",
+ "0x216a5a1135a9dab49fa9ad865e0f22fe22b5630a",
+ ADDRESSES.blast.ezETH,
+];
+
+const registryTokensByChain = {
+ ethereum: ETHEREUM_REGISTRY_TOKENS,
+ arbitrum: ARBITRUM_REGISTRY_TOKENS,
+ optimism: OPTIMISM_REGISTRY_TOKENS,
+ polygon: POLYGON_REGISTRY_TOKENS,
+ avax: AVALANCHE_REGISTRY_TOKENS,
+ bsc: BNB_REGISTRY_TOKENS,
+ base: BASE_REGISTRY_TOKENS,
+ blast: BLAST_REGISTRY_TOKENS,
+};
+
+module.exports = registryTokensByChain;
diff --git a/projects/hinkal/registryTokensWithUnderlyingAddresses.js b/projects/hinkal/registryTokensWithUnderlyingAddresses.js
new file mode 100644
index 0000000000..02fa16045c
--- /dev/null
+++ b/projects/hinkal/registryTokensWithUnderlyingAddresses.js
@@ -0,0 +1,268 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0x93ce650b8d3a7a7e44121db82a0429a3884db599":
+ "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490",
+ "0xE49127B7AEfc043847caDd85B8a41973854D30f5":
+ "0x8dff75976f22db58d7c3fd7b68d782238b0dbe30",
+ "0x8A31A94bF0926B82083C80E18B331085B84E92D7":
+ "0x689440f2Ff927E1f24c72F1087E1FAF471eCe1c8",
+ "0xcc26a5246c6a04a85e997d6581c1b4f14363841a":
+ "0xcfc25170633581bf896cb6cdee170e3e3aa59503",
+ "0x9a7Ce41c96Db8d792497D7BEe70fAfb7F8393D71":
+ "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02",
+ "0xd4EC67cF6C0Aa65F74eb7F03216Ea23151af21b8":
+ "0x2932a86df44fe8d2a706d8e9c5d51c24883423f5",
+ "0x4F1546Ce825dB85310aC2c2cfb369543d73FD0a2":
+ "0xbD5445402B0a287cbC77cb67B2a52e2FC635dce4",
+ "0x394Aa83d0E5D348c7FA39325d2A25993704Faf8f":
+ "0xfb860600f1be1f1c72a89b2ef5caf345aff7d39d",
+ "0xD1105d6502d3c562B447A75149B00aD366b3212d":
+ "0x6991C1CD588c4e6f6f1de3A0bac5B8BbAb7aAF6d",
+ "0xE08FF1427b199241506FcdCC23fcc24Dd98a4FA9":
+ "0xDeFd8FdD20e0f34115C7018CCfb655796F6B2168",
+ "0xC21545c26661ae74b3259B55aE007ACC4Bf5d4e3":
+ "0x9D5C5E364D81DaB193b72db9E9BE9D8ee669B652",
+ "0xa0Cd8B83B63381895C1854A605315fa7eF50e026":
+ "0x512a68dd5433563bad526c8c2838c39debc9a756",
+ "0x25aE9BE521898d33c7DF6Ae8c6669Fe038Bb3550":
+ "0xecad6745058377744c09747b2715c0170b5699e5",
+ "0x9434722bf29750B44649eb1b1A10a335d40edFc1":
+ "0x27cace18f661161661683bba43933b2e6eb1741e",
+ "0xF2280cBa8e0B9bc9b87b5aFbBeF8C41C20a5ddBe":
+ "0xbe266d68ce3ddfab366bb866f4353b6fc42ba43c",
+ "0x5F1894e4b409D7199Ea209b9e43C996640BCB691":
+ "0x8605dc0c339a2e7e85eea043bd29d42da2c6d784",
+ "0xa653510227752632ebf692a77e5032d4afFaB3a2":
+ "0xC94208D230EEdC4cDC4F80141E21aA485A515660",
+ "0xA1998B87C2935BDbd7fE6ee48542a59a0435a3Ee":
+ "0x245Ec0d447e7f206B43120Ac292dED5E8bB9fe61",
+ "0xC8c3031fB628Bdf4eA0F7cA5F96E369Dea07624e":
+ "0x0404d05F3992347d2f0dC3a97bdd147D77C85c1c",
+ "0xDc118133332f703e22C0b0FA7E0DD7d1299A7247":
+ "0xB468dB2E478885B87D7ce0C8DA1D4373A756C138",
+ "0xC6fDF0921c480Bd7Af89Ab4461D4aCDA24058a65":
+ "0xAE0bFfc3110e69DA8993F11C1CBd9a6eA3d16daF",
+ "0x6410ee1f8417a7cE1c3E68E3434c1d6beef6944E":
+ "0x277d1424a84b35ec0a8108482551b00b4fc1539b",
+ "0x9456cB3ae9fA8788ac1af4a7A18b339D4028061D":
+ "0xc2fe9d3c761994897594df63b33b6d843ab7b1cf",
+ "0x26dA2546602f63b84B3C4dF36476364f6350706E":
+ "0x0e83df148f69965bfe752250835854b0dbeeaf01",
+ "0x0a3fE1d39E5c60CfdB48Ba2Dc6B7c855289Dec7C":
+ "0x35ad1acf0c4be5d4ba11342128d440fdb9e189eb",
+ "0xA27fa5E11B121277423aC0b8b372596f2805e36a":
+ "0xe2c422d954db416a69fb29137fe552cce0e160e9",
+ "0x41e5c3aD70DA89dd7b6AF9Af3cd6861FbC31eA16":
+ "0x621ef98282ac42d2bf4c20fc73912a16599e12fb",
+ "0x019e773bE2D65D5fE30bE17547b89500C7C4CD5E":
+ "0xfb35Fd0095dD1096b1Ca49AD44d8C5812A201677",
+ "0x1346da36093Fdb8013E1125046f0dCBbBF645b3F":
+ "0x0ED3A1D45DfdCf85BCc6C7BAFDC0170A357B974C",
+ "0x4E0854085bC5a2fa8031ea5819863BD280e610F3":
+ "0x391B570e81e354a85a496952b66ADc831715f54f",
+ "0x9Ab43f73054C07b02e02c5468b3eB058ccdAA019":
+ "0x98601E27d41ccff643da9d981dc708cf9eF1F150",
+ "0x223026549740E2672b3f05c867Fd2B31207338A2":
+ "0x7C2D26182adeEf96976035986cF56474feC03bDa",
+ "0x3e0A917d4d914e432B82825e6FBEe039b89f4477":
+ "0x029aad400f6092dc735a65be95102efcc2fe64bf",
+ "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8":
+ ADDRESSES.ethereum.WETH,
+ "0x0B925eD163218f6662a35e0f0371Ac234f9E9371":
+ ADDRESSES.ethereum.WSTETH,
+ "0x5Ee5bf7ae06D1Be5997A1A72006FE6C607eC6DE8":
+ ADDRESSES.ethereum.WBTC,
+ "0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c":
+ ADDRESSES.ethereum.USDC,
+ "0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a":
+ ADDRESSES.ethereum.USDT,
+ "0x018008bfb33d285247A21d44E50697654f754e63":
+ ADDRESSES.ethereum.DAI,
+ "0x9ff58f4fFB29fA2266Ab25e75e2A8b3503311656":
+ ADDRESSES.ethereum.WBTC,
+ "0x030bA81f1c18d280636F32af80b9AAd02Cf0854e":
+ ADDRESSES.ethereum.WETH,
+ "0xBcca60bB61934080951369a648Fb03DF4F96263C":
+ ADDRESSES.ethereum.USDC,
+ "0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811":
+ ADDRESSES.ethereum.USDT,
+ "0x028171bCA77440897B824Ca71D1c56caC55b68A3":
+ ADDRESSES.ethereum.DAI,
+};
+
+const ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0xC3691c157D1B3A431B841230a7B11d5a373097e1":
+ "0xce5f24b7a95e9cba7df4b54e911b4a3dc8cdaf6f",
+ "0x7Bdc233E5369Ac023b9894645902C9032A72D9Ee":
+ "0x971E732B5c91A59AEa8aa5B0c763E6d648362CF8",
+ "0xCC26A5246C6A04a85E997d6581C1b4f14363841a":
+ "0xf2ddf89c04d702369ab9ef8399edb99a76e951ce",
+ "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5":
+ "0x098ef55011b6b8c99845128114a9d9159777d697",
+ "0x59eC3043D7314B9650294Fd800149b53007f804E":
+ "0x95285ea6ff14f80a2fd3989a6bab993bd6b5fa13",
+ "0x972c6F2b29638b9AD6955c4F0b0c1239b034f053":
+ "0x93729702Bf9E1687Ae2124e191B8fFbcC0C8A0B0",
+ "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19":
+ "0xd6dacdcb438f048cf90e53415872cdb3fcc95421",
+ "0x886867993080DC3bBFC39CDfc343A0e083bB34E0":
+ "0x6B7B84F6EC1c019aF08C7A2F34D3C10cCB8A8eA6",
+ "0xB72ea6F99EfA5BD6Fb400BaA4eFddC3cfB075215":
+ "0xc2b1df84112619d190193e48148000e3990bf627",
+ "0x660108601EED17aF2832A1c0F1D7dE74F560C5ed":
+ "0x7c0ac20c3ca8c6257ea099131081d8199bf6b8f6",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8":
+ ADDRESSES.arbitrum.WETH,
+ "0x513c7E3a9c69cA3e22550eF58AC1C0088e918FFf":
+ ADDRESSES.arbitrum.WSTETH,
+ "0x078f358208685046a11C85e8ad32895DED33A249":
+ ADDRESSES.arbitrum.WBTC,
+ "0x724dc807b04555b71ed48a6896b6F41593b8C637":
+ ADDRESSES.arbitrum.USDC_CIRCLE,
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620":
+ ADDRESSES.arbitrum.USDT,
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE":
+ ADDRESSES.optimism.DAI,
+};
+
+const OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0x29c431806E536Fb22ce2Edc8dd6e3C3A0d5689a8":
+ "0xc5ae4b5f86332e70f3205a8151ee9ed9f71e0797",
+ "0xDaA24E888432b5aa607105e256919Ddfc8b327E9":
+ "0xd53ccbfed6577d8dc82987e766e75e3cb73a8563",
+ "0xC3691c157D1B3A431B841230a7B11d5a373097e1":
+ "0x15f52286c0ff1d7a7ddbc9e300dd66628d46d4e6",
+ "0xCC26A5246C6A04a85E997d6581C1b4f14363841a":
+ "0x172a5af37f69c69cc59e748d090a70615830a5dd",
+ "0xeEeeb52E36c78b153caaB2761c369a50b066cDD5":
+ "0xcb8883d1d8c560003489df43b30612aabb8013bb",
+ "0x59eC3043D7314B9650294Fd800149b53007f804E":
+ "0x2eb49a3eff789d7b2286bf17667acbf12d882c17",
+ "0xbA65D50Cf4e6E739B2735338a964C3354fAF9B19":
+ "0xcea806562b757aeffa9fe9d0a03c909b4a204254",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8":
+ ADDRESSES.optimism.WETH_1,
+ "0xc45A479877e1e9Dfe9FcD4056c699575a1045dAA":
+ ADDRESSES.optimism.WSTETH,
+ "0x078f358208685046a11C85e8ad32895DED33A249":
+ ADDRESSES.optimism.WBTC,
+ "0x38d693cE1dF5AaDF7bC62595A37D667aD57922e5":
+ ADDRESSES.optimism.USDC_CIRCLE,
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620":
+ ADDRESSES.optimism.USDT,
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE":
+ ADDRESSES.optimism.DAI,
+};
+
+const POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0x9dc8Ee4264923D44F2a33Ea139FC4143C288b172":
+ "0x0e2f214b8f5d0cca011a8298bb907fb62f535160",
+ "0x1057a796C66ca87EC1e6494f5486006396756083":
+ "0x835cA119fA28515B1F184A5Ce5Ccda2B5b0d9F6D",
+ "0x350c331F4e5fD9d5D703424F3F14CcC0280B6629":
+ "0x40371aad2a24ed841316ef30938881440fd4426c",
+ "0xf742B69Bd460F14EB5d8335e06954eba694B552E":
+ "0xA9249f8667cb120F065D9dA1dCb37AD28E1E8FF0",
+ "0xc44F1103A271BEFF26bB245D760bFbe182CCf121":
+ "0x8b397084699cc64e429f610f81fac13bf061ef55",
+ "0x195888B86db69C52b54362DB2D71c2d3e411A0bA":
+ "0xc501491b0e4A73B2eFBaC564a412a927D2fc83dD",
+ "0x22301937028310Cef6530eF3C3Bfe14581eb679F":
+ "0xfc052e70eb6d94afe464a8ce8f43d203109494f2",
+ "0x90F06727Ba5016eDcf9D8B5def63a5849EcD132f":
+ "0x9633e0749faa6ec6d992265368b88698d6a93ac0",
+ "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97":
+ ADDRESSES.polygon.WMATIC_2,
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8":
+ ADDRESSES.polygon.WETH_1,
+ "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40":
+ ADDRESSES.polygon.WSTETH,
+ "0x078f358208685046a11C85e8ad32895DED33A249":
+ ADDRESSES.polygon.WBTC,
+ "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD":
+ ADDRESSES.polygon.USDC_CIRCLE,
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620":
+ ADDRESSES.polygon.USDT,
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE":
+ ADDRESSES.polygon.DAI,
+ "0x8dF3aad3a84da6b69A4DA8aeC3eA40d9091B2Ac4":
+ ADDRESSES.polygon.WMATIC_2,
+ "0x28424507fefb6f7f8E9D3860F56504E4e5f5f390":
+ ADDRESSES.polygon.WETH_1,
+ "0x5c2ed810328349100A66B82b78a1791B101C9D61":
+ ADDRESSES.polygon.WBTC,
+ "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F":
+ ADDRESSES.polygon.USDC,
+ "0x60D55F02A771d515e077c9C2403a1ef324885CeC":
+ ADDRESSES.polygon.USDT,
+ "0x27F8D03b3a2196956ED754baDc28D73be8830A6e":
+ ADDRESSES.polygon.DAI,
+};
+
+const AVALANCHE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8":
+ ADDRESSES.avax.WETH_e,
+ "0x6d80113e533a2C0fe82EaBD35f1875DcEA89Ea97":
+ ADDRESSES.avax.WAVAX,
+ "0x8ffDf2DE812095b1D19CB146E4c004587C0A0692":
+ ADDRESSES.avax.BTC_b,
+ "0x625E7708f30cA75bfd92586e17077590C60eb4cD":
+ ADDRESSES.avax.USDC,
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620":
+ ADDRESSES.avax.USDt,
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE":
+ ADDRESSES.avax.DAI,
+ "0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21":
+ ADDRESSES.avax.WETH_e,
+ "0xDFE521292EcE2A4f44242efBcD66Bc594CA9714B":
+ ADDRESSES.avax.WAVAX,
+ "0x46A51127C3ce23fb7AB1DE06226147F446e4a857":
+ ADDRESSES.avax.USDC,
+ "0x532E6537FEA298397212F09A61e03311686f548e":
+ ADDRESSES.avax.USDt,
+ "0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a":
+ ADDRESSES.avax.USDt,
+};
+
+const BNB_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0x2E94171493fAbE316b6205f1585779C887771E2F":
+ ADDRESSES.bsc.ETH,
+ "0x56a7ddc4e848EbF43845854205ad71D5D5F72d3D":
+ ADDRESSES.bsc.BTCB,
+ "0x9B00a09492a626678E5A3009982191586C444Df9":
+ ADDRESSES.bsc.WBNB,
+ "0x00901a076785e0906d1028c7d6372d247bec7d61":
+ ADDRESSES.bsc.USDC,
+ "0xa9251ca9DE909CB71783723713B21E4233fbf1B1":
+ ADDRESSES.bsc.USDT,
+};
+
+const BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {
+ "0x3b9860321f03AFe02D3FF9e4Fdd4017DC6F4d7Ca":
+ "0x79edc58C471Acf2244B8f93d6f425fD06A439407",
+ "0x1f0dbEcDA414F401dB46464864273CaD19368706":
+ "0x93933FA992927284e9d508339153B31eb871e1f4",
+ "0x3E07F263C1Ce5EC2a3f1cA87af56B80B27674D96":
+ "0x89289DC2192914a9F0674f1E9A17C56456549b8A",
+ "0xD4a0e0b9149BCee3C920d2E00b5dE09138fd8bb7":
+ ADDRESSES.optimism.WETH_1,
+ "0x99CBC45ea5bb7eF3a5BC08FB1B7E56bB2442Ef0D":
+ "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
+ "0x4e65fE4DbA92790696d040ac24Aa414708F5c0AB":
+ ADDRESSES.base.USDC,
+};
+
+const BLAST_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES = {};
+
+const registryTokensWithUnderlyingAddressesByChain = {
+ ethereum: ETHEREUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ arbitrum: ARBITRUM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ optimism: OPTIMISM_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ polygon: POLYGON_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ avalanche: AVALANCHE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ bsc: BNB_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ base: BASE_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+ blast: BLAST_REGISTRY_TOKENS_WITH_UNDERLYING_ADDRESSES,
+};
+
+module.exports = registryTokensWithUnderlyingAddressesByChain;
diff --git a/projects/horizon/collateral.js b/projects/horizon/collateral.js
index 55544343ac..a346db5e07 100644
--- a/projects/horizon/collateral.js
+++ b/projects/horizon/collateral.js
@@ -1,7 +1,8 @@
+const sdk = require("@defillama/sdk");
const { request, gql } = require("graphql-request");
const { getBlock } = require('../helper/http');
-const graph_endpoint = 'https://api.thegraph.com/subgraphs/name/rout-horizon/bsc15-issuance'
+const graph_endpoint = sdk.graph.modifyEndpoint('3URCfxZm32CHDYikF3eu93YCVpDKQyofm42FUh7KkRY9')
const graphQuery = gql`
query get_tvl($block: Int) {
snxholders(orderBy:collateral,orderDirection:desc,block: { number: $block },first:1000,skip:0, where: {initialDebtOwnership_gt: 0, debtEntryAtIndex_gt: 0}) {
diff --git a/projects/hubble/index.js b/projects/hubble/index.js
index 4ea4c00f83..930c6414da 100644
--- a/projects/hubble/index.js
+++ b/projects/hubble/index.js
@@ -1,31 +1,9 @@
-const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require("../helper/solana");
-const ignoreBadTokens = true;
-
async function tvl() {
- const collateralTokens = {
- ETH: '7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs',
- BTC: '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E',
- SRM: 'SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt',
- RAY: '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R',
- FTT: 'AGFEad2et2ZJif9jaGpdMixQqvW5i81aBdvKe7PHNfz3',
- WSOL: ADDRESSES.solana.SOL,
- MSOL: 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So',
- stSOL: '7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj',
- LDO: 'HZRCwxP2Vq9PCpPXooayhJ2bxTpo5xfpQrwB1svh332p',
- }
const collateralVaultAuthority = 'HZYHFagpyCqXuQjrSCN2jWrMHTVHPf9VWP79UGyvo95L'
- const collateralTokensAndOwners = Object.values(collateralTokens).map((mint) => [mint, collateralVaultAuthority])
-
- const psmTokens = {
- USDC: ADDRESSES.solana.USDC
- }
const psmVaultAuthority = '8WrqMitrgjzfqaPJ5PK6X3VT6B1Z8rDgQQny2aWwvJ8q'
- const psmTokensAndOwners = Object.values(psmTokens).map((mint) => [mint, psmVaultAuthority])
-
- const tokensAndOwners = [...collateralTokensAndOwners, ...psmTokensAndOwners]
- return sumTokens2({ tokensAndOwners, ignoreBadTokens })
+ return sumTokens2({ owners: [collateralVaultAuthority, psmVaultAuthority] })
}
async function staking() {
@@ -35,7 +13,7 @@ async function staking() {
]
const tokensAndOwners = [hbbStakingPoolTokenAndOwner]
- return sumTokens2({ tokensAndOwners, ignoreBadTokens })
+ return sumTokens2({ tokensAndOwners, })
}
module.exports = {
diff --git a/projects/huma/index.js b/projects/huma/index.js
new file mode 100644
index 0000000000..fd27dc2d22
--- /dev/null
+++ b/projects/huma/index.js
@@ -0,0 +1,67 @@
+const abiPool = {
+ "checkPool": "function checkPool(uint256 poolId_) view returns ((uint256 poolId, address poolAddress, string poolName, uint8 poolStatus, address poolConfigAddress, address poolTimelock))",
+}
+
+const config = {
+ celo: {
+ factory: '0x85c8dC49B8DaA709e65dd2182e500E8AC3CaA6C7',
+ v1Pools: ['0xa190a0ab76f58b491cc36205b268e8cf5650c576'],
+ },
+ polygon: {
+ v1Pools: ['0xe8926adbfadb5da91cd56a7d5acc31aa3fdf47e5', '0x95533e56f397152b0013a39586bc97309e9a00a7', '0x3EBc1f0644A69c565957EF7cEb5AEafE94Eb6FcE'],
+ }
+}
+
+module.exports = {
+ methodology: 'sum all tvls from all pools',
+ start: 1716248276, //2023-05-01
+}
+
+Object.keys(config).forEach(chain => {
+ const { factory, v1Pools, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const allTokens = []
+ const allOwners = []
+ const v1Data = await api.multiCall({ abi: 'function getCoreData() view returns (address uToken, address, address, address)', calls: v1Pools})
+ allTokens.push(...v1Data.map(i => i.uToken))
+ allOwners.push(...v1Pools)
+
+ if (factory) {
+ const poolData = await api.fetchList({ lengthAbi: 'poolId', itemAbi: abiPool.checkPool, target: factory, startFromOne: true})
+ const pools = poolData.filter(p => p.poolStatus === '1').map(p => p.poolAddress)
+ const poolConfigs = await api.multiCall({ abi: 'address:poolConfig', calls: pools})
+ const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: poolConfigs})
+ const owners = await api.multiCall({ abi: 'address:poolSafe', calls: pools})
+ allTokens.push(...tokens)
+ allOwners.push(...owners)
+ }
+ return api.sumTokens({ tokensAndOwners2: [allTokens, allOwners] })
+ },
+ borrowed: async (api) => {
+ const allTokens = []
+ const allOwners = []
+ const v1Data = await api.multiCall({ abi: 'function getCoreData() view returns (address uToken, address, address, address)', calls: v1Pools})
+ const v1Bals = await api.multiCall({ abi: 'uint256:totalPoolValue', calls: v1Pools})
+ api.add(v1Data.map(i => i.uToken), v1Bals)
+ allTokens.push(...v1Data.map(i => i.uToken))
+ allOwners.push(...v1Pools)
+
+ if (factory) {
+ const poolData = await api.fetchList({ lengthAbi: 'poolId', itemAbi: abiPool.checkPool, target: factory, startFromOne: true})
+ const pools = poolData.filter(p => p.poolStatus === '1').map(p => p.poolAddress)
+ const poolConfigs = await api.multiCall({ abi: 'address:poolConfig', calls: pools})
+ const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: poolConfigs})
+ const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: pools})
+ api.add(tokens, bals)
+ const owners = await api.multiCall({ abi: 'address:poolSafe', calls: pools})
+ allTokens.push(...tokens)
+ allOwners.push(...owners)
+ }
+
+ const calls = allTokens.map((t, i) => ({ target: t, params: allOwners[i] }))
+ const tokenBals = (await api.multiCall({ abi: 'erc20:balanceOf', calls, })).map(i => i * -1) // subtract token balance in pools
+ api.add(allTokens, tokenBals)
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/huobi/index.js b/projects/huobi/index.js
index ff2134e3d3..5c5744cc79 100644
--- a/projects/huobi/index.js
+++ b/projects/huobi/index.js
@@ -60,7 +60,7 @@ const config = {
'0x5c985e89dde482efe97ea9f1950ad149eb73829b',
'0xe4818f8fde0c977a01da4fa467365b8bf22b071e',
'0xe93381fb4c4f14bda253907b18fad305d799241a', // end add on 23/02/2024 (we defillama)
-
+ '0x6663613FbD927cE78abBF7F5Ca7e2c3FE0d96d18', // add on 22/07/2024
],
blacklistedTokens: [
'0x0316eb71485b0ab14103307bf65a021042c6d380', // HBTC , we already track their backed BTC (1btc wallet on the list)
diff --git a/projects/icecreamswap-v3/index.js b/projects/icecreamswap-v3/index.js
new file mode 100644
index 0000000000..426c5aea73
--- /dev/null
+++ b/projects/icecreamswap-v3/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ core: { factory: '0xa8a3AAD4f592b7f30d6514ee9A863A4cEFF6531D', fromBlock: 9212906, },
+})
\ No newline at end of file
diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js
index e660e4e158..0f5623414d 100644
--- a/projects/icecreamswap/index.js
+++ b/projects/icecreamswap/index.js
@@ -3,6 +3,7 @@ const { getUniTVL, } = require('../helper/unknownTokens')
const config = {
shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31',
bob: '0x7b2a5C88AB9367147F6ac384F857CbaDF5aA70a7',
+ lightlink_phoenix: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d',
}
const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert', 'scroll', 'neon_evm', 'blast' ]
diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js
index 4d6adbe0c8..982a5bf1f6 100644
--- a/projects/ichifarm/index.js
+++ b/projects/ichifarm/index.js
@@ -102,8 +102,10 @@ const config = {
// },
linea: {
vaultConfigs: [
+ { factory: '0xb0e7871d53BE1b1d746bBfD9511e2eF3cD70a6E7', fromBlock: 4722347, isAlgebra: false, }, // Linehub
{ factory: '0x0248b992ac2a75294b05286E9DD3A2bD3C9CFE4B', fromBlock: 1599561, isAlgebra: true, }, // Lynex
{ factory: '0x2592686212C164C1851dF2f62c5d5EC50600195E', fromBlock: 4148753, isAlgebra: false, }, // Metavault
+ { factory: '0xa29F3D5403D50Ea1BF597E2Ef01791A1Ce4F544E', fromBlock: 5033991, isAlgebra: false, }, // Nile
{ factory: '0x6E3eB904966B0158833852cAFD1200c171772b53', fromBlock: 3976012, isAlgebra: false, }, // Uniswap
]
},
@@ -127,7 +129,8 @@ const config = {
},
polygon_zkevm: {
vaultConfigs: [
- { factory: '0x9FAb4bdD4E05f5C023CCC85D2071b49791D7418F', fromBlock: 4830529, isAlgebra: false, }, // Zero
+ { factory: '0xe8532Db60408f2d47693dA5b9093D71580B8C23F', fromBlock: 10890417, isAlgebra: false, }, // PancakeSwap
+ { factory: '0x1721cB3ff3cAF70a79bDE9d771B27646ed8115b1', fromBlock: 11102475, isAlgebra: true, }, // QuickSwap
]
},
}
diff --git a/projects/icpex/index.js b/projects/icpex/index.js
new file mode 100644
index 0000000000..e0d3deac96
--- /dev/null
+++ b/projects/icpex/index.js
@@ -0,0 +1,18 @@
+
+const { get } = require('../helper/http')
+const { toUSDTBalances } = require('../helper/balances')
+
+module.exports = {
+ misrepresentedTokens: true,
+ icp: { tvl },
+}
+
+async function tvl() {
+ let result = await get('https://metrics.icpex.org/llama/tvl');
+ if (result.retCode === 1 && result.retMsg === "success") {
+ const tvl = result.data;
+ return toUSDTBalances(tvl);
+ } else {
+ throw new Error(`API error! message: ${result.retMsg}`);
+ }
+}
diff --git a/projects/imf-money/index.js b/projects/imf-money/index.js
new file mode 100644
index 0000000000..486c45d8af
--- /dev/null
+++ b/projects/imf-money/index.js
@@ -0,0 +1,10 @@
+const { sumTokensExport } = require('../helper/unwrapLPs')
+const PEPE_TOKEN_CONTRACT = '0x6982508145454Ce325dDbE47a25d4ec3d2311933';
+const LOCKED_MONEY_CONTRACT = '0x30F75834cB406b7093208Fda7F689938aCBD1EeB'; //wallet that has all the locked money
+
+module.exports = {
+ methodology: 'Sums the value of deposited memes',
+ ethereum: {
+ tvl: sumTokensExport({ owner: LOCKED_MONEY_CONTRACT, token: PEPE_TOKEN_CONTRACT}),
+ }
+};
diff --git a/projects/immutable-zkevm/index.js b/projects/immutable-zkevm/index.js
new file mode 100644
index 0000000000..7ef8cdc217
--- /dev/null
+++ b/projects/immutable-zkevm/index.js
@@ -0,0 +1,12 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+module.exports = {
+ ethereum: {
+ tvl: async ({ api }) =>
+ sumTokens2({
+ api,
+ owner: "0xBa5E35E26Ae59c7aea6F029B68c6460De2d13eB6",
+ fetchCoValentTokens: true,
+ }),
+ },
+};
diff --git a/projects/impermax/impermaxHelper.js b/projects/impermax/impermaxHelper.js
index 9d06f7d205..0817f51d84 100644
--- a/projects/impermax/impermaxHelper.js
+++ b/projects/impermax/impermaxHelper.js
@@ -104,6 +104,9 @@ function impermaxHelper(exportsObj, config, blacklistedPools) {
case 'canto':
case 'era':
case 'fantom':
+ case 'scroll':
+ case 'base':
+ case 'mantle':
default:
impermaxSymbol = 'STKD-UNI-V2'
return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol)
@@ -124,4 +127,5 @@ function impermaxHelper(exportsObj, config, blacklistedPools) {
module.exports = {
impermaxHelper
-}
\ No newline at end of file
+}
+
diff --git a/projects/impermax/index.js b/projects/impermax/index.js
index a0a9335bc9..27efed1a61 100644
--- a/projects/impermax/index.js
+++ b/projects/impermax/index.js
@@ -11,12 +11,13 @@ const config = {
'0xBB92270716C8c424849F17cCc12F4F24AD4064D6',
'0x7F7AD5b16c97Aa9C2B0447C2676ce7D5CEFEbCd3',
'0x7ED6eF7419cD9C00693d7A4F81c2a151F49c7aC2',
+ '0x60f57cF15a34fA0Aa25eF37eB827E1a0948966c5'
]
},
arbitrum: {
factories: [
'0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B',
- '0x8C3736e2FE63cc2cD89Ee228D9dBcAb6CE5B767B',
+ '0x9708e0b216a88d38d469b255ce78c1369ad898e6',
'0x97bc7fefb84a4654d4d3938751b5fe401e8771c2',
]
},
@@ -48,6 +49,25 @@ const config = {
'0x9b4ae930255CB8695a9F525dA414F80C4C7a945B',
]
},
+ scroll: {
+ factories: [
+ '0x02Ff7B4d96EeBF8c9B34Fae0418E591e11da3099',
+ '0xFBD17F3AA7d6506601D2bF7e15a6C96081296a01', // scroll stablefactory
+ ]
+ },
+ base: {
+ factories: [
+ '0x66ca66E002a9CEE8dEfE25dB6f0c6225117C2d9f',
+ '0x8aDc5F73e63b3Af3fd0648281fE451738D8B9D86',
+ '0x47183bB55AD0F891887E099Cec3570d3C667cD00'
+ ]
+ },
+ mantle: {
+ factories: [
+ '0x3047523D5ed0df1545B1C440BdAaB095f1f3cf5C'
+ ]
+ }
+
}
const blacklistedPools = {
@@ -89,6 +109,9 @@ const blacklistedPools = {
'0x877a330af63094d88792b9ca28ac36c71673eb1c', // IMX-FTM
'0xb97b6ed451480fe6466a558e9c54eaac32e6c696', // OXD-FTM
],
+ scroll: [],
+ base: [],
+ mantle: []
}
module.exports = {}
diff --git a/projects/inception-lrt/index.js b/projects/inception-lrt/index.js
index ecdda208cd..3731811b65 100644
--- a/projects/inception-lrt/index.js
+++ b/projects/inception-lrt/index.js
@@ -7,14 +7,13 @@ async function tvl_eth(api) {
const strategies = await api.multiCall({ abi: 'address:strategy', calls: vaults})
const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: strategies})
// const result = total_deposited.map((deposited, index) => deposited - total_withdraw[index]);
- if (api.timestamp > 1715181240) {
- const staked = await api.call({ abi: 'uint256:totalAssets', target: '0xf073bAC22DAb7FaF4a3Dd6c6189a70D54110525C' })
- api.add(ADDRESSES.null, staked)
- }
api.add(tokens, total_deposited)
}
module.exports = {
+ hallmarks: [
+ [1714953600,"Genesis Merges with InceptionLRT"]
+ ],
doublecounted: true,
ethereum: { tvl: tvl_eth, } ,
}
diff --git a/projects/indexcoop/index.js b/projects/indexcoop/index.js
index 468486092e..76b934016f 100644
--- a/projects/indexcoop/index.js
+++ b/projects/indexcoop/index.js
@@ -13,6 +13,7 @@ const bedAddress = "0x2aF1dF3AB0ab157e1E2Ad8F88A7D04fbea0c7dc6";
const dataAddress = "0x33d63Ba1E57E54779F7dDAeaA7109349344cf5F1";
const gmiAddress = "0x47110d43175f7f2c2425e7d15792acc5817eb44f";
const icethAddress = "0x7c07f7abe10ce8e33dc6c5ad68fe033085256a84";
+const hyETH = "0xc4506022Fb8090774E8A628d5084EED61D9B99Ee";
const dsETH = "0x341c05c0E9b33C0E38d64de76516b2Ce970bB3BE";
const aaveDebtToken = "0xf63b34710400cad3e044cffdcab00a0f32e33ecf";
const USDC = ADDRESSES.ethereum.USDC
@@ -29,6 +30,7 @@ const sets = [
icethAddress,
dsETH,
gtcETH,
+ hyETH,
];
async function tvl(api) {
diff --git a/projects/infdex/index.js b/projects/infdex/index.js
new file mode 100644
index 0000000000..731d0c1773
--- /dev/null
+++ b/projects/infdex/index.js
@@ -0,0 +1,6 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+const factory = '0x6701E10b02F4131003510f95419F4EeA59484007'
+
+module.exports = uniV3Export({
+ merlin: { factory, fromBlock: 12099773, }
+})
\ No newline at end of file
diff --git a/projects/infinity-hedge-fund/index.js b/projects/infinity-hedge-fund/index.js
new file mode 100644
index 0000000000..f354c5563a
--- /dev/null
+++ b/projects/infinity-hedge-fund/index.js
@@ -0,0 +1,7 @@
+const { staking } = require('../helper/staking')
+module.exports = {
+ base: {
+ tvl: () => ({}),
+ staking: staking('0x042Fef60aD51f48C65E6106F9b950178910A3300', '0x3B9728bD65Ca2c11a817ce39A6e91808CceeF6FD'),
+ }
+}
diff --git a/projects/injera/index.js b/projects/injera/index.js
new file mode 100644
index 0000000000..0b7fd40df0
--- /dev/null
+++ b/projects/injera/index.js
@@ -0,0 +1,29 @@
+const { sumTokens} = require('../helper/chain/cosmos');
+
+const addresses = {
+ injective: {
+ redBank: 'inj1dffuj4ud2fn7vhhw7dec6arx7tuyxd56srjwk4',
+ creditManager: 'inj1da4kst7293x7g43sxdx6hnppkqmr5aaf2hanhj',
+ params: 'inj1xuf0xk9583ry4wczmxulleuhrw6dqtlnvvcx56'
+ },
+}
+
+async function injectiveTVL() {
+ let balances = {};
+ await addRedBankTvl(balances, 'injective');
+ return balances;
+}
+
+
+async function addRedBankTvl(balances, chain) {
+ let a = await sumTokens({balances, owners: [addresses[chain].redBank], chain});
+ return a
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: 'For Injective chain, sum token balances in Bank/Credit Manager smart contracts to approximate net deposits, plus vault underlying assets held',
+ injective: {
+ tvl: injectiveTVL,
+ },
+};
diff --git a/projects/instadapp-lite/index.js b/projects/instadapp-lite/index.js
new file mode 100644
index 0000000000..9ed590e89e
--- /dev/null
+++ b/projects/instadapp-lite/index.js
@@ -0,0 +1,26 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const vaults = [
+ { "vault": "0xc383a3833A87009fD9597F8184979AF5eDFad019", "token": ADDRESSES.null },
+ { "vault": "0xc8871267e07408b89aA5aEcc58AdCA5E574557F8", "token": ADDRESSES.ethereum.USDC },
+ { "vault": "0xEC363faa5c4dd0e51f3D9B5d0101263760E7cdeB", "token": ADDRESSES.ethereum.WBTC },
+ { "vault": "0x40a9d39aa50871Df092538c5999b107f34409061", "token": ADDRESSES.ethereum.DAI }
+]
+const vaultsV2 = ["0xA0D3707c569ff8C87FA923d3823eC5D81c98Be78"]
+
+async function tvl(api) {
+ const calls = vaults.map(v => ({ target: v.vault }))
+ const prices = await api.multiCall({
+ calls,
+ abi: "function getCurrentExchangePrice() public view returns (uint256 exchangePrice_, uint256 newTokenRevenue_)"
+ })
+ const supply = await api.multiCall({
+ calls,
+ abi: "erc20:totalSupply"
+ })
+ prices.forEach((price, i)=>api.add(vaults[i].token, price.exchangePrice_*supply[i]/1e18))
+ return api.erc4626Sum({ calls: vaultsV2, tokenAbi: 'address:asset', balanceAbi: 'uint256:totalAssets' });
+}
+
+module.exports = {
+ ethereum: { tvl }
+}
\ No newline at end of file
diff --git a/projects/invariant/index.js b/projects/invariant/index.js
index a79b24064a..0098e4a90e 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/inverse-finance-firm/index.js b/projects/inverse-finance-firm/index.js
index a5fc0d0f2a..3ea79f3943 100644
--- a/projects/inverse-finance-firm/index.js
+++ b/projects/inverse-finance-firm/index.js
@@ -15,6 +15,7 @@ async function tvl(api) {
topics: ['0xc3dfb88ee5301cecf05761fb2728064e5b641524346ae69b9ba80394631bf11f'],
fromBlock: firmStart,
eventAbi: abi.AddMarket,
+ extraKey: "fix-firm"
})
// unique markets
@@ -46,7 +47,8 @@ module.exports = {
methodology: "Get collateral balances from users personal escrows",
hallmarks: [
[1696204800, "Borrow against INV on FiRM"],
- [1707177600, "Launch of sDOLA"],
+ [1707177600, "Launch of sDOLA"],
+ [1718236800, "CRV liquidation"]
],
start: 1670701200, // Dec 10 2022
ethereum: { tvl }
diff --git a/projects/invictus/index.js b/projects/invictus/index.js
index d1ce0d9e03..0d31072541 100644
--- a/projects/invictus/index.js
+++ b/projects/invictus/index.js
@@ -1,22 +1,12 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { getTokenAccountBalance, getTokenBalance } = require('../helper/solana')
+const { sumTokens2 } = require('../helper/solana')
async function staking() {
- const stakedInv = await getTokenAccountBalance("5EZiwr4fE1rbxpzQUWQ6N9ppkEridNwbH3dU3xUf7wPZ")
- return {
- "invictus": stakedInv
- }
+ return sumTokens2({tokenAccounts: ['5EZiwr4fE1rbxpzQUWQ6N9ppkEridNwbH3dU3xUf7wPZ']})
}
const treasury = "6qfyGvoUqGB6AQ7xLc4pVwFNdgJSbAMkTtKkBXhLRiV1"
async function tvl() {
- const [usdc,] = await Promise.all([
- ADDRESSES.solana.USDC, //usdc
- ].map(t => getTokenBalance(t, treasury)))
- return {
- "usd-coin": usdc,
- }
-
+ return sumTokens2({ owner: treasury })
}
diff --git a/projects/ip/index.js b/projects/ip/index.js
index c1721e5ed3..f9f78c593f 100644
--- a/projects/ip/index.js
+++ b/projects/ip/index.js
@@ -1,79 +1,102 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require('@defillama/sdk');
const { sumTokens2 } = require('../helper/unwrapLPs')
-const {lendingMarket} = require('../helper/methodologies')
-
-const VaultController = "0x4aaE9823Fb4C70490F1d802fC697F3ffF8D5CbE3"
+const { lendingMarket } = require('../helper/methodologies');
const vaultSummaryAbi = 'function vaultSummaries(uint96 start, uint96 stop) view returns (tuple(uint96 id, uint192 borrowingPower, uint192 vaultLiability, address[] tokenAddresses, uint256[] tokenBalances)[])'
-const cappedTokens = {
- "0x5aC39Ed42e14Cf330A864d7D1B82690B4D1B9E61": {
- address: ADDRESSES.ethereum.MATIC,
- symbol: 'MATIC',
- },
- "0xfb42f5AFb722d2b01548F77C31AC05bf80e03381": {
- address: '0xc18360217d8f7ab5e7c516566761ea12ce7f9d72',
- symbol: 'ENS',
- },
- "0x05498574BD0Fa99eeCB01e1241661E7eE58F8a85": {
- address: '0xba100000625a3754423978a60c9317c58a424e3d',
- symbol: 'BAL',
- },
- "0xd3bd7a8777c042De830965de1C1BCC9784135DD2": {
- address: ADDRESSES.ethereum.AAVE,
- symbol: 'AAVE',
- },
- "0x7C1Caa71943Ef43e9b203B02678000755a4eCdE9": {
- address: ADDRESSES.ethereum.LIDO,
- symbol: 'LDO',
- },
- "0xDDB3BCFe0304C970E263bf1366db8ed4DE0e357a": {
- address: '0x92d6c1e31e14520e676a687f0a93788b716beff5',
- symbol: 'DYDX',
- },
- "0x9d878eC06F628e883D2F9F1D793adbcfd52822A8": {
- address: ADDRESSES.ethereum.CRV,
- symbol: 'CRV',
- },
- "0x64eA012919FD9e53bDcCDc0Fc89201F484731f41": {
- address: ADDRESSES.ethereum.RETH,
- symbol: 'rETH',
- },
- "0x99bd1f28a5A7feCbE39a53463a916794Be798FC3": {
- address: ADDRESSES.ethereum.cbETH,
- symbol: 'cbETH',
- },
-}
+async function getVaultData(api, vaultController) {
+ const cappedTokens = {}
+ let pullMoreTokens = true
+ let enabledTokenIndex = 0
+ const batchSize = 10
+ const allTokens = []
+ do {
+ let calls = []
+ for (let i = 0; i < 10; i++) {
+ calls.push(enabledTokenIndex + i)
+ }
+ enabledTokenIndex += batchSize
+ const tokens = await api.multiCall({ abi: 'function _enabledTokens(uint256) view returns (address)', calls, permitFailure: true, target: vaultController })
+ allTokens.push(...tokens.filter(i => i))
+ pullMoreTokens = !tokens.some(token => !token)
+ } while (pullMoreTokens)
+
+ const uTokens = await api.multiCall({ abi: 'address:_underlying', calls: allTokens, permitFailure: true, })
+ uTokens.forEach((token, i) => {
+ if (!token) return;
+ cappedTokens[allTokens[i].toLowerCase()] = token
+ })
-async function tvl(api) {
- const balances = {}
- const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: VaultController })
+ const count = await api.call({ abi: " function vaultsMinted() view returns (uint96)", target: vaultController })
const calls = []
- for (let i = 1; i <= count; i++)
- calls.push({ params: [i, i]})
+ for (let i = 1; i <= count; i++)
+ calls.push({ params: [i, i] })
- const vaults = (await api.multiCall({ abi: vaultSummaryAbi, target: VaultController, calls, permitFailure: true })).filter(i => i).flat()
+ const vaults = (await api.multiCall({ abi: vaultSummaryAbi, target: vaultController, calls, permitFailure: true })).filter(i => i).flat()
+
+ return { cappedTokens, vaults }
+}
+
+async function eth_tvl(api) {
+ const VaultController = "0x4aaE9823Fb4C70490F1d802fC697F3ffF8D5CbE3"
+
+ const { cappedTokens, vaults } = await getVaultData(api, VaultController)
vaults.map(vault => {
vault.tokenAddresses.map((token, i) => {
- token = cappedTokens[token]?.address || token
- sdk.util.sumSingleBalance(balances,token,vault.tokenBalances[i])
+ token = cappedTokens[token.toLowerCase()] ?? token
+ api.add(token, vault.tokenBalances[i])
})
})
- return sumTokens2({ api, balances, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC]})
+ //get reserves
+ return sumTokens2({ api, owner: '0x2A54bA2964C8Cd459Dc568853F79813a60761B58', tokens: [ADDRESSES.ethereum.USDC] })
+}
+
+async function op_tvl(api) {
+ //get reserves
+ const USDI = "0x889be273BE5F75a177f9a1D00d84D607d75fB4e1"
+ await api.sumTokens({ owner: USDI, tokens: [ADDRESSES.optimism.USDC, ADDRESSES.optimism.USDC_CIRCLE] })
+
+ //get collaterals
+ const positionWrapper = "0x7131FF92a3604966d7D96CCc9d596F7e9435195c".toLowerCase()
+ const VaultController = "0x05498574BD0Fa99eeCB01e1241661E7eE58F8a85"
+ const { cappedTokens, vaults } = await getVaultData(api, VaultController)
+
+ vaults.map(vault => {
+ vault.tokenAddresses.map((token, i) => {
+ const bal = vault.tokenBalances[i]
+ if (+bal === 0) return;
+ token = cappedTokens[token.toLowerCase()] ?? token
+ token = token.toLowerCase()
+ if (token === ADDRESSES.optimism.WBTC.toLowerCase()) {
+ //scale for wbtc decimals
+ api.add(token, bal / 1e10)
+ } else if (token === positionWrapper) {
+ //total is already in usd 1e18 terms, add as DAI, as this is a stablecoin at 1e18
+ api.add(ADDRESSES.optimism.DAI, bal)
+ } else {
+ api.add(token, bal)
+ }
+ })
+ })
}
module.exports = {
start: 14962974,
ethereum: {
- tvl,
+ tvl: eth_tvl
+ },
+ optimism: {
+ tvl: op_tvl
},
methodology: `${lendingMarket}.
- For Interest Protocol, TVL is Reserve + Total Collateral Value
- Reserve is found through calling USDC.getBalances(USDI)
+ For Interest Protocol, TVL is USDC Reserve + Total Deposited Collateral Value
+ Reserve is the amount of USDC held by the USDI contract
Balances are found through VaultController.vaultSummaries(1,VaultController.vaultsMinted())
Capped tokens converted 1:1 to underlying
+ Wrapped Uni V3 Positions as implemented report their values to Interest Protocol in USD terms * 1e18,
+ as such, they are currently listed as DAI in the TVL calculation,
+ therefore DAI numbers in the TVL should be treated as Uniswap V3 position collateral value, as DAI is not otherwise listed on IP.
`
};
diff --git a/projects/iswap-tech/index.js b/projects/iswap-tech/index.js
new file mode 100644
index 0000000000..bf7ee1822e
--- /dev/null
+++ b/projects/iswap-tech/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ btr: { factory: '0xad2449234455e0992e1423411df0f8b6fed1feae', fromBlock: 1370065, },
+})
\ No newline at end of file
diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js
index 6970edde85..256c2d5b2a 100644
--- a/projects/izumi-iziswap/index.js
+++ b/projects/izumi-iziswap/index.js
@@ -33,6 +33,8 @@ const poolHelpers = {
'mode': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'],
'xlayer': ['0xF42C48f971bDaA130573039B6c940212EeAb8496'],
'bob': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'],
+ 'taiko': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'],
+ 'core': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'],
} // iziswap liquidityManager contracts
const blacklistedTokens = [
diff --git a/projects/jaspervault/index.js b/projects/jaspervault/index.js
index ba1ff656c5..a327a6ec8b 100644
--- a/projects/jaspervault/index.js
+++ b/projects/jaspervault/index.js
@@ -5,10 +5,15 @@ module.exports = {
arbitrum: {
tvl: sumTokensExport({
owners: [
- '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', // sell WBTC & ETH CALL
- '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89' // sell WBTC & ETH PUT
+ '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41',
+ '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89',
+ '0x5954B84F4ba745E1A85E9A5875ce3bDf863200ba',
+ '0xaaa5a76b9397eE41309CC15Bd71a5ae99662d6cd',
+ '0x3cF1A20AE73ff128D3A40F4492fdE59F2B2D1e8C',
+ '0x1eb466780e412C796A7BEdA541CfF47E0571A000',
+ '0x1DDD814589376Db497F91eFD2E6AFF969822a951'
],
- tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT]
+ tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.ARB]
})
},
}
diff --git a/projects/javsphere/index.js b/projects/javsphere/index.js
index 68bd33d975..415910ea31 100644
--- a/projects/javsphere/index.js
+++ b/projects/javsphere/index.js
@@ -1,4 +1,6 @@
const { get } = require('../helper/http')
+const { staking } = require("../helper/staking.js");
+const {stakings} = require("../helper/staking");
const vaultUrl = "https://mainnet.ocean.jellyfishsdk.com/v0/mainnet/address/df1q7zkdpw6hd5wzcxudx28k72vjvpefa4pyqls2grnahhyw4u8kf0zqu2cnz6/vaults";
const ONE_YEAR_LOCKING_MAINNET = '0xD88Bb8359D694c974C9726b6201479a123212333'
@@ -18,9 +20,12 @@ async function defichainTvl(api) {
module.exports = {
methodology: `We count the total value locked in DUSD from all current products (dusd staking is a vault in defichain L1,
- 1 year bond and 2 year bond are smart contracts on defimetachain L2). `,
+ 1 year bond and 2 year bond are smart contracts on defimetachain L2. We also track staking and freezer of javsphers native token JAV). `,
defichain_evm: {
- tvl
+ tvl,
+ staking: stakings( ['0x4e15D4225623D07Adb43e9D546E57E1E6097e869', '0xF923f0828c56b27C8f57bc698c99543f63091E9A'],
+ '0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E'),
+ vesting: staking('0x7246ad1ac72715c5fd6c1FD7460A63afB8289104','0x66F3Cf265D2D146A0348F6fC67E3Da0835e0968E')
}, defichain: {
tvl: defichainTvl
},
diff --git a/projects/jax-protocol/index.js b/projects/jax-protocol/index.js
new file mode 100644
index 0000000000..e7bf371af2
--- /dev/null
+++ b/projects/jax-protocol/index.js
@@ -0,0 +1,5 @@
+const { compoundExports2 } = require('../helper/compound')
+
+module.exports = {
+ taiko: compoundExports2({ comptroller: '0x8D86d4070b9432863FE9522B2c931C410085E1d4', cether: '0xdc1af71e6b9b4572cdf7832496efbea06cbecfc5', }),
+}
\ No newline at end of file
diff --git a/projects/jellyverse/index.js b/projects/jellyverse/index.js
new file mode 100644
index 0000000000..382b6f6677
--- /dev/null
+++ b/projects/jellyverse/index.js
@@ -0,0 +1,19 @@
+const { onChainTvl } = require('../helper/balancer')
+
+const config = {
+ vault: "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875",
+ startingBlock: 81_247_457,
+};
+
+module.exports = {
+ sei: {
+ tvl: onChainTvl(config.vault, config.startingBlock, {
+ preLogTokens: [
+ '0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1',
+ '0xB75D0B03c06A926e488e2659DF1A861F860bD3d1',
+ '0x5f0E07dFeE5832Faa00c63F2D33A0D79150E8598',
+ '0x5Cf6826140C1C56Ff49C808A1A75407Cd1DF9423',
+ ]
+ }),
+ }
+}
diff --git a/projects/jetprotocol.js b/projects/jetprotocol.js
index 4e31993ea1..be8e2824f5 100644
--- a/projects/jetprotocol.js
+++ b/projects/jetprotocol.js
@@ -1,40 +1,23 @@
const ADDRESSES = require('./helper/coreAssets.json')
-const { getTokenBalance, sumTokens2 } = require("./helper/solana");
+const { sumTokens2 } = require("./helper/solana");
-async function borrowed() {
- const [usdcAmount, ethAmount, solAmount, btcAmount] = await Promise.all([
- getTokenBalance(
- "G17Yu6f4emBeRLWS1Y4cNJMTmT5LUGJH95zK6253KoAH",
- "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8"
- ),
- getTokenBalance(
- "5v8QVtwqZjSdJxhCF2xWrAopiyhDgJTdgeQZ5aWmStnE",
- "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8"
- ),
- getTokenBalance(
- "A9S9XVCuNXHnJGFhxBhsTmJNHa6aPccF5NCAGgE4BxGF",
- "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8"
- ),
- getTokenBalance(
- "7SXpzVgqMvDEWkv9jtDUZVjkBPUbn8EUitKwV22WCpxt",
- "7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8"
- ),
- ]);
- return {
- bitcoin: btcAmount,
- "usd-coin": usdcAmount,
- ethereum: ethAmount,
- solana: solAmount,
- };
+const debtMapping = {
+ 'G17Yu6f4emBeRLWS1Y4cNJMTmT5LUGJH95zK6253KoAH': ADDRESSES.solana.USDC,
+ '5v8QVtwqZjSdJxhCF2xWrAopiyhDgJTdgeQZ5aWmStnE': '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk',
+ 'A9S9XVCuNXHnJGFhxBhsTmJNHa6aPccF5NCAGgE4BxGF': ADDRESSES.solana.SOL,
+ '7SXpzVgqMvDEWkv9jtDUZVjkBPUbn8EUitKwV22WCpxt': '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E',
+}
+
+async function borrowed(api) {
+ const allBals = await sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', })
+
+ Object.entries(debtMapping).forEach(([key, value]) => {
+ api.add(value, allBals['solana:'+key] ?? 0)
+ })
}
async function tvl() {
- return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', tokens: [
- ADDRESSES.solana.USDC,
- '2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk',
- ADDRESSES.solana.SOL,
- '9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E',
- ]});
+ return sumTokens2({ owner: '7gpj9cpzBBW9Ci1yMwWz7iGbQYpm5fZmadNQyrYsqch8', blacklistedTokens: Object.keys(debtMapping)});
}
// JPv1rCqrhagNNmJVM5J1he7msQ5ybtvE1nNuHpDHMNU
diff --git a/projects/jigsaw/index.js b/projects/jigsaw/index.js
new file mode 100644
index 0000000000..f7b83af14f
--- /dev/null
+++ b/projects/jigsaw/index.js
@@ -0,0 +1,11 @@
+const { sumERC4626VaultsExport } = require("../helper/erc4626");
+
+module.exports = {
+ methodology: 'ETH and LSTs in vaults',
+ ethereum: {
+ tvl: sumERC4626VaultsExport({
+ vaults: ["0x4412e5492C689CF13D585dCdb010B3b8b12dF16a", "0x9F5e6E972D76d4501900f4484622f9413E5Cc302", "0x3A10a803958e837599348621Edb42eF73c79aC22"],
+ tokenAbi: 'tokenIn', balanceAbi: 'totalSupply'
+ })
+ }
+};
\ No newline at end of file
diff --git a/projects/jojo/index.js b/projects/jojo/index.js
index c05697c1ed..761261f688 100644
--- a/projects/jojo/index.js
+++ b/projects/jojo/index.js
@@ -20,7 +20,7 @@ module.exports = {
tvl: sumTokensExport(
{
tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH, cbethBase, degenBase, mUsdcBase, ],
- owners: ['0x2f7c3cf9d9280b165981311b822becc4e05fe635', '0xf8192489A8015cA1690a556D42F7328Ea1Bb53D0']
+ owners: ['0x2f7c3cf9d9280b165981311b822becc4e05fe635', '0xf8192489A8015cA1690a556D42F7328Ea1Bb53D0', '0x8B7e1924fF57EEc8EbD87254E4de6Ff397f039D3']
}
)
},
diff --git a/projects/joltify-lending/index.js b/projects/joltify-lending/index.js
new file mode 100644
index 0000000000..931d31b53c
--- /dev/null
+++ b/projects/joltify-lending/index.js
@@ -0,0 +1,24 @@
+const { queryV1Beta1 } = require('../helper/chain/cosmos');
+const chain = 'joltify'
+
+const tvl = async (api) => {
+ const [deposited, borrowed] = await Promise.all([
+ queryV1Beta1({ chain, url: `third_party/jolt/v1beta1/total-deposited/` }),
+ queryV1Beta1({ chain, url: `third_party/jolt/v1beta1/total-borrowed/` })
+ ]);
+ deposited.supplied_coins.forEach(({ denom, amount }) => api.add(denom, amount));
+ borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount * -1));
+}
+
+const borrowed = async (api) => {
+ const borrowed = await queryV1Beta1({ chain, url: 'third_party/jolt/v1beta1/total-borrowed/' })
+ borrowed.borrowed_coins.forEach(({ denom, amount }) => api.add(denom, amount))
+}
+
+module.exports = {
+ timetravel: false,
+ joltify: {
+ tvl,
+ borrowed
+ }
+}
\ No newline at end of file
diff --git a/projects/joltify-rwa/index.js b/projects/joltify-rwa/index.js
new file mode 100644
index 0000000000..7529664e73
--- /dev/null
+++ b/projects/joltify-rwa/index.js
@@ -0,0 +1,39 @@
+const { queryV1Beta1 } = require('../helper/chain/cosmos');
+const chain = 'joltify'
+
+const tvl = async (api) => {
+ const [pools] = await Promise.all([
+ queryV1Beta1({ chain, url: `spv/list_pools` }),
+ ]);
+
+ pools.pools_info.forEach(async pool => {
+ api.add(pool.usable_amount.denom, pool.usable_amount.amount);
+ api.add(pool.escrow_principal_amount.denom, pool.escrow_principal_amount.amount);
+ api.add(pool.escrow_principal_amount.denom, pool.escrow_interest_amount);
+ });
+}
+
+const borrowed = async (api) => {
+ const [pools] = await Promise.all([
+ queryV1Beta1({ chain, url: `spv/list_pools` }),
+ ]);
+
+ const [price_info] = await Promise.all([
+ queryV1Beta1({ chain, url: `third_party/pricefeed/v1beta1/prices` }),
+ ]);
+
+ pools.pools_info.forEach(async pool => {
+ const [market, borrowed_denom] = pool.borrowed_amount.denom.split('-');
+ const market_id = `${market}:usd`;
+ const price = price_info.prices.find(price => price.market_id === market_id)?.price;
+ api.add(borrowed_denom, pool.borrowed_amount.amount * price);
+ });
+}
+
+module.exports = {
+ timetravel: false,
+ joltify: {
+ tvl,
+ borrowed
+ }
+}
\ No newline at end of file
diff --git a/projects/jpool.js b/projects/jpool.js
index 7ecab8add2..cf74565be2 100644
--- a/projects/jpool.js
+++ b/projects/jpool.js
@@ -1,16 +1,15 @@
-const {getTokenSupply} = require('./helper/solana')
-async function tvl(){
- const supply = await getTokenSupply("7Q2afV64in6N6SeZsAAB81TJzwDoD6zpqmHkzi9Dcavn")
- return {
- jpool: supply
- }
+const { getSolBalanceFromStakePool } = require('./helper/solana')
+
+async function tvl(api) {
+ // https://jpool.one/pool-info
+ await getSolBalanceFromStakePool('CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8cyGpLTo2LJzG1', api)
}
-module.exports={
- timetravel: false,
- methodology: "JSOL total supply as it's equal to the SOL staked",
- solana:{
- tvl
- }
+module.exports = {
+ timetravel: false,
+ methodology: "JSOL total supply as it's equal to the SOL staked",
+ solana: {
+ tvl
+ }
}
\ No newline at end of file
diff --git a/projects/juice-finance/index.js b/projects/juice-finance/index.js
index ea92ee9dbc..de38553ff9 100644
--- a/projects/juice-finance/index.js
+++ b/projects/juice-finance/index.js
@@ -4,6 +4,17 @@ const { sumTokens2 } = require("../helper/unwrapLPs");
// Tokens
const EZETH = ADDRESSES.blast.ezETH;
+const PRO = {
+ lendingPool: {
+ usdb: "0x788654040D7E9a8Bb583D7d8CCEA1Ebf1AE4aC06",
+ weth: "0x60ED5493B35f833189406dFec0b631A6B5B57f66",
+ },
+ collateralManager: {
+ usdb: "0xaCe661Bf726Bd8aFE6F6594C559A5136489E64f9",
+ weth: "0x4dEE8034019f03F1a025dbFB4bBC159D7BaA7a0A",
+ },
+}
+
// Lending pools
const LENDING_POOL_USDB = "0x4A1d9220e11a47d8Ab22Ccd82DA616740CF0920a";
const LENDING_POOL_WETH = "0x44f33bC796f7d3df55040cd3C631628B560715C2";
@@ -25,8 +36,14 @@ const wethCollateralManagers = [
COLLATERAL_MANAGER_V2,
WETH_COLLATERAL_MANAGER,
MUNCHABLE_WETH_COLLATERAL_MANAGER,
+ PRO.collateralManager.weth,
].map((a) => [ADDRESSES.blast.WETH, a]);
+const usdbCollateralManagers = [
+ USDB_COLLATERAL_MANAGER,
+ PRO.collateralManager.usdb,
+].map((a) => [ADDRESSES.blast.USDB, a]);
+
async function tvl(api) {
const thrusterV2LPs = [['0x4E4B4A3111d128628c427E78a2abAd1635fE6542', '0x4Ca392f74A4C86F5E521f1d8E915b36ed425B331']];
@@ -49,11 +66,13 @@ async function tvl(api) {
stateMutability: "view",
type: "function",
},
- calls: [LENDING_POOL_USDB, LENDING_POOL_WETH],
+ calls: [LENDING_POOL_USDB, PRO.lendingPool.usdb, LENDING_POOL_WETH, PRO.lendingPool.weth],
});
api.add(ADDRESSES.blast.USDB, tokens[0]);
- api.add(ADDRESSES.blast.WETH, tokens[1]);
+ api.add(ADDRESSES.blast.USDB, tokens[1]);
+ api.add(ADDRESSES.blast.WETH, tokens[2]);
+ api.add(ADDRESSES.blast.WETH, tokens[3]);
await sumTokens2({
api,
@@ -61,7 +80,7 @@ async function tvl(api) {
tokensAndOwners: [
[EZETH, EZETH_COLLATERAL_MANAGER],
[ADDRESSES.blast.weETH, WEETH_COLLATERAL_MANAGER],
- [ADDRESSES.blast.USDB, USDB_COLLATERAL_MANAGER],
+ ...usdbCollateralManagers,
...wethCollateralManagers,
],
});
diff --git a/projects/jupiter-perpetual.js b/projects/jupiter-perpetual.js
index 04278ef2bf..c71cc67a06 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/kalax/index.js b/projects/kalax/index.js
new file mode 100644
index 0000000000..ed945f180c
--- /dev/null
+++ b/projects/kalax/index.js
@@ -0,0 +1,30 @@
+const { sumTokens2 } = require("../helper/unwrapLPs")
+
+const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D"
+const farms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5',"0x1CB8f6cecf7c8FBB9863417f8371Cb2A076C9115"]
+
+async function tvl(api) {
+ let pools = (await api.multiCall({ abi: abiInfo.poolInfos, calls: farms })).flat()
+ pools
+ .filter((i) => i.assets !== KALAX)
+ .forEach((i) => api.add(i.assets, i.tvl))
+
+ return sumTokens2({ api, resolveLP: true })
+}
+
+async function staking(api) {
+ let pools = (await api.multiCall({ abi: abiInfo.poolInfos, calls: farms })).flat()
+ pools.filter((i) => i.assets === KALAX).forEach((i) => api.add(i.assets, i.tvl))
+}
+
+module.exports = {
+ blast: {
+ tvl,
+ staking,
+ },
+}
+
+const abiInfo = {
+ poolInfos:
+ "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])",
+}
diff --git a/projects/kamino-lending/index.js b/projects/kamino-lending/index.js
index d753a48fd7..2f1883a8b1 100644
--- a/projects/kamino-lending/index.js
+++ b/projects/kamino-lending/index.js
@@ -1,5 +1,5 @@
const { PublicKey } = require('@solana/web3.js');
-const { getConnection, sumTokens } = require('../helper/solana');
+const { getConnection, sumTokens2 } = require('../helper/solana');
const { Program } = require('@project-serum/anchor');
const kaminoIdl = require('./kamino-lending-idl.json');
const { MintLayout } = require("../helper/utils/solana/layouts/mixed-layout");
@@ -37,7 +37,7 @@ async function tvl() {
}
}
}
- return sumTokens(tokensAndOwners)
+ return sumTokens2({ tokensAndOwners })
}
async function isKToken(mint, connection) {
diff --git a/projects/karak/index.js b/projects/karak/index.js
index 5a163ec01a..4596dcbd6e 100644
--- a/projects/karak/index.js
+++ b/projects/karak/index.js
@@ -4,6 +4,9 @@ const config = {
ethereum: { factory: '0x54e44dbb92dba848ace27f44c0cb4268981ef1cc', },
arbitrum: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad', },
karak: { factory: '0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C', },
+ mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', },
+ bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', },
+ blast: { factory: '0x58b5dc145ca2BE84fe087614CFe36055be609BB3', },
}
Object.keys(config).forEach(chain => {
diff --git a/projects/kawa/index.js b/projects/kawa/index.js
new file mode 100644
index 0000000000..37def13d6d
--- /dev/null
+++ b/projects/kawa/index.js
@@ -0,0 +1,5 @@
+const { compoundExports2 } = require('../helper/compound');
+
+module.exports = {
+ sei: compoundExports2({ comptroller: '0xD527237E176647cbF8A7c7bCeFEfBf9130Bec948', cether: '0x20E56093357d91Ce85B0E3c2f0E4bdc676E94eDB', })
+}
\ No newline at end of file
diff --git a/projects/kayak/index.js b/projects/kayak/index.js
new file mode 100644
index 0000000000..9227635cfa
--- /dev/null
+++ b/projects/kayak/index.js
@@ -0,0 +1,23 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+const config = {
+ avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, }
+}
+
+Object.keys(config).forEach(chain => {
+ const { factory, fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs2({
+ api,
+ factory,
+ eventAbi: 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)',
+ fromBlock,
+ })
+
+ const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB], i.swapContract])
+ return sumTokens2({ api, ownerTokens })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/kayen/index.js b/projects/kayen/index.js
new file mode 100644
index 0000000000..94b62888fc
--- /dev/null
+++ b/projects/kayen/index.js
@@ -0,0 +1,12 @@
+const { getUniTVL } = require("../helper/unknownTokens");
+module.exports = {
+ misrepresentedTokens: true,
+ methodology:
+ "We count liquidity of all paris through Factory Contract and Pools (single tokens) seccions through Factory Contract.",
+ chz: {
+ tvl: getUniTVL({
+ factory: "0xE2918AA38088878546c1A18F2F9b1BC83297fdD3",
+ useDefaultCoreAssets: true,
+ }),
+ },
+};
\ No newline at end of file
diff --git a/projects/keep.js b/projects/keep.js
index 83c6c879fe..90c4457adf 100644
--- a/projects/keep.js
+++ b/projects/keep.js
@@ -1,6 +1,6 @@
+const sdk = require("@defillama/sdk");
const { GraphQLClient, } = require('graphql-request')
const utils = require('./helper/utils');
-const sdk = require('@defillama/sdk')
async function tvl() {
var q2 = `{
@@ -13,7 +13,7 @@ async function tvl() {
}
}
`;
- var endpoint = 'https://api.thegraph.com/subgraphs/name/suntzu93/tbtc';
+ var endpoint = sdk.graph.modifyEndpoint('8vQM7kTwPoW37U5FWgZLRpcoMyYKExMcHr5JGgnvzxk5');
var graphQLClient = new GraphQLClient(endpoint)
const results2 = await graphQLClient.request(q2)
var ethStaked = parseFloat(results2.totalBondedECDSAKeeps[0].totalBonded) + parseFloat(results2.totalBondedECDSAKeeps[0].totalAvailable);
@@ -39,7 +39,7 @@ async function staking() {
}
`;
- var endpoint = 'https://api.thegraph.com/subgraphs/name/suntzu93/keepnetwork';
+ var endpoint = sdk.graph.modifyEndpoint('Pg2cbxfPGJtqRBwMutR69oapbodKmcXuQRsxPRaK57S');
var graphQLClient = new GraphQLClient(endpoint)
const results = await graphQLClient.request(q1)
const keepPoolStaked = await utils.returnBalance('0x85Eee30c52B0b379b046Fb0F85F4f3Dc3009aFEC', '0xCf916681a6F08fa22e9EF3e665F2966Bf3089Ff1')
diff --git a/projects/kernel/abi.js b/projects/kernel/abi.js
new file mode 100644
index 0000000000..d70d466c83
--- /dev/null
+++ b/projects/kernel/abi.js
@@ -0,0 +1,5 @@
+exports.abi = {
+ numApprovedTokens: "function numApprovedTokens() view returns (uint256)",
+ approvedTokens: "function approvedTokens(uint256) view returns (address)",
+ tokens: "function tokens(address) view returns (address vaultToken, address rateProvider, uint256 cap, uint256 deposited, bool paused)"
+};
\ No newline at end of file
diff --git a/projects/kernel/index.js b/projects/kernel/index.js
new file mode 100644
index 0000000000..fce117aa7b
--- /dev/null
+++ b/projects/kernel/index.js
@@ -0,0 +1,30 @@
+const abi = {
+ tokens: "function tokens(address) view returns (address vaultToken, address rateProvider, uint256 cap, uint256 deposited, bool paused)"
+}
+
+const ASSETS = [
+ "0xf02C96DbbB92DC0325AD52B3f9F2b951f972bf00", // krETH
+ "0x513D27c94C0D81eeD9DC2a88b4531a69993187cF", // ksETH
+ "0x0bB9aB78aAF7179b7515e6753d89822b91e670C4", // kUSD
+]
+
+const tvl = async (api) => {
+ const tokens = await api.fetchList({ lengthAbi: 'numApprovedTokens', itemAbi: 'approvedTokens', calls: ASSETS, groupedByInput: true, });
+ const assets = []
+ const balanceCalls = []
+ tokens.forEach((tokens, i) => {
+ assets.push(...tokens)
+ balanceCalls.push(...tokens.map(token => ({ target: ASSETS[i], params: token })))
+ })
+ const balances = (await api.multiCall({ calls: balanceCalls, abi: abi.tokens })).map(i => i.deposited)
+ api.add(assets, balances)
+};
+
+module.exports = {
+ doublecounted: true,
+ methodology: 'The TVL represents the sum of each LST deposited in the protocol',
+ ethereum: {
+ tvl,
+ },
+};
+
diff --git a/projects/kicks/index.js b/projects/kicks/index.js
new file mode 100644
index 0000000000..b3ab5e8180
--- /dev/null
+++ b/projects/kicks/index.js
@@ -0,0 +1,14 @@
+
+const STAKING = "0x7f435dC15CD9d686C48B6beD2cB8d32D895cfb93"
+const TOKEN = "0xfEB4e9B932eF708c498Cc997ABe51D0EE39300cf"
+
+module.exports = {
+ methodology: "TVL counted from the KICKS contracts",
+ bsc: {
+ tvl: () => ({}),
+ staking: async (api) => {
+ const bal = await api.call({ abi: 'uint256:totalSupply', target: STAKING })
+ api.add(TOKEN, bal)
+ },
+ },
+}
\ No newline at end of file
diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js
index 0ffd836d48..20e21e32fe 100644
--- a/projects/kiloex/index.js
+++ b/projects/kiloex/index.js
@@ -3,8 +3,10 @@ const { sumTokensExport } = require("../helper/unwrapLPs");
const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"];
const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"];
-const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99"];
+const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99","0xa10f74374b8bE9E9C8Fb62c1Dc17B8D4247E332A"];
const manta_stone_token = "0xEc901DA9c68E90798BbBb74c11406A32A70652C3";
+const manat_manta_token = "0x95CeF13441Be50d20cA4558CC0a27B601aC544E5";
+const taiko_owners = ["0x735D00A9368164B9dcB2e008d5Cd15b367649aD5", "0x235C5C450952C12C8b815086943A7bBCF96bc619"];
module.exports = {
start: 1690971144,
@@ -13,6 +15,9 @@ module.exports = {
tvl: sumTokensExport({ owners: opbnb_owners, tokens: [ADDRESSES.op_bnb.USDT] })
},
manta: {
- tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token] })
+ tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token, manat_manta_token] })
+ },
+ taiko: {
+ tvl: sumTokensExport({ owners: taiko_owners, tokens: [ADDRESSES.taiko.USDC] })
},
};
diff --git a/projects/kim-v2/index.js b/projects/kim-v2/index.js
index d4c8f3d0e7..bb5564ecfa 100644
--- a/projects/kim-v2/index.js
+++ b/projects/kim-v2/index.js
@@ -4,4 +4,7 @@ module.exports = {
mode: {
tvl: getUniTVL({ factory: "0xc02155946dd8C89D3D3238A6c8A64D04E2CD4500", useDefaultCoreAssets: true, }),
},
+ base: {
+ tvl: getUniTVL({ factory: "0x14658340D7D1c112b62509bbF449be1897e8dE01", useDefaultCoreAssets: true, }),
+ },
};
\ No newline at end of file
diff --git a/projects/kim-v4/index.js b/projects/kim-v4/index.js
index 22ad879495..775c89aeba 100644
--- a/projects/kim-v4/index.js
+++ b/projects/kim-v4/index.js
@@ -6,4 +6,9 @@ module.exports = uniV3Export({
fromBlock: 4823915,
isAlgebra: true,
},
+ base: {
+ factory: '0x2F0d41f94d5D1550b79A83D2fe85C82d68c5a3ca',
+ fromBlock: 15395969,
+ isAlgebra: true,
+ },
})
diff --git a/projects/kim-vaults/index.js b/projects/kim-vaults/index.js
new file mode 100644
index 0000000000..a81af95c9d
--- /dev/null
+++ b/projects/kim-vaults/index.js
@@ -0,0 +1,36 @@
+const STEER_VAULTS = [
+ "0x23c17a512d486d6f46db63a8dd5144b352497762",
+ "0x4236fc0a5c47857777dd1578b7e825c8ccadca88",
+ "0x4c8d1a52ee90b04ff8ee1257ad12290d89d13e6f",
+ "0x554310f5d636dfc1122308a10f2b9936681f76de",
+ "0x5aa27d5d8aff8cd5e683e23812124ace4aa5af7d",
+ "0x83556d8bba69bdd159f50b2127ccc88bebf73e39",
+ "0x879f9998c68cdaf28e4808fcc2b4f174c3cc5d97",
+ "0x8bc0cd048cea0ebff9e81eeb79842c86c501ea3b",
+ "0x908731366f82668ddd3ae3b2498adf52604e892d",
+ "0xa212659dd4b71947268ff2037a654ce03730d857",
+ "0xac8c89516bc4b60621c5326446e33680357bb3d2",
+ "0xacb9a8676fc6ada472611a62354bf47502969287",
+ "0xc07df1d13188c081f770944ece48e469b326b2a5",
+ "0xc40d4d88afc7b03c65391cbfb6f399f464f6ab03",
+ "0xcf4664fd4d0cabfcbbcbd4b6c2ecb71ac120d0c3"
+];
+
+async function tvl(api) {
+ const token0s = await api.multiCall({ abi: 'address:token0', calls: STEER_VAULTS })
+ const token1s = await api.multiCall({ abi: 'address:token1', calls: STEER_VAULTS })
+ const bals = await api.multiCall({
+ abi: 'function getTotalAmounts() view returns (uint256 bal0, uint256 bal1)',
+ calls: STEER_VAULTS
+ })
+ bals.forEach(({ bal0, bal1 }, i) => {
+ api.add(token0s[i], bal0)
+ api.add(token1s[i], bal1)
+ })
+}
+
+module.exports = {
+ mode: {
+ tvl,
+ },
+};
diff --git a/projects/kinetic/index.js b/projects/kinetic/index.js
new file mode 100644
index 0000000000..ea78e37d2f
--- /dev/null
+++ b/projects/kinetic/index.js
@@ -0,0 +1,5 @@
+const { compoundExports2 } = require('../helper/compound')
+
+module.exports = {
+ flare: compoundExports2({ comptroller: '0x8041680Fb73E1Fe5F851e76233DCDfA0f2D2D7c8' }),
+}
diff --git a/projects/kinetix-v2/index.js b/projects/kinetix-v2/index.js
index db85f569e4..b8c1fa524f 100644
--- a/projects/kinetix-v2/index.js
+++ b/projects/kinetix-v2/index.js
@@ -9,4 +9,11 @@ module.exports = {
fetchBalances: true,
}),
},
+ base: {
+ tvl: getUniTVL({
+ factory: "0x8aD3d3e6B1b7B65138bD508E48330B544539b2C3",
+ useDefaultCoreAssets: true,
+ fetchBalances: true,
+ }),
+ },
};
diff --git a/projects/kinetix-v3/index.js b/projects/kinetix-v3/index.js
index 48e18f9b3d..4f26b6b52c 100644
--- a/projects/kinetix-v3/index.js
+++ b/projects/kinetix-v3/index.js
@@ -1,12 +1,12 @@
-const { uniV3GraphExport } = require('../helper/uniswapV3')
+const { uniV3Export } = require("../helper/uniswapV3");
-module.exports = {
+module.exports = uniV3Export({
kava: {
- tvl: uniV3GraphExport({
- // // factory: '0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2',
- // // fromBlock: 6069472
- graphURL: 'https://kava-graph-node.metavault.trade/subgraphs/name/kinetixfi/v3-subgraph',
- name: 'kinetixfi/kava-v3',
- })
- }
-}
+ factory: "0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2",
+ fromBlock: 6069472,
+ },
+ base: {
+ factory: "0xdDF5a3259a88Ab79D5530eB3eB14c1C92CD97FCf",
+ fromBlock: 14195510,
+ },
+});
diff --git a/projects/kkex/index.js b/projects/kkex/index.js
new file mode 100644
index 0000000000..1944a944b1
--- /dev/null
+++ b/projects/kkex/index.js
@@ -0,0 +1,9 @@
+const { gmxExports } = require("../helper/gmx");
+
+module.exports = {
+ zklink: {
+ tvl: gmxExports({
+ vault: "0xC8F6494bD11A12Dd6B676EC87C8b878a1D90e641",
+ }),
+ },
+};
diff --git a/projects/kleros/index.js b/projects/kleros/index.js
index 91d11f5935..85cf7f353e 100644
--- a/projects/kleros/index.js
+++ b/projects/kleros/index.js
@@ -1,12 +1,12 @@
-const { request, gql } = require("graphql-request");
const { getBlock } = require('../helper/http')
+const sdk = require('@defillama/sdk')
const graphUrls = {
- ethereum: 'https://api.thegraph.com/subgraphs/name/salgozino/klerosboard',
- xdai: 'https://api.thegraph.com/subgraphs/name/salgozino/klerosboard-xdai',
+ ethereum: 'ECENsJRfqi6Mwj6kF9diShPzFKkgyyo79aSCkSwAShHL',
+ xdai: 'Ck26N16xgimEuuuNSJqYVWBKcWSwPmkk36BWZGtfx1ox',
}
-const totalStakedQuery = gql`
+const totalStakedQuery = `
query($block: Int) {
klerosCounters(block: { number: $block }) {
tokenStaked
@@ -21,10 +21,10 @@ function getStakedTvl(chain) {
const graphUrl = graphUrls[chain]
const block = await getBlock(timestamp, chain, chainBlocks)
- const { klerosCounters } = await request(
+ const { klerosCounters } = await sdk.graph.request(
graphUrl,
totalStakedQuery,
- { block: block - 500 }
+ { variables: { block: block - 500 }}
)
balances.kleros = klerosCounters[0].tokenStaked / (10 ** 18);
diff --git a/projects/kodo-exchange/index.js b/projects/kodo-exchange/index.js
new file mode 100644
index 0000000000..59e0d67d2f
--- /dev/null
+++ b/projects/kodo-exchange/index.js
@@ -0,0 +1,3 @@
+const {uniTvlExport} = require('../helper/unknownTokens.js')
+
+module.exports = uniTvlExport('taiko', '0x535E02960574d8155596a73c7Ad66e87e37Eb6Bc', { hasStablePools: true})
diff --git a/projects/kosmos/index.js b/projects/kosmos/index.js
new file mode 100644
index 0000000000..d4510b19f8
--- /dev/null
+++ b/projects/kosmos/index.js
@@ -0,0 +1,11 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const bondTellers = ["0x04B07dFBB78d32FF500466c35B4Fe5D615cbe911", "0x8d4439F8AC1e5CCF37F9ACb527E59720E0ccA3E3"];
+
+module.exports = {
+ airdao: { tvl: sumTokensExport({ owners: bondTellers,
+ tokens: [ADDRESSES.null, ADDRESSES.airdao.USDC, '0x096B5914C95C34Df19500DAff77470C845EC749D']
+ }) },
+ methodology: `The TVL of Kosmos is equal to the total value of underlying assets locked in the BondTellers contracts.`,
+};
diff --git a/projects/kriya-clmm/index.js b/projects/kriya-clmm/index.js
new file mode 100644
index 0000000000..089aa59221
--- /dev/null
+++ b/projects/kriya-clmm/index.js
@@ -0,0 +1,25 @@
+const sui = require("../helper/chain/sui");
+
+const EVENT_FILTER =
+ "0xf6c05e2d9301e6e91dc6ab6c3ca918f7d55896e1f1edd64adc0e615cde27ebf1::create_pool::PoolCreatedEvent";
+
+async function kriyaTVL(api) {
+ const poolIds = await sui.queryEvents({
+ eventType: EVENT_FILTER,
+ transform: (i) => i.pool_id,
+ });
+ const pools = await sui.getObjects(poolIds);
+ pools.forEach((i) => {
+ const [token0, token1] = i.type.split("<")[1].replace(">", "").split(", ");
+ api.add(token0, i.fields.reserve_x);
+ api.add(token1, i.fields.reserve_y);
+ });
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: "Collects TVL for all CLMM pools created on Kriya",
+ sui: {
+ tvl: kriyaTVL,
+ },
+};
diff --git a/projects/kryptonite/index.js b/projects/kryptonite/index.js
index 2ebb4b8903..d2584d3830 100644
--- a/projects/kryptonite/index.js
+++ b/projects/kryptonite/index.js
@@ -58,8 +58,8 @@ Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
// Logic for calculating TVL excluding staked LP tokens
- const { total_bond_stsei_amount } = await queryContractWithRetries({ contract: hub, chain, data: { state: {} } });
- api.add(coinGeckoId, total_bond_stsei_amount / 10 ** 6, { skipChain: true });
+ const { total_bond_stsei_amount, total_bond_st_amount } = await queryContractWithRetries({ contract: hub, chain, data: { state: {} } });
+ api.add(coinGeckoId, (total_bond_stsei_amount ?? total_bond_st_amount) / 10 ** 6, { skipChain: true });
return api.getBalances();
},
pool2: async (api) => {
diff --git a/projects/kuma/index.js b/projects/kuma/index.js
index d29162875c..8b5c2a80fc 100644
--- a/projects/kuma/index.js
+++ b/projects/kuma/index.js
@@ -13,6 +13,9 @@ const allAddresses = {
},
linea: {
USK: "0x7a6AA80B49017f3E091574ab5C6977d863ff3865",
+ },
+ telos: {
+ USK: "0x09B88f74Fb9E243c4A3F4D2FfE3d1BA4287a476c",
}
}
diff --git a/projects/kyber/index.js b/projects/kyber/index.js
index 9374d46c2e..069bb63b20 100644
--- a/projects/kyber/index.js
+++ b/projects/kyber/index.js
@@ -1,4 +1,5 @@
-const { graphQuery } = require("../helper/http");
+const sdk = require("@defillama/sdk")
+const { cachedGraphQuery } = require("../helper/cache");
const { sumTokens2 } = require('../helper/unwrapLPs')
const chains = {
@@ -45,10 +46,14 @@ async function fetchPools(chain) {
case "cronos": url = 'https://cronos-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-cronos'; break;
case "base": url = 'https://base-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-base'; break;
case "scroll": url = 'https://scroll-graph.kyberengineering.io/subgraphs/name/kybernetwork/kyberswap-elastic-scroll'; break;
+ case "mainnet": url = sdk.graph.modifyEndpoint('4U9PxDR4asVvfXyoVy18fhuj6NHnQhLzZkjZ5Bmuc5xk'); break;
+ case "arbitrum-one" : url = sdk.graph.modifyEndpoint('C36tj8jSpEHxcNbjM3z7ayUZHVjrk4HRqnpGMFuRgXs6'); break;
+ case "avalanche": url = sdk.graph.modifyEndpoint('9oMJfc7CL8uDqqQ3T3NFBnFCz9JMwq2YhH9AqojECFWp'); break;
+ case "bsc": url = sdk.graph.modifyEndpoint('FDEDgycFnTbPZ7PfrnWEZ4iR7T5De6BR69zx1i8gKQRa'); break;
+ case "fantom": url = sdk.graph.modifyEndpoint('9aj6YZFVL647wFBQXnNKM72eiowP4fyzynQKwLrn5axL'); break;
+ case "optimism": url = sdk.graph.modifyEndpoint('3Kpd8i7U94pTz3Mgdb8hyvT5o26fpwT7SUHAbTa6JzfZ'); break;
default: url = `https://api.thegraph.com/subgraphs/name/kybernetwork/kyberswap-elastic-${chain}`;
}
- let length
- let lastId = ''
let toa = [];
const poolQuery = `
query pools($lastId: String) {
@@ -62,25 +67,21 @@ async function fetchPools(chain) {
}
}
}`;
- do {
- const {pools} = await graphQuery(url, poolQuery, { lastId })
+ const pools = await cachedGraphQuery('kyber/'+chain, url, poolQuery, { fetchById: true, })
pools.forEach(({ id, token0, token1}) => {
toa.push([token0.id, id])
toa.push([token1.id, id])
})
- lastId = pools[pools.length - 1].id
- } while (length === 1000)
return toa;
}
function elastic(chain) {
- return async (_, block, chainBlocks) => {
+ return async (api) => {
if (!("graphId" in chains[chain])) return {};
- block = chainBlocks[chain];
const pools = await fetchPools(chains[chain].graphId);
- return sumTokens2({ chain, block, tokensAndOwners: pools })
+ return sumTokens2({ api, tokensAndOwners: pools })
}
}
@@ -96,3 +97,5 @@ Object.keys(chains).forEach(chain => {
tvl: elastic(chain)
};
});
+
+module.exports.base.tvl = () => ({}) // setting base to 0 for now as I could not find the graph endpoint
\ No newline at end of file
diff --git a/projects/landshare/index.js b/projects/landshare/index.js
index a4a86020c3..9a34857342 100644
--- a/projects/landshare/index.js
+++ b/projects/landshare/index.js
@@ -1,34 +1,13 @@
-
-const { toUSDTBalances } = require('../helper/balances');
-const { get } = require('../helper/http');
-
-const LandshareApi = "https://api.landshare.io/api/properties";
-
-async function landshareTVL() {
- const rentals = await get(LandshareApi + "/rentals");
- const flips = await get(LandshareApi + "/flips");
-
- const totalRentals = rentals.reduce((acc, item) => {
- acc = acc + item.value
- return acc;
- }, 0);
-
- const totalFlips = flips.reduce((acc, item) => {
- acc = acc + item;
- return acc;
- }, 0);
-
- const total = totalRentals + totalFlips;
-
- return toUSDTBalances(total);
-}
+const { pool2 } = require('../helper/pool2')
+const { staking } = require('../helper/staking')
+const LANDSHARE_TOKEN_CONTRACT = '0xA73164DB271931CF952cBaEfF9E8F5817b42fA5C'
+const LANDSHARE_STAKING_CONTRACT = '0x3f9458892fB114328Bc675E11e71ff10C847F93b'
+const LANDSHARE_LP_TOKEN_CONTRACT = '0x13f80c53b837622e899e1ac0021ed3d1775caefa'
module.exports = {
- timetravel: false,
- misrepresentedTokens: true,
bsc: {
- tvl: landshareTVL,
- }
-};
-
-// node test.js projects/landshare/index.js
+ tvl: () => ({}),
+ staking: staking(LANDSHARE_STAKING_CONTRACT, LANDSHARE_TOKEN_CONTRACT),
+ pool2: pool2(LANDSHARE_STAKING_CONTRACT, LANDSHARE_LP_TOKEN_CONTRACT),
+ },
+}
\ No newline at end of file
diff --git a/projects/larix.js b/projects/larix.js
index 20f5e80b60..631afc5ea5 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/lendOS/index.js b/projects/lendOS/index.js
new file mode 100644
index 0000000000..92b4491083
--- /dev/null
+++ b/projects/lendOS/index.js
@@ -0,0 +1,7 @@
+const { aaveExports } = require('../helper/aave');
+const methodologies = require('../helper/methodologies');
+
+module.exports = {
+ methodology: methodologies.lendingMarket,
+ neon_evm: aaveExports('', undefined, undefined, ['0x3A1ca459F21D8FAcF9A30bC4773f5dBf07C1191d'], { v3: true, }),
+}
\ No newline at end of file
diff --git a/projects/limitless/index.js b/projects/limitless/index.js
index ac9ad3ebbb..a0edc079ac 100644
--- a/projects/limitless/index.js
+++ b/projects/limitless/index.js
@@ -1,51 +1,153 @@
const { nullAddress, addUniV3LikePosition } = require("../helper/unwrapLPs")
+const { graphFetchById } = require('../helper/cache')
+const { getUniqueAddresses } = require("../helper/utils")
+const sdk = require('@defillama/sdk')
const config = {
- base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', },
+ base: { postionManager: '0x3eF54A2Cf152f6E06C0928722412883D448F92eC', factory: '0x33128a8fC17869897dcE68Ed026d694621f6FDfD', limWETH: '0x845d629D2485555514B93F05Bdbe344cC2e4b0ce', marginContract: '0x536801AaE40cb214c08f178c6727d7594a7c655b', graphEndpoint: 'https://api.studio.thegraph.com/query/71042/limitless-subgraph-base/version/latest', dataProvider: '0x87E697c3EBe41eD707E4AD52541f19292Be81177', lmQuoter: '0xED14586763578147136e55D20a0Ee884Cd8fBC6d', },
arbitrum: { postionManager: '0x6D73fc6F4C299E369377C0e60CebFef2409f86A0', factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984', limWETH: '0xdEe4326E0a8B5eF94E50a457F7c70d4821be9f4C', },
linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', },
}
+const liquidityProvidedQuery = `
+query($lastId: String, $block: Int) {
+ liquidityProvideds(
+ first:1000
+ block: { number: $block }
+ where: { id_gt: $lastId }
+ ) {
+ id
+ pool
+ recipient
+ liquidity
+ tickLower
+ tickUpper
+ blockTimestamp
+ }
+}
+`
+
+const liquidityWithdrawnQuery = `
+query($lastId: String, $block: Int) {
+ liquidityWithdrawns(
+ first:1000
+ block: { number: $block }
+ where: { id_gt: $lastId }
+ ) {
+ id
+ pool
+ recipient
+ liquidity
+ tickLower
+ tickUpper
+ blockTimestamp
+ }
+}
+`
Object.keys(config).forEach(chain => {
- const { postionManager, factory, limWETH } = config[chain]
+ const { postionManager, factory, limWETH, marginContract, graphEndpoint, } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
if (limWETH) {
- const token = await api.call({ abi: 'address:asset', target: limWETH })
- await api.sumTokens({ owner: limWETH, tokens: [token]})
+ const token = await api.call({ abi: 'address:asset', target: limWETH })
+ await api.sumTokens({ owner: limWETH, tokens: [token] })
}
+ const allTokens = []
const getKey = (token0, token1, fee) => `${token0}-${token1}-${fee}`
+ if (!graphEndpoint) {
+ const tokenIds = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.tokenByIndex, target: postionManager })
+ const positionData = await api.multiCall({ calls: tokenIds, abi: abi.positions, target: postionManager })
+ const poolData = {}
+ positionData.forEach(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => {
+ if (liquidity === 0) return;
+ if (token0 === nullAddress && token1 === nullAddress) return;
+ poolData[getKey(token0, token1, fee)] = { call: { params: [token0, token1, fee] } }
+ if (marginContract) {
+ allTokens.push(token0)
+ allTokens.push(token1)
+ }
+ api.add(token0, tokensOwed0)
+ api.add(token1, tokensOwed1)
+ })
+
+ // fetch tick info from uni v3 pools
+ const calls = Object.values(poolData).map(i => i.call)
+ const pools = await api.multiCall({ abi: abi.getPool, calls, target: factory })
+ const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true })
+ Object.values(poolData).forEach((data, i) => data.tick = ticks[i]?.tick)
+
+ positionData.forEach(({ token0, token1, tickUpper, tickLower, fee, liquidity }) => {
+ if (+liquidity === 0) return;
+ const tick = poolData[getKey(token0, token1, fee)]?.tick
+ if (!tick) console.log({ token0, token1, fee, tickUpper, tickLower, liquidity })
+ if (!tick) return; // pool not found
+ addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, })
+ })
+
+ } else {
- const positionData = await api.fetchList({ lengthAbi: 'totalSupply', itemAbi: abi.positions, target: postionManager })
- const poolData = {}
- // console.table(positionData.map(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => ({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity })))
- positionData.forEach(({ token0, token1, tokensOwed0, tokensOwed1, fee, liquidity }) => {
- if (liquidity === 0) return;
- if (token0 === nullAddress && token1 === nullAddress) return;
- poolData[getKey(token0, token1, fee)] = { call: { params: [token0, token1, fee] } }
- api.add(token0, tokensOwed0)
- api.add(token1, tokensOwed1)
- })
-
- // fetch tick info from uni v3 pools
- const calls = Object.values(poolData).map(i => i.call)
- const pools = await api.multiCall({ abi: abi.getPool, calls, target: factory })
- const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true })
- Object.values(poolData).forEach((data, i) => data.tick = ticks[i]?.tick)
-
- positionData.forEach(({ token0, token1, tickUpper, tickLower, fee, liquidity }) => {
- if (liquidity === 0) return;
- const tick = poolData[getKey(token0, token1, fee)]?.tick
- if (!tick) return; // pool not found
- addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, })
- })
+ const provided = await graphFetchById({
+ endpoint: graphEndpoint,
+ query: liquidityProvidedQuery,
+ api,
+ options: {
+ useBlock: true,
+ safeBlockLimit: 500,
+ }
+ })
+ const withdrawn = await graphFetchById({
+ endpoint: graphEndpoint,
+ query: liquidityWithdrawnQuery,
+ api,
+ options: {
+ useBlock: true,
+ safeBlockLimit: 500,
+ }
+ })
+
+ console.log(provided.length, withdrawn.length)
+ const pools = getUniqueAddresses(provided.map(entry => entry.pool).concat(withdrawn.map(entry => entry.pool)))
+ const token0s = await api.multiCall({ abi: 'address:token0', calls: pools})
+ const token1s = await api.multiCall({ abi: 'address:token1', calls: pools})
+
+ const ticks = await api.multiCall({ abi: abi.slot0, calls: pools, permitFailure: true })
+
+ const poolMap = {}
+ pools.forEach((pool, index) => {
+ allTokens.push(token0s[index])
+ allTokens.push(token1s[index])
+ poolMap[pool] = {
+ token0: token0s[index],
+ token1: token1s[index],
+ tick: ticks[index].tick
+ }
+ })
+
+ const withdrawnBalancesApi = new sdk.ChainApi({ chain: api.chain})
+
+ provided.forEach(({ pool, tickLower, tickUpper, liquidity }) => {
+ const { token0, token1, tick } = poolMap[pool.toLowerCase()]
+ addUniV3LikePosition({ api, token0, token1, tick, liquidity, tickUpper, tickLower, })
+ })
+ withdrawn.forEach(({ pool, tickLower, tickUpper, liquidity }) => {
+ const { token0, token1, tick } = poolMap[pool.toLowerCase()]
+ addUniV3LikePosition({ api: withdrawnBalancesApi, token0, token1, tick, liquidity, tickUpper, tickLower, })
+ })
+
+ const balances = api.getBalancesV2()
+ const withdrawnBalances = withdrawnBalancesApi.getBalancesV2()
+ balances.subtract(withdrawnBalances)
+ }
+ if (marginContract) return api.sumTokens({ tokens: allTokens, owner: marginContract })
}
}
})
+
const abi = {
+ "tokenByIndex": "function tokenByIndex(uint256 index) view returns (uint256)",
"positions": "function positions(uint256 tokenId) view returns (address owner, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)",
"totalSupply": "uint256:totalSupply",
"getPool": "function getPool(address, address, uint24) view returns (address)",
diff --git a/projects/linehub-perps/index.js b/projects/linehub-perps/index.js
new file mode 100644
index 0000000000..cf4d3d161f
--- /dev/null
+++ b/projects/linehub-perps/index.js
@@ -0,0 +1,15 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+
+const { nullAddress } = require("../helper/unwrapLPs");
+
+async function LineaTvl(api) {
+ const tokens = [nullAddress, ADDRESSES.linea.USDC];
+ const owners = ["0xC94cFd8F4fB8Ef3EB360Ec92e2A9Ca969Cadf095", "0x00744A65cFC59ACBa312Ade7ABf77379A041Ae26"];
+ return api.sumTokens({ owners, tokens });
+}
+
+module.exports = {
+ linea: {
+ tvl: LineaTvl,
+ },
+};
diff --git a/projects/linehub-v2/index.js b/projects/linehub-v2/index.js
new file mode 100644
index 0000000000..28159d8de6
--- /dev/null
+++ b/projects/linehub-v2/index.js
@@ -0,0 +1,12 @@
+const { getUniTVL } = require("../helper/unknownTokens");
+
+module.exports = {
+ misrepresentedTokens: true,
+ linea: {
+ tvl: getUniTVL({
+ factory: "0x7811DeF28977060784cC509641f2DD23584b7671",
+ useDefaultCoreAssets: true,
+ fetchBalances: true,
+ }),
+ },
+};
diff --git a/projects/linehub-v3/index.js b/projects/linehub-v3/index.js
new file mode 100644
index 0000000000..6a555fdd5e
--- /dev/null
+++ b/projects/linehub-v3/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ linea: { factory: '0x6c379d538f2f7cb642851e154a8e572d63238df4', fromBlock: 407280, },
+})
diff --git a/projects/linkswap/index.js b/projects/linkswap/index.js
new file mode 100644
index 0000000000..4f8dd3961e
--- /dev/null
+++ b/projects/linkswap/index.js
@@ -0,0 +1,10 @@
+const { getUniTVL } = require("../helper/unknownTokens");
+
+module.exports = {
+ zklink: {
+ tvl: getUniTVL({
+ factory: "0x87929083ac2215cF3CE4936857D314aF6687C978",
+ useDefaultCoreAssets: true,
+ }),
+ },
+};
diff --git a/projects/liquix/index.js b/projects/liquix/index.js
index 63eb576fa9..9df6fa82d2 100644
--- a/projects/liquix/index.js
+++ b/projects/liquix/index.js
@@ -46,12 +46,12 @@ Object.keys(config).forEach((chain) => {
fromBlock,
});
const vaults = logs.map(i => i.proxyAddress)
- for (let i = 0; i < vaults.length; i++) {
- const balances = await api.call({ abi: 'function totalUnderlying(address vault_) external view returns ((address,uint256)[] memory)', target: helper, params: vaults[i] });
- for (let j = 0; j < balances.length; j++) {
- const token0 = balances[j][0];
- const balance = balances[j][1];
- api.add(token0, balance)
+ console.log(vaults.length)
+ const _balances = await api.multiCall({ abi: 'function totalUnderlying(address vault_) external view returns ((address,uint256)[] memory)', target: helper, calls: vaults, permitFailure: true, })
+ for (const balances of _balances) {
+ if (!balances) continue;
+ for (const balance of balances) {
+ api.add(balance[0], balance[1])
}
}
}
diff --git a/projects/listapie/index.js b/projects/listapie/index.js
new file mode 100644
index 0000000000..24a0986960
--- /dev/null
+++ b/projects/listapie/index.js
@@ -0,0 +1,22 @@
+const config = {
+ bsc: {
+ listarush: "0x934c69e35cA3a2774Cc0aa36f5632f1C39f3aC36",
+ }
+}
+
+async function staking(api) {
+ const { listarush } = config[api.chain];
+
+ const token_lista = await api.call({ abi: 'address:Lista', target: listarush, });
+ const bal = await api.call({ abi: 'uint256:totalDeposited', target: listarush, });
+ api.add(token_lista, bal)
+}
+
+Object.keys(config).forEach((chain) => {
+ module.exports[chain] = {
+ tvl: () => ({}),
+ staking,
+ }
+})
+
+module.exports.doublecounted = true
\ No newline at end of file
diff --git a/projects/locus/index.js b/projects/locus/index.js
index 990bc10cb5..64c94ee930 100644
--- a/projects/locus/index.js
+++ b/projects/locus/index.js
@@ -8,7 +8,7 @@ const stLocus = "0xEcc5e0c19806Cf47531F307140e8b042D5Afb952"
module.exports = {
doublecounted: true,
hallmarks: [
- [Math.floor(new Date('2023-12-30')/1e3), 'Was hacked for 321k'], // https://twitter.com/Locus_finance/status/1744374506267767267
+ [Math.floor(new Date('2023-12-30') / 1e3), 'Was hacked for 321k'], // https://twitter.com/Locus_finance/status/1744374506267767267
],
}
@@ -22,6 +22,7 @@ const config = {
arbitrum: {
lvTokens: {
xARB: "0xF8F045583580C4Ba954CD911a8b161FafD89A9EF",
+ pendleETH: "0x515f3533a17E2EEFB13313D9248f328C94dBe641"
},
lvTokens2: {
xUSD: "0x6318938F825F57d439B3a9E25C38F04EF97987D8",
@@ -32,7 +33,7 @@ const config = {
Object.keys(config).forEach(chain => {
const { lvTokens, lvTokens2 } = config[chain]
let tvl = sumERC4626VaultsExport({ vaults: Object.values(lvTokens), tokenAbi: 'token', balanceAbi: 'totalAssets' })
- if (lvTokens2)
+ if (lvTokens2)
tvl = sdk.util.sumChainTvls([tvl, sumERC4626VaultsExport({ vaults: Object.values(lvTokens2), tokenAbi: 'wantToken', balanceAbi: 'totalAssets' })])
module.exports[chain] = {
tvl
diff --git a/projects/logx/index.js b/projects/logx/index.js
index 43af074153..a90d5d4e53 100644
--- a/projects/logx/index.js
+++ b/projects/logx/index.js
@@ -1,3 +1,5 @@
+const { nullAddress } = require("../helper/tokenMapping")
+
module.exports = {
methodology: "USDC.e in the vault",
}
@@ -9,7 +11,8 @@ const config = {
manta: '0x53c6decad02cB6C535a7078B686650c951aD6Af5',
telos: '0x082321F9939373b02Ad54ea214BF6e822531e679',
fuse: '0x082321F9939373b02Ad54ea214BF6e822531e679',
- mode: ['0x34b83A3759ba4c9F99c339604181bf6bBdED4C79', '0x082321F9939373b02Ad54ea214BF6e822531e679']
+ mode: ['0x34b83A3759ba4c9F99c339604181bf6bBdED4C79', '0x082321F9939373b02Ad54ea214BF6e822531e679'],
+ zklink: ['0x75940cDa18F14D1F97562fc2A6dBCe31CBe03870']
}
Object.keys(config).forEach(chain => {
@@ -20,7 +23,12 @@ Object.keys(config).forEach(chain => {
const ownerTokens = []
for (const v of vault) {
const tokens = await api.fetchList({ lengthAbi: 'allWhitelistedTokensLength', itemAbi: 'allWhitelistedTokens', target: v })
- ownerTokens.push([tokens, v])
+ ownerTokens.push([tokens.map(i => {
+ switch (i.toLowerCase()) {
+ case '0x000000000000000000000000000000000000800a': return nullAddress
+ default: return i
+ }
+ }), v])
}
return api.sumTokens({ ownerTokens })
}
diff --git a/projects/loopfi/index.js b/projects/loopfi/index.js
new file mode 100644
index 0000000000..1cc6ccdb44
--- /dev/null
+++ b/projects/loopfi/index.js
@@ -0,0 +1,26 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require("../helper/unwrapLPs")
+
+const LOOP_PRELAUNCH = "0xaBEEcB1d3414550B30694bB37ac24CAaD0b82aE9"
+
+const tokens = {
+ WETH: ADDRESSES.ethereum.WETH,
+ weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee",
+ ezETH: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110",
+ rsETH: "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7",
+ rswETH: "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0",
+ uniETH: "0xF1376bceF0f78459C0Ed0ba5ddce976F1ddF51F4",
+ pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72",
+}
+
+module.exports = {
+ methodology:
+ "Counts the number of WETH and LRT tokens in the LoopFi Prelaunch Contract.",
+ start: 1718390875,
+ ethereum: {
+ tvl: sumTokensExport({
+ owner: LOOP_PRELAUNCH,
+ tokens: Object.values(tokens),
+ }),
+ },
+}
diff --git a/projects/lorenzo/index.js b/projects/lorenzo/index.js
new file mode 100644
index 0000000000..c0ee691cba
--- /dev/null
+++ b/projects/lorenzo/index.js
@@ -0,0 +1,23 @@
+const { sumTokensExport } = require("../helper/sumTokens");
+
+const LorenzoOwners = [
+ "bc1pzd6luyardlle9f7lul2y8fl72c22p6vxspc4k4g4gzgjf8975s0sr042yt",
+ "bc1p7agkadaau66jtva9n8k5pg3lsctuyqur8a2l5y9hzwqkh5nlmd0skuhws3",
+ "bc1qaf6laj9m7jteztyz4lulrtcjtpusfcfnd7r7xn",
+ "bc1qf6cj2z2e2mzuvfrl80vgt53k7jc2vf36ckahgy",
+ "bc1q5hc68n6krnzgzswf7rknha2aqxzrzup4vlhce8",
+ "bc1qpxpmr3zdjulqnwa3jdvm83tpaek6dv3kc75ms7",
+ "bc1qaml9d9mqgfhsfuaa2ymutdl4psj8c2undx9n72",
+ "bc1qutgngqyrflxrfmk9k28ucvq0s2v8a43nwfwv02",
+ "bc1qrx3fpr5j6sprxett45c2kl9p4pajyxep0mapfd",
+ "bc1q00t2ntm46c2nfvcer6ukj6npaxjurujthse4qq",
+ "bc1q3pzhncle68gct6me08kn5kf9awkevt6ettwrmg",
+ "bc1qw6cvwx8ajprmp2lzkhrsps2qx4k9r2pj4xj98x"
+];
+
+module.exports = {
+ methodology: "Lorenzo, As the Bitcoin Liquidity Finance Layer",
+ bitcoin: {
+ tvl: sumTokensExport({ owners : LorenzoOwners }),
+ }
+};
\ No newline at end of file
diff --git a/projects/lovelyswap-v2/index.js b/projects/lovelyswap-v2/index.js
new file mode 100644
index 0000000000..ed77cf9848
--- /dev/null
+++ b/projects/lovelyswap-v2/index.js
@@ -0,0 +1,7 @@
+const { uniTvlExports } = require('../helper/unknownTokens')
+
+module.exports = uniTvlExports({
+ bsc: '0x7db16925214B2F5D65dB741D59208A1187B9961c',
+ base: '0x7db16925214B2F5D65dB741D59208A1187B9961c',
+ polygon: '0x177aeb3727c91c4796766336923c4da431c59637',
+})
diff --git a/projects/lynx/index.js b/projects/lynx/index.js
new file mode 100644
index 0000000000..38ecda6e9e
--- /dev/null
+++ b/projects/lynx/index.js
@@ -0,0 +1,172 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const config = {
+ linea: {
+ tokenAndOwnerPair: [
+ [
+ // veLVC Token
+ "0xcc22F6AA610D1b2a0e89EF228079cB3e1831b1D1",
+ // OFTChipAdapter (owner)
+ "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90",
+ ],
+ ],
+ },
+ fantom: {
+ tokenAndOwnerPair: [
+ [
+ // FTM Token
+ "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
+ // OFTChipAdapter (owner)
+ "0x614aA983f54409D475aeC5D18120FECFD6320eF4"
+ ],
+ [
+ // USDC Token
+ "0x04068da6c83afcfa0e13ba15a6696662335d5b75",
+ // OFTChipAdapter (owner)
+ "0x194609ea1C1D77e66eaB28C48CE266A48f3bC30a",
+ ],
+ [
+ // FSONIC Token
+ "0x05e31a691405d06708a355c029599c12d5da8b28",
+ // OFTChipAdapter (owner)
+ "0xCCC0d9d276176FED7E6918dCf99F23DCAaCFcAc5"
+ ],
+ [
+ // BRUSH Token
+ "0x85dec8c4b2680793661bca91a8f129607571863d",
+ // OFTChipAdapter (owner)
+ "0xcbd1a63a84af4baa9541331420ff98d8fca3ba1c",
+ ],
+ [
+ // POLTER Token
+ "0x5c725631FD299703D0A74C23F89a55c6B9A0C52F",
+ // OFTChipAdapter (owner)
+ "0x089cd8ac58d9a1488b3cdfdfeb20963e7bb33732",
+ ],
+ [
+ // fBUX Token
+ "0x1e2Ea3f3209D66647f959CF00627107e079B870d",
+ // OFTChipAdapter (owner)
+ "0x86facb048fee156a16104531bd36cdff118d8107",
+ ],
+ [
+ // fTAILS Token
+ "0x5cF90b977C86415a53CE3B7bE13b26f6abdDfee2",
+ // OFTChipAdapter (owner)
+ "0x2c241eefc4b61ed475d7f1ded112df99e5de0e8f",
+ ],
+ ],
+ },
+ fuse: {
+ tokenAndOwnerPair: [
+ [
+ // WFUSE Token
+ ADDRESSES.fuse.WFUSE,
+ // OFTChipAdapter (owner)
+ "0x962FD1B229c8c775bC2E37A8a90dac4f3C0105B7",
+ ],
+ [
+ // MST Token
+ "0x2363Df84fDb7D4ee9d4E1A15c763BB6b7177eAEe",
+ // OFTChipAdapter (owner)
+ "0x028815b56433a4AAe10087290d1Ed9Ef7437068F",
+ ],
+ [
+ // sFUSE Token
+ "0xb1DD0B683d9A56525cC096fbF5eec6E60FE79871",
+ // OFTChipAdapter (owner)
+ "0x707f3d554B47E17F1FDfb408FE091B39D51929CF",
+ ],
+ [
+ // VOLT Token
+ "0xC5E782E2A4E2cFCb7eD454CF5a7b6aa2bB424B90",
+ // OFTChipAdapter (owner)
+ "0x094DE4d315198Df981D3a20ceFc3381B2182a572",
+ ],
+ ],
+ },
+ arbitrum: {
+ tokenAndOwnerPair: [
+ [
+ // stEUR Token
+ "0x004626a008b1acdc4c74ab51644093b155e59a23",
+ // OFTChipAdapter (owner)
+ "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90",
+ ],
+ [
+ // TST Token
+ "0xf5a27e55c748bcddbfea5477cb9ae924f0f7fd2e",
+ // OFTChipAdapter (owner)
+ "0xd22c72ab0f4967edb876d84773bff0b60a92e51a",
+ ],
+ [
+ // EUROs Token
+ "0x643b34980e635719c15a2d4ce69571a258f940e9",
+ // OFTChipAdapter (owner)
+ "0x3552fe61af3f6d3235dd1cb75402d4281d1fbac6",
+ ],
+ [
+ // GRAI Token
+ "0x894134a25a5faC1c2C26F1d8fBf05111a3CB9487",
+ // OFTChipAdapter (owner)
+ "0xBe1fa4177fBf43683434CecD5563DA6Ea00FD474",
+ ],
+ ],
+ },
+ optimism: {
+ tokenAndOwnerPair: [
+ [
+ // SONNE Token
+ "0x1db2466d9f5e10d7090e7152b68d62703a2245f0",
+ // OFTChipAdapter (owner)
+ "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90",
+ ],
+ ],
+ },
+ polygon: {
+ tokenAndOwnerPair: [
+ [
+ // MAI Token
+ "0xa3fa99a148fa48d14ed51d610c367c61876997f1",
+ // OFTChipAdapter (owner)
+ "0x7279d1cff1510e503b6be64fbbad64088034504c",
+ ],
+ [
+ // WMATIC Token
+ ADDRESSES.polygon.WMATIC_2,
+ // OFTChipAdapter (owner)
+ "0x028815b56433a4aae10087290d1ed9ef7437068f",
+ ],
+ ],
+ },
+ mantle: {
+ tokenAndOwnerPair: [
+ [
+ // aUSD Token
+ "0xD2B4C9B0d70e3Da1fBDD98f469bD02E77E12FC79",
+ // OFTChipAdapter (owner)
+ "0xC5E782E2A4E2cFCb7eD454CF5a7b6aa2bB424B90",
+ ],
+ ],
+ },
+ bsc: {
+ tokenAndOwnerPair: [
+ [
+ // lisUSD Token
+ "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5",
+ // OFTChipAdapter (owner)
+ "0x3b7ed1cdf0fc64d95c0d0428b9cc99b6a9a5cb94",
+ ],
+ ],
+ },
+};
+
+Object.keys(config).forEach((chain) => {
+ const { tokenAndOwnerPair } = config[chain];
+ module.exports[chain] = {
+ tvl: sumTokensExport({
+ tokensAndOwners: tokenAndOwnerPair,
+ }),
+ };
+});
diff --git a/projects/lyra-v2/index.js b/projects/lyra-v2/index.js
index 5a38db8b51..cc0875f993 100644
--- a/projects/lyra-v2/index.js
+++ b/projects/lyra-v2/index.js
@@ -1,8 +1,28 @@
-const { sumTokensExport } = require('../helper/unwrapLPs')
-const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const { getConfig } = require('../helper/cache')
-module.exports = {
- ethereum: {
- tvl: sumTokensExport({ owner: '0x6d303cee7959f814042d31e0624fb88ec6fbcc1d', tokens: [ADDRESSES.ethereum.USDC] })
+const chains = ['ethereum', 'base', 'arbitrum', 'optimism', 'mode', 'blast']
+
+async function getOldToA(api) {
+ const data = await getConfig('lyra-v2/old-contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/main/deployments/superbridge/prod_lyra-old_addresses.json')
+ const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault)
+ const tokens = await api.multiCall({ abi: 'address:token__', calls: vaults})
+ return vaults.map((vault, i) => [tokens[i], vault])
+}
+async function getToA(api) {
+ const data = await getConfig('lyra-v2/contracts', 'https://raw.githubusercontent.com/0xdomrom/socket-plugs/main/deployments/superbridge/prod_lyra_addresses.json')
+ const vaults = Object.values(data[api.chainId+'']?? {}).map(i => i.Vault)
+ const tokens = await api.multiCall({ abi: 'address:token', calls: vaults})
+ return vaults.map((vault, i) => [tokens[i], vault])
+}
+
+chains.forEach(chain => {
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const oldToA = await getOldToA(api)
+ const toa = await getToA(api)
+ console.log(chain, oldToA.concat(toa))
+ return sumTokens2({ tokensAndOwners: oldToA.concat(toa), api })
+ }
}
-}
\ No newline at end of file
+})
diff --git a/projects/macaron-xyz-stable/index.js b/projects/macaron-xyz-stable/index.js
new file mode 100644
index 0000000000..0624a26f02
--- /dev/null
+++ b/projects/macaron-xyz-stable/index.js
@@ -0,0 +1,23 @@
+const { getLogs } = require('../helper/cache/getLogs')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+async function tvl(api) {
+ const { factory, fromBlock, } = config[api.chain]
+ const logs = await getLogs({
+ api,
+ target: factory,
+ topics: ['0x8e74ffd51819fef95a58370a621a4ba82cae11062f357bf636c4cca361812ddf'],
+ fromBlock,
+ eventAbi: 'event NewStableSwapPair(address indexed pool, address indexed token0, address indexed token1, uint256 A, uint256 fee, uint256 adminFee)',
+ onlyArgs: true,
+ })
+ return sumTokens2({ api, ownerTokens: logs.map(({ pool, token0, token1 }) => ([[token0, token1], pool])) })
+}
+
+const config = {
+ btr: { factory: '0x584E53b4D07b077fA6cc4302B0b457c04bbCC8Fa', fromBlock: 1736941 },
+}
+
+Object.keys(config).forEach(chain => {
+ module.exports[chain] = { tvl }
+})
\ No newline at end of file
diff --git a/projects/macaron-xyz/index.js b/projects/macaron-xyz/index.js
index fa3a611c85..7be61a4386 100644
--- a/projects/macaron-xyz/index.js
+++ b/projects/macaron-xyz/index.js
@@ -1,3 +1,7 @@
const { uniTvlExport } = require('../helper/unknownTokens')
+const { mergeExports } = require('../helper/utils')
-module.exports = uniTvlExport('btr', '0x05daB9D11A0e14E68862cd08A73A7362Bb93a331')
\ No newline at end of file
+module.exports = mergeExports([
+ uniTvlExport('btr', '0x05daB9D11A0e14E68862cd08A73A7362Bb93a331'),
+ uniTvlExport('btr', '0x1037E9078df7ab09B9AF78B15D5E7aaD7C1AfDd0'),
+])
\ No newline at end of file
diff --git a/projects/magicsea-lb-v2/index.js b/projects/magicsea-lb-v2/index.js
new file mode 100644
index 0000000000..a0a0d2c920
--- /dev/null
+++ b/projects/magicsea-lb-v2/index.js
@@ -0,0 +1,6 @@
+const { joeV2Export } = require('../helper/traderJoeV2')
+
+module.exports = joeV2Export({
+ // shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa', // excluded since tvl is already counted in swapline
+ iotaevm: '0x8Cce20D17aB9C6F60574e678ca96711D907fD08c'
+})
\ No newline at end of file
diff --git a/projects/manta-cedefi-stake/index.js b/projects/manta-cedefi-stake/index.js
new file mode 100644
index 0000000000..103f0e0a58
--- /dev/null
+++ b/projects/manta-cedefi-stake/index.js
@@ -0,0 +1,14 @@
+const { sumTokensExport } = require("../helper/unwrapLPs")
+
+const tokens = [
+ "0x1468177DbCb2a772F3d182d2F1358d442B553089", // "mBTC"
+ "0xACCBC418a994a27a75644d8d591afC22FaBA594e", // "mETH"
+ "0x649d4524897cE85A864DC2a2D5A11Adb3044f44a", // "mUSD"
+]
+const mTokenStakeContract = "0x1B9bcc6644CC9b5e1F89aBaAb66904F5a562d4a1"
+
+module.exports = {
+ manta: {
+ tvl: sumTokensExport({ owner: mTokenStakeContract, tokens }),
+ },
+}
\ No newline at end of file
diff --git a/projects/manta-cedefi/index.js b/projects/manta-cedefi/index.js
new file mode 100644
index 0000000000..ea9ca86f2b
--- /dev/null
+++ b/projects/manta-cedefi/index.js
@@ -0,0 +1,36 @@
+const tokens = [
+ {
+ name: "mBTC",
+ address: "0x1468177DbCb2a772F3d182d2F1358d442B553089",
+ decimals: 18,
+ coinGeckoId: "bitcoin",
+ },
+ {
+ name: "mETH",
+ address: "0xACCBC418a994a27a75644d8d591afC22FaBA594e",
+ decimals: 18,
+ coinGeckoId: "ethereum",
+ },
+ {
+ name: "mUSD",
+ address: "0x649d4524897cE85A864DC2a2D5A11Adb3044f44a",
+ decimals: 18,
+ coinGeckoId: "tether",
+ },
+];
+
+async function tvl(api) {
+ const balances = await api.multiCall({
+ abi: "erc20:totalSupply",
+ calls: tokens.map((item) => item.address),
+ });
+ tokens.forEach((token, index) => {
+ api.addCGToken(token.coinGeckoId, balances[index] / 10 ** tokens[index].decimals);
+ })
+}
+
+module.exports = {
+ manta: {
+ tvl,
+ },
+}
\ No newline at end of file
diff --git a/projects/maple-syrup/index.js b/projects/maple-syrup/index.js
new file mode 100644
index 0000000000..bf031ef8e1
--- /dev/null
+++ b/projects/maple-syrup/index.js
@@ -0,0 +1,14 @@
+const rwaPools = [
+ '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b',
+]
+
+async function tvl(api) {
+ const tokens = await api.multiCall({ abi: 'address:asset', calls: rwaPools })
+ const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: rwaPools })
+ api.addTokens(tokens, bals)
+}
+
+module.exports = {
+ doublecounted: true,
+ ethereum: { tvl, }
+}
\ No newline at end of file
diff --git a/projects/maple/index.js b/projects/maple/index.js
index d33340fc8b..e835334cd5 100644
--- a/projects/maple/index.js
+++ b/projects/maple/index.js
@@ -1,8 +1,9 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require("@defillama/sdk");
const { sumTokens2 } = require("../helper/unwrapLPs");
+const { sumTokens2: sumSolana } = require("../helper/solana");
const { staking, } = require("../helper/staking")
-const { getConnection, getTokenBalance } = require('../helper/solana')
+const { getConnection, } = require('../helper/solana')
const { PublicKey } = require('@solana/web3.js')
const { getLogs } = require('../helper/cache/getLogs')
@@ -15,7 +16,6 @@ const TVL_DATA_SIZE = 8;
const PROGRAM_ID = "5D9yi4BKrxF8h65NkVE1raCCWFKUs5ngub2ECxhvfaZe";
let _tvl
-const usdc = ADDRESSES.solana.USDC
function getTvl(borrowed = false) {
return async () => {
@@ -42,10 +42,13 @@ async function getSolanaTVL() {
for (const account of accounts) {
const data = account.account.data.slice(TVL_OFFSET, TVL_OFFSET + TVL_DATA_SIZE)
const poolTvl = Number(data.readBigUint64LE())
- const loanBalance = await getTokenBalance(usdc, account.pubkey.toString())
- tvlValue += loanBalance * 1e6
- borrowed += poolTvl - loanBalance * 1e6
+ borrowed += poolTvl
}
+ const usdc = ADDRESSES.solana.USDC
+ const tempBalances = await sumSolana({ owners: accounts.map(a => a.pubkey.toString()), tokens: [ADDRESSES.solana.USDC] })
+ const usdValue = +(tempBalances['solana:'+usdc] ?? 0)
+ tvlValue += usdValue
+ borrowed -= usdValue
if (borrowed < 0) borrowed = 0
return {
diff --git a/projects/marginly/config.js b/projects/marginly/config.js
index 6b358afbed..daaa5d6f10 100644
--- a/projects/marginly/config.js
+++ b/projects/marginly/config.js
@@ -11,6 +11,11 @@ module.exports = {
fromBlock: 208756175,
version: "v1.5",
},
+ {
+ factory: "0x4a805A6dbaCF824D5A39b9f3559aeFb831C1df95",
+ fromBlock: 220673210,
+ version: "v1.5",
+ },
],
},
blast: {
diff --git a/projects/marinade-native/index.js b/projects/marinade-native/index.js
index 8f84c77ce0..1bc54efeec 100644
--- a/projects/marinade-native/index.js
+++ b/projects/marinade-native/index.js
@@ -1,17 +1,7 @@
-const { StakeProgram } = require("@solana/web3.js")
-const { getConnection } = require('../helper/solana')
+const { getStakedSol } = require('../helper/solana')
-async function tvl() {
- const stakeAccounts = await getConnection().getProgramAccounts(StakeProgram.programId, {
- filters: [{
- memcmp: { bytes: 'stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', offset: 4 + 8 }
- }],
- dataSlice: { offset: 0, length: 1 } // we dont care about the data, just the lamports
- })
-
- return {
- solana: stakeAccounts.reduce((tvl, { account }) => { return tvl + account.lamports / 1e9 }, 0)
- }
+async function tvl(api) {
+ await getStakedSol('stWirqFCf2Uts1JBL1Jsd3r6VBWhgnpdPxCTe1MFjrq', api)
}
module.exports = {
diff --git a/projects/marinade.js b/projects/marinade.js
index ad204fd662..18b1555992 100644
--- a/projects/marinade.js
+++ b/projects/marinade.js
@@ -1,4 +1,4 @@
-const { getProvider, getSolBalance, } = require("./helper/solana")
+const { getProvider, sumTokens2, } = require("./helper/solana")
const { Program, } = require("@project-serum/anchor");
async function tvl() {
@@ -6,28 +6,23 @@ async function tvl() {
const programId = 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD'
const idl = await Program.fetchIdl(programId, provider)
const program = new Program(idl, programId, provider)
- const [
- {
- account: {
- validatorSystem: { totalActiveBalance },
- availableReserveBalance,
- },
+ const [{
+ account: {
+ validatorSystem: { totalActiveBalance },
+ availableReserveBalance,
},
- ] = await program.account.state.all()
- return {
- solana:
- (+totalActiveBalance +
- +availableReserveBalance +
- (await getSolBalance("UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q"))) / // Liq Pool Sol Leg Pda
- 1e9,
+ },] = await program.account.state.all()
+ const balances = {
+ solana: (+totalActiveBalance + +availableReserveBalance) / 1e9
}
+ return sumTokens2({ balances, solOwners: ['UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q'] }) // Liq Pool Sol Leg Pda
}
module.exports = {
- hallmarks:[
- [1667865600, "FTX collapse"]
- ],
- timetravel: false,
- solana: { tvl },
- methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN and SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q`,
+ hallmarks: [
+ [1667865600, "FTX collapse"]
+ ],
+ timetravel: false,
+ solana: { tvl },
+ methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN and SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q`,
}
diff --git a/projects/maverick-v2/index.js b/projects/maverick-v2/index.js
new file mode 100644
index 0000000000..a8018ec258
--- /dev/null
+++ b/projects/maverick-v2/index.js
@@ -0,0 +1,77 @@
+// Maverick Protocol
+const { sumTokens2 } = require("../helper/unwrapLPs");
+const { getLogs2 } = require("../helper/cache/getLogs");
+
+function maverickTVL(config) {
+ const exports = {};
+
+ Object.keys(config).forEach((chain) => {
+ const { factories } = config[chain];
+ exports[chain] = {
+ tvl: async (api) => {
+ let logs = [];
+ for (let k = 0; k < factories.length; k++) {
+ logs.push(
+ ...(await getLogs2({
+ api,
+ target: factories[k].address,
+ fromBlock: factories[k].startBlock,
+ eventAbi:
+ "event PoolCreated(address poolAddress,uint8 protocolFeeRatio,uint256 feeAIn,uint256 feeBIn,uint256 tickSpacing,uint256 lookback,int32 activeTick,address tokenA,address tokenB,uint8 kinds,address accessor)",
+ }))
+ );
+ }
+
+ return sumTokens2({
+ api,
+ ownerTokens: logs.map((i) => [[i.tokenA, i.tokenB], i.poolAddress]),
+ });
+ },
+ };
+ });
+
+ return exports;
+}
+
+module.exports = maverickTVL({
+ ethereum: {
+ factories: [
+ {
+ address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e",
+ startBlock: 20027236,
+ },
+ ],
+ },
+ era: {
+ factories: [
+ {
+ address: "0x7A6902af768a06bdfAb4F076552036bf68D1dc56",
+ startBlock: 35938167,
+ },
+ ],
+ },
+ bsc: {
+ factories: [
+ {
+ address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e",
+ startBlock: 39421941,
+ },
+ ],
+ },
+ base: {
+ factories: [
+ {
+ address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e",
+ startBlock: 15321281,
+ },
+ ],
+ },
+ arbitrum: {
+ factories: [
+ {
+ address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e",
+ startBlock: 219205177,
+ },
+ ],
+ },
+});
diff --git a/projects/mcdex/index.js b/projects/mcdex/index.js
index 7646a75a0c..f801a5f6bf 100644
--- a/projects/mcdex/index.js
+++ b/projects/mcdex/index.js
@@ -1,47 +1,33 @@
-const {gql} = require('graphql-request')
-const { blockQuery } = require('../helper/http')
-const {toUSDTBalances} = require('../helper/balances');
+const { getLogs2 } = require('../helper/cache/getLogs')
const { sumTokens2, nullAddress } = require('../helper/unwrapLPs')
async function ethereum(timestamp, block) {
- return sumTokens2({ block, owner: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', tokens: [nullAddress]})
+ return sumTokens2({ block, owner: '0x220a9f0DD581cbc58fcFb907De0454cBF3777f76', tokens: [nullAddress] })
}
-async function getTVL(subgraphName, api) {
- const endpoint = `https://api.thegraph.com/subgraphs/name/mcdexio/${subgraphName}`
-
- const query = gql`
- query getTvl ($block: Int) {
- factories (
- block: { number: $block }
- ){
- id
- totalValueLockedUSD
- }
- }
- `;
- const results = await blockQuery(endpoint, query, { api, blockCatchupLimit: 600, })
- return results.factories[0].totalValueLockedUSD;
-}
-
-async function arbitrum(api) {
- return toUSDTBalances(await getTVL("mcdex3-arb-perpetual", api))
+module.exports = {
+ methodology: `Includes all locked liquidity in AMM pools, pulling the data from the mcdex subgraph`,
+ ethereum: {
+ tvl: ethereum
+ },
}
-async function bsc(api) {
- return toUSDTBalances(await getTVL("mcdex3-bsc-perpetual", api))
+const config = {
+ arbitrum: { factory: "0xA017B813652b93a0aF2887913EFCBB4ab250CE65", fromBlock: 219937, },
+ bsc: { factory: "0xfb4cd1bf5c5919a29fb894c8ddc4a69a36f5ec87", fromBlock: 11137817, },
}
-module.exports = {
- misrepresentedTokens: true,
- methodology: `Includes all locked liquidity in AMM pools, pulling the data from the mcdex subgraph`,
- arbitrum: {
- tvl: arbitrum
- },
- bsc: {
- tvl: bsc
- },
- ethereum: {
- tvl: ethereum
- },
-}
+Object.keys(config).forEach(chain => {
+ const { factory, fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs2({
+ api,
+ factory,
+ eventAbi: 'event CreateLiquidityPool(bytes32 versionKey, address indexed liquidityPool, address indexed governor, address indexed operator, address shareToken, address collateral, uint256 collateralDecimals, bytes initData)',
+ fromBlock,
+ })
+ return api.sumTokens({ tokensAndOwners: logs.map(log => [log.collateral, log.liquidityPool]) })
+ }
+ }
+})
diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js
index 491b89b3e0..3be9d2b6e7 100644
--- a/projects/meanfinance/index.js
+++ b/projects/meanfinance/index.js
@@ -2,7 +2,10 @@ const { V1_POOLS, TOKENS_IN_LEGACY_VERSIONS } = require("./addresses");
const { sumTokens2 } = require('../helper/unwrapLPs')
const { getConfig } = require('../helper/cache')
-const YIELD_VERSION = '0xA5AdC5484f9997fBF7D405b9AA62A7d88883C345'
+const YIELD_VERSION = (chain) => {
+ if (chain == 'rsk') return '0x8CC0Df843610cefF7f4AFa01100B6abf6756Bdf2';
+ else return '0xA5AdC5484f9997fBF7D405b9AA62A7d88883C345';
+}
const YIELDLESS_VERSION = '0x059d306A25c4cE8D7437D25743a8B94520536BD5'
const VULN_VERSION = '0x230C63702D1B5034461ab2ca889a30E343D81349'
const BETA_VERSION = '0x24F85583FAa9F8BD0B8Aa7B1D1f4f53F0F450038'
@@ -13,7 +16,7 @@ const LEGACY_VERSIONS = {
}
async function getTokensInChain(chain) {
- const data = await getConfig('mean-finance/'+chain, `https://api.mean.finance/v1/dca/networks/${chain}/tokens?includeNotAllowed`)
+ const data = await getConfig('mean-finance/'+chain, `https://api.balmy.xyz/v1/dca/networks/${chain}/tokens?includeNotAllowed`)
return data.map(({ address }) => address)
}
@@ -29,7 +32,7 @@ async function getV2TVL(chain, block) {
const tokens = await getTokensInChain(chain)
const versions = [
...legacyVersions.map(contract => ({ contract, tokens: legacyTokens })),
- { contract: YIELD_VERSION, tokens }
+ { contract: YIELD_VERSION(chain), tokens }
]
const toa = versions.map(({ contract, tokens }) => tokens.map(t => ([t, contract]))).flat()
@@ -62,6 +65,8 @@ module.exports = {
bsc: getV2TvlObject('bsc'),
xdai: getV2TvlObject('xdai'),
moonbeam: getV2TvlObject('moonbeam'),
+ avax: getV2TvlObject('avax'),
+ rsk: getV2TvlObject('rsk'),
hallmarks: [
[1650082958, "Protocol is paused due to non-critical vulnerability"],
[1654057358, "Deployment on Optimism"],
diff --git a/projects/mellow-protocol-v2/index.js b/projects/mellow-protocol-v2/index.js
new file mode 100644
index 0000000000..a18cfc7fce
--- /dev/null
+++ b/projects/mellow-protocol-v2/index.js
@@ -0,0 +1,32 @@
+const config = {
+ ethereum: {
+ vaults: [
+ '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc',
+ '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a',
+ '0x5fD13359Ba15A84B76f7F87568309040176167cd',
+ '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a',
+ '0xc65433845ecD16688eda196497FA9130d6C47Bd8',
+ '0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26',
+ '0x49cd586dd9BA227Be9654C735A659a1dB08232a9',
+ '0x82dc3260f599f4fC4307209A1122B6eAa007163b',
+ '0xd6E09a5e6D719d1c881579C9C8670a210437931b',
+ '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811'
+ ],
+ },
+}
+
+module.exports = {
+ doublecounted: true,
+};
+
+Object.keys(config).forEach(chain => {
+ const { vaults, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const baseTvl = await api.multiCall({ abi: 'function underlyingTvl() public view returns (address[] tokens, uint256[] values)', calls: vaults })
+ baseTvl.forEach(({ tokens, values}) => {
+ api.add(tokens, values)
+ })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/mento/index.js b/projects/mento/index.js
index 264d520f01..addb839a4b 100644
--- a/projects/mento/index.js
+++ b/projects/mento/index.js
@@ -3,18 +3,18 @@ const { nullAddress, } = require('../helper/unwrapLPs')
const { sumTokensExport, } = require('../helper/sumTokens')
module.exports = {
- methodology: 'TVL counts Celo deposited as collateral to mint cUSD.',
+ methodology: 'TVL counts all assets deposited as collateral to mint Mento stablecoins.',
celo: {
tvl: sumTokensExport({
- owners: ['0x9380fA34Fd9e4Fd14c06305fd7B6199089eD4eb9', '0x246f4599eFD3fA67AC44335Ed5e749E518Ffd8bB', '0x298FbD6dad2Fc2cB56d7E37d8aCad8Bf07324f67',],
- tokens: [nullAddress],
+ owners: ['0x9380fA34Fd9e4Fd14c06305fd7B6199089eD4eb9', '0x246f4599eFD3fA67AC44335Ed5e749E518Ffd8bB', '0x298FbD6dad2Fc2cB56d7E37d8aCad8Bf07324f67', '0x87647780180b8f55980c7d3ffefe08a9b29e9ae1'],
+ tokens: [nullAddress, ADDRESSES.celo.STEUR, ADDRESSES.celo.USDT_1],
chain: 'celo',
})
},
ethereum: {
tvl: sumTokensExport({
- owners: ['0xe1955eA2D14e60414eBF5D649699356D8baE98eE', '0x8331C987D9Af7b649055fa9ea7731d2edbD58E6B', '0x26ac3A7b8a675b741560098fff54F94909bE5E73', '0x16B34Ce9A6a6F7FC2DD25Ba59bf7308E7B38E186', ],
- tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, ],
+ owners: ['0xe1955eA2D14e60414eBF5D649699356D8baE98eE', '0x8331C987D9Af7b649055fa9ea7731d2edbD58E6B', '0x26ac3A7b8a675b741560098fff54F94909bE5E73', '0x16B34Ce9A6a6F7FC2DD25Ba59bf7308E7B38E186', '0xd0697f70E79476195B742d5aFAb14BE50f98CC1E'],
+ tokens: [nullAddress, ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.DAI, ADDRESSES.ethereum.SDAI, ADDRESSES.ethereum.STETH ],
chain: 'ethereum',
})
},
diff --git a/projects/merchant-moe-lb/index.js b/projects/merchant-moe-lb/index.js
index f86f584aba..9f4e59c4e1 100644
--- a/projects/merchant-moe-lb/index.js
+++ b/projects/merchant-moe-lb/index.js
@@ -1,34 +1,5 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { joeV2Export } = require('../helper/traderJoeV2')
-const factories = {
- mantle: '0xa6630671775c4EA2743840F9A5016dCf2A104054',
-}
-async function tvl(api) {
- const pools = await api.fetchList({
- target: factories[api.chain],
- itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)',
- lengthAbi: 'uint256:getNumberOfLBPairs',
- })
- const tokenA = await api.multiCall({
- abi: 'address:getTokenX',
- calls: pools,
- })
- const tokenB = await api.multiCall({
- abi: 'address:getTokenY',
- calls: pools,
- })
- const toa = []
- tokenA.map((_, i) => {
- toa.push([tokenA[i], pools[i]])
- toa.push([tokenB[i], pools[i]])
- })
- return sumTokens2({ api, tokensAndOwners: toa, })
-}
-
-module.exports = {
- methodology: 'We count the token balances in in different liquidity book contracts',
-}
-
-Object.keys(factories).forEach(chain => {
- module.exports[chain] = { tvl }
+module.exports = joeV2Export({
+ mantle: '0xa6630671775c4EA2743840F9A5016dCf2A104054'
})
\ No newline at end of file
diff --git a/projects/merchant/index.js b/projects/merchant/index.js
index 7eecdc199a..67e383e770 100644
--- a/projects/merchant/index.js
+++ b/projects/merchant/index.js
@@ -1,9 +1,15 @@
const { compoundExports2 } = require("../helper/compound");
module.exports = {
+ hallmarks: [
+ [1720051200,"Rug Pull"]
+ ],
methodology:
"Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets",
merlin: {
...compoundExports2({ comptroller: '0x1F2Aa5598f6543090C4c61A90917909fb5560A43'}),
},
+ linea: {
+ ...compoundExports2({ comptroller: '0xE54F37bbb8b7417EE4e0447DA0F8b922Fc7bb8Fa'}),
+ },
};
diff --git a/projects/mercurical-vaults/index.js b/projects/mercurical-vaults/index.js
index 182ac74cd4..011663b58f 100644
--- a/projects/mercurical-vaults/index.js
+++ b/projects/mercurical-vaults/index.js
@@ -1,18 +1,16 @@
const { Program } = require("@project-serum/anchor");
-const { getProvider, transformBalances, } = require("../helper/solana");
+const { getProvider, } = require("../helper/solana");
const sdk = require('@defillama/sdk')
const programId = '24Uqj9JCLxUeoC3hGfh5W3s9FM9uCHDS2SG3LYwBpyTi'
-async function tvl() {
+async function tvl(api) {
const provider = getProvider()
const idl = await Program.fetchIdl(programId, provider)
const program = new Program(idl, programId, provider)
const vaults = (await program.account.vault.all()).map(i => i.account)
const tokens = vaults.map(i => i.tokenMint.toString())
- const tokenBalances = {}
- vaults.forEach((i, idx) => sdk.util.sumSingleBalance(tokenBalances, tokens[idx], +i.totalAmount))
- return transformBalances({ tokenBalances })
+ vaults.forEach((i, idx) => api.add(tokens[idx], +i.totalAmount))
}
module.exports = {
diff --git a/projects/meridian-trade/index.js b/projects/meridian-trade/index.js
index f4c28ef79e..bc3b1d3274 100644
--- a/projects/meridian-trade/index.js
+++ b/projects/meridian-trade/index.js
@@ -1,9 +1,13 @@
const { gmxExports } = require('../helper/gmx')
-const Vault = '0x853a8cE6B6338f5B0A14BCfc97F9D68396099C9C';
+const base_vault = '0x853a8cE6B6338f5B0A14BCfc97F9D68396099C9C';
+const meter_vault = '0x95cd3F1DE20A29B473FcC1773069316a424c746D';
module.exports = {
base: {
- tvl: gmxExports({ vault: Vault, blacklistedTokens: ['0x5e06ea564efcb3158a85dbf0b9e017cb003ff56f'] })
+ tvl: gmxExports({ vault: base_vault, blacklistedTokens: ['0x5e06ea564efcb3158a85dbf0b9e017cb003ff56f'] }),
},
+ meter: {
+ tvl: gmxExports({ vault: meter_vault })
+ }
};
diff --git a/projects/meson/index.js b/projects/meson/index.js
index fa13145564..0b4c087c2c 100644
--- a/projects/meson/index.js
+++ b/projects/meson/index.js
@@ -20,10 +20,10 @@ const config = {
bsquared: {
tokens: [
ADDRESSES.bsquared.USDT,
- '0x7537C1F80c9E157ED7AFD93a494be3e1f04f1462',
+ ADDRESSES.bsquared.BSTONE,
'0xa793740863F1710A87070a5918820976ff32B758',
- '0xC2Fe4f673455Ef92299770a09CDB5E8756A525D5',
- '0xD48d3A551757ac47655fCe25BDE1B0B6b1Cb2a5A',
+ ADDRESSES.bsquared.FDUSD,
+ ADDRESSES.bsquared.ETH,
ADDRESSES.bsquared.USDC,
],
id: 'b2',
@@ -65,6 +65,7 @@ const config = {
ADDRESSES.tron.WTRX,
],
},
+ taiko: { id: 'taiko' },
ancient8: { id: 'ancient8' },
arbitrum: { id: 'arb' },
aurora: {},
@@ -98,7 +99,9 @@ const config = {
optimism: { id: 'opt'},
polygon_zkevm: { id: 'zkevm'},
era: { id: 'zksync'},
- btr: { id: 'bitlayer'}
+ btr: { id: 'bitlayer'},
+ bouncebit: { id: 'bb'},
+ europa: { id: 'skale-europa' }
}
async function addCoinfg(id, ownerTokens) {
diff --git a/projects/metastreet-v2/index.js b/projects/metastreet-v2/index.js
index c957e9f7bc..d8c8c0c05d 100644
--- a/projects/metastreet-v2/index.js
+++ b/projects/metastreet-v2/index.js
@@ -1,20 +1,38 @@
const abi = require("./abi.json");
-const { sumTokens2 } = require("../helper/unwrapLPs")
+const { sumTokens2 } = require("../helper/unwrapLPs");
-const METASTREET_POOL_FACTORY = "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095";
+const METASTREET_POOL_FACTORY = {
+ ethereum: "0x1c91c822F6C5e117A2abe2B33B0E64b850e67095",
+ base: "0x41cF7ea4Ba650191e829A6bD31B9e2049C78D858",
+ blast: "0x5F42c24Af1227c3c669035a6cB549579ed0F99dF",
+};
const MAX_UINT_128 = "0xffffffffffffffffffffffffffffffff";
async function tvl(api) {
- const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, })
- const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools, })
- const ct = await api.multiCall({ abi: abi.collateralToken, calls: pools, })
+ const pools = await api.call({
+ target: METASTREET_POOL_FACTORY[api.chain],
+ abi: abi.getPools,
+ });
+ const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools });
+ const ct = await api.multiCall({ abi: abi.collateralToken, calls: pools });
const ownerTokens = pools.map((pool, i) => [[tokens[i], ct[i]], pool]);
return sumTokens2({ api, ownerTokens, permitFailure: true });
}
async function borrowed(api) {
- const pools = await api.call({ target: METASTREET_POOL_FACTORY, abi: abi.getPools, })
- const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools, })
+ const pools = await api.call({
+ target: METASTREET_POOL_FACTORY[api.chain],
+ abi: abi.getPools,
+ });
+ const tokens = await api.multiCall({ abi: abi.currencyToken, calls: pools });
+ const tokenDecimals = await api.multiCall({
+ abi: "erc20:decimals",
+ calls: tokens.map((token) => ({ target: token })),
+ });
+ const decimalsMap = {};
+ tokens.forEach((token, index) => {
+ decimalsMap[token] = tokenDecimals[index];
+ });
const poolsBorrowedValue = (
await api.multiCall({
abi: abi.liquidityNodes,
@@ -23,14 +41,32 @@ async function borrowed(api) {
params: [0, MAX_UINT_128],
})),
})
- ).map((i) => i.reduce((partialSum, node) => partialSum + +node.value - +node.available, 0));
+ ).map((liquidityNodes, poolIndex) => {
+ const token = tokens[poolIndex];
+ const decimals = decimalsMap[token];
+ const scalingFactor = 10 ** (18 - decimals);
+
+ return liquidityNodes.reduce((partialSum, node) => {
+ const scaledValue = (+node.value - +node.available) / scalingFactor;
+ return partialSum + scaledValue;
+ }, 0);
+ });
api.addTokens(tokens, poolsBorrowedValue);
return api.getBalances();
}
module.exports = {
ethereum: {
- tvl, borrowed,
+ tvl,
+ borrowed,
+ },
+ base: {
+ tvl,
+ borrowed,
+ },
+ blast: {
+ tvl,
+ borrowed,
},
methodology:
"TVL is calculated by summing the value of token balances and NFTs across all MetaStreet pools. Total borrowed is calculated by subtracting the tokens available from the total value of all liquidity nodes across all pools.",
diff --git a/projects/metavault-v3/index.js b/projects/metavault-v3/index.js
index c78ab36597..a94dcc1647 100644
--- a/projects/metavault-v3/index.js
+++ b/projects/metavault-v3/index.js
@@ -1,8 +1,9 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { uniV3Export } = require("../helper/uniswapV3")
const factory = "0x9367c561915f9D062aFE3b57B18e30dEC62b8488" // same on all chains
module.exports = uniV3Export({
linea: { factory, fromBlock: 652486, },
- scroll: { factory, fromBlock: 77008, },
+ scroll: { factory, fromBlock: 77008, blacklistedTokens: [ADDRESSES.linea.WETH] },
})
\ No newline at end of file
diff --git a/projects/midas/index.js b/projects/midas/index.js
new file mode 100644
index 0000000000..bf220ae80c
--- /dev/null
+++ b/projects/midas/index.js
@@ -0,0 +1,18 @@
+async function tvl(api) {
+ const MTBILL_TOKEN_CONTRACT = "0xDD629E5241CbC5919847783e6C96B2De4754e438";
+ const mtbillSupply = await await api.call({ abi: "erc20:totalSupply", target: MTBILL_TOKEN_CONTRACT, });
+
+ const rate = await api.call({
+ target: "0x32d1463EB53b73C095625719Afa544D5426354cB", // IB01/USD
+ abi: "function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
+ });
+ api.addCGToken('tether', (mtbillSupply / 1e18) * (rate.answer / 1e8))
+}
+
+const chains = ["ethereum"];
+
+chains.forEach((chain) => {
+ module.exports[chain] = { tvl };
+});
+
+module.exports.misrepresentedTokens = true
\ No newline at end of file
diff --git a/projects/mimswap/index.js b/projects/mimswap/index.js
index 6121e57d58..2a11adf308 100644
--- a/projects/mimswap/index.js
+++ b/projects/mimswap/index.js
@@ -1,7 +1,9 @@
const { getLogs2 } = require('../helper/cache/getLogs')
const config = {
+ arbitrum: { factory: '0x8D0Cd3eEf1794F59F2B3a664Ef07fCAD401FEc73', fromBlock: 205217727 },
blast: { factory: '0x7E05363E225c1c8096b1cd233B59457104B84908', fromBlock: 1067907 },
+ kava: { factory: '0x7Ad0e580d8458BbeF71EC6A1755c59651E1EAaa7', fromBlock: 10023543 },
}
Object.keys(config).forEach(chain => {
diff --git a/projects/mind-restake/index.js b/projects/mind-restake/index.js
new file mode 100644
index 0000000000..f9890c22c0
--- /dev/null
+++ b/projects/mind-restake/index.js
@@ -0,0 +1,22 @@
+const config = {
+ ethereum: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196",
+ scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d",
+ bsc: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196",
+};
+
+module.exports = {
+ methodology: "Counts the total amount of asset tokens deposited in each of the Strategy contracts registered in the helper contract on each chain.",
+}
+
+Object.keys(config).forEach(chain => {
+ const target = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const [_vaults, tokens, bals] = await api.call({
+ abi: "function getPoolTotalAssets() view returns (address[] memory,address[] memory, uint256[] memory)",
+ target,
+ })
+ api.add(tokens, bals)
+ }
+ }
+})
diff --git a/projects/minswap/index.js b/projects/minswap/index.js
index bd24af267e..3c27ddf9da 100644
--- a/projects/minswap/index.js
+++ b/projects/minswap/index.js
@@ -1,13 +1,39 @@
-const { getAdaInAddress, sumTokensExport } = require("../helper/chain/cardano");
+const { getAdaInAddress, sumTokensExport, sumTokens2 } = require("../helper/chain/cardano");
-const POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me"
-const ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e"
+const V1_POOL_SCRIPT_HASH = "script1uychk9f04tqngfhx4qlqdlug5ntzen3uzc62kzj7cyesjk0d9me"
+const V1_ORDER_SCRIPT_HASH = "script15ew2tzjwn364l2pszu7j5h9w63v2crrnl97m074w9elrkxhah0e"
+
+const V2_POOL_SCRIPT_HASH = "script1agrmwv7exgffcdu27cn5xmnuhsh0p0ukuqpkhdgm800xksw7e2w"
+const V2_ORDER_SCRIPT_HASH = "script1c03gcdkrg3e3twj62menmf4xmhqhwz58d2xe7r9n497yc6r9qhd"
async function tvl() {
- const liquidityPoolLocked = await getAdaInAddress(POOL_SCRIPT_HASH)
- const batchOrderLocked = await getAdaInAddress(ORDER_SCRIPT_HASH)
+ // DEX V1
+ const v1LiquidityPoolLocked = await getAdaInAddress(V1_POOL_SCRIPT_HASH)
+ const v1BatchOrderLocked = await getAdaInAddress(V1_ORDER_SCRIPT_HASH)
+
+ // Stable Pools
+ const stablePoolsLiquidity = await sumTokens2({
+ owners: [
+ 'addr1wy7kkcpuf39tusnnyga5t2zcul65dwx9yqzg7sep3cjscesx2q5m5',
+ 'addr1wx8d45xlfrlxd7tctve8xgdtk59j849n00zz2pgyvv47t8sxa6t53',
+ 'addr1w9520fyp6g3pjwd0ymfy4v2xka54ek6ulv4h8vce54zfyfcm2m0sm',
+ 'addr1wxxdvtj6y4fut4tmu796qpvy2xujtd836yg69ahat3e6jjcelrf94',
+ ],
+ tokens: [
+ '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344',
+ 'f66d78b4a3cb3d37afa0ec36461e51ecbde00f26c8f0a68f94b6988069555344',
+ '25c5de5f5b286073c593edfd77b48abc7a48e5a4f3d4cd9d428ff93555534443',
+ 'c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d'
+ ],
+ })
+
+ // DEX V2
+ const v2LiquidityPoolLocked = await getAdaInAddress(V2_POOL_SCRIPT_HASH)
+ const v2BatchOrderLocked = await getAdaInAddress(V2_ORDER_SCRIPT_HASH)
+
return {
- cardano: (liquidityPoolLocked * 2) + batchOrderLocked,
+ cardano: ((v1LiquidityPoolLocked + v2LiquidityPoolLocked) * 2) + v1BatchOrderLocked + v2BatchOrderLocked,
+ ...stablePoolsLiquidity
};
}
@@ -22,5 +48,7 @@ module.exports = {
},
hallmarks:[
[1647949370, "Vulnerability Found"],
+ [1712565661, "Stableswap Launch"],
+ [1720584000, "V2 Launch"]
],
};
diff --git a/projects/minterest/index.js b/projects/minterest/index.js
index 976390a172..f32246396e 100644
--- a/projects/minterest/index.js
+++ b/projects/minterest/index.js
@@ -4,12 +4,14 @@ module.exports = {
hallmarks: [
[1677133355, "MINTY distribution begins on Ethereum"],
[1704369540, "MINTY distribution begins on Mantle"],
+ [1717164347, "MINTY distribution begins on Taiko"],
],
}
const config = {
ethereum: "0xD13f50274a68ABF2384C79248ADc259b3777c081",
mantle: "0xe53a90EFd263363993A3B41Aa29f7DaBde1a932D",
+ taiko: "0xe56c0d4d6A08C05ec42E923EFd06497F115D4799",
}
diff --git a/projects/mintswap-finance-v3/index.js b/projects/mintswap-finance-v3/index.js
new file mode 100644
index 0000000000..4c1f4bd9b7
--- /dev/null
+++ b/projects/mintswap-finance-v3/index.js
@@ -0,0 +1,7 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+const factory = "0x1f88BB455E02646224A0a65f3eb4B2FCb4fb8e49";
+
+module.exports = uniV3Export({
+ mint: { factory, fromBlock: 1025232 },
+})
\ No newline at end of file
diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js
index 07f53e9767..e0b048e770 100644
--- a/projects/mitosis/index.js
+++ b/projects/mitosis/index.js
@@ -1,23 +1,88 @@
-const chains = ["ethereum", "arbitrum", "optimism", "mode", "manta"];
+const ADDRESSES = require('../helper/coreAssets.json');
+const { sumTokens2 } = require('../helper/unwrapLPs');
+const sdk = require('@defillama/sdk');
const WEETH_ADDRESS = {
ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee",
arbitrum: "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe",
optimism: "0x346e03f8cce9fe01dcb3d0da3e9d00dc2c0e08f0",
- mode: "0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A",
+ mode: ADDRESSES.blast.weETH,
manta: "0x77b6F99970f488cFA8bd41892900b6Ce881C2300",
+ blast: ADDRESSES.blast.weETH,
+ linea: "0x1bf74c010e6320bab11e2e5a532b5ac15e0b8aa6",
+ scroll: "0x01f0a31698c4d065659b9bdc21b3610292a1c506",
+};
+
+const VAULT_weETHs = {
+ ethereum: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88",
};
const CAP_ADDRESS = {
+ scroll: "0x4a6219E25a41FD4165fbd158D89723a7175EA382",
ethereum: "0x451d791b6e9a9b8c9237bb55e58a7757342b16f9",
+ blast: "0x096430ef0a653c067df32e93ff77090e084169de",
+ linea: "0xcd32876b9b483eb75e8ca74935e4b51725f33a91",
+};
+
+const vaults = {
+ scroll: '0xB9Ca61A6D5fA0c443F3c48Ab1fbf0118964308D6',
+ ethereum: '0xE4cf2D4eb9c01784798679F2FED4CF47cc59a3ec'
+};
+
+const ethCapTVL = async (api) => {
+ const ethcap = CAP_ADDRESS.ethereum;
+ const tvl = await api.call({ abi: "uint256:load", target: ethcap });
+
+ const balance = {};
+ balance[WEETH_ADDRESS.ethereum] = tvl;
+
+ return balance;
};
-chains.forEach((chain) => {
- module.exports[chain] = {
- tvl: async (api) => {
- const cap = CAP_ADDRESS[chain] ?? '0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2'
- const tvl = await api.call({ abi: 'uint256:load', target: cap, })
- api.add(WEETH_ADDRESS[chain], tvl)
- },
- };
-});
+const ethVaultTVL = async (api) => {
+ const ethvault = vaults.ethereum;
+ return sumTokens2({ api, owner: ethvault, tokens: [VAULT_weETHs.ethereum] });
+};
+
+const scrollVaultTVL = async (api) => {
+ const vault = vaults.scroll;
+ return sumTokens2({ api, owner: vault, tokens: [WEETH_ADDRESS.scroll] });
+};
+
+const capTVL = (chain) => async (api) => {
+ const cap = CAP_ADDRESS[chain] ?? "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2";
+ const tvl = await api.call({ abi: "uint256:load", target: cap });
+ api.add(WEETH_ADDRESS[chain], tvl);
+};
+
+
+module.exports = {
+ ethereum: {
+ tvl: sdk.util.sumChainTvls([ethCapTVL, ethVaultTVL])
+ },
+ scroll: {
+ tvl: scrollVaultTVL,
+ },
+ arbitrum: {
+ tvl: capTVL("arbitrum"),
+ },
+ optimism: {
+ tvl: capTVL("optimism"),
+ },
+ mode: {
+ tvl: capTVL("mode"),
+ },
+ manta: {
+ tvl: capTVL("manta"),
+ },
+ blast: {
+ tvl: capTVL("blast"),
+ },
+ linea: {
+ tvl: capTVL("linea"),
+ },
+};
+
+
+
+
diff --git a/projects/mmo/helper/helper.js b/projects/mmo/helper/helper.js
index f92dee6d7d..2c7c59ff27 100644
--- a/projects/mmo/helper/helper.js
+++ b/projects/mmo/helper/helper.js
@@ -14,7 +14,7 @@ const MtrollerABI = {
async function fetch(query) {
var endpoint =
- "https://api.thegraph.com/subgraphs/name/ohan8/mmo-finance-active-loans";
+ sdk.graph.modifyEndpoint('DUQF7Lhwu1dzz2GwyNi3eRvjZeUnMNCDFjQRA8BYpoRJ');
var graphQLClient = new GraphQLClient(endpoint);
const results = await graphQLClient.request(query)
diff --git a/projects/moonbiz/index.js b/projects/moonbiz/index.js
deleted file mode 100644
index e316ff8a82..0000000000
--- a/projects/moonbiz/index.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const { uniTvlExport } = require("../helper/unknownTokens");
-
-const factory = "0x9B2593839E1390ECee3B348a47B3D93b2Ec2834C";
-
-module.exports = uniTvlExport('bsc', factory, { fetchBalances: true, })
diff --git a/projects/moonfarm.js b/projects/moonfarm.js
deleted file mode 100644
index 10b404a935..0000000000
--- a/projects/moonfarm.js
+++ /dev/null
@@ -1,77 +0,0 @@
-const utils = require('./helper/utils');
-const farmDataEndpoint = "https://marketcap.moonfarm.finance/get-farms-data"
-
-async function fetch() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlUSD
-}
-
-async function bsc() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlBSC
-}
-
-async function polygon() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlPoly
-}
-
-async function ethereum() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlETH
-}
-
-async function kava() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlKAVA
-}
-async function avalanche() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlAVAX
-}
-
-async function fantom() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlFANTOM
-}
-
-async function terra() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlLUNA
-}
-
-async function solana() {
- const data = await utils.fetchURL(farmDataEndpoint)
- return data.data.tvlSOLANA
-}
-
-module.exports = {
- bsc:{
- fetch:bsc
- },
- polygon:{
- fetch: polygon
- },
- ethereum:{
- fetch: ethereum
- },
- kava:{
- fetch: kava
- },
- avax:{
- fetch: avalanche
- },
- fantom:{
- fetch: fantom
- },
- terra:{
- fetch: terra
- },
- solana:{
- fetch: solana
- },
- fetch
-},
-module.exports.hallmarks = [
- [1651881600, "UST depeg"],
- ]
diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js
index c141c640b7..d6139ec2e2 100644
--- a/projects/morpho-blue/index.js
+++ b/projects/morpho-blue/index.js
@@ -1,45 +1,68 @@
-const { getLogs } = require('../helper/cache/getLogs')
+const { getLogs } = require("../helper/cache/getLogs");
const abi = require("../helper/abis/morpho.json");
module.exports = {
methodology: `Collateral (supply minus borrows) in the balance of the Morpho contracts`,
- doublecounted: true,
};
const config = {
- ethereum: { morphoBlue: '0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb', fromBlock: 18883124 }
-}
+ ethereum: {
+ morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
+ fromBlock: 18883124,
+ },
+ base: {
+ morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb",
+ fromBlock: 13977148,
+ },
+};
-Object.keys(config).forEach(chain => {
- const { morphoBlue, fromBlock } = config[chain]
+Object.keys(config).forEach((chain) => {
+ const { morphoBlue, fromBlock } = config[chain];
module.exports[chain] = {
tvl: async (api) => {
- const marketIds = await getMarkets(api)
- const tokens = (await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams })).map(i => [i.collateralToken, i.loanToken]).flat()
- return api.sumTokens({ owner: morphoBlue, tokens })
+ const marketIds = await getMarkets(api);
+ const tokens = (
+ await api.multiCall({
+ target: morphoBlue,
+ calls: marketIds,
+ abi: abi.morphoBlueFunctions.idToMarketParams,
+ })
+ )
+ .map((i) => [i.collateralToken, i.loanToken])
+ .flat();
+ return api.sumTokens({ owner: morphoBlue, tokens });
},
borrowed: async (api) => {
- const marketIds = await getMarkets(api)
- const marketInfo = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.idToMarketParams })
- const marketData = await api.multiCall({ target: morphoBlue, calls: marketIds, abi: abi.morphoBlueFunctions.market })
+ const marketIds = await getMarkets(api);
+ const marketInfo = await api.multiCall({
+ target: morphoBlue,
+ calls: marketIds,
+ abi: abi.morphoBlueFunctions.idToMarketParams,
+ });
+ const marketData = await api.multiCall({
+ target: morphoBlue,
+ calls: marketIds,
+ abi: abi.morphoBlueFunctions.market,
+ });
marketData.forEach((i, idx) => {
- api.add(marketInfo[idx].loanToken, i.totalBorrowAssets)
- })
- return api.getBalances()
+ api.add(marketInfo[idx].loanToken, i.totalBorrowAssets);
+ });
+ return api.getBalances();
},
- }
+ };
async function getMarkets(api) {
const logs = await getLogs({
- api, target: morphoBlue,
- skipCache: true,
- eventAbi: 'event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)',
- onlyArgs: true, fromBlock,
- topics: ['0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac'],
- })
- if(logs.length < 29){
- throw new Error("Missing markets!")
- }
- return logs.map(i => i.id)
+ api,
+ target: morphoBlue,
+ eventAbi:
+ "event CreateMarket(bytes32 indexed id, (address loanToken, address collateralToken, address oracle, address irm, uint256 lltv) marketParams)",
+ onlyArgs: true,
+ fromBlock,
+ topics: [
+ "0xac4b2400f169220b0c0afdde7a0b32e775ba727ea1cb30b35f935cdaab8683ac",
+ ],
+ });
+ return logs.map((i) => i.id);
}
-})
\ No newline at end of file
+});
diff --git a/projects/movegpt/index.js b/projects/movegpt/index.js
new file mode 100644
index 0000000000..75d2ac6e69
--- /dev/null
+++ b/projects/movegpt/index.js
@@ -0,0 +1,32 @@
+const { function_view } = require("../helper/chain/aptos");
+const MGPT_ADDRESS = '0x63be1898a424616367e19bbd881f456a78470e123e2770b5b5dcdceb61279c54::movegpt_token::MovegptCoin'
+const POOL_1 = "0xd22d0e14b278b8463c6a8c86baa0e89d1a982028c0d79b4c3584d74238a0dc6d"
+const POOL_2 = "0x9141a7ebbf2c8ab9101d6b657321e1cc78314b71b8e8780508986119660ffee8"
+
+async function get_staking(api) {
+ async function addBalance(pool) {
+ let [balance] = await function_view(
+ {
+ functionStr:
+ "0xccd92a8a4b4ee351190346bb04de9941b840bf42a2f003372ccec232d2b5bdcf::staking_fix_lock_duration::get_pool_staked_amount",
+ type_arguments: [MGPT_ADDRESS],
+ args: [pool]
+ }
+ )
+ api.addCGToken('movegpt', balance / 1e8)
+ }
+ await Promise.all([POOL_1, POOL_2].map(addBalance))
+}
+
+module.exports = {
+ timetravel: false,
+ methodology:
+ "TVL is calculated by summing the staked amounts in the specified staking pools on the Aptos blockchain.",
+ aptos: {
+ tvl: () => ({
+ }),
+ staking: async (api) => {
+ await get_staking(api)
+ },
+ }
+}
\ No newline at end of file
diff --git a/projects/munchables-season2/index.js b/projects/munchables-season2/index.js
new file mode 100644
index 0000000000..95d1cc941b
--- /dev/null
+++ b/projects/munchables-season2/index.js
@@ -0,0 +1,11 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+module.exports = {
+ blast: {
+ tvl: sumTokensExport({
+ owner: "0xEA091311Fc07139d753A6BBfcA27aB0224854Bae",
+ tokens: [ADDRESSES.null, ADDRESSES.blast.USDB, ADDRESSES.blast.WETH, ADDRESSES.blast.BLAST],
+ }),
+ },
+};
\ No newline at end of file
diff --git a/projects/mute-cl/index.js b/projects/mute-cl/index.js
new file mode 100644
index 0000000000..95093aa3e0
--- /dev/null
+++ b/projects/mute-cl/index.js
@@ -0,0 +1,10 @@
+
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = {
+ misrepresentedTokens: true,
+ ...uniV3Export({
+ era: { factory: '0x488A92576DA475f7429BC9dec9247045156144D3', fromBlock: 32830523},
+ })
+};
+
\ No newline at end of file
diff --git a/projects/mute/index.js b/projects/mute/index.js
index 110a1a2b27..831e482adb 100644
--- a/projects/mute/index.js
+++ b/projects/mute/index.js
@@ -4,6 +4,7 @@ const { getUniTVL } = require('../helper/unknownTokens');
const KOI = "0xa995ad25ce5eb76972ab356168f5e1d9257e4d05"
const veKOI = "0x98dB4e3Df6502369dAD7AC99f3aEE5D064721C4C"
+
module.exports = {
misrepresentedTokens: true,
era: {
@@ -12,3 +13,4 @@ module.exports = {
},
methodology: "Counts liquidity in pools and KOI token in the veKOI contract",
};
+
\ No newline at end of file
diff --git a/projects/mutuari/index.js b/projects/mutuari/index.js
new file mode 100644
index 0000000000..e7240c73e3
--- /dev/null
+++ b/projects/mutuari/index.js
@@ -0,0 +1,17 @@
+const { sumTokens2 } = require("../helper/unwrapLPs")
+
+async function tvl(api) {
+ const pool = await api.call({ target: '0x831fc32221924f8a6d47251327ef67ebcc5cd6dc', abi: "address:mutuariPool" })
+ const tokens = await api.call({ target: pool, abi: "address[]:getReserves" })
+ return sumTokens2({ api, owner: pool, tokens,})
+}
+async function borrowed(api) {
+ const [_, borrowed] = await api.call({ target: '0x831fc32221924f8a6d47251327ef67ebcc5cd6dc', abi: "function getGeneralInfo() view returns (uint256 totalSupplied, uint256 totalBorrowed)" })
+ api.addGasToken(borrowed)
+ return sumTokens2({ api })
+}
+
+module.exports = {
+ methodology: "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted.",
+ ftn: { tvl, borrowed },
+}
diff --git a/projects/myso-v2/index.js b/projects/myso-v2/index.js
index 6b7bd72a44..610e65d6bc 100644
--- a/projects/myso-v2/index.js
+++ b/projects/myso-v2/index.js
@@ -30,8 +30,8 @@ const getContracts = async (chainId) => {
const response = await get(
`https://api.myso.finance/chainIds/${chainId}/contracts`,
{
- decompress: false,
responseType: "stream",
+ decompress: false,
transformResponse: (data) => {
return data.pipe(zlib.createBrotliDecompress());
},
@@ -43,21 +43,19 @@ const getContracts = async (chainId) => {
return data.contracts;
};
-async function tvl(api) {
- const { fromBlock } = config[api.chain];
- let contracts;
+const CoveredCallStrategiesAbi =
+ "function strategies(uint256) view returns (address underlying, uint128 maxDeposits, uint128 minDeposits, uint128 startTime, uint128 tenor, uint128 minStrike, uint128 subscribeEndTime, uint256 totalDeposits, uint128 tokenRewardsPerDeposit)";
- try {
- contracts = await getContracts(api.chainId);
- await setCache("myso-v2", api.chain, contracts);
- } catch (e) {
- contracts = await getCache("myso-v2", api.chain);
- }
+const whaleMatchTotalSubscriptionsAbi =
+ "function totalSubscriptions(address) view returns (uint256)";
+const getBlitzMatchBalances = async (api, contracts, fromBlock) => {
const vaultFactory = contracts?.find(
(contract) => contract.type === "vault_factory"
)?.contractAddr;
+ if (!vaultFactory);
+
const logs = await getLogs({
api,
target: vaultFactory,
@@ -67,6 +65,8 @@ async function tvl(api) {
fromBlock,
});
+ if (!logs.length) return;
+
let ownerTokens = logs.map((i) => {
return [
contracts
@@ -76,10 +76,88 @@ async function tvl(api) {
];
});
- return sumTokens2({
+ return sumTokens2({ api, ownerTokens });
+};
+
+const getCoveredCallOfTheWeekBalances = async (api, contracts) => {
+ const coveredCallOfTheWeeks = contracts?.filter(
+ (contract) => contract.type === "p2p"
+ );
+
+ if (!coveredCallOfTheWeeks) return;
+
+ const coveredCallOfTheWeekStrategies = await api.multiCall({
+ calls: coveredCallOfTheWeeks.map((contract) => ({
+ target: contract?.contractAddr,
+ params: [contract.poolData.strategyId],
+ })),
+ abi: CoveredCallStrategiesAbi,
+ });
+
+ if (!coveredCallOfTheWeekStrategies.length) return;
+
+ coveredCallOfTheWeekStrategies.forEach((strategy) =>
+ api.add(strategy.underlying, strategy.totalDeposits)
+ );
+};
+
+const getWhaleMatchBalances = async (api, contracts, fromBlock) => {
+ const fundingPoolFactory = contracts.find(
+ (contract) => contract.type === "funding_pool_factory"
+ )?.contractAddr;
+
+ const fundingPools =
+ contracts.filter((contract) => contract.type === "funding_pool") || [];
+
+ if (!(fundingPoolFactory && fundingPools.length)) return;
+
+ const logs = await getLogs({
api,
- ownerTokens,
+ target: fundingPoolFactory,
+ eventAbi:
+ "event LoanProposalCreated(address indexed loanProposalAddr, address indexed fundingPool, address indexed sender, address collToken, uint256 arrangerFee, uint256 unsubscribeGracePeriod, uint256 numLoanProposals)",
+ onlyArgs: true,
+ fromBlock,
+ });
+
+ if (logs.length) {
+ const loanProposalBalances = await api.multiCall({
+ calls: logs.map((log) => ({
+ target: log?.fundingPool,
+ params: [log.loanProposalAddr],
+ })),
+ abi: whaleMatchTotalSubscriptionsAbi,
+ });
+ const tokens = await api.multiCall({
+ abi: "address:depositToken",
+ calls: logs.map((log) => log.fundingPool),
+ });
+ api.add(tokens, loanProposalBalances);
+ }
+
+ let tokensAndOwners = fundingPools.map((fundingPool) => {
+ return [fundingPool.loanCcyToken, fundingPool.contractAddr];
});
+
+ return sumTokens2({ api, tokensAndOwners });
+};
+
+async function tvl(api) {
+ const { fromBlock } = config[api.chain];
+
+ let contracts;
+
+ try {
+ contracts = await getContracts(api.chainId);
+ await setCache("myso-v2", api.chain, contracts);
+ } catch (e) {
+ contracts = await getCache("myso-v2", api.chain);
+ }
+
+ await getBlitzMatchBalances(api, contracts, fromBlock);
+ await getCoveredCallOfTheWeekBalances(api, contracts);
+
+ return getWhaleMatchBalances(api, contracts, fromBlock);
}
const config = {
@@ -107,6 +185,9 @@ const config = {
linea: {
fromBlock: 2118418,
},
+ sei: {
+ fromBlock: 79773668,
+ },
};
Object.keys(config).forEach((chain) => {
diff --git a/projects/napier/index.js b/projects/napier/index.js
new file mode 100644
index 0000000000..9db00cf28f
--- /dev/null
+++ b/projects/napier/index.js
@@ -0,0 +1,56 @@
+
+const { getLogs2 } = require("../helper/cache/getLogs");
+
+// https://docs.napier.finance/contract-and-integrations/deployed-contracts
+const config = {
+ ethereum: {
+ pool_factory: {
+ address: "0x17354e8e7518599c7f6B7095a6706766e4e4dC61",
+ deployedAt: 20212038,
+ },
+ tranche_factory: {
+ address: "0x83CE9e95118b48DfED91632e1bB848f1D4ee12e3",
+ deployedAt: 20017932,
+ },
+ },
+}
+
+Object.keys(config).map((network) => {
+ const { tranche_factory, pool_factory } = config[network];
+ module.exports[network] = {
+ tvl: async (api) => {
+ const trancheDeployedLogs = tranche_factory.address ? await getLogs2({
+ api,
+ target: tranche_factory.address,
+ eventAbi:
+ "event TrancheDeployed(uint256 indexed maturity, address indexed principalToken, address indexed yieldToken)",
+ fromBlock: tranche_factory.deployedAt,
+ extraKey: 'v1'
+ }) : [];
+
+ const tranches = trancheDeployedLogs.map((event) => event.principalToken);
+
+ // fetch deployed pools
+ const poolDeployedLogs = pool_factory.address ? await getLogs2({
+ api,
+ target: pool_factory.address,
+ eventAbi: "event Deployed(address indexed basePool, address indexed underlying, address indexed pool)",
+ fromBlock: pool_factory.deployedAt,
+ extraKey: 'v1'
+ }) : [];
+
+ const pools = poolDeployedLogs.map((event) => event.pool)
+
+ // fetch adapter contracts
+ const results = await api.multiCall({
+ abi: "function getSeries() external view returns (tuple(address underlying, address target, address yt, address adapter, uint256 mscale, uint256 maxscale, uint64 issuanceFee, uint64 maturity))",
+ calls: tranches,
+ });
+ const adapters = results.map((r) => r.adapter);
+ const underlyingTokens = results.map((r) => r.underlying);
+ const adapterBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: adapters })
+ api.add(underlyingTokens, adapterBalances)
+ return api.erc4626Sum({ calls: pools, tokenAbi: 'underlying', balanceAbi: 'totalUnderlying' })
+ },
+ };
+});
diff --git a/projects/native-lend/index.js b/projects/native-lend/index.js
new file mode 100644
index 0000000000..bc24c5182b
--- /dev/null
+++ b/projects/native-lend/index.js
@@ -0,0 +1,26 @@
+
+const { compoundExports2 } = require("../helper/compound");
+const { lendingMarket } = require("../helper/methodologies");
+
+module.exports = {
+ methodology: lendingMarket
+};
+
+const config = {
+ arbitrum: "0x795E5cCdd008637EB98c64958d3b8Ba3e6DE2d2B",
+ zklink: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059",
+ bsc: "0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9",
+ mantle:"0x48A6FE0Fa8DfF6D290Bd21aB6BCC1DDAeb9f2D0e",
+ ethereum:"0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9"
+
+};
+
+Object.keys(config).forEach((chain) => {
+ const comptroller = config[chain];
+ module.exports[chain] = compoundExports2({ comptroller })
+ module.exports[chain].tvl = async (api) => {
+ const markets = await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })
+ const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets})
+ return api.sumTokens({ owner: comptroller, tokens })
+ }
+})
\ No newline at end of file
diff --git a/projects/native/index.js b/projects/native/index.js
index 7ce6e10ca0..af1278d2f8 100644
--- a/projects/native/index.js
+++ b/projects/native/index.js
@@ -3,7 +3,7 @@ const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");
module.exports = {
methodology:
- "includes the liquidity provided to the infrasturcture and ecosystem of Native",
+ "Counts the inventory held by Native's Partnered Market Makers used to facilitate slippage free swaps on the protocol",
};
const config = {
@@ -26,8 +26,6 @@ const config = {
avax: {
factory: "0x85b0F66E83515ff4e825DfCAa58E040E08278EF9",
fromBlock: 34309521,
- vault: "0xbe5D56B08055d7b6e9f780DfeA262512a2D2d950",
- vaultFromBlock: 42536874,
},
mantle: {
factory: "0x4c34BA0103b8417e1Fc4D0F6645828B2d6d207F9",
@@ -44,8 +42,6 @@ const config = {
zklink: {
factory: "0x335c04321E88631A99F78fD7D7C4f49A921ed924",
fromBlock: 443,
- vault: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059",
- vaultFromBlock: 452,
},
};
@@ -53,27 +49,6 @@ Object.keys(config).forEach((chain) => {
const { factory, fromBlock, vault, vaultFromBlock } = config[chain];
module.exports[chain] = {
tvl: async (api) => {
- // tvl from aqua
- // read from AquaVault to get allMarkets and the token list
- // sum the balance of those tokens in the vault
- if (vault) {
- const lpTokenCreationLogs = await getLogs({
- api,
- target: vault,
- topic: "MarketListed(address)",
- eventAbi: "event MarketListed(address lpToken)",
- onlyArgs: true,
- fromBlock: vaultFromBlock,
- });
- const lpTokens = lpTokenCreationLogs.map((i) => i.lpToken);
- // get underlying of each ctoken
- const underlyingTokens = await api.multiCall({
- abi: "address:underlying",
- calls: lpTokens,
- });
- // get balances in vault
- await sumTokens2({ api, owner: vault, tokens: underlyingTokens });
- }
// tvl from factory
const poolCreationLogs = await getLogs({
api,
diff --git a/projects/navi/index.js b/projects/navi/index.js
index 4c35743ae7..24a12baa10 100644
--- a/projects/navi/index.js
+++ b/projects/navi/index.js
@@ -13,10 +13,10 @@ async function borrow(api) {
const storageObject = await sui.getObject(storageId);
const reservesId = storageObject.fields.reserves.fields.id.id
- const dynamicFields = await sui.getDynamicFieldObjects({parent: reservesId})
+ const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId })
dynamicFields.forEach((data) => {
const coin = '0x' + data.fields.value.fields.coin_type
- const borrowed = data.fields.value.fields.borrow_balance.fields.total_supply
+ const borrowed = data.fields.value.fields.borrow_balance.fields.total_supply * data.fields.value.fields.current_borrow_index / 1e27
const amount = borrowed * (10 ** (decimalShift[coin] ?? 0))
api.add(coin, amount)
})
@@ -27,16 +27,18 @@ async function tvl(api) {
const storageObject = await sui.getObject(storageId);
const reservesId = storageObject.fields.reserves.fields.id.id
- const dynamicFields = await sui.getDynamicFieldObjects({parent: reservesId})
+ const dynamicFields = await sui.getDynamicFieldObjects({ parent: reservesId })
+
dynamicFields.forEach(object => {
const coin = '0x' + object.fields.value.fields.coin_type
- const total_supply = object.fields.value.fields.supply_balance.fields.total_supply
- const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply
+ const total_supply = object.fields.value.fields.supply_balance.fields.total_supply * object.fields.value.fields.current_supply_index / 1e27
+ const borrowed = object.fields.value.fields.borrow_balance.fields.total_supply * object.fields.value.fields.current_borrow_index / 1e27
const amount = (total_supply - borrowed) * (10 ** (decimalShift[coin] ?? 0))
api.add(coin, amount)
})
}
+
module.exports = {
timetravel: false,
sui: {
diff --git a/projects/netweave-lending/index.js b/projects/netweave-lending/index.js
new file mode 100644
index 0000000000..a58faf317d
--- /dev/null
+++ b/projects/netweave-lending/index.js
@@ -0,0 +1,7 @@
+const { compoundExports2 } = require("../helper/compound");
+
+module.exports = {
+ mode: compoundExports2({
+ comptroller: '0x86112d3176c537B953560EA6fE43f79382E7bffE',
+ })
+}
diff --git a/projects/netweave-vault/index.js b/projects/netweave-vault/index.js
new file mode 100644
index 0000000000..359cd5b119
--- /dev/null
+++ b/projects/netweave-vault/index.js
@@ -0,0 +1,12 @@
+const { yieldHelper } = require("../helper/yieldHelper")
+
+const vault = '0x28d46E6A97273865561142124056eb3243568d3C'
+const abis = {
+ poolInfo: 'function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, uint256 accSushiPerShare, uint256 amount, address strat)',
+}
+module.exports = yieldHelper({
+ project: 'NetWeave',
+ chain: 'mode',
+ masterchef: vault,
+ abis,
+})
diff --git a/projects/nexus/index.js b/projects/nexus/index.js
index 19945adcae..7a63c3a307 100644
--- a/projects/nexus/index.js
+++ b/projects/nexus/index.js
@@ -1,22 +1,14 @@
-const { sumTokens2 } = require('../helper/unwrapLPs');
-
-const pools = [
- '0xcafeaBED7e0653aFe9674A3ad862b78DB3F36e60' // current pool
-];
-const yieldPools = [
- '0x27f23c710dd3d878fe9393d93465fed1302f2ebd'
-]
-const getAssetsABI = "function getAssets() view returns (tuple(address assetAddress, bool isCoverAsset, bool isAbandoned)[])"
async function tvl(api) {
- const assets = await api.multiCall({ abi: getAssetsABI, calls: pools})
- const ownerTokens = assets.map((v, i) => [v.map(i => i.assetAddress), pools[i]])
- const assets2 = await api.multiCall({ abi: 'address[]:getTrackedAssets', calls: yieldPools })
- assets2.forEach((v, i) => ownerTokens.push([v, yieldPools[i]]))
- return sumTokens2({ api, ownerTokens, blacklistedTokens: yieldPools})
+ const MasterProxy = '0x01BFd82675DBCc7762C84019cA518e701C0cD07e'
+ // const bytes2 = ethers.utils.formatBytes32String('P1').slice(0, 4) // '0x5031
+ const P1Address = await api.call({ abi: 'function getLatestAddress(bytes2) view returns (address)', target: MasterProxy, params: '0x5031' })
+ const ethValue = await api.call({ abi: 'uint256:getPoolValueInEth', target: P1Address})
+ api.addGasToken(ethValue)
}
module.exports = {
+ misrepresentedTokens: true,
start: 1558569600, // 05/23/2019 @ 12:00am (UTC)
ethereum: { tvl }
}
diff --git a/projects/nftperp/index.js b/projects/nftperp/index.js
index 78cac076fa..21642440bd 100644
--- a/projects/nftperp/index.js
+++ b/projects/nftperp/index.js
@@ -19,6 +19,16 @@ module.exports = {
[ADDRESSES.blast.WETH, "0xFfc0555EC5F5C44A6B529Cef94b9055799696272"],
// Insurance fund
[ADDRESSES.blast.WETH, "0xe2F4A2845D4183F7913EC66945b20E4c0c15DAFf"],
+ // DEX Ordinals
+ [
+ "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692",
+ "0x0C2309C6554AabBFBcA7d5219545795DcAF6f4A9",
+ ],
+ // Insurance fund Ordinals
+ [
+ "0xF7bc58b8D8f97ADC129cfC4c9f45Ce3C0E1D2692",
+ "0x0b32E91C276377b3b3CdB332e902207Defe542bd",
+ ],
],
}),
},
diff --git a/projects/nftx/index.js b/projects/nftx/index.js
index c1513efb18..b7708f1abb 100644
--- a/projects/nftx/index.js
+++ b/projects/nftx/index.js
@@ -1,119 +1,27 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { gql } = require("graphql-request");
-const { blockQuery } = require('../helper/http')
-const { getTokenPrices } = require('../helper/unknownTokens')
-const sdk = require('@defillama/sdk')
-const { getChainTransform } = require('../helper/portedTokens')
+const { getLogs2 } = require('../helper/cache/getLogs')
+const { sumTokens2 } = require('../helper/unwrapLPs')
const config = {
- ethereum: {
- weth: ADDRESSES.ethereum.WETH,
- graphUrl: 'https://graph-proxy.nftx.xyz/c/shared/subgraphs/name/nftx-project/nftx-v2-1-mainnet'
- },
- arbitrum: {
- weth: ADDRESSES.arbitrum.WETH,
- graphUrl: 'https://graph-proxy.nftx.xyz/shared/subgraphs/name/nftx-project/nftx-v2-arbitrum'
- },
+ ethereum: { factory: '0xBE86f647b167567525cCAAfcd6f881F1Ee558216', fromBlock: 12675821, },
+ arbitrum: { factory: '0xE77b89FEc41A7b7dC74eb33602e82F0672FbB33C', fromBlock: 12080098, },
}
-function getTvl(chain) {
- const { weth, graphUrl } = config[chain]
- return async (api) => {
- const { vaults } = await blockQuery(graphUrl, graphQuery, { api })
- const block = api.block
- const LPs = new Set(vaults.map(v => v.lpStakingPool.stakingToken.id))
- const tokens = new Set(vaults.map(v => v.token.id))
- const transform = await getChainTransform(chain)
-
- const weth_balances = await sdk.api.abi.multiCall({
- abi: 'erc20:balanceOf',
- calls: Array.from(LPs).map(lp => ({
- target: weth,
- params: lp
- })),
- block, chain,
- })
-
- const token_balances = await sdk.api.abi.multiCall({
- abi: 'erc20:totalSupply',
- calls: Array.from(tokens).map(token => ({
- target: token,
- })),
- block, chain,
- })
-
- const balances = {}
-
- sdk.util.sumMultiBalanceOf(balances, token_balances)
- //sdk.util.sumMultiBalanceOf(balances, weth_balances)
-
- const lps = weth_balances.output
- .filter(({ output }) => +output > 2 * 1e18) // only pick pools with minimum 2 eth in it
- .map(({ input }) => input.params[0])
-
- const { updateBalances, prices } = await getTokenPrices({
- block, useDefaultCoreAssets: true, lps, allLps: true, chain,
- })
-
- const print = []
- vaults.forEach(vault => {
- const price = prices[vault.token.id]
- const balance = (balances[vault.token.id] || 0) / 1e18
- if (!price || !balance) return;
- const total = balance * price[1]
- if (total < 50) return;
- print.push({ id: vault.token.id, balance, name: vault.token.name, val: total })
- })
- print.sort((a, b) => b.val - a.val)
-
- updateBalances(balances)
- const transformedBalances = {}
- Object.entries(balances).forEach(([token, balance]) => sdk.util.sumSingleBalance(transformedBalances, transform(token), balance))
-
- return transformedBalances
- }
-}
-
module.exports = {
- methodology: "Counts total value of all vaults",
- ethereum: { tvl: getTvl('ethereum') },
- arbitrum: { tvl: getTvl('arbitrum') },
+ methodology: "Counts total value of nfts in all the vaults",
}
-const graphQuery = gql`
-query get_vaults($block: Int) {
- vaults(
- first: 1000,
- where: { vaultId_gte: 0 },
- block: { number: $block }
- ) {
- vaultId
- id
- is1155
- isFinalized
- totalHoldings
- allocTotal
- token {
- id
- name
- symbol
- }
- asset {
- id
- name
- symbol
- }
- lpStakingPool {
- stakingToken {
- id
- name
- symbol
- }
- rewardToken{
- id
- name
- symbol
- }
+Object.keys(config).forEach(chain => {
+ const { factory, fromBlock, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ if (chain === 'arbitrum') return {} // we dont price any token in arbitrum
+ const logs = await getLogs2({
+ api,
+ factory,
+ eventAbi: 'event NewVault (uint256 indexed vaultId, address vaultAddress, address assetAddress)',
+ fromBlock,
+ })
+ const tokensAndOwners = logs.map(log => [log.assetAddress, log.vaultAddress])
+ return sumTokens2({ api, tokensAndOwners, permitFailure: true })
}
}
-}
-`
\ No newline at end of file
+})
diff --git a/projects/nimbora-yield-aggregator/index.js b/projects/nimbora-yield-aggregator/index.js
new file mode 100644
index 0000000000..e2b6102614
--- /dev/null
+++ b/projects/nimbora-yield-aggregator/index.js
@@ -0,0 +1,42 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { call, parseAddress } = require('../helper/chain/starknet')
+const { getConfig } = require('../helper/cache')
+const { get } = require('../helper/http')
+
+const totalAssetsAbi = {
+ "name": "total_assets",
+ "type": "function",
+ "inputs": [],
+ "outputs": [
+ {
+ "name": "totalAssets",
+ "type": "Uint256"
+ }
+ ],
+ "stateMutability": "view"
+}
+
+async function fetcher() {
+ return get('https://stats.nimbora.io/aggregator/strategies', {
+ headers: {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
+ }
+ })
+}
+
+async function tvl(api) {
+ const strategyData = await getConfig('nimbora-yield-aggregator', undefined, { fetcher })
+ for (let index = 0; index < strategyData.length; index++) {
+ const strategyInfo = strategyData[index];
+ const underlying = parseAddress(strategyInfo.underlying);
+ const strategyTvl = await call({ target: strategyInfo.vault, abi: totalAssetsAbi });
+ api.add(underlying, strategyTvl)
+ }
+}
+
+module.exports = {
+ methodology: 'Computed by summing the total assets held by each vault aggregator.',
+ starknet: {
+ tvl
+ },
+}
diff --git a/projects/nimbora-yield/index.js b/projects/nimbora-yield/index.js
new file mode 100644
index 0000000000..41ba202628
--- /dev/null
+++ b/projects/nimbora-yield/index.js
@@ -0,0 +1,42 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { call, parseAddress } = require('../helper/chain/starknet')
+const { getConfig } = require('../helper/cache')
+const { get } = require('../helper/http')
+
+const totalAssetsAbi = {
+ "name": "total_assets",
+ "type": "function",
+ "inputs": [],
+ "outputs": [
+ {
+ "name": "totalAssets",
+ "type": "Uint256"
+ }
+ ],
+ "stateMutability": "view"
+}
+
+async function fetcher() {
+ return get('https://backend.nimbora.io/yield-dex/strategies', {
+ headers: {
+ 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36'
+ }
+ })
+}
+
+async function tvl(api) {
+ const strategyData = await getConfig('nimbora-yield', undefined, { fetcher })
+ for (let index = 0; index < strategyData.length; index++) {
+ const strategyInfo = strategyData[index];
+ const underlying = parseAddress(strategyInfo.underlying) == "0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad" ? ADDRESSES.starknet.DAI : parseAddress(strategyInfo.underlying);
+ const strategyTvl = await call({ target: strategyInfo.tokenManager, abi: totalAssetsAbi });
+ api.add(underlying, strategyTvl)
+ }
+}
+
+module.exports = {
+ methodology: 'Computed by summing the total assets held by each strategy.',
+ starknet: {
+ tvl
+ },
+}
diff --git a/projects/nirvana/index.js b/projects/nirvana/index.js
index e8a081314d..8a4788dd2e 100644
--- a/projects/nirvana/index.js
+++ b/projects/nirvana/index.js
@@ -1,21 +1,18 @@
-const { getTokenBalance, getTokenAccountBalance, } = require('../helper/solana');
+const { sumTokens2 } = require('../helper/solana');
const ANA = "ANAxByE6G2WjFp7A4NqtWYXb3mgruyzZYg3spfxe6Lbo";
const stakingContract = "CxuuSEv67PzNkMxqCvHeDUr6HKaadoz8NhTfxbQSJnaG";
async function staking() {
- const balance = await getTokenBalance(ANA, stakingContract);
- return { 'nirvana-ana': balance };
+ return sumTokens2({ tokensAndOwners: [[ANA, stakingContract]] });
}
+
async function tvl() {
- return {
- 'tether': await getTokenAccountBalance('EwQa93fpN2a6smD7EBFjQEyDt3DP8EMLHLjgAWxG9Qhj'),
- 'usd-coin': await getTokenAccountBalance('6t7ViNDULtkgvmntHsmi1QV73Tez7ZcX6DJvARHkfUJZ'),
- };
+ return sumTokens2({ tokenAccounts: ['EwQa93fpN2a6smD7EBFjQEyDt3DP8EMLHLjgAWxG9Qhj', '6t7ViNDULtkgvmntHsmi1QV73Tez7ZcX6DJvARHkfUJZ',] })
}
module.exports = {
hallmarks: [
- [1659009600,"Flash-Loan & Price Manipulation Attack"]
+ [1659009600, "Flash-Loan & Price Manipulation Attack"]
],
timetravel: false,
methodology:
@@ -24,4 +21,5 @@ module.exports = {
tvl,
staking,
},
+ deadFrom: 1669009600,
};
\ No newline at end of file
diff --git a/projects/nolus/index.js b/projects/nolus/index.js
index 2be45251c9..b1983f2736 100644
--- a/projects/nolus/index.js
+++ b/projects/nolus/index.js
@@ -1,71 +1,31 @@
-const sdk = require("@defillama/sdk");
-const { transformBalances } = require("../helper/portedTokens");
+const sdk = require('@defillama/sdk')
+const { transformBalances } = require('../helper/portedTokens')
const { queryContract, queryManyContracts, queryContracts } = require('../helper/chain/cosmos')
-// Osmosis
-const osmosisLeaserAddr = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f'
-const osmosisAxlLppAddr = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5'
+// Osmosis Noble USDC Protocol Contracts (OSMOSIS-OSMOSIS-USDC_NOBLE) pirin-1
+const osmosisNobleOracleAddr = 'nolus1vjlaegqa7ssm2ygf2nnew6smsj8ref9cmurerc7pzwxqjre2wzpqyez4w6'
const osmosisNobleLppAddr = 'nolus1ueytzwqyadm6r0z8ajse7g6gzum4w3vv04qazctf8ugqrrej6n4sq027cf'
+const osmosisNobleLeaserAddr = 'nolus1dca9sf0knq3qfg55mv2sn03rdw6gukkc4n764x5pvdgrgnpf9mzsfkcjp6'
+
+// Osmosis axlUSDC Protocol Contracts (OSMOSIS-OSMOSIS-USDC_AXELAR) pirin-1
+const osmosisAxlOracleAddr = 'nolus1vjlaegqa7ssm2ygf2nnew6smsj8ref9cmurerc7pzwxqjre2wzpqyez4w6'
+const osmosisAxlLeaserAddr = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f'
+const osmosisAxlLppAddr = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5'
-// Neutron (Astroport)
-const neutronLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8'
-const neutronLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94'
+// Astroport Protocol Contracts (NEUTRON-ASTROPORT-USDC_AXELAR) pirin-1
+const astroportOracleAddr = 'nolus1jew4l5nq7m3xhkqzy8j7cc99083m5j8d9w004ayyv8xl3yv4h0dql2dd4e'
+const astroportLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94'
+const astroportLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8'
const _6Zeros = 1000000
-const denomsMapping = {
- "neutron": {
- "ATOM": "ibc/C4CFF46FD6DE35CA4CF4CE031E643C8FDC9BA4B99AE598E9B0ED98FE3A2319F9",
- "DYDX": "ibc/2CB87BCE0937B1D1DFCEE79BE4501AAF3C265E923509AEAC410AD85D27F35130",
- "NLS": "ibc/6C9E6701AC217C0FC7D74B0F7A6265B9B4E3C3CDA6E80AADE5F950A8F52F9972",
- "NTRN": "neutron:untrn",
- "ST_ATOM": "ibc/B7864B03E1B9FD4F049243E92ABD691586F682137037A9F3FCA5222815620B3C",
- "ST_TIA": "ibc/6569E05DEE32B339D9286A52BE33DFCEFC97267F23EF9CFDE0C055140967A9A5",
- "STK_ATOM": "ibc/3649CE0C8A2C79048D8C6F31FF18FA69C9BC7EB193512E0BD03B733011290445",
- "TIA": "ibc/773B4D0A3CD667B2275D5A4A7A2F0909C0BA0F4059C0B9181E680DDF4965DCC7",
- "USDC_AXELAR": "ibc/F082B65C88E4B6D5EF1DB243CDA1D331D002759E938A0F5CD3FFDC5D53B3E349",
- "USDC_NOBLE": "ibc/B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81"
- },
- "osmosis": {
- "AKT": "ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4",
- "ATOM": "ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2",
- "AXL": "ibc/903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E",
- "CRO": "ibc/E6931F78057F7CC5DA0FD6CEF82FF39373A6E0452BF1FD76910B93292CF356C1",
- "DYM": "ibc/9A76CDF0CBCEF37923F32518FA15E5DC92B9F56128292BC4D63C4AEA76CBB110",
- "EVMOS": "ibc/6AE98883D4D5D5FF9E50D7130F1305DA2FFA0C652D1DD9C123657C6B4EB2DF8A",
- "INJ": "ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273",
- "JKL": "ibc/8E697BDABE97ACE8773C6DF7402B2D1D5104DD1EEABE12608E3469B7F64C15BA",
- "JUNO": "ibc/46B44899322F3CD854D2D46DEEF881958467CDD4B3B10086DA49296BBED94BED",
- "LVN": "factory/osmo1mlng7pz4pnyxtpq0akfwall37czyk9lukaucsrn30ameplhhshtqdvfm5c/ulvn",
- "MARS": "ibc/573FCD90FACEE750F55A8864EF7D38265F07E5A9273FA0E8DAFD39951332B580",
- "MILK_TIA": "factory/osmo1f5vfcph2dvfeqcqkhetwv75fda69z7e5c2dldm3kvgj23crkv6wqcn47a0/umilkTIA",
- "NLS": "ibc/D9AFCECDD361D38302AA66EB3BAC23B95234832C51D12489DC451FA2B7C72782",
- "OSMO": "osmosis:uosmo",
- "PICA": "ibc/56D7C03B8F6A07AD322EEE1BEF3AE996E09D1C1E34C27CF37E0D4A0AC5972516",
- "Q_ATOM": "ibc/FA602364BEC305A696CBDF987058E99D8B479F0318E47314C49173E8838C5BAC",
- "QSR": "ibc/1B708808D372E959CD4839C594960309283424C775F4A038AAEBE7F83A988477",
- "SCRT": "ibc/0954E1C28EB7AF5B72D24F3BC2B47BBB2FDF91BDDFD57B74B99E133AED40972A",
- "ST_ATOM": "ibc/C140AFD542AE77BD7DCC83F13FDD8C5E5BB8C4929785E6EC2F4C636F98F17901",
- "ST_OSMO": "ibc/D176154B0C63D1F9C6DCFB4F70349EBF2E2B5A87A05902F57A6AE92B863E9AEC",
- "ST_TIA": "ibc/698350B8A61D575025F3ED13E9AC9C0F45C89DEFE92F76D5838F1D3C1A7FF7C9",
- "STARS": "ibc/987C17B11ABC2B20019178ACE62929FE9840202CE79498E29FE8E5CB02B7C0A4",
- "STK_ATOM": "ibc/CAA179E40F0266B0B29FB5EAA288FB9212E628822265D4141EBD1C47C3CBFCBC",
- "STRD": "ibc/A8CA5EE328FA10C9519DF6057DA1F69682D28F7D0F5CCC7ECB72E3DCA2D157A4",
- "TIA": "ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877",
- "USDC": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858",
- "USDC_AXELAR": "ibc/D189335C6E4A68B513C10AB227BF1C1D38C746766278BA3EEB4FB14124F1D858",
- "USDC_NOBLE": "ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4",
- "WBTC": "ibc/D1542AA8762DB13087D8364F3EA6509FD6F009A34F00426AF9E4F9FA85CBBF1F",
- "WETH": "ibc/EA1D43981D5C9A1C4AAEA9C23BB1D4FA126BA9BC7020A25E0AE4AA841EA25DC5"
- }
+
+const nativeTokens = {
+ 'untrn': 'neutron:untrn',
+ 'uosmo': 'osmosis:uosmo'
}
async function getLeaseCodeId(leaserAddress) {
- const leaserContract = await queryContract({
- contract: leaserAddress,
- chain: "nolus",
- data: { config: {} }
- })
-
+ const leaserContract = await queryContract({ contract: leaserAddress, chain: 'nolus', data: { 'config': {} } })
const leaseCodeId = leaserContract?.config?.lease_code
if (!leaseCodeId) {
return 0
@@ -75,27 +35,15 @@ async function getLeaseCodeId(leaserAddress) {
}
async function getLeaseContracts(leaseCodeId) {
- return await queryContracts({
- chain: "nolus",
- codeId: leaseCodeId,
- })
+ return await queryContracts({ chain: 'nolus', codeId: leaseCodeId, })
}
async function getLeases(leaseAddresses) {
- return await queryManyContracts({
- permitFailure: true,
- contracts: leaseAddresses,
- chain: "nolus",
- data: {}
- })
+ return await queryManyContracts({ permitFailure: true, contracts: leaseAddresses, chain: 'nolus', data: {} })
}
async function getLppTvl(lppAddresses) {
- const lpps = await queryManyContracts({
- contracts: lppAddresses,
- chain: "nolus",
- data: { "lpp_balance": [] },
- })
+ const lpps = await queryManyContracts({ contracts: lppAddresses, chain: 'nolus', data: { 'lpp_balance': [] } })
let totalLpp = 0
lpps.forEach(v => {
@@ -105,45 +53,65 @@ async function getLppTvl(lppAddresses) {
return totalLpp / _6Zeros
}
-function sumAssests(chain, leases) {
- let balances = {}
+function sumAssests(balances, leases, currencies) {
leases.forEach(v => {
if (v.opened) {
- const ticker = v.opened.amount.ticker
+ let ticker = v.opened.amount.ticker
const amount = parseInt(v.opened.amount.amount, 10)
- const denom = denomsMapping[chain][ticker]
- sdk.util.sumSingleBalance(balances, denom, amount)
+ const currencyData = find(currencies, (n) => n.ticker == ticker)
+ if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) {
+ sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount)
+ }
+ sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount)
}
})
- return balances
}
-async function tvl(chain, leaserAddr) {
- const leaseCodeId = await getLeaseCodeId(leaserAddr)
- const leaseContracts = await getLeaseContracts(leaseCodeId)
- const leases = await getLeases(leaseContracts)
- const balances = sumAssests(chain, leases)
- return transformBalances("nolus", balances);
+function find (collection, predicate) {
+ for (let i = 0; i < collection.length; i++) {
+ if (predicate(collection[i])) {
+ return collection[i];
+ }
+ }
+ return undefined;
+}
+
+async function tvl(protocols) {
+ let balances = {}
+ for (let i = 0; i < protocols.length; i++) {
+ const p = protocols[i]
+ const oracleData = await queryContract({ contract: p.oracle, chain: 'nolus', data: { 'currencies': {} } })
+ const leaseCodeId = await getLeaseCodeId(p.leaser)
+ const leaseContracts = await getLeaseContracts(leaseCodeId)
+ const leases = await getLeases(leaseContracts)
+ sumAssests(balances, leases, oracleData)
+ }
+ return transformBalances('nolus', balances)
}
module.exports = {
- methodology: "The combined total of lending pool assets and the current market value of active leases",
+ methodology: 'The combined total of lending pool assets and the current market value of active leases',
nolus: {
tvl: async () => {
return {
- 'axlusdc': await getLppTvl([osmosisAxlLppAddr, neutronLppAddr]),
+ 'axlusdc': await getLppTvl([osmosisAxlLppAddr, astroportLppAddr]),
'usd-coin': await getLppTvl([osmosisNobleLppAddr])
}
}
},
neutron: {
tvl: async () => {
- return await tvl("neutron", neutronLeaserAddr)
+ return await tvl([
+ { leaser: astroportLeaserAddr, oracle: astroportOracleAddr }
+ ])
}
},
osmosis: {
tvl: async () => {
- return await tvl("osmosis", osmosisLeaserAddr)
+ return await tvl([
+ { leaser: osmosisNobleLeaserAddr, oracle: osmosisNobleOracleAddr },
+ { leaser: osmosisAxlLeaserAddr, oracle: osmosisAxlOracleAddr },
+ ])
}
}
}
diff --git a/projects/nostra/index.js b/projects/nostra/index.js
index b16b13d9d7..e8034e051c 100644
--- a/projects/nostra/index.js
+++ b/projects/nostra/index.js
@@ -17,7 +17,7 @@ const supplyTokens = [
"0x05dcd26c25d9d8fd9fc860038dcb6e4d835e524eb8a85213a8cda5b7fff845f6",
"0x06eda767a143da12f70947192cd13ee0ccc077829002412570a88cd6539c1d85",
"0x05f296e1b9f4cf1ab452c218e72e02a8713cee98921dad2d3b5706235e128ee4",
- // DAI
+ // DAIv0
"0x022ccca3a16c9ef0df7d56cbdccd8c4a6f98356dfd11abc61a112483b242db90",
"0x04f18ffc850cdfa223a530d7246d3c6fc12a5969e0aa5d4a88f470f5fe6c46e9",
"0x02b5fd690bb9b126e3517f7abfb9db038e6a69a068303d06cf500c49c1388e20",
@@ -52,6 +52,16 @@ const supplyTokens = [
"0x2a3a9d7bcecc6d3121e3b6180b73c7e8f4c5f81c35a90c8dd457a70a842b723",
"0x6757ef9960c5bc711d1ba7f7a3bff44a45ba9e28f2ac0cc63ee957e6cada8ea",
"0x7d717fb27c9856ea10068d864465a2a8f9f669f4f78013967de06149c09b9af",
+ // NSTR
+ "0x2b674ffda238279de5550d6f996bf717228d316555f07a77ef0a082d925b782",
+ "0x6f8ad459c712873993e9ffb9013a469248343c3d361e4d91a8cac6f98575834",
+ "0x2589fc11f60f21af6a1dda3aeb7a44305c552928af122f2834d1c3b1a7aa626",
+ "0x46ab56ec0c6a6d42384251c97e9331aa75eb693e05ed8823e2df4de5713e9a4",
+ // DAI
+ "0x0184dd6328115c2d5f038792e427f3d81d9552e40dd675e013ccbf74ba50b979",
+ "0x036e722e04ef2ccadb9229b5415272353aaeb9554c989b83d4d932dba8dbe8f9",
+ "0x065bde349f553cf4bdd873e54cd48317eda0542764ebe5ba46984cedd940a5e4",
+ "0x000215cbd38a1e765cfd2c60bcb291c9d0b0bb7e7f56f682f0d3501303586185",
];
const debtTokens = [
"0x0491480f21299223b9ce770f23a2c383437f9fbf57abc2ac952e9af8cdb12c97",
@@ -64,6 +74,8 @@ const debtTokens = [
"0x1258eae3eae5002125bebf062d611a772e8aea3a1879b64a19f363ebd00947",
"0x292be6baee291a148006db984f200dbdb34b12fb2136c70bfe88649c12d934b",
"0x4b036839a8769c04144cc47415c64b083a2b26e4a7daa53c07f6042a0d35792",
+ "0x3e0576565c1b51fcac3b402eb002447f21e97abb5da7011c0a2e0b465136814",
+ "0x06726ec97bae4e28efa8993a8e0853bd4bad0bd71de44c23a1cd651b026b00e7",
];
function* chunks(arr, n) {
diff --git a/projects/notional-v3/index.js b/projects/notional-v3/index.js
index cbf2b9ba94..77ec4f3eb2 100644
--- a/projects/notional-v3/index.js
+++ b/projects/notional-v3/index.js
@@ -3,8 +3,8 @@ const abi = require('../notional/abi');
const { cachedGraphQuery } = require('../helper/cache')
const SUBGRAPHS = {
- arbitrum: 'https://api.studio.thegraph.com/query/36749/notional-v3-arbitrum/version/latest',
- ethereum: 'https://api.studio.thegraph.com/query/36749/notional-v3-mainnet/version/latest'
+ arbitrum: 'DnghsCNvJ4xmp4czX8Qn7UpkJ8HyHjy7cFN4wcH91Nrx',
+ ethereum: '4oVxkMtN4cFepbiYrSKz1u6HWnJym435k5DQRAFt2vHW'
};
const vaultsQuery = `{ vaultConfigurations { id } }`
diff --git a/projects/novaswap-v2/index.js b/projects/novaswap-v2/index.js
new file mode 100644
index 0000000000..ed1b823fcd
--- /dev/null
+++ b/projects/novaswap-v2/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ zklink: { factory: '0x9f94c91b178F5bc9fCcA3e5428b09A3d01CE5AC6', fromBlock: 3416798 },
+})
\ No newline at end of file
diff --git a/projects/novaswap/index.js b/projects/novaswap/index.js
new file mode 100644
index 0000000000..1859081eac
--- /dev/null
+++ b/projects/novaswap/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ zklink: { factory: '0xf8D35842f37800E349A993503372fb9E2CBb7E3d', fromBlock: 1676253 },
+})
\ No newline at end of file
diff --git a/projects/nxfinance/index.js b/projects/nxfinance/index.js
new file mode 100644
index 0000000000..98400c018a
--- /dev/null
+++ b/projects/nxfinance/index.js
@@ -0,0 +1,20 @@
+const { Program } = require("@project-serum/anchor");
+const { getProvider, } = require("../helper/solana");
+const nxIdl = require("./nx-idl.json");
+
+const NX_PROGRAM_ADDR = "EHBN9YKtMmrZhj8JZqyBQRGqyyeHw5xUB1Q5eAHszuMt";
+
+async function tvl(api) {
+ const provider = getProvider();
+ const nx_program = new Program(nxIdl, NX_PROGRAM_ADDR, provider);
+ const accounts = await nx_program.account.marginPool.all()
+
+ for (let { account: pool } of accounts)
+ api.add(pool.tokenMint.toBase58(), pool.depositTokens.toString())
+}
+
+module.exports = {
+ methodology: "Sum of assets deposited for lending and assets deposited as collateral for leveraging",
+ timetravel: false,
+ solana: { tvl, },
+};
diff --git a/projects/nxfinance/nx-idl.json b/projects/nxfinance/nx-idl.json
new file mode 100644
index 0000000000..44917c201a
--- /dev/null
+++ b/projects/nxfinance/nx-idl.json
@@ -0,0 +1,75 @@
+{
+ "version": "0.1.0",
+ "name": "leverage_finance",
+ "instructions": [],
+ "accounts": [
+ {
+ "name": "MarginPool",
+ "type": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "leveragefi",
+ "type": "publicKey"
+ },
+ {
+ "name": "vault",
+ "type": "publicKey"
+ },
+ {
+ "name": "feeDestination",
+ "type": "publicKey"
+ },
+ {
+ "name": "poolAuthority",
+ "type": "publicKey"
+ },
+ {
+ "name": "tokenMint",
+ "type": "publicKey"
+ },
+ {
+ "name": "tokenPriceOracle",
+ "type": "publicKey"
+ },
+ {
+ "name": "borrowedTokens",
+ "type": "u64"
+ },
+ {
+ "name": "depositTokens",
+ "type": "u64"
+ },
+ {
+ "name": "depositNotes",
+ "type": "u64"
+ },
+ {
+ "name": "loanNotes",
+ "type": "u64"
+ },
+ {
+ "name": "depositInterest",
+ "type": "u64"
+ },
+ {
+ "name": "loanInterest",
+ "type": "u64"
+ },
+ {
+ "name": "protocolFee",
+ "type": "u64"
+ },
+ {
+ "name": "accruedUntil",
+ "type": "i64"
+ },
+ {
+ "name": "utilizationFlag",
+ "type": "u16"
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/projects/nyke/index.js b/projects/nyke/index.js
new file mode 100644
index 0000000000..5671107595
--- /dev/null
+++ b/projects/nyke/index.js
@@ -0,0 +1,9 @@
+const { compoundExports2, methodology, } = require('../helper/compound');
+
+module.exports = {
+ methodology,
+ ethereumclassic: compoundExports2({
+ comptroller: '0x0040DCf62C380833dE60a502649567e939635fdB',
+ cether: '0x2896c67c0cea9D4954d6d8f695b6680fCfa7C0e0',
+ })
+};
diff --git a/projects/olympus/index.js b/projects/olympus/index.js
index 44ffdbd062..2a83b091b6 100644
--- a/projects/olympus/index.js
+++ b/projects/olympus/index.js
@@ -1,8 +1,10 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
const { blockQuery } = require("../helper/http");
const { getEnv } = require("../helper/env");
const { staking } = require('../helper/staking');
const { sumTokens2 } = require("../helper/unwrapLPs");
+const { sumTokens } = require("../helper/sumTokens");
const OlympusStakings = [
// Old Staking Contract
@@ -13,8 +15,15 @@ const OlympusStakings = [
];
const OHM_V1 = "0x383518188c0c6d7730d91b2c03a03c837814a899" // this is OHM v1
-const OHM = "0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5" // this is OHM v1
+const OHM = "0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5"
+const GOHM = "0x0ab87046fBb341D058F17CBC4c1133F25a20a52f"
+const TREASURY_MULTISIG = "0x245cc372c84b3645bf0ffe6538620b04a217988b";
+
+const olympusTokens = [
+ GOHM, // GOHM
+ OHM,
+];
/** Map any staked assets without price feeds to those with price feeds.
* All balances are 1: 1 to their unstaked counterpart that has the price feed.
**/
@@ -88,82 +97,82 @@ function sumBalancesByTokenAddress(arr) {
* #2. Call tokenRecords with block num from prev query
* #3. Sum values returned
***/
-async function tvl(api, isOwnTokensMode = false) {
-const subgraphUrls = {
- ethereum: `https://gateway-arbitrum.network.thegraph.com/api/${getEnv("OLYMPUS_GRAPH_API_KEY")}/subgraphs/id/7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`,
- arbitrum:
- "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-arbitrum",
- fantom:
- "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-fantom",
- polygon:
- "https://api.thegraph.com/subgraphs/name/olympusdao/protocol-metrics-polygon",
-};
-
- //filter out problematic pools that dont have a decimals function.
- const poolsWithoutDecimals = ["0x88051b0eea095007d3bef21ab287be961f3d8598"];
-
- const indexedBlockForEndpoint = await blockQuery(
- subgraphUrls[api.chain],
- getLatestBlockIndexed,
- { api }
- );
- const blockNum = indexedBlockForEndpoint.lastBlock[0].block;
- const { tokenRecords } = await blockQuery(
- subgraphUrls[api.chain],
- protocolQuery(blockNum),
- { api }
- );
-
- const filteredTokenRecords = tokenRecords.filter(
- (t) => !poolsWithoutDecimals.includes(t.tokenAddress)
- );
-
- const aDay = 24 * 3600;
- const now = Date.now() / 1e3;
- if (now - blockNum[0].timestamp > 3 * aDay) {
- throw new Error("outdated");
+function buildTvl(isOwnTokensMode = false){
+ return async function tvl(api) {
+ const subgraphUrls = {
+ ethereum: `7jeChfyUTWRyp2JxPGuuzxvGt3fDKMkC9rLjm7sfLcNp`,
+ arbitrum:
+ "2XQDRQ9AXhp5us6PsNyRM5BxKWeXhy3BNQLynA6YmmjA",
+ fantom:
+ sdk.graph.modifyEndpoint('3qSJTWdWJETFzht814HVV9rVafwRLQp3k9mZhCF39bYd'),
+ polygon:
+ "JCVMW1dbqectgaSLRuKSen6FKe9RPMJRQhNYZa4iTgFb",
+ };
+
+ //filter out problematic pools that dont have a decimals function.
+ const poolsWithoutDecimals = ["0x88051b0eea095007d3bef21ab287be961f3d8598"];
+
+ const indexedBlockForEndpoint = await blockQuery(
+ subgraphUrls[api.chain],
+ getLatestBlockIndexed,
+ { api }
+ );
+ const blockNum = indexedBlockForEndpoint.lastBlock[0].block;
+ const { tokenRecords } = await blockQuery(
+ subgraphUrls[api.chain],
+ protocolQuery(blockNum),
+ { api }
+ );
+
+ const filteredTokenRecords = tokenRecords.filter(
+ (t) => !poolsWithoutDecimals.includes(t.tokenAddress)
+ );
+
+ const aDay = 24 * 3600;
+ const now = Date.now() / 1e3;
+ if (now - blockNum[0].timestamp > 3 * aDay) {
+ throw new Error("outdated");
+ }
+ // const filteredTokenRecords = poolsOnly
+ // ? tokenRecords.filter((t) => t.category === "Protocol-Owned Liquidity")
+ // : tokenRecords;
+
+ /**
+ * iterates over filtered list from subgraph and returns any addresses
+ * that need to be normalized for pricing .
+ * See addressMap above
+ **/
+ const normalizedFilteredTokenRecords = filteredTokenRecords.map((token) => {
+ const normalizedAddress = addressMap[token.tokenAddress]
+ ? addressMap[token.tokenAddress]
+ : token.tokenAddress;
+ return { ...token, tokenAddress: normalizedAddress };
+ });
+
+ const tokensToBalances = sumBalancesByTokenAddress(
+ normalizedFilteredTokenRecords
+ ).filter(i => {
+ if (api.chain !== 'arbitrum') return true;
+ return !['0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0000200000000000000000423', '0xce6195089b302633ed60f3f427d1380f6a2bfbc7000200000000000000000424'].includes(i.tokenAddress)
+ })
+ const tokens = tokensToBalances.map(i => i.tokenAddress)
+
+
+ const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens })
+ const ownTokens = new Set(olympusTokens.map(i => i.toLowerCase()))
+ tokensToBalances.map(async (token, i) => {
+ if (ownTokens.has(token.tokenAddress.toLowerCase())) {
+ if (!isOwnTokensMode) return;
+ } else if (isOwnTokensMode) return;
+ api.add(token.tokenAddress, token.balance * 10 ** decimals[i])
+ })
+ return await sumTokens2({ api, resolveLP: true, })
}
- // const filteredTokenRecords = poolsOnly
- // ? tokenRecords.filter((t) => t.category === "Protocol-Owned Liquidity")
- // : tokenRecords;
-
- /**
- * iterates over filtered list from subgraph and returns any addresses
- * that need to be normalized for pricing .
- * See addressMap above
- **/
- const normalizedFilteredTokenRecords = filteredTokenRecords.map((token) => {
- const normalizedAddress = addressMap[token.tokenAddress]
- ? addressMap[token.tokenAddress]
- : token.tokenAddress;
- return { ...token, tokenAddress: normalizedAddress };
- });
-
- const tokensToBalances = sumBalancesByTokenAddress(
- normalizedFilteredTokenRecords
- ).filter(i => {
- if (api.chain !== 'arbitrum') return true;
- return !['0x89dc7e71e362faf88d92288fe2311d25c6a1b5e0000200000000000000000423', '0xce6195089b302633ed60f3f427d1380f6a2bfbc7000200000000000000000424'].includes(i.tokenAddress)
- })
- const tokens = tokensToBalances.map(i => i.tokenAddress)
-
-
- const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens })
- const ownTokens = new Set([
- '0x0ab87046fBb341D058F17CBC4c1133F25a20a52f', // GOHM
- '0x64aa3364f17a4d01c6f1751fd97c2bd3d7e7f1d5', // OHM
- ].map(i => i.toLowerCase()))
- tokensToBalances.map(async (token, i) => {
- if (ownTokens.has(token.tokenAddress.toLowerCase())) {
- if (!isOwnTokensMode) return;
- } else if (isOwnTokensMode) return;
- api.add(token.tokenAddress, token.balance * 10 ** decimals[i])
- })
- return sumTokens2({ api, resolveLP: true, })
}
async function ownTokens(api) {
- return tvl(api, true);
+ api.sumTokens({ owners: [TREASURY_MULTISIG], tokens: olympusTokens })
+ return buildTvl(true)(api);
}
module.exports = {
@@ -173,19 +182,19 @@ module.exports = {
"TVL is the sum of the value of all assets held by the treasury (excluding pTokens). Please visit https://app.olympusdao.finance/#/dashboard for more info.",
ethereum: {
staking: staking(OlympusStakings, [OHM, OHM_V1]),
- tvl,
+ tvl: buildTvl(false),
ownTokens,
},
arbitrum: {
- tvl,
+ tvl: buildTvl(false),
// pool2,
},
polygon: {
- tvl,
+ tvl: buildTvl(false),
// pool2,
},
fantom: {
- tvl,
+ tvl: buildTvl(false),
// pool2,
},
};
diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js
index 2820739e11..5db659f803 100644
--- a/projects/ondofinance/index.js
+++ b/projects/ondofinance/index.js
@@ -1,5 +1,7 @@
-const { getTokenSupply } = require('../helper/solana');
+const { getTokenSupply } = require("../helper/solana");
const sui = require("../helper/chain/sui");
+const { aQuery } = require("../helper/chain/aptos");
+const { get } = require("../helper/http");
module.exports = {
methodology: "Sums the total supplies of Ondo's issued tokens.",
@@ -11,23 +13,30 @@ const config = {
USDY: "A1KLoBrKBde8Ty9qtNQUtq3C2ortoC3u7twggz7sEto6",
},
ethereum: {
- OUSG: '0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92',
- USDY: '0x96F6eF951840721AdBF46Ac996b59E0235CB985C',
- USDYc: '0xe86845788d6e3e5c2393ade1a051ae617d974c09',
+ OUSG: "0x1B19C19393e2d034D8Ff31ff34c81252FcBbee92",
+ USDY: "0x96F6eF951840721AdBF46Ac996b59E0235CB985C",
+ USDYc: "0xe86845788d6e3e5c2393ade1a051ae617d974c09",
},
polygon: {
- OUSG: '0xbA11C5effA33c4D6F8f593CFA394241CfE925811',
+ OUSG: "0xbA11C5effA33c4D6F8f593CFA394241CfE925811",
},
mantle: {
USDY: "0x5bE26527e817998A7206475496fDE1E68957c5A6",
},
sui: {
- USDY: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY"
- }
-}
+ USDY: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY",
+ },
+ aptos: {
+ USDY: "0xcfea864b32833f157f042618bd845145256b1bf4c0da34a7013b76e42daa53cc",
+ },
+ noble: {
+ USDY: "ausdy",
+ },
+};
async function getUSDYTotalSupplySUI() {
- const USDY_TREASURY_CAP_OBJECT_ID = '0x9dca9f57a78fa7f132f95a0cf5c4d1b796836145ead7337da6b94012db62267a';
+ const USDY_TREASURY_CAP_OBJECT_ID =
+ "0x9dca9f57a78fa7f132f95a0cf5c4d1b796836145ead7337da6b94012db62267a";
let treasuryCapInfo = await sui.getObject(USDY_TREASURY_CAP_OBJECT_ID);
return treasuryCapInfo.fields.total_supply.fields.value;
}
@@ -39,23 +48,49 @@ Object.keys(config).forEach((chain) => {
module.exports[chain] = {
tvl: async (api) => {
let supplies;
- if (chain === 'solana') {
- supplies = await Promise.all(fundAddresses.map(getTokenSupply))
- .catch(error => {
+ if (chain === "solana") {
+ supplies = await Promise.all(fundAddresses.map(getTokenSupply)).catch(
+ (error) => {
throw error;
- });
+ }
+ );
- const scaledSupplies = supplies.map(supply => supply * 1_000_000);
+ const scaledSupplies = supplies.map((supply) => supply * 1_000_000);
api.addTokens(fundAddresses, scaledSupplies);
} else if (chain === "sui") {
let usdySupply = await getUSDYTotalSupplySUI();
api.addTokens(fundAddresses, [usdySupply]);
+ } else if (chain === "aptos") {
+ const {
+ data: { supply, decimals },
+ } = await aQuery(
+ `/v1/accounts/${config.aptos.USDY}/resource/0x1::coin::CoinInfo<${config.aptos.USDY}::usdy::USDY>`
+ );
+
+ const aptosSupply =
+ supply.vec[0].integer.vec[0].value / Math.pow(10, decimals);
+
+ api.addTokens(config.ethereum.USDY, aptosSupply * 1e18, { skipChain: true, });
+ } else if (chain === "noble") {
+ const res = await get(`https://noble-api.polkachu.com/cosmos/bank/v1beta1/supply/${config.noble.USDY}`);
+ api.addTokens(config.ethereum.USDY, parseInt(res.amount.amount), { skipChain: true, });
} else {
- supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: fundAddresses });
+ supplies = await api.multiCall({
+ abi: "erc20:totalSupply",
+ calls: fundAddresses,
+ });
+ if (chain === "ethereum") {
+ const usdycIndex = fundAddresses.indexOf(config.ethereum.USDYc);
+ const usdyIndex = fundAddresses.indexOf(config.ethereum.USDY);
+ // add USDYc supply to USDY supply
+ supplies[usdyIndex] =
+ parseInt(supplies[usdyIndex]) + parseInt(supplies[usdycIndex]);
+ fundAddresses.splice(usdycIndex, 1);
+ supplies.splice(usdycIndex, 1);
+ }
api.addTokens(fundAddresses, supplies);
}
return api.getBalances();
},
};
});
-
diff --git a/projects/only1.js b/projects/only1.js
index 94706694f6..a6496a5c6a 100644
--- a/projects/only1.js
+++ b/projects/only1.js
@@ -5,7 +5,7 @@ async function staking() {
const { data } = await getConfig('only1-solana',"https://api-edge.only1.app/staking-pools")
const owners = data.map(i => i.publicKey)
- return sumTokens2({ tokens: ['3bRTivrVsitbmCTGtqwp7hxXPsybkjn4XLNtPsHqa3zR'], owners, })
+ return sumTokens2({ tokens: ['3bRTivrVsitbmCTGtqwp7hxXPsybkjn4XLNtPsHqa3zR'], owners, computeTokenAccount: true, })
}
module.exports = {
diff --git a/projects/opal/index.js b/projects/opal/index.js
new file mode 100644
index 0000000000..5bc6a7b3c1
--- /dev/null
+++ b/projects/opal/index.js
@@ -0,0 +1,20 @@
+const config = {
+ ethereum: [
+ "0x86b130298719F753808E96cA6540b684a2d21466",// wstETH
+ "0xD2358c5d01065b13F2Ad1107d5a4531Cd98aC7A1",// rETH
+ "0x0c8e1e97d9f41a21D6Ef98E644a5516d9b7F593f",// wETH
+ "0x2165AEA91B33631A772d1723b88a98C1Ca820116",// weETH
+ "0x4aCc76B4B3E4529D7cE88Ca921D7a4112f25A6dA", // USDC
+ ]
+}
+
+Object.keys(config).forEach(chain => {
+ const pools = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const uPools = await api.fetchList({ lengthAbi: 'getUnderlyingPoolsLength', itemAbi: 'function getUnderlyingPool(uint8) view returns (address)', targets: pools, groupedByInput: true, })
+ const ownerTokens = uPools.map((tokens, i) => [tokens, pools[i]])
+ return api.sumTokens({ ownerTokens })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/open-ticketing-ecosystem/index.js b/projects/open-ticketing-ecosystem/index.js
new file mode 100644
index 0000000000..ed1af17aa6
--- /dev/null
+++ b/projects/open-ticketing-ecosystem/index.js
@@ -0,0 +1,17 @@
+const { staking } = require("../helper/staking");
+
+const stakingContractEthereum = "0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88";
+const openTokenEthereum = "0xc28eb2250d1ae32c7e74cfb6d6b86afc9beb6509";
+const stakingContractPolygon = "0x686e8500B6bE8812EB198aAbbbFA14C95c03fC88";
+const openTokenAddressPolygon = "0x7844F79FC841E4F92d974C417031c76F8578c2D5";
+
+module.exports = {
+ ethereum: {
+ tvl: () => ({}),
+ staking: staking(stakingContractEthereum, openTokenEthereum),
+ },
+ polygon: {
+ tvl: () => ({}),
+ staking: staking(stakingContractPolygon, openTokenAddressPolygon),
+ },
+};
diff --git a/projects/openocean.js b/projects/openocean.js
index 7232c74074..16e2e255f8 100644
--- a/projects/openocean.js
+++ b/projects/openocean.js
@@ -9,6 +9,7 @@ const config = {
manta: { factory: '0x8D2B7e5501Eb6D92F8e349f2FEbe785DD070bE74', },
avax: { factory: '0x042AF448582d0a3cE3CFa5b65c2675e88610B18d', s: ['0x4C431b568e8baAB20F004BB16E44570e8E0cD6D7', '0x0ebd9537a25f56713e34c45b38f421a1e7191469'], },
ethereum: { factory: '0x1f8c25f8da3990ecd3632ee4f02c2ea37755c3c6', s: ['0xb99d38eb69214e493b1183ffa3d561fc9f75d519', '0x7778360f035c589fce2f4ea5786cbd8b36e5396b'], },
+ rsk: { factory: '0x6Dd434082EaB5cD134B33719ec1ff05fe985B97b', },
}
module.exports = { misrepresentedTokens: true }
diff --git a/projects/orbit/index.js b/projects/orbit/index.js
index 50bb44ba68..a94248dcc8 100644
--- a/projects/orbit/index.js
+++ b/projects/orbit/index.js
@@ -1,9 +1,10 @@
+const sdk = require("@defillama/sdk");
const { toUSDTBalances } = require("../helper/balances");
const { request, gql } = require("graphql-request");
async function tvlFromGraph() {
const graphUrl =
- "https://api.thegraph.com/subgraphs/name/riccardogalbusera/orbit-subgraph";
+ sdk.graph.modifyEndpoint('BRUJ3Y4Fpq4VuvoCAi4p9qv1SxZ6ghVtMK1Rg8igfxmi');
const graphQuery = gql`
query {
positionManagerFactories(first: 1) {
diff --git a/projects/orbitlending-io/index.js b/projects/orbitlending-io/index.js
index e5c480b9ed..a4d550c3cc 100644
--- a/projects/orbitlending-io/index.js
+++ b/projects/orbitlending-io/index.js
@@ -1,9 +1,22 @@
const { compoundExports2 } = require('../helper/compound');
+const { mergeExports } = require('../helper/utils');
-module.exports = {
- blast: compoundExports2({
- comptroller: '0x1E18C3cb491D908241D0db14b081B51be7B6e652',
- cether: ['0xf9b3b455f5d900f62bc1792a6ca6e1d47b989389', '0x0872b71efc37cb8dde22b2118de3d800427fdba0'],
- blacklistedTokens: ['0xf92996ddc677a8dcb032ac5fe62bbf00f92ae2ec']
- }),
-};
+module.exports = mergeExports([
+ compoundExports2({
+ comptroller: '0x1E18C3cb491D908241D0db14b081B51be7B6e652',
+ cether: ['0xf9b3b455f5d900f62bc1792a6ca6e1d47b989389', '0x0872b71efc37cb8dde22b2118de3d800427fdba0'],
+ blacklistedTokens: ['0xf92996ddc677a8dcb032ac5fe62bbf00f92ae2ec']
+ }),
+ compoundExports2({
+ comptroller: '0x273683CA19D9CF827628EE216E4a9604EfB077A3',
+ cether: ['0x795dcd51eac6eb3123b7a4a1f906992eaa54cb0e']
+ }),
+ compoundExports2({
+ comptroller: '0xe9266ae95bB637A7Ad598CB0390d44262130F433',
+ cether: ['0xafabd582e82042f4a8574f75c36409abea916ac5']
+ }),
+ compoundExports2({
+ comptroller: '0xfFF8Fc176697D04607cF4e23E91c65aeD1c3d3F5',
+ cether: ['0x530a8d3fdf61112f8a879d753fe02e9e37ec36aa']
+ }),
+ ].map(t=>({blast:t})))
diff --git a/projects/organic-growth/index.js b/projects/organic-growth/index.js
new file mode 100644
index 0000000000..87a7085a91
--- /dev/null
+++ b/projects/organic-growth/index.js
@@ -0,0 +1,22 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+async function tvl(api) {
+ const logs = await getLogs2({
+ api,
+ factory: '0x9767E409259E314F3C69fe1E7cA0D3161Bba4F5a',
+ eventAbi: 'event PairCreated(address indexed token, address indexed weth, address pair)',
+ fromBlock: 308542,
+ })
+
+ const wethBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: logs.map(i => ({ target: i.weth, params: i.pair })) })
+ const tokens = logs.map(i => i.weth)
+ api.add(tokens, wethBalances)
+ api.add(tokens, wethBalances) // second time to add equivalent token value
+ return sumTokens2({ api, })
+}
+
+module.exports = {
+ misrepresentedTokens: true,
+ etlk: { tvl }
+}
\ No newline at end of file
diff --git a/projects/origami/index.js b/projects/origami/index.js
index b666da8dc9..22e1c67a61 100644
--- a/projects/origami/index.js
+++ b/projects/origami/index.js
@@ -1,8 +1,9 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const GRAPH_URLS = {
- ethereum: "https://api.thegraph.com/subgraphs/name/templedao/origami-mainnet", // ethereum
- arbitrum: "https://api.thegraph.com/subgraphs/name/templedao/origami-arb", // arbitrum
+ ethereum: sdk.graph.modifyEndpoint('GGN8RoYQBiw2Ui6wUeaKcHsBBSrQzQoryYi2feoTKwPX'), // ethereum
+ arbitrum: sdk.graph.modifyEndpoint('AHT1ffJhw7NWdeH3XYbWzMmy5USbB22K3ecVDu8azGuF'), // arbitrum
}
module.exports = {
@@ -14,6 +15,7 @@ Object.keys(GRAPH_URLS).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
const { metrics: [{ investmentVaults }] } = await cachedGraphQuery('origami/' + chain, endpoint, '{ metrics { investmentVaults { id } } }')
+ console.log(investmentVaults)
const vaults = investmentVaults.map(vault => vault.id)
let tokens = await api.multiCall({ abi: 'address:reserveToken', calls: vaults })
if (chain === 'arbitrum')
diff --git a/projects/origindollar/index.js b/projects/origindollar/index.js
index 1a2b9416b8..17a994be45 100644
--- a/projects/origindollar/index.js
+++ b/projects/origindollar/index.js
@@ -1,6 +1,6 @@
const sdk = require("@defillama/sdk");
const abi = require("./abi.json");
-const { staking } = require('../helper/staking')
+const { staking, stakings } = require("../helper/staking");
const vault = "0xE75D77B1865Ae93c7eaa3040B038D7aA7BC02F70";
@@ -35,6 +35,9 @@ const ethTvl = async (timestamp, ethBlock) => {
module.exports = {
ethereum: {
tvl: ethTvl,
- staking: staking('0x0C4576Ca1c365868E162554AF8e385dc3e7C66D9', '0x9c354503C38481a7A7a51629142963F98eCC12D0')
+ staking: stakings(
+ ["0x0C4576Ca1c365868E162554AF8e385dc3e7C66D9", "0x63898b3b6Ef3d39332082178656E9862bee45C57"],
+ ["0x9c354503C38481a7A7a51629142963F98eCC12D0", "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26"]
+ ),
},
};
diff --git a/projects/otsea/config.js b/projects/otsea/config.js
new file mode 100644
index 0000000000..5486511947
--- /dev/null
+++ b/projects/otsea/config.js
@@ -0,0 +1,17 @@
+module.exports = {
+ chains: [
+ {
+ name: 'ethereum',
+ graphql: 'https://api.studio.thegraph.com/query/65203/otsea-v1/version/latest',
+ },
+ {
+ name: 'base',
+ graphql: 'https://api.studio.thegraph.com/query/65203/otsea-base-v1/version/latest',
+ },
+ {
+ name: 'blast',
+ graphql: 'https://api.studio.thegraph.com/query/65203/otsea-blast-v1/version/latest',
+ },
+ ]
+ }
+
\ No newline at end of file
diff --git a/projects/otsea/index.js b/projects/otsea/index.js
new file mode 100644
index 0000000000..ee83ffc1f3
--- /dev/null
+++ b/projects/otsea/index.js
@@ -0,0 +1,69 @@
+
+const { GraphQLClient, gql } = require("graphql-request");
+const ADDRESSES = require('../helper/coreAssets.json')
+const { staking } = require("../helper/staking");
+const config = require("./config");
+
+const OTSEA_TOKEN = "0x5dA151B95657e788076D04d56234Bd93e409CB09";
+const OTSEA_MARKET_CONTRACT = "0x6E8B67B315b44519f8C2BEfdbbE11097c45353b4";
+const OTSEA_STAKING_CONTRACT = "0xF2c8e860ca12Cde3F3195423eCf54427A4f30916";
+
+// OTSEA market volume by network
+function getMarketVolume(endpoint) {
+ return async (api) => {
+ // locked in sell orders (ETH amount on sell orders)
+ let graphQLClient = new GraphQLClient(endpoint);
+ let query = gql`
+ query openSellOrders {
+ orders (where: { type: 1, state: 0 }) {
+ fulfilledOutput
+ totalOutput
+ }
+ }
+ `;
+ const results = await graphQLClient.request(query)
+
+ const { orders } = results || {
+ orders: [{ totalOutput: 0 }],
+ }
+ const lockedInSellOrders = orders.reduce((sum, o) => sum += +o.totalOutput - o.fulfilledOutput, 0)
+
+ // Locked in buy orders (ETH balance of market contract)
+ const lockedInBuyOrders = await api.sumTokens({ owner: OTSEA_MARKET_CONTRACT, tokens: [ADDRESSES.null] });
+
+ api.addCGToken('ethereum', parseFloat(lockedInSellOrders + lockedInBuyOrders) / 1e18)
+ }
+}
+
+// Total Volume of OTSEA
+async function otsea_total_volume(api) {
+ const collateralBalance = await api.call({
+ abi: 'erc20:totalSupply',
+ target: OTSEA_TOKEN,
+ params: [],
+ });
+
+ api.add(OTSEA_TOKEN, collateralBalance)
+}
+
+// Global export
+module.exports = {
+ methodology: "We aggregated the assets locked on OTSea market",
+ misrepresentedTokens: true,
+};
+
+// Network exports
+config.chains.forEach(async chainInfo => {
+ const { name: chain, graphql: endpoint } = chainInfo
+
+ if (chain == 'ethereum') {
+ module.exports[chain] = {
+ tvl: getMarketVolume(endpoint),
+ staking: staking(OTSEA_STAKING_CONTRACT, OTSEA_TOKEN),
+ }
+ } else {
+ module.exports[chain] = {
+ tvl: getMarketVolume(endpoint),
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/ottopia/index.js b/projects/ottopia/index.js
index 003956ae96..0a07f498cd 100644
--- a/projects/ottopia/index.js
+++ b/projects/ottopia/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { GraphQLClient, gql } = require("graphql-request");
const { staking } = require("../helper/staking");
@@ -5,7 +6,7 @@ const CLAM = "0xC250e9987A032ACAC293d838726C511E6E1C029d";
const PearlBank = "0x845EB7730a8D37e8D190Fb8bb9c582038331B48a";
async function tvl({timestamp}, block, chainBlocks) {
- let endpoint = "https://api.thegraph.com/subgraphs/name/otterclam/otterclam";
+ let endpoint = sdk.graph.modifyEndpoint('CejrrsnSQAxHJBpkgiBrLHQZ7h2MkK9QArM8bJvN9GuQ');
let graphQLClient = new GraphQLClient(endpoint);
let query = gql`
query tvl($start: BigInt!, $end: BigInt!) {
diff --git a/projects/oxygen/idl.js b/projects/oxygen/idl.js
deleted file mode 100644
index 225d65a608..0000000000
--- a/projects/oxygen/idl.js
+++ /dev/null
@@ -1,147 +0,0 @@
-
-module.exports = {
- version: '0.0.0',
- name: 'borrow_lending',
- instructions: [],
- accounts: [
- {
- name: 'MainAccount',
- type: {
- kind: 'struct',
- fields: [
- {
- name: 'authority',
- type: 'publicKey',
- },
- {
- name: 'tokens',
- type: {
- array: [
- {
- defined: 'TokenData',
- },
- 64,
- ],
- },
- },
- {
- name: 'balances',
- type: {
- array: [
- {
- defined: 'BalanceTs',
- },
- 64,
- ],
- },
- },
- {
- name: 'prices',
- type: {
- array: [
- {
- defined: 'PriceTs',
- },
- 64,
- ],
- },
- },
- {
- name: 'signerBump',
- type: 'u8',
- },
- {
- name: 'priceAuthority',
- type: 'publicKey',
- },
- {
- name: 'padding',
- type: {
- array: [
- 'u8',
- 992,
- ],
- },
- },
- ],
- },
- },
- ],
- types: [
- {
- name: 'Balance',
- type: {
- kind: 'struct',
- fields: [
- {
- name: 'depositTotal',
- type: 'u128',
- },
- {
- name: 'borrowTotal',
- type: 'u128',
- },
- {
- name: 'depositShares',
- type: 'u128',
- },
- {
- name: 'borrowShares',
- type: 'u128',
- },
- ],
- },
- },
- {
- name: 'BalanceTs',
- type: {
- kind: 'struct',
- fields: [
- {
- name: 'balance',
- type: {
- defined: 'Balance',
- },
- },
- {
- name: 'ts',
- type: 'i64',
- },
- ],
- },
- },
- {
- name: 'TokenData',
- type: {
- kind: 'struct',
- fields: [
- {
- name: 'mint',
- type: 'publicKey',
- },
- {
- name: 'decimals',
- type: 'u8',
- },
- ],
- },
- },
- {
- name: 'PriceTs',
- type: {
- kind: 'struct',
- fields: [
- {
- name: 'price',
- type: 'u128',
- },
- {
- name: 'ts',
- type: 'i64',
- },
- ],
- },
- },
- ],
- errors: [],
-};
diff --git a/projects/oxygen/index.js b/projects/oxygen/index.js
index 9b53ff39b7..01981a1a80 100644
--- a/projects/oxygen/index.js
+++ b/projects/oxygen/index.js
@@ -1,48 +1,8 @@
-const { getProvider, getTokenDecimals } = require('../helper/solana')
-const { PublicKey } = require('@solana/web3.js')
-const { Program, } = require("@project-serum/anchor");
-const idl = require('./idl');
+const { sumTokens2 } = require('../helper/solana')
-const INTERNAL_DECIMALS = 12;
-
-let tokenData
-
-async function _getTokenData() {
- const mainAccountAddress = new PublicKey('6JVfU8Cp2oAQi39YBpTSuozHiZAUa7j4t1gDyF9RDFEi')
- const programId = new PublicKey('J21zqcffYQU2NUJrvAKhqpKZLQK1YaB9dY5kmcxkMQvQ')
- const provider = getProvider()
- const program = new Program(idl, programId, provider)
- const data = await program.account.mainAccount.fetch(mainAccountAddress)
- data.tokens = data.tokens.slice(0, 6)
- data.balances = data.balances.slice(0, 6)
- data.tokenDecimals = await getTokenDecimals(data.tokens.map(({ mint }) => mint.toBase58()))
- return data
-}
-
-async function getTokenData() {
- if (!tokenData) tokenData = _getTokenData()
- return tokenData
-}
async function tvl(api) {
- const data = await getTokenData()
- data.tokens.forEach(({ mint }, i) => {
- const token = mint.toBase58()
- const { balance: { depositTotal, borrowTotal } } = data.balances[i]
- const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS)
- api.add(token, depositTotal.toString() * decimals)
- api.add(token, borrowTotal.toString() * -1 * decimals)
- })
-}
-
-async function borrowed(api) {
- const data = await getTokenData()
- data.tokens.forEach(({ mint }, i) => {
- const token = mint.toBase58()
- const { balance: { borrowTotal } } = data.balances[i]
- const decimals = 10 ** (data.tokenDecimals[token] - INTERNAL_DECIMALS)
- api.add(token, borrowTotal.toString()* decimals)
- })
+ return sumTokens2({ owner: '4ncyWnbG22vqEmyxTfBsEdbNuQhBphaasg5q5YgoiPgq'})
}
module.exports = {
diff --git a/projects/pac-finance/index.js b/projects/pac-finance/index.js
index 231eb54e08..d07df91722 100644
--- a/projects/pac-finance/index.js
+++ b/projects/pac-finance/index.js
@@ -1,6 +1,47 @@
-const { aaveExports } = require("../helper/aave");
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+const UiPoolDataProviderABI = {
+ "getReservesData": "function getReservesData(address provider) view returns (tuple(address underlyingAsset, string name, string symbol, uint256 decimals, uint256 baseLTVasCollateral, uint256 reserveLiquidationThreshold, uint256 reserveLiquidationBonus, uint256 reserveFactor, bool usageAsCollateralEnabled, bool borrowingEnabled, bool stableBorrowRateEnabled, bool isActive, bool isFrozen, uint128 liquidityIndex, uint128 variableBorrowIndex, uint128 liquidityRate, uint128 variableBorrowRate, uint128 stableBorrowRate, uint40 lastUpdateTimestamp, address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress, address interestRateStrategyAddress, uint256 availableLiquidity, uint256 totalPrincipalStableDebt, uint256 averageStableRate, uint256 stableDebtLastUpdateTimestamp, uint256 totalScaledVariableDebt, uint256 priceInMarketReferenceCurrency, address priceOracle, uint256 variableRateSlope1, uint256 variableRateSlope2, uint256 stableRateSlope1, uint256 stableRateSlope2, uint256 baseStableBorrowRate, uint256 baseVariableBorrowRate, uint256 optimalUsageRatio, bool isPaused, bool isSiloedBorrowing, uint128 accruedToTreasury, uint128 unbacked, uint128 isolationModeTotalDebt, bool flashLoanEnabled, uint256 debtCeiling, uint256 debtCeilingDecimals, uint8 eModeCategoryId, uint256 borrowCap, uint256 supplyCap, uint16 eModeLtv, uint16 eModeLiquidationThreshold, uint16 eModeLiquidationBonus, address eModePriceSource, string eModeLabel, bool borrowableInIsolation)[], tuple(uint256 marketReferenceCurrencyUnit, int256 marketReferenceCurrencyPriceInUsd, int256 networkBaseTokenPriceInUsd, uint8 networkBaseTokenPriceDecimals))"
+}
+
+const address = {
+ blast: {
+ UiPoolDataProvider: "0x1205529dc4fe0844039099cf7125aEF38B7c058F",
+ PoolAddressProvider: "0x688B5fd3C3E3724b4De08C4BCB3A755F9b579c9a",
+ },
+};
+
+async function tvl(api) {
+ const { UiPoolDataProvider, PoolAddressProvider } = address[api.chain];
+ let [reservesData] = await api.call({
+ target: UiPoolDataProvider,
+ params: PoolAddressProvider,
+ abi: UiPoolDataProviderABI.getReservesData,
+ });
+
+ let toa = reservesData.map((i) => [i.underlyingAsset, i.aTokenAddress]);
+
+ return sumTokens2({ api, resolveLP: true, tokensAndOwners: toa });
+}
+
+async function borrowed(api) {
+ const { UiPoolDataProvider, PoolAddressProvider } = address[api.chain];
+ let [reservesData] = await api.call({
+ target: UiPoolDataProvider,
+ params: PoolAddressProvider,
+ abi: UiPoolDataProviderABI.getReservesData,
+ });
+
+ reservesData.forEach((d) => {
+ api.add(d.underlyingAsset, d.totalScaledVariableDebt * d.variableBorrowIndex * 1e-27)
+ });
+
+ return sumTokens2({ api, resolveLP: true, });
+}
-// https://docs.pac.finance/developer/mainnet-addresses
module.exports = {
- blast: aaveExports("blast", undefined, undefined, ["0x742316f430002D067dC273469236D0F3670bE446",], { hasV2LPs: true }),
+ blast: {
+ tvl,
+ borrowed,
+ },
};
diff --git a/projects/pacman/index.js b/projects/pacman/index.js
index 6d2c762d53..cf82ad1db3 100644
--- a/projects/pacman/index.js
+++ b/projects/pacman/index.js
@@ -1,6 +1,7 @@
+const sdk = require("@defillama/sdk");
const { graphQuery } = require('../helper/http')
-const subgraphUrl = "https://api.thegraph.com/subgraphs/name/pacmanfinance/pacman-arbitrum";
+const subgraphUrl = sdk.graph.modifyEndpoint('9xteTELUdzjii1yLASJm6CxSpYuS1bmE6DGWMMhgkq2k');
const vaultsQuery = `
query {
diff --git a/projects/palmy/index.js b/projects/palmy/index.js
new file mode 100644
index 0000000000..bc3629e902
--- /dev/null
+++ b/projects/palmy/index.js
@@ -0,0 +1,10 @@
+const { aaveExports, methodology, } = require("../helper/aave");
+
+module.exports = {
+ methodology,
+ oas: aaveExports("oas", '0xf4A3dDC5F629d9CB14DF4e7d5f78326153eA02A3', undefined, undefined, {
+ abis: {
+ getAllATokens: "function getAllLTokens() view returns (tuple(string symbol, address tokenAddress)[])"
+ },
+ }),
+};
diff --git a/projects/particle-trade-duo/index.js b/projects/particle-trade-duo/index.js
index e8087e409c..c674172a3a 100644
--- a/projects/particle-trade-duo/index.js
+++ b/projects/particle-trade-duo/index.js
@@ -1,4 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokens2 } = require('../helper/unwrapLPs')
const config = {
blast: {
weth90d: '0xc932317385fDc794633f612874BD687eA987B151',
@@ -24,6 +25,13 @@ const wrappedNativeTokenMap = {
}
}
+const usdeVaults = {
+ blast: {
+ vault: '0xeEa70D690C6c9c5534FcB90b6b0aE71199C7d4d3',
+ fwUSDe: '0x04efc000dC9c27445b092622f42e09E173beE61f',
+ }
+}
+
Object.keys(config).forEach(chain => {
module.exports[chain] = {
tvl: async (api) => {
@@ -41,6 +49,15 @@ Object.keys(config).forEach(chain => {
const wrappedBalances = await api.multiCall({ abi: 'uint256:totalSupply', calls: wrappedTokens})
const nativeTokens = wrappedTokens.map(wrappedToken => wrappedNativeTokenMap[chain][wrappedToken])
api.add(nativeTokens, wrappedBalances);
+
+ let usdeVault = usdeVaults[chain]
+ const wrappedUSDeBalance = await api.call({
+ abi: 'erc20:balanceOf',
+ target: usdeVault.fwUSDe,
+ params: usdeVault.vault
+ });
+ api.add(ADDRESSES.arbitrum.USDe, wrappedUSDeBalance)
+ return sumTokens2({ api })
}
}
})
\ No newline at end of file
diff --git a/projects/paxo-finance/index.js b/projects/paxo-finance/index.js
index f9dd2cd90e..099a49b8c1 100644
--- a/projects/paxo-finance/index.js
+++ b/projects/paxo-finance/index.js
@@ -6,6 +6,7 @@ module.exports = {
polygon: compoundExports('0x1eDf64B621F17dc45c82a65E1312E8df988A94D3', 'polygon'),
xdc: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'xdc'),
linea: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'linea'),
+ boba: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'boba'),
methodology: `${lendingMarket}. TVL is calculated by getting the market addresses from comptroller and calling the getCash() on-chain method to get the amount of tokens locked in each of these addresses.`,
}
diff --git a/projects/paxos-gold/index.js b/projects/paxos-gold/index.js
new file mode 100644
index 0000000000..ed819b2e47
--- /dev/null
+++ b/projects/paxos-gold/index.js
@@ -0,0 +1,11 @@
+const PAXG = '0x45804880de22913dafe09f4980848ece6ecbaf78'
+
+module.exports = {
+ methodology: "TVL corresponds to the total amount of PAXG minted",
+ ethereum: {
+ tvl: async (api) => {
+ const totalSupply = await api.call({target: PAXG, abi: 'erc20:totalSupply'})
+ api.add(PAXG, totalSupply)
+ }
+ }
+}
diff --git a/projects/pearl-v2/index.js b/projects/pearl-v2/index.js
new file mode 100644
index 0000000000..cb27a24cc6
--- /dev/null
+++ b/projects/pearl-v2/index.js
@@ -0,0 +1,11 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+const ownTokens = [
+ '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143',
+ '0x4644066f535ead0cde82d209df78d94572fcbf14',
+ '0x25ea98ac87a38142561ea70143fd44c4772a16b6',
+]
+
+module.exports = uniV3Export({
+ 'real': { factory: '0xeF0b0a33815146b599A8D4d3215B18447F2A8101', fromBlock: 33062, blacklistedTokens: ownTokens,}
+})
\ No newline at end of file
diff --git a/projects/pell/index.js b/projects/pell/index.js
new file mode 100644
index 0000000000..1ba12511be
--- /dev/null
+++ b/projects/pell/index.js
@@ -0,0 +1,15 @@
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const { getConfig } = require('../helper/cache')
+
+const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core', 'bevm', 'mantle', 'scroll', 'bob']
+
+chains.forEach(chain => {
+ module.exports[chain] = {
+ tvl: async function (api) {
+ const { result } = await getConfig(`pell/${api.chain}`, `https://api.pell.network/v1/stakeList?chainId=${api.chain === 'bsquared' ? 223 : api.chainId}`)
+ const vaults = result.map(f => f.strategyAddress)
+ const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: vaults })
+ return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], })
+ }
+ }
+})
diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js
index c14c8069ae..beb4e471bb 100644
--- a/projects/pendle/v2.js
+++ b/projects/pendle/v2.js
@@ -9,20 +9,26 @@ const config = {
ethereum: {
factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784",
factoryV3: "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52",
+ factoryV4: '0x3d75Bd20C983edb5fD218A1b7e0024F1056c7A2F',
fromBlock: 16032059,
fromBlockV3: 18669498,
+ fromBlockV4: 20323253
},
arbitrum: {
factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8",
factoryV3: "0x2FCb47B58350cD377f94d3821e7373Df60bD9Ced",
+ factoryV4: '0xd9f5e9589016da862D2aBcE980A5A5B99A94f3E8',
fromBlock: 62979673,
- fromBlockV3: 154873897
+ fromBlockV3: 154873897,
+ fromBlockV4: 233004891
},
bsc: {
factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E",
factoryV3: "0xC40fEbF5A33b8C92B187d9be0fD3fe0ac2E4B07c",
+ factoryV4: '0x7D20e644D2A9e149e5be9bE9aD2aB243a7835d37',
fromBlock: 34060741,
fromBlockV3: 33884419,
+ fromBlockV4: 40539593,
pts: [
"0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb",
"0x70c1138B54ba212776d3A9d29b6160C54C31cd5d",
@@ -32,19 +38,23 @@ const config = {
optimism: {
factory: "0x17F100fB4bE2707675c6439468d38249DD993d58",
factoryV3: "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC",
+ factoryV4: '0x73Be47237F12F36203823BAc9A4d80dC798B7015',
fromBlock: 108061448,
fromBlockV3: 112783590,
+ fromBlockV4: 122792017
},
mantle: {
factoryV3: "0xD228EC1f7D4313fe321fab511A872475D07F5bA6",
+ factoryV4: '0xCa274A44a52241c1a8EFb9f84Bf492D8363929FC',
fromBlockV3: 61484384,
+ fromBlockV4: 66526601
},
};
module.exports = {};
Object.keys(config).forEach((chain) => {
- const { factory, factoryV3, fromBlock, pts, fromBlockV3 } = config[chain];
+ const { factory, factoryV3, factoryV4, fromBlock, pts, fromBlockV3, fromBlockV4 } = config[chain];
module.exports[chain] = {
tvl: async (api) => {
const logs = factory
@@ -75,7 +85,21 @@ Object.keys(config).forEach((chain) => {
})
: [];
- const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT));
+ const logsV4 = factoryV4
+ ? await getLogs({
+ api,
+ target: factoryV4,
+ topic: [
+ "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af",
+ ],
+ eventAbi:
+ "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)",
+ onlyArgs: true,
+ fromBlock: fromBlockV4,
+ })
+ : [];
+
+ const pt = logs.map((i) => i.PT).concat(logsV3.map((i) => i.PT)).concat(logsV4.map((i) => i.PT));
if (pts) pt.push(...pts);
let sy = [
...new Set(
diff --git a/projects/penpad/index.js b/projects/penpad/index.js
index 39973ca3ca..a9546f324e 100644
--- a/projects/penpad/index.js
+++ b/projects/penpad/index.js
@@ -1,10 +1,45 @@
-
const ADDRESSES = require('../helper/coreAssets.json');
-const { staking } = require('../helper/staking');
+const { sumTokensExport } = require('../helper/unknownTokens');
module.exports = {
methodology: 'Counts liquidty on the staking',
scroll: {
- tvl: staking('0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188', ADDRESSES.null),
+ tvl: sumTokensExport({
+ tokensAndOwners: [
+ [ADDRESSES.null, '0x8F53fA7928305Fd4f78c12BA9d9DE6B2420A2188'],
+ [ADDRESSES.scroll.WETH, '0x88844c8f2b895792532AaE2a0F877208248F3585'],
+ [ADDRESSES.scroll.USDT, '0xC72a7a21e3E12594c75Bc6418224E812e16a027E'],
+ [ADDRESSES.scroll.USDC, '0xDc1FCFe40A5Cf9745cef0B75428eE28E81D7cC56'],
+ [ADDRESSES.scroll.STONE, '0x20DE0435e5674Ef15E78adA570159984524B9E8F'],
+ [
+ '0xc4d46E8402F476F269c379677C99F18E22Ea030e',
+ '0x0C530882C0900b13FC6E8312B52c26e7a5b8e505',
+ ], // pufETH
+ [
+ '0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F',
+ '0x27D2B6cEcd759D289B0227966cC6Fe69Cc2b0424',
+ ], // wrsETH
+ [
+ '0xf610A9dfB7C89644979b4A0f27063E9e7d7Cda32',
+ '0x96cB437706111548c3D2e1Dc21E5Ab69E5dA057a',
+ ], // wstETH
+ [
+ '0xcA0bFd5f735924e34Cc567146989e467fFbbCe1a',
+ '0x25D710AC957A54bdD6578b5DC8187a355c805edb',
+ ], // weETH (Scroll Bridged)
+ [
+ '0x3C1BCa5a656e69edCD0D4E36BEbb3FcDAcA60Cf1',
+ '0x1C04CedF3Aac5fE35A7811689Ac6Da25b01BDc81',
+ ], // WBTC
+ [
+ '0x01f0a31698c4d065659b9bdc21b3610292a1c506',
+ '0x016d036ec56eed17b5f9dfa212e27f8e260cc7d0',
+ ], // weETH (Stargate Bridged)
+ [
+ '0x3ba89d490ab1c0c9cc2313385b30710e838370a4',
+ '0xde12ec22c5c4eeeeaf8afdc4ec735d75cf9d15a5',
+ ], // SolvBTC.b
+ ],
+ }),
},
-}
+};
diff --git a/projects/penpie/index.js b/projects/penpie/index.js
index cfee75dd76..6a4d98f2f1 100644
--- a/projects/penpie/index.js
+++ b/projects/penpie/index.js
@@ -3,7 +3,7 @@ const config = require("./config");
const { staking } = require('../helper/staking')
async function tvl(api) {
- const { masterPenpie, pendleStaking, vePENDLE, PENDLE, mPENDLE, } = config[api.chain];
+ const { masterPenpie, vlPNP } = config[api.chain];
const poolTokens = await api.fetchList({
lengthAbi: MasterMagpieAbi.poolLength,
@@ -11,13 +11,11 @@ async function tvl(api) {
target: masterPenpie,
});
const poolInfos = await api.multiCall({ abi: 'function getPoolInfo(address) view returns ( uint256 emission, uint256 allocpoint, uint256 sizeOfPool, uint256 totalPoint)', calls: poolTokens, target: masterPenpie, })
- const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: poolTokens, })
poolTokens.forEach((token, i) => {
- if (symbols[i] === 'vlPenpie' || symbols[i] === 'mPendle' || symbols[i] === 'mPendleOFT' || symbols[i] === 'mPendleSV') {
- token = PENDLE
- }
api.add(token, poolInfos[i].sizeOfPool)
})
+ if (vlPNP)
+ api.removeTokenBalance(vlPNP)
}
Object.keys(config).forEach((chain) => {
diff --git a/projects/perp88/index.js b/projects/perp88/index.js
index 8a0cba31a2..58521b33fa 100644
--- a/projects/perp88/index.js
+++ b/projects/perp88/index.js
@@ -1,40 +1,43 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokensExport } = require('../helper/unwrapLPs');
+const ADDRESSES = require("../helper/coreAssets.json");
+const { sumTokensExport } = require("../helper/unwrapLPs");
const tokens = {
- "WMATIC": ADDRESSES.polygon.WMATIC_2,
- "WETH": ADDRESSES.polygon.WETH_1,
- "WBTC": ADDRESSES.polygon.WBTC,
- "DAI": ADDRESSES.polygon.DAI,
- "USDC": ADDRESSES.polygon.USDC,
- "USDT": ADDRESSES.polygon.USDT
-}
-const POOL_DIAMOND_CONTRACT = '0xE7D96684A56e60ffBAAe0fC0683879da48daB383';
+ WMATIC: ADDRESSES.polygon.WMATIC_2,
+ WETH: ADDRESSES.polygon.WETH_1,
+ WBTC: ADDRESSES.polygon.WBTC,
+ DAI: ADDRESSES.polygon.DAI,
+ USDC: ADDRESSES.polygon.USDC,
+ USDT: ADDRESSES.polygon.USDT,
+};
+const POOL_DIAMOND_CONTRACT = "0xE7D96684A56e60ffBAAe0fC0683879da48daB383";
async function blastTvl(api) {
- const vaultStorageAddress = '0x97e94BdA44a2Df784Ab6535aaE2D62EFC6D2e303'
+ const vaultStorageAddress = "0x97e94BdA44a2Df784Ab6535aaE2D62EFC6D2e303";
const hlpUnderlyings = [
- "0x2EAd9c6C7cAB1DD3442714A8A8533078C402135A",
- "0x620aa22aA45F59Af91CaFBAd0ab58181FcDBfB08",
- ]
- return api.sumTokens({ owner: vaultStorageAddress, tokens: hlpUnderlyings, })
+ "0xb9d94A3490bA2482E2D4F21F0E76b92E5661Ded8",
+ "0xCD732d21c1B23A3f84Bb386E9759b5b6A1BcBe39",
+ ];
+ return api.sumTokens({ owner: vaultStorageAddress, tokens: hlpUnderlyings });
}
module.exports = {
start: 1668684025,
polygon: {
- tvl: sumTokensExport({ owner: POOL_DIAMOND_CONTRACT, tokens: Object.values(tokens), }),
+ tvl: sumTokensExport({
+ owner: POOL_DIAMOND_CONTRACT,
+ tokens: Object.values(tokens),
+ }),
},
arbitrum: {
tvl: sumTokensExport({
- owner: '0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0',
+ owner: "0x56CC5A9c0788e674f17F7555dC8D3e2F1C0313C0",
tokens: [
"0x70d95587d40A2caf56bd97485aB3Eec10Bee6336",
"0x47c031236e19d024b42f8AE6780E44A573170703",
],
fetchCoValentTokens: true,
- })
+ }),
},
blast: {
- tvl: blastTvl
- }
-}
+ tvl: blastTvl,
+ },
+};
diff --git a/projects/phoenix-hub/index.js b/projects/phoenix-hub/index.js
new file mode 100644
index 0000000000..772a0bb729
--- /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,
+ }
+};
diff --git a/projects/phoenix/index.js b/projects/phoenix/index.js
index 91d4012115..21c4ed56d5 100644
--- a/projects/phoenix/index.js
+++ b/projects/phoenix/index.js
@@ -2,7 +2,7 @@
const tvl = () => ({})
module.exports = {
start: 1631376000, // beijing time 2021-9-11 0:0:
- // deadFrom: '2022-09-15',
+ deadFrom: '2022-09-15',
hallmarks: [
[Math.floor(new Date('2022-09-15')/1e3), 'Project is dead: https://twitter.com/Phoenix__PHX/status/1570389804734640129'],
],
diff --git a/projects/physica-finance/index.js b/projects/physica-finance/index.js
new file mode 100644
index 0000000000..99bea7e259
--- /dev/null
+++ b/projects/physica-finance/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ planq: { factory: "0xFF4F8f857fd60142a135aB139C16370da89c76c2", fromBlock: 9020194, },
+});
diff --git a/projects/platypus-finance/index.js b/projects/platypus-finance/index.js
index 8a2c894440..cf16de413e 100644
--- a/projects/platypus-finance/index.js
+++ b/projects/platypus-finance/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { staking } = require("../helper/staking");
const { sumTokens2 } = require("../helper/unwrapLPs");
const { cachedGraphQuery } = require('../helper/cache')
@@ -13,7 +14,8 @@ const query = `{
async function tvl(api) {
if (api.timestamp > +new Date("2023-02-17") / 1e3) blacklistedTokens.push("0xdaCDe03d7Ab4D81fEDdc3a20fAA89aBAc9072CE2") // USP was hacked
- const { pools } = await cachedGraphQuery("platypus-finance", "https://api.thegraph.com/subgraphs/name/platypus-finance/platypus-dashboard", query)
+ const { pools } = await cachedGraphQuery("platypus-finance", sdk.graph.modifyEndpoint('Bu5QPRWGnZB6NxU4S7kAKQZJpY4pHmAq3TV69V1W2Qqw'), query)
+ console.log(pools)
const tokensAndOwners = pools.map(i => i.assetsList.map(v => [v.token.id, v.id])).flat()
return sumTokens2({ api, tokensAndOwners, blacklistedTokens });
}
@@ -29,5 +31,6 @@ module.exports = {
hallmarks: [
[Math.floor(new Date('2023-02-17') / 1e3), 'Protocol was hacked for $8.5m'],
[Math.floor(new Date('2023-10-12') / 1e3), 'Protocol was hacked for $2m'],
+ [1716811215,"Acquired by Stable Jack"]
],
};
diff --git a/projects/podsfinance/constants.js b/projects/podsfinance/constants.js
index f9a95a1821..70cd0e2e3a 100644
--- a/projects/podsfinance/constants.js
+++ b/projects/podsfinance/constants.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
module.exports = {
ADDRESS_ZERO: ADDRESSES.null,
@@ -7,16 +8,16 @@ module.exports = {
NETWORK_POLYGON: {
id: 137,
name: 'polygon',
- subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods-matic'
+ subgraph: sdk.graph.modifyEndpoint('5yQETkt77T9htftwDSW4WJpoGkPH9KBQzQLzPnuyZ8ti')
},
NETWORK_MAINNET: {
id: 1,
name: 'ethereum',
- subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods'
+ subgraph: sdk.graph.modifyEndpoint('9qiAuWa5ryYeTj1gLy9BGiiVkfgkXnsN25wkYQSfyaws')
},
NETWORK_ARBITRUM: {
id: 42161,
name: 'arbitrum',
- subgraph: 'https://api.thegraph.com/subgraphs/name/pods-finance/pods-arbitrum'
+ subgraph: sdk.graph.modifyEndpoint('5Qz4mWABKaCfr9uGnteAAwmWmBAyQtRDYgB3ydU556HX')
}
}
diff --git a/projects/pole/index.js b/projects/pole/index.js
deleted file mode 100644
index d7b4fd37ad..0000000000
--- a/projects/pole/index.js
+++ /dev/null
@@ -1,6 +0,0 @@
-module.exports = {
- timetravel: false,
- solana: {
- tvl: () => ({})
- },
-};
diff --git a/projects/pole/tokens.json b/projects/pole/tokens.json
deleted file mode 100644
index aef42fd27f..0000000000
--- a/projects/pole/tokens.json
+++ /dev/null
@@ -1,116 +0,0 @@
-[
- {
- "chainId": 101,
- "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
- "symbol": "USDC",
- "name": "USD Coin",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",
- "symbol": "mSOL",
- "name": "Marinade staked SOL (mSOL)",
- "decimals": 9
- },
- {
- "chainId": 101,
- "address": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",
- "symbol": "USDT",
- "name": "USDT",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf",
- "symbol": "USDT-USDC",
- "name": "Saber USDT-USDC LP",
- "decimals": 6,
- "coingeckoId": "tether"
- },
- {
- "chainId": 101,
- "address": "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",
- "symbol": "BTC",
- "name": "Wrapped Bitcoin (Sollet)",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",
- "symbol": "stSOL",
- "name": "Lido Staked SOL",
- "decimals": 9
- },
- {
- "chainId": 101,
- "address": "Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS",
- "symbol": "PAI",
- "name": "PAI (Parrot USD)",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "So11111111111111111111111111111111111111112",
- "symbol": "SOL",
- "name": "Wrapped SOL",
- "decimals": 9
- },
- {
- "chainId": 101,
- "address": "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i",
- "symbol": "UST",
- "name": "UST (Portal)",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K",
- "symbol": "MER",
- "name": "Mercurial",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "PoRTjZMPXb9T7dyU7tpLEZRQj7e6ssfAE62j2oQuc6y",
- "symbol": "PORT",
- "name": "Port Finance Token",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs",
- "symbol": "ETH",
- "name": "Ether (Portal)",
- "decimals": 8
- },
- {
- "chainId": 101,
- "address": "Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1",
- "symbol": "SBR",
- "name": "Saber Protocol Token",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt",
- "symbol": "SRM",
- "name": "Serum",
- "decimals": 6
- },
- {
- "chainId": 101,
- "address": "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX",
- "symbol": "pSOL",
- "name": "pSOL (Parrot SOL)",
- "decimals": 9,
- "coingeckoId": "solana"
- },
- {
- "chainId": 101,
- "address": "EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",
- "symbol": "FIDA",
- "name": "Bonfida",
- "decimals": 6
- }
-]
\ No newline at end of file
diff --git a/projects/polkadex/api.js b/projects/polkadex/api.js
new file mode 100644
index 0000000000..2a3caf7d11
--- /dev/null
+++ b/projects/polkadex/api.js
@@ -0,0 +1,78 @@
+const { ApiPromise, WsProvider } = require("@polkadot/api");
+const sdk = require('@defillama/sdk')
+const {fetchURL} = require("../helper/utils");
+
+const rpcNodes = ["wss://polkadex.api.onfinality.io/public-ws", "wss://polkadex.public.curie.radiumblock.co/ws"];
+const orderbookWallet = "esoEt6uZ3GuFV8EzKB2EAREe3KE9WuRVfmhK1RRtwffY78ArH"
+
+function add(_api, token, bal) {
+ _api.add(token, bal, { skipChain: true })
+}
+
+async function tvl(_api) {
+ const provider = new WsProvider(rpcNodes);
+ const api = await ApiPromise.create({ provider, });
+ await api.isReady;
+
+ const assetMapping = await getAssetMappings();
+
+ const pdexBalance = await api.query.system.account(orderbookWallet)
+ add(_api,'polkadex', pdexBalance.data.free / 1e12)
+
+ let requestedAssets = [];
+ Object.keys(assetMapping).forEach(function(key) {
+ if(key !== "PDEX")
+ requestedAssets.push([key, orderbookWallet]);
+ })
+
+ const results = await api.query.assets.account.multi(requestedAssets);
+
+ for(let i = 0; i < results.length; i++)
+ {
+ if(results[i].toPrimitive() != null) {
+ const coingeckoId = assetMapping[requestedAssets[i][0]];
+ if(coingeckoId) {
+ add(_api, coingeckoId, Number(results[i].toPrimitive().balance) / 1e12)
+ }
+ }
+ }
+
+ return _api.getBalances()
+}
+
+async function staking(_api) {
+ const provider = new WsProvider(rpcNodes);
+ const api = await ApiPromise.create({ provider, });
+ await api.isReady
+
+ const chainActiveEra = await api.query.staking.activeEra();
+
+ let activeEra = JSON.parse(JSON.stringify(chainActiveEra)).index;
+
+ let results = await api.query.staking.erasTotalStake([activeEra]);
+
+ add(_api,'polkadex', results.toPrimitive() / 1e12)
+
+ return _api.getBalances()
+}
+
+async function getAssetMappings() {
+ let coingeckoMappings = await fetchURL("https://integration-api.polkadex.trade/v1/assets");
+ let assetMapping = {};
+
+ if(coingeckoMappings.data === null)
+ return assetMapping;
+
+ Object.keys(coingeckoMappings.data).forEach(function(key) {
+ assetMapping[coingeckoMappings.data[key].asset_id] = coingeckoMappings.data[key].coingecko_id;
+ })
+
+ return assetMapping;
+}
+
+module.exports = {
+ polkadex: {
+ tvl: tvl,
+ staking: staking,
+ },
+}
\ No newline at end of file
diff --git a/projects/polkadex/index.js b/projects/polkadex/index.js
new file mode 100644
index 0000000000..542615642d
--- /dev/null
+++ b/projects/polkadex/index.js
@@ -0,0 +1,6 @@
+const { getExports } = require('../helper/heroku-api')
+
+module.exports = {
+ timetravel: false,
+ ...getExports("polkadex", ['polkadex'], ['staking'])
+}
\ No newline at end of file
diff --git a/projects/ponzi-market/index.js b/projects/ponzi-market/index.js
new file mode 100644
index 0000000000..5c95816f6b
--- /dev/null
+++ b/projects/ponzi-market/index.js
@@ -0,0 +1,22 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+const { nullAddress } = require('../helper/tokenMapping')
+
+const config = {
+ arbitrum: { factory: '0xfCd5dA8c2682e5d17235A5010A01bf6B51B2841D', fromBlock: 186066057 },
+}
+
+module.exports = {
+ methodology:
+ "Ponzi Market's TVL equals to the sum of all ETH balances of all game contracts",
+}
+
+Object.keys(config).forEach(chain => {
+ const { factory, fromBlock } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logs = await getLogs2({ api, factory, eventAbi: "event CreateGame(address contractAddress, uint256 id, uint256 initialDeposit, address creator, uint256 fee, string name, uint256 roi, uint256 maxDeposit, uint256 minDeposit, string file)", fromBlock, })
+ const pools = logs.map(log => log.contractAddress)
+ return api.sumTokens({ owners: pools, tokens: [nullAddress]})
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/pooltogether-v5/index.js b/projects/pooltogether-v5/index.js
index 7c02208969..879280fd6d 100644
--- a/projects/pooltogether-v5/index.js
+++ b/projects/pooltogether-v5/index.js
@@ -1,6 +1,6 @@
const { tvl } = require('../pooltogether/v5.js')
-const chains = ['optimism']
+const chains = ['optimism', 'base', 'arbitrum']
module.exports = {
doublecounted: true,
diff --git a/projects/pooltogether/v3.js b/projects/pooltogether/v3.js
index 9d55942b04..2d8964857d 100644
--- a/projects/pooltogether/v3.js
+++ b/projects/pooltogether/v3.js
@@ -1,15 +1,16 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const abi = require('./abi.json')
const GRAPH_URLS = {
ethereum: [
- 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_1_0',
- 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_2',
- 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_3_8',
- 'https://api.thegraph.com/subgraphs/name/pooltogether/pooltogether-v3_4_3'
+ sdk.graph.modifyEndpoint('DpnLpjCKyyQ8TZnD2V6VNyx4JR7bGrCfGaLbrrsn5r7s'),
+ sdk.graph.modifyEndpoint('6SXRM2pyUiLKgNvXU6fiSF1E3dDDFGGAFiMurbZhZew8'),
+ sdk.graph.modifyEndpoint('6fBV3gC2fjdPsKvnmhi2SNzp74RYZj3tS1AiWFGHapyX'),
+ sdk.graph.modifyEndpoint('C12o8EA9X9EKjjDoxKGUiM9YniNT4RVCiV6jGuYWwwZX')
],
- celo: ['https://api.thegraph.com/subgraphs/name/pooltogether/celo-v3_4_5'],
- bsc: ['https://api.thegraph.com/subgraphs/name/pooltogether/bsc-v3_4_3']
+ celo: [sdk.graph.modifyEndpoint('7RqWfG27PACLZEvSMGtcK87qnV1DJCQfYjNdqwHDQdTe')],
+ bsc: [sdk.graph.modifyEndpoint('9Qmsc7YBLy2sdbEAcGv8vkpaqdGm3YMYoqiWLCid64MN')]
}
const GRAPH_QUERY = `
query GET_POOLS {
diff --git a/projects/pooltogether/v5.js b/projects/pooltogether/v5.js
index 888a11c4d5..b69a502a81 100644
--- a/projects/pooltogether/v5.js
+++ b/projects/pooltogether/v5.js
@@ -2,7 +2,9 @@ const abi = require('./abi.json')
const { sumTokens2 } = require('../helper/unwrapLPs')
const V5_VAULT_FACTORIES = {
- optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39']
+ optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39'],
+ base: ['0xE32F6344875494ca3643198d87524519Dc396DDf'],
+ arbitrum: ['0x44Be003E55e7cE8a2e0ECC3266f8a9A9de2c07BC']
}
async function tvl(api) {
@@ -16,7 +18,7 @@ async function tvl(api) {
const tokens = await api.multiCall({ abi: abi.asset, calls: vaults })
const bals = await api.multiCall({ abi: abi.totalAssets, calls: vaults })
api.addTokens(tokens, bals)
- return sumTokens2({ api, resolveLP: true, })
+ return sumTokens2({ api, resolveLP: true })
}
module.exports = {
diff --git a/projects/portfinance/index.js b/projects/portfinance/index.js
index 19362999ea..f3819fc927 100644
--- a/projects/portfinance/index.js
+++ b/projects/portfinance/index.js
@@ -1,50 +1,12 @@
-const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require('../helper/solana')
async function tvl() {
-
- const tokensAndOwners = [
- /// Main Pool
- [ADDRESSES.solana.USDC, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- [ADDRESSES.solana.USDT, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- [ADDRESSES.solana.SOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["MERt85fc5boKw3BW1eYdxonEuJNvXbiMbs6hvheau5K", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- [ADDRESSES.solana.pSOL, "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["Saber2gLauYim4Mvftnrasomsv6NvAuncvMEZwcLpD1", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["PoRTjZMPXb9T7dyU7tpLEZRQj7e6ssfAE62j2oQuc6y", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
- ["7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj", "8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ"],
-
- /// Hubble Innovation Zone
- ["USDH1SM1ojwWUga67PGrgFWUHibbjqMvuMaDkRJTgkX", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"],
- ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"],
- ["Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"],
- ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"],
- [ADDRESSES.solana.SOL, "GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3"],
-
- /// UXD Innovation Zone
- ["7kbnvuGBxxj8AG9qp8Scn56muWGaRaFqxg1FsRp3PaFT", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"],
- [ADDRESSES.solana.USDC, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"],
- [ADDRESSES.solana.USDT, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"],
- [ADDRESSES.solana.SOL, "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"],
- ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa"],
-
- /// Hedge Innovation Zone
- ["9iLH8T7zoWhY7sBmj1WK9ENbWdS1nL8n9wAxaeRitTa6", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"],
- ["9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"],
- [ADDRESSES.solana.SOL, "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"],
- ["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", "4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb"],
-
- ]
-
- return sumTokens2({ tokensAndOwners })
-
+ return sumTokens2({ owners: [
+ '4bf5HQQZ9qtGGCuxYNnhiTrKpTMTX6HSoLy5a7wUjCEb', // Hedge Innovation Zone
+ '8x2uay8UgrLiX8AAYyF6AkK9z91nNtN6aLwfqPkf6TAQ', // Main Pool
+ 'GU1nCjN7mcLiSX1dtBw2t9agYCw3ybXfu1me41Q2tGT3', // Hubble Innovation Zone
+ 'Hy6gCkJyMmWMaoxLyzELRReLzdBdZ1YEjNGjQzF9LDPa', // UXD Innovation Zone
+ ], })
}
module.exports = {
@@ -52,7 +14,4 @@ module.exports = {
solana: {
tvl
},
- methodology:
- "To obtain the Port TVL we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the token is located.",
-
};
diff --git a/projects/poseidollar/index.js b/projects/poseidollar/index.js
index 436c7336b9..900db73c08 100644
--- a/projects/poseidollar/index.js
+++ b/projects/poseidollar/index.js
@@ -1,5 +1,4 @@
const ADDRESSES = require("../helper/coreAssets.json");
-const { default: BigNumber } = require("bignumber.js");
const sui = require("../helper/chain/sui");
const extractRewardTokenType = (type) => {
@@ -14,13 +13,12 @@ const extractRewardTokenType = (type) => {
const extractFarmTokensTypeLP = (type) => {
if (type.includes("::LP<")) {
const pair = type.split("::LP<")[1];
- const lpType = `${
- type
+ const lpType = `${type
.split(
type.includes("::Custodian<") ? "::Custodian<" : "::FeeCollector<"[1]
)[1]
.split(">")[0]
- }>`;
+ }>`;
const coinXType = pair.split(",")[0]?.trim();
const coinYType = pair.split(",")[1].split(">")[0]?.trim();
return { coinXType, coinYType, lpType };
@@ -51,21 +49,24 @@ const getPool = async (listPoolFlowX, poolRegistry) => {
poolInfo[0].objectType
);
- let coinXStaked = new BigNumber(0);
- let coinYStaked = new BigNumber(0);
+ let coinXStaked = 0;
+ let coinYStaked = 0;
if (lpType) {
const flowxPoolInfo = listPoolFlowX.find((item) =>
item.lp_supply.type.includes(lpType)
);
- const lpRate = new BigNumber(totalStaked).div(
- flowxPoolInfo.lp_supply.fields.value
- );
- coinXStaked = lpRate.multipliedBy(flowxPoolInfo.reserve_x.fields.balance);
- coinYStaked = lpRate.multipliedBy(flowxPoolInfo.reserve_y.fields.balance);
+ const lpRate = totalStaked / flowxPoolInfo.lp_supply.fields.value
+ coinXStaked = lpRate * flowxPoolInfo.reserve_x.fields.balance
+ coinYStaked = lpRate * flowxPoolInfo.reserve_y.fields.balance
} else {
- coinXStaked = new BigNumber(totalStaked);
+ coinXStaked = totalStaked
}
+ if (coinXType === ADDRESSES.sui.USDC)
+ coinXStaked = coinXStaked / 1e3
+ if (coinYType === ADDRESSES.sui.USDC)
+ coinYStaked = coinYStaked / 1e3
+
poolInfoResult.push({
poolId: poolId,
totalStaked: totalStaked,
@@ -92,34 +93,12 @@ async function suiTVL(api) {
"0x3cfad71fc1f65addbadc0d4056fbd1106aa6b9a219e3ea1f5356a2f500d13182"
);
- let totalResult = {};
-
//TVL on PSH Earn
for (let i = 0; i < poolShareInfo.length; i++) {
- if (!totalResult.hasOwnProperty(poolShareInfo[i].coinX)) {
- totalResult[poolShareInfo[i].coinX] = poolShareInfo[i].coinXStaked;
- } else {
- totalResult[poolShareInfo[i].coinX] = totalResult[
- poolShareInfo[i].coinX
- ].plus(poolShareInfo[i].coinXStaked);
- }
+ api.add(poolShareInfo[i].coinX, poolShareInfo[i].coinXStaked)
- if (poolShareInfo[i].coinY) {
- if (!totalResult.hasOwnProperty(poolShareInfo[i].coinY)) {
- totalResult[poolShareInfo[i].coinY] = poolShareInfo[i].coinYStaked;
- } else {
- totalResult[poolShareInfo[i].coinY] = totalResult[
- poolShareInfo[i].coinY
- ].plus(poolShareInfo[i].coinYStaked);
- }
- }
- }
-
- //Result
- for (const property in totalResult) {
- if (property) {
- api.add(property, totalResult[property].toFixed(0));
- }
+ if (poolShareInfo[i].coinY)
+ api.add(poolShareInfo[i].coinY, poolShareInfo[i].coinYStaked)
}
}
diff --git a/projects/possumLabs/index.js b/projects/possumLabs/index.js
index acad6bf323..07e33b7b14 100644
--- a/projects/possumLabs/index.js
+++ b/projects/possumLabs/index.js
@@ -1,15 +1,25 @@
const portalsContractAddress = "0x24b7d3034C711497c81ed5f70BEE2280907Ea1Fa";
-const timeRiftContractAddress = "0x6df4EF024089ab148078fdD88f5BF0Ee63248D3E";
-const hlpToken = "0x4307fbDCD9Ec7AEA5a1c2958deCaa6f316952bAb";
-const flashToken = "0xc628534100180582E43271448098cb2c185795BD";
+const portalsV2 = {
+ USDC: "0x9167CFf02D6f55912011d6f498D98454227F4e16",
+ USDCE: "0xE8EfFf304D01aC2D9BA256b602D736dB81f20984",
+ ETH: "0xe771545aaDF6feC3815B982fe2294F7230C9c55b",
+ WBTC: "0x919B37b5f2f1DEd2a1f6230Bf41790e27b016609",
+ ARB: "0x523a93037c47Ba173E9080FE8EBAeae834c24082",
+ LINK: "0x51623b54753E07Ba9B3144Ba8bAB969D427982b6",
+};
async function tvl(api) {
- const portalsStaked = await api.call({ target: portalsContractAddress, abi: "uint256:totalPrincipalStaked", });
- api.add(hlpToken, portalsStaked)
- return api.sumTokens({ owner: timeRiftContractAddress, tokens: [flashToken] })
+ const vaults = [portalsContractAddress, ...Object.values(portalsV2)]
+ const bals = await api.multiCall({ abi: 'uint256:totalPrincipalStaked', calls: vaults})
+ const tokens = await api.multiCall({ abi: 'address:PRINCIPAL_TOKEN_ADDRESS', calls: vaults})
+ api.add(tokens, bals)
}
module.exports = {
- methodology: "TVL is equal to the amount staked in the Portals and TimeRift contracts",
+ methodology:
+ "TVL is equal to the amount staked in the Portals V1 and Portals V2 contracts.",
arbitrum: { tvl },
-};
\ No newline at end of file
+ hallmarks: [
+ [1715776637, "Portals V2 Launch"],
+ ],
+};
diff --git a/projects/prdt/index.js b/projects/prdt/index.js
index 19a9b6564a..e7100be91e 100644
--- a/projects/prdt/index.js
+++ b/projects/prdt/index.js
@@ -5,14 +5,16 @@ const config = {
ethereum: {
owners: Object.values({
predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841",
+ predictionPROV3: "0x792b18ec0d39093f10f8b34676e2f8669a495e9b",
}),
tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC],
},
arbitrum: {
owners: Object.values({
predictionPROV2: "0x062EB9830D1f1f0C64ac598eC7921f0cbD6d4841",
+ predictionPROV3: "0xe2ca0a434effea151d5b2c649b754acd3c8a20f0",
}),
- tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC],
+ tokens: [ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC_CIRCLE],
},
bsc: {
owners: Object.values({
@@ -22,8 +24,9 @@ const config = {
predictionPRO: "0x599974D3f2948b50545Fb5aa77C9e0bddc230ADE",
predictionPROV2: "0x22dB94d719659d7861612E0f43EE28C9FF9909C7",
predictionclassicV3: "0x00199E444155f6a06d74CF36315419d39b874f5c",
+ predictionPROV3: "0x49eFb44831aD88A9cFFB183d48C0c60bF4028da8",
}),
- tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC],
+ tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT, ADDRESSES.bsc.USDC, ADDRESSES.bsc.ETH],
},
polygon: {
owners: Object.values({
@@ -32,8 +35,9 @@ const config = {
predictionPRO: "0x764C3Ea13e7457261E5C1AaD597F281f3e738240",
predictionPROV2: "0x8251E5EBc2d2C20f6a116144800D569FAF75d746",
predictionclassicv3: "0x9f9564BE7b566dfE4B091a83a591752102aF3F33",
+ predictionPROV3: "0x0b9c8c0a04354f41b985c10daf7db30bc66998f5",
}),
- tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC],
+ tokens: [ADDRESSES.null, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC_CIRCLE, ADDRESSES.polygon.WETH],
},
};
diff --git a/projects/prime-protocol/index.js b/projects/prime-protocol/index.js
index 850504ce07..07379c2fdd 100644
--- a/projects/prime-protocol/index.js
+++ b/projects/prime-protocol/index.js
@@ -1,4 +1,4 @@
-const sdk = require('@defillama/sdk');
+const sdk = require("@defillama/sdk");
const { sumTokens2, } = require('../helper/unwrapLPs');
const { cachedGraphQuery } = require('../helper/cache');
@@ -17,7 +17,7 @@ const PRIME_SATELLITE_NETWORKS = {
// filecoin: 314
};
-const primeSubgraphUrl = 'https://api.thegraph.com/subgraphs/name/prime-protocol/liquidity-incentives';
+const primeSubgraphUrl = sdk.graph.modifyEndpoint('6LrvPGTZeMZfEQh4p9DvDBBv4G8cjhLs4v3mdiUycERp');
const primeMarketsQuery = `{
markets { address chainId }
diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js
index 875ca18e33..d2bc988eab 100644
--- a/projects/primex-finance/index.js
+++ b/projects/primex-finance/index.js
@@ -8,12 +8,29 @@ const config = {
positionManager: '0x02bcaA4633E466d151b34112608f60A82a4F6035',
traderBalanceVault: '0x0801896C67CF024606BcC92bd788d6Eb077CC74F',
defaultTokens: {
+ MATIC: ADDRESSES.polygon.WMATIC_1,
+ WMATIC: ADDRESSES.polygon.WMATIC_2,
WETH: ADDRESSES.polygon.WETH_1,
WBTC: ADDRESSES.polygon.WBTC,
- WMATIC: ADDRESSES.polygon.WMATIC_2,
USDC: ADDRESSES.polygon.USDC,
USDT: ADDRESSES.polygon.USDT,
- EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A"
+ AAVE: "0xD6DF932A45C0f255f85145f286eA0b292B21C90B",
+ DAI: ADDRESSES.polygon.DAI,
+ LINK: "0x53E0bca35eC356BD5ddDFebbD1Fc0fD03FaBad39",
+ GNS: "0xE5417Af564e4bFDA1c483642db72007871397896",
+ EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A",
+ OM: "0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea",
+ SAND: "0xbbba073c31bf03b8acf7c28ef0738decf3695683",
+ QUICK: "0xb5c064f955d8e7f38fe0460c556a72987494ee17",
+ UNI: "0xb33eaad8d922b1083446dc23f610c2567fb5180f",
+ MANA: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4",
+ BAL: "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3",
+ GRT: "0x5fe2b58c013d7601147dcdd68c143a77499f5531",
+ SNX: "0x50b728d8d964fd00c2d0aad81718b71311fef68a",
+ GHST: "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7",
+ AVAX: "0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b",
+ CRV: "0x172370d5cd63279efa6d502dab29171933a610af",
+ SUSHI: "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a"
},
aaveTokens: {
[ADDRESSES.polygon.WETH_1]: "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
@@ -32,6 +49,7 @@ const config = {
USDC: ADDRESSES.arbitrum.USDC_CIRCLE,
USDT: ADDRESSES.arbitrum.USDT,
WETH: ADDRESSES.arbitrum.WETH,
+ ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
WBTC: ADDRESSES.arbitrum.WBTC,
ARB: ADDRESSES.arbitrum.ARB,
DAI: ADDRESSES.arbitrum.DAI,
@@ -43,7 +61,17 @@ const config = {
MAGIC: "0x539bdE0d7Dbd336b79148AA742883198BBF60342",
JOE: "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07",
STG: "0x6694340fc020c5E6B96567843da2df01b2CE1eb6",
- EPMX: "0xA533f744B179F2431f5395978e391107DC76e103"
+ EPMX: "0xA533f744B179F2431f5395978e391107DC76e103",
+ LDO: "0x13Ad51ed4F1B7e9Dc168d8a00cB3f4dDD85EfA60",
+ UNI: "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0",
+ PEPE: "0x25d887Ce7a35172C62FeBFD67a1856F20FaEbB00",
+ GRT: "0x9623063377AD1B27544C965cCd7342f7EA7e88C7",
+ CRV: "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978",
+ KNC: "0xe4DDDfe67E7164b0FE14E218d80dC4C08eDC01cB",
+ XAI: "0x4cb9a7ae498cedcbb5eae9f25736ae7d428c9d66",
+ FXS: "0x9d2F299715D94d8A7E6F5eaa8E654E8c74a988A7",
+ TIA: "0xD56734d7f9979dD94FAE3d67C7e928234e71cD4C",
+ RPL: "0xB766039cc6DB368759C1E56B79AFfE831d0Cc507",
},
aaveTokens: {
[ADDRESSES.arbitrum.DAI]: "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
@@ -60,6 +88,7 @@ const config = {
traderBalanceVault: '0x156e2fC8e1906507412BEeEB6640Bf999a1Ea76b',
defaultTokens: {
WETH: ADDRESSES.ethereum.WETH,
+ ETH: "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",
WBTC: ADDRESSES.ethereum.WBTC,
USDC: ADDRESSES.ethereum.USDC,
USDT: ADDRESSES.ethereum.USDT,
diff --git a/projects/prixmswap-v3/index.js b/projects/prixmswap-v3/index.js
new file mode 100644
index 0000000000..5150c4e604
--- /dev/null
+++ b/projects/prixmswap-v3/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require('../helper/uniswapV3')
+
+module.exports = uniV3Export({
+ kroma: { factory: '0x94527f0fdbb1497C77Bb8d409F0dAEbB323ca229', fromBlock: 10032631 }
+})
\ No newline at end of file
diff --git a/projects/probit/index.js b/projects/probit/index.js
new file mode 100644
index 0000000000..7777210d33
--- /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)
diff --git a/projects/psyoptions/index.js b/projects/psyoptions/index.js
index c77d0b9ec4..43371f8097 100644
--- a/projects/psyoptions/index.js
+++ b/projects/psyoptions/index.js
@@ -127,6 +127,9 @@ async function tvl() {
module.exports = {
misrepresentedTokens: true,
+ hallmarks: [
+ [1717977600,"Withdrawal Only Mode Announced"]
+ ],
timetravel: false,
solana: {
tvl,
diff --git a/projects/pu239/index.js b/projects/pu239/index.js
new file mode 100644
index 0000000000..7a849903a1
--- /dev/null
+++ b/projects/pu239/index.js
@@ -0,0 +1,13 @@
+const { aaveExports } = require("../helper/aave");
+const methodologies = require("../helper/methodologies");
+
+module.exports = {
+ methodology: methodologies.lendingMarket,
+ map: aaveExports(
+ "map",
+ "0x0fBB7d9866D357f75a8fAf83330b7d089703464e",
+ undefined,
+ ["0xa9fc4Ea8A1dE8C722D8a70a73f26E2DBD89475bd"],
+ { v3: true }
+ ),
+};
diff --git a/projects/puff-penthouse/index.js b/projects/puff-penthouse/index.js
index ceae2c0c6d..fae3fa7078 100644
--- a/projects/puff-penthouse/index.js
+++ b/projects/puff-penthouse/index.js
@@ -1,13 +1,14 @@
const { sumTokensExport } = require('../helper/unwrapLPs')
-const { staking } = require('../helper/staking')
+const { stakings } = require('../helper/staking')
module.exports = {
mantle: {
- staking: staking("0xBeCd6b3D8B06479c83533f0d7E6DF1b0e413AeEa", "0x26a6b0dcdCfb981362aFA56D581e4A7dBA3Be140"),
+ staking: stakings(
+ ["0xBeCd6b3D8B06479c83533f0d7E6DF1b0e413AeEa", "0x1260140fEa31cf920D7D890aD1de85cbAC1Fea12", "0x35Ee9e36804d358A2892FA0De336426cC3Cb18e4"],
+ "0x26a6b0dcdCfb981362aFA56D581e4A7dBA3Be140"),
tvl: sumTokensExport({
- tokensAndOwners: [
- ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0", "0x0CC41C11878254aF8E65ca61C03DD03735F2DC6d"]
- ]
+ tokens: ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0"],
+ owners: ["0x0CC41C11878254aF8E65ca61C03DD03735F2DC6d", "0x1260140fEa31cf920D7D890aD1de85cbAC1Fea12", "0x35Ee9e36804d358A2892FA0De336426cC3Cb18e4"]
}),
},
};
diff --git a/projects/pump-markets/index.js b/projects/pump-markets/index.js
index 0568500afd..0a138e98d5 100644
--- a/projects/pump-markets/index.js
+++ b/projects/pump-markets/index.js
@@ -8,4 +8,16 @@ module.exports = {
tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH],
}),
},
+ ethereum: {
+ tvl: sumTokensExport({
+ owner: "0x360CFF6ca6278954933A8556D1938B4cF3D747B5",
+ tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.WETH],
+ }),
+ },
+ arbitrum: {
+ tvl: sumTokensExport({
+ owner: "0x360CFF6ca6278954933A8556D1938B4cF3D747B5",
+ tokens: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.WETH],
+ }),
+ },
};
diff --git a/projects/pumpbtc/index.js b/projects/pumpbtc/index.js
new file mode 100644
index 0000000000..bce675989a
--- /dev/null
+++ b/projects/pumpbtc/index.js
@@ -0,0 +1,17 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+
+module.exports = {
+ methodology: 'TVL for pumpBTC is calculated based on the total value of WBTC, FBTC, BTCB held in the contract that were utilized in the minting process of pumpBTC.',
+}
+const config = {
+ ethereum: { owners: ['0x1fCca65fb6Ae3b2758b9b2B394CB227eAE404e1E', '0x3d9bCcA8Bc7D438a4c5171435f41a0AF5d5E6083'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364', ADDRESSES.ethereum.WBTC], },
+ bsc: { owners: ['0x2Ee808F769AB697C477E0aF8357315069b66bCBb'], tokens: ['0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c'], },
+ mantle: { owners: ['0xd6Ab15B2458B6EC3E94cE210174d860FdBdd6b96'], tokens: ['0xC96dE26018A54D51c097160568752c4E3BD6C364'], },
+}
+
+Object.keys(config).forEach(chain => {
+ const { owners, tokens, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => api.sumTokens({ owners, tokens })
+ }
+})
diff --git a/projects/q-infinity/index.js b/projects/q-infinity/index.js
new file mode 100644
index 0000000000..147ca102d4
--- /dev/null
+++ b/projects/q-infinity/index.js
@@ -0,0 +1,22 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const { sumTokensExport } = require('../helper/unwrapLPs')
+
+const WUSDC_VAULT = "0x41AA6785b4ffE18A79bba796793E828059Ff342a"
+const WETH_VAULT = "0x367750af92a2C427Cc94E1c562DEa9753a42c27e"
+const ELK_VAULT = "0x1EAf38375CA45685D3FCa0c53e9fa6b02bb9B0D5"
+
+const owners = [
+ WUSDC_VAULT,
+ WETH_VAULT,
+ ELK_VAULT,
+]
+const tokens = [
+ ADDRESSES.q.WUSDC,
+ ADDRESSES.q.WETH,
+ ADDRESSES.q.ELK,
+]
+
+module.exports = {
+ q: { tvl: sumTokensExport({ owners, tokens }) },
+};
\ No newline at end of file
diff --git a/projects/qidao/index.js b/projects/qidao/index.js
index 3c9e276e1f..54fb14c59e 100644
--- a/projects/qidao/index.js
+++ b/projects/qidao/index.js
@@ -174,6 +174,7 @@ const config = {
"0x169d47043cc0c94c39fa327941c56cb0344dc508",
"0xb5b31e6a13ae856bc30b3c76b16edad9f432b54f"
],
+ psm: ["0xdEffF862C76C6f9c7164B44f860fAe64C2A92aF5"],
toa: [
[nullAddress, '0xa3fa99a148fa48d14ed51d610c367c61876997f1'],
// vaults
diff --git a/projects/quasar-swap/index.js b/projects/quasar-swap/index.js
index de27a98231..881d4a937d 100644
--- a/projects/quasar-swap/index.js
+++ b/projects/quasar-swap/index.js
@@ -31,7 +31,7 @@ module.exports = {
block,
}),
}, */
- //deadFrom: "2024-01-01",
+ deadFrom: "2024-01-01",
nova: {
tvl: () => ({}),
staking: () => ({}),
diff --git a/projects/quickswap/index.js b/projects/quickswap/index.js
index a8d6014a81..fd961c2af7 100644
--- a/projects/quickswap/index.js
+++ b/projects/quickswap/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
const { getChainTvl } = require('../helper/getUniSubgraphTvl');
const { staking } = require('../helper/staking');
@@ -8,7 +9,7 @@ module.exports = {
polygon:{
staking: staking("0x958d208Cdf087843e9AD98d23823d32E17d723A1", ADDRESSES.polygon.QUICK),
tvl: getChainTvl({
- polygon: 'https://api.thegraph.com/subgraphs/name/sameepsi/quickswap06'
+ polygon: sdk.graph.modifyEndpoint('FUWdkXWpi8JyhAnhKL5pZcVshpxuaUQG8JHMDqNCxjPd')
})('polygon')
},
hallmarks:[
@@ -17,6 +18,6 @@ module.exports = {
[1619611200, "DeFi season on Polygon PoS begun"],
[1623851400, "Iron Finance V1 collapse"],
[1651668418, "QUICK split by 1:1000"],
- [1652481840, "QuickSwap’s GoDaddy Domain Hijack"]
+ [1652481840, "QuickSwap GoDaddy Domain Hijack"]
]
}
diff --git a/projects/ratio-finance/index.js b/projects/ratio-finance/index.js
index 6249585e99..d36a3029b3 100644
--- a/projects/ratio-finance/index.js
+++ b/projects/ratio-finance/index.js
@@ -11,6 +11,7 @@ module.exports = {
solana: {
tvl,
},
+ deadFrom: 1675728000,
methodology:
"To obtain the Ratio Finance TVL we make on-chain calls",
};
diff --git a/projects/raydium/api.js b/projects/raydium/api.js
new file mode 100644
index 0000000000..01ea1e8f65
--- /dev/null
+++ b/projects/raydium/api.js
@@ -0,0 +1,21 @@
+const { getExports } = require('../helper/heroku-api')
+const { sumTokens2 } = require('../helper/solana')
+
+module.exports = {
+ timetravel: false,
+}
+const { solana: { tvl } } = getExports("raydium", ['solana'])
+
+module.exports.solana = {
+ staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY'] }),
+ tvl: tvlWithCheck,
+}
+
+async function tvlWithCheck(api) {
+ const balances = await tvl(api)
+ api.addBalances(balances)
+ const usdValue = await api.getUSDValue()
+ // for some godforsaken reason, the TVL is sometimes reported as 60M, we fail in that case rather than report a wrong number
+ if (usdValue < 2e8) throw new Error('TVL is too low :' + usdValue / 1e6 + 'M')
+ return api.getBalances()
+}
\ No newline at end of file
diff --git a/projects/raydium.js b/projects/raydium/index.js
similarity index 75%
rename from projects/raydium.js
rename to projects/raydium/index.js
index b179ff1d78..816005d17f 100644
--- a/projects/raydium.js
+++ b/projects/raydium/index.js
@@ -1,10 +1,9 @@
-const { getConnection, sumTokens2, decodeAccount, } = require("./helper/solana");
+const { getConnection, sumTokens2, decodeAccount, } = require("../helper/solana");
const { PublicKey, } = require("@solana/web3.js");
-const sdk = require('@defillama/sdk')
-const { TokenAmountLayout, KeyLayoutv4 } = require("./helper/utils/solana/layouts/raydium-layout");
-const { transformDexBalances } = require("./helper/portedTokens");
-const { sleep } = require("./helper/utils");
+const { TokenAmountLayout, KeyLayoutv4 } = require("../helper/utils/solana/layouts/raydium-layout");
+const { transformDexBalances } = require("../helper/portedTokens");
+const { sleep } = require("../helper/utils");
const CLMM = 'CAMMCzo5YL8w4VFF8KVHrK22GGUsp5VTaW7grrKgrWqK'
const AmmV4 = '675kPX9MHTjS2zt1qfr1NYHuzeLXfQM9H24wFSUt1Mp8'
@@ -30,6 +29,8 @@ async function tvlCLMM() {
}]
})
const data = accounts.map(i => decodeAccount('raydiumCLMM', i.account))
+ console.log(data.length, 'fetched CLMM accounts')
+
const tokenAccounts = data.map(i => [i.vaultA, i.vaultB]).flat().map(i => i.toString())
return sumTokens2({ tokenAccounts })
}
@@ -40,15 +41,18 @@ async function ammV4Tvl(api) {
const auth = '5Q544fKrFoe6tsEbD7S8EmxGTJYAKtTVhAW5Q5pge4j1'
await sleep(10000)
+ console.time('raydium: ammV4Tvl fetching vault balances')
const allPoolVaultAmount = await connection.getProgramAccounts(new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA'), { filters: [{ dataSize: 165 }, { memcmp: { offset: 32, bytes: auth } }], dataSlice: { offset: 64, length: TokenAmountLayout.span } })
- await sleep(30000)
- const allPoolKeyInfo = await connection.getProgramAccounts(new PublicKey(AmmV4), { filters: [{ dataSize: 752 }], dataSlice: { offset: 336, length: KeyLayoutv4.span } })
-
+ console.timeEnd('raydium: ammV4Tvl fetching vault balances')
+ console.log(allPoolVaultAmount.length, 'fetched vault amounts')
const vaultIdToAmount = {}
for (const item of allPoolVaultAmount) {
vaultIdToAmount[item.pubkey.toString()] = TokenAmountLayout.decode(item.account.data).amount.toString()
}
+ await sleep(20000)
+ const allPoolKeyInfo = await connection.getProgramAccounts(new PublicKey(AmmV4), { filters: [{ dataSize: 752 }], dataSlice: { offset: 336, length: KeyLayoutv4.span } })
+
let i = 0
let j = 0
let data = []
@@ -113,12 +117,47 @@ async function ammV2V3() {
})
}
+async function combinedTvl(api) {
+ try {
+
+ console.time('raydium: combinedTvl')
+
+ console.time('raydium: tvlCLMM')
+ const balancesCLMM = await tvlCLMM()
+ api.addBalances(balancesCLMM)
+ console.timeEnd('raydium: tvlCLMM')
+
+ console.time('raydium: ammStableTvl')
+ const balancesAmmStable = await ammStableTvl()
+ api.addBalances(balancesAmmStable)
+ console.timeEnd('raydium: ammStableTvl')
+
+ console.time('raydium: ammV2V3')
+ const balancesAmmV2V3 = await ammV2V3()
+ api.addBalances(balancesAmmV2V3)
+ console.timeEnd('raydium: ammV2V3')
+
+ console.time('raydium: ammV4Tvl')
+ await ammV4Tvl(api)
+ console.timeEnd('raydium: ammV4Tvl')
+
+ } catch (e) {
+ console.error('raydium', e)
+ throw e
+ }
+
+ console.timeEnd('raydium: combinedTvl')
+ const tvl = await api.getUSDValue()
+ if (tvl < 1.5e8) throw new Error('TVL is too low :' + tvl/1e6 + 'M')
+ return api.getBalances()
+}
+
module.exports = {
timetravel: false,
misrepresentedTokens: true,
hallmarks: [[1667865600, "FTX collapse"]],
solana: {
- tvl: sdk.util.sumChainTvls([tvlCLMM, ammStableTvl, ammV4Tvl, ammV2V3]),
+ tvl: combinedTvl,
staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY'] })
},
};
\ No newline at end of file
diff --git a/projects/real-veRWA/index.js b/projects/real-veRWA/index.js
new file mode 100644
index 0000000000..e86393a001
--- /dev/null
+++ b/projects/real-veRWA/index.js
@@ -0,0 +1,11 @@
+const { staking } = require('../helper/staking')
+const RWAToken = '0x4644066f535Ead0cde82D209dF78d94572fCbf14'
+const veRWA = '0xa7B4E29BdFf073641991b44B283FD77be9D7c0F4'
+
+module.exports = {
+ misrepresentedTokens: true,
+ real: {
+ tvl: () => ({}),
+ staking: staking(veRWA, RWAToken),
+ }
+}
\ No newline at end of file
diff --git a/projects/rehold-v2/index.js b/projects/rehold-v2/index.js
index 6554925930..30a1825dd5 100644
--- a/projects/rehold-v2/index.js
+++ b/projects/rehold-v2/index.js
@@ -7,7 +7,40 @@ const tvl = sumTokensExport(config)
module.exports = {
ethereum: { tvl },
- bsc: { tvl },
+ bsc: { tvl: sumTokensExport({
+ owner: VAULT_V2, fetchCoValentTokens: true,
+ tokens: [
+ ADDRESSES.bsc.USDT, // BSC-USD
+ ADDRESSES.bsc.ETH, //Bpeg ETH
+ ADDRESSES.bsc.BTCB, // btcb
+ ADDRESSES.bsc.USDC, // usdc
+ "0x570A5D26f7765Ecb712C0924E4De545B89fD43dF", // sol
+ "0x1Fa4a73a3F0133f0025378af00236f3aBDEE5D63", // near
+ "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", // xrp
+ "0x1CE0c2827e2eF14D5C4f29a091d735A204794041", // shib
+ "0x111111111117dC0aa78b770fA6A738034120C302", // 1inch
+ "0x045c4324039dA91c52C55DF5D785385Aab073DcF", // bCFX
+ "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", // doge
+ "0x4B0F1812e5Df2A09796481Ff14017e6005508003", // twt
+ "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E", // floki
+ "0x0Eb3a705fc54725037CC9e008bDede697f62F335", // atom
+ "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", // link
+ "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", // matic
+ "0x56b6fB708fC5732DEC1Afc8D8556423A2EDcCbD6", // eos
+ ADDRESSES.bsc.BUSD, // busd
+ "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", // uni
+ "0xD41FDb03Ba84762dD66a0af1a6C8540FF1ba5dfb", // sfp
+ "0xAD29AbB318791D579433D831ed122aFeAf29dcfe", // ftm
+ "0xB0D502E938ed5f4df2E681fE6E419ff29631d62b", // stg
+ "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", // dot
+ ADDRESSES.bsc.WBNB, // wbnb
+ "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", // cake
+ "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // dai
+ "0x715D400F88C167884bbCc41C5FeA407ed4D2f8A0", // axs
+ "0x031b41e504677879370e9DBcF937283A8691Fa7f", // fet
+ "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", // ada
+ "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", // fil
+ ]}) },
polygon: { tvl },
avax: { tvl },
arbitrum: { tvl },
diff --git a/projects/ren/index.js b/projects/ren/index.js
index 659535bdb4..e52debcd52 100644
--- a/projects/ren/index.js
+++ b/projects/ren/index.js
@@ -3,15 +3,15 @@ const { request, gql } = require("graphql-request");
const sdk = require("@defillama/sdk");
const { getTokenSupply } = require('../helper/solana')
-const ethGraphUrl = "https://api.thegraph.com/subgraphs/name/renproject/renvm";
+const ethGraphUrl = sdk.graph.modifyEndpoint('AJaQdD8DUunuwHCbAsZk5h62AfyNG1etRtK9EcDH7gwH');
const bscGraphUrl =
- "https://api.thegraph.com/subgraphs/name/renproject/renvm-binance-smart-chain";
+ sdk.graph.modifyEndpoint('6UCMxzH5LPvZrLhcpSVrSDhoKRYJchvHM7vnTUo2bBp2');
const avalancheGraphUrl =
- "https://api.thegraph.com/subgraphs/name/renproject/renvm-avalanche";
+ sdk.graph.modifyEndpoint('GBRcEpUZTHMyjmtkPsHMYmHuPtcLFqnU5SPvpaLdfmau');
const fantomGraphUrl =
- "https://api.thegraph.com/subgraphs/name/renproject/renvm-fantom";
+ sdk.graph.modifyEndpoint('2TV9sKK7fLvfsbnUox6irt3XbiHAzw1fvbh9j8vnBXmH');
const polygonGraphUrl =
- "https://api.thegraph.com/subgraphs/name/renproject/renvm-polygon";
+ sdk.graph.modifyEndpoint('GQCGcDW16JfawMXegTemUte8PPyJQVvtF6kACvMYwX8V');
const graphQuery = gql`
{
assets {
diff --git a/projects/renzo/index.js b/projects/renzo/index.js
index 74f234f11f..94b80e7611 100644
--- a/projects/renzo/index.js
+++ b/projects/renzo/index.js
@@ -2,6 +2,7 @@ const ADDRESSES = require('../helper/coreAssets.json')
const L1_EZ_ETH_ADDRESS = "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110";
const L2_EZ_ETH_ADDRESS = ADDRESSES.blast.ezETH;
const L1_LOCKBOX_ADDRESS = "0xC8140dA31E6bCa19b287cC35531c2212763C2059";
+const L1_PZ_ETH_ADDRESS = "0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811";
async function L2Tvl(api) {
return {
@@ -12,7 +13,9 @@ async function L2Tvl(api) {
async function ethTvl(api) {
const totalTvl = await api.call({ target: L1_EZ_ETH_ADDRESS, abi: "erc20:totalSupply" });
const lockBoxBalance = await api.call({ target: L1_EZ_ETH_ADDRESS, abi: "erc20:balanceOf", params: [L1_LOCKBOX_ADDRESS] })
- api.add(L1_EZ_ETH_ADDRESS, totalTvl - lockBoxBalance)
+ const pzEthBalance = await api.call({target: L1_PZ_ETH_ADDRESS, abi: "erc20:totalSupply"});
+ api.add(L1_EZ_ETH_ADDRESS, totalTvl - lockBoxBalance);
+ api.add(L1_PZ_ETH_ADDRESS, pzEthBalance);
}
const chains = ["mode", "blast", "bsc", "linea", "arbitrum", "base"]
diff --git a/projects/repl/abi.json b/projects/repl/abi.json
index fb2a47eee7..22d7e0cd83 100644
--- a/projects/repl/abi.json
+++ b/projects/repl/abi.json
@@ -1,7 +1,8 @@
{
- "getAllActiveAgents": "function getAllActiveAgents() view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting)[])",
+ "getPagedAgents": "function getPagedAgents(uint offset, uint count) view returns ((address agent, address owner, uint64 originOwnerID, uint64 curOwnerID, uint64 curBeneficiary, uint64 actorID, uint64 agentID, uint256 targetPledge, uint256 safePledge, uint256 lastSafePledgeUpdateTime, uint256 recoveredPledge, uint256 agentContractBalance, uint256 minerBalance, uint8 status, (bytes val, bool neg) availableBalance, uint256 reservedBalance, uint256 passiveMinting, bool isValid)[])",
"getTVLComponents": "function getTVLComponents() view returns ((uint256))",
"slot0": "function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)",
"totalSupply": "uint256:totalSupply",
- "PFILPerToken": "uint256:PFILPerToken"
+ "PFILPerToken": "uint256:PFILPerToken",
+ "getAllAgentsCount": "function getAllAgentsCount() view returns ((uint256))"
}
diff --git a/projects/repl/index.js b/projects/repl/index.js
index 5a350506d4..833e739754 100644
--- a/projects/repl/index.js
+++ b/projects/repl/index.js
@@ -5,12 +5,22 @@ const { json } = require('starknet');
const { ethers } = require('ethers');
const http = require('../helper/http');
-const WFIL_WPFIL_POOL_ADDRESS = '0x443A6243A36Ef0ae1C46523d563c15abD787F4E9';
-const PFIL_CONTRACT = '0xAaa93ac72bECfbBc9149f293466bbdAa4b5Ef68C';
-const WPFIL_CONTRACT = '0x57E3BB9F790185Cfe70Cc2C15Ed5d6B84dCf4aDb';
-const WFIL_CONTRACT = '0x60E1773636CF5E4A227d9AC24F20fEca034ee25A';
const REPL_HELPER_CONTRACT = '0x65846aECBF23385F76B73ef1EDD1ebdFf7Ac258D';
+const getAllValidAgents = async (api) => {
+ const total = await api.call({ abi: abi.getAllAgentsCount, target: REPL_HELPER_CONTRACT })
+ const COUNT = 30
+ const loop = Math.ceil(total / COUNT)
+ const query = new Array(loop)
+ .fill(0)
+ .map((item, i) => api.call({ abi: abi.getPagedAgents, target: REPL_HELPER_CONTRACT, params: [i * COUNT, COUNT] }))
+ const lists = (await Promise.all(query)).reduce(
+ (pre, cur) => [...pre, ...cur],
+ []
+ )
+ return lists.filter(agent => !!agent.isValid)
+}
+
// Total Assets of Miners pledged to the protocol
const getMinerAssets = (agents) => {
return agents.reduce((sum, agent) => sum + +agent.minerBalance, 0);
@@ -21,7 +31,7 @@ module.exports = {
tvl: async (api) => {
const [tvlComponents, activeAgents] = await Promise.all([
api.call({ abi: abi.getTVLComponents, target: REPL_HELPER_CONTRACT }),
- api.call({ abi: abi.getAllActiveAgents, target: REPL_HELPER_CONTRACT }),
+ getAllValidAgents(api),
]);
const minerAssets = getMinerAssets(activeAgents);
diff --git a/projects/resolv/index.js b/projects/resolv/index.js
new file mode 100644
index 0000000000..95ba4c2387
--- /dev/null
+++ b/projects/resolv/index.js
@@ -0,0 +1,17 @@
+const USR = "0x66a1E37c9b0eAddca17d3662D6c05F4DECf3e110";
+const RLP = "0x4956b52aE2fF65D74CA2d61207523288e4528f96";
+
+const erc20 = {
+ "totalSupply": "uint256:totalSupply"
+};
+
+async function ethTvl(api) {
+ api.add(USR, await api.call({ abi: erc20.totalSupply, target: USR }));
+ api.add(RLP, await api.call({ abi: erc20.totalSupply, target: RLP }));
+}
+
+module.exports = {
+ ethereum: {
+ tvl: ethTvl
+ }
+};
\ No newline at end of file
diff --git a/projects/return-finance/index.js b/projects/return-finance/index.js
index 73c4b6961b..8a173a7ca4 100644
--- a/projects/return-finance/index.js
+++ b/projects/return-finance/index.js
@@ -5,11 +5,18 @@ module.exports = {
};
const config = {
- ethereum: ['0xFD360A096E4a4c3C424fc3aCd85da8010D0Db9a5', '0x201254227f9fE57296C257397Be6c617389a8cCb'],
- avax: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'],
- polygon: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'],
- base: ['0x3B6385493a1d4603809dDbaE647200eF8baA53F5'],
-}
+ ethereum: [
+ "0xFD360A096E4a4c3C424fc3aCd85da8010D0Db9a5",
+ "0x201254227f9fE57296C257397Be6c617389a8cCb",
+ ],
+ avax: [
+ "0x3B6385493a1d4603809dDbaE647200eF8baA53F5",
+ "0xB86e10A24172155aE20B524e6e8E17a244c4d3aE",
+ ],
+ polygon: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"],
+ base: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"],
+};
+
Object.keys(config).forEach(chain => {
diff --git a/projects/rho-markets/index.js b/projects/rho-markets/index.js
new file mode 100644
index 0000000000..79ea498355
--- /dev/null
+++ b/projects/rho-markets/index.js
@@ -0,0 +1,6 @@
+const { compoundExports2, methodology } = require('../helper/compound')
+
+module.exports = {
+ scroll: compoundExports2({ comptroller: '0x8a67AB98A291d1AEA2E1eB0a79ae4ab7f2D76041', cether: '0x639355f34Ca9935E0004e30bD77b9cE2ADA0E692' }),
+ methodology,
+}
\ No newline at end of file
diff --git a/projects/rif-on-chain/index.js b/projects/rif-on-chain/index.js
index 21c0b00482..5bca62e430 100644
--- a/projects/rif-on-chain/index.js
+++ b/projects/rif-on-chain/index.js
@@ -2,6 +2,6 @@ const { sumTokensExport } = require('../helper/unwrapLPs')
module.exports = {
rsk: {
- tvl: sumTokensExport({ owner: '0xCff3FCaEc2352C672C38d77cB1A064B7d50CE7e1', tokens: ['0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5']})
+ tvl: sumTokensExport({ owner: '0xA27024eD70035E46DBa712609FC2AFA1c97aa36a', tokens: ['0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5']})
}
}
\ No newline at end of file
diff --git a/projects/rift-finance/networks.js b/projects/rift-finance/networks.js
index c86af1ab9f..4b2c0cbee4 100644
--- a/projects/rift-finance/networks.js
+++ b/projects/rift-finance/networks.js
@@ -1,14 +1,15 @@
+const sdk = require("@defillama/sdk");
module.exports = {
aurora: {
coreAddress: "0x40A01A4064b690cA33FA52d315ec02015eF5287E",
startBlock: 58983267,
graphUrl:
- "https://api.thegraph.com/subgraphs/name/recursive-research/rift-subgraph-aurora",
+ sdk.graph.modifyEndpoint('GkqMC7XyPQFceCjT7rdqc62nzfF5WsVCn6HA9q17VBW'),
},
ethereum: {
coreAddress: "0x5D7e616B2c0bf268494A482e315a60814F97dBC8",
startBlock: 14845882,
graphUrl:
- "https://api.thegraph.com/subgraphs/name/recursive-research/rift-subgraph",
+ sdk.graph.modifyEndpoint('44q7UpeVu33BTDwHd1iHJnEYXwcF9NM6HRd5oSVdLFDQ'),
},
};
diff --git a/projects/ritsu/index.js b/projects/ritsu/index.js
new file mode 100644
index 0000000000..572b0614de
--- /dev/null
+++ b/projects/ritsu/index.js
@@ -0,0 +1,32 @@
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const { getLogs2 } = require('../helper/cache/getLogs')
+
+async function tvl(api) {
+ const { fromBlock, basicFactorys, stableFactorys, rhythmFactorys = [] } = config[api.chain]
+
+ let logs = await Promise.all([basicFactorys, stableFactorys, rhythmFactorys].flat().map(getFactoryLogs))
+ logs = logs.flat()
+
+ const ownerTokens = logs.map(({ token0, token1, pool }) => [[token0, token1], pool])
+ return sumTokens2({ api, ownerTokens})
+
+ async function getFactoryLogs(target) {
+ return getLogs2({
+ api,
+ target,
+ fromBlock,
+ eventAbi: 'event PoolCreated(address indexed token0, address indexed token1, address pool)',
+ })
+ }
+}
+
+const config = {
+ taiko: {
+ fromBlock: 787,
+ stableFactorys: ['0x3e846B1520E74728EFf445F1f86D348755F738d9'],
+ basicFactorys: ['0xDFFee0ad5C833f2A5E610dfe9FD1aD82743eA74e'],
+ rhythmFactorys: ['0x0A78CAB89a069555a18B78537f09fab24c03dECd']
+ }
+}
+
+Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } })
\ No newline at end of file
diff --git a/projects/rivera_money/index.js b/projects/rivera_money/index.js
index 33f1739f23..bd45d7734e 100644
--- a/projects/rivera_money/index.js
+++ b/projects/rivera_money/index.js
@@ -33,6 +33,28 @@ const config = {
arbitrum: [
"0x8E99B66dE170b53b39D9B54f189a12D7c6AC0cd9"
],
+
+ degen: [
+ "0xA95417805d18d00844c3C6FB7742577Cd263fE05",
+ "0x39dD79E8b1e74E8B514D7e133b3671435Ec3Da42",
+ "0xE45F416eE25844281edF2780247E28569303c7Cd",
+ "0xB9107C1Ad02bD2E20692499156F99411297d23F5",
+ "0x17A6b417249D92A2F3F7a88384c5Aa88D0d95A28",
+ ],
+
+ bsquared: [
+ "0xBC91a7a0eE37085af193C61747ecE693979Ec0C1",
+ "0xD57a87a9101d567C4139247CdF149b1DA4c8604A"
+ ],
+
+ polygon: [
+ "0x67e07BFfce318ADbA7b08618CBf4B8E271499197"
+ ],
+
+ core: [
+ "0xBC91a7a0eE37085af193C61747ecE693979Ec0C1",
+ "0x018BeE125A17D456E6dacE22A66E8B9aF3c69449",
+ ],
}
module.exports = {
diff --git a/projects/rivusdao/index.js b/projects/rivusdao/index.js
index bf74c5a389..2c901fc67d 100644
--- a/projects/rivusdao/index.js
+++ b/projects/rivusdao/index.js
@@ -1,7 +1,8 @@
const rTokens = [
- '0xdad3d3c5cac4f2c8eca2b483aba9e928a4b88783', // rsTAO
- '0xae173ac44c0041cda87907f52a1e531934e49610' // rsCOMAI
-]
+ '0x5e17abe30f0b804730c4e4db0ad217d8c29d05a0', // rsTAO
+ '0xcD7D22146ea9F26d0208848B6a1A9d1Bb538245A', // rsCOMAI
+ '0x3d8ede6231243d56e7896477789a450ce7fd2ad3' // rsNMT
+ ]
async function tvl(api) {
const tokens = await api.multiCall({ abi: 'address:wrappedToken', calls: rTokens})
@@ -10,7 +11,7 @@ async function tvl(api) {
}
module.exports = {
- methodology: "TVL is calculated as the sum of the total supplies of rsTAO and rsCOMAI tokens.",
+ methodology: "TVL is calculated as the sum of the total supplies of rsTAO, rsCOMAI and rsNMT tokens.",
ethereum: {
tvl,
}
diff --git a/projects/rize/index.js b/projects/rize/index.js
new file mode 100644
index 0000000000..e5aacc1733
--- /dev/null
+++ b/projects/rize/index.js
@@ -0,0 +1,112 @@
+const sui = require("../helper/chain/sui");
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const suiScallopPools = {
+ usdc: {
+ poolId: "0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0",
+ rewardPoolId: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
+ type: ADDRESSES.sui.USDC,
+ stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN>",
+ balanceSheet: '0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93',
+ spoolAccount: 'a5a2d2afe12ed353ca32a3d5f7592a7a57945040ee7beacab6d82a5fe5b34734',
+ decimals: 6,
+ },
+ usdt: {
+ poolId: "0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f",
+ rewardPoolId: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080",
+ type: ADDRESSES.sui.USDT,
+ stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN>",
+ balanceSheet: '0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879',
+ spoolAccount: '775206c05243da6b1a29a45c74bd3d3e7db4b3f8303342cbf34c3d12725eac70',
+ decimals: 6,
+ },
+ weth: {
+ poolId: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787",
+ rewardPoolId: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077",
+ type: ADDRESSES.sui.WETH,
+ stakeType: "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf::reserve::MarketCoin<0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN>",
+ balanceSheet: '0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c',
+ spoolAccount: '3865596e3ea8860e4d479b91d2b9f5c57adab00d70b13ac6c7eb410fd092d2cc',
+ decimals: 8,
+ },
+}
+const suiNaviPools = {
+ naviAddress: "0x966231078dda644567e71131267946b0e4cef7740d298f94b30af3293be1a755",
+ reserveParentId: "0xe6d4c6610b86ce7735ea754596d71d72d10c7980b5052fc3c8cdf8d09fea9b4b",
+ usdc: {
+ supplyBalanceParentId: "0x8d0a4467806458052d577c8cd2be6031e972f2b8f5f77fce98aa12cd85330da9",
+ assetId: 1,
+ decimals: 6,
+ },
+ usdt: {
+ supplyBalanceParentId: "0x7e2a49ff9d2edd875f82b76a9b21e2a5a098e7130abfd510a203b6ea08ab9257",
+ assetId: 2,
+ decimals: 6,
+ },
+ weth: {
+ supplyBalanceParentId: "0xa668905b1ad445a3159b4d29b1181c4a62d864861b463dd9106cc0d97ffe8f7f",
+ assetId: 3,
+ decimals: 6,
+ },
+}
+
+async function tvl(api) {
+ const [ethInNaviSui, ethInScallopSui, usdtInNaviSui, usdtInScallopSui, usdcInNaviSui, usdcInScallopSui] = await Promise.all([
+ naviSui("weth"),
+ scallopSui("weth"),
+ naviSui("usdt"),
+ scallopSui("usdt"),
+ naviSui("usdc"),
+ scallopSui("usdc"),
+ ]);
+ api.addGasToken(ethInNaviSui * 1e18)
+ api.addGasToken(ethInScallopSui * 1e18)
+ api.add(ADDRESSES.ethereum.USDT, usdtInNaviSui * 1e6)
+ api.add(ADDRESSES.ethereum.USDT, usdtInScallopSui * 1e6)
+ api.add(ADDRESSES.ethereum.USDC, usdcInNaviSui * 1e6)
+ api.add(ADDRESSES.ethereum.USDC, usdcInScallopSui * 1e6)
+}
+
+
+async function scallopSui(coinSymbol) {
+ const spoolAccountResp = await sui.getObject(suiScallopPools[coinSymbol].spoolAccount);
+ const stakesBalance = spoolAccountResp?.fields?.stakes ?? 0
+ const stakeBalance = stakesBalance / 10 ** suiScallopPools[coinSymbol].decimals
+ const balanceSheetResp = await sui.getObject(suiScallopPools[coinSymbol].balanceSheet);
+ const cash = balanceSheetResp?.fields?.value?.fields?.cash ?? 0
+ const debt = balanceSheetResp?.fields?.value?.fields?.debt ?? 0
+ const revenue = balanceSheetResp?.fields?.value?.fields?.revenue ?? 0
+ const marketCoinSupply = balanceSheetResp?.fields?.value?.fields?.market_coin_supply ?? 0
+ const conversionRate = (+cash + +debt - +revenue) / marketCoinSupply
+ const tvl = stakeBalance * conversionRate
+ return tvl;
+}
+
+async function naviSui(coinSymbol) {
+ const naviResp = await sui.getDynamicFieldObject(
+ suiNaviPools[coinSymbol].supplyBalanceParentId,
+ suiNaviPools.naviAddress,
+ { idType: 'address' });
+
+ const currentSupply = naviResp?.fields?.value ?? 0
+
+ const assetResp = await sui.getDynamicFieldObject(
+ suiNaviPools.reserveParentId,
+ suiNaviPools[coinSymbol].assetId,
+ { idType: 'u8' }
+ );
+ const currentSupplyIndexOrg = assetResp?.fields?.value?.fields?.current_supply_index;
+ const currentSupplyIndex = currentSupplyIndexOrg / 1e27
+
+ const decimals = suiNaviPools[coinSymbol].decimals
+ const tvl = (currentSupply / 1e9) * currentSupplyIndex
+ return tvl;
+}
+
+module.exports = {
+ start: 1716599207,
+ timetravel: false,
+ ethereum: {
+ tvl
+ }
+};
\ No newline at end of file
diff --git a/projects/rockswap-staking/index.js b/projects/rockswap-staking/index.js
new file mode 100644
index 0000000000..64ced9d6d0
--- /dev/null
+++ b/projects/rockswap-staking/index.js
@@ -0,0 +1,11 @@
+const { staking } = require("../helper/staking");
+
+const ROCK = "0x826628622a8B55F4AF6aC2A1DD1273bF837e651a";
+const stakingContract = "0xFDfd4A3CfECD29E00942ee3E01cDa6f92E9270BA";
+
+module.exports = {
+ bitrock: {
+ tvl: staking(stakingContract, ROCK, "bitrock"),
+ },
+ methodology: "ROCK tokens locked in staking contract",
+};
\ No newline at end of file
diff --git a/projects/rollspace/index.js b/projects/rollspace/index.js
new file mode 100644
index 0000000000..82f3cb7aa0
--- /dev/null
+++ b/projects/rollspace/index.js
@@ -0,0 +1,23 @@
+const { nullAddress } = require("../helper/tokenMapping");
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const BSC_POOL_CONTRACT = '0xB1FcDb8Ed3c2Bc572440b08a5A93984f366BBf3C';
+const BLAST_POOL_CONTRACT = '0x4E927c4bc1432dc7608d2199a77e630cc1676eD7';
+const BASE_POOL_CONTRACT = '0x35a7E7f5A8ECe30585364c28EE5974E3ECe375DC';
+const MODE_POOL_CONTRACT = '0xbADaC8BDFdC6Ef7be408e94AbE3ddC6bec783E59';
+
+module.exports = {
+ methodology: 'counts the number of BNB and ETH tokens in the bsc, blast, base and mode pool contracts.',
+ bsc: {
+ tvl: sumTokensExport({ owner: BSC_POOL_CONTRACT, tokens: [nullAddress], })
+ },
+ blast: {
+ tvl: sumTokensExport({ owner: BLAST_POOL_CONTRACT, tokens: [nullAddress], })
+ },
+ base: {
+ tvl: sumTokensExport({ owner: BASE_POOL_CONTRACT, tokens: [nullAddress], })
+ },
+ mode: {
+ tvl: sumTokensExport({ owner: MODE_POOL_CONTRACT, tokens: [nullAddress], })
+ },
+}
\ No newline at end of file
diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js
new file mode 100644
index 0000000000..35fbc3262e
--- /dev/null
+++ b/projects/rosen-bridge/index.js
@@ -0,0 +1,45 @@
+const { sumTokensExport } = require("../helper/sumTokens");
+const ADDRESSES = require('../helper/coreAssets.json');
+
+module.exports = {
+ timetravel: false,
+ ergo: {
+ tvl: sumTokensExport({
+ owners: [
+ "nB3L2PD3J4rMmyGk7nnNdESpPXxhPRQ4t1chF8LTXtceMQjKCEgL2pFjPY6cehGjyEFZyHEomBTFXZyqfonvxDozrTtK5JzatD8SdmcPeJNWPvdRb5UxEMXE4WQtpAFzt2veT8Z6bmoWN",
+ "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8",
+ ],
+ tokens: [
+ ADDRESSES.null,
+ '0cd8c9f416e5b1ca9f986a7f10a84191dfb85941619e49e53c0dc30ebf83324b',
+ '9a06d9e545a41fd51eeffc5e20d818073bf820c635e2a9d922269913e0de369d',
+ '03faf2cb329f2e90d6d23b58d91bbb6c046aa143261cc21f52fbe2824bfcbf04',
+ ]
+ }),
+ staking: sumTokensExport({
+ owners: [
+ "NY4PEzZ7VfjtnTN697R7my9uAVkCYb6N71J2RSmJCFSdDqVf9aPvFQqKXujYDBtSA8hxYVUgkGgU9SP2Ss7JDUkHkdGLBqZwH4yDcPyVvbVbcre3o7nR59wiFDVtjzCjfZmVvMVJD9HiW4GKqVuZGTQCKns8tDe3sJoDNTL3VmhzRUPZf9JCN4TNji1ruXf5CxqWtDrCfoxE4xfbRWGmtBMdLMoRdL85V7z1fP5KxroWX5YgZQo28nTCU3WjPuY2YrjqYYGNHXvFZ9G8E85kCcseNtRWqViXGFzmwqHWKaYe4AdJzBbMKzJWYszsbiemNvisPtT2Yj3FjAmAErpW3gMeWyH3WtbipaAu9D31ggpLeLkLTGscJ9HB2oExpGWvv6u9mGdkTJMHYUuZJUGrcJPE3m7ZTEFxwkbeR9oD8nHHgW4SB46kHFbxzNoUksGPZQnxf95J3e5PUnhYgg7mrQLNpq6pphgGukFcHDgAN2rgFmUSDVsuzomhP735SMiveXSPzx6PZeP7CmrEHyXN6mFbBJuY17kvzzix1w9eFwryZDuZqnAANkYhF3TLkLyGZfSC4o9iAGynpivuNMUgbKAuj6D116tKoCq9PHELL8eTefmXNLFuhauQuKRjmWQKj9zYSd7qi6Zf49KX25PnWHkC3REc4abYpjtiQFefT2HkWRwneTCkJ8uMvoHs6kJzLg8NVzH8XwEZhTM2tNSDhBKZaURpYiQcHwLDgv5uFiwhasLAdZi2EJywBYX51NKc6m4MEsTiAJC9jkEydWcwyDzSHN18yEr4rvEgMNkUhLHJokgV2v3BNFhUTJqe58e2QXAmx9MytUDqzg3vwexEpMhueC2roYA27P1mmb85HKEz15a8LnuUT8ZjmG8kDbHuPYFyxcATytVuDrFDzqKBt9X36bocip4ZU4RRY8JcWjJvMcrBCjV3EhDVQ4it8bhoZnn79PsXazvDteua1NEYEJniPnNrRaiKTUWrseEUQ2vVjWy134jMxRbeiARhoj7MDxug2kFP8jRGSsxWt3Qqbv2SezT3xZ8jYxTyQ2CiyJ61CvUQwPtmoY3XKjrgrJKwnSzJRs4egKPYZKoSiSy6UdHMKuNDmys8wYo3Gi2EgVdUYRLLWcHh5Z2H91odSbTW2h5e6pZeY4a45TgihE6ZnZBhHGc75zJjukhPgP1wEp8GrreHA7ejvTEmpwNgj571x5JrvRD5TxWaFuZKBonGexovAK2L5v", // bitcoin rsn permit collateral address
+ "ChTbcUHgBNqNMVjzV1dvCb2UDrX9nh6rGGcURCFEYXuH5ykKh7Ea3FvpFhHb9AnxXJkgAZ6WASN7Rdn7VMgkFaqP5Z5RWp84cDTmsZkhYrgAVGN7mjeLs8UxqUvRi2ArZbm35Xqk8Y88Uq2MJzmDVHLHzCYRGym8XPxFM4YEVxqzHSKYYDvaMLgKvoskFXKrvceAqEiyih26hjpekCmefiF1VmrPwwShrYYxgHLFCZdigw5JWKV4DmewuR1FH3oNtGoFok859SXeuRbpQfrTjHhGVfDsbXEo3GYP2imAh1APKyLEsG9LcE5WZnJV8eseQnYA8sACLDKZ8Tbpp9KUE7QZNFpnwGnkYx7eybbrCeFDFjTGpsBzaS6fRKrWj2J4Wy3TTyTU1F8iMCrHBF8inZPw9Kg9YEZuJMdXDFNtuaK15u86mF2s2Z5B1vdL5MtZfWThFLnixKds8ABEmGbe8n75Dym5Wv3pkEXQ6XPpaMjUxHfRJB3EfcoFM5nsZHWSTfbFBcHxSRnEiiU67cgJsBUpQn7FvEvqNLiKM4fL3yyykMtQ6RjAS8rhycszphvQa5qFrDHie4vPuTq8",
+ "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZDqS2BRcPkmovmt7SZCKD95zoNgsitrYdmv2JhoC8Wmq7aM3DpwmhejCZ59n1ZYCAL7LsKw4zX45tH3sGLXxmeBNCCkcT2yxiziEAn2C3ybXqqab7cMhkoNdRMwXpUUpk3489kfyTY7SjbUPqPKhkH9veUS6H4U7a4HaEi7tPyueHTbjjQZjCZd5uGi5tC7jMvrgjYqByUG9PA9oeXHj89RxK5TPbbmkmsZVHVtdBzfHiexJh32LMszDRHuUc6YfisZKx9kNSSzadBdLbJUGHeCd8XaBg6w3e1uUBQDghpx2z44C2GZbAmUQSUQ2jqY8BBwEhtaxzZ69NK3dEjTFgsZ1R3nkbhbAu5Xs5fabBWZo6RvaPf8jTKRwKaNgQZrL93QV2JEZoapbRHCdvzaHHpBLr1p6nkDg2kB3rUTj6kmaabxswG8bSLAA9qYZhDCyh1QdSyUnd9T2o7qHybaoeEuqG1kEWYon4741ut8HCqbwEjKze6rDuEbnPUYzSr7kiwoPeV2GrdsVFRLgxwgHJoENgjUhj1VVKZB2q7n8S6smwf7CJyYZZCZGkg5bLpywJddmegJjk2FuLwA2VEmnrDKRGpFkhxBc2rbj974XgGcBZ66mPTtwrXUwjY9G5hUArtYs8WhsCDAH58yaHFFViaAhBNDQ3HBtFbXwh6b1osdv8zDSvncYXPx2iikhmf6TRC2DE2ENYtzhLHJmgyXmQkm7yXp6nWxJaeLnUuxRaWdxxQSPy1Wnm1GvKJYzRBhv9RdcmDnEgKs21ex5uSSdqJ4H53Qs6StxGyQ4HyjTjEVUxTbUZpnzvECgAufKkuSPyC2mYkKKGrzWmvv5sh6fyo4eAq9QnfXB9YMETMpJbx5dFpc6ZXYimSCfJbJfP1bpCe1hXkhTPWeZJ9aPX6HZEfu89ChZiX32MaSM3QnnUhRbSnzdQ2jVAtqqwjNN5SeNNvXNxS6B1UHj52TGvGrLnNUp4BWgNKAAwpBxAAB7wny9tUSXt6jHVnGHBG1vJWF7S9DeaVjKg3qR8j1bUsGqh9bVkarag4SREopK8cHwFpb2yFcdGERfaKHyekAUjVkhqySH3Vb8GiAdDbRArKV2ip4eveocsFwjoCD5i9rotksNysgi9RDjkApYm7aJegC79omCujHVYFpU6HtV2AhNVFRvVBG2xDW9YEKEm3RxrjoCttM6sFkbNX61CSiQ3LsBPvcd5Aix9NUESjbNxFwARZ75UgquvFddApn13yxSqfzVoE9L3eRnAMxd7KHudBWQsnDK",
+ "LXwmG9jPiXvYd6Z1DWRazpc2wTdpW2awCB9NV5qjJx4UFoncqYxve6G1gzTVBNCsDwSu5ZPEi6LNLuPdzM1r9DUMgAzEfGghKeoGebPAyLCerZ8Us4ukQSJPj8j3TQY5JLZBwceKrx1KHjeRRQBwBgxTkfButyeLtHgMELArAC9DDaZbYg7o2t98LMUZyArDzmK5fmhdKgeo6Dw4oZ1ENbepgqG35kR2pS63heXUeEuhH4nvqfLGHwSTanzhsQeBmYH9iqxSFfCvoRFnasoEPkWAv6PwGURqUk23wS5J9CaSadgPYRNdB915Vjf2kvxxmPFwoW9Uq1ZRo5DDS49goU3YbMgDJPnekbGQ9u9jMcwvo8FGRMiJVyEy2zdncnqPUaipekDaDowgf8EKYxBRYPo93DGga9FCVAoMC2PzRXRN1Q4X2zCx9onwMPoTWu2nFjYdx58bqzqs2ToK4S7UXZw4vpt6oSam7XN2miAfSN8WJmYRJ3FSGNfUz1ryo6N8uoecwEGeFksvbkobAvykuDGzeCNgdeNnRnMFZrco3kPvdzMf75tsRJu5ZTpTMW5mJWm6NbPJwxgV5JdxUvHPd8SCCmFKxhFywqVifp6WRMMqfVKaBdmXWG7zzN6hJZhf9EHupjR4KZExmuShvpx5bA1YyMUz1MpE9VP7vkLJWDYXfpJHJEWFRiADfSHt2RE5LzepxScfoHfpE7C6e4TBQBZd3dndxWDRREZSV45A1iXdq14AYqcsoBJ5Y8JCGHzXaGCLiBHvsXFMfUdTHhbPA8cegddhhZ2tK29UhR3veSGcjVZ1YwzVthQeJZK8RMbbbdf2s3f7dr8a7YGLU31T2jjy4tPR26ZFSadcuuMFR6QQisRP7qBKpgmUJc68fWdwNsLr8FLW8q2yipH1YnsWG389BQ9aXM4Zfb2WmXUT6JCpaeABWUFCLv6w3BkuBHyUFmmfiiHNx1E9u1VEuibAJYEkC6BEuoCKDqxMV62wdjbahsAn4fZdpQyVMK6xADbY2FXrREeaq4KDGzY4XYVZxaEZs3CEeedoZjFLbBe7ysm4MWqCiK7tucARTFF4XaxoH1C5JqqiraqRm4HBGVcjfzcyMwMHUC15m2N4AoQycb97Dn8W4Qp7s7gmchThLotvP2E7t7CXDa21cwKdVx9nh2xTJRPaXzMjt49L4AbXqT9RJ9PeRsYzKcQLcgugdDoB3vDtFBTZeoNNvf43JFpapTozoQtSfj7iNrPYfaEkNvCEzLjqJVyMPZ7gt13aySy5jDPp2vF5hGd5f6yv21PAiwQtfV47hn7y5hZfKv4T3gDE4sD6UQ2HFmhrAXmcuZ4AtfZZXpC3vgw6vhraKUFsHKjLZU3WKKAwnPW1HJC61jiutpnaBK1hDhop6FHkjvNtGrSnti",
+ ],
+ tokens: [
+ '8b08cdd5449a9592a9e79711d7d79249d7a03c535d17efaee83e216e80a44c4b',
+ ]
+ }),
+ },
+ cardano: {
+ tvl: sumTokensExport({
+ owners: [
+ "addr1v8kqhz5lkdxqm8qtkn4lgd9f4890v0j6advjfmk5k9amu4c535lsu",
+ ],
+ tokens: [
+ ADDRESSES.null,
+ 'a0028f350aaabe0545fdcb56b039bfb08e4bb4d8c4d7c3c7d481c235484f534b59'
+ ]
+ }),
+ },
+ bitcoin: {
+ tvl: sumTokensExport({ owners: ['bc1qs0852en99dfctv0egj2qxnmc79mhjgn9ap975t']})
+ }
+};
diff --git a/projects/rubic/index.js b/projects/rubic/index.js
index bc977ffa2a..79011e5a5f 100644
--- a/projects/rubic/index.js
+++ b/projects/rubic/index.js
@@ -1,6 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require('@defillama/sdk');
-const solana = require('../helper/solana')
const { stakings } = require('../helper/staking');
const stakingContractRoundOne = '0x8d9Ae5a2Ecc16A66740A53Cc9080CcE29a7fD9F5';
@@ -50,16 +49,6 @@ function chainTvl(chain) {
}
}
-function solanaTvl() {
- return async (timestamp, ethBlock, chainBlocks) => {
- const balances = {};
- const poolBalance = await solana.getTokenBalance(usdcByChain['solana'], pools['solana']);
-
- sdk.util.sumSingleBalance(balances, 'usd-coin', poolBalance);
-
- return balances;
- }
-}
module.exports = {
timetravel: false, // solana :cries:
@@ -74,31 +63,4 @@ module.exports = {
kava: {
tvl: chainTvl('kava')
}
- // ethereum: {
- // tvl: chainTvl('ethereum')
- // },
- // polygon: {
- // tvl: chainTvl('polygon')
- // },
- // fantom: {
- // tvl: chainTvl('fantom')
- // },
- // avax:{
- // tvl: chainTvl('avax')
- // },
- // harmony: {
- // tvl: chainTvl('harmony')
- // },
- // moonriver: {
- // tvl: chainTvl('moonriver')
- // },
- // arbitrum: {
- // tvl: chainTvl('arbitrum')
- // },
- // aurora: {
- // tvl: chainTvl('aurora')
- // },
- // solana: {
- // tvl: solanaTvl()
- // }
}
diff --git a/projects/rubicon/index.js b/projects/rubicon/index.js
index 1a4c484405..88f57564a4 100644
--- a/projects/rubicon/index.js
+++ b/projects/rubicon/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const { sumTokens2 } = require('../helper/unwrapLPs')
@@ -17,7 +18,7 @@ module.exports = {
const config = {
optimism: {
- endpoint: 'https://api.thegraph.com/subgraphs/name/denverbaumgartner/rubiconmetricsoptimism',
+ endpoint: sdk.graph.modifyEndpoint('AUcAkUd4sJutFD3hYQfvB6uvXrEdYP26qiZwZ5qyrgTw'),
owners: [
RUBICON_MARKET_OPTIMISM, // Rubicon Market
"0xB0bE5d911E3BD4Ee2A8706cF1fAc8d767A550497", // bathETH
@@ -30,7 +31,7 @@ const config = {
]
},
arbitrum: {
- endpoint: 'https://api.thegraph.com/subgraphs/name/jossduff/rubiconmetricsarbitrum',
+ endpoint: sdk.graph.modifyEndpoint('B4cTJXyWHMLkxAcpLGK7dJfArJdrbyWukCoCLPDT1f7n'),
owners: [RUBICON_MARKET_ARBITRUM,]
}
}
diff --git a/projects/rumi/index.js b/projects/rumi/index.js
index 7ace8c1690..737b047b64 100644
--- a/projects/rumi/index.js
+++ b/projects/rumi/index.js
@@ -20,5 +20,5 @@ module.exports = {
arbitrum: {
tvl: () => ({}),
},
- // deadFrom: '2023-12-11',
+ deadFrom: '2023-12-11',
};
\ No newline at end of file
diff --git a/projects/saber.js b/projects/saber.js
index 6baab67ca2..32533eabba 100644
--- a/projects/saber.js
+++ b/projects/saber.js
@@ -51,6 +51,4 @@ module.exports = {
],
timetravel: false,
solana: { tvl },
- methodology:
- 'To obtain the TVL of Saber we make on-chain calls using the function getTokenBalance() that uses the address of the token and the address of the contract where the tokens are found. TVL is calculated using the list of pool addresses found under the "Pools" button of the Saber App. These pools addresses are hard-coded. Making these calls returns the amount of tokens held in each contract. We then use Coingecko to get the price of each token in USD and export the sum of all tokens. "USDP" is used to price the stablecoin "PAI" since it has not been listed on Coingecko.',
};
diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js
index a48b04a09e..5f99693128 100644
--- a/projects/sablier-v2/index.js
+++ b/projects/sablier-v2/index.js
@@ -22,27 +22,27 @@ async function getTokensConfig(api, isVesting) {
}
async function tvl(api) {
- const { owners } = config[api.chain]
return api.sumTokens(await getTokensConfig(api, false))
}
async function vesting(api) {
- const { owners } = config[api.chain]
return api.sumTokens(await getTokensConfig(api, true))
}
const config = {
- ethereum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2'], },
- arbitrum: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-arbitrum'], },
- bsc: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-bsc'], },
- xdai: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-gnosis'], },
- optimism: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-optimism'], },
- polygon: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-polygon'], },
- avax: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-avalanche'], },
- base: { endpoints: ['https://api.thegraph.com/subgraphs/name/sablier-labs/sablier-v2-base'], },
- blast: { endpoints: ['https://api.studio.thegraph.com/query/57079/sablier-v2-blast/version/latest'], },
+ ethereum: { endpoints: ['5EgaXheiBXZBCkepyGUYAu8pN31Dkbh7bpGtnLPqaT5m'], },
+ arbitrum: { endpoints: ['8BnGPBojHycDxVo83LP468pUo4xDyCQbtTpHGZXR6SiB'], },
+ bsc: { endpoints: ['BVyi15zcH5eUg5PPKfRDDesezMezh6cAkn8LPvh7MVAF'], },
+ xdai: { endpoints: ['EXhNLbhCbsewJPx4jx5tutNXpxwdgng2kmX1J7w1bFyu'], },
+ optimism: { endpoints: ['6e6Dvs1yDpsWDDREZRqxGi54SVdvTNzUdKpKJxniKVrp'], },
+ polygon: { endpoints: ['CsDNYv9XPUMP8vufuwDVKQrVhsxhzzRHezjLFFKZZbrx'], },
+ avax: { endpoints: ['FdVwZuMV43yCb1nPmjnLQwmzS58wvKuLMPzcZ4UWgWAc'], },
+ base: { endpoints: ['3pxjsW9rbDjmZpoQWzc5CAo4vzcyYE9YQyTghntmnb1K'], },
+ blast: { endpoints: ['BXoC2ToMZXnTmCjWftQRPh9zMyM7ysijMN54Nxzb2CEY'], },
+ scroll: { endpoints: ['HVcngokCByfveLwguuafrBC34xB65Ne6tpGrXHmqDSrh'], },
+ era: { endpoints: ['GY2fGozmfZiZ3xF2MfevohLR4YGnyxGxAyxzi9zmU5bY'], },
}
Object.keys(config).forEach(chain => {
module.exports[chain] = { tvl, vesting }
-})
\ No newline at end of file
+})
diff --git a/projects/sablier/index.js b/projects/sablier/index.js
index 4320c50909..853d27aa1a 100644
--- a/projects/sablier/index.js
+++ b/projects/sablier/index.js
@@ -14,8 +14,14 @@ const blacklistedTokens = [
async function getTokens(api, owners, isVesting) {
let tokens = (await Promise.all(owners.map(i => covalentGetTokens(i, api, { onlyWhitelisted: false, })))).flat().filter(i => !blacklistedTokens.includes(i))
tokens = getUniqueAddresses(tokens)
- const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens })
- return tokens.filter((v, i) => isWhitelistedToken(symbols[i], v, isVesting))
+ const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: tokens, permitFailure: true })
+
+ const validTokens = tokens.map((token, index) => {
+ const symbol = symbols[index];
+ return symbol ? { token, symbol } : null;
+ }).filter(pair => pair !== null);
+
+ return validTokens.filter(token => isWhitelistedToken(token.symbol, token.token, isVesting)).map(token => token.token);
}
async function tvl(api) {
diff --git a/projects/sailing-portfolios/index.js b/projects/sailing-portfolios/index.js
new file mode 100644
index 0000000000..4eefd2366b
--- /dev/null
+++ b/projects/sailing-portfolios/index.js
@@ -0,0 +1,19 @@
+const portfoliosTrackers = {
+ 'kava': '0x12c90425dD549DEdD455E223a897E438E2Dc0bbc',
+};
+
+async function tvl(api) {
+ const portfoliosTracker = portfoliosTrackers[api.chain]
+ const portfolios = await api.call({
+ target: portfoliosTracker,
+ abi: 'function getTrackedPortfolios() external view returns (address[] memory)',
+ })
+ const tokens = await api.multiCall({ abi: 'address[]:getPortfolioAssets', calls: portfolios})
+ const ownerTokens = portfolios.map((portfolio, i) => [tokens[i], portfolio])
+ return api.sumTokens({ ownerTokens })
+}
+
+module.exports = {
+ kava: { tvl, },
+ methodology: 'The assets in the balancer are detected and counted.'
+}
diff --git a/projects/sakai-vault/index.js b/projects/sakai-vault/index.js
index c41f30ac46..c42b387a33 100644
--- a/projects/sakai-vault/index.js
+++ b/projects/sakai-vault/index.js
@@ -1,17 +1,15 @@
-const { staking } = require("../helper/staking");
+const { staking } = require("../helper/staking")
+const SAKAI = "0x43b35e89d15b91162dea1c51133c4c93bdd1c4af"
const contracts = {
- SAKAI: "0x43b35e89d15b91162dea1c51133c4c93bdd1c4af",
"Sakai-SP": "0xc20A079c7962D9fc92173cda349e80D484dFA42A", //Sakai Staking Protocol Contract
- "Sakai-SP-V2": "0xba94E7c2306aC3BE22C123041Fd7823d7fA15933", //Sakai Staking Protocol Contract V2,
-};
+ "Sakai-SP-V2": "0xba94E7c2306aC3BE22C123041Fd7823d7fA15933", //Sakai Staking Protocol Contract V2
+ "Sakai-DAO": "0xeEC3514a5A66432ff2887e44664b5a82db229e5F", //Sakai DAO Contract
+}
module.exports = {
bsc: {
tvl: () => ({}),
- staking: staking(
- [contracts["Sakai-SP"], contracts["Sakai-SP-V2"]],
- contracts.SAKAI
- ),
+ staking: staking(Object.values(contracts), SAKAI),
},
-};
+}
\ No newline at end of file
diff --git a/projects/sanctum/index.js b/projects/sanctum/index.js
index a17b518c8f..1a378e1664 100644
--- a/projects/sanctum/index.js
+++ b/projects/sanctum/index.js
@@ -1,5 +1,5 @@
const { Program } = require("@project-serum/anchor");
-const { getProvider, getMultipleAccountsRaw } = require("../helper/solana");
+const { getProvider, getMultipleAccounts, } = require("../helper/solana");
const partialIdl = require("./partialIdl");
const PROGRAM_ADDR = "unpXTU2Ndrc7WWNyEhQWe4udTzSibLPi25SXv2xbCHQ";
@@ -8,11 +8,11 @@ const SOL_RESERVES = "3rBnnH9TTgd3xwu48rnzGsaQkSr1hR64nY71DrDt6VrQ";
async function tvl() {
const program = new Program(partialIdl, PROGRAM_ADDR, getProvider());
- const [poolAccount, reservesAccount] = await getMultipleAccountsRaw([
+ const [poolAccount, reservesAccount] = await getMultipleAccounts([
POOL_ADDR,
SOL_RESERVES,
]);
- const pool = program.coder.accounts.decode("pool", Buffer.from(poolAccount.data[0], poolAccount.data[1]));
+ const pool = program.coder.accounts.decode("pool", poolAccount.data)
return {
solana: (reservesAccount.lamports + pool.incomingStake.toNumber()) / 1e9,
}
diff --git a/projects/sanko-bridge/index.js b/projects/sanko-bridge/index.js
new file mode 100644
index 0000000000..69fd836d25
--- /dev/null
+++ b/projects/sanko-bridge/index.js
@@ -0,0 +1,15 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+module.exports = {
+ arbitrum: {
+ tvl: (api) =>
+ sumTokens2({
+ api,
+ owners: [
+ "0x2f285781B8d58678a3483de52D618198E4d27532",
+ "0xb4951c0C41CFceB0D195A95FE66280457A80a990",
+ ],
+ fetchCoValentTokens: true,
+ }),
+ },
+};
diff --git a/projects/satori/index.js b/projects/satori/index.js
index d0da28bcc7..cd0d499a0e 100644
--- a/projects/satori/index.js
+++ b/projects/satori/index.js
@@ -2,6 +2,9 @@ const ADDRESSES = require("../helper/coreAssets.json");
const { sumTokensExport } = require("../helper/unwrapLPs");
const USDT_TOKEN_CONTRACT = ADDRESSES.astarzk.USDT;
+const EZETH_BASE = "0x2416092f143378750bb29b79eD961ab195CcEea5";
+const EZETH_LINEA = "0x2416092f143378750bb29b79eD961ab195CcEea5";
+const ZK = "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E";
const WALLET_ADDR = [
"0x62e724cB4d6C6C7317e2FADe4A03001Fe7856940",
"0xA59a2365D555b24491B19A5093D3c99b119c2aBb",
@@ -21,7 +24,7 @@ module.exports = {
"0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0",
"0x48756b37Fd643bB40F669804730024F02900C476",
],
- tokens: [ADDRESSES.era.USDC],
+ tokens: [ADDRESSES.era.USDC, ZK],
}),
},
linea: {
@@ -30,7 +33,7 @@ module.exports = {
"0xfb371E70eEB32f4054F40514924e77213ca18425",
"0xF96116e124eB3F62Ddc6a9cfbdc58d7F8A37c50A",
],
- tokens: [ADDRESSES.linea.USDC],
+ tokens: [ADDRESSES.linea.USDC, EZETH_LINEA],
}),
},
scroll: {
@@ -48,7 +51,16 @@ module.exports = {
"0x668a9711b8d04362876dc5b6177ed362084d5aed",
"0x5f075a6a11B2e25DF664Ce7419c274943017B595",
],
- tokens: [ADDRESSES.base.USDC],
+ tokens: [ADDRESSES.base.USDC, EZETH_BASE],
}),
},
-}
\ No newline at end of file
+ xlayer: {
+ tvl: sumTokensExport({
+ owners: [
+ "0x80DD5bC934122e56B9536a9F19F2Ea95a38E98c8",
+ "0xf915391346Fad5a75F31CD00218BB1EFC13e01f2",
+ ],
+ tokens: [ADDRESSES.xlayer.USDC],
+ }),
+ },
+};
diff --git a/projects/satoshi-dex/api.js b/projects/satoshi-dex/api.js
new file mode 100644
index 0000000000..f1853181b2
--- /dev/null
+++ b/projects/satoshi-dex/api.js
@@ -0,0 +1,31 @@
+
+const { transformDexBalances } = require('../helper/portedTokens')
+const { call } = require('../helper/chain/stacks-api')
+
+const core = 'SP1W7FX8P1G721KQMQ2MA2G1G4WCVVPD9JZMGXK8R.univ2-core'
+
+async function tvl() {
+ const data = []
+ const pairCount = +(await call({ target: core, abi: 'get-nr-pools' })).toString()
+ for (let i = 1; i <= pairCount; i++) {
+ const {
+ token0, token1, reserve0, reserve1,
+ } = await call({ target: core, abi: 'do-get-pool', inputArgs: [{ type: 'uint', value: i }] })
+ data.push({
+ token0: token0.value,
+ token1: token1.value,
+ token0Bal: reserve0.value,
+ token1Bal: reserve1.value,
+ })
+ }
+
+ return transformDexBalances({ chain: 'stacks', data })
+}
+
+
+module.exports = {
+ stacks: {
+ tvl: tvl,
+ }
+}
+
\ No newline at end of file
diff --git a/projects/satoshi-dex/index.js b/projects/satoshi-dex/index.js
new file mode 100644
index 0000000000..a5b769fc0b
--- /dev/null
+++ b/projects/satoshi-dex/index.js
@@ -0,0 +1,8 @@
+const { getExports } = require('../helper/heroku-api')
+
+module.exports = {
+ timetravel: false,
+ misrepresentedTokens: true,
+ methodology: 'The calculated TVL is the current USD sum of all pools from core contract',
+ ...getExports("satoshi-dex", ['stacks']),
+}
diff --git a/projects/satoshi-protocol/index.js b/projects/satoshi-protocol/index.js
index 4ac9b74b2c..6a24763e7d 100644
--- a/projects/satoshi-protocol/index.js
+++ b/projects/satoshi-protocol/index.js
@@ -1,15 +1,21 @@
-const TROVE_MANAGER_LIST = [
- '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // WBTC Collateral
- '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // wstBTC Collateral
-]
+const { sumTokens2 } = require("../helper/unwrapLPs")
-async function tvl(api) {
- const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: TROVE_MANAGER_LIST})
- return api.sumTokens({ tokensAndOwners2: [tokens, TROVE_MANAGER_LIST]})
+function createExports(troveList) {
+ return {
+ tvl: async (api) => {
+ const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: troveList })
+ return sumTokens2({ api, tokensAndOwners2: [tokens, troveList] })
+ },
+ }
}
module.exports = {
- bevm: {
- tvl,
- }
+ bevm: createExports([
+ '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // BEVM WBTC Collateral
+ '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // BEVM wstBTC Collateral
+ ]),
+ btr: createExports([
+ '0xf1A7b474440702BC32F622291B3A01B80247835E', // BITLAYER WBTC Collateral
+ '0xe9897fe6C8bf96D5ef8B0ECC7cBfEdef9818232c', // BITLAYER stBTC Collateral
+ ]),
}
diff --git a/projects/sceptre-staked-flr/index.js b/projects/sceptre-staked-flr/index.js
new file mode 100644
index 0000000000..c3a6ed5ca9
--- /dev/null
+++ b/projects/sceptre-staked-flr/index.js
@@ -0,0 +1,13 @@
+const SFLR = "0x12e605bc104e93B45e1aD99F9e555f659051c2BB";
+
+async function tvl(api) {
+ const pooledFlr = await api.call({ abi: "uint256:totalPooledFlr", target: SFLR })
+ api.addGasToken(pooledFlr)
+}
+
+module.exports = {
+ flare: {
+ tvl,
+ },
+ methodology: "Counts staked FLR tokens.",
+}
\ No newline at end of file
diff --git a/projects/scoop/index.js b/projects/scoop/index.js
new file mode 100644
index 0000000000..fe603b90ff
--- /dev/null
+++ b/projects/scoop/index.js
@@ -0,0 +1,7 @@
+const { nullAddress, sumTokensExport } = require("../helper/unwrapLPs");
+
+module.exports={
+ base: {
+ tvl: sumTokensExport({ tokens: [nullAddress], owner: "0xaeea89678b36c20493e2c069cdcea72e1b34a9ed" })
+ }
+}
\ No newline at end of file
diff --git a/projects/scoreplay/index.js b/projects/scoreplay/index.js
new file mode 100644
index 0000000000..1ddddeb1a6
--- /dev/null
+++ b/projects/scoreplay/index.js
@@ -0,0 +1,7 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport } = require('../helper/unwrapLPs')
+
+module.exports = {
+ start: 1717958404,
+ base: { tvl: sumTokensExport({ owner: '0xFcab8B765FB0BCB05407d16173941e2d1F09DE12', tokens: [ADDRESSES.base.WETH] }) },
+}
\ No newline at end of file
diff --git a/projects/securitize/index.js b/projects/securitize/index.js
new file mode 100644
index 0000000000..97790fae5b
--- /dev/null
+++ b/projects/securitize/index.js
@@ -0,0 +1,15 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const BUIDL = "0x7712c34205737192402172409a8f7ccef8aa2aec"
+
+module.exports = {
+ ethereum: {
+ tvl: async (api) => {
+ const totalSupply = await api.call({
+ target: BUIDL,
+ abi: 'erc20:totalSupply'
+ })
+ return api.add(ADDRESSES.ethereum.USDC, totalSupply)
+ }
+ }
+}
\ No newline at end of file
diff --git a/projects/sencha/index.js b/projects/sencha/index.js
deleted file mode 100644
index 2eab65c5ff..0000000000
--- a/projects/sencha/index.js
+++ /dev/null
@@ -1,34 +0,0 @@
-const { getConfig } = require('../helper/cache')
-
-const {getTokenAccountBalance} = require('../helper/solana');
-
-async function tvl() {
- // this is a list of token accounts that are reserves of a swap
- // more details: https://github.com/senchahq/sencha-registry
- const senchaTokenAccounts= await getConfig('sencha',
- "https://raw.githubusercontent.com/SenchaHQ/sencha-registry/master/data/known-accounts.json"
- );
-
- const tvlResult = {};
- await Promise.all(
- senchaTokenAccounts.map(async ({ coingeckoId, account }) => {
- const amount = await getTokenAccountBalance(account);
- if (!tvlResult[coingeckoId]) {
- tvlResult[coingeckoId] = amount;
- } else {
- tvlResult[coingeckoId] += amount;
- }
- })
- );
- return tvlResult;
-}
-
-module.exports = {
- timetravel: false,
- methodology:
- "Sencha TVL is computed by iterating each known Sencha pool, then taking the value of each of the underlying tokens. Assets not listed on Coingecko are not counted.",
- solana: {
- tvl,
- }
-
-};
diff --git a/projects/sentiment/index.js b/projects/sentiment/index.js
index e4ab49ad0a..7e6184be99 100644
--- a/projects/sentiment/index.js
+++ b/projects/sentiment/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
const { cachedGraphQuery } = require('../helper/cache')
@@ -8,7 +9,7 @@ async function tvl(api) {
api.addTokens(assets, totalAssets)
// const userAccounts = await api.call({ target: "0x17b07cfbab33c0024040e7c299f8048f4a49679b", abi: "address[]:getAllAccounts", })
- const data = await cachedGraphQuery('sentiment', 'https://api.thegraph.com/subgraphs/name/r0ohafza/sentiment', query, { fetchById: true, })
+ const data = await cachedGraphQuery('sentiment', sdk.graph.modifyEndpoint('H4hxkyy4kLmFsZZCatedvHpWT1ZvqKcfv2FFYXLxDm9W'), query, { fetchById: true, })
const userAccounts = data.map(i => i.id)
const [equity, borrows] = await Promise.all([
api.multiCall({ target: "0xc0ac97A0eA320Aa1E32e9DEd16fb580Ef3C078Da", calls: userAccounts, abi: "function getBalance(address account) view returns (uint256)", permitFailure: true, }),
diff --git a/projects/shezmu/index.js b/projects/shezmu/index.js
new file mode 100644
index 0000000000..fbf30f43a0
--- /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
diff --git a/projects/shimmersea/index.js b/projects/shimmersea/index.js
index 235b4b878e..a5a63a83ad 100644
--- a/projects/shimmersea/index.js
+++ b/projects/shimmersea/index.js
@@ -1,3 +1,5 @@
-const { uniTvlExport } = require('../helper/unknownTokens');
-
-module.exports = uniTvlExport('shimmer_evm', '0x4fb5d3a06f5de2e88ce490e2e11d22b840d5ac47')
+const { uniTvlExports } = require('../helper/unknownTokens');
+module.exports = uniTvlExports({
+ shimmer_evm: '0x4fb5d3a06f5de2e88ce490e2e11d22b840d5ac47',
+ iotaevm: '0x349aaAc3a500014981CBA11b64C76c66a6c1e8D0'
+})
diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js
index 3625ca5c7d..720f27cd0e 100644
--- a/projects/shoebillFinance-v2/index.js
+++ b/projects/shoebillFinance-v2/index.js
@@ -68,6 +68,23 @@ module.exports = mergeExports([
bob: compoundExports2({
comptroller: "0x1e514767F5cFe1ddE599dd39a79666E3BeEAaf7d",
}),
- },
-
+ },
+ {
+ kroma: compoundExports2({
+ comptroller: "0x9f53Cd350c3aC49cE6CE673abff647E5fe79A3CC",
+ cether: "0xD13bE8b716b18265e294831FCb1330d170840BB3",
+ }),
+ },
+ {
+ fuse: compoundExports2({
+ comptroller: "0x9f53Cd350c3aC49cE6CE673abff647E5fe79A3CC",
+ cether: "0xD13bE8b716b18265e294831FCb1330d170840BB3",
+ }),
+ },
+ {
+ zklink: compoundExports2({
+ comptroller: "0x89e348e0ab4D83aEDbf1354004552822a805a12e",
+ cether: "0x4dA697a89ea1D166881362b56E6863294820eC97",
+ }),
+ },
]);
diff --git a/projects/sigmaswap/index.js b/projects/sigmaswap/index.js
new file mode 100644
index 0000000000..4e4d03f9a6
--- /dev/null
+++ b/projects/sigmaswap/index.js
@@ -0,0 +1,14 @@
+const { sumTokens2, nullAddress } = require("../helper/unwrapLPs");
+
+const contract = "0xE58a7D7E726CD266c103cC7C2763f4a3005d78B1";
+
+async function tvl(api) {
+ return sumTokens2({ tokens: [nullAddress], owner: contract, api });
+}
+
+module.exports = {
+ methodology: `We count the LYX on ${contract}`,
+ lukso: {
+ tvl,
+ },
+};
diff --git a/projects/silo/index.js b/projects/silo/index.js
index a78f3fb925..d2d47ae58f 100644
--- a/projects/silo/index.js
+++ b/projects/silo/index.js
@@ -30,6 +30,14 @@ const config = {
}
]
},
+ optimism: {
+ factories: [
+ {
+ START_BLOCK: 120480601,
+ SILO_FACTORY: '0x6B14c4450a29Dd9562c20259eBFF67a577b540b9', // Silo Optimism (Original)
+ }
+ ]
+ },
}
const XAI = '0xd7c9f0e536dc865ae858b0c0453fe76d13c3beac'
@@ -83,6 +91,7 @@ module.exports = {
methodology: `We calculate TVL by interacting with Silo Factory smart contracts on Ethereum and Arbitrum. For Ethereum, it queries Silo(Original)(0x4D919CEcfD4793c0D47866C8d0a02a0950737589), (Convex Factory)(0x6d4A256695586F61b77B09bc3D28333A91114d5a), and (LLAMA Edition)(0x2c0fA05281730EFd3ef71172d8992500B36b56eA). On Arbitrum, we query the Silo Arbitrum factory(0x4166487056A922D784b073d4d928a516B074b719) to obtain the addresses of Silos, retrieve the assets of each Silo, and then calculates the sum of the deposited tokens, borrowed amount are exported separately`,
ethereum: { tvl, borrowed, },
arbitrum: { tvl, borrowed, },
+ optimism: { tvl, borrowed, },
hallmarks: [
[1692968400, "Launch CRV market"]
]
diff --git a/projects/size-credit/index.js b/projects/size-credit/index.js
new file mode 100644
index 0000000000..24b220db46
--- /dev/null
+++ b/projects/size-credit/index.js
@@ -0,0 +1,23 @@
+const { sumTokensExport } = require('../helper/unwrapLPs')
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const AUSDC_CONTRACT = '0x4e65fe4dba92790696d040ac24aa414708f5c0ab'
+const SZDEBT_CONTRACT = '0xb0a00c4b3d77c896f46dc6b204695e22de7a185d'
+const SIZE_PROXY_CONTRACT = '0xC2a429681CAd7C1ce36442fbf7A4a68B11eFF940'
+const tokens = [
+ ADDRESSES.base.WETH,
+ AUSDC_CONTRACT,
+]
+
+async function borrowed(api) {
+ const totalDebt = await api.call({ abi: 'erc20:totalSupply', target: SZDEBT_CONTRACT, });
+
+ return api.add(ADDRESSES.base.USDbC, totalDebt)
+}
+
+module.exports = {
+ base: {
+ tvl: sumTokensExport({ tokens, owner: SIZE_PROXY_CONTRACT }),
+ borrowed
+ }
+}
diff --git a/projects/snsy/index.js b/projects/snsy/index.js
new file mode 100644
index 0000000000..c0dac1260e
--- /dev/null
+++ b/projects/snsy/index.js
@@ -0,0 +1,11 @@
+const { staking } = require('../helper/staking')
+const SNSY_TOKEN_CONTRACT = '0x82a605D6D9114F4Ad6D5Ee461027477EeED31E34';
+const SNSY_CLUB_STAKING_CONTRACT = '0x382c70620e42c2EF2b303b97bad1d9439Bf48ef9';
+
+module.exports = {
+ methodology: 'Counts the number of SNSY tokens in the Staking contract.',
+ ethereum: {
+ tvl: () => ({}),
+ staking: staking(SNSY_CLUB_STAKING_CONTRACT, SNSY_TOKEN_CONTRACT)
+ }
+};
\ No newline at end of file
diff --git a/projects/soda-protocol/index.js b/projects/soda-protocol/index.js
index b9c4ae64ba..b406eea851 100644
--- a/projects/soda-protocol/index.js
+++ b/projects/soda-protocol/index.js
@@ -1,22 +1,7 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokens2 } = require('../helper/solana')
-
-async function tvl() {
- const owner = '5cv5tMwrCMAVbwAC5icUPB5XB4qQpsaf3KaGP7Ygdomc'
- const tokens = [
- "9n4nbM75f5Ui33ZbPYXn59EwSgE8CGsHtAeTH5YFeJ9E",
- ADDRESSES.solana.SOL,
- "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt",
- ADDRESSES.solana.USDC,
- ADDRESSES.solana.USDT,
- "2FPyTwcZLUg1MDrwsyoP4D6s1tM7hAkHYRjkNb5w6Pxk",
- "4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R",
- ]
- return sumTokens2({ tokens, owner })
-}
+const { sumTokensExport } = require('../helper/solana')
module.exports = {
timetravel: false,
- solana: { tvl, },
+ solana: { tvl: sumTokensExport({ owner: '5cv5tMwrCMAVbwAC5icUPB5XB4qQpsaf3KaGP7Ygdomc'}), },
methodology: 'TVL consists of deposits made to the protocol and borrowed tokens are not counted.'
}
diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js
new file mode 100644
index 0000000000..488e83224e
--- /dev/null
+++ b/projects/sofa-org/index.js
@@ -0,0 +1,107 @@
+const { staking } = require('../helper/staking')
+
+const config = {
+ ethereum: {
+ vaults: [
+ // USDT
+ '0x3a253838121b9ad9736fAFc030Cf4971615D68b2',
+ '0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a',
+ '0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a',
+ '0x5494855B98858Ea4eF54D13E1d003197A387CE34',
+ '0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9',
+ '0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224',
+ // stETH
+ '0x141B893e4ae446e634E92116000e54d7fc72Bc65',
+ '0xC0f6d3B7B4073Df68DB5897C0884264D03A780C1',
+ '0x5bbEB889339CE028dC57a1C9A721eAa085BE2368',
+ '0x22D6201FF78854713CED5542658F16244335ae69',
+ '0xBEB059D623ac9817fc2F0414F1dCc61416da4540',
+ '0x4f8Abbc658338E4065acb154679931648195b793',
+ '0x6014784FC074706ab810130f77135bfb24463f06',
+ '0xD94A2BB8059E3bA3041592deeaF2B2eF4CcDec71',
+ '0x1361fa1398c22D6644DcC1AA619F1B84F6DB4366',
+ '0xB8610F07D25C3B0D7D589bDe8be1b07Ffae1A0A5',
+ '0x36Ac0331D03e40ab67Af564bC453314Cb58E0629',
+ '0x858Af7297a3D20f61E0F7A2487c686e0A3353f2C',
+ ],
+ aVaults: [
+ '0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19',
+ '0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3',
+ '0x9377f17ABde96887943e5Fcc92Db034c76820529',
+ '0x99c59D82b10c56950F6C031946656e6D0aD509ca',
+ '0xF6c70b5F034070001E833C9EbC6a3A0176B683A6',
+ '0x62104e40fA81a19f2B7E17C78C3ffBF4aCa4F212',
+ '0x20A82619FCd300f3E0028db6353D38E3cC3B9E14',
+ '0x1F519b172917Cfd6B7A69EF9d37E13Ac7dFF5E39',
+ '0xF4A60252B139E29A415C341a0D21261496D27d02',
+ '0x50752522d249230FE60C855098BB4a7a0974E746',
+ '0x8Ea9638f2587b20396ec8c45dd639dEB115F5211',
+ '0x8F9259a355933737F8F11f95d32460eCd5ED0706',
+ '0x3AbC7053ec29e26c1429195fd971F280422ecA80',
+ '0x071E0C2BE2b16c8B00173c6535eF8331b8e1feeD',
+ ],
+ },
+ arbitrum: {
+ vaults: [
+ // USDT
+ '0x7ECd1b5255543F4C2D7D8E475afCd01699dBE2B0',
+ '0xdFEb3460771148799b2D4344c369e2b2d6C26c42',
+ '0x00aEca021D0f06c7dee54D58ee6Af47B5645aB19',
+ '0x989897f1D976EE0b59Bf0A3172C170D8f3Cb84e3',
+ '0x6E72C8726c71a4Cbc6e31ff7d47B399Fa983C7B8',
+ '0x106825b71ccE77a70B69f57A0ACf9C4a6acf292a',
+ ],
+ aVaults: [
+ // aArbUSDT
+ '0x3a253838121b9ad9736fAFc030Cf4971615D68b2',
+ '0xD9cFF1bc89f705EaB2579fA2DC86E9a6F971370a',
+ '0x9C5D3C3AbD633b8eA68C5a51325f8630DC620AD9',
+ '0x2F1C60bA96ec6925fA9bBbFC9Eb7908bD35Bc224',
+ '0x72e0906558e4Ee528974cD7803bfF12d9f2869C3',
+ '0x9377f17ABde96887943e5Fcc92Db034c76820529',
+ '0xA5492Baf06692C0051D69D31458D536Bacc08651',
+ '0x75809d59A9a69226972DbB84cB2D1851C5cD0CbF',
+ '0x6f4DBcfC81Dd22AE3EDeC5f9724E43cba8C92E50',
+ '0xA8fcc1BA1D4893a4894206986B65F652D5FE04AB',
+ '0xA76Ee91c6E51D248782d7C81826dF91522a6EF96',
+ '0x7E11ce3e893081B111b720dF29669dEf14e81cDE',
+ '0x8E882A56604F2b5735EA979bD6fa06C064d2f3f9',
+ '0xf7Be091BCBbB79f3D9029A25Dc94bC8FDd134EaC',
+ // aArbUSDC
+ '0x8F9259a355933737F8F11f95d32460eCd5ED0706',
+ '0x3AbC7053ec29e26c1429195fd971F280422ecA80',
+ '0xDdaA9d3A83E3Db4f9A3Cb593787Db8D3063e3cC1',
+ '0xf82491Af99d6eEE7FB7a964bb8bF6eDc67a230f0',
+ '0xf1485cDEC97a334996913bE68a0563Ebe0c72ffC',
+ '0xBFD58c8150cF7048D5C149fA2bAdDD194b8416fe',
+ '0xBEFB3aAD1dfb1660444f0D76A91261EF755B2B86',
+ '0x1D2fAAd42cbF3Dc121659d856A9A405ED1067873',
+ '0xfA49f859a012e8b1795A81B23b21Db0bD40e7770',
+ '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830',
+ '0x4a5B4049a4aFae31278d36768704872f73dA67D1',
+ '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8',],
+ }
+
+}
+
+
+Object.keys(config).forEach(chain => {
+ const { vaults = [], aVaults = [] } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const tokens = await api.multiCall({ abi: 'address:collateral', calls: vaults })
+ const tokens2 = await api.multiCall({ abi: 'address:collateral', calls: aVaults })
+ const atokens = await api.multiCall({ abi: 'address:aToken', calls: aVaults })
+ return api.sumTokens({ tokensAndOwners2: [[tokens, tokens2, atokens].flat(), [vaults, aVaults, aVaults].flat()] })
+ }
+ }
+})
+
+module.exports.ethereum.staking = staking([
+ '0xBEFB3aAD1dfb1660444f0D76A91261EF755B2B86',
+ '0xBFD58c8150cF7048D5C149fA2bAdDD194b8416fe',
+ '0xfA49f859a012e8b1795A81B23b21Db0bD40e7770',
+ '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830',
+ '0x4a5B4049a4aFae31278d36768704872f73dA67D1',
+ '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8',
+], '0x57b96d4af698605563a4653d882635da59bf11af')
diff --git a/projects/solana_miner/index.js b/projects/solana_miner/index.js
index 2578c00637..c7acdf3523 100644
--- a/projects/solana_miner/index.js
+++ b/projects/solana_miner/index.js
@@ -8,6 +8,7 @@ module.exports = {
hallmarks: [
[1704834000, "Rug Pull"]
],
+ deadFrom: 1704834000,
timetravel: false,
methodology:
"Solana Miner is designed to provide a user-friendly mining experience, minimizing technical barriers and facilitating newcomers. Our product focuses not only on building a community but also on delivering passive income for investors. See more: https://solanaminer.xyz",
diff --git a/projects/solayer/index.js b/projects/solayer/index.js
new file mode 100644
index 0000000000..9657dd6952
--- /dev/null
+++ b/projects/solayer/index.js
@@ -0,0 +1,28 @@
+const { sumTokens2, getConnection } = require("../helper/solana");
+const { PublicKey } = require("@solana/web3.js");
+
+async function tvl() {
+ const connection = getConnection();
+ const [account, lst] = await Promise.all([
+ connection.getAccountInfo(new PublicKey('po1osKDWYF9oiVEGmzKA4eTs8eMveFRMox3bUKazGN2')),
+ sumTokens2({
+ tokensAndOwners: [
+ ['J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn', 'GgTE2exWZ36Q82FoVgEEzEHYCfsbGjm3P6zRfx3hLUv4'],
+ ['mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So', 'E9LmYVKU5oyjWs9Zmzv9ji8NkzhJxJQbUEH3FWDKZt8D'],
+ ['bSo13r4TkiE4KumL71LsHTPpL2euBYLFx6h9HP3piy1', '2DRZbbse5b5souvMQkifpS8CRBsDeLt6a9xDqqVJvmdw'],
+ ['5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm', 'GF8jvNGY44tnCfhnzdoSUBpgfog9YnLc6BRBCnt8j9do']
+ ],
+ })
+ ]);
+
+ return {
+ solana: Number(account.data.readBigUint64LE(258)) / 1e9,
+ ...lst
+ };
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: "TVL is calculated by summing all re-staked assets.",
+ solana: { tvl },
+};
diff --git a/projects/solend/index.js b/projects/solend/index.js
index 895249b3b0..d8c495f05e 100644
--- a/projects/solend/index.js
+++ b/projects/solend/index.js
@@ -1,47 +1,27 @@
-const BigNumber = require("bignumber.js");
-const { PublicKey, } = require("@solana/web3.js");
-const { sliceIntoChunks, } = require('../helper/utils')
-const { transformBalances, } = require('../helper/portedTokens')
-const { sumTokens, getConnection, decodeAccount, } = require("../helper/solana");
+const { sumTokens2, decodeAccount, getMultipleAccounts, } = require("../helper/solana");
const { getConfig } = require('../helper/cache')
-const sdk = require('@defillama/sdk')
const solendConfigEndpoint = "https://api.solend.fi/v1/markets/configs?scope=all&deployment=production";
-async function borrowed() {
+async function borrowed(api) {
const markets = (await getConfig('solend', solendConfigEndpoint))
- const connection = getConnection()
- const balances = {};
const reserves = []
for (const market of markets)
for (const reserve of market.reserves)
- reserves.push(new PublicKey(reserve.address))
-
- const chunks = sliceIntoChunks(reserves, 99)
- for (const chunk of chunks) {
- const infos = await connection.getMultipleAccountsInfo(chunk)
- infos.forEach(i => {
- const { info: { liquidity } } = decodeAccount('reserve', i)
- const amount = new BigNumber(liquidity.borrowedAmountWads.toString() / 1e18).toFixed(0);
- sdk.util.sumSingleBalance(balances, liquidity.mintPubkey.toString(), amount)
- })
- }
-
- return transformBalances('solana', balances);
+ reserves.push(reserve.address)
+
+ const infos = await getMultipleAccounts(reserves)
+ infos.forEach(i => {
+ const { info: { liquidity } } = decodeAccount('reserve', i)
+ const amount = liquidity.borrowedAmountWads.toString() / 1e18
+ api.add(liquidity.mintPubkey.toString(), amount)
+ })
}
async function tvl() {
const markets = (await getConfig('solend', solendConfigEndpoint))
- const tokensAndOwners = []
-
- for (const market of markets) {
- for (const reserve of market.reserves) {
- tokensAndOwners.push([reserve.liquidityToken.mint, market.authorityAddress])
- }
- }
-
- return sumTokens(tokensAndOwners);
+ return sumTokens2({ owners: markets.map(i => i.authorityAddress)});
}
module.exports = {
diff --git a/projects/solhero/index.js b/projects/solhero/index.js
deleted file mode 100644
index 1a941679b1..0000000000
--- a/projects/solhero/index.js
+++ /dev/null
@@ -1,316 +0,0 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const utils = require('../helper/utils')
-const { getConnection } = require('../helper/solana')
-const BigNumber = require('bignumber.js')
-const { PublicKey } = require('@solana/web3.js')
-const sdk = require('@defillama/sdk')
-
-const poolInfoKey = new PublicKey('CsMSJ2wJAsQBNZU9LuL3FAx2Do9ndY4Ae15JAXhFMc1p')
-
-const decimals = {
- 'Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g': 6, // HERO
- [ADDRESSES.solana.SOL]: 9, // SOL
- '4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R': 6, // RAY
- 'mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So': 9, // mSOL
- [ADDRESSES.solana.USDC]: 6, // USDC
- [ADDRESSES.solana.USDT]: 6, // USDT
- 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': 6, // hero-usdc
- 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': 9, // sol-usdt
- '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': 9, // sol-usdc
- '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': 6, // sol-ray
-}
-
-const poolTypes = {
- 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': 0, // hero-usdc
- '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': 0, // sol-usdc, 0: lp, 1: token
- 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': 0, // sol-usdt
- '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': 0, // ray-sol
-}
-
-const poolKeys = {
- 'rEmtKCiw6DQL8kAaGzhSryqnqNckYabPxTNXDdj2Jur': { // hero-usdc
- 'ammId': 'FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8',
- },
- '8HoQnePLqPj4M7PUDzfw8e3Ymdwgc7NLGnaTUapubyvu': { // sol-usdc
- 'ammId': '58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2',
- },
- 'Epm4KfTj4DMrvqn6Bwg2Tr2N8vhQuNbuK8bESFp4k33K': { // sol-usdt
- 'ammId': '7XawhbbxtsRcQA8KTkHT9f9nc6d69UwqCDh6U5EEbEmX',
- },
- '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip': { // ray-sol
- 'ammId': 'AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA',
- },
-}
-
-function isLp(token) {
- const addr = token.toString()
- if (poolTypes[addr] == 0)
- return true
- return false
-}
-
-var priceCache = new Map()
-
-async function getTokenSupplyUI(mintPubkey) {
- const connection = getConnection()
- var supply = new BigNumber(0)
-
- const ret = await connection.getTokenSupply(mintPubkey)
- if (ret && ret.value && ret.value.uiAmountString)
- supply = new BigNumber(ret.value.uiAmountString)
-
- return supply
-}
-
-async function getLpPrice(tokenPubkey) {
-
- if (priceCache[tokenPubkey.toString()])
- return priceCache[tokenPubkey.toString()]
-
- const tokenAddress = tokenPubkey.toString()
-
- var price = new BigNumber(1.0)
-
- const keys = poolKeys[tokenAddress]
- if (!keys)
- return price;
-
- const ammId = keys['ammId']
-
- const prefix = 'https://api.solscan.io/amm/read?address='
- const url = prefix + ammId
-
- const res = await utils.fetchURL(url)
- if (res && res.data && res.data.success) {
- const tvl = new BigNumber(res.data.data.liquidity)
-
- const _tokenPubkey = new PublicKey(res.data.data.lpMint)
- const supply = await getTokenSupplyUI(_tokenPubkey)
-
- price = tvl.div(supply)
-
- priceCache[tokenPubkey.toString()] = price
- } else {
- sdk.log(res)
- }
-
- return price
-}
-
-
-async function getTokenPrice(tokenPubkey) {
-
- if (priceCache[tokenPubkey.toString()])
- return priceCache[tokenPubkey.toString()]
-
- var price = new BigNumber(1.0)
-
- const prefix = 'https://public-api.solscan.io/market/token/'
- const url = prefix + tokenPubkey.toString()
-
- const res = await utils.fetchURL(url)
- if (res && res.data && res.data.priceUsdt) {
- price = new BigNumber(res.data.priceUsdt)
- priceCache[tokenPubkey.toString()] = price
- }
-
- return price
-}
-
-async function getHeroPrice() {
-
- if (priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g'])
- return priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g']
-
- var price = new BigNumber(1.0)
-
- const url = 'https://api.solscan.io/amm/read?address=FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8'
-
- const res = await utils.fetchURL(url)
- if (res && res.data && res.data.data && res.data.data.price) {
- price = new BigNumber(res.data.data.price)
- priceCache['Hero6s7zJXsw9hfCXLVR5stLqgCok3E7CCkpQEoLAk2g'] = price
- }
-
- return price
-}
-
-async function getHeroLp() {
- var lpTvl = new BigNumber(0)
-
- const url = 'https://api.solscan.io/amm/read?address=FJB4xeMJ9KoZVDZb7Pf91hggwy6hLJMQFXTMKCfugwU8'
-
- const res = await utils.fetchURL(url)
- if (res && res.data && res.data.data && res.data.data.liquidity) {
- lpTvl = new BigNumber(res.data.data.liquidity)
- }
-
- return lpTvl
-}
-
-async function pools() {
- const connection = getConnection()
- const poolInfoAccount = await connection.getAccountInfo(poolInfoKey)
-
- const buffer = Buffer.from(poolInfoAccount.data)
- const poolLength = buffer.readBigUInt64LE(0)
-
- var amounts = []
-
- for (var i = 0; i < poolLength; i++) {
- if (i == 10)
- continue
-
- const offset = 8 + i * 104
-
- const pubkey = new PublicKey(buffer.subarray(offset, offset + 32))
- const dec = new BigNumber(10).pow(decimals[pubkey.toString()])
- const amount = buffer.readBigUInt64LE(offset + 40)
-
- const boost = 3
- amounts.push(new BigNumber(amount).times(boost).div(dec))
- }
-
- return {
- solana: amounts[1],
- raydium: amounts[2],
- 'msol': amounts[3],
- 'usd-coin': amounts[4],
- tether: amounts[5],
- }
-}
-
-async function staking() {
-
- const connection = getConnection()
- const poolInfoAccount = await connection.getAccountInfo(poolInfoKey)
-
- const buffer = Buffer.from(poolInfoAccount.data)
-
- var tvl = new BigNumber(0)
-
- var solPrice = await getTokenPrice(ADDRESSES.solana.SOL)
-
- var amounts = []
-
- const poolLength = buffer.readBigUInt64LE(0)
- for (var i = 0; i < poolLength; i++) {
- if (i != 0)
- continue
-
- const offset = 8 + i * 104
-
- const pubkey = new PublicKey(buffer.subarray(offset, offset + 32))
- const dec = new BigNumber(10).pow(decimals[pubkey.toString()])
- const amount = buffer.readBigUInt64LE(offset + 40)
-
- amounts.push(new BigNumber(amount).div(dec))
-
- var price = new BigNumber(1.0)
- if (i == 0)
- price = await getHeroPrice()
- else if (isLp(pubkey))
- price = await getLpPrice(pubkey)
- else
- price = await getTokenPrice(pubkey)
-
- //if (i == 1)
- // solPrice = price
-
- const boost = 3
- const poolTvl = new BigNumber(amount).times(price).times(boost).div(dec)
- tvl = tvl.plus(poolTvl)
- }
-
- tvl = tvl.div(solPrice)
-
- return {
- solana: tvl
- }
-}
-
-async function farmPool() {
-
- const connection = getConnection()
- const poolInfoAccount = await connection.getAccountInfo(poolInfoKey)
-
- const buffer = Buffer.from(poolInfoAccount.data)
-
- var tvl = new BigNumber(0)
-
- var solPrice = await getTokenPrice(ADDRESSES.solana.SOL)
-
- var amounts = []
-
- const poolLength = buffer.readBigUInt64LE(0)
- for (var i = 0; i < poolLength; i++) {
-
- const offset = 8 + i * 104
-
- const pubkey = new PublicKey(buffer.subarray(offset, offset + 32))
- const dec = new BigNumber(10).pow(decimals[pubkey.toString()])
- const amount = buffer.readBigUInt64LE(offset + 40)
-
- amounts.push(new BigNumber(amount).div(dec))
-
- var price = new BigNumber(1.0)
- if (i == 0)
- price = await getHeroPrice()
- else if (isLp(pubkey))
- price = await getLpPrice(pubkey)
- else
- price = await getTokenPrice(pubkey)
-
- if (i == 1)
- solPrice = price
-
- const boost = 3
- const poolTvl = new BigNumber(amount).times(price).times(boost).div(dec)
- tvl = tvl.plus(poolTvl)
- }
-
- tvl = tvl.div(solPrice)
-
- return {
- solana: tvl
- }
-}
-
-async function lpTvl() {
- const connection = getConnection()
- const poolInfoAccount = await connection.getAccountInfo(poolInfoKey)
-
- const buffer = Buffer.from(poolInfoAccount.data)
-
- var tvl = new BigNumber(0)
-
- var solPrice = await getTokenPrice(ADDRESSES.solana.SOL)
- var lpTvl = await getHeroLp()
-
- lpTvl = lpTvl.div(solPrice)
-
- return {
- solana: lpTvl
- }
-}
-
-async function tvl() {
- const [pool, farm] = await Promise.all([
- pools(),
- farmPool(),
- ]);
-
- pool.solana = (pool.solana).plus(farm.solana)
-
- return pool
-}
-
-module.exports = {
- timetravel: false,
- solana: {
- tvl,
- pool2: lpTvl,
- staking,
- },
- methodology: 'TVL consists of staked tokens and raydium LPs',
-}
diff --git a/projects/solidly-v3/index.js b/projects/solidly-v3/index.js
index e496cca310..24181e4bee 100644
--- a/projects/solidly-v3/index.js
+++ b/projects/solidly-v3/index.js
@@ -4,7 +4,7 @@ const { uniV3Export } = require("../helper/uniswapV3");
module.exports = uniV3Export({
ethereum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 18044650, },
optimism: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 115235065, },
- base: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 9672720, },
+ base: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 9672720, permitFailure: true },
arbitrum: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 173576189, permitFailure: true, },
fantom: { factory: "0x70fe4a44ea505cfa3a57b95cf2862d4fd5f0f687", fromBlock: 73057898, permitFailure: true, },
});
diff --git a/projects/solv-protocol-funds/abi.json b/projects/solv-protocol-funds/abi.json
index a0495db17d..1435ab0f58 100644
--- a/projects/solv-protocol-funds/abi.json
+++ b/projects/solv-protocol-funds/abi.json
@@ -11,5 +11,6 @@
"pool": "function pool(address tokenX, address tokenY, uint24 fee) view returns (address)",
"state": "function state() view returns (uint160 sqrtPriceX96, int24 currentPoint, uint16 observationCurrentIndex, uint16 observationQueueLen, uint16 observationNextQueueLen, bool locked, uint256 liquidity, uint256 liquidityX)",
"stakedAmountsAbi": "function stakedAmounts(address) external view returns (uint256)",
- "stakedMlpAmount": "function stakedMlpAmount(address account) view returns (uint256)"
+ "stakedMlpAmount": "function stakedMlpAmount(address account) view returns (uint256)",
+ "symbol": "string:symbol"
}
\ No newline at end of file
diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js
index e67465e04d..c086c8a4c7 100644
--- a/projects/solv-protocol-funds/index.js
+++ b/projects/solv-protocol-funds/index.js
@@ -3,14 +3,14 @@ const { default: BigNumber } = require("bignumber.js");
const { getConfig } = require("../helper/cache");
const { cachedGraphQuery } = require("../helper/cache");
const { sumTokens2, } = require("../helper/unwrapLPs");
-const { getAmounts } = require("./iziswap")
+const { getAmounts } = require("./iziswap");
// The Graph
const graphUrlList = {
ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest',
bsc: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-bsc/version/latest',
arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest',
- mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph',
+ mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn',
merlin: 'http://solv-subgraph-server-alb-694489734.us-west-1.elb.amazonaws.com:8000/subgraphs/name/solv-payable-factory-merlin',
}
@@ -19,15 +19,17 @@ const slotListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/solv-pro
const addressUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solv-funds.json';
async function tvl(api) {
- let address = (await getConfig('solv-protocol/funds', addressUrl));
+ const address = (await getConfig('solv-protocol/funds', addressUrl));
+ const graphData = await getGraphData(api.timestamp, api.chain, api);
await gm(api, address);
await mux(api, address);
await klp(api, address);
await iziswap(api, address);
await lendle(api, address);
- await vaultBalance(api);
- // await otherDeposit(api, address);
+ await vaultBalance(api, graphData);
+ await otherDeposit(api, address);
+ await ceffuBalance(api, address, graphData);
return api.getBalances();
}
@@ -91,6 +93,13 @@ async function borrowed(api) {
}
}
+ const symbols = await api.multiCall({
+ abi: abi.symbol,
+ calls: poolBaseInfos.map((index) => ({
+ target: index[1]
+ })),
+ })
+
const balances = await api.multiCall({
abi: abi.balanceOf,
calls: Object.values(vaults).map((index) => ({
@@ -111,7 +120,9 @@ async function borrowed(api) {
vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`] = undefined
}
if (balance > 0) {
- api.add(poolBaseInfos[i][1], balance)
+ if (symbols[i] !== "SolvBTC") {
+ api.add(poolBaseInfos[i][1], balance)
+ }
}
}
}
@@ -247,8 +258,8 @@ async function liquidity(api, iziswap, owner) {
tokenList.forEach((token, index) => {
const amounts = getAmounts(state[index], liquidities[index])
- api.add(token[0], amounts.amountX)
- api.add(token[1], amounts.amountY)
+ api.add(token[0], amounts.amountX);
+ api.add(token[1], amounts.amountY);
})
}
@@ -286,9 +297,8 @@ async function lendle(api, address) {
api.add(lendleData.account.ethAddress, balance)
}
-async function vaultBalance(api) {
+async function vaultBalance(api, graphData) {
const network = api.chain;
- const graphData = await getGraphData(api.timestamp, network, api);
const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solvbtc.json';
let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl));
@@ -319,6 +329,13 @@ async function vaultBalance(api) {
}
}
+ const symbols = await api.multiCall({
+ abi: abi.symbol,
+ calls: Object.values(vaults).map((index) => ({
+ target: index[0]
+ })),
+ })
+
const balances = await api.multiCall({
abi: abi.balanceOf,
calls: Object.values(vaults).map((index) => ({
@@ -328,11 +345,110 @@ async function vaultBalance(api) {
})
for (const key in balances) {
- api.add(Object.values(vaults)[key][0], balances[key])
+ if (symbols[key] !== "SolvBTC") {
+ api.add(Object.values(vaults)[key][0], balances[key])
+ }
}
}
}
+async function ceffuBalance(api, address, graphData) {
+ if (!address[api.chain] || !address[api.chain]["ceffu"]) {
+ return;
+ }
+ let ceffuData = address[api.chain]["ceffu"];
+
+ let pools = [];
+ for (const graph of graphData.pools) {
+ if (graph['openFundShareSlot'] == ceffuData['slot']) {
+ pools.push(graph)
+ }
+ }
+ if (pools.length > 0) {
+ const poolConcretes = await concrete(pools, api);
+ const nav = await api.multiCall({
+ abi: abi.getSubscribeNav,
+ calls: pools.map((index) => ({
+ target: index.navOracle,
+ params: [index.poolId, api.timestamp * 1000]
+ })),
+ })
+
+ const poolTotalValues = await api.multiCall({
+ abi: abi.slotTotalValue,
+ calls: pools.map((index) => ({
+ target: poolConcretes[index.contractAddress],
+ params: [index.openFundShareSlot]
+ })),
+ })
+
+ const poolBaseInfos = await api.multiCall({
+ abi: abi.slotBaseInfo,
+ calls: pools.map((index) => ({
+ target: poolConcretes[index.contractAddress],
+ params: [index.openFundShareSlot]
+ })),
+ })
+
+ const poolDecimalList = await api.multiCall({
+ abi: abi.decimals,
+ calls: poolBaseInfos.map(i => i[1]),
+ })
+
+ let vaults = {};
+ for (const key in pools) {
+ if (poolBaseInfos[key][1] && pools[key]["vault"]) {
+ vaults[`${pools[key]["vault"].toLowerCase()}-${poolBaseInfos[key][1].toLowerCase()}`] = [poolBaseInfos[key][1], pools[key]["vault"]]
+ }
+ }
+
+ const balances = await api.multiCall({
+ abi: abi.balanceOf,
+ calls: Object.values(vaults).map((index) => ({
+ target: index[0],
+ params: [index[1]]
+ })),
+ })
+
+ let vaultbalances = {};
+ for (let i = 0; i < Object.keys(vaults).length; i++) {
+ vaultbalances[Object.keys(vaults)[i]] = balances[i];
+ }
+
+ for (let i = 0; i < poolTotalValues.length; i++) {
+ const decimals = poolDecimalList[i];
+ let balance = BigNumber(poolTotalValues[i]).div(BigNumber(10).pow(18 - decimals)).times(BigNumber(nav[i].nav_).div(BigNumber(10).pow(decimals))).toNumber();
+ if (pools[i]['vault'] && poolBaseInfos[i][1] && vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`]) {
+ balance = BigNumber(balance).minus(vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`]).toNumber();
+ vaultbalances[`${pools[i]['vault'].toLowerCase()}-${poolBaseInfos[i][1].toLowerCase()}`] = undefined
+ }
+
+ if (ceffuData["ceffus"]) {
+ let ceffus = [];
+ for (const deposit of ceffuData["ceffus"]["depositAddress"]) {
+ for (const tokenAddress of ceffuData["ceffus"]["tokens"]) {
+ ceffus.push({ tokenAddress, deposit })
+ }
+ }
+
+ const balances = await api.multiCall({
+ abi: abi.balanceOf,
+ calls: Object.values(ceffus).map((index) => ({
+ target: index["tokenAddress"],
+ params: [index["deposit"]]
+ })),
+ })
+ for (const balanceOf of balances) {
+ balance = BigNumber(balance).minus(balanceOf).toNumber();
+ }
+ }
+
+ if (balance > 0) {
+ api.add(poolBaseInfos[i][1], balance)
+ }
+ }
+ }
+}
async function getGraphData(timestamp, chain, api) {
let rwaSlot = (await getConfig('solv-protocol/slots', slotListUrl));
diff --git a/projects/solv-protocol-rwa/index.js b/projects/solv-protocol-rwa/index.js
index 19ea2fc662..25d703b28e 100644
--- a/projects/solv-protocol-rwa/index.js
+++ b/projects/solv-protocol-rwa/index.js
@@ -5,7 +5,7 @@ const { cachedGraphQuery } = require("../helper/cache");
// The Graph
const graphUrlList = {
- mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph',
+ mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn',
}
const slotListUrl = 'https://cdn.jsdelivr.net/gh/solv-finance-dev/solv-protocol-rwa-slot/slot.json';
diff --git a/projects/solvbtc/index.js b/projects/solvbtc/index.js
index c255fdf3f3..1c35f29559 100644
--- a/projects/solvbtc/index.js
+++ b/projects/solvbtc/index.js
@@ -8,7 +8,7 @@ const graphUrlList = {
ethereum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-prod/version/latest',
bsc: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-bsc/version/latest',
arbitrum: 'https://api.studio.thegraph.com/query/40045/solv-payable-factory-arbitrum/version/latest',
- mantle: 'http://api.0xgraph.xyz/subgraphs/name/solv-payable-factory-mentle-0xgraph',
+ mantle: 'https://api.0xgraph.xyz/api/public/65c5cf65-bd77-4da0-b41c-cb6d237e7e2f/subgraphs/solv-payable-factory-mantle/-/gn',
merlin: 'http://solv-subgraph-server-alb-694489734.us-west-1.elb.amazonaws.com:8000/subgraphs/name/solv-payable-factory-merlin',
}
diff --git a/projects/solyard.js b/projects/solyard.js
index 0933d95ffd..4d477ca31e 100644
--- a/projects/solyard.js
+++ b/projects/solyard.js
@@ -1,72 +1,15 @@
-const { getTokenAccountBalance } = require('./helper/solana')
-const { get } = require('./helper/http')
-let _lpData
-
-async function getLPData() {
- if (!_lpData) _lpData = get("https://api.raydium.io/pairs")
- return _lpData
-}
-
-async function tvl() {
- const LP_Data = await getLPData()
- const pools = [
- {
- name: 'RAY-USDC-V4',
- mint: 'FbC6K13MzHvN42bXrtGaWsvZY9fxrackRSZcBGfjPc7m',
- tokenAccount: '6v9NUn9gCziTvTepoL2fvegQFPtDPJKneybAzd6jdPDp',
- },
- {
- name: 'RAY-USDT',
- mint: 'C3sT1R3nsw4AVdepvLTLKr5Gvszr7jufyBWUCvy4TUvT',
- tokenAccount: 'HpGnoYvTDvSa7aSmnNCSGLKt56Mdd6HUe5q6Kj4kHjVV',
- },
- {
- name: 'RAY-SRM-V4',
- mint: '7P5Thr9Egi2rvMmEuQkLn8x8e8Qro7u2U7yLD2tU2Hbe',
- tokenAccount: 'DNYv74TeXvcaCBnC4f2jGFFYpc8P5ifDMbEAgEXoAc9h',
- },
- {
- name: 'RAY-SOL-V4',
- mint: '89ZKE4aoyfLBe2RuV6jM3JGNhaV18Nxh8eNtjRcndBip',
- tokenAccount: '61HZrok75Uy4FV4My6kbbW8a5WFkTNvCUemxMrfeka5W',
- },
- {
- name: 'RAY-ETH-V4',
- mint: 'mjQH33MqZv5aKAbKHi8dG3g3qXeRQqq1GFcXceZkNSr',
- tokenAccount: 'DRi5CTWMvsQpxX5twpnCDk1iJpZ2GvNj4QaFQ3dDMhkS',
- }
- ]
- let total = 0
- for (const { mint, tokenAccount } of pools) {
- const lpPrice = LP_Data.find(i => i.lp_mint === 'CGrLpJH8LhrFMEk5hb1JtKyEYz3fuEGY6oYfip2Wztq8')?.lp_price || 0
- const stakedLP = await getTokenAccountBalance('BmDzZtmp6dvjoV6GyWcUGBsEPRhJGKaExiwXq2gyJVp9')
- total += lpPrice * stakedLP
- }
- return {
- 'tether': total
- };
-}
-
-async function pool2() {
- const LP_Data = await getLPData()
- const lpPrice = LP_Data.find(i => i.lp_mint === 'CGrLpJH8LhrFMEk5hb1JtKyEYz3fuEGY6oYfip2Wztq8').lp_price
- const stakedLP = await getTokenAccountBalance('BmDzZtmp6dvjoV6GyWcUGBsEPRhJGKaExiwXq2gyJVp9')
- return {
- 'tether': lpPrice * stakedLP
- };
-}
+const { sumTokens2 } = require('./helper/solana')
async function staking() {
- return {
- 'solyard-finance': await getTokenAccountBalance('Gcdr3WtnnCW1SCDoLQNWXBtmt7xt4x9GEroz3zAfMWys')
- };
+ return sumTokens2({ tokenAccounts: ['Gcdr3WtnnCW1SCDoLQNWXBtmt7xt4x9GEroz3zAfMWys']})
}
module.exports = {
+ deadFrom: '2022-06-30',
timetravel: false,
solana: {
- tvl,
+ tvl: () => ({}),
staking,
- pool2,
+ pool2: () => ({}),
},
}
diff --git a/projects/soroswap/index.js b/projects/soroswap/index.js
new file mode 100644
index 0000000000..14a806760c
--- /dev/null
+++ b/projects/soroswap/index.js
@@ -0,0 +1,44 @@
+const utils = require("../helper/utils");
+const { getApiTvl } = require("../helper/historicalApi");
+
+const getCurrentTvl = (pools) => {
+ return pools?.data?.reduce((acc, pool) => {
+ return acc + (pool.tvl || 0);
+ }, 0);
+};
+
+const getTvlDayData = (pools) => {
+ const tvlChartData = {};
+
+ pools?.data?.forEach((pool) => {
+ pool.tvlChartData?.forEach((data) => {
+ tvlChartData[data.date] = {
+ tvl: (tvlChartData?.[data?.date]?.tvl || 0) + data.tvl,
+ date: data.date,
+ };
+ });
+ });
+
+ return Object.keys(tvlChartData).map((key) => ({
+ date: tvlChartData[key].date,
+ totalLiquidityUSD: tvlChartData[key].tvl,
+ }));
+};
+
+async function tvl(time) {
+ const pools = await utils.fetchURL(
+ "https://info.soroswap.finance/api/pairs?network=MAINNET"
+ );
+
+ return getApiTvl(
+ time,
+ () => getCurrentTvl(pools),
+ () => getTvlDayData(pools)
+ );
+}
+
+module.exports = {
+ methodology:
+ 'TVL counts the liquidity of the Pools on AMM, data is pulled from the Soroswap Info: "https://info.soroswap.finance/".',
+ stellar: { tvl },
+};
diff --git a/projects/sorta-fi/index.js b/projects/sorta-fi/index.js
new file mode 100644
index 0000000000..8b0ad4dbab
--- /dev/null
+++ b/projects/sorta-fi/index.js
@@ -0,0 +1,26 @@
+const { compoundExports2 } = require("../helper/compound");
+const sdk = require('@defillama/sdk')
+const { stakings } = require('../helper/staking')
+
+const contract = '0xE2D74A5f8101E6829409e4Fa8bBADCE2e0012C70'
+
+function tvl(borrowed = false) {
+ return async (api, ...args) => {
+
+ const key = borrowed ? 'borrowed' : 'tvl'
+ const comptrollers = await api.call({ abi: 'address[]:getControllers', target: contract })
+ const tvls = comptrollers.map(i => compoundExports2({ comptroller: i })[key])
+ return sdk.util.sumChainTvls(tvls)(api, ...args)
+ }
+}
+
+const stakingContract = '0xd828eB62B026e3eFf70b867FfD8C86C0AEA9dBd8'
+const token = '0x73c36aE64842Eaf4D9209dE10fdA21017b5f0709'
+
+module.exports = {
+ arbitrum: {
+ tvl: tvl(),
+ borrowed: tvl(true),
+ staking: stakings([stakingContract], token),
+ }
+}
diff --git a/projects/soulswap/abis/factory.json b/projects/soulswap/abis/factory.json
deleted file mode 100644
index 9a147cdfb8..0000000000
--- a/projects/soulswap/abis/factory.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "allPairs": "function allPairs(uint256) view returns (address)",
- "totalPairs": "uint256:totalPairs"
-}
\ No newline at end of file
diff --git a/projects/soulswap/helper/getUsdSoulTvl.js b/projects/soulswap/helper/getUsdSoulTvl.js
deleted file mode 100644
index a6d888b7d1..0000000000
--- a/projects/soulswap/helper/getUsdSoulTvl.js
+++ /dev/null
@@ -1,171 +0,0 @@
-const sdk = require('@defillama/sdk');
-const token0 = 'address:token0'
-const token1 = 'address:token1'
-const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'
-const factoryAbi = require('../abis/factory.json');
-
-async function requery(results, chain, block, abi) {
- if (results.some(r => !r.success)) {
- const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success)
- const newResults = await sdk.api.abi
- .multiCall({
- abi,
- chain,
- calls: failed.map((f) => f[0].input),
- block,
- }).then(({ output }) => output);
- failed.forEach((f, i) => {
- results[f[1]] = newResults[i]
- })
- }
-}
-
-function sum(balances, token, amount) {
- if (balances[token] === undefined) {
- balances[token] = 0
- }
- balances[token] += Number(amount)
-}
-
-function setPrice(prices, address, coreAmount, tokenAmount) {
- if (prices[address] !== undefined) {
- const currentCoreAmount = prices[address][0]
- if (coreAmount < currentCoreAmount) {
- return
- }
- }
- prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)]
-}
-
-function calculateUsdSoulTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName, decimals = 18) {
- const whitelist = whitelistRaw.map(t => t.toLowerCase())
- const coreAsset = coreAssetRaw.toLowerCase()
- return async (timestamp, ethBlock, {[chain]: block}) => {
-
- let pairAddresses;
- const pairLength = (await sdk.api.abi.call({
- target: FACTORY,
- abi: factoryAbi.totalPairs,
- chain,
- block
- })).output
- if (pairLength === null) {
- throw new Error("totalPairs() failed")
- }
- const pairNums = Array.from(Array(Number(pairLength)).keys())
- {
- const pairs = (await sdk.api.abi.multiCall({
- abi: factoryAbi.allPairs,
- chain,
- calls: pairNums.map(num => ({
- target: FACTORY,
- params: [num]
- })),
- block
- })).output
- await requery(pairs, chain, block, factoryAbi.allPairs);
- pairAddresses = pairs.map(result => result.output.toLowerCase())
- }
-
- const [token0Addresses, token1Addresses, reserves] = await Promise.all([
- sdk.api.abi
- .multiCall({
- abi: token0,
- chain,
- calls: pairAddresses.map((pairAddress) => ({
- target: pairAddress,
- })),
- block,
- })
- .then(({ output }) => output),
- sdk.api.abi
- .multiCall({
- abi: token1,
- chain,
- calls: pairAddresses.map((pairAddress) => ({
- target: pairAddress,
- })),
- block,
- })
- .then(({ output }) => output),
- sdk.api.abi
- .multiCall({
- abi: getReserves,
- chain,
- calls: pairAddresses.map((pairAddress) => ({
- target: pairAddress,
- })),
- block,
- }).then(({ output }) => output),
- ]);
- await requery(token0Addresses, chain, block, token0);
- await requery(token1Addresses, chain, block, token1);
- await requery(reserves, chain, block, getReserves);
-
- const pairs = {};
- // add token0Addresses
- token0Addresses.forEach((token0Address) => {
- const tokenAddress = token0Address.output.toLowerCase();
-
- const pairAddress = token0Address.input.target.toLowerCase();
- pairs[pairAddress] = {
- token0Address: tokenAddress,
- }
- });
-
- // add token1Addresses
- token1Addresses.forEach((token1Address) => {
- const tokenAddress = token1Address.output.toLowerCase();
- const pairAddress = token1Address.input.target.toLowerCase();
- pairs[pairAddress] = {
- ...(pairs[pairAddress] || {}),
- token1Address: tokenAddress,
- }
- });
-
- const balances = {}
- let coreBalance = 0
- const prices = {}
- const list = []
- for (let i = 0; i < reserves.length; i++) {
- const pairAddress = reserves[i].input.target.toLowerCase();
- const pair = pairs[pairAddress];
- const token0Address = pair.token0Address.toLowerCase()
- const token1Address = pair.token1Address.toLowerCase()
- const reserveAmounts = reserves[i].output
- if (token0Address === coreAsset) {
- coreBalance += Number(reserveAmounts[0]) * 2
- if (whitelist.includes(token1Address)) {
- setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1])
- }
- list.push([pairAddress, Number(reserveAmounts[0]), reserveAmounts])
- } else if (token1Address === coreAsset) {
- coreBalance += Number(reserveAmounts[1]) * 2
- if (whitelist.includes(token0Address)) {
- setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0])
- }
- } else {
- const whitelistedToken0 = whitelist.find(t => t === token0Address)
- const whitelistedToken1 = whitelist.find(t => t === token1Address)
- if (whitelistedToken0 !== undefined) {
- sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2)
- } else if (whitelistedToken1 !== undefined) {
- sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2)
- }
- }
- }
- Object.entries(balances).forEach(([address, amount]) => {
- const price = prices[address];
- if (price !== undefined) {
- coreBalance += price[1] * (amount ?? 0)
- }
- })
- return {
- [coreAssetName]: (coreBalance) / (10 ** decimals)
- }
- }
-}
-
-module.exports = {
- calculateUsdSoulTvl,
-};
diff --git a/projects/soulswap/index.js b/projects/soulswap/index.js
index 18b015606b..a314e56167 100644
--- a/projects/soulswap/index.js
+++ b/projects/soulswap/index.js
@@ -1,38 +1,31 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { calculateUsdSoulTvl } = require('./helper/getUsdSoulTvl.js')
const { staking } = require('../helper/staking.js');
const { underworldLending } = require('./underworld-lending.js')
+const { getUniTVL } = require('../helper/unknownTokens')
+
+const abis = {
+ "allPairs": "function allPairs(uint256) view returns (address)",
+ "allPairsLength": "uint256:totalPairs"
+}
const factory_fantom = '0x1120e150dA9def6Fe930f4fEDeD18ef57c0CA7eF'
const farm_fantom = '0xb898226dE3c5ca980381fE85F2Bc10e35e00634c'
const soul_fantom = '0xe2fb177009ff39f52c0134e8007fa0e4baacbd07'
-const wftm_fantom = ADDRESSES.fantom.WFTM
-const rndm_fantom = '0x49ac072c793fb9523f0688a0d863aadfbfb5d475'
-const usdc_fantom = ADDRESSES.fantom.USDC
-const wbtc_fantom = '0x321162cd933e2be498cd2267a90534a804051b11'
const factory_avax = '0x5BB2a9984de4a69c05c996F7EF09597Ac8c9D63a'
const farm_avax = '0xB1e330401c920077Ddf157AbA5594238d36b54B1'
const soul_avax = '0x11d6DD25c1695764e64F439E32cc7746f3945543'
-const wavax_avax = ADDRESSES.avax.WAVAX
-const usdc_avax = ADDRESSES.avax.USDC
-const wbtc_avax = ADDRESSES.avax.WBTC_e
-const weth_avax = ADDRESSES.avax.WETH_e
-
-const wl_fantom = [ usdc_fantom, soul_fantom, rndm_fantom, wbtc_fantom ]
-const wl_avax = [ usdc_avax, soul_avax, wbtc_avax, weth_avax ]
module.exports = {
+ misrepresentedTokens: true,
fantom:{
staking: staking(farm_fantom, soul_fantom),
- tvl: calculateUsdSoulTvl(factory_fantom, 'fantom', wftm_fantom, wl_fantom, 'fantom'),
+ tvl: getUniTVL({ factory: factory_fantom, useDefaultCoreAssets: true, abis, }),
borrowed: underworldLending('fantom', true)
},
avax:{
staking: staking(farm_avax, soul_avax),
- tvl: calculateUsdSoulTvl(factory_avax, 'avax', wavax_avax, wl_avax, 'avax'),
+ tvl: getUniTVL({ factory: factory_avax, useDefaultCoreAssets: true, abis, }),
borrowed: underworldLending('avax', true)
},
- misrepresentedTokens: true,
methodology: "Counts liquidity on the exchange, staked soul, and underworld assets.",
}
diff --git a/projects/soulswap/underworld-lending.js b/projects/soulswap/underworld-lending.js
index eead9b8693..b1c9f3f955 100644
--- a/projects/soulswap/underworld-lending.js
+++ b/projects/soulswap/underworld-lending.js
@@ -4,8 +4,8 @@ const { BigNumber } = require('bignumber.js');
// https://thegraph.com/hosted-service/subgraph/soulswapfantom/coffinbox
const graphUrls = {
- 'fantom': 'https://api.thegraph.com/subgraphs/name/soulswapfinance/fantom-coffinbox',
- 'avax': 'https://api.thegraph.com/subgraphs/name/soulswapfinance/coffinbox-avalanche',
+ 'fantom': sdk.graph.modifyEndpoint('FhS8cRWsTPZwXfmn7b8YGvKii2h2ghr2v7ah5T8oiDmo'),
+ 'avax': sdk.graph.modifyEndpoint('6WonmxWbw3MSVXVR5P4VhC8jWBEG5RkipWzxhAA67hoP'),
}
const coffinboxQuery = gql`
diff --git a/projects/sovryn-dex/index.js b/projects/sovryn-dex/index.js
index 55d3973860..81cd541b03 100644
--- a/projects/sovryn-dex/index.js
+++ b/projects/sovryn-dex/index.js
@@ -1,4 +1,6 @@
const { staking } = require('../helper/staking')
+const { request, gql } = require("graphql-request");
+const { sumTokens2 } = require('../helper/unwrapLPs');
const { getConfig } = require('../helper/cache')
const { getUniqueAddresses } = require('../helper/utils')
const { transformDexBalances } = require('../helper/portedTokens')
@@ -8,8 +10,10 @@ async function tvl(api) {
// const impl = await api.call({ abi: 'address:swapsImpl', target: '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7' })
- const protocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'
+ const RSKprotocolContract = '0x5a0d867e0d70fcc6ade25c3f1b89d618b5b4eaa7'
+
const res = await getConfig('sovryn', 'https://backend.sovryn.app/tvl')
+
let pools = Object.values(res.tvlAmm).map(i => i?.contract).filter(i => i)
pools = getUniqueAddresses(pools)
const ownerTokens = []
@@ -31,14 +35,27 @@ async function tvl(api) {
})
await Promise.all(promises)
- ownerTokens.push([allTokens, protocolContract])
+ ownerTokens.push([allTokens, RSKprotocolContract])
await api.sumTokens({ ownerTokens })
return transformDexBalances({ data, api, })
}
+
module.exports = {
misrepresentedTokens: true,
+ bob: {
+ tvl: async () => { const query = gql`
+ {
+ pools { base quote }
+ }
+ `;
+ const pools = await request(`https://bob-ambient-subgraph.sovryn.app/subgraphs/name/DistributedCollective/bob-ambient-subgraph`, query)
+ const tokens = pools.pools.map(i => [i.base, i.quote]).flat()
+ return sumTokens2({ chain: "bob", owner: '0xe5bc234A484A912A61Aa74501960cFc202e773dA', tokens, });
+ },
+ staking: staking('0xc17c6462ceafe9a8819258c6ba168bef5544fc21', '0xba20a5e63eeEFfFA6fD365E7e540628F8fC61474')
+ },
rsk: {
tvl,
staking: staking('0x5684a06cab22db16d901fee2a5c081b4c91ea40e', '0xefc78fc7d48b64958315949279ba181c2114abbd')
- }
-}
\ No newline at end of file
+ },
+}
diff --git a/projects/spacewhale/index.js b/projects/spacewhale/index.js
new file mode 100644
index 0000000000..4d71132704
--- /dev/null
+++ b/projects/spacewhale/index.js
@@ -0,0 +1,14 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
+
+const fundStore = "0xb7884D6bc7361EcbacAfAbBd949DE7D47B2a0e27"; // FundStore
+const SPACEWHALE = "0xf5961a2441fC68E38300cd8ae8d6a172b12D7E7A"; // SPACEWHALE
+const assets = [nullAddress, ADDRESSES.arbitrum.USDC_CIRCLE] // ETH, USDC
+
+module.exports = {
+ start: 1712109600,
+ arbitrum: {
+ tvl: sumTokensExport({ owners: [fundStore], tokens: assets }),
+ staking: sumTokensExport({ owners: [fundStore], tokens: [SPACEWHALE] }),
+ },
+}
\ No newline at end of file
diff --git a/projects/sparkdex-v2/index.js b/projects/sparkdex-v2/index.js
new file mode 100644
index 0000000000..15b857585c
--- /dev/null
+++ b/projects/sparkdex-v2/index.js
@@ -0,0 +1,12 @@
+const { getUniTVL } = require("../helper/unknownTokens");
+
+module.exports = {
+ misrepresentedTokens: true,
+ flare: {
+ tvl: getUniTVL({
+ factory: "0x16b619B04c961E8f4F06C10B42FDAbb328980A89",
+ useDefaultCoreAssets: true,
+ fetchBalances: true,
+ }),
+ },
+};
diff --git a/projects/sparkdex-v3/index.js b/projects/sparkdex-v3/index.js
new file mode 100644
index 0000000000..b97ba79390
--- /dev/null
+++ b/projects/sparkdex-v3/index.js
@@ -0,0 +1,6 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ flare: { factory: '0xb3fB4f96175f6f9D716c17744e5A6d4BA9da8176', fromBlock:
+ 26046709, },
+})
diff --git a/projects/spectra/abi.json b/projects/spectra/abi.json
new file mode 100644
index 0000000000..63026fe204
--- /dev/null
+++ b/projects/spectra/abi.json
@@ -0,0 +1,13 @@
+{
+ "markets": {
+ "balances": "function balances(uint256 index) view returns (uint256)"
+ },
+ "pt": {
+ "getIBT": "function getIBT() view returns (address)",
+ "balanceOf": "function balanceOf(address account) view returns (uint256)"
+ },
+ "vault": {
+ "convertToAsset": "function convertToAssets(uint256 shares) view returns (uint256 assets)",
+ "asset": "function asset() view returns (address assetTokenAddress)"
+ }
+}
diff --git a/projects/spectra/config.json b/projects/spectra/config.json
new file mode 100644
index 0000000000..1cdebca0c9
--- /dev/null
+++ b/projects/spectra/config.json
@@ -0,0 +1,10 @@
+{
+ "ethereum": {
+ "factory": "0xae4d5d5199265512B2a77Ad675107735B891aBc8",
+ "fromBlock": 19727256
+ },
+ "arbitrum": {
+ "factory": "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60",
+ "fromBlock": 204418891
+ }
+}
diff --git a/projects/spectra/index.js b/projects/spectra/index.js
new file mode 100644
index 0000000000..a0dfa4546a
--- /dev/null
+++ b/projects/spectra/index.js
@@ -0,0 +1,120 @@
+const { getLogs } = require("../helper/cache/getLogs");
+const abi = require("./abi.json");
+const config = require("./config.json");
+const sdk = require("@defillama/sdk");
+
+module.exports = {
+ methodology: `All deposited underlying in Spectra Principal Tokens and all underlying supplied as liquidity in Spectra Markets`,
+};
+
+const curvePoolDeployedTopic =
+ "0x3c7b686d948efcba31c9cfd1aeae78faac70fe0c1ed90d151d49c75e85027a91";
+const ptDeployedTopic =
+ "0xcf50c3e7162cc35f5befd4f0379ddd760d499ca96330c9ae8faa4059919caaee";
+
+Object.keys(config).forEach((chain) => {
+ const { factory, fromBlock } = config[chain];
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const marketData = await getMarkets(api);
+ const marketBatchCalls = marketData.map((market) => ({
+ target: market[0],
+ params: 0,
+ abi: abi.markets.balances,
+ }));
+
+ const pts = await getPTs(api);
+ const ptIBTCalls = pts.map((pt) => ({
+ target: pt,
+ abi: abi.pt.getIBT,
+ }));
+
+ const [ibtsInMarket, ptIbts] = await Promise.all([
+ api.batchCall(marketBatchCalls),
+ api.batchCall(ptIBTCalls),
+ ]);
+
+ const ptIBTBalanceCalls = ptIbts.map((ibt, i) => ({
+ target: ibt,
+ params: pts[i],
+ abi: abi.pt.balanceOf,
+ }));
+ const ibtBalances = await api.batchCall(ptIBTBalanceCalls);
+
+ const poolIBTBalances = marketData.reduce((acc, market, i) => {
+ const ibt = market[1];
+ const balance = sdk.util.convertToBigInt(ibtsInMarket[i]);
+ acc[ibt] = (acc[ibt] || 0n) + balance;
+ return acc;
+ }, {});
+
+ const ptIBTBalances = ptIbts.reduce((acc, ibt, i) => {
+ const balance = sdk.util.convertToBigInt(ibtBalances[i]);
+ acc[ibt] = (acc[ibt] || 0n) + balance;
+ return acc;
+ }, {});
+
+ const allIBTBalances = { ...poolIBTBalances };
+ for (const [ibt, balance] of Object.entries(ptIBTBalances)) {
+ allIBTBalances[ibt] = (allIBTBalances[ibt] || 0n) + balance;
+ }
+
+ const assetCalls = Object.keys(allIBTBalances).map((ibt) => ({
+ target: ibt,
+ abi: abi.vault.asset,
+ }));
+
+ const assetBalanceCalls = Object.entries(allIBTBalances).map(
+ ([ibt, balance]) => ({
+ target: ibt,
+ params: balance,
+ abi: abi.vault.convertToAsset,
+ })
+ );
+
+ const [assets, assetBalances] = await Promise.all([
+ api.batchCall(assetCalls),
+ api.batchCall(assetBalanceCalls),
+ ]);
+
+ const assetsWithBalances = assets.map((asset, i) => [
+ asset,
+ sdk.util.convertToBigInt(assetBalances[i]),
+ ]);
+
+ assetsWithBalances.forEach(([asset, balance]) => {
+ api.add(asset, balance);
+ });
+
+ return api.getBalances();
+ },
+ };
+
+ async function getMarkets(api) {
+ const logs = await getLogs({
+ api,
+ target: factory,
+ topic: curvePoolDeployedTopic,
+ eventAbi:
+ "event CurvePoolDeployed(address indexed poolAddress, address indexed ibt, address indexed pt)",
+ onlyArgs: true,
+ fromBlock: fromBlock,
+ extraKey: "markets",
+ });
+ return logs.map((i) => [i.poolAddress, i.ibt]);
+ }
+
+ async function getPTs(api) {
+ const logs = await getLogs({
+ api,
+ target: factory,
+ topic: ptDeployedTopic,
+ eventAbi:
+ "event PTDeployed(address indexed pt, address indexed poolCreator)",
+ onlyArgs: true,
+ fromBlock: fromBlock,
+ extraKey: "pts",
+ });
+ return logs.map((i) => i.pt);
+ }
+});
diff --git a/projects/splash.js b/projects/splash.js
new file mode 100644
index 0000000000..0e4c15d75f
--- /dev/null
+++ b/projects/splash.js
@@ -0,0 +1,15 @@
+const { get } = require('./helper/http');
+
+async function cardanoTVL() {
+ let { tvlAda } = await get('https://api2.splash.trade/platform-api/v1/platform/stats')
+
+ return { cardano: tvlAda };
+}
+
+module.exports = {
+ timetravel: false,
+ misrepresentedTokens: true,
+ cardano: {
+ tvl: cardanoTVL,
+ }
+}
diff --git a/projects/splice-fi/index.js b/projects/splice-fi/index.js
new file mode 100644
index 0000000000..d12f0e3d2c
--- /dev/null
+++ b/projects/splice-fi/index.js
@@ -0,0 +1,69 @@
+const { getLogs, getLogs2 } = require("../helper/cache/getLogs");
+
+const config = {
+ mode: [{
+ factoryV3: "0x9e6d12097339ddd5402FDD39fc0Ef86Eec54AB39",
+ fromBlockV3: 7764229,
+ }],
+ blast: [{
+ factoryV3: "0x96A6C433078059577F0CEB707d596A5F81d64375",
+ fromBlockV3: 1850297,
+ }, {
+ factoryV3: "0xf87E18913f7143E7C7eFee714813ABbC8e0E34bf",
+ fromBlockV3: 1850297,
+ },],
+}
+
+Object.keys(config).forEach((chain) => {
+ const factories = config[chain];
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const logsV3 = (await Promise.all(factories.map(i => getLogs2({
+ api,
+ target: i.factoryV3,
+ topic: [
+ "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af",
+ ],
+ eventAbi:
+ "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)",
+ fromBlock: i.fromBlockV3,
+ })))).flat()
+
+ const pt = logsV3.map((i) => i.PT)
+ let sy = [
+ ...new Set(
+ (
+ await api.multiCall({
+ abi: "address:SY",
+ calls: pt,
+ })
+ ).map((s) => s.toLowerCase())
+ ),
+ ];
+
+ const [data, supply, decimals] = await Promise.all([
+ api.multiCall({
+ abi: "function assetInfo() view returns (uint8 assetType , address uAsset , uint8 decimals )",
+ calls: sy,
+ }),
+ api.multiCall({ abi: "erc20:totalSupply", calls: sy }),
+ api.multiCall({ abi: "erc20:decimals", calls: sy }),
+ ]);
+
+ const tokenAssetTypeSy = sy.filter((_, i) => data[i].assetType === "0");
+ const exchangeRates = await api.multiCall({
+ abi: "function exchangeRate() view returns (uint256 res)",
+ calls: tokenAssetTypeSy,
+ });
+
+ data.forEach((v, i) => {
+ let value = supply[i] * 10 ** (v.decimals - decimals[i]);
+ let index = tokenAssetTypeSy.indexOf(sy[i]);
+ if (index !== -1) {
+ value = (value * exchangeRates[index]) / 10 ** 18;
+ }
+ api.add(v.uAsset.toLowerCase(), value);
+ });
+ },
+ };
+});
diff --git a/projects/stabble/index.js b/projects/stabble/index.js
new file mode 100644
index 0000000000..82b83afeab
--- /dev/null
+++ b/projects/stabble/index.js
@@ -0,0 +1,256 @@
+const sdk = require("@defillama/sdk");
+const { Program } = require("@project-serum/anchor");
+const { PublicKey } = require("@solana/web3.js");
+const { getProvider, sumTokens2 } = require("../helper/solana");
+
+async function weightedSwapTvl() {
+ const VAULT_ID = "w8edo9a9TDw52c1rBmVbP6dNakaAuFiPjDd52ZJwwVi";
+
+ const provider = getProvider();
+ const programId = new PublicKey("swapFpHZwjELNnjvThjajtiVmkz3yPQEHjLtka2fwHW");
+ const program = new Program(WEIGHTED_SWAP_IDL, programId, provider);
+ const pools = await program.account.pool.all([
+ {
+ memcmp: {
+ offset: 40,
+ bytes: VAULT_ID,
+ },
+ },
+ ]);
+ const tokens = Array.from(new Set(pools.map(({ account }) => account.tokens.map(({ mint }) => mint)).flat()));
+ const owner = findVaultAuthorityAddress(new PublicKey(VAULT_ID));
+
+ return sumTokens2({
+ tokens,
+ owner,
+ });
+}
+
+async function stableSwapTvl() {
+ const VAULT_ID = "stab1io8dHvK26KoHmTwwHyYmHRbUWbyEJx6CdrGabC";
+
+ const provider = getProvider();
+ const programId = new PublicKey("swapNyd8XiQwJ6ianp9snpu4brUqFxadzvHebnAXjJZ");
+ const program = new Program(STABLE_SWAP_IDL, programId, provider);
+ const pools = await program.account.pool.all([
+ {
+ memcmp: {
+ offset: 40,
+ bytes: VAULT_ID,
+ },
+ },
+ ]);
+ const tokens = Array.from(new Set(pools.map(({ account }) => account.tokens.map(({ mint }) => mint)).flat()));
+ const owner = findVaultAuthorityAddress(new PublicKey(VAULT_ID));
+
+ return sumTokens2({
+ tokens,
+ owner,
+ });
+}
+
+module.exports = {
+ timetravel: false,
+ solana: { tvl: sdk.util.sumChainTvls([weightedSwapTvl, stableSwapTvl]) },
+};
+
+function findVaultAuthorityAddress(vaultKey) {
+ return PublicKey.findProgramAddressSync(
+ [Buffer.from("vault_authority"), vaultKey.toBuffer()],
+ new PublicKey("vo1tWgqZMjG61Z2T9qUaMYKqZ75CYzMuaZ2LZP1n7HV")
+ )[0];
+}
+
+const WEIGHTED_SWAP_IDL = {
+ version: "1.0.0",
+ name: "weighted_swap",
+ instructions: [],
+ accounts: [
+ {
+ name: "pool",
+ type: {
+ kind: "struct",
+ fields: [
+ {
+ name: "owner",
+ type: "publicKey",
+ },
+ {
+ name: "vault",
+ type: "publicKey",
+ },
+ {
+ name: "mint",
+ type: "publicKey",
+ },
+ {
+ name: "authorityBump",
+ type: "u8",
+ },
+ {
+ name: "isActive",
+ type: "bool",
+ },
+ {
+ name: "invariant",
+ type: "u64",
+ },
+ {
+ name: "swapFee",
+ type: "u64",
+ },
+ {
+ name: "tokens",
+ type: {
+ vec: {
+ defined: "PoolToken",
+ },
+ },
+ },
+ {
+ name: "pendingOwner",
+ type: {
+ option: "publicKey",
+ },
+ },
+ ],
+ },
+ },
+ ],
+ types: [
+ {
+ name: "PoolToken",
+ type: {
+ kind: "struct",
+ fields: [
+ {
+ name: "mint",
+ type: "publicKey",
+ },
+ {
+ name: "decimals",
+ type: "u8",
+ },
+ {
+ name: "scalingUp",
+ type: "bool",
+ },
+ {
+ name: "scalingFactor",
+ type: "u64",
+ },
+ {
+ name: "balance",
+ type: "u64",
+ },
+ {
+ name: "weight",
+ type: "u64",
+ },
+ ],
+ },
+ },
+ ],
+ errors: [],
+};
+
+const STABLE_SWAP_IDL = {
+ version: "1.0.0",
+ name: "stable_swap",
+ instructions: [],
+ accounts: [
+ {
+ name: "pool",
+ type: {
+ kind: "struct",
+ fields: [
+ {
+ name: "owner",
+ type: "publicKey",
+ },
+ {
+ name: "vault",
+ type: "publicKey",
+ },
+ {
+ name: "mint",
+ type: "publicKey",
+ },
+ {
+ name: "authorityBump",
+ type: "u8",
+ },
+ {
+ name: "isActive",
+ type: "bool",
+ },
+ {
+ name: "ampInitialFactor",
+ type: "u16",
+ },
+ {
+ name: "ampTargetFactor",
+ type: "u16",
+ },
+ {
+ name: "rampStartTs",
+ type: "i64",
+ },
+ {
+ name: "rampStopTs",
+ type: "i64",
+ },
+ {
+ name: "swapFee",
+ type: "u64",
+ },
+ {
+ name: "tokens",
+ type: {
+ vec: {
+ defined: "PoolToken",
+ },
+ },
+ },
+ {
+ name: "pendingOwner",
+ type: {
+ option: "publicKey",
+ },
+ },
+ ],
+ },
+ },
+ ],
+ types: [
+ {
+ name: "PoolToken",
+ type: {
+ kind: "struct",
+ fields: [
+ {
+ name: "mint",
+ type: "publicKey",
+ },
+ {
+ name: "decimals",
+ type: "u8",
+ },
+ {
+ name: "scalingUp",
+ type: "bool",
+ },
+ {
+ name: "scalingFactor",
+ type: "u64",
+ },
+ {
+ name: "balance",
+ type: "u64",
+ },
+ ],
+ },
+ },
+ ],
+ errors: [],
+};
diff --git a/projects/stablejack/index.js b/projects/stablejack/index.js
new file mode 100644
index 0000000000..e44943b730
--- /dev/null
+++ b/projects/stablejack/index.js
@@ -0,0 +1,14 @@
+const { sumTokensExport } = require('../helper/unwrapLPs')
+
+module.exports = {
+ avax: { tvl },
+}
+
+async function tvl(api) {
+ const wsAVAX = '0x7aa5c727270c7e1642af898e0ea5b85a094c17a1'
+ const sAVAX = '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE'
+ const wsAvaxBal= await api.call({ abi: 'erc20:balanceOf', target: wsAVAX, params: '0xDC325ad34C762C19FaAB37d439fbf219715f9D58'})
+ const wsAvaxSupply = await api.call({ abi: 'uint256:totalSupply', target: wsAVAX })
+ const sAvaxBal= await api.call({ abi: 'erc20:balanceOf', target: '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE', params: wsAVAX})
+ api.add(sAVAX, wsAvaxBal * sAvaxBal / wsAvaxSupply)
+}
\ No newline at end of file
diff --git a/projects/stack/index.js b/projects/stack/index.js
new file mode 100644
index 0000000000..d7a6e6a9a0
--- /dev/null
+++ b/projects/stack/index.js
@@ -0,0 +1,23 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+module.exports = {
+ methodology:
+ "TVL counts the collateral tokens that are deposited within the respective Stack vault",
+};
+
+const config = {
+ real: {
+ vaultFactory: "0x303C5d72D2d123ac6C36957d167Ca7Cfee3414e7",
+ },
+};
+
+Object.keys(config).forEach((chain) => {
+ const { vaultFactory } = config[chain];
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const vaults = await api.fetchList({ lengthAbi: 'allVaultsLength', itemAbi: 'allVaults', target: vaultFactory })
+ const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: vaults })
+ return sumTokens2({ tokensAndOwners2: [tokens, vaults], api })
+ }
+ }
+})
diff --git a/projects/stafi/index.js b/projects/stafi/index.js
index 8aba8f04f0..413d22371c 100644
--- a/projects/stafi/index.js
+++ b/projects/stafi/index.js
@@ -1,21 +1,18 @@
const ADDRESSES = require('../helper/coreAssets.json')
const sdk = require('@defillama/sdk');
-const {chainExports} = require('../helper/exports')
-const {usdtAddress} = require('../helper/balances')
-const {getApiTvl} = require('../helper/historicalApi');
-const { fetchURL } = require('../helper/utils');
+const { get } = require('../helper/http');
const wethAddress = ADDRESSES.ethereum.WETH
async function ethereum(api) {
- const totalSupply = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:totalSupply'});
- const rate = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:getExchangeRate'});
+ const totalSupply = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:totalSupply' });
+ const rate = await api.call({ target: '0x9559Aaa82d9649C7A7b220E7c461d2E74c9a3593', abi: 'uint256:getExchangeRate' });
return {
- [wethAddress]: (totalSupply * rate)/1e18
+ [wethAddress]: (totalSupply * rate) / 1e18
}
}
-const chainToParams={
+const chainToParams = {
bsc: ["RBNB", "binancecoin"],
polygon: ["RMATIC", "matic-network"],
polkadot: ["RDOT", "polkadot"],
@@ -24,37 +21,27 @@ const chainToParams={
cosmos: ["RATOM", "cosmos"],
carbon: ["RSWTH", "switcheo"],
chihuahua: ["RHUAHUA", "chihuahua-token"],
- irisnet:["RIRIS","iris-network"]
+ irisnet: ["RIRIS", "iris-network"]
}
-function getTvlFunction(token, cgId){
- return async timestamp=>{
- const bal = await getApiTvl(timestamp, async()=>{
- const data = await fetchURL(API)
- return Number(data.data.data.currentStake.find(r=>r.rsymbol ===token).stakeAmount)
- }, async()=>{
- const data = await fetchURL(API)
- return data.data.data.historyStake[token].map(p=>({
- date: p.timestamp,
- totalLiquidityUSD: Number(p.stakeAmount)
- }))
- })
- return {
- [cgId]: Number(bal[usdtAddress])/(10**6)
- }
+function getTvlFunction(token, cgId) {
+ return async api => {
+ const { data: { currentStake } } = await get(API)
+ api.addCGToken(cgId, Number(currentStake.find(r => r.rsymbol === token)?.stakeAmount ?? 0))
+ return api.getBalances()
}
}
const API = "https://partner-api.stafi.io/stafi/v1/partnerapi/rtoken/getstakelist"
-function chainTvl(chain){
+function chainTvl(chain) {
const [token, cgId] = chainToParams[chain]
return getTvlFunction(token, cgId)
}
module.exports = {
- ethereum: {
+ ethereum: {
tvl: sdk.util.sumChainTvls([chainTvl('polygon'), ethereum]),
- staking: getTvlFunction("RFIS", "stafi")
+ staking: getTvlFunction("RFIS", "stafi")
},
bsc: {
tvl: chainTvl('bsc')
diff --git a/projects/stakedao/index.js b/projects/stakedao/index.js
index 964a6ca4e1..1958580643 100644
--- a/projects/stakedao/index.js
+++ b/projects/stakedao/index.js
@@ -1,169 +1,70 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require("@defillama/sdk");
const abi = require('./abi.json')
const { sumTokens2, PANCAKE_NFT_ADDRESS } = require('../helper/unwrapLPs')
const { getConfig } = require('../helper/cache');
+const { get } = require('../helper/http');
-const STRATEGIES_ENDPOINT = 'https://classic.stakedao.org/api/strategies/cache';
-const LOCKERS_ENDPOINT = 'https://classic.stakedao.org/api/lockers/cache';
+const STRATEGIES_ENDPOINT = 'https://api.stakedao.org/api/strategies';
+const LOCKERS_ENDPOINT = 'https://api.stakedao.org/api/lockers';
+const PANCAKESWAP_MASTERCHEF_V3 = '0x556B9306565093C855AEA9AE92A594704c2Cd59e'
-async function strategiesCurveBalancer(timestamp, block) {
+const LOCKERS = {
+ curve: {
+ 1: '0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6',
+ 42161: '0x52f541764E6e90eeBc5c21Ff570De0e2D63766B6'
+ },
+ balancer: {
+ 1: '0xea79d1A83Da6DB43a85942767C389fE0ACf336A5'
+ },
+ pendle: {
+ 1: '0xD8fa8dC5aDeC503AcC5e026a98F32Ca5C1Fa289A'
+ },
+ yearn: {
+ 1: '0xF750162fD81F9a436d74d737EF6eE8FC08e98220'
+ },
+ pancakeswap: {
+ 1: '0xB7F79090190c297F59A2b7D51D3AEF7AAd0e9Af3',
+ 56: '0x1e6f87a9ddf744af31157d8daa1e3025648d042d',
+ 42161: '0xE5244b1A263ce45CF1E51DfA97469711E9bAD68d',
+ }
+}
+
+
+async function getLPStrategiesMainnet(timestamp, block) {
const resp = await Promise.all([
- getConfig('stakedao/curve', `${STRATEGIES_ENDPOINT}/curve`),
- getConfig('stakedao/balancer', `${STRATEGIES_ENDPOINT}/balancer`)
+ getConfig('sakedao/eth-curve', `${STRATEGIES_ENDPOINT}/curve/1.json`),
+ getConfig('sakedao/eth-balancer', `${STRATEGIES_ENDPOINT}/balancer/1.json`),
+ getConfig('sakedao/eth-pendle', `${STRATEGIES_ENDPOINT}/pendle/1.json`),
+ getConfig('sakedao/eth-yearn', `${STRATEGIES_ENDPOINT}/yearn/1.json`),
]);
- const strats = resp[0].concat(resp[1])
- const lgv4 = strats.map((strat) => [strat.infos.protocolLiquidityGaugeV4, strat.infos.angleLocker || strat.infos.curveLocker])
+ const curveStrats = resp[0].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.curve[1]])
+ const balancerStrats = resp[1].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.balancer[1]])
+ const pendleStrats = resp[2].deployed.map((strat) => [strat.lpToken.address, LOCKERS.pendle[1]])
+ const yearnStrats = resp[3].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.yearn[1]])
- return lgv4
+ return [...curveStrats, ...balancerStrats, ...pendleStrats, ...yearnStrats]
}
async function tvl(api) {
- let balances = {}
- /////////////////////////////////////////////////////////////////////
- // --- STRATEGIES V2
- /////////////////////////////////////////////////////////////////////
- // ==== Addresses ==== //
- const crv3_vault_v2 = {
- contract: '0xB17640796e4c27a39AF51887aff3F8DC0daF9567',
- token: '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490',
- }
- const eurs_vault_v2 = {
- contract: '0xCD6997334867728ba14d7922f72c893fcee70e84',
- token: '0x194eBd173F6cDacE046C53eACcE9B953F28411d1',
- }
- const frax_vault_v2 = {
- contract: '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7',
- token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B',
- }
- const frax_vault2_v2 = {
- contract: '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F',
- token: '0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B',
- }
- const eth_vault_v2 = {
- contract: '0xa2761B0539374EB7AF2155f76eb09864af075250',
- token: '0xA3D87FffcE63B53E0d54fAa1cc983B7eB0b74A9c',
- }
- const steth_vault_v2 = {
- contract: '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065',
- token: '0x06325440D014e39736583c165C2963BA99fAf14E',
- }
let vaults = [
- crv3_vault_v2,
- eurs_vault_v2,
- frax_vault_v2,
- frax_vault2_v2,
- eth_vault_v2,
- steth_vault_v2
+ '0xB17640796e4c27a39AF51887aff3F8DC0daF9567', // crv3_vault_v2
+ '0xCD6997334867728ba14d7922f72c893fcee70e84', // eurs_vault_v2
+ '0x5af15DA84A4a6EDf2d9FA6720De921E1026E37b7', // frax_vault_v2
+ '0x99780beAdd209cc3c7282536883Ef58f4ff4E52F', // frax_vault2_v2
+ '0xa2761B0539374EB7AF2155f76eb09864af075250', // eth_vault_v2
+ '0xbC10c4F7B9FE0B305e8639B04c536633A3dB7065', // steth_vault_v2
]
- const vaultBals = await api.multiCall({
- abi: abi['balance'],
- calls: vaults.map(i => i.contract),
- })
- vaultBals.forEach((bal, i) => sdk.util.sumSingleBalance(balances, vaults[i].token, bal))
-
- /////////////////////////////////////////////////////////////////////
- // --- STRATEGIES ANGLE
- /////////////////////////////////////////////////////////////////////
- // ==== Addresses ==== //
- const angle_protocol = {
- stableMasteFront: '0x5adDc89785D75C86aB939E9e15bfBBb7Fc086A87',
- usdcPoolManager: '0xe9f183FC656656f1F17af1F2b0dF79b8fF9ad8eD',
- fraxPoolManager: '0x6b4eE7352406707003bC6f6b96595FD35925af48',
- daiPoolManager: '0xc9daabC677F3d1301006e723bD21C60be57a5915',
- locker: '0xD13F8C25CceD32cdfA79EB5eD654Ce3e484dCAF5',
- abiCM: 'collateralMap'
- }
- const angle_sanUSDC_V3 = {
- contract: angle_protocol.locker,
- sanUsdcEurGauge: '0x51fE22abAF4a26631b2913E417c0560D547797a7',
- usdcToken: ADDRESSES.ethereum.USDC,
- abi: 'balanceOf',
- }
- const angle_sanDAI_V3 = {
- contract: angle_protocol.locker,
- sanDaiEurGauge: '0x8E2c0CbDa6bA7B65dbcA333798A3949B07638026',
- daiToken: ADDRESSES.ethereum.DAI,
- abi: 'balanceOf',
- }
- const angle_sanFRAX_V3 = {
- contract: angle_protocol.locker,
- sanFraxEurGauge: '0xb40432243E4F317cE287398e72Ab8f0312fc2FE8',
- fraxToken: ADDRESSES.ethereum.FRAX,
- abi: 'balanceOf',
- }
- const angle_sushi_agEUR_V3 = {
- contract: angle_protocol.locker,
- sushiAgEURGauge: '0xBa625B318483516F7483DD2c4706aC92d44dBB2B',
- sushiAgEURToken: '0x1f4c763BdE1D4832B3EA0640e66Da00B98831355',
- abi: 'balanceOf',
- }
- const angle_guni_agEUR_usdc_V3 = {
- contract: angle_protocol.locker,
- guniAgEURUsdcGauge: '0xEB7547a8a734b6fdDBB8Ce0C314a9E6485100a3C',
- guniAgEURUsdcToken: '0xEDECB43233549c51CC3268b5dE840239787AD56c',
- abi: 'balanceOf',
- }
+ await api.erc4626Sum({ calls: vaults })
- // ==== Calls Balance ==== //
- const [
- sanUsdcEurV3,
- sanDaiEurV3,
- sanFraxEurV3,
- angleSushiAgEurV3,
- angleGuniAgEurUSDCV3,
- ] = await api.multiCall({
- abi: abi[angle_sanUSDC_V3.abi], calls: [
- angle_sanUSDC_V3.sanUsdcEurGauge,
- angle_sanDAI_V3.sanDaiEurGauge,
- angle_sanFRAX_V3.sanFraxEurGauge,
- angle_sushi_agEUR_V3.sushiAgEURGauge,
- angle_guni_agEUR_usdc_V3.guniAgEURUsdcGauge,
- ].map(i => ({ target: i, params: angle_sanUSDC_V3.contract }))
- })
+ const strategies = await getLPStrategiesMainnet()
- // ==== Calls Rate ==== //
- const [
- sanUsdcEurRate,
- sanDaiEurRate,
- sanFraxEurRate,
- ] = (await api.multiCall({
- abi: abi[angle_protocol.abiCM], calls: [{
- target: angle_protocol.stableMasteFront,
- params: angle_protocol.usdcPoolManager
- }, {
- target: angle_protocol.stableMasteFront,
- params: angle_protocol.daiPoolManager
- }, {
- target: angle_protocol.stableMasteFront,
- params: angle_protocol.fraxPoolManager
- },]
- })).map(i => i.sanRate)
-
- // ==== Map ==== //
- //sdk.util.sumSingleBalance(balances, angle_sanUSDC_V2.usdcToken, ((await sanUsdcEurV2) * sanUsdcEurRate / 10**18))
- sdk.util.sumSingleBalance(balances, angle_sanUSDC_V3.usdcToken, (sanUsdcEurV3 * sanUsdcEurRate / 10 ** 18))
- sdk.util.sumSingleBalance(balances, angle_sanDAI_V3.daiToken, ((sanDaiEurV3 * sanDaiEurRate / 10 ** 18)))
- sdk.util.sumSingleBalance(balances, angle_sanFRAX_V3.fraxToken, ((sanFraxEurV3 * sanFraxEurRate / 10 ** 18)))
- sdk.util.sumSingleBalance(balances, angle_sushi_agEUR_V3.sushiAgEURToken, angleSushiAgEurV3)
- sdk.util.sumSingleBalance(balances, angle_guni_agEUR_usdc_V3.guniAgEURUsdcToken, angleGuniAgEurUSDCV3)
-
- const strategies = await strategiesCurveBalancer()
-
- /////////////////////////////////////////////////////////////////////
- // --- LIQUID LOCKERS
- /////////////////////////////////////////////////////////////////////
- const resp = await getConfig('stakedao/locker', LOCKERS_ENDPOINT)
-
- let lockersInfos = []
- for (let i = 0; i < resp.length; ++i) {
- lockersInfos.push({ contract: `${resp[i].infos.locker}`, veToken: `${resp[i].infos.ve}`, token: `${resp[i].infos.token}` })
- }
+ const resp = (await get(LOCKERS_ENDPOINT)).parsed
+
+ let lockersInfos = resp.filter((locker) => locker.chainId === 1).map((locker) => ({ contract: `${locker.modules.locker}`, veToken: `${locker.modules.veToken}`, token: `${locker.token.address}` }))
// To deal with special vePendle case
- const vePendle = "0x4f30A9D41B80ecC5B94306AB4364951AE3170210"
- const veMAV = "0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8".toLowerCase()
+ const vePendle = '0x4f30A9D41B80ecC5B94306AB4364951AE3170210'
+ const veMAV = '0x4949Ac21d5b2A0cCd303C20425eeb29DCcba66D8'.toLowerCase()
const calls = []
const callsPendle = []
const callsMAV = []
@@ -187,11 +88,11 @@ async function tvl(api) {
}
let lockerBals = await api.multiCall({ abi: abi.locked, calls })
- let lockerPendleBal = await api.multiCall({ abi: "function positionData(address arg0) view returns (uint128 amount, uint128 end)", calls: callsPendle })
+ let lockerPendleBal = await api.multiCall({ abi: 'function positionData(address arg0) view returns (uint128 amount, uint128 end)', calls: callsPendle })
let lockerMAVBal = []
for (const { contract, veToken } of callsMAV) {
- const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract })
+ const count = await api.call({ abi: 'function lockupCount(address) view returns (uint256)', target: veToken, params: contract })
let balance = 0
for (let i = 0; i < count; i++) {
const lockup = await api.call({ abi: 'function lockups(address,uint256) view returns (uint256 amount, uint256 end, uint256 points)', target: veToken, params: [contract, i] })
@@ -206,89 +107,121 @@ async function tvl(api) {
amount = lockerPendleBal.shift().amount
} else if (lockersInfos[i].veToken.toLowerCase() == veMAV) {
amount = lockerMAVBal.shift().amount
- } else {
+ } else {
amount = lockerBals.shift().amount
}
- sdk.util.sumSingleBalance(balances, lockersInfos[i].token, amount)
+ api.add(lockersInfos[i].token, amount)
}
- return sumTokens2({ api, tokensAndOwners: strategies, balances, })
+ return sumTokens2({
+ api,
+ tokensAndOwners: strategies,
+ uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[1]]],
+ uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 }
+ })
}
-async function staking(timestamp, block) {
+async function staking(api) {
const sanctuary = '0xaC14864ce5A98aF3248Ffbf549441b04421247D3'
const arbStrat = '0x20D1b558Ef44a6e23D9BF4bf8Db1653626e642c3'
const veSdt = '0x0C30476f66034E11782938DF8e4384970B6c9e8a'
const sdtToken = '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F'
return sumTokens2({
+ api,
owners: [sanctuary, arbStrat, veSdt,],
tokens: [sdtToken]
})
}
async function polygon(api) {
- const crv_3crv_vault_polygon = {
- contract: '0x7d60F21072b585351dFd5E8b17109458D97ec120',
- }
- const vaultsPolygon = [
- crv_3crv_vault_polygon,
- ]
- return getBalances(api, vaultsPolygon)
+ return api.erc4626Sum({ calls: ['0x7d60F21072b585351dFd5E8b17109458D97ec120'] })
}
-async function getBalances(api, vaults, { balances = {} } = {}) {
- const tokens = await api.multiCall({ abi: 'address:token', calls: vaults.map(i => i.contract) })
- const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults.map(i => i.contract) })
- tokens.forEach((token, i) => sdk.util.sumSingleBalance(balances, token, bals[i], api.chain))
- return balances
+async function avax(api) {
+ return api.erc4626Sum({ calls: ['0x0665eF3556520B21368754Fb644eD3ebF1993AD4'] })
}
-async function avax(api) {
- const crv_3crv_vault_avalanche = {
- contract: '0x0665eF3556520B21368754Fb644eD3ebF1993AD4',
- }
+async function addPancakeSwapLPStrategiesBsc(api) {
+ const resp = await Promise.all([
+ getConfig('stakedao/bsc-cake', `${STRATEGIES_ENDPOINT}/pancakeswap/56.json`),
+ ]);
- const vaultsAvalanche = [
- crv_3crv_vault_avalanche
- ]
- return getBalances(api, vaultsAvalanche)
-}
+ const strats = resp[0].deployed.filter((strat) => strat.version !== '3')
+ const deposits = await api.multiCall({ abi: 'uint256:totalSupply', calls: strats.map((strat) => strat.sdGauge.address) })
+ const stableStrats = []
+ const defaultStrats = []
+ strats.forEach((strat, i) => {
+ strat.deposits = deposits[i]
+ switch (strat.version) {
+ case 'stable': stableStrats.push(strat); break
+ case '2': api.add(strat.lpToken.address, deposits[i]); break
+ default: defaultStrats.push(strat)
+ }
+ })
-async function bsc(api) {
- // OLD STRATEGIES
- const btcEPS_vault_bsc = { contract: '0xf479e1252481360f67c2b308F998395cA056a77f' }
- const EPS3_vault_bsc = { contract: '0x4835BC54e87ff7722a89450dc26D9dc2d3A69F36' }
- const fusdt3EPS_vault_bsc = { contract: '0x8E724986B08F2891cD98F7F71b5F52E7CFF420de' }
+ const stableLPsupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: stableStrats.map((strat) => strat.lpToken.address) })
+ const stableToken0Bals = await api.multiCall({ abi: 'function balances(uint256) view returns(uint256)', calls: stableStrats.map((strat) => ({ target: strat.pool, params: 0})) })
+ const stableToken1Bals = await api.multiCall({ abi: 'function balances(uint256) view returns(uint256)', calls: stableStrats.map((strat) => ({ target: strat.pool, params: 1})) })
+ stableStrats.forEach((strat, i) => {
+ const ratio = strat.deposits / stableLPsupplies[i]
+ api.add(strat.coins[0].address, ratio * stableToken0Bals[i])
+ api.add(strat.coins[1].address, ratio * stableToken1Bals[i])
+ })
- const vaultsBsc = [
- btcEPS_vault_bsc,
- EPS3_vault_bsc,
- fusdt3EPS_vault_bsc
- ].map(i => i.contract)
+ const dGauges = defaultStrats.map(i => i.gaugeAddress)
+ const dLpTokens = defaultStrats.map(i => i.lpToken.address)
+ const adapterAddress = await api.multiCall({ abi: 'address:adapterAddr', calls: dGauges})
+ const tokenPerShares = await api.multiCall({ abi: 'function tokenPerShare() view returns(uint256 _token0PerShare, uint256 _token1PerShare)', calls: adapterAddress })
+ const dLpSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: dLpTokens })
- const [bitcoin, usdc, tether] = (await api.multiCall({ abi: abi.balance, calls: vaultsBsc })).map(i => i / 1e18)
+ defaultStrats.forEach((strat, i) => {
+ const ratio = strat.deposits / dLpSupplies[i]
+ api.add(strat.coins[0].address, ratio * tokenPerShares[i]._token0PerShare)
+ api.add(strat.coins[1].address, ratio * tokenPerShares[i]._token1PerShare)
+ })
+}
+async function bsc(api) {
// CAKE LOCKER
const VE_CAKE = '0x5692DB8177a81A6c6afc8084C2976C9933EC1bAB'
- const STAKE_DAO_CAKE_LOCKER = '0x1E6F87A9ddF744aF31157d8DaA1e3025648d042d'
- const PANCAKESWAP_MASTERCHEF_V3 = '0x556B9306565093C855AEA9AE92A594704c2Cd59e'
- const cakeLock = await api.multiCall({ abi: abi.locks, calls: [{ target: VE_CAKE, params: STAKE_DAO_CAKE_LOCKER }] })
- const cake = Number(cakeLock[0].amount) / 1e18
+ const cakeLock = await api.multiCall({ abi: abi.locks, calls: [{ target: VE_CAKE, params: LOCKERS.pancakeswap[56] }] })
+ api.add('0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82', cakeLock[0].amount)
+
- // PANCAKE STRATEGIES
- const pcsStratsTvl = await sumTokens2({
+ // PANCAKE LP STRATEGIES
+ await addPancakeSwapLPStrategiesBsc(api)
+
+ // PANCAKE NFT STRATEGIES
+ return sumTokens2({
api,
- uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, STAKE_DAO_CAKE_LOCKER]],
- uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 }
+ uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[56]]],
+ uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3 },
+ resolveLP: true,
})
+}
- return {
- bitcoin, tether, 'usd-coin': usdc, 'pancakeswap-token': cake, ...pcsStratsTvl
- }
+async function getLPStrategiesArbitrum(timestamp, block) {
+ const resp = await Promise.all([
+ getConfig('sakedao/arb-curve', `${STRATEGIES_ENDPOINT}/curve/42161.json`),
+ ]);
+
+ const stratsCurve = resp[0].deployed.map((strat) => [strat.gaugeAddress, LOCKERS.curve[42161]])
+
+ return [...stratsCurve]
+}
+
+async function arbitrum(api) {
+ const strategies = await getLPStrategiesArbitrum()
+ const PANCAKESWAP_MASTERCHEF_V3_ARBITRUM = '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694'
+ return sumTokens2({
+ api,
+ tokensAndOwners: strategies,
+ uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, LOCKERS.pancakeswap[42161]]],
+ uniV3ExtraConfig: { nftIdFetcher: PANCAKESWAP_MASTERCHEF_V3_ARBITRUM }
+ })
}
-// node test.js projects/stakedao/index.js
module.exports = {
misrepresentedTokens: true,
ethereum: {
@@ -303,5 +236,8 @@ module.exports = {
},
bsc: {
tvl: bsc,
+ },
+ arbitrum: {
+ tvl: arbitrum
}
}
\ No newline at end of file
diff --git a/projects/stargatefinance-v2/index.js b/projects/stargatefinance-v2/index.js
new file mode 100644
index 0000000000..a06659ce58
--- /dev/null
+++ b/projects/stargatefinance-v2/index.js
@@ -0,0 +1,100 @@
+const { sumTokens2 } = require('../helper/unwrapLPs')
+
+const CONFIG = {
+ ethereum: {
+ pools: [
+ '0x77b2043768d28E9C9aB44E1aBfC95944bcE57931',
+ '0xc026395860Db2d07ee33e05fE50ed7bD583189C7',
+ '0x933597a323Eb81cAe705C5bC29985172fd5A3973',
+ '0xcDafB1b2dB43f366E48e6F614b8DCCBFeeFEEcD3',
+ '0x268Ca24DAefF1FaC2ed883c598200CcbB79E931D',
+ ],
+ },
+ bsc: {
+ pools: [
+ '0x138EB30f73BC423c6455C53df6D89CB01d9eBc63',
+ ],
+ },
+ avax: {
+ pools: [
+ '0x5634c4a5FEd09819E3c46D86A965Dd9447d86e47',
+ '0x12dC9256Acc9895B076f6638D628382881e62CeE',
+ ],
+ },
+ polygon: {
+ pools: [
+ '0x9Aa02D4Fae7F58b8E8f34c66E756cC734DAc7fe4',
+ '0xd47b03ee6d86Cf251ee7860FB2ACf9f91B9fD4d7',
+ ],
+ },
+ arbitrum: {
+ pools: [
+ '0xA45B5130f36CDcA45667738e2a258AB09f4A5f7F',
+ '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
+ '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0',
+ ],
+ },
+ optimism: {
+ pools: [
+ '0xe8CDF27AcD73a434D661C84887215F7598e7d0d3',
+ '0xcE8CcA271Ebc0533920C83d39F417ED6A0abB7D0',
+ '0x19cFCE47eD54a88614648DC3f19A5980097007dD',
+ ],
+ },
+ metis: {
+ pools: [
+ '0xD9050e7043102a0391F81462a3916326F86331F0',
+ '0x36ed193dc7160D3858EC250e69D12B03Ca087D08',
+ '0x4dCBFC0249e8d5032F89D6461218a9D2eFff5125',
+ ],
+ },
+ linea: {
+ pools: [
+ '0x81F6138153d473E8c5EcebD3DC8Cd4903506B075',
+ ],
+ },
+ mantle: {
+ pools: [
+ '0x4c1d3Fc3fC3c177c3b633427c2F769276c547463',
+ '0xAc290Ad4e0c891FDc295ca4F0a6214cf6dC6acDC',
+ '0xB715B85682B731dB9D5063187C450095c91C57FC',
+ '0xF7628d84a2BbD9bb9c8E686AC95BB5d55169F3F1',
+ ],
+ },
+ base: {
+ pools: [
+ '0xdc181Bd607330aeeBEF6ea62e03e5e1Fb4B6F7C7',
+ '0x27a16dc786820B16E5c9028b75B99F6f604b5d26',
+ ],
+ },
+ kava: {
+ pools: [
+ '0x41A5b0470D96656Fb3e8f68A218b39AdBca3420b',
+ ],
+ },
+ scroll: {
+ pools: [
+ '0xC2b638Cb5042c1B3c5d5C969361fB50569840583',
+ '0x3Fc69CC4A842838bCDC9499178740226062b14E4',
+ ],
+ },
+ aurora: {
+ pools: [
+ '0x81F6138153d473E8c5EcebD3DC8Cd4903506B075',
+ ],
+ },
+}
+
+const createTvlFunction = (pools) => {
+ return async (api) => {
+ const tokens = await api.multiCall({ abi: 'address:token', calls: pools, })
+ return sumTokens2({ api, tokensAndOwners2: [tokens, pools] })
+ };
+};
+
+Object.keys(CONFIG).forEach((chain) => {
+ const { pools } = CONFIG[chain];
+ module.exports[chain] = {
+ tvl: createTvlFunction(pools),
+ };
+});
diff --git a/projects/steadefi/index.js b/projects/steadefi/index.js
index 2b4523c0b6..b7cdbff274 100644
--- a/projects/steadefi/index.js
+++ b/projects/steadefi/index.js
@@ -16,47 +16,10 @@ const config = {
}
module.exports = {
- hallmarks : [
+ hallmarks: [
[1691373600, "Steadefi exploited"],
],
};
-/*
-Object.keys(config).forEach(chain => {
- const { fsglp } = config[chain]
- module.exports[chain] = {
- tvl: async (api) => {
- const chainId = api.getChainId()
- let [lendingPools, vaults] = await getProjectInfo()
- lendingPools = lendingPools.filter(i => i.chainId === chainId).map(i => i.address)
- const grailVaults = vaults.filter(i => i.chainId === chainId && i.protocol === 'Camelot').map(i => i.address)
- vaults = vaults.filter(i => i.chainId === chainId && i.protocol !== 'Camelot').map(i => i.address)
- const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools })
- const managers = await api.multiCall({ abi: 'address:manager', calls: vaults })
- let lpTokens = await api.multiCall({ abi: 'address:lpToken', calls: managers, permitFailure: true, })
- const glpPoolManagers = managers.filter((_, i) => !lpTokens[i])
- glpPoolManagers.forEach(v => {
- lpAssets.push(fsglp)
- lendingPools.push(v)
- })
- const lpPoolManagers = managers.filter((_, i) => lpTokens[i])
- lpTokens = lpTokens.filter(i => i)
- const bals = await api.multiCall({ abi: 'uint256:lpTokenAmt', calls: lpPoolManagers })
- api.addTokens(lpTokens, bals)
- // api.add('tether', tokenValue.reduce((a, v) => a + v/1e13, 0), { skipChain: true})
- if (grailVaults.length) {
- const grailManagers = await api.multiCall({ abi: 'address:manager', calls: grailVaults })
- const spNfts = await api.multiCall({ abi: 'address:spNft', calls: grailManagers })
- const positionIds = await api.multiCall({ abi: 'uint256:positionId', calls: grailManagers })
- const poolInfos = await api.multiCall({ abi: camelotNFTPoolAbi.getPoolInfo, calls: spNfts })
- const stakedPositionInfo = await api.multiCall({ abi: camelotNFTPoolAbi.getStakingPosition, calls: spNfts.map((v, i) => ({ target: v, params: positionIds[i] })) })
- const lpTokens = poolInfos.map(v => v.lpToken)
- const lpBalances = stakedPositionInfo.map(v => v.amount)
- api.addTokens(lpTokens, lpBalances)
- }
- return sumTokens2({ api, tokensAndOwners2: [lpAssets, lendingPools] })
- }
- }
-}) */
Object.keys(config).forEach(chain => {
module.exports[chain] = {
@@ -67,8 +30,10 @@ Object.keys(config).forEach(chain => {
vaults = vaults.filter(i => i.chainId === chainId)
const vaultAddresses = vaults.map(i => i.address)
const lpAssets = await api.multiCall({ abi: 'address:asset', calls: lendingPools })
- const bals = await api.multiCall({ abi: 'function assetAmt() view returns (uint256,uint256)', calls: vaultAddresses })
- bals.forEach(([bal0, bal1], i) => {
+ const bals = await api.multiCall({ abi: 'function assetAmt() view returns (uint256,uint256)', calls: vaultAddresses, permitFailure: true })
+ bals.forEach((res, i) => {
+ if (!res) return;
+ const [bal0, bal1] = res
api.addToken(vaults[i].tokens[0].address, bal0)
api.addToken(vaults[i].tokens[1].address, bal1)
})
diff --git a/projects/steer/index.js b/projects/steer/index.js
index 24e7646c7c..0f1e897d6f 100644
--- a/projects/steer/index.js
+++ b/projects/steer/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const { stakings } = require("../helper/staking");
@@ -5,25 +6,25 @@ const { stakings } = require("../helper/staking");
const supportedChains = [
{
name: 'Polygon',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-polygon',
+ subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-polygon/1.1.1/gn',
chainId: 137,
identifier: 'polygon'
},
{
name: 'Arbitrum',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-arbitrum',
+ subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-arbitrum/1.1.0/gn',
chainId: 42161,
identifier: 'arbitrum'
},
{
name: 'Optimism',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-optimism',
+ subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GgW1EwNARL3dyo3acQ3VhraQQ66MHT7QnYuGcQc5geDG',
chainId: 10,
identifier: 'optimism'
},
{
name: 'Binance',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-bsc',
+ subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GLDP56fPGDz3MtmhtfTkz5CxWiqiNLACVrsJ9RqQeL4U',
chainId: 56,
identifier: 'bsc'
},
@@ -35,7 +36,7 @@ const supportedChains = [
},
{
name: 'Avalanche',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/steerprotocol/steer-protocol-avalanche',
+ subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/GZotTj3rQJ8ZqVyodtK8TcnKcUxMgeF7mCJHGPYbu8dA',
chainId: 43114,
identifier: 'avax'
},
@@ -101,7 +102,7 @@ const supportedChains = [
},
{
name: 'Fantom',
- subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-protocol-fantom-test',
+ subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/9uyX2WDuaxmcYh11ehUhU68M9uSCp5FXVQV2w4LqbpbV',
chainId: 250,
identifier: 'fantom'
},
@@ -129,9 +130,28 @@ const supportedChains = [
chainId: 3776,
identifier: 'astrzk'
},
+ {
+ name: 'Telos',
+ subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-telos/1.0.1/gn',
+ chainId: 40,
+ identifier: 'telos'
+ },
+ {
+ name: 'X Layer',
+ subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-x-layer/1.0.1/gn',
+ chainId: 196,
+ identifier: 'xlayer'
+ },
+ {
+ name: 'Rootstock',
+ subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-rootstock/1.1.1/gn',
+ chainId: 30,
+ identifier: 'rsk'
+ },
+
// {
// name: 'Celo',
- // subgraphEndpoint: 'https://api.thegraph.com/subgraphs/name/rakeshbhatt10/steer-test-celo',
+ // subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/BPaFHyfVrhv3pdjGodpQcWggAg1Bcrvc9SFc2t2BXeho',
// chainId: 42220,
// identifier: 'celo'
// },
@@ -167,7 +187,9 @@ module.exports.arbitrum.staking = stakings(
"0x25Ef108B328Cf752F0E0b0169D499Db164173763",
"0x0b619438d1E8b8c205656502de59Af2Af71C43e0",
"0xaCdC6fC8F84fbA26f065489a7bf5837D7CDf546F",
- "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4"
+ "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4",
+ "0x1E6a358a1721e0D2B84f39FD328FC03A1b6e863B",
+ "0x3338B85fB1607C519962571B67061e02408475Bb"
],
"0x1C43D05be7E5b54D506e3DdB6f0305e8A66CD04e",
"arbitrum"
diff --git a/projects/step-finance/index.js b/projects/step-finance/index.js
new file mode 100644
index 0000000000..793750a3e3
--- /dev/null
+++ b/projects/step-finance/index.js
@@ -0,0 +1,11 @@
+const { sumTokens2 } = require("../helper/solana");
+
+const STAKING_VAULT = 'ANYxxG365hutGYaTdtUQG8u2hC4dFX9mFHKuzy9ABQJi';
+
+module.exports = {
+ timetravel: false,
+ solana: {
+ tvl: () => ({}),
+ staking: () => sumTokens2({ tokenAccounts: [STAKING_VAULT] })
+ },
+}
\ No newline at end of file
diff --git a/projects/stfil/index.js b/projects/stfil/index.js
index d2a1c4f887..2fd958767c 100644
--- a/projects/stfil/index.js
+++ b/projects/stfil/index.js
@@ -1,18 +1,16 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const {get} = require('../helper/http');
-const BN = require("bn.js");
+const ADDRESSES = require("../helper/coreAssets.json");
+const stFIL = "0x3C3501E6c353DbaEDDFA90376975Ce7aCe4Ac7a8";
+const WFIL = ADDRESSES.filecoin.WFIL;
-module.exports = {
- filecoin: {
- tvl: async (_, _1, _2, {api}) => {
-
- const {data: {allMinerValue, poolStFilBalance}} = await get("https://api.stfil.io/v1/info");
- const allMinerValueBN = new BN(allMinerValue);
- const poolStFilBalanceBN = new BN(poolStFilBalance);
-
- return api.add(ADDRESSES.null, allMinerValueBN.add(poolStFilBalanceBN));
- }
- }
-}
+const tvl = async (api) => {
+ const stFILSupply = await api.call({ target: stFIL, abi: 'erc20:totalSupply' })
+ api.add(WFIL, stFILSupply)
+};
+module.exports = {
+ methodology: 'stFIL tokens are minted upon filecoin deposit at 1:1 ratio',
+ filecoin: {
+ tvl,
+ },
+};
diff --git a/projects/stipflip/index.js b/projects/stipflip/index.js
new file mode 100644
index 0000000000..8883dd0ef6
--- /dev/null
+++ b/projects/stipflip/index.js
@@ -0,0 +1,26 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+const ADDRESSES = require('../helper/coreAssets.json')
+const { uniV3Export } = require('../helper/uniswapV3')
+const ORACLE = "0x4AC635E92801e657F44BDEfcc7660Ea1431DF846";
+
+async function tvl(api) {
+ const logs = await getLogs2({
+ api,
+ factory: '0x352Cea820fAE79016490518b20f1FD4F53bC56Af',
+ eventAbi: 'event SynthCreated(address indexed oracle, address indexed synth, bool long)',
+ fromBlock: 20172088,
+ })
+ const synths = logs.map(log => log.synth)
+ await api.sumTokens({ owners: [...synths, ORACLE], tokens: [ADDRESSES.null, ADDRESSES.ethereumclassic.WETC] })
+ const uniTvl = uniV3Export({
+ ethereumclassic: { blacklistedTokens: synths.concat(['0xf09ace63aa1345882a1ca200b7243f5786eb177b']), factory: '0xaCc703c9C8248a141113C672ea71d196E8118210', fromBlock: 20130563, }
+ }).ethereumclassic.tvl
+
+ return uniTvl(api)
+}
+
+module.exports = {
+ ethereumclassic: {
+ tvl,
+ },
+};
diff --git a/projects/strater/index.js b/projects/strater/index.js
index 5e92b64b02..292c71ff13 100644
--- a/projects/strater/index.js
+++ b/projects/strater/index.js
@@ -36,6 +36,8 @@ const STAPREAL_VAULT_ID =
const STAPEARL_PAIR_METADTA_ID =
"0x243096d976a44de24fde33f087665f8265543a533b5cdbae60fc72a939669867";
+const ST_SBUCK_VAULT_OBJECT_ID = "0xe83e455a9e99884c086c8c79c13367e7a865de1f953e75bcf3e529cdf03c6224"
+
function asIntN(int, bits = 32) {
return Number(BigInt.asIntN(bits, BigInt(int)));
}
@@ -92,8 +94,18 @@ async function tvl(api) {
const stapearlUSDTAmount =
(stapearlLpAmount * stapearlReserveY) / stapearlLpSupply;
+ // saving vault
+ const savingVaultcObj = await sui.getObject(ST_SBUCK_VAULT_OBJECT_ID)
+ let savingVaultTVL = Number(savingVaultcObj.fields.free_balance) + Number(savingVaultcObj.fields.time_locked_profit.fields.locked_balance) + Number(savingVaultcObj.fields.time_locked_profit.fields.unlocked_balance)
+ const strategies = savingVaultcObj.fields.strategies.fields.contents
+ for(const strategy of strategies){
+ const botrrowedAmount = Number(strategy.fields.value.fields.borrowed)
+ savingVaultTVL += botrrowedAmount
+ }
+
api.add(ADDRESSES.sui.USDC, stapearlUSDCAmount);
api.add(ADDRESSES.sui.USDT, stapearlUSDTAmount);
+ api.add(ADDRESSES.sui.BUCK, savingVaultTVL)
}
module.exports = {
diff --git a/projects/streamflow/index.js b/projects/streamflow/index.js
index 0c829ce41a..78462852b6 100644
--- a/projects/streamflow/index.js
+++ b/projects/streamflow/index.js
@@ -1,51 +1,63 @@
const { getCache } = require('../helper/http')
+const { getWhitelistedTokens } = require('../helper/streamingHelper')
-const TVL_KEY = "tvl";
-const VESTING_KEY = "tvl_vested";
-const api =
- "https://metabase.internal-streamflow.com/_public/api/v1/stats/accumulated";
+const url =
+ "https://metabase.internal-streamflow.com/_public/api/v1/stats/accumulated/by-token";
const chains = [
"solana",
"aptos",
"bsc",
"polygon",
"ethereum",
+ "sui",
];
const chainMapping = {
bsc: 'bnb'
};
-const getValueForKey = (arr, chain, key) => {
- for (let i = 0; i < arr.length; i++) {
- if (arr[i].chain.toLowerCase() === (chainMapping[chain] || chain) && arr[i][key] !== undefined) {
- return arr[i][key];
- }
- }
- return 0;
-}
-
async function getCachedApiRespnse() {
- let apiResponse = (await getCache(api));
+ let apiResponse = (await getCache(url));
return apiResponse;
}
-async function tvl(api) {
- return {
- tether: getValueForKey(await getCachedApiRespnse(), api.chain, TVL_KEY),
+async function fetchData(api, key, isVesting) {
+ const tokenHoldings = await getCachedApiRespnse();
+ const chain = (chainMapping[api.chain] || api.chain).toUpperCase();
+
+ const holdings = tokenHoldings.filter((i) => i.chain === chain);
+ let whitelistedTokens = []
+ let allTokens = []
+ if (key === "amount_locked_core") {
+ allTokens = holdings.filter((i) => +i[key] > 0).map((i) => i.mint);
+ whitelistedTokens = await getWhitelistedTokens({ api, tokens: allTokens, isVesting })
+ whitelistedTokens = new Set(whitelistedTokens)
+ }
+
+
+ for (const tokenHolding of holdings) {
+ if (key === "amount_locked_core" && !whitelistedTokens.has(tokenHolding.mint)) {
+ continue;
+ }
+ api.add(tokenHolding.mint, tokenHolding[key]);
}
}
+
+async function tvl(api) {
+ await fetchData(api, "amount_locked_core", false);
+}
+
async function vesting(api) {
- return {
- tether: getValueForKey(await getCachedApiRespnse(), api.chain, VESTING_KEY),
- }
+ await fetchData(api, "amount_locked_core", true);
+ await fetchData(api, "amount_locked_vested");
}
module.exports = {
- methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d',
+ methodology: 'Token breakdown: https://metabase.internal-streamflow.com/public/dashboard/fe3731c1-fbe4-4fb6-8960-515af1d6e72d',
timetravel: false,
- misrepresentedTokens: true,
+ misrepresentedTokens: false,
}
+
chains.forEach((chain) => {
module.exports[chain] = {
tvl, vesting
diff --git a/projects/stride-hyperlane/index.js b/projects/stride-hyperlane/index.js
new file mode 100644
index 0000000000..71f6a8371c
--- /dev/null
+++ b/projects/stride-hyperlane/index.js
@@ -0,0 +1,38 @@
+const sdk = require("@defillama/sdk")
+const { get } = require("../helper/http")
+
+async function tvl() {
+ // address denom reference: https://www.mintscan.io/stride/address/stride1h4rhlwcmdwnnd99agxm3gp7uqkr4vcjd73m4586hcuklh3vdtldqgqmjxc
+ const hyperlaneAddressDenom = "ibc/BF3B4F53F3694B66E13C23107C84B6485BD2B96296BB7EC680EA77BBA75B4801"
+
+ const { balances: hyperlaneBalances } = await get(
+ "https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/balances/stride1h4rhlwcmdwnnd99agxm3gp7uqkr4vcjd73m4586hcuklh3vdtldqgqmjxc"
+ )
+
+ const hyperlaneBalance = hyperlaneBalances.find((balance) => balance.denom === hyperlaneAddressDenom)
+
+ if (hyperlaneBalance == null) throw new Error("Something went wrong with getting the available hyperlane balance")
+
+ // This defaults to 1e6 (for now) since the origin denom of `hyperlaneAddressDenom` is utia
+ const coinDecimals = 1e6
+
+ const amount = hyperlaneBalance.amount / coinDecimals
+
+ const balances = {}
+
+ sdk.util.sumSingleBalance(
+ balances,
+ "celestia",
+ amount
+ )
+
+ return balances
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: "Hyperlane uses a lock-and-mint mechanism. To calculate TVL, we are taking the number of locked TIA on the Stride side of the bridge, and multiplying by TIA price.",
+ "celestia": {
+ tvl
+ }
+} // node test.js projects/stride-hyperlane/index.js
diff --git a/projects/stride/index.js b/projects/stride/index.js
index b96cfe370d..ff146d5dab 100644
--- a/projects/stride/index.js
+++ b/projects/stride/index.js
@@ -67,7 +67,7 @@ const chains = {
denom: "adydx",
coinGeckoId: "dydx-chain",
},
-
+
celestia: {
chainId: "celestia",
denom: "utia",
@@ -78,33 +78,38 @@ const chains = {
chainId: "dymension_1100-1",
denom: "adym",
coinGeckoId: "dymension",
- }
+ },
+
+ islm: {
+ chainId: "haqq_11235-1",
+ denom: "aISLM",
+ coinGeckoId: "islamic-coin",
+ },
};
// inj uses 1e18 - https://docs.injective.network/learn/basic-concepts/inj_coin#base-denomination
function getCoinDenimals(denom) {
- return ["aevmos", "inj", "adydx", "adym"].includes(denom) ? 1e18 : 1e6;
+ return ["aevmos", "inj", "adydx", "adym", "aISLM"].includes(denom)
+ ? 1e18
+ : 1e6;
}
function makeTvlFn(chain) {
return async () => {
-
// Define the URL for host_zone based on chainId
- let hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone/${chain.chainId}`;
- if (chain.chainId === 'celestia') {
- hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/staketia/host_zone`;
- } else if (chain.chainId === 'dymension_1100-1') {
- hostZoneUrl = `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakedym/host_zone`;
- }
+ const hostZoneUrl =
+ chain.chainId === "celestia"
+ ? "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/staketia/host_zone"
+ : chain.chainId === "dymension_1100-1"
+ ? "https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakedym/host_zone"
+ : `https://stride-fleet.main.stridenet.co/api/Stride-Labs/stride/stakeibc/host_zone/${chain.chainId}`;
const [{ amount: assetBalances }, { host_zone: hostZone }] =
await Promise.all([
await get(
`https://stride-fleet.main.stridenet.co/api/cosmos/bank/v1beta1/supply/by_denom?denom=st${chain.denom}`
),
- await get(
- hostZoneUrl
- ),
+ await get(hostZoneUrl),
]);
const assetBalance = assetBalances["amount"];
diff --git a/projects/sturdy-v2/index.js b/projects/sturdy-v2/index.js
index b831810d8d..e525b2a71a 100644
--- a/projects/sturdy-v2/index.js
+++ b/projects/sturdy-v2/index.js
@@ -4,6 +4,9 @@ const abi = require("./abi.json");
const config = {
ethereum: '0x69764E3e0671747A7768A1C1AfB7C0C39868CC9e',
mode: '0xF0382A9Eca5276d7B4BbcC503e4159C046c120ec',
+ linea: "0xd67Da8636Ae87b0cECBDa2e66dB58d4839722B52",
+ optimism: "0x9dc7B2130e478C5810Dc0cDbD46B9D479b2e1aC4",
+ sei: "0x4534F53A81416a83F6bAF5ac63c94aEd1fea1303",
}
module.exports = {
diff --git a/projects/sturgeon/index.js b/projects/sturgeon/index.js
new file mode 100644
index 0000000000..519ae34d1d
--- /dev/null
+++ b/projects/sturgeon/index.js
@@ -0,0 +1,31 @@
+const { sumTokens2 } = require("../helper/unwrapLPs")
+
+const config = {
+ "real": {
+ controller: "0xE0E71B484Bb20E37d18Ab51fB60c32deC778478A",
+ },
+}
+
+Object.keys(config).forEach(chain => {
+ const { controller } = config[chain]
+ module.exports[chain] = {
+ tvl: async function (api) {
+ const compounderVaults = await api.call({ abi: 'address[]:compounderVaultsList', target: controller })
+ const harvesterVaults = await api.call({ abi: 'address[]:harvesterVaultsList', target: controller })
+ await api.erc4626Sum({ calls: compounderVaults, isOG4626: true })
+ const tridents = await api.multiCall({ abi: 'address:asset', calls: harvesterVaults })
+ const tridentBalances = await api.multiCall({ abi: 'uint256:totalAssets', calls: harvesterVaults })
+ const token0s = await api.multiCall({ abi: 'address:token0', calls: tridents })
+ const tokenBals = await api.multiCall({ abi: 'function getTotalAmounts() external view returns (uint total0, uint total1, uint128 liquidity)', calls: tridents })
+ const token1s = await api.multiCall({ abi: 'address:token1', calls: tridents })
+ const totalSupplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: tridents })
+
+ tridents.forEach((_, i) => {
+ const ratio = tridentBalances[i] / totalSupplies[i]
+ api.add(token0s[i], tokenBals[i].total0 * ratio)
+ api.add(token1s[i], tokenBals[i].total1 * ratio)
+ })
+ return sumTokens2({ api })
+ },
+ }
+})
diff --git a/projects/sudoswap-v2/index.js b/projects/sudoswap-v2/index.js
index c7946391ca..d5aca64cb9 100644
--- a/projects/sudoswap-v2/index.js
+++ b/projects/sudoswap-v2/index.js
@@ -28,8 +28,9 @@ const config = {
ethereum: { target: '0xA020d57aB0448Ef74115c112D18a9C231CC86000', fromBlock: 17309203 },
arbitrum: { target: '0x4f1627be4C72aEB9565D4c751550C4D262a96B51', fromBlock: 168473054 },
base: { target: '0x605145d263482684590f630e9e581b21e4938eb8', fromBlock: 7529192 },
+ sanko: { target: '0x5bfE2ef160EaaAa4aFa89A8fa09775b6580162c9', fromBlock: 5317 },
}
Object.keys(config).forEach(chain => {
module.exports[chain] = { tvl }
-})
\ No newline at end of file
+})
diff --git a/projects/sudoswap/index.js b/projects/sudoswap/index.js
index 59c1aa00f3..a2e2ddd95c 100644
--- a/projects/sudoswap/index.js
+++ b/projects/sudoswap/index.js
@@ -1,6 +1,6 @@
+const sdk = require("@defillama/sdk");
const { graphFetchById, } = require('../helper/cache')
const { ART_BLOCKS, sumArtBlocks } = require('../helper/nft')
-const sdk = require('@defillama/sdk')
const query = `
query get_pairs($lastId: String, $block: Int) {
@@ -34,7 +34,7 @@ module.exports = {
ethereum: {
tvl: async (api) => {
const data = await graphFetchById({
- endpoint: 'https://api.thegraph.com/subgraphs/name/zeframlou/sudoswap',
+ endpoint: sdk.graph.modifyEndpoint('5ZEPsiros7UhV5noPBHHkzy1rfSBFRP2d2ghHZHHCugd'),
query,
api,
options: {
diff --git a/projects/sumer/index.js b/projects/sumer/index.js
index 02958bea50..aaf4cf6016 100644
--- a/projects/sumer/index.js
+++ b/projects/sumer/index.js
@@ -4,4 +4,5 @@ module.exports = {
meter: compoundExports2({ comptroller: '0xcB4cdDA50C1B6B0E33F544c98420722093B7Aa88' }),
base: compoundExports2({ comptroller: '0x611375907733D9576907E125Fb29704712F0BAfA' }),
arbitrum: compoundExports2({ comptroller: '0xBfb69860C91A22A2287df1Ff3Cdf0476c5aab24A' }),
+ ethereum: compoundExports2({ comptroller: '0x60A4570bE892fb41280eDFE9DB75e1a62C70456F' }),
}
\ No newline at end of file
diff --git a/projects/summer-fi/index.js b/projects/summer-fi/index.js
index 7cfdf389d8..4ac4457ea7 100644
--- a/projects/summer-fi/index.js
+++ b/projects/summer-fi/index.js
@@ -1,19 +1,18 @@
-const { automationTvl, dpmPositions, makerTvl } = require("./handlers");
+const { automationTvl } = require("./handlers");
const { getAutomationCdpIdList, setCallCache } = require("./helpers");
const sdk = require("@defillama/sdk");
-const { getConfig, getCache, setCache } = require("../helper/cache");
-const { endpoints } = require("./constants/endpoints");
+const { getCache, setCache } = require("../helper/cache");
module.exports = {
doublecounted: true,
+ methodology: "Summer.fi TVL is calculated by fetching on-chain data, retrieving CDP IDs, and using them to determine locked assets via the automationTvl function, excluding frontend-managed Maker vaults",
ethereum: { tvl },
};
async function tvl(api) {
await api.getBlock();
const executionStart = Date.now() / 1000;
- const [confirmedSummerFiMakerVaults, cdpIdList, cache] = await Promise.all([
- await getConfig("summer-fi/maker-vaults", endpoints.makerVaults()),
+ const [cdpIdList, cache] = await Promise.all([
getAutomationCdpIdList({ api }),
getCache("summer-fi/cache", api.chain),
]);
@@ -23,9 +22,7 @@ async function tvl(api) {
sdk.log([...cdpIdList].length, "cdpIdList");
await Promise.all([
- dpmPositions({ api }),
automationTvl({ api, cdpIdList }),
- makerTvl({ api, cdpIdList, confirmedSummerFiMakerVaults }),
]);
await setCache("summer-fi/cache", api.chain, cache);
diff --git a/projects/sun/index.js b/projects/sun/index.js
index eed20debbd..78708be7cf 100644
--- a/projects/sun/index.js
+++ b/projects/sun/index.js
@@ -74,26 +74,9 @@ const ownerTokens = pools.map(({ pool, stablecoins }) => {
const stakingContract = "TXbA1feyCqWAfAQgXvN1ChTg82HpBT8QPb"
const sun = ADDRESSES.tron.SUN
-const lpToken = 'TDQaYrhQynYV9aXTYj63nwLAafRffWSEj6'
-const oldLpStaking = "TGsymdggp98tLKZWGHcGX58TjTcaQr9s4x"
-const lpStaking = "TAkrcKsS5FW9f3ZfzvWy6Zvsz9uEjUxPoV"
-
-/* async function pool2(api) {
- const [lpTokenAmount, sunInLp, trxInLp, totalSupply] = await Promise.all([
- getTokenBalance(lpToken, lpStaking),
- getTokenBalance(sun, lpToken),
- getTrxBalance(lpToken),
- call({ target: lpToken, abi: 'totalSupply()', resTypes: ['number'] }),
- ])
- api.add(sun, sunInLp * lpTokenAmount / totalSupply)
- api.add(nullAddress, trxInLp * lpTokenAmount / totalSupply)
-}
- */
-
module.exports = {
tron: {
tvl: sumTokensExport({ ownerTokens }),
staking: sumTokensExport({ owner: stakingContract, tokens: [sun] }),
- // pool2
},
}
diff --git a/projects/superfluid.js b/projects/superfluid.js
index 1e3099bdea..95f64ca96e 100644
--- a/projects/superfluid.js
+++ b/projects/superfluid.js
@@ -6,8 +6,8 @@ const { transformBalances } = require('./helper/portedTokens')
// Superfluid Supertokens can be retrieved using GraphQl API - cannot use block number to retrieve historical data at the moment though
// TheGraph URL before being deprecated, before 2021-12-23
-// const polygonGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-matic'
-// const xdaiGraphUrl = 'https://api.thegraph.com/subgraphs/name/superfluid-finance/superfluid-xdai'
+// const polygonGraphUrl = sdk.graph.modifyEndpoint('BoiJR4mfVpVthWjTcansrCUFCjKY9MfDxgTfzkf4YpAN')
+// const xdaiGraphUrl = sdk.graph.modifyEndpoint('A3LhWnFQR13mxQPFGUZML9vyBrLLKhLJBhfFsrdShxBU')
const supertokensQuery = `
query get_supertokens($block: Int) {
@@ -99,12 +99,12 @@ async function retrieveSupertokensBalances(chain, block, isVesting, ts, graphUrl
}
const config = {
- avax: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-avalanche-c', },
- polygon: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-matic', },
- xdai: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-xdai', },
- optimism: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-optimism-mainnet', },
- arbitrum: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-arbitrum-one', },
- bsc: { graph: 'https://api.thegraph.com/subgraphs/name/superfluid-finance/protocol-v1-bsc-mainnet', },
+ avax: { graph: sdk.graph.modifyEndpoint('CtYR3ng4ED64HVEzDo49eKQgEf78RERiC8mDUtwLxda'), },
+ polygon: { graph: sdk.graph.modifyEndpoint('7d9iBvDoM43SZiZhRR2pnpW8z3ujSEy9nC6RuqnufRU9'), },
+ xdai: { graph: sdk.graph.modifyEndpoint('DE6fybqxjXLNvqGpd4QLAD92kAZNEmha1ZfKvS2qM376'), },
+ optimism: { graph: sdk.graph.modifyEndpoint('S48f1C3KhNB2YbEMDxYHPzZ3FYt27fQZdruKfSTeEdZ'), },
+ arbitrum: { graph: sdk.graph.modifyEndpoint('ES5GNHtiaqP6jFydhUyD9R4RackYrbGr6LEL1ZDauktd'), },
+ bsc: { graph: sdk.graph.modifyEndpoint('FzYUiDH968QKbjURULGE5Pwh1ZRvcBNjDcut5YSiMYnj'), },
}
module.exports = {
diff --git a/projects/superform/index.js b/projects/superform/index.js
index 3d9fd185f8..68eb5431df 100644
--- a/projects/superform/index.js
+++ b/projects/superform/index.js
@@ -1,14 +1,23 @@
-const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base"];
+const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base", "fantom"];
const factory_contract = "0xD85ec15A9F814D6173bF1a89273bFB3964aAdaEC";
+const fantom_factory_contract = "0xbc85043544CC2b3Fd095d54b6431822979BBB62A";
+
+// These vaults have misconfigured implementation affecting TVL
+const blacklisted_vaults = ["0xd3a17928245064b6df5095a76e277fe441d538a4"]
async function tvl(api) {
- const forms = await api.fetchList({ lengthAbi: 'getSuperformCount', itemAbi: "function superforms(uint256) external view returns(uint256)", target: factory_contract })
- const getSuperformRes = await api.multiCall({ abi: "function getSuperform(uint256) external view returns(address, uint32, uint64)", calls: forms, target: factory_contract })
+ const forms = await api.fetchList({ lengthAbi: 'getSuperformCount', itemAbi: "function superforms(uint256) external view returns(uint256)", target: api.chainId === 250 ? fantom_factory_contract : factory_contract })
+ const getSuperformRes = await api.multiCall({ abi: "function getSuperform(uint256) external view returns(address, uint32, uint64)", calls: forms, target: api.chainId === 250 ? fantom_factory_contract : factory_contract })
const super4626 = getSuperformRes.map(v => v[0])
const vaults = await api.multiCall({ abi: 'address:vault', calls: super4626 })
- const assets = await api.multiCall({ abi: 'address:asset', calls: super4626 })
- const vBals = await api.multiCall({ abi: "erc20:balanceOf", calls: vaults.map((v, i) => ({ target: v, params: super4626[i] })) })
- const bals = await api.multiCall({ abi: "function previewRedeemFrom(uint256) external view returns(uint256)", calls: super4626.map((v, i) => ({ target: v, params: vBals[i] })), permitFailure: true })
+
+ // Filter out blacklisted vaults
+ const filteredVaults = vaults.filter(vault => !blacklisted_vaults.includes(vault.toLowerCase()));
+ const filteredSuper4626 = super4626.filter((_, index) => !blacklisted_vaults.includes(vaults[index].toLowerCase()));
+
+ const assets = await api.multiCall({ abi: 'address:asset', calls: filteredSuper4626 })
+ const vBals = await api.multiCall({ abi: "erc20:balanceOf", calls: filteredVaults.map((v, i) => ({ target: v, params: filteredSuper4626[i] })) })
+ const bals = await api.multiCall({ abi: "function previewRedeemFrom(uint256) external view returns(uint256)", calls: filteredSuper4626.map((v, i) => ({ target: v, params: vBals[i] })), permitFailure: true })
bals.forEach((bal, i) => {
if (bal) api.add(assets[i], bal)
})
@@ -16,6 +25,10 @@ async function tvl(api) {
module.exports = {
methodology: "counts the TVL of each superform across all the supported networks",
+ hallmarks: [
+ [1707350400,"Early Access"],
+ [1715212800,"Open Launch"]
+ ]
};
superform_chains.forEach(chain => module.exports[chain] = { tvl })
\ No newline at end of file
diff --git a/projects/superhero-dex/index.js b/projects/superhero-dex/index.js
new file mode 100644
index 0000000000..e1aa3ba05f
--- /dev/null
+++ b/projects/superhero-dex/index.js
@@ -0,0 +1,26 @@
+const { get } = require('../helper/http')
+const { transformDexBalances } = require("../helper/portedTokens");
+
+async function tvl(api) {
+ const allPools = [];
+ const pairs = await get('https://dex-backend-mainnet.prd.service.aepps.com/pairs')
+ for (const pair of pairs) {
+ const [pairLiquidityInfo] = await get('https://dex-backend-mainnet.prd.service.aepps.com/history?pairAddress=' + pair.address + '&limit=100&order=desc&toBlockTime=' + api.timestamp * 1000);
+ allPools.push({
+ token0: pair.token0,
+ token0Bal: pairLiquidityInfo?.reserve0 || 0,
+ token1: pair.token1,
+ token1Bal: pairLiquidityInfo?.reserve1 || 0,
+ })
+ }
+
+ return transformDexBalances({ chain: 'aeternity', data: allPools, });
+}
+
+
+module.exports = {
+ methodology: 'TVL is calculated based on tokens that are locked in the Superhero DEX pools.',
+ aeternity: {
+ tvl,
+ },
+};
\ No newline at end of file
diff --git a/projects/superposition/index.js b/projects/superposition/index.js
new file mode 100644
index 0000000000..b6ecf4c48d
--- /dev/null
+++ b/projects/superposition/index.js
@@ -0,0 +1,51 @@
+const { getResources } = require("../helper/chain/aptos");
+
+const spRootAddress =
+ "0xccd1a84ccea93531d7f165b90134aa0415feb30e8757ab1632dac68c0055f5c2";
+
+let resourcesCache;
+
+async function _getResources() {
+ if (!resourcesCache) resourcesCache = getResources(spRootAddress);
+ return resourcesCache;
+}
+
+const brokersFilter = (i) =>
+ i.type.includes(`${spRootAddress}::broker::Broker`);
+
+function processBrokerData(brokerDataArray, isBorrowed = false) {
+ const result = {};
+
+ brokerDataArray.map((item) => {
+ const { type, data } = item;
+ result[type] = !isBorrowed ? parseInt(data.available) : parseInt(data.borrowed)
+ });
+
+ return result;
+}
+
+function simplifyKeys(balanceData, api) {
+ Object.entries(balanceData).forEach(([key, value]) => {
+ const newKey = key.match(/<([^>]+)>/)[1];
+ api.add(newKey, value);
+ });
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: "Aggregates TVL from all brokers in the Superposition protocol.",
+ aptos: {
+ tvl: async (api) => {
+ const resources = await _getResources();
+ const brokers = resources.filter(brokersFilter);
+ const balanceData = processBrokerData(brokers);
+ simplifyKeys(balanceData, api);
+ },
+ borrowed: async (api) => {
+ const resources = await _getResources();
+ const brokers = resources.filter(brokersFilter);
+ const balanceData = processBrokerData(brokers, true);
+ simplifyKeys(balanceData, api);
+ },
+ },
+};
diff --git a/projects/sushiswap-bentobox/helper.js b/projects/sushiswap-bentobox/helper.js
index 36c37f5e90..425a6f8a3c 100644
--- a/projects/sushiswap-bentobox/helper.js
+++ b/projects/sushiswap-bentobox/helper.js
@@ -24,23 +24,23 @@ const toAmountAbi =
const bentoSubgraphs = {
ethereum:
- "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-ethereum",
- polygon: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-polygon",
- fantom: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-fantom",
- bsc: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-avalanche",
+ sdk.graph.modifyEndpoint('8HYeoDopVqqvb5RJEV2TtSzFsouYPz8cownnG3mbhiGy'),
+ polygon: sdk.graph.modifyEndpoint('6kJg5kFoQY8B8Ge2hqswHMqZDcmsR1TLUUz7AKov69fy'),
+ fantom: sdk.graph.modifyEndpoint('2KqXx6dGw7T4mZeGKyzQ9m9iyuCMjPR8PntLB9Gn9AEK'),
+ bsc: sdk.graph.modifyEndpoint('BggyE3r5snDsjx19jgZcbiBH7cbtrkpjvyGLFHMdXekd'),
+ avax: sdk.graph.modifyEndpoint('EhYaJodF1WQjKgxx1ZC63goeCwp5swD4AQRdaKXBm2xk'),
arbitrum:
- "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-arbitrum",
+ sdk.graph.modifyEndpoint('JZFyMKR4jnsFQ58q7dT6nbXenTzNgE176zTejc6Gf8Z'),
optimism:
- "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-optimism",
- xdai: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-gnosis",
- harmony: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-harmony",
+ sdk.graph.modifyEndpoint('8b4Hy4Kn7jCNAf9JFrqHb24LsqmapG4HrAsCrwdJf9Nu'),
+ xdai: sdk.graph.modifyEndpoint('9jn9kA6SKCNxXQSqb93zZPLdLaru4FeZBwLNWAK4nfZ2'),
+ harmony: sdk.graph.modifyEndpoint('Bioj7N3Rf2n7iBq9PVoaMie3WiuzPze9NMi7aSye7LFc'),
moonbeam:
- "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-moonbeam",
+ sdk.graph.modifyEndpoint('7wA5gqWNP4E1dPWBsTYvz5eQSDbtYDFgyU5BGdHr2UKp'),
moonriver:
- "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-moonriver",
+ sdk.graph.modifyEndpoint('73XEV6UQKpPSJn68WZBAYTwALcZtFJkFYn58ZoZUb7tn'),
//metis: "",
- celo: "https://api.thegraph.com/subgraphs/name/sushiswap/bentobox-celo",
+ celo: sdk.graph.modifyEndpoint('5DwkvjxPGVFFaWEMM68g1yztDdhCgJEYAxS6FuhkajzR'),
//kava: "",
};
@@ -60,23 +60,23 @@ const bentoQuery = gql`
const furoSubgraphs = {
ethereum:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-ethereum",
+ sdk.graph.modifyEndpoint('D8vYJpKN5SEHUkUWKSuorsL6FRt7hAQMnywnC4e93ygf'),
polygon:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-polygon",
- fantom: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-fantom",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-avalanche",
+ sdk.graph.modifyEndpoint('4KsDNsyJjKX6bjwVNJQmJ7Dm3wovYXSX37UR39rNaMX4'),
+ fantom: sdk.graph.modifyEndpoint('E98zSR5UZBGBgQe2SSLZ5R6yj5GPqKDJcQJNDHTeV3cS'),
+ bsc: sdk.graph.modifyEndpoint('2wBYezghRA3hEJLQB4njUZGDNxCdU3u2gsLP5yVvBqKk'),
+ avax: sdk.graph.modifyEndpoint('8LVoX3JPEVAak8T8GoEfdJudMoP2bsGwd9tszJxo3Rnx'),
arbitrum:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-arbitrum",
+ sdk.graph.modifyEndpoint('8eHhPeKDr646JH5KUBBcabAJzkWmLfu6pqBtpXQHa37F'),
optimism:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-optimism",
- xdai: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-gnosis",
+ sdk.graph.modifyEndpoint('8KnsmppMf9k6Qvyixxwmny7dYugTV7XT4htHTfyq3d69'),
+ xdai: sdk.graph.modifyEndpoint('5ToxB5xubMh9osdEDeX98JBAyzUVwkReGXAT1CzQhZCB'),
harmony:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-harmony",
+ sdk.graph.modifyEndpoint('9D9C3ppoDE1zuZk5adznngKomLYS8NnC9zxniSS8vzgH'),
moonbeam:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonbeam",
+ sdk.graph.modifyEndpoint('HJxpcsmaPV3L6PsqGFBHLczeMnL7bEgmL1D65edGx8pf'),
moonriver:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonriver",
+ sdk.graph.modifyEndpoint('9ZqdKjfu7o9dX1RThXHDV9EqMn5CTvgpsPKKbpANg8yC'),
};
const furoQuery = gql`
@@ -97,11 +97,11 @@ const furoQuery = gql`
`;
const kashiSubgraphs = {
- ethereum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-ethereum",
- polygon: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-polygon",
- arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-arbitrum",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushiswap/kashi-avalanche",
+ ethereum: sdk.graph.modifyEndpoint('6Kf5cPeXUMVzfGCtzBnSxDU849w2YM2o9afn1uiPpy2m'),
+ polygon: sdk.graph.modifyEndpoint('5F3eB4Cm5mxorArsyrbs2a1TDxctmk3znpDZ4LEzqrBJ'),
+ arbitrum: sdk.graph.modifyEndpoint('G3rbmaF7w2ZLQjZgGoi12BzPeL9z4MTW662iVyjYmtiX'),
+ bsc: sdk.graph.modifyEndpoint('D1TGHRKx2Q54ce2goyt9hbtKNuT94FDBsuPwtGg5EzRw'),
+ avax: sdk.graph.modifyEndpoint('BHeJByyVoNuVtqufK3Nk7YYmFkBs43boYpKv8z6hQ5Q1'),
};
const kashiQuery = gql`
@@ -123,16 +123,16 @@ const kashiQuery = gql`
`;
const tridentSubgraphs = {
- polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon",
- optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism",
+ polygon: sdk.graph.modifyEndpoint('BSdbRfU6PjWSdKjhpfUQ6EgUpzMxgpf5c1ugaVwBJFsQ'),
+ optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'),
kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava",
metis:
"https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis",
bittorrent:
"https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc",
- arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche",
+ arbitrum: sdk.graph.modifyEndpoint('4x8H6ZoGfJykyZqAe2Kx2g5afsp17S9pn8GroRkpezhx'),
+ bsc: sdk.graph.modifyEndpoint('9TQaBw1sU3wi2kdevuygKhfhjP3STnwBe1jUnKxmNhmn'),
+ avax: sdk.graph.modifyEndpoint('NNTV3MgqSGtHMBGdMVLXzzDbKDKmsY87k3PsQ2knmC1'),
};
const tridentQuery = gql`
diff --git a/projects/sushiswap-furo/furo.js b/projects/sushiswap-furo/furo.js
index cfecc8d7bd..a299c787c6 100644
--- a/projects/sushiswap-furo/furo.js
+++ b/projects/sushiswap-furo/furo.js
@@ -5,23 +5,23 @@ const { isWhitelistedToken } = require('../helper/streamingHelper')
const graphUrls = {
ethereum:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-ethereum",
+ sdk.graph.modifyEndpoint('D8vYJpKN5SEHUkUWKSuorsL6FRt7hAQMnywnC4e93ygf'),
polygon:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-polygon",
- fantom: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-fantom",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-avalanche",
+ sdk.graph.modifyEndpoint('4KsDNsyJjKX6bjwVNJQmJ7Dm3wovYXSX37UR39rNaMX4'),
+ fantom: sdk.graph.modifyEndpoint('E98zSR5UZBGBgQe2SSLZ5R6yj5GPqKDJcQJNDHTeV3cS'),
+ bsc: sdk.graph.modifyEndpoint('2wBYezghRA3hEJLQB4njUZGDNxCdU3u2gsLP5yVvBqKk'),
+ avax: sdk.graph.modifyEndpoint('8LVoX3JPEVAak8T8GoEfdJudMoP2bsGwd9tszJxo3Rnx'),
arbitrum:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-arbitrum",
+ sdk.graph.modifyEndpoint('8eHhPeKDr646JH5KUBBcabAJzkWmLfu6pqBtpXQHa37F'),
optimism:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-optimism",
- xdai: "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-gnosis",
+ sdk.graph.modifyEndpoint('8KnsmppMf9k6Qvyixxwmny7dYugTV7XT4htHTfyq3d69'),
+ xdai: sdk.graph.modifyEndpoint('5ToxB5xubMh9osdEDeX98JBAyzUVwkReGXAT1CzQhZCB'),
harmony:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-harmony",
+ sdk.graph.modifyEndpoint('9D9C3ppoDE1zuZk5adznngKomLYS8NnC9zxniSS8vzgH'),
moonbeam:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonbeam",
+ sdk.graph.modifyEndpoint('HJxpcsmaPV3L6PsqGFBHLczeMnL7bEgmL1D65edGx8pf'),
moonriver:
- "https://api.thegraph.com/subgraphs/name/sushi-subgraphs/furo-moonriver",
+ sdk.graph.modifyEndpoint('9ZqdKjfu7o9dX1RThXHDV9EqMn5CTvgpsPKKbpANg8yC'),
};
const bentoboxes = {
diff --git a/projects/sushiswap-kashi/kashi-lending.js b/projects/sushiswap-kashi/kashi-lending.js
index 2b1498f35a..5fce7a5730 100644
--- a/projects/sushiswap-kashi/kashi-lending.js
+++ b/projects/sushiswap-kashi/kashi-lending.js
@@ -1,12 +1,13 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
const { blockQuery } = require("../helper/http");
const graphUrls = {
- ethereum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-ethereum",
- polygon: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-polygon",
- arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-arbitrum",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-labs/kashi-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushiswap/kashi-avalanche",
+ ethereum: sdk.graph.modifyEndpoint('6Kf5cPeXUMVzfGCtzBnSxDU849w2YM2o9afn1uiPpy2m'),
+ polygon: sdk.graph.modifyEndpoint('5F3eB4Cm5mxorArsyrbs2a1TDxctmk3znpDZ4LEzqrBJ'),
+ arbitrum: sdk.graph.modifyEndpoint('G3rbmaF7w2ZLQjZgGoi12BzPeL9z4MTW662iVyjYmtiX'),
+ bsc: sdk.graph.modifyEndpoint('D1TGHRKx2Q54ce2goyt9hbtKNuT94FDBsuPwtGg5EzRw'),
+ avax: sdk.graph.modifyEndpoint('BHeJByyVoNuVtqufK3Nk7YYmFkBs43boYpKv8z6hQ5Q1'),
};
const bentoboxes = {
diff --git a/projects/sushiswap-trident/trident.js b/projects/sushiswap-trident/trident.js
index ce68092fa4..4e7b29cb88 100644
--- a/projects/sushiswap-trident/trident.js
+++ b/projects/sushiswap-trident/trident.js
@@ -1,18 +1,19 @@
+const sdk = require("@defillama/sdk");
const { blockQuery } = require('../helper/http')
const graphUrls = {
- polygon: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-polygon",
+ polygon: sdk.graph.modifyEndpoint('BSdbRfU6PjWSdKjhpfUQ6EgUpzMxgpf5c1ugaVwBJFsQ'),
polygonOldRouter:
- "https://api.thegraph.com/subgraphs/name/sushi-0m/trident-polygon",
- optimism: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-optimism",
+ sdk.graph.modifyEndpoint('5LBvcUQthQDZTMe6cyJ7DbeokFkYeVpYYBZruHPUjMG5'),
+ optimism: sdk.graph.modifyEndpoint('FEgRuH9zeTRMZgpVv5YavoFEcisoK6KHk3zgQRRBqt51'),
kava: "https://pvt.graph.kava.io/subgraphs/name/sushi-v2/trident-kava",
metis:
"https://andromeda.thegraph.metis.io/subgraphs/name/sushi-v2/trident-metis",
bittorrent:
"https://subgraphs.sushi.com/subgraphs/name/sushi-v2/trident-bttc",
- arbitrum: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-arbitrum",
- bsc: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/sushi-v2/trident-avalanche",
+ arbitrum: sdk.graph.modifyEndpoint('4x8H6ZoGfJykyZqAe2Kx2g5afsp17S9pn8GroRkpezhx'),
+ bsc: sdk.graph.modifyEndpoint('9TQaBw1sU3wi2kdevuygKhfhjP3STnwBe1jUnKxmNhmn'),
+ avax: sdk.graph.modifyEndpoint('NNTV3MgqSGtHMBGdMVLXzzDbKDKmsY87k3PsQ2knmC1'),
};
const tridentQueryWithBlock = `
diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js
index 93f9064367..810caad401 100644
--- a/projects/sushiswap-v3/index.js
+++ b/projects/sushiswap-v3/index.js
@@ -3,6 +3,24 @@ const { cachedGraphQuery, getConfig, } = require('../helper/cache');
const { sumTokens2 } = require("../helper/unwrapLPs");
const factory = "0xc35dadb65012ec5796536bd9864ed8773abc74c4"
+/*
+Arbitrum: https://thegraph.com/explorer/subgraphs/96EYD64NqmnFxMELu2QLWB95gqCmA9N96ssYsZfFiYHg
+Avalanche: https://thegraph.com/explorer/subgraphs/4BxsTB5ADnYdgJgdmzyddmnDGCauctDia28uxB1hgTBE
+Base: https://thegraph.com/explorer/subgraphs/Cz4Snpih41NNNPZcbj1gd3fYXPwFr5q92iWMoZjCarEb
+Boba: https://thegraph.com/explorer/subgraphs/71VWMKCvsWRqrJouxmEQwSEMqqnqiiVYSxTZvzR8PHRx
+BSC: https://thegraph.com/explorer/subgraphs/FiJDXMFCBv88GP17g2TtPh8BcA8jZozn5WRW7hCN7cUT
+Ethereum: https://thegraph.com/explorer/subgraphs/5nnoU1nUFeWqtXgbpC54L9PWdpgo7Y9HYinR3uTMsfzs
+Fantom: https://thegraph.com/explorer/subgraphs/4BzEvR229mwKjneCbJTDM8dsS3rjgoKcXt5C7J1DaUxK
+Fuse: https://thegraph.com/explorer/subgraphs/8P62wYTJvhd6Aas656hVYhsccsGo2ihrJShaEnCoLJRK
+Gnosis: https://thegraph.com/explorer/subgraphs/GFvGfWBX47RNnvgwL6SjAAf2mrqrPxF91eA53F4eNegW
+Linea: https://thegraph.com/explorer/subgraphs/E2vqqvSzDdUiPP1r7PFnPKZQ34pAhNZjc6rEcdj3uE5t
+Moonriver: https://thegraph.com/explorer/subgraphs/F46W9YVQXGism5iN9NZNhKm2DQCvjhr4u847rL1tRebS
+Optimism: https://thegraph.com/explorer/subgraphs/Dr3FkshPgTMMDwxckz3oZdwLxaPcbzZuAbE92i6arYtJ
+Polygon: https://thegraph.com/explorer/subgraphs/CqLnQY1d6DLcBYu7aZvGmt17LoNdTe4fDYnGbE2EgotR
+PolygonZkEVM: https://thegraph.com/explorer/subgraphs/E2x2gmtYdm2HX3QXorUBY4KegfGu79Za6TEQYjVrx15c
+Scroll: https://thegraph.com/explorer/subgraphs/5gyhoHx768oHn3GxsHsEc7oKFMPFg9AH8ud1dY8EirRc
+*/
+
module.exports = uniV3Export({
ethereum: {
factory: "0xbACEB8eC6b9355Dfc0269C18bac9d6E2Bdc29C4F",
@@ -72,17 +90,20 @@ module.exports = uniV3Export({
kava: { factory: '0x1e9B24073183d5c6B7aE5FB4b8f0b1dd83FDC77a', fromBlock: 7251753, },
metis: { factory: '0x145d82bCa93cCa2AE057D1c6f26245d1b9522E6F', fromBlock: 9077930, },
bittorrent: { factory: '0xBBDe1d67297329148Fe1ED5e6B00114842728e65', fromBlock: 29265724, },
- zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, },
+ //zeta: { factory: '0xB45e53277a7e0F1D35f2a77160e91e25507f1763', fromBlock: 1551069, },
islm: { factory, fromBlock: 6541826, },
blast: { factory: '0x7680d4b43f3d1d54d6cfeeb2169463bfa7a6cf0d', fromBlock: 284122, },
+ //europa: { factory: '0x51d15889b66A2c919dBbD624d53B47a9E8feC4bB', fromBlock: 5124251, },
+ rsk: { factory: '0x46B3fDF7B5cde91Ac049936bF0Bdb12C5D22202E', fromBlock: 6365060, }, //this one
});
const config = {
filecoin: { endpoint: 'https://sushi.laconic.com/subgraphs/name/sushiswap/v3-filecoin' },
+ europa: { endpoint: 'https://elated-tan-skat-graph.skalenodes.com:8000/subgraphs/name/sushi/v3-skale-europa' },
}
const query = `{
- pools {
+ pools(first:1000) {
id
token0 { id }
token1 { id }
@@ -102,6 +123,7 @@ Object.keys(config).forEach(chain => {
const config1 = {
islm: { endpoint: 'https://evm-qwhwlq6ji.sushi.com/pool/api/pools?chainIds=11235&isWhitelisted=true&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3' },
+ // europa: { endpoint: 'https://web-8ngym4vde.sushi.com/pool/api/pools?chainIds=2046399126&isWhitelisted=true&orderBy=liquidityUSD&orderDir=desc&protocols=SUSHISWAP_V3,SUSHISWAP_V2' },
}
Object.keys(config1).forEach(chain => {
diff --git a/projects/sushiswap/api.js b/projects/sushiswap/api.js
index 02737ea89f..1efce7786f 100644
--- a/projects/sushiswap/api.js
+++ b/projects/sushiswap/api.js
@@ -1,8 +1,35 @@
+const sdk = require("@defillama/sdk");
const { toUSDTBalances } = require('../helper/balances');
const { blockQuery } = require('../helper/http')
const { getUniTVL } = require("../helper/unknownTokens")
-const graphUrl = 'https://api.thegraph.com/subgraphs/name/zippoxer/sushiswap-subgraph-fork'
+
+/*
+Arbitrum: https://thegraph.com/explorer/subgraphs/8yBXBTMfdhsoE5QCf7KnoPmQb7QAWtRzESfYjiCjGEM9
+Avalanche: https://thegraph.com/explorer/subgraphs/5DpWu6oLUEwKYLcya5fJf3MW5CE6yEMnZ8iwekmTNAbV
+Base: https://thegraph.com/explorer/subgraphs/7pXNLCc12pRM3bBPUAP9ZoEvkgUCjaBe9QC3DV9L2qzE
+Boba: https://thegraph.com/explorer/subgraphs/9cssJAh4EyzEWqZySBFguiXyygwZZAGBE3ETsGetNUK
+BSC: https://thegraph.com/explorer/subgraphs/24xqSifM5xPfGrW8MDwRhgaDsq7uaP2762fmxjyxJzot
+CELO: https://thegraph.com/explorer/subgraphs/8WcZLSs8QUSJptPbpBScoDafmp8E9whnSqYJc9TMyYFs
+Ethereum: https://thegraph.com/explorer/subgraphs/GyZ9MgVQkTWuXGMSd3LXESvpevE8S8aD3uktJh7kbVmc
+Fantom: https://thegraph.com/explorer/subgraphs/J7wEPt9nDHCno143dk6whAUesPyszxPqCDKhqDqWJHuz
+Fuse: https://thegraph.com/explorer/subgraphs/FrcJbZ3j9GZ3vF8G9uVEFQZeTD8uiCc1A1eujtxYUwYH
+Gnosis: https://thegraph.com/explorer/subgraphs/7czeiia7ZXvsW45szX2w8EK1ZNgZWZET83zYCwE6JT9x
+Harmony: https://thegraph.com/explorer/subgraphs/3k9M7aZqeJXWLUogc2FSFBgXuxej2qstKSUNBXcPCcK5
+Linea: https://thegraph.com/explorer/subgraphs/G4sRz1YAcEFYFewGLQ9bt76gQuP1oyuzhVSTvs9bj7qn
+Moonbeam: https://thegraph.com/explorer/subgraphs/6MMVBsG9hgS8BzLZfPnU8KJdGiEFbd3CyNXVG6gQKCdQ
+Moonriver: https://thegraph.com/explorer/subgraphs/DuB755c1VYFSLLhq4b783ryPcvYdsvimGuZzBpFqoapX
+Optimism: https://thegraph.com/explorer/subgraphs/4KvWjKY89DefJ6mPMASCTUDAZ6dyHSu7osCNQqaaaY3y
+Polygon: https://thegraph.com/explorer/subgraphs/8obLTNcEuGMieUt6jmrDaQUhWyj2pys26ULeP3gFiGNv
+PolygonZkEVM: https://thegraph.com/explorer/subgraphs/6QS4nmWq9Wv6WPQRk1F7RJnnKcAcUBhzaiF9ZHfkUcp4
+Scroll: https://thegraph.com/explorer/subgraphs/CiW3nquNZjKDoMfR4TbSpB4ox8Pq66FDxwSsohigSdxw
+*/
+
+const graphEndpoints = {
+ polygon: sdk.graph.modifyEndpoint('8obLTNcEuGMieUt6jmrDaQUhWyj2pys26ULeP3gFiGNv')
+}
+
+const graphUrl = sdk.graph.modifyEndpoint('8TXwDMLemg6p4eicVuixKk7Mw9aNxpod1PQQFdSvFj6H')
const graphQuery = `
query get_tvl($block: Int) {
uniswapFactory(
@@ -16,17 +43,17 @@ query get_tvl($block: Int) {
`;
const graphQueryPolygon = `
query get_tvl($block: Int) {
- factory(
+ uniswapFactory(
id: "0xc35dadb65012ec5796536bd9864ed8773abc74c4",
block: { number: $block }
) {
- liquidityUSD
+ totalLiquidityUSD
}
}
`;
async function eth(api) {
- const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, });
+ const { uniswapFactory } = await blockQuery(graphUrl, graphQuery, { api, blockCatchupLimit: 1000 });
const usdTvl = Number(uniswapFactory.totalLiquidityUSD)
return toUSDTBalances(usdTvl)
@@ -34,8 +61,11 @@ async function eth(api) {
function getChainTVL() {
return async (api) => {
- const { factory } = await blockQuery('https://api.thegraph.com/subgraphs/name/sushiswap/exchange-' + api.chain, graphQueryPolygon, { api, });
- const usdTvl = Number(factory.liquidityUSD)
+ let endpoint = graphEndpoints[api.chain]
+ if (!endpoint) throw new Error('Missing graph endpoint')
+
+ const { factory } = await blockQuery(endpoint, graphQueryPolygon, { api, blockCatchupLimit: 1000 });
+ const usdTvl = Number(factory.totalLiquidityUSD)
return toUSDTBalances(usdTvl)
}
@@ -67,7 +97,7 @@ module.exports = {
bsc: { tvl, },
heco: { tvl, },
boba: { tvl, },
- boba_avax: { tvl, },
+ //boba_avax: { tvl, },
boba_bnb: { tvl, },
avax: { tvl, },
fuse: {
@@ -95,9 +125,17 @@ module.exports = {
},
blast: { tvl: getUniTVL({ factory: '0x42Fa929fc636e657AC568C0b5Cf38E203b67aC2b', useDefaultCoreAssets: true, }) },
core: { tvl: tvl2 },
+ rsk: { tvl: tvl2 },
+ europa: { tvl: getUniTVL({ factory: '0x1aaF6eB4F85F8775400C1B10E6BbbD98b2FF8483', useDefaultCoreAssets: true, }) },
+ moonbeam: { tvl: getUniTVL({ factory: '0xc35DADB65012eC5796536bD9864eD8773aBc74C4', useDefaultCoreAssets: true, }) },
+ polygon_zkevm: { tvl: tvl2 },
+ optimism: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) },
+ linea: { tvl: getUniTVL({ factory: '0xFbc12984689e5f15626Bad03Ad60160Fe98B303C', useDefaultCoreAssets: true, }) },
+ thundercore: { tvl: tvl2 },
+ islm: { tvl: tvl2 },
}
-module.exports.polygon.tvl = getChainTVL('polygon')
+// module.exports.polygon.tvl = getChainTVL('polygon')
// module.exports.bsc.tvl = getChainTVL('bsc')
// module.exports.fantom.tvl = getChainTVL('fantom')
// module.exports.harmony.tvl = getChainTVL('harmony')
diff --git a/projects/sushiswap/index.js b/projects/sushiswap/index.js
index 4a4ea92d3f..3739a6b487 100644
--- a/projects/sushiswap/index.js
+++ b/projects/sushiswap/index.js
@@ -17,6 +17,4 @@ module.exports = indexExports
module.exports.misrepresentedTokens = true
module.exports.ethereum.staking = staking(xSUSHI, SUSHI)
-// node test.js projects/sushiswap/index.js
-
-module.exports.boba_avax.tvl = () => ({}) // boba avax is sunset
\ No newline at end of file
+// node test.js projects/sushiswap/index.js
\ No newline at end of file
diff --git a/projects/swaap-earn/index.js b/projects/swaap-earn/index.js
index 1cff804f37..f9be8debc3 100644
--- a/projects/swaap-earn/index.js
+++ b/projects/swaap-earn/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const query = `query FundsTVL{ funds { id } }`
@@ -6,7 +7,8 @@ module.exports = {
}
const config = {
- arbitrum: { endpoint: 'https://api.thegraph.com/subgraphs/name/borelien/swaap-earn-arbitrum-test', },
+ arbitrum: { endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaap-earn-arbitrum/1.0.0/gn', },
+ ethereum: { endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaap-earn-ethereum/1.0.0/gn', },
}
Object.keys(config).forEach(chain => {
diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js
index 0b4ad43ee0..c2a7fecc92 100644
--- a/projects/swaap-v2/index.js
+++ b/projects/swaap-v2/index.js
@@ -6,8 +6,12 @@ const {onChainTvl} = require("../helper/balancer");
*/
const config = {
ethereum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 17598578, },
- arbitrum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 137451745,},
+ arbitrum: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 137451745, permitFailure: true },
polygon: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 44520023,},
+ optimism: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 120693792, },
+ bsc: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 39148730,},
+ base: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 14451361,},
+ mode: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 7242549,},
}
/**
@@ -18,8 +22,8 @@ const config = {
Object.keys(config).forEach(chain => {
- const { vault, fromBlock } = config[chain]
+ const { vault, fromBlock, permitFailure } = config[chain]
module.exports[chain] = {
- tvl: onChainTvl(vault, fromBlock)
+ tvl: onChainTvl(vault, fromBlock, { permitFailure })
}
})
\ No newline at end of file
diff --git a/projects/swaap/index.js b/projects/swaap/index.js
index 83cb7a77a2..0744bbe62c 100644
--- a/projects/swaap/index.js
+++ b/projects/swaap/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { sumTokens2 } = require('../helper/unwrapLPs')
const { cachedGraphQuery } = require('../helper/cache')
@@ -6,7 +7,7 @@ const configV1 = {
startBlock: 29520285,
blockDelay: 30,
theGraph: {
- endpoint: 'https://api.thegraph.com/subgraphs/name/swaap-labs/swaapv1',
+ endpoint: 'https://api.goldsky.com/api/public/project_clws2t7g7ae9c01xsbnu80a51/subgraphs/swaapv1/1.0.0/gn',
query: `pools: pools(orderBy: liquidity, orderDirection: desc) {
id
tokens {
diff --git a/projects/swapline/index.js b/projects/swapline/index.js
index a7d6bf69ae..0e6c329e37 100644
--- a/projects/swapline/index.js
+++ b/projects/swapline/index.js
@@ -1,62 +1,17 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { joeV2Export } = require('../helper/traderJoeV2')
-const factories = {
+module.exports = joeV2Export({
fantom: '0x640801a6983c109805E928dc7d9794080C21C88E',
optimism: '0xd08C98F6409fCAe3E61f3157B4147B6595E60cf3',
polygon_zkevm: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496',
arbitrum: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa',
base: '0x5A5c0C4832828FF878CE3ab4fEc44d21200b1496',
shimmer_evm: '0xEE0616a2DEAa5331e2047Bc61E0b588195A49cEa',
-}
-async function tvl(api) {
- let blacklistedTokens = []
- if (api.chain === 'fantom') blacklistedTokens = ['0xdc6ff44d5d932cbd77b52e5612ba0529dc6226f1']
- const pools = await api.fetchList({
- target: factories[api.chain],
- itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)',
- lengthAbi: 'uint256:getNumberOfLBPairs',
- })
- const tokenA = await api.multiCall({
- abi: 'address:getTokenX',
- calls: pools,
- })
- const tokenB = await api.multiCall({
- abi: 'address:getTokenY',
- calls: pools,
- })
- const toa = []
- tokenA.map((_, i) => {
- toa.push([tokenA[i], pools[i]])
- toa.push([tokenB[i], pools[i]])
- })
- return sumTokens2({...api, tokensAndOwners: toa, blacklistedTokens,})
-}
+})
-module.exports = {
- hallmarks: [
- [1682298000,"Launch on Optimism"],
- [1687827600,"Launch on Polygon zkEVM"],
- [1689037200,"Launch on Arbitrum"],
- [1690848000,"Launch on Base"],
- [1702857600,"Launch on ShimmerEVM"]
- ],
- methodology: 'We count the token balances in different liquidity book contracts',
- fantom:{
- tvl,
- },
- optimism:{
- tvl,
- },
- polygon_zkevm:{
- tvl,
- },
- arbitrum:{
- tvl,
- },
- base:{
- tvl,
- },
- shimmer_evm: {
- tvl,
- },
-};
\ No newline at end of file
+module.exports.hallmarks = [
+ [1682298000, "Launch on Optimism"],
+ [1689037200, "Launch on Arbitrum"],
+ [1690848000, "Launch on Base"],
+ [1702857600, "Launch on ShimmerEVM"]
+]
\ No newline at end of file
diff --git a/projects/swell-l2-farm/index.js b/projects/swell-l2-farm/index.js
index 815a7d4baa..858c8e3d4c 100644
--- a/projects/swell-l2-farm/index.js
+++ b/projects/swell-l2-farm/index.js
@@ -30,11 +30,11 @@ module.exports = {
"0x6ee2b5E19ECBa773a352E5B21415Dc419A700d1d",
"0xac440d0eE23FA69632Aa731322C2a480dD1376e4",
"0x330c4DD05dB16db6323505262C57CFdE5f0A78Ea",
- "0x4c9EDD5852cd905f086C759E8383e09bff1E68B3",
- "0x853d955aCEf822Db058eb8505911ED77F175b99e",
+ ADDRESSES.ethereum.USDe,
+ ADDRESSES.ethereum.FRAX,
"0xA663B02CF0a4b149d2aD41910CB81e23e1c41c32",
"0x5E8422345238F34275888049021821E8E08CAa1f",
- "0xac3E018457B222d93114458476f3E3416Abbe38F",
+ ADDRESSES.ethereum.sfrxETH,
"0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9",
"0xf7906F274c174A52d444175729E3fa98f9bde285"
]
diff --git a/projects/swim/config.js b/projects/swim/config.js
deleted file mode 100644
index 68dc4e7723..0000000000
--- a/projects/swim/config.js
+++ /dev/null
@@ -1,122 +0,0 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-module.exports = {
- solana: {
- tvl: {
- pools: [
- {
- pool: 'AfhhYsLMXXyDxQ1B7tNqLTXXDHYtDxCzPcnXWXzHAvDb', // Hexapool
- tokens: [
- ADDRESSES.solana.USDC, // Solana-USDC
- ADDRESSES.solana.USDT, // Solana-USDT
- 'A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM', // Eth-USDC
- 'Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1', // Eth-USDT
- ADDRESSES.solana.BUSDbs, // Bsc-BUSD
- ADDRESSES.solana.USDTbs, // Bsc-USDT
- ],
- symbols: [
- "usd-coin",
- "tether",
- "usd-coin",
- "tether",
- "binance-usd",
- "tether",
- ],
- },
- {
- pool: 'Ha7YEA5wRWyH2htfyMXw3VfLbtBHm4UoVXMpq8Ev6zJh', // Meta Avax-USDC
- tokens: [
- 'FHfba3ov5P3RjaiLVgh8FTv4oirxQDoVXuoUUDvHuXax', // Avax-USDC
- ],
- symbols: [
- "usd-coin",
- ],
- },
- {
- pool: 'EpvBni7vTfbTG95zf9sNcS9To1NEKnVMpCwZdb21tKsg', // Meta Avax-USDT
- tokens: [
- 'Kz1csQA91WUGcQ2TB3o5kdGmWmMGp8eJcDEyHzNDVCX', // Avax-USDT
- ],
- symbols: [
- "tether",
- ],
- },
- {
- pool: '2iLTifF3JDP65AjFKZ3t4mgfJdQVSmVCiM8Zca3TgvpU', // Meta Polygon-USDC
- tokens: [
- 'E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M', // Polygon-USDC
- ],
- symbols: [
- "usd-coin",
- ],
- },
- {
- pool: '3uxBU3fRZzp3V7v9MTNZiDmjxDkKh3rZutLwFtnjJ2pQ', // Meta Polygon-USDT
- tokens: [
- '5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1', // Polygon-USDT
- ],
- symbols: [
- "tether",
- ],
- },
- {
- pool: '57k3vNmCivSYn7EwQNjcNFcCWAdohZ9xACfMhJGwKiBq', // GSTBNB-GSTSOL
- tokens: [
- 'GDuUFXEhUm4jG71vPxYRX3VxUMJ5etGvHTR1iKwTdb6p', // GSTBNB
- 'AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB', // GSTSOL
- ],
- symbols: [
- "green-satoshi-token-bsc",
- "green-satoshi-token",
- ]
- },
- {
- pool: 'HZr3bF8YEJWMV75Wi3aFEHEyLLk61VyQduXtunWtXNVQ', // GMTBNB-GMTSOL
- tokens: [
- '7dzFD8xQ3FDmVLxwn75UA9WhVnBsUdRAexASVvpXX3Bo', // GMTBNB
- '7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx', // GMTSOL
- ],
- symbols: [
- "stepn",
- "stepn",
- ],
- },
- {
- pool: 'DqTF8aZu63iHF55tBz1ePuaBKJ3F2srNVha3B4PpCT4N', // Meta Aurora-USDC
- tokens: [
- '9Y8pJhF8AQGBGL5PTd12P4w82n2qAADTmWakkXSatdAu', // Aurora-USDC
- ],
- symbols: [
- "usd-coin",
- ],
- },
- {
- pool: '23CU3bqMJoRTpvyti84CmPbkAyNJDnTZE7DYj6MnhGdK', // Meta Aurora-USDT
- tokens: [
- 'GFhej2oJ1NPLbzSX3D3B9jzYaidff6NoBAUNmu6dLXwU', // Aurora-USDT
- ],
- symbols: [
- "tether",
- ],
- },
- {
- pool: 'H7BkMwbJfLiWE9sSDATHTqXykm1xBjeRzzLDatW2QdEt', // Meta Fantom-USDC
- tokens: [
- 'Dnr8fDaswHtYMSKbtR9e8D5EadyxqyJwE98xp17ZxE2E', // Fantom-USDC
- ],
- symbols: [
- "usd-coin",
- ],
- },
- {
- pool: '4XQz1qHMMTkFETn5PSNyLVutYPyZ4han8RB8Mmw1G48Q', // Meta Karura-USDT
- tokens: [
- 'E942z7FnS7GpswTvF5Vggvo7cMTbvZojjLbFgsrDVff1', // Karura-USDT
- ],
- symbols: [
- "tether",
- ],
- },
- ],
- }
- },
- }
\ No newline at end of file
diff --git a/projects/swim/index.js b/projects/swim/index.js
index de5fa972a0..0cce916e1b 100644
--- a/projects/swim/index.js
+++ b/projects/swim/index.js
@@ -1,26 +1,21 @@
-const { sumTokensUnknown, } = require("../helper/solana")
-const config = require("./config")
+const { sumTokens2, } = require("../helper/solana")
-const tokensAndAccounts = [];
-
-Object.values(config).forEach((chain) => {
- Object.values(chain).forEach((tvl) => {
- Object.values(tvl).forEach((pools) => {
- Object.values(pools).forEach((pool) => {
- Object.values(pool.tokens).forEach((token, i) => {
- tokensAndAccounts.push([
- token,
- pool.pool,
- pool.symbols[i],
- ])
- });
- })
- })
- })
-});
+const owners = [
+ 'AfhhYsLMXXyDxQ1B7tNqLTXXDHYtDxCzPcnXWXzHAvDb', // Hexapool
+ 'Ha7YEA5wRWyH2htfyMXw3VfLbtBHm4UoVXMpq8Ev6zJh', // Meta Avax-USDC
+ 'EpvBni7vTfbTG95zf9sNcS9To1NEKnVMpCwZdb21tKsg', // Meta Avax-USDT
+ '2iLTifF3JDP65AjFKZ3t4mgfJdQVSmVCiM8Zca3TgvpU', // Meta Polygon-USDC
+ '3uxBU3fRZzp3V7v9MTNZiDmjxDkKh3rZutLwFtnjJ2pQ', // Meta Polygon-USDT
+ '57k3vNmCivSYn7EwQNjcNFcCWAdohZ9xACfMhJGwKiBq', // GSTBNB-GSTSOL
+ 'HZr3bF8YEJWMV75Wi3aFEHEyLLk61VyQduXtunWtXNVQ', // GMTBNB-GMTSOL
+ 'DqTF8aZu63iHF55tBz1ePuaBKJ3F2srNVha3B4PpCT4N', // Meta Aurora-USDC
+ '23CU3bqMJoRTpvyti84CmPbkAyNJDnTZE7DYj6MnhGdK', // Meta Aurora-USDT
+ 'H7BkMwbJfLiWE9sSDATHTqXykm1xBjeRzzLDatW2QdEt', // Meta Fantom-USDC
+ '4XQz1qHMMTkFETn5PSNyLVutYPyZ4han8RB8Mmw1G48Q', // Meta Karura-USDT
+]
async function tvl() {
- return sumTokensUnknown(tokensAndAccounts);
+ return sumTokens2({ owners });
}
module.exports = {
diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js
index fb87780cda..bc211d0e2e 100644
--- a/projects/symbiosis-finance/config.js
+++ b/projects/symbiosis-finance/config.js
@@ -1,5 +1,41 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const XDAO = '0x71eebA415A523F5C952Cc2f06361D5443545Ad28'
+
+const TOKENS = {
+ ethereum: {
+ pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72",
+ LADYS: "0x12970E6868f88f6557B76120662c1B3E50A646bf",
+ XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28"
+ },
+ bsc: {
+ XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28"
+ },
+ polygon: {
+ XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28"
+ },
+ arbitrum: {
+ XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28",
+ LADYS: "0x3b60FF35D3f7F62d636b067dD0dC0dFdAd670E4E"
+ },
+ manta: {
+ pufETH: "0xA53E005Cecd3D7C89A4AE814617cC14828b6527E"
+ },
+ scroll: {
+ pufETH: "0xc4d46E8402F476F269c379677C99F18E22Ea030e"
+ },
+ zeta: {
+ pufETH: "0x1e4bF3CaBD7707089138dD5a545B077413FA83Fc"
+ },
+ zklink: {
+ pufETH: "0x1B49eCf1A8323Db4abf48b2F5EFaA33F7DdAB3FC"
+ },
+ cronos: {
+ USDC: ADDRESSES.cronos.USDC
+ },
+ fraxtal: {
+ WETH: ADDRESSES.fraxtal.WETH,
+ FRAX: ADDRESSES.fraxtal.FRAX
+ }
+}
module.exports = {
chains: [
@@ -10,8 +46,10 @@ module.exports = {
ADDRESSES.ethereum.USDT,
ADDRESSES.ethereum.WETH,
ADDRESSES.ethereum.WBTC,
- XDAO,
- '0x12970E6868f88f6557B76120662c1B3E50A646bf', // LADYS
+ ADDRESSES.ethereum.FRAX,
+ TOKENS.ethereum.XDAO,
+ TOKENS.ethereum.LADYS,
+ TOKENS.ethereum.pufETH,
],
holders: [
'0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1
@@ -26,7 +64,7 @@ module.exports = {
ADDRESSES.bsc.USDC,
ADDRESSES.bsc.ETH,
ADDRESSES.bsc.BTCB,
- XDAO,
+ TOKENS.bsc.XDAO,
],
holders: [
'0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1
@@ -53,7 +91,8 @@ module.exports = {
tokens: [
ADDRESSES.polygon.USDC,
ADDRESSES.polygon.WETH_1,
- XDAO,
+ ADDRESSES.polygon.FRAX,
+ TOKENS.polygon.XDAO,
],
holders: [
'0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1
@@ -145,8 +184,9 @@ module.exports = {
ADDRESSES.arbitrum.USDC, // USDC.e
ADDRESSES.arbitrum.USDC_CIRCLE,
ADDRESSES.arbitrum.WETH,
- XDAO,
- '0x3b60FF35D3f7F62d636b067dD0dC0dFdAd670E4E', // LADYS
+ ADDRESSES.arbitrum.FRAX,
+ TOKENS.arbitrum.XDAO,
+ TOKENS.arbitrum.LADYS,
],
holders: [
'0x01A3c8E513B758EBB011F7AFaf6C37616c9C24d9', // portal v2
@@ -230,6 +270,7 @@ module.exports = {
tokens: [
ADDRESSES.scroll.WETH,
ADDRESSES.scroll.USDC,
+ TOKENS.scroll.pufETH,
],
holders: [
'0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2
@@ -241,6 +282,7 @@ module.exports = {
tokens: [
ADDRESSES.manta.WETH,
ADDRESSES.manta.USDC,
+ TOKENS.manta.pufETH,
],
holders: [
'0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2
@@ -305,6 +347,7 @@ module.exports = {
name: 'zklink',
tokens: [
ADDRESSES.zklink.WETH,
+ TOKENS.zklink.pufETH,
],
holders: [
'0x8Dc71561414CDcA6DcA7C1dED1ABd04AF474D189', // portal v2
@@ -319,5 +362,52 @@ module.exports = {
'0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2
]
},
+ {
+ name: 'taiko',
+ tokens: [
+ ADDRESSES.taiko.WETH,
+ ],
+ holders: [
+ '0x5Aa5f7f84eD0E5db0a4a85C3947eA16B53352FD4', // portal v2
+ ]
+ },
+ {
+ name: 'sei',
+ tokens: [
+ ADDRESSES.sei.USDC,
+ ADDRESSES.sei.USDT,
+ ],
+ holders: [
+ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2
+ ]
+ },
+ {
+ name: 'zeta',
+ tokens: [
+ TOKENS.zeta.pufETH,
+ ],
+ holders: [
+ '0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf', // portal v2
+ ]
+ },
+ {
+ name: 'cronos',
+ tokens: [
+ TOKENS.cronos.USDC,
+ ],
+ holders: [
+ '0xE75C7E85FE6ADd07077467064aD15847E6ba9877', // portal v2
+ ]
+ },
+ {
+ name: 'fraxtal',
+ tokens: [
+ TOKENS.fraxtal.WETH,
+ TOKENS.fraxtal.FRAX,
+ ],
+ holders: [
+ '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2
+ ]
+ },
]
}
\ No newline at end of file
diff --git a/projects/symbiotic/index.js b/projects/symbiotic/index.js
new file mode 100644
index 0000000000..fbc2c2c316
--- /dev/null
+++ b/projects/symbiotic/index.js
@@ -0,0 +1,15 @@
+const { getLogs2 } = require('../helper/cache/getLogs')
+
+async function tvl(api) {
+ const logs = await getLogs2({ api, factory: '0x1BC8FCFbE6Aa17e4A7610F51B888f34583D202Ec', eventAbi: 'event AddEntity(address indexed entity)', fromBlock: 20011312, })
+ const COLLATERALS = logs.map(log => log.entity)
+ const tokens = await api.multiCall({ abi: 'address:asset', calls: COLLATERALS, })
+ return api.sumTokens({ tokensAndOwners2: [tokens, COLLATERALS] })
+}
+
+module.exports = {
+ start: 1718088924,
+ ethereum: {
+ tvl,
+ },
+}
diff --git a/projects/symmetry/index.js b/projects/symmetry/index.js
index 2fe73c9b23..f7911fb920 100644
--- a/projects/symmetry/index.js
+++ b/projects/symmetry/index.js
@@ -1,41 +1,9 @@
-const { getConnection, sumTokens2 } = require("../helper/solana");
-const { PublicKey } = require('@solana/web3.js')
+const { sumTokensExport } = require("../helper/solana");
const FUNDS_VAULT = 'BLBYiq48WcLQ5SxiftyKmPtmsZPUBEnDEjqEnKGAR4zx'
-const TOKEN_PROGRAM_ID = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
-
-async function tvl() {
- const connection = getConnection();
- const filters = [
- {
- dataSize: 165,
- },
- {
- memcmp: {
- offset: 32,
- bytes: FUNDS_VAULT,
- }
- }
- ];
- const accounts = await connection.getParsedProgramAccounts(
- new PublicKey(TOKEN_PROGRAM_ID),
- {filters: filters}
- )
- let balances = {};
- let tokenAccounts = [];
- accounts.forEach((account, i) => {
- const parsedAccountInfo = account.account.data;
- const mintAddress = parsedAccountInfo["parsed"]["info"]["mint"];
- const tokenBalance = parsedAccountInfo["parsed"]["info"]["tokenAmount"]["uiAmount"];
- tokenAccounts.push(account.pubkey.toString());
- balances[mintAddress] = tokenBalance;
- });
- let sum = await sumTokens2({ tokenAccounts })
- return sum;
-}
module.exports = {
timetravel: false,
solana: {
- tvl
+ tvl: sumTokensExport({ owner: FUNDS_VAULT })
},
};
\ No newline at end of file
diff --git a/projects/syncswap/index.js b/projects/syncswap/index.js
index 33d497e213..b24b4c8d10 100644
--- a/projects/syncswap/index.js
+++ b/projects/syncswap/index.js
@@ -43,19 +43,21 @@ async function tvl(api) {
const config = {
era: {
fromBlock: 9775,
- stableFactorys: ['0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3'],
- classicFactorys: ['0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb'],
- aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D']
+ stableFactorys: ['0x5b9f21d407F35b10CbfDDca17D5D84b129356ea3','0x81251524898774F5F2FCaE7E7ae86112Cb5C317f'],
+ classicFactorys: ['0xf2DAd89f2788a8CD54625C60b55cD3d2D0ACa7Cb','0x0a34FBDf37C246C0B401da5f00ABd6529d906193'],
+ aquaFactorys: ['0x20b28B1e4665FFf290650586ad76E977EAb90c5D','0xFfa499b019394d9bEB5e21FC54AD572E4942302b','0x0754870C1aAb00eDCFABDF4e6FEbDD30e90f327d']
},
linea: {
fromBlock: 716,
- stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727'],
- classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d'],
+ stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727','0x61Abf754fc031C544236053495a193f3518e9101','0x024A096bAb43587d24004C95C3e20FcB7518Ad86'],
+ classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d','0x9573994Ae6C9b35627976d26FA89e507e71FBaA2','0xb8AbaEa25E42DA5ac6897C9DAb0a8157885fE32b'],
+ aquaFactorys: ['0x7a31060d8524c21496a352BE65549eEf1e864fb0','0x1080EE857D165186aF7F8d63e8ec510C28A6d1Ea']
},
scroll: {
fromBlock: 80875,
- stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727'],
- classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d'],
+ stableFactorys: ['0xE4CF807E351b56720B17A59094179e7Ed9dD3727','0x5BEBDA7E264b03bB963CB2418f40C5ffcefb7A9e','0xA2acA673C00495A184F88De533BBa8e1b7f38D00'],
+ classicFactorys: ['0x37BAc764494c8db4e54BDE72f6965beA9fa0AC2d','0xDAEdEcF3F1Caf8d9050A0C973B77E40bA8024F69','0x76f549af692efA64952d02c075226df9878Fb54C'],
+ aquaFactorys: ['0xa033eAbcCfd9b71543E34dec43935467A230Ce2d','0x87aeb51d606056F48D241C4072f55ACd9D937018']
},
}
diff --git a/projects/synfutures-v3/index.js b/projects/synfutures-v3/index.js
index 8137beac85..ce88eaf6cd 100644
--- a/projects/synfutures-v3/index.js
+++ b/projects/synfutures-v3/index.js
@@ -1,29 +1,26 @@
-const { sumTokensExport } = require('../helper/unwrapLPs')
-const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokens2 } = require('../helper/unwrapLPs')
-const { getLogs, getAddress } = require('../helper/cache/getLogs');
-const { ethers } = require('ethers');
-
+const { getLogs2, } = require('../helper/cache/getLogs')
const config = {
- blast: { gate: '0x6A372dBc1968f4a07cf2ce352f410962A972c257', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH], fromBlock: 193856 },
+ blast: { gate: '0x6A372dBc1968f4a07cf2ce352f410962A972c257', fromBlock: 193856 },
+ base: { gate: '0x208B443983D8BcC8578e9D86Db23FbA547071270', fromBlock: 16297319 },
}
Object.keys(config).forEach(chain => {
- const { gate, tokens, fromBlock } = config[chain]
+ const { gate, fromBlock } = config[chain]
module.exports[chain] = {
tvl: async (api) => {
// calculate the balance of all instruments
- const logs = await getLogs({
+ const logs = await getLogs2({
api,
target: gate,
- topics: ['0x2f642d4751a7e76430c4c9b3abe8ab9fd9ed0daa08cae14b5594765049008e02'],
fromBlock,
eventAbi: 'event NewInstrument(bytes32 index, address instrument, address base, address quote, string symbol, uint total)',
})
- const tokensAndOwners = logs.map(i => ([i.args.quote, i.args.instrument]))
- tokens.forEach(token => tokensAndOwners.push([token, gate]))
- return sumTokens2({ api, tokensAndOwners: tokensAndOwners })
+ const ownerTokens = logs.map(i => ([[i.quote], i.instrument]))
+ const allTokens = logs.map(i => i.quote)
+ ownerTokens.push([allTokens, gate])
+ return sumTokens2({ api, ownerTokens })
}
}
})
diff --git a/projects/synonym-finance/index.js b/projects/synonym-finance/index.js
index 9f2abfc94c..75f00c60cf 100644
--- a/projects/synonym-finance/index.js
+++ b/projects/synonym-finance/index.js
@@ -1,24 +1,39 @@
+const sdk = require("@defillama/sdk");
+const bytes32ToAddress = (bytes32Address) => "0x" + bytes32Address.substr(-40);
const hub = '0x1e3f1f1cA8C62aABCB3B78D87223E988Dfa3780E'
-async function tvl(api) {
- const { tokens, tokenMappings } = await getTokenInfos(api)
+async function tvl({timestamp, chain}) {
+ const api = new sdk.ChainApi({ timestamp, chain: 'arbitrum' })
+ const { tokens, tokenMappings } = await getTokenInfos(api, chain)
const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: tokens.map(token => ({ target: token, params: hub })) })
api.add(tokenMappings, bals, { skipChain: true })
return api.getBalances()
}
-async function borrowed(api) {
- const { tokens, tokenMappings } = await getTokenInfos(api)
+async function borrowed({timestamp, chain }) {
+ const api = new sdk.ChainApi({ timestamp, chain: 'arbitrum' })
+ const { tokens, tokenMappings } = await getTokenInfos(api, chain)
const bals = (await api.multiCall({ abi: "function getGlobalAmounts(address assetAddress) view returns ((uint256 deposited, uint256 borrowed))", calls: tokens, target: hub })).map(i => i.borrowed)
api.add(tokenMappings, bals, { skipChain: true })
return api.getBalances()
}
-module.exports = {
- arbitrum: { tvl, borrowed, },
-}
+const chains = [
+ 'arbitrum',
+ 'ethereum',
+ 'optimism',
+ 'base',
+ 'scroll',
+]
+
+chains.forEach(chain => {
+ module.exports[chain] = {
+ tvl,
+ borrowed
+ }
+})
-async function getTokenInfos(api) {
+async function getTokenInfos(api, requestedChain) {
const registry = await api.call({ abi: 'address:getAssetRegistry', target: hub })
const tokenBridge = await api.call({ abi: 'address:tokenBridge', target: hub })
const assets = await api.call({ abi: 'address[]:getRegisteredAssets', target: registry })
@@ -30,21 +45,32 @@ async function getTokenInfos(api) {
bridgedAssets.push(asset)
else
arbiAssets.push(asset)
-
})
+
+ if (requestedChain === 'arbitrum') {
+ return { tokens: arbiAssets, tokenMappings: arbiAssets.map(asset => 'arbitrum:' + asset) }
+ }
+
const natives = await api.multiCall({ abi: 'function nativeContract() view returns (bytes32)', calls: bridgedAssets })
const chainId = await api.multiCall({ abi: 'function chainId() view returns (uint16)', calls: bridgedAssets })
- const tokens = arbiAssets
- const tokenMappings = arbiAssets.map(asset => 'arbitrum:' + asset)
+
+ const tokens = []
+ const tokenMappings = []
+
bridgedAssets.forEach((asset, i) => {
let chain;
switch (chainId[i]) {
case '2': chain = 'ethereum'; break;
case '24': chain = 'optimism'; break;
- default: console.log('Unsupported chain ' + chainId[i]); return;
+ case '30': chain = 'base'; break;
+ case '34': chain = 'scroll'; break;
+ default: console.log('Unsupported chain ' + chainId[i] + bytes32ToAddress(natives[i])); return;
+ }
+
+ if (chain === requestedChain) {
+ tokens.push(asset)
+ tokenMappings.push(chain + ':' + bytes32ToAddress(natives[i]))
}
- tokenMappings.push(chain + ':' + "0x" + BigInt(natives[i]).toString(16))
- tokens.push(asset)
})
return { tokens, tokenMappings }
diff --git a/projects/synthetify/index.js b/projects/synthetify/index.js
index 79bb4c22d9..795e3329dc 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/synthetix-v3/index.js b/projects/synthetix-v3/index.js
index f756e24a03..168346a3d0 100644
--- a/projects/synthetix-v3/index.js
+++ b/projects/synthetix-v3/index.js
@@ -4,5 +4,8 @@ const ADDRESSES = require('../helper/coreAssets.json')
module.exports = {
base: {
tvl: sumTokensExport({ owner: '0x32C222A9A159782aFD7529c87FA34b96CA72C696', tokens: [ADDRESSES.base.USDC] })
+ },
+ arbitrum: {
+ tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDe] })
}
}
diff --git a/projects/synthetix/api.js b/projects/synthetix/api.js
index 1850690eed..1e5cc6072d 100644
--- a/projects/synthetix/api.js
+++ b/projects/synthetix/api.js
@@ -1,5 +1,5 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require('@defillama/sdk');
const BigNumber = require('bignumber.js');
const abi = require('./abi.json');
const { getBlock } = require('../helper/http');
@@ -26,8 +26,8 @@ const synthetixs = {
optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4'
}
const snxGraphEndpoints = {
- ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum',
- optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis'
+ ethereum: sdk.graph.modifyEndpoint('2chLKUMdvBJEbrceCdvCF8VGB1xQ3Ytbyujj9Rw3WyKY'),
+ optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN')
}
const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c"
const weth = ADDRESSES.ethereum.WETH
diff --git a/projects/synthetix/apiCache.js b/projects/synthetix/apiCache.js
index 735e61a8fd..9280915254 100644
--- a/projects/synthetix/apiCache.js
+++ b/projects/synthetix/apiCache.js
@@ -1,5 +1,5 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require('@defillama/sdk');
const BigNumber = require('bignumber.js');
const abi = require('./abi.json');
const { getBlock } = require('../helper/http');
@@ -29,8 +29,8 @@ const synthetixs = {
optimism: '0x8700daec35af8ff88c16bdf0418774cb3d7599b4'
}
const snxGraphEndpoints = {
- ethereum: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-ethereum',
- optimism: 'https://api.thegraph.com/subgraphs/name/0xngmi/snx-lite-optimism-regenesis'
+ ethereum: sdk.graph.modifyEndpoint('2chLKUMdvBJEbrceCdvCF8VGB1xQ3Ytbyujj9Rw3WyKY'),
+ optimism: sdk.graph.modifyEndpoint('5NQi9n4ztd8M6EEDFKA6gwcCnbLdmzZRymiDbPkbjEWN')
}
const ethStaking = "0xc1aae9d18bbe386b102435a8632c8063d31e747c"
const weth = ADDRESSES.ethereum.WETH
diff --git a/projects/tachyswap/index.js b/projects/tachyswap/index.js
new file mode 100644
index 0000000000..582afc546d
--- /dev/null
+++ b/projects/tachyswap/index.js
@@ -0,0 +1,12 @@
+const { getUniTVL } = require('../helper/unknownTokens')
+
+module.exports = {
+ misrepresentedTokens: true,
+ etlk: {
+ tvl: getUniTVL({
+ fetchBalances: true,
+ useDefaultCoreAssets: true,
+ factory: '0x033eff22bC5Bd30c597e1fdE8Ca6fB1C1274C688',
+ })
+ }
+}
\ No newline at end of file
diff --git a/projects/taffy/index.js b/projects/taffy/index.js
new file mode 100644
index 0000000000..30cf64f9ab
--- /dev/null
+++ b/projects/taffy/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require('../helper/unknownTokens');
+
+module.exports = uniTvlExport('saakuru', '0xb9FFd4f89A86a989069CAcaE90e9ce824D0c4971', { fetchBalances: true, })
\ No newline at end of file
diff --git a/projects/taidog/index.js b/projects/taidog/index.js
new file mode 100644
index 0000000000..8e56a5ad2d
--- /dev/null
+++ b/projects/taidog/index.js
@@ -0,0 +1,95 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+const { sumTokensExport } = require("../helper/unwrapLPs");
+
+const TAIDOG_TOKEN = "0x1Fd2f219B59b88bDda7dacd50c6e0667aA2d3Ee7";
+const TAIDOG_STAKING_CONTRACT = "0x9b4484D5A2665930702d09f74086CAD86d96b25E";
+
+const TAIDOG_WETH_LP = "0x28Be5f9caBd48B712a031a901590b71f5509526D";
+const LP_STAKING_CONTRACT = "0xD664c3b22c60b4927ab1e0035b99F157bc2d8F1B";
+
+const TAIKO_TOKEN = "0xA9d23408b9bA935c230493c40C73824Df71A0975";
+const TAIKO_STAKING_CONTRACT = "0x89a95021E45AcAB4B89eb20C18691E3E0D1d2170";
+
+async function poolsTvl(api) {
+ const lpTAIDOGReserves = await api.call({
+ abi: "erc20:balanceOf",
+ target: TAIDOG_TOKEN,
+ params: [TAIDOG_WETH_LP],
+ });
+
+ const lpWETHReserves = await api.call({
+ abi: "erc20:balanceOf",
+ target: ADDRESSES.taiko.WETH,
+ params: [TAIDOG_WETH_LP],
+ });
+
+ const lpStakingBalance = await api.call({
+ abi: "erc20:balanceOf",
+ target: TAIDOG_WETH_LP,
+ params: [LP_STAKING_CONTRACT],
+ });
+
+ const totalLPSupply = await api.call({
+ abi: "erc20:totalSupply",
+ target: TAIDOG_WETH_LP,
+ params: [],
+ });
+
+ // (STAKED_LP_TOKENS / LP_TOTALSUPPLY) * LP_TAIDOG_TOKEN_0_RESERVE
+ api.add(TAIDOG_TOKEN, (lpStakingBalance / totalLPSupply) * lpTAIDOGReserves);
+
+ // (STAKED_LP_TOKENS / LP_TOTALSUPPLY) * LP_WETH_TOKEN_1_RESERVE
+ api.add(
+ ADDRESSES.taiko.WETH,
+ (lpStakingBalance / totalLPSupply) * lpWETHReserves
+ );
+}
+
+async function stakingTvl(api) {
+ const stakingBalance = await api.call({
+ abi: "erc20:balanceOf",
+ target: TAIDOG_TOKEN,
+ params: [TAIDOG_STAKING_CONTRACT],
+ });
+
+ // Transform token via LP Pricing
+ // TOKEN_0 ==> LP_RESERVES ==> WETH_TOKEN_1
+
+ const lpTAIDOGReserves = await api.call({
+ abi: "erc20:balanceOf",
+ target: TAIDOG_TOKEN,
+ params: [TAIDOG_WETH_LP],
+ });
+
+ const lpWETHReserves = await api.call({
+ abi: "erc20:balanceOf",
+ target: ADDRESSES.taiko.WETH,
+ params: [TAIDOG_WETH_LP],
+ });
+
+ // transform conversion via price (staking_TOKEN_0 / TOKEN_0_RESERVE * TOKEN_1_RESERVE)
+ const transformedToWETHBalance =
+ (stakingBalance / lpTAIDOGReserves) * lpWETHReserves;
+
+ // TAIDOG staking token TRANSFORM to WETH via LP Pricing
+ api.add(ADDRESSES.taiko.WETH, transformedToWETHBalance);
+}
+
+module.exports = {
+ misrepresentedTokens: true,
+ methodology:
+ "TVL counts user deposits of assets like (ETH, USDC, TAIKO) into protocol, counts pool2 (lp tokens) in staking contract 0xD664c3b22c60b4927ab1e0035b99F157bc2d8F1B, and counts the number of TAIDOG tokens in the staking contract 0x9b4484D5A2665930702d09f74086CAD86d96b25E",
+ start: 84000,
+ taiko: {
+ tvl: sumTokensExport({
+ tokensAndOwners: [
+ [TAIKO_TOKEN, TAIKO_STAKING_CONTRACT],
+ [ADDRESSES.taiko.WETH, "0x4625F913FF1ed54859b31Cce2CE1a4DBED33b825"],
+ [ADDRESSES.taiko.USDC, "0xc004e7d1eA0f69476dc26BE343E8643088246A08"],
+ ],
+ resolveLP: true,
+ }),
+ pool2: poolsTvl,
+ staking: stakingTvl,
+ },
+};
diff --git a/projects/taiko-bridge/index.js b/projects/taiko-bridge/index.js
new file mode 100644
index 0000000000..34c4bc6c92
--- /dev/null
+++ b/projects/taiko-bridge/index.js
@@ -0,0 +1,15 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+module.exports = {
+ ethereum: {
+ tvl: async ({ api }) =>
+ sumTokens2({
+ api,
+ owners: [
+ "0xd60247c6848B7Ca29eDdF63AA924E53dB6Ddd8EC",
+ "0x996282cA11E5DEb6B5D122CC3B9A1FcAAD4415Ab",
+ ],
+ fetchCoValentTokens: true,
+ }),
+ },
+};
diff --git a/projects/taikoswap/index.js b/projects/taikoswap/index.js
new file mode 100644
index 0000000000..3810f94262
--- /dev/null
+++ b/projects/taikoswap/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require('../helper/unknownTokens')
+
+module.exports = uniTvlExport('taiko', '0x7c43adafc2337baa16aa2876f9de8da5b3720fdb')
\ No newline at end of file
diff --git a/projects/tangible-ustb/index.js b/projects/tangible-ustb/index.js
new file mode 100644
index 0000000000..b04203fbda
--- /dev/null
+++ b/projects/tangible-ustb/index.js
@@ -0,0 +1,8 @@
+const { sumTokensExport } = require('../helper/unwrapLPs')
+const USTB = '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd'
+
+module.exports = {
+ ethereum: {
+ tvl: sumTokensExport({ owner: USTB, tokens: ["0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C"]}),
+ },
+}
\ No newline at end of file
diff --git a/projects/tangible/index.js b/projects/tangible/index.js
index 0311d7a26a..bf48c1b3de 100644
--- a/projects/tangible/index.js
+++ b/projects/tangible/index.js
@@ -6,6 +6,16 @@ const { getInsuranceFundValueOp } = require("./insurance-fund-optimism");
const { getInsuranceFundValueBase } = require("./insurance-fund-base");
const { getInsuranceFundValueArb } = require("./insurance-fund-arbitrum");
+const realTvl = async (api) => {
+ const USTB = '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd'
+ const basketManager = '0x5e581ce0472bF528E7F5FCB96138d7759AC2ac3f'.toLowerCase()
+ // get all baskets in existance
+ const baskets = await api.call({ abi: 'address[]:getBasketsArray', target: basketManager })
+ console.log(baskets)
+ const basketTVL = await api.multiCall({ abi: 'uint256:getTotalValueOfBasket', calls: baskets})
+ api.add(USTB, basketTVL)
+}
+
// doc: https://docs.tangible.store/real-usd/real-usd-v3-contracts-and-addresses
const TNGBL = '0x49e6A20f1BBdfEeC2a8222E052000BbB14EE6007'.toLowerCase()
const USDR = '0x40379a439d4f6795b6fc9aa5687db461677a2dba'.toLowerCase()
@@ -188,7 +198,7 @@ async function tangiblePOL(api) {
module.exports = {
hallmarks: [
- [1697032800,"USDR Depeg"]
+ [1697032800, "USDR Depeg"]
],
misrepresentedTokens: true,
polygon: { tvl, },
@@ -196,6 +206,7 @@ module.exports = {
base: { tvl: tvlBase },
arbitrum: { tvl: tvlArb },
optimism: { tvl: tvlOp },
+ real: { tvl: realTvl },
}
async function unwrapBalancerToken(api, owner) {
diff --git a/projects/tarot/index.js b/projects/tarot/index.js
index 779def2d54..c802d74fbc 100644
--- a/projects/tarot/index.js
+++ b/projects/tarot/index.js
@@ -69,6 +69,16 @@ const config = {
'0xf450b51fb2E1e4f05DAf9Cf7D9BB97714540B4f4', // Tarot Zeniths
]
},
+ linea: {
+ factories: [
+ '0xb6193DF61351736e5190bF1DEB2E4f0769bd1BF2', // Tarot Leyline
+ ]
+ },
+ scroll: {
+ factories: [
+ '0x2217AEC3440E8FD6d49A118B1502e539f88Dba55', // Tarot Osirion
+ ]
+ },
}
tarotHelper(module.exports, config)
diff --git a/projects/tbtc/index.js b/projects/tbtc/index.js
index 876b5934b9..0ac5ec6180 100644
--- a/projects/tbtc/index.js
+++ b/projects/tbtc/index.js
@@ -1,13 +1,35 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const sdk = require('@defillama/sdk')
+const sdk = require('@defillama/sdk');
+const { sumTokensExport } = require('../helper/sumTokens');
-async function tvl(ts, block, _) {
- return {
- [ADDRESSES.ethereum.tBTC]: (await sdk.api.erc20.totalSupply({ target: ADDRESSES.ethereum.tBTC, block })).output
- }
-}
+const owners = [
+'bc1ql6yu2xywnmslnameu6376wzut4nwnafdj483ez',
+'bc1q7uf083n9rsn8zgds0eg9kyzugjcz7pe4sq2jzf',
+'bc1ql54ftzuh6k76wcn7330vlwxahhth8lqjc55lkc',
+'bc1qhq052tz9pvjp4x2vu6ndc4rlpxesc9dz37uqt5',
+'bc1q3rtrkav9l6m0e5vxya77mtlvqh8rk0eyf74277',
+'bc1qde4ggwj2jp5tetjztfml3peyvwzvpwtr9ng6we',
+'bc1qrzk68h8l2kvkvky00l8xvwz45pr4mmtyfpf0j8',
+'bc1qkza8dm07rr5pxedam5w5v5g627j0lrwwzncsvd',
+'bc1qrw5tn47ea05seyetlywltrdk06rldpk746etc9',
+'bc1qcwkzqwfyqc7frec2g0rmjlrsw3d8vdwxrksn62',
+'bc1qpdrzltkxg742jk8tr0pe7hltkme5p25ezmllz6',
+'bc1qpqrm609emjpl35v2fu3frq0r87d29vm8ffygkf',
+'bc1qhqlyelhwffrwdz4xzfe5whqxxft8quzvdscc8g',
+'bc1qpaz0dp264pakv6f6ljmg2f3x27xmsj6la33mhc',
+'bc1q9alywjvrsxu024a2m25lltl6h070l6lqfya45c',
+'bc1q8cwt90ck2uvzwqj7q3dwvwclnprz7rk4qzk05k',
+'bc1q2xygt58u9r6hc32uxruh93ap8q9898rep04xdk',
+'bc1q4rheadle4sgdgdatkeuqfm90qv3wpkd7q8yp0m',
+'bc1qrflqxl5pwet9tgv4uex6a6srmh3u4cvefeq0h6',
+'bc1qqu0nw5n5n6uvjw5m3hwh8zvzckd8cnth8nt80k',
+'bc1q3las75huex5jjhunheqycegw2x8fvhc6y0q3nu',
+]
module.exports = {
- ethereum: { tvl },
- methodology: `TVL for tBTC consists of the BTC deposits in custody that were used to mint tBTC`
-}
+ methodology: "BTC on btc chain",
+ bitcoin: {
+ tvl: sdk.util.sumChainTvls([
+ sumTokensExport({ owners }),
+ ]),
+ },
+};
diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js
index 2b1d0d1b8f..df331983ca 100644
--- a/projects/teahouse-v3/index.js
+++ b/projects/teahouse-v3/index.js
@@ -3,14 +3,14 @@ const starknet = require("../helper/chain/starknet");
const { getConfig } = require("../helper/cache");
// teahouse public api for vault
-const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults";
+const teahouseVaultAPI = "https://raw.githubusercontent.com/TeahouseFinance/Vaults-for-DeFiLlama/main/vaults.json";
// get vault contract addresses from teahouse api
async function getVaultContractsAddress(chain) {
let pairVault = [];
let portVault = [];
let starknetPairVault = [];
- const { vaults } = await getConfig("teahouse/v3_reset_cache", teahouseVaultAPI);
+ const { vaults } = await getConfig("teahouse/v3_vault_data", teahouseVaultAPI);
vaults.forEach((element) => {
// permissionless vaults
if (element.isDeFi == true && element.isActive == true) {
diff --git a/projects/teahouse/index.js b/projects/teahouse/index.js
index 4e54008cf9..e6cbbf4fa1 100644
--- a/projects/teahouse/index.js
+++ b/projects/teahouse/index.js
@@ -2,13 +2,13 @@ const abi = require("./abi.json");
const { getConfig } = require("../helper/cache");
// teahouse public api for vault
-const teahouseVaultAPI = "https://vault-content-api.teahouse.finance/vaults";
+const teahouseVaultAPI = "https://raw.githubusercontent.com/TeahouseFinance/Vaults-for-DeFiLlama/main/vaults.json";
// get vault contract addresses from teahouse api
async function getVaultContractsAddress(chain) {
let htAddress = [];
- const { vaults } = await getConfig("teahouse/v1_reset_cache", teahouseVaultAPI);
+ const { vaults } = await getConfig("teahouse/vault_data", teahouseVaultAPI);
vaults.forEach((element) => {
// v2 vaults
if (element.isDeFi == false && element.isActive == true) {
diff --git a/projects/team-finance/config.js b/projects/team-finance/config.js
index 77a48b0318..efdfcfc770 100644
--- a/projects/team-finance/config.js
+++ b/projects/team-finance/config.js
@@ -3,36 +3,92 @@ const abi_v2 = require("./lockcontract.abi.json");
module.exports = {
ethereum: [
- { contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", contractABI: abi, },
- { contract: "0xdbf72370021babafbceb05ab10f99ad275c6220a", contractABI: abi_v2, },
- { contract: "0xc77aab3c6d7dab46248f3cc3033c856171878bd5", contractABI: abi_v2, },
+ {
+ contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb",
+ contractABI: abi,
+ },
+ {
+ contract: "0xdbf72370021babafbceb05ab10f99ad275c6220a",
+ contractABI: abi_v2,
+ },
+ {
+ contract: "0xc77aab3c6d7dab46248f3cc3033c856171878bd5",
+ contractABI: abi_v2,
+ },
+ ],
+ kava: [
+ {
+ contract: "0xa9ec655dac35d989c0c8be075b1106dcd32502d6",
+ contractABI: abi_v2,
+ },
],
- kava: [{ contract: "0xa9ec655dac35d989c0c8be075b1106dcd32502d6", contractABI: abi_v2, },],
polygon: [
- { contract: "0x3eF7442dF454bA6b7C1deEc8DdF29Cfb2d6e56c7", contractABI: abi_v2, },
- { contract: "0x586c21a779c24efd2a8af33c9f7df2a2ea9af55c", contractABI: abi_v2, },
+ {
+ contract: "0x3eF7442dF454bA6b7C1deEc8DdF29Cfb2d6e56c7",
+ contractABI: abi_v2,
+ },
+ {
+ contract: "0x586c21a779c24efd2a8af33c9f7df2a2ea9af55c",
+ contractABI: abi_v2,
+ },
],
avax: [
- { contract: "0x88ada02f6fce2f1a833cd9b4999d62a7ebb70367", contractABI: abi_v2, },
- { contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb", contractABI: abi, },
- ],
- arbitrum: [{ contract: "0xE0B0D2021293Bee9715e1Db3be31b55C00F72A75", contractABI: abi_v2, }],
- base: [{ contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a", contractABI: abi_v2 },],
- velas: [{ contract: "0x586c21A779C24eFd2a8aF33C9F7Df2a2EA9aF55c", contractABI: abi_v2 },],
- fantom: [{ contract: "0x9F726019452d65a120E1F7Ae6b937eE9EbD72440", contractABI: abi_v2 },],
- cronos: [{ contract: "0x05b711Df32d73ECaa877d45a637a2eB415e7995f", contractABI: abi_v2 },],
+ {
+ contract: "0x88ada02f6fce2f1a833cd9b4999d62a7ebb70367",
+ contractABI: abi_v2,
+ },
+ {
+ contract: "0xe2fe530c047f2d85298b07d9333c05737f1435fb",
+ contractABI: abi,
+ },
+ ],
+ arbitrum: [
+ {
+ contract: "0xE0B0D2021293Bee9715e1Db3be31b55C00F72A75",
+ contractABI: abi_v2,
+ },
+ ],
+ base: [
+ {
+ contract: "0x4f0fd563be89ec8c3e7d595bf3639128c0a7c33a",
+ contractABI: abi_v2,
+ },
+ ],
+ velas: [
+ {
+ contract: "0x586c21A779C24eFd2a8aF33C9F7Df2a2EA9aF55c",
+ contractABI: abi_v2,
+ blacklist: ["0xc2995a065106b5c5c738b2320387460ebd12c12d"],
+ },
+ ],
+ fantom: [
+ {
+ contract: "0xccebbe9e2b8f46c2c6862238e60a396af790b63e",
+ contractABI: abi_v2,
+ blacklist: ["0xc2995a065106b5c5c738b2320387460ebd12c12d"], // KyberSwap LP WFTM-DOA
+ },
+ ],
+ cronos: [
+ {
+ contract: "0x05b711Df32d73ECaa877d45a637a2eB415e7995f",
+ contractABI: abi_v2,
+ },
+ ],
bsc: [
{
contract: "0x0c89c0407775dd89b12918b9c0aa42bf96518820",
contractABI: abi_v2,
blacklist: [
- '0x6c7c87d9868b1db5a0f62d867baa90e0adfa7cfd', //TNNS
- '0xf2619476bd0ca0eda08744029c66b62a904c2bf8', //JRIT
- '0x854b4c305554c5fa72353e31b8480c0e5128a152', //WEL
- '0x070a08beef8d36734dd67a491202ff35a6a16d97', // SLP
- '0x9b83f4b893cf061d8c14471aa97ef24c352f5abe', // ubec-lp
- ]
+ "0x6c7c87d9868b1db5a0f62d867baa90e0adfa7cfd", //TNNS
+ "0xf2619476bd0ca0eda08744029c66b62a904c2bf8", //JRIT
+ "0x854b4c305554c5fa72353e31b8480c0e5128a152", //WEL
+ "0x070a08beef8d36734dd67a491202ff35a6a16d97", // SLP
+ "0x9b83f4b893cf061d8c14471aa97ef24c352f5abe", // ubec-lp
+ ],
+ },
+ {
+ contract: "0x7536592bb74b5d62eb82e8b93b17eed4eed9a85c",
+ contractABI: abi_v2,
},
- { contract: "0x7536592bb74b5d62eb82e8b93b17eed4eed9a85c", contractABI: abi_v2, },
],
-}
\ No newline at end of file
+};
diff --git a/projects/term-finance/index.js b/projects/term-finance/index.js
index cd2787efac..87415e3dec 100644
--- a/projects/term-finance/index.js
+++ b/projects/term-finance/index.js
@@ -3,9 +3,9 @@ const { getLogs } = require('../helper/cache/getLogs')
const graphs = {
ethereum:
- "https://graph-node.mainnet.termfinance.io/subgraphs/name/term-finance-mainnet",
- avax:
- "https://public-graph-proxy.avalanche.mainnet.termfinance.io",
+ "https://public-graph-proxy.mainnet.termfinance.io",
+ avax:
+ "https://public-graph-proxy.avalanche.mainnet.termfinance.io",
};
const query = `
@@ -40,15 +40,16 @@ query auctionsQuery($lastId: ID) {
const startBlocks = {
"ethereum": 16380765,
- "avalanche": 43162228,
+ "avax": 43162228,
};
const emitters = {
"ethereum": [
"0x9D6a563cf79d47f32cE46CD7b1fb926eCd0f6160", // 0.2.4
"0xf268E547BC77719734e83d0649ffbC25a8Ff4DB3", // 0.4.1
"0xc60e0f5cD9EE7ACd22dB42F7f56A67611ab6429F", // 0.6.0
+ "0x4C6Aeb4E8dBBAF53c13AF495c847D4eC68994bD4", // 0.9.0
],
- "avalanche": [
+ "avax": [
"0xb81afB6724ba9d19a3572Fb29ed7ef633fD50093", // 0.6.0
],
};
diff --git a/projects/term-structure/index.js b/projects/term-structure/index.js
new file mode 100644
index 0000000000..8724f8b9e4
--- /dev/null
+++ b/projects/term-structure/index.js
@@ -0,0 +1,16 @@
+const ADDRESSES = require('../helper/coreAssets.json');
+const { sumTokens2 } = require('../helper/unwrapLPs');
+
+const ZkTrueUpContractAddress = "0x09E01425780094a9754B2bd8A3298f73ce837CF9";
+
+module.exports = {
+ ethereum: {
+ tvl: async (api) => {
+ const infoAbi = "function getAssetConfig(uint16 tokenId) external view returns (bool isStableCoin, bool isTsbToken, uint8 decimals, uint128 minDepositAmt, address token)"
+ const tokenInfo = await api.fetchList({ lengthAbi: 'getTokenNum', itemAbi: infoAbi, target: ZkTrueUpContractAddress, startFrom: 1 })
+ const tokens = tokenInfo.map(i => i.token)
+ tokens.push(ADDRESSES.ethereum.WETH)
+ return sumTokens2({ api, tokens, owner: ZkTrueUpContractAddress })
+ },
+ },
+};
diff --git a/projects/tether-gold/index.js b/projects/tether-gold/index.js
new file mode 100644
index 0000000000..0a36aa8392
--- /dev/null
+++ b/projects/tether-gold/index.js
@@ -0,0 +1,11 @@
+const XAUt = '0x68749665ff8d2d112fa859aa293f07a622782f38'
+
+module.exports = {
+ methodology: "TVL corresponds to the total amount of XAUt minted",
+ ethereum: {
+ tvl: async (api) => {
+ const totalSupply = await api.call({target: XAUt, abi: 'erc20:totalSupply'})
+ api.add(XAUt, totalSupply)
+ }
+ }
+}
diff --git a/projects/tezfin/index.js b/projects/tezfin/index.js
index 727d5a792f..956de546b3 100644
--- a/projects/tezfin/index.js
+++ b/projects/tezfin/index.js
@@ -4,19 +4,29 @@ const { getStorage, sumTokens2 } = require("../helper/chain/tezos");
async function tvl() {
return sumTokens2({
owners: [
- "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6",
- "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb",
- "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46"
- ],
+ // v1 contracts
+ "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", // ꜰXTZ v1
+ "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", // ꜰUSDtz v1
+ "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46", // ꜰUSDt v1
+ // v2 contracts
+ "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2
+ "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2
+ "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2
+ ],
includeTezos: true,
});
}
async function borrowed() {
const borrowedTokensAddresses = [
- "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6",
- "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb",
- "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46"
+ // v1 contracts
+ "KT1GYKoownVC1ukP2TBDgKx7bSXRM5XkV1W6", // ꜰXTZ v1
+ "KT1MX7D6ZJp2DDSSeDS96JPTFPXKkNiHFhwb", // ꜰUSDtz v1
+ "KT1W8P4ZxD8eREKjDnxMe5882NP3GnAgrv46", // ꜰUSDt v1
+ // v2 contracts
+ "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2
+ "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2
+ "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2
];
const balances = {};
@@ -48,4 +58,4 @@ module.exports = {
borrowed,
},
methodology: 'TVL counts the liquidity and reserves for each market. Borrowed amounts are calculated based on the total borrows from each contract address, with special handling for "tezos" to adjust for precision.',
-};
\ No newline at end of file
+};
diff --git a/projects/thUSD/index.js b/projects/thUSD/index.js
new file mode 100644
index 0000000000..368dc65b0c
--- /dev/null
+++ b/projects/thUSD/index.js
@@ -0,0 +1,11 @@
+const sdk = require('@defillama/sdk')
+const { getLiquityTvl } = require("../helper/liquity")
+const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs")
+const tBTCTvl = getLiquityTvl('0xf5e4ffeb7d2183b61753aa4074d72e51873c1d0a', { nonNativeCollateralToken: true, abis: { collateralToken: 'address:collateralAddress' } })
+const ethTvl = sumTokensExport({ owner: '0x1f490764473eb1013461D6079F827DB95d8B4DC5', tokens: [nullAddress]})
+
+module.exports = {
+ ethereum: {
+ tvl: sdk.util.sumChainTvls([tBTCTvl, ethTvl])
+ }
+}
diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js
index 68f8d3a3e3..ecf12f8b44 100644
--- a/projects/thetanuts/index.js
+++ b/projects/thetanuts/index.js
@@ -1,5 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const { sumTokensExport } = require('../helper/unwrapLPs')
+const { sumTokensExport, sumTokens2 } = require('../helper/unwrapLPs')
// Ethereum Vaults
const ethCallVault = '0x9014f8E90423766343Ed4fe41668563526dF6715'
@@ -88,9 +88,9 @@ const arbPutVault = '0xf94ea5B18401821BE07FBfF535B8211B061A7F70'
const ethCallVaultArb = '0x1D1CD4abe0F2AF9d79b5e3149BF4A503f97C1EAd'
const ethPutVaultArb = '0xA8459eC6DF0D9a61058C43a308dD8A2CEc9d550E'
// Assets locked in Aave V2 fork
-const aArb = '0x116a7f52556a57F807CEACe228242C3c91D2C7E5'
-const aUsdc = '0xBEe683e6e5CE1e7Ea07c6f11DF240AcD92c33632'
-const aWeth = '0xBbf03fC0C8441e9cc50cC087f74899C137597b6e'
+const aArb_ARB = '0x116a7f52556a57F807CEACe228242C3c91D2C7E5'
+const aUsdc_ARB = '0xBEe683e6e5CE1e7Ea07c6f11DF240AcD92c33632'
+const aWeth_ARB = '0xBbf03fC0C8441e9cc50cC087f74899C137597b6e'
// LongLiquidityVaults - Holds aAssets (not counted) and V3 liquidity NFTs
const arbC_LLV = '0x721Bba1556649e9c70E2dF1EAFC04270376025f7'
const arbP_LLV = '0x57eD79afD32c616E4631231636F4597188d20C5e'
@@ -104,6 +104,14 @@ const aPTrsETH_27JUN24 = '0x121b956D11EaeCFD3f0CdF259D6faFFEbEDD0bC9'
const PTweETH_27JUN24 = '0x1c27Ad8a19Ba026ADaBD615F6Bc77158130cfBE4'
const aPTweETH_27JUN24 = '0x1B38B4586003E64c6c87F4acaF4f15415C2034EB'
+const PTweETH_26SEP24 = '0xb8b0a120F6A68Dd06209619F62429fB1a8e92feC'
+const aPTweETH_26SEP24 = '0xF5d0866646DF182Fb9BC7FB27B26B84F96b2239d'
+const PTezETH_26SEP24 = '0x2CCFce9bE49465CC6f947b5F6aC9383673733Da9'
+const aPTezETH_26SEP24 = '0x3F9ca12e7D4867E45b289484a3F33bbA2A1b8723'
+const PTrsETH_26SEP24 = '0x30c98c0139B62290E26aC2a2158AC341Dcaf1333'
+const aPTrsETH_26SEP24 = '0x0B6Ef11254edCab4b164daa7e626Dc0d0c2Ad51f'
+
+
// Polygon zkEVM vaults
const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C'
@@ -151,6 +159,7 @@ const wcro = '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23'
// Arbitrum assets
const arb = ADDRESSES.arbitrum.ARB
const usdc_arb = ADDRESSES.arbitrum.USDC_CIRCLE
+const weth_arb = ADDRESSES.arbitrum.WETH
const univ3nft_arb = '0xC36442b4a4522E871399CD717aBDD847Ab11FE88'
// Polygon zkEVM assets
@@ -217,20 +226,25 @@ const config = {
tokensAndOwners: [
[arb, arbCallVault,],
[usdc_arb, arbPutVault,],
- [arb, ethCallVaultArb,],
+ [weth_arb, ethCallVaultArb,],
[usdc_arb, ethPutVaultArb,],
- [arb, aArb,],
- [usdc_arb, aUsdc,],
-
+ [arb, aArb_ARB,],
+ [weth_arb, aWeth_ARB,],
+ [usdc_arb, aUsdc_ARB,],
+
[PTezETH_27JUN24, aPTezETH_27JUN24,],
[PTrsETH_27JUN24, aPTrsETH_27JUN24,],
[PTweETH_27JUN24, aPTweETH_27JUN24,],
+
+ [PTezETH_26SEP24, aPTezETH_26SEP24,],
+ [PTrsETH_26SEP24, aPTrsETH_26SEP24,],
+ [PTweETH_26SEP24, aPTweETH_26SEP24,],
],
- LLVOwners: [
- [univ3nft_arb, arbC_LLV,],
- [univ3nft_arb, arbP_LLV,],
- [univ3nft_arb, ethC_LLV,],
- [univ3nft_arb, ethP_LLV,],
+ uniV3Owners: [
+ arbC_LLV,
+ arbP_LLV,
+ ethC_LLV,
+ ethP_LLV,
]
},
fantom: {
@@ -296,8 +310,11 @@ const config = {
}
Object.keys(config).forEach(chain => {
- const { tokensAndOwners, LLVOwners } = config[chain]
+ const { tokensAndOwners, uniV3Owners } = config[chain]
module.exports[chain] = {
- tvl: sumTokensExport({ tokensAndOwners, resolveUniV3 : LLVOwners != null && LLVOwners.length > 0 ? true : false, uniV3nftsAndOwners : LLVOwners })
+ tvl: async (api) => {
+ if (uniV3Owners) await sumTokens2({ api, owners: uniV3Owners, resolveUniV3: true})
+ return sumTokens2({ api, tokensAndOwners})
+ }
}
})
diff --git a/projects/thevault/index.js b/projects/thevault/index.js
new file mode 100644
index 0000000000..dde245b270
--- /dev/null
+++ b/projects/thevault/index.js
@@ -0,0 +1,13 @@
+const { getStakedSol } = require("../helper/solana")
+
+async function tvl(api) {
+ // https://docs.thevault.finance/about/stake-pool-address
+ await getStakedSol('GdNXJobf8fbTR5JSE7adxa6niaygjx4EEbnnRaDCHMMW', api)
+}
+
+module.exports = {
+ timetravel: false,
+ solana: {
+ tvl
+ },
+};
diff --git a/projects/time-fun/index.js b/projects/time-fun/index.js
new file mode 100644
index 0000000000..89e0c994ee
--- /dev/null
+++ b/projects/time-fun/index.js
@@ -0,0 +1,7 @@
+const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs')
+
+module.exports = {
+ base: {
+ tvl: sumTokensExport({ owner: '0x428aef7fb31e4e86162d62d4530a4dd7232d953d', tokens: [nullAddress] })
+ }
+}
\ No newline at end of file
diff --git a/projects/timeswap/index.js b/projects/timeswap/index.js
index 19acc60107..45b9d2f993 100644
--- a/projects/timeswap/index.js
+++ b/projects/timeswap/index.js
@@ -1,9 +1,10 @@
+const sdk = require("@defillama/sdk");
const { sumTokens2 } = require('../helper/unwrapLPs')
const { cachedGraphQuery } = require('../helper/cache')
const GRAPH_URLS = {
polygon:
- "https://api.thegraph.com/subgraphs/name/timeswap-labs/timeswap-defi-llama",
+ sdk.graph.modifyEndpoint('CjoTTVotweY5YZYjGbskVMZvJi8oD6urLnP1N7rWVFun'),
};
function chainTvl(chain) {
diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js
new file mode 100644
index 0000000000..42e2ab819d
--- /dev/null
+++ b/projects/tivel-finance/index.js
@@ -0,0 +1,15 @@
+const config = {
+ era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F',
+ scroll: '0x30e44f48c9542533cB0b6b7dA39F6d42F26D843f',
+}
+
+Object.keys(config).forEach(chain => {
+ const factory = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const pools = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: 'pools', target: factory })
+ const tokens = await api.multiCall({ abi: 'address:quoteToken', calls: pools })
+ return api.sumTokens({ tokensAndOwners2: [tokens, pools] })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/tlx/index.js b/projects/tlx/index.js
index fd11ed7196..c66b889291 100644
--- a/projects/tlx/index.js
+++ b/projects/tlx/index.js
@@ -1,9 +1,16 @@
-const { sumTokens2 } = require("../helper/unwrapLPs");
+const ADDRESSES = require('../helper/coreAssets.json')
+const helperAbi = {
+ "leveragedTokenData": "function leveragedTokenData() view returns (tuple(address addr, string symbol, uint256 totalSupply, string targetAsset, uint256 targetLeverage, bool isLong, bool isActive, uint256 rebalanceThreshold, uint256 exchangeRate, bool canRebalance, bool hasPendingLeverageUpdate, uint256 remainingMargin, uint256 leverage, uint256 assetPrice, uint256 userBalance)[])"
+}
+
const contracts = {
tlx: "0xD9cC3D70E730503E7f28c1B407389198c4B75FA2",
+ sUSD: ADDRESSES.optimism.sUSD,
locker: "0xc068c3261522c97ff719dc97c98c63a1356fef0f",
-}
+ staker: "0xc30877315f3b621a8f7bcda27819ec29429f3817",
+ leveragedTokenHelper: "0xBdAF7A2C4ee313Be468B9250609ba8496131B1f0",
+};
async function staking(api) {
const lockedTlxBalance = await api.call({
@@ -11,15 +18,34 @@ async function staking(api) {
target: contracts.locker,
});
- api.addToken(contracts.tlx, lockedTlxBalance)
- return sumTokens2({ api })
+ const stakedTlxBalance = await api.call({
+ abi: "uint256:totalStaked",
+ target: contracts.staker,
+ });
+
+ api.addToken(contracts.tlx, lockedTlxBalance);
+ api.addToken(contracts.tlx, stakedTlxBalance);
+}
+
+async function tvl(api) {
+ // documentation: https://docs.tlx.fi/more/deployed-contracts
+ // factory - 0x5dd85f51e9fd6ade8ecc216c07919ecd443eb14d
+ const res = await api.call({
+ abi: helperAbi.leveragedTokenData,
+ target: contracts.leveragedTokenHelper,
+ });
+ const totalSusd = res.reduce((acc, token) => {
+ return acc + (token.totalSupply * token.exchangeRate) / 1e18;
+ }, 0);
+ api.addToken(contracts.sUSD, totalSusd);
}
module.exports = {
start: 1712731500,
- methodology: "Total TLX locked in the genesis locker contract.",
+ methodology:
+ "Total TLX locked in the genesis locker contract and total TLX staked in the staking contract. TVL is computed as the total margin deposited across the protocol's leveraged tokens.",
optimism: {
- tvl: () => ({}),
+ tvl: tvl,
staking: staking,
},
};
diff --git a/projects/tonbridge.js b/projects/tonbridge.js
index a7cd42ef9e..730263b45c 100644
--- a/projects/tonbridge.js
+++ b/projects/tonbridge.js
@@ -13,13 +13,13 @@ const tokenMap = {
//'f48054939064d686a9ad68d96d9ab79e409b095557c06ab7f073097dade7057f': 'dartflex',
//'00ca16398f314a9b3bed582dc69582515d866ededb6c4e18190f63b305cedf91': NA
'a49cd4e158a9a15555e624759e2e4e766d22600b7800d891e46f9291f044a93d': 'everscale',
- 'b2e341c01da068d43cfa0eae6dae36b12b476e55cf2c3eeb002689f44b9ddef9': 'aave',
- 'bc77ba7f3cbbebcca393e85ed479ef44df63cdee4fb572c3e0f904fb9fc63e25': 'compound-governance-token',
- '7dd7ae82835848dc6b490515ec4034968a8ceff893a6d5f31ab3cdfcfb79bbb6': 'curve-dao-token',
- '6b2baa777b89da66dddaf9f1602142987b13ca565bbb170da929ea945f5ce9fb': 'stasis-eurs',
+ // 'b2e341c01da068d43cfa0eae6dae36b12b476e55cf2c3eeb002689f44b9ddef9': 'aave',
+ // 'bc77ba7f3cbbebcca393e85ed479ef44df63cdee4fb572c3e0f904fb9fc63e25': 'compound-governance-token',
+ // '7dd7ae82835848dc6b490515ec4034968a8ceff893a6d5f31ab3cdfcfb79bbb6': 'curve-dao-token',
+ // '6b2baa777b89da66dddaf9f1602142987b13ca565bbb170da929ea945f5ce9fb': 'stasis-eurs',
//'387609364f765017fa3fa5815e08d420e054c88a86426cd6d5aaf2a1ee46ff5a': 'torn',
- 'e114f1f7d21ac6566d988c983315e0cdd5bee7b43c08918537d1117dea7e4534': 'yearn-finance',
- '3c66e3e0ce0a909ce8779b31509db773e544132d8fa6f6641c00bce257c79d9c': '1inch',
+ // 'e114f1f7d21ac6566d988c983315e0cdd5bee7b43c08918537d1117dea7e4534': 'yearn-finance',
+ // '3c66e3e0ce0a909ce8779b31509db773e544132d8fa6f6641c00bce257c79d9c': '1inch',
//'bf1c7c0e8a187d9d5ba6069bf768b69a982df8b22ef8430b31dcc4f97263507e': 'dartflex'
};
diff --git a/projects/toucan-protocol/config.js b/projects/toucan-protocol/config.js
index 21fe7468ca..670406ffa6 100644
--- a/projects/toucan-protocol/config.js
+++ b/projects/toucan-protocol/config.js
@@ -1,8 +1,12 @@
const ADDRESSES = require('../helper/coreAssets.json')
const CONFIG_DATA = {
+ base: {
+ char: "0x20b048fA035D5763685D695e66aDF62c5D9F5055",
+ },
celo: {
bct: "0x0CcB0071e8B8B716A2a5998aB4d97b83790873Fe",
nct: ADDRESSES.celo.NCT,
+ char: "0x50E85c754929840B58614F48e29C64BC78C58345",
},
polygon: {
bct: "0x2F800Db0fdb5223b3C3f354886d907A671414A7F",
@@ -12,7 +16,20 @@ const CONFIG_DATA = {
nct_bridge: "0xdC1Dfa22824Af4e423a558bbb6C53a31c3c11DCC"
},
};
+const TOKEN_DATA = {
+ bct: {
+ coingecko: "toucan-protocol-base-carbon-tonne",
+ validUntil: 1709828986,
+ },
+ nct: {
+ coingecko: "toucan-protocol-nature-carbon-tonne",
+ },
+ char: {
+ coingecko: "biochar",
+ },
+};
module.exports = {
CONFIG_DATA,
+ TOKEN_DATA,
};
diff --git a/projects/toucan-protocol/index.js b/projects/toucan-protocol/index.js
index 4f14b10255..441843bc51 100644
--- a/projects/toucan-protocol/index.js
+++ b/projects/toucan-protocol/index.js
@@ -1,23 +1,44 @@
const sdk = require('@defillama/sdk')
-const { CONFIG_DATA } = require("./config");
+const { CONFIG_DATA, TOKEN_DATA } = require("./config");
const getCalculationMethod = (chain) => {
return async (api,) => {
- const supplyCalls = [CONFIG_DATA[chain].bct, CONFIG_DATA[chain].nct];
+ const supplyCalls = []
+ const tokenInfo = []
+ Object.keys(CONFIG_DATA[chain]).map((key) => {
+ supplyCalls.push(CONFIG_DATA[chain][key]);
+ tokenInfo.push(TOKEN_DATA[key]);
+ })
- let [bct, nct] = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, })
+ const resp = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls, })
+ const tokensArray = resp.map((obj, i) => {
+ const validUntil = tokenInfo[i].validUntil
+ if (validUntil && api.timestamp > validUntil)
+ tokenInfo[i].totalSupply = 0
+ else
+ tokenInfo[i].totalSupply = obj
+
+ return {
+ [tokenInfo[i].coingecko]: dropDecimals(tokenInfo[i].totalSupply),
+ };
+ });
- // If the current block is later than the date BCT was transferred to KlimaDAO, return 0
- if (api.timestamp > 1709828986)
- bct = 0
+ const tokens = tokensArray.reduce((acc, cur) => {
+ for (const entry of Object.entries(cur)) {
+ const [key, value] = entry;
+ acc[key] = value;
+ }
+ return acc;
+ } , {});
- return {
- 'toucan-protocol-base-carbon-tonne': bct / 1e18,
- 'toucan-protocol-nature-carbon-tonne': nct / 1e18,
- };
+ return tokens;
};
};
+const dropDecimals = (num) => {
+ return (num ?? 0) / 1e18;
+}
+
const getRegenCredits = () => {
return async () => {
const transferred = (await sdk.api.abi.call({
@@ -34,6 +55,9 @@ const getRegenCredits = () => {
module.exports = {
start: 1634842800,
+ base: {
+ tvl: getCalculationMethod("base")
+ },
celo: {
tvl: getCalculationMethod("celo")
},
diff --git a/projects/traderjoe-lb-v2-1/index.js b/projects/traderjoe-lb-v2-1/index.js
index 6921e43811..381f8ebd87 100644
--- a/projects/traderjoe-lb-v2-1/index.js
+++ b/projects/traderjoe-lb-v2-1/index.js
@@ -1,42 +1,11 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
-const { staking } = require("../helper/staking.js");
+const { staking } = require("../helper/staking.js")
+const { joeV2Export } = require('../helper/traderJoeV2')
-const factories = {
+module.exports = joeV2Export({
avax: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e',
arbitrum: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e',
bsc: '0x8e42f2F4101563bF679975178e880FD87d3eFd4e',
- ethereum: '0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a'
-}
-async function tvl(api) {
- const pools = await api.fetchList({
- target: factories[api.chain],
- itemAbi: 'function getLBPairAtIndex(uint256) view returns (address)',
- lengthAbi: 'uint256:getNumberOfLBPairs',
- })
- const tokenA = await api.multiCall({
- abi: 'address:getTokenX',
- calls: pools,
- })
- const tokenB = await api.multiCall({
- abi: 'address:getTokenY',
- calls: pools,
- })
- const toa = []
- tokenA.map((_, i) => {
- toa.push([tokenA[i], pools[i]])
- toa.push([tokenB[i], pools[i]])
- })
- return sumTokens2({ api, tokensAndOwners: toa, blacklistedTokens: [
- '0x77ea44CB68Eaadd5D7372e5602b5646475ea1C81',
- ] })
-}
-
-module.exports = {
- methodology: 'We count the token balances in in different liquidity book contracts',
-}
-
-Object.keys(factories).forEach(chain => {
- module.exports[chain] = { tvl }
+ ethereum: '0xDC8d77b69155c7E68A95a4fb0f06a71FF90B943a',
})
module.exports.arbitrum.staking = staking("0x43646A8e839B2f2766392C1BF8f60F6e587B6960", "0x371c7ec6D8039ff7933a2AA28EB827Ffe1F52f07")
\ No newline at end of file
diff --git a/projects/traderjoe-lb-v2-2/index.js b/projects/traderjoe-lb-v2-2/index.js
new file mode 100644
index 0000000000..e2028cfd49
--- /dev/null
+++ b/projects/traderjoe-lb-v2-2/index.js
@@ -0,0 +1,7 @@
+//const { staking } = require("../helper/staking.js")
+const { joeV2Export } = require('../helper/traderJoeV2')
+
+module.exports = joeV2Export({
+ avax: '0xb43120c4745967fa9b93E79C149E66B0f2D6Fe0c',
+ arbitrum: '0xb43120c4745967fa9b93E79C149E66B0f2D6Fe0c',
+})
\ No newline at end of file
diff --git a/projects/tradoor/index.js b/projects/tradoor/index.js
new file mode 100644
index 0000000000..ebe0c7c6bd
--- /dev/null
+++ b/projects/tradoor/index.js
@@ -0,0 +1,11 @@
+const { sumTokensExport } = require("../helper/chain/ton");
+const ADDRESSES = require("../helper/coreAssets.json");
+
+const evaaScAddr = "EQBPAMNu5Eud9AEvplOjNlRhxI4EkuJEhEMAmxh9erxmImKs"
+
+module.exports = {
+ methodology: 'Counts Tradoor smartcontract balance as TVL.',
+ ton: {
+ tvl: sumTokensExport({ owner: evaaScAddr, tokens: [ADDRESSES.null]}),
+ }
+}
diff --git a/projects/treasury/convex.js b/projects/treasury/convex.js
index f7aafb92a0..61d5bbf6ec 100644
--- a/projects/treasury/convex.js
+++ b/projects/treasury/convex.js
@@ -1,32 +1,75 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { nullAddress, treasuryExports } = require("../helper/treasury");
+const { staking } = require("../helper/staking");
+const { mergeExports } = require('../helper/utils');
+const {
+ genericUnwrapCvxRewardPool,
+ genericUnwrapCvxFraxFarm,
+ genericUnwrapCvxPrismaPool,
+ genericUnwrapCvxCurveLendRewardPool,
+} = require('../helper/unwrapLPs');
const convexTreasuryVault = "0x1389388d01708118b497f59521f6943Be2541bb7";
-const treasuryARB = "0x6111abf720051309012fcdbc2910054e41dcff8c"
-module.exports = treasuryExports({
+const treasuryManagerPositions = [{
+ type: 'convex-curve-lp',
+ manager: '0xa25B17D7deEE59f9e326e45cC3C0C1B158E74316', // #1
+ curveLpStakingContract: '0x39D78f11b246ea4A1f68573c3A5B64E83Cff2cAe', // cvxCRV/CRV
+}, {
+ type: 'convex-curve-lp',
+ manager: '0xeB8121b44a290eE16981D87B92fc16b2366dE6B3', // #2
+ curveLpStakingContract: '0x19F3C877eA278e61fE1304770dbE5D78521792D2', // cvxFXS/FXS
+}, {
+ type: 'convex-frax-curve-lp',
+ manager: '0x9d464B601f74C8d3d42379921106B907F1055F80', // #3
+ fraxCurveLpStakingContract: '0xb01BaB994b52A37a231551f00a1B7cAcd43bc8C9', // frxETH/CVX
+ vaultAddress: '0x56f08393ff2e4E6b89E130646C6E7F52Af3499e5',
+}, {
+ type: 'convex-fx-curve-lp',
+ manager: '0x8BE4Ec802E8Ad5Ebf8324FC81aEa03980457eDcC', // #4
+ fxGauge: '0xfEFafB9446d84A9e58a3A2f2DDDd7219E8c94FbB', // FXN/cvxFXN
+ vaultAddress: '0x83dcBF8B0E90343FbE148F221e8f243bd16eCF46',
+}, {
+ type: 'convex-prisma-curve-lp',
+ manager: '0xD60cd4AD7A2D6bF4eC9fccbCAeec769b52726dfd', // #5
+ prismaLpStakingContract: '0xd91fBa4919b7BF3B757320ea48bA102F543dE341', // cvxPRISMA/PRISMA
+}, {
+ type: 'convex-curve-lend-lp',
+ manager: '0x04Dd97255ddeE29c941D85F5B5cdE6ace8BD207f', // #6
+ curveLpStakingContract: '0x68e400d058D4c0066344D1B3F392878e993B38Ab', // cvxCRV/CRV
+ lendVault: '0x4a7999c55d3a93dAf72EA112985e57c2E3b9e95D',
+}]
+
+async function tvl(api) {
+ for (const treasuryManagerPosition of treasuryManagerPositions) {
+ if (treasuryManagerPosition.type === 'convex-curve-lp') {
+ const { manager, curveLpStakingContract } = treasuryManagerPosition;
+ await genericUnwrapCvxRewardPool({ api, owner: manager, pool: curveLpStakingContract });
+ } else if (treasuryManagerPosition.type === 'convex-frax-curve-lp') {
+ const { vaultAddress, fraxCurveLpStakingContract } = treasuryManagerPosition;
+ await genericUnwrapCvxFraxFarm({ api, owner: vaultAddress, farm: fraxCurveLpStakingContract });
+ } else if (treasuryManagerPosition.type === 'convex-fx-curve-lp') {
+ const { vaultAddress, fxGauge } = treasuryManagerPosition;
+ await genericUnwrapCvxRewardPool({ api, owner: vaultAddress, pool: fxGauge });
+ } else if (treasuryManagerPosition.type === 'convex-prisma-curve-lp') {
+ const { manager, prismaLpStakingContract } = treasuryManagerPosition;
+ await genericUnwrapCvxPrismaPool({ api, owner: manager, pool: prismaLpStakingContract });
+ } else if (treasuryManagerPosition.type === 'convex-curve-lend-lp') {
+ const { manager, curveLpStakingContract, lendVault } = treasuryManagerPosition;
+ await genericUnwrapCvxCurveLendRewardPool({ api, owner: manager, rewardsContract: curveLpStakingContract, lendVault });
+ }
+ }
+ return api.getBalances()
+}
+
+module.exports = mergeExports([treasuryExports({
ethereum: {
- tokens: [
- nullAddress,
- ADDRESSES.ethereum.CRV,
- ADDRESSES.ethereum.SNX,
- "0x31429d1856aD1377A8A0079410B297e1a9e214c2", // ANGLE
- ADDRESSES.ethereum.LIDO,
- "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX
- "0x92E187a03B6CD19CB6AF293ba17F2745Fd2357D5", // DUCK
- ADDRESSES.ethereum.FTM,
- "0x3472A5A71965499acd81997a54BBA8D852C6E53d", // BADGER
- "0xa3BeD4E1c75D00fa6f4E5E6922DB7261B5E9AcD2", // MTA
- "0x8207c1FfC5B6804F6024322CcF34F29c3541Ae26", // OGN
- "0xCdF7028ceAB81fA0C6971208e83fa7872994beE5", // T
- ],
owners: [convexTreasuryVault],
- ownTokens: [ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.cvxCRV],
+ ownTokens: [ADDRESSES.ethereum.CVX],
},
- arbitrum: {
- tokens: [
- nullAddress,
- ],
- owners: [treasuryARB],
+}), {
+ timetravel: false, // treasuryManagerPositions match the latest contracts and positions, so wouldn't work nor be accurate for past blocks
+ ethereum: {
+ tvl,
},
-});
+}]);
diff --git a/projects/treasury/dexfinance.js b/projects/treasury/dexfinance.js
new file mode 100644
index 0000000000..d336eb63cc
--- /dev/null
+++ b/projects/treasury/dexfinance.js
@@ -0,0 +1,84 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const sdk = require('@defillama/sdk');
+const { treasuryExports } = require("../helper/treasury");
+
+const mainTreasury = '0x776e9df67667cb568f0e7951f74347fd985d615b';
+const multisig = '0xacB39b9Bf0462203b4Ca0CB74eC1AffB1b17c3b6';
+
+
+module.exports = treasuryExports({
+ arbitrum: {
+ owners: [mainTreasury, multisig],
+ tokens: [
+ ADDRESSES.arbitrum.USDC,
+ ADDRESSES.arbitrum.WETH,
+ '0x92a212d9f5eef0b262ac7d84aea64a0d0758b94f', //gdex
+ '0x4117ec0a779448872d3820f37ba2060ae0b7c34b', //usdex
+ '0x1b896893dfc86bb67cf57767298b9073d2c1ba2c', //cake
+ '0x6985884c4392d348587b19cb9eaaf157f13271cd', //zro
+ '0xd56734d7f9979dd94fae3d67c7e928234e71cd4c', //tia
+ '0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8', //pendle
+ '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe
+ '0xf97f4df75117a78c1a5a0dbb814af92458539fb4', //link
+ '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', //gmx
+ '0x912ce59144191c1204e64559fe8253a0e49e6548', //arb
+ '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', //wbtc
+ ]
+ },
+ avax: {
+ owners: [mainTreasury],
+ tokens: [
+ ADDRESSES.avax.USDT_e,
+ ADDRESSES.avax.WETH_e,
+ ]
+ },
+ optimism: {
+ owners: [mainTreasury],
+ tokens: [
+ ADDRESSES.optimism.OP,
+ ADDRESSES.optimism.WETH,
+ ADDRESSES.optimism.USDC,
+ ]
+ },
+ manta: {
+ owners: [mainTreasury],
+ tokens: [
+ ADDRESSES.manta.USDC,
+ '0x95cef13441be50d20ca4558cc0a27b601ac544e5', //MANTA
+ '0x4c2a0f964a37a3ce305fe41c575beeb48c8c3fa2', //gCETO
+ '0x3af03e8c993900f0ea6b84217071e1d4cc783982', //CETO
+ '0xe68874e57224d1e4e6d4c6b4cf5af7ca51867611', //bCETO
+ '0x6da9ebd271a0676f39c088a2b5fd849d5080c0af', //USDEX
+ ]
+ },
+ // pulse: {
+ // owners: [mainTreasury],
+ // tokens: [
+ // ADDRESSES.pulse.WETH,
+ // '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //usdc(fork)
+ // '0x30fcb23a906493371b1721c8feb8815804808d74', //sdai
+ // '0xaa2c47a35c1298795b5271490971ec4874c8e53d', //usdex
+ // '0x6386704cd6f7a584ea9d23ccca66af7eba5a727e', //spark
+ // ]
+ // },
+ base: {
+ owners: [mainTreasury],
+ tokens: [
+ ADDRESSES.base.USDC,
+ '0x532f27101965dd16442e59d40670faf5ebb142e4', //brett
+ '0xece7b98bd817ee5b1f2f536daf34d0b6af8bb542', //rock
+ '0x5babfc2f240bc5de90eb7e19d789412db1dec402', //circle
+ '0x6921b130d297cc43754afba22e5eac0fbf8db75b', //doginme
+ '0x7d9ce55d54ff3feddb611fc63ff63ec01f26d15f', //fungi
+ '0xcde90558fc317c69580deeaf3efc509428df9080', //normilio
+ '0xba0dda8762c24da9487f5fa026a9b64b695a07ea', //ox
+ '0xa3d1a8deb97b111454b294e2324efad13a9d8396', //ovn
+ '0xb79dd08ea68a908a97220c76d19a6aa9cbde4376', //usd+
+ '0x940181a94a35a4569e4529a3cdfb74e38fd98631', //aero
+ '0x7f62ac1e974d65fab4a81821ca6af659a5f46298', //wels
+ '0x78b3c724a2f663d11373c4a1978689271895256f', //tkn
+ '0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452', //wsteth
+ '0x373504da48418c67e6fcd071f33cb0b3b47613c7', //wbasedoge
+ ]
+ },
+})
\ No newline at end of file
diff --git a/projects/treasury/fjord-foundry.js b/projects/treasury/fjord-foundry.js
new file mode 100644
index 0000000000..df947c9c86
--- /dev/null
+++ b/projects/treasury/fjord-foundry.js
@@ -0,0 +1,16 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { treasuryExports, nullAddress } = require("../helper/treasury");
+
+const treasury = "0xcA518c4DB97ECCe85cC82DE3C2B93D8f8b536ca5" // https://x.com/dcfgod/status/1815970805878034797
+
+module.exports = treasuryExports({
+ ethereum: {
+ tokens: [
+ nullAddress,
+ ADDRESSES.ethereum.USDC,
+ ADDRESSES.ethereum.USDT
+ ],
+ owners: [treasury],
+ },
+
+})
\ No newline at end of file
diff --git a/projects/treasury/golem.js b/projects/treasury/golem.js
index 9095d252ab..7dc4a819b2 100644
--- a/projects/treasury/golem.js
+++ b/projects/treasury/golem.js
@@ -1,3 +1,4 @@
+const ADDRESSES = require('../helper/coreAssets.json')
const { nullAddress, treasuryExports } = require("../helper/treasury");
const { mergeExports } = require('../helper/utils');
@@ -20,7 +21,7 @@ module.exports = treasuryExports({
async function tvl(api) {
if(api.timestamp > 1687828149){
// Staked 100k ETH in validators
- api.add("0x0000000000000000000000000000000000000000", 100e3*1e18)
+ api.add(ADDRESSES.null, 100e3*1e18)
}
return api.getBalances()
}
diff --git a/projects/treasury/klima-dao.js b/projects/treasury/klima-dao.js
index 07fcc23911..5059eb015f 100644
--- a/projects/treasury/klima-dao.js
+++ b/projects/treasury/klima-dao.js
@@ -1,10 +1,26 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { nullAddress, treasuryExports } = require("../helper/treasury");
+
const klimaTreasury1 = "0x7dd4f0b986f032a44f913bf92c9e8b7c17d77ad7";
-const daoWallet = "0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c"
+const daoWallet_polygon = "0x65A5076C0BA74e5f3e069995dc3DAB9D197d995c"
+const daoWallet_base = "0xa79cd47655156b299762dfe92a67980805ce5a31"
+
+const KLIMA_polygon = "0x4e78011ce80ee02d2c3e649fb657e45898257815"; // on polygon
+const KLIMA_base = "0xdcefd8c8fcc492630b943abcab3429f12ea9fea2"; // on base
+
+const AERO = "0x940181a94A35A4569E4529A3CDfB74e38FD98631";
+const aeroVotingEscrow = "0xebf418fe2512e7e6bd9b87a8f0f294acdc67e6b4";
-const KLIMA = "0x4e78011ce80ee02d2c3e649fb657e45898257815";
+// aerodrome pools
+// const vAMM_WETH_KLIMA = "0xB37642E87613d8569Fd8Ec80888eA6c63684E79e"
+
+const veAEROIds = [
+ "22922",
+ "20882",
+ "20680",
+ "19983",
+];
module.exports = treasuryExports({
polygon: {
@@ -33,7 +49,23 @@ module.exports = treasuryExports({
"0x672688C6Ee3E750dfaA4874743Ef693A6f2538ED", // CRISP-C
"0x82B37070e43C1BA0EA9e2283285b674eF7f1D4E2", // CCO2
],
- owners: [klimaTreasury1, daoWallet],
- ownTokens: [KLIMA],
+ owners: [klimaTreasury1, daoWallet_polygon],
+ ownTokens: [KLIMA_polygon],
+ },
+ base: {
+ tokens: [
+ nullAddress,
+ ADDRESSES.base.USDC, // USDC
+ //ADDRESSES.base.USDT,
+ ADDRESSES.base.WETH,
+ '0x576Bca23DcB6d94fF8E537D88b0d3E1bEaD444a2', // BCT (base address)
+ '0x20b048fa035d5763685d695e66adf62c5d9f5055', // CHAR
+ AERO,
+ ],
+ solidlyVeNfts: [
+ { baseToken: AERO, veNft: aeroVotingEscrow},
+ ],
+ owners: [daoWallet_base],
+ ownTokens: [KLIMA_base],
},
-})
+});
diff --git a/projects/treasury/magpie.js b/projects/treasury/magpie.js
new file mode 100644
index 0000000000..5f296e72c6
--- /dev/null
+++ b/projects/treasury/magpie.js
@@ -0,0 +1,41 @@
+const { treasuryExports } = require("../helper/treasury");
+const { mergeExports } = require('../helper/utils');
+
+const magpieTreasury = "0x6dc8ccf1b731e97834002e6ff45e4953bf9602de";
+const vlpnp_staking = "0xc61D3c70CfC9dEDaA090FDD0760Eb9291253fEFF";
+const vlrdp_staking = "0x07973730596E7dbA60E586CDC3dD48d2886Df9dd";
+const pnp_arb = "0x2Ac2B254Bc18cD4999f64773a966E4f4869c34Ee"
+const rdp_arb = "0x54bdbf3ce36f451ec61493236b8e6213ac87c0f6"
+const ckp_bsc = "0x2B5D9ADea07B590b638FFc165792b2C610EdA649"
+const vlckp_staking = "0x232594e7F0096ba7DDAbcD8689cB0D994694eb26"
+const mgp = "0xD06716E1Ff2E492Cc5034c2E81805562dd3b45fa";
+
+//counting staked tokens in each chain
+const stakedExports = {
+ arbitrum: {
+ tvl: async (api) => {
+ let bal_vlpnp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlpnp_staking, })
+ api.add(pnp_arb, bal_vlpnp);
+ let bal_vlrdp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlrdp_staking, })
+ api.add(rdp_arb, bal_vlrdp);
+ return api.getBalances();
+ },
+ },
+ bsc: {
+ tvl: async (api) => {
+ let bal_vlckp = await api.multiCall({ abi: 'function getUserTotalLocked(address) view returns(uint256 _lockAmount)', calls: [magpieTreasury], target: vlckp_staking, })
+ api.add(ckp_bsc, bal_vlckp);
+ return api.getBalances();
+ },
+ },
+}
+
+const treasuryExportsObj = treasuryExports({
+ ethereum: { owners: [magpieTreasury], },
+ bsc: {
+ owners: [magpieTreasury],
+ ownTokens: [mgp]
+ },
+})
+
+module.exports = mergeExports([treasuryExportsObj, stakedExports])
diff --git a/projects/treasury/redacted.js b/projects/treasury/redacted.js
index 0dcf99dcbd..117be41936 100644
--- a/projects/treasury/redacted.js
+++ b/projects/treasury/redacted.js
@@ -8,6 +8,7 @@ const treasury4 = "0xa722ebccd25adb06e5d0190b240d1f4039839822"
const treasury5OP = "0x2e33a660742e813ad948fb9f7d682fe461e5fbf3"
const treasury6ARB = "0x64769c53ff91b83fe9830776a4b85a1f4e1edaad"
const BTRF = "0xc55126051B22eBb829D00368f4B12Bde432de5Da"
+const DINERO = "0x6DF0E641FC9847c0c6Fde39bE6253045440c14d3"
module.exports = treasuryExports({
ethereum: {
@@ -23,7 +24,7 @@ module.exports = treasuryExports({
"0xBCe0Cf87F513102F22232436CCa2ca49e815C3aC",
ADDRESSES.ethereum.CRV,
],
- ownTokens: [BTRF],
+ ownTokens: [BTRF, DINERO],
owners: [treasury, treasury2,treasury3,treasury4],
},
optimism: {
diff --git a/projects/treasury/ribbon.js b/projects/treasury/ribbon.js
index 899bc9c364..4e6ebcaac8 100644
--- a/projects/treasury/ribbon.js
+++ b/projects/treasury/ribbon.js
@@ -6,6 +6,7 @@ const treasury = "0xDAEada3d210D2f45874724BeEa03C7d4BBD41674";
const treasury2 = "0x42c1357aaa3243ea30c713cdfed115d09f10a71d"
const treasury3 = "0x6adeb4fddb63f08e03d6f5b9f653be8b65341b35"
const RBN = "0x6123B0049F904d730dB3C36a31167D9d4121fA6B";
+const AEVO = ADDRESSES.ethereum.AEVO
module.exports = treasuryExports({
ethereum: {
@@ -31,6 +32,7 @@ module.exports = treasuryExports({
ownTokens: [
RBN,
"0xd590931466cdD6d488A25da1E89dD0539723800c", // 50RBN-50USDC
+ AEVO
],
},
});
diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js
index f86dddf3eb..47ddb3f1ac 100644
--- a/projects/treasury/safe.js
+++ b/projects/treasury/safe.js
@@ -2,6 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json')
const { nullAddress,treasuryExports } = require("../helper/treasury");
const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" //
+const SAFE = ADDRESSES.ethereum.SAFE
+const safe_foundation_treasury = "0x1d4f25bc16b68c50b78e1040bc430a8097fd6f45"
+const safe_dao_2 = "0x0b00b3227a5f3df3484f03990a87e02ebad2f888"
+
module.exports = treasuryExports({
optimism: {
@@ -11,5 +15,12 @@ module.exports = treasuryExports({
],
owners: [treasury],
},
+ ethereum: {
+ tokens: [
+ nullAddress,
+ ],
+ owners: [safe_foundation_treasury, safe_dao_2],
+ ownTokens: [SAFE],
+ },
})
\ No newline at end of file
diff --git a/projects/treasury/sudoswap.js b/projects/treasury/sudoswap.js
index 902d6e480c..b1206c70d9 100644
--- a/projects/treasury/sudoswap.js
+++ b/projects/treasury/sudoswap.js
@@ -20,4 +20,11 @@ module.exports = treasuryExports({
"0xb23d80f5FefcDDaa212212F028021B41DEd428CF", //PRIME
],
},
+ sanko: {
+ owners: ["0x5bfe2ef160eaaaa4afa89a8fa09775b6580162c9"],
+ ownTokens: [],
+ tokens: [
+ nullAddress,
+ ],
+ },
});
\ No newline at end of file
diff --git a/projects/treasury/unore.js b/projects/treasury/unore.js
index b7cd8bbc6c..d12966f9d2 100644
--- a/projects/treasury/unore.js
+++ b/projects/treasury/unore.js
@@ -1,6 +1,7 @@
const ADDRESSES = require("../helper/coreAssets.json");
const { treasuryExports, nullAddress } = require("../helper/treasury");
-const multisig='0x46488d2D36D8983de980Ff3b9f046DCd0a9DC2ae'
+const multisig='0x46488d2D36D8983de980Ff3b9f046DCd0a9DC2ae';
+const multisig2='0x4aede441085398BD74FeB9eeFCfe08E709e69ABF'
const UNO = "0x474021845c4643113458ea4414bdb7fb74a01a77";
@@ -13,7 +14,7 @@ module.exports = treasuryExports({
ADDRESSES.ethereum.WETH,//WETH
ADDRESSES.ethereum.USDT,//USDT
],
- owners: [multisig],
+ owners: [multisig,multisig2],
ownTokens: [UNO],
},
});
diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js
index e4ff6d42de..2098881e80 100644
--- a/projects/treasury/venus.js
+++ b/projects/treasury/venus.js
@@ -1,25 +1,63 @@
-const ADDRESSES = require('../helper/coreAssets.json')
-const { nullAddress,treasuryExports } = require("../helper/treasury");
+const ADDRESSES = require("../helper/coreAssets.json");
+const { nullAddress, treasuryExports } = require("../helper/treasury");
const venusTreasury = "0xF322942f644A996A617BD29c16bd7d231d9F35E9";
const XVS = "0xcf6bb5389c92bdda8a3747ddb454cb7a64626c63";
const venusBTC = "0x882C173bC7Ff3b7786CA16dfeD3DFFfb9Ee7847B";
-const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7"
-
+const VAI = "0x4BD17003473389A42DAF6a0a729f6Fdb328BbBd7";
module.exports = treasuryExports({
bsc: {
- tokens: [
- nullAddress,
- ADDRESSES.bsc.USDT,//bsc-usdc
- ADDRESSES.bsc.USDC,//usdc
- ADDRESSES.bsc.BTCB,//BTCB
- '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3',//DAI
- ADDRESSES.bsc.BETH,//BETH
-
- ],
+ tokens: [
+ nullAddress,
+ ADDRESSES.bsc.USDT, //bsc-usdc
+ ADDRESSES.bsc.USDC, //usdc
+ ADDRESSES.bsc.BTCB, //BTCB
+ "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", //DAI
+ ADDRESSES.bsc.BETH, //BETH
+ ADDRESSES.bsc.WBNB,
+ venusBTC,
+ "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", //eth
+ "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC
+ "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH
+ "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT
+ "0xB248a295732e0225acd3337607cc01068e3b9c10", // venusXRP
+ "0x95c78222B3D6e262426483D42CfA53685A67Ab9D", // venusBUSD
+ "0xA07c5b74C9B40447a954e1466938b865b6BBea36", // venusBNB
+ "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", //cake
+ "0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11", //thena
+ "0x4338665CBB7B2485A8855A139b75D5e34AB0DB94", //ltc
+ "0xfb5B838b6cfEEdC2873aB27866079AC55363D37E", //floki
+ "0x20eE7B720f4E4c4FFcB00C4065cdae55271aECCa", //nft
+ "0xBf5140A22578168FD562DCcF235E5D43A02ce9B1", //uni
+ "0x47BEAd2563dCBf3bF2c9407fEa4dC236fAbA485A", //sxp
+ "0x7083609fCE4d1d8Dc0C979AAb8c869Ea2C873402", //dot
+ "0x1D2F0da169ceB9fC7B3144628dB156f3F6c60dBE", //xrp
+ "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", //ada
+ "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", //link
+ "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", //doge
+ "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9", //tusd
+ "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", //fil
+ "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", //matic
+ "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd
+ "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", //ankrbnb
+ "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3", //trx
+ "0x352Cb5E19b12FC216548a2677bD0fce83BaE434B", //btt
+ "0x8fF795a6F4D97E7887C79beA79aba5cc76444aDf", //bch
+ "0xd17479997F34dd9156Deef8F95A52D81D265be9c", //usdd
+ "0x302cD8973bE5CA2334B4ff7e7b01BA41455559b3", //ethw
+ "0x1bdd3Cf7F79cfB8EdbB955f20ad99211551BA275", //bnbx
+ "0x965F527D9159dCe6288a2219DB51fc6Eef120dD1", //bsw
+ "0xc2E9d07F66A89c44062459A47a0D2Dc038E4fb16", //stkbnb
+ "0xaeF0d72a118ce24feE3cD1d43d383897D05B4e99", //win
+ "0x0782b6d8c4551B9760e74c0545a9bCD90bdc41E5", //lisusd
+ "0x12BB890508c125661E03b09EC06E404bc9289040", //raca
+ "0x4B0F1812e5Df2A09796481Ff14017e6005508003", //twt
+ "0x8F0528cE5eF7B51152A59745bEfDD91D97091d2F", //alpaca
+ "0x12f31B73D812C6Bb0d735a218c086d44D5fe5f89", //ageur
+ ],
owners: [venusTreasury],
- ownTokens: [XVS, venusBTC, VAI],
+ ownTokens: [XVS, VAI],
},
-})
\ No newline at end of file
+});
diff --git a/projects/treasury/zerolend.js b/projects/treasury/zerolend.js
new file mode 100644
index 0000000000..98d58291a7
--- /dev/null
+++ b/projects/treasury/zerolend.js
@@ -0,0 +1,23 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs.js");
+
+const linea = {
+ weth: ADDRESSES.linea.WETH,
+ zero: "0x78354f8DcCB269a615A7e0a24f9B0718FDC3C7A7",
+ treasury: "0x14aAD4668de2115e30A5FeeE42CFa436899CCD8A",
+};
+
+module.exports = {
+ linea: {
+ tvl: sumTokensExport({
+ owner: linea.treasury,
+ chain: "linea",
+ tokens: [linea.weth, nullAddress],
+ }),
+ ownTokens: sumTokensExport({
+ owner: linea.treasury,
+ tokens: [linea.zero],
+ chain: "linea",
+ }),
+ },
+};
diff --git a/projects/treasury/zunami.js b/projects/treasury/zunami.js
index 04bc565e90..fe86071152 100644
--- a/projects/treasury/zunami.js
+++ b/projects/treasury/zunami.js
@@ -2,6 +2,7 @@ const { nullAddress, treasuryExports } = require("../helper/treasury");
const ADDRESSES = require("../helper/coreAssets.json");
const treasury = "0xb056b9a45f09b006ec7a69770a65339586231a34";
+const ZUN = "0x6b5204b0be36771253cc38e88012e02b752f0f36"
module.exports = treasuryExports({
ethereum: {
@@ -16,6 +17,7 @@ module.exports = treasuryExports({
"0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT
"0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS
],
- owners: [treasury]
+ owners: [treasury],
+ ownTokens: [ZUN]
}
});
\ No newline at end of file
diff --git a/projects/truefi/abi.json b/projects/truefi/abi.json
index c291f46fb2..ad9087e274 100644
--- a/projects/truefi/abi.json
+++ b/projects/truefi/abi.json
@@ -9,5 +9,7 @@
"liquidValue": "uint256:liquidValue",
"getAssetVaults": "address[]:getAssetVaults",
"liquidAssets": "uint256:liquidAssets",
- "outstandingAssets": "uint256:outstandingAssets"
+ "outstandingAssets": "uint256:outstandingAssets",
+ "getAlocVaults": "address[]:getPortfolios",
+ "borrowedAssets": "uint256:borrowedAmount"
}
\ No newline at end of file
diff --git a/projects/truefi/index.js b/projects/truefi/index.js
index 2a4291a383..87aef85eb8 100644
--- a/projects/truefi/index.js
+++ b/projects/truefi/index.js
@@ -5,6 +5,9 @@ const stkTRU = '0x23696914Ca9737466D8553a2d619948f548Ee424'
const TRU = '0x4C19596f5aAfF459fA38B0f7eD92F11AE6543784'
const managedPortfolioFactory = '0x17b7b75FD4288197cFd99D20e13B0dD9da1FF3E7'
const assetVaultFactory = '0x5Def383172C7dFB6F937e32aDf5be4D252168eDA'
+const alocVaultFactory = '0x1672f101be9FfE121AfF7514B373e956272fe249'
+
+const alocVaultFactoryArbitrum = '0xCA1353dAB799d87D70E3750c2280205A5c8f62e9'
const pools = [
'0x97cE06c3e3D027715b2d6C22e67D5096000072E5', // TUSD
@@ -29,15 +32,36 @@ async function getAllTvl(api, isBorrowed) {
const avLiquidAssets = await api.multiCall({ calls: assetVaults, abi: abi.liquidAssets, })
const avIlliquidAssets = await api.multiCall({ calls: assetVaults, abi: abi.outstandingAssets, })
+ const alocVaults = await api.call({target: alocVaultFactory, abi: abi.getAlocVaults})
+ const alocUnderlyingTokens = await api.multiCall({calls: alocVaults, abi: abi.asset})
+ const alocLiquidAssets = await api.multiCall({calls: alocVaults, abi: abi.liquidAssets})
+ const alocIlliquidAssets = await api.multiCall({calls: alocVaults, abi: abi.borrowedAssets})
+
if (!isBorrowed) {
api.addTokens(tokens, currencyBalance)
api.addTokens(underlyingToken, liquidValue)
api.addTokens(avUnderlyingTokens, avLiquidAssets)
+ api.addTokens(alocUnderlyingTokens, alocLiquidAssets)
} else {
api.addTokens(tokens, loansValue)
api.addTokens(underlyingToken, illiquidValue)
api.addTokens(avUnderlyingTokens, avIlliquidAssets)
+ api.addTokens(alocUnderlyingTokens, alocIlliquidAssets)
+ }
+}
+
+async function getArbitrumTvl(api, isBorrowed) {
+ const alocVaults = await api.call({target: alocVaultFactoryArbitrum, abi: abi.getAlocVaults, chain: 'arbitrum'})
+ const alocUnderlyingTokens = await api.multiCall({calls: alocVaults, abi: abi.asset, chain: 'arbitrum'})
+ const alocLiquidAssets = await api.multiCall({calls: alocVaults, abi: abi.liquidAssets, chain: 'arbitrum'})
+ const alocIlliquidAssets = await api.multiCall({calls: alocVaults, abi: abi.borrowedAssets, chain: 'arbitrum'})
+
+ if(!isBorrowed) {
+ api.addTokens(alocUnderlyingTokens, alocLiquidAssets)
+ } else {
+ api.addTokens(alocUnderlyingTokens, alocIlliquidAssets)
}
+
}
async function borrowed(api) {
@@ -48,11 +72,23 @@ async function tvl(api) {
return getAllTvl(api, false)
}
+async function borrowedArbitrum(api) {
+ return getArbitrumTvl(api, true)
+}
+
+async function tvlArbitrum(api) {
+ return getArbitrumTvl(api, false)
+}
+
module.exports = {
start: 1605830400, // 11/20/2020 @ 12:00am (UTC)
ethereum: {
tvl,
staking: staking(stkTRU, TRU),
borrowed,
+ },
+ arbitrum: {
+ tvl: tvlArbitrum,
+ borrowed: borrowedArbitrum,
}
}
\ No newline at end of file
diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js
index b070741614..c9a9b38a22 100644
--- a/projects/trufin-trustake/index.js
+++ b/projects/trufin-trustake/index.js
@@ -1,4 +1,15 @@
const ADDRESSES = require('../helper/coreAssets.json')
+const { function_view } = require('../helper/chain/aptos')
+
+const TRUSTAKE_APT_CONTRACT_ADDR = "0x6f8ca77dd0a4c65362f475adb1c26ae921b1d75aa6b70e53d0e340efd7d8bc80"
+const MODULE = "staker"
+const FUNCTION = "total_staked"
+
+async function aptosTvl(api) {
+ const totalStaked = await function_view({ functionStr: `${TRUSTAKE_APT_CONTRACT_ADDR}::${MODULE}::${FUNCTION}` })
+ api.add(ADDRESSES.aptos.APT, totalStaked[0])
+}
+
const abi = {
"totalShares": "uint256:totalShares",
"sharePrice": "function sharePrice() external view returns (uint256, uint256)",
@@ -20,5 +31,8 @@ module.exports = {
methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`,
ethereum: {
tvl
+ },
+ aptos: {
+ tvl: aptosTvl
}
}
diff --git a/projects/txBridge/index.js b/projects/txBridge/index.js
index 5e7d9d935d..3c27fe9844 100644
--- a/projects/txBridge/index.js
+++ b/projects/txBridge/index.js
@@ -8,6 +8,7 @@ module.exports = {
owners: [
"0x32400084C286CF3E17e7B677ea9583e60a000324",
"0x57891966931Eb4Bb6FB81430E6cE0A03AAbDe063",
+ "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB"
],
fetchCoValentTokens: true,
}),
diff --git a/projects/tymio/index.js b/projects/tymio/index.js
new file mode 100644
index 0000000000..9116ba6771
--- /dev/null
+++ b/projects/tymio/index.js
@@ -0,0 +1,18 @@
+const config = {
+ ethereum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6',
+ arbitrum: '0xB67D637B1301EEb56Dba4555bBd15Cd220F1aaD6',
+};
+
+module.exports = {
+ methodology: 'Obtaining all authorized assets on deployed project contracts',
+}
+
+Object.keys(config).forEach(chain => {
+ const contract = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ const tokens = await api.fetchList({ lengthAbi: 'acceptableTokensArrayLength', itemAbi: 'acceptableTokensArray', target: contract})
+ return api.sumTokens({ tokens, owner: contract })
+ }
+ }
+})
\ No newline at end of file
diff --git a/projects/unbound/index.js b/projects/unbound/index.js
index be951d9483..fa320ce92a 100644
--- a/projects/unbound/index.js
+++ b/projects/unbound/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { GraphQLClient, gql } = require('graphql-request')
const { staking } = require("../helper/staking");
@@ -10,7 +11,7 @@ const UNB_POLY = '0xD81F558b71A5323e433729009D55159955F8A7f9'
async function ethTvl() {
- var endpoint = 'https://api.thegraph.com/subgraphs/name/unbound-finance/unbound'
+ var endpoint = sdk.graph.modifyEndpoint('8hYGnnqzaQ98ikvhi9uZ5GRmYjd7C2ykopeNpbA3DXUh')
var graphQLClient = new GraphQLClient(endpoint)
var query = gql`
@@ -40,7 +41,7 @@ async function ethTvl() {
}
async function polyTvl() {
- var endpoint = 'https://api.thegraph.com/subgraphs/name/unbound-finance/unbound-polygon'
+ var endpoint = sdk.graph.modifyEndpoint('EtpUNR2s35iZNRGfQ5vqCSayGf72THHd1duUtkxKreGU')
var graphQLClient = new GraphQLClient(endpoint)
var query = gql`
diff --git a/projects/unicrypt/apiCache.js b/projects/unicrypt/apiCache.js
index 9065e8b6db..a593eb0930 100644
--- a/projects/unicrypt/apiCache.js
+++ b/projects/unicrypt/apiCache.js
@@ -1,9 +1,9 @@
const sdk = require('@defillama/sdk');
const { config, protocolPairs, tokens, stakingContracts,
- ethereumContractData, bscContractData, polygonContractData,
- avalancheContractData, gnosisContractData,arbitrumContractData, } = require('./config')
- const { getCache, setCache, } = require("../helper/cache")
- const { vestingHelper, } = require("../helper/unknownTokens")
+ ethereumContractData, baseContractData, bscContractData, polygonContractData,
+ avalancheContractData, gnosisContractData, arbitrumContractData, } = require('./config')
+const { getCache, setCache, } = require("../helper/cache")
+const { vestingHelper, } = require("../helper/unknownTokens")
const project = 'bulky/unicrypt'
const { stakings } = require("../helper/staking");
@@ -87,6 +87,9 @@ module.exports = {
[protocolPairs.uncx_WETH],
config.uniswapv2.chain)
},
+ base: {
+ tvl: tvl(baseContractData)
+ },
bsc: {
tvl: tvl(bscContractData),
@@ -97,8 +100,8 @@ module.exports = {
polygon: {
tvl: tvl(polygonContractData)
},
- avax: { tvl: tvl(avalancheContractData) },
- arbitrum: { tvl: tvl(arbitrumContractData) },
+ avax: { tvl: tvl(avalancheContractData) },
+ arbitrum: { tvl: tvl(arbitrumContractData) },
xdai: {
tvl: tvl(gnosisContractData),
pool2: pool2s([config.honeyswap.locker],
diff --git a/projects/unicrypt/config.js b/projects/unicrypt/config.js
index 9b0fd29eae..fb9ad32d89 100644
--- a/projects/unicrypt/config.js
+++ b/projects/unicrypt/config.js
@@ -107,6 +107,18 @@ const config = {
locker: '0xe3D32266974f1E8f8549cAf9F54977040e7D1c07',
factory: '0xa818b4f111ccac7aa31d0bcc0806d64f2e0737d7',
startBlock: 14476818
+ },
+ uniswapV2_base: {
+ chain: 'base',
+ locker: '0xc4E637D37113192F4F1F060DaEbD7758De7F4131',
+ factory: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6',
+ startBlock: 12110643
+ },
+ sushiswapV2_base: {
+ chain: 'base',
+ locker: '0xBeddF48499788607B4c2e704e9099561ab38Aae8',
+ factory: '0x71524B4f93c58fcbF659783284E38825f0622859',
+ startBlock: 10577634
}
}
@@ -138,6 +150,23 @@ const ethereumContractData = [
}
]
+const baseContractData = [
+ { // Uniswap v2
+ chain: config.uniswapV2_base.chain,
+ contract: config.uniswapV2_base.locker,
+ getNumLockedTokensABI: getNumLockedTokens,
+ getLockedTokenAtIndexABI: getLockedTokenAtIndex,
+ factory: config.uniswapV2_base.factory
+ },
+ { // Sushiswap
+ chain: config.sushiswapV2_base.chain,
+ contract: config.sushiswapV2_base.locker,
+ getNumLockedTokensABI: getNumLockedTokens,
+ getLockedTokenAtIndexABI: getLockedTokenAtIndex,
+ factory: config.sushiswapV2_base.factory
+ },
+]
+
const bscContractData = [
{ // Pancakeswap v2
chain: config.pancakeswapv2.chain,
@@ -236,6 +265,7 @@ const arbitrumContractData = [
module.exports = {
+ baseContractData,
ethereumContractData,
bscContractData,
polygonContractData,
diff --git a/projects/unicrypt/index.js b/projects/unicrypt/index.js
index 179fbaf629..3bce8bb712 100644
--- a/projects/unicrypt/index.js
+++ b/projects/unicrypt/index.js
@@ -1,104 +1 @@
-const sdk = require('@defillama/sdk');
-const { config, protocolPairs, tokens, stakingContracts,
- ethereumContractData, bscContractData, polygonContractData,
- avalancheContractData, gnosisContractData, arbitrumContractData, } = require('./config')
-
-const { stakings } = require("../helper/staking");
-const { pool2s } = require("../helper/pool2");
-
-const { vestingHelper } = require("../helper/unknownTokens")
-
-function tvl(args) {
- return async (timestamp, ethBlock, chainBlocks) => {
- let totalBalances = {}
- for (let i = 0; i < args.length; i++) {
- const chain = args[i].chain
- const contract = args[i].contract
- let block = chainBlocks[chain]
- const { output: totalDepositId } = await sdk.api.abi.call({
- target: contract,
- abi: args[i].getNumLockedTokensABI,
- chain, block,
- })
-
- let tokens = [];
- const allDepositId = Array.from(Array(+totalDepositId).keys());
- const lpAllTokens = (
- await sdk.api.abi.multiCall({
- abi: args[i].getLockedTokenAtIndexABI,
- calls: allDepositId.map((num) => ({
- target: contract,
- params: num,
- })),
- chain: chain,
- block: block
- })
- ).output
-
- lpAllTokens.forEach(lp => {
- if (!lp.success) return;
- const lpToken = lp.output
- tokens.push(lpToken)
- })
-
- const blacklist = [...(args[i].pool2 || [])]
-
- if (chain === 'ethereum')
- blacklist.push('0x72E5390EDb7727E3d4e3436451DADafF675dBCC0') // HANU
-
- let balances = await vestingHelper({
- chain, block,
- owner: contract,
- useDefaultCoreAssets: true,
- blacklist,
- tokens,
- })
-
- for (const [token, balance] of Object.entries(balances))
- sdk.util.sumSingleBalance(totalBalances, token, balance)
- }
- return totalBalances
- }
-}
-
-module.exports = {
- methodology:
- `Counts each LP pair's native token and
- stable balance, adjusted to reflect locked pair's value.
- Balances and merged across multiple
- locker and staking contracts to return sum TVL per chain`,
-
- ethereum: {
- staking: stakings(
- stakingContracts,
- tokens.uncx_eth,
- config.uniswapv2.chain
- ),
- tvl: tvl(ethereumContractData),
-
- pool2: pool2s([config.uniswapv2.locker, config.pol.locker],
- [protocolPairs.uncx_WETH],
- config.uniswapv2.chain)
- },
- bsc: {
- tvl: tvl(bscContractData),
-
- pool2: pool2s([config.pancakeswapv2.locker, config.pancakeswapv1.locker, config.safeswap.locker,
- config.julswap.locker, config.biswap.locker],
- [protocolPairs.uncx_BNB], config.pancakeswapv2.chain)
- },
- polygon: {
- tvl: tvl(polygonContractData)
- },
- avax: {
- tvl: tvl(avalancheContractData)
- },
- arbitrum: { tvl: tvl(arbitrumContractData) },
- xdai: {
- tvl: tvl(gnosisContractData),
- pool2: pool2s([config.honeyswap.locker],
- [protocolPairs.uncx_XDAI],
- config.honeyswap.chain)
- },
-}
-
+module.exports = require('./apiCache')
\ No newline at end of file
diff --git a/projects/unifarm/helper.js b/projects/unifarm/helper.js
index d73021b1fb..7cc9212972 100644
--- a/projects/unifarm/helper.js
+++ b/projects/unifarm/helper.js
@@ -1,3 +1,5 @@
+const sdk = require("@defillama/sdk");
+const { cachedGraphQuery } = require('../helper/cache')
const { graphQuery, } = require('../helper/http')
const { sleep, log } = require('../helper/utils')
const v1Data = require('./v1Data.json')
@@ -77,9 +79,9 @@ query MyQuery {
`;
const v2EndPoints = {
- ethereum: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-eth",
- polygon: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-polygon",
- bsc: "https://api.thegraph.com/subgraphs/name/themohitmadan/unifarm-bsc",
+ ethereum: sdk.graph.modifyEndpoint('Cquw1hbmvNrSvUjaqoRhu9nWv7AX1Mz2gEb9sapYdMA5'),
+ polygon: sdk.graph.modifyEndpoint('Ami8CcwigwYViJsUrwqK8DWwDPtFVAKbeYfii6ANahax'),
+ bsc: sdk.graph.modifyEndpoint('EsA5LyABgi7ibZJGNr5PQsQ2L8QDPZxNdDvd5qPs5CJj'),
}
const getV1Calls = async (chain) => {
@@ -95,7 +97,7 @@ const getV1Calls = async (chain) => {
};
const getV2Calls = async (chain) => {
- const { cohorts } = await graphQuery(v2EndPoints[chain], v2Query)
+ const { cohorts } = await cachedGraphQuery('unifarm/'+chain, v2EndPoints[chain], v2Query)
let calls = [];
for (let i = 0; i < cohorts.length; i++) {
const owner = cohorts[i].id
diff --git a/projects/unirouter/index.js b/projects/unirouter/index.js
new file mode 100644
index 0000000000..62cd1b5c31
--- /dev/null
+++ b/projects/unirouter/index.js
@@ -0,0 +1,15 @@
+const ADDRESSES = require("../helper/coreAssets.json");
+
+async function unirouterLSDTvl(api) {
+ const uBTCBalance = await api.call({
+ abi: "erc20:totalSupply",
+ target: ADDRESSES.bsquared.UBTC,
+ });
+ return await api.add(ADDRESSES.null, uBTCBalance);
+}
+
+module.exports = {
+ bsquared: {
+ tvl: unirouterLSDTvl,
+ },
+};
diff --git a/projects/uniswap-v1/index.js b/projects/uniswap-v1/index.js
index 4cf1412218..305756f274 100644
--- a/projects/uniswap-v1/index.js
+++ b/projects/uniswap-v1/index.js
@@ -1,7 +1,7 @@
const { getChainTvl } = require('../helper/getUniSubgraphTvl');
const v1graph = getChainTvl({
- ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap'
+ ethereum: 'ESnjgAG9NjfmHypk4Huu4PVvz55fUwpyrRqHF21thoLJ'
}, "uniswaps", "totalLiquidityUSD")
module.exports = {
diff --git a/projects/uniswap-v2/index.js b/projects/uniswap-v2/index.js
index f6c9eca289..631ec062bd 100644
--- a/projects/uniswap-v2/index.js
+++ b/projects/uniswap-v2/index.js
@@ -2,7 +2,7 @@ const { getChainTvl } = require('../helper/getUniSubgraphTvl');
const { getUniTVL } = require('../helper/unknownTokens');
const v2graph = getChainTvl({
- ethereum: 'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v2-dev'
+ ethereum: 'A3Np3RQbaBA6oKJgiwDJeo5T3zrYfGHPWFYayMwtNDum'
})
module.exports = {
diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js
index 6e381b717b..28d12b541b 100644
--- a/projects/uniswap/index.js
+++ b/projects/uniswap/index.js
@@ -1,16 +1,16 @@
const { uniV3Export } = require('../helper/uniswapV3')
-const { cachedGraphQuery, configPost } = require('../helper/cache')
+const { cachedGraphQuery, configPost, getConfig } = require('../helper/cache')
const { sumTokens2 } = require('../helper/unwrapLPs')
const graphs = {
- ethereum: "https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v3",
- optimism: "https://api.thegraph.com/subgraphs/name/ianlapham/optimism-post-regenesis",
- arbitrum: 'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-dev',
- polygon: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon",
- celo: "https://api.thegraph.com/subgraphs/name/jesse-sawa/uniswap-celo",
- bsc: "https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-bsc",
- avax: "https://api.thegraph.com/subgraphs/name/lynnshaoyu/uniswap-v3-avax",
- base: "https://api.studio.thegraph.com/query/48211/uniswap-v3-base/version/latest",
+ ethereum: "5AXe97hGLfjgFAc6Xvg6uDpsD5hqpxrxcma9MoxG7j7h",
+ optimism: "Cghf4LfVqPiFw6fp6Y5X5Ubc8UpmUhSfJL82zwiBFLaj",
+ arbitrum: 'FbCGRftH4a3yZugY7TnbYgPJVEv2LvMT6oF1fxPe9aJM',
+ polygon: "3hCPRGf4z88VC5rsBKU5AA9FBBq5nF3jbKJG7VZCbhjm",
+ celo: "ESdrTJ3twMwWVoQ1hUE2u7PugEHX3QkenudD6aXCkDQ4",
+ bsc: "F85MNzUGYqgSHSHRGgeVMNsdnW1KtZSVgFULumXRZTw2",
+ // avax: "3Pwd3cqFKbqKAyaJfGUVmJJ7oYbFQLDa19iB27iMxebD",
+ base: "43Hwfi3dJSoGpyas9VwNoDAv55yjgGrPpNSmbQZArzMG",
}
const blacklists = {
@@ -82,14 +82,28 @@ module.exports = {
scroll: { factory: "0x70C62C8b8e801124A4Aa81ce07b637A3e83cb919", fromBlock: 1367, },
blast: { factory: "0x792edade80af5fc680d96a2ed80a44247d2cf6fd", fromBlock: 400903, },
linea: { factory: "0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9", fromBlock: 25247, },
+ manta: { factory: "0x06D830e15081f65923674268121FF57Cc54e4e23", fromBlock: 1191705 },
+ avax: { factory: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", fromBlock: 27832972 },
+ taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 },
+ sei: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 79245151 },
+ mantle: { factory: "0x0d922Fb1Bc191F64970ac40376643808b4B74Df9", fromBlock: 63795918 }
}),
filecoin: { tvl: filecoinTvl },
}
-const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'avax', 'base']
+const chains = ['ethereum', 'arbitrum', 'optimism', 'polygon', 'bsc', 'base']
chains.forEach(chain => {
module.exports[chain] = {
tvl: v3TvlPaged(chain)
}
})
+
+module.exports.sei.tvl = async (api) => {
+ const { result } = await getConfig('oku-trade/sei', 'https://omni.icarus.tools/sei/cush/getAllPoolsInOrder')
+ const pools = result.map(i => i.pool)
+ const token0s = await api.multiCall({ abi: 'address:token0', calls: pools })
+ const token1s = await api.multiCall({ abi: 'address:token1', calls: pools })
+ const ownerTokens = pools.map((pool, i) => [[token0s[i], token1s[i]], pool])
+ return sumTokens2({ api, ownerTokens })
+}
diff --git a/projects/universal-swaps/index.js b/projects/universal-swaps/index.js
new file mode 100644
index 0000000000..56d0a3aa59
--- /dev/null
+++ b/projects/universal-swaps/index.js
@@ -0,0 +1,5 @@
+const { uniV3Export } = require("../helper/uniswapV3");
+
+module.exports = uniV3Export({
+ lukso: { factory: "0x8130c332dddf8964b08eab86aad3999017436a6e", fromBlock: 1939261, },
+});
\ No newline at end of file
diff --git a/projects/unlockd-v2/index.js b/projects/unlockd-v2/index.js
new file mode 100644
index 0000000000..c0d566ce10
--- /dev/null
+++ b/projects/unlockd-v2/index.js
@@ -0,0 +1,31 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const methodologies = require("../helper/methodologies.js");
+const uTokenAbi = {
+ "totalAvailableSupply": "function totalAvailableSupply(address) view returns (uint256)",
+ "getScaledTotalDebtMarket": "function getScaledTotalDebtMarket(address) view returns (uint256)"
+}
+const addresses = {
+ UTokenVault: "0x25299e9Ec27c242465587B8A2Aa70bcE02636cDA",
+ USDC: ADDRESSES.ethereum.USDC
+}
+
+async function tvl(api) {
+ return api.sumTokens({ owner: addresses.UTokenVault, token: addresses.USDC })
+}
+
+async function borrowed(api) {
+ const scaledDebt = await api.call({
+ target: addresses.UTokenVault,
+ params: addresses.USDC,
+ abi: uTokenAbi.getScaledTotalDebtMarket
+ });
+ api.add(addresses.USDC, scaledDebt)
+}
+
+module.exports = {
+ methodology: methodologies.lendingMarket,
+ ethereum: {
+ tvl,
+ borrowed,
+ },
+};
diff --git a/projects/untangled/index.js b/projects/untangled/index.js
index e4c3b7bf05..e3e00334a1 100644
--- a/projects/untangled/index.js
+++ b/projects/untangled/index.js
@@ -1,6 +1,7 @@
const Contracts = {
SecuritizationManager: "0x4DCC7a839CE7e952Cd90d03d65C70B9CCD6BA4C2",
USDC: "0xcebA9300f2b948710d2653dD7B07f33A8B32118C",
+ SecuritizationPoolValueService: "0x8dA445046281e6FBf2aBAd56952331B9D5Ea8d45"
};
async function tvl(api) {
@@ -11,8 +12,8 @@ async function tvl(api) {
async function borrowed(api) {
const pools = await api.fetchList({ lengthAbi: 'getPoolsLength', itemAbi: 'pools', target: Contracts.SecuritizationManager})
- const reserves = await api.multiCall({ abi: 'function getReserves() external view returns (uint256, uint256)', calls: pools })
- api.add(Contracts.USDC, reserves.map(i => i[0]))
+ const poolDebt = await api.multiCall({target: Contracts.SecuritizationPoolValueService, abi: "function getExpectedAssetsValue(address poolAddress) external view returns (uint256)", calls:pools})
+ api.add(Contracts.USDC, poolDebt)
}
module.exports = {
diff --git a/projects/upfi.js b/projects/upfi.js
deleted file mode 100644
index b99aa7be23..0000000000
--- a/projects/upfi.js
+++ /dev/null
@@ -1,18 +0,0 @@
-const { get } = require('./helper/http')
-
-async function pool2() {
- const response = await get("https://api.upfi.network/tvl")
- return {
- 'upfi-network': response.UPS_USDC,
- 'usd-coin': response.USDC_UPFI + response.UPFI_3Pool,
- }
-}
-
-module.exports = {
- timetravel: false,
- methodology: 'TVL data is pulled from the UPFI API "https://api.upfi.network/tvl".',
- solana: {
- tvl: async ()=> ({}),
- pool2,
- }
-};
diff --git a/projects/usual/index.js b/projects/usual/index.js
new file mode 100644
index 0000000000..6d5c7e3c2a
--- /dev/null
+++ b/projects/usual/index.js
@@ -0,0 +1,12 @@
+
+const { sumTokensExport } = require('../helper/unwrapLPs')
+
+const USYC = '0x136471a34f6ef19fe571effc1ca711fdb8e49f2b'
+const treasury = '0xdd82875f0840AAD58a455A70B88eEd9F59ceC7c7'
+
+module.exports = {
+ methodology: 'TVL represents the value in RWA held by the protocol',
+ ethereum: {
+ tvl: sumTokensExport({ token: USYC, owner: treasury})
+ }
+}
\ No newline at end of file
diff --git a/projects/valoro/index.js b/projects/valoro/index.js
new file mode 100644
index 0000000000..7956518530
--- /dev/null
+++ b/projects/valoro/index.js
@@ -0,0 +1,26 @@
+const { sumTokens } = require("../helper/chain/elrond");
+const { get } = require("../helper/http");
+
+const fundsOwnerSc =
+ "erd1qqqqqqqqqqqqqpgqqvj2zrdfv4lsc38p8cvh4e0yd4av6njfu7zsj7ztzl";
+
+async function getFunds(address) {
+ const fundsScs = await get(`https://api.multiversx.com/accounts/${address}/contracts`);
+ return fundsScs
+}
+
+async function tvl() {
+ const funds = await getFunds(fundsOwnerSc);
+ const owners = [
+ ...funds.map(fund => fund.address)
+ ];
+
+ return sumTokens({ owners });
+}
+
+module.exports = {
+ timetravel: false,
+ elrond: {
+ tvl,
+ },
+};
diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js
index 85c31daa45..b6eb22698c 100644
--- a/projects/vaultka/index.js
+++ b/projects/vaultka/index.js
@@ -1,6 +1,6 @@
//import utils
const ADDRESSES = require("../helper/coreAssets.json");
-
+const { staking } = require("../helper/staking");
// 19/12/2023 ALP Leverage Vault
// 29/11/2023 GMXV2 Leverage(Neutral) Vault
// 12/11/2023 GLP Compound Vault
@@ -39,6 +39,7 @@ module.exports = {
sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758",
sakeWater: "0x6b367F9EB22B2E6074E9548689cddaF9224FC0Ab",
sakeV2: "0xc53A53552191BeE184557A15f114a87a757e5b6F",
+ sakeV3: "0x7Fe1A53c23C0a7a6c9dF6560518DDE36e1dd1184",
sakeWaterV2: "0x806e8538FC05774Ea83d9428F778E423F6492475",
vodkaV1_Water: "0xC99C6427cB0B824207606dC2745A512C6b066E7C",
VodkaV1: "0x88D7500aF99f11fF52E9f185C7aAFBdF9acabD93",
@@ -108,16 +109,12 @@ module.exports = {
});
const contractAbis = {
- stakedVlpBalance:
- "function getStakedVlpBalance() public view returns (uint256)",
- stakedHlpBalance:
- "function userTokenAmount(address user) public view returns (uint256)",
- stakedAlpBalance:
- "function userInfo(address account) external view returns (uint256, uint256)",
+ stakedVlpBalance: "function getStakedVlpBalance() public view returns (uint256)",
+ stakedHlpBalance: "function userTokenAmount(address user) public view returns (uint256)",
+ stakedAlpBalance: "function userInfo(address account) external view returns (uint256, uint256)",
alpPrice: "function getAlpPrice() external view returns (uint256)", //
klpPrice: "function getKlpPrice(bool) external view returns (uint256)",
- balanceOf:
- "function balanceOf(address) external view returns (uint256)",
+ balanceOf: "function balanceOf(address) external view returns (uint256)",
};
const StakedVLPBal = await api.call({
@@ -128,6 +125,12 @@ module.exports = {
abi: contractAbis.stakedVlpBalance,
target: addresses.sakeV2,
});
+
+ const StakedVLPBalV3 = await api.call({
+ abi: contractAbis.stakedVlpBalance,
+ target: addresses.sakeV3,
+ });
+
const StakedHLPBal = await api.call({
abi: contractAbis.stakedHlpBalance,
target: addresses.hlpStaking,
@@ -163,9 +166,11 @@ module.exports = {
api.add(addresses.VLP, StakedVLPBal);
api.add(addresses.VLP, StakedVLPBalV2);
+ api.add(addresses.VLP, StakedVLPBalV3);
api.add(addresses.hlp, StakedHLPBal);
api.add(ADDRESSES.arbitrum.USDC, alpValue);
api.add(ADDRESSES.arbitrum.USDC, klpValue);
},
+ staking: staking("0xA6f217d92A1F23C0454792cb7Bf81c74C8416550", "0xAFccb724e3aec1657fC9514E3e53A0E71e80622D"),
},
};
diff --git a/projects/vega-protocol/index.js b/projects/vega-protocol/index.js
index 57d6692f7b..1e04155ce6 100644
--- a/projects/vega-protocol/index.js
+++ b/projects/vega-protocol/index.js
@@ -2,16 +2,22 @@ const { getLogs } = require('../helper/cache/getLogs')
const { sumTokens2 } = require('../helper/unwrapLPs')
const assetListedEvent = "event Asset_Listed(address indexed asset_source, bytes32 indexed vega_asset_id, uint256 nonce)"
+const assetListedTopic = "0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e"
const BigNumber = require("bignumber.js");
const config = {
ethereum: {
- fromBlock: 17343884,
+ fromBlock: 17343884,
vega: '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e',
stakingContract: '0x195064D33f09e0c42cF98E665D9506e0dC17de68',
assetPool: '0xA226E2A13e07e750EfBD2E5839C5c3Be80fE7D4d',
bridge: '0x23872549cE10B40e31D6577e0A920088B0E0666a',
vestingContract: '0x23d1bFE8fA50a167816fBD79D7932577c06011f4'
+ },
+ arbitrum: {
+ fromBlock: 213213680,
+ bridge: "0x475B597652bCb2769949FD6787b1DC6916518407",
+ assetPool: "0xCc006887FE2bfABB535030b3a9877Bb8C1e35201"
}
}
@@ -25,23 +31,24 @@ module.exports = {
Object.keys(config).forEach(chain => {
const { bridge, fromBlock, vega, stakingContract, assetPool, vestingContract } = config[chain]
- module.exports[chain] = {
+ const sums = {
tvl: async (api) => {
- const logs = await getLogs({
+ const listedAssets = await getLogs({
api,
target: bridge,
- topics: ['0x4180d77d05ff0d31650c548c23f2de07a3da3ad42e3dd6edd817b438a150452e'],
+ topics: [assetListedTopic],
eventAbi: assetListedEvent,
onlyArgs: true,
fromBlock,
})
const blacklistedTokens = []
if (vega) blacklistedTokens.push(vega)
- return sumTokens2({ api, blacklistedTokens, owner: assetPool, tokens: logs.map(i => i.asset_source) })
- },
- //staking: staking(stakingContract, vega)
- staking: async (_, _b, cb, { chain, block, api } = {}) => {
+ return sumTokens2({ api, blacklistedTokens, owner: assetPool, tokens: listedAssets.map(i => i.asset_source) })
+ }
+ }
+ if (vestingContract && stakingContract) {
+ sums.staking = async (_, _b, cb, { chain, block, api } = {}) => {
const vegaStakedInVesting = await api.call({
abi: contractAbis.totalStaked,
target: vestingContract
@@ -56,9 +63,8 @@ Object.keys(config).forEach(chain => {
return {
'0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e': BigNumber(vegaStakedInVesting).plus(BigNumber(vegaStakedInStaking)).toFixed(0)
}
-
}
}
-
+ module.exports[chain] = sums
})
diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js
index 89124b0939..f1ae88d8b5 100644
--- a/projects/vela-exchange/index.js
+++ b/projects/vela-exchange/index.js
@@ -1,60 +1,44 @@
+const sdk = require("@defillama/sdk");
const ADDRESSES = require('../helper/coreAssets.json')
const { staking } = require("../helper/staking")
const { graphQuery } = require('../helper/http')
const VELA = '0x088cd8f5eF3652623c22D48b1605DCfE860Cd704'
-const arbitrumEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official"
-const baseEndpoint = "https://api.thegraph.com/subgraphs/name/velaexchange/vela-exchange-official-base"
-async function staking_arbitrum_(api) {
+const arbitrumEndpoint = 'https://api.goldsky.com/api/public/project_clu01p4nr68r301pze2tj4sh7/subgraphs/vela-arbitrum/mainnet/gn'
+const baseEndpoint = 'https://api.goldsky.com/api/public/project_clu01p4nr68r301pze2tj4sh7/subgraphs/vela-base/mainnet/gn'
+async function velaStaking(api, endpoint) {
const query = `
- query {
- poolInfos(where: {
- id: "all"
- }) {
- pid1
- pid2
- pid3
- }
+ query {
+ poolInfos(where: {
+ id: "all"
+ }) {
+ pid1
+ pid2
+ pid3
}
- `;
- const graphRes = (await graphQuery(arbitrumEndpoint, query)).poolInfos.find(x => true);
- api.add(VELA, graphRes?.pid2)
- api.add(VELA, graphRes?.pid3)
-}
-
-async function staking_base_(api) {
-
- const query = `
- query {
- poolInfos(where: {
- id: "all"
- }) {
- pid1
- pid2
- pid3
- }
- }
- `;
- const graphRes = (await graphQuery(baseEndpoint, query)).poolInfos.find(x => true);
- api.add(VELA, graphRes?.pid2)
- api.add(VELA, graphRes?.pid3)
+ }
+ `;
+ const graphRes = (await graphQuery(endpoint, query)).poolInfos.find(x => true);
+ api.add(VELA, graphRes?.pid2);
+ api.add(VELA, graphRes?.pid3);
}
module.exports = {
methodology: "Counts USDC deposited to trade and to mint VLP. Staking counts VELA and esVELA deposited to earn esVELA",
arbitrum: {
- tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.USDC]),
- staking: staking_arbitrum_
+ tvl: staking('0xC4ABADE3a15064F9E3596943c699032748b13352', [ADDRESSES.arbitrum.USDC_CIRCLE,ADDRESSES.arbitrum.USDC, "0x724dc807b04555b71ed48a6896b6f41593b8c637"]),
+ staking: async (api) => velaStaking(api,arbitrumEndpoint)
},
base: {
start: 3566528,
tvl: staking("0xC4ABADE3a15064F9E3596943c699032748b13352", ADDRESSES.base.USDbC),
- staking: staking_base_
+ staking: async (api) => velaStaking(api,baseEndpoint)
},
hallmarks: [
[Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'],
- [1693926000, 'Launched on Base Chain']
+ [1693926000, 'Launched on Base Chain'],
+ [1721314800, 'Implemented Aave VLP supply integration']
],
}
diff --git a/projects/velodrome-v2/index.js b/projects/velodrome-v2/index.js
index b21a9461fd..eba9afb904 100644
--- a/projects/velodrome-v2/index.js
+++ b/projects/velodrome-v2/index.js
@@ -8,6 +8,18 @@ module.exports = {
allPairs: 'function allPools(uint256) view returns (address)',
}, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }),
},
+ mode: {
+ tvl: uniTvlExport("0x31832f2a97Fd20664D76Cc421207669b55CE4BC0", undefined, undefined, {
+ allPairsLength: 'uint256:allPoolsLength',
+ allPairs: 'function allPools(uint256) view returns (address)',
+ }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }),
+ },
+ bob: {
+ tvl: uniTvlExport("0x31832f2a97Fd20664D76Cc421207669b55CE4BC0", undefined, undefined, {
+ allPairsLength: 'uint256:allPoolsLength',
+ allPairs: 'function allPools(uint256) view returns (address)',
+ }, { useDefaultCoreAssets: true, hasStablePools: true, permitFailure: true, }),
+ },
hallmarks: [
[1687465883, "v2 Migration on OP Mainnet"], // https://twitter.com/VelodromeFi/status/1671979216039202816
]
diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js
index d3fb595a04..d4585e82f7 100644
--- a/projects/venus-isolated-pools/index.js
+++ b/projects/venus-isolated-pools/index.js
@@ -1,15 +1,19 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
-const sdk = require('@defillama/sdk')
const { compoundExports2 } = require('../helper/compound')
const config = {
bsc: {
- endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools',
+ endpoint: sdk.graph.modifyEndpoint('H2a3D64RV4NNxyJqx9jVFQRBpQRzD6zNZjLDotgdCrTC'),
corePools: ['0xfd36e2c2a6789db23113685031d7f16329158384'],
},
ethereum: {
- endpoint: 'https://api.thegraph.com/subgraphs/name/venusprotocol/venus-isolated-pools-ethereum',
+ endpoint: sdk.graph.modifyEndpoint('Htf6Hh1qgkvxQxqbcv4Jp5AatsaiY5dNLVcySkpCaxQ8'),
corePools: ['0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'],
- }
+ },
+ /*arbitrum: {
+ endpoint: sdk.graph.modifyEndpoint('2zqpTYBL3X1E2eb129bKno1pJdx6xBawr8urp61w33Z8'),
+ corePools: ['0x317c1A5739F39046E20b08ac9BeEa3f10fD43326']
+ },*/
}
Object.keys(config).forEach(chain => {
diff --git a/projects/venus.js b/projects/venus.js
index d60ffe1c2d..6f552d30a8 100644
--- a/projects/venus.js
+++ b/projects/venus.js
@@ -11,4 +11,5 @@ module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f1632915838
})
module.exports.ethereum = compoundExports2({ comptroller: '0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'})
-module.exports.op_bnb = compoundExports2({ comptroller: '0xd6e3e2a1d8d95cae355d15b3b9f8e5c2511874dd'})
\ No newline at end of file
+module.exports.op_bnb = compoundExports2({ comptroller: '0xd6e3e2a1d8d95cae355d15b3b9f8e5c2511874dd'})
+module.exports.arbitrum = compoundExports2({ comptroller: '0x317c1A5739F39046E20b08ac9BeEa3f10fD43326'})
\ No newline at end of file
diff --git a/projects/vertex/index.js b/projects/vertex/index.js
index c503377815..e82cca2d13 100644
--- a/projects/vertex/index.js
+++ b/projects/vertex/index.js
@@ -11,6 +11,16 @@ const config = {
"perpEngine": "0xb74C78cca0FADAFBeE52B2f48A67eE8c834b5fd1"
}
+const mantleConfig = {
+ "querier": "0x71b50Ce0E7f7B920c1BAee3BDE00F2c3F7470395",
+ //"feeCalculator": "",
+ "clearinghouse": "0x5bcfC8AD38Ee1da5F45d9795aCaDf57D37FEC172",
+ "clearinghouseLiq": "0x4b62c8179F85E399ce24fB279d44803F17118Aa4",
+ "endpoint": "0x526D7C7ea3677efF28CB5bA457f9d341F297Fd52",
+ "spotEngine": "0xb64d2d606DC23D7a055B770e192631f5c8e1d9f8",
+ "perpEngine": "0x38080ee5fb939d045A9e533dF355e85Ff4f7e13D"
+}
+
module.exports = {
arbitrum: {
@@ -18,5 +28,11 @@ module.exports = {
owners: [config.clearinghouse, config.endpoint],
tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.USDC_CIRCLE],
})
+ },
+ mantle: {
+ tvl: sumTokensExport({
+ owners: [mantleConfig.clearinghouse, mantleConfig.endpoint],
+ tokens: ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0", ADDRESSES.mantle.USDC, ADDRESSES.mantle.WETH, ADDRESSES.mantle.WMNT],
+ })
}
}
\ No newline at end of file
diff --git a/projects/vestaequity/index.js b/projects/vestaequity/index.js
new file mode 100644
index 0000000000..0d2d5655b7
--- /dev/null
+++ b/projects/vestaequity/index.js
@@ -0,0 +1,24 @@
+const { toUSDTBalances } = require('../helper/balances');
+const { get } = require('../helper/http');
+
+const VestaEquityTVLApi = "https://app.vestaequity.net/api/listings/tvl/";
+
+async function vestaequityTVL() {
+
+ const response = (
+ await get(VestaEquityTVLApi)
+ );
+
+ const total = response.reduce((acc, item) => {
+ acc = acc + item.tvl;
+ return acc;
+ }, 0);
+
+ return toUSDTBalances(total);
+}
+
+module.exports = {
+ algorand: {
+ tvl: vestaequityTVL,
+ }
+};
diff --git a/projects/vesu/abi.js b/projects/vesu/abi.js
new file mode 100644
index 0000000000..fbb644f722
--- /dev/null
+++ b/projects/vesu/abi.js
@@ -0,0 +1,94 @@
+const allAbi = [
+
+ {
+ type: "function",
+ name: "decimals",
+ inputs: [],
+ outputs: [
+ {
+ type: "core::integer::u8",
+ },
+ ],
+ state_mutability: "view",
+ },
+
+ {
+ "type": "function",
+ "name": "asset_config_unsafe",
+ "inputs": [
+ {
+ "name": "pool_id",
+ "type": "felt"
+ },
+ {
+ "name": "asset",
+ "type": "felt"
+ }
+ ],
+ "outputs": [
+ {
+ "type": "(vesu::data_model::AssetConfig, core::integer::u256)"
+ }
+ ],
+ "state_mutability": "view",
+ "customInput": "address"
+ },
+ {
+ "type": "struct",
+ "name": "vesu::data_model::AssetConfig",
+ "members": [
+ {
+ "name": "total_collateral_shares",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "total_nominal_debt",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "reserve",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "max_utilization",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "floor",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "scale",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "is_legacy",
+ "type": "core::bool"
+ },
+ {
+ "name": "last_updated",
+ "type": "core::integer::u64"
+ },
+ {
+ "name": "last_rate_accumulator",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "last_full_utilization_rate",
+ "type": "core::integer::u256"
+ },
+ {
+ "name": "fee_rate",
+ "type": "core::integer::u256"
+ }
+ ]
+ },
+]
+
+const abi = {}
+allAbi.forEach(i => abi[i.name] = i)
+
+module.exports = {
+ abi,
+ allAbi
+}
\ No newline at end of file
diff --git a/projects/vesu/index.js b/projects/vesu/index.js
new file mode 100644
index 0000000000..2e85366489
--- /dev/null
+++ b/projects/vesu/index.js
@@ -0,0 +1,36 @@
+const { multiCall, sumTokens } = require("../helper/chain/starknet");
+const { abi, allAbi } = require("./abi");
+
+const INTERNAL_SCALE = 10 ** 18;
+const SINGLETON = "0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef";
+const POOL_ID = "0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28";
+const ASSETS = [
+ "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",
+ "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac",
+ "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8",
+ "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",
+ "0x042b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2",
+ "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d",
+];
+
+async function tvl(api) {
+ return sumTokens({ api, owner: SINGLETON, tokens: ASSETS });
+}
+
+const borrowed = async (api) => {
+ const calls = ASSETS.map((asset) => ({ target: SINGLETON, params: [POOL_ID, asset] }));
+ const assetStates = await multiCall({ calls, abi: abi.asset_config_unsafe, allAbi });
+ return assetStates.forEach((res, index) => {
+ const { total_nominal_debt, scale, last_rate_accumulator } = res['0']
+ const totalDebt = Number(total_nominal_debt) * Number(last_rate_accumulator) / INTERNAL_SCALE;
+ const scaledTotalDebt = totalDebt * Number(scale) / INTERNAL_SCALE;
+ api.add(ASSETS[index], scaledTotalDebt);
+ });
+};
+
+module.exports = {
+ starknet: {
+ tvl,
+ borrowed,
+ },
+};
diff --git a/projects/vfat/config.js b/projects/vfat/config.js
new file mode 100644
index 0000000000..3a3692d452
--- /dev/null
+++ b/projects/vfat/config.js
@@ -0,0 +1,81 @@
+module.exports = {
+ base: {
+ factory: '0x71D234A3e1dfC161cc1d081E6496e76627baAc31',
+ gaugeFactory: '0x35f35cA5B132CaDf2916BaB57639128eAC5bbcb5',
+ gaugeFactory2: '0xD30677bd8dd15132F251Cb54CbDA552d2A05Fb08',
+ voter: '0x16613524e02ad97edfef371bc883f2f5d6c480a5',
+ NonfungiblePositionManager: '0x827922686190790b37229fd06084350E74485b72',
+ masterchefV3: '0xC6A2Db661D5a5690172d8eB0a7DEA2d3008665A3',
+ fromBlock: 3200567,
+ fromBlockSickle: 12116234,
+ chainName: 'base',
+ },
+ optimism: {
+ factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8',
+ gaugeFactory: '0x8391fE399640E7228A059f8Fa104b8a7B4835071',
+ oldGaugeFactory2: '0x282AC0eA96493650F1A5E5e5d20490C782F1592a',
+ gaugeFactory2: '0x327147eE440252b893A771345025B41A267Ad985',
+ voter: '0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C',
+ oldNonfungiblePositionManager: '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4',
+ NonfungiblePositionManager: '0x416b433906b1B72FA758e166e239c43d68dC6F29',
+ fromBlock: 105896812,
+ fromBlockSickle: 117753454,
+ chainName: 'optimism',
+ },
+ arbitrum: {
+ factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf',
+ gaugeFactory: '0xAAA2564DEb34763E3d05162ed3f5C2658691f499',
+ gaugeFactory2: '0xaa2fbd0c9393964af7c66c1513e44a8caaae4fda',
+ NonfungiblePositionManager: '0xAA277CB7914b7e5514946Da92cb9De332Ce610EF',
+ masterchefV3: '0x5e09ACf80C0296740eC5d6F643005a4ef8DaA694',
+ fromBlock: 69820005,
+ fromBlockSickle: 197499243,
+ chainName: 'arbitrum',
+ },
+ linea: {
+ factory: '0x0F6aBc6B808B377d6AeD8dA1FAD5E135C99C81a3',
+ fromBlockSickle: 4949355,
+ fromBlock: 381770,
+ gaugeFactory: '0xAAA932839641c037452f826BB9d7B2057129833b',
+ gaugeFactory2: '0xAAA2D4987EEd427Ba5E2c933EeFCD75C84b446B7',
+ voter: '0xAAAf3D9CDD3602d117c67D80eEC37a160C8d9869',
+ NonfungiblePositionManager: '0xAAA78E8C4241990B4ce159E105dA08129345946A',
+ masterchefV3: '0x22E2f236065B780FA33EC8C4E58b99ebc8B55c57',
+ chainName: 'linea',
+ },
+ ethereum: {
+ factory: '0x9D70B9E5ac2862C405D64A0193b4A4757Aab7F95',
+ chainName: 'ethereum',
+ masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e',
+ fromBlockSickle: 19580798,
+ },
+ mode: {
+ factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf',
+ chainName: 'mode',
+ fromBlockSickle: 7464171,
+ gaugeFactory: '0x31832f2a97Fd20664D76Cc421207669b55CE4BC0',
+ voter: '0xD2F998a46e4d9Dd57aF1a28EBa8C34E7dD3851D7',
+ fromBlock: 7453232,
+ },
+ fantom: {
+ factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf',
+ chainName: 'fantom',
+ fromBlockSickle: 79166260,
+ NonfungiblePositionManager: '0x2B52294425a9a229322228de659eDE9D146D7c2f',
+ gaugeFactory: '0x5b3220cb732245ffe8e26df228ac93feb685c157',
+ fromBlock: 58469764,
+ voter: '0xe3d1a117df7dcac2eb0ac8219341bad92f18dac1',
+ },
+ mantle: {
+ factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8',
+ chainName: 'mantle',
+ fromBlockSickle: 62383980,
+ moeMasterchef: '0xA756f7D419e1A5cbd656A438443011a7dE1955b5'
+ },
+ bsc: {
+ factory: '0x53d9780DbD3831E3A797Fd215be4131636cD5FDf',
+ chainName: 'bsc',
+ masterchefV3: '0x556B9306565093C855AEA9AE92A594704c2Cd59e',
+ fromBlockSickle: 37565801
+ },
+}
\ No newline at end of file
diff --git a/projects/vfat/index.js b/projects/vfat/index.js
index 8565a945a6..5fcc39dd58 100644
--- a/projects/vfat/index.js
+++ b/projects/vfat/index.js
@@ -1,46 +1,28 @@
const { getLogs } = require('../helper/cache/getLogs');
const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs');
-const config = {
- base: {
- factory: '0x71D234A3e1dfC161cc1d081E6496e76627baAc31',
- gaugeFactory: '0x35f35cA5B132CaDf2916BaB57639128eAC5bbcb5',
- gaugeFactory2: '0xD30677bd8dd15132F251Cb54CbDA552d2A05Fb08',
- voter: '0x16613524e02ad97edfef371bc883f2f5d6c480a5',
- NonfungiblePositionManager: '0x827922686190790b37229fd06084350E74485b72',
- fromBlock: 3200567,
- fromBlockSickle: 12116234,
- chainName: 'base',
- },
- optimism: {
- factory: '0xB4C31b0f0B76b351395D4aCC94A54dD4e6fbA1E8',
- gaugeFactory: '0x8391fE399640E7228A059f8Fa104b8a7B4835071',
- gaugeFactory2: '0x282AC0eA96493650F1A5E5e5d20490C782F1592a',
- voter: '0x41C914ee0c7E1A5edCD0295623e6dC557B5aBf3C',
- NonfungiblePositionManager: '0xbB5DFE1380333CEE4c2EeBd7202c80dE2256AdF4',
- fromBlock: 105896812,
- fromBlockSickle: 117753454,
- chainName: 'optimism',
- },
-};
-
-
-async function tvl(api) {
- const { factory, gaugeFactory, gaugeFactory2, voter, NonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain];
-
- // Fetch logs from both the factory and the voter contracts
- const [deployLogs, deployAeroLogs] = await Promise.all([
- getLogs({
- api,
- target: factory,
- fromBlock: fromBlockSickle,
- eventAbi: 'event Deploy(address indexed admin, address sickle)',
- }),
- getLogs({
- api,
- target: voter,
- fromBlock,
- eventAbi: `event GaugeCreated(
+const config = require('./config');
+const { sumLPBalances } = require('./utils');
+
+// Helper function to fetch sickles
+async function fetchSickles(api, factory, fromBlockSickle) {
+ const deployLogs = await getLogs({
+ api,
+ target: factory,
+ fromBlock: fromBlockSickle,
+ eventAbi: 'event Deploy(address indexed admin, address sickle)',
+ onlyArgs: true,
+ });
+ return deployLogs.map(log => log.sickle);
+}
+
+// Helper function to fetch and process gauges
+async function fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2, includeOldContract = false, oldGaugeFactory2 = '') {
+ const deployAeroLogs = await getLogs({
+ api,
+ target: voter,
+ fromBlock,
+ eventAbi: `event GaugeCreated(
address indexed poolFactory,
address indexed votingRewardsFactory,
address indexed gaugeFactory,
@@ -50,67 +32,292 @@ async function tvl(api) {
address gauge,
address creator
)`,
- }),
- ]);
-
-
- // Get the addresses of deployed sickles
- const sickles = deployLogs.map(log => log.args.sickle);
+ });
- // Separate gauges by type
- const deployedAeroGauges = deployAeroLogs.reduce(
+ return deployAeroLogs.reduce(
(acc, log) => {
const gaugeFactoryAddress = log.args.gaugeFactory;
const gaugeAddress = log.args.gauge;
if (gaugeFactoryAddress === gaugeFactory) {
acc.lp.push(gaugeAddress);
- } else if (gaugeFactoryAddress === gaugeFactory2) {
+ } else if (gaugeFactoryAddress === gaugeFactory2 || (includeOldContract && gaugeFactoryAddress === oldGaugeFactory2)) {
acc.nft.push(gaugeAddress);
}
return acc;
},
{ lp: [], nft: [] }
);
+}
+
+
+async function fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName) {
+ const eventAbi = `event GaugeCreated(
+ address indexed gauge,
+ address creator,
+ address feeDistributor,
+ address indexed pool
+ )`;
+
+ const eventAbi2 = `event GaugeCreated(address indexed pool, address gauge)`;
+
+ const deployRamsesLogs = await getLogs({
+ api,
+ target: chainName === 'linea' ? voter : gaugeFactory,
+ fromBlock,
+ eventAbi,
+ skipCache: true,
+ });
+
+ const deployRamsesLogs2 = await getLogs({
+ api,
+ target: gaugeFactory2,
+ fromBlock,
+ eventAbi: eventAbi2,
+ skipCache: true,
+ });
+
+ const lp = deployRamsesLogs.map(log => log.args.gauge);
+ const nft = deployRamsesLogs2.map(log => log.args.gauge);
+
+ const nftSet = new Set(nft);
+
+ const filteredLp = lp.filter(address => !nftSet.has(address));
+
+ return { lp: filteredLp, nft };
+}
+
+async function fetchSickleNftPositions(api, sickles, managerAddress, isMasterchef = false) {
+ const nftCalls = [];
- const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp })
- const gaugeTokenMapping = {}
- stakingTokens.forEach((stakingToken, index) => {
- gaugeTokenMapping[deployedAeroGauges.lp[index]] = stakingToken
+ const sickleBals = await api.multiCall({ abi: 'erc20:balanceOf', target: managerAddress, calls: sickles });
+ for (let i = 0; i < sickles.length; i++) {
+ const sickle = sickles[i]
+ let nftBals = +sickleBals[i];
+ for (let j = 0; j < nftBals; j++)
+ nftCalls.push({ params: [sickle, j] });
+
+ }
+
+ const nftIds = await api.multiCall({ abi: 'function tokenOfOwnerByIndex(address owner, uint256 index) view returns (uint256)', calls: nftCalls, target: managerAddress });
+
+ const positions = await api.multiCall({
+ abi: isMasterchef
+ ? 'function userPositionInfos(uint256 tokenId) view returns (uint128 liquidity, uint128 boostLiquidity, int24 tickLower, int24 tickUpper, uint256 rewardGrowthInside, uint256 reward, address user, uint256 pid, uint256 boostMultiplier)'
+ : 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)',
+ calls: nftIds,
+ target: managerAddress,
+ });
+
+ const pidSet = new Set(positions.map(position => position.pid));
+ const pids = [...pidSet];
+
+ if (isMasterchef) {
+ const poolInfos = await api.multiCall({
+ abi: 'function poolInfo(uint256 pid) view returns (uint256 allocPoint, address v3Pool, address token0, address token1, uint24 fee, uint256 totalLiquidity, uint256 totalBoostLiquidity)',
+ calls: pids,
+ permitFailure: true,
+ target: managerAddress,
+ });
+ const poolInfoMap = {};
+ poolInfos.forEach((info, index) => {
+ poolInfoMap[pids[index]] = info;
+ });
+
+ positions.forEach((position) => {
+ if (!position) return;
+ const poolInfo = poolInfoMap[position.pid];
+ if (!poolInfo) {
+ console.log('Missing pool info for pid', position.pid, position, managerAddress)
+ }
+ position.allocPoint = poolInfo.allocPoint;
+ position.v3Pool = poolInfo.v3Pool;
+ position.token0 = poolInfo.token0;
+ position.token1 = poolInfo.token1;
+ position.fee = poolInfo.fee;
+ position.totalLiquidity = poolInfo.totalLiquidity;
+ position.totalBoostLiquidity = poolInfo.totalBoostLiquidity;
+ });
+ }
+
+ return positions.filter(position => position).forEach(position => {
+ addUniV3LikePosition({ ...position, api })
})
+}
+
+async function fetchGauges3(api, voter, fromBlock) {
+ const eventAbi = `event StakingRewardsCreated(
+ address indexed pool,
+ address indexed stakingRewards,
+ address indexed rewardToken,
+ address stakingToken
+ )`;
+
+ const deployLogs = await getLogs({
+ api,
+ target: voter,
+ fromBlock,
+ eventAbi,
+ skipCache: true,
+ });
+
+ return deployLogs.map(log => log.args[2]);
+}
+
+// TVL calculation for Base and Optimism
+async function tvlBaseOptimism(api) {
+ const { factory, gaugeFactory, gaugeFactory2, oldGaugeFactory2, voter, NonfungiblePositionManager, oldNonfungiblePositionManager, fromBlock, fromBlockSickle, chainName } = config[api.chain];
+ const sickles = await fetchSickles(api, factory, fromBlockSickle);
+ const includeOldContract = chainName === 'optimism';
+ const deployedAeroGauges = await fetchGauges(api, voter, fromBlock, gaugeFactory, gaugeFactory2, includeOldContract, oldGaugeFactory2);
- // Prepare balance queries for each gauge-sickle pair
- const balanceCallsLP = [];
- const tokens = [];
+ const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: deployedAeroGauges.lp });
+ await sumLPBalances(api, deployedAeroGauges.lp, sickles, stakingTokens);
- for (const gauge of deployedAeroGauges.lp) {
- for (const sickle of sickles) {
- balanceCallsLP.push({ target: gauge, params: [sickle] });
- tokens.push(gaugeTokenMapping[gauge])
+ const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft });
+ const slot0s = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', calls: pools });
+
+ await Promise.all(deployedAeroGauges.nft.map(async (gauge, i) => {
+ const tick = slot0s[i].tick;
+ const nftIds = (await api.multiCall({ abi: 'function stakedValues(address depositor) view returns (uint256[])', calls: sickles, target: gauge })).flat();
+ const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager, permitFailure: true, });
+ if (chainName === 'optimism' && oldNonfungiblePositionManager) {
+ const oldPositions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: oldNonfungiblePositionManager, permitFailure: true, });
+ positions.push(...oldPositions);
}
+ positions.filter(i => i).forEach(position => addUniV3LikePosition({ ...position, tick, api }));
+ }));
+
+ if (chainName === 'base')
+ await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true);
+
+ return sumTokens2({ api, resolveLP: true });
+}
+
+// TVL calculation for Arbitrum and Linea
+async function tvlArbitrumLinea(api) {
+ const { factory, gaugeFactory, gaugeFactory2, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain];
+ const blacklistedSickles = ['0x4989D5e508eBa5D4999b6A34FB30021e1f1bB4d8'];
+ let sickles = await fetchSickles(api, factory, fromBlockSickle);
+ if (chainName === 'linea') {
+ sickles = sickles.filter(sickle => !blacklistedSickles.includes(sickle));
}
+ const gauges = await fetchGauges2(api, fromBlock, gaugeFactory, gaugeFactory2, voter, chainName);
+ const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges.lp });
+
+ await sumLPBalances(api, gauges.lp, sickles, stakingTokens);
+ await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager);
+ await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true);
+
+ return sumTokens2({ api, resolveLP: true });
+}
+
+async function modeTvl(api) {
+ const { factory, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain];
+ const sickles = await fetchSickles(api, factory, fromBlockSickle);
+ const gauges = await fetchGauges3(api, voter, fromBlock);
+ const stakingTokens = await api.multiCall({ abi: 'address:stakingToken', calls: gauges });
+ await sumLPBalances(api, gauges, sickles, stakingTokens);
+ return sumTokens2({ api, resolveLP: true });
+}
- const lpBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCallsLP, })
- api.add(tokens, lpBals)
+// TVL calculation for chains with masterchefV3
+async function genericTvl(api) {
+ const { factory, fromBlockSickle, masterchefV3, NonfungiblePositionManager, chainName } = config[api.chain];
+ const sickles = await fetchSickles(api, factory, fromBlockSickle);
- // process NFT gauges
- const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft })
- const slot0s = await api.multiCall({ abi: 'function slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, bool unlocked)', calls: pools })
- let i = 0
+ if (masterchefV3)
+ await fetchSickleNftPositions(api, sickles, masterchefV3, true);
- await Promise.all(deployedAeroGauges.nft.map(async (gauge, i) => {
- const tick = slot0s[i].tick
- const nftIds = (await api.multiCall({ abi: 'function stakedValues(address depositor) view returns (uint256[])', calls: sickles, target: gauge })).flat()
- const positions = await api.multiCall({ abi: 'function positions(uint256 tokenId) view returns (uint96 nonce, address operator, address token0, address token1, int24 tickSpacing, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1)', calls: nftIds, target: NonfungiblePositionManager })
- positions.forEach(position => addUniV3LikePosition({ ...position, tick, api }))
- }))
-
- // unwrap uni v2 like LPs
- return sumTokens2({ api, resolveLP: true, })
+
+ if (NonfungiblePositionManager)
+ await fetchSickleNftPositions(api, sickles, NonfungiblePositionManager);
+
+}
+
+async function fetchFantomGauges(api, fromBlock, gaugeFactory) {
+ const eventAbi = `event GaugeCreated(
+ address indexed maker,
+ address indexed pool,
+ address g,
+ address b,
+ address v,
+ bool i,
+ address[] a
+ )`;
+
+ const deployLogs = await getLogs({
+ api,
+ target: gaugeFactory,
+ fromBlock,
+ eventAbi,
+ onlyArgs: true,
+ });
+
+ return deployLogs.map(log => log.g);
+}
+
+// TVL calculation for Fantom
+async function tvlFantom(api) {
+ const { factory, gaugeFactory, voter, fromBlock, fromBlockSickle, chainName } = config[api.chain];
+
+ const sickles = await fetchSickles(api, factory, fromBlockSickle);
+ const gauges = await fetchFantomGauges(api, fromBlock, gaugeFactory, voter, chainName);
+ const stakingTokens = await api.multiCall({ abi: 'address:stake', calls: gauges });
+ await sumLPBalances(api, gauges, sickles, stakingTokens);
+
+ return sumTokens2({ api, resolveLP: true });
}
+async function tvlMantle(api) {
+ const { factory, fromBlockSickle, moeMasterchef } = config[api.chain];
+
+ const sickles = await fetchSickles(api, factory, fromBlockSickle);
+
+ const tokens = await api.fetchList({ lengthAbi: 'getNumberOfFarms', itemAbi: 'getToken', target: moeMasterchef })
+
+ const farmTokenMap = {}
+ const farmIds = []
+ tokens.forEach((token, index) => {
+ farmTokenMap[index] = token
+ farmIds.push(index)
+ })
+
+ const depositCalls = [];
+ sickles.forEach(sickle => {
+ farmIds.forEach(pid => {
+ depositCalls.push({ target: moeMasterchef, params: [pid, sickle] });
+ });
+ });
+
+ const deposits = await api.multiCall({
+ abi: 'function getDeposit(uint256 pid, address account) view returns (uint256)',
+ calls: depositCalls
+ });
+
+ depositCalls.forEach((call, index) => {
+ const pid = call.params[0];
+ const deposit = deposits[index];
+ const token = farmTokenMap[pid];
+ api.add(token, deposit)
+ });
+ return sumTokens2({ api, resolveLP: true });
+}
Object.keys(config).forEach(chain => {
+ let tvl
+ switch (chain) {
+ case 'base':
+ case 'optimism': tvl = tvlBaseOptimism; break;
+ case 'arbitrum':
+ case 'linea': tvl = tvlArbitrumLinea; break;
+ case 'fantom': tvl = tvlFantom; break;
+ case 'mode': tvl = modeTvl; break;
+ case 'mantle': tvl = tvlMantle; break;
+ default:
+ tvl = genericTvl
+ }
+
module.exports[chain] = { tvl }
-})
\ No newline at end of file
+})
diff --git a/projects/vfat/utils.js b/projects/vfat/utils.js
new file mode 100644
index 0000000000..0339c2e583
--- /dev/null
+++ b/projects/vfat/utils.js
@@ -0,0 +1,72 @@
+const { Balances } = require('@defillama/sdk');
+const { sumTokens2 } = require('../helper/unwrapLPs');
+
+async function sumLPBalances(api, gauges, sickles, lpTokens) {
+ api.log(api.chain, sickles.length, gauges.length,)
+ lpTokens.forEach((lpToken, index) => lpTokens[index] = lpToken.toLowerCase())
+ let minLPValue = 4e3
+ if (lpTokens.length > 200) minLPValue = 15e3
+ if (lpTokens.length > 400) minLPValue = 25e3
+
+ const filteredLPSet = new Set(await filteredLPTokens({ api, lpTokens, minLPValue, }))
+
+ const gaugeTokenMapping = {};
+ const tokens = []
+ lpTokens.forEach((lpToken, index) => {
+ if (!filteredLPSet.has(lpToken)) return;
+
+ const gauge = gauges[index].toLowerCase()
+ tokens.push(gauge)
+ gaugeTokenMapping[gauge] = lpToken
+ });
+
+ const transformAddress = (token) => {
+ token = token.toLowerCase()
+ return `${api.chain}:${gaugeTokenMapping[token] ?? token}`
+ }
+ await sumTokens2({ api, transformAddress, tokens, owners: sickles })
+}
+
+// we are going to filter out tokens that we dont have price in the server and LP tokens with less than 1k value in it
+async function filteredLPTokens({ api, lpTokens, minLPValue = 10e3 }) {
+ const token0s = await api.multiCall({ abi: 'address:token0', calls: lpTokens, permitFailure: true, })
+ const token1s = await api.multiCall({ abi: 'address:token1', calls: lpTokens, permitFailure: true, })
+ const reserves = await api.multiCall({ abi: 'function getReserves() view returns (uint256 bal0, uint256 bal1, uint256 block)', calls: lpTokens, permitFailure: true, })
+ const allTokens = [lpTokens, token0s, token1s,].flat().filter(i => i).map(i => i.toLowerCase())
+ const dummyBals = {}
+ allTokens.forEach(i => dummyBals[api.chain + ':' + i] = 1e20) // hack to cache token prices to memory
+ await Balances.getUSDValue(dummyBals)
+
+ const filteredLPTokens = []
+ for (let i = 0; i < lpTokens.length; i++) {
+ const tokenBalance = new Balances({ chain: api.chain, })
+ tokenBalance.add(lpTokens[i], 1e20)
+ const tokenValue = await tokenBalance.getUSDValue()
+ if (tokenValue > 0) {
+ filteredLPTokens.push(lpTokens[i])
+ continue;
+ }
+
+ if (!reserves[i]) {
+ continue;
+ }
+
+
+ const lpBalance = new Balances({ chain: api.chain, })
+ lpBalance.add(token0s[i], reserves[i].bal0)
+ lpBalance.add(token1s[i], reserves[i].bal1)
+ const lpValue = await lpBalance.getUSDValue()
+ if (lpValue < minLPValue) { // LP has less than 2k value, we ignore it
+ continue;
+ }
+ filteredLPTokens.push(lpTokens[i])
+ }
+
+ api.log(api.chain, 'filteredLPTokens', filteredLPTokens.length, 'out of', lpTokens.length, 'LP tokens are filtered out.')
+ return filteredLPTokens
+}
+
+
+module.exports = {
+ sumLPBalances,
+}
\ No newline at end of file
diff --git a/projects/visor/config.js b/projects/visor/config.js
index 0ccba906f3..69ab6e9301 100644
--- a/projects/visor/config.js
+++ b/projects/visor/config.js
@@ -75,6 +75,7 @@ const HYPE_REGISTRY = {
["0xA8E2fD481342976a3259591FBc08999369a43C5A", 3554431], // Uniswap
["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 163300], // Lynex
["0x9C3E0445559E6de1fe6391E8e018DcA02B480836", 3952143], // Nile
+ ["0xFf0D3aBfd3003D4D5Ad7d57C912cca02ebA6036B", 4775887], // Linehub
],
base: [
["0x829432679F69DBd8b2575f006EC0129894a39D86", 12465470], // Uniswap
@@ -85,6 +86,7 @@ const HYPE_REGISTRY = {
["0x39ce2eB762e7bFe19b6AD4D5bA384c67CE4051f0", 7310157], // Swapbased
["0x8118C33513feC13f8cf488CCb4509190650F0e92", 7310111], // Baseswap
["0xf1DF4F17e34Ba710DfFC487F73f1e19476E815a6", 8743213], // Thick
+ ["0xe1cd1c2d2e4B44dE211D554649BC7dc49eF07784", 15063294], // Kinetix
],
kava: [
["0x683292172E2175bd08e3927a5e72FC301b161300", 6384272], // Kinetix
@@ -94,8 +96,9 @@ const HYPE_REGISTRY = {
["0xf14Fb95d6E7E1ab5fCdFfF7Ab203a84b9361E6FC", 10038113], // Thena
],
manta: [
- ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap
+ ["0x670003267DDFF9C2c740EC9A1645569cCCDC6Bf7", 2261164], // Uniswap
["0x8a9570ec97534277Ade6e46d100939FbCE4968f0", 689622], // Quickswap
+ ["0x683292172E2175bd08e3927a5e72FC301b161300", 394949], // Apertureswap
],
metis: [
["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 9080358], // Hercules
@@ -125,6 +128,13 @@ const HYPE_REGISTRY = {
mode: [
["0x683292172E2175bd08e3927a5e72FC301b161300", 696737], // KIM
],
+ taiko: [
+ ["0xc27ddd78fc49875fe6f844b72bbf31dfbb099881", 57600], // Uniswap
+ ],
+ rsk: [
+ ["0x683292172E2175bd08e3927a5e72FC301b161300", 6414342], // Uniswap
+ ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 6414350], // Sushiswap
+ ],
};
Object.keys(HYPE_REGISTRY).forEach(chain => {
diff --git a/projects/vnx-rwa/index.js b/projects/vnx-rwa/index.js
new file mode 100644
index 0000000000..11f015f845
--- /dev/null
+++ b/projects/vnx-rwa/index.js
@@ -0,0 +1,112 @@
+const { getTokenSupply } = require("../helper/solana");
+const fetch = require('node-fetch');
+
+const ASSETS = {
+ EVM: {
+ ethereum: [
+ "0x6d57b2e05f26c26b549231c866bdd39779e4a488", // VNXAU
+ "0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3", // VEUR
+ "0x79d4f0232A66c4c91b89c76362016A1707CFBF4f" // VCHF
+ ],
+ polygon: [
+ "0xC8bB8eDa94931cA2F20EF43eA7dBD58E68400400", // VNXAU
+ "0xE4095d9372E68d108225c306A4491cacfB33B097", // VEUR
+ "0xCdB3867935247049e87c38eA270edD305D84c9AE" // VCHF
+ ],
+ avax: [
+ "0x7678e162f38ec9ef2Bfd1d0aAF9fd93355E5Fa0b", // VEUR,
+ "0x228a48df6819CCc2eCa01e2192ebAFfFdAD56c19" // VCHF,
+ ],
+ q: [
+ "0xe4fadbbf24f118b1e63d65f1aac2a825a07f7619", // VNXAU
+ "0x513f99dee650f529d7c65bb5679f092b64003520", // VEUR
+ "0x65b9d36281e97418793f3430793f88440dab68d7" // VCHF
+ ]
+ },
+ nonEVM: {
+ solana: [
+ "9TPL8droGJ7jThsq4momaoz6uhTcvX2SeMqipoPmNa8R",// VNXAU
+ "C4Kkr9NZU3VbyedcgutU6LKmi6MKz81sx6gRmk5pX519",// VNXAU
+ "AhhdRu5YZdjVkKR3wbnUDaymVQL2ucjMQ63sZ3LFHsch" // VCHF
+ ],
+ stellar: [
+ "VNXAU-GCKIYYQVIFBIFDRN7BNDNHL3UZSFHT5NHDAISG2N3MWCZY3WNXL3LXN3", // VNXAU
+ "VEUR-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN", // VEUR
+ "VCHF-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN" // VCHF
+ ]
+ }
+};
+
+const MAPPINGS = {
+ stellar: {
+ 'VNXAU-GCKIYYQVIFBIFDRN7BNDNHL3UZSFHT5NHDAISG2N3MWCZY3WNXL3LXN3': '0x6d57b2e05f26c26b549231c866bdd39779e4a488',
+ 'VEUR-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN': '0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3',
+ 'VCHF-GDXLSLCOPPHTWOQXLLKSVN4VN3G67WD2ENU7UMVAROEYVJLSPSEWXIZN': '0x79d4f0232A66c4c91b89c76362016A1707CFBF4f'
+ },
+ q: {
+ '0xe4fadbbf24f118b1e63d65f1aac2a825a07f7619': '0x6d57b2e05f26c26b549231c866bdd39779e4a488',
+ '0x513f99dee650f529d7c65bb5679f092b64003520': '0x6bA75D640bEbfe5dA1197bb5A2aff3327789b5d3',
+ '0x65b9d36281e97418793f3430793f88440dab68d7': '0x79d4f0232A66c4c91b89c76362016A1707CFBF4f'
+ }
+};
+
+const fetchStellarSupply = async (asset) => {
+ const stellarApi = `https://api.stellar.expert/explorer/public/asset/${asset}`;
+ const response = await fetch(stellarApi);
+ const { supply } = await response.json();
+ return supply / 1e7 * 1e18; // supply / stellar dec * eth dec
+};
+
+const solanaTvl = async (api, assets) => {
+ const supplies = await Promise.all(assets.map(getTokenSupply));
+ const scaledSupplies = supplies.map((supply) => supply * 1e9);
+ api.add(assets, scaledSupplies);
+};
+
+const stellarTvl = async (api, assets) => {
+ const supplies = await Promise.all(assets.map(fetchStellarSupply));
+ supplies.forEach((supply, index) => {
+ const ethereumAsset = MAPPINGS.stellar[assets[index]];
+ api.add(ethereumAsset, supply, { skipChain: true });
+ });
+};
+
+const evmTvl = (chain, assets) => {
+ return async (api) => {
+ const totalSupplies = await api.multiCall({ calls: assets, abi: 'erc20:totalSupply' });
+ if (chain === 'q') {
+ totalSupplies.forEach((supply, index) => {
+ const ethereumAsset = MAPPINGS.q[assets[index]];
+ api.add(ethereumAsset, supply, { skipChain: true });
+ });
+ } else {
+ api.add(assets, totalSupplies);
+ }
+ };
+};
+
+const nonEvmTvl = (chain, assets) => {
+ return async (api) => {
+ if (chain === "solana") {
+ await solanaTvl(api, assets);
+ } else if (chain === "stellar") {
+ await stellarTvl(api, assets);
+ }
+ };
+};
+
+const getTvlFunction = (key, chain, assets) => {
+ if (key === 'EVM') {
+ return evmTvl(chain, assets);
+ } else if (key === 'nonEVM') {
+ return nonEvmTvl(chain, assets);
+ }
+};
+
+Object.entries(ASSETS).forEach(([key, chains]) => {
+ Object.entries(chains).forEach(([chain, assets]) => {
+ module.exports[chain] = {
+ tvl: getTvlFunction(key, chain, assets)
+ };
+ });
+});
diff --git a/projects/voltage-stableswap/index.js b/projects/voltage-stableswap/index.js
index f6b1af3c59..8fbb3467cf 100644
--- a/projects/voltage-stableswap/index.js
+++ b/projects/voltage-stableswap/index.js
@@ -1,13 +1,33 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require('../helper/unwrapLPs')
-const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49'.toLowerCase()
+const FUSD_ADDRESS = '0xd0ce1b4a349c35e61af02f5971e71ac502441e49'
const STABLESWAP_ADDRESS = '0x2a68D7C6Ea986fA06B2665d08b4D08F5e7aF960c'.toLowerCase()
+const FUSD_V3_ADDRESS = ADDRESSES.fuse.FUSD_3
+const PEGSWAP_ADDRESS = '0x56ee525bb9056bed23a6055e60b2a2c5c225d1db'
-const STABLES = [ADDRESSES.fuse.USDC, ADDRESSES.fuse.USDT, ADDRESSES.fuse.BUSD]
+const STABLES = [
+ ADDRESSES.fuse.USDC,
+ ADDRESSES.fuse.USDT,
+ ADDRESSES.fuse.BUSD,
+ ADDRESSES.fuse.USDC_2,
+ ADDRESSES.fuse.USDT_2,
+ ADDRESSES.fuse.BNB,
+ ADDRESSES.fuse.BNB_2,
+ ADDRESSES.fuse.WETH,
+ ADDRESSES.fuse.WETH_2,
+]
module.exports = {
fuse: {
- tvl: sumTokensExport({ owners: [STABLESWAP_ADDRESS, FUSD_ADDRESS], tokens: STABLES, })
- }
+ tvl: sumTokensExport({
+ owners: [
+ STABLESWAP_ADDRESS,
+ FUSD_ADDRESS,
+ FUSD_V3_ADDRESS,
+ PEGSWAP_ADDRESS,
+ ],
+ tokens: STABLES,
+ }),
+ },
}
diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js
index ae95ac05fc..5840df0b84 100644
--- a/projects/wagmi-com/index.js
+++ b/projects/wagmi-com/index.js
@@ -1,3 +1,4 @@
+const { staking } = require('../helper/staking')
const { uniV3Export, uniV3GraphExport } = require("../helper/uniswapV3");
module.exports = uniV3Export({
@@ -6,6 +7,18 @@ module.exports = uniV3Export({
kava: { factory: '0x0e0Ce4D450c705F8a0B6Dd9d5123e3df2787D16B', fromBlock: 6037137, },
ethereum: { factory: '0xB9a14EE1cd3417f3AcC988F61650895151abde24', fromBlock: 18240112, },
metis: { factory: '0x8112E18a34b63964388a3B2984037d6a2EFE5B8A', fromBlock: 9740222, },
+ zklink: { factory: '0x6175b648473F1d4c1549aAC3c2d007e7720585e6', fromBlock: 1339353, },
+ iotaevm: { factory: '0x01Bd510B2eA106917e711f9a05a42fC162bee2Ac', fromBlock: 143828, },
})
-module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) }
\ No newline at end of file
+module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) }
+
+const stakingConfig = {
+ metis: { swagmi: '0x5fb3983adc4dcc82a610a91d2e329f6401352558', wagmi: '0xaf20f5f19698f1d19351028cd7103b63d30de7d7', },
+ kava: { swagmi: '0x3690d1a9fb569c21372f8091527ab44f1dc9630f', wagmi: '0xaf20f5f19698f1d19351028cd7103b63d30de7d7', },
+}
+
+Object.keys(stakingConfig).forEach(chain => {
+ const { swagmi, wagmi, } = stakingConfig[chain]
+ module.exports[chain].staking = staking(swagmi, wagmi)
+})
\ No newline at end of file
diff --git a/projects/waterneuron/index.js b/projects/waterneuron/index.js
new file mode 100644
index 0000000000..cb595e9f0f
--- /dev/null
+++ b/projects/waterneuron/index.js
@@ -0,0 +1,19 @@
+const { get } = require("../helper/http");
+
+const url = 'https://tsbvt-pyaaa-aaaar-qafva-cai.raw.icp0.io/api/metadata';
+
+async function tvl() {
+ const metadata = await get(url)
+ const staked_icp = metadata.tracked_6m_stake + metadata.neuron_8y_stake_e8s
+ return {
+ "coingecko:internet-computer": staked_icp/ 1e8
+ }
+}
+
+module.exports = {
+ timetravel: false,
+ methodology: 'Staked tokens are counted as TVL.',
+ icp: {
+ tvl,
+ },
+}
diff --git a/projects/wbrockstaking/index.js b/projects/wbrockstaking/index.js
new file mode 100644
index 0000000000..2f72feb04f
--- /dev/null
+++ b/projects/wbrockstaking/index.js
@@ -0,0 +1,16 @@
+const ADDRESSES = require('../helper/coreAssets.json')
+const { staking } = require("../helper/staking");
+
+const stakingContract = "0x1a71F508d536c7Ab1D1B53a5D261abD494524C96";
+const BITROCKETHstakingContract = "0x46363C31Be0c677Bd6F3eD429686753794ee8b97";
+
+module.exports = {
+ bitrock: {
+ tvl: staking(stakingContract, ADDRESSES.bitrock.WBR),
+ },
+ ethereum: {
+ tvl: staking(BITROCKETHstakingContract, ADDRESSES.bitrock.BR),
+ },
+ methodology: "Wrapped Bitrock tokens locked in staking contract",
+};
+
diff --git a/projects/wenmarkets/index.js b/projects/wenmarkets/index.js
new file mode 100644
index 0000000000..b1bcd2437c
--- /dev/null
+++ b/projects/wenmarkets/index.js
@@ -0,0 +1,14 @@
+const { sumTokens2, nullAddress } = require('../helper/unwrapLPs')
+
+const contract = "0x3bB94837A91E22A134053B9F38728E27055ec3d1"
+
+async function tvl(api) {
+ return sumTokens2({ tokens: [nullAddress], owner: contract, api })
+}
+
+module.exports = {
+ methodology: `We count the MATIC on ${contract}`,
+ polygon: {
+ tvl
+ }
+}
\ No newline at end of file
diff --git a/projects/whales-market/index.js b/projects/whales-market/index.js
index 3b1fe2e2a3..ac9413b92f 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) },
};
diff --git a/projects/wing.js b/projects/wing.js
index 3633cca459..b68791d482 100644
--- a/projects/wing.js
+++ b/projects/wing.js
@@ -1,28 +1,18 @@
-const { get } = require('./helper/http')
-
-const nft_url = "https://nftapi.wing.finance/backend/nft-pool/pool-overview"
+const { get } = require('./helper/http');
+const { compoundExports2 } = require('./helper/compound');
+const { mergeExports } = require('./helper/utils');
+const { sumTokensExport } = require('./helper/unwrapLPs');
+const ADDRESSES = require('./helper/coreAssets.json')
const config = {
ontology: {
url: 'https://flashapi.wing.finance/api/v1/flashpooldetail',
},
- ethereum: {
- url: 'https://ethapi.wing.finance/eth/flash-pool/detail',
- },
- okexchain: {
- url: 'https://ethapi.wing.finance/okexchain/flash-pool/detail',
- },
- bsc: {
- url: "https://ethapi.wing.finance/bsc/flash-pool/detail",
- },
- ontology_evm: {
- url: "https://ethapi.wing.finance/ontevm/flash-pool/detail",
- },
}
-module.exports = {
- misrepresentedTokens: true,
+const apiExports = {
+ misrepresentedTokens: true,
};
const data = {}
@@ -34,15 +24,12 @@ async function getData(chain) {
}
Object.keys(config).forEach(chain => {
- module.exports[chain] = {
+ apiExports[chain] = {
tvl: async () => {
const { result } = await getData(chain)
if (!result.totalBorrow) result.totalBorrow = result.TotalBorrow
if (!result.totalSupply) result.totalSupply = result.TotalSupply
- if (chain == "ethereum") {
- const result_nft = await get(nft_url)
- if (result_nft.nftCollateralTVL !=undefined && !result_nft.nftCollateralTVL) result.totalSupply += result_nft.nftCollateralTVL
- }
+
return {
tether: result.totalSupply - result.totalBorrow
}
@@ -65,3 +52,41 @@ Object.keys(config).forEach(chain => {
},
}
})
+
+
+module.exports = mergeExports([
+ { // flash pool
+ ethereum: compoundExports2({ comptroller: '0x2F9fa63066cfA2d727F57ddf1991557bA86F12c9' }),
+ okexchain: compoundExports2({ comptroller: '0x66e212d287e547c2c93cfe50795543c025ca9ee3' }),
+ bsc: compoundExports2({ comptroller: '0x49620e9bfd117c7b05b4732980b05b7afee60a69' }),
+ ontology_evm: compoundExports2({ comptroller: '0x000A4d6b9E553a7f4bc1B8F94bB7Dd37BfF6d79b' }),
+ }, { // p2p pool
+ ethereum: {
+ tvl: sumTokensExport({
+ owner: '0x091806040FD70B40bcDA5e01D00eAfad8D10AB56',
+ tokens: [
+ ADDRESSES.ethereum.DAI,
+ ADDRESSES.ethereum.WETH,
+ '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643',
+ '0x39AA39c021dfbaE8faC545936693aC917d5E7563',
+ '0xdAC17F958D2ee523a2206206994597C13D831ec7',
+ '0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4',
+ '0xc00e94Cb662C3520282E6f5717214004A7f26888',
+ '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5',
+ ]
+
+ })
+ },
+ }, { // nft pool
+ ethereum: {
+ tvl: sumTokensExport({
+ owner: '0x3c3e283353f4349f6424151583A8353E8F40F2B1',
+ tokens: [
+ ADDRESSES.ethereum.WETH,
+ ]
+
+ })
+ },
+ },
+ apiExports,
+])
\ No newline at end of file
diff --git a/projects/wise-lending-v2/index.js b/projects/wise-lending-v2/index.js
index b344569aa7..bb9c673262 100644
--- a/projects/wise-lending-v2/index.js
+++ b/projects/wise-lending-v2/index.js
@@ -1,32 +1,39 @@
-
+const ADDRESSES = require('../helper/coreAssets.json')
async function tvl(api) {
- const { lending: lendingContract, feeManager } = config[api.chain]
- const pools = await api.fetchList({ lengthAbi: 'uint256:getPoolTokenAddressesLength', itemAbi: 'function getPoolTokenAdressesByIndex(uint256) view returns (address)', target: feeManager })
- const isATokens = await api.multiCall({ abi: 'function isAaveToken(address) view returns (bool)', calls: pools, target: feeManager })
- const aTokens = pools.filter((_, i) => isATokens[i])
- let otherTokens = pools.filter((_, i) => !isATokens[i])
- const names = await api.multiCall({ abi: 'string:name', calls: otherTokens })
- const pendleTokens = otherTokens.filter((_, i) => names[i].includes(' Pendle '))
- otherTokens = otherTokens.filter(i => !pendleTokens.includes(i))
- const uaTokens = await api.multiCall({ abi: 'function underlyingToken(address) view returns (address)', calls: aTokens, target: feeManager })
+ const { lending: lendingContract, tvlAddresses } = config[api.chain];
+
+ return api.sumTokens({ owner: lendingContract, tokens: tvlAddresses });
+}
- // unwrap pendle
- const pBals = await api.multiCall({ abi: 'erc20:balanceOf', calls: pendleTokens.map(t => ({ target: t, params: lendingContract })) })
- const pSupply = await api.multiCall({ abi: 'erc20:totalSupply', calls: pendleTokens })
- const pTotalAssets = await api.multiCall({ abi: 'uint256:totalLpAssets', calls: pendleTokens })
- const pUnderlying = await api.multiCall({ abi: 'address:UNDERLYING_PENDLE_MARKET', calls: pendleTokens })
+async function borrowed(api) {
+ const { lending: lendingContract, borrowAddresses } = config[api.chain];
- pUnderlying.forEach((token, i) => {
- api.add(token, pBals[i] * pTotalAssets[i] / pSupply[i])
+ const borrowAmounts = await api.multiCall({
+ abi: 'function getPseudoTotalBorrowAmount(address) view returns (uint256)',
+ target: lendingContract,
+ calls: borrowAddresses
})
- return api.sumTokens({ owner: lendingContract, tokens: [...otherTokens, ...uaTokens], })
+ api.add(borrowAddresses, borrowAmounts)
}
+const aavePools = [
+ "0x724dc807b04555b71ed48a6896b6F41593b8C637",
+ "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8",
+ ADDRESSES.arbitrum.WSTETH,
+ "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE",
+ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620",
+];
+
const config = {
- arbitrum: { lending: '0x9034a49587bd2c1af27598e0f04f30db66c87ebf', feeManager: '0x90a022796798f9dbA1Da0f8645234B284d4E8EC6' },
-}
+ arbitrum: {
+ lending: '0x9034a49587bD2c1Af27598E0f04F30Db66C87Ebf',
+ feeManager: '0x90a022796798f9dbA1Da0f8645234B284d4E8EC6',
+ tvlAddresses: aavePools,
+ borrowAddresses: aavePools
+ },
+};
Object.keys(config).forEach(chain => {
- module.exports[chain] = { tvl }
-})
+ module.exports[chain] = { tvl, borrowed };
+});
diff --git a/projects/wonton/index.js b/projects/wonton/index.js
new file mode 100644
index 0000000000..24e0de3b7b
--- /dev/null
+++ b/projects/wonton/index.js
@@ -0,0 +1,16 @@
+const ADDRESSES = require("../helper/coreAssets.json")
+const { sumTokensExport } = require("../helper/chain/ton")
+const HIGHLOAD_CONTRACT = "UQD8ucMJDu-VfMbemse1GaSefy8DUB18VxpvbnWiHQGlGMED"
+const POOL_CONTRACT = "UQDzfsiEm9p5KCPA8xNiXHLX42WShhvXEwVadworVgFvCyV8"
+
+module.exports = {
+ methodology:
+ "Counts all TON sitting in pre-bonding and high-load smart contact as the TVL. ",
+ timetravel: false,
+ ton: {
+ tvl: sumTokensExport({
+ owners: [HIGHLOAD_CONTRACT, POOL_CONTRACT],
+ tokens: ADDRESSES.ton.TON,
+ })
+ },
+};
diff --git a/projects/woodswap/index.js b/projects/woodswap/index.js
new file mode 100644
index 0000000000..8fb05ca6eb
--- /dev/null
+++ b/projects/woodswap/index.js
@@ -0,0 +1,10 @@
+const { iziswapExport } = require('../helper/iziswap')
+
+const poolHelpers = {
+ 'rsk': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'],
+} // iziswap liquidityManager contracts
+
+
+Object.keys(poolHelpers).forEach(chain => {
+ module.exports[chain] = { tvl: iziswapExport({ poolHelpers: poolHelpers[chain], }), }
+})
\ No newline at end of file
diff --git a/projects/woofi.js b/projects/woofi.js
index f885941627..1dcba24a85 100644
--- a/projects/woofi.js
+++ b/projects/woofi.js
@@ -4,16 +4,16 @@ const { staking, stakings } = require('./helper/staking')
const wooPPConfig = {
fantom: [
ADDRESSES.fantom.WFTM, // WFTM
- '0x74b23882a30290451A17c44f4F05243b6b58C76d', // ETH
- '0x321162Cd933E2Be498Cd2267a90534A804051b11', // BTC
+ '0x74b23882a30290451A17c44f4F05243b6b58C76d', // WETH
+ '0x321162Cd933E2Be498Cd2267a90534A804051b11', // WBTC
'0x6626c47c00F1D87902fc13EECfaC3ed06D5E8D8a', // WOO
ADDRESSES.fantom.USDC, // USDC
- ADDRESSES.fantom.fUSDT,
+ ADDRESSES.fantom.fUSDT, // fUSDT
],
bsc: [
ADDRESSES.bsc.WBNB, // WBNB
ADDRESSES.bsc.ETH, // ETH
- ADDRESSES.bsc.BTCB, // BTC
+ ADDRESSES.bsc.BTCB, // BTCB
'0x4691937a7508860F876c9c0a2a617E7d9E945D4B', // WOO
ADDRESSES.bsc.USDT, // USDT
ADDRESSES.bsc.BUSD, // BUSD
@@ -25,55 +25,59 @@ const wooPPConfig = {
ADDRESSES.avax.BTC_b, // BTC.b
'0xaBC9547B534519fF73921b1FBA6E672b5f58D083', // WOO.e
ADDRESSES.avax.USDC, // USDC
- ADDRESSES.avax.USDt,
+ ADDRESSES.avax.USDt, // USDt
],
polygon: [
ADDRESSES.polygon.WMATIC_2, // WMATIC
ADDRESSES.polygon.WETH_1, // WETH
ADDRESSES.polygon.WBTC, // WBTC
'0x1B815d120B3eF02039Ee11dC2d33DE7aA4a8C603', // WOO
- ADDRESSES.polygon.USDC, // USDC
- ADDRESSES.polygon.USDT,
+ ADDRESSES.polygon.USDC, // USDC.e
+ ADDRESSES.polygon.USDC_CIRCLE, // native USDC
+ ADDRESSES.polygon.USDT, // USDT
],
arbitrum: [
ADDRESSES.arbitrum.WETH, // WETH
ADDRESSES.arbitrum.WBTC, // WBTC
'0xcAFcD85D8ca7Ad1e1C6F82F651fA15E33AEfD07b', // WOO
ADDRESSES.arbitrum.ARB, // ARB
- ADDRESSES.arbitrum.USDC, // USDC
+ ADDRESSES.arbitrum.USDC, // USDC.e
ADDRESSES.arbitrum.USDC_CIRCLE, // native USDC
- ADDRESSES.arbitrum.USDT,
+ ADDRESSES.arbitrum.USDT, // USDT
],
optimism: [
ADDRESSES.optimism.WETH_1, // WETH
ADDRESSES.optimism.WBTC, // WBTC
ADDRESSES.optimism.OP, // OP
- ADDRESSES.optimism.USDC, // USDC
- ADDRESSES.optimism.USDT,
+ ADDRESSES.optimism.USDC, // USDC.e
+ ADDRESSES.optimism.USDC_CIRCLE, // native USDC
+ ADDRESSES.optimism.USDT, // USDT
'0x871f2F2ff935FD1eD867842FF2a7bfD051A5E527', // WOO
],
ethereum: [],
era: [
ADDRESSES.era.WETH, // WETH
- ADDRESSES.era.USDC, // USDC
+ ADDRESSES.era.USDC, // USDC.e
+ '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // native USDC
],
polygon_zkevm: [
- ADDRESSES.polygon_zkevm.WETH,
- ADDRESSES.polygon_zkevm.USDC,
+ ADDRESSES.polygon_zkevm.WETH, // WETH
+ ADDRESSES.polygon_zkevm.USDC, // USDC
],
linea: [
- ADDRESSES.linea.WETH,
- ADDRESSES.linea.USDC,
+ ADDRESSES.linea.WETH, // WETH
+ ADDRESSES.linea.USDC, // native USDC
],
base: [
- ADDRESSES.base.WETH,
- ADDRESSES.base.USDbC,
+ ADDRESSES.base.WETH, // WETH
+ ADDRESSES.base.USDbC, // USDbC
+ ADDRESSES.base.USDC, // native USDC
],
mantle: [
- ADDRESSES.mantle.WMNT,
- ADDRESSES.mantle.WETH,
- ADDRESSES.mantle.USDT,
- ADDRESSES.mantle.USDC,
+ ADDRESSES.mantle.WMNT, // WMNT
+ ADDRESSES.mantle.WETH, // WETH
+ ADDRESSES.mantle.USDT, // USDT
+ ADDRESSES.mantle.USDC, // USDC
],
}
@@ -85,31 +89,31 @@ const chainConfig = {
stakingContractV2: '0x1416E1378682b5Ca53F76656549f7570ad0703d9',
},
bsc: {
- wooPPContract: '0x59dE3B49314Bf5067719364A2Cb43e8525ab93FA',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: '0x4691937a7508860f876c9c0a2a617e7d9e945d4b',
stakingContract: '0x2AEab1a338bCB1758f71BD5aF40637cEE2085076',
stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13',
},
avax: {
- wooPPContract: '0x3b3E4b4741e91aF52d0e9ad8660573E951c88524',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: '0xabc9547b534519ff73921b1fba6e672b5f58d083',
stakingContract: '0xcd1B9810872aeC66d450c761E93638FB9FE09DB0',
stakingContractV2: '0x3Bd96847C40De8b0F20dA32568BD15462C1386E3',
},
polygon: {
- wooPPContract: '0x7081A38158BD050Ae4a86e38E0225Bc281887d7E',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: '0x1b815d120b3ef02039ee11dc2d33de7aa4a8c603',
stakingContract: '0x9BCf8b0B62F220f3900e2dc42dEB85C3f79b405B',
stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13',
},
arbitrum: {
- wooPPContract: '0xeFF23B4bE1091b53205E35f3AfCD9C7182bf3062',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: '0xcafcd85d8ca7ad1e1c6f82f651fa15e33aefd07b',
stakingContract: '0x9321785D257b3f0eF7Ff75436a87141C683DC99d',
stakingContractV2: '0x2CFa72E7f58dc82B990529450Ffa83791db7d8e2',
},
optimism: {
- wooPPContract: '0xd1778F9DF3eee5473A9640f13682e3846f61fEbC',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: '0x871f2f2ff935fd1ed867842ff2a7bfd051a5e527',
stakingContract: null,
stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13',
@@ -121,7 +125,7 @@ const chainConfig = {
stakingContractV2: '0xba91ffD8a2B9F68231eCA6aF51623B3433A89b13',
},
era: {
- wooPPContract: '0x42ED123EB5266A5B8E2B54B2C76180CCF5e72FEe',
+ wooPPContract: '0xE656d70bc3550e3EEE9dE7dC79367A44Fd13d975',
woo: null,
stakingContract: null,
stakingContractV2: null,
@@ -133,19 +137,19 @@ const chainConfig = {
stakingContractV2: null,
},
linea: {
- wooPPContract: '0xF5d215d9C84778F85746D15762DaF39B9E83a2d6',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: null,
stakingContract: null,
stakingContractV2: null,
},
base: {
- wooPPContract: '0xb130a49065178465931d4f887056328CeA5D723f',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: null,
stakingContract: null,
stakingContractV2: null,
},
mantle: {
- wooPPContract: '0x9D1A92e601db0901e69bd810029F2C14bCCA3128',
+ wooPPContract: '0xEd9e3f98bBed560e66B89AaC922E29D4596A9642',
woo: null,
stakingContract: null,
stakingContractV2: null,
diff --git a/projects/xai-bridge/index.js b/projects/xai-bridge/index.js
new file mode 100644
index 0000000000..ab93d3ca0b
--- /dev/null
+++ b/projects/xai-bridge/index.js
@@ -0,0 +1,15 @@
+const { sumTokens2 } = require("../helper/unwrapLPs");
+
+module.exports = {
+ arbitrum: {
+ tvl: (api) =>
+ sumTokens2({
+ api,
+ owners: [
+ "0xb591cE747CF19cF30e11d656EB94134F523A9e77",
+ "0xb15A0826d65bE4c2fDd961b72636168ee70Af030",
+ ],
+ fetchCoValentTokens: true,
+ }),
+ },
+};
diff --git a/projects/xave-finance/index.js b/projects/xave-finance/index.js
index 2e432364bc..8daa2f6d9a 100644
--- a/projects/xave-finance/index.js
+++ b/projects/xave-finance/index.js
@@ -42,7 +42,8 @@ async function tvl(api) {
const data = await api.multiCall({
abi: "function liquidity() view returns (uint256 total_, uint256[] memory individual_)",
calls: pools.map((v) => ({ target: v })),
- });
+ permitFailure: true
+ })
// Curve.derivatives(0)
const derivatives0 = await api.multiCall({
@@ -67,6 +68,8 @@ async function tvl(api) {
});
data.forEach((d, i) => {
+ if (!d) return
+
const divisor0 = ethers.parseUnits(
"1",
parseInt(derivatives0Decimals[i])
diff --git a/projects/xei/index.js b/projects/xei/index.js
new file mode 100644
index 0000000000..fe08b8c3f9
--- /dev/null
+++ b/projects/xei/index.js
@@ -0,0 +1,14 @@
+const { getConfig } = require('../helper/cache')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const ADDRESSES = require('../helper/coreAssets.json')
+
+async function tvl(api) {
+ const { data } = await getConfig('xei', 'https://app.xei.finance/indexer/1329/xei/poolList?page=1&pageSize=999')
+ const transformToken = i => i === ADDRESSES.null ? ADDRESSES.sei.WSEI : i
+ const ownerTokens = data.list.map(({ detail: i }) => ([[i.Token0, i.Token1].map(transformToken), i.Pool]))
+ return sumTokens2({ api, ownerTokens, })
+}
+
+module.exports = {
+ sei: { tvl },
+}
\ No newline at end of file
diff --git a/projects/xlink/index.js b/projects/xlink/index.js
new file mode 100644
index 0000000000..ad6c513dc3
--- /dev/null
+++ b/projects/xlink/index.js
@@ -0,0 +1,67 @@
+const { sumTokensExport } = require('../helper/sumTokens');
+const ADDRESSES = require('../helper/coreAssets.json');
+
+module.exports = {
+ methodology: "TVL of XLink is the sum of the tokens locked in its contracts",
+ timetravel: false,
+};
+
+const config = {
+ bitcoin: {
+ owners:
+ [
+ 'bc1qh604n2zey83dnlwt4p0m8j4rvetyersm0p6fts',
+ '31wQsi1uV8h7mL3QvBXQ3gzkH9zXNTp5cF',
+ 'bc1q9hs56nskqsxmgend4w0823lmef33sux6p8rzlp',
+ '32jbimS6dwSEebMb5RyjGxcmRoZEC5rFrS',
+ 'bc1qlhkfxlzzzcc25z95v7c0v7svlp5exegxn0tf58',
+ '3MJ8mbu4sNseNeCprG85emwgG9G9SCort7',
+ 'bc1qeph95q50cq6y66elk3zzp48s9eg66g47cptpft',
+ 'bc1qfcwjrdjk3agmg50n4c7t4ew2kjqqxc09qgvu7d',
+ '1882c4wfo2CzNo4Y4LCqxKGQvz7BsE7nqJ',
+ '1KGnLjKyqiGSdTNH9s6okFk2t5J7R6CdWt',
+ ],
+ },
+ bsc: {
+ owners:
+ [
+ '0xFFda60ed91039Dd4dE20492934bC163e0F61e7f5',
+ // '0x5caeb9d58325044a1ad9d4abff2e0d525928812d' // is EOA
+ ],
+ tokens:
+ [
+ ADDRESSES.bsc.USDT,
+ ADDRESSES.bsc.BTCB
+ ]
+ },
+ ethereum: {
+ owners:
+ [
+ '0x13b72A19e221275D3d18ed4D9235F8F859626673',
+ // '0x1bf78679b001c5efa20d80600e085ae52d25abc1' // is EOA
+ ],
+ tokens:
+ [
+ ADDRESSES.ethereum.USDT,
+ ADDRESSES.ethereum.WBTC
+ ]
+ },
+ stacks: {
+ owners:
+ [
+ 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.cross-bridge-registry-v2-01',
+ 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.btc-peg-out-endpoint-v2-01'
+ ],
+ blacklistedTokens:
+ [
+ 'SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc',
+ 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex',
+ ]
+ },
+}
+
+Object.keys(config).forEach(chain => {
+ module.exports[chain] = {
+ tvl: sumTokensExport(config[chain])
+ }
+})
\ No newline at end of file
diff --git a/projects/xrpl-dex/app.js b/projects/xrpl-dex/app.js
new file mode 100644
index 0000000000..4faf69b22a
--- /dev/null
+++ b/projects/xrpl-dex/app.js
@@ -0,0 +1,165 @@
+const rippleCodec = require("ripple-binary-codec");
+const { PromisePool } = require("@supercharge/promise-pool");
+const { getCache, setCache } = require("../helper/cache");
+const { transformDexBalances } = require("../helper/portedTokens");
+
+const NODE_URL = "https://xrplcluster.com";
+
+const fetchLedgerData = async (binary, marker, atLedgerIndex) => {
+ const xrplResponse = await fetch(NODE_URL, {
+ method: "POST",
+ body: JSON.stringify({
+ method: "ledger_data",
+ params: [
+ {
+ ledger_index: atLedgerIndex ?? "validated",
+ binary,
+ type: "amm",
+ ...(marker && { marker: marker }),
+ },
+ ],
+ }),
+ });
+ const xrplResponseJson = await xrplResponse.json();
+ return {
+ state: xrplResponseJson.result.state,
+ marker: xrplResponseJson.result.marker,
+ };
+};
+
+const fetchPoolReserves = async (pool, atLedgerIndex) => {
+ const xrplResponse = await fetch(NODE_URL, {
+ method: "POST",
+ body: JSON.stringify({
+ method: "amm_info",
+ params: [
+ {
+ ledger_index: atLedgerIndex ?? "validated",
+ asset: pool.asset1,
+ asset2: pool.asset2,
+ },
+ ],
+ }),
+ });
+ const xrplResponseJson = await xrplResponse.json();
+ return {
+ token0: parseReserve(xrplResponseJson.result.amm.amount),
+ token1: parseReserve(xrplResponseJson.result.amm.amount2),
+ };
+};
+
+let lastPrinted = 0
+const discoverPools = async (nextMarker, isBinary, atLedgerIndex, poolsFound = []) => {
+ const { state, marker } = await fetchLedgerData(
+ isBinary,
+ nextMarker,
+ atLedgerIndex
+ );
+ if (state && state.length != 0) {
+ const decodedState = isBinary
+ ? state.map((entry) => rippleCodec.decode(entry.data))
+ : state;
+ poolsFound.push(
+ ...decodedState.map((entry) => ({
+ account: entry.Account,
+ asset1: {
+ currency: entry.Asset.currency,
+ issuer: entry.Asset.issuer,
+ },
+ asset2: {
+ currency: entry.Asset2.currency,
+ issuer: entry.Asset2.issuer,
+ },
+ }))
+ );
+ }
+
+ if (poolsFound.length % 10 === 0 && lastPrinted !== poolsFound.length) {
+ console.log(new Date(), "Pools found so far ", poolsFound.length);
+ lastPrinted = poolsFound.length;
+ }
+ if (marker)
+ return discoverPools(
+ marker,
+ isBinary,
+ atLedgerIndex,
+ poolsFound
+ )
+ return poolsFound;
+};
+
+const parseReserve = (reserveData) => {
+ const reserveIsXrp = typeof reserveData === "string";
+ return {
+ currency: reserveIsXrp ? "XRP" : reserveData.currency,
+ issuer: reserveIsXrp ? null : reserveData.issuer,
+ amount: reserveIsXrp ? reserveData : reserveData.value,
+ };
+};
+
+const getAllPoolsReserves = async (poolAddresses, atLedgerIndex) => {
+ const poolsWithReserves = [];
+
+ const { errors } = await PromisePool.withConcurrency(14)
+ .for(poolAddresses)
+ .process(async (pool) => {
+ const { token0, token1 } = await fetchPoolReserves(pool, atLedgerIndex);
+ poolsWithReserves.push({
+ pool: pool.account,
+ token0Reserve: token0,
+ token1Reserve: token1,
+ });
+ });
+ if (errors.length > 0)
+ throw new Error(errors)
+ return poolsWithReserves
+}
+
+main().catch(console.error).then(() => {
+ console.log("done");
+ process.exit(0)
+})
+
+function getTimeNow() {
+ return Math.floor(Date.now() / 1000);
+}
+
+async function main() {
+ const timeNow = getTimeNow()
+ const aDayInSeconds = 60 * 60 * 24;
+ const projectKey = 'xrpl-dex'
+ const cacheKey = 'cache'
+ let { allPools, lastPoolUpdate, lastDataUpdate, tvl } = await getCache(projectKey, cacheKey)
+ if (!lastPoolUpdate || timeNow - lastPoolUpdate > 3 * aDayInSeconds) {
+ try {
+ console.time("xrpl-dex fetch pool list");
+ allPools = await discoverPools(null, 1);
+ console.timeEnd("xrpl-dex fetch pool list");
+ lastPoolUpdate = getTimeNow();
+ await setCache(projectKey, cacheKey, { allPools, lastPoolUpdate, lastDataUpdate, tvl })
+ } catch (e) {
+ console.error(e)
+ }
+ }
+ if (lastDataUpdate && timeNow - lastDataUpdate < 2 * 60 * 60) {
+ // data was updated recently, no need to update
+ return
+ }
+ const poolsWithReserves = await getAllPoolsReserves(allPools);
+
+ tvl = await transformDexBalances({
+ chain: 'ripple',
+ data: poolsWithReserves.map(i => ({
+ token0: i.token0Reserve.currency,
+ token0Bal: i.token0Reserve.amount,
+ token1: i.token1Reserve.currency,
+ token1Bal: i.token1Reserve.amount,
+ })),
+ })
+ await setCache(projectKey, cacheKey, {
+ allPools, lastPoolUpdate, lastDataUpdate: getTimeNow(), tvl: {
+ ripple: tvl.ripple,
+ 'ripple:XRP': tvl['ripple:XRP'],
+ }
+ })
+}
\ No newline at end of file
diff --git a/projects/xrpl-dex/index.js b/projects/xrpl-dex/index.js
new file mode 100644
index 0000000000..0de17de24c
--- /dev/null
+++ b/projects/xrpl-dex/index.js
@@ -0,0 +1,26 @@
+const { getCache, } = require("../helper/cache");
+
+
+module.exports = {
+ methodology:
+ "Finds all AMM pools on XRPL, checks their reserves, calculates TVL (in XRP) for each pool and sums them up.",
+ ripple: {
+ tvl,
+ },
+ misrepresentedTokens: true,
+};
+
+function getTimeNow() {
+ return Math.floor(Date.now() / 1000);
+}
+
+async function tvl() {
+ const timeNow = getTimeNow()
+ const aDayInSeconds = 60 * 60 * 24;
+ const projectKey = 'xrpl-dex'
+ const cacheKey = 'cache'
+ let { lastDataUpdate, tvl } = await getCache(projectKey, cacheKey)
+ if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds)
+ throw new Error("stale/missing tvl data");
+ return tvl
+}
\ No newline at end of file
diff --git a/projects/xrpl-dex/package-lock.json b/projects/xrpl-dex/package-lock.json
new file mode 100644
index 0000000000..f79d19f783
--- /dev/null
+++ b/projects/xrpl-dex/package-lock.json
@@ -0,0 +1,106 @@
+{
+ "name": "xrpl-dex",
+ "version": "1.0.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "xrpl-dex",
+ "version": "1.0.0",
+ "license": "ISC",
+ "dependencies": {
+ "ripple-binary-codec": "^2.1.0"
+ }
+ },
+ "node_modules/@noble/hashes": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz",
+ "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==",
+ "engines": {
+ "node": ">= 16"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@scure/base": {
+ "version": "1.1.7",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.7.tgz",
+ "integrity": "sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g==",
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/@xrplf/isomorphic": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@xrplf/isomorphic/-/isomorphic-1.0.1.tgz",
+ "integrity": "sha512-0bIpgx8PDjYdrLFeC3csF305QQ1L7sxaWnL5y71mCvhenZzJgku9QsA+9QCXBC1eNYtxWO/xR91zrXJy2T/ixg==",
+ "dependencies": {
+ "@noble/hashes": "^1.0.0",
+ "eventemitter3": "5.0.1",
+ "ws": "^8.13.0"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
+ "node_modules/bignumber.js": {
+ "version": "9.1.2",
+ "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz",
+ "integrity": "sha512-2/mKyZH9K85bzOEfhXDBFZTGd1CTs+5IHpeFQo9luiBG7hghdC851Pj2WAhb6E3R6b9tZj/XKhbg4fum+Kepug==",
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
+ "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA=="
+ },
+ "node_modules/ripple-address-codec": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ripple-address-codec/-/ripple-address-codec-5.0.0.tgz",
+ "integrity": "sha512-de7osLRH/pt5HX2xw2TRJtbdLLWHu0RXirpQaEeCnWKY5DYHykh3ETSkofvm0aX0LJiV7kwkegJxQkmbO94gWw==",
+ "dependencies": {
+ "@scure/base": "^1.1.3",
+ "@xrplf/isomorphic": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 16"
+ }
+ },
+ "node_modules/ripple-binary-codec": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/ripple-binary-codec/-/ripple-binary-codec-2.1.0.tgz",
+ "integrity": "sha512-q0GAx+hj3UVcDbhXVjk7qeNfgUMehlElYJwiCuIBwqs/51GVTOwLr39Ht3eNsX5ow2xPRaC5mqHwcFDvLRm6cA==",
+ "dependencies": {
+ "@xrplf/isomorphic": "^1.0.1",
+ "bignumber.js": "^9.0.0",
+ "ripple-address-codec": "^5.0.0"
+ },
+ "engines": {
+ "node": ">= 16"
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
+ "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ }
+ }
+}
diff --git a/projects/xrpl-dex/package.json b/projects/xrpl-dex/package.json
new file mode 100644
index 0000000000..a7e910c8e3
--- /dev/null
+++ b/projects/xrpl-dex/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "xrpl-dex",
+ "version": "1.0.0",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "MIT",
+ "description": "",
+ "dependencies": {
+ "ripple-binary-codec": "^2.1.0"
+ }
+}
diff --git a/projects/xrpl-dex/run.sh b/projects/xrpl-dex/run.sh
new file mode 100644
index 0000000000..83626d02a0
--- /dev/null
+++ b/projects/xrpl-dex/run.sh
@@ -0,0 +1,3 @@
+npm i
+cd .. && npm i && cd xrpl-dex
+node app.js
\ No newline at end of file
diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js
index 79387dddc3..307d67cbec 100644
--- a/projects/xy-finance/index.js
+++ b/projects/xy-finance/index.js
@@ -67,6 +67,12 @@ const config = {
},
xlayer: {
chainId: '196'
+ },
+ taiko: {
+ chainId: '167000'
+ },
+ ox_chain: {
+ chainId: '6699'
}
}
@@ -96,7 +102,23 @@ const yPoolDepositContract = {
"eYe": {
"contractAddress": "0xF0052C0B4F08078846aF48FE8C7bb365c9937c21",
"tokenAddress": "0x9A257C90Fa239fBA07771ef7da2d554D148c2E89"
- }
+ },
+ "LOOT": {
+ "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c",
+ "tokenAddress": "0x721A1B990699eE9D90b6327FaaD0A3E840aE8335"
+ },
+ "PEPE": {
+ "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC",
+ "tokenAddress": "0x6982508145454Ce325dDbE47a25d4ec3d2311933"
+ },
+ "MOG": {
+ "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701",
+ "tokenAddress": "0xaaeE1A9723aaDB7afA2810263653A34bA2C21C7a"
+ },
+ // "BITCOIN": {
+ // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" // doesnt exist
+ // }
},
"25": {
"ETH": {
@@ -139,6 +161,14 @@ const yPoolDepositContract = {
"contractAddress": "0x58F29F7d759aef5B8e34C8e4152d6117893017aB",
"tokenAddress": "0xae620DC4B9b6e44FBeb4a949F63AC957Cc43b5dD"
},
+ "LLT": {
+ "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F"
+ },
+ "RIP": {
+ "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80",
+ "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8"
+ }
},
"56": {
"ETH": {
@@ -193,6 +223,10 @@ const yPoolDepositContract = {
"contractAddress": "0xF98bfE69d069B40668D4F6aaeA22E73d1DC21A93",
"tokenAddress": "0x925FAdb35B73720238cc78777d02ED4dD3100816",
},
+ "LLT": {
+ "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ "tokenAddress": "0x0DdE4811C4DD68Dc740A1D7997F33fF46CD186a9"
+ }
},
"250": {
"ETH": {
@@ -348,12 +382,20 @@ const yPoolDepositContract = {
},
"8453": {
"ETH": {
- "contractAddress": "0xD195070107d853e55Dad9A2e6e7E970c400E67b8",
+ "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC",
"tokenAddress": ethAddress
},
"USDC": {
- "contractAddress": "0xA5Cb30E5d30A9843B6481fFd8D8D35DDED3a3251",
+ "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80",
"tokenAddress": ADDRESSES.base.USDbC
+ },
+ "LOOT": {
+ "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF"
+ },
+ "RIP": {
+ "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701",
+ "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8"
}
},
"5000": {
@@ -368,6 +410,10 @@ const yPoolDepositContract = {
"USDT": {
"contractAddress": "0x0241fb446d6793866245b936F2C3418F818bDcD3",
"tokenAddress": ADDRESSES.mantle.USDT
+ },
+ "LOOT": {
+ "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF"
}
},
"534352": {
@@ -385,6 +431,10 @@ const yPoolDepositContract = {
"contractAddress": "0xFa77c2DecCB21ACb9Bf196408Bf6aD5973D07762",
"tokenAddress": ethAddress
},
+ "LOOT": {
+ "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c",
+ "tokenAddress": "0x1C559a960aE5293eA56C40EFC3c0169B413DDcF3"
+ }
},
"196": {
"ETH": {
@@ -395,6 +445,38 @@ const yPoolDepositContract = {
"contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab",
"tokenAddress": ADDRESSES.xlayer.USDT
}
+ },
+ "167000": {
+ "ETH": {
+ "contractAddress": "0xFa77c2DecCB21ACb9Bf196408Bf6aD5973D07762",
+ "tokenAddress": ethAddress
+ },
+ "USDC": {
+ "contractAddress": "0x1e4992E1Be86c9d8ed7dcBFcF3665FE568dE98Ab",
+ "tokenAddress": ADDRESSES.taiko.USDC
+ }
+ },
+ "6699": {
+ "USDC": {
+ "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80",
+ "tokenAddress": "0xcE8f4E26e2532A78DAcD7A497A1827692b14b31D"
+ },
+ "ETH": {
+ "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC",
+ "tokenAddress": "0x7e6ecF974310d75325Ab1209253250aC7fCCe09b"
+ },
+ "PEPE": {
+ "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701",
+ "tokenAddress": "0x4aE774bF3dEfF2eaD31D5D51Aa636EE216fBE274"
+ },
+ "MOG": {
+ "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2",
+ "tokenAddress": "0xfaffa4b4D8538A2ba63bEa39ACbF709E3A972714"
+ },
+ // "BITCOIN": {
+ // "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c",
+ // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F"
+ // }
}
}
diff --git a/projects/yakafinance/index.js b/projects/yakafinance/index.js
new file mode 100644
index 0000000000..aa2ce19a7e
--- /dev/null
+++ b/projects/yakafinance/index.js
@@ -0,0 +1,3 @@
+const { uniTvlExport } = require("../helper/unknownTokens");
+
+module.exports = uniTvlExport('sei', '0xd45dAff288075952822d5323F1d571e73435E929')
\ No newline at end of file
diff --git a/projects/yearn/index.js b/projects/yearn/index.js
index a753745a90..177cef1743 100644
--- a/projects/yearn/index.js
+++ b/projects/yearn/index.js
@@ -1,4 +1,4 @@
-const { sumTokens2 } = require('../helper/unwrapLPs')
+const { sumTokens2, nullAddress } = require('../helper/unwrapLPs')
const { getConfig } = require('../helper/cache')
const v1Vaults = [
@@ -38,18 +38,33 @@ const blacklist = [
'0x7F83935EcFe4729c4Ea592Ab2bC1A32588409797',
'0x123964EbE096A920dae00Fb795FFBfA0c9Ff4675',
'0x39546945695DCb1c037C836925B355262f551f55',
- ...v1Vaults,
-]
+ ...v1Vaults,
+].map(i => i.toLowerCase())
async function tvl(api) {
- if(api.chain==="polygon"){
- const data = await getConfig('yearn/' + api.chain, `https://ydaemon.yearn.finance/vaults/all?chainids=137&limit=100000`)
- await api.erc4626Sum({ calls: data.filter(v=>v.kind==="Multi Strategy").map(v=>v.address), balanceAbi: 'totalAssets', tokenAbi: "asset" })
- } else {
- const data = await getConfig('yearn/' + api.chain, `https://api.yearn.finance/v1/chains/${api.chainId}/vaults/all`)
- const vaults = data.map(i => i.address).filter(i => !blacklist.includes(i))
- await api.erc4626Sum({ calls: vaults, balanceAbi: 'totalAssets', })
+ let data = await getConfig('yearn/v2-' + api.chain, `https://ydaemon.yearn.finance/vaults/all?chainids=${api.chainId}&limit=100000`)
+ if (!data.length) {
+ data = await getConfig('yearn/old-' + api.chain, `https://api.yexporter.io/v1/chains/${api.chainId}/vaults/all`)
}
+ let strategies = data.map(v => v.strategies ?? []).flat().map(v => v.address.toLowerCase())
+ let vaults = data.filter(i => i.tvl.tvl > 0).map(v => v.address.toLowerCase()).filter(i => !blacklist.includes(i) && !strategies.includes(i))
+ const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults })
+ const calls = [...vaults]
+ bals.forEach((bal, i) => {
+ if (+bal === 0)
+ calls[i] = nullAddress // skip empty vaults
+ })
+ const tokens = await api.multiCall({ abi: 'address:token', calls, permitFailure: true })
+
+ tokens.forEach((token, i) => {
+ if (token)
+ calls[i] = nullAddress // skip vaults that have a token
+ })
+ const tokensAlt = await api.multiCall({ abi: 'address:asset', calls, permitFailure: true })
+ bals.forEach((bal, i) => {
+ const token = tokens[i] || tokensAlt[i]
+ if (token) api.add(token, bal)
+ })
if (api.chain === 'ethereum') {
const tokens = await api.multiCall({ abi: 'address:token', calls: v1Vaults })
let bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: v1Vaults })
@@ -57,21 +72,19 @@ async function tvl(api) {
bals = bals.map((bal, i) => bal * ratio[i] / 1e18)
api.addTokens(tokens, bals)
}
- return sumTokens2({ api, resolveLP: true,})
+ return sumTokens2({ api, resolveLP: true, })
}
+
module.exports = {
doublecounted: true,
- misrepresentedTokens: true,
- timetravel: false,
- fantom: { tvl },
- ethereum: { tvl },
- arbitrum: { tvl },
- optimism: { tvl },
- base: { tvl },
- polygon: { tvl },
hallmarks: [
[1594944000, "YFI token Launch"],
]
-};
+}
+
+const chains = ['ethereum', 'fantom', 'arbitrum', 'optimism', 'polygon', 'base']
+chains.forEach(chain => {
+ module.exports[chain] = { tvl }
+})
\ No newline at end of file
diff --git a/projects/yei-fi/index.js b/projects/yei-fi/index.js
new file mode 100644
index 0000000000..c66083025c
--- /dev/null
+++ b/projects/yei-fi/index.js
@@ -0,0 +1,5 @@
+const { aaveExports } = require('../helper/aave');
+
+module.exports = {
+ sei: aaveExports(undefined, '', undefined, ['0x60c82a40c57736a9c692c42e87a8849fb407f0d6']),
+};
diff --git a/projects/yel/Helpers/Result.js b/projects/yel/Helpers/Result.js
deleted file mode 100644
index 3fe1557073..0000000000
--- a/projects/yel/Helpers/Result.js
+++ /dev/null
@@ -1,23 +0,0 @@
-const BigNumber = require("bignumber.js");
-module.exports = class Result {
- constructor(obj) {
- this.result = obj;
- }
-
- append(obj) {
- for (const key in obj) {
- if (this.result.hasOwnProperty(key)) {
- BigNumber.config({EXPONENTIAL_AT: 100});
- const sum = (new BigNumber(this.result[key])).plus(new BigNumber(obj[key]));
- this.result[key] = sum.valueOf();
- } else {
- this.result[key] = obj[key];
- }
- }
- return this;
- }
-
- render() {
- return this.result;
- }
-}
diff --git a/projects/yel/Providers/Base/LP.js b/projects/yel/Providers/Base/LP.js
deleted file mode 100644
index 4a827a67e9..0000000000
--- a/projects/yel/Providers/Base/LP.js
+++ /dev/null
@@ -1,122 +0,0 @@
-const sdk = require("@defillama/sdk");
-const abi = require("../../config/abi.json");
-const addr = require("../../config/addresses.json");
-const BigNumber = require("bignumber.js");
-
-module.exports = class LP {
- /**
- * @type {"bsc"|"fantom"|"polygon"|"ethereum"}
- */
-
-
- constructor(lpFarmingContract, network) {
- this.network = "ethereum";
- this.lpFarmingContract = "";
- this.totalAmount1 = 0;
- this.totalAmount0 = 0;
- this.lpTokenContract = "";
- this.lpToken1 = "";
- this.lpToken0 = "";
- this.lpTotalSupply = 0;
- this.fraction1 = 1;
- this.fraction0 = 1;
- this.totalLockedLPs = 0;
- this.token1InLP = 0;
- this.token0InLP = 0;
- this.network = network;
- this.lpFarmingContract = lpFarmingContract;
- }
-
- async getTokensAmountInLp() {
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.getReserves,
- chain: this.network,
- target: this.lpTokenContract,
- });
- this.totalAmount1 = resp.output[1];
- this.totalAmount0 = resp.output[0];
- } catch (e) {
- console.warn(e);
- }
- }
-
- /**
- * @param {1|0}index
- */
- async getLpToken(index) {
- const execAbi = index === 1 ? abi.externalFarming.token1 : abi.externalFarming.token0;
- try {
- const resp = await sdk.api.abi.call({
- abi: execAbi,
- chain: this.network,
- target: this.lpTokenContract,
- });
- let tokenAddr = resp.output
- if (resp.output.toLocaleLowerCase() === addr.tokens.bsc.yel) {
- tokenAddr = addr.tokens.ethereum.yel;
- }
- if (index === 0) {
- this.lpToken0 = tokenAddr;
- } else {
- this.lpToken1 = tokenAddr;
- }
- } catch (e) {
- console.warn(e);
- }
- }
-
- async getLPTotalSupply() {
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.externalFarming.totalSupply,
- chain: this.network,
- target: this.lpTokenContract,
- });
- this.lpTotalSupply = resp.output;
- } catch (e) {
- console.warn(e);
- }
- return this;
- }
-
- getCoefToken0ToToken1() {
- BigNumber.config({ EXPONENTIAL_AT: 100 });
- this.fraction1 = new BigNumber(this.totalAmount1).div(this.lpTotalSupply).toNumber();
- this.fraction0 = new BigNumber(this.totalAmount0).div(this.lpTotalSupply).toNumber();
- }
-
- getTotalLockedTokens() {
- BigNumber.config({ EXPONENTIAL_AT: 100 });
- this.token1InLP = new BigNumber(this.totalLockedLPs)
- .multipliedBy(new BigNumber(this.fraction1))
- .toFixed(0);
- this.token0InLP = new BigNumber(this.totalLockedLPs)
- .multipliedBy(new BigNumber(this.fraction0))
- .toFixed(0);
- }
-
- async calculateTokensLocked() {
- await this.getTokensAmountInLp();
- await Promise.all([
- this.getLpToken(1),
- this.getLpToken(0)
- ])
- await this.getLPTotalSupply();
- this.getCoefToken0ToToken1();
- this.getTotalLockedTokens();
- }
-
- getLockedTokens() {
- const prefix = this.network === "ethereum" ? "" : this.network + ":";
- const result = {};
-
- if (this.lpToken0.toLocaleLowerCase() !== addr.tokens.ethereum.yel.toLocaleLowerCase()) {
- result[prefix + this.lpToken0] = this.token0InLP;
- }
- if (this.lpToken1.toLocaleLowerCase() !== addr.tokens.ethereum.yel.toLocaleLowerCase()) {
- result[prefix + this.lpToken1] = this.token1InLP;
- }
- return result
- }
-}
diff --git a/projects/yel/Providers/YelEnhancedLpFarm.js b/projects/yel/Providers/YelEnhancedLpFarm.js
deleted file mode 100644
index 5ab3a790c4..0000000000
--- a/projects/yel/Providers/YelEnhancedLpFarm.js
+++ /dev/null
@@ -1,56 +0,0 @@
-const LP = require("./Base/LP");
-const sdk = require("@defillama/sdk");
-const abi = require("../config/abi.json");
-
-module.exports = class YelEnhancedLpFarm extends LP {
- constructor(farmingContract, network) {
- super(farmingContract, network);
- }
-
- async getLPTokenAddress() {
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.externalFarming.lpToken,
- chain: this.network,
- target: this.lpFarmingContract,
- });
- this.lpTokenContract = resp.output;
- } catch (e) {
- console.warn(e);
- }
- return this;
- }
-
- async getLPTotalCount() {
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.externalFarming.totalLP,
- chain: this.network,
- target: this.lpFarmingContract,
- });
- this.totalLockedLPs = resp.output;
- } catch (e) {
- console.warn(e);
- }
- }
-
- async unwrap() {
- await this.getLPTokenAddress();
- await this.getLPTotalCount();
- await this.calculateTokensLocked();
- }
-
- getTokensInLP() {
- const prefix = this.network === "ethereum" ? "" : this.network+":"
- return {
- [prefix+this.lpToken0]: this.token0InLP,
- [prefix+this.lpToken1]: this.token1InLP,
- }
- }
-
- static async tokensInLP(contract, network) {
- const obj = new YelEnhancedLpFarm(contract, network)
- await obj.unwrap();
- return obj.getTokensInLP();
- }
-}
diff --git a/projects/yel/Providers/YelEnhancedSingleStake.js b/projects/yel/Providers/YelEnhancedSingleStake.js
deleted file mode 100644
index 644e344ab2..0000000000
--- a/projects/yel/Providers/YelEnhancedSingleStake.js
+++ /dev/null
@@ -1,25 +0,0 @@
-const sdk = require("@defillama/sdk");
-const abi = require("../config/abi.json");
-
-module.exports = class YelEnhancedSingleStake {
- static async getStakedTokens(contractAddress, network, key) {
- key = key || 'stakingTokenTotalAmount';
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.poolInfo,
- params: [0],
- chain: network,
- target: contractAddress,
- });
- const staked = resp.output[key];
- const token = resp.output['stakingToken'];
- const prefix = network === "ethereum" ? "" : network+":"
- return {
- [prefix + token] : staked
- }
- } catch (e) {
- console.warn(e);
- return {};
- }
- }
-}
diff --git a/projects/yel/Providers/YelLPFarm.js b/projects/yel/Providers/YelLPFarm.js
deleted file mode 100644
index d75fbec149..0000000000
--- a/projects/yel/Providers/YelLPFarm.js
+++ /dev/null
@@ -1,55 +0,0 @@
-const sdk = require("@defillama/sdk");
-const abi = require("../config/abi.json");
-const LP = require("./Base/LP");
-const addr = require("../config/addresses.json");
-
-
-module.exports = class YelLPFarm extends LP {
- constructor(farmingContract, network) {
- super(farmingContract, network);
- }
-
- async getPoolInfo() {
- try {
- const resp = await sdk.api.abi.call({
- abi: abi.poolInfo,
- chain: this.network,
- params: [1],
- target: this.lpFarmingContract,
- });
- this.totalLockedLPs = resp.output[1];
- this.lpTokenContract = resp.output[0];
- } catch (e) {
- console.warn(e);
- }
- }
-
- async unwrap() {
- await this.getPoolInfo();
- await this.calculateTokensLocked();
- }
-
- async getLockedYel() {
- const result = {};
-
- if (this.lpToken0.toLocaleLowerCase() === addr.tokens.ethereum.yel.toLocaleLowerCase()) {
- result[this.lpToken0] = this.token0InLP;
- }
- if (this.lpToken1.toLocaleLowerCase() === addr.tokens.ethereum.yel.toLocaleLowerCase()) {
- result[this.lpToken1] = this.token1InLP;
- }
- return result
- }
-
- static async nonYELTokensInLP(contract, network) {
- const obj = new YelLPFarm(contract, network)
- await obj.unwrap();
- return obj.getLockedTokens();
- }
-
- static async yelTokensInLp(contract, network) {
- const obj = new YelLPFarm(contract, network)
- await obj.unwrap();
- return obj.getLockedYel();
- }
-}
diff --git a/projects/yel/Providers/YelSingleStaking.js b/projects/yel/Providers/YelSingleStaking.js
deleted file mode 100644
index c12c803cc9..0000000000
--- a/projects/yel/Providers/YelSingleStaking.js
+++ /dev/null
@@ -1,16 +0,0 @@
-const sdk = require("@defillama/sdk");
-const abi = require("../config/abi.json");
-const addr = require("../config/addresses.json")
-module.exports = class YelSingleStaking {
- static async getStakedYel(farmingContract, network) {
- const resp = await sdk.api.abi.call({
- abi: abi.poolInfo,
- chain: network,
- params: [0],
- target: farmingContract,
- })
- return {
- [addr.tokens.ethereum.yel]: resp.output[1]
- }
- }
-}
diff --git a/projects/yel/config/abi.json b/projects/yel/config/abi.json
deleted file mode 100644
index e3893b937a..0000000000
--- a/projects/yel/config/abi.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "getReserves": "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)",
- "poolInfo": "function poolInfo(uint256) view returns (address stakingToken, uint256 stakingTokenTotalAmount, uint256 accYelPerShare, uint32 lastRewardTime, uint16 allocPoint)",
- "externalFarming": {
- "totalLP": "uint256:totalLP",
- "lpToken": "address:lpToken",
- "token1": "address:token1",
- "token0": "address:token0",
- "totalSupply": "uint256:totalSupply"
- }
-}
\ No newline at end of file
diff --git a/projects/yel/config/addresses.json b/projects/yel/config/addresses.json
deleted file mode 100644
index b36487349e..0000000000
--- a/projects/yel/config/addresses.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "tokens": {
- "ethereum" : {
- "weth": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
- "ifarm" : "0x1571ed0bed4d987fe2b498ddbae7dfa19519f651",
- "yel": "0x7815bDa662050D84718B988735218CFfd32f75ea"
- },
- "bsc" : {
- "wbnb" : "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",
- "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300"
- },
- "fantom" : {
- "wftm" : "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83",
- "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300"
- },
- "polygon" : {
- "wmatic" : "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
- "yel": "0xd3b71117e6c1558c1553305b44988cd944e97300"
- }
- },
- "yelFarmingContract" : {
- "ethereum" : "0xe7c8477C0c7AAaD6106EBDbbED3a5a2665b273b9",
- "bsc" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E",
- "fantom" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E",
- "polygon" : "0x954b15065e4FA1243Cd45a020766511b68Ea9b6E"
- },
- "yelEnhancedPools" : {
- "ethereum": {
- "ifarm": "0x5dD8532613B9a6162BA795208D1A01613df26dc5"
- },
- "bsc": {
- "bnbBanana": "0x660f09cF84F8f366Bc653942b54B114d0Ec9E8a2"
- },
- "fantom": {
- "ftmBoo": "0x61EB6f6bC4Ec28203e9973B44967dA263B3Ec0e3",
- "anySwap": "0x3a6eE00959751A1981D731a5aC15B660a9a8BAd4"
- },
- "polygon" : {
- "dQuick" : "0x0379C1BbE394f835366D2EFDBf2AF09fBa0689A4"
- }
- }
-}
diff --git a/projects/yel/index.js b/projects/yel/index.js
index c2fee76ff2..2b470a01b0 100644
--- a/projects/yel/index.js
+++ b/projects/yel/index.js
@@ -1,134 +1,58 @@
-const sdk = require("@defillama/sdk");
-const Result = require("./Helpers/Result");
-const YelLPFarm = require("./Providers/YelLPFarm");
-const addr = require("./config/addresses.json");
-const YelEnhancedLpFarm = require("./Providers/YelEnhancedLpFarm");
-const YelSingleStaking = require("./Providers/YelSingleStaking");
-const YelEnhancedSingleStake = require("./Providers/YelEnhancedSingleStake");
-
-async function ethereumStaking() {
- const [
- ifarmEnhanced,
- yelSSEth,
- ] = await Promise.all([
- YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.ethereum.ifarm, 'ethereum'),
- YelSingleStaking.getStakedYel(addr.yelFarmingContract.ethereum, 'ethereum'),
- ])
- return (new Result(ifarmEnhanced))
- .append(yelSSEth)
- .render();
-}
-
-async function bscStaking() {
- return await YelSingleStaking.getStakedYel(addr.yelFarmingContract.bsc, 'bsc');
-}
-
-async function ftmStaking() {
- const [
- anySwap,
- yelSSFantom
- ] = await Promise.all([
- YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.fantom.anySwap, 'fantom', 2),
- YelSingleStaking.getStakedYel(addr.yelFarmingContract.fantom, 'fantom'),
- ])
- return (new Result(anySwap))
- .append(yelSSFantom)
- .render();
-}
-
-async function maticStaking() {
- const [
- yelInLpPolygon,
- dQuick
- ] = await Promise.all([
- YelEnhancedSingleStake.getStakedTokens(addr.yelEnhancedPools.polygon.dQuick, 'polygon', 2),
- YelSingleStaking.getStakedYel(addr.yelFarmingContract.polygon, 'polygon'),
- ])
- return (new Result(dQuick))
- .append(yelInLpPolygon)
- .render();
-}
-
-async function ethereumPool2() {
- const [
- yelInLpEth,
- wethInLp,
- ] = await Promise.all([
- YelLPFarm.yelTokensInLp(addr.yelFarmingContract.ethereum, 'ethereum'),
- YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.ethereum, 'ethereum'),
- ])
- return (new Result(yelInLpEth))
- .append(wethInLp)
- .render();
-}
-
-async function bscPool2() {
- const [
- bnbInYel,
- yelInLpBsc,
- bananaBnb,
- ] = await Promise.all([
- YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.bsc, 'bsc'),
- YelLPFarm.yelTokensInLp(addr.yelFarmingContract.bsc, 'bsc'),
- YelEnhancedLpFarm.tokensInLP(addr.yelEnhancedPools.bsc.bnbBanana, 'bsc'),
- ])
- return (new Result(bnbInYel))
- .append(bananaBnb)
- .append(yelInLpBsc)
- .render();
-}
-
-async function ftmPool2() {
- const [
- ftmInYel,
- yelInLpFantom,
- ftmBoo,
- ] = await Promise.all([
- YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.fantom, 'fantom'),
- YelLPFarm.yelTokensInLp(addr.yelFarmingContract.fantom, 'fantom'),
- YelEnhancedLpFarm.tokensInLP(addr.yelEnhancedPools.fantom.ftmBoo, 'fantom')
- ])
- return (new Result(ftmInYel))
- .append(ftmBoo)
- .append(yelInLpFantom)
- .render();
-}
-
-async function maticPool2() {
- const [
- maticInYel,
- yelInLpPolygon,
- ] = await Promise.all([
- YelLPFarm.nonYELTokensInLP(addr.yelFarmingContract.polygon, 'polygon'),
- YelLPFarm.yelTokensInLp(addr.yelFarmingContract.polygon, 'polygon'),
- ])
- return (new Result(maticInYel))
- .append(yelInLpPolygon)
- .render();
-}
-
-async function tvl() {
- return {};
-}
-
-module.exports = {
- ethereum: {
- staking: ethereumStaking,
- pool2: ethereumPool2,
- tvl,
- },
- bsc: {
- staking: bscStaking,
- pool2: ethereumPool2
+const { sumUnknownTokens } = require('../helper/unknownTokens')
+const { sumTokens2 } = require('../helper/unwrapLPs')
+const ADDRESSES = require('../helper/coreAssets.json')
+
+const config = {
+ ethereum: {
+ farms: ['0x5dD8532613B9a6162BA795208D1A01613df26dc5', '0xe7c8477C0c7AAaD6106EBDbbED3a5a2665b273b9'], lps: ['0xc83ce8612164ef7a13d17ddea4271dd8e8eebe5d'], ownTokens: ['0x7815bDa662050D84718B988735218CFfd32f75ea']
+ },
+ bsc: {
+ farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E',], lps: ['0xa5ac78a856345ab1fc8a4550208f42ca34b54e56', '0x8290d3CA64f712de9FB7220353dAa55bf388F3A3'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300']
+ },
+ fantom: {
+ farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E', '0x3a6eE00959751A1981D731a5aC15B660a9a8BAd4'], lps: ['0x8BFf7b8B6a14e576a3634d6c0466A19A6E9b170a'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300']
+ },
+ polygon: {
+ farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E', '0x0379C1BbE394f835366D2EFDBf2AF09fBa0689A4'], lps: ['0x8bAb87ECF28Bf45507Bd745bc70532e968b5c2De'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300']
+ },
+ blast: {
+ ownTokensAndOwners: [['0x949185D3BE66775Ea648F4a306740EA9eFF9C567', '0x7d2f5881F0C4B840fcFA2c49F4052d1A004eAf0d']],
+ tokensAndOwners: [
+ [ADDRESSES.blast.WETH, '0x795a85CD543D0E2d29F7e11e33a20a38A4b5121e'],
+ [ADDRESSES.blast.BLAST, '0x7D8490333315EaAa5e93F3C6983d1e8128D7f50f'],
+ ],
+ }
+}
+
+Object.keys(config).forEach(chain => {
+ const { farms = [], lps = [], ownTokens = [], ownTokensAndOwners, tokensAndOwners, } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ if (api.chain === 'bsc') {
+ const lpStaked = await api.call({ abi: 'uint256:totalLP', target: '0x660f09cF84F8f366Bc653942b54B114d0Ec9E8a2' })
+ api.add('0xF65C1C0478eFDe3c19b49EcBE7ACc57BB6B1D713', lpStaked)
+ } else if (api.chain === 'fantom') {
+ const lpStaked = await api.call({ abi: 'uint256:totalLP', target: '0x61EB6f6bC4Ec28203e9973B44967dA263B3Ec0e3' })
+ api.add('0xEc7178F4C41f346b2721907F5cF7628E388A7a58', lpStaked)
+ }
+ if (farms.length) {
+ const res = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: 'function poolInfo(uint256) view returns (address stakingToken, uint256, uint256, uint32, uint16)', calls: farms, groupedByInput: true })
+ const ownerTokens = res.map((r, i) => ([r.map(i => i.stakingToken), farms[i]]))
+ await sumTokens2({ api, ownerTokens, blacklistedTokens: [...lps, ...ownTokens], resolveLP: true, })
+ }
+
+ if (tokensAndOwners) return api.sumTokens({ tokensAndOwners })
},
- fantom: {
- staking: ftmStaking,
- pool2: ftmPool2
+ pool2: async (api) => {
+ if (farms.length && lps.length)
+ await sumUnknownTokens({ api, owners: farms, tokens: lps, resolveLP: true, useDefaultCoreAssets: true, lps, })
+
},
- polygon: {
- staking: maticStaking,
- pool2: maticPool2
+ staking: async (api) => {
+ if (farms.length && ownTokens.length)
+ await sumUnknownTokens({ api, owners: farms, tokens: ownTokens, useDefaultCoreAssets: true, lps, })
+
+ if (ownTokensAndOwners) return api.sumTokens({ tokensAndOwners: ownTokensAndOwners })
},
- methodology: "TVL is accounted from YEL liquidity mining farms, enhanced pools, partner farms and other protocols. Basically, that’s all the funds held at YEL Finance smart-contracts.",
-};
-// node test.js projects/yel/index.js
\ No newline at end of file
+ }
+})
\ No newline at end of file
diff --git a/projects/yfx-v4/index.js b/projects/yfx-v4/index.js
new file mode 100644
index 0000000000..7bca17e6ab
--- /dev/null
+++ b/projects/yfx-v4/index.js
@@ -0,0 +1,19 @@
+const config = {
+ arbitrum: { manager: "0xFE1ca968afbadEd3BF2CB685451C858Deb46Ce31", vault: "0x50b516a9DB620aB67A33d895DAF4Bd1c294b9517" },
+ base: { manager: "0xfD38EaD11eaa5D566dc331848fF495B3D5cfb79F", vault: "0xfcDaC5524EC86223216643384f5c59C65560d673" }
+}
+
+module.exports = {
+ methodology: 'Count balance of each pool from the Vault',
+}
+
+Object.keys(config).forEach(chain => {
+ const { vault, manager } = config[chain]
+ module.exports[chain] = {
+ tvl: async (api) => {
+ let pools = await api.call({ target: manager, abi: "address[]:getAllPools", });
+ const tokens = await api.multiCall({ abi: 'address:getBaseAsset', calls: pools })
+ return api.sumTokens({ owner: vault, tokens })
+ }
+ }
+})
diff --git a/projects/yieldbank/index.js b/projects/yieldbank/index.js
index 3576a0da1f..82203489f1 100644
--- a/projects/yieldbank/index.js
+++ b/projects/yieldbank/index.js
@@ -6,7 +6,7 @@ async function tvl(api) {
const tokens = await api.multiCall({ abi: 'address:want', calls: vaults })
const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults })
api.addTokens(tokens, bals)
- return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: false })
+ return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: false })
}
module.exports = {
@@ -16,5 +16,5 @@ module.exports = {
tvl: () => ({}),
staking: () => ({})
},
-// deadFrom: "2023-12-01",
+ deadFrom: "2023-12-01",
}
diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js
index cccb078f2e..867f5af476 100644
--- a/projects/yieldflow/index.js
+++ b/projects/yieldflow/index.js
@@ -36,32 +36,43 @@ const managers = [
'0xCF49168017096dB97Eb14552bd0af6eE9a27e76A',
'0x899DF9d131D2276Db3c5f392ce2b396d9b1BFa8c',
- '0xC3ec6F076fE7395B0C263f7E37B084EC4Fd06eaF',
- '0x034a5fC7518d2D1b6a8C9CaccD273ee37C669E95',
- '0xE0D19D57BAFF656d2910BFFBec81E33f1368A0Ee',
- '0x2de0b61a2778169f095A8a7DAD7B566A9973E977',
- '0x440b228411a4D83820e0c63cD71E769a6660E037',
- '0x717FADe04FF819a58128Be591caC8C801F28Cd5b',
- '0x1655cfD162b4148E1715B6302DA4EF075Fa72ADf',
- '0x604Ef6Dc8c7abf78008749b57a4135C87d69fc35',
- '0xa63fa8FE58A5E197f092742619D8F4C7fE4924e8',
+ '0xC3ec6F076fE7395B0C263f7E37B084EC4Fd06eaF',
+ '0x034a5fC7518d2D1b6a8C9CaccD273ee37C669E95',
+ '0xE0D19D57BAFF656d2910BFFBec81E33f1368A0Ee',
+ '0x2de0b61a2778169f095A8a7DAD7B566A9973E977',
+ '0x440b228411a4D83820e0c63cD71E769a6660E037',
+ '0x717FADe04FF819a58128Be591caC8C801F28Cd5b',
+ '0x1655cfD162b4148E1715B6302DA4EF075Fa72ADf',
+ '0x604Ef6Dc8c7abf78008749b57a4135C87d69fc35',
+ '0xa63fa8FE58A5E197f092742619D8F4C7fE4924e8',
- '0xC22c7f332cA100725Bf4eA832f2D169e471923D6',
- '0x1E5F83Fc7f167fF44D58e59142DeE2358346331B',
- '0x8702800D715461Fb7D9C89C74DDB7bE73F5a37C6',
- '0xb6F1E82e7AE822DE9eD64967D04359Fe4D58A569',
- '0xE0213546258ABd7EF0D689D26Cf6d6BCEeE20e8a',
- '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e'
+ '0xC22c7f332cA100725Bf4eA832f2D169e471923D6',
+ '0x1E5F83Fc7f167fF44D58e59142DeE2358346331B',
+ '0x8702800D715461Fb7D9C89C74DDB7bE73F5a37C6',
+ '0xb6F1E82e7AE822DE9eD64967D04359Fe4D58A569',
+ '0xE0213546258ABd7EF0D689D26Cf6d6BCEeE20e8a',
+ '0xf732Fc726B3a4bE9f6c86a710Fd3367259DB456e',
-
+ '0x16A3EBd3D55b27FF6e2839DA2078889cA148C040',
+ '0xf4447cCFeE677A5b0BaD6bcD5f92A1929c171b48',
+ '0x538A753B616F5aAD60852ca039572e5C4B72cA85',
+
+ '0x780A252d7C797cFB255fe2EAa4E1a257a897B6ed',
+ '0xffF3c0063f2Fc1Af569C359480b5b62841357169',
+ '0xEFF4A3260263A927D0707190C931bE13292bD4Ba',
+
+ '0xD4c68a094De7e1336E261c6EDD595F64cd70A064',
+ '0x88609B69feDc0EEF4326c3390a8ae1b2073DcF03',
+ '0xdcC4391042d462158C847f73F4232ce47A8F999c',
]
async function tvl(api) {
- const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: managers})
- const tokenIds = await api.multiCall({ abi: abi.getCurrentTokenId, calls: managers})
- const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i]})) })
- const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity]})) })
-
+ const { managers } = config[api.chain]
+ const positionManagers = await api.multiCall({ abi: 'address:positionManager', calls: managers })
+ const tokenIds = await api.multiCall({ abi: abi.getCurrentTokenId, calls: managers })
+ const liquidities = await api.multiCall({ abi: abi.getPositions, calls: positionManagers.map((v, i) => ({ target: v, params: tokenIds[i] })) })
+ const tokenAmounts = await api.multiCall({ abi: abi.getAmountsForTicks, calls: liquidities.map((v, i) => ({ target: managers[i], params: [v.tickLower, v.tickUpper, v.liquidity] })) })
+
liquidities.forEach((v, i) => {
api.add(v.token0, tokenAmounts[i][0])
api.add(v.token1, tokenAmounts[i][1])
@@ -71,5 +82,22 @@ async function tvl(api) {
module.exports = {
doublecounted: true,
- arbitrum: { tvl },
-};
+}
+
+const config = {
+ arbitrum: { managers },
+ ethereum: {
+ managers: [
+ '0x65D1788F9d9A800c5Fc9b9CB8e49A1b488C736c7',
+ '0x01Af749E58c076c301B1F57D0BCBBf2D49B503bD',
+ '0x47Dd57DFe9e01616e4Adc28015243Ea6A2C09cEC',
+ '0x0a4a169a6b2ac75c86e2F0e42822fdEA13fB1CC8',
+ '0xafFA16b152232dAd8BF3AaDF6bb6F895A836F917',
+ '0xFB04d48e4CE9C042188Ef933ff4cf58921Ab59B8'
+ ]
+ }
+}
+
+Object.keys(config).forEach(chain => {
+ module.exports[chain] = { tvl }
+})
\ No newline at end of file
diff --git a/projects/yieldyak/abi.json b/projects/yieldyak/abi.json
index c64c45205e..4d9b0decbe 100644
--- a/projects/yieldyak/abi.json
+++ b/projects/yieldyak/abi.json
@@ -2,5 +2,6 @@
"depositToken": "address:depositToken",
"totalDeposits": "uint256:totalDeposits",
"token": "address:token",
- "getRatio": "uint256:getRatio"
+ "getRatio": "uint256:getRatio",
+ "symbol": "string:symbol"
}
\ No newline at end of file
diff --git a/projects/yieldyak/index.js b/projects/yieldyak/index.js
index 5d77fe99e1..c851ea55f7 100644
--- a/projects/yieldyak/index.js
+++ b/projects/yieldyak/index.js
@@ -1,35 +1,70 @@
const { staking } = require('../helper/staking');
const { cachedGraphQuery, getConfig } = require('../helper/cache')
+const sdk = require('@defillama/sdk')
-const graphUrl = 'https://api.thegraph.com/subgraphs/name/yieldyak/reinvest-tracker'
+const graphUrl = sdk.graph.modifyEndpoint('7oSYYdK5RKmqggdzFyfUnojP6puDAj31C4ezDGrgVfk9')
const graphQuery = `{ farms(first: 1000) { id }}`;
-async function tvl(api) {
- const { farms } = await cachedGraphQuery('yieldyak/avax', graphUrl, graphQuery)
- const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.id), permitFailure: true, })
- const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.id), permitFailure: true, })
+async function avaxTvl(api) {
+ const farms = await getConfig('yieldyak/avax', 'https://staging-api.yieldyak.com/43114/farms')
+ const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, })
+ const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, })
+ const symbols = await api.multiCall({
+ abi: 'string:symbol',
+ calls: tokens.map(token => ({ target: token })),
+ permitFailure: true,
+ });
+
+
+ const excludedAddress = '0x59414b3089ce2af0010e7523dea7e2b35d776ec7';
+ const excludedSymbol = 'YAK';
+
tokens.forEach((token, i) => {
- if (!token || !vals[i]) return;
- api.add(token, vals[i])
- })
+ if (!token || !vals[i] || token === excludedAddress || symbols[i] === excludedSymbol) return;
+ api.add(token, vals[i]);
+ });
}
+
async function arbiTvl(api) {
const farms = await getConfig('yieldyak/arbi', 'https://staging-api.yieldyak.com/42161/farms')
const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, })
const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, })
+ const excludedAddress = '0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696';
+
+ tokens.forEach((token, i) => {
+ if (!token || !vals[i] || token === excludedAddress) return;
+ api.add(token, vals[i]);
+ });
+}
+async function mantleTvl(api) {
+ const farms = await getConfig('yieldyak/mantle', 'https://staging-api.yieldyak.com/5000/farms')
+ const tokens = await api.multiCall({ abi: 'address:depositToken', calls: farms.map(i => i.address), permitFailure: true, })
+ const vals = await api.multiCall({ abi: 'uint256:totalDeposits', calls: farms.map(i => i.address), permitFailure: true, })
+ const excludedAddress = '0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696';
+
tokens.forEach((token, i) => {
- if (!token || !vals[i]) return;
- api.add(token, vals[i])
- })
+ if (!token || !vals[i] || token === excludedAddress) return;
+ api.add(token, vals[i]);
+ });
}
const masterYak = "0x0cf605484A512d3F3435fed77AB5ddC0525Daf5f"
const yakToken = "0x59414b3089ce2af0010e7523dea7e2b35d776ec7"
+const arbiYyStaking = "0xbb82b43Bf2057B804253D5Db8c18A647fC1f3403"
+const mantleYyStaking = "0xF54D65AeB65b093A6BF717b541894ee6471A6CE1"
+const bridgedYakToken = "0x7f4dB37D7bEb31F445307782Bc3Da0F18dF13696"
module.exports = {
avax: {
- tvl,
+ tvl:avaxTvl,
staking: staking(masterYak, yakToken),
},
- arbitrum: { tvl: arbiTvl },
+ arbitrum: {
+ tvl: arbiTvl,
+ staking: staking(arbiYyStaking, bridgedYakToken),
+ },
+ mantle: {
+ tvl: mantleTvl,
+ staking: staking(mantleYyStaking, bridgedYakToken),
+ }
}
\ No newline at end of file
diff --git a/projects/yldr/index.js b/projects/yldr/index.js
index c97f9ee996..b601e17d0e 100644
--- a/projects/yldr/index.js
+++ b/projects/yldr/index.js
@@ -10,6 +10,7 @@ const config = {
ethereum: { v3Wrapper: '0x13f4dc963ddd2ec0160f6473c69b704b0e8674fc', factory: '0xd7b1C5afc105e0E70F78B66CdFE977aEf80540bA', fromBlock: 18808612, },
arbitrum: { v3Wrapper: '0x07B99965dBEdf38322ADFe48623e042Aa0656283', factory: '0x88959bebbce33d75227633d5114e3c3fd0fb9a6d', fromBlock: 155897900, },
polygon: { v3Wrapper: '0x27b3E5fD3E2C03Ac02Ee2a90E7B0C52Dac179dAe', factory: '0xf336D4687937C109e51e0266663689Da5ad637C3', fromBlock: 54456800 },
+ base: { v3Wrapper: '0x4bD51179f30Cd162167D40AF9F6d378FC580C9cd', factory: '0xCE52e9DD55AC9aa98BfEE1bA615FA5a07c8b3eF1', fromBlock: 14253820 },
}
const eventAbi = 'event ReserveInitialized (address indexed asset, address indexed yToken, address variableDebtToken, address interestRateStrategyAddress)'
diff --git a/projects/yyex/index.js b/projects/yyex/index.js
new file mode 100644
index 0000000000..a2bcfaf620
--- /dev/null
+++ b/projects/yyex/index.js
@@ -0,0 +1,9 @@
+const { gmxExports } = require("../helper/gmx");
+
+module.exports = {
+ btr: {
+ tvl: gmxExports({
+ vault: "0x16Aa605Ca2cBE921AAC6C4838c1109b3cf9d444F",
+ }),
+ },
+};
diff --git a/projects/zeno/index.js b/projects/zeno/index.js
index 7a0ec0617b..541525055a 100644
--- a/projects/zeno/index.js
+++ b/projects/zeno/index.js
@@ -1,11 +1,12 @@
+const ADDRESSES = require('../helper/coreAssets.json')
async function metisTvl(api) {
const vaultStorageAddress = "0xFaEee486F4A53cdBEaBE37216bcf1016eB4E52D6";
// eth, usdt, usdc
const zenoUnderlyingTokens = [
- "0x420000000000000000000000000000000000000a",
- "0xEA32A96608495e54156Ae48931A7c20f0dcc1a21",
- "0xbB06DCA3AE6887fAbF931640f67cab3e3a16F4dC",
+ ADDRESSES.metis.WETH,
+ ADDRESSES.metis.m_USDC,
+ ADDRESSES.metis.m_USDT,
];
return api.sumTokens({
diff --git a/projects/zerolend/index.js b/projects/zerolend/index.js
index 13d30abb22..6f56ea6d81 100644
--- a/projects/zerolend/index.js
+++ b/projects/zerolend/index.js
@@ -1,4 +1,6 @@
const { aaveExports } = require("../helper/aave");
+const { staking } = require("../helper/staking");
+const { pool2s } = require("../helper/pool2");
const config = {
era: "0xB73550bC1393207960A385fC8b34790e5133175E",
@@ -9,8 +11,22 @@ const config = {
ethereum: "0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf",
};
+const linea = {
+ treasury: "0x14aAD4668de2115e30A5FeeE42CFa436899CCD8A",
+ zeroEthNileLP: "0x0040f36784dda0821e74ba67f86e084d70d67a3a",
+ zeroEthNileCLP: "0x179b4B1C19faF18Bed713304c870e9317bc79A84",
+ zeroEthLynexCLP: "0xb88261e0DBAAc1564f1c26D78781F303EC7D319B",
+ zero: "0x78354f8DcCB269a615A7e0a24f9B0718FDC3C7A7",
+ zlpLocker: "0x8bb8b092f3f872a887f377f73719c665dd20ab06",
+ zeroLocker: "0x08D5FEA625B1dBf9Bae0b97437303a0374ee02F8",
+};
+
+const data = {};
Object.keys(config).forEach((chain) => {
- module.exports[chain] = aaveExports(chain, undefined, undefined, [
- config[chain],
- ]);
+ data[chain] = aaveExports(chain, undefined, undefined, [config[chain]]);
});
+
+data.linea.staking = staking(linea.zeroLocker, linea.zero, "linea");
+data.linea.pool2 = pool2s([linea.zlpLocker], [linea.zeroEthNileLP], "linea"); // todo add the lynex and nile LPs from the treasury
+
+module.exports = data;
diff --git a/projects/zircuit/index.js b/projects/zircuit/index.js
index cab942cebb..dc8ef0a2ae 100644
--- a/projects/zircuit/index.js
+++ b/projects/zircuit/index.js
@@ -19,7 +19,14 @@ const TOKEN_CONTRACTS = [
ADDRESSES.ethereum.STONE, // cSTONE
'0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa', // mETH
'0xD9A442856C234a39a81a089C06451EBAa4306a72', // pufETH
- '0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9' // egETH
+ '0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9', // egETH
+ '0x5fD13359Ba15A84B76f7F87568309040176167cd', // amphrETH
+ '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a', // rstETH
+ '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', // steakLRT
+ '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a', // Re7LRT
+ '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811', // pzETH
+ '0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e', // pumpBTC
+ '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88' // weETHs
];
module.exports = {
diff --git a/projects/zkLink/index.js b/projects/zkLink/index.js
index 5dde9d4146..3c3ec06b60 100644
--- a/projects/zkLink/index.js
+++ b/projects/zkLink/index.js
@@ -119,7 +119,7 @@ const config = {
"0xf5b90fE755Aa2e3CcC69d9548cbeB7b38c661D73", // nova bridge address
],
tokens: [
- "0xB880fd278198bd590252621d4CD071b1842E9Bcd", //MBTC
+ ADDRESSES.merlin.WBTC_1, //MBTC
"0x41D9036454BE47d3745A823C4aaCD0e29cFB0f71", //Solv BTC
],
diff --git a/projects/zkfinance/index.js b/projects/zkfinance/index.js
new file mode 100644
index 0000000000..1ba6e29c4e
--- /dev/null
+++ b/projects/zkfinance/index.js
@@ -0,0 +1,11 @@
+const { compoundExports2 } = require("../helper/compound");
+const zksyncComptroller = "0x218EBB63dfDf74eA689fBb2C55964E00ec905332";
+const zkEther = "0x36002f692234cDF2f115Ee701a9899DCB69F19d8";
+
+module.exports = {
+ era: compoundExports2({
+ comptroller: zksyncComptroller,
+ cether: zkEther,
+ fetchBalances: true,
+ }),
+};
diff --git a/projects/zksynth/index.js b/projects/zksynth/index.js
index cb3cfa0724..e9098e0d09 100644
--- a/projects/zksynth/index.js
+++ b/projects/zksynth/index.js
@@ -1,3 +1,4 @@
+const sdk = require("@defillama/sdk");
const { cachedGraphQuery } = require('../helper/cache')
const { sumTokens2 } = require('../helper/unwrapLPs')
@@ -11,7 +12,7 @@ const query = `{
}`
async function tvl(api) {
- const { pools } = await cachedGraphQuery('zksynth', 'https://api.thegraph.com/subgraphs/name/prasad-kumkar/zksynth-mainnet', query)
+ const { pools } = await cachedGraphQuery('zksynth', sdk.graph.modifyEndpoint('CWgPgHm4zz4pijQaEsi2oniuzvdwqasBczTgBRMgg1EL'), query)
const tokensAndOwners = pools.map(i => i.collaterals).flat().map(i => [i.token.id, i.pool.id])
return sumTokens2({ api, tokensAndOwners })
}
diff --git a/projects/zkx/index.js b/projects/zkx/index.js
new file mode 100644
index 0000000000..9dffbaaa88
--- /dev/null
+++ b/projects/zkx/index.js
@@ -0,0 +1,8 @@
+const { sumTokensExport } = require('../helper/unwrapLPs')
+const ADDRESSES = require('../helper/coreAssets.json')
+
+module.exports = {
+ ethereum: {
+ tvl: sumTokensExport({ owners: ['0x8F5Af913D42DbC296d0e184B6356EC4256029D09'], tokens: [ADDRESSES.ethereum.USDC], })
+ }
+}
diff --git a/projects/zunami/abi.json b/projects/zunami/abi.json
deleted file mode 100644
index fcec271d50..0000000000
--- a/projects/zunami/abi.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "totalHoldings": "uint256:totalHoldings"
-}
\ No newline at end of file
diff --git a/projects/zunami/index.js b/projects/zunami/index.js
index 4c2293a0ef..5505e9b36b 100644
--- a/projects/zunami/index.js
+++ b/projects/zunami/index.js
@@ -1,22 +1,37 @@
const ADDRESSES = require('../helper/coreAssets.json')
-const abi = require("./abi.json");
+const poolAbi = {
+ "totalHoldings": "uint256:totalHoldings"
+}
+const stakingAbi = {
+ "totalSupply": "uint256:totalSupply"
+}
const zunUSD = "0x8C0D76C9B18779665475F3E212D9Ca1Ed6A1A0e6";
const zunUSDAps = "0x28e487bbF6b64867C29e61DccbCD17aB64082889";
+
const zunETH = "0xc2e660C62F72c2ad35AcE6DB78a616215E2F2222";
const zunETHAps = "0x5Ab3aa11a40eB34f1d2733f08596532871bd28e2";
+const zunStaking = "0x45af4F12B46682B3958B297bAcebde2cE2E795c3";
+
+const ZUN = "0x6b5204B0Be36771253Cc38e88012E02B752f0f36";
+
async function ethTvl(api) {
- api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunUSD, }))
- api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: abi.totalHoldings, target: zunUSDAps, }))
- api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: abi.totalHoldings, target: zunETH, }))
- api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: abi.totalHoldings, target: zunETHAps, }))
+ api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: poolAbi.totalHoldings, target: zunUSD, }))
+ api.add(ADDRESSES.ethereum.DAI, await api.call({ abi: poolAbi.totalHoldings, target: zunUSDAps, }))
+ api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: poolAbi.totalHoldings, target: zunETH, }))
+ api.add(ADDRESSES.ethereum.WETH, await api.call({ abi: poolAbi.totalHoldings, target: zunETHAps, }))
+}
+
+async function staking(api) {
+ api.add(ZUN, await api.call({ abi: stakingAbi.totalSupply, target: zunStaking, }))
}
module.exports = {
misrepresentedTokens: true,
ethereum: {
tvl: ethTvl,
+ staking,
},
hallmarks: [
[Math.floor(new Date('2023-08-13')/1e3), 'Project was hacked for $2M'],
diff --git a/test.js b/test.js
index c77936d29d..5846caef10 100644
--- a/test.js
+++ b/test.js
@@ -27,7 +27,7 @@ const currentCacheVersion = sdk.cache.currentVersion // load env for cache
if (process.env.LLAMA_SANITIZE)
Object.keys(process.env).forEach((key) => {
if (key.endsWith('_RPC')) return;
- if (['TVL_LOCAL_CACHE_ROOT_FOLDER', 'LLAMA_DEBUG_MODE', ...ENV_KEYS].includes(key) || key.includes('SDK')) return;
+ if (['TVL_LOCAL_CACHE_ROOT_FOLDER', 'LLAMA_DEBUG_MODE', 'GRAPH_API_KEY', ...ENV_KEYS].includes(key) || key.includes('SDK')) return;
delete process.env[key]
})
process.env.SKIP_RPC_CHECK = 'true'
@@ -354,10 +354,10 @@ async function computeTVL(balances, timestamp) {
let tokenData = []
readKeys.forEach(i => unknownTokens[i] = true)
+ const queries = buildPricesGetQueries(readKeys)
const { errors } = await PromisePool.withConcurrency(5)
- .for(sliceIntoChunks(readKeys, 100))
- .process(async (keys) => {
- tokenData.push((await axios.get(`https://coins.llama.fi/prices/current/${keys.join(',')}`)).data.coins)
+ .for(queries).process(async (query) => {
+ tokenData.push((await axios.get(query)).data.coins)
})
if (errors && errors.length)
@@ -423,7 +423,23 @@ setTimeout(() => {
process.exit(1);
}, 10 * 60 * 1000) // 10 minutes
+function buildPricesGetQueries(readKeys) {
+ if (!readKeys.length) return []
+ const burl = 'https://coins.llama.fi/prices/current/'
+ const queries = []
+ let query = burl
+ for (const key of readKeys) {
+ if (query.length + key.length > 2000) {
+ queries.push(query.slice(0, -1))
+ query = burl
+ }
+ query += `${key},`
+ }
+
+ queries.push(query.slice(0, -1))
+ return queries
+}
async function initCache() {
let currentCache = await sdk.cache.readCache(INTERNAL_CACHE_FILE)
diff --git a/utils/handleError.js b/utils/handleError.js
index 254c51a97e..049f9b2cd9 100644
--- a/utils/handleError.js
+++ b/utils/handleError.js
@@ -4,7 +4,7 @@ function handleError(error){
console.log('\n',errorString, '\n\n')
const isGraphError = error.stack?.includes('graphql-request') && error.response?.errors?.length
if (isGraphError)
- console.error(error.response.errors.map(e => e.message).join('\n'))
+ console.error(`On chain ${error.chain ?? "Unknown"}:` + error.response.errors.map(e => e.message).join('\n'))
else
console.error(error.toString())
const axiosError = error?.response?.data?.message
diff --git a/volume.md b/volume.md
deleted file mode 100644
index 03e6490bc4..0000000000
--- a/volume.md
+++ /dev/null
@@ -1,34 +0,0 @@
-#### 1inch
-https://api.thegraph.com/subgraphs/name/1inch-exchange/oneinch-liquidity-protocol-v2
-
-#### Balancer
-https://api.thegraph.com/subgraphs/name/balancer-labs/balancer
-
-#### Bancor
-https://thegraph.com/explorer/subgraph/blocklytics/bancor
-
-#### Carthage
-https://thegraph.cndlchain.com/subgraphs/name/ianlapham/uniswap-v3-test
-
-#### Curve
-https://www.curve.fi/raw-stats/ren-1440m.json //where ren is the pool name
-
-#### Dodo
-https://thegraph.com/explorer/subgraph/dodoex/dodoex-v2
-
-#### Dydx
-https://docs.dydx.exchange/#get-markets
-
-#### Pancake Swap
-https://api.pancakeswap.finance/api/v1/stat
-
-#### Champagne Swap
-https://api.thegraph.com/subgraphs/name/champagneswap/exchangev3
-
-
-#### Perp
-https://thegraph.com/explorer/subgraph/perpetual-protocol/perp-position-subgraph
-https://perp.gq/pairs
-
-#### Uniswap
-https://api.thegraph.com/subgraphs/name/uniswap/uniswap-v2