diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6509cb7efa8e..69b6f38f3481 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,4 +56,6 @@ jobs: done - name: Run ESLint - uses: eslint/github-action@v0 + run: | + npm ci + npm run lint diff --git a/README.md b/README.md index ab14d8212ac7..c78ecdb136f8 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Also, don't hesitate to send a message on [our discord](https://discord.defillam 1. PLEASE PLEASE **enable "Allow edits by maintainers" while putting up the PR.** 2. Once your adapter has been merged, it takes time to show on the UI. No need to notify us on Discord. -3. Sorry, We no longer accept fetch adapter for new projects (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), we prefer the tvl to be computed from blockchain data, if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. +3. TVL must be computed from blockchain data (reason: https://github.com/DefiLlama/DefiLlama-Adapters/discussions/432), if you have trouble with creating a the adapter, please hop onto our discord, we are happy to assist you. 4. **For updating listing info** It is a different repo, you can find your listing in this file: https://github.com/DefiLlama/defillama-server/blob/master/defi/src/protocols/data2.ts, you can edit it there and put up a PR 5. Do not edit/push `package-lock.json` file as part of your changes, we use lockfileVersion 2, and most use v1 and using that messes up our CI 6. No need to go to our discord and announce that you've created a PR, we monitor all PRs and will review it asap @@ -25,8 +25,10 @@ This is a work in progress. The goal is to eventually handle historical data. De If you have any suggestions, want to contribute or want to chat, please join [our discord](https://discord.defillama.com/) and drop a message. ## Testing adapters -``` +```bash node test.js projects/pangolin/index.js +# Add a timestamp at the end to run the adapter at a historical timestamp +node test.js projects/aave/v3.js 1729080692 ``` ## Changing RPC providers diff --git a/package-lock.json b/package-lock.json index a541388890c7..5b6ddb351cea 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "hasInstallScript": true, "license": "ISC", "dependencies": { + "@coral-xyz/anchor": "^0.30.1", "@defillama/sdk": "latest", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", @@ -56,727 +57,846 @@ "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" }, "node_modules/@aws-crypto/crc32": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-3.0.0.tgz", - "integrity": "sha512-IzSgsrxUcsrejQbPVilIKy16kAT52EwB6zSaI+M3xxIhKh5+aldEyvI+z6erM7TCLB2BJsFrtHjp6/4/sr+3dA==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32/-/crc32-5.2.0.tgz", + "integrity": "sha512-nLbCWqQNgUiwwtFsen1AdzAtvuLRsQS8rYgMuxCrdKf9kOssamGLuPwyTY9wyYblNr9+1XM8v6zoDTPPSIeANg==", "dependencies": { - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, - "node_modules/@aws-crypto/crc32/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/crc32c": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-3.0.0.tgz", - "integrity": "sha512-ENNPPManmnVJ4BTXlOjAgD7URidbAznURqD0KvfREyc4o20DPYdEldU1f5cQ7Jbj0CJJSPaMIk/9ZshdB3210w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/crc32c/-/crc32c-5.2.0.tgz", + "integrity": "sha512-+iWb8qaHLYKrNvGRbiYRHSdKRWhto5XlZUEBwDjYNf+ly5SVYG6zEoYIdxvf5R3zyeP16w4PLBn3rH1xc74Rag==", "dependencies": { - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/crc32c/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, - "node_modules/@aws-crypto/ie11-detection": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/ie11-detection/-/ie11-detection-3.0.0.tgz", - "integrity": "sha512-341lBBkiY1DfDNKai/wXM3aujNBkXR7tq1URPQDL9wi3AUbI80NR74uF1TXHMm7po1AcnFk8iu2S2IeU/+/A+Q==", + "node_modules/@aws-crypto/sha1-browser": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-5.2.0.tgz", + "integrity": "sha512-OH6lveCFfcDjX4dbAvCFSYUjJZjDr/3XJ3xHtjn3Oj5b9RjojQo8npoLeA/bNwkOkrSQ0wgrHzXk4tDRxGKJeg==", "dependencies": { - "tslib": "^1.11.1" + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", + "@aws-sdk/types": "^3.222.0", + "@aws-sdk/util-locate-window": "^3.0.0", + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/ie11-detection/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@aws-crypto/sha1-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } }, - "node_modules/@aws-crypto/sha1-browser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha1-browser/-/sha1-browser-3.0.0.tgz", - "integrity": "sha512-NJth5c997GLHs6nOYTzFKTbYdMNA6/1XlKVgnZoaZcQ7z7UJlOgj2JdbHE8tiYLS3fzXNCguct77SPGat2raSw==", + "node_modules/@aws-crypto/sha1-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", "dependencies": { - "@aws-crypto/ie11-detection": "^3.0.0", - "@aws-crypto/supports-web-crypto": "^3.0.0", - "@aws-crypto/util": "^3.0.0", - "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-locate-window": "^3.0.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" } }, - "node_modules/@aws-crypto/sha1-browser/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@aws-crypto/sha1-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } }, "node_modules/@aws-crypto/sha256-browser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-3.0.0.tgz", - "integrity": "sha512-8VLmW2B+gjFbU5uMeqtQM6Nj0/F1bro80xQXCW6CQBWgosFWXTx77aeOF5CAIAmbOK64SdMBJdNr6J41yP5mvQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-browser/-/sha256-browser-5.2.0.tgz", + "integrity": "sha512-AXfN/lGotSQwu6HNcEsIASo7kWXZ5HYWvfOmSNKDsEqC4OashTp8alTmaz+F7TC2L083SFv5RdB+qU3Vs1kZqw==", "dependencies": { - "@aws-crypto/ie11-detection": "^3.0.0", - "@aws-crypto/sha256-js": "^3.0.0", - "@aws-crypto/supports-web-crypto": "^3.0.0", - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/sha256-js": "^5.2.0", + "@aws-crypto/supports-web-crypto": "^5.2.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", "@aws-sdk/util-locate-window": "^3.0.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/sha256-browser/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@aws-crypto/sha256-browser/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=14.0.0" + } }, "node_modules/@aws-crypto/sha256-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-3.0.0.tgz", - "integrity": "sha512-PnNN7os0+yd1XvXAy23CFOmTbMaDxgxXtTKHybrJ39Y8kGzBATgBFibWJKH6BhytLI/Zyszs87xCOBNyBig6vQ==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/sha256-js/-/sha256-js-5.2.0.tgz", + "integrity": "sha512-FFQQyu7edu4ufvIZ+OadFpHHOt+eSTBaYaki44c+akjg7qZg9oOQeLlk77F6tSYqjDAFClrHJk9tMf0HdVyOvA==", "dependencies": { - "@aws-crypto/util": "^3.0.0", + "@aws-crypto/util": "^5.2.0", "@aws-sdk/types": "^3.222.0", - "tslib": "^1.11.1" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, - "node_modules/@aws-crypto/sha256-js/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/supports-web-crypto": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-3.0.0.tgz", - "integrity": "sha512-06hBdMwUAb2WFTuGG73LSC0wfPu93xWwo5vL2et9eymgmu3Id5vFAHBbajVWiGhPO37qcsdCap/FqXvJGJWPIg==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/supports-web-crypto/-/supports-web-crypto-5.2.0.tgz", + "integrity": "sha512-iAvUotm021kM33eCdNfwIN//F77/IADDSs58i+MDaOqFrVjZo9bAal0NK7HurRuWLLpF1iLX7gbWrjHjeo+YFg==", "dependencies": { - "tslib": "^1.11.1" + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/supports-web-crypto/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, "node_modules/@aws-crypto/util": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-3.0.0.tgz", - "integrity": "sha512-2OJlpeJpCR48CC8r+uKVChzs9Iungj9wkZrl8Z041DWEWvyIHILYKCPNzJghKsivj+S3mLo6BVc7mBNzdxA46w==", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/@aws-crypto/util/-/util-5.2.0.tgz", + "integrity": "sha512-4RkU9EsI6ZpBve5fseQlGNUWKMa1RLPQ1dnjnQoe07ldfIzcsGb5hC5W0Dm7u423KWzawlrpbjXBrXCEv9zazQ==", "dependencies": { "@aws-sdk/types": "^3.222.0", - "@aws-sdk/util-utf8-browser": "^3.0.0", - "tslib": "^1.11.1" + "@smithy/util-utf8": "^2.0.0", + "tslib": "^2.6.2" } }, - "node_modules/@aws-crypto/util/node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" - }, - "node_modules/@aws-sdk/client-s3": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.485.0.tgz", - "integrity": "sha512-Vh8FRiXekwu1sSdfhS/wpNzjIljPmIXrUdEapR7EmaIwditR+mTTzNS+7y69YdPQhVEE2u9QxRlo4Eg1e1jD3w==", - "dependencies": { - "@aws-crypto/sha1-browser": "3.0.0", - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/client-sts": "3.485.0", - "@aws-sdk/core": "3.485.0", - "@aws-sdk/credential-provider-node": "3.485.0", - "@aws-sdk/middleware-bucket-endpoint": "3.485.0", - "@aws-sdk/middleware-expect-continue": "3.485.0", - "@aws-sdk/middleware-flexible-checksums": "3.485.0", - "@aws-sdk/middleware-host-header": "3.485.0", - "@aws-sdk/middleware-location-constraint": "3.485.0", - "@aws-sdk/middleware-logger": "3.485.0", - "@aws-sdk/middleware-recursion-detection": "3.485.0", - "@aws-sdk/middleware-sdk-s3": "3.485.0", - "@aws-sdk/middleware-signing": "3.485.0", - "@aws-sdk/middleware-ssec": "3.485.0", - "@aws-sdk/middleware-user-agent": "3.485.0", - "@aws-sdk/region-config-resolver": "3.485.0", - "@aws-sdk/signature-v4-multi-region": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-endpoints": "3.485.0", - "@aws-sdk/util-user-agent-browser": "3.485.0", - "@aws-sdk/util-user-agent-node": "3.485.0", - "@aws-sdk/xml-builder": "3.485.0", - "@smithy/config-resolver": "^2.0.23", - "@smithy/core": "^1.2.2", - "@smithy/eventstream-serde-browser": "^2.0.16", - "@smithy/eventstream-serde-config-resolver": "^2.0.16", - "@smithy/eventstream-serde-node": "^2.0.16", - "@smithy/fetch-http-handler": "^2.3.2", - "@smithy/hash-blob-browser": "^2.0.17", - "@smithy/hash-node": "^2.0.18", - "@smithy/hash-stream-node": "^2.0.18", - "@smithy/invalid-dependency": "^2.0.16", - "@smithy/md5-js": "^2.0.18", - "@smithy/middleware-content-length": "^2.0.18", - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-retry": "^2.0.26", - "@smithy/middleware-serde": "^2.0.16", - "@smithy/middleware-stack": "^2.0.10", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/node-http-handler": "^2.2.2", - "@smithy/protocol-http": "^3.0.12", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "@smithy/util-base64": "^2.0.1", - "@smithy/util-body-length-browser": "^2.0.1", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.24", - "@smithy/util-defaults-mode-node": "^2.0.32", - "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-retry": "^2.0.9", - "@smithy/util-stream": "^2.0.24", - "@smithy/util-utf8": "^2.0.2", - "@smithy/util-waiter": "^2.0.16", - "fast-xml-parser": "4.2.5", - "tslib": "^2.5.0" + "node_modules/@aws-crypto/util/node_modules/@smithy/is-array-buffer": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.2.0.tgz", + "integrity": "sha512-GGP3O9QFD24uGeAXYUjwSTXARoqpZykHadOmA8G5vfJPK0/DC67qa//0qvqrJzL1xc8WQWX7/yc7fwudjPHPhA==", + "dependencies": { + "tslib": "^2.6.2" }, "engines": { "node": ">=14.0.0" } }, - "node_modules/@aws-sdk/client-sso": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.485.0.tgz", - "integrity": "sha512-apN2bEn0PZs0jD4jAfvwO3dlWqw9YIQJ6TAudM1bd3S5vzWqlBBcLfQpK6taHoQaI+WqgUWXLuOf7gRFbGXKPg==", - "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/core": "3.485.0", - "@aws-sdk/middleware-host-header": "3.485.0", - "@aws-sdk/middleware-logger": "3.485.0", - "@aws-sdk/middleware-recursion-detection": "3.485.0", - "@aws-sdk/middleware-user-agent": "3.485.0", - "@aws-sdk/region-config-resolver": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-endpoints": "3.485.0", - "@aws-sdk/util-user-agent-browser": "3.485.0", - "@aws-sdk/util-user-agent-node": "3.485.0", - "@smithy/config-resolver": "^2.0.23", - "@smithy/core": "^1.2.2", - "@smithy/fetch-http-handler": "^2.3.2", - "@smithy/hash-node": "^2.0.18", - "@smithy/invalid-dependency": "^2.0.16", - "@smithy/middleware-content-length": "^2.0.18", - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-retry": "^2.0.26", - "@smithy/middleware-serde": "^2.0.16", - "@smithy/middleware-stack": "^2.0.10", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/node-http-handler": "^2.2.2", - "@smithy/protocol-http": "^3.0.12", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "@smithy/util-base64": "^2.0.1", - "@smithy/util-body-length-browser": "^2.0.1", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.24", - "@smithy/util-defaults-mode-node": "^2.0.32", - "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-retry": "^2.0.9", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "node_modules/@aws-crypto/util/node_modules/@smithy/util-buffer-from": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.2.0.tgz", + "integrity": "sha512-IJdWBbTcMQ6DA0gdNhh/BwrLkDR+ADW5Kr1aZmd4k3DIF6ezMV4R2NIAmT08wQJ3yUK82thHWmC/TnK/wpMMIA==", + "dependencies": { + "@smithy/is-array-buffer": "^2.2.0", + "tslib": "^2.6.2" }, "engines": { "node": ">=14.0.0" } }, - "node_modules/@aws-sdk/client-sts": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.485.0.tgz", - "integrity": "sha512-PI4q36kVF0fpIPZyeQhrwwJZ6SRkOGvU3rX5Qn4b5UY5X+Ct1aLhqSX8/OB372UZIcnh6eSvERu8POHleDO7Jw==", - "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/core": "3.485.0", - "@aws-sdk/credential-provider-node": "3.485.0", - "@aws-sdk/middleware-host-header": "3.485.0", - "@aws-sdk/middleware-logger": "3.485.0", - "@aws-sdk/middleware-recursion-detection": "3.485.0", - "@aws-sdk/middleware-user-agent": "3.485.0", - "@aws-sdk/region-config-resolver": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-endpoints": "3.485.0", - "@aws-sdk/util-user-agent-browser": "3.485.0", - "@aws-sdk/util-user-agent-node": "3.485.0", - "@smithy/config-resolver": "^2.0.23", - "@smithy/core": "^1.2.2", - "@smithy/fetch-http-handler": "^2.3.2", - "@smithy/hash-node": "^2.0.18", - "@smithy/invalid-dependency": "^2.0.16", - "@smithy/middleware-content-length": "^2.0.18", - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-retry": "^2.0.26", - "@smithy/middleware-serde": "^2.0.16", - "@smithy/middleware-stack": "^2.0.10", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/node-http-handler": "^2.2.2", - "@smithy/protocol-http": "^3.0.12", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "@smithy/util-base64": "^2.0.1", - "@smithy/util-body-length-browser": "^2.0.1", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.24", - "@smithy/util-defaults-mode-node": "^2.0.32", - "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-middleware": "^2.0.9", - "@smithy/util-retry": "^2.0.9", - "@smithy/util-utf8": "^2.0.2", - "fast-xml-parser": "4.2.5", - "tslib": "^2.5.0" + "node_modules/@aws-crypto/util/node_modules/@smithy/util-utf8": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.3.0.tgz", + "integrity": "sha512-R8Rdn8Hy72KKcebgLiv8jQcQkXoLMOGGv5uI1/k0l+snqkOzQ1R0ChUBCxWMlBsFMekWjq0wRudIweFs7sKT5A==", + "dependencies": { + "@smithy/util-buffer-from": "^2.2.0", + "tslib": "^2.6.2" }, "engines": { "node": ">=14.0.0" } }, + "node_modules/@aws-sdk/client-s3": { + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-s3/-/client-s3-3.623.0.tgz", + "integrity": "sha512-vEroSYEtbp5n289xsQnnAhKxg3R5NGkbhKXWpW1m7GGDsFihwVT9CVsDHpIW2Hvezz5ob65gB4ZAYMnJWZuUpA==", + "dependencies": { + "@aws-crypto/sha1-browser": "5.2.0", + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.623.0", + "@aws-sdk/client-sts": "3.623.0", + "@aws-sdk/core": "3.623.0", + "@aws-sdk/credential-provider-node": "3.623.0", + "@aws-sdk/middleware-bucket-endpoint": "3.620.0", + "@aws-sdk/middleware-expect-continue": "3.620.0", + "@aws-sdk/middleware-flexible-checksums": "3.620.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-location-constraint": "3.609.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-sdk-s3": "3.622.0", + "@aws-sdk/middleware-signing": "3.620.0", + "@aws-sdk/middleware-ssec": "3.609.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/signature-v4-multi-region": "3.622.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@aws-sdk/xml-builder": "3.609.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/eventstream-serde-browser": "^3.0.5", + "@smithy/eventstream-serde-config-resolver": "^3.0.3", + "@smithy/eventstream-serde-node": "^3.0.4", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-blob-browser": "^3.1.2", + "@smithy/hash-node": "^3.0.3", + "@smithy/hash-stream-node": "^3.1.2", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/md5-js": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-stream": "^3.1.3", + "@smithy/util-utf8": "^3.0.0", + "@smithy/util-waiter": "^3.1.2", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/client-sso": { + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso/-/client-sso-3.623.0.tgz", + "integrity": "sha512-oEACriysQMnHIVcNp7TD6D1nzgiHfYK0tmMBMbUxgoFuCBkW9g9QYvspHN+S9KgoePfMEXHuPUe9mtG9AH9XeA==", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.623.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/client-sso-oidc": { + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sso-oidc/-/client-sso-oidc-3.623.0.tgz", + "integrity": "sha512-lMFEXCa6ES/FGV7hpyrppT1PiAkqQb51AbG0zVU3TIgI2IO4XX02uzMUXImRSRqRpGymRCbJCaCs9LtKvS/37Q==", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/core": "3.623.0", + "@aws-sdk/credential-provider-node": "3.623.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.623.0" + } + }, + "node_modules/@aws-sdk/client-sts": { + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/client-sts/-/client-sts-3.623.0.tgz", + "integrity": "sha512-iJNdx76SOw0YjHAUv8aj3HXzSu3TKI7qSGuR+OGATwA/kpJZDd+4+WYBdGtr8YK+hPrGGqhfecuCkEg805O5iA==", + "dependencies": { + "@aws-crypto/sha256-browser": "5.2.0", + "@aws-crypto/sha256-js": "5.2.0", + "@aws-sdk/client-sso-oidc": "3.623.0", + "@aws-sdk/core": "3.623.0", + "@aws-sdk/credential-provider-node": "3.623.0", + "@aws-sdk/middleware-host-header": "3.620.0", + "@aws-sdk/middleware-logger": "3.609.0", + "@aws-sdk/middleware-recursion-detection": "3.620.0", + "@aws-sdk/middleware-user-agent": "3.620.0", + "@aws-sdk/region-config-resolver": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@aws-sdk/util-user-agent-browser": "3.609.0", + "@aws-sdk/util-user-agent-node": "3.614.0", + "@smithy/config-resolver": "^3.0.5", + "@smithy/core": "^2.3.2", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/hash-node": "^3.0.3", + "@smithy/invalid-dependency": "^3.0.3", + "@smithy/middleware-content-length": "^3.0.5", + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.14", + "@smithy/util-defaults-mode-node": "^3.0.14", + "@smithy/util-endpoints": "^2.0.5", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/@aws-sdk/core": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.485.0.tgz", - "integrity": "sha512-Yvi80DQcbjkYCft471ClE3HuetuNVqntCs6eFOomDcrJaqdOFrXv2kJAxky84MRA/xb7bGlDGAPbTuj1ICputg==", + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/core/-/core-3.623.0.tgz", + "integrity": "sha512-8Toq3X6trX/67obSdh4K0MFQY4f132bEbr1i0YPDWk/O3KdBt12mLC/sW3aVRnlIs110XMuX9yrWWqJ8fDW10g==", "dependencies": { - "@smithy/core": "^1.2.2", - "@smithy/protocol-http": "^3.0.12", - "@smithy/signature-v4": "^2.0.0", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/core": "^2.3.2", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "fast-xml-parser": "4.4.1", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/credential-provider-env": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.485.0.tgz", - "integrity": "sha512-3XkFgwVU1XOB33dV7t9BKJ/ptdl2iS+0dxE7ecq8aqT2/gsfKmLCae1G17P8WmdD3z0kMDTvnqM2aWgUnSOkmg==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-env/-/credential-provider-env-3.620.1.tgz", + "integrity": "sha512-ExuILJ2qLW5ZO+rgkNRj0xiAipKT16Rk77buvPP8csR7kkCflT/gXTyzRe/uzIiETTxM7tr8xuO9MP/DQXqkfg==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" + } + }, + "node_modules/@aws-sdk/credential-provider-http": { + "version": "3.622.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-http/-/credential-provider-http-3.622.0.tgz", + "integrity": "sha512-VUHbr24Oll1RK3WR8XLUugLpgK9ZuxEm/NVeVqyFts1Ck9gsKpRg1x4eH7L7tW3SJ4TDEQNMbD7/7J+eoL2svg==", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/credential-provider-ini": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.485.0.tgz", - "integrity": "sha512-cFYF/Bdw7EnT4viSxYpNIv3IBkri/Yb+JpQXl8uDq7bfVJfAN5qZmK07vRkg08xL6TC4F41wshhMSAucGdTwIw==", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.485.0", - "@aws-sdk/credential-provider-process": "3.485.0", - "@aws-sdk/credential-provider-sso": "3.485.0", - "@aws-sdk/credential-provider-web-identity": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@smithy/credential-provider-imds": "^2.0.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/shared-ini-file-loader": "^2.0.6", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-ini/-/credential-provider-ini-3.623.0.tgz", + "integrity": "sha512-kvXA1SwGneqGzFwRZNpESitnmaENHGFFuuTvgGwtMe7mzXWuA/LkXdbiHmdyAzOo0iByKTCD8uetuwh3CXy4Pw==", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.622.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.623.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.623.0" } }, "node_modules/@aws-sdk/credential-provider-node": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.485.0.tgz", - "integrity": "sha512-2DwzO2azkSzngifKDT61W/DL0tSzewuaFHiLJWdfc8Et3mdAQJ9x3KAj8u7XFpjIcGNqk7FiKjN+zeGUuNiEhA==", - "dependencies": { - "@aws-sdk/credential-provider-env": "3.485.0", - "@aws-sdk/credential-provider-ini": "3.485.0", - "@aws-sdk/credential-provider-process": "3.485.0", - "@aws-sdk/credential-provider-sso": "3.485.0", - "@aws-sdk/credential-provider-web-identity": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@smithy/credential-provider-imds": "^2.0.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/shared-ini-file-loader": "^2.0.6", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-node/-/credential-provider-node-3.623.0.tgz", + "integrity": "sha512-qDwCOkhbu5PfaQHyuQ+h57HEx3+eFhKdtIw7aISziWkGdFrMe07yIBd7TJqGe4nxXnRF1pfkg05xeOlMId997g==", + "dependencies": { + "@aws-sdk/credential-provider-env": "3.620.1", + "@aws-sdk/credential-provider-http": "3.622.0", + "@aws-sdk/credential-provider-ini": "3.623.0", + "@aws-sdk/credential-provider-process": "3.620.1", + "@aws-sdk/credential-provider-sso": "3.623.0", + "@aws-sdk/credential-provider-web-identity": "3.621.0", + "@aws-sdk/types": "3.609.0", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/credential-provider-process": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.485.0.tgz", - "integrity": "sha512-X9qS6ZO/rDKYDgWqD1YmSX7sAUUHax9HbXlgGiTTdtfhZvQh1ZmnH6wiPu5WNliafHZFtZT2W07kgrDLPld/Ug==", + "version": "3.620.1", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-process/-/credential-provider-process-3.620.1.tgz", + "integrity": "sha512-hWqFMidqLAkaV9G460+1at6qa9vySbjQKKc04p59OT7lZ5cO5VH5S4aI05e+m4j364MBROjjk2ugNvfNf/8ILg==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/shared-ini-file-loader": "^2.0.6", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/credential-provider-sso": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.485.0.tgz", - "integrity": "sha512-l0oC8GTrWh+LFQQfSmG1Jai1PX7Mhj9arb/CaS1/tmeZE0hgIXW++tvljYs/Dds4LGXUlaWG+P7BrObf6OyIXA==", + "version": "3.623.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-sso/-/credential-provider-sso-3.623.0.tgz", + "integrity": "sha512-70LZhUb3l7cttEsg4A0S4Jq3qrCT/v5Jfyl8F7w1YZJt5zr3oPPcvDJxo/UYckFz4G4/5BhGa99jK8wMlNE9QA==", "dependencies": { - "@aws-sdk/client-sso": "3.485.0", - "@aws-sdk/token-providers": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/shared-ini-file-loader": "^2.0.6", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/client-sso": "3.623.0", + "@aws-sdk/token-providers": "3.614.0", + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/credential-provider-web-identity": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.485.0.tgz", - "integrity": "sha512-WpBFZFE0iXtnibH5POMEKITj/hR0YV5l2n9p8BEvKjdJ63s3Xke1RN20ZdIyKDaRDwj8adnKDgNPEnAKdS4kLw==", + "version": "3.621.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/credential-provider-web-identity/-/credential-provider-web-identity-3.621.0.tgz", + "integrity": "sha512-w7ASSyfNvcx7+bYGep3VBgC3K6vEdLmlpjT7nSIHxxQf+WSdvy+HynwJosrpZax0sK5q0D1Jpn/5q+r5lwwW6w==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sts": "^3.621.0" } }, "node_modules/@aws-sdk/middleware-bucket-endpoint": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.485.0.tgz", - "integrity": "sha512-DptPuprsx9V1LH91ZvC/7a7B1UnuSAIi1ArJHlHqJL1ISo6sH1oeXP6KRa0tj8biGMDIx0b22wg8EEpFePMy3w==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-bucket-endpoint/-/middleware-bucket-endpoint-3.620.0.tgz", + "integrity": "sha512-eGLL0W6L3HDb3OACyetZYOWpHJ+gLo0TehQKeQyy2G8vTYXqNTeqYhuI6up9HVjBzU9eQiULVQETmgQs7TFaRg==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-arn-parser": "3.465.0", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "@smithy/util-config-provider": "^2.1.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-arn-parser": "3.568.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-expect-continue": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.485.0.tgz", - "integrity": "sha512-rOwJJWM1/ydwSiJJ1l/X5h91u2Xzb8/CwOW6ZY+E8iZA0HDCtlJnKNlhHb+NHGtDamd4+1qdGSRtPQevyS58Cg==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-expect-continue/-/middleware-expect-continue-3.620.0.tgz", + "integrity": "sha512-QXeRFMLfyQ31nAHLbiTLtk0oHzG9QLMaof5jIfqcUwnOkO8YnQdeqzakrg1Alpy/VQ7aqzIi8qypkBe2KXZz0A==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-flexible-checksums": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.485.0.tgz", - "integrity": "sha512-5+OmVMbEwl1LDdWbaJxoSViw6vuMsdDQgASFUM37aG46q1zWSiPU171IXutEAFZZXN/t0HcOFi0AmNrS0o+dkQ==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-flexible-checksums/-/middleware-flexible-checksums-3.620.0.tgz", + "integrity": "sha512-ftz+NW7qka2sVuwnnO1IzBku5ccP+s5qZGeRTPgrKB7OzRW85gthvIo1vQR2w+OwHFk7WJbbhhWwbCbktnP4UA==", "dependencies": { - "@aws-crypto/crc32": "3.0.0", - "@aws-crypto/crc32c": "3.0.0", - "@aws-sdk/types": "3.485.0", - "@smithy/is-array-buffer": "^2.0.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@aws-crypto/crc32": "5.2.0", + "@aws-crypto/crc32c": "5.2.0", + "@aws-sdk/types": "3.609.0", + "@smithy/is-array-buffer": "^3.0.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-host-header": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.485.0.tgz", - "integrity": "sha512-1mAUX9dQNGo2RIKseVj7SI/D5abQJQ/Os8hQ0NyVAyyVYF+Yjx5PphKgfhM5yoBwuwZUl6q71XPYEGNx7be6SA==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-host-header/-/middleware-host-header-3.620.0.tgz", + "integrity": "sha512-VMtPEZwqYrII/oUkffYsNWY9PZ9xpNJpMgmyU0rlDQ25O1c0Hk3fJmZRe6pEkAJ0omD7kLrqGl1DUjQVxpd/Rg==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-location-constraint": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.485.0.tgz", - "integrity": "sha512-Mrp4chtYliqCUSVjzLYPcZCPGmhL4QM7o6NhHBdA6omaIGdn4pJqFwN5ELZoWJDZMKyfrKi6s6u97jR9VtEXRg==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-location-constraint/-/middleware-location-constraint-3.609.0.tgz", + "integrity": "sha512-xzsdoTkszGVqGVPjUmgoP7TORiByLueMHieI1fhQL888WPdqctwAx3ES6d/bA9Q/i8jnc6hs+Fjhy8UvBTkE9A==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-logger": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.485.0.tgz", - "integrity": "sha512-O8IgJ0LHi5wTs5GlpI7nqmmSSagkVdd1shpGgQWY2h0kMSCII8CJZHBG97dlFFpGTvx5EDlhPNek7rl/6F4dRw==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-logger/-/middleware-logger-3.609.0.tgz", + "integrity": "sha512-S62U2dy4jMDhDFDK5gZ4VxFdWzCtLzwbYyFZx2uvPYTECkepLUfzLic2BHg2Qvtu4QjX+oGE3P/7fwaGIsGNuQ==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-recursion-detection": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.485.0.tgz", - "integrity": "sha512-ZeVNATGNFcqkWDut3luVszROTUzkU5u+rJpB/xmeMoenlDAjPRiHt/ca3WkI5wAnIJ1VSNGpD2sOFLMCH+EWag==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-recursion-detection/-/middleware-recursion-detection-3.620.0.tgz", + "integrity": "sha512-nh91S7aGK3e/o1ck64sA/CyoFw+gAYj2BDOnoNa6ouyCrVJED96ZXWbhye/fz9SgmNUZR2g7GdVpiLpMKZoI5w==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-sdk-s3": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.485.0.tgz", - "integrity": "sha512-3769c4e3UtvaNU5T6dHxhjGI1kEXymldqiP1PMZMX2jVffwSGhbvyLq0Kl6+9Jr51fj2oXN6Tex+8J9+5dzTgQ==", + "version": "3.622.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-sdk-s3/-/middleware-sdk-s3-3.622.0.tgz", + "integrity": "sha512-tX9wZ2ALx5Ez4bkY+SvSj6DpNZ6TmY4zlsVsdgV95LZFLjNwqnZkKkS+uKnsIyLBiBp6g92JVQwnUEIp7ov2Zw==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-arn-parser": "3.465.0", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/protocol-http": "^3.0.12", - "@smithy/signature-v4": "^2.0.0", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/util-config-provider": "^2.1.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-arn-parser": "3.568.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "@smithy/util-stream": "^3.1.3", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-signing": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.485.0.tgz", - "integrity": "sha512-41xzT2p1sOibhsLkdE5rwPJkNbBtKD8Gp36/ySfu0KE415wfXKacElSVxAaBw39/j7iSWDYqqybeEYbAzk+3GQ==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-signing/-/middleware-signing-3.620.0.tgz", + "integrity": "sha512-gxI7rubiaanUXaLfJ4NybERa9MGPNg2Ycl/OqANsozrBnR3Pw8vqy3EuVImQOyn2pJ2IFvl8ZPoSMHf4pX56FQ==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/property-provider": "^2.0.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/signature-v4": "^2.0.0", - "@smithy/types": "^2.8.0", - "@smithy/util-middleware": "^2.0.9", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-ssec": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.485.0.tgz", - "integrity": "sha512-A59WTC0egT8zLnRzB+yWKq2AonugD1DgN4710RG70JY5XUmx5TYdECbUrVeG/zhNIKbBLLFjRcVk2uo4OZcgIA==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-ssec/-/middleware-ssec-3.609.0.tgz", + "integrity": "sha512-GZSD1s7+JswWOTamVap79QiDaIV7byJFssBW68GYjyRS5EBjNfwA/8s+6uE6g39R3ojyTbYOmvcANoZEhSULXg==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/middleware-user-agent": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.485.0.tgz", - "integrity": "sha512-CddCVOn+OPQ0CcchketIg+WF6v+MDLAf3GOYTR2htUxxIm7HABuRd6R3kvQ5Jny9CV8gMt22G1UZITsFexSJlQ==", + "version": "3.620.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/middleware-user-agent/-/middleware-user-agent-3.620.0.tgz", + "integrity": "sha512-bvS6etn+KsuL32ubY5D3xNof1qkenpbJXf/ugGXbg0n98DvDFQ/F+SMLxHgbnER5dsKYchNnhmtI6/FC3HFu/A==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-endpoints": "3.485.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@aws-sdk/util-endpoints": "3.614.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/region-config-resolver": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.485.0.tgz", - "integrity": "sha512-2FB2EQ0sIE+YgFqGtkE1lDIMIL6nYe6MkOHBwBM7bommadKIrbbr2L22bPZGs3ReTsxiJabjzxbuCAVhrpHmhg==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/region-config-resolver/-/region-config-resolver-3.614.0.tgz", + "integrity": "sha512-vDCeMXvic/LU0KFIUjpC3RiSTIkkvESsEfbVHiHH0YINfl8HnEqR5rj+L8+phsCeVg2+LmYwYxd5NRz4PHxt5g==", "dependencies": { - "@smithy/node-config-provider": "^2.1.9", - "@smithy/types": "^2.8.0", - "@smithy/util-config-provider": "^2.1.0", - "@smithy/util-middleware": "^2.0.9", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/signature-v4-multi-region": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.485.0.tgz", - "integrity": "sha512-168ipXkbG75l9cKQmsBtx/4+AYjGsBoy724bXosW13t2/l/E3IzJAYUjDROiK0JXVMG85xAnGWbFwZkjxVXzrQ==", + "version": "3.622.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/signature-v4-multi-region/-/signature-v4-multi-region-3.622.0.tgz", + "integrity": "sha512-K7ddofVNzwTFRjmLZLfs/v+hiE9m5LguajHk8WULxXQgkcDI3nPgOfmMMGuslYohaQhRwW+ic+dzYlateLUudQ==", "dependencies": { - "@aws-sdk/middleware-sdk-s3": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/signature-v4": "^2.0.0", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/middleware-sdk-s3": "3.622.0", + "@aws-sdk/types": "3.609.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/signature-v4": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/token-providers": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.485.0.tgz", - "integrity": "sha512-kOXA1WKIVIFNRqHL8ynVZ3hCKLsgnEmGr2iDR6agDNw5fYIlCO/6N2xR6QdGcLTvUUbwOlz4OvKLUQnWMKAnnA==", - "dependencies": { - "@aws-crypto/sha256-browser": "3.0.0", - "@aws-crypto/sha256-js": "3.0.0", - "@aws-sdk/middleware-host-header": "3.485.0", - "@aws-sdk/middleware-logger": "3.485.0", - "@aws-sdk/middleware-recursion-detection": "3.485.0", - "@aws-sdk/middleware-user-agent": "3.485.0", - "@aws-sdk/region-config-resolver": "3.485.0", - "@aws-sdk/types": "3.485.0", - "@aws-sdk/util-endpoints": "3.485.0", - "@aws-sdk/util-user-agent-browser": "3.485.0", - "@aws-sdk/util-user-agent-node": "3.485.0", - "@smithy/config-resolver": "^2.0.23", - "@smithy/fetch-http-handler": "^2.3.2", - "@smithy/hash-node": "^2.0.18", - "@smithy/invalid-dependency": "^2.0.16", - "@smithy/middleware-content-length": "^2.0.18", - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-retry": "^2.0.26", - "@smithy/middleware-serde": "^2.0.16", - "@smithy/middleware-stack": "^2.0.10", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/node-http-handler": "^2.2.2", - "@smithy/property-provider": "^2.0.0", - "@smithy/protocol-http": "^3.0.12", - "@smithy/shared-ini-file-loader": "^2.0.6", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "@smithy/util-base64": "^2.0.1", - "@smithy/util-body-length-browser": "^2.0.1", - "@smithy/util-body-length-node": "^2.1.0", - "@smithy/util-defaults-mode-browser": "^2.0.24", - "@smithy/util-defaults-mode-node": "^2.0.32", - "@smithy/util-endpoints": "^1.0.8", - "@smithy/util-retry": "^2.0.9", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/token-providers/-/token-providers-3.614.0.tgz", + "integrity": "sha512-okItqyY6L9IHdxqs+Z116y5/nda7rHxLvROxtAJdLavWTYDydxrZstImNgGWTeVdmc0xX2gJCI77UYUTQWnhRw==", + "dependencies": { + "@aws-sdk/types": "3.609.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" + }, + "peerDependencies": { + "@aws-sdk/client-sso-oidc": "^3.614.0" } }, "node_modules/@aws-sdk/types": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.485.0.tgz", - "integrity": "sha512-+QW32YQdvZRDOwrAQPo/qCyXoSjgXB6RwJwCwkd8ebJXRXw6tmGKIHaZqYHt/LtBymvnaBgBBADNa4+qFvlOFw==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/types/-/types-3.609.0.tgz", + "integrity": "sha512-+Tqnh9w0h2LcrUsdXyT1F8mNhXz+tVYBtP19LpeEGntmvHwa2XzvLUCWpoIAIVsHp5+HdB2X9Sn0KAtmbFXc2Q==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/util-arn-parser": { - "version": "3.465.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.465.0.tgz", - "integrity": "sha512-zOJ82vzDJFqBX9yZBlNeHHrul/kpx/DCoxzW5UBbZeb26kfV53QhMSoEmY8/lEbBqlqargJ/sgRC845GFhHNQw==", + "version": "3.568.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-arn-parser/-/util-arn-parser-3.568.0.tgz", + "integrity": "sha512-XUKJWWo+KOB7fbnPP0+g/o5Ulku/X53t7i/h+sPHr5xxYTJJ9CYnbToo95mzxe7xWvkLrsNtJ8L+MnNn9INs2w==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/util-endpoints": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.485.0.tgz", - "integrity": "sha512-dTd642F7nJisApF8YjniqQ6U59CP/DCtar11fXf1nG9YNBCBsNNVw5ZfZb5nSNzaIdy27mQioWTCV18JEj1mxg==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-endpoints/-/util-endpoints-3.614.0.tgz", + "integrity": "sha512-wK2cdrXHH4oz4IomV/yrGkftU9A+ITB6nFL+rxxyO78is2ifHJpFdV4aqk4LSkXYPi6CXWNru/Dqc7yiKXgJPw==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/util-endpoints": "^1.0.8", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", + "@smithy/util-endpoints": "^2.0.5", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/util-locate-window": { - "version": "3.465.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.465.0.tgz", - "integrity": "sha512-f+QNcWGswredzC1ExNAB/QzODlxwaTdXkNT5cvke2RLX8SFU5pYk6h4uCtWC0vWPELzOfMfloBrJefBzlarhsw==", + "version": "3.568.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-locate-window/-/util-locate-window-3.568.0.tgz", + "integrity": "sha512-3nh4TINkXYr+H41QaPelCceEB2FXP3fxp93YZXB/kqJvX0U9j0N0Uk45gvsjmEPzG8XxkPEeLIfT2I1M7A6Lig==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@aws-sdk/util-user-agent-browser": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.485.0.tgz", - "integrity": "sha512-QliWbjg0uOhGTcWgWTKPMY0SBi07g253DjwrCINT1auqDrdQPxa10xozpZExBYjAK2KuhYDNUzni127ae6MHOw==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-browser/-/util-user-agent-browser-3.609.0.tgz", + "integrity": "sha512-fojPU+mNahzQ0YHYBsx0ZIhmMA96H+ZIZ665ObU9tl+SGdbLneVZVikGve+NmHTQwHzwkFsZYYnVKAkreJLAtA==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/types": "^2.8.0", + "@aws-sdk/types": "3.609.0", + "@smithy/types": "^3.3.0", "bowser": "^2.11.0", - "tslib": "^2.5.0" + "tslib": "^2.6.2" } }, "node_modules/@aws-sdk/util-user-agent-node": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.485.0.tgz", - "integrity": "sha512-QF+aQ9jnDlPUlFBxBRqOylPf86xQuD3aEPpOErR+50qJawVvKa94uiAFdvtI9jv6hnRZmuFsTj2rsyytnbAYBA==", + "version": "3.614.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/util-user-agent-node/-/util-user-agent-node-3.614.0.tgz", + "integrity": "sha512-15ElZT88peoHnq5TEoEtZwoXTXRxNrk60TZNdpl/TUBJ5oNJ9Dqb5Z4ryb8ofN6nm9aFf59GVAerFDz8iUoHBA==", "dependencies": { - "@aws-sdk/types": "3.485.0", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@aws-sdk/types": "3.609.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" }, "peerDependencies": { "aws-crt": ">=1.0.0" @@ -787,24 +907,16 @@ } } }, - "node_modules/@aws-sdk/util-utf8-browser": { - "version": "3.259.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/util-utf8-browser/-/util-utf8-browser-3.259.0.tgz", - "integrity": "sha512-UvFa/vR+e19XookZF8RzFZBrw2EUkQWxiBW0yYQAhvk3C+QVGl0H3ouca8LDBlBfQKXwmW3huo/59H8rwb1wJw==", - "dependencies": { - "tslib": "^2.3.1" - } - }, "node_modules/@aws-sdk/xml-builder": { - "version": "3.485.0", - "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.485.0.tgz", - "integrity": "sha512-xQexPM6LINOIkf3NLFywplcbApifZRMWFN41TDWYSNgCUa5uC9fntfenw8N/HTx1n+McRCWSAFBTjDqY/2OLCQ==", + "version": "3.609.0", + "resolved": "https://registry.npmjs.org/@aws-sdk/xml-builder/-/xml-builder-3.609.0.tgz", + "integrity": "sha512-l9XxNcA4HX98rwCC2/KoiWcmEiRfZe4G+mYwDbCFT87JIMj6GBhLDkAzr/W8KAaA2IDr8Vc6J8fZPgVulxxfMA==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@babel/runtime": { @@ -819,14 +931,15 @@ } }, "node_modules/@coral-xyz/anchor": { - "version": "0.28.1-beta.2", - "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.28.1-beta.2.tgz", - "integrity": "sha512-xreUcOFF8+IQKWOBUrDKJbIw2ftpRVybFlEPVrbSlOBCbreCWrQ5754Gt9cHIcuBDAzearCDiBqzsGQdNgPJiw==", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.30.1.tgz", + "integrity": "sha512-gDXFoF5oHgpriXAaLpxyWBHdCs8Awgf/gLHIo6crv7Aqm937CNdY+x+6hoj7QR5vaJV7MxWSQ0NGFzL3kPbWEQ==", + "license": "(MIT OR Apache-2.0)", "dependencies": { - "@coral-xyz/borsh": "^0.28.0", + "@coral-xyz/anchor-errors": "^0.30.1", + "@coral-xyz/borsh": "^0.30.1", "@noble/hashes": "^1.3.1", "@solana/web3.js": "^1.68.0", - "base64-js": "^1.5.1", "bn.js": "^5.1.2", "bs58": "^4.0.1", "buffer-layout": "^1.2.2", @@ -843,10 +956,20 @@ "node": ">=11" } }, + "node_modules/@coral-xyz/anchor-errors": { + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor-errors/-/anchor-errors-0.30.1.tgz", + "integrity": "sha512-9Mkradf5yS5xiLWrl9WrpjqOrAV+/W2RQHDlbnAZBivoGpOs1ECjoDCkVk4aRG8ZdiFiB8zQEVlxf+8fKkmSfQ==", + "license": "Apache-2.0", + "engines": { + "node": ">=10" + } + }, "node_modules/@coral-xyz/anchor/node_modules/@coral-xyz/borsh": { - "version": "0.28.0", - "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.28.0.tgz", - "integrity": "sha512-/u1VTzw7XooK7rqeD7JLUSwOyRSesPUk0U37BV9zK0axJc1q0nRbKFGFLYCQ16OtdOJTTwGfGp11Lx9B45bRCQ==", + "version": "0.30.1", + "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.30.1.tgz", + "integrity": "sha512-aaxswpPrCFKl8vZTbxLssA2RvwX2zmKLlRCIktJOwW+VpVwYtXRtlWiIP+c2pPRKneiTiWCN2GEMSH9j1zTlWQ==", + "license": "Apache-2.0", "dependencies": { "bn.js": "^5.1.2", "buffer-layout": "^1.2.0" @@ -886,9 +1009,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.74", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", - "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", + "version": "5.0.101", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.101.tgz", + "integrity": "sha512-mlZsTA9dxIDn/VG2qKq6q9BbIikb5UWL7WSI71JNRNDJ0RE/bHiRvpU0gjtgEb6svt5pV5jRsWONjcSPOWcljg==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", @@ -1149,6 +1272,32 @@ "@solana/web3.js": "^1.30.2" } }, + "node_modules/@pythnetwork/client/node_modules/@coral-xyz/anchor": { + "version": "0.28.1-beta.2", + "resolved": "https://registry.npmjs.org/@coral-xyz/anchor/-/anchor-0.28.1-beta.2.tgz", + "integrity": "sha512-xreUcOFF8+IQKWOBUrDKJbIw2ftpRVybFlEPVrbSlOBCbreCWrQ5754Gt9cHIcuBDAzearCDiBqzsGQdNgPJiw==", + "license": "(MIT OR Apache-2.0)", + "dependencies": { + "@coral-xyz/borsh": "^0.28.0", + "@noble/hashes": "^1.3.1", + "@solana/web3.js": "^1.68.0", + "base64-js": "^1.5.1", + "bn.js": "^5.1.2", + "bs58": "^4.0.1", + "buffer-layout": "^1.2.2", + "camelcase": "^6.3.0", + "cross-fetch": "^3.1.5", + "crypto-hash": "^1.3.0", + "eventemitter3": "^4.0.7", + "pako": "^2.0.3", + "snake-case": "^3.0.4", + "superstruct": "^0.15.4", + "toml": "^3.0.0" + }, + "engines": { + "node": ">=11" + } + }, "node_modules/@pythnetwork/client/node_modules/@coral-xyz/borsh": { "version": "0.28.0", "resolved": "https://registry.npmjs.org/@coral-xyz/borsh/-/borsh-0.28.0.tgz", @@ -1210,640 +1359,653 @@ } }, "node_modules/@smithy/abort-controller": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-2.0.16.tgz", - "integrity": "sha512-4foO7738k8kM9flMHu3VLabqu7nPgvIj8TB909S0CnKx0YZz/dcDH3pZ/4JHdatfxlZdKF1JWOYCw9+v3HVVsw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@smithy/abort-controller/-/abort-controller-3.1.1.tgz", + "integrity": "sha512-MBJBiidoe+0cTFhyxT8g+9g7CeVccLM0IOKKUMCNQ1CNMJ/eIfoo0RTfVrXOONEI1UCN1W+zkiHSbzUNE9dZtQ==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/chunked-blob-reader": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader/-/chunked-blob-reader-2.0.0.tgz", - "integrity": "sha512-k+J4GHJsMSAIQPChGBrjEmGS+WbPonCXesoqP9fynIqjn7rdOThdH8FAeCmokP9mxTYKQAKoHCLPzNlm6gh7Wg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader/-/chunked-blob-reader-3.0.0.tgz", + "integrity": "sha512-sbnURCwjF0gSToGlsBiAmd1lRCmSn72nu9axfJu5lIx6RUEgHu6GwTMbqCdhQSi0Pumcm5vFxsi9XWXb2mTaoA==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" } }, "node_modules/@smithy/chunked-blob-reader-native": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-2.0.1.tgz", - "integrity": "sha512-N2oCZRglhWKm7iMBu7S6wDzXirjAofi7tAd26cxmgibRYOBS4D3hGfmkwCpHdASZzwZDD8rluh0Rcqw1JeZDRw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/chunked-blob-reader-native/-/chunked-blob-reader-native-3.0.0.tgz", + "integrity": "sha512-VDkpCYW+peSuM4zJip5WDfqvg2Mo/e8yxOv3VF1m11y7B8KKMKVFtmZWDe36Fvk8rGuWrPZHHXZ7rR7uM5yWyg==", "dependencies": { - "@smithy/util-base64": "^2.0.1", - "tslib": "^2.5.0" + "@smithy/util-base64": "^3.0.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/config-resolver": { - "version": "2.0.23", - "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-2.0.23.tgz", - "integrity": "sha512-XakUqgtP2YY8Mi+Nlif5BiqJgWdvfxJafSpOSQeCOMizu+PUhE4fBQSy6xFcR+eInrwVadaABNxoJyGUMn15ew==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/config-resolver/-/config-resolver-3.0.5.tgz", + "integrity": "sha512-SkW5LxfkSI1bUC74OtfBbdz+grQXYiPYolyu8VfpLIjEoN/sHVBlLeGXMQ1vX4ejkgfv6sxVbQJ32yF2cl1veA==", "dependencies": { - "@smithy/node-config-provider": "^2.1.9", - "@smithy/types": "^2.8.0", - "@smithy/util-config-provider": "^2.1.0", - "@smithy/util-middleware": "^2.0.9", - "tslib": "^2.5.0" + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-config-provider": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/core": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@smithy/core/-/core-1.2.2.tgz", - "integrity": "sha512-uLjrskLT+mWb0emTR5QaiAIxVEU7ndpptDaVDrTwwhD+RjvHhjIiGQ3YL5jKk1a5VSDQUA2RGkXvJ6XKRcz6Dg==", + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/@smithy/core/-/core-2.3.2.tgz", + "integrity": "sha512-in5wwt6chDBcUv1Lw1+QzZxN9fBffi+qOixfb65yK4sDuKG7zAUO9HAFqmVzsZM3N+3tTyvZjtnDXePpvp007Q==", "dependencies": { - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-retry": "^2.0.26", - "@smithy/middleware-serde": "^2.0.16", - "@smithy/protocol-http": "^3.0.12", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/util-middleware": "^2.0.9", - "tslib": "^2.5.0" + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-retry": "^3.0.14", + "@smithy/middleware-serde": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/credential-provider-imds": { - "version": "2.1.5", - "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-2.1.5.tgz", - "integrity": "sha512-VfvE6Wg1MUWwpTZFBnUD7zxvPhLY8jlHCzu6bCjlIYoWgXCDzZAML76IlZUEf45nib3rjehnFgg0s1rgsuN/bg==", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/@smithy/credential-provider-imds/-/credential-provider-imds-3.2.0.tgz", + "integrity": "sha512-0SCIzgd8LYZ9EJxUjLXBmEKSZR/P/w6l7Rz/pab9culE/RWuqelAKGJvn5qUOl8BgX8Yj5HWM50A5hiB/RzsgA==", "dependencies": { - "@smithy/node-config-provider": "^2.1.9", - "@smithy/property-provider": "^2.0.17", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "tslib": "^2.5.0" + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/eventstream-codec": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-2.0.16.tgz", - "integrity": "sha512-umYh5pdCE9GHgiMAH49zu9wXWZKNHHdKPm/lK22WYISTjqu29SepmpWNmPiBLy/yUu4HFEGJHIFrDWhbDlApaw==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-codec/-/eventstream-codec-3.1.2.tgz", + "integrity": "sha512-0mBcu49JWt4MXhrhRAlxASNy0IjDRFU+aWNDRal9OtUJvJNiwDuyKMUONSOjLjSCeGwZaE0wOErdqULer8r7yw==", "dependencies": { - "@aws-crypto/crc32": "3.0.0", - "@smithy/types": "^2.8.0", - "@smithy/util-hex-encoding": "^2.0.0", - "tslib": "^2.5.0" + "@aws-crypto/crc32": "5.2.0", + "@smithy/types": "^3.3.0", + "@smithy/util-hex-encoding": "^3.0.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/eventstream-serde-browser": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-2.0.16.tgz", - "integrity": "sha512-W+BdiN728R57KuZOcG0GczpIOEFf8S5RP/OdVH7T3FMCy8HU2bBU0vB5xZZR5c00VRdoeWrohNv3XlHoZuGRoA==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-browser/-/eventstream-serde-browser-3.0.5.tgz", + "integrity": "sha512-dEyiUYL/ekDfk+2Ra4GxV+xNnFoCmk1nuIXg+fMChFTrM2uI/1r9AdiTYzPqgb72yIv/NtAj6C3dG//1wwgakQ==", "dependencies": { - "@smithy/eventstream-serde-universal": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/eventstream-serde-universal": "^3.0.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/eventstream-serde-config-resolver": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-2.0.16.tgz", - "integrity": "sha512-8qrE4nh+Tg6m1SMFK8vlzoK+8bUFTlIhXidmmQfASMninXW3Iu0T0bI4YcIk4nLznHZdybQ0qGydIanvVZxzVg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-config-resolver/-/eventstream-serde-config-resolver-3.0.3.tgz", + "integrity": "sha512-NVTYjOuYpGfrN/VbRQgn31x73KDLfCXCsFdad8DiIc3IcdxL+dYA9zEQPyOP7Fy2QL8CPy2WE4WCUD+ZsLNfaQ==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/eventstream-serde-node": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-2.0.16.tgz", - "integrity": "sha512-NRNQuOa6mQdFSkqzY0IV37swHWx0SEoKxFtUfdZvfv0AVQPlSw4N7E3kcRSCpnHBr1kCuWWirdDlWcjWuD81MA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-node/-/eventstream-serde-node-3.0.4.tgz", + "integrity": "sha512-mjlG0OzGAYuUpdUpflfb9zyLrBGgmQmrobNT8b42ZTsGv/J03+t24uhhtVEKG/b2jFtPIHF74Bq+VUtbzEKOKg==", "dependencies": { - "@smithy/eventstream-serde-universal": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/eventstream-serde-universal": "^3.0.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/eventstream-serde-universal": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-2.0.16.tgz", - "integrity": "sha512-ZyLnGaYQMLc75j9kKEVMJ3X6bdBE9qWxhZdTXM5RIltuytxJC3FaOhawBxjE+IL1enmWSIohHGZCm/pLwEliQA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@smithy/eventstream-serde-universal/-/eventstream-serde-universal-3.0.4.tgz", + "integrity": "sha512-Od9dv8zh3PgOD7Vj4T3HSuox16n0VG8jJIM2gvKASL6aCtcS8CfHZDWe1Ik3ZXW6xBouU+45Q5wgoliWDZiJ0A==", "dependencies": { - "@smithy/eventstream-codec": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/eventstream-codec": "^3.1.2", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/fetch-http-handler": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-2.3.2.tgz", - "integrity": "sha512-O9R/OlnAOTsnysuSDjt0v2q6DcSvCz5cCFC/CFAWWcLyBwJDeFyGTCTszgpQTb19+Fi8uRwZE5/3ziAQBFeDMQ==", + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@smithy/fetch-http-handler/-/fetch-http-handler-3.2.4.tgz", + "integrity": "sha512-kBprh5Gs5h7ug4nBWZi1FZthdqSM+T7zMmsZxx0IBvWUn7dK3diz2SHn7Bs4dQGFDk8plDv375gzenDoNwrXjg==", "dependencies": { - "@smithy/protocol-http": "^3.0.12", - "@smithy/querystring-builder": "^2.0.16", - "@smithy/types": "^2.8.0", - "@smithy/util-base64": "^2.0.1", - "tslib": "^2.5.0" + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", + "@smithy/util-base64": "^3.0.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/hash-blob-browser": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@smithy/hash-blob-browser/-/hash-blob-browser-2.0.17.tgz", - "integrity": "sha512-/mPpv1sRiRDdjO4zZuO8be6eeabmg5AVgKDfnmmqkpBtRyMGSJb968fjRuHt+FRAsIGywgIKJFmUUAYjhsi1oQ==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/hash-blob-browser/-/hash-blob-browser-3.1.2.tgz", + "integrity": "sha512-hAbfqN2UbISltakCC2TP0kx4LqXBttEv2MqSPE98gVuDFMf05lU+TpC41QtqGP3Ff5A3GwZMPfKnEy0VmEUpmg==", "dependencies": { - "@smithy/chunked-blob-reader": "^2.0.0", - "@smithy/chunked-blob-reader-native": "^2.0.1", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/chunked-blob-reader": "^3.0.0", + "@smithy/chunked-blob-reader-native": "^3.0.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/hash-node": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-2.0.18.tgz", - "integrity": "sha512-gN2JFvAgnZCyDN9rJgcejfpK0uPPJrSortVVVVWsru9whS7eQey6+gj2eM5ln2i6rHNntIXzal1Fm9XOPuoaKA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/hash-node/-/hash-node-3.0.3.tgz", + "integrity": "sha512-2ctBXpPMG+B3BtWSGNnKELJ7SH9e4TNefJS0cd2eSkOOROeBnnVBnAy9LtJ8tY4vUEoe55N4CNPxzbWvR39iBw==", "dependencies": { - "@smithy/types": "^2.8.0", - "@smithy/util-buffer-from": "^2.0.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/hash-stream-node": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@smithy/hash-stream-node/-/hash-stream-node-2.0.18.tgz", - "integrity": "sha512-OuFk+ITpv8CtxGjQcS8GA04faNycu9UMm6YobvQzjeEoXZ0dLF6sRfuzD+3S8RHPKpTyLuXtKG1+GiJycZ5TcA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/hash-stream-node/-/hash-stream-node-3.1.2.tgz", + "integrity": "sha512-PBgDMeEdDzi6JxKwbfBtwQG9eT9cVwsf0dZzLXoJF4sHKHs5HEo/3lJWpn6jibfJwT34I1EBXpBnZE8AxAft6g==", "dependencies": { - "@smithy/types": "^2.8.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/invalid-dependency": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-2.0.16.tgz", - "integrity": "sha512-apEHakT/kmpNo1VFHP4W/cjfeP9U0x5qvfsLJubgp7UM/gq4qYp0GbqdE7QhsjUaYvEnrftRqs7+YrtWreV0wA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/invalid-dependency/-/invalid-dependency-3.0.3.tgz", + "integrity": "sha512-ID1eL/zpDULmHJbflb864k72/SNOZCADRc9i7Exq3RUNJw6raWUSlFEQ+3PX3EYs++bTxZB2dE9mEHTQLv61tw==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/is-array-buffer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-2.0.0.tgz", - "integrity": "sha512-z3PjFjMyZNI98JFRJi/U0nGoLWMSJlDjAW4QUX2WNZLas5C0CmVV6LJ01JI0k90l7FvpmixjWxPFmENSClQ7ug==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/is-array-buffer/-/is-array-buffer-3.0.0.tgz", + "integrity": "sha512-+Fsu6Q6C4RSJiy81Y8eApjEB5gVtM+oFKTffg+jSuwtvomJJrhUJBu2zS8wjXSgH/g1MKEWrzyChTBe6clb5FQ==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/md5-js": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-2.0.18.tgz", - "integrity": "sha512-bHwZ8/m6RbERQdVW5rJ2LzeW8qxfXv6Q/S7Fiudhso4pWRrksqLx3nsGZw7bmqqfN4zLqkxydxSa9+4c7s5zxg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/md5-js/-/md5-js-3.0.3.tgz", + "integrity": "sha512-O/SAkGVwpWmelpj/8yDtsaVe6sINHLB1q8YE/+ZQbDxIw3SRLbTZuRaI10K12sVoENdnHqzPp5i3/H+BcZ3m3Q==", "dependencies": { - "@smithy/types": "^2.8.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/middleware-content-length": { - "version": "2.0.18", - "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-2.0.18.tgz", - "integrity": "sha512-ZJ9uKPTfxYheTKSKYB+GCvcj+izw9WGzRLhjn8n254q0jWLojUzn7Vw0l4R/Gq7Wdpf/qmk/ptD+6CCXHNVCaw==", + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@smithy/middleware-content-length/-/middleware-content-length-3.0.5.tgz", + "integrity": "sha512-ILEzC2eyxx6ncej3zZSwMpB5RJ0zuqH7eMptxC4KN3f+v9bqT8ohssKbhNR78k/2tWW+KS5Spw+tbPF4Ejyqvw==", "dependencies": { - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/middleware-endpoint": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-2.3.0.tgz", - "integrity": "sha512-VsOAG2YQ8ykjSmKO+CIXdJBIWFo6AAvG6Iw95BakBTqk66/4BI7XyqLevoNSq/lZ6NgZv24sLmrcIN+fLDWBCg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@smithy/middleware-endpoint/-/middleware-endpoint-3.1.0.tgz", + "integrity": "sha512-5y5aiKCEwg9TDPB4yFE7H6tYvGFf1OJHNczeY10/EFF8Ir8jZbNntQJxMWNfeQjC1mxPsaQ6mR9cvQbf+0YeMw==", "dependencies": { - "@smithy/middleware-serde": "^2.0.16", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/shared-ini-file-loader": "^2.2.8", - "@smithy/types": "^2.8.0", - "@smithy/url-parser": "^2.0.16", - "@smithy/util-middleware": "^2.0.9", - "tslib": "^2.5.0" + "@smithy/middleware-serde": "^3.0.3", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/url-parser": "^3.0.3", + "@smithy/util-middleware": "^3.0.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/middleware-retry": { - "version": "2.0.26", - "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-2.0.26.tgz", - "integrity": "sha512-Qzpxo0U5jfNiq9iD38U3e2bheXwvTEX4eue9xruIvEgh+UKq6dKuGqcB66oBDV7TD/mfoJi9Q/VmaiqwWbEp7A==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/middleware-retry/-/middleware-retry-3.0.14.tgz", + "integrity": "sha512-7ZaWZJOjUxa5hgmuMspyt8v/zVsh0GXYuF7OvCmdcbVa/xbnKQoYC+uYKunAqRGTkxjOyuOCw9rmFUFOqqC0eQ==", "dependencies": { - "@smithy/node-config-provider": "^2.1.9", - "@smithy/protocol-http": "^3.0.12", - "@smithy/service-error-classification": "^2.0.9", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "@smithy/util-middleware": "^2.0.9", - "@smithy/util-retry": "^2.0.9", - "tslib": "^2.5.0", - "uuid": "^8.3.2" + "@smithy/node-config-provider": "^3.1.4", + "@smithy/protocol-http": "^4.1.0", + "@smithy/service-error-classification": "^3.0.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-retry": "^3.0.3", + "tslib": "^2.6.2", + "uuid": "^9.0.1" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" + } + }, + "node_modules/@smithy/middleware-retry/node_modules/uuid": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", + "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", + "funding": [ + "https://github.com/sponsors/broofa", + "https://github.com/sponsors/ctavan" + ], + "bin": { + "uuid": "dist/bin/uuid" } }, "node_modules/@smithy/middleware-serde": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-2.0.16.tgz", - "integrity": "sha512-5EAd4t30pcc4M8TSSGq7q/x5IKrxfXR5+SrU4bgxNy7RPHQo2PSWBUco9C+D9Tfqp/JZvprRpK42dnupZafk2g==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-serde/-/middleware-serde-3.0.3.tgz", + "integrity": "sha512-puUbyJQBcg9eSErFXjKNiGILJGtiqmuuNKEYNYfUD57fUl4i9+mfmThtQhvFXU0hCVG0iEJhvQUipUf+/SsFdA==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/middleware-stack": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-2.0.10.tgz", - "integrity": "sha512-I2rbxctNq9FAPPEcuA1ntZxkTKOPQFy7YBPOaD/MLg1zCvzv21CoNxR0py6J8ZVC35l4qE4nhxB0f7TF5/+Ldw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/middleware-stack/-/middleware-stack-3.0.3.tgz", + "integrity": "sha512-r4klY9nFudB0r9UdSMaGSyjyQK5adUyPnQN/ZM6M75phTxOdnc/AhpvGD1fQUvgmqjQEBGCwpnPbDm8pH5PapA==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/node-config-provider": { - "version": "2.1.9", - "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-2.1.9.tgz", - "integrity": "sha512-tUyW/9xrRy+s7RXkmQhgYkAPMpTIF8izK4orhHjNFEKR3QZiOCbWB546Y8iB/Fpbm3O9+q0Af9rpywLKJOwtaQ==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-config-provider/-/node-config-provider-3.1.4.tgz", + "integrity": "sha512-YvnElQy8HR4vDcAjoy7Xkx9YT8xZP4cBXcbJSgm/kxmiQu08DwUwj8rkGnyoJTpfl/3xYHH+d8zE+eHqoDCSdQ==", "dependencies": { - "@smithy/property-provider": "^2.0.17", - "@smithy/shared-ini-file-loader": "^2.2.8", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/property-provider": "^3.1.3", + "@smithy/shared-ini-file-loader": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/node-http-handler": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-2.2.2.tgz", - "integrity": "sha512-XO58TO/Eul/IBQKFKaaBtXJi0ItEQQCT+NI4IiKHCY/4KtqaUT6y/wC1EvDqlA9cP7Dyjdj7FdPs4DyynH3u7g==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/node-http-handler/-/node-http-handler-3.1.4.tgz", + "integrity": "sha512-+UmxgixgOr/yLsUxcEKGH0fMNVteJFGkmRltYFHnBMlogyFdpzn2CwqWmxOrfJELhV34v0WSlaqG1UtE1uXlJg==", "dependencies": { - "@smithy/abort-controller": "^2.0.16", - "@smithy/protocol-http": "^3.0.12", - "@smithy/querystring-builder": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/abort-controller": "^3.1.1", + "@smithy/protocol-http": "^4.1.0", + "@smithy/querystring-builder": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/property-provider": { - "version": "2.0.17", - "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-2.0.17.tgz", - "integrity": "sha512-+VkeZbVu7qtQ2DjI48Qwaf9fPOr3gZIwxQpuLJgRRSkWsdSvmaTCxI3gzRFKePB63Ts9r4yjn4HkxSCSkdWmcQ==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/property-provider/-/property-provider-3.1.3.tgz", + "integrity": "sha512-zahyOVR9Q4PEoguJ/NrFP4O7SMAfYO1HLhB18M+q+Z4KFd4V2obiMnlVoUFzFLSPeVt1POyNWneHHrZaTMoc/g==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/protocol-http": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-3.0.12.tgz", - "integrity": "sha512-Xz4iaqLiaBfbQpB9Hgi3VcZYbP7xRDXYhd8XWChh4v94uw7qwmvlxdU5yxzfm6ACJM66phHrTbS5TVvj5uQ72w==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/protocol-http/-/protocol-http-4.1.0.tgz", + "integrity": "sha512-dPVoHYQ2wcHooGXg3LQisa1hH0e4y0pAddPMeeUPipI1tEOqL6A4N0/G7abeq+K8wrwSgjk4C0wnD1XZpJm5aA==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/querystring-builder": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-2.0.16.tgz", - "integrity": "sha512-Q/GsJT0C0mijXMRs7YhZLLCP5FcuC4797lYjKQkME5CZohnLC4bEhylAd2QcD3gbMKNjCw8+T2I27WKiV/wToA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-builder/-/querystring-builder-3.0.3.tgz", + "integrity": "sha512-vyWckeUeesFKzCDaRwWLUA1Xym9McaA6XpFfAK5qI9DKJ4M33ooQGqvM4J+LalH4u/Dq9nFiC8U6Qn1qi0+9zw==", "dependencies": { - "@smithy/types": "^2.8.0", - "@smithy/util-uri-escape": "^2.0.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "@smithy/util-uri-escape": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/querystring-parser": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-2.0.16.tgz", - "integrity": "sha512-c4ueAuL6BDYKWpkubjrQthZKoC3L5kql5O++ovekNxiexRXTlLIVlCR4q3KziOktLIw66EU9SQljPXd/oN6Okg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/querystring-parser/-/querystring-parser-3.0.3.tgz", + "integrity": "sha512-zahM1lQv2YjmznnfQsWbYojFe55l0SLG/988brlLv1i8z3dubloLF+75ATRsqPBboUXsW6I9CPGE5rQgLfY0vQ==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/service-error-classification": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-2.0.9.tgz", - "integrity": "sha512-0K+8GvtwI7VkGmmInPydM2XZyBfIqLIbfR7mDQ+oPiz8mIinuHbV6sxOLdvX1Jv/myk7XTK9orgt3tuEpBu/zg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/service-error-classification/-/service-error-classification-3.0.3.tgz", + "integrity": "sha512-Jn39sSl8cim/VlkLsUhRFq/dKDnRUFlfRkvhOJaUbLBXUsLRLNf9WaxDv/z9BjuQ3A6k/qE8af1lsqcwm7+DaQ==", "dependencies": { - "@smithy/types": "^2.8.0" + "@smithy/types": "^3.3.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/shared-ini-file-loader": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-2.2.8.tgz", - "integrity": "sha512-E62byatbwSWrtq9RJ7xN40tqrRKDGrEL4EluyNpaIDvfvet06a/QC58oHw2FgVaEgkj0tXZPjZaKrhPfpoU0qw==", + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/@smithy/shared-ini-file-loader/-/shared-ini-file-loader-3.1.4.tgz", + "integrity": "sha512-qMxS4hBGB8FY2GQqshcRUy1K6k8aBWP5vwm8qKkCT3A9K2dawUwOIJfqh9Yste/Bl0J2lzosVyrXDj68kLcHXQ==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/signature-v4": { - "version": "2.0.19", - "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-2.0.19.tgz", - "integrity": "sha512-nwc3JihdM+kcJjtORv/n7qRHN2Kfh7S2RJI2qr8pz9UcY5TD8rSCRGQ0g81HgyS3jZ5X9U/L4p014P3FonBPhg==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@smithy/signature-v4/-/signature-v4-4.1.0.tgz", + "integrity": "sha512-aRryp2XNZeRcOtuJoxjydO6QTaVhxx/vjaR+gx7ZjaFgrgPRyZ3HCTbfwqYj6ZWEBHkCSUfcaymKPURaByukag==", "dependencies": { - "@smithy/eventstream-codec": "^2.0.16", - "@smithy/is-array-buffer": "^2.0.0", - "@smithy/types": "^2.8.0", - "@smithy/util-hex-encoding": "^2.0.0", - "@smithy/util-middleware": "^2.0.9", - "@smithy/util-uri-escape": "^2.0.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@smithy/is-array-buffer": "^3.0.0", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-hex-encoding": "^3.0.0", + "@smithy/util-middleware": "^3.0.3", + "@smithy/util-uri-escape": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/smithy-client": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-2.2.1.tgz", - "integrity": "sha512-SpD7FLK92XV2fon2hMotaNDa2w5VAy5/uVjP9WFmjGSgWM8pTPVkHcDl1yFs5Z8LYbij0FSz+DbCBK6i+uXXUA==", + "version": "3.1.12", + "resolved": "https://registry.npmjs.org/@smithy/smithy-client/-/smithy-client-3.1.12.tgz", + "integrity": "sha512-wtm8JtsycthkHy1YA4zjIh2thJgIQ9vGkoR639DBx5lLlLNU0v4GARpQZkr2WjXue74nZ7MiTSWfVrLkyD8RkA==", "dependencies": { - "@smithy/middleware-endpoint": "^2.3.0", - "@smithy/middleware-stack": "^2.0.10", - "@smithy/protocol-http": "^3.0.12", - "@smithy/types": "^2.8.0", - "@smithy/util-stream": "^2.0.24", - "tslib": "^2.5.0" + "@smithy/middleware-endpoint": "^3.1.0", + "@smithy/middleware-stack": "^3.0.3", + "@smithy/protocol-http": "^4.1.0", + "@smithy/types": "^3.3.0", + "@smithy/util-stream": "^3.1.3", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/types": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/@smithy/types/-/types-2.8.0.tgz", - "integrity": "sha512-h9sz24cFgt/W1Re22OlhQKmUZkNh244ApgRsUDYinqF8R+QgcsBIX344u2j61TPshsTz3CvL6HYU1DnQdsSrHA==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/@smithy/types/-/types-3.3.0.tgz", + "integrity": "sha512-IxvBBCTFDHbVoK7zIxqA1ZOdc4QfM5HM7rGleCuHi7L1wnKv5Pn69xXJQ9hgxH60ZVygH9/JG0jRgtUncE3QUA==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/url-parser": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-2.0.16.tgz", - "integrity": "sha512-Wfz5WqAoRT91TjRy1JeLR0fXtkIXHGsMbgzKFTx7E68SrZ55TB8xoG+vm11Ru4gheFTMXjAjwAxv1jQdC+pAQA==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/url-parser/-/url-parser-3.0.3.tgz", + "integrity": "sha512-pw3VtZtX2rg+s6HMs6/+u9+hu6oY6U7IohGhVNnjbgKy86wcIsSZwgHrFR+t67Uyxvp4Xz3p3kGXXIpTNisq8A==", "dependencies": { - "@smithy/querystring-parser": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/querystring-parser": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" } }, "node_modules/@smithy/util-base64": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-2.0.1.tgz", - "integrity": "sha512-DlI6XFYDMsIVN+GH9JtcRp3j02JEVuWIn/QOZisVzpIAprdsxGveFed0bjbMRCqmIFe8uetn5rxzNrBtIGrPIQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-base64/-/util-base64-3.0.0.tgz", + "integrity": "sha512-Kxvoh5Qtt0CDsfajiZOCpJxgtPHXOKwmM+Zy4waD43UoEMA+qPxxa98aE/7ZhdnBFZFXMOiBR5xbcaMhLtznQQ==", "dependencies": { - "@smithy/util-buffer-from": "^2.0.0", - "tslib": "^2.5.0" + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-body-length-browser": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-2.0.1.tgz", - "integrity": "sha512-NXYp3ttgUlwkaug4bjBzJ5+yIbUbUx8VsSLuHZROQpoik+gRkIBeEG9MPVYfvPNpuXb/puqodeeUXcKFe7BLOQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-browser/-/util-body-length-browser-3.0.0.tgz", + "integrity": "sha512-cbjJs2A1mLYmqmyVl80uoLTJhAcfzMOyPgjwAYusWKMdLeNtzmMz9YxNl3/jRLoxSS3wkqkf0jwNdtXWtyEBaQ==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" } }, "node_modules/@smithy/util-body-length-node": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-2.1.0.tgz", - "integrity": "sha512-/li0/kj/y3fQ3vyzn36NTLGmUwAICb7Jbe/CsWCktW363gh1MOcpEcSO3mJ344Gv2dqz8YJCLQpb6hju/0qOWw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-body-length-node/-/util-body-length-node-3.0.0.tgz", + "integrity": "sha512-Tj7pZ4bUloNUP6PzwhN7K386tmSmEET9QtQg0TgdNOnxhZvCssHji+oZTUIuzxECRfG8rdm2PMw2WCFs6eIYkA==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-buffer-from": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-2.0.0.tgz", - "integrity": "sha512-/YNnLoHsR+4W4Vf2wL5lGv0ksg8Bmk3GEGxn2vEQt52AQaPSCuaO5PM5VM7lP1K9qHRKHwrPGktqVoAHKWHxzw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-buffer-from/-/util-buffer-from-3.0.0.tgz", + "integrity": "sha512-aEOHCgq5RWFbP+UDPvPot26EJHjOC+bRgse5A8V3FSShqd5E5UN4qc7zkwsvJPPAVsf73QwYcHN1/gt/rtLwQA==", "dependencies": { - "@smithy/is-array-buffer": "^2.0.0", - "tslib": "^2.5.0" + "@smithy/is-array-buffer": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-config-provider": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-2.1.0.tgz", - "integrity": "sha512-S6V0JvvhQgFSGLcJeT1CBsaTR03MM8qTuxMH9WPCCddlSo2W0V5jIHimHtIQALMLEDPGQ0ROSRr/dU0O+mxiQg==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-config-provider/-/util-config-provider-3.0.0.tgz", + "integrity": "sha512-pbjk4s0fwq3Di/ANL+rCvJMKM5bzAQdE5S/6RL5NXgMExFAi6UgQMPOm5yPaIWPpr+EOXKXRonJ3FoxKf4mCJQ==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-defaults-mode-browser": { - "version": "2.0.24", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-2.0.24.tgz", - "integrity": "sha512-TsP5mBuLgO2C21+laNG2nHYZEyUdkbGURv2tHvSuQQxLz952MegX95uwdxOY2jR2H4GoKuVRfdJq7w4eIjGYeg==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-browser/-/util-defaults-mode-browser-3.0.14.tgz", + "integrity": "sha512-0iwTgKKmAIf+vFLV8fji21Jb2px11ktKVxbX6LIDPAUJyWQqGqBVfwba7xwa1f2FZUoolYQgLvxQEpJycXuQ5w==", "dependencies": { - "@smithy/property-provider": "^2.0.17", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", "bowser": "^2.11.0", - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { "node": ">= 10.0.0" } }, "node_modules/@smithy/util-defaults-mode-node": { - "version": "2.0.32", - "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-2.0.32.tgz", - "integrity": "sha512-d0S33dXA2cq1NyorVMroMrEtqKMr3MlyLITcfTBf9pXiigYiPMOtbSI7czHIfDbuVuM89Cg0urAgpt73QV9mPQ==", + "version": "3.0.14", + "resolved": "https://registry.npmjs.org/@smithy/util-defaults-mode-node/-/util-defaults-mode-node-3.0.14.tgz", + "integrity": "sha512-e9uQarJKfXApkTMMruIdxHprhcXivH1flYCe8JRDTzkkLx8dA3V5J8GZlST9yfDiRWkJpZJlUXGN9Rc9Ade3OQ==", "dependencies": { - "@smithy/config-resolver": "^2.0.23", - "@smithy/credential-provider-imds": "^2.1.5", - "@smithy/node-config-provider": "^2.1.9", - "@smithy/property-provider": "^2.0.17", - "@smithy/smithy-client": "^2.2.1", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/config-resolver": "^3.0.5", + "@smithy/credential-provider-imds": "^3.2.0", + "@smithy/node-config-provider": "^3.1.4", + "@smithy/property-provider": "^3.1.3", + "@smithy/smithy-client": "^3.1.12", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { "node": ">= 10.0.0" } }, "node_modules/@smithy/util-endpoints": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-1.0.8.tgz", - "integrity": "sha512-l8zVuyZZ61IzZBYp5NWvsAhbaAjYkt0xg9R4xUASkg5SEeTT2meHOJwJHctKMFUXe4QZbn9fR2MaBYjP2119+w==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@smithy/util-endpoints/-/util-endpoints-2.0.5.tgz", + "integrity": "sha512-ReQP0BWihIE68OAblC/WQmDD40Gx+QY1Ez8mTdFMXpmjfxSyz2fVQu3A4zXRfQU9sZXtewk3GmhfOHswvX+eNg==", "dependencies": { - "@smithy/node-config-provider": "^2.1.9", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/node-config-provider": "^3.1.4", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">= 14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-hex-encoding": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-2.0.0.tgz", - "integrity": "sha512-c5xY+NUnFqG6d7HFh1IFfrm3mGl29lC+vF+geHv4ToiuJCBmIfzx6IeHLg+OgRdPFKDXIw6pvi+p3CsscaMcMA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-hex-encoding/-/util-hex-encoding-3.0.0.tgz", + "integrity": "sha512-eFndh1WEK5YMUYvy3lPlVmYY/fZcQE1D8oSf41Id2vCeIkKJXPcYDCZD+4+xViI6b1XSd7tE+s5AmXzz5ilabQ==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-middleware": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-2.0.9.tgz", - "integrity": "sha512-PnCnBJ07noMX1lMDTEefmxSlusWJUiLfrme++MfK5TD0xz8NYmakgoXy5zkF/16zKGmiwOeKAztWT/Vjk1KRIQ==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-middleware/-/util-middleware-3.0.3.tgz", + "integrity": "sha512-l+StyYYK/eO3DlVPbU+4Bi06Jjal+PFLSMmlWM1BEwyLxZ3aKkf1ROnoIakfaA7mC6uw3ny7JBkau4Yc+5zfWw==", "dependencies": { - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-retry": { - "version": "2.0.9", - "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-2.0.9.tgz", - "integrity": "sha512-46BFWe9RqB6g7f4mxm3W3HlqknqQQmWHKlhoqSFZuGNuiDU5KqmpebMbvC3tjTlUkqn4xa2Z7s3Hwb0HNs5scw==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@smithy/util-retry/-/util-retry-3.0.3.tgz", + "integrity": "sha512-AFw+hjpbtVApzpNDhbjNG5NA3kyoMs7vx0gsgmlJF4s+yz1Zlepde7J58zpIRIsdjc+emhpAITxA88qLkPF26w==", "dependencies": { - "@smithy/service-error-classification": "^2.0.9", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/service-error-classification": "^3.0.3", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">= 14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-stream": { - "version": "2.0.24", - "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-2.0.24.tgz", - "integrity": "sha512-hRpbcRrOxDriMVmbya+Mv77VZVupxRAsfxVDKS54XuiURhdiwCUXJP0X1iJhHinuUf6n8pBF0MkG9C8VooMnWw==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/@smithy/util-stream/-/util-stream-3.1.3.tgz", + "integrity": "sha512-FIv/bRhIlAxC0U7xM1BCnF2aDRPq0UaelqBHkM2lsCp26mcBbgI0tCVTv+jGdsQLUmAMybua/bjDsSu8RQHbmw==", "dependencies": { - "@smithy/fetch-http-handler": "^2.3.2", - "@smithy/node-http-handler": "^2.2.2", - "@smithy/types": "^2.8.0", - "@smithy/util-base64": "^2.0.1", - "@smithy/util-buffer-from": "^2.0.0", - "@smithy/util-hex-encoding": "^2.0.0", - "@smithy/util-utf8": "^2.0.2", - "tslib": "^2.5.0" + "@smithy/fetch-http-handler": "^3.2.4", + "@smithy/node-http-handler": "^3.1.4", + "@smithy/types": "^3.3.0", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-buffer-from": "^3.0.0", + "@smithy/util-hex-encoding": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-uri-escape": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-2.0.0.tgz", - "integrity": "sha512-ebkxsqinSdEooQduuk9CbKcI+wheijxEb3utGXkCoYQkJnwTnLbH1JXGimJtUkQwNQbsbuYwG2+aFVyZf5TLaw==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-uri-escape/-/util-uri-escape-3.0.0.tgz", + "integrity": "sha512-LqR7qYLgZTD7nWLBecUi4aqolw8Mhza9ArpNEQ881MJJIU2sE5iHCK6TdyqqzcDLy0OPe10IY4T8ctVdtynubg==", "dependencies": { - "tslib": "^2.5.0" + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-utf8": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-2.0.2.tgz", - "integrity": "sha512-qOiVORSPm6Ce4/Yu6hbSgNHABLP2VMv8QOC3tTDNHHlWY19pPyc++fBTbZPtx6egPXi4HQxKDnMxVxpbtX2GoA==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@smithy/util-utf8/-/util-utf8-3.0.0.tgz", + "integrity": "sha512-rUeT12bxFnplYDe815GXbq/oixEGHfRFFtcTF3YdDi/JaENIM6aSYYLJydG83UNzLXeRI5K8abYd/8Sp/QM0kA==", "dependencies": { - "@smithy/util-buffer-from": "^2.0.0", - "tslib": "^2.5.0" + "@smithy/util-buffer-from": "^3.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@smithy/util-waiter": { - "version": "2.0.16", - "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-2.0.16.tgz", - "integrity": "sha512-5i4YONHQ6HoUWDd+X0frpxTXxSXgJhUFl+z0iMy/zpUmVeCQY2or3Vss6DzHKKMMQL4pmVHpQm9WayHDorFdZg==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@smithy/util-waiter/-/util-waiter-3.1.2.tgz", + "integrity": "sha512-4pP0EV3iTsexDx+8PPGAKCQpd/6hsQBaQhqWzU4hqKPHN5epPsxKbvUTIiYIHTxaKt6/kEaqPBpu/ufvfbrRzw==", "dependencies": { - "@smithy/abort-controller": "^2.0.16", - "@smithy/types": "^2.8.0", - "tslib": "^2.5.0" + "@smithy/abort-controller": "^3.1.1", + "@smithy/types": "^3.3.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14.0.0" + "node": ">=16.0.0" } }, "node_modules/@solana/buffer-layout": { @@ -2124,11 +2286,11 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.6.5", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", - "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", + "version": "1.7.4", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.7.4.tgz", + "integrity": "sha512-DukmaFRnY6AzAALSH4J2M3k6PkaC+MfaAGdEERRWcC9q3/TWQwLpHR8ZRLKTdQ3aBDL64EdluRDjJqKw+BPZEw==", "dependencies": { - "follow-redirects": "^1.15.4", + "follow-redirects": "^1.15.6", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -2372,9 +2534,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "dependencies": { "path-key": "^3.1.0", @@ -2754,17 +2916,17 @@ "integrity": "sha512-wpYMUmFu5f00Sm0cj2pfivpmawLZ0NKdviQ4w9zJeR8JVtOpOxHmLaJuj0vxvGqMJQWyP/COUkF75/57OKyRag==" }, "node_modules/fast-xml-parser": { - "version": "4.2.5", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.2.5.tgz", - "integrity": "sha512-B9/wizE4WngqQftFPmdaMYlXoJlJOYxGQOanC77fq9k8+Z0v5dDSVh+3glErdIROP//s/jgb7ZuxKfB8nVyo0g==", + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.4.1.tgz", + "integrity": "sha512-xkjOecfnKGkSsOwtZ5Pz7Us/T6mrbPQrq0nh+aCO5V9nk5NLWmasAHumTKjiPJPWANe+kAZ84Jc8ooJkzZ88Sw==", "funding": [ - { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" - }, { "type": "github", "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" } ], "dependencies": { diff --git a/package.json b/package.json index ab06da450e69..0ad5df52622b 100644 --- a/package.json +++ b/package.json @@ -15,11 +15,13 @@ "entities": "cd utils;npm i; cd ..; node utils/testInteractive entities", "useTokenLabels": "node utils/scripts/useTokenLabels.js", "biggest-files": "find ./projects -name '*.js' -not -path './projects/helper/*' -not -path './projects/curve/*' -not -path './projects/sigmao/*' -exec du -sh {} \\; | sort -rh | head -n 100", + "check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js", "postinstall": "echo 'run \"npm update @defillama/sdk\" if you want lastest sdk changes' " }, "author": "", "license": "ISC", "dependencies": { + "@coral-xyz/anchor": "^0.30.1", "@defillama/sdk": "latest", "@project-serum/anchor": "^0.26.0", "@solana/web3.js": "^1.87.6", diff --git a/projects/0xDAO/erc20.json b/projects/0xDAO/erc20.json deleted file mode 100644 index fcb2bc003306..000000000000 --- a/projects/0xDAO/erc20.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "allowance": "function allowance(address owner, address spender) view returns (uint256)", - "balanceOf": "function balanceOf(address account) view returns (uint256)", - "decimals": "uint8:decimals", - "governance": "address:governance", - "minters": "function minters(address) view returns (bool)", - "name": "string:name", - "symbol": "string:symbol", - "totalSupply": "uint256:totalSupply" -} diff --git a/projects/0xDAO/index.js b/projects/0xDAO/index.js index 4da9614f5749..a68d6856b15d 100644 --- a/projects/0xDAO/index.js +++ b/projects/0xDAO/index.js @@ -1,209 +1,68 @@ -const oxLensAbi = require("./oxLens.json"); -const solidlyLensAbi = require("./solidlyLens.json"); -const veAbi = require("./ve.json"); +const oxLensAbi = { + "oxPoolsAddresses": "address[]:oxPoolsAddresses", + "oxPoolsData": "function oxPoolsData(address[] _oxPoolsAddresses) view returns (tuple(address id, address stakingAddress, uint256 stakedTotalSupply, uint256 totalSupply, tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply) poolData)[])" +} + +const veAbi = { + "locked": "function locked(uint256) view returns (int128 amount, uint256 end)" +} + const partnerRewardsPoolAddress = "0xDA006E87DB89e1C5213D4bfBa771e53c91D920aC"; const oxdV1RewardsPoolAddress = "0xDA000779663501df3C9Bc308E7cEc70cE6F04211"; const oxSolidRewardPoolAddress = "0xDA0067ec0925eBD6D583553139587522310Bec60"; -const vlOxdAddress = "0xDA00527EDAabCe6F97D89aDb10395f719E5559b9"; -const oxdAddress = "0xc5A9848b9d145965d821AaeC8fA32aaEE026492d"; const solidAddress = "0x888EF71766ca594DED1F0FA3AE64eD2941740A20"; const veAddress = "0xcBd8fEa77c2452255f59743f55A3Ea9d83b3c72b"; const oxSolidAddress = "0xDA0053F0bEfCbcaC208A3f867BB243716734D809"; -const sanitize = require("./sanitizeWeb3Response.js"); - -const { standardPoolInfoAbi, addFundsInMasterChef } = require('../helper/masterchef') -const sdk = require('@defillama/sdk') -const shareValue = "uint256:getShareValue" -const xSCREAM = "0xe3D17C7e840ec140a7A51ACA351a482231760824" -const xCREDIT = "0xd9e28749e80D867d5d14217416BFf0e668C10645" -const shareTarot = "function shareValuedAsUnderlying(uint256 _share) returns (uint256 underlyingAmount_)" -const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4" - -const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1" - -async function tvl(_, __, chainBlocks) { - // 0xDAO Master Chef - const balances = {} - const chain = 'fantom' - const block = chainBlocks[chain] - const calldata = { - chain, block +const { standardPoolInfoAbi } = require('../helper/masterchef') +const { sumTokens2 } = require("../helper/unwrapLPs.js"); + +async function tvl(api) { + const masterchef = "0xa7821c3e9fc1bf961e280510c471031120716c3d" + const oxd = "0xc165d941481e68696f43ee6e99bfb2b23e0e3114" + const tokens = (await api.fetchList({ lengthAbi: 'poolLength', itemAbi: standardPoolInfoAbi, target: masterchef })).map(i => i.lpToken) + await api.sumTokens({ owner: masterchef, tokens, blacklistedTokens: [oxd] }) + + // 0xDAO Core + const oxLensAddress = "0xDA00137c79B30bfE06d04733349d98Cf06320e69"; + + // Fetch pools addresses + const oxPoolsAddresses = await api.call({ target: oxLensAddress, abi: oxLensAbi.oxPoolsAddresses }) + const pageSize = 200; + let currentPage = 0; + + let addresses = [] + while (addresses) { + const start = currentPage * pageSize; + const end = start + pageSize; + addresses = oxPoolsAddresses.slice(start, end); + if (addresses.length === 0) { + break; } - const transform = addr => `fantom:${addr}` - await addFundsInMasterChef(balances, "0xa7821c3e9fc1bf961e280510c471031120716c3d", block, chain, - transform, standardPoolInfoAbi, [], true, true, "0xc165d941481e68696f43ee6e99bfb2b23e0e3114") - - const screamShare = await sdk.api.abi.call({ - ...calldata, - target: xSCREAM, - abi: shareValue - }) - sdk.util.sumSingleBalance(balances, transform("0xe0654C8e6fd4D733349ac7E09f6f23DA256bF475"), - screamShare.output *balances[transform(xSCREAM)] /1e18) - delete balances[transform(xSCREAM)] - - const creditShare = await sdk.api.abi.call({ - ...calldata, - target: xCREDIT, - abi: shareValue - }) - sdk.util.sumSingleBalance(balances, transform("0x77128dfdd0ac859b33f44050c6fa272f34872b5e"), - creditShare.output * balances[transform(xCREDIT)] / 1e18) - delete balances[transform(xCREDIT)] - - const tarotShare = await sdk.api.abi.call({ - ...calldata, - target: xTAROT, - abi: shareTarot, - params: sdk.util.convertToBigInt(balances[transform(xTAROT)]) - }) - sdk.util.sumSingleBalance(balances, transform("0xc5e2b037d30a390e62180970b3aa4e91868764cd"), - tarotShare.output) - delete balances[transform(xTAROT)] + currentPage += 1; - sdk.util.sumSingleBalance(balances, transform("0xf24bcf4d1e507740041c9cfd2dddb29585adce1e"), - balances[transform(fBEET)]) - delete balances[transform(fBEET)] + const poolsData = await api.call({ params: [addresses], target: oxLensAddress, abi: oxLensAbi.oxPoolsData }) + poolsData.forEach(pool => api.add(pool.poolData.id, pool.totalSupply)) + } - // 0xDAO Core - const oxLensAddress = "0xDA00137c79B30bfE06d04733349d98Cf06320e69"; - const solidlyLensAddress = "0xDA0024F99A9889E8F48930614c27Ba41DD447c45"; - // const oxd = new web3.eth.Contract(erc20Abi, oxdAddress); + // Add locked SOLID + const { amount: lockedSolidAmount } = await api.call({ target: veAddress, params: 2, abi: veAbi.locked }) + api.add(solidAddress, lockedSolidAmount); - // Fetch pools addresses - const { output: oxPoolsAddresses } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: oxLensAddress, - abi: oxLensAbi.oxPoolsAddresses - }) - const pageSize = 200; - const poolsMap = {}; - let currentPage = 0; + // Add staking pools TVL + const oxdV1RewardsPoolBalance = await api.call({ target: oxdV1RewardsPoolAddress, abi: 'erc20:totalSupply' }) + const oxSolidRewardsPoolBalance = await api.call({ target: oxSolidRewardPoolAddress, abi: 'erc20:totalSupply' }) + const partnerRewardsPoolBalance = await api.call({ target: partnerRewardsPoolAddress, abi: 'erc20:totalSupply' }) - // Add pools - const addPools = (pools, reservesData) => { - pools.forEach((pool) => { - const solidlyPoolAddress = pool.poolData.id; - const reserveData = reservesData.find( - (data) => data.id === solidlyPoolAddress - ); - const newPool = pool; - newPool.poolData = { - ...pool.poolData, - ...reserveData, - }; - const shareOfTotalSupply = newPool.totalSupply / newPool.poolData.totalSupply - newPool.shareOfTotalSupply = shareOfTotalSupply; - let token0Reserve = newPool.poolData.token0Reserve * shareOfTotalSupply - let token1Reserve = newPool.poolData.token1Reserve * shareOfTotalSupply - if (isNaN(token0Reserve)) { - token0Reserve = "0" - } - if (isNaN(token1Reserve)) { - token1Reserve = "0" - } - newPool.token0Reserve = token0Reserve; - newPool.token1Reserve = token1Reserve; - poolsMap[pool.id] = newPool; - }); - }; - let addresses = [] - while (addresses) { - const start = currentPage * pageSize; - const end = start + pageSize; - addresses = oxPoolsAddresses.slice(start, end); - if (addresses.length === 0) { - break; - } - currentPage += 1; + api.add(oxSolidAddress, oxdV1RewardsPoolBalance); + api.add(oxSolidAddress, partnerRewardsPoolBalance); + api.add(oxSolidAddress, oxSolidRewardsPoolBalance); - const { output: poolsData } = await sdk.api.abi.call({ - block, - chain: 'fantom', - params: [addresses], - target: oxLensAddress, - abi: oxLensAbi.oxPoolsData - }) - const solidlyPoolsAddresses = poolsData.map((pool) => pool.poolData.id); - const { output: reservesData } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: solidlyLensAddress, - params: [solidlyPoolsAddresses], - abi: solidlyLensAbi.poolsReservesInfo - }) - addPools( - sanitize(poolsData), - sanitize(reservesData) - ); - } - const pools = Object.values(poolsMap); - - // Add TVL from pools to balances - const addBalance = (tokenAddress, amount) => { - const fantomTokenAddress = `fantom:${tokenAddress}` - sdk.util.sumSingleBalance(balances, fantomTokenAddress, amount) - } - pools.forEach(pool => { - const token0 = pool.poolData.token0Address; - const token1 = pool.poolData.token1Address; - const amount0 = pool.token0Reserve; - const amount1 = pool.token1Reserve; - addBalance(token0, amount0); - addBalance(token1, amount1); - }); - - // Add locked SOLID - const { output: { amount: lockedSolidAmount } } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: veAddress, - params: 2, - abi: veAbi.locked - }) - addBalance(solidAddress, lockedSolidAmount); - - // Add staking pools TVL - const { output: oxdV1RewardsPoolBalance } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: oxdV1RewardsPoolAddress, - abi: 'erc20:totalSupply' - }) - const { output: oxSolidRewardsPoolBalance } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: oxSolidRewardPoolAddress, - abi: 'erc20:totalSupply' - }) - const { output: partnerRewardsPoolBalance } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: partnerRewardsPoolAddress, - abi: 'erc20:totalSupply' - }) - - addBalance(oxSolidAddress, oxdV1RewardsPoolBalance); - addBalance(oxSolidAddress, partnerRewardsPoolBalance); - addBalance(oxSolidAddress, oxSolidRewardsPoolBalance); - - // Add vote locked OXD - const { output: voteLockedOxdBalance } = await sdk.api.abi.call({ - block, - chain: 'fantom', - target: oxdAddress, - params: vlOxdAddress, - abi: 'erc20:balanceOf' - }) - addBalance(oxdAddress, voteLockedOxdBalance); - - return balances + return sumTokens2({ api, resolveLP: true, }) } module.exports = { - fantom: { - tvl - } + fantom: { + tvl + } } diff --git a/projects/0xDAO/oxLens.json b/projects/0xDAO/oxLens.json deleted file mode 100644 index ddad50306786..000000000000 --- a/projects/0xDAO/oxLens.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "oxPoolsAddresses": "address[]:oxPoolsAddresses", - "oxPoolsData": "function oxPoolsData(address[] _oxPoolsAddresses) view returns (tuple(address id, address stakingAddress, uint256 stakedTotalSupply, uint256 totalSupply, tuple(address id, string symbol, bool stable, address token0Address, address token1Address, address gaugeAddress, address bribeAddress, address[] bribeTokensAddresses, address fees, uint256 totalSupply) poolData)[])" -} diff --git a/projects/0xDAO/sanitizeWeb3Response.js b/projects/0xDAO/sanitizeWeb3Response.js deleted file mode 100644 index 0fbe41de8a18..000000000000 --- a/projects/0xDAO/sanitizeWeb3Response.js +++ /dev/null @@ -1,45 +0,0 @@ -/** - * @notice Converts web3 tuple into javascript object recursively - * @author 0xDAO - */ -const sanitize = (data) => { - let dataKeys = {}; - let object = {}; - let array = []; - - // Find all keys (Object.keys will not work here, first we must iterate) - Object.entries(data).forEach(([key]) => { - dataKeys[key] = true; - }); - dataKeys = Object.keys(dataKeys); - const keysLength = dataKeys.length; - - // Detect whether the item is an object or an array - const isObject = keysLength > data.length; - if (isObject) { - dataKeys = dataKeys.slice(dataKeys.length / 2, dataKeys.length); - dataKeys.forEach((key) => { - let dataValue = data[key]; - if (Array.isArray(dataValue)) { - // Recursively sanitize - dataValue = sanitize(dataValue); - } - object[key] = dataValue; - }); - return object; - } else { - // Detect whether the item is an array of objects or an array of values - if (Array.isArray(data)) { - dataKeys.forEach((key) => { - // Recursively sanitize - array.push(sanitize(data[key])); - }); - } else { - return data; - } - return array; - } - }; - - module.exports = sanitize; - \ No newline at end of file diff --git a/projects/0xDAO/solidlyLens.json b/projects/0xDAO/solidlyLens.json deleted file mode 100644 index 5bb2f7d9011b..000000000000 --- a/projects/0xDAO/solidlyLens.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "poolsReservesInfo": "function poolsReservesInfo(address[] _poolsAddresses) view returns (tuple(address id, address token0Address, address token1Address, uint256 token0Reserve, uint256 token1Reserve, uint8 token0Decimals, uint8 token1Decimals)[])" -} diff --git a/projects/0xDAO/ve.json b/projects/0xDAO/ve.json deleted file mode 100644 index 3600933cc821..000000000000 --- a/projects/0xDAO/ve.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "locked": "function locked(uint256) view returns (int128 amount, uint256 end)" -} diff --git a/projects/21-co/index.js b/projects/21-co/index.js index 1d5299a08af7..4254a70a3f12 100644 --- a/projects/21-co/index.js +++ b/projects/21-co/index.js @@ -1,11 +1,10 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + const config = { bitcoin: { - owners: [ - '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW', - '12WZhMFFLHQ4rCMSkeBfbJXRk7aGWyBh1M', - ], + owners: bitcoinAddressBook.twentyOneCo }, solana: { owners: [ diff --git a/projects/2doge/index.js b/projects/2doge/index.js index d1729bbfde85..c3645ff7a905 100644 --- a/projects/2doge/index.js +++ b/projects/2doge/index.js @@ -19,5 +19,6 @@ module.exports = { }, hallmarks: [ [1646179200, "Rug Pull"] - ] + ], + deadFrom: 1646179200 }; diff --git a/projects/2pi/index.js b/projects/2pi/index.js index 5bc419332f54..81f8967c2833 100644 --- a/projects/2pi/index.js +++ b/projects/2pi/index.js @@ -15,23 +15,24 @@ const fetchChainAddresses = async chain => { return getUniqueAddresses(archimedes) } -const fetchTvl = chain => { - return async (api) => { - const addresses = await fetchChainAddresses(chains[chain]) - let pools = await Promise.all(addresses.map(i => api.fetchList({ withMetadata: true, target: i, lengthAbi: archimedesAbi['poolLength'], itemAbi: archimedesAbi['poolInfo'] }))) - pools = pools.flat() - const wantTokens = pools.map(i => i.output.want) - const calls = pools.map(i => i.input) - const bal = await api.multiCall({ abi: archimedesAbi.balance, calls, }) - api.add(wantTokens, bal) +const tvl = async (api) => { + const addresses = await fetchChainAddresses(chains[api.chain]) + const res = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: archimedesAbi['poolInfo'], calls: addresses, groupedByInput: true }) + const calls = [] + const tokens = [] + for (let i = 0; i < res.length; i++) { + const pool = addresses[i] + for (let j = 0; j < res[i].length; j++) { + calls.push({ target: pool, params: j }) + tokens.push(res[i][j].want) + } } + console.log(res, api.chain) + const bals = await api.multiCall({ abi: archimedesAbi.balance, calls}) + api.add(tokens, bals) } -module.exports = { - timetravel: false, - ...Object.fromEntries( - Object.keys(chains).map(chain => [ - chain, { tvl: fetchTvl(chain) } - ]) - ) -} + +Object.keys(chains).forEach(chain => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/Astra/index.js b/projects/Astra/index.js new file mode 100644 index 000000000000..27d31e093f56 --- /dev/null +++ b/projects/Astra/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const FACTORY = "0x2b6852CeDEF193ece9814Ee99BE4A4Df7F463557" // This factory is on AirDAO Mainnet (Chain Id: 16718) + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address to find and price Liquidity Pool pairs.`, + airdao: { + tvl: dexTVL + } +}; diff --git a/projects/AvoLend/index.js b/projects/AvoLend/index.js index c7e8011c9641..e4d354ef8eec 100644 --- a/projects/AvoLend/index.js +++ b/projects/AvoLend/index.js @@ -6,3 +6,5 @@ module.exports = { cether: '0x29e15766d6b203C35c2D51AAEc4Cf964129Af088', }), }; +module.exports.deadFrom='2024-04-03', +module.exports.blast.borrowed = () => ({}) // bad debt diff --git a/projects/BagelFinance/index.js b/projects/BagelFinance/index.js new file mode 100644 index 000000000000..95a32763b67a --- /dev/null +++ b/projects/BagelFinance/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const BagelLpPool = "UQAqcydSR5paeZTvCSN5XwAuaHB1T5aE33rofhvpz0B59gKr" + +module.exports = { + methodology: 'Counts LP smartcontract balance as TVL.', + ton: { + tvl: sumTokensExport({ owners: [BagelLpPool], tokens: [ADDRESSES.null]}), + } +} diff --git a/projects/BeetrootFinance/index.js b/projects/BeetrootFinance/index.js new file mode 100644 index 000000000000..338248e54dda --- /dev/null +++ b/projects/BeetrootFinance/index.js @@ -0,0 +1,73 @@ + +const { get } = require('../helper/http') +const ADDRESSES = require("../helper/coreAssets.json"); +const { getJettonBalances } = require('../helper/chain/ton') + +async function fetchVaultData(address) { + const url = 'https://api5.storm.tg/graphql'; + + const query = ` + query VaultQuery($address: String!) { + getVault(address: $address) { + rate + } + } + `; + + try { + const response = await fetch(url, { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + }, + body: JSON.stringify({ + operationName: 'VaultQuery', + variables: { address }, + query + }) + }); + + if (!response.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + + const data = await response.json(); + return data.data.getVault; + } catch (error) { + console.error('Error fetching vault data:', error); + throw error; + } +} + +async function calculateTvl() { + const USDT_TLP_PRICE = (await get('https://tradoor.io/v3/lp/history/price?period=week')).data[0].price; + + const vaultData = await fetchVaultData('0:33e9e84d7cbefff0d23b395875420e3a1ecb82e241692be89c7ea2bd27716b77'); + const USDT_SLP_PRICE = vaultData?.rate / 1e9 || 0; + + const balances = await getJettonBalances('0:c2f0c639b58e6b3cce8a145c73e7c7cc5044baa92b05c62fcf6da8a0d50b8edc'); + + const USDT_SLP_ADDRESS = '0:aea78c710ae94270dc263a870cf47b4360f53cc5ed38e3db502e9e9afb904b11'; + const USDT_TLP_ADDRESS = '0:332c916f885a26051cb3a121f00c2bda459339eb103df36fe484df0b87b39384'; + + const USDT_SLP_BALANCE = balances[USDT_SLP_ADDRESS].balance / 1e9; + const USDT_TLP_BALANCE = balances[USDT_TLP_ADDRESS].balance / 1e9; + + const tvl = ((USDT_TLP_PRICE * USDT_TLP_BALANCE) + (USDT_SLP_PRICE * USDT_SLP_BALANCE)) * 1e6; + return tvl; +} + + +async function tvl(api) { + const calculatedTvl = await calculateTvl(); + api.add(ADDRESSES.ton.USDT, calculatedTvl); +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + methodology: `TVL calculation methodology consists of the delta between onchain USDT deposits and withdrawals`.trim(), + ton: { + tvl + } +} diff --git a/projects/BroSwap/index.js b/projects/BroSwap/index.js index d2d87c88ecd0..347f9bc19025 100644 --- a/projects/BroSwap/index.js +++ b/projects/BroSwap/index.js @@ -3,6 +3,6 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, core: { - tvl: getUniTVL({ factory: '0x8edF7B8411b2e5dB740dbbf949E011e59fc7980a', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x8edF7B8411b2e5dB740dbbf949E011e59fc7980a', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/Caketomb/index.js b/projects/Caketomb/index.js index 6b6806de2b18..acb6f205c5a9 100644 --- a/projects/Caketomb/index.js +++ b/projects/Caketomb/index.js @@ -1,4 +1,4 @@ -const {pool2Exports} = require("../helper/pool2"); +const {pool2} = require("../helper/pool2"); const { staking } = require("../helper/staking"); const shares = "0x9f8349C33B942b6CBb15426E02b5Bbb77fAeB64f"; @@ -15,6 +15,6 @@ module.exports = { bsc: { tvl: async () => ({}), staking: staking(boardroom, shares), - pool2: pool2Exports(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) + pool2: pool2(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) } } diff --git a/projects/Chocoinu/index.ts b/projects/Chocoinu/index.js similarity index 70% rename from projects/Chocoinu/index.ts rename to projects/Chocoinu/index.js index 67d71cfa0921..ee0967d634f6 100644 --- a/projects/Chocoinu/index.ts +++ b/projects/Chocoinu/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - avax: { tvl: getUniTVL({ factory: '0x49a5044268A54467a94905d1458A88413695afc1', useDefaultCoreAssets: true, fetchBalances: true, }), }, + avax: { tvl: getUniTVL({ factory: '0x49a5044268A54467a94905d1458A88413695afc1', useDefaultCoreAssets: true,}), }, } diff --git a/projects/CirclePacific/index.js b/projects/CirclePacific/index.js index be017a121493..b27a255faca5 100644 --- a/projects/CirclePacific/index.js +++ b/projects/CirclePacific/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - manta: { tvl: getUniTVL({ factory: '0xD8c3DBE9C3953Fda5e4573533e662C58A37E1455', useDefaultCoreAssets: true, fetchBalances: true, }), }, + manta: { tvl: getUniTVL({ factory: '0xD8c3DBE9C3953Fda5e4573533e662C58A37E1455', useDefaultCoreAssets: true, }), }, } diff --git a/projects/CreampanFinance/index.js b/projects/CreampanFinance/index.js index 96fbc4c79a59..b0bc1d48760a 100644 --- a/projects/CreampanFinance/index.js +++ b/projects/CreampanFinance/index.js @@ -13,7 +13,7 @@ async function tvl(api) { const data = await Promise.all(accounts.map(account => queryV1Beta1({ chain: 'cronos', url: `/staking/v1beta1/delegations/${account}`, }))); const factroy_contract_address = '0x66f5997b7810723aceeeb8a880846fc117081bd0'; data.map(i => i.delegation_responses).flat().forEach(i => api.add(ADDRESSES.cronos.WCRO, i.balance.amount * 1e10)) - return api.sumTokens({ owner: factroy_contract_address, tokens: ['0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23']}) + return api.sumTokens({ owner: factroy_contract_address, tokens: [ADDRESSES.cronos.WCRO_1]}) } module.exports = { diff --git a/projects/CthulhuFinance/index.js b/projects/CthulhuFinance/index.js index 84776a175e12..506c8e7acba9 100644 --- a/projects/CthulhuFinance/index.js +++ b/projects/CthulhuFinance/index.js @@ -15,6 +15,7 @@ module.exports = { hallmarks: [ [1679788800, "Rug Pull"] ], + deadFrom: 1679788800, optimism: { tvl: vaultTvl([ "0xF6a6C4573099E6F6b9D8E1186a2C089B4d0fDf91", diff --git a/projects/DegenDex/index.js b/projects/DegenDex/index.js index 7cb423ed3c6a..03afaec1d9ef 100644 --- a/projects/DegenDex/index.js +++ b/projects/DegenDex/index.js @@ -10,6 +10,6 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, fetchBalances: true, }) + tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true,}) } }) diff --git a/projects/Delea/index.js b/projects/Delea/index.js new file mode 100644 index 000000000000..7e6d95799813 --- /dev/null +++ b/projects/Delea/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +module.exports = { + methodology: 'Counts Delea smartcontract balance as TVL.', + ton: { + tvl: sumTokensExport({ owners: ["EQB6rkS8xt3Ey4XugdVqQDe1vt4KJDh813_k2ceoONTCBnyD", "EQCwIIRKpuV9fQpQxdTMhLAO30MNHa6GOYd00TsySOOYtA9n", "EQA2OzCuP8-d_lN2MYxLv5WCNfpLH1NUuugppOZBZgNYn-aa", "EQCgGUMB_u1Gkrskw2o407Ig8ymQmfkxWuPW2d4INuQoPFJO"], tokens: [ADDRESSES.null]}), + } +} diff --git a/projects/Dexland/index.js b/projects/Dexland/index.js index 0446297126f1..ac7e28d9f11b 100644 --- a/projects/Dexland/index.js +++ b/projects/Dexland/index.js @@ -3,6 +3,6 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, core: { - tvl: getUniTVL({ factory: '0x3D6Cb82318f8c5DAAA9498a379D047a369c1E4aA', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x3D6Cb82318f8c5DAAA9498a379D047a369c1E4aA', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/DigiFT/index.js b/projects/DigiFT/index.js index 752e4c5ffb3e..01f434bcc3f3 100644 --- a/projects/DigiFT/index.js +++ b/projects/DigiFT/index.js @@ -2,14 +2,14 @@ const sdk = require('@defillama/sdk'); //Polygon FeedPrice contract address const DFeedPriceAddress = "0x7d4d68f18d1be3410ab8d827fb7ebc690f938d2d" const tokenListAbi = "function getAllTokenRecords() view returns (tuple(uint256 chainId, address tokenAddress, uint64 tokenType)[])" - + async function getTokenList(tokenAPI, chainId) { return (await tokenAPI.call({ target: DFeedPriceAddress, abi: tokenListAbi })).filter(item => item[0] == chainId && item[2] == '1').map(item => item[1]); } - + module.exports = { ethereum: { tvl: async (api) => { @@ -19,5 +19,14 @@ module.exports = { api.addTokens(tokens, tokenSupplies) return api.getBalances() } + }, + arbitrum: { + tvl: async (api) => { + const tokenAPI = new sdk.ChainApi({ chain: 'polygon', timestamp: api.timestamp, }); + const tokens = await getTokenList(tokenAPI, api.chainId) + const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: tokens}) + api.addTokens(tokens, tokenSupplies) + return api.getBalances() + } } }; diff --git a/projects/FirepotSwap/index.js b/projects/FirepotSwap/index.js index 1a845539f4c6..185f18a3c33a 100644 --- a/projects/FirepotSwap/index.js +++ b/projects/FirepotSwap/index.js @@ -2,7 +2,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const FACTORY = "0xe63Cf585Dae8273A5e37AfF6da2f823FBf3Eb5BE" // This factory is on AirDAO Mainnet (Chain Id: 16718) -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, diff --git a/projects/FlashLiquidity/index.js b/projects/FlashLiquidity/index.js index 54711fd7279e..c2094aa26796 100644 --- a/projects/FlashLiquidity/index.js +++ b/projects/FlashLiquidity/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require("../helper/unknownTokens"); const factory = "0x6e553d5f028bD747a27E138FA3109570081A23aE" -const tvl = getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true, }) +const tvl = getUniTVL({ factory, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, diff --git a/projects/FlitSwap/index.js b/projects/FlitSwap/index.js index f72478cc59a6..dc0b84a2701e 100644 --- a/projects/FlitSwap/index.js +++ b/projects/FlitSwap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, op_bnb: { tvl: getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0x243f0218EF4cB8FC922ddd6d44e2DdE5b95DCa89', }) diff --git a/projects/Fountain-Protocol/index.js b/projects/Fountain-Protocol/index.js index 391f1c2ba923..7c44d2f60c05 100644 --- a/projects/Fountain-Protocol/index.js +++ b/projects/Fountain-Protocol/index.js @@ -1,23 +1,14 @@ -const {usdCompoundExports} = require('../helper/compound'); -const sdk = require("@defillama/sdk"); +const {compoundExports2} = require('../helper/compound'); +const { mergeExports } = require('../helper/utils'); const unitroller_classic_oasis = '0xA7684aE7e07Dac91113900342b3ef25B9Fd1D841'; -const ftoken_classic_oasis = '0xD7d588bAbFb99E82Cd6dd0cA7677A5599AA678B5'; - const unitroller_usd_oasis = '0x1C0C30795802Bf2B3232a824f41629BbBCF63127'; -const ftoken_usd_oasis ='0x2552707D66C102c12b0f8284824F80e1299cB6B7'; - const unitroller_lpt_oasis = '0x7c4d0c834701C6E7F57b8c1424d30aDC46eA0840'; -const ftoken_lpt_oasis ='0x63f1Fe2E1da490611FC16E4a5d92b7ec7d0911a9'; - -const classic_lending = usdCompoundExports(unitroller_classic_oasis, "oasis", ftoken_classic_oasis) -const stable_lending = usdCompoundExports(unitroller_usd_oasis, "oasis", ftoken_usd_oasis) -const lpt_lending = usdCompoundExports(unitroller_lpt_oasis, "oasis", ftoken_lpt_oasis) -module.exports={ - oasis:{ - tvl: sdk.util.sumChainTvls([classic_lending.tvl, stable_lending.tvl, lpt_lending.tvl]), - borrowed: sdk.util.sumChainTvls([classic_lending.borrowed, stable_lending.borrowed, lpt_lending.borrowed]) - }, - methodology: "TVL is comprised of tokens deposited to the protocol as collateral from serveral pools, similar to Compound Finance and the borrowed tokens are not counted as TVL. ", -}; +module.exports= mergeExports([ + [unitroller_classic_oasis, '0xd7d588babfb99e82cd6dd0ca7677a5599aa678b5'], + [unitroller_usd_oasis], + [unitroller_lpt_oasis, '0x63f1fe2e1da490611fc16e4a5d92b7ec7d0911a9'], +].map( ([comptroller, cether]) => ({ + oasis: compoundExports2({ comptroller, cether, }), +}))) \ No newline at end of file diff --git a/projects/GajFinance/index.js b/projects/GajFinance/index.js index a50a4daddc26..d363c4c95c46 100644 --- a/projects/GajFinance/index.js +++ b/projects/GajFinance/index.js @@ -11,7 +11,6 @@ async function stakingAvax(timestamp, ethBlock, chainBlocks) { } module.exports = { - broken: 'Api is no longer reachable', methodology: "TVL comes from NFT Farming, Jungle Pools, MasterChef and Vaults", avax:{ staking: stakingAvax, diff --git a/projects/HyperBlast/index.js b/projects/HyperBlast/index.js index be608acd72c4..0a8d4b165644 100644 --- a/projects/HyperBlast/index.js +++ b/projects/HyperBlast/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: '0xD97fFc2041a8aB8f6bc4aeE7eE8ECA485381D088', useDefaultCoreAssets: true, - fetchBalances: true, }), }, } \ No newline at end of file diff --git a/projects/Infernoswap/index.js b/projects/Infernoswap/index.js index 7150a5b11ae5..27c48287e25c 100644 --- a/projects/Infernoswap/index.js +++ b/projects/Infernoswap/index.js @@ -1,4 +1,5 @@ const { uniTvlExport } = require('../helper/unknownTokens'); module.exports.hallmarks = [[1703808000, "Rug Pull"]] -module.exports = uniTvlExport('beam', '0x671235E91df0A21F319260F9e93Fc459519E163C', { fetchBalances: true}) \ No newline at end of file +module.exports = uniTvlExport('beam', '0x671235E91df0A21F319260F9e93Fc459519E163C', { fetchBalances: true}) // lies about token balance +module.exports.deadFrom = 1703808000 \ No newline at end of file diff --git a/projects/Inufair/index.js b/projects/Inufair/index.js index d59895713040..24c851862e66 100644 --- a/projects/Inufair/index.js +++ b/projects/Inufair/index.js @@ -1,4 +1,4 @@ const { uniTvlExport } = require('../helper/unknownTokens'); module.exports.hallmarks=[[1705708800,"Rug Pull"]]; -module.exports = uniTvlExport('zkfair', '0x3582Ccde3F786229CE6Dbd88c5aDb86bF64DAA31', { fetchBalances: true, }) +module.exports = uniTvlExport('zkfair', '0x3582Ccde3F786229CE6Dbd88c5aDb86bF64DAA31') diff --git a/projects/KyborgExchange/index.js b/projects/KyborgExchange/index.js index ce604dec3b55..63333c7f9fe3 100644 --- a/projects/KyborgExchange/index.js +++ b/projects/KyborgExchange/index.js @@ -9,6 +9,7 @@ module.exports = { hallmarks: [ [1684108800, "Rug Pull"] ], + deadFrom: '2023-05-15', methodology: `Counts the tokens balances of the KyborgHub contract`, }; diff --git a/projects/LairFinance/index.js b/projects/LairFinance/index.js new file mode 100644 index 000000000000..8e815ec5ce37 --- /dev/null +++ b/projects/LairFinance/index.js @@ -0,0 +1,13 @@ +const contracts = { + stKAIA: '0x42952B873ed6f7f0A7E4992E2a9818E3A9001995', + node: '0x7949597f453592B782EC9036Af27d63Ed9774b2d', +} + +async function tvl(api) { + const tvl = await api.call({ target: contracts.node, abi: "uint256:getTotalClaimable" }) + api.addGasToken(tvl) +} + +module.exports = { + klaytn: { tvl } +} \ No newline at end of file diff --git a/projects/LemonBlast/index.js b/projects/LemonBlast/index.js index 018a1e7110e7..937330fceeaa 100644 --- a/projects/LemonBlast/index.js +++ b/projects/LemonBlast/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - blast: { tvl: getUniTVL({ factory: '0x31329BcDC90faD4d65764ccf91f833ec1d5fB5A4', useDefaultCoreAssets: true, fetchBalances: true, }), }, + blast: { tvl: getUniTVL({ factory: '0x31329BcDC90faD4d65764ccf91f833ec1d5fB5A4', useDefaultCoreAssets: true,}), }, } diff --git a/projects/LuigiSwap/index.js b/projects/LuigiSwap/index.js index e510d698461b..cbe4b40e00d3 100644 --- a/projects/LuigiSwap/index.js +++ b/projects/LuigiSwap/index.js @@ -6,14 +6,12 @@ module.exports = { tvl: getUniTVL({ factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", useDefaultCoreAssets: true, - fetchBalances: true, }), }, scroll: { tvl: getUniTVL({ factory: "0x0dAe6d22182c20AB9150a4DCB3160591Dc41027a", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/Magnate/index.js b/projects/Magnate/index.js index 707b662419e0..4f66a7b26908 100644 --- a/projects/Magnate/index.js +++ b/projects/Magnate/index.js @@ -8,4 +8,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-08-25')/1e3), 'Project Rugged'], ], + deadFrom: Math.floor(new Date('2023-08-25')/1e3) }; diff --git a/projects/MeowProtocol/index.js b/projects/MeowProtocol/index.js index 73cb3303687a..2a1fd2861968 100644 --- a/projects/MeowProtocol/index.js +++ b/projects/MeowProtocol/index.js @@ -19,4 +19,7 @@ Object.keys(config).forEach(chain => { return api.getBalances() } } -}) \ No newline at end of file +}) + + + module.exports.deadFrom = '2024-05-09' \ No newline at end of file diff --git a/projects/Metahub-Finance/index.js b/projects/Metahub-Finance/index.js new file mode 100644 index 000000000000..9108edcd6ed6 --- /dev/null +++ b/projects/Metahub-Finance/index.js @@ -0,0 +1,22 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") +const ADDRESSES = require('../helper/coreAssets.json') +const MEN_TOKEN_CONTRACT = '0x94b959c93761835f634B8d6E655070C58E2CAa12'; +const owners = [ + '0xF3Bc54A6b9615569194a203f852E64476f70d875', + '0x58e353BA88F22d6955b99Ee3a84826751F5B01be', + '0x126b40E61efAE1ef7b86ed3ffF4083369E3DaDF3', + '0x8Db60A7F9Ff1C92288C905fE780aE4D6f69Dd72e', + '0x0C6feFB39a0fe19054490F18C3Cb2412f407F650', + '0xf72d1642a6ce6e8b50597b6dca636488e14b666b', + '0xf416E1c9AdeCc1F8AF16E5fc26b06F69520A613b', + '0x1a0900f58ed4c558a0b35f184276ec9383ff29b0', + '0x56485038b32a24C7f5Ee1449eaC7f444ca4b21F2' +] + +module.exports = { + polygon: { + tvl: sumTokensExport({ owners, token: ADDRESSES.polygon.USDT, }), + staking: sumTokensExport({ owners, token: MEN_TOKEN_CONTRACT }), + pool2: sumTokensExport({ owners, token: '0xD12bA2A40289Ed8728682447DC77D001F03675F9', resolveLP: true, }), + }, +} \ No newline at end of file diff --git a/projects/MorFi/index.js b/projects/MorFi/index.js new file mode 100644 index 000000000000..c0ab9c3f66f2 --- /dev/null +++ b/projects/MorFi/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + morph: { + factory: "0x1be404c921ef85537233ef2be251a27583072861", + fromBlock: 166014, + isAlgebra: true, + }, +}); \ No newline at end of file diff --git a/projects/OCP/index.js b/projects/OCP/index.js index 745ef6b4d664..4bde384bb683 100644 --- a/projects/OCP/index.js +++ b/projects/OCP/index.js @@ -1,7 +1,7 @@ const { compoundExports } = require('../helper/compound') module.exports = { - bsc: compoundExports('0xc001c415b7e78ea4a3edf165d8f44b70391f8c3c', 'bsc', undefined, undefined, undefined, undefined, { blacklistedTokens: ['0x3c70260eee0a2bfc4b375feb810325801f289fbd', '0x5801d0e1c7d977d78e4890880b8e579eb4943276']}), + bsc: compoundExports('0xc001c415b7e78ea4a3edf165d8f44b70391f8c3c', undefined, undefined, { blacklistedTokens: ['0x3c70260eee0a2bfc4b375feb810325801f289fbd', '0x5801d0e1c7d977d78e4890880b8e579eb4943276']}), hallmarks: [ [Math.floor(new Date('2022-02-14')/1e3), 'Project abandoned by the team'], ], diff --git a/projects/Omnidrome/index.js b/projects/Omnidrome/index.js index f5fc98868218..79149493ce2e 100644 --- a/projects/Omnidrome/index.js +++ b/projects/Omnidrome/index.js @@ -6,6 +6,6 @@ module.exports = { tvl: uniTvlExport("0x769d1BcB5FDf30F5a9D19f1ab8A3cF8b60a6e855", undefined, undefined, { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint256) view returns (address)', - }, { fetchBalances: true, useDefaultCoreAssets: true, hasStablePools: true, }), + }, { useDefaultCoreAssets: true, hasStablePools: true, }), }, } diff --git a/projects/OpankeSwap/index.js b/projects/OpankeSwap/index.js index a523d98fdf91..5c73708b245e 100644 --- a/projects/OpankeSwap/index.js +++ b/projects/OpankeSwap/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x4523A7f5414bAc9BfbDfc6eF0932Bf580C3cf9f1", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/OreSwap/index.js b/projects/OreSwap/index.js index f2bd8b4d59fe..ddf01264a41c 100644 --- a/projects/OreSwap/index.js +++ b/projects/OreSwap/index.js @@ -3,6 +3,6 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, core: { - tvl: getUniTVL({ factory: '0xbA862e0B955c612EEd514E722c84F1E70962457e', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0xbA862e0B955c612EEd514E722c84F1E70962457e', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/PattieSwap/index.js b/projects/PattieSwap/index.js index c5c5a6d69eb1..118acef1dd35 100644 --- a/projects/PattieSwap/index.js +++ b/projects/PattieSwap/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - bsc: { tvl: getUniTVL({ factory: '0x71f6a913b317d2BF0Bf51Fd48d90e4cC6e62C4Dd', useDefaultCoreAssets: true, fetchBalances: true, }), }, + bsc: { tvl: getUniTVL({ factory: '0x71f6a913b317d2BF0Bf51Fd48d90e4cC6e62C4Dd', useDefaultCoreAssets: true, }), }, } diff --git a/projects/PinSwap/index.js b/projects/PinSwap/index.js new file mode 100644 index 000000000000..10fc1049a5ff --- /dev/null +++ b/projects/PinSwap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); +module.exports = { + misrepresentedTokens: true, + iotex: { + tvl: getUniTVL({ + factory: "0x0A753dD1AFDE272a2d4bf55dF616568744201577", + useDefaultCoreAssets: true, + }), + }, +}; diff --git a/projects/PoorExchange/index.js b/projects/PoorExchange/index.js index 2a8e7f52a39c..e9140ed14805 100644 --- a/projects/PoorExchange/index.js +++ b/projects/PoorExchange/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('arbitrum', '0x9fA0988D9e4b6362e0aaA02D1A09196a78c177e1', { fetchBalances: true, }) +module.exports = uniTvlExport('arbitrum', '0x9fA0988D9e4b6362e0aaA02D1A09196a78c177e1') diff --git a/projects/Produs/index.js b/projects/Produs/index.js index be8684fb5cd9..ab90dd59a9b9 100644 --- a/projects/Produs/index.js +++ b/projects/Produs/index.js @@ -3,6 +3,6 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ factory: '0x8ae5527706446943cBA8589313EC217a4a7288a4', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x8ae5527706446943cBA8589313EC217a4a7288a4', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/PyreSwap/index.js b/projects/PyreSwap/index.js index bd1797bd0eee..3fb46e898ba8 100644 --- a/projects/PyreSwap/index.js +++ b/projects/PyreSwap/index.js @@ -6,6 +6,6 @@ module.exports = { ['fantom', 'bsc', 'avax'].forEach(chain => { module.exports[chain] = { - tvl: getUniTVL({ factory: '0x045d720873f0260e23da812501a7c5930e510aa4', useDefaultCoreAssets: true, fetchBalances: true, }) + tvl: getUniTVL({ factory: '0x045d720873f0260e23da812501a7c5930e510aa4', useDefaultCoreAssets: true, }) } }) \ No newline at end of file diff --git a/projects/RandomReward/index.js b/projects/RandomReward/index.js new file mode 100644 index 000000000000..1002d8650381 --- /dev/null +++ b/projects/RandomReward/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +const RR_ETHEREUM = '0x5ec1e43163b303b13fea20a892cba7e5568d8a8f'; + +module.exports = { + methodology: `Total ETH held in the Random Reward contract, available for distribution.`, + ethereum: { tvl: sumTokensExport({ owner: RR_ETHEREUM, tokens: [nullAddress]}), }, + }; \ No newline at end of file diff --git a/projects/SRWAio/index.js b/projects/SRWAio/index.js new file mode 100644 index 000000000000..a1ed193b07c2 --- /dev/null +++ b/projects/SRWAio/index.js @@ -0,0 +1,31 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { queryAddresses, sumTokens } = require('../helper/chain/radixdlt'); + +const componentAddress = 'component_rdx1cps7jyr7vqrtm2uxj8d77a9fyjkv804nhqzvfn2u7m58tg3wdk2qky' + +const resources = [ + { + address: ADDRESSES.radixdlt.XRD, + }, + { + address: 'resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf', + } +] + +async function tvl(api) { + return sumTokens({ api, owners: [componentAddress] }); +} + +async function borrowed(api) { + const componentData = await queryAddresses({ addresses: [componentAddress] }); + resources.forEach((resource) => { + const matchingEntry = componentData[0].details.state.fields[12]?.entries.find((entry) => entry.key.value === resource.address); + api.add(matchingEntry.key.value, Number(matchingEntry.value.value)); + }); +} + +module.exports = { + radixdlt: { tvl, borrowed }, + timetravel: false, +}; \ No newline at end of file diff --git a/projects/Scale/index.js b/projects/Scale/index.js index 2b179553ea6e..ff0a304401fd 100644 --- a/projects/Scale/index.js +++ b/projects/Scale/index.js @@ -4,7 +4,7 @@ const { staking } = require('../helper/staking') module.exports = { misrepresentedTokens: true, base:{ - tvl: uniTvlExport("0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04", "base", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: uniTvlExport("0xEd8db60aCc29e14bC867a497D94ca6e3CeB5eC04", "base", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }), staking: staking("0x28c9c71c776a1203000b56c0cca48bef1cd51c53", "0x54016a4848a38f257b6e96331f7404073fd9c32c"), }, } diff --git a/projects/SquadSwap-v3/index.js b/projects/SquadSwap-v3/index.js index 289e6633bab0..56b4d2953b70 100644 --- a/projects/SquadSwap-v3/index.js +++ b/projects/SquadSwap-v3/index.js @@ -1,6 +1,10 @@ const { uniV3Export } = require('../helper/uniswapV3') -const factory = '0x009c4ef7C0e0Dd6bd1ea28417c01Ea16341367c3' module.exports = uniV3Export({ - bsc: { factory, fromBlock: 34184408 } + bsc: { factory: '0x009c4ef7C0e0Dd6bd1ea28417c01Ea16341367c3', fromBlock: 34184408 }, + base: { factory: '0xa1288b64F2378276d0Cc56F08397F70BecF7c0EA', fromBlock: 19730499 }, + blast: { factory: '0x6Ea64BDCa26F69fdeF36C1137A0eAe5Bf434e8fd', fromBlock: 5644236 }, + arbitrum: { factory: '0x0558921f7C0f32274BB957D5e8BF873CE1c0c671', fromBlock: 253170358 }, + polygon: { factory: '0x633Faf3DAc3677b51ea7A53a81b79AEe944714dc', fromBlock: 61864971 }, + optimism: { factory: '0xa1288b64F2378276d0Cc56F08397F70BecF7c0EA', fromBlock: 125326692 }, }) diff --git a/projects/SquadSwap/index.js b/projects/SquadSwap/index.js index ce4ef4e103eb..eff4b963aaba 100644 --- a/projects/SquadSwap/index.js +++ b/projects/SquadSwap/index.js @@ -1,19 +1,27 @@ const { stakings } = require("../helper/staking"); const { getUniTVL } = require('../helper/unknownTokens') -const masterchefV2Address = '0x2e881a10f682a3b2CBaaF8fc5A9a94E98D4879B4'; // SquadSwap's MasterChef V2 contract -const masterchefV3Address = '0x44eC8143EB368cAbB00c4EfF085AF276260202B5'; // SquadSwap's MasterChef V3 contract -const squadTokenAddress = '0x2d2567dec25c9795117228adc7fd58116d2e310c'; // SquadSwap token contract + + +const config = { + bsc: { factory: '0x1D9F43a6195054313ac1aE423B1f810f593b6ac1', masterchefs: ['0x2e881a10f682a3b2CBaaF8fc5A9a94E98D4879B4', '0x44eC8143EB368cAbB00c4EfF085AF276260202B5'], token: '0x2d2567dec25c9795117228adc7fd58116d2e310c' }, + base: { factory: '0xba34aA640b8Be02A439221BCbea1f48c1035EEF9', masterchefs: ['0xB6171582C75421A740dcC15E4D873a34Cb2Ebb48', '0x89c0619E7A798309193438b3Cff11f1F31266711'], token: '0x08Ccb86a31270Fd97D927A4e17934C6262A68b7E' }, + blast: { factory: '0x4B599f3425D54AfBf94bFD41EA9931fF92AD6551', masterchefs: ['0xdeE10310E729C36a560c72c0E8E3be0e46673063', '0xda3840837Df961A710C889e0D23295dF82cCfF8b'], token: '0x08Ccb86a31270Fd97D927A4e17934C6262A68b7E' }, + arbitrum: { factory: '0xba34aA640b8Be02A439221BCbea1f48c1035EEF9', masterchefs: ['0x6dAafc12F65801afb2F0B0212a8229F224Acf576', '0xA9E236aa88D3D9d5D4499D1b6ffA7ec170dA5DCA'], token: '0x08Ccb86a31270Fd97D927A4e17934C6262A68b7E' }, + polygon: { factory: '0xEE8F37D490CB7Ea1dae7d080c5738894731299f0', masterchefs: ['0x1D9F43a6195054313ac1aE423B1f810f593b6ac1', '0xb4286E807A8107cC3344d3094468DC44D73b49c2'], token: '0x5eBB1ff6dc0759f7A6253d0568A610650Dd0d050' }, + optimism: { factory: '0xba34aA640b8Be02A439221BCbea1f48c1035EEF9', masterchefs: ['0xB6171582C75421A740dcC15E4D873a34Cb2Ebb48', '0x89c0619E7A798309193438b3Cff11f1F31266711'], token: '0x08Ccb86a31270Fd97D927A4e17934C6262A68b7E' }, + +} + module.exports = { - methodology: "TVL is calculated from total liquidity of SquadSwap's active pools", - bsc: { - tvl: getUniTVL({ - factory: '0x1D9F43a6195054313ac1aE423B1f810f593b6ac1', - useDefaultCoreAssets: true, - }), - staking: stakings([ - masterchefV2Address, - masterchefV3Address, - ], squadTokenAddress) - } -}; + methodology: "TVL is calculated from total liquidity of SquadSwap's active pools", + misrepresentedTokens: true +} + +Object.keys(config).forEach(chain => { + const { factory, masterchefs, token, } = config[chain] + module.exports[chain] = { + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), + staking: token && stakings(masterchefs, token) + } +}) \ No newline at end of file diff --git a/projects/TonStable/index.js b/projects/TonStable/index.js new file mode 100644 index 000000000000..6f0a12dad516 --- /dev/null +++ b/projects/TonStable/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const tonStableAddr = "EQC2Bt4vwcSgCwABlOfgl75GbGuC0GpRU2GsZKqqMHu-T0gk"; + +module.exports = { + methodology: "TonStable's TVL includes all deposited supported assets", + ton: { + tvl: sumTokensExport({ owner: tonStableAddr, tokens: [ADDRESSES.null] }), + }, +}; diff --git a/projects/XDX/index.js b/projects/XDX/index.js index 388e2f70dd56..5bcc175f7e4b 100644 --- a/projects/XDX/index.js +++ b/projects/XDX/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, blast: { tvl: getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0xF55dE36072beCebF162d2d54C49964f3b0683711', }) diff --git a/projects/ZTLN/index.js b/projects/ZTLN/index.js new file mode 100644 index 000000000000..f3d9acdf980d --- /dev/null +++ b/projects/ZTLN/index.js @@ -0,0 +1,50 @@ +const { request } = require("graphql-request"); + +const endpoint = "https://api.studio.thegraph.com/query/77016/wallet-mainnet/version/latest"; + +const securityAddress = '0x917991d52Aa2fC1b5612A6aa5e4e81d580F97532'; +const query = ` +query MyQuery { + securities(where: {security: "${securityAddress}"}) { + secondaryInvestors { + amount + } + } +} +`; + +async function getTvl() { + try { + const data = await request(endpoint, query); + + const securities = data.securities || []; + + let tokens = 0; + const currencyDecimal = 10 ** 18; + + securities.forEach(security => { + security.secondaryInvestors.forEach(investor => { + const amt = parseFloat(investor.amount); + tokens += amt / currencyDecimal; + }); + }); + + const price = 100.5; + const tvl = tokens * price; + + // console.log("tvl", tvl); + return tvl; + } catch (error) { + console.error("Error fetching TVL:", error); + return 0; + } +} + +module.exports = { + timetravel: false, + methodology: "The value in RWA held by the protocol", + ethereum: { + fetch: getTvl + }, + fetch: getTvl +}; \ No newline at end of file diff --git a/projects/Zolidly/index.js b/projects/Zolidly/index.js index ebb6c6a55868..c3fa2b987990 100644 --- a/projects/Zolidly/index.js +++ b/projects/Zolidly/index.js @@ -5,6 +5,7 @@ module.exports = { hallmarks: [ [1684713600, "Rug Pull"] ], + deadFrom: '2023-05-22', era: { tvl: getUniTVL({ factory: '0x6E1315819908Eaa036405f405c033cC2BfFBFc75', diff --git a/projects/ZukeSwap/index.js b/projects/ZukeSwap/index.js index 6d16f07a5835..c9f4fe12155b 100644 --- a/projects/ZukeSwap/index.js +++ b/projects/ZukeSwap/index.js @@ -4,6 +4,7 @@ module.exports = { hallmarks: [ [1680307200, "Rug Pull"] ], + deadFrom: '2023-04-01', misrepresentedTokens: true, loop: { tvl: getUniTVL({ diff --git a/projects/a51-finance-v3/index.js b/projects/a51-finance-v3/index.js index 7d3e171b294d..5b18a09575f4 100644 --- a/projects/a51-finance-v3/index.js +++ b/projects/a51-finance-v3/index.js @@ -40,6 +40,8 @@ const config = { manta: [{ target: "0x69317029384c3305fC04670c68a2b434e2D8C44C", helper: "0xa1d8180f4482359ceb7eb7437fcf4a2616830f81", startBlock: 1834975 },], // lynex linea: [{target: "0xA8Dc31c8C9F93dB2e42A5472F580689794639576",helper: "0x965356eb2C208Ce4130E267342cA720042Cce7b2",startBlock: 4518443,},], + // swapmode + mode: [{ target: "0x69317029384c3305fC04670c68a2b434e2D8C44C", helper: "0xFFD9acf25F2D930BE88D486D588ecBa7a418DE0B", startBlock: 11042629 },], } module.exports = { diff --git a/projects/aark/index.js b/projects/aark/index.js index 83e1c5288389..8f2f40192199 100644 --- a/projects/aark/index.js +++ b/projects/aark/index.js @@ -5,7 +5,7 @@ async function tvl(api) { return api.sumTokens({ owner: VAULT_CONTRACT_ADDRESS, tokens: [ ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.USDC, - '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', //FRAX + ADDRESSES.arbitrum.FRAX, //FRAX ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WSTETH, ADDRESSES.arbitrum.DAI, diff --git a/projects/aave-v3/index.js b/projects/aave-v3/index.js new file mode 100644 index 000000000000..2bb6fcc0406e --- /dev/null +++ b/projects/aave-v3/index.js @@ -0,0 +1,58 @@ +const abi = { + getReserveTokensAddresses: "function getReserveTokensAddresses(address asset) view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress)", + getAllReservesTokens: "function getAllReservesTokens() view returns ((string symbol, address tokenAddress)[])", + getReserveData: "function getReserveData(address asset) view returns (uint256 unbacked, uint256 accruedToTreasuryScaled, uint256 totalAToken, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)", +}; + +const CONFIG = { + ethereum: ['0x41393e5e337606dc3821075Af65AeE84D7688CBD', '0x08795CFE08C7a81dCDFf482BbAAF474B240f31cD', '0xE7d490885A68f00d9886508DF281D67263ed5758'], + polygon: ['0x7F23D86Ee20D869112572136221e173428DD740B'], + avax: ['0x7F23D86Ee20D869112572136221e173428DD740B'], + arbitrum: ['0x7F23D86Ee20D869112572136221e173428DD740B'], + optimism: ['0x7F23D86Ee20D869112572136221e173428DD740B'], + harmony: ['0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654'], + fantom: ['0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654'], + metis: ['0xC01372469A17b6716A38F00c277533917B6859c0'], + base: ['0xd82a47fdebB5bf5329b09441C3DaB4b5df2153Ad'], + xdai: ['0x57038C3e3Fe0a170BB72DE2fD56E98e4d1a69717'], + scroll: ['0xe2108b60623C6Dcf7bBd535bD15a451fd0811f7b'], + bsc: ['0x23dF2a19384231aFD114b036C14b6b03324D79BC'], + era: ['0x5F2A704cE47B373c908fE8A29514249469b52b99'] +}; + +const fetchReserveData = async (api, poolDatas, isBorrowed) => { + const reserveTokens = await api.multiCall({ calls: poolDatas, abi: abi.getAllReservesTokens }); + const calls = [] + + poolDatas.map((pool, i) => { + reserveTokens[i].forEach(({ tokenAddress }) => calls.push({ target: pool, params: tokenAddress })); + }); + const reserveData = await api.multiCall({ abi: isBorrowed ? abi.getReserveData : abi.getReserveTokensAddresses, calls, }) + const tokensAndOwners = [] + reserveData.forEach((data, i) => { + const token = calls[i].params + if (isBorrowed) { + api.add(token, data.totalVariableDebt) + api.add(token, data.totalStableDebt) + } else + tokensAndOwners.push([token, data.aTokenAddress]) + }) + + if (isBorrowed) return api.getBalances() + return api.sumTokens({ tokensAndOwners }) +} + +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. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending." + +Object.keys(CONFIG).forEach((chain) => { + const poolDatas = CONFIG[chain]; + module.exports[chain] = { + tvl: (api) => fetchReserveData(api, poolDatas), + borrowed: (api) => fetchReserveData(api, poolDatas, true), + }; +}); + +module.exports.hallmarks = [ + [1659630089, "Start OP Rewards"], + [1650471689, "Start AVAX Rewards"] +] diff --git a/projects/aave/v3.js b/projects/aave/v3.js deleted file mode 100644 index a515119da1e0..000000000000 --- a/projects/aave/v3.js +++ /dev/null @@ -1,36 +0,0 @@ -const { aaveChainTvl } = require('../helper/aave'); -const methodologies = require('../helper/methodologies'); - -const v3params = ["0x770ef9f4fe897e59daCc474EF11238303F9552b6", undefined, ["0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654"]] - -function v3(chain) { - let params = v3params - if (chain === 'ethereum') - params = ['0xbaA999AC55EAce41CcAE355c77809e68Bb345170', undefined, ['0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3']] - else if (chain === 'metis') - params = ['0x9E7B73ffD9D2026F3ff4212c29E209E09C8A91F5', undefined, ['0x99411FC17Ad1B56f49719E3850B2CDcc0f9bBFd8']] - else if (chain === 'base') - params = ['0x2f6571d3Eb9a4e350C68C36bCD2afe39530078E2', undefined, ['0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac']] - else if (chain === 'xdai') - params = ['0x36616cf17557639614c1cdDb356b1B83fc0B2132', undefined, ['0x501B4c19dd9C2e06E94dA7b6D5Ed4ddA013EC741']] - else if (chain === 'scroll') - params = ['0xFBedc64AeE24921cb43004312B9eF367a4162b57', undefined, ['0xa99F4E69acF23C6838DE90dD1B5c02EA928A53ee']] - else if (chain === 'bsc') - params = ['0x117684358D990E42Eb1649E7e8C4691951dc1E71', undefined, ['0x41585C50524fb8c3899B43D7D797d9486AAc94DB']] - const section = borrowed => aaveChainTvl(chain, ...params, borrowed, true); - return { - tvl: section(false), - borrowed: section(true) - } -} - -module.exports = { - methodology: methodologies.lendingMarket, - avax: v3("avax"), - ...["optimism", "fantom", "harmony", "arbitrum", "polygon", "ethereum", "metis", "base", "xdai", "scroll", "bsc"].reduce((t, c) => ({ ...t, [c]: v3(c) }), {}), - hallmarks: [ - [1659630089, "Start OP Rewards"], - [1650471689, "Start AVAX Rewards"] - ], -}; -// node test.js projects/aave/index.js diff --git a/projects/aavegotchi/index.js b/projects/aavegotchi/index.js index 912aa44ba8d6..ba5ebf7e2377 100644 --- a/projects/aavegotchi/index.js +++ b/projects/aavegotchi/index.js @@ -1,7 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { request, gql } = require("graphql-request"); const { getBlock } = require('../helper/http') @@ -19,24 +17,14 @@ const vaultContractsPolygon = [ const GHST_Polygon = "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7"; const stkGHST_QUICKContract = "0xA02d547512Bb90002807499F05495Fe9C4C3943f"; const GHST_pools2 = [ - "0xccb9d2100037f1253e6c1682adf7dc9944498aff", // WETH_GHST_UNIV2 - "0x8B1Fd78ad67c7da09B682c5392b65CA7CaA101B9", // GHST_QUICK_UNIV2 - "0x096C5CCb33cFc5732Bcd1f3195C13dBeFC4c82f4" // GHST_USDC_UNIV2 + "0xccb9d2100037f1253e6c1682adf7dc9944498aff", // WETH_GHST_UNIV2 + "0x8B1Fd78ad67c7da09B682c5392b65CA7CaA101B9", // GHST_QUICK_UNIV2 + "0x096C5CCb33cFc5732Bcd1f3195C13dBeFC4c82f4" // GHST_USDC_UNIV2 ] -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - for (const token of tokensETH) { - await sumTokensAndLPsSharedOwners( - balances, - [[token, false]], - [vaultContractETH] - ); - } - - return balances; -}; +const ethTvl = async (api) => { + return api.sumTokens({ owner: vaultContractETH, tokens: tokensETH }) +} const graphUrl = 'https://subgraph.satsuma-prod.com/tWYl5n5y04oz/aavegotchi/aavegotchi-core-matic/api' @@ -58,14 +46,14 @@ query GET_SUMMONED_GOTCHIS ($minGotchiId: Int, $block: Int) { stakedAmount } }` -async function getGotchisCollateral(timestamp, block) { +async function getGotchisCollateral(timestamp, block, api) { const allGotchis = []; let minGotchiId = 0; while (minGotchiId !== -1) { const { aavegotchis } = await request( graphUrl, - graphQuery, - {minGotchiId, block} + graphQuery, + { minGotchiId, block } ); if (aavegotchis && aavegotchis.length > 0) { minGotchiId = parseInt(aavegotchis[aavegotchis.length - 1].gotchiId); @@ -74,42 +62,18 @@ async function getGotchisCollateral(timestamp, block) { minGotchiId = -1; } } - const gotchisBalances = { - output: allGotchis.map(g => ({ - input: {target: g.collateral}, - success: true, - output: g.stakedAmount - })) - }; - - const balances = {}; - sdk.util.sumMultiBalanceOf(balances, gotchisBalances, true, x => 'polygon:' + x); - return gotchisBalances; + allGotchis.map(i => api.add(i.collateral, i.stakedAmount)); } -const polygonTvl = async (_, _block, chainBlocks) => { - const balances = {}; - const block = await getBlock(_, 'polygon', chainBlocks) - 500 - - let transformAddress = i => `polygon:${i}`; - - await sumTokensAndLPsSharedOwners( - balances, - [[GHST_Polygon, false]], - vaultContractsPolygon, - block, - "polygon", - transformAddress - ); - - const gotchisBalances = await getGotchisCollateral(_, block); - sdk.util.sumMultiBalanceOf(balances, gotchisBalances, true, x => 'polygon:' + x); +const polygonTvl = async (api) => { + const block = await getBlock(api.timestamp, 'polygon', { polygon: api.block }) - 500 - return balances; + await api.sumTokens({ owners: vaultContractsPolygon, tokens: [GHST_Polygon] }) + await getGotchisCollateral(api.timestamp, block, api); }; module.exports = { - ethereum: { + ethereum: { tvl: ethTvl, }, polygon: { diff --git a/projects/abacus/index.js b/projects/abacus/index.js new file mode 100644 index 000000000000..cd42e3ee9f06 --- /dev/null +++ b/projects/abacus/index.js @@ -0,0 +1,25 @@ +const wildCreditABI = require('../wildcredit/abi.json'); + +const config = { + arbitrum: { strategy: '0xB4E291f443f51D80186dd3EE0Af7F4a4E6e90804', veToken: '0xAAA343032aA79eE9a6897Dab03bef967c3289a06', token: '0xAAA6C1E32C55A7Bfa8066A6FAE9b42650F262418' }, + avax: { strategy: '0xedEd6a22bf714d4B19b7e7bC1CA0BCF88956751c', veToken: '0xAAAEa1fB9f3DE3F70E89f37B69Ab11B47eb9Ce6F', token: '0xaaab9d12a30504559b0c5a9a5977fee4a6081c6b' }, + bsc: { strategy: '0x37e46C030e0d843b39F692c9108E54945F4CCCf7', veToken: '0xfBBF371C9B0B994EebFcC977CEf603F7f31c070D', token: '0xF4C8E32EaDEC4BFe97E0F595AdD0f4450a863a11' }, + polygon: { strategy: '0x32dAc1B8AD93b53F549D6555e01c35dCC50b6229', veToken: '0xB419cE2ea99f356BaE0caC47282B9409E38200fa', token: '0xBFA35599c7AEbb0dAcE9b5aa3ca5f2a79624D8Eb' }, + mantle: { strategy: '0xCaAF554900E33ae5DBc66ae9f8ADc3049B7D31dB', veToken: '0xAAAEa1fB9f3DE3F70E89f37B69Ab11B47eb9Ce6F', token: '0xC1E0C8C30F251A07a894609616580ad2CEb547F2' }, + scroll: { strategy: '0xDDFc6B230656010f314F2F659eC8ff33FaB7A9Db', veToken: '0xAAAEa1fB9f3DE3F70E89f37B69Ab11B47eb9Ce6F', token: '0xAAAE8378809bb8815c08D3C59Eb0c7D1529aD769' }, +} + +Object.keys(config).forEach(chain => { + const { strategy, veToken, token, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const nftPositions = await api.call({ abi: 'erc20:balanceOf', target: veToken, params: strategy }) + const positionIds = await api.multiCall({ + abi: wildCreditABI.tokenOfOwnerByIndex, target: veToken, + calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [strategy, index] })) + }) + const locked = await api.multiCall({ abi: 'function locked(uint256) view returns (uint256 amount, uint256 end)', calls: positionIds, target: veToken }) + locked.forEach(i => api.add(token, i.amount)) + } + } +}) \ No newline at end of file diff --git a/projects/abc-pool/index.js b/projects/abc-pool/index.js index e358ef7546f9..7f61095bd772 100644 --- a/projects/abc-pool/index.js +++ b/projects/abc-pool/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const PoSPoolProxy1967_core = "cfx:type.contract:accpx9uxky39pg1hzav757vdej95w1kbcp13d0hvm7"; const PoSPoolProxy1967_espace = "0xb6eb7aa86f3886b6edc0fc1c826221b1fb26e437"; const core_rpc = "https://main.confluxrpc.com"; diff --git a/projects/abracadabra/market.json b/projects/abracadabra/market.json index 8d045db77801..af4f168f0210 100644 --- a/projects/abracadabra/market.json +++ b/projects/abracadabra/market.json @@ -67,7 +67,8 @@ "0x1062eb452f8c7a94276437ec1f4aaca9b1495b72": "0x38EA452219524Bb87e18dE1C24D3bB59510BD783", "0x692887E8877C6Dd31593cda44c382DB5b289B684": "0xf35b31B941D94B249EaDED041DB1b05b7097fEb6", "0x406b89138782851d3a8C04C743b010CEb0374352": "0xdCD90C7f6324cfa40d7169ef80b12031770B4325", - "0x85f60D3ea4E86Af43c9D4E9CC9095281fC25c405": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599" + "0x85f60D3ea4E86Af43c9D4E9CC9095281fC25c405": "0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599", + "0x00380CB5858664078F2289180CC32F74440AC923": "0x5C5b196aBE0d54485975D1Ec29617D42D9198326" }, "fantom": { "0xed745b045f9495b8bfc7b58eea8e0d0597884e12": "0x0DEC85e74A92c52b7F708c4B10207D9560CEFaf0", diff --git a/projects/abstraDex/index.js b/projects/abstraDex/index.js index ac6ecf1f3043..75dcb1d9baaa 100644 --- a/projects/abstraDex/index.js +++ b/projects/abstraDex/index.js @@ -1,4 +1,6 @@ + + const { getUniTVL } = require("../helper/unknownTokens"); const config = { @@ -7,6 +9,8 @@ const config = { zeta: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', blast: '0xA7afB6163c331DDb0845843889D6f9544328846F', cyeth: '0x174c4c03dfea09682728a5959a253bf1f7c7766f', + cronos_zkevm: '0x76D1fC018676f8A973474C24F40A2e14e401b770', + morph: '0x174c4C03DfeA09682728A5959A253bf1F7C7766F', } module.exports = { @@ -15,4 +19,5 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, }), } -}) \ No newline at end of file +}) + diff --git a/projects/accumulated-finance/index.js b/projects/accumulated-finance/index.js index 95eed412e761..f844b04379f7 100644 --- a/projects/accumulated-finance/index.js +++ b/projects/accumulated-finance/index.js @@ -62,6 +62,21 @@ const config = { "LST": "0xcba2aeec821b0b119857a9ab39e09b034249681a" }, } + ], + "oasis": [ + { + "sapphire": { + "LST": "0xed57966f1566de1a90042d07403021ea52ad4724" + } + } + ], + "stETH": [ + { + "ethereum": { + "baseToken": "0xae7ab96520de3a18e5e111b5eaab095312d7fe84", + "LST": "0x684d7fd1067ed8e9686e6fd764d048b9bf92dfa9" + } + }, ] } diff --git a/projects/acet/index.js b/projects/acet/index.js new file mode 100644 index 000000000000..68378f60052a --- /dev/null +++ b/projects/acet/index.js @@ -0,0 +1,19 @@ +const stakingAccounts = [ + "0x64D2C3a33F5bc09Dc045f9A20fA4cA4f42215c0b", + "0xfb62ea552eeba8b00cc5db56ba8d7c50429c0001", + "0x38506a479E8959150466cE9253c19089fd0907D7", +]; + +const token = "0x9F3BCBE48E8b754F331Dfc694A894e8E686aC31D"; + +module.exports = { + bsc: { + tvl: async () => ({}), + staking: async (api) => { + return api.sumTokens({ + tokensAndOwners: stakingAccounts.map((account) => [token, account]), + }); + }, + }, +}; + \ No newline at end of file diff --git a/projects/acoconut/abis/singlePlus.json b/projects/acoconut/abis/singlePlus.json deleted file mode 100644 index 7936ebcea105..000000000000 --- a/projects/acoconut/abis/singlePlus.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "totalUnderlying": "uint256:totalUnderlying", - "token": "address:token" -} \ No newline at end of file diff --git a/projects/acoconut/index.js b/projects/acoconut/index.js index 65fdc8aeac77..ec15ad39c67e 100644 --- a/projects/acoconut/index.js +++ b/projects/acoconut/index.js @@ -1,7 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const singlePlusAbi = require('./abis/singlePlus'); -const { sumTokens2 } = require('../helper/unwrapLPs') const tokensInacBTC = [ ADDRESSES.ethereum.WBTC, @@ -19,28 +16,13 @@ const bscSingleTokens = [ const btcb = 'bsc:' + ADDRESSES.bsc.BTCB -async function eth(timestamp, block) { - return sumTokens2({ block, owner: acBTCTokenHolder, tokens: tokensInacBTC}) +async function eth(api) { + return api.sumTokens({ owner: acBTCTokenHolder, tokens: tokensInacBTC}) } -async function bsc(timestamp, _, {bsc: block}) { - const balances = {}; - - const totalUnderlyingResults = await sdk.api.abi.multiCall({ - block, - calls: bscSingleTokens.map((address) => ({ - target: address - })), - abi: singlePlusAbi["totalUnderlying"], - chain: 'bsc' - }); - - totalUnderlyingResults.output.forEach((tokenBalanceResult) => { - const valueInToken = tokenBalanceResult.output; - sdk.util.sumSingleBalance(balances, btcb, valueInToken) - }); - - return balances; +async function bsc(api) { + const tokens = await api.multiCall({ abi: 'address:token', calls: bscSingleTokens}) + return api.sumTokens({ tokensAndOwners2: [tokens, bscSingleTokens]}) } module.exports = { diff --git a/projects/adamantfinance/abi.json b/projects/adamantfinance/abi.json deleted file mode 100644 index dea346007a61..000000000000 --- a/projects/adamantfinance/abi.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "balance": "uint256:balance", - "balanceOfVault": "uint256:balanceOf", - "balanceOf": "function balanceOf(address arg0) view returns (uint256)", - "minter": "address:minter", - "totalSupply": "uint256:totalSupply", - "coins": "function coins(uint256 arg0) view returns (address)", - "lp_token": "address:lp_token", - "decimals": "uint8:decimals" -} \ No newline at end of file diff --git a/projects/adamantfinance/index.js b/projects/adamantfinance/index.js index 8ef3d10fba1c..d36fbf527dc7 100644 --- a/projects/adamantfinance/index.js +++ b/projects/adamantfinance/index.js @@ -1,12 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); const { stakings } = require("../helper/staking"); const { getConfig } = require('../helper/cache') -const { unwrapLPsAuto, sumTokens2, } = require("../helper/unwrapLPs"); -const { - getChainTransform, -} = require("../helper/portedTokens"); +const { sumTokens2, } = require("../helper/unwrapLPs"); const { staking: stakingUnknown, } = require("../helper/unknownTokens"); const vaultsUrl = { @@ -22,15 +17,6 @@ const vaultsUrl = { 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 ***/ const stakingContracts_polygon = [ "0x920f22E1e5da04504b765F8110ab96A20E6408Bd", @@ -50,7 +36,6 @@ const stakingContracts_Arbitrum = [ "0x9d5d0cb1B1210d4bf0e0FdCC6aCA1583fA48f0fD", ]; -const lpAddresses_arbitrum = []; const ARBY = ADDRESSES.arbitrum.ARBY /*** Cronos Addresses ***/ @@ -61,11 +46,6 @@ const stakingContracts_cronos = [ ]; const CADDY = ADDRESSES.arbitrum.ARBY; -const vaultAddresses_cronos = [ - "0x3a9645ee664DCE6529Af678aaB4fE3AD9d68323f", - "0x6681EDBf50C0758C719F3024C282de1694807CcB", -]; - const lpAddresses_cronos = [ "0x332937463df26f46a1a715a41205765774beef80", //CADDY-WCRO Cronos "0x2a008ef8ec3ef6b03eff10811054e989aad1cf71", //CADDY-WCRO Cronos @@ -73,119 +53,60 @@ const lpAddresses_cronos = [ async function pool2Polygon(api) { - const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaultAddresses_polygon}) - const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: vaultAddresses_polygon}) + const bals = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaultAddresses_polygon }) + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: vaultAddresses_polygon }) api.addTokens(tokens, bals) return sumTokens2({ api, resolveLP: true }) } -async function polygonTvl(timestamp, block, chainBlocks) { - return await tvl2(timestamp, "polygon", NetworkID.POLYGON, chainBlocks, lpAddresses_polygon); -} - -async function arbitrumTvl(timestamp, block, chainBlocks) { - return await tvl(timestamp, "arbitrum", chainBlocks, lpAddresses_arbitrum); -} - -async function cronosTvl(timestamp, block, chainBlocks) { - 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) { - const vault_balances = ( - await sdk.api.abi.multiCall({ - chain: chain, - block: block, - calls: uniVaults.map((vault) => ({ - target: vault.vaultAddress, - })), - abi: abi.balance, - }) - ).output.map((val) => val.output); - - uniVaults.forEach((v, idx) => { - if ( - !lpAddressesIgnored.some( - (addr) => addr.toLowerCase() === v.lpAddress.toLowerCase() - ) - ) { - sdk.util.sumSingleBalance(balances, chain + ':' + v.lpAddress, vault_balances[idx]) - } - }); - await unwrapLPsAuto({ balances, block, chain, }); - return balances; -} - -const tvl = async (timestamp, chain, chainBlocks, lpAddressesIgnored) => { - - const block = chainBlocks[chain]; - const transformAddress = await getChainTransform(chain) - let balances = {}; - - let resp = await getConfig('adamant-fi/'+chain, vaultsUrl[chain]); - - let uniVaults = resp - .filter( - (vault) => - vault.vaultAddress !== adMESH && - vault.platform !== "dodo" - ) - .map((vault) => ({ - vaultAddress: vault.vaultAddress, - lpAddress: vault.lpAddress, - })); - balances = await uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress); +const blacklistedTokens = [ + ...lpAddresses_polygon, + ...lpAddresses_cronos, +] - return balances; -}; - -const tvl2 = async (timestamp, chain, chainId, chainBlocks, lpAddressesIgnored) => { - - const block = chainBlocks[chain]; - const transformAddress = await getChainTransform(chain) - let balances = {}; +const blacklistedOwners = new Set([ + adMESH, + "0x01d2833e6d86D5Ad8380044DEb2cA520fc60D326", //adMESH related token/deposit + "0xbe6aa0AF32984fE3f65a73071DECC09Ab607e310", //adMESH related token/deposit +].map(i => i.toLowerCase())) - let resp = await getConfig('adamant-fi/'+chain, allVaultsUrl); +const tvl = async (api) => { + let info = await getConfig('adamant-fi/allVaults', allVaultsUrl) + if (api.chain === 'arbitrum') { + info = await getConfig('adamant-fi/arbitrumVaults', vaultsUrl.arbitrum) - 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 + info = info.filter((vault) => vault.platform !== "dodo" && !blacklistedOwners.has(vault.lpAddress.toLowerCase()) ) - .map((vault) => ({ - vaultAddress: vault.vaultAddress, - lpAddress: vault.lpAddress, - })); - - balances = await uniTvl(balances, chain, block, uniVaults, lpAddressesIgnored, transformAddress); - return balances; + } else { + info = info + .filter((vault) => vault.platform !== "dodo" && vault.chainId == api.chainId && !blacklistedOwners.has(vault.lpAddress.toLowerCase())) + } + + + const tokens = info.map(i => i.lpAddress) + const vaults = info.map(i => i.vaultAddress) + const bals = await api.multiCall({ abi: "uint256:balance", calls: vaults, permitFailure: true, }) + api.addTokens(tokens, bals.map(i => i ?? 0)) + for (const token of blacklistedTokens) + api.removeTokenBalance(token) + return sumTokens2({ api, resolveLP: true }) }; module.exports = { polygon: { staking: stakings(stakingContracts_polygon, ADDY), pool2: pool2Polygon, - tvl: polygonTvl, + tvl, }, arbitrum: { staking: stakings(stakingContracts_Arbitrum, ARBY), - tvl: arbitrumTvl, + tvl, }, cronos: { staking: stakingUnknown({ owners: stakingContracts_cronos, tokens: [CADDY], chain: 'cronos', lps: lpAddresses_cronos, useDefaultCoreAssets: true }), - tvl: cronosTvl, - }, - fraxtal: { - tvl: fraxtalTvl, + tvl, }, + fraxtal: { tvl, }, 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/adaxPro/index.js b/projects/adaxPro/index.js index d8edf47e0e37..da9196e5d135 100644 --- a/projects/adaxPro/index.js +++ b/projects/adaxPro/index.js @@ -8,4 +8,5 @@ module.exports={ hallmarks: [ [Math.floor(new Date('2023-08-29')/1e3), 'Website offline! Rug pull?'], ], + deadFrom: Math.floor(new Date('2023-08-29')/1e3) } \ No newline at end of file diff --git a/projects/adrastea-lrt/index.js b/projects/adrastea-lrt/index.js new file mode 100644 index 000000000000..f75e94027aa7 --- /dev/null +++ b/projects/adrastea-lrt/index.js @@ -0,0 +1,6 @@ +const { sumTokensExport } = require('../helper/solana') +module.exports = { + solana: { + tvl: sumTokensExport({ owners: ['wYPqKV6XuRBSBU1zYiYB1ZTPhkR8PsDRz5kKgmSyum1'] }) + } +} diff --git a/projects/adrastea/index.js b/projects/adrastea/index.js new file mode 100644 index 000000000000..ff48a6915623 --- /dev/null +++ b/projects/adrastea/index.js @@ -0,0 +1,6 @@ +const { sumTokensExport } = require('../helper/solana') +module.exports = { + solana: { + tvl: sumTokensExport({ owners: ['Ec5tJ1H24iVSM2L8Yd7SHf7bjtD7FUWDiYSeESpFYynM'] }) + } +} diff --git a/projects/adrena/index.js b/projects/adrena/index.js new file mode 100644 index 000000000000..510b18bf1d11 --- /dev/null +++ b/projects/adrena/index.js @@ -0,0 +1,35 @@ +const { sumTokens2, getConnection } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js") +const { decodeAccount } = require('../helper/utils/solana/layout') +const ADDRESSES = require('../helper/coreAssets.json') + +async function staking() { + return sumTokens2({ tokenAccounts: ['9nD5AenzdbhRqWo7JufdNBbC4VjZ5QH7jzLuvPZy2rhb']}) +} + +async function tvl(api) { + const connection = getConnection("solana"); + + await sumTokens2({ + owner: '4o3qAErcapJ6gRLh1m1x4saoLLieWDu7Rx3wpwLc7Zk9', + balances: api.getBalances(), + blacklistedTokens: [ + 'AuQaustGiaqxRvj2gtCdrd22PBzTn8kM3kEPEkZCtuDw', // ADX + '4yCLi5yWGzpTWMQ1iWHG5CrGYAdBkhyEdsuSugjDUqwj', // ALP + ], + }); + + const rewards = await connection.getAccountInfo(new PublicKey('5GAFPnocJ4GUDJJxtExBDsH5wXzJd3RYzG8goGGCneJi')); + + // Remove rewards from AUM + api.add(ADDRESSES.solana.USDC, +decodeAccount('tokenAccount', rewards).amount.toString() * -1) +} + +module.exports = { + timetravel: false, + methodology: "TVL counts tokens deposited in the Liquidity Pool.", + solana: { + tvl, + staking, + }, +}; diff --git a/projects/aera/index.js b/projects/aera/index.js index 762598907b94..270e3e3b4ae6 100644 --- a/projects/aera/index.js +++ b/projects/aera/index.js @@ -4,6 +4,9 @@ const { getLogs } = require('../helper/cache/getLogs') const COMPOUND_ORACLE_NAME = 'CompoundV3PositionOracle' const AAVE_ORACLE_NAME = 'AaveV3PositionOracle' +const LLAMAPAY_ROUTER_ORACLE_NAME = 'LlamaPayRouterOracle' +const GEARBOX_TOKEN_PREFIX = 'Farming of' +const ARRAKIS_TOKEN_PREFIX = 'Arrakis Vault V2' const config = { polygon: { @@ -16,23 +19,24 @@ const config = { } ], cometReward: '0x45939657d1CA34A8FA39A924B71D28Fe8431e581', + arrakisHelper: '0x89E4bE1F999E3a58D16096FBe405Fc2a1d7F07D6', vaultFactories: [ - { - address: "0xfa6295a04f99815e8fa65240ed2cf9ad383c50ba", - fromBlock: 42027977 - }, - { - address: "0x3c14801dc6402e0560d69083f2b238b4c4b4dafe", - fromBlock: 42835719 - }, - { - address: "0x49b428ea1cd536e7d103e9729ea14400785e30ec", - fromBlock: 54062542 - }, - { - address: "0xa1c908cf7371047649dfca9ece01327dc6db3094", - fromBlock: 48024333 - } + { + address: "0xfa6295a04f99815e8fa65240ed2cf9ad383c50ba", + fromBlock: 42027977 + }, + { + address: "0x3c14801dc6402e0560d69083f2b238b4c4b4dafe", + fromBlock: 42835719 + }, + { + address: "0x49b428ea1cd536e7d103e9729ea14400785e30ec", + fromBlock: 54062542 + }, + { + address: "0xa1c908cf7371047649dfca9ece01327dc6db3094", + fromBlock: 48024333 + } ] }, ethereum: { @@ -49,28 +53,29 @@ const config = { } ], cometReward: '0x1B0e765F6224C21223AeA2af16c1C46E38885a40', + arrakisHelper: '0x89E4bE1F999E3a58D16096FBe405Fc2a1d7F07D6', vaultFactories: [ { - address: "0x8a7c03e9f037ba096f1fa8b48bfd65c7578327c9", - fromBlock: 17642780 + address: "0x8a7c03e9f037ba096f1fa8b48bfd65c7578327c9", + fromBlock: 17642780 }, { - address: "0xbebb92ed09688e64dc38c240b600d0b1d504ee56", - fromBlock: 17694550 + address: "0xbebb92ed09688e64dc38c240b600d0b1d504ee56", + fromBlock: 17694550 }, { - address: "0x6b8d4485e11aae228a32FAe5802c6d4BA25EA404", - fromBlock: 18143506 + address: "0x6b8d4485e11aae228a32FAe5802c6d4BA25EA404", + fromBlock: 18143506 }, { - address: "0x9500948c2BEeeB2Da4CC3aA21CB05Bd2e7C27191", - fromBlock: 18192390 + address: "0x9500948c2BEeeB2Da4CC3aA21CB05Bd2e7C27191", + fromBlock: 18192390 }, { - address: "0x38896b4ac8420b8A2B768001Da44d11109F1797D", - fromBlock: 18737324 + address: "0x38896b4ac8420b8A2B768001Da44d11109F1797D", + fromBlock: 18737324 } - ] + ] }, arbitrum: { aavePool: '0x794a61358D6845594F94dc1DB02A252b5b4814aD', @@ -86,11 +91,16 @@ const config = { }, ], cometReward: '0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae', + arrakisHelper: '0x89E4bE1F999E3a58D16096FBe405Fc2a1d7F07D6', vaultFactories: [ - { - address: "0xaF2762E1F75DeCdb8d240576e7A2CEc1A365cD46", - fromBlock: 203397910 - } + { + address: "0xaF2762E1F75DeCdb8d240576e7A2CEc1A365cD46", + fromBlock: 203397910 + }, + { + address: '0x49b428ea1cd536e7d103e9729ea14400785e30ec', + fromBlock: 245595750 + } ] }, base: { @@ -111,11 +121,12 @@ const config = { }, ], cometReward: '0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1', + arrakisHelper: '0x89E4bE1F999E3a58D16096FBe405Fc2a1d7F07D6', vaultFactories: [ - { - address: "0x5CD0Cb0DcDEF98a8d07a8D44054a13F2c35C53E1", - fromBlock: 13582859 - } + { + address: "0x5CD0Cb0DcDEF98a8d07a8D44054a13F2c35C53E1", + fromBlock: 13582859 + } ] }, } @@ -130,10 +141,11 @@ Object.keys(config).forEach(chain => { const AAVE_POOL_DATA_PROVIDER = config[chain].aavePoolDataProvider const COMETS = config[chain].comets const COMET_REWARD = config[chain].cometReward + const ARRAKIS_HELPER = config[chain].arrakisHelper const vaultFactories = config[chain].vaultFactories - + const vaultCreateds = [] - for (const { address, fromBlock} of vaultFactories) { + for (const { address, fromBlock } of vaultFactories) { const logs = await getLogs({ api, target: address, @@ -142,7 +154,7 @@ Object.keys(config).forEach(chain => { onlyArgs: true, fromBlock, }) - vaultCreateds.push(...logs.map(x => ({vault: x.vault, assetRegistry: x.assetRegistry}))) + vaultCreateds.push(...logs.map(x => ({ vault: x.vault, assetRegistry: x.assetRegistry }))) } const vaults = [] @@ -153,24 +165,44 @@ Object.keys(config).forEach(chain => { }) const assets = await api.multiCall({ abi: abi.assets, calls: assetRegistries }) + const uniqueAssets = [...new Set(assets.flatMap(x => x.map(y => y.asset)))] + const assetNames = await api.multiCall({ abi: 'string:name', calls: uniqueAssets, permitFailure: true }) const erc4626sAndOwners = [] const tokensAndOwners = [] const erc4626UnderylingMap = {} - const positions = [] + const aaveVaults = [] + const compoundVaults = [] + const llamapayRouters = [] + const gearboxFarmingPools = [] + const arrakisVaults = [] for (let i = 0; i < vaults.length; ++i) { const vault = vaults[i] for (let j = 0; j < assets[i].length; ++j) { const assetInfo = assets[i][j] - // position assets - if (assetInfo.asset === assetInfo.oracle) { - positions.push([assetInfo.asset, vault]) - continue + const assetName = assetNames[uniqueAssets.findIndex(x => x === assetInfo.asset)] + if (assetName) { + if (assetName === COMPOUND_ORACLE_NAME) { + compoundVaults.push(vault) + } + if (assetName === AAVE_ORACLE_NAME) { + aaveVaults.push(vault) + } + if (assetName === LLAMAPAY_ROUTER_ORACLE_NAME) { + llamapayRouters.push(assetInfo.asset) + } + if (assetName.startsWith(GEARBOX_TOKEN_PREFIX)) { + gearboxFarmingPools.push([vault, assetInfo.asset]) + } + if (assetName.startsWith(ARRAKIS_TOKEN_PREFIX)) { + arrakisVaults.push(assetInfo.asset) + } } + if (assetInfo.isERC4626) { if (!erc4626UnderylingMap[assetInfo.asset]) erc4626UnderylingMap[assetInfo.asset] = null erc4626sAndOwners.push([assetInfo.asset, vault]) @@ -180,12 +212,17 @@ Object.keys(config).forEach(chain => { } } - const [underlyingTokens, vaultErc4626Balances, tokenNames,] = await Promise.all([ + const [underlyingTokens, vaultErc4626Balances] = await Promise.all([ api.multiCall({ abi: 'address:asset', calls: Object.keys(erc4626UnderylingMap) }), api.multiCall({ abi: 'erc20:balanceOf', calls: erc4626sAndOwners.map(x => ({ target: x[0], params: x[1] })) }), - api.multiCall({ abi: 'string:name', calls: positions.map(x => x[0]), permitFailure: true }), ]) - await processLendingTvls(positions, tokenNames, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDER, COMETS, vaults, COMET_REWARD) + await Promise.all([ + processAaveTvl(aaveVaults, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDER), + processCompoundTvl(compoundVaults, api, COMETS, vaults, COMET_REWARD), + processLlamaPayTvl(llamapayRouters, api), + processGearboxTvl(gearboxFarmingPools, api), + processArrakisTvl(arrakisVaults, api, ARRAKIS_HELPER) + ]) Object.keys(erc4626UnderylingMap).forEach((erc4626Asset, i) => erc4626UnderylingMap[erc4626Asset] = underlyingTokens[i]) @@ -201,80 +238,118 @@ Object.keys(config).forEach(chain => { } }) -async function processLendingTvls(positions, tokenNames, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDER, COMETS, vaults, COMET_REWARD) { - const compoundVaults = []; - const aaveVaults = []; - for (let i = 0; i < positions.length; ++i) { - if (tokenNames[i] === COMPOUND_ORACLE_NAME) { - compoundVaults.push(positions[i][1]); - } else if (tokenNames[i] === AAVE_ORACLE_NAME) { - aaveVaults.push(positions[i][1]); - } - } +async function processArrakisTvl(arrakisVaults, api, arrakisHelper) { + if (arrakisVaults.length === 0) return - await Promise.all([ - processAaveTvl(aaveVaults, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDER), - processCompoundTvl(compoundVaults, api, COMETS, vaults, COMET_REWARD) + const [tokens0, tokens1, totalUnderlyings] = await Promise.all([ + api.multiCall({ abi: abi.token0, calls: arrakisVaults}), + api.multiCall({ abi: abi.token1, calls: arrakisVaults}), + api.multiCall({ abi: abi.totalUnderlying, calls: arrakisVaults.map(x => ({target: arrakisHelper, params: [x]}))}) ]) + + totalUnderlyings.forEach((v, i) => { + api.addToken(tokens0[i], v.totalAmount0) + api.addToken(tokens1[i], v.totalAmount1) + }) +} + +async function processGearboxTvl(farmingPools, api) { + if (farmingPools.length === 0) return + + const [stakingTokens, stakingTokenBalances, rewardTokens, farmed] = await Promise.all([ + api.multiCall({ abi: abi.stakingToken, calls: farmingPools.map(x => x[1])}), + api.multiCall({ abi: 'erc20:balanceOf', calls: farmingPools.map(x => ({target: x[1], params:[x[0]]}))}), + api.multiCall({ abi: abi.rewardsToken, calls: farmingPools.map(x => x[1])}), + api.multiCall({ abi: abi.farmed, calls: farmingPools.map(x => ({target: x[1], params: [x[0]]}))}) + ]) + + const [underlyingTokens, underlyingBalances] = await Promise.all([ + api.multiCall({ abi: 'address:asset', calls: stakingTokens}), + api.multiCall({ abi: abi.convertToAssets, calls: stakingTokens.map((x, i) => ({target: x, params: [stakingTokenBalances[i]]}))}) + ]) + + rewardTokens.forEach((rewardToken, i) => { + api.addToken(rewardToken, farmed[i]) + }) + underlyingTokens.forEach((underlyingToken, i) => { + api.addToken(underlyingToken, underlyingBalances[i]) + }) +} + +async function processLlamaPayTvl(llamaPayRouters, api) { + if (llamaPayRouters.length === 0) return + + const llamaPayInfos = await api.multiCall({ abi: abi.llamaPayInfoList, calls: llamaPayRouters.map(x => ({target: x})) }) + + const [llamaPayTokens, decimalDivisors, llamaPayBalances] = await Promise.all([ + api.multiCall({abi: abi.token, calls: llamaPayInfos.flatMap(x => x.map(y => y[0]))}), + api.multiCall({abi: abi.DECIMALS_DIVISOR, calls: llamaPayInfos.flatMap(x => x.map(y => y[0]))}), + api.multiCall({abi: abi.balances, calls: llamaPayInfos.flatMap((v, i) => v.map(y => ({target: y[0], params:[llamaPayRouters[i]]})))}) + ]) + + llamaPayTokens.forEach((token, i) => { + api.addToken(token, BigInt(llamaPayBalances[i]) / BigInt(decimalDivisors[i])) + }) } async function processCompoundTvl(compoundVaults, api, COMETS, vaults, COMET_REWARD) { - if (compoundVaults.length) { - const numAssets = await api.multiCall({ abi: 'uint8:numAssets', calls: COMETS.map(x => x.address) }); - - - const collateralCalls = []; - COMETS.forEach((comet, i) => [...Array(parseInt(numAssets[i])).keys()].forEach(assetIndex => collateralCalls.push({ target: comet.address, params: assetIndex }))); - const balanceOfCalls = []; - vaults.forEach(vault => COMETS.forEach(comet => balanceOfCalls.push({ target: comet.address, params: vault, baseToken: comet.baseToken }))); - const rewardOwedCalls = []; - vaults.forEach(vault => COMETS.forEach(comet => rewardOwedCalls.push({ target: COMET_REWARD, params: [comet.address, vault] }))); - - const [collateralInfos, balanceOfs, borrowBalanceOfs, rewardOwed] = await Promise.all([ - api.multiCall({ abi: abi.getAssetInfo, calls: collateralCalls }), - api.multiCall({ abi: 'erc20:balanceOf', calls: balanceOfCalls }), - api.multiCall({ abi: abi.borrowBalanceOf, calls: balanceOfCalls }), - api.multiCall({ abi: abi.getRewardOwed, calls: rewardOwedCalls }) - ]); - - balanceOfs.forEach((balance, i) => { - const sum = (BigInt(balance) - BigInt(borrowBalanceOfs[i])).toString(); - api.addToken(balanceOfCalls[i].baseToken, sum); - }); - - rewardOwed.forEach(reward => { - api.addToken(reward.token, reward.owed); - }); - - const collateralBalanceOfCalls = []; - vaults.forEach(vault => collateralInfos.forEach((collateral, i) => collateralBalanceOfCalls.push({ target: collateralCalls[i].target, params: [vault, collateral.asset] }))); - const collateralBalanceOfs = await api.multiCall({ abi: abi.collateralBalanceOf, calls: collateralBalanceOfCalls }); - - collateralBalanceOfs.forEach((balance, i) => { - api.addToken(collateralBalanceOfCalls[i].params[1], balance); - }); - } + if (compoundVaults.length === 0 || !COMETS || !COMET_REWARD) return + + const numAssets = await api.multiCall({ abi: 'uint8:numAssets', calls: COMETS.map(x => x.address) }); + + + const collateralCalls = []; + COMETS.forEach((comet, i) => [...Array(parseInt(numAssets[i])).keys()].forEach(assetIndex => collateralCalls.push({ target: comet.address, params: assetIndex }))); + const balanceOfCalls = []; + vaults.forEach(vault => COMETS.forEach(comet => balanceOfCalls.push({ target: comet.address, params: vault, baseToken: comet.baseToken }))); + const rewardOwedCalls = []; + vaults.forEach(vault => COMETS.forEach(comet => rewardOwedCalls.push({ target: COMET_REWARD, params: [comet.address, vault] }))); + + const [collateralInfos, balanceOfs, borrowBalanceOfs, rewardOwed] = await Promise.all([ + api.multiCall({ abi: abi.getAssetInfo, calls: collateralCalls }), + api.multiCall({ abi: 'erc20:balanceOf', calls: balanceOfCalls }), + api.multiCall({ abi: abi.borrowBalanceOf, calls: balanceOfCalls }), + api.multiCall({ abi: abi.getRewardOwed, calls: rewardOwedCalls }) + ]); + + balanceOfs.forEach((balance, i) => { + const sum = (BigInt(balance) - BigInt(borrowBalanceOfs[i])).toString(); + api.addToken(balanceOfCalls[i].baseToken, sum); + }); + + rewardOwed.forEach(reward => { + api.addToken(reward.token, reward.owed); + }); + + const collateralBalanceOfCalls = []; + vaults.forEach(vault => collateralInfos.forEach((collateral, i) => collateralBalanceOfCalls.push({ target: collateralCalls[i].target, params: [vault, collateral.asset] }))); + const collateralBalanceOfs = await api.multiCall({ abi: abi.collateralBalanceOf, calls: collateralBalanceOfCalls }); + + collateralBalanceOfs.forEach((balance, i) => { + api.addToken(collateralBalanceOfCalls[i].params[1], balance); + }); } async function processAaveTvl(aaveVaults, api, AAVE_POOL, AAVE_POOL_DATA_PROVIDER) { - if (aaveVaults.length) { - const aaveReservesList = await api.call({ abi: abi.getReservesList, target: AAVE_POOL }); + if (aaveVaults.length === 0 || !AAVE_POOL || !AAVE_POOL_DATA_PROVIDER) return - const aaveReserveDetails = await api.multiCall({ abi: abi.getReserveData, target: AAVE_POOL, calls: aaveReservesList }); + const aaveReservesList = await api.call({ abi: abi.getReservesList, target: AAVE_POOL }); - const aaveQueryParams = []; - aaveReservesList.forEach(asset => aaveVaults.forEach(vault => aaveQueryParams.push({ params: [asset, vault], }))); - const aavePositions = await api.multiCall({ abi: abi.getUserReserveData, target: AAVE_POOL_DATA_PROVIDER, calls: aaveQueryParams }); + const aaveReserveDetails = await api.multiCall({ abi: abi.getReserveData, target: AAVE_POOL, calls: aaveReservesList }); - for (const i in aavePositions) { - const aavePosition = aavePositions[i]; - const reserveIdx = aaveReservesList.findIndex(x => x === aaveQueryParams[i].params[0]); + const aaveQueryParams = []; + aaveReservesList.forEach(asset => aaveVaults.forEach(vault => aaveQueryParams.push({ params: [asset, vault], }))); + const aavePositions = await api.multiCall({ abi: abi.getUserReserveData, target: AAVE_POOL_DATA_PROVIDER, calls: aaveQueryParams }); - api.addToken(aaveReserveDetails[reserveIdx].aTokenAddress, aavePosition.currentATokenBalance); - api.addToken(aaveReserveDetails[reserveIdx].stableDebtTokenAddress, aavePosition.currentStableDebt); - api.addToken(aaveReserveDetails[reserveIdx].variableDebtTokenAddress, aavePosition.currentVariableDebt); - } + for (const i in aavePositions) { + const aavePosition = aavePositions[i]; + const reserveIdx = aaveReservesList.findIndex(x => x === aaveQueryParams[i].params[0]); + + api.addToken(aaveReserveDetails[reserveIdx].aTokenAddress, aavePosition.currentATokenBalance); + api.addToken(aaveReserveDetails[reserveIdx].stableDebtTokenAddress, aavePosition.currentStableDebt); + api.addToken(aaveReserveDetails[reserveIdx].variableDebtTokenAddress, aavePosition.currentVariableDebt); } + } const abi = { @@ -286,5 +361,21 @@ const abi = { "getReservesList": "address[]:getReservesList", "getAssetInfo": "function getAssetInfo(uint8 i) view returns ((uint8 offset, address asset, address priceFeed, uint64 scale, uint64 borrowCollateralFactor, uint64 liquidateCollateralFactor, uint64 liquidationFactor, uint128 supplyCap))", "borrowBalanceOf": "function borrowBalanceOf(address account) view returns (uint256)", - "getRewardOwed": "function getRewardOwed(address comet, address account) returns ((address token, uint256 owed))" + "getRewardOwed": "function getRewardOwed(address comet, address account) returns ((address token, uint256 owed))", + "llamaPayCount": "function llamaPayCount() returns (uint256 count)", + "llamaPayInfoList": "function llamaPayInfoList() returns ((address llamapay, address priceFeed, bool invertPrice)[])", + "token": "function token() returns (address token)", + "balances": "function balances(address) returns (uint256)", + "DECIMALS_DIVISOR": "function DECIMALS_DIVISOR() returns (uint256)", + "stakingToken": "function stakingToken() returns (address)", + "rewardsToken": "function rewardsToken() returns (address)", + "farmed": "function farmed(address) returns (uint256)", + "totalUnderlying": "function totalUnderlying(address) returns (uint256 totalAmount0, uint256 totalAmount1)", + "token0": "function token0() returns (address)", + "token1": "function token1() returns (address)", + "stakerStrategyShares": "function stakerStrategyShares(address,address) returns (uint256)", + "strategy": "function stakerStrategyShares() returns (address)", + "underlyingToken": "function underlyingToken() returns (address)", + "sharesToUnderlyingView": "function sharesToUnderlyingView(uint256) returns (uint256)", + "queuedWithdrawals": "function queuedWithdrawals(uint256) returns (bytes32 root, uint256 shares)" } \ No newline at end of file diff --git a/projects/aevo-xyz/index.js b/projects/aevo-xyz/index.js index 5b2b9a5faefb..72df3d5d87d5 100644 --- a/projects/aevo-xyz/index.js +++ b/projects/aevo-xyz/index.js @@ -42,7 +42,25 @@ module.exports = { '0x7809621a6D7e61E400853C64b61568aA773A28Ef', // Native USDC '0x5c7Dd6cb73d93879E94F20d103804C495A10aE7e', // WETH ], - fetchCoValentTokens: true, + tokens: [ + ADDRESSES.optimism.USDC, + ADDRESSES.optimism.USDT, + ADDRESSES.optimism.WETH_1, + ADDRESSES.optimism.USDC_CIRCLE + ] }) }, + base: { + tvl: sumTokensExport({ + owners: [ + '0x6ee3907D1B9423584195979812379143B327fb48', // Native USDC + '0xA8bD0eCb10a83CC6E14FC5381f384DD3C0779e8B', // WETH + ], + tokens: [ + ADDRESSES.base.USDC, + ADDRESSES.base.USDbC, + ADDRESSES.base.WETH, + ] + }) + } } diff --git a/projects/affine-defi-liquid/index.js b/projects/affine-defi-liquid/index.js index 694da7fc8c76..24ad3ae987a4 100644 --- a/projects/affine-defi-liquid/index.js +++ b/projects/affine-defi-liquid/index.js @@ -1,14 +1,31 @@ const { sumERC4626VaultsExport } = require('../helper/erc4626') +// LINEA +const LINEA_VAULT = "0xB838Eb4F224c2454F2529213721500faf732bf4d" + +async function addL2TVL(api, target) { + const tokens = await api.call({abi: 'erc20:totalSupply', target: target}) + const sharePrice = await api.call({abi: 'uint256:sharePrice', target: target}) + const decimals = await api.call({abi: 'uint256:decimals', target: target}) + + // Convert to human-readable format + const totalInEth = tokens * sharePrice / 10 ** decimals + + api.addGasToken(totalInEth) +} + module.exports = { doublecounted: true, ethereum: { tvl: sumERC4626VaultsExport({ vaults: [ - '0x0D53bc2BA508dFdf47084d511F13Bb2eb3f8317B', - '0x47657094e3AF11c47d5eF4D3598A1536B394EEc4', + '0xcbC632833687DacDcc7DfaC96F6c5989381f4B47', + '0xF0a949B935e367A94cDFe0F2A54892C2BC7b2131', ], isOG4626: true, }), }, -} \ No newline at end of file + linea: { + tvl: async (api) => await addL2TVL(api, LINEA_VAULT) + }, +} diff --git a/projects/agile/index.js b/projects/agile/index.js index 49d534e3ce6f..f639ee263960 100644 --- a/projects/agile/index.js +++ b/projects/agile/index.js @@ -1,16 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports, } = require('../helper/compound') const sdk = require('@defillama/sdk') const { getUniTVL } = require("../helper/unknownTokens"); const unitroller = '0x643dc7C5105d1a3147Bd9524DFC3c5831a373F1e' -const lendingMarket = compoundExports(unitroller, "cronos", "0x2e909694B362c2FcA3C8168613bd47842245504B", "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", undefined, undefined, { +const lendingMarket = compoundExports(unitroller, "0x2e909694B362c2FcA3C8168613bd47842245504B", ADDRESSES.cronos.WCRO_1, { blacklistedTokens: [ '0xa4434afeae0decb9820d906bf01b13291d00651a', ] }) module.exports = { + deadFrom: '2022-06-28', methodology: "Liquidity on DEX and supplied and borrowed amounts found using the unitroller address(0x643dc7C5105d1a3147Bd9524DFC3c5831a373F1e)", cronos: { //staking: stakingPricedLP("0x37619cC85325aFea778830e184CB60a3ABc9210B", "0x9A92B5EBf1F6F6f7d93696FCD44e5Cf75035A756", "moonriver", "0xbBe2f34367972Cb37ae8dea849aE168834440685", "moonriver"), @@ -23,4 +25,6 @@ module.exports = { ]), borrowed: lendingMarket.borrowed } -} \ No newline at end of file +} + +module.exports.cronos.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/agora/index.js b/projects/agora/index.js index 60c8624464af..5a5a0e902baf 100644 --- a/projects/agora/index.js +++ b/projects/agora/index.js @@ -1,43 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { compoundExports, methodology, } = require("../helper/compound"); const { getUniTVL } = require('../helper/unknownTokens') const factory = '0x3c4063B964B1b3bF229315fCc4df61a694B0aE84' -const metis = ADDRESSES.metis.Metis -const agora = '0x0Ed0Ca6872073E02cd3aE005BaF04bA43BE947fA' -const { tvl: agoraTvl, } = compoundExports( - "0x3fe29D7412aCDade27e21f55a65a7ddcCE23d9B3", - "metis", - "0xcFd482DcE13cA1d27834D381AF1b570E9E6C6810", - metis, -); - -const { tvl: agoraPlusTvl, } = compoundExports( - "0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da", - "metis", - "0xE85A1ae1A2A21135c49ADEd398D3FD5Ed032B28e", - metis, - undefined, - symbol => symbol.indexOf('appuffNetswap') > -1 -); - -const { tvl: agoraStakeTvl, } = compoundExports( - "0xb36DF0773AbD23081516F54f9dbB9a99Ec27dbB0", - "metis", - "0xc3034143816398d37Ec9447c9CA17c407e96Dc12", - metis, - undefined, -); - -const { tvl: agoraFarmTvl, } = compoundExports( - "0xEC1A06f320E6e295Ab6892BB4e0f9e29c712F11F", - "metis", - "0x13Cb104a1D94A89a260b27DfAAB07C862da622E5", - metis, - undefined, -); +const { tvl: agoraTvl, } = compoundExports("0x3fe29D7412aCDade27e21f55a65a7ddcCE23d9B3", "0xcFd482DcE13cA1d27834D381AF1b570E9E6C6810",); +const { tvl: agoraPlusTvl, } = compoundExports("0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da", "0xE85A1ae1A2A21135c49ADEd398D3FD5Ed032B28e",); +const { tvl: agoraStakeTvl, } = compoundExports("0xb36DF0773AbD23081516F54f9dbB9a99Ec27dbB0", "0xc3034143816398d37Ec9447c9CA17c407e96Dc12",); +const { tvl: agoraFarmTvl, } = compoundExports("0xEC1A06f320E6e295Ab6892BB4e0f9e29c712F11F", "0x13Cb104a1D94A89a260b27DfAAB07C862da622E5",); const chainTvl = getUniTVL({ factory, useDefaultCoreAssets: true, }) @@ -49,6 +19,6 @@ module.exports = { misrepresentedTokens: true, metis: { tvl: sdk.util.sumChainTvls([chainTvl, agoraTvl, agoraPlusTvl, agoraFarmTvl, agoraStakeTvl]), - borrowed: ()=>({}), + borrowed: () => ({}), }, }; diff --git a/projects/agus/index.js b/projects/agus/index.js index 66d9c57c49f5..dfb8d1e49a72 100644 --- a/projects/agus/index.js +++ b/projects/agus/index.js @@ -3,9 +3,9 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, bsc: { - tvl: getUniTVL({ factory: '0x1aEa6414e7F7A9581Ce53385b2902c59b34D4a94', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x1aEa6414e7F7A9581Ce53385b2902c59b34D4a94', useDefaultCoreAssets: true,}), }, core: { - tvl: getUniTVL({ factory: '0x1aEa6414e7F7A9581Ce53385b2902c59b34D4a94', useDefaultCoreAssets: true, fetchBalances: true, }) + tvl: getUniTVL({ factory: '0x1aEa6414e7F7A9581Ce53385b2902c59b34D4a94', useDefaultCoreAssets: true,}) }, }; diff --git a/projects/ainn-layer2/index.js b/projects/ainn-layer2/index.js index 1c5871701fb2..e14235bbff3f 100644 --- a/projects/ainn-layer2/index.js +++ b/projects/ainn-layer2/index.js @@ -1,34 +1,13 @@ const sdk = require('@defillama/sdk'); const { sumTokensExport } = require('../helper/sumTokens'); - -const BTCOwners = [ - "bc1q6dtp7ayaj5k2zv0z5ayhkdsvmtvdqgyaa9zs53", - "3H8cmLndtkBs7kiHByhHAddTzy8taUwYPt", - "bc1pepsapf26n8y2f4uftlmhy60ksghx6rqlxdcj4uacfqrkcg6pmncs52rzuu", - "bc1qcmmkxfp2rawrp6yx55rez9jcqdnxtam8jhu2v2d9kz46upf948wq2usauv", - "bc1qu4ru2sph5jatscx5xuf0ttka36yvuql7hl5h4c", - "1JA46eiDpfx589wawn5RvtEXgwc518QfhZ", - "bc1qaajdlp5yrj5f77wq2ndtfqnmsamvvxhpy95662zkzykn9qhvdgys580hcs", - "368vZZKUWDFZRLWMFNRJzHo1HnibNeAJir", - "33hE9Wq65kjbiLsGD1NYwwNatP6hbsZv5H", - "32GU8Jux7SbsEbaAaLUnEQmc6JemLF6BUb", - "3CP5WJ2JSLCew7SETWUe5FxpBGrekMBiwk", - "39Fvw2Ho1fEkyDsos5sNTN5iMJZKzTL526", - "3Kptt4TZZRcjuGH8ikoQ8mV1TVxq45dnuS", - "3G4sMXWAAVTvTXTksr8u9zuu7W8RKsicEz", - "335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei", - "bc1qqg3cdyadq25zn99sdprr4lgpsxg2za998eygy8", - "bc1qw4vp94e9egkaxc04qsu5z9aq5pqpku2p6pzer8", - "bc1q3q7afjarz7l6v49538qs2prffhtawf38ss85k8", - "bc1q3smt9ut40eld6tgn42sdlp9yrx98s90unqw3pl" -]; +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: "Staking tokens via AINN Layer2 Dataset counts as TVL.", bitcoin: { tvl: sdk.util.sumChainTvls([ - sumTokensExport({ owners: BTCOwners }), + sumTokensExport({ owners: bitcoinAddressBook.ainn }), ]), }, zklink: { diff --git a/projects/airdao-harbor/index.js b/projects/airdao-harbor/index.js new file mode 100644 index 000000000000..c129cf5ee5c8 --- /dev/null +++ b/projects/airdao-harbor/index.js @@ -0,0 +1,11 @@ +async function tvl(api) { + const totalStake = await api.call({ abi: 'uint256:getTotalStAmb', target: '0xBda7cf631Db4535A500ED16Dd98099C04e66F1d5' }) + api.addGasToken(totalStake) +} + +module.exports = { + methodology: `TVL counts deposits made to Harbor liquid staking on AirDAO.`, + airdao: { + tvl + } +} \ No newline at end of file diff --git a/projects/airpuff/index.js b/projects/airpuff/index.js index f2189acf5734..8c0a498dace4 100644 --- a/projects/airpuff/index.js +++ b/projects/airpuff/index.js @@ -45,22 +45,22 @@ module.exports = { tvl: async (api) => { const KUSDC = { vault: "0x4c18E80b801AA24066D8B1C6E65ee245497Cb741", - token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + token: ADDRESSES.karak.USDC, }; const KWETH = { vault: "0x9a9631F7BEcE5C6E0aBA1f73f0e5796c534dc4db", - token: "0x4200000000000000000000000000000000000006", + token: ADDRESSES.optimism.WETH_1, }; const wethLending = { vault: "0xd6034F9147CF7528e857403Dea93bc45743295eb", - token: "0x4200000000000000000000000000000000000006", + token: ADDRESSES.optimism.WETH_1, }; const usdcLending = { vault: "0x475820E4bCE0E3d233Ad7f6A8c9DD1f66974c5d6", - token: "0xa415021bC5c4C3b5B989116DC35Ae95D9C962c8D", + token: ADDRESSES.karak.USDC, }; const KarakUSDCBal = await api.call({ target: KUSDC.vault, abi: contractAbis.getTotalSupply }); @@ -222,8 +222,12 @@ module.exports = { reStakingToken: "0xeA1A6307D9b18F8d1cbf1c3Dd6aad8416C06a221", oracle: "0xb09cbB6Aa95A004F9aeE4349DF431aF5ad03ECe4", }; + + tokensAndOwners.push([eETH.reStakingToken, eETH.vault]); + + // leverage users const ezETH = { vault: "0x32a0ce2bDfc37eE606aB905b4f9fC286049A774f", @@ -334,6 +338,11 @@ module.exports = { pendleAddress: "0xb05cabcd99cf9a73b19805edefc5f67ca5d1895e", }; + const bptrswETH1x2 = { + vault: "0x76338fca82925Fe2Df2C4F2c6e9545247617C634", + pendleAddress: "0x7bAf258049cc8B9A78097723dc19a8b103D4098F" + }; + //new 1x strats on pendle v2 //PT Tensorplex Staked TAO 27JUN2024 (PT-stTAO-...) @@ -388,6 +397,7 @@ module.exports = { bptzrsETH1x, bptzUSDe1x, bptrswETH1x, + bptrswETH1x2, pTEzETHDEC30, ].map((i) => [i.pendleAddress, i.vault]); tokensAndOwners.push(...tokensAndOwners2); diff --git a/projects/akronswap/index.js b/projects/akronswap/index.js index fea9a6e6afa7..b309ff858954 100644 --- a/projects/akronswap/index.js +++ b/projects/akronswap/index.js @@ -1,17 +1,11 @@ const { getUniTVL } = require('../helper/unknownTokens'); - + +const tvl = getUniTVL({ factory: '0xAf39606bec181887951Ab6912Ac7EA216Bd6E4B4', useDefaultCoreAssets: true, }) + 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, }), - }, + ethereum: { tvl, }, + arbitrum: { tvl, }, + base: { tvl, }, + bsc: { tvl, }, } \ No newline at end of file diff --git a/projects/alcor/index.js b/projects/alcor/index.js index 3ef74175e374..b8b614282e8b 100644 --- a/projects/alcor/index.js +++ b/projects/alcor/index.js @@ -14,12 +14,13 @@ async function eos() { // Alcor // https://wax.alcor.exchange async function wax() { - const accounts = ["swap.alcor", "alcordexmain"]; + const accounts = ["swap.alcor", "alcordexmain", "liquid.alcor"]; const tokens = [ ["eosio.token", "WAX", "wax"], ["alien.worlds", "TLM", "alien-worlds"], ["token.rfox", "USD", "redfox-labs"], ["usdt.alcor", "USDT", "usdt-alcor"], + ["token.fusion", "LSWAX", "waxfusion-staked-wax"], ]; return await get_account_tvl(accounts, tokens, "wax"); } diff --git a/projects/alephium-bridge/index.js b/projects/alephium-bridge/index.js index 884308d9e0e8..4fc07c5cdc33 100644 --- a/projects/alephium-bridge/index.js +++ b/projects/alephium-bridge/index.js @@ -2,26 +2,42 @@ const sdk = require("@defillama/sdk"); const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs'); -const tokenBridgeAddress = '0x579a3bde631c3d8068cbfe3dc45b0f14ec18dd43' -const bridgedAlphAddress = '0x590f820444fa3638e022776752c5eef34e2f89a6' +const ethTokenBridgeAddress = '0x579a3bde631c3d8068cbfe3dc45b0f14ec18dd43' +const ethBridgedAlphAddress = '0x590f820444fa3638e022776752c5eef34e2f89a6' +const bscTokenBridgeAddress = '0x2971F580C34d3D584e0342741c6a622f69424dD8' +const bscBridgedAlphAddress = '0x8683BA2F8b0f69b2105f26f488bADe1d3AB4dec8' -async function tvl(ts, block) { - const totalBridgedAlphSupply = await sdk.api.erc20.totalSupply({ target: bridgedAlphAddress, block }) - return { - alephium: totalBridgedAlphSupply.output / 1e18, - } +async function tvl(api) { + const ethApi = new sdk.ChainApi({ chain: 'ethereum', timestamp: api.timestamp }) + const bscApi = new sdk.ChainApi({ chain: 'bsc', timestamp: api.timestamp }) + await ethApi.getBlock() + await bscApi.getBlock() + const ethBal = await ethApi.call({ abi: 'erc20:totalSupply', target: ethBridgedAlphAddress }) + const bscBal = await bscApi.call({ abi: 'erc20:totalSupply', target: bscBridgedAlphAddress }) + api.addCGToken('alephium', (+ethBal + +bscBal) / 1e18) } module.exports = { - methodology: "Tracks funds locked in the Alephium Bridge Token contracts on Ethereum", + methodology: "Tracks funds locked in the Alephium Bridge Token contracts on Ethereum and Binance Smart Chain", ethereum: { - tvl: sumTokensExport({ owner: tokenBridgeAddress, tokens: [ - ADDRESSES.ethereum.WETH, - ADDRESSES.ethereum.USDT, - ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.WBTC, - ADDRESSES.ethereum.DAI - ] }), + tvl: sumTokensExport({ + owner: ethTokenBridgeAddress, tokens: [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.DAI + ] + }), + }, + bsc: { + tvl: sumTokensExport({ + owner: bscTokenBridgeAddress, tokens: [ + ADDRESSES.bsc.WBNB, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.USDT + ] + }), }, alephium: { tvl diff --git a/projects/alexar/index.js b/projects/alexar/index.js index f35001a02d13..f904f2c2686b 100644 --- a/projects/alexar/index.js +++ b/projects/alexar/index.js @@ -10,12 +10,17 @@ const chainMapping = { bsc: 'binance' }; -const chainListSupply = ['juno', 'cosmos', 'comdex', 'carbon', 'crescent', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; +const blackListChains = ['comdex', 'crescent']; +const chainListSupply = ['juno', 'cosmos', 'carbon', 'injective', 'kujira', 'osmosis', 'persistence', 'stargaze', 'secret', 'stargaze', 'umee', 'evmos', 'terra2']; const chainListTotal = ['avax', 'bsc', 'moonbeam', 'polygon', 'fantom', 'arbitrum', 'aurora', 'celo', 'kava', 'mantle', 'ethereum', 'base']; chainListSupply.concat(chainListTotal).forEach(chain => { - module.exports[chain] = { tvl }; + if (blackListChains.includes(chain)) { + module.exports[chain] = { tvl: () => ({}) }; + } else { + module.exports[chain] = { tvl }; + } async function tvl(api) { const config = await getConfig('alexar', 'https://api.axelarscan.io/api/getTVL') const tokensAndOwners = [] diff --git a/projects/alexlab/api.js b/projects/alexlab/api.js new file mode 100644 index 000000000000..539871663ad8 --- /dev/null +++ b/projects/alexlab/api.js @@ -0,0 +1,110 @@ +const { call } = require('../helper/chain/stacks-api') +const { getCache, setCache } = require('../helper/cache') +const { sleep } = require('../helper/utils') +const sdk = require('@defillama/sdk') + +const factory = 'SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.amm-pool-v2-01' + +async function tvl(api) { + // https://docs.alexgo.io/developers/smart-contracts + + + // get simple weight pool data + const simpleWeightAMM = 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.simple-weight-pool-alex' + let { value: swPools } = await call({ target: simpleWeightAMM, abi: 'get-pools' }) + swPools = swPools.map(i => i.value) + for (const { value: pool } of swPools) { + const inputArgs = ['token-x', 'token-y'].map(key => pool[key]) + const { value: poolData } = await call({ target: simpleWeightAMM, abi: 'get-pool-details', inputArgs }) + api.add(pool['token-x'].value, poolData['balance-x'].value) + api.add(pool['token-y'].value, poolData['balance-y'].value) + await sleep(2100) + } + + + + // get fixed weight pool data + const fixedWeightAMM = 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.fixed-weight-pool-v1-01' + let { value: fwPools } = await call({ target: fixedWeightAMM, abi: 'get-pools' }) + fwPools = fwPools.map(i => i.value) + for (const { value: pool } of fwPools) { + const inputArgs = ['token-x', 'token-y', 'weight-x', 'weight-y'].map(key => pool[key]) + const { value: poolData } = await call({ target: fixedWeightAMM, abi: 'get-pool-details', inputArgs }) + api.add(pool['token-x'].value, poolData['balance-x'].value) + api.add(pool['token-y'].value, poolData['balance-y'].value) + await sleep(2100) + } + + + + // update cache for amm v2 pools & token metadata + const cache = await getCache('alex/ammv2', 'stacks') + if (!cache.pairData) cache.pairData = [] + if (!cache.tokenMetadata) cache.tokenMetadata = {} + const currentPairCount = cache.pairData.length + let hasMorePairs = true + let i = currentPairCount + 1 + do { + try { + const pairData = await call({ target: factory, abi: 'get-pool-details-by-id', inputArgs: [{ type: 'number', value: i }] }) + if (!pairData.value?.factor) hasMorePairs = false + else + cache.pairData.push(pairData.value) + i++ + await sleep(2100) + } catch (e) { + sdk.log('error fetching pair data', e) + hasMorePairs = false + } + } while (hasMorePairs) + let cacheNeedsUpdate = cache.pairData.length > currentPairCount + const tokenSet = new Set(cache.pairData.flatMap(pair => [pair['token-x'], pair['token-y']]).map(token => token.value) + .filter(token => !cache.tokenMetadata[token]) + ) + const tokensMissingMetadata = Array.from(tokenSet) + if (tokensMissingMetadata.length > 0) { + cacheNeedsUpdate = true + for (const token of tokensMissingMetadata) { + try { + const decimals = await call({ target: token, abi: 'get-decimals' }) + const symbol = await call({ target: token, abi: 'get-symbol' }) + let baseToken = {} + let baseDecimals = {} + let baseSymbol = {} + try { + baseDecimals = await call({ target: token, abi: 'get-base-decimals' }) + baseToken = await call({ target: token, abi: 'get-base-token' }) + if (typeof baseToken === 'string') baseToken = { value: baseToken } + if (baseToken.value) { + baseSymbol = await call({ target: baseToken.value, abi: 'get-symbol' }) + } + } catch (e) { + // sdk.log('error fetching base token metadata', e) + } + cache.tokenMetadata[token] = { decimals: decimals.value, symbol: symbol.value, baseToken: baseToken.value, baseDecimals: baseDecimals.value, baseSymbol: baseSymbol.value } + await sleep(2100) + } catch (e) { + sdk.log('error fetching token metadata', e) + } + } + } + + api.log('pair count', cache.pairData.length) + if (cacheNeedsUpdate) + await setCache('alex/ammv2', 'stacks', cache) + + + + // add amm v2 tvl + for (const pair of cache.pairData) { + const { value: bals } = await call({ target: factory, abi: 'get-balances', inputArgs: [pair['token-x'], pair['token-y'], pair.factor] }) + api.add(pair['token-x'].value, bals['balance-x'].value) + api.add(pair['token-y'].value, bals['balance-y'].value) + await sleep(600) + } + return api.getBalances() +} + +module.exports = { + stacks: { tvl } +} \ No newline at end of file diff --git a/projects/alexlab/index.js b/projects/alexlab/index.js index 523b6f815f2e..a723011104df 100644 --- a/projects/alexlab/index.js +++ b/projects/alexlab/index.js @@ -4,41 +4,16 @@ const { get } = require('../helper/http') // https://stacks-node-api.blockstack.org/extended/v1/address/SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.alex-vault/balances const ALEX_API = "https://api.alexlab.co/v1"; -async function fetch() { - const url = `${ALEX_API}/pool_token_stats`; - const alexStatsResponse = await get(url) - - const valueLockedMap = {}; - let totalValueLocked = 0; - for (const pool of alexStatsResponse) { - let poolValue = 0; - const poolToken = pool.pool_token; - - if (poolToken == "age000-governance-token") { - poolValue = pool.price * pool.reserved_balance; - } else { - poolValue = pool.price * pool.total_supply; - } - totalValueLocked += poolValue; - valueLockedMap[poolToken] = poolValue; - } - - return { tether: totalValueLocked }; -} - async function staking() { const url = `${ALEX_API}/stats/tvl`; const alexResponse = await get(url) return { tether: alexResponse.reserve_pool_value }; } +const { getExports } = require('../helper/heroku-api') -// node test.js projects/alexlab/index.js module.exports = { - misrepresentedTokens: true, timetravel: false, - stacks: { - tvl: fetch, - staking, - }, - methodology: "Alex Lab TVL is sum of tokens locked in ALEX platform.", -}; + ...getExports("alexlab", ['stacks']), +} + +module.exports.stacks.staking = staking diff --git a/projects/alienbase-v3/index.js b/projects/alienbase-v3/index.js index 8240ecdc52e7..84e9b10caa55 100644 --- a/projects/alienbase-v3/index.js +++ b/projects/alienbase-v3/index.js @@ -2,5 +2,5 @@ const { uniV3Export } = require('../helper/uniswapV3') const factory = '0x0Fd83557b2be93617c9C1C1B6fd549401C74558C' module.exports = uniV3Export({ - base: { factory, fromBlock: 7150708, }, + base: { factory, fromBlock: 7150708, permitFailure: true }, }) diff --git a/projects/alienworlds/index.js b/projects/alienworlds/index.js new file mode 100644 index 000000000000..d5c46289a0d0 --- /dev/null +++ b/projects/alienworlds/index.js @@ -0,0 +1,26 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +const accounts = ["nftmt.worlds", "stake.worlds", "lore.worlds", "arena.worlds", "boost.worlds"] + +// AlienWorlds +// https://alienworlds.io/ +async function wax() { + const tokens = [ + ["eosio.token", "WAX", "wax"], + ]; + return await get_account_tvl(accounts, tokens, "wax"); +} +async function staking() { + const tokens = [ + ["alien.worlds", "TLM", "alien-worlds"], + ]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +module.exports = { + methodology: `AlienWorlds TVL is achieved by querying token balances from Staking, Voting & Gaming smart contract(s).`, + wax: { + tvl: wax, + staking, + }, +} diff --git a/projects/allo/index.js b/projects/allo/index.js new file mode 100644 index 000000000000..51a9d7ca8408 --- /dev/null +++ b/projects/allo/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/sumTokens"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + + +module.exports = { + methodology: `Total amount of BTC in restaked on babylon`, + doublecounted:true, + bitcoin: { + tvl: sumTokensExport({ owners: bitcoinAddressBook.allo }), + }, +}; diff --git a/projects/allstake/index.js b/projects/allstake/index.js index a685108ede54..bb58a5242c89 100644 --- a/projects/allstake/index.js +++ b/projects/allstake/index.js @@ -1,12 +1,20 @@ const { getUniqueAddresses } = require('../helper/utils'); const { call, sumTokens } = require('../helper/chain/near'); const { sumTokens2, getProvider } = require('../helper/solana'); +const { sumTokens2: evmSumTokens2 } = require("../helper/unwrapLPs") 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'); +const ALLSTAKE_ETHEREUM_STRATEGY_MANAGER_CONTRACT = '0x344F8B88357A710937f2b3db9d1B974B9a002afB'; + +async function ethereumTvl(api) { + const strategies = await api.fetchList({ lengthAbi: 'strategiesLen', itemAbi: 'strategies', target: ALLSTAKE_ETHEREUM_STRATEGY_MANAGER_CONTRACT}) + const tokens = await api.multiCall({ abi: 'address:underlying', calls: strategies }); + return evmSumTokens2({ api, tokensAndOwners2: [tokens, strategies] }); +} async function nearTvl() { const strategies = await call(ALLSTAKE_NEAR_CONTRACT, 'get_strategies', {}); @@ -51,6 +59,9 @@ module.exports = { solana: { tvl: solanaTvl, }, + ethereum: { + tvl: ethereumTvl, + }, timetravel: false, methodology: 'Summed up all the tokens deposited in the contract', } diff --git a/projects/alpaca-finance/ausd.js b/projects/alpaca-finance/ausd.js index 9c96cb515dc1..fbc4fbd119ad 100644 --- a/projects/alpaca-finance/ausd.js +++ b/projects/alpaca-finance/ausd.js @@ -1,6 +1,4 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); const { getConfig } = require('../helper/cache') async function getProcolAUSDAddresses(chain) { @@ -30,70 +28,31 @@ async function getProcolLYFAddresses(chain) { } } -async function calAusdTvl(chain, block) { - /// @dev Initialized variables - const balances = {}; +async function calAusdTvl(api) { + const chain = api.chain; const ausdAddresses = await getProcolAUSDAddresses(chain); const lyfAddresses = await getProcolLYFAddresses(chain); - - const pids = await sdk.api.abi.multiCall({ - block, - abi: abi.pid, - calls: ausdAddresses["IbTokenAdapters"].map((each) => { - return { - target: each.address, - }; - }), - chain, - }); - const failaunchUserInfos = await sdk.api.abi.multiCall({ - block, + const ibTokens = ausdAddresses["IbTokenAdapters"].map((i) => i.address) + const pids = await api.multiCall({ abi: abi.pid, calls: ibTokens }); + const failaunchUserInfos = await api.multiCall({ abi: abi.userInfo, - calls: pids.output.map((each) => { - return { - target: lyfAddresses["FairLaunch"].address, - params: [each.output, each.input.target], - }; - }), - chain, - }); - const totalTokens = await sdk.api.abi.multiCall({ - block, - abi: abi.totalToken, - calls: ausdAddresses["IbTokenAdapters"].map((each) => { + target: lyfAddresses["FairLaunch"].address, + calls: pids.map((each, i) => { return { - target: each.collateralToken, + params: [each, ibTokens[i]], }; }), - chain, }); - const totalSupplys = await sdk.api.abi.multiCall({ - block, - abi: abi.totalSupply, - calls: ausdAddresses["IbTokenAdapters"].map((each) => { - return { - target: each.collateralToken, - }; - }), - chain, - }); - const vaultTokens = await sdk.api.abi.multiCall({ - block, - abi: abi.token, - calls: ausdAddresses["IbTokenAdapters"].map((each) => { - return { - target: each.collateralToken, - }; - }), - chain, - }); - - failaunchUserInfos.output.forEach((eachUserInfo, i) => { - const balance = new BigNumber(eachUserInfo.output.amount).multipliedBy(totalTokens.output[i].output).dividedBy(totalSupplys.output[i].output) - balances[`${chain}:${vaultTokens.output[i].output}`] = balance.toFixed(0); + const collateralTokens = ausdAddresses.IbTokenAdapters.map((each) => each.collateralToken); + const totalTokens = await api.multiCall({ abi: abi.totalToken, calls: collateralTokens }); + const totalSupplys = await api.multiCall({ abi: abi.totalSupply, calls: collateralTokens, }); + const vaultTokens = await api.multiCall({ abi: abi.token, calls: collateralTokens, }); + + failaunchUserInfos.forEach((eachUserInfo, i) => { + api.add(vaultTokens[i], eachUserInfo.amount * totalTokens[i] / totalSupplys[i]); }) - return balances; + return api.getBalances() } module.exports = { diff --git a/projects/alpaca-finance/index.js b/projects/alpaca-finance/index.js index 81ee4eeb2658..80f4b65ae455 100644 --- a/projects/alpaca-finance/index.js +++ b/projects/alpaca-finance/index.js @@ -4,34 +4,14 @@ const { calAusdTvl } = require('./ausd'); const { calxALPACAtvl } = require('./xalpaca'); const aExports = require('../alpaca-finance-lend'); -async function bscTvl(timestamp, ethBlock, chainBlocks) { - const lyfTvl = await calLyfTvl('bsc', chainBlocks.bsc); - const ausdTvl = await calAusdTvl('bsc', chainBlocks.bsc); - return {...lyfTvl, ...ausdTvl}; -} - -async function bscStaking(timestamp, ethBlock, chainBlocks) { - return await calxALPACAtvl('bsc', chainBlocks.bsc); -} - -async function fantomTvl(timestamp, ethBlock, chainBlocks) { - const lyfTvl = await calLyfTvl('fantom', chainBlocks.fantom); - return {...lyfTvl}; -} - -async function ftmStaking(timestamp, ethBlock, chainBlocks) { - return await calxALPACAtvl('fantom', chainBlocks.fantom); -} - -// node test.js projects/alpaca-finance/index.js module.exports = { start: 1602054167, bsc: { - tvl: sdk.util.sumChainTvls([bscTvl, aExports.bsc.tvl]), - staking: bscStaking, + tvl: sdk.util.sumChainTvls([calLyfTvl, calAusdTvl, aExports.bsc.tvl]), + staking: calxALPACAtvl, }, fantom: { - tvl: sdk.util.sumChainTvls([fantomTvl, aExports.fantom.tvl]), - staking: ftmStaking, + tvl: sdk.util.sumChainTvls([calLyfTvl, aExports.fantom.tvl]), + staking: calxALPACAtvl, } }; diff --git a/projects/alpaca-finance/lyf.js b/projects/alpaca-finance/lyf.js index d448335c5779..5dd21568b9ca 100644 --- a/projects/alpaca-finance/lyf.js +++ b/projects/alpaca-finance/lyf.js @@ -1,8 +1,4 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); const { getConfig } = require('../helper/cache') -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); async function getProcolAddresses(chain) { if (chain == 'bsc') { @@ -21,121 +17,14 @@ async function getProcolAddresses(chain) { } } -async function calLyfTvl(chain, block) { - /// @dev Initialized variables - const balances = {}; - - /// @dev Getting all addresses from Github +async function calLyfTvl(api) { + const chain = api.chain; const addresses = await getProcolAddresses(chain); - - for (let i = 0; i < addresses["Vaults"].length; i++) { - /// @dev getting balances that each of workers holding - const stakingTokenInfos = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.userInfo, - calls: addresses["Vaults"][i]["workers"].filter((n) => { - /// @dev filter only workers that are working with LPs - if (n.name.includes("CakeMaxiWorker")) { - return false; - } - return true; - }).map((worker) => { - return { - target: worker["stakingTokenAt"], - params: [worker["pId"], worker["address"]], - }; - }), - chain, - }) - ).output; - - /// @dev unwrap LP to get underlaying token balances for workers that are working with LPs - await unwrapUniswapLPs( - balances, - stakingTokenInfos - .filter((n) => { - /// @dev filter only workers that are working with LPs - const name = addresses["Vaults"][i]["workers"].find( - (w) => w.address === n.input.params[1] - ).name; - if (name.includes("CakeMaxiWorker")) { - return false; - } - return true; - }) - .map((info) => { - /// @dev getting LP address and return the object that unwrapUniswapLPs want - const lpAddr = addresses["Vaults"][i]["workers"].find( - (w) => w.address === info.input.params[1] - ).stakingToken; - return { - token: lpAddr, - balance: info.output.amount, - }; - }), - block, - chain, - (addr) => `${chain}:${addr}` - ); - - /// @dev update balances directly for single-asset workers - const singleAssetWorkersInfos = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.userInfoCake, - calls: addresses["Vaults"][i]["workers"].filter((n) => { - /// @dev filter only single-asset LYF workers - return n.name.includes("CakeMaxiWorker"); - }).map((worker) => { - return { - target: worker["stakingTokenAt"], - params: [worker["address"]], - }; - }), - chain, - }) - ).output; - - const singleAssetPrice = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.singleAssetPrice, - calls: addresses["Vaults"][0]["workers"].filter((n) => { - /// @dev filter only single-asset LYF workers - return n.name.includes("CakeMaxiWorker"); - }).map((worker) => { - return { - target: worker["stakingTokenAt"], - }; - }), - chain, - }) - ).output; - - const singleAssetWorkersBalances = singleAssetWorkersInfos - .map((n) => { - /// @dev getting staking token address and return the object to be sum with balances - const stakingTokenAddr = addresses["Vaults"][i]["workers"].find( - (w) => w.address === n.input.params[0] - ).stakingToken; - return { - token: stakingTokenAddr, - balance: BigNumber(n.output.shares).multipliedBy(BigNumber(singleAssetPrice[0].output)).div(1e18), - }; - }); - - /// @dev sum single-asset balances to balances variable - singleAssetWorkersBalances.forEach((s) => { - balances[`${chain}:${s.token}`] = BigNumber( - balances[`${chain}:${s.token}`] || 0 - ) - .plus(BigNumber(s.balance)) - .toFixed(0); - }); - } - - return balances; + const vaults = addresses["Vaults"].map(i => i.address) + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:totalToken', calls: vaults}) + api.add(tokens, bals) + return api.getBalances() } module.exports = { diff --git a/projects/alpaca-finance/xalpaca.js b/projects/alpaca-finance/xalpaca.js index 490a9dd4037f..00c4de866051 100644 --- a/projects/alpaca-finance/xalpaca.js +++ b/projects/alpaca-finance/xalpaca.js @@ -1,4 +1,3 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { getConfig } = require('../helper/cache') @@ -18,25 +17,14 @@ async function getProcolXAlpacaAddresses(chain) { ) } } - -async function calxALPACAtvl(chain, block) { - const xalpacaAddresses = await getProcolXAlpacaAddresses(chain); - const xalpacaTVL = ( - await sdk.api.abi.multiCall({ - block, - abi: abi.xalpacaTotalSupply, - calls: [ - { - target: xalpacaAddresses["xALPACA"], - }, - ], - chain, - }) - ).output; +async function calxALPACAtvl(api) { + const xalpacaAddresses = await getProcolXAlpacaAddresses(api.chain); + + const xalpacaTVL = await api.call({ abi: abi.xalpacaTotalSupply, target: xalpacaAddresses["xALPACA"], }) const alpacaAddress = xalpacaAddresses["Tokens"]["ALPACA"]; - return { [`${chain}:${alpacaAddress}`]: xalpacaTVL[0].output }; + api.add(alpacaAddress, xalpacaTVL) } module.exports = { diff --git a/projects/alpha-homora/index.js b/projects/alpha-homora/index.js index d512fa9997e7..39b58dd157df 100644 --- a/projects/alpha-homora/index.js +++ b/projects/alpha-homora/index.js @@ -1,32 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require("bignumber.js"); const {tvlV1Eth, tvlV1Bsc} = require('./v1.js') const {tvlV2, tvlV2Onchain} = require('./v2.js') -async function ethTvl(timestamp, block) { - const ethAddress = ADDRESSES.null; - const balances = {}; - - const tvls = await Promise.all([ - tvlV1Eth(timestamp, block), - tvlV2(block, "ethereum", true), - ]); - - const ethTvl = BigNumber.sum(tvls[0], tvls[1]); - balances[ethAddress] = ethTvl.toFixed(0); - - return balances; -} - -async function avaxTvl(timestamp, block, chainBlocks) { - return tvlV2Onchain(chainBlocks.avax, "avax") -} - -async function fantomTvl(timestamp, block, chainBlocks) { - return tvlV2Onchain(chainBlocks.fantom, "fantom") -} -async function opTvl(timestamp, block, chainBlocks) { - return tvlV2Onchain(chainBlocks.optimism, "optimism") +async function ethTvl(api) { + await Promise.all([ + tvlV1Eth(api), + tvlV2(api), + ]) } module.exports = { @@ -39,13 +18,13 @@ module.exports = { tvl: tvlV1Bsc }, avax:{ - tvl: avaxTvl + tvl: tvlV2Onchain }, fantom:{ - tvl: fantomTvl + tvl: tvlV2Onchain }, optimism:{ - tvl: opTvl + tvl: tvlV2Onchain }, start: 1602054167, // unix timestamp (utc 0) specifying when the project began, or where live data begins hallmarks: [ diff --git a/projects/alpha-homora/v1.js b/projects/alpha-homora/v1.js index 3e8ed453dd81..77aa2b78564e 100644 --- a/projects/alpha-homora/v1.js +++ b/projects/alpha-homora/v1.js @@ -1,139 +1,35 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { getConfig } = require('../helper/cache') -const BigNumber = require("bignumber.js"); +const { getConfig } = require('../helper/cache'); +const { sumTokens2 } = require('../helper/unwrapLPs'); module.exports = { - tvlV1Eth, - tvlV1Bsc + tvlV1Eth, + tvlV1Bsc } -async function tvlV1Eth({timestamp}, block) { - const startTimestamp = 1602054167; - const startBlock = 11007158; - - if (timestamp < startTimestamp || block < startBlock) { - return BigNumber(0); - } - return tvlV1("ethereum", block, "https://homora.alphafinance.io/static/contracts.json", "WETHAddress", "totalETH") +async function tvlV1Eth(api) { + return tvlV1(api, "https://homora.alphafinance.io/static/contracts.json") } const wBNB = ADDRESSES.bsc.WBNB -async function tvlV1Bsc(timestamp, block, chainBlocks) { - const tvlBNB = await tvlV1("bsc", chainBlocks.bsc, "https://homora-bsc.alphafinance.io/static/contracts.json", "WBNBAddress", "totalBNB") - return { - ["bsc:"+wBNB]: tvlBNB.toFixed(0) - } +async function tvlV1Bsc(api) { + await tvlV1(api, "https://homora-bsc.alphafinance.io/static/contracts.json") } -async function tvlV1(chain, block, contractsUrl, wrappedBaseName, totalEthMethodName) { - const data = await getConfig('alpha-hormora/v1/'+chain, - contractsUrl - ); - - const bankAddress = data.bankAddress.toLowerCase(); - const WETHAddress = data[wrappedBaseName].toLowerCase(); - - let pools = data.pools; - - const uniswapPools = pools.filter( - (pool) => pool.id === undefined - ); - - const sushiswapPools = pools.filter( - (pool) => pool.id !== undefined - ); - pools = [...uniswapPools, ...sushiswapPools]; - - const { output: _totalETH } = await sdk.api.abi.call({ - target: bankAddress, - block, - chain, - abi: 'uint256:'+totalEthMethodName, - }); - - const totalETH = BigNumber(_totalETH); - - const { output: _totalDebt } = await sdk.api.abi.call({ - target: bankAddress, - block, - chain, - abi: abi["glbDebtVal"], - }); - - const totalDebt = BigNumber(_totalDebt); - - // Uniswap Pools - const { output: _UnilpTokens } = await sdk.api.abi.multiCall({ - calls: uniswapPools.map((pool) => ({ - target: pool.lpStakingAddress, - params: [pool.goblinAddress], - })), - chain, - abi: abi["balanceOf"], - block, - }); - - // Sushiswap Pools - const { output: _SushilpTokens } = await sdk.api.abi.multiCall({ - calls: sushiswapPools.map((pool) => ({ - target: pool.lpStakingAddress, - params: [pool.id, pool.goblinAddress], - })), - chain, - abi: abi["userInfo"], - block, - }); - - const _lpTokens = [ - ..._UnilpTokens, - ..._SushilpTokens.map((x) => ({ - output: x.output[0], - })), - ]; - - const lpTokens = _lpTokens.map((_lpToken) => BigNumber(_lpToken.output || 0)); - - const { output: _totalETHOnStakings } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: WETHAddress, - params: [pool.lpTokenAddress], - })), - chain, - abi: abi["balanceOf"], - block, - }); - - const totalETHOnStakings = _totalETHOnStakings.map((stake) => - BigNumber(stake.output || 0) - ); - - const { output: _totalLpTokens } = await sdk.api.abi.multiCall({ - calls: pools.map((pool) => ({ - target: pool.lpTokenAddress, - })), - chain, - abi: abi["totalSupply"], - block, - }); - - const totalLpTokens = _totalLpTokens.map((_totalLpToken) => - BigNumber(_totalLpToken.output || 0) - ); - - const unUtilizedValue = totalETH.minus(totalDebt); - - let tvl = BigNumber(unUtilizedValue); - for (let i = 0; i < lpTokens.length; i++) { - if (totalLpTokens[i].gt(0)) { - const amount = lpTokens[i] - .times(totalETHOnStakings[i]) - .div(totalLpTokens[i]) - .times(BigNumber(2)); - - tvl = tvl.plus(amount); - } - } - return tvl; - } \ No newline at end of file +async function tvlV1(api, contractsUrl) { + const data = await getConfig('alpha-hormora/v1/' + api.chain, contractsUrl); + + const bankAddress = data.bankAddress + + let pools = data.pools.map(i => i.goblinAddress) + const tokens = await api.multiCall({ abi: 'address:lpToken', calls: pools }) + const shares = await api.multiCall({ abi: 'uint256:totalShare', calls: pools }) + const bals = await api.multiCall({ abi: 'function shareToBalance(uint256) view returns (uint256)', calls: shares.map((v, i) => ({ target: pools[i], params: v})) }) + api.add(tokens, bals) + const totalEthMethodName = api.chain === 'bsc' ? 'totalBNB' : 'totalETH'; + const totalETH = await api.call({ target: bankAddress, abi: 'uint256:' + totalEthMethodName, }); + const totalDebt = await api.call({ target: bankAddress, abi: abi.glbDebtVal, }); + api.addGasToken(totalETH - totalDebt); + return sumTokens2({ api, resolveLP: true}) +} \ No newline at end of file diff --git a/projects/alpha-homora/v2.js b/projects/alpha-homora/v2.js index ab58294362b8..293e35739dd4 100644 --- a/projects/alpha-homora/v2.js +++ b/projects/alpha-homora/v2.js @@ -1,369 +1,174 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const BigNumber = require("bignumber.js"); -const { request, gql } = require("graphql-request"); -const { unwrapCreamTokens, unwrapUniswapLPs, sumTokens2 } = require('../helper/unwrapLPs') +const { request, } = require("graphql-request"); +const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') const chainParams = { - optimism: { - safeBoxApi: "https://api.homora.alphaventuredao.io/v2/10/safeboxes", - 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: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'), + optimism: { + safeBoxApi: "https://api.homora.alphaventuredao.io/v2/10/safeboxes", + 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: 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", - instances: [ - { - wMasterChefAddress: "0xb41de9c1f50697cc3fd63f24ede2b40f6269cbcb", - wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", // wrong - poolsJsonUrl: "https://homora-api.alphafinance.io/v2/43114/pools", - graphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'), - }, - ] - }, - fantom: { - safeBoxApi: "https://homora-api.alphafinance.io/v2/250/safeboxes", - 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: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'), - }, - ] - }, - ethereum: { - safeBoxApi: "https://homora-api.alphafinance.io/v2/1/safeboxes", - coreOracleAddress: "0x6be987c6d72e25f02f6f061f94417d83a6aa13fc", - latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), - instances: [ - { - // Current - werc20Address: "0x06799a1e4792001aa9114f0012b9650ca28059a3", - wMasterChefAddress: "0xa2caea05ff7b98f10ad5ddc837f15905f33feb60", - wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", - wStakingRewardIndex: "0x011535fd795fd28c749363e080662d62fbb456a7", - wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", - poolsJsonUrl: "https://homora-api.alphafinance.io/v2/1/pools", - graphUrl: sdk.graph.modifyEndpoint('37CbUUxwQC7uTqQquQXtQQF8b2bU7L3VBrkEntiHxf4r'), - }, - { - // Legacy - werc20Address: "0xe28d9df7718b0b5ba69e01073fe82254a9ed2f98", - wMasterChefAddress: "0x373ae78a14577682591e088f2e78ef1417612c68", - wLiquidityGauge: "0xfdb4f97953150e47c8606758c13e70b5a789a7ec", - wStakingRewardIndex: "0x713df2ddda9c7d7bda98a9f8fcd82c06c50fbd90", - wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", - poolsJsonUrl: - "local", - graphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), - } - ] - } + graphUrl: sdk.graph.modifyEndpoint('8zVTsZBmd8CU7vnmonPr7qex4A69yM7NSzxKCpGHw6Q6'), + }, + ] + }, + fantom: { + safeBoxApi: "https://homora-api.alphafinance.io/v2/250/safeboxes", + 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: sdk.graph.modifyEndpoint('H4Q15YbQxRWw14HaABfWiTptSwRzanXNwyACY8MCRqVS'), + }, + ] + }, + ethereum: { + safeBoxApi: "https://homora-api.alphafinance.io/v2/1/safeboxes", + coreOracleAddress: "0x6be987c6d72e25f02f6f061f94417d83a6aa13fc", + latestAlphaHomoraV2GraphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), + instances: [ + { + // Current + werc20Address: "0x06799a1e4792001aa9114f0012b9650ca28059a3", + wMasterChefAddress: "0xa2caea05ff7b98f10ad5ddc837f15905f33feb60", + wLiquidityGauge: "0xf1f32c8eeb06046d3cc3157b8f9f72b09d84ee5b", + wStakingRewardIndex: "0x011535fd795fd28c749363e080662d62fbb456a7", + wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", + poolsJsonUrl: "https://homora-api.alphafinance.io/v2/1/pools", + graphUrl: sdk.graph.modifyEndpoint('37CbUUxwQC7uTqQquQXtQQF8b2bU7L3VBrkEntiHxf4r'), + }, + { + // Legacy + werc20Address: "0xe28d9df7718b0b5ba69e01073fe82254a9ed2f98", + wMasterChefAddress: "0x373ae78a14577682591e088f2e78ef1417612c68", + wLiquidityGauge: "0xfdb4f97953150e47c8606758c13e70b5a789a7ec", + wStakingRewardIndex: "0x713df2ddda9c7d7bda98a9f8fcd82c06c50fbd90", + wStakingRewardPerp: "0xc4635854480fff80f742645da0310e9e59795c63", + poolsJsonUrl: + "local", + graphUrl: sdk.graph.modifyEndpoint('CnfAARjTUna6ZVo7RjJvQmm44e7uWx6kbaRm4Xh5MR5N'), + } + ] + } } -const GET_TOTAL_COLLATERALS = gql` - query GET_TOTAL_COLLATERALS($block: Int) { - werc20Collaterals(block: { number: $block }) { +const GET_TOTAL_COLLATERALS = ` + query GET_TOTAL_COLLATERALS{ + werc20Collaterals { lpToken amount } - sushiswapCollaterals(block: { number: $block }) { + sushiswapCollaterals{ pid amount } - crvCollaterals(block: { number: $block }) { + crvCollaterals { pid gid amount } - wstakingRewardCollaterals(block: { number: $block }) { + wstakingRewardCollaterals { wtoken amount } } `; -const GET_CY_TOKEN = gql` - query GET_CY_TOKEN($cyToken: String, $block: Int) { - cyTokenStates( - where: { cyToken: $cyToken } - first: 1 - orderBy: blockTimestamp - orderDirection: desc - block: { number: $block } - ) { - id - cyToken - safeboxBalance - exchangeRate - blockTimestamp - } - } -`; module.exports = { - tvlV2, - tvlV2Onchain -} - -async function getPools(poolsJsonUrl, chain){ - return poolsJsonUrl === "local"? require('./v2/legacy-pools.json') : (await getConfig('alpha-hormora/v2-pools/'+chain, poolsJsonUrl)) + tvlV2, + tvlV2Onchain } -async function tvlV2Onchain(block, chain) { - const balances = {} - const transform = addr => { - if (addr.toLowerCase() === '0x260bbf5698121eb85e7a74f2e45e16ce762ebe11') - return 'avax:' + ADDRESSES.avax.USDT_e // Axelar wrapped UST -> USDT - if (addr.toLowerCase() === '0x2147efff675e4a4ee1c2f918d181cdbd7a8e208f') - return '0xa1faa113cbe53436df28ff0aee54275c13b40975' // Wrapped Alpha Finance -> ALPHA (erc20) - return `${chain}:${addr}` - } - const { safeBoxApi, poolsJsonUrl, instances, } = chainParams[chain]; - let safebox = await getConfig('alpha-hormora/v2-safebox/'+chain, safeBoxApi); - const safeBoxRewards = safebox.filter(i => i.ibStakingReward) - safebox = safebox.filter(i => !i.ibStakingReward) - await unwrapIBRewards({ boxes: safeBoxRewards, balances, chain, block, transform, }) - await unwrapCreamTokens(balances, safebox.map(s=>[s.cyTokenAddress, s.safeboxAddress]), block, chain, transform) - let pools= await getPools(poolsJsonUrl, chain); - const owners = pools.filter(i => i.wTokenType === 'WUniswapV3').map(i => i.wTokenAddress).filter(i => i) - pools = pools.filter(i => i.wTokenType !== 'WUniswapV3') - let poolsWithPid = pools.filter(p => p.pid !== undefined) - let poolsWithoutPid = pools.filter(p => p.pid === undefined) - const { output: masterchefLpTokens } = await sdk.api.abi.multiCall({ - calls: poolsWithPid.map((pool) => ({ - target: pool.exchange.stakingAddress ?? pool.stakingAddress, - params: [pool.pid, pool.wTokenAddress], - })), - chain, - abi: abi["userInfo"], - block, - }); - let lpPools = masterchefLpTokens.map((amount, i) => ({ - balance: amount.output.amount, - token: poolsWithPid[i].lpTokenAddress - })) - const { output: stakingPoolsLpTokens } = await sdk.api.abi.multiCall({ - calls: poolsWithoutPid.map((pool) => ({ - target: pool.stakingAddress, - params: [pool.wTokenAddress], - })), - chain, - abi: "erc20:balanceOf", - block, - }); - stakingPoolsLpTokens.forEach((amount, i) => lpPools.push({ - balance: amount.output, - token: poolsWithoutPid[i].lpTokenAddress - })) - const blacklisted = ['0xf3a602d30dcb723a74a0198313a7551feaca7dac', '0x2a8a315e82f85d1f0658c5d66a452bbdd9356783',].map(i => i.toLowerCase()) - lpPools = lpPools.filter(p => !blacklisted.includes(p.token.toLowerCase())) - await unwrapUniswapLPs(balances, lpPools, block, chain, transform) - if (owners.length) await sumTokens2({ balances, chain, block, owners, resolveUniV3: true, }) - - return balances +async function getPools(poolsJsonUrl, chain) { + return poolsJsonUrl === "local" ? require('./v2/legacy-pools.json') : (await getConfig('alpha-hormora/v2-pools/' + chain, poolsJsonUrl)) } -async function unwrapIBRewards({ block, chain, boxes, balances, transform}) { - for (const { cyTokenAddress, ibStakingReward, safeboxAddress, } of boxes) { - const tempBalance = {} - const [ - { output: balanceOf,}, - { output: totalSupply,}, - ] = await Promise.all([ - sdk.api.erc20.balanceOf({ target: ibStakingReward, owner: safeboxAddress, chain, block, }), - sdk.api.erc20.totalSupply({ target: ibStakingReward, chain, block, }), - unwrapCreamTokens(tempBalance, [[cyTokenAddress, ibStakingReward]], block, chain, transform), - ]) - const ratio = balanceOf / totalSupply - for (const [token, balance] of Object.entries(tempBalance)) { - sdk.util.sumSingleBalance(balances, token, BigNumber(balance * ratio).toFixed(0)) - } - } +async function tvlV2Onchain(api) { + const chain = api.chain + const { safeBoxApi, poolsJsonUrl, } = chainParams[chain]; + let safebox = await getConfig('alpha-hormora/v2-safebox/' + chain, safeBoxApi); + const ownerTokens = safebox.map(s => [[s.cyTokenAddress], s.safeboxAddress]) + await sumTokens2({ api, ownerTokens }) + let pools = await getPools(poolsJsonUrl, chain); + const owners = pools.filter(i => i.wTokenType === 'WUniswapV3').map(i => i.wTokenAddress).filter(i => i) + pools = pools.filter(i => i.wTokenType !== 'WUniswapV3') + let poolsWithPid = pools.filter(p => p.pid !== undefined) + let poolsWithoutPid = pools.filter(p => p.pid === undefined) + const masterchefLpTokens = await api.multiCall({ + calls: poolsWithPid.map((pool) => ({ + target: pool.exchange.stakingAddress ?? pool.stakingAddress, + params: [pool.pid, pool.wTokenAddress], + })), + abi: abi["userInfo"], + }); + masterchefLpTokens.map((amount, i) => api.add(poolsWithPid[i].lpTokenAddress, amount.amount)) + const stakingPoolsLpTokens = await api.multiCall({ + calls: poolsWithoutPid.map((pool) => ({ target: pool.stakingAddress, params: [pool.wTokenAddress], })), + abi: "erc20:balanceOf", + }); + stakingPoolsLpTokens.forEach((amount, i) => api.add(poolsWithoutPid[i].lpTokenAddress, amount)) + const blacklisted = ['0xf3a602d30dcb723a74a0198313a7551feaca7dac', '0x2a8a315e82f85d1f0658c5d66a452bbdd9356783', '0x75E5509029c85fE08e4934B1275c5575aA5538bE'] + blacklisted.forEach(i => api.removeTokenBalance(i)) + await sumTokens2({ api, owners, resolveUniV3: api.chain === 'optimism', resolveLP: api.chain !== 'optimism', }) } - -async function tvlV2(block, chain) { - const { safeBoxApi, coreOracleAddress, latestAlphaHomoraV2GraphUrl, instances } = chainParams[chain]; - const cyTokens = await getCyTokens(block, safeBoxApi, latestAlphaHomoraV2GraphUrl, chain); - const collateralGroups = await Promise.all(instances.map(params => getTotalCollateral(block, params, chain))) - - const tokens = Array.from( - new Set([ - ...collateralGroups.map(collaterals => - collaterals.map((collateral) => collateral.lpTokenAddress) - .filter((lpToken) => !!lpToken)).flat(), - ...cyTokens.map((cy) => cy.token).filter((token) => !!token), - ]) - ); - - const tokenPrices = await getTokenPrices(tokens, block, chain, coreOracleAddress); - - const totalCollateralValue = BigNumber.sum(...collateralGroups.map(collaterals => sumCollaterals(collaterals, tokenPrices))) - - const totalCyValue = BigNumber.sum( - 0, - ...cyTokens.map((cy) => { - if (cy.token in tokenPrices) { - return BigNumber(cy.amount).times(tokenPrices[cy.token]); - } - return BigNumber(0); - }) - ); - - return totalCollateralValue - .plus(totalCyValue); +async function tvlV2(api) { + const chain = api.chain + const { safeBoxApi, instances } = chainParams[chain]; + await getCyTokens(api, safeBoxApi); + await Promise.all(instances.map(params => getTotalCollateral(params, api))) } -function sumCollaterals(collaterals, tokenPrices) { - return BigNumber.sum( - 0, // Default value - ...collaterals.map((collateral) => { - if (collateral.lpTokenAddress in tokenPrices) { - return BigNumber(collateral.amount).times( - tokenPrices[collateral.lpTokenAddress] - ); - } - return BigNumber(0); - }) - ); +async function getCyTokens(api, safeBoxApi) { + const safebox = await getConfig('alpha-hormora/v2-safebox/' + api.chain, safeBoxApi); + const ownerTokens = safebox.map(s => [[s.cyTokenAddress, s.address], s.safeboxAddress]) + return api.sumTokens({ ownerTokens, }) } -async function getCyTokens(block, safeBoxApi, AlphaHomoraV2GraphUrl, chain) { - const safebox = await getConfig('alpha-hormora/v2-safebox/'+chain, - safeBoxApi - ); - return Promise.all( - safebox.map(async (sb) => { - const cyToken = sb.cyTokenAddress; - const { cyTokenStates } = await request( - AlphaHomoraV2GraphUrl, - GET_CY_TOKEN, - { - block, - cyToken, - } - ); - const cyTokenState = cyTokenStates[0]; - if (!cyTokenState) { - return { amount: new BigNumber(0), token: null }; - } - const exchangeRate = new BigNumber(cyTokenState.exchangeRate).div(1e18); - const cyBalance = new BigNumber(cyTokenState.safeboxBalance); - return { amount: cyBalance.times(exchangeRate), token: sb.address }; - }) - ); -} -async function getTokenPrices(tokens, block, chain, coreOracleAddress) { - const { output: _ethPrices } = await sdk.api.abi.multiCall({ - calls: tokens.map((token) => ({ - target: coreOracleAddress, - params: [token], - })), - chain, - abi: abi["getETHPx"], - block, - permitFailure: true, - }); +async function getTotalCollateral({ wMasterChefAddress, wLiquidityGauge, poolsJsonUrl, graphUrl, }, api) { + const chain = api.chain + const pools = await getPools(poolsJsonUrl, chain); - const tokenPrices = {}; - for (let i = 0; i < _ethPrices.length; i++) { - const price = _ethPrices[i].output / 2 ** 112; - if (price > 0) { - tokenPrices[tokens[i]] = price; - } - } - return tokenPrices; -} + const { crvCollaterals, sushiswapCollaterals, werc20Collaterals, wstakingRewardCollaterals, } = await request(graphUrl, GET_TOTAL_COLLATERALS, { block: undefined }); -async function getTotalCollateral( - block, - { - werc20Address, - wMasterChefAddress, - wLiquidityGauge, - wStakingRewardIndex, - wStakingRewardPerp, - poolsJsonUrl, - graphUrl, - }, chain -) { - const pools = await getPools(poolsJsonUrl, chain); + crvCollaterals.map((coll) => { + const pool = pools.find((pool) => pool.wTokenAddress === wLiquidityGauge && Number(coll.pid) === pool.pid && Number(coll.gid) === pool.gid); + if (!pool || !pool.lpTokenAddress) + return; + api.add(pool.lpTokenAddress, coll.amount); + }) - const { - crvCollaterals, - sushiswapCollaterals, - werc20Collaterals, - wstakingRewardCollaterals, - } = await request(graphUrl, GET_TOTAL_COLLATERALS, { - block, - }); + sushiswapCollaterals.map((coll) => { + const pool = pools.find((pool) => pool.wTokenAddress === wMasterChefAddress && Number(coll.pid) === pool.pid); + if (!pool || !pool.lpTokenAddress) + return; + api.add(pool.lpTokenAddress, coll.amount); + }) - const collaterals = [ - ...crvCollaterals.map((coll) => { - const pool = pools.find( - (pool) => - pool.wTokenAddress === wLiquidityGauge && - Number(coll.pid) === pool.pid && - Number(coll.gid) === pool.gid - ); - if (!pool) { - return { - lpTokenAddress: null, - amount: BigNumber(0), - }; - } - return { - lpTokenAddress: pool.lpTokenAddress ? pool.lpTokenAddress : null, - amount: BigNumber(coll.amount), - }; - }), - ...sushiswapCollaterals.map((coll) => { - const pool = pools.find( - (pool) => - pool.wTokenAddress === wMasterChefAddress && - Number(coll.pid) === pool.pid - ); - if (!pool) { - return { - lpTokenAddress: null, - amount: BigNumber(0), - }; - } - return { - lpTokenAddress: pool.lpTokenAddress ? pool.lpTokenAddress : null, - amount: BigNumber(coll.amount), - }; - }), - ...werc20Collaterals.map((coll) => ({ - lpTokenAddress: - "0x" + - BigNumber(coll.lpToken).toString(16).padStart(40, "0").toLowerCase(), - amount: BigNumber(coll.amount), - })), - ...wstakingRewardCollaterals.map((coll) => { - const pool = pools.find((pool) => pool.wTokenAddress === coll.wtoken); - if (!pool) { - return { - lpTokenAddress: null, - amount: BigNumber(0), - }; - } - return { - lpTokenAddress: pool.lpTokenAddress ? pool.lpTokenAddress : null, - amount: BigNumber(coll.amount), - }; - }), - ]; + werc20Collaterals.map((coll) => api.add("0x" + BigNumber(coll.lpToken).toString(16).padStart(40, "0").toLowerCase(), coll.amount)) - return collaterals; + wstakingRewardCollaterals.map((coll) => { + const pool = pools.find((pool) => pool.wTokenAddress === coll.wtoken); + if (!pool || !pool.lpTokenAddress) + return; + api.add(pool.lpTokenAddress, coll.amount); + }) } diff --git a/projects/alphaX-protocol/index.js b/projects/alphaX-protocol/index.js new file mode 100644 index 000000000000..8eac5b407bdc --- /dev/null +++ b/projects/alphaX-protocol/index.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const walletAddresses = { + ethereum: ['0xA61a6E696B7C566DA42B80dA27d96e7104bcec99'], + arbitrum: ['0x552E7A55802f3350C707a243E402aa50Eda9D286'] +} + +const tokenAddress = { + ethereum: [ADDRESSES.ethereum.USDT], + arbitrum: [ADDRESSES.arbitrum.USDT], +} + +Object.keys(walletAddresses).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ owners: walletAddresses[chain], tokens: tokenAddress[chain], }) + } +}) \ No newline at end of file diff --git a/projects/alphafi/index.js b/projects/alphafi/index.js index 93ca30732747..fa3f7404d659 100644 --- a/projects/alphafi/index.js +++ b/projects/alphafi/index.js @@ -1,51 +1,212 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sui = require("../helper/chain/sui") const { addUniV3LikePosition } = require("../helper/unwrapLPs") -const ALPHAFI_TVL_IDS = [ +const ALPHAFI_CETUS_TVL_IDS = [ { poolID: "0x30066d9879374276dc01177fbd239a9377b497bcd347c82811d75fcda35b18e5", cetusPoolID: "0xc8d7a1503dc2f9f5b05449a87d8733593e2f0f3e7bffd90541252782e4d2ca20", investorID: "0x87a76889bf4ed211276b16eb482bf6df8d4e27749ebecd13017d19a63f75a6d5", - token0Type: "0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c::coin::COIN", - token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + token0Type: ADDRESSES.sui.USDT, + token1Type: ADDRESSES.sui.USDC }, { poolID: "0xa7239a0c727c40ee3a139689b16b281acfd0682a06c23531b184a61721ece437", cetusPoolID: "0x0e809689d04d87f4bd4e660cd1b84bf5448c5a7997e3d22fc480e7e5e0b3f58d", investorID: "0x1b923520f19660d4eb013242c6d03c84fdea034b8f784cfd71173ef72ece50e1", token0Type: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY", - token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + token1Type: ADDRESSES.sui.USDC }, { poolID: "0xee6f6392cbd9e1997f6e4cf71db0c1ae1611f1f5f7f23f90ad2c64b8f23cceab", cetusPoolID: "0xcf994611fd4c48e277ce3ffd4d4364c914af2c3cbb05f7bf6facd371de688630", investorID: "0xb6ca8aba0fb26ed264a3ae3d9c1461ac7c96cdcbeabb01e71086e9a8340b9c55", - token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", - token1Type: "0x2::sui::SUI" + token0Type: ADDRESSES.sui.USDC, + token1Type: ADDRESSES.sui.SUI }, { poolID: "0x676fc5cad79f51f6a7d03bfa3474ecd3c695d322380fc68e3d4f61819da3bf8a", cetusPoolID: "0xaa57c66ba6ee8f2219376659f727f2b13d49ead66435aa99f57bb008a64a8042", investorID: "0x9ae0e56aa0ebc27f9d8a17b5a9118d368ba262118d878977b6194a10a671bbbc", - token0Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN", - token1Type: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881::coin::COIN" + token0Type: ADDRESSES.sui.USDC, + token1Type: ADDRESSES.sui.WBTC }, { poolID: "0xbdf4f673b34274f36be284bca3f765083380fefb29141f971db289294bf679c6", cetusPoolID: "0x5b0b24c27ccf6d0e98f3a8704d2e577de83fa574d3a9060eb8945eeb82b3e2df", investorID: "0x05fa099d1df7b5bfb2e420d5ee2d63508db17c40ce7c4e0ca0305cd5df974e43", - token0Type: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5::coin::COIN", - token1Type: "0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf::coin::COIN" + token0Type: ADDRESSES.sui.WETH, + token1Type: ADDRESSES.sui.USDC + }, + { + poolID: "0x045e4e3ccd383bedeb8fda54c39a7a1b1a6ed6a9f66aec4998984373558f96a0", + cetusPoolID: "0x0254747f5ca059a1972cd7f6016485d51392a3fde608107b93bbaebea550f703", + investorID: "0xdd9018247d579bd7adfdbced4ed39c28821c6019461d37dbdf32f0d409959b1c", + token0Type: "0xa99b8952d4f7d947ea77fe0ecdcc9e5fc0bcab2841d6e2a5aa00c3044e5544b5::navx::NAVX", + token1Type: ADDRESSES.sui.SUI + }, + { + poolID: "0x59ff9c5df31bfd0a59ac8393cf6f8db1373252e845958953e6199952d194dae4", + cetusPoolID: "0x81fe26939ed676dd766358a60445341a06cea407ca6f3671ef30f162c84126d5", + investorID: "0x8051a9ce43f9c21e58331b1ba2b1925e4ae4c001b1400459236d86d5d3d2888b", + token0Type: ADDRESSES.sui.BUCK, + token1Type: ADDRESSES.sui.USDC + }, + { + poolID: "0xd50ec46c2514bc8c588760aa7ef1446dcd37993bc8a3f9e93563af5f31b43ffd", + cetusPoolID: "0x9ddb0d269d1049caf7c872846cc6d9152618d1d3ce994fae84c1c051ee23b179", + investorID: "0x74308f0de7ea1fc4aae2046940522f8f79a6a76db94e1227075f1c2343689882", + token0Type: ADDRESSES.sui.SOL, + token1Type: ADDRESSES.sui.USDC + }, + { + poolID: "0x6eec371c24ad264ced3a1f40b83d7d720aa2b0afa860a6af85436f6a769842e1", + cetusPoolID: "0xaa72bd551b25715b8f9d72f226fa02526bdf2e085a86faec7184230c5209bb6e", + investorID: "0x651acc1166023a08c17f24e71550982400e9b1f4950cc1324410300efc1af905", + token0Type: "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA", + token1Type: ADDRESSES.sui.SUI + }, + // usdc sui + { + poolID: "0x727882553d1ab69b0cabad2984331e7e39445f91cb4046bf7113c36980685528", + cetusPoolID: "0xb8d7d9e66a60c239e7a60110efcf8de6c705580ed924d0dde141f4a0e2c90105", + investorID: "0xba6acd0350eab1c6bc433b6c869e5592fe0667ae96a3115f89d5c79dd78396ef", + token0Type: ADDRESSES.sui.USDC_CIRCLE, + token1Type: ADDRESSES.sui.SUI + }, + // usdc usdt + { + poolID: "0xa213f04c6049f842a7ffe7d39e0c6138a863dc6e25416df950d23ddb27d75661", + cetusPoolID: "0x6bd72983b0b5a77774af8c77567bb593b418ae3cd750a5926814fcd236409aaa", + investorID: "0xe553be450b7290025d5810da45102abdbaa211c5735e47f6740b4dd880edc0bd", + token0Type: ADDRESSES.sui.USDC_CIRCLE, + token1Type: ADDRESSES.sui.USDT + }, + // usdc wusdc + { + poolID: "0x568a47adf2b10219f0973a5600096822b38b4a460c699431afb6dad385614d66", + cetusPoolID: "0x1efc96c99c9d91ac0f54f0ca78d2d9a6ba11377d29354c0a192c86f0495ddec7", + investorID: "0x6cc5e671a2a6e9b8c8635ff1fb16ae62abd7834558c3a632d97f393c0f022972", + token0Type: ADDRESSES.sui.USDC_CIRCLE, + token1Type: ADDRESSES.sui.USDC + }, + // usdc eth + { + poolID: "0xc04f71f32a65ddf9ebf6fb69f39261457da28918bfda5d3760013f3ea782a594", + cetusPoolID: "0x9e59de50d9e5979fc03ac5bcacdb581c823dbd27d63a036131e17b391f2fac88", + investorID: "0xb0bff60783536f9dc0b38e43150a73b73b8a4f1969446f7721e187821915bd00", + token0Type: ADDRESSES.sui.USDC_CIRCLE, + token1Type: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH" + }, + // deep sui + { + poolID: "0xff496f73a1f9bf7461882fbdad0c6c6c73d301d3137932f7fce2428244359eaa", + cetusPoolID: "0xe01243f37f712ef87e556afb9b1d03d0fae13f96d324ec912daffc339dfdcbd2", + investorID: "0x5e195363175e4b5139749d901ddd5ef1ffc751777a7051b558c45fa12f24abc3", + token0Type: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", + token1Type: ADDRESSES.sui.SUI + }, + // buck sui + { + poolID: "0xeb44ecef39cc7873de0c418311557c6b8a60a0af4f1fe1fecece85d5fbe02ab5", + cetusPoolID: "0x59cf0d333464ad29443d92bfd2ddfd1f794c5830141a5ee4a815d1ef3395bf6c", + investorID: "0x9b7c9b6086d3baf413bccdfbb6f60f04dedd5f5387dee531eef5b811afdfaedc", + token0Type: ADDRESSES.sui.BUCK, + token1Type: ADDRESSES.sui.SUI + }, + // fud sui + { + poolID: "0x005a2ebeb982a1e569a54795bce1eeb4d88900b674440f8487c2846da1706182", + cetusPoolID: "0xfc6a11998f1acf1dd55acb58acd7716564049cfd5fd95e754b0b4fe9444f4c9d", + investorID: "0xaa17ff01024678a94381fee24d0021a96d4f3a11855b0745facbb5d2eb9df730", + token0Type: "0x76cb819b01abed502bee8a702b4c2d547532c12f25001c9dea795a5e631c26f1::fud::FUD", + token1Type: ADDRESSES.sui.SUI }, ] +const ALPHAFI_NAVI_TVL_IDS = [ + { + poolID: "0x643f84e0a33b19e2b511be46232610c6eb38e772931f582f019b8bbfb893ddb3", + tokenType: ADDRESSES.sui.SUI, + expo: 9 + }, + { + poolID: "0x0d9598006d37077b4935400f6525d7f1070784e2d6f04765d76ae0a4880f7d0a", + tokenType: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", + expo: 9 + }, + { + poolID: "0xc696ca5b8f21a1f8fcd62cff16bbe5a396a4bed6f67909cfec8269eb16e60757", + tokenType: ADDRESSES.sui.USDT, + expo: 6, + }, + { + poolID: "0x01493446093dfcdcfc6c16dc31ffe40ba9ac2e99a3f6c16a0d285bff861944ae", + tokenType: ADDRESSES.sui.USDC, + expo: 6 + }, + { + poolID: "0xe4eef7d4d8cafa3ef90ea486ff7d1eec347718375e63f1f778005ae646439aad", + tokenType: ADDRESSES.sui.WETH, + expo: 8 + }, + { + poolID: "0x04378cf67d21b41399dc0b6653a5f73f8d3a03cc7643463e47e8d378f8b0bdfa", + tokenType: ADDRESSES.sui.USDC_CIRCLE, + expo: 6 + }, + { + poolID: "0xea3c2a2d29144bf8f22e412ca5e2954c5d3021d3259ff276e3b62424a624ad1f", + tokenType: "0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY", + expo: 6 + }, + { + poolID: "0x8ebe04b51e8a272d4db107ad19cfbc184d1dafeeaab0b61c26e613b804e7777a", + tokenType: "0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD", + expo: 6 + }, + { + poolID: "0xc37ec956fdef6c217505e62444ab93f833c20923755d67d1c8588c9b093ae00e", + tokenType: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", + expo: 8 + }, +] +const ALPHAFI_NAVI_LOOP_TVL_IDS = [ + { + poolID: "0xd013a1a0c6f2bad46045e3a1ba05932b4a32f15864021d7e0178d5c2fdcc85e3", + investorID: "0x36cc3135c255632f9275a5b594145745f8344ce8f6e46d9991ffb17596195869", + tokenType: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55::cert::CERT", + expo: 9 + }, +] +const ALPHAFI_BUCKET_TVL_IDS = [ + { + poolID: "0x2c5c14b9fb21f93f36cac0f363acf59ecb21f34c4c9b1a1b383f635ecdc7b507", + tokenType: ADDRESSES.sui.BUCK, + }, + +] const ALPHAFI_POOL2_IDS = [{ poolID: "0x594f13b8f287003fd48e4264e7056e274b84709ada31e3657f00eeedc1547e37", cetusPoolID: "0xda7347c3192a27ddac32e659c9d9cbed6f8c9d1344e605c71c8886d7b787d720", investorID: "0x46d901d5e1dba34103038bd2ba789b775861ea0bf4d6566afd5029cf466a3d88", token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA", - token1Type: "0x2::sui::SUI" + token1Type: ADDRESSES.sui.SUI +}, +{ + poolID: "0x430986b53a787362e54fa83d0ae046a984fb4285a1bc4fb1335af985f4fe019d", + cetusPoolID: "0x0cbe3e6bbac59a93e4d358279dff004c98b2b8da084729fabb9831b1c9f71db6", + investorID: "0x705c560fd1f05c64e0480af05853e27e1c3d04e255cd6c5cb6921f5d1df12b5a", + token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA", + token1Type: ADDRESSES.sui.USDC +}, +{ + poolID: "0x4c0e42f1826170ad9283b321a7f9a453ef9f65aaa626f7d9ee5837726664ecdc", + cetusPoolID: "0x29e218b46e35b4cf8eedc7478b8795d2a9bcce9c61e11101b3a039ec93305126", + investorID: "0xb43d1defd5f76ef084d68d6b56e903b54d0a3b01be8bb920ed1fa84b42c32ee1", + token0Type: "0xfe3afec26c59e874f3c1d60b8203cb3852d2bb2aa415df9548b8d688e6683f93::alpha::ALPHA", + token1Type: ADDRESSES.sui.USDC_CIRCLE }, ] @@ -56,8 +217,8 @@ 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) { +async function addPoolTVL(api, alphafiCetusPools) { + for (const { poolID, cetusPoolID, investorID, token0Type, token1Type } of alphafiCetusPools) { let investorObject = await sui.getObject(investorID) let poolObject = await sui.getObject(poolID) let cetusPoolObject = await sui.getObject(cetusPoolID) @@ -73,16 +234,63 @@ async function addPoolTVL(api, pools) { } } +async function addPoolTVL2(api, alphafiNaviPools){ + + for (const { poolID, tokenType, expo } of alphafiNaviPools){ + let poolObject = await sui.getObject(poolID); + let tokensInvested = poolObject.fields.tokensInvested; + let balance = BigInt(tokensInvested)/BigInt(Math.pow(10, 9-expo)); + api.add(tokenType, balance); + } +} + +async function addPoolTVL3(api, alphafiNaviLoopPools){ + + for (const { poolID, investorID, tokenType, expo } of alphafiNaviLoopPools){ + let poolObject = await sui.getObject(poolID); + let investorObject = await sui.getObject(investorID); + let tokensInvested = poolObject.fields.tokensInvested; + + let liquidity = parseFloat(tokensInvested); + /* + in the code below, we are subtracting the debt in the pool from the liquidity, since the borrowed tokens are supplied back to the pool (as part of our strategy). + we have current_debt_to_supply_ratio in the object, so current debt in the system is (current liquidity * current_debt_to_supply_ratio). + we subtract the above derived debt from the liquidity. + current_debt_to_supply_ratio in our system is scaled by 1e20, hence the division of 1e20 in the below used expression. + */ + liquidity = liquidity*(1-(parseFloat(investorObject.fields.current_debt_to_supply_ratio)/parseFloat(1e20))); + + tokensInvested = (liquidity.toString().split('.')[0]); + + let balance = BigInt(tokensInvested)/BigInt(Math.pow(10, 9-expo)); + api.add(tokenType, balance); + } +} + +async function addPoolTVL4(api, alphafiBucketPools){ + + for (const { poolID, tokenType } of alphafiBucketPools){ + let poolObject = await sui.getObject(poolID); + let tokensInvested = poolObject.fields.tokensInvested; + api.add(tokenType, tokensInvested); + } +} + async function tvl(api) { - await addPoolTVL(api, ALPHAFI_TVL_IDS) + + await Promise.all([addPoolTVL(api, ALPHAFI_CETUS_TVL_IDS), addPoolTVL2(api, ALPHAFI_NAVI_TVL_IDS), addPoolTVL3(api, ALPHAFI_NAVI_LOOP_TVL_IDS), addPoolTVL4(api, ALPHAFI_BUCKET_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)) + api.addToken(ALPHA_COIN_TYPE, BigInt(alphaPoolObject.fields.alpha_bal)) } module.exports = { diff --git a/projects/alphpad/index.js b/projects/alphpad/index.js new file mode 100644 index 000000000000..8da07e5e177d --- /dev/null +++ b/projects/alphpad/index.js @@ -0,0 +1,35 @@ +const alephium = require('../helper/chain/alephium') + +const Addresses = { + apad: '27HxXZJBTPjhHXwoF1Ue8sLMcSxYdxefoN2U6d8TKmZsm', + alphApadPool: 'vFpZ1DF93x1xGHoXM8rsDBFjpcoSsCi5ZEuA5NG5UJGX', + alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX', + vault: 'yzoCumd4Fpi959NSis9Nnyr28UkgyRYqrKBgYNAuYj3m' +} + +async function apadLocked() { + const results = await alephium.contractMultiCall([ + { group: 0, address: Addresses.vault, methodIndex: 34 }, + { group: 0, address: Addresses.alphApadPool, methodIndex: 8 }, + { group: 0, address: Addresses.alphUsdtPool, methodIndex: 8 }, + ]); + const apadLocked = results[0].returns[0].value; + const apadInAlph = results[1].returns[0].value / results[1].returns[1].value; + const alphInUsd = (results[2].returns[1].value * 10 ** 12) / results[2].returns[0].value; + return ((apadLocked / 10 ** 18) * apadInAlph) * alphInUsd; +} + +async function staking(api) { + const apadLockedValue = await apadLocked(); + api.addCGToken('tether', apadLockedValue) +} + + +module.exports = { + timetravel: false, + methodology: 'TVL locked in the APAD on Alephium', + alephium: { + tvl: () => ({}), + staking + } +} diff --git a/projects/ampleswap/index.js b/projects/ampleswap/index.js index 77bd25892b4d..085021d75d10 100644 --- a/projects/ampleswap/index.js +++ b/projects/ampleswap/index.js @@ -12,5 +12,6 @@ module.exports = { staking: staking(MasterChefContract, AMPLE), }, alv: { tvl: getUniTVL({ factory: '0x01dC97C89DF7d3C616a696dD53F600aB3FF12983', useDefaultCoreAssets: true }), }, - dsc: { tvl: getUniTVL({ factory: '0x232Ba9f3B3643ab28d28ED7ee18600708D60E5fe', useDefaultCoreAssets: true, }), }, + dsc: { tvl: () => ({}) } + // dsc: { tvl: getUniTVL({ factory: '0x232Ba9f3B3643ab28d28ED7ee18600708D60E5fe', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/amply-finance/index.js b/projects/amply-finance/index.js new file mode 100644 index 000000000000..5874c27456ad --- /dev/null +++ b/projects/amply-finance/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require('../helper/aave'); +const methodologies = require('../helper/methodologies'); + +module.exports = { + methodology: methodologies.lendingMarket, + cronos_zkevm: aaveExports(undefined, undefined, undefined, ['0x47656eb2A31094b348EBF458Eccb942d471324eD'], { v3: true, }) +} \ No newline at end of file diff --git a/projects/amulet-finance/index.js b/projects/amulet-finance/index.js new file mode 100644 index 000000000000..2ff8f98074c7 --- /dev/null +++ b/projects/amulet-finance/index.js @@ -0,0 +1,91 @@ +const { PromisePool } = require("@supercharge/promise-pool"); +const { queryContract } = require("../helper/chain/cosmos"); + +const coinGeckIds = { + atom: "cosmos", + eth: "ethereum", + tia: "celestia", +}; + +function synthDenomToTicker(denom) { + const parts = denom.split("/"); + + if (parts.length != 3) throw new Error(`unexpected synthetic denom: ${denom}`); + + return denom.split("/").at(-1); +} + +async function getVaultStates(api, vaultSynthPairs) { + const { results, errors } = await PromisePool.for(vaultSynthPairs).process( + async ([vault, synthTicker]) => { + const state = await queryContract({ + contract: vault, + chain: api.chain, + data: { state: {} }, + }); + + return { vault, synthTicker, totalDeposits: state.total_deposits }; + }, + ); + + if (errors && errors.length) throw errors[0]; + + return results; +} + +function getTvl({ hub, mint }) { + return async (api) => { + const listVaultsPromise = queryContract({ + contract: hub, + chain: api.chain, + data: { list_vaults: {} }, + }); + + const allAssetsPromise = queryContract({ + contract: mint, + chain: api.chain, + data: { all_assets: {} }, + }); + + let [listVaultsRes, allAssetsRes] = await Promise.all([listVaultsPromise, allAssetsPromise]); + + // synthTicker => { underlyingTicker, decimals } + const assets = Object.fromEntries( + allAssetsRes.assets.map((asset) => [ + asset.ticker, + { underlyingTicker: asset.ticker.slice(2), decimals: asset.decimals }, + ]), + ); + + // [ [vaultAddress, synthTicker ] ] + const vaultSynthPairs = listVaultsRes.vaults.map((metadata) => [ + metadata.vault, + synthDenomToTicker(metadata.synthetic), + ]); + + // [{ vault, synthTicker, totalDeposits }] + const vaults = await getVaultStates(api, vaultSynthPairs); + + for (const v of vaults) { + const asset = assets[v.synthTicker]; + + const balance = Number(v.totalDeposits) / Math.pow(10, asset.decimals); + + const coinGeckoId = coinGeckIds[asset.underlyingTicker]; + + // ignore vaults with assets that don't have a CG mapping + if (!coinGeckoId) continue; + + api.addCGToken(coinGeckoId, balance); + } + }; +} + +module.exports = { + neutron: { + tvl: getTvl({ + hub: "neutron16d4a7q3wfkkawj4jwyzz6g97xtmj0crkyn06ev74fu4xsgkwnreswzfpcy", + mint: "neutron1shwxlkpdjd8h5wdtrykypwd2v62z5glr95yp0etdcspkkjwm5meq82ndxs", + }), + }, +}; diff --git a/projects/amun/index.js b/projects/amun/index.js index ed95afa5c108..8268809ca30f 100644 --- a/projects/amun/index.js +++ b/projects/amun/index.js @@ -5,6 +5,7 @@ async function tvl(api) { } module.exports = { + deadFrom: '2023-03-22', timetravel: false, ethereum: { tvl: () => ({}), }, polygon: { tvl: () => ({}), }, diff --git a/projects/amyfinance/index.js b/projects/amyfinance/index.js index a3d082e495c3..b8d2e5fdb864 100644 --- a/projects/amyfinance/index.js +++ b/projects/amyfinance/index.js @@ -1,16 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); +const { sumTokensExport } = require('../helper/unwrapLPs'); const tokens = [ - [ADDRESSES.arbitrum.USDC, false], //USDC - [ADDRESSES.arbitrum.USDT, false], //USDT - [ADDRESSES.optimism.DAI, false], //DAI - [ADDRESSES.arbitrum.WBTC, false], //WBTC - [ADDRESSES.arbitrum.WETH, false], //WETH - ["0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", false], //UNI - [ADDRESSES.arbitrum.LINK, false], //LINK - [ADDRESSES.arbitrum.MIM, false], //MIM - ["0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", false], //SUSHI + ADDRESSES.arbitrum.USDC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH, + "0xFa7F8980b0f1E64A2062791cc3b0871572f1F7f0", + ADDRESSES.arbitrum.LINK, + ADDRESSES.arbitrum.MIM, + "0xd4d42F0b6DEF4CE0383636770eF773390d85c61A", ]; const aibContracts = [ "0xe76a422C30B09f8d20ad5d8A9D21206835F6c692", //aibUSDC @@ -22,18 +22,9 @@ const aibContracts = [ "0x9Dd192fca6A1E7c8a3C014a35087dE3fb9Da14E5", //aibLINK "0x381F8482ee0a12202F2A3735370859f5709B12d2", //aibMIM "0x52444Aa321dfD7b24aA263Af6F7DCC26565f3629", //aibSUSHI -]; - -async function tvl(timestamp, ethBlock, {arbitrum: block}) { - let balances = {}; - const transformAdress = i => `arbitrum:${i}` - - await sumTokensAndLPsSharedOwners(balances, tokens, aibContracts, - block, "arbitrum", transformAdress); - return balances; -} +] module.exports = { - arbitrum: { tvl, }, + arbitrum: { tvl: sumTokensExport({ owners: aibContracts, tokens }), }, deadFrom: '2022-10-23' } diff --git a/projects/anedak/index.js b/projects/anedak/index.js index 493ebe635bca..950d50178163 100644 --- a/projects/anedak/index.js +++ b/projects/anedak/index.js @@ -116,10 +116,11 @@ async function fetch() { } module.exports = { + // deadFrom: '2024-08-30', timetravel: false, misrepresentedTokens: true, methodology: "TVL accounts for the liquidity on all Anedak AMM pools, with all values calculated in terms of KDA price.", kadena: { - tvl: fetch, + tvl: () => ({}), }, }; diff --git a/projects/angle/addresses.js b/projects/angle/addresses.js index e36103f28ef3..6f2cadb65e29 100644 --- a/projects/angle/addresses.js +++ b/projects/angle/addresses.js @@ -14,7 +14,7 @@ const TreasuryTokenAddresses = { ADDRESSES.ethereum.CVX, '0x875773784Af8135eA0ef43b5a374AaD105c5D39e', '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', + ADDRESSES.ethereum.FXS, '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F', '0x4da27a545c0c5B758a6BA100e3a049001de870f5', ADDRESSES.ethereum.USDC, @@ -122,7 +122,7 @@ const chains = [ const tokens = { ethereum: { EURA: '0x1a7e4e63778B4f12a199C062f3eFdD288afCBce8', - stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + stEUR: ADDRESSES.celo.STEUR, USDA: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', stUSD: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', bC3M: '0x2F123cF3F37CE3328CC9B5b8415f9EC5109b45e7', @@ -133,7 +133,7 @@ const tokens = { }, arbitrum: { EURA: '0xFA5Ed56A203466CbBC2430a43c66b9D8723528E7', - stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + stEUR: ADDRESSES.celo.STEUR, USDA: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', stUSD: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', }, @@ -154,7 +154,7 @@ const tokens = { }, xdai: { EURA: '0x4b1E2c2762667331Bc91648052F646d1b0d35984', - stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + stEUR: ADDRESSES.celo.STEUR, USDA: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', stUSD: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', }, @@ -165,7 +165,7 @@ const tokens = { }, celo: { EURA: '0xC16B81Af351BA9e64C1a069E3Ab18c244A1E3049', - stEUR: '0x004626A008B1aCdC4c74ab51644093b155e59A23', + stEUR: ADDRESSES.celo.STEUR, USDA: '0x0000206329b97DB379d5E1Bf586BbDB969C63274', stUSD: '0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776', }, diff --git a/projects/ankr/index.js b/projects/ankr/index.js index edef93324697..d56fa0b489b1 100644 --- a/projects/ankr/index.js +++ b/projects/ankr/index.js @@ -29,6 +29,12 @@ async function getAvaxTvl() { } } +async function getFlowTvl() { + return { + 'flow': await getTvls("flowevm", "totalStaked"), + } +} + async function polkadot() { return { polkadot: await getTvls("dot", "totalStaked"), @@ -91,6 +97,9 @@ module.exports = { fantom: { tvl: getFantomTvl, }, + flow: { + tvl: getFlowTvl, + }, polkadot: { tvl: polkadot, }, diff --git a/projects/annex.js b/projects/annex.js index 140683c71b82..bf06194e1b55 100644 --- a/projects/annex.js +++ b/projects/annex.js @@ -4,7 +4,7 @@ const { compoundExports } = require('./helper/compound') const wBNB = ADDRESSES.bsc.WBNB; const cBNB = "0xC5a83aD9f3586e143D2C718E8999206887eF9dDc"; -const wCRO = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; +const wCRO = ADDRESSES.cronos.WCRO_1; const cCRO = "0x61FCA31c51aCc4CC683291Be936E6799AeAAFe41"; const wKAVA = ADDRESSES.kava.WKAVA; @@ -12,7 +12,7 @@ const cKAVA = "0x5642Aa2fC7028a203C689Bf21c1a92861D8C449B"; module.exports = { methodology: 'TVL is comprised of tokens deposited to the protocol as collateral, similar to Compound Finance and other lending protocols the borrowed tokens are not counted as TVL. Data is pull from the Annex API "https://api.annex.finance/api/v1/governance/annex".', - bsc: compoundExports("0xb13026db8aafa2fd6d23355533dccccbd4442f4c", "bsc", cBNB, wBNB,), - cronos: compoundExports("0xbC1f72e751DE303Ff545D2E348fef2E84D493645", "cronos", cCRO, wCRO,), - kava: compoundExports("0xFb6FE7d66E55831b7e108B77D11b8e4d479c2986", "kava", cKAVA, wKAVA,), + bsc: compoundExports("0xb13026db8aafa2fd6d23355533dccccbd4442f4c", cBNB,), + cronos: compoundExports("0xbC1f72e751DE303Ff545D2E348fef2E84D493645", cCRO,), + kava: compoundExports("0xFb6FE7d66E55831b7e108B77D11b8e4d479c2986", cKAVA,), }; // node test.js projects/annex.js \ No newline at end of file diff --git a/projects/ante/index.js b/projects/ante/index.js index 27f4b2a48382..ef79007b8709 100644 --- a/projects/ante/index.js +++ b/projects/ante/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); const { sumTokens2, nullAddress } = require('../helper/unwrapLPs'); const { createIncrementArray } = require('../helper/utils'); @@ -95,60 +94,37 @@ const CONFIG = { }; Object.keys(CONFIG).forEach((chain) => { - const { startBlock, factories } = CONFIG[chain]; + const { factories } = CONFIG[chain]; module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { - let calls, currentRes; + tvl: async (api) => { + let currentRes; const pools = []; - let tokens = []; + let tokens = [nullAddress]; let i = 0; - const length = 4; + const length = 10 for (const factory of factories) { if (factory.version >= '0.6') { - const controller = await sdk.api.abi.call({ - target: factory.factory, - abi: abis.getController, - chain, - block, - }); - const allowedTokens = await sdk.api.abi.call({ - target: controller.output, - abi: abis.getAllowedTokens, - chain, - block, - }); - - tokens = [...new Set([...tokens, ...allowedTokens.output])]; + const controller = await api.call({ target: factory.factory, abi: abis.getController, }); + const allowedTokens = await api.call({ target: controller, abi: abis.getAllowedTokens, }); + tokens.push(...allowedTokens); } do { - calls = createIncrementArray(4).map((j) => ({ - params: j + i * length, - })); - const { output: res } = await sdk.api.abi.multiCall({ + const calls = createIncrementArray(length).map((j) => ({ params: j + i * length, })); + const res = await api.multiCall({ target: factory.factory, abi: abis.allPools, calls, - chain, - block, permitFailure: true, }); - currentRes = res.map((i) => i.output).filter((i) => i); - + currentRes = res.filter((i) => i) pools.push(...currentRes); - i++; } while (currentRes.length === length); } - return sumTokens2({ - tokens: [nullAddress, ...tokens], - owners: pools, - chain, - block, - }); + return sumTokens2({ tokens, owners: pools, api }); }, - start: startBlock, }; }); diff --git a/projects/antihero-fi/index.js b/projects/antihero-fi/index.js index 1973a1222cf8..6547afa83463 100644 --- a/projects/antihero-fi/index.js +++ b/projects/antihero-fi/index.js @@ -7,7 +7,7 @@ module.exports = { methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", arbitrum: { - ...compoundExports(unitroller, "arbitrum"), + ...compoundExports(unitroller), staking: staking( [ "0x2117E6449b3C50B70705bF1566383b1a94bd5192", @@ -15,4 +15,7 @@ module.exports = { "0x9d15bb4351E95A3FE213E48B410BA1aB7CF8Ce45" ), }, -}; \ No newline at end of file + deadFrom: "2023-08-27" +}; + +module.exports.arbitrum.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/anyhedge/index.js b/projects/anyhedge/index.js index a53a8e2d9cdd..4b03fd90e83c 100644 --- a/projects/anyhedge/index.js +++ b/projects/anyhedge/index.js @@ -23,15 +23,15 @@ async function tvl({timestamp}) { // tvl data lags by contract duration since contracts are secret until settled // so tvl at current time will always be 0, and only later when contracts are revealed // can it be calculated in retrospect and stats back-filled - // for this reason, we cut-off the data at (today-31d) - const lastTimestamp = Math.floor(new Date().getTime() / 1000 - 31*86400); + // for this reason, we cut-off the data at (today-91d) + const lastTimestamp = Math.floor(new Date().getTime() / 1000 - 91*86400); if (timestamp > lastTimestamp) throw "Data for the date is incomplete, awaiting contract reveals." tvlAnyHedge = await getTVLAnyHedge(timestamp) - testDataSource = await getTVLAnyHedge(timestamp + 31*86400) + testDataSource = await getTVLAnyHedge(timestamp + 91*86400) - // if we're querying data for `timestamp`, a row for `timestamp+31d` should exist + // if we're querying data for `timestamp`, a row for `timestamp+91d` should exist if (testDataSource == null) throw "Data source hasn't been updated yet." @@ -47,20 +47,13 @@ async function tvl({timestamp}) { } module.exports = { - methodology: "Scrape the blockchain and filter for spent transaction outputs that match the contract's input script template. Aggregate them to compute TVL. The TVL data lags by contract duration since contracts are secret until settled. So, TVL at the current time will always be 0 and can only be calculated in retrospect and stats back-filled when contracts are revealed. For this reason, the code cuts-off the data at 31 days ago. See here for more details: https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md", + methodology: "Scrape the blockchain and filter for spent transaction outputs that match the contract's input script template. Aggregate them to compute TVL. The TVL data lags by contract duration since contracts are secret until settled. So, TVL at the current time will always be 0 and can only be calculated in retrospect and stats back-filled when contracts are revealed. For this reason, the code cuts-off the data at 91 days ago. See here for more details: https://gitlab.com/0353F40E/anyhedge-stats/-/blob/master/readme.md", start: 1654787405, bitcoincash: { tvl }, hallmarks: [ - [1654787405, "First AnyHedge v0.11 Contract"], - [1663106400, "AnyHedge Alpha is live and available"], - [1666585080, "The BCH Bull (Beta) goes live"], - [1666785960, "Paytaca wallet's product live"], - [1680356040, "BCH Bull trials P2P contracts"], - [1681725240, "BCH Bull is released"], - [1683634380, "BCH Bull adds Achievements"], - [1686651480, "BCH Bull raise max contract to $100k"], - [1687330080, "BCH Bull raise max leverage to 7.77x"], - [1703054100, "BCH Bull enables Early Settlements"], + [1681725240, "BCH Bull public release (AnyHedge v0.11 contract)"], + [1703054100, "BCH Bull enables early settlement feture"], + [1720612800, "BCH Bull enables leveraged shorting feature (AnyHedge v0.12 contract)"] ] }; diff --git a/projects/anzen-v2/index.js b/projects/anzen-v2/index.js index be764330c274..ae832b45bd01 100644 --- a/projects/anzen-v2/index.js +++ b/projects/anzen-v2/index.js @@ -6,6 +6,7 @@ const USDz = '0xa469b7ee9ee773642b3e93e842e5d9b5baa10067'; const Base_USDz = '0x04d5ddf5f3a8939889f11e97f8c4bb48317f1938'; const Blast_USDz = '0x52056ed29fe015f4ba2e3b079d10c0b87f46e8c6'; const Manta_USDz = '0x73d23f3778a90be8846e172354a115543df2a7e4'; +const Arbitrum_USDz = '0x5018609ab477cc502e170a5accf5312b86a4b94f'; const SPCT = '0xf30a29f1c540724fd8c5c4be1af604a6c6800d29'; // Secured collateral const mainnet_tvl = async (api) => { @@ -28,6 +29,11 @@ const manta_tvl = async (api) => { api.add(Manta_USDz, supply) } +const arbitrum_tvl = async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: Arbitrum_USDz }) + api.add(Arbitrum_USDz, supply) +} + const collateral_assets = async (api) => { const supply = await api.call({ abi: 'erc20:totalSupply', target: SPCT }) api.add(SPCT, supply) @@ -47,4 +53,7 @@ module.exports = { manta: { tvl: manta_tvl, }, + arbitrum: { + tvl: arbitrum_tvl, + }, }; diff --git a/projects/ape-express/index.js b/projects/ape-express/index.js new file mode 100644 index 000000000000..ad907f925c2c --- /dev/null +++ b/projects/ape-express/index.js @@ -0,0 +1,30 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { nullAddress } = require('../helper/tokenMapping'); + +const configs = [ + { factory: "0xCd7a0227Bc48b1c14C5a1A6a4851010f80943476", fromBlock: 63905 }, + { factory: "0xBcace40e446b06E6A530D945eFbae222f84fA836", fromBlock: 3633933 } +] + +const tvl = async (api) => { + const logs = [] + for (const { factory, fromBlock } of configs) { + logs.push(await getLogs({ + api, + target: factory, + topics: ['0x8409923236a093dc9b93970d1428b15e2c21c325f3480269492056cdd1134023'], + eventAbi: 'event TokenCreated (address indexed token, address indexed bondingCurve, address indexed creator, string name, string symbol, address router, uint256 initialVirtualAPE, uint256 finalVirtualAPE, uint8 tradeFeePercent, uint8 apxSuccessFee, uint8 creatorSuccessFee)', + onlyArgs: true, + fromBlock, + })) + } + let pools = logs.flat().map(log => log.bondingCurve) + return sumTokens2({ api, owners: pools, token: nullAddress }) +} + +module.exports = { + apechain: { + tvl, + } +} \ No newline at end of file diff --git a/projects/ape-fi/index.js b/projects/ape-fi/index.js index b2ff6182ddd7..3f7a647b4dc9 100644 --- a/projects/ape-fi/index.js +++ b/projects/ape-fi/index.js @@ -1,6 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const { sumTokens2, sumTokensExport } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); const APE = "0x4d224452801ACEd8B2F0aebE155379bb5D594381"; const crvFRAX = "0x3175Df0976dFA876431C2E9eE6Bc45b65d3473CC"; @@ -12,31 +11,10 @@ const fraxStakingWrapper = "0x6a20FC1654A2167d00614332A5aFbB7EBcD9d414"; const apeAPE = "0xcaB90816f91CC25b04251857ED6002891Eb0D6Fa"; -const tvl = async (timestamp, block) => { - const toa = [ - [APE, apeAPE], - ] +const tvl = async (api) => { + const apeUSDCrvFraxTotalSupply = await api.call({ abi: 'erc20:totalSupply', target: apeUSDCrvFrax }) - const balances = await sumTokens2({ block, tokensAndOwners: toa }) - - const { - output: [ - { output: apeUSDCrvFraxTotalSupply }, - ] - } = await sdk.api.abi.multiCall({ - calls: [apeUSDCrvFrax].map((target) => ({ target })), - abi: "erc20:totalSupply", - block, - }); - - const { - output: [ - { output: amoV2LPBalance }, - { output: multisigLPBalance }, - { output: stakedLPBalance }, - { output: crvFraxBalance }, - ] - } = await sdk.api.abi.multiCall({ + const [amoV2LPBalance, multisigLPBalance, stakedLPBalance, crvFraxBalance,] = await api.multiCall({ calls: [ { target: convexRewardPool, params: amoV2, }, { target: convexRewardPool, params: multisig, }, @@ -44,13 +22,10 @@ const tvl = async (timestamp, block) => { { target: crvFRAX, params: apeUSDCrvFrax, }, ], abi: "erc20:balanceOf", - block: block, }); - const apeUSDCrvFraxShare = BigNumber((+stakedLPBalance + +multisigLPBalance + +amoV2LPBalance) /apeUSDCrvFraxTotalSupply ).toFixed(0) - const crvFraxShare = BigNumber(crvFraxBalance * apeUSDCrvFraxShare).toFixed(0) - sdk.util.sumSingleBalance(balances, crvFRAX, crvFraxShare) - return balances + const apeUSDCrvFraxShare = (+stakedLPBalance + +multisigLPBalance + +amoV2LPBalance) / apeUSDCrvFraxTotalSupply + api.add(crvFRAX, crvFraxBalance * apeUSDCrvFraxShare) }; module.exports = { @@ -61,9 +36,11 @@ module.exports = { ['0xfb7a3798c6fff187c8cf08c0b1322b52cfa70ace', '0xbcc28F6BA03642B9B5a3E7ad5C8f27991576796c'], // uni v2 ['0x84ab278a8140a8a9759de17895a8da8d756618f3', '0x0a2c0a2033eccc7cc57e42901f04b96972131579'], // uni v2 ['0x04b727C7e246CA70d496ecF52E6b6280f3c8077D', '0x0C63197017970596044f80778282BB5B2208f018'], // curve - ] + ], + resolveLP: true, }), tvl, + staking: staking(apeAPE, APE), }, start: 15688276, methodology: diff --git a/projects/aperocket/abi.json b/projects/aperocket/abi.json deleted file mode 100644 index 8f90529e6e97..000000000000 --- a/projects/aperocket/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "tvlOfPool": "function tvlOfPool(address vault) view returns (uint256)", - "tvlOfVault": "function tvlOfVault(address _vault, bool isLp, address tokenRouter) view returns (uint256)" -} \ No newline at end of file diff --git a/projects/aperocket/index.js b/projects/aperocket/index.js index d73d0b39ed65..c53df55b2642 100644 --- a/projects/aperocket/index.js +++ b/projects/aperocket/index.js @@ -1,12 +1,5 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); - -/* Certain portion of TVL accounted by their site is coming from their own native token - * in differente blockchains (i.e, bsc and polygon). Aprox $6.0M - */ - -const V2_READER = "0xDc84cbf85ADA13ACAe796FAa4472C19cC901b042" -const MERCURY_READER = "0xc9e54c7ec73aEe86e2BB07c4c6B65BE8BD86Ca90" +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const V2_VAULTS_CONTRACTS_BSC = [ "0xa13eF34F11cD905A1aACe891e3Fd1b355D770e7F", // BANANA @@ -38,54 +31,17 @@ const V2_VAULTS_CONTRACTS_BSC = [ "0x1AFB491895D301a7cea026a5c65316b2C05A56B4", // ETH-BTCB LP Maximizer (Biswap) ]; -const MERCURY_SINGLE_VAULTS_CONTRACTS_BSC = [ - { - address: "0xFfDcD49d902d71445B93DCbFa51E2F9797de05C9", // BANANA - isLp: false, - router: "0xcF0feBd3f17CEf5b47b0cD257aCf6025c5BFf3b7", - }, -]; - -const bscTvl = async (timestamp, block, chainBlocks) => { - block = chainBlocks.bsc - const getV2Tvls = ( - await sdk.api.abi.multiCall({ - abi: abi.tvlOfPool, - calls: V2_VAULTS_CONTRACTS_BSC.map((vcb) => ({ - target: V2_READER, - params: [vcb], - })), - block, - chain: "bsc", - }) - ).output.map((tvl) => tvl.output); - - const v2Tvl = getV2Tvls.reduce((previousValue, currentValue) => Number(previousValue) + Number(currentValue)) - - const getMercuryTvls = ( - await sdk.api.abi.multiCall({ - abi: abi.tvlOfVault, - calls: MERCURY_SINGLE_VAULTS_CONTRACTS_BSC.map((vcb) => ({ - target: MERCURY_READER, - params: [vcb.address, vcb.isLp, vcb.router], - })), - block, - chain: "bsc", - }) - ).output.map((tvl) => tvl.output); - - const mercuryTvl = getMercuryTvls.reduce((previousValue, currentValue) => Number(previousValue) + Number(currentValue)) - - const totalTvl = (v2Tvl / 10 ** 18) + (mercuryTvl / 10 ** 18) - - return { - 'tether': totalTvl, - }; +const bscTvl = async (api) => { + const tokens = await api.multiCall({ abi: 'address:STAKING_TOKEN', calls: V2_VAULTS_CONTRACTS_BSC}) + const bals = await api.multiCall({ abi: 'uint256:balance', calls: V2_VAULTS_CONTRACTS_BSC}) + api.add(tokens, bals) + return sumTokens2({ api, resolveLP: true}) }; module.exports = { bsc: { tvl: bscTvl, + staking: staking("0xFfDcD49d902d71445B93DCbFa51E2F9797de05C9", "0x603c7f932ED1fc6575303D8Fb018fDCBb0f39a95"), }, methodology: `TVL consists of deposits made to the Earn Vaults of ApeRocket minus the 'SPACE' vault and the 'SPACE-BNB' pool2 vault which are created using the protocol's native token.`, misrepresentedTokens: true, diff --git a/projects/aperture/abi.json b/projects/aperture/abi.json deleted file mode 100644 index 1406ebe36abd..000000000000 --- a/projects/aperture/abi.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "getStrategyId": "uint64:nextStrategyId", - "getLeverage": "uint256:leverageLevel", - "getEquityETHValue": "uint256:getEquityETHValue", - "getETHPx": "function getETHPx(address oracle, address token) view returns (uint256)" -} \ No newline at end of file diff --git a/projects/aperture/getVaults.js b/projects/aperture/getVaults.js deleted file mode 100644 index dc2a35f7484a..000000000000 --- a/projects/aperture/getVaults.js +++ /dev/null @@ -1,28 +0,0 @@ -const sdk = require('@defillama/sdk') -const abi = require("./abi.json"); -const { getParamCalls, getUniqueAddresses } = require('../helper/utils') - -const APERTURE_MANAGER_ADDRESS = "0xeD380115259FcC9088c187Be1279678e23a6E565"; - -const abis = { - strategyIdToMetadata: "function strategyIdToMetadata(uint64 arg0) view returns (string, string, address)", -} - -async function getVaults(chain, block) { - const { output: nextStrategyId } = await sdk.api.abi.call({ - target: APERTURE_MANAGER_ADDRESS, - abi: abi.getStrategyId, - chain, block, - }) - const { output: vaults } = await sdk.api.abi.multiCall({ - target: APERTURE_MANAGER_ADDRESS, - abi: abis.strategyIdToMetadata, - calls: getParamCalls(nextStrategyId), - chain, block, - }) - return getUniqueAddresses(vaults.map(i => i.output[2])); -} - -module.exports = { - getVaults, -}; diff --git a/projects/aperture/index.js b/projects/aperture/index.js index d7f269fc488b..2edccc060ac7 100644 --- a/projects/aperture/index.js +++ b/projects/aperture/index.js @@ -1,45 +1,21 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { default: BigNumber } = require("bignumber.js"); -const { getVaults } = require("./getVaults.js"); +const APERTURE_MANAGER_ADDRESS = "0xeD380115259FcC9088c187Be1279678e23a6E565"; -async function avax_tvl(timestamp, _, { avax: block }) { - const chain = "avax"; - const vaultContracts = await getVaults(chain, block); - const calls = vaultContracts.map((i) => ({ target: i })); - const equityETHValues = ( - await sdk.api.abi.multiCall({ - abi: abi.getEquityETHValue, - calls, - chain, - block, - }) - ).output; - - const vaultLeverage = ( - await sdk.api.abi.multiCall({ - abi: abi.getLeverage, - calls, - chain, - block, - }) - ).output; - - let balances = {}; - for (let i = 0; i < vaultContracts.length; i++) { - const bal = (vaultLeverage[i].output * equityETHValues[i].output) / 1e22; - sdk.util.sumSingleBalance( - balances, - `coingecko:avalanche-2`, - BigNumber(bal).toFixed(0) - ); - } +const abis = { + strategyIdToMetadata: "function strategyIdToMetadata(uint64 arg0) view returns (string, string, address strategy)", + "getStrategyId": "uint64:nextStrategyId", + "getLeverage": "uint256:leverageLevel", + "getEquityETHValue": "uint256:getEquityETHValue", + "getETHPx": "function getETHPx(address oracle, address token) view returns (uint256)" +} - return balances; +async function avax_tvl(api) { + const strategies = (await api.fetchList({ lengthAbi: 'nextStrategyId', itemAbi: abis.strategyIdToMetadata, target: APERTURE_MANAGER_ADDRESS, })).map(i => i.strategy) + const equityETHValues = await api.multiCall({ abi: abis.getEquityETHValue, calls: strategies }) + const vaultLeverage = await api.multiCall({ abi: abis.getLeverage, calls: strategies }) + vaultLeverage.map((v, i) => api.addCGToken(`avalanche-2`, equityETHValues[i] * v / 1e22)) } module.exports = { - timetravel: false, avax: { tvl: avax_tvl, }, diff --git a/projects/apestore/index.js b/projects/apestore/index.js index f4350642fbfb..419a1d1d8612 100644 --- a/projects/apestore/index.js +++ b/projects/apestore/index.js @@ -9,10 +9,17 @@ const routers = [ "0x0bf8edd756ff6caf3f583d67a9fd8b237e40f58a" ]; +const routersEth = [ + "0xA7d854eAf481846f7dA8CC863a46aC1F67b548D8" +]; + const tokens = [coreAssets.null]; module.exports = { base: { tvl: sumTokensExport({ owners: routers, tokens }) }, + ethereum: { + tvl: sumTokensExport({ owners: routersEth, tokens }) + } }; \ No newline at end of file diff --git a/projects/apeswap-lending/index.js b/projects/apeswap-lending/index.js index 788cafed4b64..c89796e5a82d 100644 --- a/projects/apeswap-lending/index.js +++ b/projects/apeswap-lending/index.js @@ -1,21 +1,7 @@ -const {usdCompoundExports} = require('../helper/compound'); -const methodologies = require('../helper/methodologies'); - -const unitroller_bsc = "0xad48b2c9dc6709a560018c678e918253a65df86e" - -const abis = { - oracle: "address:getRegistry", - underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", -} - -const lendingMarket = usdCompoundExports(unitroller_bsc, "bsc", "0x34878F6a484005AA90E7188a546Ea9E52b538F6f", abis) - +const { compoundExports2 } = require('../helper/compound') +const methodologies = require('../helper/methodologies') module.exports = { - misrepresentedTokens: true, - bsc:{ - tvl: lendingMarket.tvl, - borrowed: lendingMarket.borrowed - }, + bsc: compoundExports2({ comptroller: '0xad48b2c9dc6709a560018c678e918253a65df86e' }), methodology: methodologies.lendingMarket, } \ No newline at end of file diff --git a/projects/apex-omni/index.js b/projects/apex-omni/index.js index 74ecad0c41dd..b17cac8f801c 100644 --- a/projects/apex-omni/index.js +++ b/projects/apex-omni/index.js @@ -9,13 +9,17 @@ const tokens = [ const walletAddresses = { bsc: ['0xb8d9f005654b7b127b34dae8f973ba729ca3a2d9'], ethereum: ['0x35D173cdfE4d484BC5985fDa55FABad5892c7B82'], - arbitrum: ['0x3169844a120c0f517b4eb4a750c08d8518c8466a'] + arbitrum: ['0x3169844a120c0f517b4eb4a750c08d8518c8466a'], + base: ['0xee7981c4642de8d19aed11da3bac59277dfd59d7'], + mantle: ['0x3c7c0ebfcd5786ef48df5ed127cddeb806db976c'] }; const tokenAddress = { bsc: [ADDRESSES.bsc.USDT], arbitrum: [ADDRESSES.arbitrum.USDT], + base: [ADDRESSES.base.USDT], + mantle: [ADDRESSES.mantle.USDT] } module.exports = { @@ -28,4 +32,10 @@ module.exports = { arbitrum: { tvl: sumTokensExport({ owners: walletAddresses.arbitrum, tokens: tokenAddress.arbitrum }), }, + base: { + tvl: sumTokensExport({ owners: walletAddresses.base, tokens: tokenAddress.base }), + }, + mantle: { + tvl: sumTokensExport({ owners: walletAddresses.mantle, tokens: tokenAddress.mantle }), + }, }; \ No newline at end of file diff --git a/projects/apexdefi/index.js b/projects/apexdefi/index.js new file mode 100644 index 000000000000..1437fcac87ae --- /dev/null +++ b/projects/apexdefi/index.js @@ -0,0 +1,36 @@ +const { staking } = require('../helper/staking') +const ADDRESSES = require('../helper/coreAssets.json'); + +const config = { + avax: { factory: "0x754A0c42C35562eE7a41eb824d14bc1259820f01", wrapperFactory: '0x39aB4aabAd7656f94E32ebD90547C3c4a183f4B4' }, + base: { factory: "0x10d11Eb1d5aB87E65518458F990311480b321061", wrapperFactory: '0xc9fbf1e865eeababe92d47ddb11d580f37ce4e00' }, + ethereum: { factory: "0x820c889D5749847217599B43ab86FcC91781019f", }, +} + +async function _staking(api) { + const poolInfoAbi = "function getPoolInfo(uint256 _poolId) public view returns (address _staketoken, uint256 _allocationPoints, uint256 _lastRewardTimestamp, uint256 _rewardTokenPerShare, uint256 _totalStaked, uint256 _bonusMultiplier, address _rewarder)" + + const poolInfo = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: poolInfoAbi, target: '0x5995876c9C6e2C23C1C5fc902661127fF9ed38D3', }) + poolInfo.forEach(pool => api.add(pool._staketoken, pool._totalStaked)) +} + +module.exports.methodology = "The Apex DeFi factory contract address is used to obtain the balances held in each token contract as liquidity and the staking contract is used to get the staked APEX balance."; + +Object.keys(config).forEach(chain => { + const { factory, wrapperFactory, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + // count the value of erc20 wrapped and deposited in the pools + if (wrapperFactory) { + const wrapperPools = await api.fetchList({ lengthAbi: 'allWrappersLength', itemAbi: 'allWrappers', target: wrapperFactory }) + const tokens = await api.multiCall({ abi: 'address:originalToken', calls: wrapperPools }) + await api.sumTokens({ tokensAndOwners2: [tokens, wrapperPools]}) + } + + const tokens = await api.call({ abi: 'address[]:getAllTokens', target: factory }) + return api.sumTokens({ owners: tokens, tokens: [ADDRESSES.null] }) + } + } +}) + +// module.exports.avax.staking = staking('0x5995876c9C6e2C23C1C5fc902661127fF9ed38D3','0x98B172A09102869adD73116FC92A0A60BFF4778F') \ No newline at end of file diff --git a/projects/apexswap/index.js b/projects/apexswap/index.js index d509b1c8a36e..f5ef357df5f6 100644 --- a/projects/apexswap/index.js +++ b/projects/apexswap/index.js @@ -5,6 +5,7 @@ module.exports = { hallmarks: [ [1665532800, "Rug Pull"] ], + deadFrom: '2022-10-12', avax: { tvl: getUniTVL({ factory: '0x21cadeb92c8bbfbef98c3098846f0999209c3a97', diff --git a/projects/apwine/index.js b/projects/apwine/index.js index 1de189ff1ab3..79522802e0a2 100644 --- a/projects/apwine/index.js +++ b/projects/apwine/index.js @@ -114,5 +114,8 @@ module.exports = { tvl: tvl_from_registry('polygon'), pool2: pool2s([APW_WETH_cometh_staking, APW_MUST_cometh_staking], [APW_WETH_cometh, APW_MUST_cometh]) }, - methodology: `Use the registry to retrieve futureVaults, and get for each vault the IBT which is the token that this vault holds - the user locked collateral` + methodology: `Use the registry to retrieve futureVaults, and get for each vault the IBT which is the token that this vault holds - the user locked collateral`, + hallmarks: [ + [1677798000, "Announcement of V1 Retirement"] + ], } diff --git a/projects/aqua-network/index.js b/projects/aqua-network/index.js new file mode 100644 index 000000000000..86fb368bc1bc --- /dev/null +++ b/projects/aqua-network/index.js @@ -0,0 +1,40 @@ +const { get } = require('../helper/http') +const AQUA_STATS_URL = "https://amm-api.aqua.network/api/external/v1/statistics/totals/?size=all" + +let _data + +async function getData() { + if (!_data) + _data = get(AQUA_STATS_URL) + const data = await _data + const res = {} + data.forEach((item) => { + res[item.date] = item.tvl / 1e7 + }) + return res +} + +function formatUnixTimestamp(unixTimestamp) { + const date = new Date(unixTimestamp * 1000); // Convert Unix timestamp to milliseconds + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); // Months are zero-based + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; +} + +async function tvl(api) { + const key = formatUnixTimestamp(api.timestamp) + const allData = await getData() + const usdValue = allData[key] + if (!usdValue) + throw new Error('No data found for current date'); + api.addCGToken('tether', usdValue) +} + +module.exports = { + start: 1719792000, + misrepresentedTokens: true, + methodology: + 'counts the liquidity of the Pools on AMM, data is pulled from the Aquarius API.', + stellar: { tvl }, +}; diff --git a/projects/aqua-patina/index.js b/projects/aqua-patina/index.js new file mode 100644 index 000000000000..14053941fad0 --- /dev/null +++ b/projects/aqua-patina/index.js @@ -0,0 +1,16 @@ +const apETH = '0xAaAaAAaBC6CBc3A1FD3a0fe0FDec43251C6562F5' + +async function tvl(api) { + const supply = await api.call({ target: apETH, abi: 'uint256:totalSupply' }) + const multiplier = await api.call({ target: apETH, abi: 'uint256:ethPerAPEth' }) + api.addGasToken(supply * multiplier / 1e18) +} + +module.exports = { + doublecounted: true, + methodology: 'Returns the ETH equivalent value of the total supply of apETH tokens on Ethereum. This is calculated by the multiplier used in the contract to determine the ETH value of each token when minting apETH.', + start: 20937454, + ethereum: { + tvl, + } +} \ No newline at end of file diff --git a/projects/aqualoan/index.js b/projects/aqualoan/index.js new file mode 100644 index 000000000000..9ffc6fb2511a --- /dev/null +++ b/projects/aqualoan/index.js @@ -0,0 +1,44 @@ +const abi = { + getReserveTokensAddresses: "function getReserveTokensAddresses(address asset) view returns (address aTokenAddress, address stableDebtTokenAddress, address variableDebtTokenAddress)", + getAllReservesTokens: "function getAllReservesTokens() view returns ((string symbol, address tokenAddress)[])", + getReserveData: "function getReserveData(address asset) view returns (uint256 unbacked, uint256 accruedToTreasuryScaled, uint256 totalAToken, uint256 totalStableDebt, uint256 totalVariableDebt, uint256 liquidityRate, uint256 variableBorrowRate, uint256 stableBorrowRate, uint256 averageStableBorrowRate, uint256 liquidityIndex, uint256 variableBorrowIndex, uint40 lastUpdateTimestamp)", +}; + +const CONFIG = { + bsc: ['0xDc33eAA50B8707f791478Cec324e451E20FDa7ed'] +}; + +const fetchReserveData = async (api, poolDatas, isBorrowed) => { + const reserveTokens = await api.multiCall({ calls: poolDatas, abi: abi.getAllReservesTokens }); + const calls = [] + + poolDatas.map((pool, i) => { + reserveTokens[i].forEach(({ tokenAddress }) => calls.push({ target: pool, params: tokenAddress })); + }); + const reserveData = await api.multiCall({ abi: isBorrowed ? abi.getReserveData : abi.getReserveTokensAddresses, calls, }) + const tokensAndOwners = [] + reserveData.forEach((data, i) => { + const token = calls[i].params + if (isBorrowed) { + api.add(token, data.totalVariableDebt) + api.add(token, data.totalStableDebt) + } else + tokensAndOwners.push([token, data.aTokenAddress]) + }) + + if (isBorrowed) return api.getBalances() + return api.sumTokens({ tokensAndOwners }) +} + +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. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending." + +Object.keys(CONFIG).forEach((chain) => { + const poolDatas = CONFIG[chain]; + module.exports[chain] = { + tvl: (api) => fetchReserveData(api, poolDatas), + borrowed: (api) => fetchReserveData(api, poolDatas, true), + }; +}); + +module.exports.hallmarks = [ +] diff --git a/projects/aquaprotocol/index.js b/projects/aquaprotocol/index.js new file mode 100644 index 000000000000..5b06ff4af5fd --- /dev/null +++ b/projects/aquaprotocol/index.js @@ -0,0 +1,12 @@ +const { sumTokensExport } = require('../helper/sumTokens') +const ADDRESSES = require("../helper/coreAssets.json"); + +const AQUA_ADDRESS = 'EQAWDyxARSl3ol2G1RMLMwepr3v6Ter5ls3jiAlheKshgg0K' + +module.exports = { + methodology: 'Total amount of collateral locked in the Aqua Protocol (EQAWDyxARSl3ol2G1RMLMwepr3v6Ter5ls3jiAlheKshgg0K)', + start: 1726506000, + ton: { + tvl: sumTokensExport({ owner: AQUA_ADDRESS, tokens: [ADDRESSES.null]}), + } +} diff --git a/projects/arable-protocol/index.js b/projects/arable-protocol/index.js index 74db2b8336a5..02538413b2a3 100644 --- a/projects/arable-protocol/index.js +++ b/projects/arable-protocol/index.js @@ -1,5 +1,5 @@ const { staking } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const acre = "0x00ee200df31b869a321b10400da10b561f3ee60d"; const stakingContract = "0x4bc722Cd3F7b29ae3A5e0a17a61b72Ea5020502B"; @@ -11,6 +11,6 @@ module.exports = { avax:{ tvl: async () => ({}), staking: staking(stakingContract, acre), - pool2: pool2Exports(farming, [acrewavaxpgl], "avax") + pool2: pool2(farming, [acrewavaxpgl], "avax") } } \ No newline at end of file diff --git a/projects/arbicheems/index.js b/projects/arbicheems/index.js index b1e6962476d2..8ccb415a5993 100644 --- a/projects/arbicheems/index.js +++ b/projects/arbicheems/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { stakingUnknownPricedLP } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); +const { staking } = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); const cheems = "0x75a2f30929C539E7d4eE033c9331b89F879c0cf7"; const stakingContract = "0xaaCcB989FE1084c6935f09aE4BBD49AfF58Bdb94"; @@ -13,50 +13,11 @@ const ethPool = "0xd495Beb0011e3DFEC0C93376f5216C1C3dD01C23"; const cheemsEthPool = "0x1382EcDf09507ba87022c79312DfAfb2A5063d73"; const cheemsEthSLP = "0xce786f1f3d3025fe4a64e37d28fa76311ff5253f"; -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - - const ethBal = ( - await sdk.api.eth.getBalance({ - target: ethPool, - block: chainBlocks.arbitrum, - chain: "arbitrum", - }) - ).output; - sdk.util.sumSingleBalance( - balances, - ADDRESSES.ethereum.WETH, - ethBal - ); - - const mimBal = ( - await sdk.api.erc20.balanceOf({ - target: mim, - owner: mimPool, - block: chainBlocks.arbitrum, - chain: "arbitrum", - }) - ).output; - sdk.util.sumSingleBalance(balances, `arbitrum:${mim}`, mimBal); - - return balances; -} - module.exports = { + deadFrom: '2022-02-22', arbitrum: { - tvl, - staking: stakingUnknownPricedLP( - stakingContract, - cheems, - "arbitrum", - cheemsEthSLP, - (addr) => `arbitrum:${addr}` - ), - pool2: pool2Exports( - cheemsEthPool, - [cheemsEthSLP], - "arbitrum", - (addr) => `arbitrum:${addr}` - ), + tvl: sumTokensExport({ tokensAndOwners: [[nullAddress, ethPool], [mim, mimPool]] }), + staking: staking(stakingContract, cheems,), + pool2: pool2(cheemsEthPool, [cheemsEthSLP],), }, }; diff --git a/projects/arbinyan/index.js b/projects/arbinyan/index.js index 57b4c5a4683e..f8a6bd5f6fab 100644 --- a/projects/arbinyan/index.js +++ b/projects/arbinyan/index.js @@ -1,83 +1,21 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); +const { pool2 } = require("../helper/pool2"); const { staking } = require("../helper/staking"); -const BigNumber = require("bignumber.js"); +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); const stakingETHContract = "0x9F7968de728aC7A6769141F63dCA03FD8b03A76F"; -const WETH = ADDRESSES.ethereum.WETH; const stakingNYANContract = "0x32e5594F14de658b0d577D6560fA0d9C6F1aa724"; const NYAN = "0xed3fb761414da74b74f33e5c5a1f78104b188dfc"; const stakingPool2Contract = "0x62FF5Be795262999fc1EbaC29277575031d2dA2C"; -const NYAN_WETH_SLP = "0x70Df9Dd83be2a9F9Fcc58Dd7C00d032d007b7859"; -const WETH_arb = ADDRESSES.arbitrum.WETH; - -async function pool2(time, ethBlock, chainBlocks) { - const balances = {}; - - const balance_slp = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: NYAN_WETH_SLP, - params: stakingPool2Contract, - chain: "arbitrum", - block: chainBlocks["arbitrum"], - }) - ).output; - - const totalSupply_slp = ( - await sdk.api.erc20.totalSupply({ - target: NYAN_WETH_SLP, - chain: "arbitrum", - block: chainBlocks["arbitrum"], - }) - ).output; - - const underlyingsBalance = ( - await sdk.api.abi.multiCall({ - calls: [NYAN, WETH_arb].map((token) => ({ - target: token, - params: NYAN_WETH_SLP, - })), - abi: 'erc20:balanceOf', - chain: "arbitrum", - block: chainBlocks["arbitrum"], - }) - ).output; - - underlyingsBalance.forEach((call) => { - const underlyingSetBalance = BigNumber(call.output) - .times(balance_slp) - .div(totalSupply_slp); - - sdk.util.sumSingleBalance( - balances, - `arbitrum:${call.input.target}`, - underlyingSetBalance.toFixed(0) - ); - }); - - return balances; -} - -async function arbTvl(time, _ethBlock, {arbitrum: block}) { - const eth = await sdk.api.eth.getBalance({ - target: stakingETHContract, - block, - chain: "arbitrum", - }); - return { - [WETH]: eth.output, - }; -} +const NYAN_WETH_SLP = "0x70df9dd83be2a9f9fcc58dd7c00d032d007b7859"; module.exports = { misrepresentedTokens: true, arbitrum: { staking: staking(stakingNYANContract, NYAN), - pool2: pool2, - tvl: arbTvl, + pool2: pool2(stakingPool2Contract, NYAN_WETH_SLP), + tvl: sumTokensExport({ owner: stakingETHContract, tokens: [nullAddress] }), }, methodology: "Counts as TVL the ETH asset deposited through StakingETH Contract, and we count Staking and Pool2 parts in the same way", diff --git a/projects/arbirise-finance/abis/arbiStakerERC20.json b/projects/arbirise-finance/abis/arbiStakerERC20.json deleted file mode 100644 index c9224c60fa21..000000000000 --- a/projects/arbirise-finance/abis/arbiStakerERC20.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "stakedTokenTotal": "function stakedTokenTotal(address) view returns (uint256)", - "getNumTokensStaked": "uint256:getNumTokensStaked", - "getTokenStakedAt": "function getTokenStakedAt(uint256 index) view returns (address token)" -} \ No newline at end of file diff --git a/projects/arbirise-finance/contracts.json b/projects/arbirise-finance/contracts.json deleted file mode 100644 index b402c911dda9..000000000000 --- a/projects/arbirise-finance/contracts.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "arbiStaker": "0x6a894bd1A5476Bdc52B709623B8751e244E6e975", - "sushiFactoryAddress": "0xc35DADB65012eC5796536bD9864eD8773aBc74C4", - "weth": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", - "usdc": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", - "usdcWethPair": "0x905dfCD5649217c42684f23958568e533C711Aa3" -} diff --git a/projects/arbirise-finance/getPrice.js b/projects/arbirise-finance/getPrice.js deleted file mode 100644 index b3cd1bfeda6a..000000000000 --- a/projects/arbirise-finance/getPrice.js +++ /dev/null @@ -1,146 +0,0 @@ -const sdk = require("@defillama/sdk"); -const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)'; -const token0 = "address:token0"; -const contracts = require("./contracts.json"); -const { default: BigNumber } = require("bignumber.js"); - -const getETHPrice = async (block) => { - const reserves = ( - await sdk.api.abi.call({ - target: contracts["usdcWethPair"], - abi: getReserves, - block: block, - chain: "arbitrum", - }) - ).output; - - const _token0 = ( - await sdk.api.abi.call({ - target: contracts["usdcWethPair"], - abi: token0, - block: block, - chain: "arbitrum", - }) - ).output; - - const WETHReserve = new BigNumber( - _token0.toLowerCase() === contracts["weth"].toLowerCase() - ? reserves._reserve0 - : reserves._reserve1 - ).div(1e18); - const USDCReserve = new BigNumber( - _token0.toLowerCase() === contracts["usdc"].toLowerCase() - ? reserves._reserve0 - : reserves._reserve1 - ).div(1e6); - - return new BigNumber(USDCReserve).div(new BigNumber(WETHReserve)); -}; - -const getPrice = async (tokenAddress, block) => { - try { - const ETHPrice = await getETHPrice(block); - - const symbol = ( - await sdk.api.abi.call({ - target: tokenAddress, - abi: "erc20:symbol", - chain: "arbitrum", - block - }) - ).output; - - const isLp = symbol === "SLP"; - - if (tokenAddress.toLowerCase() === contracts["weth"].toLowerCase()) { - return { price: ETHPrice, decimals: 18 }; - } - - const pairAddress = isLp - ? tokenAddress - : ( - await sdk.api.abi.call({ - target: contracts["sushiFactoryAddress"], - abi: 'function getPair(address, address) view returns (address)', - params: [tokenAddress, contracts["weth"]], - block: block, - chain: "arbitrum", - }) - ).output; - - const reserves = ( - await sdk.api.abi.call({ - target: pairAddress, - abi: getReserves, - block: block, - chain: "arbitrum", - }) - ).output; - - const _token0 = ( - await sdk.api.abi.call({ - target: pairAddress, - abi: token0, - block: block, - chain: "arbitrum", - }) - ).output; - - const decimals = ( - await sdk.api.abi.call({ - target: tokenAddress, - abi: "erc20:decimals", - chain: "arbitrum", - block - }) - ).output; - - const WETHReserve = new BigNumber( - _token0.toLowerCase() === contracts["weth"].toLowerCase() - ? reserves._reserve0 - : reserves._reserve1 - ).div(1e18); - const tokenReserve = new BigNumber( - _token0.toLowerCase() === tokenAddress.toLowerCase() - ? reserves._reserve0 - : reserves._reserve1 - ).div(`1e${decimals}`); - - if (isLp) { - const totalSupply = ( - await sdk.api.abi.call({ - target: tokenAddress, - abi: "erc20:totalSupply", - chain: "arbitrum", - block - }) - ).output; - - return { - price: new BigNumber(WETHReserve) - .times(ETHPrice) - .times(2) - .div(new BigNumber(totalSupply).div(`1e${decimals}`)), - decimals, - }; - } - - const priceInETH = new BigNumber(tokenReserve).div( - new BigNumber(WETHReserve) - ); - - return { - price: ETHPrice.div(priceInETH), - decimals, - }; - } catch (e) { - return { - price: new BigNumber(0), - decimals: 0, - }; - } -}; - -module.exports = { - getPrice, -}; diff --git a/projects/arbirise-finance/index.js b/projects/arbirise-finance/index.js index d7f66d495bc8..d6ef6d37e07e 100644 --- a/projects/arbirise-finance/index.js +++ b/projects/arbirise-finance/index.js @@ -1,65 +1,18 @@ -const sdk = require("@defillama/sdk"); -const arbiStakerERC20 = require("./abis/arbiStakerERC20.json"); -const contracts = require("./contracts.json"); -const { default: BigNumber } = require("bignumber.js"); -const { getPrice } = require("./getPrice"); - -async function tvl(time, _ethBlock, {arbitrum: block}) { - - const nbOfPrograms = ( - await sdk.api.abi.call({ - block, - target: contracts["arbiStaker"], - abi: arbiStakerERC20["getNumTokensStaked"], - chain: "arbitrum", - }) - ).output; - - const stakingTokens = ( - await sdk.api.abi.multiCall({ - block, - abi: arbiStakerERC20["getTokenStakedAt"], - calls: [...Array(+nbOfPrograms).keys()].map((index) => ({ - target: contracts["arbiStaker"], - params: index, - })), - chain: "arbitrum", - }) - ).output.map((o) => o.output); - - const stakedByProgram = ( - await sdk.api.abi.multiCall({ - block, - abi: arbiStakerERC20["stakedTokenTotal"], - calls: stakingTokens.map((token) => ({ - target: contracts["arbiStaker"], - params: token, - })), - chain: "arbitrum", - }) - ).output; - - let balances = {}; - - for (let i = 0; i < stakedByProgram.length; i++) { - const { price, decimals } = await getPrice( - stakedByProgram[i].input.params[0], - block - ); - const staked = new BigNumber(stakedByProgram[i].output).div( - `1e${decimals}` - ); - // Adding USDC decimals (6)again here `price.times(staked).times(1e6)` because `sumSingleBalance` will remove them - const rewardProgramTVL = price.times(staked).times(1e6).toFixed(0); - sdk.util.sumSingleBalance( - balances, - `arbitrum:${contracts["usdc"]}`, - rewardProgramTVL - ); - } - - return balances; +const abi = { + "stakedTokenTotal": "function stakedTokenTotal(address) view returns (uint256)", + "getNumTokensStaked": "uint256:getNumTokensStaked", + "getTokenStakedAt": "function getTokenStakedAt(uint256 index) view returns (address token)" } +const { sumTokens2 } = require("../helper/unwrapLPs"); + +async function tvl(api) { + const staker = '0x6a894bd1A5476Bdc52B709623B8751e244E6e975'; + const tokens = await api.fetchList({ lengthAbi: abi.getNumTokensStaked, itemAbi: abi.getTokenStakedAt, target: staker}) + const bals = await api.multiCall({ abi: abi.stakedTokenTotal, calls: tokens, target: staker}) + api.add(tokens, bals) + return sumTokens2({ api, resolveLP: true}) +} + module.exports = { methodology: diff --git a/projects/arcadia-finance-v2/index.js b/projects/arcadia-finance-v2/index.js index 561698f4362f..88571f13dcc9 100644 --- a/projects/arcadia-finance-v2/index.js +++ b/projects/arcadia-finance-v2/index.js @@ -6,6 +6,7 @@ const config = { pools: { wethPool: "0x803ea69c7e87D1d6C86adeB40CB636cC0E6B98E2", usdcPool: "0x3ec4a293Fb906DD2Cd440c20dECB250DeF141dF1", + cbbtcPool: "0xa37E9b4369dc20940009030BfbC2088F09645e3B" }, uniNFT: "0x03a520b32c04bf3beef7beb72e919cf822ed34f1", slipNFT: "0x827922686190790b37229fd06084350e74485b72", diff --git a/projects/argofinance/index.js b/projects/argofinance/index.js index 065d7c9e99f4..62e70315a65f 100644 --- a/projects/argofinance/index.js +++ b/projects/argofinance/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { queryV1Beta1 } = require("../helper/chain/cosmos"); const sdk = require("@defillama/sdk"); @@ -5,7 +6,7 @@ async function tvl() { const data = await queryV1Beta1({ chain: 'cronos', url: '/staking/v1beta1/delegations/cro1klkxkl2c59m5dcw4w0683ctfaxklsy9py26jg3', }) let total = data.delegation_responses.reduce((a, i) => a += +i.balance.amount, 0) const balances = {} - sdk.util.sumSingleBalance(balances, 'cronos:0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23', total * 1e10) + sdk.util.sumSingleBalance(balances, 'cronos:' + ADDRESSES.cronos.WCRO_1, total * 1e10) return balances } diff --git a/projects/aries-markets/index.js b/projects/aries-markets/index.js index 20a2e72f70b9..2a5ac2351480 100644 --- a/projects/aries-markets/index.js +++ b/projects/aries-markets/index.js @@ -1,5 +1,4 @@ const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); const { getResources, getTableData, } = require("../helper/chain/aptos"); const { transformBalances } = require("../helper/portedTokens"); const toHex = (str) => Buffer.from(str, 'utf-8').toString('hex'); @@ -11,7 +10,8 @@ async function _getResources() { return resourcesCache } const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastIndexOf(">")); -const reserveContrainerFilter = (i) => i.type.includes("0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3::reserve::ReserveCoinContainer") +const reserveContrainerFilter = (i) => i.type.includes("0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3::reserve::ReserveCoinContainer"); +const faWrapperFilter = (i) => i.type.includes("0x9770fa9c725cbd97eb50b2be5f7416efdfd1f1554beb0750d4dae4c64e860da3::fa_to_coin_wrapper::WrapperCoinInfo"); module.exports = { timetravel: false, @@ -26,11 +26,20 @@ module.exports = { lamports: i.data.underlying_coin.value, tokenAddress: extractCoinAddress(i.type), })); + const faWrappers = data.filter(faWrapperFilter) + .map((i) => ({ + lamports: i.data.fa_amount, + faAddress: i.data.metadata.inner, + })); coinContainers.forEach(({ lamports, tokenAddress }) => { sdk.util.sumSingleBalance(balances, tokenAddress, lamports); }); + faWrappers.forEach(({ lamports, faAddress }) => { + sdk.util.sumSingleBalance(balances, faAddress, lamports); + }); + return transformBalances("aptos", balances); }, borrowed: async () => { @@ -59,10 +68,13 @@ module.exports = { }); const total_borrowed = BigInt(reserveStatus.total_borrowed.val) / BigInt(10 ** 18); + + const faInfo = data.filter(faWrapperFilter).filter((i) => i.type.includes(coin_type)); + const normalizedAddress = faInfo.length == 0 ? coin_type : faInfo[0].data.metadata.inner; return { lamports: total_borrowed.toString(), - tokenAddress: coin_type, + tokenAddress: normalizedAddress, }; }) ); diff --git a/projects/armada/index.js b/projects/armada/index.js index f27dbd7bee12..3184eed7f8f9 100644 --- a/projects/armada/index.js +++ b/projects/armada/index.js @@ -1,11 +1,10 @@ -const BN = require("bn.js"); -const BigNumber = require("bignumber.js"); const { ArmadaIDL, WhirpoolIDL } = require("./idl"); const { getProvider, sumTokens2 } = require("../helper/solana"); const { Program } = require("@project-serum/anchor"); const { PublicKey } = require("@solana/web3.js"); +const { addUniV3LikePosition } = require("../helper/unwrapLPs"); -async function tvl() { +async function tvl(api) { const anchorProvider = getProvider(); const programId = new PublicKey( "ArmN3Av2boBg8pkkeCK9UuCN9zSUVc2UQg1qR2sKwm8d" @@ -46,307 +45,24 @@ async function tvl() { return agg; }, {}); // Convert Positions to token amounts - const balances = {}; - positions.forEach((position) => { + + for (const position of positions) { const whirlpool = whirlpoolMap[position.whirlpool.toString()]; - const sqrtPriceLowerX64 = tickIndexToSqrtPriceX64(position.tickLowerIndex); - const sqrtPriceUpperX64 = tickIndexToSqrtPriceX64(position.tickUpperIndex); - const { tokenA, tokenB } = getTokenAmountsFromLiquidity( - position.liquidity, - whirlpool.sqrtPrice, - sqrtPriceLowerX64, - sqrtPriceUpperX64, - true - ); - const balanceKeyA = `solana:${whirlpool.tokenMintA.toString()}`; - const balanceKeyB = `solana:${whirlpool.tokenMintB.toString()}`; - const prevBalanceA = balances[balanceKeyA]; - const prevBalanceB = balances[balanceKeyB]; - balances[balanceKeyA] = prevBalanceA ? prevBalanceA.add(tokenA) : tokenA; - balances[balanceKeyB] = prevBalanceB ? prevBalanceB.add(tokenB) : tokenB; - }); - Object.keys(balances).forEach((key) => { - balances[key] = balances[key].toString() - }) + const tickLower = position.tickLowerIndex + const tickUpper = position.tickUpperIndex + const tick = whirlpool.tickCurrentIndex + const liquidity = position.liquidity + const token0 = whirlpool.tokenMintA.toString() + const token1 = whirlpool.tokenMintB.toString() + addUniV3LikePosition({ api, token0, token1, liquidity, tickLower, tickUpper, tick }) + } + return sumTokens2({ tokenAccounts: vaultTokenAccounts, - balances, + balances: api.getBalances() }); } -const tickIndexToSqrtPriceX64 = (tickIndex) => { - if (tickIndex > 0) { - return new BN(tickIndexToSqrtPricePositive(tickIndex)); - } else { - return new BN(tickIndexToSqrtPriceNegative(tickIndex)); - } -}; - -function tickIndexToSqrtPricePositive(tick) { - let ratio; - - if ((tick & 1) != 0) { - ratio = new BN("79232123823359799118286999567"); - } else { - ratio = new BN("79228162514264337593543950336"); - } - - if ((tick & 2) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79236085330515764027303304731")), - 96, - 256 - ); - } - if ((tick & 4) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79244008939048815603706035061")), - 96, - 256 - ); - } - if ((tick & 8) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79259858533276714757314932305")), - 96, - 256 - ); - } - if ((tick & 16) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79291567232598584799939703904")), - 96, - 256 - ); - } - if ((tick & 32) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79355022692464371645785046466")), - 96, - 256 - ); - } - if ((tick & 64) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79482085999252804386437311141")), - 96, - 256 - ); - } - if ((tick & 128) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("79736823300114093921829183326")), - 96, - 256 - ); - } - if ((tick & 256) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("80248749790819932309965073892")), - 96, - 256 - ); - } - if ((tick & 512) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("81282483887344747381513967011")), - 96, - 256 - ); - } - if ((tick & 1024) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("83390072131320151908154831281")), - 96, - 256 - ); - } - if ((tick & 2048) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("87770609709833776024991924138")), - 96, - 256 - ); - } - if ((tick & 4096) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("97234110755111693312479820773")), - 96, - 256 - ); - } - if ((tick & 8192) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("119332217159966728226237229890")), - 96, - 256 - ); - } - if ((tick & 16384) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("179736315981702064433883588727")), - 96, - 256 - ); - } - if ((tick & 32768) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("407748233172238350107850275304")), - 96, - 256 - ); - } - if ((tick & 65536) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("2098478828474011932436660412517")), - 96, - 256 - ); - } - if ((tick & 131072) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("55581415166113811149459800483533")), - 96, - 256 - ); - } - if ((tick & 262144) != 0) { - ratio = signedShiftRight( - ratio.mul(new BN("38992368544603139932233054999993551")), - 96, - 256 - ); - } - - return signedShiftRight(ratio, 32, 256); -} - -function tickIndexToSqrtPriceNegative(tickIndex) { - let tick = Math.abs(tickIndex); - let ratio; - - if ((tick & 1) != 0) { - ratio = new BN("18445821805675392311"); - } else { - ratio = new BN("18446744073709551616"); - } - - if ((tick & 2) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18444899583751176498")), 64, 256); - } - if ((tick & 4) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18443055278223354162")), 64, 256); - } - if ((tick & 8) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18439367220385604838")), 64, 256); - } - if ((tick & 16) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18431993317065449817")), 64, 256); - } - if ((tick & 32) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18417254355718160513")), 64, 256); - } - if ((tick & 64) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18387811781193591352")), 64, 256); - } - if ((tick & 128) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18329067761203520168")), 64, 256); - } - if ((tick & 256) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("18212142134806087854")), 64, 256); - } - if ((tick & 512) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("17980523815641551639")), 64, 256); - } - if ((tick & 1024) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("17526086738831147013")), 64, 256); - } - if ((tick & 2048) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("16651378430235024244")), 64, 256); - } - if ((tick & 4096) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("15030750278693429944")), 64, 256); - } - if ((tick & 8192) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("12247334978882834399")), 64, 256); - } - if ((tick & 16384) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("8131365268884726200")), 64, 256); - } - if ((tick & 32768) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("3584323654723342297")), 64, 256); - } - if ((tick & 65536) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("696457651847595233")), 64, 256); - } - if ((tick & 131072) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("26294789957452057")), 64, 256); - } - if ((tick & 262144) != 0) { - ratio = signedShiftRight(ratio.mul(new BN("37481735321082")), 64, 256); - } - - return ratio; -} - -function signedShiftRight(n0, shiftBy, bitWidth) { - let twoN0 = n0.toTwos(bitWidth).shrn(shiftBy); - twoN0.imaskn(bitWidth - shiftBy + 1); - return twoN0.fromTwos(bitWidth - shiftBy); -} - -const getTokenAmountsFromLiquidity = ( - liquidity, - currentSqrtPrice, - lowerSqrtPrice, - upperSqrtPrice, - round_up -) => { - const _liquidity = new BigNumber(liquidity.toString()); - const _currentPrice = new BigNumber(currentSqrtPrice.toString()); - const _lowerPrice = new BigNumber(lowerSqrtPrice.toString()); - const _upperPrice = new BigNumber(upperSqrtPrice.toString()); - let tokenA, tokenB; - if (currentSqrtPrice.lt(lowerSqrtPrice)) { - // x = L * (pb - pa) / (pa * pb) - tokenA = toX64_Decimal(_liquidity) - .times(_upperPrice.minus(_lowerPrice)) - .div(_lowerPrice.times(_upperPrice)); - tokenB = new BigNumber(0); - } else if (currentSqrtPrice.lt(upperSqrtPrice)) { - // x = L * (pb - p) / (p * pb) - // y = L * (p - pa) - tokenA = toX64_Decimal(_liquidity) - .times(_upperPrice.minus(_currentPrice)) - .div(_currentPrice.times(_upperPrice)); - tokenB = fromX64_Decimal(_liquidity.times(_currentPrice.minus(_lowerPrice))); - } else { - // y = L * (pb - pa) - tokenA = new BigNumber(0); - tokenB = fromX64_Decimal(_liquidity.times(_upperPrice.minus(_lowerPrice))); - } - - if (round_up) { - return { - tokenA: new BN(tokenA.integerValue(BigNumber.ROUND_CEIL).toString()), - tokenB: new BN(tokenB.integerValue(BigNumber.ROUND_CEIL).toString()), - }; - } else { - return { - tokenA: new BN(tokenA.integerValue(BigNumber.ROUND_FLOOR).toString()), - tokenB: new BN(tokenB.integerValue(BigNumber.ROUND_FLOOR).toString()), - }; - } -}; - -const toX64_Decimal = (num) => { - return num.times(new BigNumber(2).pow(64)); -}; - -const fromX64_Decimal = (num) => { - return num.times(new BigNumber(2).pow(-64)); -}; - module.exports = { doublecounted: true, misrepresentedTokens: true, diff --git a/projects/arrakis-modular/index.js b/projects/arrakis-modular/index.js new file mode 100644 index 000000000000..a9a7ed4b1388 --- /dev/null +++ b/projects/arrakis-modular/index.js @@ -0,0 +1,41 @@ +const config = { + ethereum: { + factory: '0x820FB8127a689327C863de8433278d6181123982', + fromBlock: 20540819, + }, + arbitrum: { + factory: '0x820FB8127a689327C863de8433278d6181123982', + fromBlock: 243467827, + }, + base: { + factory: '0x820FB8127a689327C863de8433278d6181123982', + fromBlock: 18512550, + }, +} + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach(chain => { + const { factory } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const numPublicVaults = await api.call({ abi: 'uint256:numOfPublicVaults', target: factory }) + const numPrivateVaults = await api.call({ abi: 'uint256:numOfPrivateVaults', target: factory }) + const publicVaults = numPublicVaults > 0 ? await api.call({ abi: 'function publicVaults(uint256 startIndex_, uint256 endIndex_) returns (address[] memory)', target: factory, params: [0, numPublicVaults] }) : [] + const privateVaults = numPrivateVaults > 0 ? await api.call({ abi: 'function privateVaults(uint256 startIndex_, uint256 endIndex_) returns (address[] memory)', target: factory, params: [0, numPrivateVaults] }) : [] + const vaults = [...publicVaults, ...privateVaults] + const [token0s, token1s, bals] = await Promise.all([ + api.multiCall({ abi: 'address:token0', calls: vaults }), + api.multiCall({ abi: 'address:token1', calls: vaults }), + api.multiCall({ abi: 'function totalUnderlying() view returns (uint256, uint256)', calls: vaults }), + ]) + + bals.forEach(([v0, v1], i) => { + api.add(token0s[i], v0) + api.add(token1s[i], v1) + }) + } + } +}) \ No newline at end of file diff --git a/projects/arrland/index.js b/projects/arrland/index.js new file mode 100644 index 000000000000..737a9c718247 --- /dev/null +++ b/projects/arrland/index.js @@ -0,0 +1,17 @@ + +const { stakings } = require("../helper/staking"); +const { pool2s } = require("../helper/pool2"); + +const stakingAddresses = ["0x111e34bA90D1dE9a2A57f987b5711C71FA4c0Fa0"]; +const stakingToken = "0x14e5386f47466a463f85d151653e1736c0c50fc3"; +const pool2StakingAddresses = ["0xEAf6E84B4E4C2Ce70a80fd781B6A7f177E7b60F5", "0xb94380939A15C574FE22B04FC95Ec5CCaAD783b8"]; +const lpTokens = ["0x6495b61b8088a0a82de737ffb142136119b016e6", "0x464b7eb1c66d662e652dfbfced35d465498ad9ac"]; + +module.exports = { + polygon: { + tvl: () => 0, + staking: stakings(stakingAddresses, stakingToken, "polygon"), + pool2: pool2s(pool2StakingAddresses, lpTokens, "polygon") + }, + methodology: "Counts total value locked as the $RUM token staking, LP token staking", +} \ No newline at end of file diff --git a/projects/arrow-markets/index.js b/projects/arrow-markets/index.js new file mode 100644 index 000000000000..7c9065442323 --- /dev/null +++ b/projects/arrow-markets/index.js @@ -0,0 +1,11 @@ +async function staking(api) { + const bal = await api.call({ abi: 'uint256:totalStakeAmounts', target: '0x9193957DC6d298a83afdA45A83C24c6C397b135f' }) + api.add('0x5c5e384Bd4e36724B2562cCAA582aFd125277C9B', bal) +} + +module.exports = { + avax: { + tvl: () => ({}), + staking, + } +} \ No newline at end of file diff --git a/projects/ascentyield/index.js b/projects/ascentyield/index.js new file mode 100644 index 000000000000..2cffc9780d8f --- /dev/null +++ b/projects/ascentyield/index.js @@ -0,0 +1,38 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/solana"); +const { post } = require('../helper/http'); +const { sumTokensExport } = require("../helper/unwrapLPs") + + +const hyperliquidSubAccount = "0x75b2e5c67d2116bcf1b77c5e6444fc18bc5d38a4" // for trading at hyperliquid +const jlpholder = "9nAgg9wAnuiPv57dXkmCwoGhhbTHS1RRzvYLjnRGZtXp" // for keeping JLP and USDC(buy JLP) +const arbiusdcholder = "0xa6Ff9a77D6bD8B0a759055Cd8885e23228bc10Ec" // USDC on arbi(will bridge to solana) +const hyperliquidMainAccount = "0x7151609Fdc7E0Cac89FB9720F0957AF9d552f8f9" // will transfer USDC to sub account + + +module.exports = { + methodology: "Aggregate trading account margins in HyperLiquid and JLP, USDC on the solana network.", + solana: { + tvl: async (api) => { + return sumTokens2({ + owner: jlpholder + }); + }, + }, + hyperliquid: { + tvl: async (api) => { + let data = await post('https://api.hyperliquid.xyz/info', { + type: "clearinghouseState", + user: hyperliquidSubAccount + }) + data = parseInt(data.marginSummary.accountValue) + api.addCGToken('usd-coin', data) + } + }, + arbitrum: { + tvl: sumTokensExport({ + owners: [arbiusdcholder, hyperliquidMainAccount], + tokens: [ADDRESSES.arbitrum.USDC_CIRCLE,] + }) + }, +}; diff --git a/projects/asgardfinance/index.js b/projects/asgardfinance/index.js index bf5323aaa83c..537325ed1bb5 100644 --- a/projects/asgardfinance/index.js +++ b/projects/asgardfinance/index.js @@ -1,68 +1,17 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { staking } = require('../helper/staking'); const AsgardStaking = "0x4EA2bb6Df87F66cbea70818aE92f3A48F98EBC93"; const ASG = "0x0DC5189Ec8CDe5732a01F0F592e927B304370551"; -const AsgardTreasury = "0x9D5818af130705F95444d78A55B4F3d85cBfCC13"; - -const DAI = ADDRESSES.ethereum.DAI; -const ASG_DAI_SLP = "0x024cc95611d478dd367240e72c82662d9e390a6a"; -const FRAX = ADDRESSES.ethereum.FRAX; -const ASG_FRAX_SLP = "0x5696cd9054ce11625141f5ee2c65fc4d57c2a5ca"; -const WUST = "0xa47c8bf37f92abed4a126bda807a7b7498661acd"; -const ASG_UST_SLP = "0x5a1abc007f031aa58238f45941d965ce6892fdff"; - -/*** Staking of native token (ASG) TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: ASG, - params: AsgardStaking, - block: ethBlock, - }) - ).output; - - sdk.util.sumSingleBalance(balances, ASG, stakingBalance); - - return balances; -}; - -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of DAI, UST and FRAX balances + Sushi SLPs balance - ***/ -async function ethTvl(timestamp, block) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [FRAX, false], - [WUST, false], - [ASG_DAI_SLP, true], - [ASG_FRAX_SLP, true], - [ASG_UST_SLP, true], - ], - [AsgardTreasury], - block - ); - - return balances; -} - module.exports = { hallmarks: [ [1643155200, "Token mint exploit"] ], ethereum: { - staking, - tvl: ethTvl, + staking: staking(AsgardStaking, ASG), + tvl: () => ({}), }, + deadFrom: '2021-08-28', methodology: "Counts DAI, DAI SLP (ASG-DAI), FRAX, FRAX SLP (ASG-FRAX), UST, UST SLP (ASG-UST) on the treasury", }; diff --git a/projects/assetchain-swap/index.js b/projects/assetchain-swap/index.js new file mode 100644 index 000000000000..ec189ab1a567 --- /dev/null +++ b/projects/assetchain-swap/index.js @@ -0,0 +1,3 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ assetchain: { factory: '0xa9d53862D01190e78dDAf924a8F497b4F8bb5163', fromBlock: 17598, } }) \ No newline at end of file diff --git a/projects/asteria-finance/asteriaFinance.js b/projects/asteria-finance/asteriaFinance.js new file mode 100644 index 000000000000..ef1389d25485 --- /dev/null +++ b/projects/asteria-finance/asteriaFinance.js @@ -0,0 +1,26 @@ +function asteriaFinanceExport(config) { + const exports = { + methodology: 'We count the token balances in in different liquidity book contracts', + } + + Object.keys(config).forEach(chain => { + let { factory } = config[chain] + + 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 tokensAndOwners2 = [tokenA.concat(tokenB), pools.concat(pools)] + return api.sumTokens({ tokensAndOwners2 }) + } + } + }) + + return exports +} + + +module.exports = { + asteriaFinanceExport, +} \ No newline at end of file diff --git a/projects/asteria-finance/index.js b/projects/asteria-finance/index.js new file mode 100644 index 000000000000..d582769ab3db --- /dev/null +++ b/projects/asteria-finance/index.js @@ -0,0 +1,5 @@ +const { asteriaFinanceExport } = require('./asteriaFinance') + +module.exports = asteriaFinanceExport({ + scroll: { factory: '0x77C99431b679e21C42464f1714221eAE94C1e3ed' }, +}) \ No newline at end of file diff --git a/projects/asteroneo/index.js b/projects/asteroneo/index.js new file mode 100644 index 000000000000..dcc2069e3902 --- /dev/null +++ b/projects/asteroneo/index.js @@ -0,0 +1,5 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + neox: { tvl: getUniTVL({ factory: '0x1dAbb81D9Faeb1DF4a8c97A60C5269c7D45e66B0', useDefaultCoreAssets: true })} +} \ No newline at end of file diff --git a/projects/astherus-basis-trading/index.js b/projects/astherus-basis-trading/index.js new file mode 100644 index 000000000000..79fcfcc24c6d --- /dev/null +++ b/projects/astherus-basis-trading/index.js @@ -0,0 +1,10 @@ +const USDF = "0x5A110fC00474038f6c02E89C707D638602EA44B5" + +module.exports = { + bsc: { + tvl: async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: USDF }) + api.add(USDF, supply) + }, + } +} \ No newline at end of file diff --git a/projects/astherus/index.js b/projects/astherus/index.js index e3e924285ffb..de07fb304d71 100644 --- a/projects/astherus/index.js +++ b/projects/astherus/index.js @@ -1,4 +1,5 @@ const { getConfig } = require('../helper/cache') +const { sumTokens2 } = require('../helper/solana') const config = { bsc: '0x128463A60784c4D3f46c23Af3f65Ed859Ba87974', @@ -18,4 +19,11 @@ Object.keys(config).forEach(chain => { return api.sumTokens({ owner: vault, tokens }) } } -}) \ No newline at end of file +}) + +module.exports['solana'] = { + tvl: async function (...rest) { + const { data: tokens } = await getConfig(`astherus/solana`, `https://astherus.finance/bapi/futures/v1/public/future/web3/ae-deposit-asset?network=SOL`) + return sumTokens2({ tokenAccounts: tokens.map(({ tokenVault }) => [tokenVault]).flat() }) + } +} diff --git a/projects/astroport-classic/index.js b/projects/astroport-classic/index.js index b15e40f8b5e1..f0b4b13d1191 100644 --- a/projects/astroport-classic/index.js +++ b/projects/astroport-classic/index.js @@ -5,9 +5,11 @@ module.exports = { misrepresentedTokens: true, methodology: "Liquidity on the DEX", terra: { - tvl: getFactoryTvl("terra1fnywlw4edny3vw44x04xd67uzkdqluymgreu7g",) + // tvl: getFactoryTvl("terra1fnywlw4edny3vw44x04xd67uzkdqluymgreu7g",) // it stopped working and team no long maintains it + tvl: () => ({}) }, hallmarks: [ [1651881600, "UST depeg"], - ] -} // node test.js projects/astroport/index.js + ], + deadFrom: '2024-10-02' +} \ No newline at end of file diff --git a/projects/astroport/index.js b/projects/astroport/index.js index ed71d81eda1d..979e4010725d 100644 --- a/projects/astroport/index.js +++ b/projects/astroport/index.js @@ -11,7 +11,9 @@ module.exports = { tvl: getFactoryTvl("terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r") }, neutron: { - tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e") + tvl: getFactoryTvl("neutron1hptk0k5kng7hjy35vmh009qd5m6l33609nypgf2yc6nqnewduqasxplt4e", { + blacklistedPairs: ['neutron14hn88erzgqskhvvczvdncu79tz4xqncrun5l5yqkwecmzrlpqnjquqp33f'] + }) }, sei: { tvl: getFactoryTvl("sei1xr3rq8yvd7qplsw5yx90ftsr2zdhg4e9z60h5duusgxpv72hud3shh3qfl") diff --git a/projects/astrovault/index.js b/projects/astrovault/index.js index 793056b5ee68..9d3ab70cf716 100644 --- a/projects/astrovault/index.js +++ b/projects/astrovault/index.js @@ -2,17 +2,36 @@ const { queryContract, } = require("../helper/chain/cosmos"); const { PromisePool } = require('@supercharge/promise-pool') const { transformDexBalances } = require('../helper/portedTokens') -const STABLE_FACTORY_ARCHWAY = "archway19yzx44k7w7gsjjhumkd4sh9r0z6lscq583hgpu9s4yyl00z9lahq0ptra0"; -const STANDARD_FACTORY_ARCHWAY = "archway1cq6tgc32az7zpq5w7t2d89taekkn9q95g2g79ka6j46ednw7xkkq7n55a2"; -const HYBRID_FACTORY_ARCHWAY = "archway1zlc00gjw4ecan3tkk5g0lfd78gyfldh4hvkv2g8z5qnwlkz9vqmsdfvs7q"; +const data = { + archway: { + stableFactory: + "archway19yzx44k7w7gsjjhumkd4sh9r0z6lscq583hgpu9s4yyl00z9lahq0ptra0", + standardFactory: + "archway1cq6tgc32az7zpq5w7t2d89taekkn9q95g2g79ka6j46ednw7xkkq7n55a2", + hybridFactory: + "archway1zlc00gjw4ecan3tkk5g0lfd78gyfldh4hvkv2g8z5qnwlkz9vqmsdfvs7q", + }, + neutron: { + stableFactory: + "neutron10rtkhawvvqxp5zmdqn0ehcsygxjgtj64vrg58v6wnf9tn00uu97s7qfcdq", + standardFactory: + "neutron1r27at895fhu6sdj3v8jjra0n2pvu7jxrr3m90py058dkmm83wh8s9qkxw7", + hybridFactory: + "neutron16yn2gcz24s9qwpuxvrhl3xed0pmhrgwx2mz40zrazfc0pt5kq0psucs6xl", + }, +}; async function tvl(api) { const { chain } = api - for (const factory of [STABLE_FACTORY_ARCHWAY, STANDARD_FACTORY_ARCHWAY, HYBRID_FACTORY_ARCHWAY]) { + for (const factory of [ + data[chain].stableFactory, + data[chain].standardFactory, + data[chain].hybridFactory, + ]) { let allPools = []; let pagesRemaining = true; let start_after = null; - const key = factory === STANDARD_FACTORY_ARCHWAY ? 'pairs' : 'pools' + const key = factory === data[chain].standardFactory ? 'pairs' : 'pools' while (pagesRemaining) { const poolsList = await queryContract({ @@ -48,7 +67,7 @@ async function tvl(api) { .for(allPools) .process(getPoolAssetsState) - if (factory === STANDARD_FACTORY_ARCHWAY) await transformDexBalances({ chain, data: poolAssets, balances: api.getBalances() }) + if (factory === data[chain].standardFactory) await transformDexBalances({ chain, data: poolAssets, balances: api.getBalances() }) else { poolAssets.forEach(({ token0, token0Bal, token1, token1Bal }) => { api.add(token0, token0Bal) @@ -63,5 +82,8 @@ module.exports = { misrepresentedTokens: true, archway: { tvl, - } + }, + neutron: { + tvl, + }, } \ No newline at end of file diff --git a/projects/atlantisloans/index.js b/projects/atlantisloans/index.js index 7acc9bff00f1..ae1eeac8bd63 100644 --- a/projects/atlantisloans/index.js +++ b/projects/atlantisloans/index.js @@ -3,8 +3,6 @@ const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); const { compoundExports } = require("../helper/compound"); -const comptroller = "0xE7E304F136c054Ee71199Efa6E26E8b0DAe242F3"; -const polygonComptroller = "0x8f85ee1c0a96734cb76870106dd9c016db6de09a" const avaxComptroller = "0x8f85ee1c0a96734cb76870106dd9c016db6de09a" const dcComptroller = "0xA65722af4957CeF481Edb4cB255f804DD36E8aDc" @@ -19,28 +17,16 @@ module.exports = { bsc: { pool2: pool2(lpVaultStakingContract_BNB, ALT_BUSD_CakeLP_BNB), staking: staking(vaultStakingContract_BNB, ATL), - // ...compoundExports(comptroller, - // "bsc", - // "0x5A9A90983A369b6bB8F062f0AFe6219Ac01caF63", - // ADDRESSES.bsc.WBNB - // ), tvl: async () => ({}), }, - // polygon: compoundExports(polygonComptroller, - // "polygon", - // "0xa65722af4957cef481edb4cb255f804dd36e8adc", - // ADDRESSES.polygon.WMATIC_2 - // ), polygon: { tvl: async () => ({}), }, avax: compoundExports(avaxComptroller, - "avax", "0x6bd2154fbc086cb43411966e0e72584196ccd065", ADDRESSES.avax.WAVAX ), dogechain: compoundExports(dcComptroller, - "dogechain", "0xbc46Dc817ce983CfD1B36cBc599031aCBEc2FDfe", ADDRESSES.dogechain.WWDOGE ), diff --git a/projects/atlas-fi/index.js b/projects/atlas-fi/index.js index f3c59e9c9f59..7bf2132ff79d 100644 --- a/projects/atlas-fi/index.js +++ b/projects/atlas-fi/index.js @@ -30,5 +30,6 @@ module.exports = { tvl, pool2: sumTokensExport({ useDefaultCoreAssets: true, owner: FARM_PROXY, tokens: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'], lps: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'] }), staking: sumTokensExport({ useDefaultCoreAssets: true, owner: FARM_PROXY, tokens: ['0x296A0b8847BD4ED9af71a9ef238fa5Be0778B611'], lps: ['0x4edaa03fc13f8f13c3290c3728f587760b12e381'] }), - } + }, + deadFrom: 1681776000 } diff --git a/projects/atomichub/index.js b/projects/atomichub/index.js index b5936881a911..7b07e90db943 100644 --- a/projects/atomichub/index.js +++ b/projects/atomichub/index.js @@ -12,14 +12,15 @@ async function eos() { // AtomicHub // https://wax.atomichub.io/ async function wax() { + const accounts = ["atomicmarket", "atomicassets"]; const tokens = [ ["eosio.token", "WAX", "wax"], ]; - return await get_account_tvl("atomicmarket", tokens, "wax"); + return await get_account_tvl(accounts, tokens, "wax"); } module.exports = { - methodology: `AtomicHub TVL is achieved by querying token balances from AtomicHub's smart contract.`, + methodology: `AtomicHub TVL is achieved by querying token balances from AtomicHub's smart contracts.`, eos: { tvl: eos }, diff --git a/projects/aura-finance/index.js b/projects/aura-finance/index.js index d4ecb17a4387..07dc07649b39 100644 --- a/projects/aura-finance/index.js +++ b/projects/aura-finance/index.js @@ -68,6 +68,7 @@ const config = { xdai: { factory: '0x83E443EF4f9963C77bd860f94500075556668cb8', fromBlock: 27088527, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, polygon_zkevm: { factory: '0x2498A2B0d6462d2260EAC50aE1C3e03F4829BA95', fromBlock: 203652, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, avax: { factory: '0xf23b4DB826DbA14c0e857029dfF076b1c0264843', fromBlock: 32558551, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, + fraxtal: { factory: '0xc3ccacE87f6d3A81724075ADcb5ddd85a8A1bB68', fromBlock: 4712390, voterProxy: '0xC181Edc719480bd089b94647c2Dc504e2700a2B0' }, } module.exports = { diff --git a/projects/aurigami.js b/projects/aurigami.js index 6df91e0837f7..1fea9e6c36b6 100644 --- a/projects/aurigami.js +++ b/projects/aurigami.js @@ -1,12 +1,9 @@ const { compoundExports } = require("./helper/compound"); module.exports = { - aurora: { - ...compoundExports( - '0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb', - 'aurora', - '0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9', - '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb' - ) - } + aurora: compoundExports( + '0x817af6cfAF35BdC1A634d6cC94eE9e4c68369Aeb', + '0xca9511B610bA5fc7E311FDeF9cE16050eE4449E9', + '0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb' + ) }; \ No newline at end of file diff --git a/projects/avalance-btc/index.js b/projects/avalance-btc/index.js new file mode 100644 index 000000000000..ce1f9d49544b --- /dev/null +++ b/projects/avalance-btc/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require('../helper/sumTokens'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +//https://support.avax.network/en/articles/6349640-how-does-the-avalanche-bridge-work + +module.exports = { + methodology: 'BTC wallets on bc1q2f0tczgrukdxjrhhadpft2fehzpcrwrz549u90', + bitcoin: { + tvl: sumTokensExport({ owners: bitcoinAddressBook.avalanche }), + }, +}; diff --git a/projects/avalon-finance-cedefi/index.js b/projects/avalon-finance-cedefi/index.js new file mode 100644 index 000000000000..2f7e5b71114e --- /dev/null +++ b/projects/avalon-finance-cedefi/index.js @@ -0,0 +1,50 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { sumTokensExport } = require('../helper/sumTokens'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const abi = { + "getPoolManagerReserveInformation": "function getPoolManagerReserveInformation() view returns (tuple(uint256 userAmount, uint256 collateral, uint256 debt, uint256 claimableUSDT, uint256 claimableBTC) poolManagerReserveInfor)" +} + +const config = { + ethereum: { poolAddress: "0x02feDCff97942fe28e8936Cdc3D7A480fdD248f0", lfbtcAddress: "0x3119a1AD5B63A000aB9CA3F2470611eB997B93B9", usdtAddress: ADDRESSES.ethereum.USDT, }, +} + +// @dev btcOwnersOfCedefi: Bitcoin owners of the Avalon CeDefi pool contract. +const btcOwnersOfCedefi = bitcoinAddressBook.avalonCedefi + +// @dev getMetrics: call to get the collateral and debt of the Avalon CeDefi pool contract. +const getMetrics = async (api, borrowed) => { + const { poolAddress, lfbtcAddress, usdtAddress } = config[api.chain] + const marketData = await api.call({ abi: abi.getPoolManagerReserveInformation, target: poolAddress, }); + // @note: no more count collateral on Ethereum, count collateral on Bitcoin instead + // const balanceOfCollateral = marketData.collateral; + const balanceOfDebt = marketData.debt; + if (!borrowed) { + // pool balance of lfbtc + const balance = await api.call({ abi: 'erc20:balanceOf', target: config[api.chain].lfbtcAddress, params: poolAddress}) + api.add(config[api.chain].lfbtcAddress, balance) + } + + if (borrowed) + api.add(usdtAddress, balanceOfDebt); + // else + // api.add(lfbtcAddress, balanceOfCollateral); +} + +module.exports = { + methodology: `lfbtc collateral, USDT debt of Avalon CeDefi pool contract and Bitcoin owners of the Avalon CeDefi pool contract`, + doublecounted: false, + ethereum: { + tvl: (api) => getMetrics(api, false), + borrowed: (api) => getMetrics(api, true), + }, + // bitcoin: { + // tvl: sdk.util.sumChainTvls([ + // sumTokensExport({ owners: btcOwnersOfCedefi }), + // ]), + // }, +} + +delete module.exports.bitcoin diff --git a/projects/avalon-finance-usda/index.js b/projects/avalon-finance-usda/index.js new file mode 100644 index 000000000000..a4e3c61b6a6b --- /dev/null +++ b/projects/avalon-finance-usda/index.js @@ -0,0 +1,33 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + ethereum: { + poolAddress: '0x3f390dD6EF69f68f9877aACC086856a200808693', + fbtcAddress: '0xC96dE26018A54D51c097160568752c4E3BD6C364', + lfbtcAddress: '0x3119a1AD5B63A000aB9CA3F2470611eB997B93B9', + usdaAddress: '0x0b4D6DA52dF60D44Ce7140F1044F2aD5fabd6316', + }, + bsc: { + poolAddress: '0xC757E47d6bC20FEab54e16F2939F51Aa4826deF7', + fbtcAddress: '0xC96dE26018A54D51c097160568752c4E3BD6C364', + lfbtcAddress: '0x3119a1AD5B63A000aB9CA3F2470611eB997B93B9', + usdaAddress: '0x8a4bA6C340894B7B1De0F6A03F25Aa6afb7f0224', + }, + mantle: { + poolAddress: '0x8f778806CBea29F0f64BA6A4B7724BCD5EEd543E', + fbtcAddress: '0xC96dE26018A54D51c097160568752c4E3BD6C364', + lfbtcAddress: '0x3119a1AD5B63A000aB9CA3F2470611eB997B93B9', + usdaAddress: '0x2BDC204b6d192921605c66B7260cFEF7bE34Eb2E', + }, +} + +module.exports = { + methodology: `FBTC and LFBTC as collateral`, +} + +Object.keys(config).forEach(chain => { + const {poolAddress, lfbtcAddress, fbtcAddress,} = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owner: poolAddress, tokens: [lfbtcAddress, fbtcAddress], }), + } +}) diff --git a/projects/avalon-finance-usdalend/index.js b/projects/avalon-finance-usdalend/index.js new file mode 100644 index 000000000000..25cc7ba8ce1c --- /dev/null +++ b/projects/avalon-finance-usdalend/index.js @@ -0,0 +1,16 @@ + +const { aaveExports } = require('../helper/aave') +const methodologies = require('../helper/methodologies') +const { mergeExports } = require('../helper/utils') + +//@note Main & Innovative Markets +const mainMarket = { + iotex: aaveExports('', '', undefined, ['0xDB52DD393e3a5e95d3B7C7e1C42cC06bb807A369'], { v3: true }), +} + + +module.exports = mergeExports( + mainMarket, +) + +module.exports.methodology = methodologies.lendingMarket diff --git a/projects/avalon-finance/index.js b/projects/avalon-finance/index.js index 47dc1ec950d7..18c7ed309d7a 100644 --- a/projects/avalon-finance/index.js +++ b/projects/avalon-finance/index.js @@ -3,21 +3,78 @@ const { aaveExports } = require('../helper/aave') const methodologies = require('../helper/methodologies') const { mergeExports } = require('../helper/utils') +//@note Main & Innovative Markets 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}), - 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 }), + iotex: aaveExports('', '', undefined, ['0xBa77520d38953BF6a8395D118CfF714Ed672533f'], { v3: true }), + bsquared: aaveExports('', '', undefined, ['0x4Ea93E846b8C6E7b3D5a5BEDF4fe6B8AED58FCEe'], { v3: true }), + taiko: aaveExports('', '', undefined, ['0xF6Aa54a5b60c324602C9359E8221423793e5205d'], { v3: true }), + mode: aaveExports('', '', undefined, ['0xC5b05b7092257Ee3eEAf013198d30F1E8179B6C9'], { v3: true }), + klaytn: aaveExports('', '', undefined, ['0xddD3D480521bc027596e078BCd1b838d50Daa076'], { v3: true }), // Kaia V3 Main + zeta: aaveExports('', '', undefined, ['0xA34F1a928024E3609C8968fEA90C747e8D1fA20f'], { v3: true }), // Zetachain V3 Main } const innovativeMarket = { merlin: aaveExports('', '0x91b212e9FaF20117Eae59d6289CB38749DDFc070', undefined, ['0x883cb2E2d9c5D4D9aF5b0d37fc39Fa2284405682'], { v3: true }), - btr: aaveExports('', '0x90EA8C92AddE4D3f323Dad9E36f0E0395dbc929d', undefined, ['0x4c25c261Fe47bC216113D140BaF72B05E151bcE4'], { v3: true }), } -module.exports = mergeExports(mainMarket, innovativeMarket) +//@note Protocol based markets: Solv, pumpBTC, stbtc, unibtc, others +const solvMarkets = { + base: aaveExports('', '', undefined, ['0xA9D15C669940a757Ab76C6604f2f8f1e198f7D50'], { v3: true }), + bsc: aaveExports('', '0x5395201A4DD625a0d69b99D917282f75928416c1', undefined, ['0x672b19DdA450120C505214D149Ee7F7B6DEd8C39'], { v3: true }), + ethereum: aaveExports('', '0xff12470a969Dd362EB6595FFB44C82c959Fe9ACc', undefined, ['0xfabb0fDca4348d5A40EB1BB74AEa86A1C4eAd7E2'], { v3: true }), + core: aaveExports('', '0x410d2D3Dc79ec66A2Cfc3A4a0AD4af3a38D38bd0', undefined, ['0x802CB61844325dc9A161bC3A498E3BE1B7b6FE00'], { v3: true }), + arbitrum: aaveExports('', '0xa2ddc06baDc817C612111137c0cf6Bd43634EE1a', undefined, ['0xEc579d2cE07401258710199Ff12a5bb56e086a6F'], { v3: true }), + bob: aaveExports('', '', undefined, ['0xfabb0fDca4348d5A40EB1BB74AEa86A1C4eAd7E2'], { v3: true }), +} + +const pumpBTCMarkets = { + ethereum: aaveExports('', '0xE00A3FE97714765A1a2054E850724Fd1320FaCc0', undefined, ['0x2eE0438BCC1876cEA2c6fc43dD21417cF3D1c2eF'], { v3: true }), + bsc: aaveExports('', '0xb1C93Ba1286b6CCA1496C266f0eBfCe94b0C0cc0', undefined, ['0x58c937fa2D147117dB43d187f9411151edfFf03c'], { v3: true }), +} + +const unibtcMarkets = { + merlin: aaveExports('', '0x0024818043D04B1Cc9685233D47eF7eea6Df0A5E', undefined, ['0x623700Fee1dF64088f258e2c4DAB4D6aEac4dDA6'], { v3: true }), + btr: aaveExports('', '', undefined, ['0x898D0EF6E20B7597728AEB41169c22608Fe4b234'], { v3: true }), + bsc: aaveExports('', '', undefined, ['0xF828A73cB00072843241C6294ed778F26854fe5C'], { v3: true }), + mode: aaveExports('', '', undefined, ['0x8F016F5dac399F20B34E35CBaF1dFf12eeE2dE74'], { v3: true }), +} + +const stbtcMarkets = { + bsc: aaveExports('', '', undefined, ['0x56F817eF5D1945E0772496020ff0F72c3984B351'], { v3: true }), + btr: aaveExports('', '0x90EA8C92AddE4D3f323Dad9E36f0E0395dbc929d', undefined, ['0x4c25c261Fe47bC216113D140BaF72B05E151bcE4'], { v3: true }), +} + +const otherProtocolTokenMarkets = { + // ETH - Swell BTC + ethereum: aaveExports('', '0x3975BE5E668b189b8Ac9049B96A9D9561c4F5273', undefined, ['0x87Ed94868f6fbaA834Db81a1C5854c445caCaB67'], { v3: true }), + // BSC - WBTC + bsc: aaveExports('', '', undefined, ['0xA34F1a928024E3609C8968fEA90C747e8D1fA20f'], { v3: true }), +} + +const obtcMarkets = { + core: aaveExports('', '', undefined, ['0x5c78EbB34cC5b52146D107365A66E37a677Fcf50'], { v3: true }), +} + +const ubtcMarkets = { + core: aaveExports('', '', undefined, ['0x2752237ccC6aB5e4B9e9BFca57D7a6956aF4FE3d'], { v3: true }), +} + +const xaumMarkets = { + bsc: aaveExports('', '', undefined, ['0x2c4aEB7C9f0D196a51136B3c7bec49cB2DBD1966'], { v3: true }), +} + +const lbtcMarkets = { + bsc: aaveExports('', '', undefined, ['0x5b9b3C211B81627Cc6b46824CB26829F31A587dc'], { v3: true }), +} + +const listaMarkets = { + bsc: aaveExports('', '', undefined, ['0x5157f63bE7808DEB090Eee7762e917745896A09E'], { v3: true }), // BSC - ListaDAO +} + +module.exports = mergeExports( + mainMarket, innovativeMarket, solvMarkets, pumpBTCMarkets, unibtcMarkets, stbtcMarkets, otherProtocolTokenMarkets, obtcMarkets, ubtcMarkets, xaumMarkets, lbtcMarkets, listaMarkets, +) module.exports.methodology = methodologies.lendingMarket diff --git a/projects/avatr/index.js b/projects/avatr/index.js index 574576b8472a..23f07d4da8ad 100644 --- a/projects/avatr/index.js +++ b/projects/avatr/index.js @@ -26,6 +26,7 @@ module.exports = { hallmarks: [ [1682726400, "Rug Pull"] ], + deadFrom: '2023-04-29', ethereum: { tvl, }, diff --git a/projects/avaware/index.js b/projects/avaware/index.js index 6dc0119e3440..ffc0651d3835 100644 --- a/projects/avaware/index.js +++ b/projects/avaware/index.js @@ -1,43 +1,17 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { staking } = require('../helper/staking'); const FarmPoolManager = "0x7ec4AeaeB57EcD237F35088D11C59525f7D631FE"; const treasuryAddress = "0x9300736E333233F515E585c26A5b868772392709"; const AVE = "0x78ea17559B3D2CF85a7F9C2C704eda119Db5E6dE"; -/*** Staking of native token AVE TVL Portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const transformAddress = addr => 'avax:'+addr; - - await sumTokensAndLPsSharedOwners( - balances, - [[AVE, false]], - [treasuryAddress], - chainBlocks["avax"], - "avax", - transformAddress - ); - - return balances; -}; - /*** farms TVL portion ***/ -const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { +const avaxTvl = async (api) => { const chain = 'avax' - const block = chainBlocks[chain] - const CountOfPools = ( - await sdk.api.abi.call({ - abi: abi.poolCount, - target: FarmPoolManager, - chain, block, - }) - ).output; + const CountOfPools = await api.call({ abi: abi.poolCount, target: FarmPoolManager, }) const indices = [] @@ -48,28 +22,14 @@ const avaxTvl = async (timestamp, ethBlock, chainBlocks) => { indices.push(index) } - const { output: poolsRes } = await sdk.api.abi.multiCall({ - target: FarmPoolManager, - abi: abi.getPool, - calls: indices.map(i => ({ params: i })), - chain, block, - }) - const pools = poolsRes.map(i => i.output.pool) - - const { output: tokens } = await sdk.api.abi.multiCall({ - target: FarmPoolManager, - abi: abi.stakingToken, - calls: pools.map(i => ({ target: i })), - chain, block, - }) - const toa = [] - tokens.forEach(({ output, input: { target } }) => toa.push([output, target])) - return sumTokens2({ tokensAndOwners: toa, chain, block, }) + const pools = (await api.multiCall({ target: FarmPoolManager, abi: abi.getPool, calls: indices, })).map(i => i.pool) + const tokens = await api.multiCall({ abi: abi.stakingToken, calls: pools, }) + return sumTokens2({ api, tokensAndOwners2: [tokens, pools], resolveLP: true, }) }; module.exports = { - avax:{ - staking, + avax: { + staking: staking(treasuryAddress, AVE), tvl: avaxTvl, }, methodology: `We count TVL that is on the Farms threw FarmPoolManager contract diff --git a/projects/awaken/index.js b/projects/awaken/index.js index b40ea52d2cc8..94db172ccbff 100644 --- a/projects/awaken/index.js +++ b/projects/awaken/index.js @@ -2,7 +2,7 @@ const { request, gql } = require("graphql-request"); const { toUSDTBalances } = require("../helper/balances"); const GRAPH_QUERY = gql` - query get_tvl($dto: GetTotalValueLockedDto) { + query get_tvl($dto: GetTotalValueLockedDto!) { totalValueLocked(dto: $dto) { value } @@ -32,7 +32,7 @@ function getChainTvl(graphUrls) { } const v2graph = getChainTvl({ - aelf: "https://dapp.awaken.finance/AElfIndexer_Swap/SwapIndexerSchema/graphql", + aelf: "https://app.aefinder.io/awaken/995f8e7e957d43d6b1706a4e351e2e47/graphql", }); module.exports = { diff --git a/projects/axe/index.js b/projects/axe/index.js index e3cab00080cb..b1d62850bcf2 100644 --- a/projects/axe/index.js +++ b/projects/axe/index.js @@ -1,34 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { staking } = require("../helper/staking.js"); - -const treasuryAddresses = ["0xa2039621Cc042567092fAaee89B03Ef959F89712"]; -const DAI = ADDRESSES.ethereum.DAI; -const USDC = ADDRESSES.ethereum.USDC; -const AXEStaking = "0x7f4d186b76a39a2da32804a8c35b3d04e0e174fd"; -const AXE = "0x30AC8317DfB0ab4263CD8dB1C4F10749911B126C"; - -const AXE_DAI_POOL = "0xd34d3b648db688bee383022dd26a9027592b82d5"; -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of DAI and UNI-V2 balances - ***/ - async function ethTvl(timestamp, block) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [DAI, false], - [USDC, false], - [AXE_DAI_POOL, true] - ], - treasuryAddresses, - block - ); - - return balances; -} - module.exports = { hallmarks: [ [1648765747, "Rug Pull"] @@ -36,8 +5,8 @@ module.exports = { deadFrom: 1648765747, start: 1637036516, // 16 Nov 2021 ethereum: { - tvl: ethTvl, - staking: staking(AXEStaking, AXE), + tvl: () => ({}), + staking: () => ({}), }, methodology: "Counts DAI, USDC and DAI SLP (AXE-DAI) on the treasury", diff --git a/projects/ayin/index.js b/projects/ayin/index.js index 33c05f232073..e4ef7ac6ecb0 100644 --- a/projects/ayin/index.js +++ b/projects/ayin/index.js @@ -3,27 +3,22 @@ const alephium = require('../helper/chain/alephium') const Addresses = { alphAyinPool: '25ywM8iGxKpZWuGA5z6DXKGcZCXtPBmnbQyJEsjvjjWTy', alphUsdtPool: '2A5R8KZQ3rhKYrW7bAS4JTjY9FCFLJg6HjQpqSFZBqACX', + alphUsdcPool: '283R192Z8n6PhXSpSciyvCsLEiiEVFkSE6MbRBA4KSaAj', alphWethPool: 'yXMFxdoKcE86W9NAyajc8Z3T3k2f5FGiHqHtuA69DYT1', - ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m', alphWbtcPool: '28XY326TxvSekaAwiWDLFg2QBRfacSga8dyNJCYGUYNbq', + alphApadPool: 'vFpZ1DF93x1xGHoXM8rsDBFjpcoSsCi5ZEuA5NG5UJGX', + alphChengPool: '25b5aNfdrNRjJ7ugPTkxThT51L1NSvf8igQyDHKZhweiK', + alphAnsdPool: 'uM4QJwHqFoTF2Pou8TqwhaDiHYLk4SHG65uaQG8r7KkT', + alphAlphagaPool: '23cXw23ZjRqKc7i185ZoH8vh9KT4XTumVRWpVLUecgLMd', + ayinUsdtPool: '21NEBCk8nj5JBKpS7eN8kX6xGJoLHNqTS3WBFnZ7q8L9m', + ayinUsdcPool: '2961aauvprhETv6TXGQRc3zZY4FbLnqKon2a4wK6ABH9q', + ayinApadPool: '247rZysrruj8pj2GnFyK2bqB2nU4JsUj7k2idksAp4XMy', usdtUsdcPool: '27C75V9K5o9CkkGTMDQZ3x2eP82xnacraEqTYXA35Xuw5', - usdt: 'zSRgc7goAYUgYsEBYdAzogyyeKv3ne3uvWb3VDtxnaEK', - weth: 'vP6XSUyjmgWCB2B9tD5Rqun56WJqDdExWnfwZVEqzhQb', - ayin: 'vT49PY8ksoUL6NcXiZ1t2wAmC7tTPRfFfER8n3UCLvXy', - wbtc: 'xUTp3RXGJ1fJpCGqsAY6GgyfRQ3WQ1MdcYR1SiwndAbR', - usdc: '22Nb9JajRpAh9A2fWNgoKt867PA6zNyi541rtoraDfKXV' } +const alephId = '0000000000000000000000000000000000000000000000000000000000000000' const XAyinAddress = 'zst5zMzizEeFYFis6DNSknY5GCYTpM85D3yXeRLe2ug3' -const TokenIds = { - usdt: alephium.contractIdFromAddress(Addresses.usdt), - weth: alephium.contractIdFromAddress(Addresses.weth), - 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 }, @@ -35,31 +30,18 @@ async function ayinTvlForXAyin() { return (Number(totalSupply) / 1e18) * (Number(currentPrice) / 1e18) } -async function tvl() { +async function tvl(api) { const alphTvls = await Promise.all([ - Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool + Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphUsdcPool, Addresses.alphWethPool, Addresses.alphApadPool, Addresses.alphChengPool, Addresses.alphAnsdPool, Addresses.alphAlphagaPool ].map(poolAddress => alephium.getAlphBalance(poolAddress))) const alphTvl = alphTvls.reduce((tvl, res) => tvl + Number(res.balance), 0) - const tokensTvls = await Promise.all([ - Addresses.alphAyinPool, Addresses.alphUsdtPool, Addresses.alphWethPool, Addresses.ayinUsdtPool, - Addresses.alphWbtcPool, Addresses.usdtUsdcPool - ].map(poolAddress => alephium.getTokensBalance(poolAddress))) - const tokensTvl = tokensTvls.reduce((res, tokenTvls) => { + api.add(alephId, alphTvl) + const tokensTvls = await Promise.all(Object.values(Addresses).map(poolAddress => alephium.getTokensBalance(poolAddress))) + tokensTvls.forEach((tokenTvls) => { tokenTvls.forEach(tokenTvl => { - if (res[tokenTvl.tokenId] !== undefined) { - res[tokenTvl.tokenId] = Number(res[tokenTvl.tokenId]) + Number(tokenTvl.balance) - } + api.add(tokenTvl.tokenId, tokenTvl.balance) }); - return res - }, { [TokenIds.ayin]: 0, [TokenIds.usdt]: 0, [TokenIds.weth]: 0, [TokenIds.wbtc]: 0, [TokenIds.usdc]: 0 }) - return { - alephium: alphTvl / 1e18, - ayin: tokensTvl[TokenIds.ayin] / 1e18, - weth: tokensTvl[TokenIds.weth] / 1e18, - tether: tokensTvl[TokenIds.usdt] / 1e6, - usdc: tokensTvl[TokenIds.usdc] / 1e6, - bitcoin: tokensTvl[TokenIds.wbtc] / 1e8 - } + }) } async function staking() { diff --git a/projects/babena/index.js b/projects/babena/index.js index 838dc984444a..ab91127e7201 100644 --- a/projects/babena/index.js +++ b/projects/babena/index.js @@ -104,9 +104,10 @@ async function stakingfetch() { module.exports = { timetravel: false, misrepresentedTokens: true, + // deadFrom: '2024-08-30', kadena: { - tvl: fetch, - staking: stakingfetch + tvl: () => ({}), + staking: () => ({}) } } \ No newline at end of file diff --git a/projects/babylon/index.js b/projects/babylon/index.js new file mode 100644 index 000000000000..ad038db97ed5 --- /dev/null +++ b/projects/babylon/index.js @@ -0,0 +1,21 @@ +const axios = require('axios'); + +async function tvl(api) { + const response = await axios.get('https://staking-api.babylonlabs.io/v1/stats'); + const activeTvlSatoshis = response.data.data.active_tvl; + const activeTvlBitcoin = activeTvlSatoshis / 1e8; + + if (activeTvlBitcoin > 0) + api.addCGToken('bitcoin', activeTvlBitcoin) + else + throw new Error('Babylon: Invalid TVL value'); +} + +module.exports = { + methodology: 'TVL is fetched from Babylon’s Staking API and represents the total Bitcoin locked in the Babylon staking protocol.', + start: 1724351485, + timetravel: false, + bitcoin: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/babyswap/index.js b/projects/babyswap/index.js index 409c98f85ae5..8fdc293ff0a4 100644 --- a/projects/babyswap/index.js +++ b/projects/babyswap/index.js @@ -3,22 +3,10 @@ const { staking } = require("../helper/staking"); const MasterChefContract = "0xdfAa0e08e357dB0153927C7EaBB492d1F60aC730"; const BABY = "0x53E562b9B7E5E94b81f10e96Ee70Ad06df3D2657"; -// node test.js projects/babyswap/index.js - -/* -module.exports = { - bsc: { - staking: staking(MasterChefContract, BABY), - tvl: bscTvl, - }, - methodology: - "We count liquidity on the Farms (LP tokens) and Pools (single tokens) seccions threw MasterChef Contract", -};*/ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { methodology: `Uses factory(0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da) address and whitelisted tokens address to find and price Liquidity Pool pairs`, misrepresentedTokens: true, - incentivized: true, bsc: { tvl: getUniTVL({ factory: '0x86407bEa2078ea5f5EB5A52B2caA963bC1F889Da', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, BABY), diff --git a/projects/backbonelabs/index.js b/projects/backbonelabs/index.js index f4d583c320c1..8e53eda9be9d 100644 --- a/projects/backbonelabs/index.js +++ b/projects/backbonelabs/index.js @@ -2,21 +2,21 @@ const { queryContract: queryContractCosmos } = require("../helper/chain/cosmos") const ADDRESSES = require('../helper/coreAssets.json') const config = { - terra2: { - token: ADDRESSES.terra2.LUNA, - hub: "terra1l2nd99yze5fszmhl5svyh5fky9wm4nz4etlgnztfu4e8809gd52q04n3ea", - boneToken: "terra17aj4ty4sz4yhgm08na8drc0v03v2jwr3waxcqrwhajj729zhl7zqnpc0ml", - }, - migaloo: { - token: ADDRESSES.migaloo.WHALE, - hub: "migaloo1mf6ptkssddfmxvhdx0ech0k03ktp6kf9yk59renau2gvht3nq2gqdhts4u", - boneToken: "factory/migaloo1mf6ptkssddfmxvhdx0ech0k03ktp6kf9yk59renau2gvht3nq2gqdhts4u/boneWhale" + archway: { + token: ADDRESSES.archway.ARCH, + hub: "archway12ejj99vkawuxfv0rg9l08hsun35juc6evprracmpe3mka3lsk5fqpjxhgl", + boneToken: "archway12yurzx8zynv3ck7uh4tucre48tqsm4fac4hfk9p3l24qs2cn08dqr684cg" }, chihuahua: { token: ADDRESSES.chihuahua.HUAHUA, hub: "chihuahua1psf89r2g9vdlttrjphspcpzzfx87r2r4nl5fg703ky42mp2706wsw5330f", boneToken: "chihuahua1jz5n4aynhpxx7clf2m8hrv9dp5nz83k67fgaxhy4p9dfwl6zssrq3ymr6w" }, + injective: { + token: ADDRESSES.injective.INJ, + hub: "inj1dxp690rd86xltejgfq2fa7f2nxtgmm5cer3hvu", + boneToken: "factory/inj1dxp690rd86xltejgfq2fa7f2nxtgmm5cer3hvu/bINJ" + }, juno: { token: ADDRESSES.juno.JUNO, hub: "juno102at0mu2xeluyw9efg257yy6pyhv088qqhmp4f8wszqcwxnpdcgqsfq0nv", @@ -27,10 +27,20 @@ const config = { hub: "kujira15e8q5wzlk5k38gjxlhse3vu6vqnafysncx2ltexd6y9gx50vuj2qpt7dgv", boneToken: "factory/kujira15e8q5wzlk5k38gjxlhse3vu6vqnafysncx2ltexd6y9gx50vuj2qpt7dgv/boneKuji" }, + migaloo: { + token: ADDRESSES.migaloo.WHALE, + hub: "migaloo1mf6ptkssddfmxvhdx0ech0k03ktp6kf9yk59renau2gvht3nq2gqdhts4u", + boneToken: "factory/migaloo1mf6ptkssddfmxvhdx0ech0k03ktp6kf9yk59renau2gvht3nq2gqdhts4u/boneWhale" + }, osmosis: { token: ADDRESSES.osmosis.OSMO, hub: "osmo1s3l0lcqc7tu0vpj6wdjz9wqpxv8nk6eraevje4fuwkyjnwuy82qsx3lduv", boneToken: "factory/osmo1s3l0lcqc7tu0vpj6wdjz9wqpxv8nk6eraevje4fuwkyjnwuy82qsx3lduv/boneOsmo" + }, + terra2: { + token: ADDRESSES.terra2.LUNA, + hub: "terra1l2nd99yze5fszmhl5svyh5fky9wm4nz4etlgnztfu4e8809gd52q04n3ea", + boneToken: "terra17aj4ty4sz4yhgm08na8drc0v03v2jwr3waxcqrwhajj729zhl7zqnpc0ml", } }; diff --git a/projects/bagful/index.js b/projects/bagful/index.js new file mode 100644 index 000000000000..f9543aa99fdc --- /dev/null +++ b/projects/bagful/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const AGGREGATOR = "0x6bD057Dae9aA5aE05c782F2eB988CBdE53Be9620"; + + +async function tvl(api) { + let pools = await api.call({ abi: abiInfo.poolTvls, target: AGGREGATOR }); + pools.forEach(pool=>{ + api.add(pool.poolAssets,pool.tvl) + }) + return await sumTokens2({api,resolveLP:true}) +} + + +module.exports = { +doublecounted: true, + linea: { + tvl, + }, +}; + +const abiInfo = { + poolTvls: + "function getPoolTotalTvl() view returns (tuple(uint256 pid, address poolAddress,address poolAssets, uint256 tvl)[])", +}; diff --git a/projects/bahamut-dex/index.js b/projects/bahamut-dex/index.js new file mode 100644 index 000000000000..7d68b7cf2f8e --- /dev/null +++ b/projects/bahamut-dex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); + +module.exports = uniTvlExport('ftn', '0x63D19A275fd468aA5A29FAc7B14697Ca0b5B3315') diff --git a/projects/bakerfi/index.js b/projects/bakerfi/index.js index 11aaf5cb1515..ee598baa7f38 100644 --- a/projects/bakerfi/index.js +++ b/projects/bakerfi/index.js @@ -1,24 +1,31 @@ const config = { "arbitrum": { - vaults: ["0x5c1b2312FaE6c0d61B6A15A8093842E9fE5b1e44"] + vaults: ["0x4c6d58749126FEBb1D28E8B8FdE97DC3107996d3"] }, base: { - vaults: ["0x37327c99bBc522e677a97d01021dB20227faF60A"] + vaults: ["0x37327c99bBc522e677a97d01021dB20227faF60A", "0x892022FE1431fdE03836725BBD0f0380e21E2095"] + }, + ethereum: { + vaults: ["0x01280b3683fE20Dc9cCF4D9526418F252871E4F7"] }, } async function getVaultTVL(api, vaults) { - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) - api.addGasToken(bals) + const bals = await api.multiCall({ + abi: "uint256:totalAssets", + calls: vaults, + }); + api.addGasToken(bals); } module.exports = { - methodology: 'Counts the number of assets that are deployed through the protocol', -} + methodology: + "Counts the number of assets that are deployed through the protocol", +}; -Object.keys(config).forEach(chain => { - const { vaults = [] } = config[chain] +Object.keys(config).forEach((chain) => { + const { vaults = [] } = config[chain]; module.exports[chain] = { tvl: async (api) => await getVaultTVL(api, vaults), - } -}) + }; +}); diff --git a/projects/baklava-space/index.js b/projects/baklava-space/index.js index abcb3083ff3c..976b87a6e15a 100644 --- a/projects/baklava-space/index.js +++ b/projects/baklava-space/index.js @@ -38,7 +38,18 @@ const config = { '0x49AF8CAf88CFc8394FcF08Cf997f69Cee2105f2b', '0x83B2D994A1d16E6A3A44281D12542E2bc0d5EBFD', '0xea505C49B43CD0F9Ed3b40D77CAF1e32b0097328', - '0xc5DFb9698440Eaeb0A7C9dAA5a795e9B48CacadF' + '0xc5DFb9698440Eaeb0A7C9dAA5a795e9B48CacadF', + '0x6067776741a82Ad90Dff7e8D9af495F245b71782', + '0x0324a1a68d6Ef3C5037DCc5a305F941eD240197A', + '0x21c502F430A0Ff9Cbc37dcb60a0528e8C76d559f', + '0x3C27C6a8cD5A60dE337772c2c441fF83279d5855', + '0xFefa438D90227Bb6312b0846a28787Db8A0f0c2A', + '0xf81Ac49CEeA834deC340aB08a544fB1E79d44c31', + '0xed1031885D7DE7DB78BE921F5FeAacD3f6E9a127', + '0x9bD9b6600eeE5f8318913cCb17BF836E1e9d2f4F', + '0x25F0Bc213ED49ABe3AD36CB8D0919A138d19b648', + '0x59639E20A17EaD110aaBAF249001Ab140917C18e', + '0x90011B2AB095c9a9f70a8eBEe21313FB3989029f' // CLM pool(Not calculated by defillama) ], bsc: [ '0x6659B42C106222a50EE555F76BaD09b68EC056f9', diff --git a/projects/balanced/helper.js b/projects/balanced/helper.js index 68a9223e4459..1f2e07b1de8e 100644 --- a/projects/balanced/helper.js +++ b/projects/balanced/helper.js @@ -41,7 +41,8 @@ const networkIdentifiers = { "archway-1": "archway", "injective-1/inj": "injective", "0xa4b1.arbitrum": "arbitrum", - "0x2105.base": "base" + "0x2105.base": "base", + "sui/0000000000000000000000000000000000000000000000000000000000000002::sui::SUI": "sui", } // Get decimals of cross-chain Balanced assets in balancedAssetManagerContract diff --git a/projects/balanced/index.js b/projects/balanced/index.js index bfa389909ee9..7ccfd8a3bc44 100644 --- a/projects/balanced/index.js +++ b/projects/balanced/index.js @@ -19,7 +19,7 @@ async function tvl(api) { // https://github.com/balancednetwork/balanced-java-contracts/wiki/Contract-Addresses // https://github.com/DefiLlama/DefiLlama-Adapters/pull/9857#issuecomment-2060842344 module.exports = { - methodology: 'TVL consists of liquidity on the DEX, deposits made to the lending program and the stability fund. Data is pulled from the ICX API "https://ctz.solidwallet.io/api/v3" and Balanced stats API "https://balanced.sudoblock.io/api/v1/docs', + methodology: "TVL: The total liquidity held on the Balanced exchange and in the Stability Fund. Fees: Collected from traders", icon: { tvl }, @@ -41,4 +41,7 @@ module.exports = { arbitrum: { tvl: async () => await computeTVL("arbitrum"), }, + sui: { + tvl: async () => await computeTVL("sui"), + }, }; diff --git a/projects/balancer-cow-amm/index.js b/projects/balancer-cow-amm/index.js new file mode 100644 index 000000000000..35c72404d95a --- /dev/null +++ b/projects/balancer-cow-amm/index.js @@ -0,0 +1,19 @@ +const { v1Tvl } = require('../helper/balancer') +const sdk = require('@defillama/sdk') + +const config = { + ethereum: [ + ['0xf76c421bAb7df8548604E60deCCcE50477C10462', 20432455], + ['0x23fcC2166F991B8946D195de53745E1b804C91B7', 20391510], + ], + xdai: [ + ['0x703Bd8115E6F21a37BB5Df97f78614ca72Ad7624', 35259725], + ['0x7573B99BC09c11Dc0427fb9c6662bc603E008304', 35163914], + ], +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sdk.util.sumChainTvls(config[chain].map(c => v1Tvl(...c))) + } +}) \ No newline at end of file diff --git a/projects/balus/index.js b/projects/balus/index.js new file mode 100644 index 000000000000..c06b764c3953 --- /dev/null +++ b/projects/balus/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require("../helper/coreAssets.json") +const { sumTokensExport } = require("../helper/chain/ton") +const CONTRACT = "EQDswKn606G8kwS8RuUJg9baJbgAhixb6bYJC6VmIPU873uq" + +module.exports = { + methodology: "Counts all TON balance in the smart contract as the TVL", + timetravel: false, + ton: { + tvl: sumTokensExport({ + owners: [CONTRACT], + tokens: ADDRESSES.ton.TON, + }) + }, +}; diff --git a/projects/banano/index.js b/projects/banano/index.js index 8adc696432e2..c58390a92fb4 100644 --- a/projects/banano/index.js +++ b/projects/banano/index.js @@ -1,5 +1,4 @@ -const { pool2BalanceFromMasterChefExports} = require("../helper/pool2.js"); -const masterchefAbi = require("../helper/abis/masterchef.json"); +const { sumTokens2 } = require("../helper/unwrapLPs.js"); //Polygon and BSC staking contracts const polygonContract = "0xefa4aED9Cf41A8A0FcdA4e88EfA2F60675bAeC9F"; @@ -12,11 +11,16 @@ module.exports = { methodology: 'Pool2 TVL in Polygon and BSC LPs', polygon: { tvl: async ()=>({}), - pool2: pool2BalanceFromMasterChefExports(polygonContract, ban, "polygon", addr=>`polygon:${addr}`, masterchefAbi.poolInfo) + pool2: tvl, }, bsc: { tvl: async ()=>({}), - pool2: pool2BalanceFromMasterChefExports(bscContract, ban, "bsc", addr=>`bsc:${addr}`, masterchefAbi.poolInfo) + pool2: tvl, }, } +async function tvl(api) { + const contract = api.chain === 'bsc' ? bscContract : polygonContract; + const tokens = await api.fetchList({ lengthAbi: 'poolLength', itemAbi:'function poolInfo(uint256) view returns (address stakingToken , uint256 stakingTokenTotalAmount , uint256 accWBANPerShare , uint32 lastRewardTime , uint16 allocPoint )' , target: contract}) + return sumTokens2({ api, tokens: tokens.map(i => i.stakingToken), owner: contract, resolveLP: true}) +} \ No newline at end of file diff --git a/projects/bank-ai/index.js b/projects/bank-ai/index.js index b50971fb1837..4444b6cbd72b 100644 --- a/projects/bank-ai/index.js +++ b/projects/bank-ai/index.js @@ -3,6 +3,6 @@ const { staking } = require('../helper/staking') module.exports = { ethereum: { tvl: () => ({}), - staking: staking("0x140Fae0A43190A3D0Cbf8DBdB347200EB84E81d1", "0xf19693068120185664E211F619c4F0530cE07088") + staking: staking("0x804Bd4F1c9B5D7864d6F215644fb931349EEACA2", "0xe18ab3568fa19e0ed38bc1d974eddd501e61e12d") } } \ No newline at end of file diff --git a/projects/banx/index.js b/projects/banx/index.js index 02c5ddea41c8..f39198dd44f6 100644 --- a/projects/banx/index.js +++ b/projects/banx/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { Program, } = require("@project-serum/anchor"); +const { Program } = require('@coral-xyz/anchor'); const { getConfig } = require('../helper/cache') const { bs58 } = require('@project-serum/anchor/dist/cjs/utils/bytes'); const { getProvider } = require('../helper/solana') @@ -11,28 +11,26 @@ async function getData() { return data async function getAllData() { - const programId = '4tdmkuY6EStxbS6Y8s5ueznL3VPMSugrvQuDeAHGZhSt' const provider = getProvider() const idl = await getConfig('banx-idl', 'https://api.banx.gg/idl') - const program = new Program(idl, programId, provider) + const program = new Program(idl, provider) - const bondOfferOffset = 32 + 8; const bondTradeTxnOffset = 8; + const userVaultOffset = 8; const [ - bondOffers, bondTradeTxn, + userVaults, ] = await Promise.all([ - getFilteredAccounts(program, 'bondOfferV3', bondOfferOffset, [5, 7,]), - getFilteredAccounts(program, 'bondTradeTransactionV3', bondTradeTxnOffset, [2, 6, 9]), - ]) + getFilteredAccounts(program, 'bondTradeTransactionV3', bondTradeTxnOffset, [2, 6, 9, 13]), + getFilteredAccounts(program, 'userVault', userVaultOffset, [1]), + ]); - // OffersSum is sum of sol in pools not yet lent out. The borrowedSum is the sum of SOL which has been borrowed and overcollaterized by the value of locked NFTs - const { offersSum, offersSumUsdc } = bondOffers.reduce(({ offersSum, offersSumUsdc }, offer) => { - if (offer.account.bondingCurve.bondingType.linearUsdc || offer.account.bondingCurve.bondingType.exponentialUsdc) { - return { offersSumUsdc: offersSumUsdc + (+offer.account.fundsSolOrTokenBalance) + Math.max(0, +offer.account.bidSettlement), offersSum }; + const { escrowSum, escrowSumUsdc } = userVaults.reduce(({ escrowSum, escrowSumUsdc }, userVault) => { + if (userVault.account.lendingTokenType.usdc) { + return { escrowSum, escrowSumUsdc: escrowSumUsdc + (+userVault.account.offerLiquidityAmount) } } - return { offersSum: offersSum + (+offer.account.fundsSolOrTokenBalance) + Math.max(0, +offer.account.bidSettlement), offersSumUsdc }; - }, { offersSum: 0, offersSumUsdc: 0 }); + return { escrowSum: escrowSum + (+userVault.account.offerLiquidityAmount), escrowSumUsdc } + }, { escrowSum: 0, escrowSumUsdc: 0 }) const { borrowedSum, borrowedSumUsdc } = bondTradeTxn.reduce(({ borrowedSum, borrowedSumUsdc }, bondTxn) => { if (bondTxn.account.lendingToken.usdc) { @@ -42,7 +40,7 @@ async function getData() { }, { borrowedSum: 0, borrowedSumUsdc: 0 }); - return { tvl: offersSum, tvlUsdc: offersSumUsdc, borrowed: borrowedSum, borrowedUsdc: borrowedSumUsdc } + return { tvl: escrowSum, tvlUsdc: escrowSumUsdc, borrowed: borrowedSum, borrowedUsdc: borrowedSumUsdc } } } diff --git a/projects/bao-markets/index.js b/projects/bao-markets/index.js index d92caa764f23..8d30950c58fa 100644 --- a/projects/bao-markets/index.js +++ b/projects/bao-markets/index.js @@ -4,7 +4,7 @@ const { compoundExports } = require("../helper/compound"); // BaoMarkets const comptroller = "0x0Be1fdC1E87127c4fe7C05bAE6437e3cf90Bf8d8"; -const compoundTvl = compoundExports(comptroller, undefined, '0xf635fdf9b36b557bd281aa02fdfaebec04cd084a', nullAddress, undefined, undefined, { blacklistedTokens: ['0xe7a52262c1934951207c5fc7a944a82d283c83e5', '0xc0601094C0C88264Ba285fEf0a1b00eF13e79347', ]}) +const compoundTvl = compoundExports(comptroller, '0xf635fdf9b36b557bd281aa02fdfaebec04cd084a', nullAddress, { blacklistedTokens: ['0xe7a52262c1934951207c5fc7a944a82d283c83e5', '0xc0601094C0C88264Ba285fEf0a1b00eF13e79347', ]}) module.exports = { ethereum: compoundTvl diff --git a/projects/basedai/index.js b/projects/basedai/index.js new file mode 100644 index 000000000000..fbdcdbf57a34 --- /dev/null +++ b/projects/basedai/index.js @@ -0,0 +1,12 @@ +const { staking } = require('../helper/staking'); + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking( + "0xa6b816010ab51e088c4f19c71aba87e54b422e14", + "0xA9E8aCf069C58aEc8825542845Fd754e41a9489A" + ) + }, + methodology: "Currently, the TVL is considered as the amount of Pepecoin tokens held in the farming contract at '0xa6b816010ab51e088c4f19c71aba87e54b422e14'." +}; diff --git a/projects/baseswap/index.js b/projects/baseswap/index.js index 233217ac6857..aad434ca440f 100644 --- a/projects/baseswap/index.js +++ b/projects/baseswap/index.js @@ -2,7 +2,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const BSWAP = "0x78a087d713Be963Bf307b18F2Ff8122EF9A63ae9"; const FACTORY = "0xFDa619b6d20975be80A10332cD39b9a4b0FAa8BB" -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, permitFailure: true }) module.exports = { diff --git a/projects/basic/index.js b/projects/basic/index.js new file mode 100644 index 000000000000..b542170fe782 --- /dev/null +++ b/projects/basic/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { compoundExports2 } = require("../helper/compound"); + +module.exports = { + iotex: compoundExports2({ + cether: '0x83C51de03f03C5E23f02F674dbD2032e164112Fc', + comptroller: '0x47D7B83947Aa12fEb95f5f55527Dc9B32E4ec009', + cetheEquivalent: ADDRESSES.iotex.WIOTX + }) +}; \ No newline at end of file diff --git a/projects/basilisk/index.js b/projects/basilisk/index.js index 2dd0f26c6e07..37f4698f7fd9 100644 --- a/projects/basilisk/index.js +++ b/projects/basilisk/index.js @@ -4,6 +4,5 @@ module.exports = { era: compoundExports2({ comptroller: '0x4085f99720e699106bc483dAb6CAED171EdA8D15', cether: '0x1e8F1099a3fe6D2c1A960528394F4fEB8f8A288D', - fetchBalances: true, }) }; \ No newline at end of file diff --git a/projects/basin/index.js b/projects/basin/index.js index f7b341d6c7b7..491a76161d3c 100644 --- a/projects/basin/index.js +++ b/projects/basin/index.js @@ -1,34 +1,29 @@ -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 +const { cachedGraphQuery } = require('../helper/cache') +const chains = { + ethereum: { + startBlock: 17977905, + subgraphUrl: "https://graph.bean.money/basin_eth" + }, + arbitrum: { + startBlock: 261772155, + subgraphUrl: "https://graph.bean.money/basin" + } } -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 }) - } +async function tvl(api) { + const { subgraphUrl } = chains[api.chain]; + const wells = await cachedGraphQuery('basin/' + api.chain, subgraphUrl, `{ + wells { + id tokens { id } + } + }`) + const ownerTokens = wells.wells.map(well => [well.tokens.map(t => t.id), well.id]); + return api.sumTokens({ ownerTokens }); } module.exports = { methodology: "Counts the value of token reserves inside all deployed Wells.", - start: 17977905, - ethereum: { - tvl: chainTvl('ethereum') - } + start: 1692797303, + ethereum: { tvl }, + arbitrum: { tvl } }; diff --git a/projects/bastion/index.js b/projects/bastion/index.js index 3436be4a5759..78cae181c7ba 100644 --- a/projects/bastion/index.js +++ b/projects/bastion/index.js @@ -1,27 +1,14 @@ const { compoundExports } = require("../helper/compound"); -const sdk = require('@defillama/sdk') const mainHubExport = compoundExports( "0x6De54724e128274520606f038591A00C5E94a1F6", - "aurora", "0x4E8fE8fd314cFC09BDb0942c5adCC37431abDCD0", "0xc9bdeed33cd01541e1eed10f90519d2c06fe3feb" ); -const auroraRealmExport = compoundExports( - "0xA195b3d7AA34E47Fb2D2e5A682DF2d9EFA2daF06", - "aurora" -); - -const multiChainRealmExport = compoundExports( - "0xe1cf09BDa2e089c63330F0Ffe3F6D6b790835973", - "aurora" -); - -const stakedNearRealmExport = compoundExports( - "0xE550A886716241AFB7ee276e647207D7667e1E79", - "aurora" -); +const auroraRealmExport = compoundExports("0xA195b3d7AA34E47Fb2D2e5A682DF2d9EFA2daF06",); +const multiChainRealmExport = compoundExports("0xe1cf09BDa2e089c63330F0Ffe3F6D6b790835973",); +const stakedNearRealmExport = compoundExports("0xE550A886716241AFB7ee276e647207D7667e1E79",); const bastion = [ mainHubExport, @@ -31,22 +18,14 @@ const bastion = [ ]; module.exports = { - aurora: { + aurora: { tvl: async (...args) => { - let balances = {}; - const tvls = await Promise.all(bastion.map(realm => realm.tvl(...args))) - tvls.forEach(tvl => { - Object.keys(tvl).forEach(key => sdk.util.sumSingleBalance(balances, key, tvl[key])) - }) - return balances; + await Promise.all(bastion.map(realm => realm.tvl(...args))) + return args[0].getBalances(); }, borrowed: async (...args) => { - let balances = {}; - const tvls = await Promise.all(bastion.map(realm => realm.borrowed(...args))) - tvls.forEach(tvl => { - Object.keys(tvl).forEach(key => sdk.util.sumSingleBalance(balances, key, tvl[key])) - }) - return balances; + await Promise.all(bastion.map(realm => realm.borrowed(...args))) + return args[0].getBalances(); }, }, }; \ No newline at end of file diff --git a/projects/bb-club-cdp/index.js b/projects/bb-club-cdp/index.js new file mode 100644 index 000000000000..f9c3ddabb791 --- /dev/null +++ b/projects/bb-club-cdp/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + bouncebit: { + tvl: sumTokensExport({ owner: '0xdE1F1Ff02D565E554E63AEfe80cB6818eAaCD6A8', token: '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC'}), + } +} \ No newline at end of file diff --git a/projects/bb-club-farm/index.js b/projects/bb-club-farm/index.js new file mode 100644 index 000000000000..c483544065fb --- /dev/null +++ b/projects/bb-club-farm/index.js @@ -0,0 +1,15 @@ +const { stakingUnknownPricedLP } = require("../helper/staking"); +const BBTC = '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC' +const stakingLNNGAddress= '0x997A1C457acB020CF668BB7d6f05A184854CD3ca' +const LNNGLPAddress = '0x2d2011408d0E76c521Cf6169E004c8BF893Af34E' + +async function tvl(api) { + return api.sumTokens({owners: ['0x05407cAe9FdaF5e8cC395089207E2E72b8Ae739b'], tokens: [BBTC], api }) +} + +module.exports = { + bouncebit: { + tvl, + staking: stakingUnknownPricedLP(stakingLNNGAddress, LNNGLPAddress, "bouncebit", LNNGLPAddress) + } +} \ No newline at end of file diff --git a/projects/bb-club-meme/index.js b/projects/bb-club-meme/index.js new file mode 100644 index 000000000000..961da573e72c --- /dev/null +++ b/projects/bb-club-meme/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(api) { + const factory = '0x0dB9ea3c097fC9fD709da54aA1eFcd6FFb3DdE2C'; + const memeCoins = await api.fetchList({ lengthAbi: 'allPairsLength', itemAbi: 'allPairs', target: factory }) + return api.sumTokens({owners: memeCoins, tokens: [ADDRESSES.null] }) +} + +module.exports = { + bouncebit: { + tvl + } +} \ No newline at end of file diff --git a/projects/bb-club-quanto/index.js b/projects/bb-club-quanto/index.js new file mode 100644 index 000000000000..e5f76ca4826e --- /dev/null +++ b/projects/bb-club-quanto/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + bouncebit: { + tvl: sumTokensExport({ owner: '0xA19237FFc49D1b71f00DA1a82cfF79CE7789f74A', token: '0xF4c20e5004C6FDCDdA920bDD491ba8C98a9c5863'}) + } +} \ No newline at end of file diff --git a/projects/bb-club-restaking/index.js b/projects/bb-club-restaking/index.js new file mode 100644 index 000000000000..3460141dff20 --- /dev/null +++ b/projects/bb-club-restaking/index.js @@ -0,0 +1,13 @@ +const BBTC = '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC' + +async function BTCFIStaking(api) { + const totalStake = await api.call({abi: 'uint256:totalStaked', target: '0x0d5d4599eb4f48df6aeaf2f3c814f5a5302931e5'}) + api.add(BBTC, totalStake) +} + + +module.exports = { + bouncebit: { + tvl: BTCFIStaking + } +} \ No newline at end of file diff --git a/projects/bcraft/index.js b/projects/bcraft/index.js new file mode 100644 index 000000000000..3f2fce450958 --- /dev/null +++ b/projects/bcraft/index.js @@ -0,0 +1,12 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const clans = "0x0De0D0cF717af57D2101F6Be0962fA890c1FBeC6" +async function tvl(time, ethBlock, _b, { api}) { + return sumTokens2({ tokens: [nullAddress], owner: clans, api }) +} + +module.exports = { + methodology: `We count the ETH on ${clans}`, + base: { + tvl: tvl + } +} \ No newline at end of file diff --git a/projects/bean/index.js b/projects/bean/index.js index c19f8559c800..b30c77d6a725 100644 --- a/projects/bean/index.js +++ b/projects/bean/index.js @@ -1,21 +1,41 @@ const ADDRESSES = require('../helper/coreAssets.json') -const BEANSTALK = "0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5"; - -const BEAN_ERC20_V1 = "0xdc59ac4fefa32293a95889dc396682858d52e5db"; -const BEANETH_V1 = "0x87898263b6c5babe34b4ec53f22d98430b91e371"; -const BEAN3CRV_V1 = "0x3a70dfa7d2262988064a2d051dd47521e43c9bdd"; -const BEANLUSD_V1 = "0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d"; - -const BEAN_ERC20 = "0xbea0000029ad1c77d3d5d23ba2d8893db9d1efab"; -const UNRIPE_BEAN_ERC20 = "0x1bea0050e63e05fbb5d8ba2f10cf5800b6224449"; -const UNRIPE_LP_ERC20 = "0x1bea3ccd22f4ebd3d37d731ba31eeca95713716d"; -const BEAN3CRV_V2 = "0xc9c32cd16bf7efb85ff14e0c8603cc90f6f2ee49"; -const BEANETH_V2 = "0xbea0e11282e2bb5893bece110cf199501e872bad"; - -// Underlying non-bean tokens -const WETH = ADDRESSES.ethereum.WETH; -const CRV3 = "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490"; -const LUSD = ADDRESSES.ethereum.LUSD; +const ADDR = { + ethereum: { + BEANSTALK: "0xc1e088fc1323b20bcbee9bd1b9fc9546db5624c5", + BEAN_ERC20_V1: "0xdc59ac4fefa32293a95889dc396682858d52e5db", + BEANETH_V1: "0x87898263b6c5babe34b4ec53f22d98430b91e371", + BEAN3CRV_V1: "0x3a70dfa7d2262988064a2d051dd47521e43c9bdd", + BEANLUSD_V1: "0xd652c40fbb3f06d6b58cb9aa9cff063ee63d465d", + BEAN_ERC20: "0xbea0000029ad1c77d3d5d23ba2d8893db9d1efab", + UNRIPE_BEAN_ERC20: "0x1bea0050e63e05fbb5d8ba2f10cf5800b6224449", + UNRIPE_LP_ERC20: "0x1bea3ccd22f4ebd3d37d731ba31eeca95713716d", + BEAN3CRV_V2: "0xc9c32cd16bf7efb85ff14e0c8603cc90f6f2ee49", + BEANETH_V2: "0xbea0e11282e2bb5893bece110cf199501e872bad", + // Underlying non-bean tokens + WETH: ADDRESSES.ethereum.WETH, + CRV3: "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", + LUSD: ADDRESSES.ethereum.LUSD + }, + arbitrum: { + BEANSTALK: "0xd1a0060ba708bc4bcd3da6c37efa8dedf015fb70", + BEAN_ERC20: "0xbea0005b8599265d41256905a9b3073d397812e4", + BEANWETH: "0xbea00aa8130acad047e137ec68693c005f8736ce", + BEANWSTETH: "0xbea00bbe8b5da39a3f57824a1a13ec2a8848d74f", + BEANWEETH: "0xbea00cc9f93e9a8ac0dfdff2d64ba38eb9c2e48c", + BEANWBTC: "0xbea00dde4b34acdcb1a30442bd2b39ca8be1b09c", + BEANUSDC: "0xbea00ee04d8289aed04f92ea122a96dc76a91bd7", + BEANUSDT: "0xbea00ff437ca7e8354b174339643b4d1814bed33", + UNRIPE_BEAN_ERC20: "0x1bea054dddbca12889e07b3e076f511bf1d27543", + UNRIPE_LP_ERC20: "0x1bea059c3ea15f6c10be1c53d70c75fd1266d788", + // Underlying non-bean tokens + WETH: ADDRESSES.arbitrum.WETH, + WSTETH: ADDRESSES.arbitrum.WSTETH, + WEETH: "0x35751007a407ca6feffe80b3cb397736d2cf4dbe", + WBTC: ADDRESSES.arbitrum.WBTC, + USDC: ADDRESSES.arbitrum.USDC_CIRCLE, + USDT: ADDRESSES.arbitrum.USDT + } +}; /// REFERENCE BLOCKS TIMESTAMPS // Whitelist BEANETH_V1 12974075 1628288832 @@ -34,52 +54,96 @@ const LUSD = ADDRESSES.ethereum.LUSD; const EXPLOIT_TIME = 1650198256; const REPLANT_TIME = 1659657966; const BIP12_TIME = 1645038020; +const ARB_MIGRATION_TIME = 1728529200; // 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] + ethereum: { + [ADDR.ethereum.BEANETH_V1]: { + startTime: 1628288832, + endTime: EXPLOIT_TIME, + underlying: [ADDR.ethereum.BEAN_ERC20_V1, ADDR.ethereum.WETH] + }, + [ADDR.ethereum.BEAN3CRV_V1]: { + startTime: 1645038020, + endTime: EXPLOIT_TIME, + underlying: [ADDR.ethereum.BEAN_ERC20_V1, ADDR.ethereum.CRV3] + }, + [ADDR.ethereum.BEANLUSD_V1]: { + startTime: 1649451979, + endTime: EXPLOIT_TIME, + underlying: [ADDR.ethereum.BEAN_ERC20_V1, ADDR.ethereum.LUSD] + }, + [ADDR.ethereum.BEAN3CRV_V2]: { + startTime: 1659645914, + endTime: ARB_MIGRATION_TIME, + underlying: [ADDR.ethereum.BEAN_ERC20, ADDR.ethereum.CRV3] + }, + [ADDR.ethereum.BEANETH_V2]: { + startTime: 1693412759, + endTime: ARB_MIGRATION_TIME, + underlying: [ADDR.ethereum.BEAN_ERC20, ADDR.ethereum.WETH] + } }, - [BEANETH_V2]: { - startTime: 1693412759, - endTime: 999999999999, - underlying: [BEAN_ERC20, WETH] + arbitrum: { + [ADDR.arbitrum.BEANWETH]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.WETH] + }, + [ADDR.arbitrum.BEANWSTETH]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.WSTETH] + }, + [ADDR.arbitrum.BEANWEETH]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.WEETH] + }, + [ADDR.arbitrum.BEANWBTC]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.WBTC] + }, + [ADDR.arbitrum.BEANUSDC]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.USDC] + }, + [ADDR.arbitrum.BEANUSDT]: { + startTime: ARB_MIGRATION_TIME, + endTime: 999999999999, + underlying: [ADDR.arbitrum.BEAN_ERC20, ADDR.arbitrum.USDT] + }, } }; +function invalidTime(api) { + if (api.chain === 'ethereum') { + return (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) || api.timestamp >= ARB_MIGRATION_TIME; + } else if (api.chain === 'arbitrum') { + return false; + } +} + // 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; + return ADDR.ethereum.BEAN_ERC20_V1; + } else if ( timestamp <= ARB_MIGRATION_TIME) { + return ADDR.ethereum.BEAN_ERC20; + } else { + return ADDR.arbitrum.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) { +function getPools(api) { + const { chain, timestamp } = api; const pools = []; - for (const contract in ALL_POOLS) { - const pool = ALL_POOLS[contract]; + for (const contract in ALL_POOLS[chain]) { + const pool = ALL_POOLS[chain][contract]; if (timestamp >= pool.startTime && timestamp <= pool.endTime) { pools.push(contract); } @@ -100,14 +164,14 @@ async function getPoolReserves(api, pool) { pool = pool.toLowerCase(); const poolBalances = await api.multiCall({ - calls: ALL_POOLS[pool].underlying.map(token => ({ + calls: ALL_POOLS[api.chain][pool].underlying.map(token => ({ target: token, params: pool })), abi: 'erc20:balanceOf' }); - return poolBalances.map((balance, i) => ({ token: ALL_POOLS[pool].underlying[i], balance })); + return poolBalances.map((balance, i) => ({ token: ALL_POOLS[api.chain][pool].underlying[i], balance })); } // Returns the total silo'd amount of the requested token @@ -118,15 +182,15 @@ async function getSiloDeposited(api, token) { // Prior to BIP12, there was no generalized deposit getter result = await api.call({ abi: - token === BEAN_ERC20_V1 + token === ADDR.ethereum.BEAN_ERC20_V1 ? "function totalDepositedBeans() public view returns (uint256)" : "function totalDepositedLP() public view returns (uint256)", - target: BEANSTALK + target: ADDR[api.chain].BEANSTALK }); } else { result = await api.call({ abi: "function getTotalDeposited(address) external view returns (uint256)", - target: BEANSTALK, + target: ADDR[api.chain].BEANSTALK, params: token }); } @@ -164,12 +228,12 @@ async function getRipePooledBalances(api, unripeToken) { const [underlyingToken, underlyingPerUnripe, depositedUnripe] = await Promise.all([ api.call({ abi: "function getUnderlyingToken(address) external view returns (address)", - target: BEANSTALK, + target: ADDR[api.chain].BEANSTALK, params: unripeToken }), api.call({ abi: "function getUnderlyingPerUnripeToken(address) external view returns (uint256)", - target: BEANSTALK, + target: ADDR[api.chain].BEANSTALK, params: unripeToken }), getSiloDeposited(api, unripeToken), @@ -177,12 +241,13 @@ async function getRipePooledBalances(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; + const BEAN = ADDR[api.chain].BEAN_ERC20; + if (underlyingToken.toLowerCase() == BEAN) { + ripePooledTokenBalances[BEAN] = (ripePooledTokenBalances[BEAN] ?? 0) + underlyingAmount; } else { const underlyingSupply = await getTotalSupply(api, underlyingToken); const ratio = underlyingAmount / underlyingSupply; - const balances = await getPooledBalances(api, [underlyingToken], [ratio]); + const balances = await getPooledBalances(api, [underlyingToken.toLowerCase()], [ratio]); for (const token in balances) { ripePooledTokenBalances[token] = (ripePooledTokenBalances[token] ?? 0) + balances[token]; } @@ -192,7 +257,7 @@ async function getRipePooledBalances(api, unripeToken) { // Beans deposited in the silo async function staking(api) { - if (api.timestamp >= EXPLOIT_TIME && api.timestamp <= REPLANT_TIME) { + if (invalidTime(api)) { return {}; } @@ -200,23 +265,23 @@ async function staking(api) { const bean = getBean(api.timestamp); const [siloBeans, unripeSiloBeans] = await Promise.all([ getSiloDeposited(api, bean), - getRipePooledBalances(api, UNRIPE_BEAN_ERC20) + getRipePooledBalances(api, ADDR[api.chain].UNRIPE_BEAN_ERC20) ]); - const totalStaked = siloBeans + unripeSiloBeans[BEAN_ERC20]; + const totalStaked = siloBeans + unripeSiloBeans[ADDR[api.chain].BEAN_ERC20]; return { - [`ethereum:${bean.toLowerCase()}`]: totalStaked + [`${api.chain}:${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) { + if (invalidTime(api)) { return {}; } // Get the amount of lp tokens deposited in the silo - const pools = getPools(api.timestamp); + const pools = getPools(api); const poolPromises = pools.map(pool => [ getSiloDeposited(api, pool), getTotalSupply(api, pool) @@ -231,7 +296,7 @@ async function pool2(api) { // 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) + getRipePooledBalances(api, ADDR[api.chain].UNRIPE_LP_ERC20) ]); const pool2Balances = balancesResults[0]; @@ -242,21 +307,27 @@ async function pool2(api) { // Add chain info const retval = {}; for (const token in pool2Balances) { - retval[`ethereum:${token.toLowerCase()}`] = pool2Balances[token]; + retval[`${api.chain}:${token.toLowerCase()}`] = pool2Balances[token]; } return retval; } module.exports = { methodology: "Counts the value of deposited Beans and LP tokens in the silo.", - start: 12974077, + start: 1628287657, ethereum: { tvl: () => ({}), pool2, staking }, + arbitrum: { + tvl: () => ({}), + pool2, + staking + }, hallmarks: [ - [1650153600, "Governance Exploit"], - [1659602715, "Replant"] + [EXPLOIT_TIME, "Governance Exploit"], + [REPLANT_TIME, "Replant"], + [ARB_MIGRATION_TIME, "Migration to Arbitrum"], ] }; diff --git a/projects/bearnfi/index.js b/projects/bearnfi/index.js index 19af898bbaaf..d0e7fde02fd2 100644 --- a/projects/bearnfi/index.js +++ b/projects/bearnfi/index.js @@ -4,10 +4,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const { compoundExports } = require('../helper/compound') const { getConfig } = require('../helper/cache') -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { getChainTransform } = require("../helper/portedTokens"); - -const abi = require("./abi.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const url = "https://api.bdollar.fi/api/bvault/get-vaults"; @@ -15,76 +12,28 @@ const BDEX_FACTORY = "0x2C358A7C62cdb9D554A65A86EEa034bc55D1E715"; const COMPTROLLER = "0xEEea0D4aAd990c4ede8e064A8Cb0A627B432EDa0"; const wBNB = ADDRESSES.bsc.WBNB; const cBNB = "0xa3948b027f94ca195eac645746435aaa7eb555a7"; -const chain = 'bsc' - -async function yieldTVL(timestamp, chainBlocks) { - let balances = {}; +async function yieldTVL(api) { // --- bVaults & bDollar TVL section, all contract addresses grab from endpoint --- // --- Sections of boardroom is not considered in TVL (bDollar Shares related) --- let vaultsInfo = (await getConfig('bearn-fi', url)).data.vaultInfos; const keys = Object.keys(vaultsInfo); - const strategies = []; + const strategies = [] keys.forEach((key) => { - strategies.push({ - address: vaultsInfo[key].strategy, - token: vaultsInfo[key].token, - }); - }); - - let wantedLocked = ( - await sdk.api.abi.multiCall({ - block: chainBlocks["bsc"], - calls: strategies.map((strategy) => ({ target: strategy.address })), - abi: abi.wantLockedTotal, - chain: "bsc", - }) - ).output.map((el) => el.output); - - let wantedAddresses = ( - await sdk.api.abi.multiCall({ - block: chainBlocks["bsc"], - calls: strategies.map((strategy) => ({ target: strategy.address })), - abi: abi.wantAddress, - chain: "bsc", - }) - ).output.map((el) => el.output); - - const transformAdress = await getChainTransform(chain); - - const lpPositions = []; - - strategies.map((strategy, idx) => { - if ( - strategy.token.includes("CakeLP") || - strategy.token.includes("CLP") || - strategy.token.includes("vBSWAP") || - strategy.token.includes("VLP") && strategy.token !== "VLP_BDO_VDOLLAR" - ) { - lpPositions.push({ - token: wantedAddresses[idx], - balance: wantedLocked[idx], - }); - } else { - // apparently this strategy in the endpoint states 0 tvl, so it is filter out - if (!strategy.token.includes("ibBUSD")) { - sdk.util.sumSingleBalance( - balances, - `bsc:${wantedAddresses[idx]}`, - wantedLocked[idx] - ); - } - } + if (vaultsInfo[key].token !== "ibBUSD") + strategies.push(vaultsInfo[key].strategy) }); + const bals = await api.multiCall({ abi: "uint256:wantLockedTotal", calls: strategies }) + const tokens = await api.multiCall({ abi: "address:wantAddress", calls: strategies }) - await unwrapUniswapLPs(balances, lpPositions, chainBlocks["bsc"], "bsc", transformAdress); - return balances; + api.add(tokens, bals) + return sumTokens2({ api, resolveLP: true }) } -const cExports = compoundExports(COMPTROLLER, chain, cBNB, wBNB,) +const cExports = compoundExports(COMPTROLLER, cBNB, wBNB,) const dexTVL = getUniTVL({ factory: BDEX_FACTORY, diff --git a/projects/bedrock/index.js b/projects/bedrock/index.js new file mode 100644 index 000000000000..b673ced9d285 --- /dev/null +++ b/projects/bedrock/index.js @@ -0,0 +1,28 @@ +const { sumTokens } = require('../helper/chain/bitcoin') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') +const { getConfig } = require('../helper/cache.js') + +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.bedrock() }) +} + +module.exports = { + timetravel: false, + doublecounted: true, + bitcoin: { + tvl + } +} + +async function tvlEvm(api) { + const API_URL = 'https://raw.githubusercontent.com/Bedrock-Technology/uniBTC/refs/heads/main/data/tvl/reserve_address.json' + const { evm, } = await getConfig('bedrock.btc_address', API_URL) + const chain = api.chain == 'btr' ? 'bitlayer' : api.chain + const { vault, tokens } = evm[chain] ?? {} + if (!vault) return; + return api.sumTokens({ api, owner: vault, tokens }) +} + +['btr', 'ethereum', 'bsc', 'arbitrum', 'mantle', 'merlin', 'optimism', 'bob', 'bsquared', 'zeta', 'mode'].forEach(chain => { + module.exports[chain] = { tvl: tvlEvm } +}) \ No newline at end of file diff --git a/projects/beeBase/index.js b/projects/beeBase/index.js new file mode 100644 index 000000000000..684b86cb849e --- /dev/null +++ b/projects/beeBase/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + base: { + tvl: sumTokensExport({ owners: + [ + "0xFD09F108D1728E6B6eD241ccd254775e322f1ed6", + "0x8a2fFD429d33FBfC6f5A91aa207e48bB095Db7d9" + ], tokens: [ + ADDRESSES.null, + ADDRESSES.base.USDC, + ADDRESSES.base.WETH, + ]}), + } +}; \ No newline at end of file diff --git a/projects/beefy/index.js b/projects/beefy/index.js index 57cd2993eef6..58dba0060099 100644 --- a/projects/beefy/index.js +++ b/projects/beefy/index.js @@ -34,6 +34,7 @@ const chains = { ethereum: 1, optimism: 10, cronos: 25, + rsk: 30, bsc: 56, xdai: 100, fuse: 122, @@ -47,6 +48,7 @@ const chains = { polygon_zkevm: 1101, moonbeam: 1284, moonriver: 1285, + sei: 1329, kava: 2222, mantle: 5000, canto: 7700, @@ -57,6 +59,8 @@ const chains = { oasis: 42262, avax: 43114, linea: 59144, + real: 111188, + scroll: 534352, aurora: 1313161554, harmony: 1666600000 } diff --git a/projects/bella.js b/projects/bella.js index 55e063a1cbbf..7eaaa8ac2e59 100644 --- a/projects/bella.js +++ b/projects/bella.js @@ -1,48 +1,34 @@ -const sdk = require('@defillama/sdk') -const { sumTokens } = require('./helper/unwrapLPs') -const bVaultAbi = require('./config/bella/abis/bVault') +const { sumTokens2 } = require('./helper/unwrapLPs') const ADDRESSES = require('./helper/coreAssets.json'); -const { getPoolLiquidityAmount } = require('./config/bella/izi'); -const iziABI = require('./config/bella/abis/izi'); +const { getPoolLiquidityAmount } = require('./bella/izi'); +const iziABI = require('./bella/abis/izi'); const bVaults = { - bUsdt: { address: '0x2c23276107b45E64c8c59482f4a24f4f2E568ea6', }, - bUsdc: { address: '0x8016907D54eD8BCf5da100c4D0EB434C0185dC0E', }, - bArpa: { address: '0x750d30A8259E63eD72a075f5b6630f08ce7996d0', }, - bWbtc: { address: '0x3fb6b07d77dace1BA6B5f6Ab1d8668643d15a2CC', }, - bHbtc: { address: '0x8D9A39706d3B66446a298f1ae735730257Ec6108', }, - // bBusd: { address: '0x378388aa69f3032FA46150221210C7FA70A35153', }, // according to the team this is deprecated + bUsdt: '0x2c23276107b45E64c8c59482f4a24f4f2E568ea6', + bUsdc: '0x8016907D54eD8BCf5da100c4D0EB434C0185dC0E', + bArpa: '0x750d30A8259E63eD72a075f5b6630f08ce7996d0', + bWbtc: '0x3fb6b07d77dace1BA6B5f6Ab1d8668643d15a2CC', + bHbtc: '0x8D9A39706d3B66446a298f1ae735730257Ec6108', + // bBusd: '0x378388aa69f3032FA46150221210C7FA70A35153', // according to the team this is deprecated } -const uniswapV2Pools = { - belUsdt: { address: '0xf0d1109e723cb06e400e2e57d0b6c7c32bedf61a', owner: '0x6731a6a2586a0d555dcff7eb4d8fb7444bdfde2a' }, - belEth: { address: '0x9e98deac1a416c9ce3c892bd8eef586f1291ca35', owner: '0x994be2994471d5ef93c600cf78c2752c5e96f5a7' }, - arpaUsdt: { address: '0x9F624b25991b99D7b14d6740A9D581DD77980808', owner: '0xc935285b0d88069305431dace0c3c01d7e793d84' }, -} - -async function tvl(ts, block) { - const tokenCalls = Object.values(bVaults).map(a => ({ target: a.address })) - - const { output: tokenResponse } = await sdk.api.abi.multiCall({ - block, calls: tokenCalls, abi: bVaultAbi.token - }) +const uniswapV2Pools = [ + ['0xf0d1109e723cb06e400e2e57d0b6c7c32bedf61a','0x6731a6a2586a0d555dcff7eb4d8fb7444bdfde2a'], // belUsdt + ['0x9e98deac1a416c9ce3c892bd8eef586f1291ca35','0x994be2994471d5ef93c600cf78c2752c5e96f5a7'], // belEth + ['0x9F624b25991b99D7b14d6740A9D581DD77980808','0xc935285b0d88069305431dace0c3c01d7e793d84'], // arpaUsdt +] - const { output: underlyingBalances } = await sdk.api.abi.multiCall({ - block, calls: tokenCalls, abi: bVaultAbi.underlyingBalance - }) +async function tvl(api) { + const tokens = Object.values(bVaults) + const utokens = await api.multiCall({ calls: tokens, abi: 'address:token'}) + const bals = await api.multiCall({ calls: tokens, abi: "uint256:underlyingBalance"}) + api.add(utokens, bals) - const balances = {} - tokenResponse.forEach(({ input, output }, i) => { - sdk.util.sumSingleBalance(balances, output, underlyingBalances[i].output || 0) - }) - return balances } -async function pool2(ts, block) { - const toa = [] - Object.values(uniswapV2Pools).forEach(({ address, owner }) => toa.push([address, owner])) - return sumTokens({}, toa, block,) +async function pool2(api) { + return sumTokens2({ api, tokensAndOwners: uniswapV2Pools, resolveLP: true, }) } module.exports = { @@ -50,15 +36,15 @@ module.exports = { tvl, pool2, }, - manta: { + manta: { pool2: async (api) => { const STONE = '0xEc901DA9c68E90798BbBb74c11406A32A70652C3' const WUSDM = '0xbdAd407F77f44F7Da6684B416b1951ECa461FB07' const IZI = '0x91647632245cabf3d66121f86c387ae0ad295f9a' const miningContract = '0x2C9bFcA337bAc7cBdA3B80D1b2d10ed6482D7C0f' const MiningABI = iziABI.mantaMiningABI; - const {totalTokenX_, totalTokenY_, totalNIZI_} = await api.call({ - abi: MiningABI, + const { totalTokenX_, totalTokenY_, totalNIZI_ } = await api.call({ + abi: MiningABI, target: miningContract, chain: 'manta', }); @@ -121,10 +107,9 @@ module.exports = { const infoABI = "function getMiningContractInfo() external view returns (address tokenX, address tokenY, uint24 fee_, address iziTokenAddr, uint256 lastTouchTime_, uint256 totalVLiquidity_, uint256 bal0, uint256 bal1, uint256 balIzi, uint256 startTime_, uint256 endTime_)" const data = await api.multiCall({ abi: infoABI, calls: pool2s }) - const transform = i => i.toLowerCase() === '0xb83cfb285fc8d936e8647fa9b1cc641dbaae92d9' ? 'ethereum:0xa91ac63d040deb1b7a5e4d4134ad23eb0ba07e14': 'era:'+i for (const { tokenX, tokenY, iziTokenAddr, bal0, bal1, balIzi } of data) { - api.add(transform(tokenX), bal0, { skipChain: true}) - api.add(transform(tokenY), bal1, { skipChain: true}) + api.add(tokenX, bal0) + api.add(tokenY, bal1) api.add(iziTokenAddr, balIzi) } }, diff --git a/projects/config/bella/abis/bVault.js b/projects/bella/abis/bVault.js similarity index 100% rename from projects/config/bella/abis/bVault.js rename to projects/bella/abis/bVault.js diff --git a/projects/config/bella/abis/izi.js b/projects/bella/abis/izi.js similarity index 100% rename from projects/config/bella/abis/izi.js rename to projects/bella/abis/izi.js diff --git a/projects/config/bella/izi.js b/projects/bella/izi.js similarity index 100% rename from projects/config/bella/izi.js rename to projects/bella/izi.js diff --git a/projects/config/bella/util.js b/projects/bella/util.js similarity index 100% rename from projects/config/bella/util.js rename to projects/bella/util.js diff --git a/projects/bencu/index.js b/projects/bencu/index.js index f73e5f51451e..21c5cb190422 100644 --- a/projects/bencu/index.js +++ b/projects/bencu/index.js @@ -1,8 +1,7 @@ -const {usdCompoundExports} = require("../helper/compound") +const { compoundExports2 } = require("../helper/compound") -module.exports={ - misrepresentedTokens: true, - metis:usdCompoundExports("0xC5986Df018D1ff8ecA79fd3f266428616617cDF3", "metis", undefined, undefined, { - blacklist: ['0x718F2e019F8166d81523d959F720Ad4A6e379209'.toLowerCase()] - }) +module.exports = { + metis: compoundExports2({ + comptroller: '0xC5986Df018D1ff8ecA79fd3f266428616617cDF3', + }) } \ No newline at end of file diff --git a/projects/benqi/index.js b/projects/benqi/index.js index 91882701b701..65656996c35f 100644 --- a/projects/benqi/index.js +++ b/projects/benqi/index.js @@ -6,12 +6,12 @@ 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, + compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c").tvl, + compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F").tvl, ]), borrowed: sdk.util.sumChainTvls([ - compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax").borrowed, - compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F", "avax").borrowed, + compoundExports("0x486af39519b4dc9a7fccd318217352830e8ad9b4", '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c').borrowed, + compoundExports("0xD7c4006d33DA2A0A8525791ed212bbCD7Aca763F").borrowed, ]), pool2: pool2("0x784da19e61cf348a8c54547531795ecfee2affd1", "0xe530dc2095ef5653205cf5ea79f8979a7028065c") } diff --git a/projects/beta-finance-v2/index.js b/projects/beta-finance-v2/index.js index b4578abb80cd..910972b10ca6 100644 --- a/projects/beta-finance-v2/index.js +++ b/projects/beta-finance-v2/index.js @@ -4,6 +4,8 @@ const { getUniqueAddresses } = require('../helper/tokenMapping'); const config = { ethereum: { bank: '0x1150d370C61cdd5d6F81c68783678382b447B07D', fromBlock: 18569809, }, + bsc: { bank: '0x5F579336b1959a4a51782B61ce8E877fF6171A6C', fromBlock: 34515370, }, + arbitrum: { bank: '0xAcF4dC6043043324b84aFE77e00678607F9e70fF', fromBlock: 223761172, }, } const abis = { diff --git a/projects/betmode/index.js b/projects/betmode/index.js new file mode 100644 index 000000000000..299c6d1e51b8 --- /dev/null +++ b/projects/betmode/index.js @@ -0,0 +1,24 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); + +module.exports = { + methodology: "TVL is the total quantity of USDC held in the contract", + mode: { + tvl: sumTokensExport({ + owners: ["0xeb5D5af6a0ac3B64243858094d6b3b379B8772Aa"], + tokens: [ADDRESSES.mode.USDC], + }), + }, + base: { + tvl: sumTokensExport({ + owners: ["0x1C6971510c02eAe2e0a7d02A51193fE0b7286De4"], + tokens: [ADDRESSES.base.USDC], + }), + }, + optimism: { + tvl: sumTokensExport({ + owners: ["0x4b9d8f10bB6F50765DbeB9F8FBBF3Dace0Db8f3c"], + tokens: [ADDRESSES.optimism.USDC_CIRCLE], + }), + }, +}; diff --git a/projects/bevm/index.js b/projects/bevm/index.js index 342a3d12fb37..d3fe0438889c 100644 --- a/projects/bevm/index.js +++ b/projects/bevm/index.js @@ -1,15 +1,10 @@ const { sumTokensExport } = require("../helper/sumTokens"); -const ADDRESSES = require("../helper/coreAssets.json"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: "TVL counts tokens deposited in BEVM", //doublecounted: true, bitcoin: { - tvl: sumTokensExport({ - owners: [ - "bc1p43kqxnf7yxcz5gacmqu98cr2r5gndtauzrwpypdzmsgp7n3lssgs5wruvy", - "bc1p2s98z85m7dwc7agceh58j54le0nedmqwxvuuj4ex4mwpsv52pjxqkczev9", - ], - }), + tvl: sumTokensExport({ owners: bitcoinAddressBook.bevm }), }, }; diff --git a/projects/bfly.js b/projects/bfly.js index dcea3c526d32..29089ee81605 100644 --- a/projects/bfly.js +++ b/projects/bfly.js @@ -40,7 +40,6 @@ module.exports={ methodology: "Data is retrieved from the api at https://fai.bfly.finance", misrepresentedTokens: true, timetravel: false, - incentivized: true, starcoin: { tvl, } diff --git a/projects/bgsol/index.js b/projects/bgsol/index.js new file mode 100644 index 000000000000..12a938e64eea --- /dev/null +++ b/projects/bgsol/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/solana"); + +async function tvl() { + return sumTokens2({ tokenAccounts: ['Ejg5vqsthntG8wJDijzgEWvdvhoAh8pzu4Q4r4MqsdkR'] }) +} + +module.exports = { + timetravel: false, + doublecounted: true, + methodology: "Bitget Staked SOL (BGSOL) is a tokenized representation on your staked sSOL", + solana: { tvl }, +}; \ No newline at end of file diff --git a/projects/biconomy-cex/index.js b/projects/biconomy-cex/index.js new file mode 100644 index 000000000000..fff4938b346d --- /dev/null +++ b/projects/biconomy-cex/index.js @@ -0,0 +1,25 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + ethereum: { + owners: [ + '0xb03eDB668008459B3c6D948ab5Ab305581DbF69c' + ], + }, + bitcoin: { + owners: bitcoinAddressBook.biconomy + }, + polygon: { + owners: [ + '0x366ba28Ec89113454EA6e82bB606426e8cA22780' + ], + }, + tron: { + owners: [ + 'TEi2hVWDRMo61PAoi1Dwbn8hNXufkwEVyp' + ] + }, +} + +module.exports = cexExports(config) diff --git a/projects/bifi/index.js b/projects/bifi/index.js index c22a620cfbeb..c5a0511bf930 100644 --- a/projects/bifi/index.js +++ b/projects/bifi/index.js @@ -51,7 +51,7 @@ const chainPools = { UnifiedDAI: { pool: '0x2168dAb12A6A93181bbAD9C9dc769307C36fB45C', token: ADDRESSES.bfc.UnifiedDAI }, UnifiedWBTC: { pool: '0xEa3b4a2dA5DbE8379AD4c60aaD5184df69D7C9AD', token: ADDRESSES.bfc.WBTC}, UnifiedBTCB: { pool: '0x0B31FeE8bF53bFe2f5F7083B73A4c9C8B517E32F', token: ADDRESSES.bfc.BTCB}, - BitcoinUSD: { pool: '0xcF2FC1d354018A39D5Ef036aA865Ad8cbF7B611E', token: '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555' } + BitcoinUSD: { pool: '0xcF2FC1d354018A39D5Ef036aA865Ad8cbF7B611E', token: ADDRESSES.bfc.BitcoinUSD } }, } diff --git a/projects/bigone/index.js b/projects/bigone/index.js new file mode 100644 index 000000000000..360b25c9ecd5 --- /dev/null +++ b/projects/bigone/index.js @@ -0,0 +1,27 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + ethereum: { + owners: [ + '0xd4dcd2459bb78d7a645aa7e196857d421b10d93f', + '0x88e343f4599292c2cffe683c1bb93cd3480bdbab', + '0xa30d8157911ef23c46c0eb71889efe6a648a41f7' + ], + }, + bitcoin: { + owners: bitcoinAddressBook.bigone + }, + solana: { + owners: [ + '7BCp5XUXtKzZWYCvGR2fzFqoyKiJ7ozN8eCEHscpSMnB' + ] + }, + tron: { + owners: [ + 'TNrPUjc47JU1fgaQZPa1odQnD5RTdH3NSu' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/binance-btc/index.js b/projects/binance-btc/index.js new file mode 100644 index 000000000000..3847560af6bc --- /dev/null +++ b/projects/binance-btc/index.js @@ -0,0 +1,12 @@ +const sdk = require('@defillama/sdk'); +const { sumTokensExport } = require('../helper/sumTokens'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +module.exports = { + methodology: "BTC on btc chain", + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners: bitcoinAddressBook.binance2 }), + ]), + }, +}; \ No newline at end of file diff --git a/projects/binance/config.js b/projects/binance/config.js index 4b945b4df62a..f58740a565ac 100644 --- a/projects/binance/config.js +++ b/projects/binance/config.js @@ -95,6 +95,7 @@ const assetList = [ ['BTC', 'BTC', '3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa'], ['BTC', 'BTC', '3NjHh71XgjikBoTNYdWgXiNeZcLaKNThgb'], ['BTC', 'BTC', '3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA'], + ['BTC', 'BTC', 'bc1qdtmav38lca8yu3rrcknnqx5242cckgxqws7m72'], ['BTC', 'BTC', 'bc1q32lyrhp9zpww22phqjwwmelta0c8a5q990ghs6'], ['BTC', 'BTC', 'bc1q78ufzeu8w8fwvxuphrdlg446xhyptf28fkatu5'], ['BTC', 'BTC', 'bc1q7t9fxfaakmtk8pj7tdxjvwsng6y9x76czuaf5h'], @@ -174,7 +175,6 @@ const assetList = [ ['DOGE', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['DOGE', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], ['DOGE', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], - /* ['DOGE', 'DOGE', 'D73RQLGWW9TBT2AKspEP24wLiXFrXvnTqX'], ['DOGE', 'DOGE', 'D7BrtudMAdwz2U7vSGumVDuxZsZNibJuzw'], ['DOGE', 'DOGE', 'D7D2f2WuEkwhTWqBkisZ5sM3JagaBcNWBs'], @@ -212,7 +212,6 @@ const assetList = [ ['DOGE', 'DOGE', 'DTSop4ycWkpmDqpncVZ3jwKp3z7B4kW4T3'], ['DOGE', 'DOGE', 'DTbG3RJRejnM99g8MSnhSbJxJVW8X7YXy9'], ['DOGE', 'DOGE', 'DU8gPC5mh4KxWJARQRxoESFark2jAguBr5'], - */ ['DOT', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], ['DOT', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], ['DOT', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], @@ -227,6 +226,7 @@ const assetList = [ ['DOT', 'DOT', '1743nDTMZisPgBCYSAgkUn1kVG7MePc9rvMEjoRNf4ipVkF'], ['DOT', 'DOT', '1P6bgxZi42kYYV545c3RSp7NJLUgASDpMP1ifXJazVR1e2N'], ['DOT', 'DOT', '1qnJN7FViy3HZaxZK9tGAA71zxHSBeUweirKqCaox4t8GT7'], + ['DOT', 'DOT', '169HLL5FwyoazAXyc8g7M6VRFCbpiLKTW6yQBVHBjRBUcFra'], ['DOT', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['DOT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['DOT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], @@ -280,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'], @@ -290,6 +290,7 @@ const assetList = [ ['FDUSD', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], ['FDUSD', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], ['FDUSD', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], + ['USDT', 'BEP20', '0x4fdFE365436b5273a42F135C6a6244A20404271E'], ['FDUSD', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['FDUSD', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['FDUSD', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'], @@ -306,6 +307,7 @@ const assetList = [ ['GRT', 'ARB', '0xf977814e90da44bfa03b6295a0616a897441acec'], ['GRT', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['GRT', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], + ['ETH', 'ETH', '0x4fdFE365436b5273a42F135C6a6244A20404271E'], ['GRT', 'ETH', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], ['GRT', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['GRT', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], @@ -426,6 +428,8 @@ const assetList = [ ['SOL', 'SOL', '9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM'], ['SOL', 'SOL', 'BZ3kabSsMzbuJUguYxtmkRtzw7ACqw1DUMH8PcbvXiUr'], ['SOL', 'SOL', 'HXsKP7wrBWaQ8T2Vtjry3Nj3oUgwYcqq9vrHDM12G664'], + //added on 31/07/2024 + ['SOL', 'SOL', 'GK35nWN6ZHSGZrRTf8kTQd8RkFCighChPEb41XwSFVAC'], ['SSV', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], ['SSV', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['SSV', 'ETH', '0x4a9e49a45a4b2545cb177f79c7381a30e1dc261f'], @@ -567,33 +571,35 @@ const assetList = [ ['WRX', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], ['WRX', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], ['WRX', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['XRP', 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], - ['XRP', 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], - ['XRP', 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], - ['XRP', 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], - ['XRP', 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], - ['XRP', 'BEP20', '0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774'], - ['XRP', 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], - ['XRP', 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], - ['XRP', 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'], - ['XRP', 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['XRP', 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], - ['XRP', 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], - ['XRP', 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], - ['XRP', 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], - ['XRP', 'XRP', 'rBtttd61FExHC68vsZ8dqmS3DfjFEceA1A'], - ['XRP', 'XRP', 'rDAE53VfMvftPB4ogpWGWvzkQxfht6JPxr'], - ['XRP', 'XRP', 'rDecw8UhrZZUiaWc91e571b3TL41MUioh7'], - ['XRP', 'XRP', 'rEy8TFcrAPvhpKrwyrscNYyqBGUkE9hKaJ'], - ['XRP', 'XRP', 'rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK'], - ['XRP', 'XRP', 'rP3mUZyCDzZkTSd1VHoBbFt8HGm8fyq8qV'], - ['XRP', 'XRP', 'rPJ5GFpyDLv7gqeB1uZVUBwDwi41kaXN5A'], - ['XRP', 'XRP', 'rPz2qA93PeRCyHyFCqyNggnyycJR1N4iNf'], - ['XRP', 'XRP', 'rarG6FaeYhnzSKSS5EEPofo4gFsPn2bZKk'], - ['XRP', 'XRP', 'rfQ9EcLkU6WnNmkS3EwUkFeXeN47Rk8Cvi'], - ['XRP', 'XRP', 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'], - ['XRP', 'XRP', 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'], - ['XRP', 'XRP', 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], + [ADDRESSES.ripple.XRP, 'BEP2', 'bnb1fnd0k5l4p3ck2j9x9dp36chk059w977pszdgdz'], + [ADDRESSES.ripple.XRP, 'BEP2', 'bnb1u2agwjat20494fmc6jnuau0ls937cfjn4pjwtn'], + [ADDRESSES.ripple.XRP, 'BEP20', '0x0e4158c85ff724526233c1aeb4ff6f0c46827fbe'], + [ADDRESSES.ripple.XRP, 'BEP20', '0x5a52e96bacdabb82fd05763e25335261b270efcb'], + [ADDRESSES.ripple.XRP, 'BEP20', '0x8894e0a0c962cb723c1976a4421c95949be2d4e3'], + [ADDRESSES.ripple.XRP, 'BEP20', '0xbd612a3f30dca67bf60a39fd0d35e39b7ab80774'], + [ADDRESSES.ripple.XRP, 'BEP20', '0xd3a22590f8243f8e83ac230d1842c9af0404c4a1'], + [ADDRESSES.ripple.XRP, 'BEP20', '0xe2fc31f816a9b94326492132018c3aecc4a93ae1'], + [ADDRESSES.ripple.XRP, 'BEP20', '0xeb2d2f1b8c558a40207669291fda468e50c8a0bb'], + [ADDRESSES.ripple.XRP, 'BEP20', '0xf977814e90da44bfa03b6295a0616a897441acec'], + [ADDRESSES.ripple.XRP, 'ETH', '0x21a31ee1afc51d94c2efccaa2092ad1028285549'], + [ADDRESSES.ripple.XRP, 'ETH', '0x28c6c06298d514db089934071355e5743bf21d60'], + [ADDRESSES.ripple.XRP, 'ETH', '0xdfd5293d8e347dfe59e90efd55b2956a1343963d'], + [ADDRESSES.ripple.XRP, 'ETH', '0xf977814e90da44bfa03b6295a0616a897441acec'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rBtttd61FExHC68vsZ8dqmS3DfjFEceA1A'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rDAE53VfMvftPB4ogpWGWvzkQxfht6JPxr'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rDecw8UhrZZUiaWc91e571b3TL41MUioh7'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rEy8TFcrAPvhpKrwyrscNYyqBGUkE9hKaJ'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rNU4eAowPuixS5ZCWaRL72UUeKgxcKExpK'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rP3mUZyCDzZkTSd1VHoBbFt8HGm8fyq8qV'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rPJ5GFpyDLv7gqeB1uZVUBwDwi41kaXN5A'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rPz2qA93PeRCyHyFCqyNggnyycJR1N4iNf'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rarG6FaeYhnzSKSS5EEPofo4gFsPn2bZKk'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rfQ9EcLkU6WnNmkS3EwUkFeXeN47Rk8Cvi'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rhWj9gaovwu2hZxYW7p388P8GRbuXFLQkK'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rpmxpWis42eYV4oMhyxJNSzrLRdacJVooa'], + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rs8ZPbYqgecRcDzQpJYAMhSxSi5htsjnza'], + // added on 31/07/2024 + [ADDRESSES.ripple.XRP, ADDRESSES.ripple.XRP, 'rwkbXMJQLQhVhcjZnnHV4zu39N7WcQXQKX'], ['USDT', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['ETH', 'ETH', '0x835678a611b28684005a5e2233695fb6cbbb0007'], ['ETH', 'ARB', '0xf92402bb795fd7cd08fb83839689db79099c8c9c'], @@ -618,13 +624,16 @@ const assetList = [ ['MATIC', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'], ['USDT', 'MATIC', '0x505e71695e9bc45943c58adec1650577bca68fd9'], ['USDT', 'TRX', 'TRGCqsUXeynKTgynp2j9g3sg7Nux2KtB3u'], + // added on the 27/08/2024 + ['BTC', 'BTC', '3PXBET2GrTwCamkeDzKCx8DeGDyrbuGKoc'], + ['BTC', 'BTC', '3QK5vQ9hucSg8ZC8Vizq83qEWeHFLAWMud'], ] function getAddresses(chain) { return assetList.filter(i => i[1] === chain).map(i => i[2]) } function getOwners(chain) { - const isCaseSensitive = ['BTC', 'TRX', 'SOL', 'XRP', 'LTC', 'DOT', 'ALGO', 'DOGE'].includes(chain) + const isCaseSensitive = ['BTC', 'TRX', 'SOL', ADDRESSES.ripple.XRP, 'LTC', 'DOT', 'ALGO', 'DOGE'].includes(chain) return getUniqueAddresses(assetList.filter(i => i[1] === chain).map(i => i[2]), isCaseSensitive) } @@ -669,7 +678,7 @@ module.exports = { owners: getOwners('OP') }, ripple: { - owners: getOwners('XRP') + owners: getOwners(ADDRESSES.ripple.XRP) }, solana: { owners: getOwners('SOL') @@ -704,9 +713,7 @@ 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 index 103fb69b2ef0..91bec7b4f811 100644 --- a/projects/bing-cex/index.js +++ b/projects/bing-cex/index.js @@ -1,11 +1,10 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + const config = { bitcoin: { - owners: [ - 'bc1qr8e6kmev99jxnk7hpyhex434t59ke5tpvmnyd3', - 'bc1qzzn5tszxn3ha87xfke540k8pr4favsk9cusakq' - ] + owners: bitcoinAddressBook.bingCex }, arbitrum: { owners: [ diff --git a/projects/biokript/index.js b/projects/biokript/index.js index 1b61c9b4fc54..844050762cd3 100644 --- a/projects/biokript/index.js +++ b/projects/biokript/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('bsc', '0x795802cb01a7be4be2f7f114b232a83b3adce64a', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('bsc', '0x795802cb01a7be4be2f7f114b232a83b3adce64a') \ No newline at end of file diff --git a/projects/bitcointry/index.js b/projects/bitcointry/index.js new file mode 100644 index 000000000000..b28662a5f882 --- /dev/null +++ b/projects/bitcointry/index.js @@ -0,0 +1,47 @@ +const { cexExports } = require('../helper/cex') + +const config = { + bsc: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + '0xeb4b2ecaa3e732da97d5fa922634138b9c2be6b9', //broker account on Binance + '0x57078A682ac277D444D8CeE278Dc6E2Ff0A52eA8' //broker account on gate io + ] + }, + base: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + ] + }, + arbitrum: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + ] + }, + ethereum: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + '0xeb4b2ecaa3e732da97d5fa922634138b9c2be6b9' //broker account on Binance + ] + }, + avax: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + '0xeb4b2ecaa3e732da97d5fa922634138b9c2be6b9' //broker account on Binance + ] + }, + polygon: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + '0xeb4b2ecaa3e732da97d5fa922634138b9c2be6b9' //broker account on Binance + ] + }, + optimism: { + owners: [ + '0x13CB26668e11b39290AcaE7Bb8BFF1eC0B4dcAaD', //main wallet + '0xeb4b2ecaa3e732da97d5fa922634138b9c2be6b9' //broker account on Binance + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/bitdrome/index.js b/projects/bitdrome/index.js new file mode 100644 index 000000000000..a8e4e946a5b7 --- /dev/null +++ b/projects/bitdrome/index.js @@ -0,0 +1,13 @@ +async function tvl(api) { + const TwoPoolFactory = '0x634FB7F07BDb77281c64a57F69E1EB19583E727a' + const pools = await api.fetchList({ lengthAbi: 'pool_count', itemAbi: 'pool_list', target: TwoPoolFactory }) + const tokens = await api.multiCall({ target: TwoPoolFactory, calls: pools, abi: 'function get_coins(address _pool) view returns (address[2])' }) + const ownerTokens = tokens.map((v, i) => [v, pools[i]]) + return api.sumTokens({ ownerTokens }) +} + +module.exports = { + bevm: { + tvl + } +} \ No newline at end of file diff --git a/projects/bitfi/index.js b/projects/bitfi/index.js index 4421b9d9845f..0bcd9b108d7e 100644 --- a/projects/bitfi/index.js +++ b/projects/bitfi/index.js @@ -1,31 +1,9 @@ -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', -] - +async function tvl(api) { + const BFBTC = '0xC2236204768456B21eAfEf0d232Ba1FccCe59823' + const supply = await api.call({ abi: 'erc20:totalSupply', target: BFBTC }) + api.add(BFBTC, supply) +} module.exports = { - methodology: "BTC on btc chain", - bitcoin: { - tvl: sdk.util.sumChainTvls([ - sumTokensExport({ owners }), - ]), - }, -}; + doublecounted: true, + ailayer: { tvl }, +} diff --git a/projects/bitfinex/index.js b/projects/bitfinex/index.js index ae30d0f51c0b..0b0caf02f2e9 100644 --- a/projects/bitfinex/index.js +++ b/projects/bitfinex/index.js @@ -1,12 +1,9 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bitcoin: { - owners: [ - '1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g', //BTC hot wallet - '3JZq4atUahhuA9rLhXLMhhTo133J9rF97j', //BTC cold wallet - 'bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97', // BTC cold wallet - ], + owners: bitcoinAddressBook.bitfinex, }, ethereum: { owners: [ diff --git a/projects/bitflux/index.js b/projects/bitflux/index.js new file mode 100644 index 000000000000..a3f45f7644cc --- /dev/null +++ b/projects/bitflux/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const swapFlashLoan = '0x4bcb9Ea3dACb8FfE623317E0B102393A3976053C'; + +const ADDRESSES = { + 'WBTC': "0x5832f53d147b3d6Cd4578B9CBD62425C7ea9d0Bd", + "solvBTCb": "0x5b1fb849f1f76217246b8aaac053b5c7b15b7dc3", + "solvBTCcore": "0x9410e8052bc661041e5cb27fdf7d9e9e842af2aa" +} + +module.exports = { + core: { + tvl: sumTokensExport( + { + owner: swapFlashLoan, + tokens: [ADDRESSES.WBTC, ADDRESSES.solvBTCb, ADDRESSES.solvBTCcore] + }), + } +} \ No newline at end of file diff --git a/projects/bitget/index.js b/projects/bitget/index.js index 82a4da501b35..8cc714db9efa 100644 --- a/projects/bitget/index.js +++ b/projects/bitget/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bsc: { @@ -64,20 +65,7 @@ const config = { ] }, bitcoin: { - owners: [ - '1FWQiwK27EnGXb6BiBMRLJvunJQZZPMcGd', - '1GDn5X4R5vjdSvFPrq1MJubXFkMHVcFJZv', - '3GbdoiTnQrJYatcr2nhq7MYASSCWEKmN6L', - '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 - ] + owners: bitcoinAddressBook.bitget }, arbitrum: { owners: [ @@ -132,6 +120,9 @@ const config = { kava: { owners: ['0x97b9d2102a9a65a26e1ee82d59e42d1b73b68689'] }, + starknet: { + owners: ['0x0299b9008e2d3fa88de6d06781fc9f32f601b2626cb0efa8e8c19f2b17837ed1'] + }, } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/bitlayer-btc/index.js b/projects/bitlayer-btc/index.js new file mode 100644 index 000000000000..5a6957f6e997 --- /dev/null +++ b/projects/bitlayer-btc/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require("../helper/sumTokens"); +const { bitlayerBridge } = require("../helper/bitcoin-book"); + +module.exports = { + bitcoin: { + tvl: sumTokensExport({ owners: bitlayerBridge }) + }, +}; diff --git a/projects/bitmake/index.js b/projects/bitmake/index.js index 2a4781423b91..eaa310102c2b 100644 --- a/projects/bitmake/index.js +++ b/projects/bitmake/index.js @@ -1,13 +1,6 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - // wallet provide by a bitmake team - owners: [ - "3F12ncAyx4VkfpvnS7ZxdpggFx4p9RKfVe", - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.bitmake } } module.exports = cexExports(config) module.exports.methodology = 'We are only tracking one BTC wallet. We dont have information regarding other wallets' \ No newline at end of file diff --git a/projects/bitmap-game/index.js b/projects/bitmap-game/index.js new file mode 100644 index 000000000000..ef3e0d1897b7 --- /dev/null +++ b/projects/bitmap-game/index.js @@ -0,0 +1,12 @@ +const { staking } = require('../helper/staking') +const STAKE_MERL_CONTRACT = '0xb311c4b8091aff30Bb928b17Cc59Ce5D8775b13A' +const MERL_TOKEN = '0x5c46bFF4B38dc1EAE09C5BAc65872a1D8bc87378' +const STAKE_BITMAP_TOKEN_CONTRACT = '0x8567bD39b8870990a2cA14Df3102a00A7d72f7E3' +const BITMAP_TOKEN = '0x7b0400231Cddf8a7ACa78D8c0483890cd0c6fFD6' + +module.exports = { + merlin: { + tvl: staking([STAKE_BITMAP_TOKEN_CONTRACT, STAKE_MERL_CONTRACT,], MERL_TOKEN), + staking: staking([STAKE_BITMAP_TOKEN_CONTRACT, STAKE_MERL_CONTRACT,], BITMAP_TOKEN,), + } +} \ No newline at end of file diff --git a/projects/bitmark/index.js b/projects/bitmark/index.js index d6d4c6129d7a..c2bae74bae15 100644 --- a/projects/bitmark/index.js +++ b/projects/bitmark/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') // https://support.bitmart.com/hc/en-us/articles/18473693031451-Enhancing-Transparency-and-Trust-at-BitMart const owners = [ @@ -18,7 +19,10 @@ const config = { owners: ['CgANddXc7FKSsdLSdFv67X8faZqQaRTeLMXkAVANkZD4'] }, bitcoin: { - owners: ['37RJkdkzPXCMYSTq74berJYj9FmNn7wFP5'] + owners: bitcoinAddressBook.bitmark + }, + starknet: { + owners: ['0x04de639e634c071c3ce8b1c69fac0500aab5ddb25a08fd0f757176243e4c0467'] }, } diff --git a/projects/bitmex/index.js b/projects/bitmex/index.js index 01756dad6cd0..949a8ea55ead 100644 --- a/projects/bitmex/index.js +++ b/projects/bitmex/index.js @@ -1,15 +1,13 @@ const { cexExports } = require('../helper/cex') -const bitcoinOwners = require('./bitcoin.json') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { + bitcoin: { owners: bitcoinAddressBook.bitmex }, ethereum: { owners: [ '0xEEA81C4416d71CeF071224611359F6F99A4c4294', // Etherscan Label (seems cold) '0xfb8131c260749c7835a08ccbdb64728de432858e' // Etherscan Label (seems hot) ], - }, - bitcoin: { - owners: bitcoinOwners, } } diff --git a/projects/bitparty/index.js b/projects/bitparty/index.js index c5a0a6e70a87..5e08782687f1 100644 --- a/projects/bitparty/index.js +++ b/projects/bitparty/index.js @@ -9,8 +9,8 @@ module.exports = { nullAddress, ADDRESSES.btr.ETH, '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2', - '0x9827431e8b77e87c9894bd50b055d6be56be0030', - '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F', + '0xf8c374ce88a3be3d374e8888349c7768b607c755', + ADDRESSES.btr.WBTC, '0x07373d112edc4570b46996ad1187bc4ac9fb5ed0', '0x2729868df87d062020e4a4867ff507fb52ee697c', '0x68879ca2af24941fc3b6eb89fdb26a98aa001fc1', diff --git a/projects/bitsmiley-io/index.js b/projects/bitsmiley-io/index.js index 462e12db1b00..086d6c57cbcc 100644 --- a/projects/bitsmiley-io/index.js +++ b/projects/bitsmiley-io/index.js @@ -1,10 +1,11 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2, } = require('../helper/unwrapLPs') async function tvl(api) { return sumTokens2({ owners: [ '0x37fc73b4dda9f7263926590838e32e05e4e051e9', - ], tokens: ['0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f', '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2'], api, }) //wbtc and usdt + ], tokens: [ADDRESSES.btr.WBTC, '0xfe9f969faf8ad72a83b761138bf25de87eff9dd2'], api, }) //wbtc and usdt } module.exports = { diff --git a/projects/bitstable-finance/index.js b/projects/bitstable-finance/index.js index 39f2780ef949..596f5d3d4299 100644 --- a/projects/bitstable-finance/index.js +++ b/projects/bitstable-finance/index.js @@ -2,32 +2,46 @@ const ADDRESS = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/sumTokens"); const sdk = require('@defillama/sdk') const { sumTokensExport: sumBRC20TokensExport } = require("../helper/chain/brc20"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + + +const BB_STAKE_CONTRACT = '0x8816353DA8A4D45E81C509A54AdbA8E57908958f' +const BB_STAKE_ABI = 'function totalStakedAmount() view returns (uint256)' const owner = "0x103dd1184599c7511a3016E0a383E11F84AE7173"; const tokens = { ethereum: [ADDRESS.ethereum.USDT], bsc: [ADDRESS.ethereum.FDUSD], + bouncebit: [ADDRESS.bouncebit.BBUSD] }; +const bbInBouncebitStaking = async (api) => { + const staked = await api.call({ target: BB_STAKE_CONTRACT, abi: BB_STAKE_ABI }) + api.addCGToken('bouncebit', staked/1e18) +} + module.exports = { methodology: "Staking tokens via BitStable counts as TVL", bitcoin: { tvl: sdk.util.sumChainTvls([ // Native(BTC) - sumTokensExport({ owners: ["bc1p36wvtxursam9cq8zmc9ppvsqf9ulefm7grvlfc4tzc5j83rcggsqh6nxw5"] }), + sumTokensExport({ owner: bitcoinAddressBook.bitstable[0] }), // BRC20 sumBRC20TokensExport({ // Deposit Address - owners: ["bc1p0uw83vg0h32v7kypyvjn9nextku2h7axjdeefy2ewstevnqffaksjzhrdf"], + owner: bitcoinAddressBook.bitstable[1], blacklistedTokens: ["BSSB", "DAII"], }), ]), staking: sumBRC20TokensExport({ // Farm Address - owners: ["bc1pvngqf24g3hhr5s4ptv472prz576uye8qmagy880ydq5gzpd30pdqtua3rd"], + owner: bitcoinAddressBook.bitstable[2], blacklistedTokens: ["DAII"], }), }, + bouncebit: { + staking: bbInBouncebitStaking, + }, }; Object.keys(tokens).map((chain) => { diff --git a/projects/bitstamp/index.js b/projects/bitstamp/index.js index 16863b9a6eae..946b9467bb0f 100644 --- a/projects/bitstamp/index.js +++ b/projects/bitstamp/index.js @@ -1,163 +1,84 @@ -const { cexExports } = require('../helper/cex') +const sdk = require('@defillama/sdk') +const { cexExports } = require("../helper/cex") +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') const config = { - ethereum: { + ripple: { owners: [ - '0x896dfee1afeb6336e86911bd5a341c1264e5611a', - '0x48ec5560bfd59b95859965cce48cc244cfdf6b0c', - '0x16a798dbd8fa626143bb4f06fa4724d4145d4e6e', - '0x379825f8da776b573a63404a5c499c8a379a131f', - '0x6130611f7a65deb930bd0c0825af88078fcced43', - '0xcddf488f1c826160ee832d4f1492f00cf8557ff6', - '0x593aebee9117eea447279e5973f64c68d8e977a0', - '0x6778c14331251bbbee71414eda389dcef4bd81b8', - '0x772396dd44ce3d347838bfec437cb32f534963f2', - '0xab09b0c5c112999bee4f45e323c4ad2b59638603', - '0xd4fcc07a8da7d55599167991d4ab47f976d0a306', - '0xd46914c273443505563d346f98d41f6a40dff36c', - '0x182e1259ef6ee45dc811132ef4ba5871f1536822', - '0x6dca94b6173c28a4900ea257121e6002c0b96968', - '0xfbb23038fe6cfa16aa898d7dbca7c3269bdaf258', - '0x518b82370bc31ebb96922ec257d92517d7387615', - '0x4c0907f7ad337635a7fd414a0c7a938e0d64bf4d', - '0xab7bb7959332888e44d795c6f28ee876a8469eaa', - '0x858c83a0c97a3a710fd3b9167a0248d76d3b036f', - '0xee7c0bf91f9ac8117b490c8e028714acbcb41364', - '0x31c84a968736fcfe02a9ba274e0fa515a4a6659c', - '0xee9fb7a615cb76b46d26be6ebc9114a627a81c5b', - '0x1522900b6dafac587d499a862861c0869be6e428', - '0xb8e73ba7c6c0b50a0cd94fe9f6622762b0401c02', - '0x4c766def136f59f6494f0969b1355882080cf8e0', - '0xb66410ae75317faf13dba869b6df7b30892d1e46', - '0xde0f7df88678e2aee576a2f3d9b18d4dfad0155c', - '0x964771f6df31eea2d927fa71d7bd78e81bcdce05', - '0xa3fb85c3a2c50d8c0e1dd7fa7746f97c9e1d9591', - '0x333c100ae1a2743a1e55d73913cac6d95deb7f62', - '0xc0ac2f4a3cf22fd504d8835b07f5acccfa9b27f9', - '0x3f3e23249f38d35a4cdaf44edfd99eeb4325b401', - '0x88a4df73aac310484c60c4c0ac4904cab938c20b', - '0xc5b611f502a0dcf6c3188fd494061ae29b2baa4f', - '0x9fec89e34efaa4fc9f19c02f474c71373e6effe7', - '0x7e677cacaae0d465cfd336869f1f575a48bf012a', - '0xe1576685451986e3f93c2fb87cca3aec5b5d45d0', - '0xc20b79cff9d2c89ba8aeb9abf4bfef0314ca7bd2', - '0x059799f2261d37b829c2850cee67b5b975432271', - '0x8366dcab4cc14c826fc9d51bd4c16567bd07b02a', - '0x9a9bed3eb03e386d66f8a29dc67dc29bbb1ccb72', - '0xbcddeba6a9672c1f76a8b8edd3190bdfe6d4ef11', + "rnuDDzvYWTPqXTDVvwE9oLGLgxzV7Rpnpe", + "rafKN5p8iQsRP13LZXXoV8SCw2b9ugvjy1", + "rGNCoeUNqBzQnEiK2X7EYDzSpJ7PtKQSBb", + "rEXmdJZRfjXN3XGVdz99dGSZpQyJqUeirE", + "r3rVXDv8HDUBcrckfda9YsnBkX2E62WLyK", + "rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv", + "rp8Ygdyi2u7DZuMbchpFKBpsgSeg4LXDFQ", + "r3KfqsuMjp85ddhNN2xNAAbmrNKUgFbcpk", + "rG2bzZ2Q9JcpPeCyqXTQts6jHSYsX21G6a", + "rnTdkgZXF9AsEV8crG8KtngiD4nDC8Dkc2", + "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B", + "rHHrmqpzuDSkpcRK2PFm7P5Mo5zf927ina", ], }, - bitcoin: { - owners: [ - "3312eBSkTsjjmKs5sYXdt7mE8H7dHxPEVH", - "3GUWpWqvaovudjG635LUzNXk3Ss1mjcm9M", - "38gEk7LkqdM8xm66i6Wz5TU6cbrhoboQFK", - "3HM4BJM3WGVbG59xp2v276LjEAAkms7EPG", - "3En4rmQMjEaCeCUXWAFNPJh9vFAYDdLTQc", - "3CqawYdjUh59Qj7WGvna5rAGn7ApuSKUgG", - "3HVHcuRXWhrn2dG8r6gPjxTKcjMmaCrNRg", - "3EwyjNGDXeK9tQ2mTS5Xz9Wh7ajyGmunMV", - "39PxrQEhMgDcsvsPhCJ5CBfrXeW9BECxg1", - "3QVD5HvPJLbQhDsDdoDZtW9cwZG3mEFzRN", - "3MF4BwuPuasoK6v4a3iarDgSFVjmXxLG6j", - "39emsnF1cY5djp3kmrdR5H9ghdjDwVwjiP", - "3Ee3Cft7X4DbRzMoBdaKWrCZ4AqriA5sbF", - "338A5vHMB2CMCQfMqYgY8awH5Ho5YbNShs", - "35MynuEPTZJd8Y7QhEsUiKKt18TrF9UgJQ", - "33t9PxtMC3yUpT5gvjVaA4PDwaMT8xCbpu", - "bc1q532e9kept2a8sgdkj3p2xy9l5pdlrv76skpphadq3xr2lk9wrllqgxqygw", - "bc1qajtynuexync79hveple9s7r83rsk49gq858ktdchjaze4853dtksy38uux", - "bc1q2wx2hpjn036mu6qg2zwsqrm0g8h9gtm4egj4cymjtvyaapsz09usep66v9", - "bc1qgc446er7nn9t92hnk5untxg2ad4hvxaanpvwmrexy8caykjzj7ws9hqjmr", - "3JuPfeK7N4hTgXp3ULx6a4zr5fFwoBmdFU", - "32jWyMp8CfoFfQ6QRfXGi7hQJ6d1YfPykB", - "bc1qhex599hljc4zx67zuh0yqk9r7npkqhwld0af6urx7mv58ykx2vgq0z5sta", - "bc1qyfcls8kletachlsg54zvqujvnvvr76lkezqe43kf63p5yc0hnx5sq42q6k", - "3Hi5VHVgmYZYfAPc9aNvQoNXyEv5rYvJQN", - "bc1q3lgd3ggp2fvr27aat6kat00yawhqley5wpl4fytc3f6cyfyz98nsave8sw", - "bc1qkg6x25h8w0060k2dkzq57ltyfm4yahm9uwz6rda8efep9fe38h2qekh58h", - "bc1qwj7zwn3p4y8grutk9zxxn09vm0cs9g0mledte5kqxsm43w08u6pqp8p82q", - "bc1q3anumarec8zlzs7nt4waljuhg2ueel6m0z5s3v7vg6cnfu66m83spupgm6", - "bc1qckj933afq7ultlp4nrqhqk3shkaxt6j8y39htyn0umglr233m6wqfv7ay8", - "bc1qhusm86yqagqczep0dfmge53q3rehn0rzw5qeqwr0gtyw5p2sdkyspgu2me", - "bc1qzdyl7pr0nuqka4lzgkj58ukk0crp8qflgjseumj55nm8c0027v7q99jmhv", - "bc1qrl2cxsmm4aqgtkyxs25thvcc0p0wvujp8gkjuw228g43w7ccz26q7a37ys", - "bc1qaj2ew0aerhf9ggd3rw3xjn79f49w0dadxk4vg083adzzvpmuhp4scadxsu", - "bc1qqrgs3laxzxrkpzvqgmca6njpmxsjjta3vlvlngz8kdz78g8d9e4sa8l3l8", - "bc1qejhwz50y9fnrqfu8dmy9jtv4k3k4yphpnegv06utvqek6u4jfv3qhr9ts5", - "3Jowo3hYr1oqv7J7osUu4eW88owPZScgFk", - "bc1qjzwquwh3psueazgs43u4m2s56gernmuxl95964vl20nee2fn27cq5r4fhg", - "bc1qa9v2dxhxsj75mcczwlssparhhnzcmkudg3tswtdcfrr0eussva9qxwzpdl", - "bc1qdvzxxwmcc2th8f9x0vj6jw8xz7sqkjp994z6vd6mapy48uce0xfsu2qdxz", - "3Jc5hrY64F1C9rfrXJrrKR73bhGj3Um3Eq", - "3KDH9yEKVksjSTj13PpnrhrfSpqwFWzNVB", - "367TJA4M2DE37ZLuv48ujTxVa7ESqa2pUF", - "3CC4qT3fTW9deeTQqXBQH273YMcRWrHBje", - "36NSBe6tr6rAYnKrj5tHnTGNLUdJ7wFd7q", - "3L5TXDJvpn8ZuVMxRNqsxXod68eLgnQcJv", - "3MiAhu93R5PNLbsSDDa8Mx9bzJ1p5h8mJV", - "3Q4Boc44ZzUVeDSv7Kst4iADM6jETrk7RV", - "33fyemB54JUv9DGXzFCdGM37vDJ3eXnrce", - "bc1q926pgy6v9l9fqck759js2k557fxn8xxpj8rz070m70c0q5g8nqcqx70wjp", - "3F4ceyGSFiN2pep4pjqXEHnZNHcvzh3W9y", - "bc1qrxtqv6ym455etlvx86c98qk7ujherxgcycpwxjqyxacalztalslqhtd8hw", - "bc1qlyvp6l3t47qqszngk8kyele2up4rf8t9g4jsmy8g9y48xhhuxvrs0eflt6", - "bc1qgrzeldvkp9n6yrq9ess9rxv7kcczdh9ta93llnh7tgxr5542seus2q36jy", - "bc1q3lyjsr6e0krj6dp3cf9agehge5nak77d70r4seuyea2hjzwkkm4svht4gs", - "bc1quhatrr4tjpzr0wtsem6fwwwrxztmdlv60ldja6arz6hlr97fpuzs3lawcs", - "bc1qujz8nfqnencmfdm3nkj0ctu20tvh8lgwr8lxpayy0zh4gf4lzkjsd60kdv", - "bc1qmzv8qjzyyvvhcunpt7kwg79la3h3pkukn9xynvpk89ju7rjl2vvs5jsz0a", - "3E9wB5NTXtuYWxk8gXmoa9Jvb6XF8CGnkf", - "3LkVkaoLQGnnhNofgcNd6c7ufZ8FHheGx6" - ] - }, - ripple: { - owners: [ - 'rnuDDzvYWTPqXTDVvwE9oLGLgxzV7Rpnpe', - 'rafKN5p8iQsRP13LZXXoV8SCw2b9ugvjy1', - 'rGNCoeUNqBzQnEiK2X7EYDzSpJ7PtKQSBb', - 'rEXmdJZRfjXN3XGVdz99dGSZpQyJqUeirE', - 'r3rVXDv8HDUBcrckfda9YsnBkX2E62WLyK', - 'rDsbeomae4FXwgQTJp9Rs64Qg9vDiTCdBv', - 'rp8Ygdyi2u7DZuMbchpFKBpsgSeg4LXDFQ', - 'r3KfqsuMjp85ddhNN2xNAAbmrNKUgFbcpk', - 'rG2bzZ2Q9JcpPeCyqXTQts6jHSYsX21G6a', - 'rnTdkgZXF9AsEV8crG8KtngiD4nDC8Dkc2', - 'rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B', - 'rHHrmqpzuDSkpcRK2PFm7P5Mo5zf927ina' - ] - }, - solana: { - owners: [ - 'E1EfU3iKUS16mB2vdgj6mi3ssV32dm2Pxh7W74XxKuYu', - 'i57ExrKB2i4mSgjSuq2xz617mQXmu33WG2WEYypmdvX', - 'HBxZShcE86UMmF93KUM8eWJKqeEXi5cqWCLYLMMhqMYm', - 'ETZY5TjMKdV2KdHVmUNTN56pWhMc8TyjrXtQ7YexDCmG' - ] -}, -avax: { - owners: [ - '0xa3fb85c3a2c50d8c0e1dd7fa7746f97c9e1d9591', - '0xc0ac2f4a3cf22fd504d8835b07f5acccfa9b27f9', - '0x3f3e23249f38d35a4cdaf44edfd99eeb4325b401', - ] -}, -cardano: { - owners: [ - 'addr1q9w7x0secwr3uz397nl3zw4wc7w9su22rlc7v54p5q425xjauvlpnsu8rc9zta8lzya2a3uutpc558l3uef2rgp24gdqhcgfgs', - 'addr1q9frvl4a0wgmk4e28gu4asyqrd6ezd3wn3e2wdq4h3hn73zjxelt67u3hdtj5w3etmqgqxm4jymza8rj5u6pt0r08azq3pf2u9', - 'addr1qysvm626pgxcwgy2w7fk2ulmw0mc6v3twzes3arns64hk5eqeh545zsdsusg5aunv4elkulh35ezku9npr688p4t0dfsw7ur3u' - ] -}, -near: { - owners: [ - '992e069ce45717059abba021058759968fb0f61f048c09ac95b7a68a70b65ab1', - '7206287337fd1c74c3df9a04cecd8471a0ba8de3eb63bba3a1e49778f8538899', - '0df4207b35f21783f743f10b82dac228c9f11339aa1bc359f568b52efb6c46df', - '5362a3510eaf41f139d760ec375a425b95d4f86fe596f8d5e29351481a0a4941', - '452b94b0072819f60c0d757f6927155f12d6376409b0e6eac42d04946cd4c6eb', - ] -} +}; + +const chains = [ + 'bitcoin', 'litecoin', 'ripple', + 'ethereum', 'avax', 'solana', 'sui', 'xdc', 'near', 'cardano', 'algorand', +] + +chains.forEach(chain => { + module.exports[chain] = { + tvl: async (...args) => { + const data = await getAllData() + const tvlFunc = cexExports({ [chain]: data[chain] })[chain].tvl + return tvlFunc(...args) + } + } +}) + +let _allData + +function getAllData() { + if (!_allData) + _allData = _getAllData() + + return _allData + + function _getAllData() { + return getConfig('bitstamp', undefined, { + fetcher: async () => { + let page = 1 + let hasMorePages = true + let lastItem + const walletChainMapping = {} + do { + sdk.log('fetching page', page) + const data = await get('https://www.bitstamp.net/api/v2/wallet_transparency/?perPage=1000&page=' + page) + const allWallets = Object.values(data.wallets).flat() + const currentLastItem = allWallets[allWallets.length - 1] + + allWallets.forEach(({ address, network }) => { + if (!walletChainMapping[network]) + walletChainMapping[network] = {} + walletChainMapping[network][address] = true + }) + + page++ + hasMorePages = !lastItem || currentLastItem.address !== lastItem.address + lastItem = currentLastItem + } while (hasMorePages) + + Object.entries(walletChainMapping).forEach(([chain, wallets]) => { + walletChainMapping[chain] = { owners: Object.keys(wallets) } + }) + + walletChainMapping.avax = walletChainMapping['avalanche-c-chain'] + walletChainMapping.xdc = walletChainMapping['xdc-network'] + walletChainMapping.ripple = config.ripple + return walletChainMapping + } + }) + } } -module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/bitunix-cex/index.js b/projects/bitunix-cex/index.js new file mode 100644 index 000000000000..e44bc0f87fa5 --- /dev/null +++ b/projects/bitunix-cex/index.js @@ -0,0 +1,42 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + ethereum: { + owners: [ + "0x76B0aB5067B3be922ef4698390Ca8bd5812A5080" + ], + }, + bitcoin: { + owners: bitcoinAddressBook.bitunixCex, + }, + tron: { + owners: [ + "TJwMqVoy8kAtrC1GLqRuoDqPYCsbaxZzw4", + "TA2EWrSzZHsDBn3d8j4m9f2nbHds2cSNYb", + "TNuHnKVFW3kahz3Xe6EyHJiTm9GBtg2aGD", + "TMiru9N4RffN3e7oT1HGk8cN6WizmL4ijP", + "TDpDGvfxtEdq7EHyHThYtSuL9tAEZSnjv7", + "TPssYpQm3tFzQNvCSVkeTrx4cFft43Ln2J", + "TDzTcjvucTPgZqaVjTct65AyFxP7DnLEjY", + "TE9oPgFeo3qz3152e2GNfKEdEs3UF42jTF", + "TYVAHVXixkL2dnaPfyjZz6J7hF6J4WW3Qx", + "TCxBM3QPZCebzCuXtzzBA7Vet5mCcruHdN", + "TLnMjGrgWTZLadqNRzbQPTzDPWbH6Dc1HA", + "TRcvGsNpzkm8LdhLYmqBWESRrTUv7BPQ8t", + "TWJ6R2EbFC5KdZFwLNj9GDiENn7WyAUjQE", + 'TJqCunxn9xYtnXtP8v5t54W7uR2huUbFvS', + 'THY84dJ4EPsPddwJP2URsqkDzHwVB9uk48', + 'TQTn7XQmZ9p2jToTV2rPbrVLZSftaZjK9y', + 'TLvpkJy9cn695PZLU2fEKYbfVDDpUymZvR', + 'TGmri3M7L5bhMVZdEViUX9tdARpJ4ANdNb', + 'TQTgNHaHLPEcCsvfFciriXLvQDktWNQ7yM', + 'TVaRQRPJh3MT3AfGLVZuaTdJL8nd176tpB', + 'TXP66hCnRzRP4ZNbQcNSWcBV4C5JnHK51F', + 'TP5UzNzk4tL2Jo6twHavUM9s9NjUPSgrvN', + 'TJRkfdgdQTSTmfQQzFy8RR6o73eLCEorSH' + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/bitvenus/index.js b/projects/bitvenus/index.js index b4c04f821547..43cc471a90c6 100644 --- a/projects/bitvenus/index.js +++ b/projects/bitvenus/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -15,14 +16,7 @@ const config = { ], }, bitcoin: { - owners: [ - // '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', - // '358pjjkYRG8exw2BKZnn7Q9s6SCb7wZEWN', - // '3C1ykoWkHBMZwmY8PUUMVxtJJSBkZBCtN8', - 'bc1qrm2a7u9xyeffvulm6e589qvesmt0v0rjxqfkhv', - 'bc1qvht34dma2uy23l9j862nnqr38a42kjr66e6lec' - - ] + owners: bitcoinAddressBook.bitvenus }, bsc: { owners: [ diff --git a/projects/blasterswap-vaults/index.js b/projects/blasterswap-vaults/index.js index 8bde49169e06..80d01bcd8ee4 100644 --- a/projects/blasterswap-vaults/index.js +++ b/projects/blasterswap-vaults/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking.js"); const vaults = ['0xC52fb7E613e401a0195C2fdB369618580D58C91D', '0x013249266842e078999088807033D80531A84260']; @@ -5,7 +6,7 @@ const tokens = ['0xd43D8aDAC6A4C7d9Aeece7c3151FcA8f23752cf8', '0x5ffd9EbD27f2fcA module.exports = { blast: { - tvl: staking('0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', '0xb1a5700fa2358173fe465e6ea4ff52e36e88e2ad'), + tvl: staking('0x0464a36beCf9967111D2dCAb57CAf4a2376f6E3F', ADDRESSES.blast.BLAST), staking: staking(vaults, tokens) }, } diff --git a/projects/blastfutures/index.js b/projects/blastfutures/index.js index 291de1720549..08bda7642f66 100644 --- a/projects/blastfutures/index.js +++ b/projects/blastfutures/index.js @@ -4,7 +4,8 @@ const { staking } = require('../helper/staking') module.exports = { blast: { - tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), - staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'), + // tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), + // staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'), + tvl: () => ({}) // moved to rabbitx }, } diff --git a/projects/blastup/index.js b/projects/blastup/index.js index a44fce37bd9e..916a4b5be3cb 100644 --- a/projects/blastup/index.js +++ b/projects/blastup/index.js @@ -1,10 +1,25 @@ -const { staking } = require("../helper/staking") -const stakingpool = "0x0E84461a00C661A18e00Cab8888d146FDe10Da8D" +const { staking } = require("../helper/staking"); +const ADDRESSES = require("../helper/coreAssets.json"); -const ADDRESSES = require("../helper/coreAssets.json") +const stakingpool = "0x0E84461a00C661A18e00Cab8888d146FDe10Da8D"; + +const blastup = "0x59c159e5a4f4d1c86f7abdc94b7907b7473477f6"; +const lockedBlastup = "0xf8a5d147a3a3416ab151758d969eff15c27ab743"; +const stakingContracts = [ + "0x115ebda9489cf250ff0e8ea9f473c96c222a874c", // LockedBlastUPStaking 6% + "0x2e36e05e7ecd36164ada93752a9a82c1efaa9582", // LockedBlastUPStaking 12% + "0xf399110e921d25dd1ad6a0eef020991df3dd0cd3", // LockedBlastUPStaking 18% + "0xb0d7902685a4f4d916a21a0ed721298d590cd9cd", // BlastUPStaking 6% + "0x520bf8e72f9e808102eb421fb03764624d1984e9", // BlastUPStaking 12% + "0xc3524c6fdce9e60c1a1ddce54953973264097542", // BlastUPStaking 18% +] module.exports = { blast: { - tvl: staking(stakingpool, [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]), + tvl: staking([stakingpool], [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]), + staking: staking(stakingContracts, [blastup, lockedBlastup]), }, -} + hallmarks: [ + [1717575654, "IDO Farming Launch"], + ], +} \ No newline at end of file diff --git a/projects/blend-finance/index.js b/projects/blend-finance/index.js new file mode 100644 index 000000000000..0119682aa18b --- /dev/null +++ b/projects/blend-finance/index.js @@ -0,0 +1,12 @@ + +const { aaveExports } = require('../helper/aave') +const methodologies = require('../helper/methodologies') + +module.exports = { + methodology: methodologies.lendingMarket, + bevm: aaveExports('bevm', '0x26fb0b1eef8822f8F71a385d2839b6a654cA186a', undefined, ['0x3Eb2Dd6c395B8E6E3ab843858480aC60e9D0f3Bc'], { + v3: true, abis: { + getAllATokens: "function getAllBTokens() view returns (tuple(string symbol, address tokenAddress)[])", + } + }), +} \ No newline at end of file diff --git a/projects/blend-pools/api.js b/projects/blend-pools/api.js index fa85d3cb59fa..bac0cd1ba0bb 100644 --- a/projects/blend-pools/api.js +++ b/projects/blend-pools/api.js @@ -15,12 +15,12 @@ const network = { 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 + // bRate and dRate have 9 decimals + const supply = Number(data.bSupply) * Number(data.bRate) / 1e9; + const borrowed = Number(data.dSupply) * Number(data.dRate) / 1e9 + if (isBorrowed) + return borrowed + return supply - borrowed } @@ -39,9 +39,9 @@ async function addPoolTVL(poolId, api, isBorrowed = false) { async function tvl(api) { let backstop = await BackstopConfig.load(network, BACKSTOP_ID); - for (const pool of backstop.rewardZone) + for (const pool of backstop.rewardZone){ await addPoolTVL(pool, api); - +} return sumTokens2({ api }) } diff --git a/projects/blindex/index.js b/projects/blindex/index.js index 05b6979a8b3e..5349e7138ee0 100644 --- a/projects/blindex/index.js +++ b/projects/blindex/index.js @@ -1,5 +1,12 @@ const sdk = require("@defillama/sdk"); -const abi = require("../helper/abis/blindex.json"); +const abi = { + "bdstable_pools_array": "function bdstable_pools_array(uint256) view returns (address)", + "getBdStablesPoolsLength": "uint256:getBdStablesPoolsLength", + "getBDStablePoolCollateral": "address:collateral_token", + "getBDStable": "function bdstables(uint256) view returns (address)", + "getBdStablesLength": "uint256:getBdStablesLength", + "getBDXPriceUsdD12": "uint256:BDX_price_d12" +} const { getUniTVL, } = require("../helper/unknownTokens"); const chains = { diff --git a/projects/blockng/index.js b/projects/blockng/index.js index 376ce4cc57cb..73e8bc69c01a 100644 --- a/projects/blockng/index.js +++ b/projects/blockng/index.js @@ -2,7 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumUnknownTokens, getUniTVL, sumTokensExport } = require('../helper/unknownTokens'); const { staking, } = require('../helper/staking') const sdk = require('@defillama/sdk') -const blockng = require('../helper/abis/blockng.json'); +const blockng = { + "getPoolInfo": "function getPoolInfo(address, address, uint256, uint256) view returns (tuple(address lpTokenAddress, address subTokenAddress, string subTokenSymbol, address dexFactory, address gaugeAddress, uint256 gaugeTotalSupply, uint256 lpPrice, uint256 gaugeAPR, address bribeAddress, int256 weights, uint256 punkId)[] beams)", + "numberOfPool": "function numberOfPool(address voter) view returns (uint256 len)" +} const chain = 'smartbch' const WBCH = ADDRESSES.smartbch.WBCH diff --git a/projects/blofin-cex/index.js b/projects/blofin-cex/index.js new file mode 100644 index 000000000000..cea48485cf27 --- /dev/null +++ b/projects/blofin-cex/index.js @@ -0,0 +1,50 @@ +const { cexExports } = require("../helper/cex"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + bitcoin: { + owners: bitcoinAddressBook.blofinCex, + }, + bsc: { + owners: ["0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040"], + }, + ethereum: { + owners: [ + "0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040", + "0xe5e6c3ced4670697b7cB27a53649a3ED321c18ee", + "0xdBdf80D997cFAaAC6150cD0cEC2C127fDaD7A823", + "0x88C984990573d385949deB571ed21eaD63301045", + "0xD775Ad8d9B9130B5D609Dc065BD548E46A6610b6" + ], + }, + solana: { + owners: [ + "94xmX5J92nZLanLvRstmxhgiS8kN8SVfFQ2zPKYB3Ynb", + "E3Gd8Hd1yKdkHTQnbenNVBgV2p1MrrenQnVU4SkJD4zx", + "3oWiTmU5QpTbSuTCVULybWsXc3DVxixdABxJPerLgTai" + ], + }, + optimism: { + owners: ["0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040"], + }, + arbitrum: { + owners: ["0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040"], + }, + tron: { + owners: [ + "TDFHcjw2PiDLjoqxXedaSSEtA1osqu8J6c", + "TE4uQTkFMcjm7UVYeQCgTHuec1pFP5J4Ds", + "TRzpEdrAwHXPQYWvXHJArpcac2WV3gXMr3", + "TVNRJgNsVMjDPethVVToz9aSvZq9SVgDXv", + "THTGgHWFXwgaZEDdaQmR6iuUEa7NKfCUtH" + ], + }, + polygon: { + owners: ["0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040"], + }, + base: { + owners: ["0x1cA5aa5b1dd8D948bB0971A5fB1762FE172E0040"], + }, +}; + +module.exports = cexExports(config); diff --git a/projects/bluemeteor/index.js b/projects/bluemeteor/index.js index caec2d3a8f63..567eeb03f200 100644 --- a/projects/bluemeteor/index.js +++ b/projects/bluemeteor/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - pulse: { tvl: getUniTVL({ factory: '0x2c68d8942fD4B5eC45a671fA230fb3dEBF224176', useDefaultCoreAssets: true, fetchBalances: true, }), }, + pulse: { tvl: getUniTVL({ factory: '0x2c68d8942fD4B5eC45a671fA230fb3dEBF224176', useDefaultCoreAssets: true, }), }, } \ No newline at end of file diff --git a/projects/blur-finance/index.js b/projects/blur-finance/index.js index b89430a0111d..4aaf7040a2fa 100644 --- a/projects/blur-finance/index.js +++ b/projects/blur-finance/index.js @@ -5,4 +5,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2022-08-10')/1e3), 'Rug pull'], ], + deadFrom: Math.floor(new Date('2022-08-10')/1e3) } \ No newline at end of file diff --git a/projects/bnpl-pay/index.js b/projects/bnpl-pay/index.js index 00f78c909d21..257633231792 100644 --- a/projects/bnpl-pay/index.js +++ b/projects/bnpl-pay/index.js @@ -1,94 +1,29 @@ -const sdk = require('@defillama/sdk') -const { getParamCalls, getUniqueAddresses } = require('../helper/utils') +const { getUniqueAddresses } = require('../helper/utils') const { sumTokens2 } = require('../helper/unwrapLPs') -const chain = 'ethereum' const BNPL_FACTORY = '0x7edB0c8b428b97eA1Ca44ea9FCdA0835FBD88029' -let nodes = {} -async function getNodes(block) { - if (!nodes[block]) nodes[block] = _getNodes(block) - return nodes[block] -} -async function _getNodes(block) { - const { output: nodeCount } = await sdk.api.abi.call({ - target: BNPL_FACTORY, - abi: abi.bankingNodeCount, - chain, block, - }) +async function tvl(api) { + const nodes = await api.fetchList({ lengthAbi: abi.bankingNodeCount, itemAbi: abi.bankingNodesList, target: BNPL_FACTORY }) - const nodeCalls = getParamCalls(nodeCount) - const { output: res } = await sdk.api.abi.multiCall({ - target: BNPL_FACTORY, - abi: abi.bankingNodesList, - calls: nodeCalls, - chain, block, - }) - - const nodes = res.map(i => i.output.toLowerCase()) - const baseTokenCalls = nodes.map(i => ({ target: i })) - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.baseToken, - calls: baseTokenCalls, - chain, block, - }) - const baseTokenMapping = {} - tokens.forEach(({ input: { target }, output }) => baseTokenMapping[target] = output) - return { nodes, baseTokenMapping } -} - -async function tvl(_, block) { - const { nodes, baseTokenMapping, } = await getNodes(block) const tokens = getUniqueAddresses([ - // ...Object.keys(baseTokenMapping), '0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811', // aave USDT '0xBcca60bB61934080951369a648Fb03DF4F96263C', // aave USDC ]) - return sumTokens2({ chain, block, owners: nodes, tokens, }) + return sumTokens2({ api, owners: nodes, tokens, }) } -async function staking(_, block) { - const { nodes } = await getNodes(block) +async function staking(api) { + const nodes = await api.fetchList({ lengthAbi: abi.bankingNodeCount, itemAbi: abi.bankingNodesList, target: BNPL_FACTORY }) + return sumTokens2({ - chain, block, owners: nodes, tokens: [ + api, owners: nodes, tokens: [ '0x84d821f7fbdd595c4c4a50842913e6b1e07d7a53', // BNPL ] }) } -async function borrowed(_, block) { - const { nodes, baseTokenMapping, } = await getNodes(block) - const balances = {} - const loanCountCalls = nodes.map(i => ({ target: i })) - const { output: loanCounts } = await sdk.api.abi.multiCall({ - abi: abi.getCurrentLoansCount, - calls: loanCountCalls, - chain, block, - }) - const loanToIdCalls = [] - loanCounts.forEach(({ input: { target}, output }) => { - const calls = getParamCalls(output) - calls.forEach(i => i.target = target) - loanToIdCalls.push(...calls) - }) - - const { output: loanIds } = await sdk.api.abi.multiCall({ - abi: abi.currentLoans, - calls: loanToIdCalls, - chain, block, - }) - - const idToLoanCalls = loanIds.map(({ input: { target }, output }) => ({ target, params: output })) - const { output: res } = await sdk.api.abi.multiCall({ - abi: abi.idToLoan, - calls: idToLoanCalls, - chain, block, - }) - - res.forEach(({ output, input: { target } }) => { - sdk.util.sumSingleBalance(balances, baseTokenMapping[target], output.principalRemaining) - }) - return balances +async function borrowed(api) { } const abi = { @@ -101,5 +36,8 @@ const abi = { } module.exports = { + deadFrom: '2023-02-12', ethereum: { tvl, staking, borrowed, }, } + +module.exports.ethereum.borrowed = () => ({}) // bad debt diff --git a/projects/bnsol/index.js b/projects/bnsol/index.js new file mode 100644 index 000000000000..cb7ba4d83bc3 --- /dev/null +++ b/projects/bnsol/index.js @@ -0,0 +1,12 @@ +const { getStakedSol } = require("../helper/solana") + +async function tvl(api) { + await getStakedSol('75NPzpxoh8sXGuSENFMREidq6FMzEx4g2AfcBEB6qjCV', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + }, +}; \ No newline at end of file diff --git a/projects/bob-gateway/index.js b/projects/bob-gateway/index.js new file mode 100644 index 000000000000..954e389fcd34 --- /dev/null +++ b/projects/bob-gateway/index.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const factories = { + v1: "0x1831d29376eb94bba3ca855af7984db923768b27", + v2: "0x37f330e667208633e1da1cf601d01f0ef8484306", + v3: "0xAE6770a207E86FaE3b191564FA55ce7Bfee0Dde9", +}; + +const abis = { + v1: { + allOnramps: "function allOnramps() view returns (address[])", + }, + v2: { + allGateways: "function allGateways() view returns (address[])", + }, + v3: { + allGateways: "function allGateways() view returns (address[])", + }, +}; + +module.exports = { + bob: { + tvl: async (api) => { + const gateways = (await api.batchCall([ + { abi: abis.v1.allOnramps, target: factories.v1 }, + { abi: abis.v2.allGateways, target: factories.v2 }, + { abi: abis.v3.allGateways, target: factories.v3 } + ])).flat(); + + return sumTokens2({ + api, + tokens: [ + ADDRESSES.bob.WBTC, + ADDRESSES.bob.TBTC, + ADDRESSES.bob.SolvBTC, + ADDRESSES.bob.SolvBTC_BBN, + ADDRESSES.bob.FBTC, + ADDRESSES.bob.uniBTC, + ADDRESSES.bob.pumpBTC, + ], + owners: gateways, + }); + }, + } +}; + diff --git a/projects/bodhfinance/index.js b/projects/bodhfinance/index.js index f2f06ea70f89..6896d33c98bd 100644 --- a/projects/bodhfinance/index.js +++ b/projects/bodhfinance/index.js @@ -6,9 +6,12 @@ const bETH = "0xe970c37243F3d0B2AeB041b855Ef6466CB140BcA" const unitroller = "0x97b491744587d05ca33e84bB18B61Df9B3986DcE" const { tvl, borrowed } = compoundExports( - unitroller, "boba", bETH, WETH, ); + unitroller, bETH, ); module.exports = { + deadFrom: '2023-04-17', methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", boba: { tvl, borrowed } } + +module.exports.boba.borrowed = () => ({}) // bad debt diff --git a/projects/bombmoney/index.js b/projects/bombmoney/index.js index fcc813abdf7b..b6db5ee98a3e 100644 --- a/projects/bombmoney/index.js +++ b/projects/bombmoney/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const {pool2Exports} = require("../helper/pool2"); +const {pool2} = require("../helper/pool2"); const { staking } = require("../helper/staking"); const token = "0x522348779DCb2911539e76A1042aA922F9C47Ee3"; @@ -16,6 +16,6 @@ module.exports = { bsc: { tvl: async () => ({}), staking: staking(masonry, shares), - pool2: pool2Exports(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) + pool2: pool2(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) } } \ No newline at end of file diff --git a/projects/bonedex/index.js b/projects/bonedex/index.js index 725585ed9de4..71b35aad7492 100644 --- a/projects/bonedex/index.js +++ b/projects/bonedex/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0x907599886DeBF90CCB1e9B446b31D52bDD25926D', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('shibarium', '0x907599886DeBF90CCB1e9B446b31D52bDD25926D') \ No newline at end of file diff --git a/projects/bonk-sol/index.js b/projects/bonk-sol/index.js new file mode 100644 index 000000000000..913d9a817cc6 --- /dev/null +++ b/projects/bonk-sol/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('ArAQfbzsdotoKB5jJcZa3ajQrrPcWr2YQoDAEAiFxJAC', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/bonqdao/index.js b/projects/bonqdao/index.js index 45c4a5624868..8f60657a81a9 100644 --- a/projects/bonqdao/index.js +++ b/projects/bonqdao/index.js @@ -67,6 +67,7 @@ module.exports = { hallmarks: [ [1675252800,"Oracle Hack"] ], + deadFrom: '2023-02-01', methodology: 'Summation of the collateral deposited in BonqDAO Troves (personal lending vaults)', start: 36884903, polygon: { diff --git a/projects/bonzo/index.js b/projects/bonzo/index.js new file mode 100644 index 000000000000..a0262ffd9426 --- /dev/null +++ b/projects/bonzo/index.js @@ -0,0 +1,7 @@ +const { aaveV2Export, methodology } = require("../helper/aave") + +module.exports = { + timetravel: false, + methodology, + hedera: aaveV2Export('0x236897c518996163E7b313aD21D1C9fCC7BA1afc'), +} \ No newline at end of file diff --git a/projects/boomswap/index.js b/projects/boomswap/index.js new file mode 100644 index 000000000000..66b711360dac --- /dev/null +++ b/projects/boomswap/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'bsc': '0xB438dee6a8875AFAbB8a82e86ef56C4DEEe5D1b5' +}) \ No newline at end of file diff --git a/projects/boringdao/index.js b/projects/boringdao/index.js index 8a2556e1d455..4259bd6f1064 100644 --- a/projects/boringdao/index.js +++ b/projects/boringdao/index.js @@ -2,6 +2,8 @@ const { sumTokensExport } = require("../helper/sumTokens") const contracts = require("./contracts.json"); const sdk = require("@defillama/sdk"); const { staking } = require('../helper/staking') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + function chainTvl(chain) { const owners = Object.values(contracts[chain].contracts) @@ -14,7 +16,7 @@ function chainTvl(chain) { module.exports = { timetravel: false, bitcoin: { - tvl: sumTokensExport({ owner: '33ZibwpiZe4bM5pwpAdQNqqs2RthLkpJer'}) + tvl: sumTokensExport({ owners: bitcoinAddressBook.boringdao }) }, litecoin: { tvl: async (_, block) => { diff --git a/projects/bouncebit-premium/index.js b/projects/bouncebit-premium/index.js index fde3876f9dca..afee6eefcb11 100644 --- a/projects/bouncebit-premium/index.js +++ b/projects/bouncebit-premium/index.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens, sumTokensExport } = require('../helper/sumTokens'); const BBTC = '0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC' -const BBUSD = '0x77776b40C3d75cb07ce54dEA4b2Fd1D07F865222' +const BBUSD = ADDRESSES.bouncebit.BBUSD // const stBBTC = '0x7F150c293c97172C75983BD8ac084c187107eA19' const stBBTC_STAKE_ABI = diff --git a/projects/bountive/index.js b/projects/bountive/index.js index 134cab63885a..74d80582d483 100644 --- a/projects/bountive/index.js +++ b/projects/bountive/index.js @@ -4,15 +4,13 @@ const { multiCall } = require('../helper/chain/starknet') const bountiveTokens = [ // BoSTRK: Bountive STRK - "0x05a0fff20829d60a0cdae2da18a32bd3de5c32f8d0109d2a0b59a88a7a77176e", + "0x018e009bbb035c506234e7a8eca6a7229adfd59a278ba3845285d28b03ed6d53", // BoETH: Bountive ETH - "0x00d91e36ff68918b392c9cfc2e3f575526f69e04b97eb28142856fae3611fcf7", + "0x02fcaebd41710024e25b6dc646a62acb6560125a699a3f695b6adb54a180aaee", // BoUSDC: Bountive USDC - "0x04ed6784fa5c11889851c2d13bbd80464e55605a90b5b664f9400df0fd6ef4a5", + "0x028a88bf75f1b10dc8552051a56fbdc732084af514f6065f4c67ea6d50204720", // BoUSDT: Bountive USDT - "0x0753dc6f8fee7487fe3f32728c0f1af9df1f7a3d0443ef507eb79a974697be12", - // BoDAI: Bountive DAI - "0x06e32d47c49efb0243da8d456dc413f1dcf50ceea7be28ef520492eccfff2b43", + "0x0243d9a1cffc0b5ebbf549efd1232a96b1ef392fe595e91dd72103d5a8e7d847", ] const underlyingsTokens = [ @@ -24,8 +22,6 @@ const underlyingsTokens = [ ADDRESSES.starknet.USDC, // USDT ADDRESSES.starknet.USDT, - // DAI - ADDRESSES.starknet.DAI, ] async function tvl(api) { diff --git a/projects/bracket-fi/index.js b/projects/bracket-fi/index.js new file mode 100644 index 000000000000..9581a2b6cc94 --- /dev/null +++ b/projects/bracket-fi/index.js @@ -0,0 +1,34 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") +const ADDRESSES = require('../helper/coreAssets.json') + +const BRACKET_ESCROW_PROXY = '0x9b9d7297C3374DaFA2A609d47C79904e467970Bc' + +const config = { + ethereum: { + tokens: [ + ADDRESSES.ethereum.WSTETH, + ADDRESSES.ethereum.RETH, + "0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7", + "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", + "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", + "0xf1C9acDc66974dFB6dEcB12aA385b9cD01190E38", + "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110", + ] + }, + arbitrum: { + tokens: [ + ADDRESSES.arbitrum.WSTETH, + "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8", + "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", + "0x4186BFC76E2E237523CBC30FD220FE055156b41F", + ADDRESSES.blast.ezETH + ] + }, +} + +Object.keys(config).forEach(chain => { + const { owner = BRACKET_ESCROW_PROXY, tokens, } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owner, tokens }) + } +}) \ No newline at end of file diff --git a/projects/brainiac/index.js b/projects/brainiac/index.js index 5ef9ecfb1452..41fb35a1bec9 100644 --- a/projects/brainiac/index.js +++ b/projects/brainiac/index.js @@ -20,7 +20,7 @@ const BRAINIAC_CKB_LP = '0xaa0f41e50dbfd8247fb397b1fffea1fea9f4e6d4' // params = comptroller , chain , brCKB , CKB module.exports = { - [chain]: compoundExports("0x5c68BDBba7151c486faCB66dc39b891030e46725", chain, "0x352d09567dE5A02415670723D09E006F623fE62e", ADDRESSES.godwoken_v1.pCKB) + [chain]: compoundExports("0x5c68BDBba7151c486faCB66dc39b891030e46725", "0x352d09567dE5A02415670723D09E006F623fE62e", ADDRESSES.godwoken_v1.pCKB) } module.exports[chain].staking = staking({ chain, useDefaultCoreAssets: true, owners: farms, tokens: [BRAINIAC], lps: [BRAINIAC_CKB_LP], }) diff --git a/projects/bridgehela/index.js b/projects/bridgehela/index.js new file mode 100644 index 000000000000..cf3011562d58 --- /dev/null +++ b/projects/bridgehela/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owner:'0x8094816e435b8ca77f2dfe240820c6c6ac784900', tokens: [ADDRESSES.ethereum.USDT,ADDRESSES.ethereum.USDC] }) + }, + bsc: { + tvl: sumTokensExport({ owner:'0x8094816e435b8ca77f2dfe240820c6c6ac784900', tokens: [ADDRESSES.bsc.USDT,ADDRESSES.bsc.USDC] }) + }, + polygon: { + tvl: sumTokensExport({ owner:'0x700d0c48926af78c2c51f08c667f27ce6548386b', tokens: [ADDRESSES.polygon.USDT,ADDRESSES.polygon.USDC] }) + } +} \ No newline at end of file diff --git a/projects/bridgers-ai/index.js b/projects/bridgers-ai/index.js index c5e4cb897bb1..4d6ddf8a6720 100644 --- a/projects/bridgers-ai/index.js +++ b/projects/bridgers-ai/index.js @@ -137,7 +137,7 @@ const tokensConf = { TON: ADDRESSES.ton.TON, USDT: ADDRESSES.ton.USDT, USDC: ADDRESSES.ton.USDC, - NOT: 'EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT', + NOT: ADDRESSES.ton.NOT, }, era: { ETH: nullAddress, diff --git a/projects/bril-finance/index.js b/projects/bril-finance/index.js index faf565b1f2e8..73be3acf3cc8 100644 --- a/projects/bril-finance/index.js +++ b/projects/bril-finance/index.js @@ -25,13 +25,15 @@ Object.keys(config).forEach(chain => { const areStrategiesEnabled = await api.multiCall({ abi: factory_abi.isStrategyEnabled, calls: strategies, target: factory }); const enabledStrategies = strategies.filter((s, index) => areStrategiesEnabled[index]); - const balances = await api.multiCall({ abi: abi.vaultAmounts, calls: enabledStrategies, }); + const balances = await api.multiCall({ abi: abi.vaultAmounts, calls: enabledStrategies, permitFailure: true }); const summaries = await api.multiCall({ abi: abi.vaultSummary, calls: enabledStrategies, permitFailure: true, }); for (let i = 0; i < balances.length; i++) { - if (!summaries[i]) continue; - api.add(summaries[i].baseToken_, balances[i].baseTotal_); - api.add(summaries[i].scarceToken_, balances[i].scarceTotal_); + const balance = balances[i] + const summary = summaries[i] + if (!balance || !summary) continue; + api.add(summary.baseToken_, balance.baseTotal_); + api.add(summary.scarceToken_, balance.scarceTotal_); } } } diff --git a/projects/brinc/index.js b/projects/brinc/index.js index f707a7bd22c0..48c496bcdb28 100644 --- a/projects/brinc/index.js +++ b/projects/brinc/index.js @@ -1,26 +1,16 @@ const ADDRESSES = require('../helper/coreAssets.json') -const {sumTokensAndLPsSharedOwners} = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unwrapLPs') const treasury = "0xB5de3f06aF62D8428a8BF7b4400Ea42aD2E0bc53" -async function tvl(time, ethBlock, chainBlocks){ - const balances = {}; - const transformAddress = i => `arbitrum:${i}` - await sumTokensAndLPsSharedOwners(balances, [ - [ADDRESSES.optimism.DAI, false], //dai - - ], [treasury], chainBlocks.arbitrum, "arbitrum", transformAddress) - return balances -} - -module.exports={ +module.exports = { hallmarks: [ [1639440000, "Brinc hack due to private key compromise"], [1644019200, "Relaunch on Arbitrum"] ], methodology: `DAI reserves in the bonding curve `, - arbitrum:{ - tvl, + arbitrum: { + tvl: sumTokensExport({ owners: [treasury], tokens: [ADDRESSES.optimism.DAI], }), //staking: stakingPricedLP("0xE5Df6583eE8DAe9F532e65D7D2C30A961c442f8a", "0x5fE5E1d5D86BDD4a7D84B4cAfac1E599c180488f", "ethereum", "0xe4f157c7ca54f435fcc3bb0b4452f98d3a48f303", "dai", true ) } } \ No newline at end of file diff --git a/projects/bsquared/index.js b/projects/bsquared/index.js index 9cb2cef416a2..8ce3f7c70f05 100644 --- a/projects/bsquared/index.js +++ b/projects/bsquared/index.js @@ -2,21 +2,7 @@ const sdk = require('@defillama/sdk'); const { sumTokensExport: sumBRC20TokensExport } = require("../helper/chain/brc20"); const { sumTokensExport } = require('../helper/sumTokens'); const ADDRESSES = require('../helper/coreAssets.json') - -const BTCOwners = [ - // pre deposited wallets //Bitcoin Multisig Addresses - "bc1q4fsk5pgnmnu7ngp79xclsw2t0yk46sjqw22ffz", - "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m", //Bitcoin Multisig Addresses - "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs", //Bitcoin Multisig Addresses - //Bitcoin Custodian Addresses - "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg", - "bc1qr4cpjazz6hhjh44yrshqw4xs4e3eld60wnsq2m", - "14UwPgMLZY6rLZRDxxvmNWQ9rMkg2iraHG", - "bc1quetqhxs809mwgms0rhae4cw98chzqe0er8fryr", -]; -const BRC20Owners = [ - "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc", //Bitcoin Multisig Addresses -]; +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const ADDRESSES_ETHEREUM_STONE = '0x7122985656e38BDC0302Db86685bb972b145bD3C'; @@ -27,8 +13,8 @@ module.exports = { methodology: "Staking tokens via BSquared Network Buzz counts as TVL", bitcoin: { tvl: sdk.util.sumChainTvls([ - sumTokensExport({ owners: BTCOwners }), - sumBRC20TokensExport({ owners: BRC20Owners }), + sumTokensExport({ owners: bitcoinAddressBook.bsquaredBTC }), + sumBRC20TokensExport({ owners: bitcoinAddressBook.bsquaredBRC20 }), ]), }, ethereum: { diff --git a/projects/bsx-exchange/index.js b/projects/bsx-exchange/index.js index ce2bab3c6be7..b7cb8e6afddc 100644 --- a/projects/bsx-exchange/index.js +++ b/projects/bsx-exchange/index.js @@ -1,3 +1,5 @@ +const { nullAddress } = require("../helper/tokenMapping") + const config = { base: '0x26a54955a5fb9472d3edfeac9b8e4c0ab5779ed3', } @@ -7,7 +9,8 @@ Object.keys(config).forEach(chain => { module.exports[chain] = { tvl: async (api) => { const tokens = await api.call({ abi: 'address[]:getSupportedTokenList', target: exchange }) - return api.sumTokens({ owner: exchange, tokens }) + tokens.push(nullAddress) + return api.sumTokens({ owner: exchange, tokens, blacklistedTokens: ['0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'] }) } } }) diff --git a/projects/btcst/index.js b/projects/btcst/index.js index 19563fa439cb..492c6f1b23bd 100644 --- a/projects/btcst/index.js +++ b/projects/btcst/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const BTCST = "0x78650B139471520656b9E7aA7A5e9276814a38e9"; @@ -30,29 +29,10 @@ const listOfTokens = [ "0xba2ae424d960c26247dd6c32edc70b295c744c43", ]; -async function bscTvl(chainBlocks) { - const balances = {}; - - const transformAddress = i => `bsc:${i}`; - for (const token of listOfTokens) { - await sumTokensAndLPsSharedOwners( - balances, - [[token, false]], - vaultContracts, - chainBlocks["bsc"], - "bsc", - transformAddress - ); - } - - return balances; -} - module.exports = { - misrepresentedTokens: true, bsc: { staking: stakings(vaultContracts, BTCST), - tvl: bscTvl, + tvl: stakings(vaultContracts, listOfTokens), }, methodology: "Counts liquidty on all the Vaults through their Contracts", }; diff --git a/projects/btse/index.js b/projects/btse/index.js index 08ded778d944..1b1c1a970176 100644 --- a/projects/btse/index.js +++ b/projects/btse/index.js @@ -1,9 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: ['bc1qaxyju6n2x2tednv8e7hgnhnz44vrfcmuhjxpfk'] - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.btse } } module.exports = cexExports(config) diff --git a/projects/bubbleswap-v2/index.js b/projects/bubbleswap-v2/index.js index 2ec1923a3e81..3bd32bcbc81e 100644 --- a/projects/bubbleswap-v2/index.js +++ b/projects/bubbleswap-v2/index.js @@ -3,6 +3,7 @@ module.exports = { hedera: { tvl: () => ({}), }, + deadFrom: '2023-07-01', timetravel: false, methodology: "Data is retrieved from the api at https://api.bubbleswap.io/", hallmarks: [ diff --git a/projects/bucket-protocol/index.js b/projects/bucket-protocol/index.js index 040f879c685a..c4e070763b5a 100644 --- a/projects/bucket-protocol/index.js +++ b/projects/bucket-protocol/index.js @@ -3,10 +3,20 @@ const sui = require("../helper/chain/sui"); const MAINNET_PROTOCOL_ID = "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df"; +// Token +const SUI = ADDRESSES.sui.SUI; const BUCK = ADDRESSES.sui.BUCK; const USDC = ADDRESSES.sui.USDC; const USDT = ADDRESSES.sui.USDT; - +const USDC_CIRCLE= ADDRESSES.sui.USDC_CIRCLE +const SCALLOP_swUSDC = "0xad4d71551d31092230db1fd482008ea42867dbf27b286e9c70a79d2a6191d58d::scallop_wormhole_usdc::SCALLOP_WORMHOLE_USDC" +const SCALLOP_sUSDC = "0x854950aa624b1df59fe64e630b2ba7c550642e9342267a33061d59fb31582da5::scallop_usdc::SCALLOP_USDC" +const SCALLOP_sUSDT = "0xe6e5a012ec20a49a3d1d57bd2b67140b96cd4d3400b9d79e541f7bdbab661f95::scallop_wormhole_usdt::SCALLOP_WORMHOLE_USDT" +const SCALLOP_sSUI = "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI" +const SCALLOP_sSB_ETH = "0xb14f82d8506d139eacef109688d1b71e7236bcce9b2c0ad526abcd6aa5be7de0::scallop_sb_eth::SCALLOP_SB_ETH" +const SCALLOP_sSCA = "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA" +const SPRING_SUI = "0x83556891f4a0f233ce7b05cfe7f957d4020492a34f5405b2cb9377d060bef4bf::spring_sui::SPRING_SUI" +const SCA_ADDRESS = "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA" const AF_LP_IDs = [ "0xe2569ee20149c2909f0f6527c210bc9d97047fe948d34737de5420fab2db7062", "0x885e09419b395fcf5c8ee5e2b7c77e23b590e58ef3d61260b6b4eb44bbcc8c62", @@ -35,6 +45,9 @@ const KRIYA_POOL_IDs = [ const CETUS_LP_ID = "0xb9d46d57d933fabaf9c81f4fc6f54f9c1570d3ef49785c6b7200cad6fe302909"; +const USDC_CIRCLE_PSM = + "0xd22388010d7bdb9f02f14805a279322a3fa3fbde42896b7fb3d1214af404c455"; + const USDC_PSM = "0x0c2e5fbfeb5caa4c2f7c8645ffe9eca7e3c783536efef859be03146b235f9e04"; @@ -68,6 +81,13 @@ const scallop_sUSDC_LP_ID = const scallop_sUSDT_LP_ID = "0x6b68b42cbb4efccd9df30466c21fff3c090279992c005c45154bd1a0d87ac725"; +const scallop_sCircleUSDC_LP_ID = + "0xdf91ef19f6038e662e9c89f111ffe19e808cdfb891d080208d15141932f9513b"; + +const haSUI_Navi_Pond_ID = "0xef1ff1334c1757d8e841035090d34b17b7aa3d491a3cb611319209169617518e" + +const SUI_Navi_Pond_ID = "0xcf887d7201c259496a191348da86b4772a2e2ae3f798ca50d1247194e30b7656"; + async function getStakingLPAmount(id) { const stakingLPObject = await sui.getObject(id); return stakingLPObject.fields.output_volume; @@ -78,6 +98,21 @@ async function getScallopsLPAmount(id) { return stakingLPObject.fields.coin_balance; } +function convertUnderlyingAssets(coin){ + // USDC + if(coin === SCALLOP_swUSDC) return ADDRESSES.sui.USDC + if(coin === SCALLOP_sUSDC) return ADDRESSES.sui.USDC_CIRCLE + // USDT + if(coin === SCALLOP_sUSDT) return ADDRESSES.sui.USDT + // sSUI + if(coin === SCALLOP_sSUI) return ADDRESSES.sui.SUI + // sbETH + if(coin === SCALLOP_sSB_ETH) return ADDRESSES.sui.WETH + // sSCA + if(coin === SCALLOP_sSCA) return SCA_ADDRESS + return coin +} + async function tvl(api) { const protocolFields = await sui.getDynamicFieldObjects({ parent: MAINNET_PROTOCOL_ID, @@ -102,6 +137,9 @@ async function tvl(api) { const cetusLpObj = await sui.getObject(CETUS_LP_ID); const stakedBucketus = cetusLpObj.fields.staked; + const usdcCirclePSMObj = await sui.getObject(USDC_CIRCLE_PSM); + const usdcCirclePSMAmount = usdcCirclePSMObj.fields.pool; + const usdcPSMObj = await sui.getObject(USDC_PSM); const usdcPSMAmount = usdcPSMObj.fields.pool; @@ -126,7 +164,11 @@ async function tvl(api) { for (const bucket of bucketList) { //AF_LP doesn't have price, need to split the tokens if (bucket.type.includes("AF_LP")) continue; - const coin = bucket.type.split("<").pop()?.replace(">", "") ?? ""; + const coin_address = bucket.type.split("<").pop()?.replace(">", "") ?? ""; + + /// Since we're unable to fetch the price of Scallop's sCOIN, we'll regard sCOIN as underlying assets + const coin = convertUnderlyingAssets(coin_address) + api.add(coin, bucket.fields.collateral_vault); } @@ -179,6 +221,7 @@ async function tvl(api) { const halfStakedBucketus = Math.floor(stakedBucketus / 2); api.add(USDC, Math.floor(halfStakedBucketus / 1000)); + api.add(USDC_CIRCLE, Math.floor(usdcCirclePSMAmount)); api.add(USDC, Math.floor(usdcPSMAmount)); api.add(USDT, Math.floor(usdtPSMAmount)); @@ -238,11 +281,26 @@ async function tvl(api) { snaviLPAmount ); + const haSuiNaviPondAmount = await getStakingLPAmount(haSUI_Navi_Pond_ID); + api.add( + "0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d::hasui::HASUI", + haSuiNaviPondAmount + ); + + const suiNaviPondAmount = await getStakingLPAmount(SUI_Navi_Pond_ID); + api.add( + SUI, + suiNaviPondAmount + ); + 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); + + const scallopCircleUSDC_LPAmount = await getScallopsLPAmount(scallop_sCircleUSDC_LP_ID); + api.add(USDC_CIRCLE, scallopCircleUSDC_LPAmount) } module.exports = { diff --git a/projects/buffer/index.js b/projects/buffer/index.js index 0384e3b2d19a..f5195dea68bb 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/bulbaswap-v2/index.js b/projects/bulbaswap-v2/index.js new file mode 100644 index 000000000000..c7df338a40f6 --- /dev/null +++ b/projects/bulbaswap-v2/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'morph': '0x8D2A8b8F7d200d75Bf5F9E84e01F9272f90EFB8b' +}) \ No newline at end of file diff --git a/projects/bulbaswap-v3/index.js b/projects/bulbaswap-v3/index.js new file mode 100644 index 000000000000..c7ac10b8b7ea --- /dev/null +++ b/projects/bulbaswap-v3/index.js @@ -0,0 +1,3 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ morph: { factory: '0xFf8578C2949148A6F19b7958aE86CAAb2779CDDD', fromBlock: 25159, } }) \ No newline at end of file diff --git a/projects/bunicorn/index.js b/projects/bunicorn/index.js index 7ab2ca1e5483..737e953316ed 100644 --- a/projects/bunicorn/index.js +++ b/projects/bunicorn/index.js @@ -18,7 +18,7 @@ module.exports = { allPairsLength: 'uint256:allPoolsLength', allPairs: 'function allPools(uint256) view returns (address)', }, - fetchBalances: true, + fetchBalances: true, // get reserves call fails }).bsc.tvl]), staking, }, diff --git a/projects/burve-protocol/index.js b/projects/burve-protocol/index.js index 9083ef30b8dc..53d9ae554d50 100644 --- a/projects/burve-protocol/index.js +++ b/projects/burve-protocol/index.js @@ -2,11 +2,12 @@ const { getLogs2 } = require('../helper/cache/getLogs') const config = { bsc: { fromBlock: 35953570 }, arbitrum: { fromBlock: 184614246 }, + base: { fromBlock: 15653766 }, } module.exports = { start: 1707300000, - methodology: "BurveProtocol TVL including total values of assets locked in the tokens which is deployed by BurveProtocol", + methodology: "The TVL including total values of assets locked in the tokens which are deployed by BurveProtocol", } Object.keys(config).forEach(chain => { @@ -15,7 +16,7 @@ Object.keys(config).forEach(chain => { tvl: async (api) => { const tokens = await getLogs2({ api, factory, eventAbi: 'event LogTokenDeployed (string tokenType, string bondingCurveType, uint256 tokenId, address deployedAddr)', fromBlock, transform: i => i.deployedAddr }) const uTokens = await api.multiCall({ abi: 'address:getRaisingToken', calls: tokens }) - return api.sumTokens({ tokensAndOwners2: [uTokens, tokens] }) + return api.sumTokens({ tokensAndOwners2: [uTokens, tokens], blacklistedTokens: tokens }) } } }) diff --git a/projects/buzz-farming/index.js b/projects/buzz-farming/index.js index 158f1ddda7db..146b5e9dd77c 100644 --- a/projects/buzz-farming/index.js +++ b/projects/buzz-farming/index.js @@ -1,17 +1,18 @@ 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_BSTONE = ADDRESSES.bsquared.BSTONE; +const ADDRESSES_BSQUARED_FDUSD = ADDRESSES.bsquared.FDUSD; +const ADDRESSES_BSQUARED_MATIC = ADDRESSES.bsquared.MATIC; +const ADDRESSES_BSQUARED_ORDI = ADDRESSES.bsquared.ORDI; +const ADDRESSES_BSQUARED_SATS = ADDRESSES.bsquared.SATS; const ADDRESSES_BSQUARED_FBTC = '0x5d247f32b792a61f7b4078cf7752a878aff152e2'; -const ADDRESSES_BSQUARED_UBTC = '0x796e4d53067ff374b89b2ac101ce0c1f72ccaac2'; +const ADDRESSES_BSQUARED_UBTC = ADDRESSES.bsquared.UBTC; const ADDRESSES_BSQUARED_USDA = '0x46fecc5bef70615ee3bfdbd2b278944368b78cf5'; -const ADDRESSES_BSQUARED_ETH = '0xd48d3a551757ac47655fce25bde1b0b6b1cb2a5a'; +const ADDRESSES_BSQUARED_ETH = ADDRESSES.bsquared.ETH; +const ADDRESSES_BSQUARED_UNIBTC = '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e'; -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,]; +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, ADDRESSES_BSQUARED_UNIBTC]; module.exports = { diff --git a/projects/bwswap/index.js b/projects/bwswap/index.js index c3e0bd3f48e5..ea2470e9f64e 100644 --- a/projects/bwswap/index.js +++ b/projects/bwswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('base', '0x67233C258BAeE28b2a7d42ec19fBD0b750a77Cd1', { fetchBalances: true }) \ No newline at end of file +module.exports = uniTvlExport('base', '0x67233C258BAeE28b2a7d42ec19fBD0b750a77Cd1') \ No newline at end of file diff --git a/projects/bybit/index.js b/projects/bybit/index.js index dfbdf54ffa97..eb982dcb464a 100644 --- a/projects/bybit/index.js +++ b/projects/bybit/index.js @@ -1,75 +1,150 @@ -const { cexExports } = require('../helper/cex') +const { cexExports } = require("../helper/cex"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { owners: [ - '0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4', - '0xA7A93fd0a276fc1C0197a5B5623eD117786eeD06', - '0xe1ab8c08294F8ee707D4eFa458eaB8BbEeB09215', - '0xee5B5B923fFcE93A870B3104b7CA09c3db80047A', - '0xf89d7b9c864f589bbF53a82105107622B35EaA40', // multiple chains + "0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4", + "0xA7A93fd0a276fc1C0197a5B5623eD117786eeD06", + "0xe1ab8c08294F8ee707D4eFa458eaB8BbEeB09215", + "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A", + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", // multiple chains + "0x88a1493366d48225fc3cefbdae9ebb23e323ade3", + "0x6Bd869be16359f9E26f0608A50497f6Ef122eE3E", + "0x922fa922da1b0b28d0af5aa274d7326eaa108c3d", + "0xbaed383ede0e5d9d72430661f3285daa77e9439f" ], }, bitcoin: { - owners: [ - 'bc1q2qqqt87kh33s0er58akh7v9cwjgd83z5smh9rp', - 'bc1q9w4g79ndel72lygvwtqzem67z6uqv4yncvqjz3yn8my9swnwflxsutg4cx', - 'bc1qjysjfd9t9aspttpjqzv68k0ydpe7pvyd5vlyn37868473lell5tqkz456m', - '1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC', - 'bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f', - // added on the 15th of july 2024. - 'bc1qa2eu6p5rl9255e3xz7fcgm6snn4wl5kdfh7zpt05qp5fad9dmsys0qjg0e' - ] + owners: bitcoinAddressBook.bybit, }, bsc: { owners: [ - '0xee5B5B923fFcE93A870B3104b7CA09c3db80047A', - '0xf89d7b9c864f589bbf53a82105107622b35eaa40', - ] + "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A", + "0xf89d7b9c864f589bbf53a82105107622b35eaa40", + "0x88a1493366d48225fc3cefbdae9ebb23e323ade3" + ], }, tron: { owners: [ - 'TB1WQmj63bHV9Qmuhp39WABzutphMAetSc', - 'TBpr1tQ5kvoKMv85XsCESVavYo4oZZdWpY', - 'TKFvdC4UC1vtCoHZgn8eviK34kormXaqJ7', - 'TQVxjVy2sYt4at45ezD7VG4H6nQZtsua5C', - 'TS9PDCB6vzLYDCPr5Nas2yzekdr7ot6dxn', - 'TU4vEruvZwLLkSfV9bNw12EJTPvNr7Pvaa', - 'TXRRpT4BZ3dB5ShUQew2HXv1iK3Gg4MM9j', - 'TYgFxMvvu2VHFJnxQf8fh1qVAeMfXZJZ3K', - ] + "TB1WQmj63bHV9Qmuhp39WABzutphMAetSc", + "TBpr1tQ5kvoKMv85XsCESVavYo4oZZdWpY", + "TKFvdC4UC1vtCoHZgn8eviK34kormXaqJ7", + "TQVxjVy2sYt4at45ezD7VG4H6nQZtsua5C", + "TS9PDCB6vzLYDCPr5Nas2yzekdr7ot6dxn", + "TU4vEruvZwLLkSfV9bNw12EJTPvNr7Pvaa", + "TXRRpT4BZ3dB5ShUQew2HXv1iK3Gg4MM9j", + "TYgFxMvvu2VHFJnxQf8fh1qVAeMfXZJZ3K", + "TB1cPNTPE2yKRbyd5C3hd9KMXgb8HqW1CM", + "TTH75Z9rfRgzCLNDDYBaR2WjUvuSDRtSMg" + ], }, polygon: { - owners: ['0xf89d7b9c864f589bbf53a82105107622b35eaa40'] + owners: ["0xf89d7b9c864f589bbf53a82105107622b35eaa40", "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"], }, arbitrum: { - owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] + owners: ["0xf89d7b9c864f589bbF53a82105107622B35EaA40", "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"], }, avax: { - owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] + owners: ["0xf89d7b9c864f589bbF53a82105107622B35EaA40", "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"], }, ripple: { owners: [ - 'rMvCasZ9cohYrSZRNYPTZfoaaSUQMfgQ8G', - 'rwBHqnCgNRnk3Kyoc6zon6Wt4Wujj3HNGe', - 'raQxZLtqurEXvH5sgijrif7yXMNwvFRkJN' - ] + "rMvCasZ9cohYrSZRNYPTZfoaaSUQMfgQ8G", + "rwBHqnCgNRnk3Kyoc6zon6Wt4Wujj3HNGe", + "raQxZLtqurEXvH5sgijrif7yXMNwvFRkJN", + "raBWjPDjohBGc9dR6ti3DsP9Sn47jirTi3" + ], }, optimism: { - owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] + owners: ["0xf89d7b9c864f589bbF53a82105107622B35EaA40", "0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4", "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"], }, era: { - owners: ['0xf89d7b9c864f589bbF53a82105107622B35EaA40'] + owners: ["0xf89d7b9c864f589bbF53a82105107622B35EaA40", "0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4", "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A"], }, solana: { owners: [ - 'AC5RDfQFmDS1deWZos921JfqscXdByf8BKHs5ACWjtW2', - '42brAgAVNzMBP7aaktPvAmBSPEkehnFQejiZc53EpJFd' - ] + "AC5RDfQFmDS1deWZos921JfqscXdByf8BKHs5ACWjtW2", + "42brAgAVNzMBP7aaktPvAmBSPEkehnFQejiZc53EpJFd", + ], }, cardano: { - owners: ['addr1v8mn6dmk7tf9u26kr09a05lmvc9j4k9d940a88ta3hdczqgyt7whl'] - } -} + owners: ["addr1v8mn6dmk7tf9u26kr09a05lmvc9j4k9d940a88ta3hdczqgyt7whl"], + }, + aptos: { + owners: [ + "0x84b1675891d370d5de8f169031f9c3116d7add256ecf50a4bc71e3135ddba6e0", + ], + }, + taiko: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + celo: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + base: { + owners: [ + "0x1Db92e2EeBC8E0c075a02BeA49a2935BcD2dFCF4", + "0xbaed383ede0e5d9d72430661f3285daa77e9439f", + "0xee5B5B923fFcE93A870B3104b7CA09c3db80047A", + ], + }, + fantom: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + kava: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + linea: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + litecoin: { + owners: [ + "LKxNtynH2GxLc2oLxUGL6ryckK8JMdP5BR", + "ltc1qp7cnlxmz8wgc93g0m020ckru2s55t25y3wunf6" + ], + }, + manta: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + "0xa6a9f45518881a788e29f82a032f9d400177d2b6", + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + "0x588846213a30fd36244e0ae0ebb2374516da836c" + ], + }, + scroll: { + owners: [ + "0xf89d7b9c864f589bbF53a82105107622B35EaA40", + ], + }, + polkadot: { + owners: [ + "11yLs2qzU15AhxnH1d7Koqcf83AwutKkDaGbqsJJ6yDWQjc", + "12nr7GiDrYHzAYT9L8HdeXnMfWcBuYfAXpgfzf3upujeCciz" + ], + }, + eos: { + owners: [ + "coldcrazycat", + "eosdididada3", + "kcwo3rimcnqf" + ], + }, + starknet: { + owners: [ + "0x076601136372fcdbbd914eea797082f7504f828e122288ad45748b0c8b0c9696" + ], + }, +}; -module.exports = cexExports(config) \ No newline at end of file +module.exports = cexExports(config); diff --git a/projects/bybitSOL/index.js b/projects/bybitSOL/index.js new file mode 100644 index 000000000000..d1c4d1c48ff7 --- /dev/null +++ b/projects/bybitSOL/index.js @@ -0,0 +1,13 @@ + +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('2aMLkB5p5gVvCwKkdSo5eZAL1WwhZbxezQr1wxiynRhq', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/cabinet/index.js b/projects/cabinet/index.js new file mode 100644 index 000000000000..a0df108b04a4 --- /dev/null +++ b/projects/cabinet/index.js @@ -0,0 +1,42 @@ +const { fetchLocal, mkMeta } = require("../helper/pact"); + +const chainId = "5"; +const network = `https://api.chainweb.com/chainweb/0.0/mainnet01/chain/${chainId}/pact`; +const GAS_PRICE = 0.00000001; +const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; + + +const getReserve = (tokenData) => { + return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); +}; + + +const getCabinetTvl = async () => { + const data = await fetchLocal( + { + pactCode: `(coin.get-balance "c:86aaCQXT8uRkyXGXu9k-eNn1kXqV_nNmjTYErKpZ6vE")`, + meta: mkMeta("", chainId, GAS_PRICE, 3000, creationTime(), 600) + }, + network + ); + if (data.result.status === "success") { + return getReserve(data.result.data); + } + throw new Error("Failed do fetch TVL"); + +} + +async function tvl() { + const cabinetTvl = await getCabinetTvl(); + return { + kadena: cabinetTvl, + }; +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + kadena: { + tvl: tvl, + }, +}; diff --git a/projects/cables/index.js b/projects/cables/index.js new file mode 100644 index 000000000000..748416239de5 --- /dev/null +++ b/projects/cables/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const config = { + avax: { + owners: [ + '0xfA12DCB2e1FD72bD92E8255Db6A781b2c76adC20', + ], + }, + arbitrum: { + owners: [ + '0xfA12DCB2e1FD72bD92E8255Db6A781b2c76adC20', + ], + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ ...config[chain], fetchCoValentTokens: true, }) + } +}) \ No newline at end of file diff --git a/projects/cake-defi/index.js b/projects/cake-defi/index.js index 8d2bcba9ddc2..f6e1b0420ced 100644 --- a/projects/cake-defi/index.js +++ b/projects/cake-defi/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -18,7 +19,7 @@ const config = { ] }, bitcoin: { - owners: ['3GcSHxkKY8ADMWRam51T1WYxYSb2vH62VL'] + owners: bitcoinAddressBook.cakeDefi }, litecoin: { owners: ['MLYQxJfnUfVqRwfYXjDJfmLbyA77hqzSXE'] diff --git a/projects/camelot-v2/index.js b/projects/camelot-v2/index.js index dd0b50fbc1e9..ec282cb3732b 100644 --- a/projects/camelot-v2/index.js +++ b/projects/camelot-v2/index.js @@ -1,4 +1,3 @@ - const { uniV3Export } = require('../helper/uniswapV3') const { mergeExports } = require('../helper/utils'); @@ -11,6 +10,9 @@ const export2 = uniV3Export({ rari: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 340548, isAlgebra: true}, sanko: { factory: '0xcF8d0723e69c6215523253a190eB9Bc3f68E0FFa', fromBlock: 51, isAlgebra: true}, arbitrum: { factory: '0xd490f2f6990c0291597fd1247651b4e0dcf684dd', fromBlock: 75633510, isAlgebra: true, }, + reya: { factory: '0x10aA510d94E094Bd643677bd2964c3EE085Daffc', fromBlock: 2932166, isAlgebra: true, }, + gravity: { factory: '0x10aA510d94E094Bd643677bd2964c3EE085Daffc', fromBlock: 11988, isAlgebra: true, }, + apechain: { factory: '0x10aA510d94E094Bd643677bd2964c3EE085Daffc', fromBlock: 60224, isAlgebra: true, }, }) module.exports = mergeExports([export1, export2 ]) \ No newline at end of file diff --git a/projects/camelot/index.js b/projects/camelot/index.js index 87e43be12c33..195068af3fc5 100644 --- a/projects/camelot/index.js +++ b/projects/camelot/index.js @@ -14,5 +14,14 @@ module.exports = { }, rari: { tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + }, + reya: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + }, + gravity: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) + }, + apechain: { + tvl: getUniTVL({factory: '0x7d8c6B58BA2d40FC6E34C25f9A488067Fe0D2dB4', useDefaultCoreAssets: true}) } }; \ No newline at end of file diff --git a/projects/canto-lending/index.js b/projects/canto-lending/index.js index c7e02a89e34b..a8f26b9abb46 100644 --- a/projects/canto-lending/index.js +++ b/projects/canto-lending/index.js @@ -25,8 +25,7 @@ const addresses = { } const chain = 'canto' -const checkForLPTokens = i => /vAMM/.test(i) -const compoundData = compoundExports(addresses.Comptroller, chain, addresses.CCANTO, addresses.WCANTO, undefined, checkForLPTokens, { blacklistedTokens:[ +const compoundData = compoundExports(addresses.Comptroller, addresses.CCANTO, addresses.WCANTO, { blacklistedTokens:[ addresses.Note, addresses.NOTE_WCANTO, addresses.ETH_WCANTO, diff --git a/projects/capybara-exchange/config.js b/projects/capybara-exchange/config.js index f5272a6610a9..9d552c09fc0c 100644 --- a/projects/capybara-exchange/config.js +++ b/projects/capybara-exchange/config.js @@ -1,8 +1,5 @@ module.exports = { klaytn: { - pools: { - mainPool: "0x540cce8ed7d210f71eeabb9e7ed7698ac745e077", - volatilePool: "0x6389dbfa1427a3b0a89cddc7ea9bbda6e73dece7", - }, + master: "0x3CA30C862769b5de7987D2E2db4c1A72800A1Da1", }, }; diff --git a/projects/capybara-exchange/index.js b/projects/capybara-exchange/index.js index 9810ad1be6ae..4f34cd275cee 100644 --- a/projects/capybara-exchange/index.js +++ b/projects/capybara-exchange/index.js @@ -2,23 +2,20 @@ const config = require("./config"); const { sumTokens2 } = require("../helper/unwrapLPs"); Object.keys(config).forEach((chain) => { - const arg = config[chain]; + const { master } = 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 poolInfos = await api.fetchList({ + // Reference: https://github.com/wombat-exchange/v1-core/blob/5887ec5e1f1cbd067eaee8aee49fcb857fb867c5/contracts/wombat-governance/MasterWombatV3.sol#L587 + lengthAbi: 'poolLength', + itemAbi: "function poolInfo(uint256) external view returns (address asset, uint96, address, uint256, uint104, uint104, uint40)", + target: master, }); - const wTokens = await api.multiCall({ abi: "function addressOfAsset(address) view returns (address)", calls, }); - return sumTokens2({ api, tokensAndOwners2: [tokens, wTokens], }); + // Reference: https://github.com/wombat-exchange/v1-core/blob/5887ec5e1f1cbd067eaee8aee49fcb857fb867c5/contracts/wombat-core/asset/Asset.sol#L4 + const assets = poolInfos.map(i => i.asset); + const uTokens = await api.multiCall({ abi: 'address:underlyingToken', calls: assets }) + + return sumTokens2({ api, tokensAndOwners2: [uTokens, assets], }); }, }; }); diff --git a/projects/capybara-perp/index.js b/projects/capybara-perp/index.js new file mode 100644 index 000000000000..27ea0a80f523 --- /dev/null +++ b/projects/capybara-perp/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + klaytn: { + tvl: sumTokensExport({ owners: ['0xeB23e0a5065D96FCa71DE240C6b302B9Da14Ac0e', '0x94b231dD60E64ba8bCC72892cE4B4B9A5004730d'], tokens: [ADDRESSES.klaytn.stKaia] }), + } +} diff --git a/projects/capyfi/index.js b/projects/capyfi/index.js new file mode 100644 index 000000000000..8dfbc1567c3e --- /dev/null +++ b/projects/capyfi/index.js @@ -0,0 +1,6 @@ +const { compoundExports2, methodology } = require('../helper/compound') + +module.exports = { + methodology, + lac: compoundExports2({ comptroller: '0x123Abe3A273FDBCeC7fc0EBedc05AaeF4eE63060', cether: '0x465ebfceb3953e2922b686f2b4006173664d16ce' }) +} diff --git a/projects/carbondefi/index.js b/projects/carbondefi/index.js index 85a5897ddfd9..8fd3768e9430 100644 --- a/projects/carbondefi/index.js +++ b/projects/carbondefi/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/unwrapLPs"); const config = { @@ -9,17 +10,22 @@ const config = { fromBlock: 79146720, controller: "0xe4816658ad10bF215053C533cceAe3f59e1f1087", }, + celo: { + fromBlock: 26828280, + controller: "0x6619871118D144c1c28eC3b23036FC1f0829ed3a", + gasToken: ADDRESSES.celo.CELO, + }, }; Object.keys(config).forEach((chain) => { - const { controller, fromBlock } = config[chain]; + const { controller, fromBlock, gasToken } = 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() + const tokens = pairs.filter(pair => !gasToken || (pair[0] !== gasToken && pair[1] !== gasToken)).flat() return sumTokens2({ api, owner: controller, tokens }); }, diff --git a/projects/carrot/index.js b/projects/carrot/index.js new file mode 100644 index 000000000000..181ce8bb9cc8 --- /dev/null +++ b/projects/carrot/index.js @@ -0,0 +1,50 @@ +const { PublicKey } = require('@solana/web3.js'); +const { Program } = require("@project-serum/anchor"); +const { getConnection, getProvider, getTokenSupplies } = require('../helper/solana') + +async function tvl(api) { + + const connection = getConnection() + const programId = 'CarrotwivhMpDnm27EHmRLeQ683Z1PufuqEmBZvD282s' + const testVaultExclusion = '2AV35oWyAuSN5wmuy26VD5JirjVpXkfkv5ZMCQ2LtpuV' // our test vault should not be included in TVL + + // Use this method to track TVL via the token... + // const CRT_MINT = 'CRTx1JouZhzSU6XytsE42UQraoGqiHgxabocVfARTy2s'; + // await getTokenSupplies(CRT_MINT, {api}) + + // Use this method to track TVL via onchain state of each Vault by adding the balance at each strategy. + const programAccounts = await connection.getProgramAccounts(new PublicKey(programId), { + filters: [{ + memcmp: { + offset: 8, + bytes: 'CarrotLYPhQzYL4fEsTUvEzw5QDaMGSZUENHSkh7qzQa' // carrot keeper + }, + },] + }); + + const provider = getProvider(); + const idl = await Program.fetchIdl(programId, provider) + const program = new Program(idl, programId, provider) + + programAccounts.forEach(({ account, pubkey }, i) => { + if(pubkey.toBase58() !== testVaultExclusion) { + const { assets, strategies } = program.coder.accounts.decode( + "Vault", + account.data + ); + const assetMap = {} + assets.forEach(({assetId, mint }) => assetMap[assetId] = mint.toString()) + + strategies.forEach(i => { + api.add(assetMap[i.assetId], i.balance.toString()) + }) + } + }) +} + +module.exports = { + doublecounted: true, + timetravel: false, + methodology: 'TVL calculated by calling the onchain state of the CRT Vault accounts, and tallying the balance of each strategy.', + solana: { tvl }, +} diff --git a/projects/carrotswap/index.js b/projects/carrotswap/index.js new file mode 100644 index 000000000000..4e1c4cce5023 --- /dev/null +++ b/projects/carrotswap/index.js @@ -0,0 +1,5 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + neox: { tvl: getUniTVL({ factory: '0x753df473702cB31BB81a93966e658e1AA4f10DD8', useDefaultCoreAssets: true })} +} \ No newline at end of file diff --git a/projects/cashcow/index.js b/projects/cashcow/index.js index c59fa600be4c..b919f5f0b9d3 100644 --- a/projects/cashcow/index.js +++ b/projects/cashcow/index.js @@ -29,7 +29,6 @@ module.exports = { bsc: { staking: stakingPools, ...compoundExports(comptroller, - "bsc", cBNB, WBNBEquivalent) }, diff --git a/projects/celerbridge/index.js b/projects/celerbridge/index.js index 448459932383..1d10495e01b7 100644 --- a/projects/celerbridge/index.js +++ b/projects/celerbridge/index.js @@ -376,7 +376,7 @@ const liquidityBridgeTokens = [ }, { // FXS - ethereum: "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + ethereum: ADDRESSES.ethereum.FXS, }, { // MAI diff --git a/projects/cellana/index.js b/projects/cellana/index.js index 04bc636c582d..c4627078cd7d 100644 --- a/projects/cellana/index.js +++ b/projects/cellana/index.js @@ -13,8 +13,7 @@ const extractCoinAddress = (str) => str.slice(str.indexOf("<") + 1, str.lastInde const reserveContrainerFilter = (i) => i.type.includes("0x1::coin::CoinStore") async function getfungibleAssetBalances(api) { - const data = await _getPools('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') - const poolsAddresses = data[0]; + const poolsAddresses = await _getPools('0x4bf51972879e3b95c4781a5cdcb9e1ee24ef483e7d22f2d903626f126df62bd1') 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 diff --git a/projects/cells/index.js b/projects/cells/index.js index 6cc7ec3d6d2f..ec2506fb2a24 100644 --- a/projects/cells/index.js +++ b/projects/cells/index.js @@ -4,4 +4,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-06-11') / 1e3), 'Project rugged'], ], + deadFrom: Math.floor(new Date('2023-06-11') / 1e3) } \ No newline at end of file diff --git a/projects/cemetery/index.js b/projects/cemetery/index.js index 2658153249c4..b55b1f79ac2f 100644 --- a/projects/cemetery/index.js +++ b/projects/cemetery/index.js @@ -7,5 +7,6 @@ module.exports = masterchefExports({ }) module.exports.hallmarks = [ [1646524800,"Rug Pull"] -] +], +module.exports.deadFrom='2022-03-06' diff --git a/projects/ceto-swap/index.js b/projects/ceto-swap/index.js index 65de715ab2c4..bd9840a68899 100644 --- a/projects/ceto-swap/index.js +++ b/projects/ceto-swap/index.js @@ -4,6 +4,6 @@ const factory = '0xf50c8e257ccf3e2b58651f78e3c2dc83446d9c47'; module.exports = { manta: { - tvl: getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }), + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), }, }; diff --git a/projects/chain-fusion/index.js b/projects/chain-fusion/index.js new file mode 100644 index 000000000000..80c79de0d0b9 --- /dev/null +++ b/projects/chain-fusion/index.js @@ -0,0 +1,27 @@ +const { sumTokens2, } = require("../helper/unwrapLPs"); +const { get } = require('../helper/http') + +// This address holds all the locked ETH as well as locked ERC20 tokens +const ethereum_contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; + +async function ethereum_tvl(api) { + return sumTokens2({ owner: ethereum_contract, api, fetchCoValentTokens: true }); +} + +async function bitcoin_tvl(ts) { + var end = ts.timestamp + let start = end - 24 * 60 * 60; + const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/mxzaz-hqaaa-aaaar-qaada-cai/total-supply?start=${start}&end=${end}&step=1`); + let [_, bal] = data.pop() + return { + 'coingecko:bitcoin': bal / 1e8 + }; +} + +module.exports = { + methodology: `We count the ETH and ERC20-Tokens on ${ethereum_contract} as the collateral for ckETH and ck-ERC20 tokens and we count BTC as the collateral for ckBTC`, + ethereum: { + tvl: ethereum_tvl, + }, + bitcoin: { tvl: bitcoin_tvl }, +}; diff --git a/projects/chainflip/index.js b/projects/chainflip/index.js index ba8ccc93fe4b..975f0bb523d5 100644 --- a/projects/chainflip/index.js +++ b/projects/chainflip/index.js @@ -1,13 +1,70 @@ -const { staking } = require('../helper/staking'); +const { staking } = require('../helper/staking') +const { graphQuery } = require('../helper/http'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const STATE_CHAIN_GATEWAY_CONTRACT = '0x826180541412D574cf1336d22c0C0a287822678A'; const FLIP_TOKEN = '0x6995ab7c4d7f4b03f467cf4c8e920427d9621dbd' -module.exports = { - methodology: 'counts the number of FLIP tokens in the Chainflip State Chain Gateway Contract.', - start: 1700740800, // FLIP went live on 2023-11-23 12:00 UTC - ethereum: { - tvl: () => 0, - staking: staking(FLIP_TOKEN, STATE_CHAIN_GATEWAY_CONTRACT), +const poolsDataQuery = `{ + allPools { + nodes { + baseAsset + baseLiquidityAmount + quoteAsset + quoteLiquidityAmount + } + } + allBoostPools { + nodes { + asset + chain + feeTierPips + availableAmount + unavailableAmount + } } + allDepositBalances { + groupedAggregates(groupBy: ASSET) { + sum { + amount + } + keys + } + } +}` + +const endpoint = 'https://cache-service.chainflip.io/graphql' + +async function tvl(api) { + // Call GraphQL and get tokens, add each to balance + const { + allPools: { nodes }, + allBoostPools: { nodes: bNodes }, + allDepositBalances: { groupedAggregates: uNodes } + } = await graphQuery(endpoint, poolsDataQuery); + + nodes.forEach(i => { + api.add(i.baseAsset, i.baseLiquidityAmount) + api.add(i.quoteAsset, i.quoteLiquidityAmount) + }) + bNodes.forEach(i => { + api.add(i.asset, i.availableAmount) + api.add(i.asset, i.unavailableAmount) + }) + uNodes.forEach(i => { + api.add(i.keys[0], i.sum.amount) + }) + return sumTokens2({ api }) +} + +module.exports = { + methodology: 'The number of FLIP tokens in the Chainflip State Chain Gateway Contract, as well as the total liquidity.', + start: 1700740800, // FLIP went live on 2023-11-23 12:00 UTC + ethereum: { + tvl: () => ({}), + staking: staking(FLIP_TOKEN, STATE_CHAIN_GATEWAY_CONTRACT), + }, + chainflip: { + tvl, + } }; diff --git a/projects/chainge.js b/projects/chainge.js index e438c9fd9379..790526fcadd6 100644 --- a/projects/chainge.js +++ b/projects/chainge.js @@ -1,13 +1,28 @@ -const utils = require('./helper/utils'); +const ADDRESSES = require('./helper/coreAssets.json') +const { sumTokensExport } = require('./helper/unwrapLPs') -// fusion -async function fetch() { - let tvl = await utils.fetchURL('https://info.chainge.finance/api/v1/info/getInfoOuterTvl') - - return tvl.data.data.totalTvl +const config = { + rollux: { + chaingeAddress: "0x66ff2f0AC3214758D1e61B16b41e3d5e62CAEcF1", + tokens: [ + ADDRESSES.rollux.USDC, + ADDRESSES.rollux.USDT, + ADDRESSES.rollux.WBTC, + ADDRESSES.rollux.WETH, + ADDRESSES.rollux.WSYS, + ADDRESSES.null, // for native SYS + ] + } } module.exports = { - methodology: "assets in liquidity are counted as TVL", - fetch + methodology: "assets in liquidity are counted as TVL + balances of all tokens (USDC, USDT, WBTC, WETH, WSYS, and native SYS) held in the Chainge treasury address on the Rollux network. These tokens are used to provide liquidity for cross-chain swaps.", + fusion: { tvl: () => ({})} } + +Object.keys(config).forEach(chain => { + const { chaingeAddress, tokens } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owner: chaingeAddress, tokens }) + } +}) \ No newline at end of file diff --git a/projects/chaingpt/index.js b/projects/chaingpt/index.js index fab8d065e058..ccf14b869861 100644 --- a/projects/chaingpt/index.js +++ b/projects/chaingpt/index.js @@ -29,7 +29,7 @@ const config = { { factory: '0x2D47310bB0C6A9D4ae2a1d6625eC0BEe4F473Bb6', fromBlock: 46082883 }, ], core: [ - { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 15191500 }, + { factory: '0x9840652DC04fb9db2C43853633f0F62BE6f00f98', fromBlock: 15191500, blacklistedTokens: ['0xcE87100A1dBAf576ebd063EB0890840346338689'] }, ], base: [ { factory: '0xFB5cd8426FBC3b1f2ea4B113A5A37752B3098C79', fromBlock: 15137100 }, @@ -49,22 +49,29 @@ async function tvl(api) { const chainConfigs = config[api.chain] const ownerTokens = [] const poolTokenMapping = {} + let blacklistedTokens = [] + for (const chainConfig of chainConfigs) { - const { factory, fromBlock } = chainConfig + const { factory, fromBlock, blacklistedTokens: configBlacklistedTokens } = chainConfig + + if (configBlacklistedTokens) { + blacklistedTokens = blacklistedTokens.concat(configBlacklistedTokens) + } 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) @@ -79,6 +86,7 @@ async function tvl(api) { }) logs.forEach(({ args: i }) => { const key = i.token + '-' + i.owner + if (!poolTokenMapping[key]) poolTokenMapping[key] = [] poolTokenMapping[key].push(i.offeredCurrency) }) @@ -91,7 +99,8 @@ async function tvl(api) { ownerTokens.push([poolTokenMapping[key], i.pool]) }) } - return api.sumTokens({ ownerTokens }) + + return api.sumTokens({ ownerTokens, blacklistedTokens }) } diff --git a/projects/channels/index.js b/projects/channels/index.js index 63f235ca8807..c939e7969592 100644 --- a/projects/channels/index.js +++ b/projects/channels/index.js @@ -1,5 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { compoundExports } = require('../helper/compound'); +const { compoundExports2 } = require('../helper/compound'); const comptroller = { heco: "0x8955aeC67f06875Ee98d69e6fe5BDEA7B60e9770", @@ -12,14 +11,9 @@ const ceth = { heco: "0x397c6D1723360CC1c317CdC9B2E926Ae29626Ff3", } -const native = { - bsc: ADDRESSES.bsc.WBNB, - heco: ADDRESSES.heco.WHT, -} - module.exports = { ...Object.keys(comptroller).reduce((exp, chain) => { - exp[chain] = compoundExports(comptroller[chain], chain, ceth[chain], native[chain], undefined, symbol => ["MLP", "CLP", "SLP"].some(c => symbol.includes(c))) + exp[chain] = compoundExports2({ comptroller: comptroller[chain], cether: ceth[chain]}) return exp }, {}) } diff --git a/projects/chargedefi/index.js b/projects/chargedefi/index.js index 92151453ec5b..c16ca6556061 100644 --- a/projects/chargedefi/index.js +++ b/projects/chargedefi/index.js @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const { staking } = require("../helper/staking"); const chargeTokenAddress = "0x1C6bc8e962427dEb4106aE06A7fA2d715687395c"; @@ -62,7 +62,7 @@ module.exports = { methodology: 'The TVL of Charge Defi is calculated using the Pancake LP token deposits (Static/BUSD and Charge/BUSD) in the farms, and the Charge & Static-BUSD deposits found in each Boardroom.', bsc: { tvl, - pool2: pool2Exports( + pool2: pool2( chargeBUSDFarmStrategyAddress, [chargeBUSDLpAddress], "bsc" diff --git a/projects/chee-finance/index.js b/projects/chee-finance/index.js index afd6c95ed493..45fb43035810 100644 --- a/projects/chee-finance/index.js +++ b/projects/chee-finance/index.js @@ -1,10 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') -const {compoundExports } = require('../helper/compound') +const { compoundExports } = require('../helper/compound') -module.exports={ +module.exports = { hallmarks: [ ], - celo:compoundExports("0x9BD4Fd10b531ae07437676dfE3FA6f505032CB64", "celo", "0x9de4171EDc1F69EAD07f7595bD3beD62d9215532", ADDRESSES.celo.CELO), - meter:compoundExports("0xcc0BfaD4e684023B18e0adfEcaEDd800D91dc8B5", "meter", "0xbF5cffE28d3CbA3376Cd02fF12eBECa43Bc3f14A", ADDRESSES.meter.WMTR), - bsc:compoundExports("0x0E00Ae24B84148ee93Ce2Cf4F52dE277C91B0B72", "bsc", "0x9437Ea5b08AC7f9dc553861dfE1AA77EE0F2aE69", ADDRESSES.bsc.WBNB), + celo: compoundExports("0x9BD4Fd10b531ae07437676dfE3FA6f505032CB64", "0x9de4171EDc1F69EAD07f7595bD3beD62d9215532", ADDRESSES.celo.CELO), + meter: compoundExports("0xcc0BfaD4e684023B18e0adfEcaEDd800D91dc8B5", "0xbF5cffE28d3CbA3376Cd02fF12eBECa43Bc3f14A", ADDRESSES.meter.WMTR), + bsc: compoundExports("0x0E00Ae24B84148ee93Ce2Cf4F52dE277C91B0B72", "0x9437Ea5b08AC7f9dc553861dfE1AA77EE0F2aE69", ADDRESSES.bsc.WBNB), } \ No newline at end of file diff --git a/projects/chiliswap/index.js b/projects/chiliswap/index.js index cde14c6c62db..3b5d59068820 100644 --- a/projects/chiliswap/index.js +++ b/projects/chiliswap/index.js @@ -4,6 +4,6 @@ module.exports = { misrepresentedTokens: true, methodology: 'TVL accounts for the liquidity on all AMM pools', scroll: { - tvl: getUniTVL({ fetchBalances: true, factory: "0x2627161e60fFa589f8bD3798F0947d572A7EdF68", useDefaultCoreAssets: true }) + tvl: getUniTVL({ factory: "0x2627161e60fFa589f8bD3798F0947d572A7EdF68", useDefaultCoreAssets: true }) } } \ No newline at end of file diff --git a/projects/chiliz-governance-staking/index.js b/projects/chiliz-governance-staking/index.js index 02b95529187e..72f3cb4aef44 100644 --- a/projects/chiliz-governance-staking/index.js +++ b/projects/chiliz-governance-staking/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); -const STAKING_CONTRACT = '0x0000000000000000000000000000000000001000'; +const STAKING_CONTRACT = ADDRESSES.findora.FRA; module.exports = { methodology: 'Total CHZ Locked in Staking System Contract.', diff --git a/projects/chilizswap/index.js b/projects/chilizswap/index.js index 2fa4d4c077f8..8b5da67de570 100644 --- a/projects/chilizswap/index.js +++ b/projects/chilizswap/index.js @@ -7,7 +7,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xcF4A2be8Fe92fEe8e350AD8D876274749Ae0CBb1", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; \ No newline at end of file diff --git a/projects/chimeradex-lend/index.js b/projects/chimeradex-lend/index.js index b2415bc1cd6b..4eabbb781ba7 100644 --- a/projects/chimeradex-lend/index.js +++ b/projects/chimeradex-lend/index.js @@ -8,3 +8,6 @@ const config = { Object.keys(config).forEach(chain => { module.exports[chain] = compoundExports2({ comptroller: config[chain]}) }) +module.exports.deadFrom='2023-12-12' +module.exports.scroll.borrowed = () => ({}) // bad debt +module.exports.arbitrum.borrowed = () => ({}) // bad debt diff --git a/projects/chimeradex/index.js b/projects/chimeradex/index.js index 63181160ec6e..25e9dbec3d25 100644 --- a/projects/chimeradex/index.js +++ b/projects/chimeradex/index.js @@ -1,6 +1,5 @@ const { getUniTVL } = require('../helper/unknownTokens'); const tvl = getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0x661B92cc18a8d73209dBa1394aE56fca2F9DDb4D', }) diff --git a/projects/cian-yl/index.js b/projects/cian-yl/index.js new file mode 100644 index 000000000000..0b9afbfc121f --- /dev/null +++ b/projects/cian-yl/index.js @@ -0,0 +1,25 @@ +// cian yield layer +const config = { + ethereum: [ + "0xB13aa2d0345b0439b064f26B82D8dCf3f508775d", + "0xd87a19fF681AE98BF10d2220D1AE3Fbd374ADE4e", + "0x9fdDAD44eD6b77e6777dC1b16ee4FCcCBaF0A019", + "0x6c77bdE03952BbcB923815d90A73a7eD7EC895D1", + "0xcc7E6dE27DdF225E24E8652F62101Dab4656E20A", + "0xd4Cc9b31e9eF33E392FF2f81AD52BE8523e0993b", + "0x3D086B688D7c0362BE4f9600d626f622792c4a20", + ], + arbitrum: ["0x15cbFF12d53e7BdE3f1618844CaaEf99b2836d2A"], +}; + +module.exports = { + doublecounted: true, +}; + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl: async (_, _b, _cb, { api }) => { + return api.erc4626Sum({ calls: config[chain], isOG4626: true }); + }, + }; +}); diff --git a/projects/citadelswap/index.js b/projects/citadelswap/index.js index f1d363e60789..9005a9908e60 100644 --- a/projects/citadelswap/index.js +++ b/projects/citadelswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('base', '0xbe720274c24b5ec773559b8c7e28c2503dac7645', { fetchBalances: true, }) +module.exports = uniTvlExport('base', '0xbe720274c24b5ec773559b8c7e28c2503dac7645') diff --git a/projects/ckbtc/index.js b/projects/ckbtc/index.js deleted file mode 100644 index 94bca3276727..000000000000 --- a/projects/ckbtc/index.js +++ /dev/null @@ -1,16 +0,0 @@ -const { get } = require('../helper/http') - -async function tvl(ts) { - var end = ts.timestamp - let start = end - 24 * 60 * 60; - const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/mxzaz-hqaaa-aaaar-qaada-cai/total-supply?start=${start}&end=${end}&step=1`); - let [_, bal] = data.pop() - return { - 'coingecko:bitcoin': bal / 1e8 - }; -} - -module.exports = { - methodology: `We count the BTC as the collateral for the ckBTC`, - bitcoin: { tvl: tvl }, -} diff --git a/projects/cketh/index.js b/projects/cketh/index.js deleted file mode 100644 index 0a12acb97319..000000000000 --- a/projects/cketh/index.js +++ /dev/null @@ -1,21 +0,0 @@ -const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); -// const { get } = require('../helper/http') -const ADDRESSES = require('../helper/coreAssets.json') - -const contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; - -async function tvl(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 = { - methodology: `We count the ETH on ${contract} as the collateral for the ckETH`, - ethereum: { - tvl, - }, -}; \ No newline at end of file diff --git a/projects/clave/index.js b/projects/clave/index.js new file mode 100644 index 000000000000..3ce9e9ba2d61 --- /dev/null +++ b/projects/clave/index.js @@ -0,0 +1,12 @@ +const ZtakeV1Address = "0x9248F1Ee8cBD029F3D22A92EB270333a39846fB2" + +async function tvl(api) { + const ZK = await api.call({ abi: 'address:ZK', target: ZtakeV1Address}) + return api.sumTokens({ owner: ZtakeV1Address, tokens: [ZK] }) +} + +module.exports = { + era: { + tvl, + } +} diff --git a/projects/clearpool/index.js b/projects/clearpool/index.js index 1de97ee2fbfd..ad8721de6419 100644 --- a/projects/clearpool/index.js +++ b/projects/clearpool/index.js @@ -69,6 +69,10 @@ const config = { factory: "0x44fEF0fAB3A96CA34b06d5142350Ef9223F65A7e", fromBlock: 226174706, }, + vaults: { + factory: "0xA8e8AccabCf29e7d8b33D086085D87F9F38a6Ed7", + fromBlock: 226193395 + } }, [CHAIN.MANTLE]: { dynamic: { @@ -78,6 +82,10 @@ const config = { vaults: { factory: "0xF041A2838794266d19f79709F416A2977F896A9B", fromBlock: 59594636 + }, + prime: { + factory: "0x29157e2B6A34Ae1787CDdD05Ad54DD4aa9783A5c", + fromBlock: 68483768 } }, [CHAIN.BASE]: { @@ -185,7 +193,7 @@ Object.keys(config).forEach((chain) => { await Promise.all(promiseArray) - return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools], blacklistedTokens: blacklistedTokens[chain]}) + return sumTokens2({ api, tokensAndOwners2: [allTokens, allPools], blacklistedTokens: blacklistedTokens[chain] }) } const borrowed = async (api) => { @@ -210,7 +218,7 @@ Object.keys(config).forEach((chain) => { api.addTokens(allTokens, balances) if (blacklistedTokens[chain]) { - blacklistedTokens[chain].forEach((token) => api.removeTokenBalance(token)) + blacklistedTokens[chain].forEach((token) => api.removeTokenBalance(token)) } } module.exports[chain] = { tvl, borrowed } diff --git a/projects/cleopatradao.js b/projects/cleopatradao.js index 78420920ca3c..a4105d10021d 100644 --- a/projects/cleopatradao.js +++ b/projects/cleopatradao.js @@ -13,5 +13,5 @@ const treasuryTokens = [ module.exports = { deadFrom: 1648765747, misrepresentedTokens: true, - ...ohmTvl(treasury, treasuryTokens, "avax", stakingContract, cat, undefined, undefined, false) + ...ohmTvl(treasury, treasuryTokens, "avax", stakingContract, cat) } diff --git a/projects/clip-finance/index.js b/projects/clip-finance/index.js index f52cb9124cc5..1da2b85271b0 100644 --- a/projects/clip-finance/index.js +++ b/projects/clip-finance/index.js @@ -6,6 +6,9 @@ const config = { }, linea: { vaultRegistry: "0x5A9B5E22be45d04c753863A916c4311f07bd4dF0", + clipTokenStaking: "0x8bbc8f21aabC8ecb5a566cE6013842E1F3c8fCC1", + clipToken: "0x4Ea77a86d6E70FfE8Bb947FC86D68a7F086f198a", + wClipToken: "0x54e4a172dbEaC5B239131a44B71C37113A8530F7", }, base: { vaultRegistry: "0x5A9B5E22be45d04c753863A916c4311f07bd4dF0", @@ -19,29 +22,36 @@ const VaultType = { Aero: 4, LynexAlgebra: 5, NileCl: 6, + ZeroLend: 7, + StargateFarming: 8, + UniswapV3: 9, }; const typesDataInterfaces = { any: ["uint256"], // has only vaultType amm: ["uint256", "address"], // vaultType, amm pool address + vaultBased: ["uint256", "address"], // vaultType, strategy address [VaultType.PancakeV3]: ["uint256", "address"], // vaultType, v3 pool address [VaultType.Stargate]: ["uint256"], // vaultType - [VaultType.MendiLending]: ["uint256", "address"], //vaultType, mendiLeverage address + [VaultType.MendiLending]: ["uint256", "address"], //vaultType, mendi strategy 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 + [VaultType.ZeroLend]: ["uint256", "address"], // vaultType, ZeroLend strategy address + [VaultType.StargateFarming]: ["uint256", "address"], // vaultType, Stargate strategy address + [VaultType.UniswapV3]: ["uint256", "address"], // vaultType, v3 pool address }; const tvl = async (api) => { const { vaultRegistry } = config[api.chain]; const vaultDatas = await api.call({ abi: abis.getVaults, target: vaultRegistry }); const decoder = ethers.AbiCoder.defaultAbiCoder(); - //for DefiLlama's reviewer: it is better to check vault type using vaultType instead of existence of certain - //function. We are not sure that we will not add the same function to other vault type. + // for DefiLlama's reviewer: it is better to check vault type using vaultType instead of existence of certain + // function. We are not sure that we will not add the same function to other vault type. const vaults = vaultDatas.map((i) => ({ ...i, vaultType: decoder.decode(typesDataInterfaces.any, i.data) })); - //ammVaults - const ammTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra, VaultType.NileCl]; + // ammVaults + const ammTypes = [VaultType.PancakeV3, VaultType.LynexAlgebra, VaultType.NileCl, VaultType.UniswapV3]; const ammVaults = vaults.filter((i) => ammTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault); const ammPools = vaults .filter((i) => ammTypes.includes(Number(i.vaultType.toString()))) @@ -56,20 +66,20 @@ const tvl = async (api) => { api.add(ammToken1s[i], pool.total1); }); - //Aerodrom Vaults - const aerodromVaults = vaults.filter((i) => i.vaultType == VaultType.Aero).map((i) => i.vault); - const tokenAs = await api.multiCall({ abi: "address:tokenA", calls: aerodromVaults }); + // Aerodrome Vaults + const aerodromeVaults = vaults.filter((i) => i.vaultType == VaultType.Aero).map((i) => i.vault); + const tokenAs = await api.multiCall({ abi: "address:tokenA", calls: aerodromeVaults }); - const tokenBs = await api.multiCall({ abi: "address:tokenB", calls: aerodromVaults }); - const farms = await api.multiCall({ abi: "address:farm", calls: aerodromVaults }); + const tokenBs = await api.multiCall({ abi: "address:tokenB", calls: aerodromeVaults }); + const farms = await api.multiCall({ abi: "address:farm", calls: aerodromeVaults }); - const lpTokens = await api.multiCall({ abi: "address:lpToken", calls: aerodromVaults }); + const lpTokens = await api.multiCall({ abi: "address:lpToken", calls: aerodromeVaults }); const liquidities = await api.multiCall({ abi: abis.balanceOf, calls: farms.map((vault, i) => ({ target: vault, - params: aerodromVaults[i], + params: aerodromeVaults[i], })), }); @@ -93,7 +103,7 @@ const tvl = async (api) => { abi: abis.balanceOf, calls: tokenAs.map((tokenA, i) => ({ target: tokenA, - params: aerodromVaults[i], + params: aerodromeVaults[i], })), }); @@ -101,22 +111,23 @@ const tvl = async (api) => { abi: abis.balanceOf, calls: tokenBs.map((tokenB, i) => ({ target: tokenB, - params: aerodromVaults[i], + params: aerodromeVaults[i], })), }); - aerodromVaults.forEach((_, i) => { + aerodromeVaults.forEach((_, i) => { if (lpTotalSupplies > 0) { api.add(tokenAs[i], Math.floor((liquidities[i] * lpBalanceAs[i]) / lpTotalSupplies[i] + tokenABalances[i])); api.add(tokenBs[i], Math.floor((liquidities[i] * lpBalanceBs[i]) / lpTotalSupplies[i] + tokenBBalances[i])); } }); - //Mendi Vaults - const mendiVaults = vaults.filter((i) => i.vaultType == VaultType.MendiLending).map((i) => i.vault); - const depositTokens = await api.multiCall({ abi: "address:depositToken", calls: mendiVaults }); - const TVLs = await api.multiCall({ abi: "uint256:TVL", calls: mendiVaults }); - mendiVaults.forEach((_, i) => { + // Vault Based Vaults + const vaultBasedTypes = [VaultType.MendiLending, VaultType.ZeroLend, VaultType.StargateFarming]; + const vaultBasedVaults = vaults.filter((i) => vaultBasedTypes.includes(Number(i.vaultType.toString()))).map((i) => i.vault); + const depositTokens = await api.multiCall({ abi: "address:depositToken", calls: vaultBasedVaults }); + const TVLs = await api.multiCall({ abi: "uint256:TVL", calls: vaultBasedVaults }); + vaultBasedVaults.forEach((_, i) => { api.add(depositTokens[i], TVLs[i]); }); @@ -133,15 +144,26 @@ module.exports = { }; Object.keys(config).forEach((chain) => { + const { clipTokenStaking, clipToken, wClipToken } = config[chain]; + module.exports[chain] = { tvl, }; + + if (clipTokenStaking && clipToken && wClipToken) + module.exports[chain].staking = async (api) => { + const totalStackedWClip = await api.call({ target: clipTokenStaking, abi: abis.getCumulativeStaked, params: wClipToken, }); + + // Add to TVL wCLIP (1 wCLIP = 1 CLIP always) staked in the Clip Token Staking contract + api.add(clipToken, totalStackedWClip); + } }); const abis = { - getTotalAmounts: "function getTotalAmounts() public view returns (uint256 total0, uint256 total1, uint128 liquidity)", + getTotalAmounts: "function getTotalAmounts() external view returns (uint256 total0, uint256 total1, uint128 liquidity)", depositToken: "address:depositToken", totalTokens: "uint256:totalTokens", getVaults: "function getVaults() view returns ((address vault, bytes data)[])", balanceOf: "function balanceOf(address) view returns (uint256)", + getCumulativeStaked: "function getCumulativeStaked(address stakedToken) external view returns (uint256)" }; diff --git a/projects/clipper/index.js b/projects/clipper/index.js index dff254e4ab70..1d5ea4ab6321 100644 --- a/projects/clipper/index.js +++ b/projects/clipper/index.js @@ -14,6 +14,6 @@ module.exports = { methodology: `Counts the tokens in pool address in different chains` }; -['ethereum', 'polygon', 'moonbeam', 'arbitrum', 'optimism', 'mantle', 'base'].forEach(chain => { +['ethereum', 'polygon', 'moonbeam', 'arbitrum', 'optimism', 'mantle', 'base', 'polygon_zkevm'].forEach(chain => { module.exports[chain] = { tvl } }) diff --git a/projects/clober-liquidity-vault/index.js b/projects/clober-liquidity-vault/index.js new file mode 100644 index 000000000000..0ceb589677d9 --- /dev/null +++ b/projects/clober-liquidity-vault/index.js @@ -0,0 +1,32 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const abi = { + openEvent: 'event Open(bytes32 indexed key, uint192 indexed bookIdA, uint192 indexed bookIdB, bytes32 salt, address strategy)', + getBookKey: "function getBookKey(uint192 id) view returns ((address base, uint64 unitSize, address quote, uint24 makerPolicy, address hooks, uint24 takerPolicy))", + getLiquidity: "function getLiquidity(bytes32 key) view returns ((uint256 reserve, uint256 claimable, uint256 cancelable) liquidityA, (uint256 reserve, uint256 claimable, uint256 cancelable) liquidityB)", +} + +const config = { + base: { + rebalancer: '0x13f2Ff6Cc952f4181D6c316426e9CbdA957c6482', + bookManager: '0x382CCccbD3b142D7DA063bF68cd0c89634767F76', + fromBlock: 21715410, + }, +} + +async function tvl(api) { + const { rebalancer, bookManager, fromBlock } = config[api.chain] + const logs = await getLogs2({ api, factory: rebalancer, eventAbi: abi.openEvent, fromBlock, extraKey: 'open-bookid' }) + const bookIds = logs.map(i => [i.bookIdA, i.bookIdB]).flat() + const res = await api.multiCall({ abi: abi.getBookKey, calls: bookIds, target: bookManager }) + const tokens = res.map(i => [i.base, i.quote]).flat() + return api.sumTokens({ owners: [rebalancer,], tokens }) +} + +module.exports = { + methodology: "TVL includes all assets deposited into the Clober Liquidity Vault contract, specifically allocated for liquidity provision and market-making within the Clober ecosystem", +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/clober-v2/index.js b/projects/clober-v2/index.js index 84fd0a858615..d704c67ef2ff 100644 --- a/projects/clober-v2/index.js +++ b/projects/clober-v2/index.js @@ -11,7 +11,7 @@ const config = { async function tvl(api) { const { factory, fromBlock } = config[api.chain] - const logs = await getLogs2({ api, factory, eventAbi: abi.openEvent, fromBlock, }) + const logs = await getLogs2({ api, factory, eventAbi: abi.openEvent, fromBlock, extraKey: 'open-address', }) const tokens = logs.map(({ base, quote }) => [base, quote]).flat() return api.sumTokens({ owner: factory, tokens, }) } diff --git a/projects/cmdao-gameswap/index.js b/projects/cmdao-gameswap/index.js index 3e280724b4c5..315e900272b4 100644 --- a/projects/cmdao-gameswap/index.js +++ b/projects/cmdao-gameswap/index.js @@ -1,11 +1,18 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unknownTokens'); +const { pool2 } = require("../helper/pool2"); module.exports = { jbc: { - tvl: sumTokensExport({ - owner: '0x280608DD7712a5675041b95d0000B9089903B569', - tokens: [ADDRESSES.jbc.JUSDT], - }), + tvl: sumTokensExport({ + owner: '0x280608DD7712a5675041b95d0000B9089903B569', + tokens: [ADDRESSES.jbc.JUSDT], + }), + }, + optimism: { + pool2: pool2('0x51f97e67b2ff5ed064dc2b27b7a745e0d4c47ee0', ['0xA41F70B283b8f097112ca3Bb63cB2718EE662e49']), + }, + bitkub: { + pool2: pool2('0xe5B764566CB5b26fE7568e59370368ACf9c7c5c3', ['0x5Cced24E580586841f326d5088D288e6Ddd201dA']), } }; diff --git a/projects/coconuts-finance/index.js b/projects/coconuts-finance/index.js index 69fd9c5358ac..be0cd1a2116c 100644 --- a/projects/coconuts-finance/index.js +++ b/projects/coconuts-finance/index.js @@ -2,5 +2,5 @@ module.exports = { avax: { tvl: () => ({}) }, - broken: 'Api is down' + deadFrom: '2022-04-27', }; diff --git a/projects/coffeefi/index.js b/projects/coffeefi/index.js index 84400df1dab4..a8da5aeff62f 100644 --- a/projects/coffeefi/index.js +++ b/projects/coffeefi/index.js @@ -11,6 +11,6 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { - tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, hasStablePools: true, fetchBalances: true, }) + tvl: getUniTVL({ factory: config[chain], useDefaultCoreAssets: true, hasStablePools: true, }) } }) \ No newline at end of file diff --git a/projects/coffin-meme/index.js b/projects/coffin-meme/index.js new file mode 100644 index 000000000000..8011665f059c --- /dev/null +++ b/projects/coffin-meme/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require('../helper/coreAssets.json') + +const coffinScAddr = "EQBozwKVDya9IL3Kw4mR5AQph4yo15EuMdyX8nLljeaUxrpM" + +module.exports = { + methodology: 'Counts Coffin.Meme smartcontract TON & jettons balance as TVL.', + ton: { + tvl: sumTokensExport({ owner: coffinScAddr, tokens: [ADDRESSES.null], }), + } +} \ No newline at end of file diff --git a/projects/coincollect/index.js b/projects/coincollect/index.js index a2f458f0902a..f750ac0d35ed 100644 --- a/projects/coincollect/index.js +++ b/projects/coincollect/index.js @@ -1,4 +1,3 @@ -const { staking } = require("../helper/staking"); const { getUniTVL, sumTokensExport } = require('../helper/unknownTokens') const MasterChefContract = "0x46A928F2386b8c38cdde028a32c5b7aa19F40445"; @@ -7,9 +6,8 @@ const COLLECT = "0x56633733fc8BAf9f730AD2b6b9956Ae22c6d4148"; module.exports = { methodology: `Uses factory(0x2bc17223A99B6e2857796a5F64A1ED91067b5657) address to count liquidity in pools as TVL.`, misrepresentedTokens: true, - incentivized: true, polygon: { - tvl: getUniTVL({ factory: '0x2bc17223A99B6e2857796a5F64A1ED91067b5657', useDefaultCoreAssets: true, fetchBalances: true }), + tvl: getUniTVL({ factory: '0x2bc17223A99B6e2857796a5F64A1ED91067b5657', useDefaultCoreAssets: true, }), staking: sumTokensExport({owner: MasterChefContract, tokens: [COLLECT], lps: ['0x0cCc84b6506003487AEC687085e82C2f912E607B'], useDefaultCoreAssets: true, }), } }; diff --git a/projects/coindcx/index.js b/projects/coindcx/index.js index c690caf2634b..84a9a41485ef 100644 --- a/projects/coindcx/index.js +++ b/projects/coindcx/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -55,32 +56,7 @@ const config = { ] }, bitcoin: { - owners: [ - '12hGEyxk4zMLquxiMiFrkvYSohsXz2D3uZ', - 'bc1qz22hegkllltcydg3pz3an6h352mjmyp7n2vhd9', - '1MzSJodjNmACPKyj9VUv9X55Pby87osLhc', - 'bc1qucl4n347qc6e48w85xdxcv86sm3an8fr250hhm', - '1F6CrpEnHEZh6gQtJ7cf1MtK7Y8GYKoP4i', - 'bc1qn2xm6agnanuyuwfcfw92el7nvt2lpsqr5s5c0w', - '17mxRZ9WeXigSwg3Cm62HxeATnuUphMxGL', - 'bc1qffg4ya27430vv5ymg2lhf4mj7tvtc3ur5qyyq3', - '1JV3umtGC6H6tFUVoFyV5KwbJDscUwrtX7', - 'bc1qhlyrdhfqry06nj902p9dxdftm4pxkhdqeum8y8', - '1KXxS6QnzpB8mSLm5kmXJXqvZF7wVvQDCw', - 'bc1qedxsgzuj8ga644gwlqw4nw7f3xncq4g2rskmzu', - '12T8i8tpeczk5JGf8ppZf1w6SFBRwEa9y4', - 'bc1qpl5kqjkugyncr72a4fhxvm0360ehfdl27e00ja', - '1PRwacjHVksLNTkSYNkiWkRgTm1yDSgLMG', - 'bc1q7c9ylgjsyc0yaxwm84jjh6avfajzfe7dhk6e0e', - '1477uXZ1NfUaaZZdnztQ7h8ftGRpuWQPfA', - 'bc1qygg2x02cfy0e6r7798v4qrcjjkzm8tl5t0xkwf', - 'bc1qljm7vwdgdy6ca97stsyjyl3zdjtkdsdm8vnh8f', - 'bc1qqhwh3tcg5duwq7hdlnlr5n2tg2uq755cwmkjqn', - 'bc1qqe4g7sjxzk90nsgj0mwufwcdtd7kufg7k32xch', - '1avi3SkWKGLis8dGCP9JUnFfVeheP8wkt', - 'bc1qmulc2ju4kykj24xuw0fu73h9h3usa897xhaucz', // - '3Dm2TL1pt1VzeBCq9jgvQG81QPv19PyReh' - ] + owners: bitcoinAddressBook.coindcx }, tron: { owners: [ diff --git a/projects/coinex/index.js b/projects/coinex/index.js index 93d7b69dd29d..cf53e8ec9299 100644 --- a/projects/coinex/index.js +++ b/projects/coinex/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -15,25 +16,7 @@ const config = { ], }, bitcoin: { - owners: [ - '189myj1KAbiCWfqWhT6Td4noANKBuag3QN', - '1C2Pxf3ghtKyM4mKC3xSLKrN33YcKnKF2a', - '1JZw5HYSoAEfvGGVQ4U2JihZaQkjcXrr2i', - '16M3n9p6CLATDnpsJNTjCn22AaxzErxg5V', - '15cYMF4jcRwpcbjENMdMizCzAmd7Pc51So', - '18JQXgQ4GjZAuYCy1fNAFGHVEAWUui2q9h', - '1LGbUy11yMaNC9s73q7vEad8JTZyczCima', - '1DGXwH2gzBYM6UrVE57DaaQ3hJJm3s32YK', - '152GodsXfK5kYMdH4spzYD3Ttm1u2oNipN', - '18oxoXCq5mah3GjLjGCS3BRTQxxN7738rL', - '1H21g458T25SnAzvFDJiBrcyhfwHiCH5YF', - '14BhR6aE8Fkt2c8E1m2ydx76fBz5kpt62K', - '1Ef59jZsv87uAcwBZdDhNxiSbCceQ6bFTA', - '14ukjw4r3UFC5A8yvG7yt2GdvLUHEWtskS', - '141TDnaiLEW1vE5xd42Dw8HEhDCA2qrZTr', - '1Ew9SPwBHY8GjHd3uBxhtGcvVmyBN7PHcw', - '1LYrQCjUf54vf9G4qwFpJQ9RCyL2DprPqQ', - ] + owners: bitcoinAddressBook.coinex }, tron: { owners: [ @@ -41,6 +24,11 @@ const config = { 'TFp4V3S9JqJyQAMMCewyn4aAaLueJwzS7H', ] }, + starknet: { + owners: [ + '0x00fb108ed29e1b5d82bb61a39a15bbab410543818bf7df9be3c0f5dd0d612cf3' + ] + }, } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/coinsquare/index.js b/projects/coinsquare/index.js index e38efba56dfd..88fcfa8e05d9 100644 --- a/projects/coinsquare/index.js +++ b/projects/coinsquare/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -29,18 +30,7 @@ const config = { ], }, bitcoin: { - owners: [ - '1P7cDFGeWm6ezez6XGXTAjvm8qcsGiMXe7', - 'bc1q0k5rpdwf7wnq3fuk7dfjqd59p3ke7ufqmlkfp4', - 'bc1qdstretw2uvhjen7hvgaya3nsjgr430x9jhqf4a', - 'bc1qez6ezccleuac4dnj5cpexz5mz3j0j3j655j6qn', - 'bc1qg6a9kpmge0fdwtrymjvq3cydfzgpcge7e05e7z', - 'bc1qg8fywv20ztsp0edtf53zpsnxeu5cqxrmdwmtjd', - 'bc1qm5mqpgtt2ufucfdvhu5xcdgs3vzehwu62wsyqy', - 'bc1qmkkejzrq7ayfjpy7w8gmkhd3uwcy7nryr5apch', - 'bc1qsjc50kf72r4q44ac28v3vrukaxjg4w30rh0cmm', - 'bc1qyz9mssutu8xxcgjvsucz38qvxt7hxwtnm5eh8k', - ] + owners: bitcoinAddressBook.coinsquare }, avax: { owners: ['0x14AA1AD09664c33679aE5689d93085B8F7c84bd3'] diff --git a/projects/coinw/index.js b/projects/coinw/index.js index 56de3cda3482..408e75fdde6e 100644 --- a/projects/coinw/index.js +++ b/projects/coinw/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -13,10 +14,7 @@ const config = { ], }, bitcoin: { - owners: [ - '14Z9KSmCo1UjvBiXj2j9er35GmGmaFxsmE', - '1KYBKqRjGbRynSiyoiHndULssXrEeWhvU8', - ] + owners: bitcoinAddressBook.coinw }, tron: { owners: [ diff --git a/projects/colend/index.js b/projects/colend/index.js index 527766840418..e8f8e3d6462a 100644 --- a/projects/colend/index.js +++ b/projects/colend/index.js @@ -1,7 +1,13 @@ const { aaveExports } = require("../helper/aave"); +const { mergeExports } = require("../helper/utils"); const methodologies = require("../helper/methodologies"); -module.exports = { + +module.exports = mergeExports([{ methodology: methodologies.lendingMarket, +//Main core: aaveExports('core', '0xC3F120f418f9541263eA3F4a5a4120eb3f28EfA1', undefined, ['0x567AF83d912C85c7a66d093e41D92676fA9076E3'], { v3: true, }), -}; +}, { +//LstBTC + core: aaveExports('core', '0x71B2C1Dda32E4c35f02301dC611043F46CC8108f', undefined, ['0x8E43DF2503c69b090D385E36032814c73b746e3d'], { v3: true, }), +}]) diff --git a/projects/colony/index.js b/projects/colony/index.js index 77d1808fa02b..3bc233767bdd 100644 --- a/projects/colony/index.js +++ b/projects/colony/index.js @@ -29,7 +29,6 @@ function _tvl() { const colonyDexTVL = getUniTVL({ factory: colonyDexFactory, - fetchBalances: true, useDefaultCoreAssets: true }) @@ -56,6 +55,7 @@ module.exports = { hallmarks: [ [1651241728, "Staking V2 Launch"], [1711370069, "Staking V3 Launch"], - [1715688000, "EarlyStage Launch"] + [1715688000, "EarlyStage Launch"], + [1719792000, "Liquid Vesting DEX Launch"] ], }; diff --git a/projects/commodo/index.js b/projects/commodo/index.js index 35064931579d..c706a1ed9a9c 100644 --- a/projects/commodo/index.js +++ b/projects/commodo/index.js @@ -43,6 +43,7 @@ async function getData() { module.exports = { + deadFrom: "2024-09-17", timetravel: false, comdex: { tvl: async () => transformBalances('comdex', (await getData()).tvl), diff --git a/projects/commonwealth/index.js b/projects/commonwealth/index.js new file mode 100644 index 000000000000..df1f9ba06348 --- /dev/null +++ b/projects/commonwealth/index.js @@ -0,0 +1,26 @@ +const { staking } = require('../helper/staking'); + +const TREASURY = [ + '0xdE70B8BC5215BdF03f839BB8cD0F639D4E3E2881', + '0xA205fD6A798A9Ba8b107A00b8A6a5Af742d6aCb5', + '0x990eCdf73704f9114Ee28710D171132b5Cfdc6f0', + '0xa653879692D4D0e6b6E0847ceDd58eAD2F1CC136' +] + + +const CONTRACTS = [ + '0xf4aa59f5192856f41ae19caab4929ccd3a265e70', // staked + '0x7519461fbd96abb539c770d57f38c2e91f8262aa', + '0xd7e31990883250e53314b15ee555345f04d011e8', + '0x87412c03979cc19c60071f5f98313a7cbe9f6d65', // rewards + +]; + +const WLTH = '0x99b2B1A2aDB02B38222ADcD057783D7e5D1FCC7D'; + +module.exports = { + base: { + tvl: () => ({}), + staking: staking(CONTRACTS, WLTH) + } +}; diff --git a/projects/composable/index.js b/projects/composable/index.js index 46e9157045a9..a3629501f193 100644 --- a/projects/composable/index.js +++ b/projects/composable/index.js @@ -1,53 +1,39 @@ const ADDRESSES = require('../helper/coreAssets.json') const { chainExports } = require('../helper/exports') -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') const networks = { - 'ethereum': ['0xef4439f0fae7db0b5ce88c155fc6af50f1b38728', [ - ADDRESSES.ethereum.USDC, //usdc - ADDRESSES.ethereum.WETH, // eth - '0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf', // tricrypto - ]], - 'arbitrum': ['0xEba8C2Bf0d1C9413543188fc42D7323690AED051', [ - ADDRESSES.arbitrum.USDC, //usdc - ADDRESSES.arbitrum.WETH //eth - ]], - 'polygon': ['0xcd8e7322dc2659b1ec447e5d52fdd9c67e8c3c01', [ - ADDRESSES.polygon.USDC, //usdc - ADDRESSES.polygon.WETH_1 //eth - ]] + 'ethereum': ['0xef4439f0fae7db0b5ce88c155fc6af50f1b38728', [ + ADDRESSES.ethereum.USDC, //usdc + ADDRESSES.ethereum.WETH, // eth + '0xca3d75ac011bf5ad07a98d02f18225f9bd9a6bdf', // tricrypto + ]], + 'arbitrum': ['0xEba8C2Bf0d1C9413543188fc42D7323690AED051', [ + ADDRESSES.arbitrum.USDC, //usdc + ADDRESSES.arbitrum.WETH //eth + ]], + 'polygon': ['0xcd8e7322dc2659b1ec447e5d52fdd9c67e8c3c01', [ + ADDRESSES.polygon.USDC, //usdc + ADDRESSES.polygon.WETH_1 //eth + ]] } const abi = { - token: "address:token", - totalToken: "uint256:totalToken", + token: "address:token", + totalToken: "uint256:totalToken", } const rugPools = ['0x4a03ea61e543ec7141a3f90128b0c0c9514f8737', '0xf12da8470e2643ccb39a157e8577d9aa586a488f', '0x1941441d31809e9E1828Da0cE6d44175F657E215'] function chainTvl(chain) { - return async (_time, ethBlock, chainBlocks) => { - const balances = {} - const [owner, tokens] = networks[chain] - await sumTokensAndLPsSharedOwners(balances, tokens.map(t => [t, false]), [owner], chainBlocks[chain], chain, addr => `${chain}:${addr}`) - if (chain === "ethereum") { - for (const pool of rugPools) { - const token = await sdk.api.abi.call({ - target: pool, - abi: abi.token, - block: ethBlock - }) - const bal = await sdk.api.abi.call({ - target: pool, - abi: abi.totalToken, - block: ethBlock - }) - sdk.util.sumSingleBalance(balances, token.output, bal.output) - } - } - return balances + return async (api) => { + const [owner, tokens] = networks[chain] + await api.sumTokens({ owner, tokens }) + if (chain === "ethereum") { + const tokens = await api.multiCall({ abi: abi.token, calls: rugPools }) + const balances = await api.multiCall({ abi: abi.totalToken, calls: rugPools }) + api.add(tokens, balances) } + } } module.exports = chainExports(chainTvl, Object.keys(networks)) \ No newline at end of file diff --git a/projects/compound-onchain/index.js b/projects/compound-onchain/index.js index 50130ca42f05..bc62fe4e4d40 100644 --- a/projects/compound-onchain/index.js +++ b/projects/compound-onchain/index.js @@ -1,143 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') - -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const BigNumber = require('bignumber.js'); -const { lendingMarket } = require('../helper/methodologies') - -// cache some data -const markets = [ - { - underlying: ADDRESSES.ethereum.BAT, - symbol: 'BAT', - decimals: 18, - cToken: '0x6C8c6b02E7b2BE14d4fA6022Dfd6d75921D90E4E', - }, - { - underlying: ADDRESSES.ethereum.DAI, - symbol: 'DAI', - decimals: 18, - cToken: '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', - }, - { - underlying: ADDRESSES.ethereum.WETH, - symbol: 'WETH', - decimals: 18, - cToken: '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', - }, //cETH => WETH - { - underlying: '0x1985365e9f78359a9B6AD760e32412f4a445E862', - symbol: 'REP', - decimals: 18, - cToken: '0x158079Ee67Fce2f58472A96584A73C7Ab9AC95c1', - }, - { - underlying: ADDRESSES.ethereum.USDC, - symbol: 'USDC', - decimals: 6, - cToken: '0x39AA39c021dfbaE8faC545936693aC917d5E7563', - }, - { - underlying: ADDRESSES.ethereum.USDT, - symbol: 'USDT', - decimals: 6, - cToken: '0xf650C3d88D12dB855b8bf7D11Be6C55A4e07dCC9', - }, - { - underlying: ADDRESSES.ethereum.WBTC, - symbol: 'WBTC', - decimals: 8, - cToken: '0xC11b1268C1A384e55C48c2391d8d480264A3A7F4',//cWBTC - legacy - }, - { - underlying: '0xE41d2489571d322189246DaFA5ebDe1F4699F498', - symbol: 'ZRX', - decimals: 18, - cToken: '0xB3319f5D18Bc0D84dD1b4825Dcde5d5f7266d407', - }, - { - underlying: ADDRESSES.ethereum.SAI, - symbol: 'SAI', - decimals: 18, - cToken: '0xF5DCe57282A584D2746FaF1593d3121Fcac444dC', - }, -]; - -// ask comptroller for all markets array -async function getAllCTokens(block) { - return (await sdk.api.abi.call({ - block, - target: '0x3d9819210a31b4961b30ef54be2aed79b9c9cd3b', - params: [], - abi: abi['getAllMarkets'], - })).output; -} - -const CTOKEN_WETH = '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'.toLowerCase() - -// returns {[underlying]: {cToken, decimals, symbol}} -async function getMarkets(block) { - if (block < 10271924) { - // the allMarkets getter was only added in this block. - return markets; - } else { - const markets = [{ - cToken: CTOKEN_WETH, - underlying: ADDRESSES.ethereum.WETH, //cETH => WETH - }] - - const allCTokens = await getAllCTokens(block) - const calls = allCTokens.filter(i => i.toLowerCase() !== CTOKEN_WETH).map(i => ({ target: i })) - const { output } = await sdk.api.abi.multiCall({ - abi: abi['underlying'], calls, block, - }) - output.forEach(({ input: { target: cToken }, output: underlying}) => markets.push({ cToken, underlying, })) - return markets; - } -} - -async function v2Tvl(balances, block, borrowed) { - let markets = await getMarkets(block); - - // Get V2 tokens locked - let v2Locked = await sdk.api.abi.multiCall({ - block, - calls: markets.map((market) => ({ - target: market.cToken, - })), - abi: borrowed ? abi.totalBorrows : abi['getCash'], - }); - - markets.forEach((market) => { - let getCash = v2Locked.output.find((result) => result.input.target === market.cToken); - balances[market.underlying] = BigNumber(balances[market.underlying] || 0) - .plus(getCash.output) - .toFixed(); - }); - return balances; -} - -async function borrowed(timestamp, block) { - const balances = {}; - await v2Tvl(balances, block, true) - return balances -} - -async function tvl(timestamp, block) { - let balances = {}; - - await v2Tvl(balances, block, false) - return balances; -} +const { lendingMarket } = require('../helper/methodologies'); +const { compoundExports2 } = require('../helper/compound'); module.exports = { hallmarks: [ [1632873600, "Comptroller vulnerability exploit"], [1592226000, "COMP distribution begins"] ], - ethereum: { - tvl, - borrowed - }, + ethereum: compoundExports2({ comptroller: '0x3d9819210A31b4961b30EF54bE2aeD79B9c9Cd3B', cether: '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5' }), 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, then we get the price of each token from coingecko.`, }; diff --git a/projects/compound-v1/index.js b/projects/compound-v1/index.js index f42bbd12eb6f..dfbe6c48b177 100644 --- a/projects/compound-v1/index.js +++ b/projects/compound-v1/index.js @@ -1,59 +1,21 @@ const v1abi = require('./v1Abi.json'); -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); const v1Contract = '0x3FDA67f7583380E67ef93072294a7fAc882FD7E7' -async function v1Tvl(balances, block, borrowed) { - const marketsLength = await sdk.api.abi.call({ - target: v1Contract, - block, - abi: v1abi.getCollateralMarketsLength - }); - const underlyings = await sdk.api.abi.multiCall({ - calls: Array(Number(marketsLength.output)).fill().map((n, i) => ({ - target: v1Contract, - params: [i] - })), - block, - abi: v1abi.collateralMarkets - }); - const markets = await sdk.api.abi.multiCall({ - calls: underlyings.output.map(m => ({ - target: v1Contract, - params: [m.output] - })), - block, - abi: v1abi.markets - }); - markets.output.forEach(m => { - const token = m.input.params[0] - let amount - if (borrowed) { - amount = m.output.totalBorrows - } else { - amount = BigNumber(m.output.totalSupply).minus(m.output.totalBorrows).toFixed(0) - } - sdk.util.sumSingleBalance(balances, token, amount) - }) +async function tvl(api) { + const tokens = await api.fetchList({ lengthAbi: v1abi.getCollateralMarketsLength, itemAbi: v1abi.collateralMarkets, target: v1Contract }) + return api.sumTokens({ owner: v1Contract, tokens }) } -async function borrowed(timestamp, block) { - const balances = {}; - await v1Tvl(balances, block, true) - return balances -} - -async function tvl(timestamp, block) { - let balances = {}; - - await v1Tvl(balances, block, false) - return balances; +async function borrowed(api) { + const tokens = await api.fetchList({ lengthAbi: v1abi.getCollateralMarketsLength, itemAbi: v1abi.collateralMarkets, target: v1Contract }) + const markets = await api.multiCall({ abi: v1abi.markets, calls: tokens, target: v1Contract }) + const bals = markets.map(m => m.totalBorrows) + api.add(tokens, bals) } module.exports = { - ethereum: { - tvl, - borrowed - }, + ethereum: { + tvl, + borrowed + }, }; - \ No newline at end of file diff --git a/projects/compound-v3/index.js b/projects/compound-v3/index.js index dae13fed8eb2..0d4ca453e27a 100644 --- a/projects/compound-v3/index.js +++ b/projects/compound-v3/index.js @@ -6,6 +6,8 @@ module.exports = compoundV3Exports({ '0xc3d688B66703497DAA19211EEdff47f25384cdc3', // USDC Market '0xa17581a9e3356d9a858b789d68b4d866e593ae94', // ETH Market '0x3Afdc9BCA9213A35503b077a6072F3D0d5AB0840', // USDT Market + '0x3D0bb1ccaB520A66e607822fC55BC921738fAFE3', // wstETH Market + '0x5D409e56D886231aDAf00c8775665AD0f9897b56', // USDS Market ], }, arbitrum: { @@ -13,20 +15,21 @@ module.exports = compoundV3Exports({ '0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA', // USDC.e Market '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDC Market '0x6f7D514bbD4aFf3BcD1140B7344b32f063dEe486', // WETH Market - '0x5C58d4479A1E9b2d19EE052143FA73F0ee79A36e', // USDT Market + '0xd98Be00b5D27fc98112BdE293e487f8D4cA57d07', // USDT Market ], }, polygon: { markets: [ '0xF25212E676D1F7F89Cd72fFEe66158f541246445', // USDC.e Market '0xaeB318360f27748Acb200CE616E389A6C9409a07', // USDT Market - ], + ], }, base: { markets: [ '0x9c4ec768c28520B50860ea7a15bd7213a9fF58bf', // USDbC Market '0x46e6b214b524310239732D51387075E0e70970bf', // ETH Market '0xb125E6687d4313864e53df431d5425969c15Eb2F', // USDC Market + '0x784efeB622244d2348d4F2522f8860B96fbEcE89', // AERO Market ], }, scroll: { diff --git a/projects/concentrator/index.js b/projects/concentrator/index.js index 10500adb5595..1a89013741f8 100644 --- a/projects/concentrator/index.js +++ b/projects/concentrator/index.js @@ -22,6 +22,8 @@ const aladdinCVXAddress = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777"; const arUSDAddress = "0x549716F858aefF9CB845d4C78c67A7599B0Df240"; const arUSD4626Address = "0x07D1718fF05a8C53C8F05aDAEd57C0d672945f9a"; const rUSDAddress = "0x65D72AA8DA931F047169112fcf34f52DbaAE7D18"; +const aFXNAddress = "0x00Bac667a4cCf9089aB1Db978238C555C4349545"; +const fxnAddress = ADDRESSES.ethereum.FXN; const concentratorNewVault = "0x3Cf54F3A1969be9916DAD548f3C084331C4450b5"; const concentratorAfxsVault = "0xD6E3BB7b1D6Fa75A71d48CFB10096d59ABbf99E1"; @@ -81,6 +83,7 @@ async function tvl(api) { getAsdCRVInfo(balances, block), getAladdinCVXInfo(balances, block), getAladdinRUSDInfo(balances, block), + getAladdinFXNInfo(balances, block), getVaultInfo("old", balances, block), getVaultInfo("New", balances, block), getVaultInfo("afxs", balances, block), @@ -268,6 +271,22 @@ async function getAladdinRUSDInfo(balances, block) { ); } +async function getAladdinFXNInfo(balances, block) { + const aladdinFXNTotalUnderlying = ( + await sdk.api.abi.call({ + target: aFXNAddress, + block, + abi: AladdinAFXSABI.totalAssets, + }) + ).output; + sdk.util.sumSingleBalance( + balances, + fxnAddress, + aladdinFXNTotalUnderlying, + chain + ); +} + module.exports = { doublecounted: true, ethereum: { diff --git a/projects/config/cover/cover.js b/projects/config/cover/cover.js deleted file mode 100644 index 06f0adefe8e9..000000000000 --- a/projects/config/cover/cover.js +++ /dev/null @@ -1,14 +0,0 @@ -let abis = {}; - -abis.cover = { - getProtocolDetails: "function getProtocolDetails() view returns (bytes32 _name, bool _active, uint256 _claimNonce, uint256 _claimRedeemDelay, uint256 _noclaimRedeemDelay, address[] _collaterals, uint48[] _expirationTimestamps, address[] _allCovers, address[] _allActiveCovers)", -} - -abis.protocols = { - getAllProtocolAddresses: "address[]:getAllProtocolAddresses", -} - -module.exports = { - abis -} - diff --git a/projects/config/defisaver/abis.js b/projects/config/defisaver/abis.js deleted file mode 100644 index 3415032db2d6..000000000000 --- a/projects/config/defisaver/abis.js +++ /dev/null @@ -1,70 +0,0 @@ -module.exports = { - "CompoundSubscriptions": { - "abi": { - getSubscribers: "function getSubscribers() view returns (tuple(address user, uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, bool boostEnabled)[])", - }, - "networks": { - "1": { - "createdBlock": 8335635, - "address": "0x52015effd577e08f498a0ccc11905925d58d6207" - } - } - }, - "CompoundLoanInfo": { - "abi": { - getLoanDataArr: "function getLoanDataArr(address[] _users) view returns (tuple(address user, uint128 ratio, address[] collAddr, address[] borrowAddr, uint256[] collAmounts, uint256[] borrowAmounts)[] loans)", - }, - "networks": { - "1": { - "createdBlock": 8335635, - "address": "0xb1f40b5109bba75c27a302c4e5d2afc30d5d1f30" - } - } - }, - "McdSubscriptions": { - "abi":{ - getSubscribers: "function getSubscribers() view returns (tuple(uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, address owner, uint256 cdpId, bool boostEnabled, bool nextPriceEnabled)[])", - }, - "networks": { - "1": { - "createdBlock": 8335635, - "address": "0xC45d4f6B6bf41b6EdAA58B01c4298B8d9078269a" - } - } - }, - "MCDSaverProxy": { - "abi": { - getCdpDetailedInfo: "function getCdpDetailedInfo(uint256 _cdpId) view returns (uint256 collateral, uint256 debt, uint256 price, bytes32 ilk)", - }, - "networks": { - "42": { - "createdBlock": 14500373, - "address": "0xDbfdfDBcA9f796Bf955B8B4EB2b46dBb51CaE30B" - }, - "1": { - "createdBlock": 8928152, - "address": "0x260C1543743FD03cD98a1d1eDC3A4724af0A1Fce" - } - } - }, - "AaveSubscriptionsV2": { - "abi": { - getSubscribers: "function getSubscribers() view returns (tuple(address user, uint128 minRatio, uint128 maxRatio, uint128 optimalRatioBoost, uint128 optimalRatioRepay, bool boostEnabled)[])", - }, - "networks": { - "1": { - "address": "0x6B25043BF08182d8e86056C6548847aF607cd7CD" - } - } - }, - "AaveLoanInfoV2": { - "abi": { - getLoanDataArr: "function getLoanDataArr(address _market, address[] _users) view returns (tuple(address user, uint128 ratio, address[] collAddr, address[] borrowAddr, uint256[] collAmounts, uint256[] borrowStableAmounts, uint256[] borrowVariableAmounts)[] loans)", - }, - "networks": { - "1": { - "address": "0xd0C9ADDABbA270493A6503e74E62794435c8F1D3" - } - } - }, -} diff --git a/projects/config/hakka/abi.json b/projects/config/hakka/abi.json deleted file mode 100644 index d68cc38951d5..000000000000 --- a/projects/config/hakka/abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "balanceOf": "function balanceOf(address account) view returns (uint256)", - "totalSupply": "uint256:totalSupply", - "pancakeUserInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt)", - "alpacaUserInfo": "function userInfo(uint256, address) view returns (uint256 amount, uint256 rewardDebt, uint256 bonusDebt, address fundedBy)", - "beltUserInfo": "function userInfo(uint256, address) view returns (uint256 shares, uint256 rewardDebt)" -} \ No newline at end of file diff --git a/projects/config/hodltree/addresses.js b/projects/config/hodltree/addresses.js deleted file mode 100644 index f366254dfaff..000000000000 --- a/projects/config/hodltree/addresses.js +++ /dev/null @@ -1,158 +0,0 @@ -const ADDRESSES = require('../../helper/coreAssets.json') -const { - dexType, - flashloan, - lendBorrow, - em -} = require('./types.js'); - -/** - * @typedef {Object} ContractDef - * @property {String} contractType - * @property {String} address - * @property {Object} miscInfo - */ - -/** - * @typedef {Object} Dex - * @property {String} dexType - * @property {ContractDef[]} contracts - */ - -/** - * @typedef {Dex[]} NetworkDex - */ - -/** - * @type {NetworkDex} - */ -const eth = [ - { - dexType: dexType.lendBorrow, - contracts: [{ - contractType: lendBorrow.lender, - address: '0xb3e1912fa5d9d219da8c65cda407cc998849428b', - miscInfo: { - tokenIn: ADDRESSES.ethereum.WETH - } - }, { - contractType: lendBorrow.borrower, - address: '0x8ac9425260b6da02db07da7980b09525ebf3b6a0', - miscInfo: { - tokenIn: '0xBcca60bB61934080951369a648Fb03DF4F96263C' - } - }, { - contractType: lendBorrow.borrower, - address: '0x45d5a790da3bfa305efca81eac652678ae3a90a6', - miscInfo: { - tokenIn: '0x028171bCA77440897B824Ca71D1c56caC55b68A3' - } - }] - }, - { - dexType: dexType.flashloan, - contracts: [{ - contractType: flashloan.lp, - address: '0x2e5a08c26cb22109e585784c4f99363bb3e199ab', - miscInfo: { - tokensIn: [ - ADDRESSES.ethereum.sUSD, - '0x056Fd409E1d7A124BD7017459dFEa2F387b6d5Cd', - ADDRESSES.ethereum.USDC, - ADDRESSES.ethereum.DAI, - ADDRESSES.ethereum.TUSD - ] - } - }] - }, - { - dexType: dexType.em, - contracts: [{ - contractType: em.ep, - address: '0x95142849d31eaa20b5b9ab746dff27ff400ce6bf', - miscInfo: { - token: '0x28e598846febb750effc384853fbce82988eaaa2' - } - }, { - contractType: em.rp, - address: '0xce596bf99d21e46fa91143c03d7a356682b67859', - miscInfo: { - token: ADDRESSES.ethereum.sUSD - } - }, { - contractType: em.vps, - address: '0xb7ead8c418f3d03bc22dd538c22600abe7209e72', - miscInfo: { - token: ADDRESSES.ethereum.sUSD - } - }, - - { - contractType: em.ep, - address: '0x78E52d69fA8e0F036fFEF0BcDc4C289DB0DF63E2', - miscInfo: { - token: '0xba100000625a3754423978a60c9317c58a424e3D' - } - }, { - contractType: em.rp, - address: '0x87B46E49681E08E3adDF8A90F6a1fb5183079033', - miscInfo: { - token: ADDRESSES.ethereum.USDC - } - }, { - contractType: em.vps, - address: '0xcB72e764Ab46535aAD13cbF55b1F06cB15347A95', - miscInfo: { - token: ADDRESSES.ethereum.USDC - } - }] - } -] - -/** - * @type {NetworkDex} - */ -const polygon = [ - { - dexType: dexType.lendBorrow, - contracts: [{ - contractType: lendBorrow.lender, - address: '0x2F35d311fd2F0b0dA65FA268B86831279FB4fd98', - miscInfo: { - tokenIn: ADDRESSES.polygon.WMATIC_2 - } - }, { - contractType: lendBorrow.borrower, - address: '0xbfb5215aD157Cd6C8B22494dC54Ff4B74bA18C09', - miscInfo: { - tokenIn: '0x1a13f4ca1d028320a707d99520abfefca3998b7f' - } - }, { - contractType: lendBorrow.borrower, - address: '0x0Cf91744D15684b91E6705e56f6dC820647B3067', - miscInfo: { - tokenIn: '0x27f8d03b3a2196956ed754badc28d73be8830a6e' - } - }] - }, - { - dexType: dexType.flashloan, - contracts: [{ - contractType: flashloan.lp, - address: '0xCAFDa65B1031535F1766C6b1E3b5efF5520c7C0f', - miscInfo: { - tokensIn: [ - ADDRESSES.polygon.USDC, - ADDRESSES.polygon.DAI, - ADDRESSES.polygon.USDT - ] - } - }] - } -] - - -module.exports = { - eth, - polygon -} \ No newline at end of file diff --git a/projects/config/hodltree/index.js b/projects/config/hodltree/index.js deleted file mode 100644 index b5f9eb53e714..000000000000 --- a/projects/config/hodltree/index.js +++ /dev/null @@ -1,8 +0,0 @@ -const { eth, polygon } = require("./addresses"); -const dexTypes = require('./types'); - -module.exports = { - ethContracts: eth, - polygonContracts: polygon, - dexTypes -} \ No newline at end of file diff --git a/projects/config/hodltree/types.js b/projects/config/hodltree/types.js deleted file mode 100644 index b31869e5f1c4..000000000000 --- a/projects/config/hodltree/types.js +++ /dev/null @@ -1,28 +0,0 @@ -const dexType = { - lendBorrow: 'lendBorrow', - flashloan: 'flashloan', - em: 'em' -} - -const lendBorrow = { - lender: 'lender', - borrower: 'borrower' -} - -const flashloan = { - lp: 'liquidityPool' -} - -const em = { - ep: 'elasticPool', - vp: 'volatilePool', - vps: 'volatilePoolStorage', - rp: 'reservePool' -} - -module.exports = { - dexType, - lendBorrow, - flashloan, - em -} \ No newline at end of file diff --git a/projects/config/keys.js b/projects/config/keys.js deleted file mode 100644 index 9d5be2d3bd2d..000000000000 --- a/projects/config/keys.js +++ /dev/null @@ -1,61 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -let keys = - { - - [ADDRESSES.ethereum.LINK]: 'chainlink', - [ADDRESSES.ethereum.WBTC]: 'bitcoin', - [ADDRESSES.ethereum.AAVE]: 'aave', - [ADDRESSES.ethereum.USDC]: 'stable', - [ADDRESSES.ethereum.TUSD]: 'stable', - [ADDRESSES.ethereum.YFI]: 'yearn-finance', - '0x408e41876cccdc0f92210600ef50372656052a38': 'republic-protocol', //ren - '0x80fB784B7eD66730e8b1DBd9820aFD29931aab03': 'ethlend', //lend - [ADDRESSES.ethereum.BUSD]: 'stable', - [ADDRESSES.ethereum.USDT]: 'stable', - [ADDRESSES.ethereum.DAI]: 'stable', - [ADDRESSES.ethereum.MKR]: 'maker', - [ADDRESSES.ethereum.SNX]: 'havven', - '0x0f5d2fb29fb7d3cfee444a200298f468908cc942': 'decentraland', //MANA - [ADDRESSES.ethereum.UNI]: 'uniswap', - '0xdd974d5c2e2928dea5f71b9825b8b646686bd200': 'kyber-network', //knc - '0xf629cbd94d3791c9250152bd8dfbdf380e2a3b9c': 'enjincoin', //ENJ - [ADDRESSES.ethereum.BAT]: 'basic-attention-token', - [ADDRESSES.ethereum.sUSD]: 'stable', - '0xe41d2489571d322189246dafa5ebde1f4699f498': '0x', //0x - [ADDRESSES.ethereum.CRV]: 'curve-dao-token', - '0xc00e94cb662c3520282e6f5717214004a7f26888': 'compound-governance-token', - '0x04fa0d235c4abf4bcf4787af4cf447de572ef828': 'uma', - '0xd26114cd6ee289accf82350c8d8487fedb8a0c07': 'omisego', - [ADDRESSES.ethereum.SAI]: 'sai', - [ADDRESSES.ethereum.WETH]: 'ethereum', - '0x5d3a536e4d6dbd6114cc1ead35777bab948e3643': 'cdai', - '0xbc396689893d065f41bc2c6ecbee5e0085233447': 'perpetual-protocol', - '0x92e187a03b6cd19cb6af293ba17f2745fd2357d5': 'unit-protocol-duck', - '0x2ba592f78db6436527729929aaf6c908497cb200': 'cream', - '0x0ae055097c6d159879521c384f1d2123d1f195e6': 'xdai-stake', - '0x1ceb5cb57c4d4e2b2433641b95dd330a33185a44': 'keep3rv1', - [ADDRESSES.ethereum.FTM]: 'fantom', - [ADDRESSES.ethereum.SUSHI]: 'sushi', - '0x4688a8b1f292fdab17e9a90c8bc379dc1dbd8713': 'cover-protocol', - '0x3472a5a71965499acd81997a54bba8d852c6e53d': 'badger-dao', - '0xa3bed4e1c75d00fa6f4e5e6922db7261b5e9acd2': 'meta', - '0xca1207647ff814039530d7d35df0e1dd2e91fa84': 'dhedge-dao', - '0x1b40183efb4dd766f11bda7a7c3ad8982e998421': 'vesper-finance', - '0x5f64ab1544d28732f0a24f4713c2c8ec0da089f0': 'dextf', - '0x903bef1736cddf2a537176cf3c64579c3867a881': 'ichi-farm', - '0xaac41ec512808d64625576eddd580e7ea40ef8b2': 'gameswap-org', - '0x7240ac91f01233baaf8b064248e80feaa5912ba3': 'octofi', - '0x8798249c2e607446efb7ad49ec89dd1865ff4272': 'xsushi', - '0xb753428af26e81097e7fd17f40c88aaa3e04902c': 'saffron-finance', - '0xc944e90c64b2c07662a292be6244bdf05cda44a7': 'the-graph', - '0xc5bddf9843308380375a611c18b50fb9341f502a': 'vecrv-dao-yvault', - '0x1337def16f9b486faed0293eb623dc8395dfe46a': 'armor', - '0xd291e7a03283640fdc51b121ac401383a46cc623': 'rari-governance-token', - '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d': 'bitcoin', //renbtc - '0xe1406825186D63980fd6e2eC61888f7B91C4bAe4': 'strudel-finance', // vBTC - } - - -module.exports = { - keys -} diff --git a/projects/config/mantra-dao/contracts/lp-staking-contracts.js b/projects/config/mantra-dao/contracts/lp-staking-contracts.js deleted file mode 100644 index 9b9e96e592af..000000000000 --- a/projects/config/mantra-dao/contracts/lp-staking-contracts.js +++ /dev/null @@ -1,197 +0,0 @@ -const ADDRESSES = require('../../../helper/coreAssets.json') -const lpStakingAssetsETH = [ - // LABS-ETH UNI LP simple staking - { - contract: "0x5f81a986611C600a3656d9adc202283186C6121D", - pairAddress: "0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", - token1: "0x2D9FD51E896Ff0352Cb6D697D13D04C2CB85CA83", - price1: "labs-group", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // LABS-ETH UNI LP staking with exit tollbooth - { - contract: "0xfc8e3b55897d8cef791451bbe69b204b9c58fc8a", - pairAddress: "0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", - token1: "0x2D9FD51E896Ff0352Cb6D697D13D04C2CB85CA83", - price1: "labs-group", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // MANTRA DAO OM-ETH LP staking - { - contract: "0x91fe14df53eae3a87e310ec6edcdd2d775e1a23f", - pairAddress: "0xe46935ae80e05cdebd4a4008b6ccaa36d2845370", - token1: "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", - price1: "mantra-dao", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // ROYA-ETH LP staking - { - contract: "0x55e0F2cE66Fa8C86ef478fa47bA0bE978eFC2647", - pairAddress: "0x6d9d2427cfa49e39b4667c4c3f627e56ae586f37", - token1: "0x4Cd4c0eEDb2bC21f4e280d0Fe4C45B17430F94A9", - price1: "royale", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // BITE-ETH LP staking - { - contract: "0xb12f0CbcC89457d44323139e6Bb0526Fd82f12F2", - pairAddress: "0x1f07f8e712659087914b96db4d6f6e4fee32285e", - token1: "0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", - price1: "dragonbite", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // BITE-ETH LP staking w/ tollbooth - { - contract: "0x18Ba986ED3128fc7E3E86a09E902436e900a899c", - pairAddress: "0x1f07f8e712659087914b96db4d6f6e4fee32285e", - token1: "0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", - price1: "dragonbite", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // BBANK-ETH LP staking - { - contract: "0x6406788d1CD4fdD823ef607A924c00a4244a841d", - pairAddress: "0x2a182e532a379cb2c7f1b34ce3f76f3f7d3596f7", - token1: ADDRESSES.ethereum.WETH, - price1: "weth", - token2: "0xf4b5470523ccd314c6b9da041076e7d79e0df267", - price2: "blockbank", - }, - // RAZE-ETH LP staking - { - contract: "0xe2a80A76B084B51CFAe5B2C3e0FF5232e0408201", - pairAddress: "0x4fc47579ecf6aa76677ee142b6b75faf9eeafba8", - token1: "0x5eaa69b29f99c84fe5de8200340b4e9b4ab38eac", - price1: "raze-network", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, - // BCUBE-ETH LP staking - { - contract: "0xFF964d0bf9f81c401932A6B975EAE54129712eE5", - pairAddress: "0xc62bf2c79f34ff24e2f97982af4f064161ed8949", - token1: "0x93c9175e26f57d2888c7df8b470c9eea5c0b0a93", - price1: "b-cube-ai", - token2: ADDRESSES.ethereum.WETH, - price2: "weth", - }, -]; - -// BSC LP Staking -const lpStakingAssetsBSC = [ - // FINE-BNB LP staking - { - contract: "0xF25897a7EDf1Dfa9C65f5DB7Ec4Bad868873805B", - pairAddress: "0xC309a6d2F1537922E06f15aA2eb21CaA1b2eEDb6", - token1: "0x4e6415a5727ea08aae4580057187923aec331227", - price1: "refinable", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // OM-BNB LP staking - { - contract: "0xcbf42ace1dbd895ffdcabc1b841488542626014d", - pairAddress: "0x49837a48abde7c525bdc86d9acba39f739cbe22c", - token1: ADDRESSES.bsc.WBNB, - price1: "wbnb", - token2: "0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", - price2: "mantra-dao", - }, - // CBD-BNB LP staking - { - contract: "0x92fCe8AfFB2A68d418BaDF8E360E0CDe06c39356", - pairAddress: "0x0b49580278b403ca13055bf4d81b6b7aa85fd8b9", - token1: "0x0e2b41ea957624a314108cc4e33703e9d78f4b3c", - price1: "greenheart-cbd", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // BBANK-BNB LP staking - { - contract: "0x1E8BC897bf03ebac570Df7e5526561f8a42eCe05", - pairAddress: "0x538e61bd3258304e9970f4f2db37a217f60436e1", - token1: ADDRESSES.bsc.WBNB, - price1: "wbnb", - token2: "0xf4b5470523ccd314c6b9da041076e7d79e0df267", - price2: "blockbank", - }, - // BONDLY-BNB LP staking - { - contract: "0xD862866599CA681c492492E1B7B9aB80066f2FaC", - pairAddress: "0xb8b4383b49d451bbea63bc4421466e1086da6f18", - token1: "0x96058f8c3e16576d9bd68766f3836d9a33158f89", - price1: "bondly", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // MIST-BNB LP staking - { - contract: "0x4F905f75F5576228eD2D0EA508Fb0c32a0696090", - pairAddress: "0x5a26eb7c9c72140d01039eb172dcb8ec98d071bd", - token1: "0x68e374f856bf25468d365e539b700b648bf94b67", - price1: "mist", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // ROSN-BNB LP staking - { - contract: "0x5B4463bBD7B2E870601e91161e0F1F7f84CDE214", - pairAddress: "0x5548bd47293171d3bc1621edccd953bcc9b814cb", - token1: "0x651Cd665bD558175A956fb3D72206eA08Eb3dF5b", - price1: "roseon-finance", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // MLT-BNB LP staking - { - contract: "0x398a5FEE22E0dEb67dA1bD15FA4841b6Aa64c471", - pairAddress: "0x560b96f81a2190ff6ac84ebfd17788bab3679cbc", - token1: "0x4518231a8fdf6ac553b9bbd51bbb86825b583263", - price1: "media-licensing-token", - token2: ADDRESSES.bsc.WBNB, - price2: "wbnb", - }, - // L3P-BNB LP staking - { - contract: "0x3ba3E2f3cACcDbE3C56D3046FFe859cc9deE08a0", - pairAddress: "0xB62c57Bda4C126E21A726e3D28734bfb1151231e", - token1: ADDRESSES.bsc.WBNB, - price1: "wbnb", - token2: "0xdeF1da03061DDd2A5Ef6c59220C135dec623116d", - price2: "lepricon", - }, -]; - -// POLYGON LP Staking -const lpStakingAssetsPOLYGON = [ - // OM-WETH LP staking - { - contract: "0xCBf42Ace1dBD895FFDCaBC1b841488542626014d", - pairAddress: "0xff2bbcb399ad50bbd06debadd47d290933ae1038", - token1: ADDRESSES.polygon.WETH_1, - price1: "weth", - token2: "0xC3Ec80343D2bae2F8E680FDADDe7C17E71E114ea", - price2: "mantra-dao", - }, - // GAMER-WETH LP staking - { - contract: "0x11c70CAA910647d820bD014d676Dcd97EDD64A99", - pairAddress: "0x1dF661fC4319415a2f990bd5F49D5cA70EFDee1C", - token1: "0x3f6b3595ecF70735D3f48D69b09C4E4506DB3F47", - price1: "gamestation", - token2: ADDRESSES.polygon.WETH_1, - price2: "weth", - }, -]; - -module.exports = { - lpStakingAssetsETH, - lpStakingAssetsBSC, - lpStakingAssetsPOLYGON, -}; diff --git a/projects/config/mantra-dao/contracts/naked-staking-contracts.js b/projects/config/mantra-dao/contracts/naked-staking-contracts.js deleted file mode 100644 index 5afba0c79e90..000000000000 --- a/projects/config/mantra-dao/contracts/naked-staking-contracts.js +++ /dev/null @@ -1,134 +0,0 @@ -const stakingAssetsETH = [ - // sOM POOL 1 - Staked OM - { - contract: "0x9E15Ad979919bB4db331Bfe864475Ae3BFFebA93", - token: "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", - price: "mantra-dao", - }, - // sOM POOL 2 - Staked OM - { - contract: "0xa01892d97e9c8290c2c225fb0b756bfe26bc9802", - token: "0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", - price: "mantra-dao", - }, - // RFUEL Pool 2 - Staked RFUEL - { - contract: "0x456DF576962289256A92290C9E48EE116B8Cb413", - token: "0xaf9f549774ecedbd0966c52f250acc548d3f36e5", - price: "rio-defi", - }, - // L3P - Staked Lepricon - { - contract: "0xdbc34d084393ed8d7b750FfCCea5A139EC7b9349", - token: "0xdef1da03061ddd2a5ef6c59220c135dec623116d", - price: "lepricon", - }, - // ROYA - Staked royale - { - contract: "0x4Cd4c0eEDb2bC21f4e280d0Fe4C45B17430F94A9", - token: "0x7eaF9C89037e4814DC0d9952Ac7F888C784548DB", - price: "royale", - }, - // Finxflo - Staked Finxflo - { - contract: "0x6BcDC61A7A6d86f7b7B66d461b7eF7fa268571a0", - token: "0x8a40c222996f9F3431f63Bf80244C36822060f12", - price: "finxflo", - }, - // PKF - Staked Polkafoundry - { - contract: "0x1dfdb0fb85402dc7f8d72d92ada8fbbb3ffc8633", - token: "0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", - price: "polkafoundry", - }, - // RAZE - Staked Raze - { - contract: "0x2d0ea72db9f9a63f4b185eab1ca74137d808ebfa", - token: "0x5eaa69b29f99c84fe5de8200340b4e9b4ab38eac", - price: "raze-network", - }, - // KYL - Staked KYL - { - contract: "0x6ae05b5db520011bf76645ebb4d6a697e5b3774b", - token: "0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c", - price: "kylin-network", - }, - // LABS Pool 1 - Staked LABS - { - contract: "0x6f0db359309CAD297D2e7952a4F5f081bDC1e373", - token: "0x8b0e42f366ba502d787bb134478adfae966c8798", - price: "labs-group", - }, - // LABS Pool 2 - Staked LABS - { - contract: "0xb96e42c0de658ca26048b0e200f9a1e05ad89e0f", - token: "0x8b0E42F366bA502d787BB134478aDfAE966C8798", - price: "labs-group", - }, - // BONDLY staking - { - contract: "0x39621A555554A7FF77F2b64185c53E04C90cD540", - token: "0xd2dda223b2617cb616c1580db421e4cfae6a8a85", - price: "bondly", - }, - // BITE staking - { - contract: "0xa571309B1267676568Bf9f155606a08790896Fe2", - token: "0x4eED0fa8dE12D5a86517f214C2f11586Ba2ED88D", - price: "dragonbite", - }, - // BCUBE staking - { - contract: "0xb19b94d53D362CDfC7360C951a85ca2c1d5400BA", - token: "0x93C9175E26F57d2888c7Df8B470C9eeA5C0b0A93", - price: "b-cube-ai", - }, -]; - -const stakingAssetsBSC = [ - // ROSN staking - { - contract: "0x7dd79e93dba1d677574d0b5e99721f2e4b45e297", - token: "0x651cd665bd558175a956fb3d72206ea08eb3df5b", - price: "roseon-finance", - }, - // BONDLY staking - { - contract: "0x004c0908518e19aa8b27a55c171564097fa3c354", - token: "0x96058f8c3e16576d9bd68766f3836d9a33158f89", - price: "bondly", - }, - // MLT staking - { - contract: "0xF0185520Cc773502f0f208433ca178f2f57157A9", - token: "0x4518231a8fdf6ac553b9bbd51bbb86825b583263", - price: "media-licensing-token", - }, - // OM staking - { - contract: "0xEfc2d65302eb6345A7C0e212B791e0d45C2C3c91", - token: "0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", - price: "mantra-dao", - }, -]; - -const stakingAssetsPOLYGON = [ - // OM staking - { - contract: "0xCdD0f77A2A158B0C7cFe38d00443E9A4731d6ea6", - token: "0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", - price: "mantra-dao", - }, - // GAMER staking - { - contract: "0xd1ecDC553651daB068486d9c4d066eCDC614416e", - token: "0x3f6b3595ecf70735d3f48d69b09c4e4506db3f47", - price: "gamestation", - }, -]; - -module.exports = { - stakingAssetsETH, - stakingAssetsBSC, - stakingAssetsPOLYGON, -}; diff --git a/projects/config/onx/avalanche/vaults.js b/projects/config/onx/avalanche/vaults.js deleted file mode 100644 index 8440ae3433ee..000000000000 --- a/projects/config/onx/avalanche/vaults.js +++ /dev/null @@ -1,47 +0,0 @@ - -const vaults = [ - //usdcAvax - ['0xa389f9430876455c36478deea9769b7ca4e3ddb1', '0x8025d4deDa0C7512d44438a7DC597612B4108F07'], - //wethAvax - ['0xfe15c2695f1f920da45c30aae47d11de51007af9', '0xf7AcA362510b327bDAca693611353b6a837cBDB2'], - //avaxUsdte - ['0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', '0x897Fb124aCdF5A685d9258645ffee0058464817A'], - //joeAvax [not available] - ['0x454e67025631c065d3cfad6d71e6892f74487a15', '0x02e9bc3EF29A3f51EdE6e4c4F70fdcb894CD6Cf5'], - //wBtcAvax - ['0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa', '0x8922E41342C6160fAf4dC40f2c1fCFCd94E98779'], - //linkAvax - ['0x6f3a0c89f611ef5dc9d96650324ac633d02265d3', '0x55F42961b3aD4E2A08f1780C7434dd8EC5f7FcE4'], - //joeUsdce - ['0x67926d973cd8ee876ad210faaf7dffa99e414acf', '0xD9F63Cc588822cD3eF802D900808E946d13CE609'], - //bnbAvax - ['0xeb8eb6300c53c3addbb7382ff6c6fbc4165b0742', '0x4decafaCD4591e52f85e8FE69F82F2400176BB33'], - //joeUsdte - ['0x1643de2efb8e35374d796297a9f95f64c082a8ce', '0xfD127Bc3b6153b043fFD8d7f38272593700b124c'], - // //spellAvax [not available] - ['0x62cf16bf2bc053e7102e2ac1dee5029b94008d99', '0x9eE877279DFE8e5F20614db88e50CD72B4efDEAD'], - // //xavaAvax [not available] - ['0x72c3438cf1c915ecf5d9f17a6ed346b273d5bf71', '0x54720637Fa477eD87Cd06F674247a649A5168eB6'], - //linkeUsdce - ['0xb9f425bc9af072a91c423e31e9eb7e04f226b39d', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], - //wethUsdce - ['0x199fb78019a08af2cb6a078409d0c8233eba8a0c', '0x2C858E3181988f2E4458f14768aE204E5BF2Ee0e'], - //pefiAvax [not available] - ['0xb78c8238bd907c42be45aebdb4a8c8a5d7b49755', '0x276F74C24Cc4443Ecb4967Db77572BE50aeD4117'], - //wbtceAvax - ['0x62475f52add016a06b398aa3b2c2f2e540d36859', '0x008E6bf114D686713dC233487e360A158433e519'], - //aaveAvax - ['0xc3e6d9f7a3a5e3e223356383c7c055ee3f26a34f', '0xE7c34e1946A10a3A28BEd4B0Cb5B7F0d85F5368D'], - //qiAvax - ['0x2774516897ac629ad3ed9dcac7e375dda78412b9', '0x0240269d999301d03aAe390104584F7517f52ECd'], - // //avaxBoo [not available] - ['0xebf50b8089a0c5e7c5de23f644fcd723818f65b3', '0xB4a805Ad532BB92501507C9eAc27FD0BAe4d68A1'], - // //maiAvax [not available] - ['0x23ddca8de11eccd8000263f008a92e10dc1f21e8', '0x2071fD6779B701aa71c4a48b8f37970160e5FE75'], - // //h20Avax [not available] - ['0x9615a11eaa912eae869e9c1097df263fc3e105f3', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], -] - -module.exports = { - vaults, -} \ No newline at end of file diff --git a/projects/config/onx/constant.js b/projects/config/onx/constant.js deleted file mode 100644 index 49f50ba4e5b2..000000000000 --- a/projects/config/onx/constant.js +++ /dev/null @@ -1,23 +0,0 @@ -const tokenAddresses = { - onx: "0xe0ad1806fd3e7edf6ff52fdb822432e847411033", - sOnx: "0xa99f0ad2a539b2867fcfea47f7e71f240940b47c", - onxFarm: "0x168f8469ac17dd39cd9a2c2ead647f814a488ce9", - onxTripleFarm: "0x30D1A19EA928cCf46634cBC2944D2D89Be636f22", - onxWethSushiPair: "0x62f22A47e5D2F8b71cC44fD85863753618312f67", - pool: "0x47F3E6C1Ef0cBe69502167095b592e61de108BaA", - aethToken: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", - onsToken: "0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD", - oneVault: "0x3BdF1977d87EDAD8e0617efCEa958F6d43A4C30E", - onePools: [ - '0x54c532E367031F56c401C6024aC4ABEfF2b03534', - '0xbc2346C3c7F3998A12A1c8E7Be44734EcC832763', - '0xe64796FCc97c33A2193Ba60f013F3fA5D4712d56', - '0xe659fA84e0C687760245046BA63329d44320997c', - '0x19Eb6536777713aCdAcA8dd9A3AD9843D74E9E3b', - '0x1B72255a11DF705Bb598E670830E03A19F2D242f', - '0x7058EE5467edef417746aab0B8cabbbE36eF1798', - '0x9792eE4c36a622a8CF9566b037c57519A9fe8a56', - ] -}; - -module.exports = tokenAddresses; diff --git a/projects/config/onx/ethereum/index.js b/projects/config/onx/ethereum/index.js deleted file mode 100644 index 64d49959e7e4..000000000000 --- a/projects/config/onx/ethereum/index.js +++ /dev/null @@ -1,61 +0,0 @@ -const tokenAddresses = require('../constant'); -const { vaults } = require('./vaults'); -const { staking } = require('../../../helper/staking') -const ADDRESSES = require('../../../helper/coreAssets.json') - -const getEthereumStaking = staking(tokenAddresses.sOnx, tokenAddresses.onx) - -const getEthereumBorrows = async (api) => { - api.add(ADDRESSES.null, await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalBorrow' })) -} - -async function getEthereumPoolTvl(api) { - const pools = ['0xAdb6d1cB866a52C5E8C1e79Ff8e0559c12F4D7a3'] - const tokens = ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f'] - const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) - api.addTokens(tokens, bals) - return api.sumTokens({ owners: [tokenAddresses.onxFarm, tokenAddresses.onxTripleFarm], tokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) -} - -async function ethTvl(api) { - await Promise.all([addFarmTvl, addOnePoolTvl, addVaultTvl, addOneVaultTvl, ethStakeTvl ].map(i => i())) - - async function ethStakeTvl() { - let totalStake = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalStake' }) - let totalBorrow = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalPledge' }) - api.add(ADDRESSES.null, totalStake - totalBorrow) - } - - - async function addVaultTvl() { - const pools = vaults.map(i => i[1]) - const tokens = vaults.map(i => i[0]) - const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) - api.addTokens(tokens, bals) - } - - async function addFarmTvl() { - const farm = '0x168f8469ac17dd39cd9a2c2ead647f814a488ce9' - const pools = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address token, uint256,uint256,uint256)', target: farm }) - return api.sumTokens({ owner: farm, tokens: pools.map(i => i.token), blacklistedTokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) - } - async function addOnePoolTvl() { - const pools = tokenAddresses.onePools - const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: pools }) - return api.sumTokens({ tokensAndOwners2: [tokens, pools] }) - } - - async function addOneVaultTvl() { - const vault = tokenAddresses.oneVault - const aETH = await api.call({ abi: 'address:aEth', target: vault }) - const aETHb = await api.call({ abi: 'address:aETHb', target: vault }) - return api.sumTokens({ tokens: [aETH, aETHb], owner: vault }) - } -} - -module.exports = { - getEthereumStaking, - getEthereumPoolTvl, - getEthereumBorrows, - ethTvl, -} diff --git a/projects/config/onx/ethereum/vaults.js b/projects/config/onx/ethereum/vaults.js deleted file mode 100644 index e4523e5deb09..000000000000 --- a/projects/config/onx/ethereum/vaults.js +++ /dev/null @@ -1,24 +0,0 @@ -const vaults = [ - ['0xceff51756c56ceffca006cd410b03ffc46dd3a58', '0x2abCe7c4C77e215fcCc189E02Fc5D2A30b52a06a'], - ['0x397ff1542f962076d0bfe58ea045ffa2d347aca0', '0x637c871C559ade45b37074fCF3B8081Ec81c55FC'], - ['0x06da0fd433c1a5d7a4faa01111c044910a184553', '0xeAaE5CEfce1092eb3eA1DA7622B3cF4fb20B8b81'], - - ['0x795065dcc9f64b5614c407a6efdc400da6221fb0', '0xdC6f222c4504C43225a89b84E3aae15Ad0DFDF0F'], - ['0x36e2fcccc59e5747ff63a03ea2e5c0c2c14911e7', '0x10A8dc3C0Db7BDFE1Db36d113c2685e60daaFEb8'], - ['0xfa5bc40c3bd5afa8bc2fe6b84562fee16fb2df5f', '0x6901Aac9813f3EfAae32F44E9b579f08A12707AD'], - ['0x1241f4a348162d99379a23e73926cf0bfcbf131e', '0x121eF4eEc2bb4D5eD91347166F02c0763af1C49A'], - ['0x088ee5007c98a9677165d78dd2109ae4a3d04d0c', '0x431b1F5356EcAc2D86b2313907B747B16D11066f'], - - ['0xc3d03e4f041fd4cd388c549ee2a29a9e5075882f', '0x5EA1b54C522f279ecC0182d9b35229d6435D42b7'], - ['0xd75ea151a61d06868e31f8988d28dfe5e9df57b4', '0x9DB4AFCABdB25C89424c88e720dD47D6be43BdBe'], - ['0xc40d16476380e4037e6b1a2594caf6a6cc8da967', '0xbd3a37e3690ad4e145c39983D0Aaf8bd5f5e2F29'], - ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], - ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], - - ['0xba13afecda9beb75de5c56bbaf696b880a5a50dd', '0x659217CdA99658AeBA399B4a79FB03D96B3c46bC'], - ['0xf55c33d94150d93c2cfb833bcca30be388b14964', '0xcedB7921013A012c5538C0d2925a90AA817Bef4D'], -] - -module.exports = { - vaults, -} \ No newline at end of file diff --git a/projects/config/onx/fantom/vaults.js b/projects/config/onx/fantom/vaults.js deleted file mode 100644 index 73cfd84fb0e4..000000000000 --- a/projects/config/onx/fantom/vaults.js +++ /dev/null @@ -1,42 +0,0 @@ -const vaults = [ - //xBoo - ['0x841fad6eae12c286d1fd18d1d525dffa75c7effe', '0x95d0d6A7D75A5b086d2823C38F6Dd80a50fD0d93',], - //BooFtm - ['0xec7178f4c41f346b2721907f5cf7628e388a7a58', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], - //UsdcFtm - ['0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], - //fUsdtFtm - ['0x5965E53aa80a0bcF1CD6dbDd72e6A9b2AA047410', '0xC033338F7605B1555b1d3FC2a3626b2b76a0E042'], - //DaiFtm - ['0xe120ffBDA0d14f3Bb6d6053E90E63c572A66a428', '0xf1Ba3EF65262ee4058462E65A3A09a7571193400'], - //btc - ['0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3', '0x0f16CBDaF6c8115cDde59876cF232903E95D488A'], - //eth - ['0xf0702249F4D3A25cD3DED7859a165693685Ab577', '0x7396241a8a45E6252A2b5bBB571CBdfF599E16F1'], - //link - ['0x89d9bC2F2d091CfBFc31e333D6Dc555dDBc2fd29', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], - //aave - ['0xeBF374bB21D83Cf010cC7363918776aDF6FF2BF6', '0xE663F7d6AFB3A3Ef458D5c4a068E29368a46Eb87'], - //sushi - ['0xf84E313B36E86315af7a06ff26C8b20e9EB443C3', '0x32B750721Ad93f62b21402526354d53ac46953C2'], - //crv - ['0xB471Ac6eF617e952b84C6a9fF5de65A9da96C93B', '0x424B1AE0AF693d4577dde25081E970cb656013C7'], - //bnb - ['0x956DE13EA0FA5b577E4097Be837BF4aC80005820', '0x1fA1B8D94B922e3C9821f66363a75237c36096af'], - //any - ['0x5c021D9cfaD40aaFC57786b409A9ce571de375b4', '0xE41718b549B935358A2f62acbD289F3dcccABB18'], - //mim - ['0x6f86e65b255c9111109d2D2325ca2dFc82456efc', '0xfB271303B157d2e3d91CF86C7956eb46180d62E5'], - //yfi - ['0x0845c0bFe75691B1e21b24351aAc581a7FB6b7Df', '0x4CddFEf40f13F16520b7f98f269f772560A8fb9a'], - //btcEth - ['0xEc454EdA10accdD66209C57aF8C12924556F3aBD', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], - //spell - ['0x78f82c16992932EfDd18d93f889141CcF326DBc2', '0x4aFa2C780d0d2b139886A532d1D1959f4D316ee7'], - //joe - ['0xd518737Ff601c2A7C67F55EbbEb0a4e3fF5C0C35', '0xbE0093F744287Ea0478cc75c6320043a8b79E845'], -] - -module.exports = { - vaults, -} \ No newline at end of file diff --git a/projects/config/onx/polygon/vaults.js b/projects/config/onx/polygon/vaults.js deleted file mode 100644 index 1da4897cb8db..000000000000 --- a/projects/config/onx/polygon/vaults.js +++ /dev/null @@ -1,46 +0,0 @@ -const vaults = [ - //dualMaticUsdc - ['0x6e7a5fafcec6bb1e78bae2a1f0b612012bf14827', '0x36D14424Cc5a18893e93A0f8FdD42DC40562887E'], - //dualMaticEth - ['0xadbf1854e5883eb8aa7baf50705338739e558e5b', '0xfe51dE20719d05152Ace63a069446Bb5C89511DB'], - //dualMaticUsdt - ['0x604229c960e5cacf2aaeac8be68ac07ba9df81c3', '0x067E7586Eb8733bF108167C15cBAbee4c629C37A'], - //dualMaticQuick - ['0x019ba0325f1988213d448b3472fa1cf8d07618d7', '0x849031F78970639F8Dc9Dc3E962e0d0079D1051c'], - //EthUsdc - ['0x853ee4b2a13f8a742d64c8f088be7ba2131f670d', '0x185A1cfdb7173b224d08E61F1Cb21Fd5Fd6ee8CD'], - //wBtcEth - ['0xdc9232e2df177d7a12fdff6ecbab114e2231198d', '0xf1ba3ef65262ee4058462e65a3a09a7571193400'], - //ethUsdt - ['0xf6422b997c7f54d1c6a6e103bcb1499eea0a7046', '0x353856185fBB65a098b971B6d492CC3c245D9a59'], - //quickEth - ['0x1bd06b96dd42ada85fdd0795f3b4a79db914add5', '0x9767218525A443AE1B04A2a84Cf2f6D646C2fA06'], - //aaveEth - ['0x90bc3e68ba8393a3bf2d79309365089975341a43', '0xbB760a23924a23e5270c659349c753d16e7C1078'], - //ethDai - ['0x4a35582a710e1f4b2030a3f826da20bfb6703c09', '0x0d553115D2c1E2b734d66De1Eba4BAe1a88cB175'], - //wbtcUsdc - ['0xf6a637525402643b0654a54bead2cb9a83c8b498', '0x248Eecc8286A8C6484B4A87e1F32f0bc2d7971D4'], - //linkEth - ['0x5ca6ca6c3709e1e6cfe74a50cf6b2b6ba2dadd67', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], - //usdcQuick - ['0x1f1e4c845183ef6d50e9609f16f6f9cae43bc9cb', '0x7E9dA60002dAF64778C78Ac90dD5bdc9391acb00'], - //usdcUsdt - ['0x2cf7252e74036d1da831d11089d326296e64a728', '0x1a130be9a0E9046936E5461D3e8727b6aF7d0C2C'], - //avaxMatic - ['0xeb477ae74774b697b5d515ef8ca09e24fee413b5', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], - //solMatic - ['0x898386dd8756779a4ba4f1462891b92dd76b78ef', '0x0A1EfAF7dd833F9D8EF9f2f095bf1d6C725FF110'], - //bnbUsdc - ['0x40a5df3e37152d4daf279e0450289af76472b02e', '0x43bE6849BC355735D77238AcfDBcEB7bE8673f02'], - //ftmMatic - ['0xd2b61a42d3790533fedc2829951a65120624034a', '0xF020de990036D5aE107860592Bde0E53892F1531'], - //daiUsdc - ['0xf04adbf75cdfc5ed26eea4bbbb991db002036bdd', '0x260e6fB68C787CdA2E9ea104f9e3a3923E4119f6'], - //daiUsdt - ['0x59153f27eefe07e5ece4f9304ebba1da6f53ca88', '0x32B750721Ad93f62b21402526354d53ac46953C2'], -] - -module.exports = { - vaults, -} \ No newline at end of file diff --git a/projects/config/onx/vault.js b/projects/config/onx/vault.js deleted file mode 100644 index 5d08d27fe2df..000000000000 --- a/projects/config/onx/vault.js +++ /dev/null @@ -1,13 +0,0 @@ -const EXCHANGE_TYPE = { - SUSHISWAP: 'SUSHISWAP', - AVALANCHE: 'AVALANCHE', - UNISWAP: 'UNISWAP', - QUICKSWAP: 'QUICKSWAP', - QUICKSWAP_DUAL_MATIC: 'QUICKSWAP_DUAL_MATIC', - SPOOKYSWAP: 'SPOOKYSWAP', - SPOOKYSWAP_SINGLE: 'SPOOKYSWAP_SINGLE', -} - -module.exports = { - EXCHANGE_TYPE, -} \ No newline at end of file diff --git a/projects/config/piedao/abi/IPie.json b/projects/config/piedao/abi/IPie.json deleted file mode 100644 index 3df655fc4d9d..000000000000 --- a/projects/config/piedao/abi/IPie.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "totalSupply": "uint256:totalSupply", - "calcTokensForAmount": "function calcTokensForAmount(uint256 _amount) view returns (address[] tokens, uint256[] amounts)" -} \ No newline at end of file diff --git a/projects/config/piedao/abi/IStakingAll.json b/projects/config/piedao/abi/IStakingAll.json deleted file mode 100644 index 9dee9d343590..000000000000 --- a/projects/config/piedao/abi/IStakingAll.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "poolCount": "uint256:poolCount", - "getPoolToken": "function getPoolToken(uint256 _poolId) view returns (address)" -} \ No newline at end of file diff --git a/projects/contango-v2/index.js b/projects/contango-v2/index.js index cf64a0e03be6..00a537adc471 100644 --- a/projects/contango-v2/index.js +++ b/projects/contango-v2/index.js @@ -1,81 +1,117 @@ -const sdk = require("@defillama/sdk"); -const { blockQuery } = require("../helper/http"); const { cachedGraphQuery } = require("../helper/cache"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const CONTANGO_PROXY = "0x6Cae28b3D09D8f8Fc74ccD496AC986FC84C0C24E"; const CONTANGO_LENS_PROXY = "0xe03835Dfae2644F37049c1feF13E8ceD6b1Bb72a"; +const alchemyGraphUrl = (chain) => `https://subgraph.satsuma-prod.com/773bd6dfe1c6/egills-team/v2-${chain}/api` + +const excludedIds_arb = [ + "0x415242555344540000000000000000000bffffffff0000000000000000000623", + "0x555344435745544800000000000000000bffffffff000000000000000000030a", + "0x574554485553444300000000000000000bffffffff00000000000000000001df", + "0x574554485553444300000000000000000bffffffff00000000000000000001e8", + "0x574554485553444300000000000000000bffffffff0000000000000000000309", + "0x776545544857455448000000000000000bffffffff0000000000000000003099", + "0x777374455448574554480000000000000bffffffff00000000000000000010a7" +]; const config = { arbitrum: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: sdk.graph.modifyEndpoint('BmHqxUxxLuMoDYgbbXU6YR8VHUTGPBf9ghD7XH6RYyTQ'), + graphUrl: alchemyGraphUrl('arbitrum'), + excludedIds: excludedIds_arb }, optimism: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: sdk.graph.modifyEndpoint('PT2TcgYqhQmx713U3KVkdbdh7dJevgoDvmMwhDR29d5'), + graphUrl: alchemyGraphUrl('optimism'), }, ethereum: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: sdk.graph.modifyEndpoint('FSn2gMoBKcDXEHPvshaXLPC1EJN7YsfCP78swEkXcntY'), + graphUrl: alchemyGraphUrl('mainnet'), }, polygon: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: sdk.graph.modifyEndpoint('5t3rhrAYt79iyjm929hgwyiaPLk9uGxQRMiKEasGgeSP'), + graphUrl: alchemyGraphUrl('polygon'), }, xdai: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: sdk.graph.modifyEndpoint('9h1rHUKJK9CGqztdaBptbj4Q9e2zL9jABuu9LpRQ1XkC'), + graphUrl: alchemyGraphUrl('gnosis'), }, base: { contango: CONTANGO_PROXY, contango_lens: CONTANGO_LENS_PROXY, - grapUrl: - "https://graph.contango.xyz:18000/subgraphs/name/contango-xyz/v2-base", + graphUrl: alchemyGraphUrl('base'), + }, + avax: { + contango: CONTANGO_PROXY, + contango_lens: CONTANGO_LENS_PROXY, + graphUrl: alchemyGraphUrl('avalanche'), + }, + bsc: { + contango: CONTANGO_PROXY, + contango_lens: CONTANGO_LENS_PROXY, + graphUrl: alchemyGraphUrl('bsc'), + }, + linea: { + contango: CONTANGO_PROXY, + contango_lens: CONTANGO_LENS_PROXY, + graphUrl: alchemyGraphUrl('linea'), + }, + scroll: { + contango: CONTANGO_PROXY, + contango_lens: CONTANGO_LENS_PROXY, + graphUrl: + "https://graph.contango.xyz:18000/subgraphs/name/contango-xyz/v2-scroll", }, }; module.exports = { + hallmarks: [[1729036800, "Affected by the Radiant hack"]], doublecounted: true, methodology: `Counts the tokens locked in the positions to be used as margin + user's tokens locked in the protocol's vault. Borrowed coins are discounted from the TVL, so only the position margins are counted. The reason behind this is that the protocol only added the user's margin to the underlying money market. Adding the borrowed coins to the TVL can be used as a proxy for the protocol's open interest.`, }; Object.keys(config).forEach((chain) => { - const { contango, contango_lens, grapUrl } = config[chain]; + const { contango, contango_lens, graphUrl, excludedIds = [] } = config[chain]; module.exports[chain] = { tvl: async (api) => { await Promise.all([ - positionsTvl(api, contango_lens, grapUrl, false), - vaultTvl(api, contango, grapUrl), + positionsTvl(api, contango_lens, graphUrl, false, excludedIds), + vaultTvl(api, contango, graphUrl), ]); - return api.getBalances(); + return sumTokens2({ api }) }, - borrowed: async (api) => - positionsTvl(api, contango_lens, grapUrl, true), + borrowed: async (api) => { + + await positionsTvl(api, contango_lens, graphUrl, true, excludedIds) + return sumTokens2({ api }) + } }; }); async function positionsTvl( api, contangoLens, - grapUrl, + graphUrl, borrowed, + excludedIds ) { const cacheKey = `contango-positions-${api.chain}`; - const positions = await cachedGraphQuery(cacheKey, grapUrl, graphQueries.position, { + const positions = await cachedGraphQuery(cacheKey, graphUrl, graphQueries.position, { api, useBlock: true, fetchById: true, safeBlockLimit: 3000, }) - const parts = positions.map(({ id, instrument: { base, quote } }) => [ - id, - [base.id, quote.id], - ]); + + const parts = positions + .filter(({ id }) => !excludedIds.includes(id)) + .map(({ id, instrument: { base, quote } }) => [id, [base.id, quote.id]]); const balances = await api.multiCall({ target: contangoLens, @@ -94,9 +130,9 @@ async function positionsTvl( }); } -async function vaultTvl(api, contango, grapUrl) { +async function vaultTvl(api, contango, graphUrl) { const cacheKey = `contango-vaultAssets-${api.chain}`; - const assets = await cachedGraphQuery(cacheKey, grapUrl, graphQueries.asset, { + const assets = await cachedGraphQuery(cacheKey, graphUrl, graphQueries.asset, { api, useBlock: true, fetchById: true, diff --git a/projects/convex/index.js b/projects/convex/index.js index 10505a93fb82..35e6962b2dab 100644 --- a/projects/convex/index.js +++ b/projects/convex/index.js @@ -10,7 +10,7 @@ const boosterAddresses = { const staker = '0x989aeb4d175e16225e39e87d0d97a3360524ad80' const cvxRewardsAddress = "0xCF50b810E57Ac33B91dCF525C6ddd9881B139332"; -const cvxLockerAddress = "0x72a19342e8F1838460eBFCCEf09F6585e32db86E"; +const cvxLockerAddress = ADDRESSES.ethereum.vlCVX; const arbiPoolInfoABI = 'function poolInfo(uint256) view returns (address lptoken, address gauge, address rewards, bool shutdown, address factory)' diff --git a/projects/cookiebase/index.js b/projects/cookiebase/index.js index a864a15c24c7..a10ad9d8b3ac 100644 --- a/projects/cookiebase/index.js +++ b/projects/cookiebase/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - base: { tvl: getUniTVL({ factory: '0x05b00D63DbC67874ad44d039213b7DAfB999d184', useDefaultCoreAssets: true, fetchBalances: true, }), }, + base: { tvl: getUniTVL({ factory: '0x05b00D63DbC67874ad44d039213b7DAfB999d184', useDefaultCoreAssets: true, }), }, } \ No newline at end of file diff --git a/projects/core-bridge/index.js b/projects/core-bridge/index.js new file mode 100644 index 000000000000..1b3d41eb8540 --- /dev/null +++ b/projects/core-bridge/index.js @@ -0,0 +1,70 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const owners = ['0x52e75D318cFB31f9A2EdFa2DFee26B161255B233', '0x4D73AdB72bC3DD368966edD0f0b2148401A178E2'] +const owner = '0x29d096cD18C0dA7500295f082da73316d704031A' + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + bsc: { + tvl: (api) => + sumTokens2({ + api, + owners, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + polygon: { + tvl: (api) => + sumTokens2({ + api, + owners, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + optimism: { + tvl: (api) => + sumTokens2({ + api, + owner, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + avax: { + tvl: (api) => + sumTokens2({ + api, + owner, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + arbitrum: { + tvl: (api) => + sumTokens2({ + api, + owner, + fetchCoValentTokens: true, + permitFailure: true + }), + }, + base: { + tvl: (api) => + sumTokens2({ + api, + owner: '0x84FB2086Fed7b3c9b3a4Bc559f60fFaA91507879', + fetchCoValentTokens: true, + permitFailure: true + }), + }, +}; diff --git a/projects/corgi/index.js b/projects/corgi/index.js index 7b91d612e4b9..ca2948a7edc6 100644 --- a/projects/corgi/index.js +++ b/projects/corgi/index.js @@ -1,3 +1,4 @@ +const { deadFrom } = require("../mosquitos-finance"); module.exports = { dogechain: { @@ -5,5 +6,6 @@ module.exports = { }, hallmarks: [ [1662859935, "Rug pull"], - ] + ], + deadFrom: 1662859935 } \ No newline at end of file diff --git a/projects/corgiswap.js b/projects/corgiswap.js index 059f6df96968..c7a1445a49c5 100644 --- a/projects/corgiswap.js +++ b/projects/corgiswap.js @@ -10,6 +10,6 @@ module.exports = { methodology: 'TVL accounts for the liquidity on all AMM pools, using the TVL chart on https://corgiswap.info/ as the source. Staking accounts for the CORIS locked in MasterChef (0x60E5Cf9111d046E8F986fC98e37d6703607d5Baf)', bsc: { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }), - staking: stakingPricedLP(masterChef, corisToken, "bsc", "0x1881bd6aba086da0c5cfed7247f216dea50e38ed", "wbnb", true) + staking: async ()=>({}) // CORIS returning an incorrect staking value locked }, } diff --git a/projects/corn-l2/index.js b/projects/corn-l2/index.js new file mode 100644 index 000000000000..1b170f485123 --- /dev/null +++ b/projects/corn-l2/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owners: [ + "0x8bc93498b861fd98277c3b51d240e7e56e48f23c", + "0x6d85d1c7f58fd5d05b1b633e8b0ce2e57fca9d80", + ], + fetchCoValentTokens: true, + permitFailure: true + }), + }, +}; diff --git a/projects/coslend/index.js b/projects/coslend/index.js index a75948a2d1d2..68f8b21fe9b2 100644 --- a/projects/coslend/index.js +++ b/projects/coslend/index.js @@ -1,10 +1,4 @@ -const { usdCompoundExports } = require("../helper/compound"); +const { compoundExports2 } = require("../helper/compound") module.exports = { - evmos: usdCompoundExports( - "0x5b32B588Af5F99F4e5c4038dDE6BDD991024F650", - "evmos", - undefined, - undefined, - {} - ), -}; + evmos: compoundExports2({ comptroller: "0x5b32B588Af5F99F4e5c4038dDE6BDD991024F650" }), +} diff --git a/projects/counterstake/index.js b/projects/counterstake/index.js index ee60d77fe5c6..6a3575087286 100644 --- a/projects/counterstake/index.js +++ b/projects/counterstake/index.js @@ -74,7 +74,7 @@ async function totalObyteTvl(timestamp) { const totalTVLByEVMNetwork = async (api) => { const bridges = await getConfig('counterstake/bridges', 'https://counterstake.org/api/bridges').then((data) => data.data); - const pooledAssistants = await getConfig('counterstake/poolStakes', 'https://counterstake.org/api/pooled_assistants').then((data) => data.data); + const pooledAssistants = await getConfig('counterstake/poolStakes', 'https://counterstake.org/api/pooled_assistants').then((data) => data.data.assistants); const bridgeAasByChain = []; const tokensAndOwners = [] @@ -89,6 +89,7 @@ const totalTVLByEVMNetwork = async (api) => { } }); + pooledAssistants.filter(({ network }) => network.toLowerCase() === api.chain).forEach(({ assistant_aa, side, bridge_id }) => { const bridge = bridges.find((bridge) => bridge.bridge_id === bridge_id); diff --git a/projects/cover.js b/projects/cover.js index b5db9ec2b7d8..7599462a0554 100644 --- a/projects/cover.js +++ b/projects/cover.js @@ -1,10 +1,18 @@ const ADDRESSES = require('./helper/coreAssets.json') -const abis = require('./config/cover/cover.js') +const abis = { + cover: { + getProtocolDetails: "function getProtocolDetails() view returns (bytes32 _name, bool _active, uint256 _claimNonce, uint256 _claimRedeemDelay, uint256 _noclaimRedeemDelay, address[] _collaterals, uint48[] _expirationTimestamps, address[] _allCovers, address[] _allActiveCovers)", + }, + protocols: { + getAllProtocolAddresses: "address[]:getAllProtocolAddresses", + } +} + async function tvl(api) { let factory = '0xedfC81Bf63527337cD2193925f9C0cF2D537AccA' - const allProtocols = await api.call({ abi: abis.abis.protocols.getAllProtocolAddresses, target: factory }) - const details = await api.multiCall({ abi: abis.abis.cover.getProtocolDetails, calls: allProtocols}) + const allProtocols = await api.call({ abi: abis.protocols.getAllProtocolAddresses, target: factory }) + const details = await api.multiCall({ abi: abis.cover.getProtocolDetails, calls: allProtocols }) const tokens = [ADDRESSES.ethereum.DAI, '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01'] const owners = details.map(i => i._allCovers).flat() return api.sumTokens({ owners, tokens }) diff --git a/projects/cozy/index.js b/projects/cozy/index.js index fd1662199db5..431e97eda7a4 100644 --- a/projects/cozy/index.js +++ b/projects/cozy/index.js @@ -1,14 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {compoundExports} = require('../helper/compound') +const { compoundExports } = require('../helper/compound') -const transform = addr=>{ - if(addr==="0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"){ - return ADDRESSES.ethereum.WETH - } - return addr -} - -module.exports={ - methodology: "Count tokens the same way we count for compound", - ethereum: compoundExports('0x895879b2c1fbb6ccfcd101f2d3f3c76363664f92', "ethereum", undefined, undefined, transform) +module.exports = { + methodology: "Count tokens the same way we count for compound", + ethereum: compoundExports('0x895879b2c1fbb6ccfcd101f2d3f3c76363664f92') } \ No newline at end of file diff --git a/projects/crackandstack/index.js b/projects/crackandstack/index.js new file mode 100644 index 000000000000..39d351216e3a --- /dev/null +++ b/projects/crackandstack/index.js @@ -0,0 +1,17 @@ + +const { sumTokensExport } = require("../helper/unwrapLPs"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const CONTRACTS = ["0x2c301eBfB0bb42Af519377578099b63E921515B7", "0xD8F7cd7d919c5266777FB83542F956dD30E80187", "0x12689b6ddE632E69fBAA70d066f86aC9fDd33dd1"]; + +// Crack & Stack +// https://crackandstack.com/ +module.exports = { + methodology: `Crack & Stack TVL is the backed value of the Lanterns NFT.`, + taiko: { + tvl: sumTokensExport({ + owners: CONTRACTS, + tokens: [ADDRESSES.null, ADDRESSES.taiko.USDT, ADDRESSES.taiko.USDC_e, ADDRESSES.taiko.USDC, ADDRESSES.taiko.TAIKO] + }), + }, +} diff --git a/projects/crafting/index.js b/projects/crafting/index.js index de35652d1126..4ee4ec79c804 100644 --- a/projects/crafting/index.js +++ b/projects/crafting/index.js @@ -1,11 +1,9 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const contractStakingETH = "0x9353177049757A21f19a28C3055c03871e6428cf"; -const ETH = ADDRESSES.null; const contractAddresses = [ + contractStakingETH, //Staking Contract wbtc "0xF70A76AfFD4c368eD16a2593C4D9FAee3562a4Ba", //Staking Contract usdt @@ -15,6 +13,7 @@ const contractAddresses = [ ]; const tokens = [ + ADDRESSES.null, ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.USDT, "0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D", @@ -32,44 +31,12 @@ const tokens_aurora = [ ADDRESSES.aurora.NEAR, ]; -async function ethTvl(timestamp, block) { - const balances = {}; - - for (let i = 0; i < tokens.length; i++) { - await sumTokensAndLPsSharedOwners( - balances, - [[tokens[i], false]], - [contractAddresses[i]] - ); - } - - const ethBal = ( - await sdk.api.eth.getBalance({ - target: contractStakingETH, - block - }) - ).output; - - sdk.util.sumSingleBalance(balances, ETH, ethBal); - - return balances; +async function ethTvl(api) { + await api.sumTokens({owners: contractAddresses, tokens: tokens}) } -async function auroraTvl(timestamp, block, chainBlocks) { - const balances = {}; - - for (let i = 0; i < tokens_aurora.length; i++) { - await sumTokensAndLPsSharedOwners( - balances, - [[tokens_aurora[i], false]], - [contractAddresses_aurora[i]], - chainBlocks["aurora"], - "aurora", - (addr) => `aurora:${addr}` - ); - } - - return balances; +async function auroraTvl(api) { + return api.sumTokens({owners: contractAddresses_aurora, tokens: tokens_aurora}) } module.exports = { diff --git a/projects/cream/index.js b/projects/cream/index.js index 3f60a31e7bab..04b706225e95 100644 --- a/projects/cream/index.js +++ b/projects/cream/index.js @@ -5,14 +5,13 @@ module.exports = { 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: compoundExports("0xbdC857eae1D15ad171E11af6FC3e99413Ed57Ec4", "ethereum"), + ethereum: compoundExports("0xbdC857eae1D15ad171E11af6FC3e99413Ed57Ec4"), bsc: compoundExports( "0x589DE0F0Ccf905477646599bb3E5C622C84cC0BA", - "bsc", "0x1Ffe17B99b439bE0aFC831239dDECda2A790fF3A", ADDRESSES.bsc.WBNB ), - polygon: compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24", "polygon"), - arbitrum: compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee", "arbitrum"), - base: compoundExports("0x94d31f92a7f85b51F0B628467B3E660BA3e8D799", "base"), + polygon: compoundExports("0x20ca53e2395fa571798623f1cfbd11fe2c114c24"), + arbitrum: compoundExports("0xbadaC56c9aca307079e8B8FC699987AAc89813ee"), + base: compoundExports("0x94d31f92a7f85b51F0B628467B3E660BA3e8D799"), }; diff --git a/projects/creamswap/abi.json b/projects/creamswap/abi.json deleted file mode 100644 index 5b5c9fc806fa..000000000000 --- a/projects/creamswap/abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "getCurrentTokens": "address[]:getCurrentTokens", - "get_virtual_price": "uint256:get_virtual_price", - "getPricePerFullShare": "uint256:getPricePerFullShare", - "balanceOfUnderlying": "function balanceOfUnderlying(address owner) returns (uint256)", - "underlying": "address:underlying" -} \ No newline at end of file diff --git a/projects/creamswap/index.js b/projects/creamswap/index.js index 7c8d5f64de63..fb8efca0c71d 100644 --- a/projects/creamswap/index.js +++ b/projects/creamswap/index.js @@ -1,189 +1,20 @@ -const ADDRESSES = require('../helper/coreAssets.json') -/*================================================== - Modules - ==================================================*/ - - -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const BigNumber = require('bignumber.js'); -const { getLogs } = require('../helper/cache/getLogs') - -/*================================================== -Settings -==================================================*/ - -const wETH = ADDRESSES.ethereum.WETH; -const usdt = ADDRESSES.ethereum.USDT; -const yyCrv = '0x5dbcF33D8c2E976c6b560249878e6F1491Bca25c'; -const yETH = '0xe1237aA7f535b0CC33Fd973D66cBf830354D16c7'; -const crYFI = '0xCbaE0A83f4f9926997c8339545fb8eE32eDc6b76'; -const crCREAM = '0x892B14321a4FCba80669aE30Bd0cd99a7ECF6aC0'; -const cryUSD = '0x4EE15f44c6F0d8d1136c83EfD2e8E4AC768954c6'; -const CRETH2 = '0xcBc1065255cBc3aB41a6868c22d1f1C573AB89fd'; - -/*================================================== - TVL - ==================================================*/ - -function isCrToken(address) { - const crTokens = [crYFI, crCREAM, cryUSD]; - return crTokens.includes(address); -} +const { getLogs } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); async function tvl(api) { - const block = api.block - let balances = { - [ADDRESSES.null]: '0', // ETH - }; - let poolLogs = (await Promise.all([ - getLogs({ - api, - target: '0xf8062Eedf80D8D2527cE89435f670cb996aB4e54', - topic: 'LOG_NEW_POOL(address,address)', - fromBlock: 10815298, - }), - - block >= 11053389 ? - getLogs({ - api, - target: '0x136d6F80Bb3A853D151686BFED2c9309Aea6dDec', - topic: 'LOG_NEW_POOL(address,address)', - fromBlock: 11053389, - }) : Promise.resolve( []), - - block >= 11099537 ? - getLogs({ - api, - target: '0x0d3303Ffaf107cD732396570Bf07b2dbd79B619f', - topic: 'LOG_NEW_POOL(address,address)', - fromBlock: 11099537, - }) : Promise.resolve([]) - ])).reduce((pools, subPools) => { - pools.push(...subPools); - return pools; - }, []) - - let poolCalls = []; - - let pools = poolLogs.map((poolLog) => { - return `0x${poolLog.topics[2].slice(26)}` - }); + getLogs({ api, target: '0xf8062Eedf80D8D2527cE89435f670cb996aB4e54', topic: 'LOG_NEW_POOL(address,address)', fromBlock: 10815298, }), + getLogs({ api, target: '0x136d6F80Bb3A853D151686BFED2c9309Aea6dDec', topic: 'LOG_NEW_POOL(address,address)', fromBlock: 11053389, }), + getLogs({ api, target: '0x0d3303Ffaf107cD732396570Bf07b2dbd79B619f', topic: 'LOG_NEW_POOL(address,address)', fromBlock: 11099537, }) + ])).flat() - const poolTokenData = (await sdk.api.abi.multiCall({ - calls: pools.map((poolAddress) => ({ target: poolAddress })), - abi: abi.getCurrentTokens, - })).output; + let pools = poolLogs.map((poolLog) => `0x${poolLog.topics[2].slice(26)}`) - poolTokenData.forEach((poolToken) => { - let poolTokens = poolToken.output; - let poolAddress = poolToken.input.target; - - poolTokens.forEach((token) => { - poolCalls.push({ - target: token, - params: poolAddress, - }); - }) - }); - - let poolBalances = (await sdk.api.abi.multiCall({ - block, - calls: poolCalls, - abi: 'erc20:balanceOf' - })).output; - - poolBalances.forEach((balanceOf) => { - let balance = balanceOf.output; - let address = balanceOf.input.target; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - }); - - let underlyingBalanceCalls = []; - let underlyingAddressCalls = []; - poolBalances.filter((poolBalance) => isCrToken(poolBalance.input.target)).forEach(pooBalance => { - underlyingBalanceCalls.push({ - target: pooBalance.input.target, - params: pooBalance.input.params, - }); - underlyingAddressCalls.push({ - target: pooBalance.input.target, - params: [], - }) - }) - - let [underlyingBalances, underlyingAddress, yVaultPrices, yCrvPrice] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - calls: underlyingBalanceCalls, - abi: abi['balanceOfUnderlying'], - permitFailure: true, - }), - sdk.api.abi.multiCall({ - block, - calls: underlyingAddressCalls, - abi: abi['underlying'] - }), - sdk.api.abi.multiCall({ - block, - calls: [{ target: yETH }, { target: yyCrv }], - abi: abi['getPricePerFullShare'], - }), - sdk.api.abi.call({ - block, - target: '0x45F783CCE6B7FF23B2ab2D70e416cdb7D6055f51', - params: [], - abi: abi['get_virtual_price'] - }) - ]); - - underlyingBalances = underlyingBalances.output; - underlyingAddress = underlyingAddress.output; - yVaultPrices = yVaultPrices.output; - yCrvPrice = yCrvPrice.output; - - // convert cTokens into underlying tokens - underlyingBalances.forEach((underlying, i) => { - let balance = underlying.output; - let address = underlyingAddress[i].output; - let cAddress = underlying.input.target; - balances[address] = balance; - delete balances[cAddress]; - }) - - // convert vault tokens into underlying values - poolBalances.forEach((balanceOf, i) => { - let balance = balanceOf.output; - let address = balanceOf.input.target; - - if (BigNumber(balance).toNumber() <= 0) { - return; - } - // assume CRETH2:ETH = 1:1 - if (address === CRETH2) { - balances[wETH] = BigNumber(balances[wETH] || 0).plus(balances[CRETH2]).toFixed(); - delete balances[CRETH2]; - } else if (address === yyCrv) { - const yyCrvCash = BigNumber(balance).multipliedBy(yCrvPrice).div(1e18).div(1e12).multipliedBy(yVaultPrices[1].output).div(1e18).integerValue(); - balances[usdt] = BigNumber(balances[usdt] || 0).plus(yyCrvCash).toFixed(); - delete balances[yyCrv]; - } else { - balances[address] = BigNumber(balances[address] || 0).plus(balance).toFixed(); - } - }); - return balances; + const poolTokenData = await api.multiCall({ calls: pools, abi: "address[]:getCurrentTokens", }) + const ownerTokens = poolTokenData.map((v, i) => [v, pools[i]]) + return sumTokens2({ ownerTokens, api }) } -/*================================================== - Exports - ==================================================*/ - module.exports = { start: 1599552000, // 09/08/2020 @ 8:00am (UTC) ethereum: { tvl } diff --git a/projects/credbull/index.js b/projects/credbull/index.js index aeeb7c6c6b40..fc22664beac7 100644 --- a/projects/credbull/index.js +++ b/projects/credbull/index.js @@ -1,5 +1,8 @@ const { getConfig } = require('../helper/cache'); +const STAKING_VAULT_CONTRACT = "0xe4a4d891f02DF7bFFc5ff9e691313DE8a9E76b91"; +const CBL_TOKEN = "0xD6b3d81868770083307840F513A3491960b95cb6"; + async function tvl(api) { let vaults = await getConfig('credbull', "https://incredbull.io/api/vaults") vaults = vaults[api.chain] @@ -13,12 +16,17 @@ async function borrowed(api) { 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) + 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) } +async function stakedCbl(api) { + const bals = await api.multiCall({ abi: 'address:totalAssets', calls: [STAKING_VAULT_CONTRACT,] }) + api.add(CBL_TOKEN, bals) +} + module.exports = { methodology: 'TVL consist of the sum of every deposit of all vaults for a given asset.', btr: { tvl, borrowed, }, - arbitrum: { tvl, borrowed }, + arbitrum: { tvl, borrowed, staking: stakedCbl }, }; diff --git a/projects/creditum/abi.json b/projects/creditum/abi.json deleted file mode 100644 index 7c1d075b5591..000000000000 --- a/projects/creditum/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "token": "address:token" -} \ No newline at end of file diff --git a/projects/creditum/helper.js b/projects/creditum/helper.js deleted file mode 100644 index 3e70d309c535..000000000000 --- a/projects/creditum/helper.js +++ /dev/null @@ -1,51 +0,0 @@ -const abi = require('./abi.json') -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js'); - -async function handleYearnTokens(balances, tokens, owner, block, chain, transform) { - let balance = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p, - params: owner, - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - let pricePerShare = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p, - })), - abi: "uint256:pricePerShare", - block, - chain, - }) - ).output; - let underlyingTokens = ( - await sdk.api.abi.multiCall({ - calls: tokens.map((p) => ({ - target: p, - })), - abi: abi.token, - block, - chain, - }) - ).output; - for (let i = 0; i < balance.length; i++) { - let addr = transform(underlyingTokens[i].output.toLowerCase()); - const price = pricePerShare[i].output - sdk.util.sumSingleBalance( - balances, - addr, - BigNumber(balance[i].output) - .times(price).div(10**Math.log10(price)) - .toFixed(0) - ); - } - } -module.exports = { - handleYearnTokens -} \ No newline at end of file diff --git a/projects/creditum/index.js b/projects/creditum/index.js index b428aeba56d8..07d58fc8788b 100644 --- a/projects/creditum/index.js +++ b/projects/creditum/index.js @@ -1,35 +1,25 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakingPricedLP } = require("../helper/staking"); -const { sumTokensSharedOwners } = require("../helper/unwrapLPs"); const { pool2 } = require("../helper/pool2"); -const { handleYearnTokens } = require("./helper.js"); const lending = "0x04D2C91A8BDf61b11A526ABea2e2d8d778d4A534" -async function tvl(time, ethBlock, chainBlocks){ - const chain = 'fantom' - const block = chainBlocks[chain] - const balances = {} - const transform = addr=> addr===ADDRESSES.fantom.DAI?[ADDRESSES.ethereum.DAI]:`${chain}:${addr}` - await sumTokensSharedOwners(balances, [ - ADDRESSES.fantom.USDC, - ADDRESSES.fantom.WFTM, - ADDRESSES.fantom.DAI, - "0x321162Cd933E2Be498Cd2267a90534A804051b11", - "0x74b23882a30290451A17c44f4F05243b6b58C76d" - ], [lending], block, chain, transform) - await handleYearnTokens(balances, [ - "0x637ec617c86d24e421328e6caea1d92114892439", - "0xef0210eb96c7eb36af8ed1c20306462764935607", - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0" - ], lending, block, chain, transform) - return balances +async function tvl(api) { + return api.sumTokens({ + owner: lending, tokens: [ + ADDRESSES.fantom.USDC, + ADDRESSES.fantom.WFTM, + ADDRESSES.fantom.DAI, + "0x321162Cd933E2Be498Cd2267a90534A804051b11", + "0x74b23882a30290451A17c44f4F05243b6b58C76d" + ] + }) } -module.exports={ - fantom:{ - tvl, - staking: stakingPricedLP("0xd9e28749e80D867d5d14217416BFf0e668C10645", "0x77128dfdd0ac859b33f44050c6fa272f34872b5e", "fantom", "0x06F3Cb227781A836feFAEa7E686Bdc857e80eAa7", "wrapped-fantom"), - pool2: pool2("0xe0c43105235c1f18ea15fdb60bb6d54814299938", "0x06f3cb227781a836fefaea7e686bdc857e80eaa7"), - }, +module.exports = { + fantom: { + tvl, + staking: stakingPricedLP("0xd9e28749e80D867d5d14217416BFf0e668C10645", "0x77128dfdd0ac859b33f44050c6fa272f34872b5e", "fantom", "0x06F3Cb227781A836feFAEa7E686Bdc857e80eAa7", "wrapped-fantom"), + pool2: pool2("0xe0c43105235c1f18ea15fdb60bb6d54814299938", "0x06f3cb227781a836fefaea7e686bdc857e80eaa7"), + }, } \ No newline at end of file diff --git a/projects/crescent-dex/index.js b/projects/crescent-dex/index.js index 73f391a62921..d1c4431ef6a7 100644 --- a/projects/crescent-dex/index.js +++ b/projects/crescent-dex/index.js @@ -26,5 +26,7 @@ module.exports = { methodology: "Counts the liquidity on all pools. ", crescent: { tvl - } + }, + deadFrom: '2024-05-01', + hallmarks: [[1713052800, 'Sunset of Crescent Network']] } \ No newline at end of file diff --git a/projects/crolend/index.js b/projects/crolend/index.js index 27fb8cb7c046..096c50e7d1a8 100644 --- a/projects/crolend/index.js +++ b/projects/crolend/index.js @@ -1,11 +1,10 @@ -const { getCompoundV2Tvl } = require('../helper/compound') - module.exports = { hallmarks: [ [1670004805, "Project rugged"] ], + deadFrom: 1670004805, cronos: { - tvl: getCompoundV2Tvl("0x30dF4C58ADaf1FcF388B7Bf775840DEc086dcB98", "cronos"), + tvl: ()=>({}), borrowed: ()=>({}) } } \ No newline at end of file diff --git a/projects/crosscurve/index.js b/projects/crosscurve/index.js new file mode 100644 index 000000000000..1cd9439331ac --- /dev/null +++ b/projects/crosscurve/index.js @@ -0,0 +1,151 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.ethereum.TUSD, // TUSD + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI + "0x4DEcE678ceceb27446b35C672dC7d61F30bAD69E", // crvUSDC + "0x390f3595bCa2Df7d23783dFd126427CCeb997BF4", // crvUSDT + "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", // 3Crv + "0xc4AD29ba4B3c580e6D59105FFf484999997675Ff", // crv3crypto + ADDRESSES.ethereum.WETH, // WETH + "0xb7ecb2aa52aa64a717180e030241bc75cd946726", // tBTC/WBTC + ], + }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0x4D15a3A2286D883AF0AA1B3f21367843FAc63E07", // TUSD + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.arbitrum.USDC, // usdc.e + ADDRESSES.optimism.DAI, // DAI + "0xec090cf6DD891D2d014beA6edAda6e05E025D93d", // crvUSDC + "0x82670f35306253222F8a165869B28c64739ac62e", // 3c-crvUSD + "0x73aF1150F265419Ef8a5DB41908B700C32D49135", // crvUSDT + "0x7f90122BF0700F9E7e1F688fe926940E8839F353", // 2CRV + ADDRESSES.arbitrum.WETH, // WETH + "0x186cf879186986a20aadfb7ead50e3c20cb26cec", // 2BTC-ng + ], + }), + }, + polygon: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0x2e1AD108fF1D8C782fcBbB89AAd783aC49586756", // TUSD + ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.USDC, // usdc.e + ADDRESSES.polygon.DAI, // DAI + "0x5225010a0ae133b357861782b0b865a48471b2c5", // crvUSDC + "0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171", // aave + "0xa70af99bff6b168327f9d1480e29173e757c7904", // crvUSDT + "0xdad97f7713ae9437fa9249920ec8507e5fbb23d3", // crv3crypto + ADDRESSES.polygon.WBTC, // WBTC + ], + }), + }, + bsc: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.bsc.TUSD, // TUSD + ADDRESSES.bsc.USDT, // USDT + ADDRESSES.bsc.USDC, // usdc.e + "0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3", // DAI + "0xc4ec3ab41182e70ca45a764ffc5c45b9a82ccc97", // crvUSDC + "0xA5E0E46462970C9Ee8C2ECadcde254c483748Ec4", // b3pool + "0xae87e5fa20f335ce14aa3b9e0616308d9ac7d4ce", // crvUSDT + ADDRESSES.bsc.BTCB, // BTCB + ], + }), + }, + optimism: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0xcB59a0A753fDB7491d5F3D794316F1adE197B21E", // TUSD + ADDRESSES.optimism.USDT, // USDT + ADDRESSES.optimism.USDC, // usdc.e + ADDRESSES.optimism.DAI, // DAI + "0x03771e24b7c9172d163bf447490b142a15be3485", // crvUSDC + "0x1337bedc9d22ecbe766df105c9623922a27963ec", // 3pool + "0xd1b30ba128573fcd7d141c8a987961b40e047bb6", // crvUSDT + ADDRESSES.optimism.WETH_1, // WETH + "0x1dc5c0f8668a9f54ed922171d578011850ca0341", // 2BTC + ], + }), + }, + avax: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0x1C20E891Bab6b1727d14Da358FAe2984Ed9B59EB", // TUSD + ADDRESSES.avax.USDt, // USDT + ADDRESSES.avax.USDC, // usdc.e + ADDRESSES.avax.DAI, // DAI + "0x1337BedC9D22ecbe766dF105c9623922A27963EC", // av3crv + "0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828", // crv3crypto + ADDRESSES.avax.BTC_b, // BTC.b + ], + }), + }, + base: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f", // 4pool + ADDRESSES.optimism.WETH_1, // WETH + "0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf", // cbBTC + ], + }), + }, + xdai: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + "0x1337bedc9d22ecbe766df105c9623922a27963ec", // x3CRV + ], + }), + }, + blast: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.blast.WETH, // WETH + ], + }), + }, + mantle: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.mantle.WETH, // WETH + ], + }), + }, + linea: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.linea.WETH, // WETH + "0x3aab2285ddcddad8edf438c1bab47e1a9d05a9b4", // WBTC + ], + }), + }, + taiko: { + tvl: sumTokensExport({ + owner: "0xac8f44ceca92b2a4b30360e5bd3043850a0ffcbe", + tokens: [ + ADDRESSES.taiko.WETH, // WETH + ], + }), + }, +}; diff --git a/projects/crouton/index.js b/projects/crouton/index.js new file mode 100644 index 000000000000..66f73f7a0f3c --- /dev/null +++ b/projects/crouton/index.js @@ -0,0 +1,24 @@ +const { get } = require("../helper/http"); +const ADDRESSES = require("../helper/coreAssets.json"); + +async function tvl(api) { + const pools = await get("https://backend.crouton.finance/pools"); + const tvl = pools.reduce((acc, pool) => { + acc += Number(pool.tvlUsd); + return acc; + }, 0); + api.add(ADDRESSES.ton.USDT, tvl * 1e6); +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + methodology: ` +The methodology for calculating TVL includes both the TON balance and tokens' balances +data for each pool. The calculation is performed on the Parraton API side. + `.trim(), + + ton: { + tvl, + }, +}; diff --git a/projects/crypto-com/index.js b/projects/crypto-com/index.js index 0df01714333f..377bcf63c449 100644 --- a/projects/crypto-com/index.js +++ b/projects/crypto-com/index.js @@ -1,17 +1,9 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bitcoin: { - owners: [ - 'bc1qpy4jwethqenp4r7hqls660wy8287vw0my32lmy', - '3LhhDLBVWBZChNQv8Dn4nDKFnCyojG1FqN', - '3QsGsAXQ4rqRNvh5pEW55hf3F9PEyb7rVq', - 'bc1qr4dl5wa7kl8yu792dceg9z5knl2gkn220lk7a9', - 'bc1q4c8n5t00jmj8temxdgcc3t32nkg2wjwz24lywv', - '14m3sd9HCCFJW4LymahJCKMabAxTK4DAqW', - 'bc1qjqy709gqpse60hdsm2d2v0dzzu7yp5dej7fdrpl2x3taccvujq4s0vzsyd', - 'bc1qcdqj2smprre85c78d942wx5tauw5n7uw92r7wr' - ], + owners: bitcoinAddressBook.cryptoCom, }, ethereum: { owners: [ diff --git a/projects/crypto-lottery/index.js b/projects/crypto-lottery/index.js index e7b60e3946ef..7bb9e73fb755 100644 --- a/projects/crypto-lottery/index.js +++ b/projects/crypto-lottery/index.js @@ -13,6 +13,10 @@ const config = { module.exports = { methodology: "We count of smart contract balance in coins", + deadFrom: "2024-09-11", + hallmarks: [ + [Math.floor(new Date('2024-09-11')/1e3), 'Closed due to lack of interest'], + ], } Object.keys(config).forEach(chain => { diff --git a/projects/cswap/index.js b/projects/cswap/index.js index 7a6a0a544d44..23c9b0685c64 100644 --- a/projects/cswap/index.js +++ b/projects/cswap/index.js @@ -2,6 +2,8 @@ const { transformDexBalances } = require('../helper/portedTokens') const { get } = require('../helper/http') module.exports = { + deadFrom: '2024-09-17', + hallmarks: [[1726531200,'Sunset of cSwap']], timetravel: false, misrepresentedTokens: true, comdex: { diff --git a/projects/cuanswap/index.js b/projects/cuanswap/index.js index 9ec53b7b1a20..519e6e011b49 100644 --- a/projects/cuanswap/index.js +++ b/projects/cuanswap/index.js @@ -3,6 +3,6 @@ const { getUniTVL, } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, core: { - tvl: getUniTVL({ factory: '0x23556027Ad3C3e76160AcA51e8098C395a6d815C', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x23556027Ad3C3e76160AcA51e8098C395a6d815C', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/cubfinance/index.js b/projects/cubfinance/index.js index 4d6499ccd125..82be384f66b7 100644 --- a/projects/cubfinance/index.js +++ b/projects/cubfinance/index.js @@ -1,31 +1,15 @@ const sdk = require('@defillama/sdk'); const abi = require('./abi.json'); const { sumTokens2 } = require('../helper/unwrapLPs') -const { getParamCalls } = require('../helper/utils') const { yieldHelper } = require('../helper/yieldHelper') const cubFarmAddress = '0x227e79c83065edb8b954848c46ca50b96cb33e16'; const cubKingdomFarmAddress = '0x2E72f4B196b9E5B89C29579cC135756a00E6CBBd'; const cub = '0x50d809c74e0b8e49e7b4c65bb3109abe3ff4c1c1' -const chain = 'bsc' - -async function tvl(timestamp, ethBlock, { bsc: block }) { - const toa = [] - const poolLength = (await sdk.api.abi.call({ - target: cubFarmAddress, - abi: abi['poolLength'], - chain, block, - })).output; - const { output: res } = await sdk.api.abi.multiCall({ - target: cubFarmAddress, - abi: abi['poolInfo'], - calls: getParamCalls(poolLength), - chain, block, - }) - - res.forEach(({ output }) => toa.push([output.lpToken, cubFarmAddress])) - return sumTokens2({ chain, block, tokensAndOwners: toa, blacklistedTokens: [cub, '0x5E719AA339a6229692cf4163Eb0D966ACF93Ce28',], resolveLP: true, }) +async function tvl(api) { + const farms = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: cubFarmAddress}) + return sumTokens2({ api, owner: cubFarmAddress, tokens: farms.map(i => i.lpToken), blacklistedTokens: [cub, '0x5E719AA339a6229692cf4163Eb0D966ACF93Ce28',], resolveLP: true, }) } const kingdomTvl = yieldHelper({ diff --git a/projects/cubiswap/index.js b/projects/cubiswap/index.js index 1426bdeb6605..51750a173ef1 100644 --- a/projects/cubiswap/index.js +++ b/projects/cubiswap/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const FACTORY = "0xE6c8488a3078f474D0B75E4ac06a369e3Fb39d76" // This factory is on opBNB Mainnet (Chain Id: 204) -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, permitFailure: true }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, permitFailure: true }) module.exports = { diff --git a/projects/curve/index.js b/projects/curve/index.js index c53dc8ecc744..3424f2ea1d3d 100644 --- a/projects/curve/index.js +++ b/projects/curve/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensSharedOwners, nullAddress, sumTokens2, } = require("../helper/unwrapLPs"); +const { nullAddress, sumTokens2, } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); const { getCache } = require("../helper/http"); const { getUniqueAddresses } = require("../helper/utils"); @@ -257,25 +257,15 @@ module.exports.ethereum["staking"] = staking( ); module.exports.harmony = { - tvl: async (ts, ethB, chainB) => { - if (ts > 1655989200) { + tvl: async (api) => { + if (api.timestamp > 1655989200) { // harmony hack return {}; } - const block = chainB.harmony - const balances = {}; - await sumTokensSharedOwners( - balances, - [ - "0xef977d2f931c1978db5f6747666fa1eacb0d0339", - "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f" - ], - ["0xC5cfaDA84E902aD92DD40194f0883ad49639b023"], - block, - "harmony", - addr => `harmony:${addr}` - ); - return balances; + return api.sumTokens({ owner: '0xC5cfaDA84E902aD92DD40194f0883ad49639b023', tokens: [ + "0xef977d2f931c1978db5f6747666fa1eacb0d0339", + "0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f" + ]}) } }; diff --git a/projects/cyberblast-v2/index.js b/projects/cyberblast-v2/index.js index 4981fbf840db..4697179eda92 100644 --- a/projects/cyberblast-v2/index.js +++ b/projects/cyberblast-v2/index.js @@ -7,6 +7,6 @@ module.exports = { misrepresentedTokens: true, methodology: `Uses Uniswap-style factory address to find and price liquidity pairs.`, blast: { - tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }), + tvl: getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }), } }; \ No newline at end of file diff --git a/projects/cyberperp/index.js b/projects/cyberperp/index.js new file mode 100644 index 000000000000..70e531c520d8 --- /dev/null +++ b/projects/cyberperp/index.js @@ -0,0 +1,9 @@ +const { gmxExports } = require("../helper/gmx"); + +const vault = "0x35C301Df78a6eD459931F56fBa6Cb2ad71bE606b"; + +module.exports = { + iotaevm: { + tvl: gmxExports({ vault}), + }, +}; \ No newline at end of file diff --git a/projects/cybertime/index.js b/projects/cybertime/index.js index 96bc09744d7a..89599fa15875 100644 --- a/projects/cybertime/index.js +++ b/projects/cybertime/index.js @@ -1,7 +1,7 @@ const abi = require("./abi.json"); const { pool2s } = require("../helper/pool2"); -const { addFundsInMasterChef } = require("../helper/masterchef"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { staking } = require("../helper/staking"); const pool2FarmContracts = [ //CTFFarmV1 @@ -53,53 +53,20 @@ const farms = [ "0xCE997537498793d25dAb0F289e161DB26914275A", ]; -const Staking = async (chainBlocks) => { - const balances = {}; - - let transformAddress = i => `bsc:${i}`; - await sumTokensAndLPsSharedOwners( - balances, - [ - [NFTL_V1, false], - [CTF_V1, false], - [NFTL_V2, false], - [CTF_V2, false], - [CTF_V3, false], - ], - farms, - chainBlocks["bsc"], - "bsc", - transformAddress - ); - - return balances; -}; const bscTvl = async (api) => { - const balances = {}; - - let transformAddress = i => `bsc:${i}`; + const blacklistedTokens = [CTF_V3, CTF_V2] + const ownerTokens = [] for (const farm of farms) { - await addFundsInMasterChef( - balances, - farm, - api.bsc, - "bsc", - transformAddress, - abi.poolInfo, - [CTF_V2], - true, - true, - CTF_V3 - ); + const poolInfos = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: abi.poolInfo, target: farm }) + ownerTokens.push([poolInfos.map(pool => pool.lpToken), farm]) } - - return balances; + return sumTokens2({ api, ownerTokens, blacklistedTokens, resolveLP: true, }) }; module.exports = { - bsc: { - staking: Staking, + bsc: { + staking: staking(farms, [NFTL_V1, CTF_V1, NFTL_V2, CTF_V2, CTF_V3,]), pool2: pool2s(pool2FarmContracts, lpPool2), tvl: bscTvl, }, diff --git a/projects/cybro/index.js b/projects/cybro/index.js new file mode 100644 index 000000000000..7611d32485dc --- /dev/null +++ b/projects/cybro/index.js @@ -0,0 +1,32 @@ +const vaults = [ + '0xc9434fbee4ec9e0bad7d067b35d2329e5f1d8915', + '0xf56dab7b7b2954aa86a591f164205e6cdd33797e', + '0x4caec64454893c7912e6beb1e19b4714dd353748', + '0xb4e96a45699b4cfc08bb6dd71eb1276bfe4e26e7', + '0x9c3d4e6f96d2c3ddd8afee3891b955283a920889', + '0x4f3da57dbfb2b85c96e3556c5f1859ef88f5d6b1', + '0x7458ac85593472ba501ee361449638ed180a7ee7', + '0x83eaed4393328f77d0e402018a369b8b82e501a4', + '0x18e22f3f9a9652ee3a667d78911bac55bc2249af', + '0xd58826d2c0babf1a60d8b508160b52e9c19aff07', + '0x567103a40c408b2b8f766016c57a092a180397a1', + '0xe922bccf90d74f02a9d4203b377399314e008e41', + '0x0667ac28015ed7146f19b2d218f81218abf32951', + '0xdccde9c6800bea86e2e91cf54a870ba3ff6faf9f', + '0x9cc62ef691e869c05fd2ec41839889d4e74c3a3f', + '0x3500e1d4e93c9f45aa8198efda16842cb73fa1bc', + '0x6654cddf2a14a06307af6a8d7731dd4e059962a1', + '0xdb5e7d5ac4e09206fed80efd7abd9976357e1c03', + '0x3db2bd838c2bed431dcfa012c3419b7e94d78456', +] + +async function tvl(api) { + return api.erc4626Sum2({ calls: vaults }) +} + +module.exports = { + doublecounted: true, + methodology: "We calculate TVL based on the Total Supply of our proxy contracts through which users interact with vault's contracts", + start: 1000235, + blast: { tvl }, +}; diff --git a/projects/cygnus-fi-restake/index.js b/projects/cygnus-fi-restake/index.js new file mode 100644 index 000000000000..af16c2f48bee --- /dev/null +++ b/projects/cygnus-fi-restake/index.js @@ -0,0 +1,31 @@ +const { sumTokensExport } = require('../helper/sumTokens'); +const ADDRESSES = require('../helper/coreAssets.json') + +// Cygnus is extending the restaking protocol to more chains. +// Bsquared is one of the first chains we are supporting. + +const CYGNUS_POOL_CONFIG = { + bsquared: { + UBTC: { + depositToken: ADDRESSES.bsquared.UBTC, + vault: '0x7551aEa51588AaCe99B89c3FaC3CFc4108DB8094' + }, + STBTC: { + depositToken: '0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3', + vault: '0x0Ce45dd53affbb011884EF1866E0738f58AB7969' + }, + UNIBTC: { + depositToken: '0x93919784C523f39CACaa98Ee0a9d96c3F32b593e', + vault: '0xBc323bA4bbf2559417C3Ca47A75e2Ea341Cf8320' + } + } +} + +module.exports = { + methodology: "Calculates assets locked in cygnus restaking vault", +} + +Object.keys(CYGNUS_POOL_CONFIG).forEach(chain => { + const tokensAndOwners = Object.values(CYGNUS_POOL_CONFIG[chain]).map(i => [i.depositToken, i.vault]) + module.exports[chain] = { tvl: sumTokensExport({ tokensAndOwners }) } +}) \ No newline at end of file diff --git a/projects/cygnus-fi-ton/index.js b/projects/cygnus-fi-ton/index.js new file mode 100644 index 000000000000..f795f9a54f16 --- /dev/null +++ b/projects/cygnus-fi-ton/index.js @@ -0,0 +1,31 @@ +const { call } = require("../helper/chain/ton") +const { get } = require('../helper/http') + +// helper function of getting jetton metadata +async function getJettonMetadata(addr) { + const res = await get(`https://tonapi.io/v2/jettons/${addr}`) + return res +} + +async function tvl(api) { + const CLTON_MINTER_ADDRESS = 'EQDz48al4FfPnapvXYJOfkBOIj3xvNZ0t5vSpQN-Qukqwm7W' + const CLTON_TOKEN_ADDRESS = 'EQCxd6SJQ8KiLkEpN3OoBfUIHqPE3yp0j80UnPysQqcTikNF' + + const cltonMinterResult = await call({ target: CLTON_MINTER_ADDRESS, abi: "get_minter_data", stack: [] }) + // exchange rate from clTON to TON: decimal 9 + + const cltonToTon = cltonMinterResult[4] / 1e9 + const cltonMetadata = await getJettonMetadata(CLTON_TOKEN_ADDRESS) + + // Now the tokens in the withdrawal vault will be correctly destroyed, so the TOTAL SUPPLY can be a true indication of tvl + const cltonTotalSupply = (cltonMetadata['total_supply']) / 1e9 + + const cltonTvl = cltonTotalSupply * cltonToTon + api.addCGToken("the-open-network", cltonTvl) +} + +module.exports = { + ton: { + tvl + } +}; \ No newline at end of file diff --git a/projects/cygnus-finance/index.js b/projects/cygnus-finance/index.js index a4a696fe38b8..91b035082561 100644 --- a/projects/cygnus-finance/index.js +++ b/projects/cygnus-finance/index.js @@ -13,12 +13,15 @@ async function getJettonMetadata(addr) { const res = await get(`https://tonapi.io/v2/jettons/${addr}`) return res } +async function getJettonBalance(address, jettonMasterAddress) { + const res = await get(`https://tonapi.io/v2/accounts/${address}/jettons/${jettonMasterAddress}`) + return res.balance +} 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 @@ -27,8 +30,11 @@ async function tonTvl() { const jettonResult = await getJettonMetadata(CGUSDT_ADDRESS) const cgUsdtTotalSupply = jettonResult['total_supply'] + // subtract the amount of cgUSDT in the withdrawal vault + const withdrawVaultBalance = await getJettonBalance(MINTER_ADDRESS, CGUSDT_ADDRESS) + // caculate tvl - const tvl = (cgUsdtTotalSupply) / 10 ** 6 * cgusdtTousdt + const tvl = (cgUsdtTotalSupply - withdrawVaultBalance) / 10 ** 6 * cgusdtTousdt return { "coingecko:tether": tvl } } diff --git a/projects/cytonic/index.js b/projects/cytonic/index.js new file mode 100644 index 000000000000..cb9e01c15f72 --- /dev/null +++ b/projects/cytonic/index.js @@ -0,0 +1,149 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +const { getProvider, sumTokens2, } = require("../helper/solana"); +const { Program } = require("@project-serum/anchor"); +const idl = { + "version": "0.1.0", + "name": "depositor", + "instructions": [], + "accounts": [ + { + "name": "VaultData", + "docs": [ + "Vault is a instance that holds general deposit data for a particular token", + "It is also responsible for freezing and migrating funds", + "When program receives funds, they are send on vault data's account's ATA" + ], + "type": { + "kind": "struct", + "fields": [ + { "name": "owner", "type": "publicKey" }, + { "name": "mint", "type": "publicKey" }, + { "name": "vaultAta", "type": "publicKey" }, + { "name": "withdrawDuration", "type": "u64" }, + { "name": "isFrozen", "type": "bool" }, + { "name": "totalDeposited", "type": "u64" }, + { "name": "bump", "type": "u8" }, + { "name": "allowedForPurchase", "type": "bool" }, + { "name": "purchaseRecepientAta", "type": "publicKey" }, + { "name": "admin", "type": "publicKey" } + ] + } + } + ], + "types": [], + "events": [], + "errors": [] +} + + +const BRIDGE_DEPOSITOR_EVM = '0xaEA5Bf79F1E3F2069a99A99928927988EC642e0B'; +const BRIDGE_DEPOSITOR_SOL = 'HYDqq5GfUj4aBuPpSCs4fkmeS7jZHRhrrQ3q72KsJdD4'; + +async function sol_tvl() { + const provider = getProvider() + const program = new Program(idl, BRIDGE_DEPOSITOR_SOL, provider) + const tokenAccounts = (await program.account.vaultData.all()).map((a) => a.account.vaultAta); + return sumTokens2({ tokenAccounts }) +} + + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // ETH + ADDRESSES.ethereum.WBTC, // WBTC + ADDRESSES.ethereum.WETH, // WETH + "0xd31a59c85ae9d8edefec411d448f90841571b89c", // WSOL + ADDRESSES.ethereum.WSTETH, // Lido WSTETH + ADDRESSES.ethereum.EETH, // EETH + '0xd9a442856c234a39a81a089c06451ebaa4306a72', // pufETH + '0xf951e335afb289353dc249e82926178eac7ded78', // swETH + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI + '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110', // ezETH + ADDRESSES.ethereum.USDe, // Ethena USD + ], + }), + }, + bsc: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // BNB + ADDRESSES.bsc.USDC, // USDC + ADDRESSES.bsc.USDT, // USDT + '0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3', // DAI + ], + }), + }, + arbitrum: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // ETH + ADDRESSES.arbitrum.USDC_CIRCLE, // USDC + ADDRESSES.arbitrum.USDT, // USDT + ADDRESSES.arbitrum.DAI, // DAI + ADDRESSES.optimism.ezETH, // ezETH + ], + }), + }, + base: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // ETH + ADDRESSES.base.USDC, // USDC + ], + }), + }, + polygon: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // POL + ADDRESSES.polygon.USDC, // USDC + ADDRESSES.polygon.USDT, // USDT + ADDRESSES.polygon.DAI, // DAI + ], + }), + }, + avax: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // AVA + ADDRESSES.avax.USDC, // USDC + ADDRESSES.avax.USDt, // USDT + ADDRESSES.avax.DAI, // DAI + ], + }), + }, + optimism: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // ETH + ADDRESSES.optimism.USDC_CIRCLE, // USDC + ADDRESSES.optimism.USDT, // USDT + ADDRESSES.optimism.DAI, // DAI + ], + }), + }, + blast: { + tvl: sumTokensExport({ + owner: BRIDGE_DEPOSITOR_EVM, + tokens: [ + ADDRESSES.null, // ETH + ADDRESSES.blast.USDB, // USDB + ], + }), + }, + solana: { + tvl: sol_tvl + } +} \ No newline at end of file diff --git a/projects/cytoswap/index.js b/projects/cytoswap/index.js new file mode 100644 index 000000000000..fd11aef50364 --- /dev/null +++ b/projects/cytoswap/index.js @@ -0,0 +1,7 @@ +const { uniV3GraphExport } = require('../helper/uniswapV3') + +module.exports = { + hela: { + tvl: uniV3GraphExport({ graphURL: 'https://subgraph.snapresearch.xyz/subgraphs/name/cytoswap-mainnet', name: 'cytoswap-hela' }), + } +} \ No newline at end of file diff --git a/projects/d2finance/index.js b/projects/d2finance/index.js index 975a89d36bf1..79b1afe321b9 100644 --- a/projects/d2finance/index.js +++ b/projects/d2finance/index.js @@ -1,22 +1,40 @@ const { sumERC4626VaultsExport } = require("../helper/erc4626"); -const vaultTvl = sumERC4626VaultsExport({ +const vaultTvlOnArbitrum = sumERC4626VaultsExport({ vaults: [ "0x27D22Eb71f00495Eccc89Bb02c2B68E6988C6A42", "0x183424d5ae5ec9fd486634bc566d0f75ad9c9109", - "0x80c403807b1032d7cb19b6d612ce23f05a213d36", "0x5b49d7fae00de64779ddcd6b067c8eb046bd9a0b", "0x291344FBaaC4fE14632061E4c336Fe3B94c52320", "0xEd80C858D43a1D043E86Cf1F20384e189cf23BDA", "0x4ada76cc8755f62508a2df65d7fafa4fd26e76c6", "0x1c17a39B156189BF40905425170a3Ff62fb650DA", "0x7348925D3C63e4E61e9F5308eEec0f06EaA3bB7b", + "0xD1D64dAeED7504Ef3Eb056aa2D973bD064843A84", + "0xB0730AA7d6e880F901B5d71A971096dB56895a0f", + "0x5f44A7DD0a016A5Ec9682df36899A781442CAa43", + "0x0215EdEecdABE3DfC5EC8D59337eC9b26d359088", + "0x36b1939ADf539a4AC94b57DBAd32FaEcd5bcF4d0", + "0x34F0FdD80A51dfd8bA42343c20F89217280d760E", + "0x57f467C9c4639B066F5A4D676Cd8Ed7D87C1791b", + "0x7348925D3C63e4E61e9F5308eEec0f06EaA3bB7b", + "0xCFBBea43Fd99126E4c0eF53e2344609D513f72b3", + "0x0F76De33a3679a6065D14780618b54584a3907D4", + "0x195a9e0f29f96d4ab2139ee1272380a4aa352890" ], isOG4626: true, }); +const vaultTvlOnAvalanche = sumERC4626VaultsExport({ + vaults: ["0x17Fd8C3d1e0379Cf6B1Dace21750E624EB9573C2"], + isOG4626: true, +}) + module.exports = { arbitrum: { - tvl: vaultTvl, + tvl: vaultTvlOnArbitrum, }, + avax: { + tvl: vaultTvlOnAvalanche, + } }; diff --git a/projects/d8x/index.js b/projects/d8x/index.js index 474940d7094d..87622b002f22 100644 --- a/projects/d8x/index.js +++ b/projects/d8x/index.js @@ -2,7 +2,7 @@ const abi = require("./abi-poolInfo.json"); const { sumTokens2 } = require("../helper/unwrapLPs"); const config = { - polygon_zkevm: { factory: "0xaB7794EcD2c8e9Decc6B577864b40eBf9204720f" }, + polygon_zkevm: { factory: "0x900DfC161C34656a9D9c43307F92255C2aa06162" }, xlayer: { factory: "0xb24dB543749277E8625a59C061aE7574C8235475" }, arbitrum: { factory: "0x8f8BccE4c180B699F81499005281fA89440D1e95" }, }; diff --git a/projects/dSOL/index.js b/projects/dSOL/index.js new file mode 100644 index 000000000000..70f6e31dce8b --- /dev/null +++ b/projects/dSOL/index.js @@ -0,0 +1,13 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + // dSOL sanctum stake pool : https://solscan.io/account/9mhGNSPArRMHpLDMSmxAvuoizBqtBGqYdT8WGuqgxNdn + await getSolBalanceFromStakePool('9mhGNSPArRMHpLDMSmxAvuoizBqtBGqYdT8WGuqgxNdn', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/dackieswap-v2/index.js b/projects/dackieswap-v2/index.js index 5d17bd3771c1..2fce6ef05040 100644 --- a/projects/dackieswap-v2/index.js +++ b/projects/dackieswap-v2/index.js @@ -15,6 +15,8 @@ const config = { inevm: '0x507940c2469e6e3b33032f1d4ff8d123bdde2f5c', mode: '0x757cd583004400ee67e5cc3c7a60c6a62e3f6d30', base: '0x591f122D1df761E616c13d265006fcbf4c6d6551', + linea: '0x9790713770039CeFcf4FAaf076E2846c9B7a4630', + wc: '0x757cD583004400ee67e5cC3c7A60C6a62E3F6d30', } module.exports = { diff --git a/projects/dackieswap/index.js b/projects/dackieswap/index.js index d84e295906b4..d7b1425e6f79 100644 --- a/projects/dackieswap/index.js +++ b/projects/dackieswap/index.js @@ -4,8 +4,10 @@ module.exports = uniV3Export({ base: { factory: "0x3D237AC6D2f425D2E890Cc99198818cc1FA48870", fromBlock: 2031627 }, optimism: { factory: "0xc2BC7A73613B9bD5F373FE10B55C59a69F4D617B", fromBlock: 115172042 }, arbitrum: { factory: "0xaEdc38bD52b0380b2Af4980948925734fD54FbF4", fromBlock: 180722131 }, - blast: { factory: "0xd1575B2e0C82fba9Eddc3de9c9AAF923AFA670cC", fromBlock: 286237 }, + blast: { factory: "0xCFC8BfD74422472277fB5Bc4Ec8851d98Ecb2976", fromBlock: 8239180 }, inevm: { factory: "0xf79A36F6f440392C63AD61252a64d5d3C43F860D", fromBlock: 291933 }, mode: { factory: "0xc6f3966E5D08Ced98aC30f8B65BeAB5882Be54C7", fromBlock: 6102035 }, xlayer: { factory: "0xc6f3966e5d08ced98ac30f8b65beab5882be54c7", fromBlock: 278971 }, + linea: { factory: "0xc6255ec7CDb11C890d02EBfE77825976457B2470", fromBlock: 8488016 }, + wc: { factory: "0xB9010964301326160173da694c0697a2FcE82F39", fromBlock: 4523073 }, }); \ No newline at end of file diff --git a/projects/dalmatiandex/index.js b/projects/dalmatiandex/index.js index ec70804526fa..9ee62afc08a9 100644 --- a/projects/dalmatiandex/index.js +++ b/projects/dalmatiandex/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0x80108b858e04d5a35EF7dA7A67Cf45eeD18abf27', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('shibarium', '0x80108b858e04d5a35EF7dA7A67Cf45eeD18abf27') \ No newline at end of file diff --git a/projects/damm-finance/index.js b/projects/damm-finance/index.js index 5274ec161d80..7814fb9b5895 100644 --- a/projects/damm-finance/index.js +++ b/projects/damm-finance/index.js @@ -1,17 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require('../helper/compound') -const WETH = ADDRESSES.ethereum.WETH const bETH = "0xe970c37243F3d0B2AeB041b855Ef6466CB140BcA" const unitroller = "0x4F96AB61520a6636331a48A11eaFBA8FB51f74e4" -const { tvl, borrowed } = compoundExports( - unitroller, "ethereum", bETH, WETH, ); +const { tvl, borrowed } = compoundExports(unitroller, bETH,); module.exports = { - methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", - ethereum: { tvl, borrowed }, - hallmarks:[ - [1664974802, "Liquidity Bonding Start"] - ], + methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + ethereum: { tvl, borrowed }, + hallmarks: [ + [1664974802, "Liquidity Bonding Start"] + ], } diff --git a/projects/danzo-arena/index.js b/projects/danzo-arena/index.js index b7084cb67d3a..95b91240b0d8 100644 --- a/projects/danzo-arena/index.js +++ b/projects/danzo-arena/index.js @@ -1,7 +1,8 @@ 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/ + "addr1vx4caaf06swdn7cdfc7pu3sw235zvuhd02tw2np4uac9mwcp2vt4y", //Danzo Tokens locked inside the address for the DeFi game DANZO ARENA: https://danzo.gg/arena/ + "addr1q8wu9v2wn8hkzq2g7q3ez8a99thw0gwmlhgpc2crmfk982xr2rqrszevgfwunrxu8ajh7pfhmaf6ppj60nj8rnhqhl4srgnekp", //Danzo Tokens locked inside the address for the DeFi game DANZO Game: https://danzo.gg ]; module.exports = { diff --git a/projects/daolama/borrowed.js b/projects/daolama/borrowed.js index cad75fd016c9..f18b21a40712 100644 --- a/projects/daolama/borrowed.js +++ b/projects/daolama/borrowed.js @@ -1,14 +1,17 @@ -const sdk = require("@defillama/sdk"); -const { transformBalances } = require("../helper/portedTokens"); -const { get } = require('../helper/http'); +const sdk = require('@defillama/sdk'); +const { transformBalances } = require('../helper/portedTokens'); const ADDRESSES = require('../helper/coreAssets.json'); -const { BASE_API_URL } = require("./constants"); -const nullAddress = ADDRESSES.null; +const { call } = require('../helper/chain/ton'); +const { POOL_ADDRESS } = require('./constants'); async function borrowed(api) { const balances = {}; - const result = await get(`${BASE_API_URL}/api/v1/analytics/borrowed`); - sdk.util.sumSingleBalance(balances, nullAddress, result.value, api.chain); + const result = await call({ + target: POOL_ADDRESS, + abi: 'get_pool_data', + }); + const borrowedTon = result[2]; + sdk.util.sumSingleBalance(balances, ADDRESSES.ton.TON, borrowedTon, api.chain); return transformBalances(api.chain, balances); } diff --git a/projects/daolama/constants.js b/projects/daolama/constants.js index 9e4e70753705..57a78813b32e 100644 --- a/projects/daolama/constants.js +++ b/projects/daolama/constants.js @@ -1,4 +1,3 @@ module.exports = { - BASE_API_URL: 'https://api.daolama.co', - POOL_ADDRESS: 'EQAwsDboFl_iGuaflNn5959HOamenkvQEQDwakO55CY2SGB8' + POOL_ADDRESS: 'EQCkeTvOSTBwBtP06X2BX7THj_dlX67PhgYRGuKfjWtB9FVb' } diff --git a/projects/daolama/tvl.js b/projects/daolama/tvl.js index e431da19e93f..ded130ec979a 100644 --- a/projects/daolama/tvl.js +++ b/projects/daolama/tvl.js @@ -1,7 +1,10 @@ -const ADDRESSES = require("../helper/coreAssets.json"); -const { POOL_ADDRESS } = require("./constants"); -const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require('../helper/coreAssets.json'); +const { POOL_ADDRESS } = require('./constants'); +const { sumTokensExport } = require('../helper/chain/ton'); module.exports = { - tvl: sumTokensExport({ owner: POOL_ADDRESS, tokens: [ADDRESSES.ton.TON, ADDRESSES.ton.USDT]}), + tvl: sumTokensExport({ + owners: [POOL_ADDRESS], + tokens: [ADDRESSES.ton.TON, ADDRESSES.ton.USDT] + }), } diff --git a/projects/darkauto/abi.json b/projects/darkauto/abi.json deleted file mode 100644 index cc4d761525d2..000000000000 --- a/projects/darkauto/abi.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "poolLength": "uint256:poolLength", - "wantLockedTotal": "uint256:wantLockedTotal", - "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)" -} \ No newline at end of file diff --git a/projects/darkauto/index.js b/projects/darkauto/index.js index a8580e16417c..e28e2ad7909f 100644 --- a/projects/darkauto/index.js +++ b/projects/darkauto/index.js @@ -1,21 +1,31 @@ -const vaultUtils = require("./utils") +const { sumUnknownTokens } = require("../helper/unknownTokens") -async function cronosTVL(timestamp, block, chainBlocks){ - const vaultAddress = "0x66D586eae9B30CD730155Cb7fb361e79D372eA2a" - return await vaultUtils.tvl(chainBlocks.cronos, 'cronos', vaultAddress) +module.exports = { + doublecounted: true, + misrepresentedTokens: true, } -async function dogechainTVL(timestamp, block, chainBlocks){ - const vaultAddress = "0xf5e5271432089254288F47d6F2CFcfE066377900" - return await vaultUtils.tvl(chainBlocks.dogechain, 'dogechain', vaultAddress) + +const config = { + cronos: '0x66D586eae9B30CD730155Cb7fb361e79D372eA2a', + dogechain: '0xf5e5271432089254288F47d6F2CFcfE066377900', } -module.exports = { - doublecounted: true, - cronos: { - tvl: cronosTVL, - }, - dogechain: { - tvl: dogechainTVL, +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: config[chain] }) + const lps = poolInfos.map(pool => pool.want) + const strategies = poolInfos.map(pool => pool.strategy) + const bals = await api.multiCall({ abi: abi.wantLockedTotal, calls: strategies }) + api.add(lps, bals) + return sumUnknownTokens({ api, lps, resolveLP: true }) + } } -}; +}) + +const abi = { + "poolLength": "uint256:poolLength", + "wantLockedTotal": "uint256:wantLockedTotal", + "poolInfo": "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)" +} \ No newline at end of file diff --git a/projects/darkauto/utils.js b/projects/darkauto/utils.js deleted file mode 100644 index 2e318248baef..000000000000 --- a/projects/darkauto/utils.js +++ /dev/null @@ -1,125 +0,0 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const abi = require("./abi.json"); -const { getLPData, getTokenPrices, } = require('../helper/unknownTokens'); - -const farmLPBalance = async ( - chain, - block, - lpToken, - lpLocked, - token0, - token1, -) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - } - ], - block, - chain: chain, - }) - ).output; - - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: "erc20:totalSupply", - chain: chain, - block, - }) - ).output; - const token0Locked = (lpLocked * balances[0].output) / lpTotalSuply; - const token1Locked = (lpLocked * balances[1].output) / lpTotalSuply; - - return [ - { token: `${chain}:${token0}`, locked: token0Locked }, - { token: `${chain}:${token1}`, locked: token1Locked }, - ]; -}; - - - -const tvl = async (block, chain, vaultAddress) => { - const balances = {}; - const { output: poolLength } = await sdk.api.abi.call({ - abi: abi["poolLength"], - target: vaultAddress, - chain, - }) - let calls = [] - for (let i = 0; i < poolLength; i++) { - calls.push({ - target: vaultAddress, - params: [i] - }) - } - let poolInfos = - await sdk.api.abi.multiCall({ - abi: abi["poolInfo"], - calls, - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(poolInfo => poolInfo.output)); - - const lps = poolInfos.map(pool =>{ - return pool.want - }) - - const tokenInfos = await getLPData({block, chain, lps, allLps: false}) - - let wanLockedTotals = - await sdk.api.abi.multiCall({ - abi: abi["wantLockedTotal"], - calls: poolInfos.map(poolInfo => { - return { - target: poolInfo.strategy, - params: [] - } - }), - block, - chain: chain, - }) - .then(d => d.output).then(d => d.map(lock => lock.output)); - - let requests = []; - calls.map((item, idx) => { - const lpAddress = poolInfos[idx].want.toLowerCase(); - if(!tokenInfos[lpAddress]) - return null; - - requests.push(farmLPBalance( - chain, - block, - lpAddress, - wanLockedTotals[idx], - tokenInfos[lpAddress].token0Address, - tokenInfos[lpAddress].token1Address - )); - }); - const data = await Promise.all(requests); - - data.forEach((farm) => { - farm.forEach((item) => { - balances[item.token] = new BigNumber(balances[item.token] || 0) - .plus(item.locked || 0) - .toFixed(0); - }); - }); - - const { updateBalances, prices} = await getTokenPrices({ chain, block, lps, useDefaultCoreAssets: true}) - await updateBalances(balances) - return balances; -}; -module.exports = { - tvl, -}; diff --git a/projects/darkcrypto/farm-utils.js b/projects/darkcrypto/farm-utils.js index 22195222b33e..c6e9c7371172 100644 --- a/projects/darkcrypto/farm-utils.js +++ b/projects/darkcrypto/farm-utils.js @@ -1,90 +1,38 @@ -const sdk = require('@defillama/sdk'); -const BigNumber = require('bignumber.js'); -const farmCronos = require('./farm-cronos.json'); +const abi = { + getReserves: "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)", + poolInfo: "function poolInfo(uint256) view returns (address token, uint256 allocPoint, uint256 lastRewardTime, uint256 accSkyPerShare, bool isStarted)" +} -const farmLPBalance = async ( - chain, - block, - masterChef, - lpToken, - token0, - token1, -) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - }, - { - target: lpToken, - params: [masterChef], - }, - ], - block, - chain: chain, - }) - ).output; - - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: 'erc20:totalSupply', - chain: chain, - block, - }) - ).output; - const token0Locked = (balances[2].output * balances[0].output) / lpTotalSuply; - const token1Locked = (balances[2].output * balances[1].output) / lpTotalSuply; - return [ - { token: `${chain}:${token0}`, locked: token0Locked }, - { token: `${chain}:${token1}`, locked: token1Locked }, - ]; -}; +const pool2Balances = async (api, masterChef) => { + const calls = Array.from({ length: 9 }, (_, i) => ({ target: masterChef, params: [i] })); + const poolsInfos = await api.multiCall({ calls, abi: abi.poolInfo }) + const pools = poolsInfos.map(({ token }) => token) + const [token0s, token1s, balances, reserves, supplies] = await Promise.all([ + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'address:token0', permitFailure: true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'address:token1', permitFailure: true }), + api.multiCall({ calls: pools.map((p) => ({ target: p, params: [masterChef] })), abi: 'erc20:balanceOf', permitFailure:true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: abi.getReserves, permitFailure:true }), + api.multiCall({ calls: pools.map((p) => ({ target: p })), abi: 'erc20:totalSupply', permitFailure:true }) + ]) -const farmLocked = async (block) => { - const balances = {}; - const tokens = farmCronos.tokens; + pools.forEach((_, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + const balance = balances[i] + const reserve = reserves[i] + const supply = supplies[i] + if (!token0 || !token1 || !balance || !reserve || !supply) return - const allPools = farmCronos.farms - .map((t) => { - return t.pools.map((pool) => { - return Object.assign(pool, { - masterChef: t.masterChef, - }); - }); - }) - .reduce((acc, current) => [...acc, ...current], []); - const promises = allPools.map((item) => { - return farmLPBalance( - 'cronos', - block, - item.masterChef, - item.lpToken, - tokens[item.token0], - tokens[item.token1], - ); - }); + const _balance0 = Math.round(reserve[0] * balance / supply) + const _balance1 = Math.round(reserve[1] * balance / supply) - const data = await Promise.all(promises); - data.forEach((farm) => { - farm.forEach((item) => { - balances[item.token] = new BigNumber(balances[item.token] || 0) - .plus(item.locked || 0) - .toFixed(0); - }); - }); + api.add(token0, _balance0) + api.add(token1, _balance1) + }) +} - return balances; -}; module.exports = { - farmLocked, -}; + pool2Balances +} \ No newline at end of file diff --git a/projects/darkcrypto/index.js b/projects/darkcrypto/index.js index 0ba25a6e1abd..895db318fdb2 100644 --- a/projects/darkcrypto/index.js +++ b/projects/darkcrypto/index.js @@ -1,33 +1,10 @@ const { stakingUnknownPricedLP } = require("../helper/staking"); -const farmUtils = require("./farm-utils"); const vaultUtils = require("./vault-utils") +const { pool2Balances } = require("./farm-utils"); -const sdk = require("@defillama/sdk"); const sky = "0x9D3BBb0e988D9Fb2d55d07Fe471Be2266AD9c81c"; const boardroom = "0x2e7d17ABCb9a2a40ec482B2ac9a9F811c12Bf630"; - - -async function pool2(timestamp, block, chainBlocks) { - // SKY POOL - const farmTvl = await farmUtils.farmLocked(chainBlocks["cronos"]); - let balances = {}; - - //add CRO balance in LP pool - sdk.util.sumSingleBalance( - balances, - "cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", - farmTvl["cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"] - ); - - //add Dark and Sky balance in LP pool - sdk.util.sumSingleBalance( - balances, - "cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", - farmTvl["cronos:0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"], - ); - - return balances; -} +const masterChef = "0x42B652A523367e7407Fb4BF2fA1F430781e7db8C" async function vault(api){ return vaultUtils.vaultLocked(api) @@ -37,13 +14,12 @@ module.exports = { doublecounted: true, cronos: { tvl:vault, - pool2, + pool2: (api) => pool2Balances(api, masterChef), staking: stakingUnknownPricedLP( boardroom, sky, "cronos", "0xaA0845EE17e4f1D4F3A8c22cB1e8102baCf56a77" ), - }, }; diff --git a/projects/darkness/index.js b/projects/darkness/index.js index ac1f3dce8ca7..6d7d830dc2d9 100644 --- a/projects/darkness/index.js +++ b/projects/darkness/index.js @@ -10,7 +10,7 @@ module.exports = { tvl: sumTokensExport({ owner: '0x92631e0e84ff01853ef1bb88fc9c9f7d1e1af1ca', tokens: [ - '0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23', + ADDRESSES.cronos.WCRO_1, '0xf2001b145b43032aaf5ee2884e456ccd805f677d', ADDRESSES.cronos.USDC, '0x6582c738660bf0701f05b04dce3c4e5fcfcda47a', diff --git a/projects/dddx.js b/projects/dddx.js index 74a17009ea41..5f23d33d4707 100644 --- a/projects/dddx.js +++ b/projects/dddx.js @@ -3,7 +3,6 @@ const { stakings } = require("./helper/staking"); module.exports = { misrepresentedTokens: true, - incentivized: true, bsc: { tvl: getUniTVL({ factory: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', useDefaultCoreAssets: true }), staking: stakings( @@ -14,7 +13,6 @@ module.exports = { ], '0x4B6ee8188d6Df169E1071a7c96929640D61f144f', - 'bsc' ) } }; diff --git a/projects/dedust/index.js b/projects/dedust/index.js index 0d504ed2c0dc..14452d04ffa7 100644 --- a/projects/dedust/index.js +++ b/projects/dedust/index.js @@ -1,5 +1,11 @@ const { get } = require('../helper/http') +const { call } = require('../helper/chain/ton') const { transformDexBalances } = require('../helper/portedTokens') +const ADDRESSES = require("../helper/coreAssets.json"); + + +const SCALE_STAKING_ADDRESS = 'EQBNZB91JJX9Ub7KMEAUoQNVcQlCsob5e_WMFbvsML_UoAKD' +const SCALE = "EQBlqsm144Dq6SjbPI4jjZvA1hqTIP3CvHovbIfW_t-SCALE" module.exports = { misrepresentedTokens: true, @@ -17,6 +23,13 @@ module.exports = { token1Bal: i.right_token_reserve, })) }) + }, + staking: async (api) => { + const get_staking_data = await call({ target: SCALE_STAKING_ADDRESS, abi: "get_staking_data" }) + // TODO: move this to price server + const price_response = await get(`https://tonapi.io/v2/rates?tokens=${SCALE}¤cies=ton`) + const scale_price = price_response.rates[SCALE].prices.TON + return api.add(ADDRESSES.ton.TON, parseInt(get_staking_data[3]) * scale_price) } } } diff --git a/projects/deepbook-sui/index.js b/projects/deepbook-sui/index.js index f09f1fb55a96..48e9623c26d3 100644 --- a/projects/deepbook-sui/index.js +++ b/projects/deepbook-sui/index.js @@ -34,6 +34,7 @@ function findClosestTvl(data, ts) { // Sum all unique values together let totalTvl = Object.values(aggregatedTvl).reduce((acc, current) => acc + current, 0); + if (+totalTvl<0) return 0 return totalTvl; } diff --git a/projects/deepbook-v3/index.js b/projects/deepbook-v3/index.js new file mode 100644 index 000000000000..88495a261b87 --- /dev/null +++ b/projects/deepbook-v3/index.js @@ -0,0 +1,32 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { get } = require("../helper/http"); + +const coins = { + deepType: "0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP", + suiType: "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI", + usdcType: ADDRESSES.sui.USDC_CIRCLE, + bethType: "0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH", + wusdtType: ADDRESSES.sui.USDT, + wusdcType: ADDRESSES.sui.USDC, + nsType: "0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS", + typusType: "0xf82dc05634970553615eef6112a1ac4fb7bf10272bf6cbe0f80ef44a6c489385::typus::TYPUS", +} + +const endpointUrl = "https://deepbook-indexer.mainnet.mystenlabs.com" +const endpointName = "get_net_deposits" + +const tvl = async (api) => { + const url = `${endpointUrl}/${endpointName}/${Object.values(coins).join(',')}/${api.timestamp}` + const data = await get(url) + Object.keys(data).forEach(coin => { + api.add(coin, data[coin]) + }) +} + +module.exports = { + methodology: "All deposits into all BalanceManagers minutes all withdrawals from all BalanceManagers", + start: 1728858752, + sui: { + tvl, + } +} \ No newline at end of file diff --git a/projects/deepr-finance/index.js b/projects/deepr-finance/index.js index b252e40e0b5b..4735b983be03 100644 --- a/projects/deepr-finance/index.js +++ b/projects/deepr-finance/index.js @@ -1,6 +1,11 @@ -const { compoundExports2, methodology, } = require('../helper/compound'); +const { compoundExports2, methodology } = require("../helper/compound"); module.exports = { - shimmer_evm: compoundExports2({ comptroller: '0xF7E452A8685D57083Edf4e4CC8064EcDcF71D7B7', }), + shimmer_evm: compoundExports2({ + comptroller: "0xF7E452A8685D57083Edf4e4CC8064EcDcF71D7B7", + }), + iotaevm: compoundExports2({ + comptroller: "0xee07121d97FDEA35675e02017837a7a43aeDa48F", + }), methodology, -} \ No newline at end of file +}; diff --git a/projects/defi-money/index.js b/projects/defi-money/index.js new file mode 100644 index 000000000000..984d9f37889a --- /dev/null +++ b/projects/defi-money/index.js @@ -0,0 +1,62 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const config = { + optimism: { + controller: "0x1337F001E280420EcCe9E7B934Fa07D67fdb62CD", + MONEY: "0x7e803F4edd6528caFBf5C5d03Cc106b04379C24b", + stakeLPs: [ + // "0x7e803F4edd6528caFBf5C5d03Cc106b04379C24b", // MONEY - already included in tvl + "0xE8f00491afa68B4A653C77e5f92DBA0F8df3a185", // crvUSD/MONEY + "0xa398a48C2738fd6c79F5654823Fb93456B0fDaF6", // USDT/MONEY + "0x36afCD1083eE9186A2b984E10d75C1E14b99B75e", // USDC/MONEY + "0xcf38a66DeD7825cfEF66046c256Aa0EDbd41BEf5", // DAI/MONEY + "0x73C3eC2b8e00929824a529e60fb6ed8aF193c7cc", // FRAX/MONEY + ], + }, + arbitrum: { + controller: "0x1337F001E280420EcCe9E7B934Fa07D67fdb62CD", + MONEY: "0xEbE54BEE7A397919C53850bA68E126b0A6b295ed", + stakeLPs: [ + // "0xEbE54BEE7A397919C53850bA68E126b0A6b295ed", // MONEY - already included in tvl + "0xF2852d7e810d3EC7094bFE1D7DDCa5044c259c25", // crvUSD/MONEY + "0x6e59b326984fC132F16a977cd20E38641A9043De", // USDT/MONEY + "0xdE718A791226c93B53C77D60E5D4693C05a31422", // USDC/MONEY + "0xE3763d545707F435e21eeBbe75070495c806B744", // DAI/MONEY + "0x07aDF588508b923B8eA0389d27b61b9CB8a197Cb", // FRAX/MONEY + ], + }, + base: { + controller: "0x1337F001E280420EcCe9E7B934Fa07D67fdb62CD", + MONEY: "0xEbE54BEE7A397919C53850bA68E126b0A6b295ed", + stakeLPs: [ + // "0x9F04112af02CE57C10d946481Ea06373719c1E7E", // MONEY - already included in tvl + "0xe0f7c023763d782970ab45e9232255a64290cd6a", // crvUSD/MONEY + "0xb7698c690752ae034e914a29a0de67339a94982b", // USDC/MONEY + "0x45acdee3c9f7e1c7ad6cc10c9cb9f74eb52d0e70", // USDbC/MONEY + "0xac786337dde86b768ea3cc90afa03250bccfff28", // DAI/MONEY + ], + }, +} + +const tvl = async (api) => { + const { controller, } = config[api.chain] + const colls = await api.call({ target: controller, abi: 'address[]:get_all_collaterals' }) + const amms = await api.multiCall({ abi: 'function get_amm(address) view returns (address)', calls: colls, target: controller }) + return sumTokens2({ api, tokensAndOwners2: [colls, amms]}) +} + +const pool2 = async (api) => { + const { stakeLPs = [], } = config[api.chain] + const tokens = await api.multiCall({ abi: 'address:STAKE_TOKEN', calls: stakeLPs }) + return sumTokens2({ api, tokensAndOwners2: [tokens, stakeLPs]}) +} + +module.exports = { + methodology: "TVL corresponds to the collateral deposited in the markets", +} + +Object.keys(config).forEach((chain) => { + module.exports[chain] = { + tvl, pool2, + } +}) diff --git a/projects/defx/index.js b/projects/defx/index.js new file mode 100644 index 000000000000..98626e678f71 --- /dev/null +++ b/projects/defx/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ tokensAndOwners: [ + [ + ADDRESSES.arbitrum.USDC_CIRCLE, + '0x091486F9427cf07942fa17Ad7194BE3feaDfa46d' + ] + ]}) + } +} \ No newline at end of file diff --git a/projects/delagate-xyz/index.js b/projects/delagate-xyz/index.js new file mode 100644 index 000000000000..0eb3f51366ce --- /dev/null +++ b/projects/delagate-xyz/index.js @@ -0,0 +1,25 @@ +const { getLogs2, } = require('../helper/cache/getLogs') +const { getUniqueAddresses } = require('../helper/tokenMapping') +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(api) { + const tokens = await getLogs2({ + api, + factory: '0x00000000000000447e69651d841bD8D104Bed493', + fromBlock: 18184587, + eventAbi: 'event DelegateERC721 (address indexed from, address indexed to, address indexed contract, uint256 tokenId, bytes32 rights, bool enable)', + customCacheFunction: ({ cache, logs }) => { + if (!cache.logs) cache.logs = [] + cache.logs.push(...logs.map(i => i.contract)) + cache.logs = getUniqueAddresses(cache.logs) + return cache + }, + }) + return sumTokens2({ owner: '0xc2e257476822377dfb549f001b4cb00103345e66', tokens, permitFailure: true, sumChunkSize: 50 }) +} + +module.exports = { + ethereum: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/delta/index.js b/projects/delta/index.js index e0ad89e1b9a6..c7a6143220d6 100644 --- a/projects/delta/index.js +++ b/projects/delta/index.js @@ -1,6 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); const { staking } = require("../helper/staking"); const vaultStakingContract = "0x9fE9Bb6B66958f2271C4B0aD23F6E8DDA8C221BE"; @@ -8,74 +5,18 @@ const rebasingContract = "0xfcfC434ee5BfF924222e084a8876Eee74Ea7cfbA"; const DELTA_WETH_SLP = "0x1498bd576454159Bb81B5Ce532692a8752D163e8"; const DELTA = "0x9EA3b5b4EC044b70375236A281986106457b20EF"; -const WETH = ADDRESSES.ethereum.WETH; -async function Pool2(timestamp, block) { - const balances = {}; - - const totalSupply_slp = ( - await sdk.api.erc20.totalSupply({ - target: DELTA_WETH_SLP, - }) - ).output; - - const totalSupply_rlp = ( - await sdk.api.erc20.totalSupply({ - target: rebasingContract, - }) - ).output; - - const balance_slp = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: DELTA_WETH_SLP, - params: rebasingContract, - block - }) - ).output; - - const balance_rlp = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: rebasingContract, - params: vaultStakingContract, - block - }) - ).output; - - const underlyingsBalance = ( - await sdk.api.abi.multiCall({ - calls: [DELTA, WETH].map((token) => ({ - target: token, - params: DELTA_WETH_SLP, - })), - abi: 'erc20:balanceOf', - block - }) - ).output; - - underlyingsBalance.forEach((call) => { - const underlyingSetBalance = BigNumber(call.output) - .times(balance_slp) - .div(totalSupply_slp) - .times(balance_rlp) - .div(totalSupply_rlp); - - sdk.util.sumSingleBalance( - balances, - call.input.target, - underlyingSetBalance.toFixed(0) - ); - }); - - return balances; +async function pool2(api) { + const totalSupply_rlp = await api.call({ abi: 'erc20:totalSupply', target: rebasingContract, }) + const balance_slp = await api.call({ abi: 'erc20:balanceOf', target: DELTA_WETH_SLP, params: rebasingContract, }) + const balance_rlp = await api.call({ abi: 'erc20:balanceOf', target: rebasingContract, params: vaultStakingContract, }) + api.add(DELTA_WETH_SLP, balance_slp * balance_rlp / totalSupply_rlp) } module.exports = { - misrepresentedTokens: true, ethereum: { staking: staking(vaultStakingContract, DELTA), - pool2: Pool2, + pool2, tvl: async () => ({}) }, methodology: "Counts liquidty on the Staking and Pool2", diff --git a/projects/deltaprime/index.js b/projects/deltaprime/index.js index 649aa73e1f80..626b2577ad0a 100644 --- a/projects/deltaprime/index.js +++ b/projects/deltaprime/index.js @@ -95,8 +95,6 @@ async function tvlAvalanche(api) { 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/assetToAddressMappingArbitrum.json b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json index f5d72b8ee7ae..39fef5797e3a 100644 --- a/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json +++ b/projects/deltaprime/mappings/assetToAddressMappingArbitrum.json @@ -21,8 +21,13 @@ "GM_ARB_ARB_USDC": "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", "GM_LINK_LINK_USDC": "0x7f1fa204bb700853D36994DA19F830b6Ad18455C", "GM_UNI_UNI_USDC": "0xc7Abb2C5f3BF3CEB389dF0Eecd6120D451170B50", - "GM_SOL_SOL_USDC": "0x09400D9DB990D5ed3f35D7be61DfAEB900Af03C9", "GM_BTC_WBTC_USDC": "0x47c031236e19d024b42f8AE6780E44A573170703", + "GM_SOL_SOL_USDC": "0x09400D9DB990D5ed3f35D7be61DfAEB900Af03C9", + "GM_NEAR_WETH_USDC": "0x63Dc80EE90F26363B3FCD609007CC9e14c8991BE", + "GM_ATOM_WETH_USDC": "0x248C35760068cE009a13076D573ed3497A47bCD4", + "GM_GMX_GMX_USDC": "0x55391D178Ce46e7AC8eaAEa50A72D1A5a8A622Da", + "GM_ETH_WETH": "0x450bb6774Dd8a756274E0ab4107953259d2ac541", + "GM_BTC_WBTC": "0x7C11F78Ce78768518D743E81Fdfa2F860C6b9A77", "arbSnrLLP": "0x5573405636F4b895E511C9C54aAfbefa0E7Ee458", "arbMzeLLP": "0xb076f79f8D1477165E2ff8fa99930381FB7d94c1", "arbJnrLLP": "0x502697AF336F7413Bb4706262e7C506Edab4f3B9", @@ -38,8 +43,12 @@ "weETH": "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", "rsETH": "0x4186BFC76E2E237523CBC30FD220FE055156b41F", "PENDLE_EZ_ETH_LP": "0xecCDC2C2191d5148905229c5226375124934b63b", + "PENDLE_EZ_ETH_26_09_24": "0xB3f215aFD47Dd29f4B82D9b480BB86FeAF543e67", "PENDLE_WSTETH_LP": "0xdb0e1D1872202A81Eb0cb655137f4a937873E02f", + "PENDLE_WSTETH_26_06_25": "0x4d2Faa48Ef93Cc3c8A7Ec27F3Cb91cEB1a36F89B", "PENDLE_E_ETH_LP": "0x264f4138161aaE16b76dEc7D4eEb756f25Fa67Cd", + "PENDLE_E_ETH_26_09_24": "0xa7D760926F3098E9fb5A93018155578fCDad75C0", "PENDLE_RS_ETH_LP": "0xe3B327c43b5002eb7280Eef52823698b6cDA06cF", + "PENDLE_RS_ETH_26_09_24": "0x9e411b97437Af296D6c4b482893c63Ffd8DfBE6D", "PENDLE_SILO_ETH_WSTETH_LP": "0xCcCC7c80c9Be9fDf22e322A5fdbfD2ef6ac5D574" } diff --git a/projects/deltatrade.js b/projects/deltatrade.js new file mode 100644 index 000000000000..815fecee3301 --- /dev/null +++ b/projects/deltatrade.js @@ -0,0 +1,67 @@ +const ADDRESSES = require('./helper/coreAssets.json') +const { sumTokens } = require('./helper/chain/near') +const { getConfig } = require('./helper/cache') +const { get } = require('./helper/http') + +const { PublicKey } = require('@solana/web3.js'); +const { sumTokens2, ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, } = require('./helper/solana') + +const state = new PublicKey('FRcbUFpGHQppvXAyJrNYLKME1BQfowh4xKZB2vt9j6yn'); +const programId = new PublicKey('CNLGhYQgNwjyDfHZTEjHfk1MPkqwP96qZahWN82UfcLM'); + +const GRID_CONTRACT_ID = 'grid.deltatrade.near'; +const DCA_CONTRACT_ID = 'dca.deltatrade.near'; + +const tokens = [ + 'wrap.near', + '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1', + 'token.v2.ref-finance.near', + ADDRESSES.near.BURROW, + 'token.lonkingnearbackto2024.near', + 'blackdragon.tkn.near', + 'ftv2.nekotoken.near', + 'gear.enleap.near', + 'token.0xshitzu.near', + 'edge-fast.near', + '802d89b6e511b335f05024a65161bce7efc3f311.factory.bridge.near', +] + +module.exports = { + timetravel: false, + near: { + tvl: () => sumTokens({ tokens, owners: [GRID_CONTRACT_ID, DCA_CONTRACT_ID] }), + }, + solana: { + tvl: solanaTvl, + } +} + +async function getTokens() { + return getConfig('deltatrade/sol-pairs', undefined, { + fetcher: async () => { + const { data } = await get('https://solapi.deltatrade.ai/api/bot/grid/pairs'); + const tokenSet = new Set() + data.forEach(pair => { + tokenSet.add(pair.base_token.code) + tokenSet.add(pair.quote_token.code) + }) + const arry = Array.from(tokenSet) + arry.sort() + return arry + } + }) +} + +function getGlobalBalanceUser(token) { + const [globalBalPda] = PublicKey.findProgramAddressSync([Buffer.from("global_balance_user"), state.toBuffer(), new PublicKey(token).toBuffer()], programId); + + // const globalBalTokenAccount = await Token.getAssociatedTokenAddress(ASSOCIATED_TOKEN_PROGRAM_ID, TOKEN_PROGRAM_ID, new PublicKey(token), new PublicKey(globalBalPda.toString()), true); + const [tokenAccount] = PublicKey.findProgramAddressSync([new PublicKey(globalBalPda.toString()), TOKEN_PROGRAM_ID, new PublicKey(token)].map(i => i.toBuffer()), ASSOCIATED_TOKEN_PROGRAM_ID) + return tokenAccount.toString(); +} + +async function solanaTvl() { + const tokens = await getTokens(); + const tokenAccounts = tokens.map(getGlobalBalanceUser) + return sumTokens2({ tokenAccounts }) +} diff --git a/projects/demeter/index.js b/projects/demeter/index.js index c7adf3de8270..d414bdcd542f 100644 --- a/projects/demeter/index.js +++ b/projects/demeter/index.js @@ -2,6 +2,9 @@ const { get } = require('../helper/http') async function fetch() { let results = await get('https://api.deotoken.com/api/demeter/supply-data'); + if(results.tvl > 1e9){ + throw new Error(">1bn") + } return results.tvl; } diff --git a/projects/demodyfi/index.js b/projects/demodyfi/index.js index 5d4e830a964e..4d2e07f3ae24 100644 --- a/projects/demodyfi/index.js +++ b/projects/demodyfi/index.js @@ -1,139 +1,19 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const wGLMR = ADDRESSES.moonbeam.WGLMR; -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - -async function dmodBscStakingPool(timestamp, block, chainBlocks) { - const stakingBalance = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "bsc", - target: "0x002D8563759f5e1EAf8784181F3973288F6856e4", - params: ["0xc94e085E2E2D92A950fa4A6B923263C0B47c6dBa"], - block: chainBlocks["bsc"], - }) - ).output - ); - - const decimals = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:decimals", - chain: "bsc", - target: "0x002D8563759f5e1EAf8784181F3973288F6856e4", - params: [], - block: chainBlocks["bsc"], - }) - ).output - ); - - return { 'demodyfi': stakingBalance.div(new BigNumber(10).pow(decimals)).toFixed(0) }; -} -async function dmodEthereumStakingPool(timestamp, block, chainBlocks) { - const stakingBalance = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "ethereum", - target: ADDRESSES.moonbeam.WGLMR, - params: ["0x024D59Ac0Bb03dEd28B9A16cd50B3d242B43a683"], - block - }) - ).output - ); - - const decimals = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:decimals", - chain: "ethereum", - target: ADDRESSES.moonbeam.WGLMR, - params: [], - block - }) - ).output - ); - - return { 'demodyfi': stakingBalance.div(new BigNumber(10).pow(decimals)).toFixed(0) }; -} -async function dmodBscLPPool(timestamp, block, chainBlocks) { - const transform = i => `bsc:${i}`; - const balances = {}; - - const lpTokenbalance = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "bsc", - target: "0x0f35d854C267D29C0E418F561b75aE09B9E413D4", - params: ["0xc94e085E2E2D92A950fa4A6B923263C0B47c6dBa"], - block: chainBlocks["bsc"], - }) - ).output - ); - - await unwrapUniswapLPs( - balances, - [ - { - balance: lpTokenbalance, - token: "0x0f35d854C267D29C0E418F561b75aE09B9E413D4", - }, - ], - chainBlocks["bsc"], - "bsc", - transform - ); - - return balances; -} -async function dmodEthereumLPPool(timestamp, block, chainBlocks) { - const balances = {}; - - const lpTokenbalance = new BigNumber( - ( - await sdk.api.abi.call({ - abi: "erc20:balanceOf", - chain: "ethereum", - target: "0xD5B1Cd8D245A93E0697707AEe82497388508b132", - params: ["0x024D59Ac0Bb03dEd28B9A16cd50B3d242B43a683"], - block - }) - ).output - ); - - await unwrapUniswapLPs( - balances, - [ - { - balance: lpTokenbalance, - token: "0xD5B1Cd8D245A93E0697707AEe82497388508b132", - }, - ], - block, - "ethereum" - ); - - return balances; -} +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') module.exports = { misrepresentedTokens: true, ethereum: { - tvl: () => ({}), - staking: dmodEthereumStakingPool, - pool2: dmodEthereumLPPool + staking: staking('0x024D59Ac0Bb03dEd28B9A16cd50B3d242B43a683', ADDRESSES.moonbeam.WGLMR), + pool2: pool2('0x024D59Ac0Bb03dEd28B9A16cd50B3d242B43a683', '0xD5B1Cd8D245A93E0697707AEe82497388508b132'), }, bsc: { - tvl: () => ({}), - staking: dmodBscStakingPool, - pool2: dmodBscLPPool + staking: staking('0xc94e085E2E2D92A950fa4A6B923263C0B47c6dBa', '0x002D8563759f5e1EAf8784181F3973288F6856e4'), + pool2: pool2('0xc94e085E2E2D92A950fa4A6B923263C0B47c6dBa', '0x0f35d854C267D29C0E418F561b75aE09B9E413D4'), }, moonbeam: { tvl: getUniTVL({ factory: '0x61999fAb7fdcEe1B26b82b5c2f825BCC8F8c2458', useDefaultCoreAssets: true }), }, -}; -// node test.js projects/demodyfi/index.js \ No newline at end of file +}; \ No newline at end of file diff --git a/projects/deq/index.js b/projects/deq/index.js new file mode 100644 index 000000000000..718f0d3bcace --- /dev/null +++ b/projects/deq/index.js @@ -0,0 +1,7 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + ethereum: { + tvl: sumERC4626VaultsExport({ vaults: ['0x3742f3Fcc56B2d46c7B8CA77c23be60Cd43Ca80a'], tokenAbi: 'avail', balanceAbi: 'assets'}), + } +} \ No newline at end of file diff --git a/projects/deri-v4/index.js b/projects/deri-v4/index.js index adca15cd19fa..2107b324e619 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 eb71c2aab713..1a8d8eb5178e 100644 --- a/projects/deribit/index.js +++ b/projects/deribit/index.js @@ -1,24 +1,8 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { - bitcoin: { - // from https://insights.deribit.com/exchange-updates/deribit-wallet-holdings/ - owners: [ - "bc1qa3phj5uhnuauk6r62cku6r6fl9rawqx4n6d690", - "bc1qtq5zfllw9fs9w6stnfgalf9v59fgrcxxyawuvm", - "1MDq7zyLw6oKichbFiDDZ3aaK59byc6CT8", - "1932eKraQ3Ad9MeNBHb14WFQbNrLaKeEpT", - "13JJ1nxDeX5fMsDeyGHiLoK8rF2ayGq1cX", - "1MdrdcEzfiJdvs6eVSwUx6bWboPX8if5U3", - "35WHp4Hid61peyH4tuhNunwRj2gtNB41Lo", - "34ZHV8dd6uucEUABUydWpKi6F4qKQntEUf", - //added on the 26/06/2024 - "bc1qzwhw94uldd3c8736lsxrda6t6x56030f8zk8nr", - "bc1qrmuxak470z7zch5f3gz05dc6h4ngwqdq4wx80w", - "bc1qf6lm99tp5p27hsmyskve236nsv32lnfwt4h8wk", - "14HeA1YRUiJGb95HVpVTBuavMUBYGk6y7R", - ], - }, + bitcoin: { owners: bitcoinAddressBook.deribit }, ethereum:{ owners: [ "0x77021d475E36b3ab1921a0e3A8380f069d3263de", @@ -36,7 +20,8 @@ const config = { "0x1baE874af9f81B8F93315b27F080260Da4702D3a", "0x2563328d58AC7eE9e930E89C29Ce96046a291207", "0x866c9a77d8Ab71d2874703e80cb7aD809b301e8e", - "0xCf2027AAB22980820F0767d9f214CDBD2AA2428D" + "0xCf2027AAB22980820F0767d9f214CDBD2AA2428D", + "0xACd41f0dA1A84f5543c84a33864e025cE30C099D", ] }, solana: { @@ -65,4 +50,4 @@ const config = { } module.exports = cexExports(config) -module.exports.methodology = 'This wallets where collect from here https://insights.deribit.com/exchange-updates/deribit-wallet-holdings/' +module.exports.methodology = 'This wallets where collect from here https://insights.deribit.com/exchange-updates/proof-of-reserves-deribit/' diff --git a/projects/desyn-basisTrading/index.js b/projects/desyn-basisTrading/index.js new file mode 100644 index 000000000000..ec2b2904956f --- /dev/null +++ b/projects/desyn-basisTrading/index.js @@ -0,0 +1,12 @@ +const { getTvlFunction, chains } = require("../desyn-farm/helper"); + +module.exports = { + doublecounted: true, + methodology: 'Combines on-chain airdrops with stable returns from basis trading on Binance.', +} + +chains.forEach(chain => { + module.exports[chain] = { + tvl: getTvlFunction('StrategyType3', true) + } +}) \ No newline at end of file diff --git a/projects/desyn-farm/helper.js b/projects/desyn-farm/helper.js new file mode 100644 index 000000000000..e4c51906f273 --- /dev/null +++ b/projects/desyn-farm/helper.js @@ -0,0 +1,59 @@ +const { getConfig } = require('../helper/cache') + +const chains = ["ethereum", "arbitrum", "btr", "mode", "zklink", "core", "ailayer", "linea", "merlin", "scroll"]; + +const abi = { + getBalance: "function getBalance(address) view returns (uint256)" +} + +async function getInfoListPool(strategy_type, chain) { + const data = await getConfig('desyn/' + strategy_type, `https://api.desyn.io/etf/defillama/get_pool_list?strategy_type=${strategy_type}`) + return data.data.config[chain]?.safePools +} + +// This is aSTETH, +// before the design of the semi-closed soETH, +// the contract in order to limit the closure of the time, +// the user can still deposit, +// so he was given a maximum value of the balance, +// which will become negative after adding any number, blocking the user to put in +const leverageStaking = '0x1982b2F5814301d4e9a8b0201555376e62F82428' + + +function getTvlFunction(strategy_type, isDoubleCounted) { + return async (api) => { + const pools = await getInfoListPool(strategy_type, api.chain) + if (!pools?.length) return; + const tokens = await api.multiCall({ abi: 'address[]:getCurrentTokens', calls: pools }) + const calls = [] + const tokensAndOwners = [] + const allTokens = [] + let i = 0 + + for (const pool of pools) { + for (const token of tokens[i]) { + if (!isDoubleCounted) { + tokensAndOwners.push([token, pool]) + } else { + calls.push({ target: pool, params: token }) + allTokens.push(token) + } + } + i++ + } + + if (!isDoubleCounted) return api.sumTokens({ tokensAndOwners }) + + const allBals = await api.multiCall({ abi: abi.getBalance, calls }) + api.add(allTokens, allBals) + + if (strategy_type === 'StrategyType2') + api.removeTokenBalance(leverageStaking) + } +} + + +module.exports = { + getTvlFunction, + chains +} \ No newline at end of file diff --git a/projects/desyn-farm/index.js b/projects/desyn-farm/index.js index 9e773382f8de..37d3e2839d29 100644 --- a/projects/desyn-farm/index.js +++ b/projects/desyn-farm/index.js @@ -1,28 +1,11 @@ -const { getLogs } = require('../helper/cache/getLogs') +const { getTvlFunction, chains } = require("./helper"); module.exports = { - doublecounted: true, - methodology: 'On-chain restaking', + methodology: 'Focused on airdrops from DeSyn and new chains.', } -const config = { - merlin: { factory: '0x790b4ee7998A93702f29e56f8b615eF35BE5af43', fromBlock: 11260440}, -} - -Object.keys(config).forEach(chain => { - const {factory, fromBlock, } = config[chain] +chains.forEach(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]])}) - } + tvl: getTvlFunction('StrategyType1', false) } }) \ No newline at end of file diff --git a/projects/desyn-farm1/index.js b/projects/desyn-farm1/index.js deleted file mode 100644 index 13e162927816..000000000000 --- a/projects/desyn-farm1/index.js +++ /dev/null @@ -1,28 +0,0 @@ -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-yieldAggregator/index.js b/projects/desyn-yieldAggregator/index.js new file mode 100644 index 000000000000..835f12569bb8 --- /dev/null +++ b/projects/desyn-yieldAggregator/index.js @@ -0,0 +1,12 @@ +const { getTvlFunction, chains } = require("../desyn-farm/helper"); + +module.exports = { + doublecounted: true, + methodology: 'Engages with DeFi protocols like Lending, DEX, and Restaking, offering both airdrops and structured yield options.', +} + +chains.forEach(chain => { + module.exports[chain] = { + tvl: getTvlFunction('StrategyType2', true) + } +}) \ No newline at end of file diff --git a/projects/desyn/index.js b/projects/desyn/index.js deleted file mode 100644 index 75f12cba8437..000000000000 --- a/projects/desyn/index.js +++ /dev/null @@ -1,38 +0,0 @@ -const { getLogs } = require('../helper/cache/getLogs') - -module.exports = { - 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 => { - 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/dexalot-bridge/index.js b/projects/dexalot-bridge/index.js new file mode 100644 index 000000000000..a68684be3d0d --- /dev/null +++ b/projects/dexalot-bridge/index.js @@ -0,0 +1,3 @@ +const { exportDexalotTVL } = require("../dexalot/helper"); + +module.exports = exportDexalotTVL("Portfolio") \ No newline at end of file diff --git a/projects/dexalot/helper.js b/projects/dexalot/helper.js new file mode 100644 index 000000000000..99d791be706f --- /dev/null +++ b/projects/dexalot/helper.js @@ -0,0 +1,33 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const { get } = require("../helper/http"); + +const dexalotTradingAPI = "https://api.dexalot.com/privapi/trading" + +// [chain]: env +const supportedChains = { + "arbitrum": "production-multi-arb", + "avax": "production-multi-avax", + "base": "production-multi-base" +} + +function getTVL(env, contractName) { + return async (api) => { + const contract = await get(`${dexalotTradingAPI}/deployment?contracttype=${contractName}&env=${env}`) + const allTokens = await get(`${dexalotTradingAPI}/tokens`) + const tokens = allTokens.filter((t) => !t.isvirtual && t.env === env).map((t) => t.address) + return sumTokens2({ api, owner: contract[0].address, tokens }) + } +} + +// Returns TVL for each supported chain (excludes Dexalot chain) +function exportDexalotTVL(contractName) { + const res = {} + for (const [chain, env] of Object.entries(supportedChains)) { + res[chain] = {tvl: getTVL(env, contractName)} + } + return res +} + +module.exports = { + exportDexalotTVL +} \ No newline at end of file diff --git a/projects/dexalot/index.js b/projects/dexalot/index.js new file mode 100644 index 000000000000..c08832f46583 --- /dev/null +++ b/projects/dexalot/index.js @@ -0,0 +1,25 @@ +const { get } = require("../helper/http"); +const { exportDexalotTVL } = require("./helper"); + +const dexalotAPI = "https://api.dexalot.com" + +async function getDexalotChainLockedOrders(_) { + const lockedTokens = await get(`${dexalotAPI}/api/stats/orderstvl`) + const res = {} + for (const {coingecko_id, amount} of lockedTokens) { + // Ignore counting tokens without coingecko_id + if (coingecko_id == null) { + continue + } + res[coingecko_id] = amount + } + return res +} + +module.exports = { + methodology: "Dexalot TVL is comprised of the token balances locked in the MainnetRFQ (swap) contracts and the value locked in open orders on the Dexalot chain.", + dexalot: { + tvl: getDexalotChainLockedOrders, + }, + ...exportDexalotTVL("MainnetRFQ") +} \ No newline at end of file diff --git a/projects/dexfinance-vault/index.js b/projects/dexfinance-vault/index.js index 6132575bf44f..5eaf428385fa 100644 --- a/projects/dexfinance-vault/index.js +++ b/projects/dexfinance-vault/index.js @@ -33,53 +33,57 @@ const CONFIG = { }; 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 vaults = await api.fetchList({ lengthAbi: abi.factory.vaultsLength, itemAbi: abi.factory.vaults, target: factory, permitFailure:true }); + const farmsAll = await api.fetchList({ lengthAbi: abi.vault.farmsLength, itemAbi: abi.vault.farms, targets: vaults, groupedByInput: true, permitFailure:true }) + + return vaults.map((vault, i) => { + const farms = farmsAll[i] || []; + return farms.map(farm => ({ vault, farm })); + }).flat(); }; const getVaultsConnectors = async (api, factory, vaultFarms) => { - const connectorsCalls = vaultFarms.map(({ farm, vault }) => ({ params: farm.beacon, target: vault, })); + 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 connectors = await api.multiCall({ abi: abi.vault.farmConnector, calls: connectorsCalls, permitFailure: true }); + const calculationConnectors = await api.multiCall({ abi: abi.factory.farmCalculationConnector, calls: calculationConnectorCalls, target: factory, permitFailure: true }); + + return vaultFarms + .map((item, i) => { + const connector = connectors[i] + const calculationConnector = calculationConnectors[i] + if (!connector || !calculationConnector) return null; + delete item.farm.data; + return { ...item, connector, calculationConnector }; + }).filter(item => item !== null); +}; 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 v2Farms = []; + const v3Farms = []; + const calls = vaultFarms.map(({ connector }) => connector); + const liquidityCalls = vaultFarms.map(({ calculationConnector, connector }) => ({ target: calculationConnector, params: [connector] })); + const stakingDatasCalls = vaultFarms.map(({ calculationConnector }) => ({ target: calculationConnector })) + + const [stakingTokens, liquidities, datas] = await Promise.all([ + api.multiCall({ calls, abi: abi.farm.stakingToken, permitFailure: true }), + api.multiCall({ calls: liquidityCalls, abi: abi.vault.liquidity }), + api.multiCall({ calls: stakingDatasCalls, abi: abi.farm.stakingTokenData, permitFailure: true }) + ]); + + vaultFarms.forEach(( item, i ) => { + const stakingToken = stakingTokens[i] + const liquidity = liquidities[i] + const data = datas[i] + if (!stakingToken || !liquidity ) return + if (!data) { + v2Farms.push({ ...item, stakingToken, liquidity }) + } else { + v3Farms.push({ ...item, stakingToken, liquidity, data }) + } }) -}; -const groupBy = (array, keyFn) => { - return array.reduce((acc, item) => { - const key = keyFn(item); - if (!acc[key]) { - acc[key] = []; - } - acc[key].push(item); - return acc; - }, {}); + return { v2Farms, v3Farms } }; const lpv2Balances = async (api, farms) => { @@ -100,34 +104,25 @@ async function addERC721Data(api, vaultFarms) { nftPositionMapping[nft].push(positionIds[i]) }) for (const [nftAddress, positionIds] of Object.entries(nftPositionMapping)) - await sumTokens2({ api, uniV3ExtraConfig: { nftAddress, positionIds, } }) + 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 vaultFarmsWithConnectors = await getVaultsConnectors(api, factory, vaultFarms); + const { v2Farms, v3Farms } = await getVaultsDatas(api, vaultFarmsWithConnectors); - 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 Promise.all([ + lpv2Balances(api, v2Farms), + addERC721Data(api, v3Farms) ]) - + 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, }; + module.exports[chain] = { tvl }; }) \ No newline at end of file diff --git a/projects/dforce/index.js b/projects/dforce/index.js index 7041ab53d46e..312cc30dc033 100644 --- a/projects/dforce/index.js +++ b/projects/dforce/index.js @@ -35,8 +35,10 @@ let allControllers = { ], arbitrum: [ "0x50210A88217d1dD9e7FBc3E4a927Cc55829a38eB", // dForce vault pool: USX/2CRV + "0xcfe6d1b2BE777f20AD6F98f1c12C6436652F2031", // dForce vault pool: iwstETH + "0xB5b3da79789dE012Fd75108138b2315E5645715A", // dForce vault pool: saETH ], - optimism: [], + optimism: ["0xdF0e115aA822443df9200Cc5d0260FA8E1aF06F5"], // dForce vault pool: iwstETH polygon: [], avax: ["0x078ad8d6faeD9DAeE55f5d446C80E0C81230DE6b"], kava: ["0xFBf64A8cAEA1D641affa185f850dbBF90d5c84dC"], diff --git a/projects/diamond-coin/index.js b/projects/diamond-coin/index.js index 0d4c9453ec76..b39f71c4b618 100644 --- a/projects/diamond-coin/index.js +++ b/projects/diamond-coin/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const {pool2Exports} = require("../helper/pool2"); +const {pool2} = require("../helper/pool2"); const token = "0xDDa0F0E1081b8d64aB1D64621eb2679F93086705"; const emissionRewardPool = "0xDDa0F0E1081b8d64aB1D64621eb2679F93086705"; @@ -12,6 +12,6 @@ const DiamondLPs = [ module.exports = { fantom: { tvl: async () => ({}), - pool2: pool2Exports(emissionRewardPool, DiamondLPs, "fantom", addr=>`fantom:${addr}`) + pool2: pool2(emissionRewardPool, DiamondLPs, "fantom", addr=>`fantom:${addr}`) } } diff --git a/projects/dinari/index.js b/projects/dinari/index.js index 829e3dbfcfad..75778cabe477 100644 --- a/projects/dinari/index.js +++ b/projects/dinari/index.js @@ -13,6 +13,10 @@ const config = { kinto: { factory: "0xE4Daa69e99F48AD0C4D4843deF4447253248A906", usdplus: "0x6F086dB0f6A621a915bC90295175065c9e5d9b8c" + }, + base: { + factory: "0xBCE6410A175a1C9B1a25D38d7e1A900F8393BC4D", + usdplus: "0x98C6616F1CC0D3E938A16200830DD55663dd7DD3" } } diff --git a/projects/dinosaur-finance/index.js b/projects/dinosaur-finance/index.js index d468024e9486..f0a56d1812d4 100644 --- a/projects/dinosaur-finance/index.js +++ b/projects/dinosaur-finance/index.js @@ -24,6 +24,7 @@ module.exports = { hallmarks: [ [1675814400, "Rug Pull"] ], + deadFrom: '2023-02-08', arbitrum: { tvl, } diff --git a/projects/direct-exchange/index.js b/projects/direct-exchange/index.js index f0ee9967356c..e96546d2ab8c 100644 --- a/projects/direct-exchange/index.js +++ b/projects/direct-exchange/index.js @@ -2,6 +2,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, kava: { - tvl: getUniTVL({ factory: '0xcE08c3d20Ff00a9Cf0D28922768bD606592B5D4C', fetchBalances: true, useDefaultCoreAssets: true, }) + tvl: getUniTVL({ factory: '0xcE08c3d20Ff00a9Cf0D28922768bD606592B5D4C', useDefaultCoreAssets: true, }) }, } diff --git a/projects/diviswap/index.js b/projects/diviswap/index.js new file mode 100644 index 000000000000..7f30bfcf047e --- /dev/null +++ b/projects/diviswap/index.js @@ -0,0 +1,2 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); +module.exports = uniTvlExport('chz', "0xbdd9c322ecf401e09c9d2dca3be46a7e45d48bb1") \ No newline at end of file diff --git a/projects/djed-alliance/index.js b/projects/djed-alliance/index.js index 705e632a15c4..f1dad7c7d5ea 100644 --- a/projects/djed-alliance/index.js +++ b/projects/djed-alliance/index.js @@ -6,9 +6,9 @@ const { sumTokensExport } = require("../helper/chain/cardano"); module.exports = { - methodology: 'The TVL of each Djed deployment is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain. The total TVL is the sum of the Djed TVLs on all blockchains.', + methodology: 'The TVL of Djed is the reserve belonging to the deployment. The TVL within a given blockchain is the sum of the TVLs of all known Djed deployments within that blockchain.', cardano: { - tvl: sumTokensExport({ owner: 'addr1zxem3j9xw7gyqnry0mfdhku7grrzu0707dc9fs68zwkln5sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0qul0eqc', tokens: ['lovelace']}), + tvl: sumTokensExport({ owner: 'addr1zx82ru5f7p8ewhhdvahueg2s4gxs3gxl66fkygdekkjs74sm5kjdmrpmng059yellupyvwgay2v0lz6663swmds7hp0q4vpw0l', tokens: ['lovelace']}), }, }; diff --git a/projects/doglands-swap/index.js b/projects/doglands-swap/index.js index 3882cc3fe95c..95b6d77e685a 100644 --- a/projects/doglands-swap/index.js +++ b/projects/doglands-swap/index.js @@ -1,3 +1,4 @@ +const { deadFrom } = require("../mosquitos-finance"); module.exports = { methodology: "Count TVL as liquidity on the dex", @@ -8,4 +9,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-01-20')/1e3), 'Project rugged'], ], + deadFrom: Math.floor(new Date('2023-01-20')/1e3) } \ No newline at end of file diff --git a/projects/dogswap/index.js b/projects/dogswap/index.js index b7fcd411e6fd..f286a9b83d13 100644 --- a/projects/dogswap/index.js +++ b/projects/dogswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0xA780FcBFF7c5232FDbEF4fc67313bEcFfdf64172', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('shibarium', '0xA780FcBFF7c5232FDbEF4fc67313bEcFfdf64172') \ No newline at end of file diff --git a/projects/dojoswap-ancient8/index.js b/projects/dojoswap-ancient8/index.js new file mode 100644 index 000000000000..f2320073e43a --- /dev/null +++ b/projects/dojoswap-ancient8/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'ancient8': '0x7d6eb409e2540d27Ea6Dc976E1a549a3dBcBfFBC' +}) \ No newline at end of file diff --git a/projects/dojoswap/index.js b/projects/dojoswap/index.js index 0b3632accacc..815afadc13af 100644 --- a/projects/dojoswap/index.js +++ b/projects/dojoswap/index.js @@ -1,4 +1,3 @@ -const BigNumber = require("bignumber.js"); const { getFactoryTvl } = require("../terraswap/factoryTvl"); const factory = { diff --git a/projects/donaswap-v2/index.js b/projects/donaswap-v2/index.js index 4861efb4b71a..ddd20b512c63 100644 --- a/projects/donaswap-v2/index.js +++ b/projects/donaswap-v2/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require("../helper/unknownTokens.js"); const V2_FACTORY = "0x8e5dff1c121F661971d02950698f8c5EFc3DfA78"; -const tvl = getUniTVL({ factory: V2_FACTORY, useDefaultCoreAssets: true, fetchBalances: true }); +const tvl = getUniTVL({ factory: V2_FACTORY, useDefaultCoreAssets: true }); const chains = ['arbitrum', 'astar', 'aurora', 'avax', 'base', 'bsc', 'celo', 'cmp', 'conflux', 'core', 'dogechain', 'ethereum', 'fantom', 'flare', 'fuse', 'fusion', 'heco', 'kcc', 'kardia', 'kava', 'linea', 'metis', 'moonbeam', 'moonriver', 'optimism', 'palm', 'polygon', 'polygon_zkevm', 'thundercore'] diff --git a/projects/donkeswap/index.js b/projects/donkeswap/index.js new file mode 100644 index 000000000000..280e58c34388 --- /dev/null +++ b/projects/donkeswap/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require("../helper/unknownTokens"); + +// node test.js projects/donkswap/index.js +module.exports = { + misrepresentedTokens: true, + methodology: "Factory address (0x4B4746216214f9e972c5D35D3Fe88e6Ec4C28A6B) is used to find the LP pairs. TVL is equal to the liquidity on the AMM.", + sei: { + tvl: getUniTVL({ factory: "0x4B4746216214f9e972c5D35D3Fe88e6Ec4C28A6B", useDefaultCoreAssets: true }) + } +}; diff --git a/projects/dotoracle/index.js b/projects/dotoracle/index.js index 0911ba1624c9..c131683560be 100644 --- a/projects/dotoracle/index.js +++ b/projects/dotoracle/index.js @@ -14,7 +14,7 @@ const config = { usdt: ADDRESSES.ethereum.USDT, DAI: ADDRESSES.ethereum.DAI, frax: ADDRESSES.ethereum.FRAX, - fxs: '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', + fxs: ADDRESSES.ethereum.FXS, maker: ADDRESSES.ethereum.MKR, aave: ADDRESSES.ethereum.AAVE, } diff --git a/projects/double2win/index.js b/projects/double2win/index.js new file mode 100644 index 000000000000..c68d0e86d57e --- /dev/null +++ b/projects/double2win/index.js @@ -0,0 +1,55 @@ +const { cachedGraphQuery } = require('../helper/cache') +const { sumTokens2 } = require("../helper/unwrapLPs") + +async function getTokens(chain, subgraph) { + const graphQuery = ` + { + assetTokens(where: {amount_gt: "0"}) { + tokenAddress + } + migrations(where: {pair_starts_with: "0x", lpAmount_gt: "0"}) { + pair + ammType + } + liquidities(where: {pair_starts_with: "0x", lpAmount_gt: "0"}) { + pair + ammType + } + } + ` + + const { assetTokens, migrations, liquidities } = await cachedGraphQuery(`double2win/${chain}`, subgraph, graphQuery) + const tokens = [] + + migrations.forEach(migration => { tokens.push(migration.pair.toLowerCase()) }) + liquidities.forEach(liquidity => { tokens.push(liquidity.pair.toLowerCase()) }) + assetTokens.forEach(assetToken => { tokens.push(assetToken.tokenAddress.toLowerCase()) }) + + return tokens +} + +async function arbitrumTvl(api) { + const chain = api.chain + const subgraph = "https://api.studio.thegraph.com/query/16975/double-arbitrum/version/latest" + const addresses = { + uniswapV2Vault: '0xBf212dEE0aea6531dEb0B02be6E70b527dDF8246', + uniswapV2Migration: '0x1c6E7CE03ae7a9A252BcE0C9F871654dBB0C7ca5', + uniswapV3Vault: '0x07116C5ED5cBb49464f64926Ba152B8985fe3AFf', + uniswapV3Migration: '0x99F980fa0b1939A0A1033092EF2a668df8D8b70D', + assetVault: '0x7C09A9c30736F17043Fe6D0C0A3D03a7Cf6e78FD', + } + + const tokens = await getTokens(chain, subgraph) + + const blacklistedTokens = ['0x13654df31871b5d01e5fba8e6c21a5d0344820f5'] + await sumTokens2({ api, owners: [addresses.uniswapV3Vault, addresses.uniswapV3Migration,], resolveUniV3: true, blacklistedTokens, }) + await sumTokens2({ api, owners: [addresses.uniswapV2Migration, addresses.assetVault, addresses.uniswapV2Vault], tokens, resolveLP: true, blacklistedTokens, }) + +} + +module.exports = { + doublecounted: true, + arbitrum: { + tvl: arbitrumTvl, + }, +} diff --git a/projects/doubler/index.js b/projects/doubler/index.js index 4ecc77fbf9b3..ce04c5f7fb60 100644 --- a/projects/doubler/index.js +++ b/projects/doubler/index.js @@ -1,17 +1,30 @@ -const WETH_CONTRACT = '0x82af49447d8a07e3bd95bd0d56f35241523fbab1'; -const DOUBLER_CONTRACT = '0x56386f04111057a5D8DF8d719827038B716333F0'; +const ADDRESSES = require('../helper/coreAssets.json') -async function tvl(api) { - const collateralBalance = await api.call({ - abi: 'erc20:balanceOf', - target: WETH_CONTRACT, - params: [DOUBLER_CONTRACT], - }); - api.add(WETH_CONTRACT, collateralBalance) -} +const ARB_DOUBLER_POOL1_CONTRACT = '0x56386f04111057a5D8DF8d719827038B716333F0'; + +const abi = "function getPool() view returns ((bool isNative, uint16 inputFee, uint16 withdrawFee, uint256 id, uint256 lastPrice, uint256 cLastRbTime, uint256 lowerOfInputMaximum, uint256 endPrice, uint256 startTime, uint256 lastDayRate, uint256 endTime, address asset, address cToken, address bToken, address creator))" -module.exports = { +const config = { arbitrum: { - tvl, + pepe: '0x15AD6EDCa40dFAFE1B3BAc5F1c6d65411726F1bF', + pool2: '0xC64a3f7da839F8851cB2A5710b693c92fA461027', + }, + manta: { + weth: '0xc8480647Eeb358df638Ca882362cE528cC666087', + manta: '0x498F4711a706F9ad33b5D68EaA20E56a87d5d926', + }, +} + +Object.keys(config).forEach(chain => { + const pools = Object.values(config[chain]) + module.exports[chain] = { + tvl: async (api) => { + const tokens = await api.multiCall({ abi, calls: pools, }) + if (chain === 'arbitrum') { + tokens.push({ asset: ADDRESSES.arbitrum.WETH }) + pools.push(ARB_DOUBLER_POOL1_CONTRACT) + } + return api.sumTokens({ tokensAndOwners2: [tokens.map(i => i.asset), pools] }) + } } -}; \ No newline at end of file +}) \ No newline at end of file diff --git a/projects/doubleup/index.js b/projects/doubleup/index.js new file mode 100644 index 000000000000..0537218bb3e6 --- /dev/null +++ b/projects/doubleup/index.js @@ -0,0 +1,40 @@ +const sui = require("../helper/chain/sui"); + +const UNI_HOUSE_OBJ_ID = "0x75c63644536b1a7155d20d62d9f88bf794dc847ea296288ddaf306aa320168ab" + +async function tvl(api) { + const unihouseDynamicFields = await sui.getDynamicFieldObjects({ + parent: UNI_HOUSE_OBJ_ID, + }); + + const unihouseList = unihouseDynamicFields?.filter( + (field) => field?.type.includes("house::House"), + ); + + const unihouseIdList = unihouseList.map((house) => house.fields.id.id); + + for (const id of unihouseIdList) { + const house = await sui.getObject(id); + + const houseType = house?.type; + const coinType = houseType.split("<")[1].split(">")[0]; + + const housePipeDebt = house?.fields?.house_pipe_debt?.fields?.value; + const housePool = house?.fields?.house_pool; + const houseTvl = Number(housePipeDebt) + Number(housePool); + + api.add(coinType, houseTvl); + + const pipeDebt = house?.fields?.pipe_debt?.fields?.value; + const _tvl = Number(pipeDebt) + Number(house?.fields?.pool); + + api.add(coinType, _tvl); + } +} + +module.exports = { + timetravel: false, + sui: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/dough-finance.js b/projects/dough-finance.js new file mode 100644 index 000000000000..c2df644f5e3f --- /dev/null +++ b/projects/dough-finance.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('./helper/coreAssets.json') +const { sumTokens2 } = require("./helper/unwrapLPs") + +async function getVaults(api) { + const vaults = await api.fetchList({ lengthAbi: 'dsaCounter', itemAbi: 'getDsaByID', target: "0x5390724ca3b0880242c7b1ef08eb9b1abe698c0e" }) + const tokens = [ + "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c", + "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", + ADDRESSES.ethereum.USDC, // usdc + ADDRESSES.ethereum.WETH, // eth + "0x72e95b8931767c79ba4eee721354d6e99a61d004", // debt usdc + "0xea51d7853eefb32b6ee06b1c12e6dcca88be0ffe", // debt weth + ] + return { vaults, tokens } +} + +module.exports = { + hallmarks: [ + [1720742400, "Protocol Exploit"] + ], + ethereum: { + tvl: async (api) => { + const { vaults, tokens } = await getVaults(api) + return sumTokens2({ api, tokens, owners: vaults }) + }, + } +} diff --git a/projects/drachma/index.js b/projects/drachma/index.js index fb70373e02a1..7fe6cf8708e1 100644 --- a/projects/drachma/index.js +++ b/projects/drachma/index.js @@ -6,10 +6,7 @@ const { compoundExports } = require("../helper/compound"); const comptroller = "0xB6ef08Ffbbb0691a3D9E6c41db4b1d2F97D8D49a"; //tvl for drachma farm -const { tvl: drachmaTvl, borrowed: drachmaBorrowed } = compoundExports( - comptroller, - "metis" -); +const { tvl: drachmaTvl, borrowed: drachmaBorrowed } = compoundExports(comptroller,); //tvl for drachma app function tvl(chain) { diff --git a/projects/dragonswap-sei-v3/index.js b/projects/dragonswap-sei-v3/index.js new file mode 100644 index 000000000000..b747f8211f2a --- /dev/null +++ b/projects/dragonswap-sei-v3/index.js @@ -0,0 +1,21 @@ +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const { sumTokens2 } = require('../helper/unwrapLPs') + +module.exports = { + sei: { tvl }, +} + +async function tvl(api) { + const pools = await getConfig('dragonswap/uni-v3-pools', undefined, { + fetcher: async () => { + let { pools } = await get(`https://sei-api.dragonswap.app/api/v1/pools`) + pools = pools.filter(i => i.type === 'V3_POOL').map(i => i.pool_address) + return pools + } + }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const ownerTokens = pools.map((v, i) => [[token0s[i], token1s[i]], v]) + return sumTokens2({ api, ownerTokens }) +} \ No newline at end of file diff --git a/projects/drift.js b/projects/drift.js index 702364a68c16..da3f57d84a58 100644 --- a/projects/drift.js +++ b/projects/drift.js @@ -1,4 +1,8 @@ +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, @@ -8,11 +12,38 @@ module.exports = { }, }; -async function tvl() { - return sumTokens2({ - owners: [ - 'CU4eFxpyCGNDEXN27Jonn7RfgwBt3cnp7TcTrJF6EW9Q', // legacy - 'JCNCMFXo5M5qwUPg2Utu1u6YWp3MbygxqBsBeXXJfrw', // Drift vault - ], - }) +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() +} + diff --git a/projects/drop/index.js b/projects/drop/index.js new file mode 100644 index 000000000000..7cf5f94515f8 --- /dev/null +++ b/projects/drop/index.js @@ -0,0 +1,21 @@ +const { queryContract } = require('../helper/chain/cosmos') + +const config = { + neutron: [{ + coinGeckoId: "cosmos", + contract: "neutron16m3hjh7l04kap086jgwthduma0r5l0wh8kc6kaqk92ge9n5aqvys9q6lxr" + }], +}; + +async function tvl(api) { + for (const { coinGeckoId, contract, decimals = 6 } of config[api.chain]) { + const bonded = await queryContract({ contract, chain: api.chain, data: { "total_bonded": {} } }) + api.addCGToken(coinGeckoId, bonded / 10 ** decimals) + } +} + +module.exports = { + timetravel: false, + methodology: "Sum of all the tokens that are liquid staked on DROP", + neutron: { tvl } +} \ No newline at end of file diff --git a/projects/dtx-v3/index.js b/projects/dtx-v3/index.js new file mode 100644 index 000000000000..af79fead8a02 --- /dev/null +++ b/projects/dtx-v3/index.js @@ -0,0 +1,3 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ taiko: { factory: '0xfCA1AEf282A99390B62Ca8416a68F5747716260c', fromBlock: 105000, } }) \ No newline at end of file diff --git a/projects/duckgang/index.js b/projects/duckgang/index.js new file mode 100644 index 000000000000..d7d52600eecc --- /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/duet/bsc.js b/projects/duet/bsc.js index c833afef31ad..3480ab750bf2 100644 --- a/projects/duet/bsc.js +++ b/projects/duet/bsc.js @@ -1,14 +1,11 @@ const { getConfig } = require("../helper/cache"); -const collateralReaderContractABI = require("./abis/collateral-reader.json"); const ebcakeReaderContractABI = require("./abis/ebcake-reader.json"); const { getUniqueAddresses } = require('../helper/utils') -const BigNumber = require("bignumber.js"); const { sumTokens2 } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); const TOKEN_LIST_URL = "https://app.duet.finance/tokens.json"; -const COLLATERAL_READER_CONTRACT = "0xFfB8FD0E5eA13bb71401B19e00f9F934746f0b7A"; const DUET = '0x95EE03e1e2C5c4877f9A298F1C0D6c98698FAB7B' async function getEBCakeTvl(api) { @@ -51,16 +48,9 @@ async function tvl(api) { if (!tokens[i]) return; tokensAndOwners.push([tokens[i], underlyingMap[v]]) }) - // api.add('tether', (await getEBCakeTvl(api)) / 1e8, { skipChain: true }) await getEBCakeTvl(api) return sumTokens2({ tokensAndOwners, api, resolveLP: true, blacklistedTokens: [DUET]}) - - // const tokenTvls = await api.multiCall({ abi: collateralReaderContractABI.depositVaultValues, target: COLLATERAL_READER_CONTRACT, calls: uniqueVaults.map(i => ({ params: [[i], false] })) }) - // api.add('tether', (await getEBCakeTvl(api)) / 1e8, { skipChain: true }) - // tokenTvls.forEach(v => { - // if (v) api.add('tether', v[1][0] / 1e8, { skipChain: true }) - // }) } module.exports = { diff --git a/projects/dyad/index.js b/projects/dyad/index.js index ec95d77124b5..71d6cfa51b98 100644 --- a/projects/dyad/index.js +++ b/projects/dyad/index.js @@ -5,12 +5,13 @@ const vaults = [ "0x7e5f2b8f089a4cd27f5b6b846306020800df45bd", // "0xf3768D6e78E65FC64b8F12ffc824452130BD5394", // Kerosene is own token "0x3D72f7Fc3A9537e1fcC6FBF91AF55CcF2c5C4ed0", + "0x3FC5c0e19b6287f25EB271c2E8e7Ba898FE7ab29", + "0x5B74DD13D4136443A7831fB7AD139BA123B5071B", + "0xB58d87dD30a67823acC4b9Fa533F464CdEdA737E", ] 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] }) } diff --git a/projects/dymension-dex.js b/projects/dymension-dex.js new file mode 100644 index 000000000000..d62aa3609849 --- /dev/null +++ b/projects/dymension-dex.js @@ -0,0 +1,18 @@ +async function tvl() { + const pools = await fetch("https://fetchnetworkdatarequest-xqbg2swtrq-uc.a.run.app/?networkId=dymension_1100-1&dataType=pools").then(r=>r.json()) + const dym = pools.reduce((sum, pool)=>{ + const dymAssets = pool.poolAssets.find(a=>a.token.denom === "adym").token.amount/1e18 + return sum+dymAssets + }, 0) + + return { + "coingecko:dymension": dym*2 + } +} + +module.exports = { + methodology: 'Liquidity in DEX', + dymension:{ + tvl + } +} diff --git a/projects/dynastyswap-xyz/index.js b/projects/dynastyswap-xyz/index.js index 448503aa1bfe..067434d2e3cb 100644 --- a/projects/dynastyswap-xyz/index.js +++ b/projects/dynastyswap-xyz/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, pulse: { - tvl: getUniTVL({ factory: '0x7abcEc2e35505aF1720431A6c414067717342B1F', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x7abcEc2e35505aF1720431A6c414067717342B1F', useDefaultCoreAssets: true, }), }, }; // node test.js projects/pulsex/index.js \ No newline at end of file diff --git a/projects/dyson/index.js b/projects/dyson/index.js index 1bb23112fa4e..b9b85e684644 100644 --- a/projects/dyson/index.js +++ b/projects/dyson/index.js @@ -12,6 +12,7 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { + // get reserves call fails tvl: getUniTVL({ factory: config[chain], fetchBalances: true, useDefaultCoreAssets: true }) } }) diff --git a/projects/earlyfans/index.js b/projects/earlyfans/index.js index e7801fcb37e7..ebed47cab717 100644 --- a/projects/earlyfans/index.js +++ b/projects/earlyfans/index.js @@ -2,17 +2,19 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') -const contract = "0x4b17a9318238403ddac8E3a790C3b06D18132Bf4"; -const early = "0x7135B32e9903BdB4e19a8b1D22fC2038964B8451"; +const earlyfansV1contract = "0x4b17a9318238403ddac8E3a790C3b06D18132Bf4"; +const earlyTokenContract = "0x7135B32e9903BdB4e19a8b1D22fC2038964B8451"; +const earlyfansV2promisesContract = "0x169BC25B709f05c69daE264487cd84Be526AFb9a"; +const earlyfansV2bribesContract = "0x55BcC767F4ADD89BB7C316C560701A0a331DF746" async function tvl(api) { - return sumTokens2({ tokens: [ADDRESSES.null], owners: [contract], api }); + return sumTokens2({ tokens: [ADDRESSES.null], owners: [earlyfansV1contract, earlyfansV2promisesContract, earlyfansV2bribesContract], api }); } module.exports = { - methodology: `TVL counts the EARLY on ${early} and ETH on ${contract}`, + methodology: `TVL counts the EARLY on ${earlyTokenContract} and ETH on ${earlyfansV1contract}, ${earlyfansV2promisesContract} and ${earlyfansV2bribesContract}.`, blast: { tvl, - staking: staking(contract, early) // early token + staking: staking(earlyfansV1contract, earlyTokenContract) // early token }, }; diff --git a/projects/ease/index.js b/projects/ease/index.js index 953cbceadcbf..266eca108145 100644 --- a/projects/ease/index.js +++ b/projects/ease/index.js @@ -1,5 +1,3 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); const { stakings } = require("../helper/staking"); const { getConfig } = require('../helper/cache') @@ -9,17 +7,11 @@ const NXM = "0xd7c49CEE7E9188cCa6AD8FF264C1DA2e69D4Cf3B"; // const ARNXM_VAULT = "0x1337DEF1FC06783D4b03CB8C1Bf3EBf7D0593FC4"; const STAKING_CONTRACTS = [ //BRIBE_POT - "0xEA5EdeF17C9be57228389962ba50b98397f1E28C", + "0xEA5EdeF17C9be57228389962ba50b98397f1E28C", //GV_EASE "0xEa5edeF1eDB2f47B9637c029A6aC3b80a7ae1550", ]; -const RCA_SHIELD = { - abis: { - uBalance: "uint256:uBalance" - }, -}; - const ARNXM_VAULT = { abis: { aum: "uint256:aum", @@ -31,17 +23,17 @@ async function tvl(api) { //get TVL of Uninsurance vaults let resp = await getConfig('ease', VAULT_LIST_URL); let vaults = resp.map(i => i.address.toLowerCase()).filter(i => i !== '0x8f247eb2d71beeacdf212f8bc748f09cdf7144c0') - const bals = await api.multiCall({ abi: 'uint256:uBalance', calls: vaults }) - const tokens = await api.multiCall({ abi: 'address:uToken', calls: vaults }) - const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) + const bals = await api.multiCall({ abi: 'uint256:uBalance', calls: vaults }) + const tokens = await api.multiCall({ abi: 'address:uToken', calls: vaults }) + const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) api.addTokens(tokens, bals.map((v, i) => v / 10 ** (18 - decimals[i]))) //get TVL of arNXM vault - const balNXM = await api.call({ target: ARNXM_VAULT.address, abi: ARNXM_VAULT.abis.aum, }); + const balNXM = await api.call({ target: ARNXM_VAULT.address, abi: ARNXM_VAULT.abis.aum, }); api.add(NXM, balNXM) } module.exports = { - ethereum:{ + ethereum: { tvl, staking: stakings(STAKING_CONTRACTS, EASE), }, diff --git a/projects/ebisus-bay/index.js b/projects/ebisus-bay/index.js index 32cf05c4aa84..7d826375e2ac 100644 --- a/projects/ebisus-bay/index.js +++ b/projects/ebisus-bay/index.js @@ -1,20 +1,23 @@ const { staking } = require('../helper/staking') const { getUniTVL } = require('../helper/unknownTokens') -const factory = '0x5f1d751f447236f486f4268b883782897a902379' const frtnToken = '0xaF02D78F39C0002D14b95A3bE272DA02379AfF21' const bankContract = '0x1E16Aa4Bb965478Df310E8444CD18Fa56603A25F' module.exports = { - misrepresentedTokens: true, - methodology: "The TVL accounts for all LP on the dex, using the factory address 0x5f1d751f447236f486f4268b883782897a902379). Staking accounts for the FRTN staked in the bank on our platform.", - cronos: { - staking: staking(bankContract, frtnToken), - tvl: getUniTVL({ - factory, - useDefaultCoreAssets: true, - }), - }, + misrepresentedTokens: true, + methodology: "The TVL accounts for all LP on the dex, using the factory address 0x5f1d751f447236f486f4268b883782897a902379). Staking accounts for the FRTN staked in the bank on our platform.", } +const config = { + cronos: '0x5f1d751f447236f486f4268b883782897a902379', + cronos_zkevm: '0x1A695B3aC30D41F9A1D856A27DD0D9DdaaCe750d', +} + +Object.keys(config).forEach(chain => { + const factory = config[chain] + module.exports[chain] = { tvl: getUniTVL({ factory, useDefaultCoreAssets: true, }) } +}) + +module.exports.cronos.staking = staking(bankContract, frtnToken) \ No newline at end of file diff --git a/projects/echelon/index.js b/projects/echelon/index.js index fd13d9e71570..9d8b9c12aa68 100644 --- a/projects/echelon/index.js +++ b/projects/echelon/index.js @@ -1,24 +1,52 @@ const sdk = require("@defillama/sdk"); const { getResource, } = require("../helper/chain/aptos"); const { transformBalances } = require("../helper/portedTokens"); +const { get } = require("../helper/http"); -const contractAddress = "0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba"; +const mainLendingContract = "0xc6bc659f1649553c1a3fa05d9727433dc03843baac29473c817d06d39e7621ba"; +const isolatedLendingContract = "0x024c90c44edf46aa02c3e370725b918a59c52b5aa551388feb258bd5a1e82271"; +const coinAssetType = '300'; +// main pool async function getMarketAddresses() { - const lending = await getResource(contractAddress, `${contractAddress}::lending::Lending`); + const lending = await getResource(mainLendingContract, `${mainLendingContract}::lending::Lending`); return lending.market_objects.map(obj => obj.inner); } async function getMarket(marketAddress) { - const market = await getResource(marketAddress, `${contractAddress}::lending::Market`); - const coinInfo = await getResource(marketAddress, `${contractAddress}::lending::CoinInfo`); - return { cash: market.total_cash, liability: market.total_liability, fee: market.total_reserve, coin: coinInfo.type_name }; + const market = await getResource(marketAddress, `${mainLendingContract}::lending::Market`) + var coinInfo = null; + if (market.asset_type === coinAssetType) { + coinInfo = (await getResource(marketAddress, `${mainLendingContract}::lending::CoinInfo`)).type_name + } else { + coinInfo = (await getResource(marketAddress, `${mainLendingContract}::lending::FungibleAssetInfo`)).metadata.inner; + } + + + return { cash: market.total_cash, liability: market.total_liability, fee: market.total_reserve, coin: coinInfo }; +} + +// isolated pairs + +async function getIsolatedPairAddresses() { + const isolatedLending = await getResource(isolatedLendingContract, `${isolatedLendingContract}::isolated_lending::IsolatedLending`); + return isolatedLending.pair_objects.map(obj => obj.inner); +} + +async function getPair(pairAddress) { + const [pair, coinInfo] = await Promise.all([ + getResource(pairAddress, `${isolatedLendingContract}::isolated_lending::Pair`), + getResource(pairAddress, `${isolatedLendingContract}::isolated_lending::CoinInfo`) + ]) + const { total_collateral_amount, total_supply_amount, total_borrow_amount } = pair; + const { collateral_type_name, liability_type_name } = coinInfo; + return { collateral_token: collateral_type_name, asset_token: liability_type_name, total_collateral_amount, total_supply_amount, total_borrow_amount } } module.exports = { timetravel: false, methodology: - "Aggregates TVL for all markets in Echelon.", + "Aggregate TVL of both the Echelon main pool and its isolated pairs", aptos: { tvl: async () => { const balances = {}; @@ -29,6 +57,15 @@ module.exports = { sdk.util.sumSingleBalance(balances, coin, cash); }); + const isolatedPairAddresses = await getIsolatedPairAddresses(); + const pairs = await Promise.all(isolatedPairAddresses.map(pairAddress => getPair(pairAddress))); + pairs.forEach(({ collateral_token, total_collateral_amount, asset_token, total_supply_amount, total_borrow_amount }) => { + // isolated pair collateral tvl + sdk.util.sumSingleBalance(balances, collateral_token, total_collateral_amount); + // isolated pair asset tvl (supply - borrow) + sdk.util.sumSingleBalance(balances, asset_token, Number(total_supply_amount) - Number(total_borrow_amount)); + }); + return transformBalances("aptos", balances); }, borrowed: async () => { @@ -40,7 +77,13 @@ module.exports = { sdk.util.sumSingleBalance(balances, coin, liability); }); + const isolatedPairAddresses = await getIsolatedPairAddresses(); + const pairs = await Promise.all(isolatedPairAddresses.map(pairAddress => getPair(pairAddress))); + pairs.forEach(({ asset_token, total_borrow_amount }) => { + sdk.util.sumSingleBalance(balances, asset_token, total_borrow_amount); + }); + return transformBalances("aptos", balances); } }, -}; \ No newline at end of file +}; diff --git a/projects/echo-bridge/index.js b/projects/echo-bridge/index.js new file mode 100644 index 000000000000..60fe3a95d0de --- /dev/null +++ b/projects/echo-bridge/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens') + +module.exports = { + bsquared: { + tvl: sumTokensExport({ owner: '0x5b1399B8b97fBC3601D8B60Cc0F535844C411Bd5', tokens: [ADDRESSES.bsquared.UBTC]}) + } +} \ No newline at end of file diff --git a/projects/echo-lending/index.js b/projects/echo-lending/index.js new file mode 100644 index 000000000000..4fef0c664684 --- /dev/null +++ b/projects/echo-lending/index.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require("@defillama/sdk"); +const { transformBalances } = require("../helper/portedTokens"); +const { function_view } = require("../helper/chain/aptos"); + +let _data + +const mapping = { + 'APT': ADDRESSES.aptos.APT, +} + +async function getData() { + if (!_data) + _data = _getData() + + return _data + + + async function _getData() { + const resources = await function_view({ functionStr: "0xeab7ea4d635b6b6add79d5045c4a45d8148d88287b1cfa1c3b6a4b56f46839ed::pool_data_provider::get_all_reserves_tokens", }) + const [uTokens, tokens] = await function_view({ functionStr: "0xeab7ea4d635b6b6add79d5045c4a45d8148d88287b1cfa1c3b6a4b56f46839ed::underlying_token_factory::get_coin_asset_pairs", }) + const mapping = {} + tokens.forEach((token, i) => mapping[token] = uTokens[i]) + + for (const item of resources) { + const token = item.token_address + item.uToken = mapping[token] + item.reserve = await function_view({ functionStr: "0xeab7ea4d635b6b6add79d5045c4a45d8148d88287b1cfa1c3b6a4b56f46839ed::pool_data_provider::get_reserve_data", args: [token] }) + item.debt = item.reserve[3] + item.balance = +item.reserve[2] - +item.debt + } + return resources.filter(i => i.uToken); + } +} + +module.exports = { + aptos: { + tvl: async (api) => { + const data = await getData() + api.add(data.map(i => i.uToken), data.map(i => i.balance)) + }, + borrowed: async (api) => { + const data = await getData() + api.add(data.map(i => i.uToken), data.map(i => i.debt)) + }, + }, +}; diff --git a/projects/echodex/index.js b/projects/echodex/index.js index 47eec9b7c350..0d6c3395105a 100644 --- a/projects/echodex/index.js +++ b/projects/echodex/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - linea: { tvl: getUniTVL({ factory: '0x6D1063F2187442Cc9adbFAD2f55A96B846FCB399', useDefaultCoreAssets: true, fetchBalances: true }), }, + linea: { tvl: getUniTVL({ factory: '0x6D1063F2187442Cc9adbFAD2f55A96B846FCB399', useDefaultCoreAssets: true, }), }, } diff --git a/projects/echswap/index.js b/projects/echswap/index.js index 751dcffd9460..61e7a731d411 100644 --- a/projects/echswap/index.js +++ b/projects/echswap/index.js @@ -1,10 +1,12 @@ const { getUniTVL } = require('../helper/unknownTokens') +const { deadFrom } = require('../mosquitos-finance') module.exports = { misrepresentedTokens: true, hallmarks: [ [1671062400, "Rug Pull"] ], + deadFrom: 1671062400, echelon: { tvl: () => ({}), } diff --git a/projects/ecodefi/index.js b/projects/ecodefi/index.js index 90170d58142c..b996f17a8921 100644 --- a/projects/ecodefi/index.js +++ b/projects/ecodefi/index.js @@ -2,6 +2,7 @@ const { staking } = require('../helper/staking') const { compoundExports2 } = require('../helper/compound') module.exports = { + deadFrom: '2022-08-02', methodology: 'counts the number of Total value locked in ESG protocol.', bsc: { ...compoundExports2({ comptroller: '0xfd1f241ba25b8966a14865cb22a4ea3d24c92451'}), @@ -9,3 +10,5 @@ module.exports = { }, start: 15307794, // Feb-16-2022 01:49:31 PM +UTC } + +module.exports.bsc.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/econia.js b/projects/econia.js index 43682d065cee..c6fc3d330e78 100644 --- a/projects/econia.js +++ b/projects/econia.js @@ -1,5 +1,4 @@ const axios = require("axios"); -const BigNumber = require("bignumber.js"); const URL = 'https://aptos-mainnet-econia.nodeinfra.com'; diff --git a/projects/eddyfinance-stableswap/index.js b/projects/eddyfinance-stableswap/index.js new file mode 100644 index 000000000000..a6d880d409db --- /dev/null +++ b/projects/eddyfinance-stableswap/index.js @@ -0,0 +1,37 @@ +const { getUniTVL } = require('../helper/unknownTokens') +const sdk = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)'; + +const stablePools = [ + '0x448028804461e8e5a8877c228F3adFd58c3Da6B6', // 4 asset pool + '0x01a9cd602c6c3f05ea9a3a55184c2181bd43e4b8', // 2 asset pool accumulated finance + '0xee1629de70afaf3ae3592a9d6d859949750aa697', // 2 asset pool zearn + '0x89cb3fA2A7910A268e9f7F619108aFADBD7587c4' // 2 asset UltiVerse pool +] + +async function stableSwapTvl(api) { + const params = [0, 1, 2, 3] + const calls = [] + stablePools.forEach(pool => { + params.forEach(param => + calls.push({ target: pool, params: param })) + }) + const tokens = await api.multiCall({ abi: 'function coins(uint256) view returns (address)', calls, permitFailure: true }) + const tokensAndOwners = [] + tokens.forEach((token, i) => { + if (!token) return; + tokensAndOwners.push([token, calls[i].target]) + }) + + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: stablePools }) +} + + + +module.exports = { + misrepresentedTokens: true, + methodology: "Sum of tvl of the StableSwap pools", + zeta: { tvl: stableSwapTvl }, +}; \ No newline at end of file diff --git a/projects/eddyfinance/index.js b/projects/eddyfinance/index.js index 6b155c1b7fad..48885f559f14 100644 --- a/projects/eddyfinance/index.js +++ b/projects/eddyfinance/index.js @@ -1,8 +1,38 @@ const { getUniTVL } = require('../helper/unknownTokens') -const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' +const sdk = require('@defillama/sdk'); +const { sumTokens2 } = require('../helper/unwrapLPs'); -const zetaTVL = getUniTVL({ factory: '0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c', abis: { getReserves } }) +const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)'; +/* +const stablePools = [ + '0x448028804461e8e5a8877c228F3adFd58c3Da6B6', // 4 asset pool + '0x01a9cd602c6c3f05ea9a3a55184c2181bd43e4b8', // 2 asset pool accumulated finance + '0xee1629de70afaf3ae3592a9d6d859949750aa697', // 2 asset pool zearn + '0x89cb3fA2A7910A268e9f7F619108aFADBD7587c4' // 2 asset UltiVerse pool +] + +async function stableSwapTvl(api) { + const params = [0, 1, 2, 3] + const calls = [] + stablePools.forEach(pool => { + params.forEach(param => + calls.push({ target: pool, params: param })) + }) + const tokens = await api.multiCall({ abi: 'function coins(uint256) view returns (address)', calls, permitFailure: true }) + const tokensAndOwners = [] + tokens.forEach((token, i) => { + if (!token) return; + tokensAndOwners.push([token, calls[i].target]) + }) + + return sumTokens2({ api, tokensAndOwners, blacklistedTokens: stablePools }) +} +*/ // separate into eddyfinance-stableswap adapter + +const uniTvl = getUniTVL({ factory: '0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c', abis: { getReserves } }) module.exports = { - zeta: { tvl: zetaTVL }, + misrepresentedTokens: true, + methodology: "Sum of tvl of UniV2 pools", + zeta: { tvl: uniTvl }, }; \ No newline at end of file diff --git a/projects/edgeX/index.js b/projects/edgeX/index.js new file mode 100644 index 000000000000..77bcb85f9ce3 --- /dev/null +++ b/projects/edgeX/index.js @@ -0,0 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const walletAddresses = { + eth: ['0xc0a1a1e4af873e9a37a0cac37f3ab81152432cc5', '0xfAaE2946e846133af314d1Df13684c89fA7d83DD'], + bsc: ['0x0520b0a951658db92b8a2dd9f146bb8223638740'], + arbitrum: ['0xceeed84620e5eb9ab1d6dfc316867d2cda332e41'], +}; + +const tokenAddress = { + eth: [ADDRESSES.ethereum.USDT], + bsc: [ADDRESSES.bsc.USDT], + arbitrum: [ADDRESSES.arbitrum.USDT], +} + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owners: walletAddresses.eth, tokens: tokenAddress.eth }), + }, + bsc: { + tvl: sumTokensExport({ owners: walletAddresses.bsc, tokens: tokenAddress.bsc }), + }, + arbitrum: { + tvl: sumTokensExport({ owners: walletAddresses.arbitrum, tokens: tokenAddress.arbitrum }), + }, +}; diff --git a/projects/eigenlayer/index.js b/projects/eigenlayer/index.js index a0d3c712495b..6f34f2bb3778 100644 --- a/projects/eigenlayer/index.js +++ b/projects/eigenlayer/index.js @@ -1,10 +1,14 @@ -const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const { getLogs } = require('../helper/cache/getLogs') -const { startAlliumQuery, retrieveAlliumResults } = require('../helper/allium') -const { getCache, setCache, } = require('../helper/cache') +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const { getLogs2 } = require("../helper/cache/getLogs"); +const { startAlliumQuery, retrieveAlliumResults } = require("../helper/allium"); +const { getCache, setCache } = require("../helper/cache"); + +const EIGEN = '0xec53bF9167f50cDEB3Ae105f56099aaaB9061F83' +const eigenStrategy = '0xaCB55C530Acdb2849e6d4f36992Cd8c9D50ED8F7' +const bEIGEN = '0x83e9115d334d248ce39a6f36144aeab5b3456e75' async function getEigenPods(timestamp) { - const queryId = await getCache('eigenlayer', 'eigenpods-query') + const queryId = await getCache("eigenlayer", "eigenpods-query"); const offset = 3; const newQuery = await startAlliumQuery(` select @@ -26,50 +30,52 @@ async function getEigenPods(timestamp) { from beacon.validator.balances where status in ('active_ongoing', 'pending_queued', 'pending_initialized', 'withdrawal_possible') - and slot_timestamp = '${new Date(timestamp * 1e3 - offset * 24 * 3600e3).toISOString().split('T')[0]}T23:59:59' - ) beacon where pods.params['eigenPod'] = beacon.WITHDRAWAL_ADDRESS`) - await setCache('eigenlayer', 'eigenpods-query', newQuery) - const eigenPods = await retrieveAlliumResults(queryId) - const sum = eigenPods[0]?.["sum"] + and slot_timestamp = '${ + new Date(timestamp * 1e3 - offset * 24 * 3600e3).toISOString().split("T")[0] + }T23:59:59' + ) beacon where pods.params['eigenPod'] = beacon.WITHDRAWAL_ADDRESS`); + await setCache("eigenlayer", "eigenpods-query", newQuery); + const eigenPods = await retrieveAlliumResults(queryId); + const sum = eigenPods[0]?.["sum"]; if (!sum) { - throw new Error("Empty eigenpods") + throw new Error("Empty eigenpods"); } - return sum + return sum; } -async function tvl({timestamp}, _b, _cb, { api, }) { - /* - const podLogs = await getLogs({ - api, - target: '0x91E677b07F7AF907ec9a428aafA9fc14a0d3A338', - topics: ['0x21c99d0db02213c32fff5b05cf0a718ab5f858802b91498f80d82270289d856a'], - eventAbi: "event PodDeployed (address indexed eigenPod, address indexed podOwner)", - onlyArgs: true, - fromBlock: 17445564, - }) - const pods = podLogs.map(log => log.eigenPod) - const restakedStatus = await api.multiCall({ abi: 'bool:hasRestaked', calls: pods }) - restakedStatus.filter(i => i).forEach(() => api.add(nullAddress, 32 * 1e18)) - */ +const fetchLogs = async (api, eventAbi) => getLogs2({ + api, + target: "0x858646372cc42e1a627fce94aa7a7033e7cf075a", + eventAbi, + fromBlock: 17445564, + skipCacheRead: true +}); +const tvl = async ({ timestamp }, _b, _cb, { api }) => { api.add(nullAddress, await getEigenPods(timestamp) * 1e18) - const logs = await getLogs({ - api, - target: '0x858646372CC42E1A627fcE94aa7A7033e7CF075A', - topic: 'StrategyAddedToDepositWhitelist(address)', - eventAbi: "event StrategyAddedToDepositWhitelist(address strategy)", - onlyArgs: true, - fromBlock: 17445564, - }) - const strategies = logs.map(log => log.strategy) - const tokens = await api.multiCall({ abi: 'address:underlyingToken', calls: strategies }) - return sumTokens2({ api, tokensAndOwners2: [tokens, strategies] }) + + const [addeds, removeds] = await Promise.all([ + fetchLogs(api, "event StrategyAddedToDepositWhitelist(address strategy)"), + fetchLogs(api, "event StrategyRemovedFromDepositWhitelist(address strategy)"), + ]); + + const activeStrategies = addeds + .map(item => item[0]) + .filter(strategy => !removeds.some(removed => removed[0] === strategy)); + + const rawUnderlyingTokens = await api.multiCall({ abi: 'address:underlyingToken', calls: activeStrategies }) + const underlyingTokens = rawUnderlyingTokens.filter((t) => t.toLowerCase() !== bEIGEN) // filter out bEIGEN + return sumTokens2({ api, tokensAndOwners2: [underlyingTokens, activeStrategies] }) + +}; + +const staking = async (api) => { + const balance = await api.call({ target: bEIGEN, params: [eigenStrategy], abi: 'erc20:balanceOf' }) + api.add(EIGEN, balance) } // https://github.com/Layr-Labs/eigenlayer-contracts/blob/master/script/output/M1_deployment_mainnet_2023_6_9.json module.exports = { timetravel: false, - ethereum: { - tvl, - }, -} + ethereum: { tvl, staking }, +}; \ No newline at end of file diff --git a/projects/eigenpie/config.js b/projects/eigenpie/config.js index 544eaf261943..d45891839f5e 100644 --- a/projects/eigenpie/config.js +++ b/projects/eigenpie/config.js @@ -1,6 +1,13 @@ module.exports = { - ethereum: { - eigenConfig: "0x20b70E4A1883b81429533FeD944d7957121c7CAB", - eigenStaking: "0x24db6717dB1C75B9Db6eA47164D8730B63875dB7", - } - }; \ No newline at end of file + ethereum: { + eigenConfig: "0x20b70E4A1883b81429533FeD944d7957121c7CAB", + eigenStaking: "0x24db6717dB1C75B9Db6eA47164D8730B63875dB7", + }, + zircuit:{ + msteth: "0x1C1Fb35334290b5ff1bF7B4c09130885b10Fc0f4", + egeth: "0x4bcc7c793534246BC18acD3737aA4897FF23B458", + wsteth: "0xf0e673Bc224A8Ca3ff67a61605814666b1234833", + weth: "0x4200000000000000000000000000000000000006", + } + +}; \ No newline at end of file diff --git a/projects/eigenpie/index.js b/projects/eigenpie/index.js index a19b6d398d70..c487fad2e26f 100644 --- a/projects/eigenpie/index.js +++ b/projects/eigenpie/index.js @@ -1,20 +1,49 @@ const config = require("./config"); -const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk') + +async function getZircuitSupplies(api) { + const { msteth, egeth } = config[api.chain]; + const mlrttokens = [msteth, egeth]; + const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: mlrttokens, }); + return { + zircuitMstethSupply: tokenSupplies[0], + zircuitEgethSupply: tokenSupplies[1], + }; +} async function tvl(api) { - const { eigenConfig, eigenStaking } = config[api.chain]; + const { eigenConfig } = config[api.chain]; + + const zircuitApi = new sdk.ChainApi({ chain: 'zircuit', timestamp: api.timestamp }); + await zircuitApi.getBlock() + const zircuitSupplies = await getZircuitSupplies(zircuitApi); + api.add('0xae7ab96520de3a18e5e111b5eaab095312d7fe84', zircuitSupplies.zircuitMstethSupply * -1); // Adjust for msteth + api.add('0xeFEfeFEfeFeFEFEFEfefeFeFefEfEfEfeFEFEFEf', zircuitSupplies.zircuitEgethSupply * -1); // Adjust for egeth - let tokens = await api.call({ abi: 'address[]:getSupportedAssetList', target: eigenConfig, }); - const mlrttokens = await api.multiCall({ abi: 'function mLRTReceiptByAsset(address) view returns (address)', calls: tokens, target: eigenConfig }) - const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: mlrttokens}) - tokens = tokens.map(token => token.toLowerCase() === '0xeFEfeFEfeFeFEFEFEfefeFeFefEfEfEfeFEFEFEf'.toLowerCase() ? ADDRESSES.null : token) - api.add(tokens, tokenSupplies) + // Fetch token list and their supplies + let tokens = await api.call({ abi: 'address[]:getSupportedAssetList', target: eigenConfig }); + const mlrttokens = await api.multiCall({ abi: 'function mLRTReceiptByAsset(address) view returns (address)', calls: tokens, target: eigenConfig }); + const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: mlrttokens }); + api.add(tokens, tokenSupplies); } -Object.keys(config).forEach((chain) => { - module.exports[chain] = { - tvl, - }; -}); +async function tvl_zircuit(api) { + const { msteth, egeth, wsteth, weth } = config[api.chain]; + const mlrttokens = [msteth, egeth]; + const tokens = [wsteth, weth]; + + // Now add zircuit-specific supplies + const tokenSupplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: mlrttokens }); + api.add(tokens, tokenSupplies); +} + +module.exports = { + ethereum: { + tvl: tvl, + }, + zircuit: { + tvl: tvl_zircuit, + }, +}; -module.exports.doublecounted = true \ No newline at end of file +module.exports.doublecounted = true; diff --git a/projects/elara/index.js b/projects/elara/index.js new file mode 100644 index 000000000000..59f6e25980d6 --- /dev/null +++ b/projects/elara/index.js @@ -0,0 +1,6 @@ +const { methodology, compoundExports2 } = require("../helper/compound"); + +module.exports = { + zircuit: compoundExports2({ comptroller: '0x695aCEf58D1a10Cf13CBb4bbB2dfB7eDDd89B296' }), + methodology, +} \ No newline at end of file diff --git a/projects/electrikfinance/index.js b/projects/electrikfinance/index.js index fbe4d161219b..1f5271627e4f 100644 --- a/projects/electrikfinance/index.js +++ b/projects/electrikfinance/index.js @@ -1,23 +1,7 @@ -const { sumUnknownTokens } = require("../helper/unknownTokens"); -const { getConfig } = require('../helper/cache') - -const chain = "klaytn"; -const tokenAPI = "address:want" - module.exports = { - [chain]: { - tvl: async (api) => { - let { result: { pools } } = await getConfig('elektrik-finance', 'https://api.electrik.finance/api/status/pools'); - pools = Object.values(pools) - const vaults = []; - const tokens = []; - for (var i = 0; i < pools.length; i++) { - vaults.push(pools[i].earnedTokenAddress); - tokens.push(pools[i].tokenAddress); - } - const bals = await api.multiCall({ abi: 'uint256:balance', calls: vaults }) - api.addTokens(tokens, bals) - return sumUnknownTokens({ api, useDefaultCoreAssets: true, resolveLP: true, lps: tokens }) - } + klaytn: { + tvl: () => ({}) } -} \ No newline at end of file +} + +module.exports.deadFrom = '2023-01-01' diff --git a/projects/electroswap-v2/index.js b/projects/electroswap-v2/index.js new file mode 100644 index 000000000000..35fbf2c4a3cc --- /dev/null +++ b/projects/electroswap-v2/index.js @@ -0,0 +1,7 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports={ + etn: { + tvl: getUniTVL({ factory: '0x203D550ed6fA9dAB8A4190720CF9F65138abd15B', useDefaultCoreAssets: false }), + } +} \ No newline at end of file diff --git a/projects/electroswap-v3/index.js b/projects/electroswap-v3/index.js new file mode 100644 index 000000000000..b580d9c6e93a --- /dev/null +++ b/projects/electroswap-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + etn: { + factory: "0xbF6Bcbe2be545135391777F3B4698be92E2EB8cA", + fromBlock: 1242016, + }, +}); diff --git a/projects/elexium/index.js b/projects/elexium/index.js new file mode 100644 index 000000000000..25363aa8de5c --- /dev/null +++ b/projects/elexium/index.js @@ -0,0 +1,65 @@ +const alephium = require("../helper/chain/alephium"); + +const elexiumTokenId = "cad22f7c98f13fe249c25199c61190a9fb4341f8af9b1c17fcff4cd4b2c3d200"; +const alephId = '0000000000000000000000000000000000000000000000000000000000000000' +const veAddress = "23XEjbtTNN2FtcJryavvfMf6VwgVK22uiw5T6N85kjFzX"; +const pairFactoryAddress = "22oTtDJEMjNc9QAdmcZarnEzgkAooJp9gZy7RYBisniR5"; + +async function getAllPools() { + const results = await alephium.contractMultiCall([ + { group: 0, address: pairFactoryAddress, methodIndex: 0 }, + ]); + + const pairsCount = Number(results[0].returns[0].value); + + const poolIds = []; + + for (let i = 0; i < pairsCount; i++) { + const results = await alephium.contractMultiCall([ + { + group: 0, + address: pairFactoryAddress, + methodIndex: 2, + args: [{ value: i, type: "U256" }], + }, + ]); + + const poolId = results[0].returns[0].value; + + poolIds.push(poolId); + } + + return poolIds; +} + +async function addPoolTokens(poolId, api) { + const poolAddress = alephium.addressFromContractId(poolId); + + const tokenBalance = (await alephium.getTokensBalance(poolAddress)).filter( + (t) => t.tokenId !== poolId, + ); + + tokenBalance.forEach(i => api.add(i.tokenId, i.balance)); + + const alphBalance = (await alephium.getAlphBalance(poolAddress)).balance; + api.add(alephId, alphBalance); +} + +async function poolsTvl(api) { + const allPools = await getAllPools() + + for (const pool of allPools) + await addPoolTokens(pool, api); +} + +async function veTVL(api) { + const tokenBalance = (await alephium.getTokensBalance(veAddress)).find((t) => t.tokenId === elexiumTokenId,) ?? { balance: 0 }; + api.add(elexiumTokenId, tokenBalance.balance); +} + +module.exports = { + timetravel: false, + methodology: + "Total value of tokens provided as liquidity on alephium and total amount of locked $EX in voting escrow", + alephium: { tvl: poolsTvl, staking: veTVL }, +}; diff --git a/projects/elfi/index.js b/projects/elfi/index.js new file mode 100644 index 000000000000..f5993606535f --- /dev/null +++ b/projects/elfi/index.js @@ -0,0 +1,30 @@ + +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +const tradeVault = '0x8772bB60EA1BBA8a7729a90ff1907855FD55ba83' +const lpVault = '0xbC268D619b406bdfCA1B4AC30d50Ba30AB38E96f' +const portfolioVault = '0x9099824Be9aB2b691ce0E478853Cb15Fb81FF677' + +const elfUSD = '0x70B8117b3177a7CE42BEe021E89625f27E45b98C' + +module.exports = { + arbitrum: { + tvl, + }, +}; + +async function tvl(api) { + const logs = await getLogs2({ + api, + factory: '0x153c613D572c050104086c7113d00B76Fbaa5d55', + eventAbi: 'event MarketCreated (bytes32 code, string stakeTokenName, address indexToken, address baseToken, address stakeToken)', + fromBlock: 233088372, + }) + + const ownerTokens = logs.map(log => [[log.baseToken, log.indexToken], log.stakeToken]) + ownerTokens.push([[ADDRESSES.arbitrum.USDC_CIRCLE], elfUSD]) + const tokens = ownerTokens.map(([tokens]) => tokens).flat() + await api.sumTokens({ tokens, owners: [lpVault, portfolioVault, tradeVault] }) + return api.sumTokens({ ownerTokens}) +} \ No newline at end of file diff --git a/projects/elixir/index.js b/projects/elixir/index.js new file mode 100644 index 000000000000..14febf5d5be4 --- /dev/null +++ b/projects/elixir/index.js @@ -0,0 +1,59 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { sumTokensExport } = require("../helper/unwrapLPs"); +const MANAGER_ABI = { + getPoolToken: "function getPoolToken(uint256 id, address token) view returns (address _address, uint256 amount, uint256, bool)", + getPoolToken_2: "function pools(uint256 id) view returns (address router, uint8 poolType, address token, uint256 orderlyDepositFee, uint256 orderlyWithdrawalFee, uint256 activeAmount, uint256 hardcap)" +} + +const DEUSD_LP_STAKING = "0xC7963974280261736868f962e3959Ee1E1B99712"; +const COMMITS = "0x4265f5D6c0cF127d733EeFA16D66d0df4b650D53"; +const FOUNDATION = "0x4B4EEC1DDC9420a5cc35a25F5899dC5993f9e586"; +const FOUNDATION_2 = "0x738744237b7Fd97AF670d9ddF54390c24263CeA8"; +const deUSD = "0x15700b564ca08d9439c58ca5053166e8317aa138" + +const LP_TOKENS = [ + "0xb478Bf40dD622086E0d0889eeBbAdCb63806ADde", // DEUSD/DAI Curve LP + "0x88DFb9370fE350aA51ADE31C32549d4d3A24fAf2", // DEUSD/FRAX Curve LP + "0x5F6c431AC417f0f430B84A666a563FAbe681Da94", // DEUSD/USDC Curve LP + "0x7C4e143B23D72E6938E06291f705B5ae3D5c7c7C", // DEUSD/USDT Curve LP +]; + +const VERTEX_MANAGER = '0x052Ab3fd33cADF9D9f227254252da3f996431f75' +const ORDERLY_MANAGER = '0x79865208f5dc18a476f49e6dbfd7d79785cb8cd8' + +const orderlyIntegration = async (api, manager, poolIds) => { + const pools = await api.multiCall({ abi: MANAGER_ABI.getPoolToken_2, calls: poolIds, target: manager }); + pools.forEach(i => api.add(i.token, i.activeAmount)); +} + +const integration = async (api, manager, poolIds, tokens) => { + if (manager === ORDERLY_MANAGER) + return orderlyIntegration(api, manager, poolIds) + const calls = poolIds.map(id => tokens.map(token => ({ params: [id, token] }))).flat(); + const pools = await api.multiCall({ abi: MANAGER_ABI.getPoolToken, calls, target: manager }); + pools.forEach((v, i) => api.add(calls[i].params[1], v.amount)); +} + +module.exports = { + ethereum: { + tvl: async (api) => { + // const deusdSupply = await api.call({ target: deUSD, abi: "erc20:totalSupply" }) + // api.add(deUSD, deusdSupply); + await api.sumTokens({ owners: [COMMITS, FOUNDATION, FOUNDATION_2], tokens: [ADDRESSES.ethereum.STETH, ADDRESSES.null, ADDRESSES.ethereum.SDAI] }) + }, + pool2: sumTokensExport({ owner: DEUSD_LP_STAKING, tokens: LP_TOKENS }) + }, + arbitrum: { + tvl: async (api) => { + await integration(api, VERTEX_MANAGER, [1, 2, 3, 4, 5, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 31, 34, 36, 38, 40, 41, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62], [ + ADDRESSES.arbitrum.USDC_CIRCLE, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.ARB, + '0x95146881b86B3ee99e63705eC87AfE29Fcc044D9', + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.WETH, + ]) + await integration(api, ORDERLY_MANAGER, Array.from({ length: 10 }, (_, i) => i + 1)) + } + } +}; diff --git a/projects/elkfinance/index.js b/projects/elkfinance/index.js index b6f6026c6296..86c844e12eac 100644 --- a/projects/elkfinance/index.js +++ b/projects/elkfinance/index.js @@ -31,7 +31,8 @@ const factories = { base: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", linea: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", velas: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", - q: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4" + q: "0xfbb4E52FEcc90924c79F980eb24a9794ae4aFFA4", + rsk: "0x69D10bc18cd588a4B70F836A471D4e9c2Fd86092" } function chainTvl(chain) { diff --git a/projects/elma/index.js b/projects/elma/index.js new file mode 100644 index 000000000000..4f1ce27e1de2 --- /dev/null +++ b/projects/elma/index.js @@ -0,0 +1,24 @@ +module.exports = { + methodology: "Principal Tokens (PT) are always 1:1 mintable & redeemable with Underlying Tokens (UT). TVL is Total Market Cap of all PT, where 1 PT = 1 UT.", +} + +const config = { + fantom: { markets: [ + '0x0a558d43bccbc7586547fc74e3a0e70467215b3c', + '0x35402cDc3BCFFb904116bDC720Afc75c2921De08', + '0xB6633c351a3aF289ed6bbF4A78c682FA16656B1E', + '0xFaa22e721924fa57d042F6E2c793997aA9287B27', + ]} +} + +Object.keys(config).forEach(chain => { + const {markets,} = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const tokens = await api.multiCall({ abi: 'address:BASE', calls: markets}) + const wTokens = await api.multiCall({ abi: 'address:WRAP', calls: markets}) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: wTokens}) + api.add(tokens, supplies) + } + } +}) \ No newline at end of file diff --git a/projects/empyrean/index.js b/projects/empyrean/index.js index fd1a0dd0caf1..7946f41140a1 100644 --- a/projects/empyrean/index.js +++ b/projects/empyrean/index.js @@ -1,40 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const empyreanStaking = "0xD080CBc2885c64510923Ac6F5c8896011f86a6aF"; const EMPYR = "0xE9F226a228Eb58d408FdB94c3ED5A18AF6968fE1"; -const treasuryAddress = "0x4606f4e6D43d501b86Fc583f44ae27097A1F9EA7"; -const USDC = ADDRESSES.aurora.USDC_e; -const EMPYR_USDC_TLP = "0x6e46c69FE35eF5BB78D7f35d92645C74245a6567"; - -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of USDC and Trisolaris TLP balances - ***/ -async function auroraTvl(timestamp, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [USDC, false], - [EMPYR_USDC_TLP, true], - ], - [treasuryAddress], - chainBlocks["aurora"], - "aurora", - (addr) => `aurora:${addr}` - ); - - return balances; -} - module.exports = { misrepresentedTokens: true, aurora: { staking: staking(empyreanStaking, EMPYR), - tvl: auroraTvl, + tvl: () => ({}), }, methodology: "Counts USDC and TLP (EMPYR-USDC) on the treasury", diff --git a/projects/energondex/index.js b/projects/energondex/index.js index c296374609a1..e5e45cec6ec9 100644 --- a/projects/energondex/index.js +++ b/projects/energondex/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL, staking } = require('../helper/unknownTokens') const sdk = require('@defillama/sdk') -const uniTvl = getUniTVL({ factory: '0xBfAe4f07C099798F23f5aC6773532fB637B68Ad7', useDefaultCoreAssets: true, fetchBalances: true, }) +const uniTvl = getUniTVL({ factory: '0xBfAe4f07C099798F23f5aC6773532fB637B68Ad7', useDefaultCoreAssets: true, }) const masterchef = '0x9A40F8374cf840cb1d76DD085E250D86641FB6a3' const egd = '0xF8F85beB4121fDAa9229141e5D5e4B782d8819D8' const weth = ADDRESSES.base.WETH diff --git a/projects/enosys-bridge/index.js b/projects/enosys-bridge/index.js index 57c5807cfeb6..069f878851c6 100644 --- a/projects/enosys-bridge/index.js +++ b/projects/enosys-bridge/index.js @@ -2,7 +2,7 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - xdc: { tvl: sumTokensExport({ owner: '0xd5308a4bb2d7121a26d0bd11257245f0efda2bc4', tokens: [ADDRESSES.xdc.WXDC], logCalls: true }) }, + xdc: { tvl: sumTokensExport({ owner: '0xcB71dC7b30205eB7Ce27B2cB36b24ba331ecD42a', tokens: [ADDRESSES.xdc.WXDC], logCalls: true }) }, ethereum: { tvl: sumTokensExport({ tokensAndOwners: [ [ADDRESSES.ethereum.USDT,'0x8936761f2903ed1af2b269e6fa3a79ebb0162c51'], diff --git a/projects/enosys-dex-v3/index.js b/projects/enosys-dex-v3/index.js new file mode 100644 index 000000000000..2cb8d3c4698f --- /dev/null +++ b/projects/enosys-dex-v3/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + songbird: { factory: "0x416F1CcBc55033Ae0133DA96F9096Fe8c2c17E7d", fromBlock: 69857654 }, + flare: { factory: "0x17AA157AC8C54034381b840Cb8f6bf7Fc355f0de", fromBlock: 29925441 }, +}); \ No newline at end of file diff --git a/projects/ensuro/index.js b/projects/ensuro/index.js index 47ac5caf0486..b892a405af23 100644 --- a/projects/ensuro/index.js +++ b/projects/ensuro/index.js @@ -4,10 +4,10 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const addressBook = { polygon: { usdc: ADDRESSES.polygon.USDC, - aave_v3_usdc: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aPolUSDC - aave_v2_usdc: "0x1a13F4Ca1d028320A707D99520AbFefca3998b7F", // amUSDC + aave_v3_usdc: "0x625E7708f30cA75bfd92586e17077590C60eb4cD", // aPolUSDC - AAVE USDC (Bridged) + aave_v3_native_usdc: "0xA4D94019934D8333Ef880ABFFbF2FDd611C762BD", // aPolUSDCn - AAVE USDC (Native) compound_v3_usdc: "0xF25212E676D1F7F89Cd72fFEe66158f541246445", // Compound USDC - mountain_usdm: "0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C", // Mountain USDM + mountain_usdm: ADDRESSES.ethereum.USDM, // Mountain USDM reserves: [ // eTokens {name: "eToken Junior Koala", address: "0x8d2Ee82c4172B2138B06b8037d769cBfAf9C0274"}, @@ -24,6 +24,9 @@ const addressBook = { {name: "eToken Junior Bliss", address: "0x71d390C243706b713B5D2b077E942223f7A55d00"}, {name: "eToken Junior InsureHero", address: "0x15F76F59A29C7c12b4a67751CA525bf9167C1AaB"}, {name: "eToken Junior Clerity", address: "0x1c7F0c8ba10Db7f2e1c7B5B0A024b66b6baceb45"}, + {name: "eToken Junior FortuneCredit", address: "0xb1Dff6ce862273adcA2B9eFD96A8976764Ac7414"}, + {name: "eToken Junior Azzegura", address: "0x45435f79103472eD62fB9C92F04c50b188b22B99"}, + {name: "eToken Junior Covest", address: "0x92624870dC092C36943682375Df8246BF126D410"}, // PremiumsAccounts {name: "PremiumsAccount Koala", address: "0xCCf5C404d32eB6E777088AB13837a1b8dCBA9328"}, {name: "PremiumsAccount Innov Zone", address: "0x4f43B8F252887F814ED689346fdb5Bd266394520"}, @@ -37,6 +40,13 @@ const addressBook = { {name: "PremiumsAccount Bliss", address: "0x11b490292799a0edFE37797592F77151C4483442"}, {name: "PremiumsAccount InsureHero", address: "0x41B5a105C850014eC594879E8511994F25092460"}, {name: "PremiumsAccount Clerity", address: "0xD26d5015C57C197AE5e7BC866B49837d22364eAB"}, + {name: "PremiumsAccount FortuneCredit", address: "0xaF48bd33916836F5A3dD8C9095692d240A6A2567"}, + {name: "PremiumsAccount Azzegura", address: "0x6CB730dF6B3DB5BAac5FD96F50b04005c1B3A5F7"}, + {name: "PremiumsAccount Covest", address: "0x1D71E3901dB121F05A4a06F92440108055386355"}, + // Main CFLs + {name: "CFL Koala", address: "0xf6b7a278afFbc905b407E01893B287D516016ce0"}, + {name: "CFL Spot", address: "0x48Ff8B1493c6A3545Aea3F0812f1303E2f958bF4"}, + {name: "CFL Bliss", address: "0x936DAC0eeA5e4E90B8384B96d1aA6284Ce106f71"}, // MultiStrategy Vault - Vault that aggregates assets of several reserves {name: "MultiStrategy Vault", address: "0x1EE585dcea25cbDa16BE8cfeFa381A1F32acA418"}, ], @@ -45,7 +55,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, addresses.mountain_usdm], i.address]) + const ownerTokens = addresses.reserves.map(i => [[addresses.usdc, addresses.aave_v3_usdc, addresses.aave_v3_native_usdc, addresses.compound_v3_usdc, addresses.mountain_usdm], i.address]) return sumTokens2({ api, ownerTokens, }); } diff --git a/projects/enterdao/index.js b/projects/enterdao/index.js index 0be631aa3ced..0e414715655f 100644 --- a/projects/enterdao/index.js +++ b/projects/enterdao/index.js @@ -1,9 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const StakingContract = "0x3F148612315AaE2514AC630D6FAf0D94B8Cd8E33"; -const USDC_ENTR_SUSHI_LP = "0x83b546e10917432a722444672504f0d459472171"; const yieldFarms = [ ADDRESSES.ethereum.SUSHI, //SUSHI "0xbb0e17ef65f82ab018d8edd776e8dd940327b28b", //AXS @@ -15,26 +13,11 @@ const yieldFarms = [ "0x83b546e10917432a722444672504f0d459472171", //SUSHI-LP ]; -const ethTvl = async () => { - const balances = {}; - - for (const yieldFarm of yieldFarms) { - await sumTokensAndLPsSharedOwners( - balances, - yieldFarm == USDC_ENTR_SUSHI_LP - ? [[yieldFarm, true]] - : [[yieldFarm, false]], - [StakingContract] - ); - } - - return balances; -}; module.exports = { misrepresentedTokens: true, ethereum: { - tvl: ethTvl, + tvl: sumTokensExport({ owner: StakingContract, tokens: yieldFarms, resolveLP: true, }), }, methodology: "We count as TVL all the Yield Farms through Staking Contract", }; diff --git a/projects/entities/el-salvador.js b/projects/entities/el-salvador.js index 37e69daa82f8..1bdb7b30d4e8 100644 --- a/projects/entities/el-salvador.js +++ b/projects/entities/el-salvador.js @@ -1,5 +1,6 @@ const { sumTokensExport } = require('../helper/sumTokens') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { - bitcoin: { tvl: sumTokensExport({owner: '32ixEdVJWo3kmvJGMTZq5jAQVZZeuwnqzo'}) } + bitcoin: { tvl: sumTokensExport({ owners: bitcoinAddressBook.elSalvador }) } } \ No newline at end of file diff --git a/projects/entities/fbi-dprk.js b/projects/entities/fbi-dprk.js index cab5e9377320..93f0017ec889 100644 --- a/projects/entities/fbi-dprk.js +++ b/projects/entities/fbi-dprk.js @@ -1,16 +1,5 @@ const { treasuryExports } = require("../helper/treasury") +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: [ //source https://www.fbi.gov/news/press-releases/fbi-identifies-cryptocurrency-funds-stolen-by-dprk - "3LU8wRu4ZnXP4UM8Yo6kkTiGHM9BubgyiG", - "39idqitN9tYNmq3wYanwg3MitFB5TZCjWu", - "3AAUBbKJorvNhEUFhKnep9YTwmZECxE4Nk", - "3PjNaSeP8GzLjGeu51JR19Q2Lu8W2Te9oc", - "3NbdrezMzAVVfXv5MTQJn4hWqKhYCTCJoB", - "34VXKa5upLWVYMXmgid6bFM4BaQXHxSUoL" - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.fbiDprk } } module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/mt-gox.js b/projects/entities/mt-gox.js index df5b55172cd3..9d4a8a99373a 100644 --- a/projects/entities/mt-gox.js +++ b/projects/entities/mt-gox.js @@ -1,14 +1,5 @@ const { treasuryExports } = require("../helper/treasury") +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: [ - "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ - 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', - 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', - 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.mtGoxEntities } } module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/entities/silkroad-fbifunds.js b/projects/entities/silkroad-fbifunds.js index df5b55172cd3..0c9c2e09c867 100644 --- a/projects/entities/silkroad-fbifunds.js +++ b/projects/entities/silkroad-fbifunds.js @@ -1,14 +1,5 @@ const { treasuryExports } = require("../helper/treasury") +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: [ - "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ - 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', - 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', - 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.silkroadFBIEntities } } module.exports = treasuryExports(config) \ No newline at end of file diff --git a/projects/enzo/index.js b/projects/enzo/index.js index e4fd5e32ba3d..e454bcb795c5 100644 --- a/projects/enzo/index.js +++ b/projects/enzo/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports2 } = require("../helper/compound"); module.exports = { - btr: compoundExports2({ cether: '0xe277Aed3fF3Eb9824EdC52Fe7703DF0c5ED8B313', comptroller: '0xe688a4a94AD1D32CD52A01306fc0a9552749F322', cetheEquivalent: '0xfF204e2681A6fA0e2C3FaDe68a1B28fb90E4Fc5F' }) + btr: compoundExports2({ cether: '0xe277Aed3fF3Eb9824EdC52Fe7703DF0c5ED8B313', comptroller: '0xe688a4a94AD1D32CD52A01306fc0a9552749F322', cetheEquivalent: ADDRESSES.btr.WBTC }) }; \ No newline at end of file diff --git a/projects/enzyme/index.js b/projects/enzyme/index.js index 121fe8240fdb..8bd0e867834a 100644 --- a/projects/enzyme/index.js +++ b/projects/enzyme/index.js @@ -5,6 +5,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const config = { polygon: { endpoint: sdk.graph.modifyEndpoint('GCAHDyqvZBLMwqdb9U7AqWAN4t4TSwR3aXMHDoUUFuRV') }, ethereum: { endpoint: sdk.graph.modifyEndpoint('9DLBBLep5UyU16kUQRvxBCMqko4q9XzuE4XsMMpARhKK') }, + arbitrum: { endpoint: sdk.graph.modifyEndpoint('8UJ5Bkf2eazZhXsAshhzQ2Keibcb8NFHBvXis9pb2C2Y') }, } const query = `query get_accounts($lastId: String!) { vaults( @@ -16,6 +17,12 @@ const query = `query get_accounts($lastId: String!) { async function tvl(api) { const { endpoint } = config[api.chain] const vaults = await cachedGraphQuery('enzyme/' + api.chain, endpoint, query, { fetchById: true, }) + const externalPositions = (await api.multiCall({ calls: vaults.map(i => i.id), abi: 'address[]:getActiveExternalPositions', excludeFailed: true, })).flat() + const managedAssets = await api.multiCall({ abi: 'function getManagedAssets() external returns (address[] memory assets, uint256[] memory amounts)', calls: externalPositions, excludeFailed: true, }) + const debtAssets = await api.multiCall({ abi: 'function getDebtAssets() external returns (address[] memory assets, uint256[] memory amounts)', calls: externalPositions, excludeFailed: true, }) + managedAssets.forEach(i => api.add(i.assets, i.amounts)) + debtAssets.forEach(i => api.add(i.assets, i.amounts.map(i => -1 * i))) + return sumTokens2({ api, ownerTokens: vaults.map(i => { return [i.trackedAssets.map(i => i.id), i.id] @@ -30,4 +37,4 @@ module.exports = { Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) diff --git a/projects/equilibria/index.js b/projects/equilibria/index.js index b848170a21cd..14c6cc39e75c 100644 --- a/projects/equilibria/index.js +++ b/projects/equilibria/index.js @@ -26,6 +26,12 @@ const contracts = { staker: "0x4D32C8Ff2fACC771eC7Efc70d6A8468bC30C26bF", eqbRewardsAddress: "0x22Fc5A29bd3d6CCe19a06f844019fd506fCe4455", pendleAddress: "0xBC7B1Ff1c6989f006a1185318eD4E7b5796e66E1", + }, + mantle: { + boosterAddress: "0x920873E5b302A619C54c908aDFB77a1C4256A3B8", + staker: "0x479603DE0a8B6D2f4D4eaA1058Eea0d7Ac9E218d", + eqbRewardsAddress: "0x71e0ce200a10f0bBFB9F924fE466ACf0B7401EbF", + pendleAddress: "0xd27B18915e7acc8FD6Ac75DB6766a80f8D2f5729", } }; @@ -90,7 +96,7 @@ async function tvl(chain, block) { return balances; } -const chains = ["ethereum", "arbitrum", 'bsc', 'optimism']; +const chains = ["ethereum", "arbitrum", 'bsc', 'optimism', 'mantle']; module.exports = { doublecounted: true, diff --git a/projects/equilibrium/api.js b/projects/equilibrium/api.js index 45f1595d10b6..8b45d48911dc 100644 --- a/projects/equilibrium/api.js +++ b/projects/equilibrium/api.js @@ -1,94 +1,6 @@ -const { ApiPromise, WsProvider } = require("@polkadot/api"); -const BN = require("bn.js"); - -const capitalize = (str) => str.slice(0, 1).toUpperCase() + str.slice(1); - -const currencyFromU64 = (u64) => { - const bytes = []; - let num = typeof u64 === "number" ? new BN(u64) : u64; - do { - bytes.unshift(num.modn(256)); - num = num.divn(256); - } while (num.gtn(0)); - return capitalize(Buffer.from(bytes).toString("utf8")); -}; - -const u64FromCurrency = (currency) => { - const buf = Buffer.from(currency.toLowerCase()); - const size = buf.length; - return buf.reduce((val, digit, i) => val + Math.pow(256, size - 1 - i) * digit, 0); -}; - -const ASSETS = { - // Do not incluede Eq token in product TVL - "Eq": "", - "Aca": "Acala", - "Bnb": "binancecoin", - "Bnc": "bifrost-native-coin", - "Cru": "crust-network", - "Dot": "polkadot", - "Eqd": "", - "Lit": "Litentry ", - "Pha": "Phala", - "Astr": "Astar", - "Busd": "binance-usd", - "Glmr": "Moonbeam", - "Ibtc": "Bitcoin", - "Intr": "Interlay", - "Lpt0": "", - "Lpt1": "", - "Para": "parallel-finance", - "Usdt": "tether", - "Xdot": "polkadot", - "Cd613": "polkadot", - "Cd714": "polkadot", - "Cd815": "polkadot", - "Eqdot": "polkadot", - "Mxeth": "ethereum", - "Xdot2": "polkadot", - "Xdot3": "polkadot", - "Mxusdc": "usd-coin", - "Mxwbtc": "wrapped-bitcoin", -}; - -const PRECISION = 1_000_000_000n; async function tvl() { - const provider = new WsProvider("wss://node.pol.equilibrium.io/"); - const api = await ApiPromise.create({ provider }); - - const assets = (await api.query.eqAssets.assets()).unwrap(); - - const queries = assets.map(({ id }) => { - return [api.query.eqAggregates.totalUserGroups, ["Balances", { 0: id }]]; - }); - - const balances = await api.queryMulti(queries); - - const eqDotPrice = (await api.query.oracle.pricePoints(u64FromCurrency("eqdot"))).unwrap().price.toNumber() - / (await api.query.oracle.pricePoints(u64FromCurrency("dot"))).unwrap().price.toNumber(); - - const accuracy = 10000; - - const result = assets.reduce((acc, { id }, i) => { - const symbol = currencyFromU64(id) - const coiungekoAsset = ASSETS[symbol]; - if (coiungekoAsset) - { - let amount = Number(balances[i].collateral.toBigInt() * BigInt(accuracy) / PRECISION) / accuracy; - - // eqDot staking token - if (symbol == "Eqdot") - { - amount *= eqDotPrice; - } - acc[coiungekoAsset] = (acc[coiungekoAsset] ?? 0) + amount; - } - return acc; - }, {}); - - return result; -} + throw new Error("Equilibrium chain is deprecated");} module.exports = { equilibrium: {tvl}, diff --git a/projects/equilibrium/index.js b/projects/equilibrium/index.js index 52f805a08992..c1484bea19d7 100644 --- a/projects/equilibrium/index.js +++ b/projects/equilibrium/index.js @@ -1,6 +1,8 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + hallmarks: [[1714550400, 'Sunset of Equilibrium Network']], + deadFrom: "2024-09-01", timetravel: false, ...getExports("equilibrium", ['equilibrium']) } \ No newline at end of file diff --git a/projects/eris-protocol/index.js b/projects/eris-protocol/index.js index 2d68297c92d8..1f60b22d8e8d 100644 --- a/projects/eris-protocol/index.js +++ b/projects/eris-protocol/index.js @@ -172,6 +172,10 @@ const config = { coinGeckoId: "chihuahua-token", hub: "chihuahua1nktfhalzvtx82kyn4dh6l8htcl0prfpnu380a39zj52nzu3j467qqg23ry", }, + nibiru: { + coinGeckoId: "nibiru", + hub: "nibi1udqqx30cw8nwjxtl4l28ym9hhrp933zlq8dqxfjzcdhvl8y24zcqpzmh8m", + }, }; let assetDecimals = { @@ -399,7 +403,7 @@ async function productsTvl(chain) { module.exports = { timetravel: false, - methodology: "Liquid Staking and Arbitrage Protocol", + methodology: "Liquid Staking and Arbitrage Protocol", terra2: { tvl: () => productsTvl("terra2") }, terra: { tvl: () => productsTvl("terra") }, kujira: { tvl: () => productsTvl("kujira") }, @@ -411,4 +415,5 @@ module.exports = { chihuahua: { tvl: () => productsTvl("chihuahua") }, archway: { tvl: () => productsTvl("archway") }, sei: { tvl: () => productsTvl("sei") }, + nibiru: { tvl: () => productsTvl("nibiru") }, }; diff --git a/projects/esper-finance/index.js b/projects/esper-finance/index.js index e7bf0db6028f..eecb132f3938 100644 --- a/projects/esper-finance/index.js +++ b/projects/esper-finance/index.js @@ -4,6 +4,6 @@ module.exports = { misrepresentedTokens: true, start: 4781359, mantle: { - tvl: getUniTVL({ factory: '0x69C4515C926ac3db7A547044145495240961a7B5', useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x69C4515C926ac3db7A547044145495240961a7B5', useDefaultCoreAssets: true, }), }, }; diff --git a/projects/estate-protocol/index.js b/projects/estate-protocol/index.js new file mode 100644 index 000000000000..58bca1154727 --- /dev/null +++ b/projects/estate-protocol/index.js @@ -0,0 +1,20 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { get } = require('../helper/http') + +const EVM_ADDRESS_REGEX = /^0x[a-fA-F0-9]{40}$/; + +async function tvl(api) { + const tokens = (await get('https://estateprotocol.com/api/public/property/list')).filter(t => t.propertyAddress && EVM_ADDRESS_REGEX.test(t.propertyAddress) && t.token_price) + const tokenSupplies = await api.multiCall({ calls: tokens.map((token) => ({ target: token.propertyAddress })), abi: 'erc20:totalSupply' }) + + tokenSupplies.forEach((supply, i) => { + const token = tokens[i] + const price = parseFloat(token.token_price) + api.add(ADDRESSES.arbitrum.USDC_CIRCLE, supply * price * Math.pow(10, 6-18)) + }) +} + +module.exports = { + methodology: `TVL for Estate Protocol consists of the accumulation of all properties prices, each being tokenSupply * tokenPrice where tokenPrice is given by the API`, + arbitrum: { tvl } +} diff --git a/projects/ether-fi/index.js b/projects/ether-fi/index.js index 3be5a79fad12..9a2c088fa272 100644 --- a/projects/ether-fi/index.js +++ b/projects/ether-fi/index.js @@ -1,9 +1,16 @@ const { nullAddress } = require("../helper/unwrapLPs"); const sdk = require('@defillama/sdk') +function staking(contract, token) { + return async (api) => { + api.add(token, await api.call({ target: contract, abi: 'erc20:totalSupply'})) + } +} + module.exports = { doublecounted: true, ethereum: { + staking: staking("0x86B5780b606940Eb59A062aA85a07959518c0161", "0xFe0c30065B384F05761f15d0CC899D4F9F9Cc0eB"), tvl: async ({ timestamp }) => { const api = new sdk.ChainApi({ timestamp, chain: 'optimism' }) await api.getBlock() @@ -11,5 +18,8 @@ module.exports = { [nullAddress]: await api.call({ target: '0x6329004E903B7F420245E7aF3f355186f2432466', abi: 'uint256:getTvl' }) } } + }, + arbitrum:{ + staking: staking("0x86B5780b606940Eb59A062aA85a07959518c0161", "0x7189fb5b6504bbff6a852b13b7b82a3c118fdc27") } } diff --git a/projects/ethereum-classic-stable-dollar/index.js b/projects/ethereum-classic-stable-dollar/index.js new file mode 100644 index 000000000000..a7d96f22adfa --- /dev/null +++ b/projects/ethereum-classic-stable-dollar/index.js @@ -0,0 +1,14 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, } = require('../helper/unwrapLPs') +const { sumTokensExport, } = require('../helper/sumTokens') + +module.exports = { + methodology: "The TVL of ECSD is the amount of ETC in the contract's reserve.", + ethereumclassic: { + tvl: sumTokensExport({ + owner: '0xCc3664d7021FD36B1Fe2b136e2324710c8442cCf', + tokens: [nullAddress], + }) + }, +} + diff --git a/projects/etherfi-liquid/index.js b/projects/etherfi-liquid/index.js index 2ffb2b3b8dda..bc6001deb4ed 100644 --- a/projects/etherfi-liquid/index.js +++ b/projects/etherfi-liquid/index.js @@ -1,12 +1,18 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') +const liquidVaults = [ + "0xf0bb20865277aBd641a307eCe5Ee04E79073416C", + "0x08c6F91e2B681FaF5e17227F2a44C307b3C1364C" +] + +const liquidAccountants = [ + "0x0d05D94a5F1E76C18fbeB7A13d17C8a314088198", + "0xc315D6e14DDCDC7407784e2Caf815d131Bc1D3E7" +] + async function tvl(api) { const optimismApi = new sdk.ChainApi({ chain: 'optimism', timestamp: api.timestamp }) - const balETH = await api.call({ - abi: "uint256:totalSupply", - target: '0xf0bb20865277aBd641a307eCe5Ee04E79073416C', - }); await optimismApi.getBlock() const wethBal = await optimismApi.call({ target: '0xAB7590CeE3Ef1A863E9A5877fBB82D9bE11504da', @@ -18,17 +24,31 @@ async function tvl(api) { abi: 'function categoryLastUpdated(string _category) view returns (uint256)', params: ['liquid-weth'] }); - if (api.timestamp - updatedTimestamp > 12 * 60 * 60 || updatedTimestamp > api.timestamp) { + + //eth vault + const balETH = await api.call({ + abi: "uint256:totalSupply", + target: liquidVaults[0], + }); + const ethQuote = await api.call({ + target: liquidAccountants[0], + abi: 'function getRate() view returns (uint256)' + }); + if (api.timestamp - updatedTimestamp > 12 * 60 * 60) { throw new Error('Data is outdated') } - console.log(updatedTimestamp, api.timestamp) - api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) - BigInt(wethBal)); + api.add(ADDRESSES.ethereum.EETH, BigInt(balETH) * BigInt(ethQuote) / BigInt(1e18) - BigInt(wethBal)); api.add(ADDRESSES.ethereum.WETH, wethBal) + //usdc vault const balUSD = await api.call({ abi: "uint256:totalSupply", - target: '0x08c6f91e2b681faf5e17227f2a44c307b3c1364c', + target: liquidVaults[1], + }); + const usdQuote = await api.call({ + target: liquidAccountants[1], + abi: 'function getRate() view returns (uint256)' }); - api.add(ADDRESSES.ethereum.USDC, balUSD); + api.add(ADDRESSES.ethereum.USDC, balUSD * usdQuote / 1e6); } module.exports = { diff --git a/projects/etherfi-lrt/index.js b/projects/etherfi-lrt/index.js index 576cdac1e000..78604fcdee0e 100644 --- a/projects/etherfi-lrt/index.js +++ b/projects/etherfi-lrt/index.js @@ -1,17 +1,41 @@ -const ADDRESSES = require('../helper/coreAssets.json'); -const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') -async function tvl(api) { - const balETH2 = await api.call({ - abi: "uint256:totalSupply", - target: '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88', - }); - api.add(ADDRESSES.ethereum.EETH, BigInt(balETH2)); +const vaults = [ + '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88', + '0x7223442cad8e9cA474fC40109ab981608F8c4273', + '0x657e8C867D8B37dCC18fA4Caead9C45EB088C642', + '0x352180974C71f84a934953Cf49C4E538a6F9c997', + '0xeDa663610638E6557c27e2f4e973D3393e844E70', +] + +const vaultAccountant = [ + '0xbe16605B22a7faCEf247363312121670DFe5afBE', + '0x126af21dc55C300B7D0bBfC4F3898F558aE8156b', + '0x1b293DC39F94157fA0D1D36d7e0090C8B8B8c13F', + '0xBae19b38Bf727Be64AF0B578c34985c3D612e2Ba', + '0x1D4F0F05e50312d3E7B65659Ef7d06aa74651e0C', +] + +async function vaultsTvl(api) { + const supplies = await api.multiCall({ calls: vaults, abi: 'uint256:totalSupply' }) + const quotes = await api.multiCall({ calls: vaultAccountant, abi: 'uint256:getRate' }) + const bases = await api.multiCall({ calls: vaultAccountant, abi: 'address:base' }) + for (let i = 0; i < vaults.length; i++) { + const bvSupply = supplies[i] + let base = bases[i] + const quote = quotes[i] + if (base.toLowerCase() === ADDRESSES.ethereum.WETH.toLowerCase()) + base = ADDRESSES.ethereum.EETH + + const denominator = Math.pow(10, (String(quote).length - 1)) + api.add(base, bvSupply * quote / denominator) + } } module.exports = { doublecounted: true, + misrepresentedTokens: true, ethereum: { - tvl, + tvl: vaultsTvl, }, -}; +} \ No newline at end of file diff --git a/projects/ethervista/index.js b/projects/ethervista/index.js new file mode 100644 index 000000000000..8f340e3d67f1 --- /dev/null +++ b/projects/ethervista/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'ethereum': '0x9a27cb5ae0B2cEe0bb71f9A85C0D60f3920757B4' +}) \ No newline at end of file diff --git a/projects/ethfi-stake/index.js b/projects/ethfi-stake/index.js new file mode 100644 index 000000000000..5db91d79ad06 --- /dev/null +++ b/projects/ethfi-stake/index.js @@ -0,0 +1,18 @@ +const { staking } = require("../helper/staking"); + +module.exports = { + ethereum: { + tvl: () => 0, + staking: staking( + "0x86B5780b606940Eb59A062aA85a07959518c0161", + "0xFe0c30065B384F05761f15d0CC899D4F9F9Cc0eB" + ), + }, + arbitrum: { + tvl: () => 0, + staking: staking( + "0x86B5780b606940Eb59A062aA85a07959518c0161", + "0x7189fb5b6504bbff6a852b13b7b82a3c118fdc27" + ), + }, +}; diff --git a/projects/euler-v2/index.js b/projects/euler-v2/index.js new file mode 100644 index 000000000000..b68875c0ab81 --- /dev/null +++ b/projects/euler-v2/index.js @@ -0,0 +1,31 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +module.exports = { + methodology: `TVL is supply balance minus borrows the euler contract.`, +} + +const config = { + ethereum: { factory: '0x29a56a1b8214D9Cf7c5561811750D5cBDb45CC8e', } +} + +Object.keys(config).forEach(chain => { + const { factory, } = config[chain] + + async function getVaults(api) { + const vaults = await api.fetchList({ lengthAbi: 'getProxyListLength', itemAbi: 'proxyList', target: factory }) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + return { vaults, tokens } + } + + module.exports[chain] = { + tvl: async (api) => { + const { vaults, tokens } = await getVaults(api) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults], permitFailure: true }) + }, + borrowed: async (api) => { + const { vaults, tokens } = await getVaults(api) + const borrows = await api.multiCall({ abi: 'uint256:totalBorrows', calls: vaults }) + api.add(tokens, borrows) + }, + } +}) diff --git a/projects/euphoria/index.js b/projects/euphoria/index.js index 77a2cc135816..32bf250bf1b7 100644 --- a/projects/euphoria/index.js +++ b/projects/euphoria/index.js @@ -1,6 +1,5 @@ const { staking } = require('../helper/staking'); -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs'); -const { getChainTransform } = require('../helper/portedTokens'); +const { sumTokensExport } = require('../helper/unwrapLPs'); const wagmiAddresses = { staking: '0x95066025af40F7f7832f61422802cD1e13C23753', @@ -22,33 +21,17 @@ const wagmiReserves = { }, }; -async function tvl(time, ethBlock, {harmony: block}) { - const balances = {}; - const transform = await getChainTransform('harmony'); - - await sumTokensAndLPsSharedOwners( - balances, - [ - [wagmiReserves.single.dai, false], - [wagmiReserves.lp.wagmiDai, true], - [wagmiReserves.single.ust, false], - [wagmiReserves.lp.wagmiUst, true], - [wagmiReserves.single.usdc, false], - [wagmiReserves.single.busd, false], - [wagmiReserves.lp.wagmiOne, true], - ], - [wagmiAddresses.treasury], - block, - 'harmony', - transform - ); - - return balances; -} - module.exports = { harmony: { - tvl, + tvl: sumTokensExport({owners: [wagmiAddresses.treasury], tokens: [ + wagmiReserves.single.dai, + wagmiReserves.lp.wagmiDai, + wagmiReserves.single.ust, + wagmiReserves.lp.wagmiUst, + wagmiReserves.single.usdc, + wagmiReserves.single.busd, + wagmiReserves.lp.wagmiOne, + ], resolveLP: true,}), staking: staking(wagmiAddresses.staking, wagmiAddresses.wagmi), }, methodology: diff --git a/projects/evaa/index.js b/projects/evaa/index.js index 1913a9c2142f..2616a62cc1b0 100644 --- a/projects/evaa/index.js +++ b/projects/evaa/index.js @@ -1,11 +1,12 @@ const { sumTokensExport } = require("../helper/chain/ton"); const ADDRESSES = require("../helper/coreAssets.json"); -const evaaScAddr = "EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr" +const evaaMainPool = "EQC8rUZqR_pWV1BylWUlPNBzyiTYVoBEmQkMIQDZXICfnuRr" +const evaaLpPool = "EQBIlZX2URWkXCSg3QF2MJZU-wC5XkBoLww-hdWk2G37Jc6N" module.exports = { methodology: 'Counts EVAA smartcontract balance as TVL.', ton: { - tvl: sumTokensExport({ owner: evaaScAddr, tokens: [ADDRESSES.null]}), + tvl: sumTokensExport({ owners: [evaaMainPool, evaaLpPool], tokens: [ADDRESSES.null]}), } } diff --git a/projects/evmoswap/index.js b/projects/evmoswap/index.js index 9977c6b24115..6b6d3fb9d8fe 100644 --- a/projects/evmoswap/index.js +++ b/projects/evmoswap/index.js @@ -1,14 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const { getChainTransform} = require("../helper/portedTokens") const { getUniTVL } = require('../helper/unknownTokens') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const madDAI = ADDRESSES.evmos.DAI const madUSDC = ADDRESSES.evmos.USDC const madUSDT = ADDRESSES.evmos.USDT -const madWETH = ADDRESSES.evmos.WETH -const madWBTC = ADDRESSES.evmos.WBTC //////////////////////////// UNI AMM //////////////////////////////////// const evmoswapTvl = getUniTVL({ factory: '0xF24E36e53628C3086493B9EfA785ab9DD85232EB', useDefaultCoreAssets: true }) @@ -18,25 +14,10 @@ const poolAddressesEvmos = [ "0xf0a5b0fa1531C94754241911A2E6D94506336321", // 3pool ]; -async function stableAMMTvl(timestamp, chainBlocks) { - const balances = {}; - const transformAddress = await getChainTransform("evmos"); - await sumTokensAndLPsSharedOwners( - balances, - [ - [madDAI, false], - [madUSDC, false], - [madUSDT, false], - ], - poolAddressesEvmos, - chainBlocks["evmos"], - "evmos", - transformAddress - ); - return balances; +async function stableAMMTvl(api) { + return api.sumTokens({owners: poolAddressesEvmos, tokens: [madDAI, madUSDC, madUSDT]}) } - module.exports = { misrepresentedTokens: true, methodology: @@ -44,4 +25,4 @@ module.exports = { evmos: { tvl: sdk.util.sumChainTvls([evmoswapTvl, stableAMMTvl]), }, -}; // node test.js projects/evmoswap/index.js +} diff --git a/projects/evolve/index.js b/projects/evolve/index.js index e2e4dc67df4d..d1f936ffa908 100644 --- a/projects/evolve/index.js +++ b/projects/evolve/index.js @@ -6,6 +6,10 @@ const config = { }, }; -module.exports = {} +module.exports = { + deadFrom: '2023-02-27', +} tarotHelper(module.exports, config, { tarotSymbol: 'vEvolve'}) + +module.exports.cronos.borrowed = () => ({}) // bad debt diff --git a/projects/exmo/index.js b/projects/exmo/index.js new file mode 100644 index 000000000000..f830a3acedf5 --- /dev/null +++ b/projects/exmo/index.js @@ -0,0 +1,21 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + '0x7029B8aaE2399a9f4B82d4516D6D16A35A52ff2e', + ], + }, + doge: { + owners: [ + 'DC1GBAsLTJMvShigDk4UR3oVnkmiH4xaoE', + ] + }, + ripple: { + owners: [ + 'rDfvwaonnG198FJKiugQDn96kVW4Ej6bUX', + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/exsat-credit-staking/index.js b/projects/exsat-credit-staking/index.js new file mode 100644 index 000000000000..1c7cd332c757 --- /dev/null +++ b/projects/exsat-credit-staking/index.js @@ -0,0 +1,12 @@ +const { sumTokens } = require("../helper/chain/bitcoin"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.exsatCreditStaking() }) + } + +module.exports = { + methodology: 'TVL is based on Bitcoin addresses in the exSat credit staking contract, summing their associated Bitcoin balances.', + start: 1729684800, + bitcoin: { tvl }, +}; diff --git a/projects/exsat/index.js b/projects/exsat/index.js new file mode 100644 index 000000000000..0edca69310df --- /dev/null +++ b/projects/exsat/index.js @@ -0,0 +1,11 @@ +const { sumTokens } = require("../helper/chain/bitcoin"); +const bitcoinBook = require('../helper/bitcoin-book'); + +async function tvl(api) { + return sumTokens({ owners: await bitcoinBook.exsatBridge() }); +} + +module.exports = { + methodology: 'TVL for the exSat Bridge represents the total balance in custody BTC addresses, reflecting BTC assets bridged to the exSat network.', + bitcoin: { tvl }, +}; diff --git a/projects/ezkalibur/index.js b/projects/ezkalibur/index.js index 2b61648181f2..59d927171a99 100644 --- a/projects/ezkalibur/index.js +++ b/projects/ezkalibur/index.js @@ -9,7 +9,7 @@ module.exports = { misrepresentedTokens: true, start: 1686309181, era: { - tvl: getUniTVL({ factory: '0x15C664A62086c06D43E75BB3fddED93008B8cE63', useDefaultCoreAssets: true,fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x15C664A62086c06D43E75BB3fddED93008B8cE63', useDefaultCoreAssets: true, }), staking: stakingPricedLP(xSWORD,SWORD_TOKEN,'era',SWORD_WETH_LP,'weth') }, }; \ No newline at end of file diff --git a/projects/fantOHM/index.js b/projects/fantOHM/index.js index 4ef7e40e4037..390b2b42fdd0 100644 --- a/projects/fantOHM/index.js +++ b/projects/fantOHM/index.js @@ -1,8 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const {staking} = require("../helper/staking"); -const {sumTokensAndLPsSharedOwners} = require("../helper/unwrapLPs"); -const index = require('./index.json') +const { sumTokens2} = require("../helper/unwrapLPs"); const MasterChefBeets = require('./MasterChefBeets.json') const BalancerVaultBeets = require('./BalancerVaultBeets.json') const BalancerWeightedPoolBeets = require('./BalancerWeightedPoolBeets.json') @@ -14,70 +13,33 @@ const fantomTreasuryContract = "0xA3b52d5A6d2f8932a5cD921e09DA840092349D71"; const moonriverFhm = "0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286"; const moonriverStaking = "0xF5C7D63C5Fc0aD4b7Cef7d8904239860725Ebc87"; const moonriverTreasuryContract = "0x5E983ff70DE345de15DbDCf0529640F14446cDfa"; -const ethTreasuryContract = "0x9042E869BedCD2BB3EEa241aC0032cadAE8DF006"; // addreses of gnosis safe's according to: https://fantohm.com/#security const fantomGnosisContract = "0x34F93b12cA2e13C6E64f45cFA36EABADD0bA30fC"; -const moonriverGnosisContract = "0xE3CD5475f18a97D3563307B4e1A6467470237927"; const ethGnosisContract = "0x66a98CfCd5A0dCB4E578089E1D89134A3124F0b1"; const bscGnosisContract = "0x3538Acb37Cf5a92eBE7091714975b2f8dDd5c6C1"; const fantohmDaoDeployerWallet = "0x3381e86306145b062cEd14790b01AC5384D23D82"; -const ethTradfi3mContract = "0xCD8A46dC7EE4488b441Ae1CD3b5BCa48d5389C12"; -const ethTradfi6mContract = "0xD9fDd86ecc03e34DAf9c645C40DF670406836816"; -const ftmTradfi3mContract = "0xEFbe7fe9E8b407a3F0C0451E7669E70cDD0C4C77"; -const ftmTradfi6mContract = "0xB1c77436BC180009709Be00C9e852246476321A3"; const masterChefContract = "0x4897EB3257A5391d80B2f73FB0748CCd4150b586"; -// -// Moonriver TVL should consist of - treasury value and investments on gnosis safe -// -const movr_transforms = { - "0x748134b5f553f2bcbd78c6826de99a70274bdeb3": "ethereum:" + ADDRESSES.ethereum.USDC, // USDC - "0xe936caa7f6d9f5c9e907111fcaf7c351c184cda7": "ethereum:" + ADDRESSES.ethereum.USDT, // USDT - "0xfa1fbb8ef55a4855e5688c0ee13ac3f202486286": "fantom:0xfa1FBb8Ef55A4855E5688C0eE13aC3f202486286", // FHM -} - -async function moonriverTvl(timestamp, block, chainBlocks) { - let balances = {}; - block = chainBlocks.moonriver - // treasury value - await sumTokensAndLPsSharedOwners(balances, [ - ["0x748134b5f553f2bcbd78c6826de99a70274bdeb3", false], // USDC.m - ["0xE936CAA7f6d9F5C9e907111FCAf7c351c184CDA7", false], // USDT.m - ["0x0b6116bb2926d996cdeba9e1a79e44324b0401c9", true], // HB LP - ], [moonriverTreasuryContract], block, "moonriver", - addr => (movr_transforms[addr.toLowerCase()] ? movr_transforms[addr.toLowerCase()] : `moonriver:${addr}`)); - - // investments - await Promise.all([ - balanceOf(moonriverGnosisContract, "0x98878B06940aE243284CA214f92Bb71a2b032B8A", "moonriver:0x98878B06940aE243284CA214f92Bb71a2b032B8A", balances, chainBlocks.moonriver, "moonriver"), // wMOVR - ]); - - return balances; -} - -// -// Fantom TVL should consist of - treasury value and investments on gnosis safe -// -const fantom_transforms = { - [ADDRESSES.fantom.DAI]: ADDRESSES.ethereum.DAI, // DAI - [ADDRESSES.fantom.USDC]: ADDRESSES.ethereum.USDC, // USDC +async function moonriverTvl(api) { + return sumTokens2({api, owner: moonriverTreasuryContract, tokens: [ + "0x748134b5f553f2bcbd78c6826de99a70274bdeb3", + "0xE936CAA7f6d9F5C9e907111FCAf7c351c184CDA7", + "0x0b6116bb2926d996cdeba9e1a79e44324b0401c9", + ], resolveLP: true }) } -async function fantomTvl(timestamp, _, {fantom: block}) { - let balances = {}; - - // treasury value - await sumTokensAndLPsSharedOwners(balances, [ - [ADDRESSES.fantom.DAI, false], // DAI - [ADDRESSES.fantom.WFTM, false], // wFTM - // ["0x6fc9383486c163fa48becdec79d6058f984f62ca", false], // USDB - [ADDRESSES.fantom.USDC, false], // USDC - ["0xd77fc9c4074b56ecf80009744391942fbfddd88b", true], // DAI/FHM - ], [fantomTreasuryContract], block, "fantom", - addr => (fantom_transforms[addr.toLowerCase()] ? fantom_transforms[addr.toLowerCase()] : `fantom:${addr}`)) +async function fantomTvl(api) { + let balances = api.getBalances() + const block = api.block + await sumTokens2({ api, owner: fantomTreasuryContract, tokens: [ + ADDRESSES.fantom.DAI, + ADDRESSES.fantom.WFTM, + ADDRESSES.fantom.USDC, + "0xd77fc9c4074b56ecf80009744391942fbfddd88b", + ], resolveLP: true }) // treasury values await Promise.all([ diff --git a/projects/farmix/index.js b/projects/farmix/index.js new file mode 100644 index 000000000000..559b765ffe31 --- /dev/null +++ b/projects/farmix/index.js @@ -0,0 +1,54 @@ +const { sleep } = require('../helper/utils') +const { call } = require('../helper/chain/ton'); +const plimit = require("p-limit"); +const ADDRESSES = require('../helper/coreAssets.json'); + +const _rateLimited = plimit(1) +const rateLimited = fn => (...args) => _rateLimited(() => fn(...args)) +const getPoolJettonsRateLimited = rateLimited(getPoolCurrentJettons); + + +const POOLS = [ + 'EQC-jlX83DYZgSWRW5q_XuHLWWFQPp2xGmc8BCoeWckKpeHs', + 'EQD6gQSWCayHh0FvUnTXlpfizIWiq7UeE4gYvXGYtEhIYJ8q', + 'EQCE_6TevKEpj8OTz3rZt1D5bR6fENQbSN2bbW0jzxbWGGIo', +] + +const UNDERLYING_JETTONS = [ + ADDRESSES.ton.TON, + ADDRESSES.ton.USDT, + ADDRESSES.ton.NOT, +] + + +async function getPoolCurrentJettons(api, poolAddr, underlyingJettonAddr, isBorrowed) { + const result = await call({ + target: poolAddr, + abi: 'get_expected_state', + params: [['num', 0]] + }); + await sleep(1000 * (2 * Math.random() + 3)); + const jettonCurrentAmount = isBorrowed ? result[6] : result[5]; + api.add(underlyingJettonAddr, jettonCurrentAmount); +} + +async function tvl(api) { + await Promise.all(POOLS.map(async (poolAddr, i) => { + return getPoolJettonsRateLimited(api, poolAddr, UNDERLYING_JETTONS[i]); + })) +} + +async function borrowed(api) { + await Promise.all(POOLS.map(async (poolAddr, i) => { + return getPoolJettonsRateLimited(api, poolAddr, UNDERLYING_JETTONS[i], true); + })) +} + +module.exports = { + methodology: 'TVL is counted only as current available pool liquidity. Borrowed jettons not included in the tvl', + timetravel: false, + ton: { + tvl, + borrowed, + } +} \ No newline at end of file diff --git a/projects/fastex/index.js b/projects/fastex/index.js index f86b57f05276..34c9d1bfb257 100644 --- a/projects/fastex/index.js +++ b/projects/fastex/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -8,9 +9,7 @@ const config = { ], }, bitcoin: { - owners: [ - 'bc1qs7yen7ljpvyw7vn58ql6zfaddqf4rcjalsgmt5' - ] + owners: bitcoinAddressBook.fastex }, tron: { owners: [ diff --git a/projects/fbtc/index.js b/projects/fbtc/index.js new file mode 100644 index 000000000000..2a2bb3173ea0 --- /dev/null +++ b/projects/fbtc/index.js @@ -0,0 +1,11 @@ +const { sumTokens } = require('../helper/chain/bitcoin') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.fbtc() }) +} + +module.exports = { + timetravel: false, + bitcoin: { tvl } +} diff --git a/projects/fedex/index.js b/projects/fedex/index.js index b32d4f1ec2c5..f66baf6dcb71 100644 --- a/projects/fedex/index.js +++ b/projects/fedex/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xfb3AD00B272449AF3ea44e5C6ADbdfaB1655A046", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/fei/index.js b/projects/fei/index.js index 1c8b547d128d..7eb9e75f94f8 100644 --- a/projects/fei/index.js +++ b/projects/fei/index.js @@ -1,11 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { sumTokensAndLPsSharedOwners } = require('../helper/unwrapLPs') +const { nullAddress, sumTokens2 } = require('../helper/unwrapLPs'); -const weth = ADDRESSES.ethereum.WETH - -async function tvl(timestamp, block) { - const balances = {} +async function tvl(api) { const owners = [ '0xBFfB152b9392e38CdDc275D818a3Db7FE364596b', // GenesisGroup.sol [OLD] '0xa08A721dFB595753FFf335636674D76C455B275C', // EthReserveStabilizer.sol [OLD] @@ -46,30 +42,24 @@ async function tvl(timestamp, block) { // Holders of DPI in Fuse pool 19 '0x3dD3d945C4253bAc5B4Cc326a001B7d3f9C4DD66', // DpiFusePcvDeposit.sol ] - await sumTokensAndLPsSharedOwners(balances, [ - ['0x94b0a3d511b6ecdb17ebf877278ab030acb0a878', true], // FEI-ETH Uni V2 LP (NOTE: this counts both FEI and ETH, but only the FEI doesn't count as PCV) - [ADDRESSES.ethereum.STETH, false], // stETH - ['0x030ba81f1c18d280636f32af80b9aad02cf0854e', false], // aWETH - ['0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5', false], // cETH - ['0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', false], // cDAI - ['0x0954906da0Bf32d5479e25f46056d22f08464cab', false], // INDEX - ['0xc9BC48c72154ef3e5425641a3c747242112a46AF', false], // aRAI - ['0x752F119bD4Ee2342CE35E2351648d21962c7CAfE', false], // RAI in Fuse pool 9 - ['0x8775aE5e83BC5D926b6277579c2B0d40c7D9b528', true], // FEI-DPI Sushi LP (NOTE: this counts both the FEI and the DPI, but only the FEI doesn't count as PCV) - ['0xF06f65a6b7D2c401FcB8B3273d036D21Fe2a5963', false], // DPI in Fuse pool 19 - ], owners, block) - const directETH = await sdk.api.eth.getBalances({ - targets: owners, - block - }) - directETH.output.forEach(eth => { - sdk.util.sumSingleBalance(balances, weth, eth.balance) - }) - return balances + const tokens = [ + '0x94b0a3d511b6ecdb17ebf877278ab030acb0a878', // FEI-ETH Uni V2 LP (NOTE: this counts both FEI and ETH, but only the FEI doesn't count as PCV) + ADDRESSES.ethereum.STETH, // stETH + '0x030ba81f1c18d280636f32af80b9aad02cf0854e', // aWETH + '0x4ddc2d193948926d02f9b1fe9e1daa0718270ed5', // cETH + '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', // cDAI + '0x0954906da0Bf32d5479e25f46056d22f08464cab', // INDEX + '0xc9BC48c72154ef3e5425641a3c747242112a46AF', // aRAI + '0x752F119bD4Ee2342CE35E2351648d21962c7CAfE', // RAI in Fuse pool 9 + '0x8775aE5e83BC5D926b6277579c2B0d40c7D9b528', // FEI-DPI Sushi LP (NOTE: this counts both the FEI and the DPI, but only the FEI doesn't count as PCV) + '0xF06f65a6b7D2c401FcB8B3273d036D21Fe2a5963', // DPI in Fuse pool 19 + nullAddress + ] + return sumTokens2({ api, owners, tokens, }) } module.exports = { - ethereum: { tvl }, + ethereum: { tvl }, }; module.exports.hallmarks = [ [1651325520, "Exploit $80M FEI"], diff --git a/projects/fenrirfinance/index.js b/projects/fenrirfinance/index.js index c4b9cbd3180b..fe038d5f562b 100644 --- a/projects/fenrirfinance/index.js +++ b/projects/fenrirfinance/index.js @@ -1,11 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {fullCoumpoundExports} = require('../helper/compound'); +const { compoundExports2 } = require('../helper/compound'); -const replace = { - [ADDRESSES.bsc.BETH]: ADDRESSES.ethereum.WETH, // beth->weth - "0xfb6115445bff7b52feb98650c87f44907e58f802": ADDRESSES.ethereum.AAVE, // aave -} - -module.exports = fullCoumpoundExports("0x56b4B49f31517be8DacC2ED471BCc20508A0e29D", "bsc", "0x444ADC2D487090A660ebFdDd934d0E962410d8Cc", ADDRESSES.bsc.WBNB, addr=>{ - return replace[addr.toLowerCase()] || `bsc:${addr}` -}) +module.exports.bsc = compoundExports2({ comptroller: '0x56b4B49f31517be8DacC2ED471BCc20508A0e29D' }) diff --git a/projects/ferdyflip/index.js b/projects/ferdyflip/index.js index f20b732b2810..e6242ae51973 100644 --- a/projects/ferdyflip/index.js +++ b/projects/ferdyflip/index.js @@ -4,7 +4,7 @@ const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs"); // https://docs.ferdyflip.xyz/developers/contracts/platform const config = { avax: { - tokens: [ADDRESSES.avax.WAVAX, nullAddress], owners: ['0x20AfbaC35B333dA4fE7230CC60946F88ee87aAA3'], + tokens: [ADDRESSES.avax.WAVAX, nullAddress], owners: ['0x20AfbaC35B333dA4fE7230CC60946F88ee87aAA3', '0xe0a69f4d29c891b9c5c7368b591ed3109bcb80f7'], }, base: { tokens: [ADDRESSES.base.WETH, nullAddress], owners: ['0x3b6014e4b38791444a352D687022D6d6d79Eb99c'], diff --git a/projects/ferro/index.js b/projects/ferro/index.js index 007b21fc2587..311df16a530e 100644 --- a/projects/ferro/index.js +++ b/projects/ferro/index.js @@ -25,7 +25,7 @@ const tokens = { SWAP_LCRO_WCRO_ADDRESSES, ], // WCRO - "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23": [ + [ADDRESSES.cronos.WCRO_1]: [ SWAP_LCRO_WCRO_ADDRESSES, ], // LATOM-ATOM diff --git a/projects/fiatdao/index.js b/projects/fiatdao/index.js index 8c9c9e7e6fdf..d50accceba56 100644 --- a/projects/fiatdao/index.js +++ b/projects/fiatdao/index.js @@ -1,9 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk") -const { default: BigNumber } = require("bignumber.js") const abi = require('./abi.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs") +const { sumTokens2, } = require("../helper/unwrapLPs") const { getConfig } = require('../helper/cache') @@ -14,76 +12,42 @@ const YFI = ADDRESSES.ethereum.YFI const MKR = ADDRESSES.ethereum.MKR const BOND = "0x0391D2021f89DC339F60Fff84546EA23E337750f" const UMA = "0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828" -const GOHM = "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f" const WSOHM = "0xca76543cf381ebbb277be79574059e32108e3e65" const WSOHM_FDT_SLP = "0x2e30e758b3950dd9afed2e21f5ab82156fbdbbba" const FDT_GOHM = "0x75b02b9889536B617d57D08c1Ccb929c523945C1" -const LUSD = ADDRESSES.ethereum.LUSD -const LUSD3CRV = '0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA' - -function resolveUnderlier(underlier) { - if (underlier == LUSD3CRV) return LUSD - return underlier -} - -// Launch Ceremony -async function launchCeremonyTVL(timestamp, block) { - const balances = {} - - await sumTokensAndLPsSharedOwners( - balances, - [ - [WSOHM, false], - [RGT, false], - [YFI, false], - [MKR, false], - [BOND, false], - [UMA, false], - [WSOHM_FDT_SLP, true], - [FDT_GOHM, true], - ], - [STAKING_CONTRACT, STAKING_NFT], - block, - "ethereum", - (addr) => { - if (addr.toLowerCase() === WSOHM.toLowerCase()) return GOHM - return addr - } - ) - - return balances -} - // Protocol TVL -async function tvl(timestamp, block) { - if (block && block < 14928955 ) return {}; - const balances = {}; +async function tvl(api) { + + // Launch Ceremony + await sumTokens2({ api, owners: [STAKING_CONTRACT, STAKING_NFT], tokens: [RGT, YFI, MKR, BOND, UMA, WSOHM_FDT_SLP, FDT_GOHM,], resolveLP: true }) + const wsOHMBal = await api.call({ abi: 'erc20:balanceOf', target: WSOHM, params: STAKING_CONTRACT }) + api.add('0x0ab87046fbb341d058f17cbc4c1133f25a20a52f', wsOHMBal) const metadata = (await getConfig('fiatdao', 'https://raw.githubusercontent.com/fiatdao/changelog/main/metadata/metadata-mainnet.json')) const allVaults = Object.keys(metadata) - const { output: tokensAll } = await sdk.api.abi.multiCall({ abi: abi.token, calls: allVaults.map(i => ({ target: i })), block, }) + const tokensAll = await api.multiCall({ abi: abi.token, calls: allVaults, }) const tokens = [] const vaults = [] - tokensAll.forEach(({ output, input: { target } }) => { + tokensAll.forEach((output, i) => { if (output !== ADDRESSES.null) { - vaults.push(target) + vaults.push(allVaults[i]) tokens.push(output) } }) - const vaultCalls = vaults.map(i => ({ target: i })) - const { output: tokenScales } = await sdk.api.abi.multiCall({ abi: abi.tokenScale, calls: vaultCalls, block, }) - const { output: underliers } = await sdk.api.abi.multiCall({ abi: abi.underlierToken, calls: vaultCalls, block, }) - const { output: underlierScales } = await sdk.api.abi.multiCall({ abi: abi.underlierScale, calls: vaultCalls, block, }) + const tokenScales = await api.multiCall({ abi: abi.tokenScale, calls: vaults, }) + const underliers = await api.multiCall({ abi: abi.underlierToken, calls: vaults, }) + const underlierScales = await api.multiCall({ abi: abi.underlierScale, calls: vaults, }) const erc20Metadata = [] const erc1155Metadata = [] - underliers.forEach(({ output: token, input: { target: vault } }, i) => { - const underlier = resolveUnderlier(token) - const scale = BigNumber(underlierScales[i].output / (tokenScales[i].output * 1e18)) + underliers.forEach((token, i) => { + const underlier = token + const vault = vaults[i] + const scale = underlierScales[i] / (tokenScales[i] * 1e18) metadata[vault].tokenIds.forEach(id => { if (id === '0') { erc20Metadata.push({ vault, scale, underlier, tokenCall: { target: tokens[i], params: vault }, priceCall: { target: vault, params: [0, false, false] } }) @@ -93,27 +57,29 @@ async function tvl(timestamp, block) { }) }) - const { output: erc20Balances } = await sdk.api.abi.multiCall({ abi: 'erc20:balanceOf', calls: erc20Metadata.map(i => i.tokenCall), block, }) - const { output: erc20Prices } = await sdk.api.abi.multiCall({ abi: abi.fairPrice, calls: erc20Metadata.map(i => i.priceCall), block, }) - const { output: erc1155Balances } = await sdk.api.abi.multiCall({ abi: abi.balanceOf, calls: erc1155Metadata.map(i => i.tokenCall), block, }) - const { output: erc1155Prices } = await sdk.api.abi.multiCall({ abi: abi.fairPrice, calls: erc1155Metadata.map(i => i.priceCall), block, }) + const erc20Balances = await api.multiCall({ abi: 'erc20:balanceOf', calls: erc20Metadata.map(i => i.tokenCall), }) + const erc20Prices = await api.multiCall({ abi: abi.fairPrice, calls: erc20Metadata.map(i => i.priceCall), }) + const erc1155Balances = await api.multiCall({ abi: abi.balanceOf, calls: erc1155Metadata.map(i => i.tokenCall), permitFailure: true}) + const erc1155Prices = await api.multiCall({ abi: abi.fairPrice, calls: erc1155Metadata.map(i => i.priceCall), permitFailure: true }) - erc20Balances.forEach(({ output, }, i) => { - sdk.util.sumSingleBalance(balances, erc20Metadata[i].underlier, erc20Metadata[i].scale.times(output).times(erc20Prices[i].output).toFixed(0)) + erc20Balances.forEach((output, i) => { + api.add(erc20Metadata[i].underlier, erc20Metadata[i].scale * output * erc20Prices[i]) }) - erc1155Balances.forEach(({ output, }, i) => { - sdk.util.sumSingleBalance(balances, erc1155Metadata[i].underlier, erc1155Metadata[i].scale.times(output).times(erc1155Prices[i].output).toFixed(0)) + erc1155Balances.forEach((output, i) => { + if (!output || !erc1155Prices[i]) { + return; + } + api.add(erc1155Metadata[i].underlier, erc1155Metadata[i].scale * output * erc1155Prices[i]) }) - return balances } module.exports = { misrepresentedTokens: true, methodology: 'TVL includes fair value of collateral backing outstanding $FIAT and the initial FDT Jubilee event', - ethereum: { tvl: sdk.util.sumChainTvls([tvl, launchCeremonyTVL]) }, - hallmarks:[ + ethereum: { tvl }, + hallmarks: [ [1635959960, "FDT Jubilee starts"], [1639380013, "FDT Jubilee ends"], [1649604096, "Protocol Launch"] diff --git a/projects/filament/index.js b/projects/filament/index.js new file mode 100644 index 000000000000..d188e10297f5 --- /dev/null +++ b/projects/filament/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const USDC_CONTRACT = '0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1'; +const FILAMENT_VAULT_CONTRACT = '0xbeB6A6273c073815eBe288d2dF4e5E8bc027DA11'; +const FILAMENT_DEPOSIT_CONTRACT = '0x894DE0011C0d69BCa2e19c21CD246C17A8A4252e'; + +module.exports = { + sei: { + tvl: sumTokensExport({ owners: [FILAMENT_VAULT_CONTRACT, FILAMENT_DEPOSIT_CONTRACT], tokens: [USDC_CONTRACT] }), + }, +} diff --git a/projects/filda/abi.json b/projects/filda/abi.json deleted file mode 100644 index 5181f2371dce..000000000000 --- a/projects/filda/abi.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "markets": "function markets(address) view returns (bool isSupported, uint256 blockNumber, address interestRateModel, uint256 totalSupply, uint256 supplyRateMantissa, uint256 supplyIndex, uint256 totalBorrows, uint256 borrowRateMantissa, uint256 borrowIndex)", - "totalBorrows": "uint256:totalBorrows", - "borrowRatePerBlock": "uint256:borrowRatePerBlock", - "supplyRatePerBlock": "uint256:supplyRatePerBlock", - "underlying": "address:underlying", - "getCash": "uint256:getCash", - "getAllMarkets": "address[]:getAllMarkets" -} \ No newline at end of file diff --git a/projects/filda/index.js b/projects/filda/index.js index ce4e00009be9..d23a4c8960a6 100644 --- a/projects/filda/index.js +++ b/projects/filda/index.js @@ -1,145 +1,15 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const { compoundExports2 } = require('../helper/compound'); -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json'); -const { unwrapUniswapLPs } = require('../helper/unwrapLPs') -const { compoundExportsWithDifferentBase, compoundExports, usdCompoundExports } = require('../helper/compound'); - -const comptroller = "0xb74633f2022452f377403B638167b0A135DB096d" - -// ask comptroller for all markets array -async function getAllCTokens(block) { - return (await sdk.api.abi.call({ - block, - chain: 'heco', - target: comptroller, - params: [], - abi: abi['getAllMarkets'], - })).output; -} - -async function getUnderlying(block, cToken) { - if (cToken === '0x824151251B38056d54A15E56B73c54ba44811aF8') { - return '0x6f259637dcd74c767781e37bc6133cd6a68aa161';//cHT => HT - } else { - const token = (await sdk.api.abi.call({ - block, - chain: 'heco', - target: cToken, - abi: abi['underlying'], - })).output; - return token - } -} - -function transformAddress(token) { - if (token === '0x6f259637dcd74c767781e37bc6133cd6a68aa161') { - return token - } else if (token === ADDRESSES.heco.DAI_HECO) { - return ADDRESSES.ethereum.DAI;//DAI => DAI - } else if (token === ADDRESSES.heco.USDC_HECO) { - return ADDRESSES.ethereum.USDC;//USDC => USDC - } else if (token === ADDRESSES.heco.TUSD) { - return ADDRESSES.ethereum.TUSD //TUSD - } else { - return 'heco:' + token - } -} - -// returns {[underlying]: {cToken, decimals, symbol}} -async function getMarkets(block) { - let allCTokens = await getAllCTokens(block); - const markets = [] - await ( - Promise.all(allCTokens.map(async (cToken) => { - let underlying = await getUnderlying(block, cToken); - markets.push({ underlying, cToken }) - })) - ); - - return markets; -} - -const replacements = { - "0xc2CB6B5357CcCE1B99Cd22232942D9A225Ea4eb1": { - coingecko: "bitcoin-cash-sv", - decimals: 1e18 - }, - //"heco:0x581EdD7eAb23896513360D7EE8DfE07A5Cad2aBd": "tether", - "0x6514a5Ebff7944099591Ae3e8A5c0979C83B2571": { - coingecko: "neo", - decimals: 1e8 - }, - "0x45e97daD828AD735af1dF0473fc2735F0Fd5330c": { - coingecko: "tezos", - decimals: 1e18, - } -} -function lending(borrowed) { - return async (timestamp, ethBlock, {heco: block}) => { - let balances = {}; - let markets = await getMarkets(block); - - let v2Locked = await sdk.api.abi.multiCall({ - block, - calls: markets.map((market) => ({ - target: market.cToken, - })), - chain: 'heco', - abi: borrowed ? abi.totalBorrows : abi['getCash'], - }); - - const symbols = await sdk.api.abi.multiCall({ - block, - calls: markets.map((market) => ({ - target: market.cToken, - })), - chain: 'heco', - abi: "erc20:symbol", - }); - - const lps = [] - markets.forEach((market, idx) => { - let getCash = v2Locked.output.find((result) => result.input.target === market.cToken); - const symbol = symbols.output.find((result) => result.input.target === market.cToken); - if (getCash.output === null) { - throw new Error("getCash failed") - } - if (symbol.output.endsWith("LP")) { - lps.push({ - token: market.underlying, - balance: getCash.output - }) - } else { - const replacement = replacements[market.underlying] - if (replacement === undefined) { - sdk.util.sumSingleBalance(balances, transformAddress(market.underlying), getCash.output) - } else { - sdk.util.sumSingleBalance(balances, replacement.coingecko, Number(getCash.output) / replacement.decimals) - } - } - }); - - await unwrapUniswapLPs(balances, lps, block, "heco", transformAddress) - return balances; - } -} - -// DANGER!! Oracles are not priced against USD but against other base tokens, such as IOTX module.exports = { - timetravel: true, // Impossible because getBlock will rug tho - heco: { - tvl: lending(false), - borrowed: lending(true) - }, - iotex: compoundExportsWithDifferentBase("0x55E5F6E48FD4715e1c05b9dAfa5CfD0B387425Ee", "iotex", "iotex"), - bsc: compoundExports("0xF0700A310Cb14615a67EEc1A8dAd5791859f65f1", "bsc"), - rei: compoundExportsWithDifferentBase("0xEc1e6e331e990a0D8e40AC51f773e9c998ec7BC3", "rei", "rei-network"), - polygon: compoundExports("0xfBE0f3A3d1405257Bd69691406Eafa73f5095723", "polygon"), - arbitrum: compoundExports("0xF67EF5E77B350A81DcbA5430Bc8bE876eDa8D591", "arbitrum"), - elastos: compoundExportsWithDifferentBase("0xE52792E024697A6be770e5d6F1C455550265B2CD", "elastos", "elastos"), - kava: compoundExportsWithDifferentBase("0xD2CBE89a36df2546eebc71766264e0F306d38196", "kava", "kava"), - bittorrent: compoundExportsWithDifferentBase("0xE52792E024697A6be770e5d6F1C455550265B2CD", "bittorrent", "bittorrent"), + heco: compoundExports2({ comptroller: '0xb74633f2022452f377403B638167b0A135DB096d', cether: '0x824151251b38056d54a15e56b73c54ba44811af8'}), + iotex: compoundExports2({ comptroller: '0x55E5F6E48FD4715e1c05b9dAfa5CfD0B387425Ee',}), + bsc: compoundExports2({ comptroller: '0xF0700A310Cb14615a67EEc1A8dAd5791859f65f1',}), + rei: compoundExports2({ comptroller: '0xEc1e6e331e990a0D8e40AC51f773e9c998ec7BC3',}), + polygon: compoundExports2({ comptroller: '0xfBE0f3A3d1405257Bd69691406Eafa73f5095723',}), + arbitrum: compoundExports2({ comptroller: '0xF67EF5E77B350A81DcbA5430Bc8bE876eDa8D591',}), + elastos: compoundExports2({ comptroller: '0xE52792E024697A6be770e5d6F1C455550265B2CD',}), + kava: compoundExports2({ comptroller: '0xD2CBE89a36df2546eebc71766264e0F306d38196',}), + bittorrent: compoundExports2({ comptroller: '0xE52792E024697A6be770e5d6F1C455550265B2CD',}), hallmarks: [ [Math.floor(new Date('2023-04-24')/1e3), 'Protocol was hacked'], ], diff --git a/projects/filliquid/index.js b/projects/filliquid/index.js new file mode 100644 index 000000000000..0e9283eb60bc --- /dev/null +++ b/projects/filliquid/index.js @@ -0,0 +1,10 @@ +async function tvl(api) { + // https://github.com/FILL-Lab/FILLiquid/blob/main/contracts/FILLiquid.sol + const res = await api.call({ abi: 'uint256:getTVL', target: '0xA25F892cF2731ba89b88750423Fc618De0959C43'}) + api.addGasToken(res) +} + +module.exports = { + methodology: 'Get the total amount of pledge and account balance of fil in the statistical contract', + filecoin: { tvl } +} diff --git a/projects/finceptor/index.js b/projects/finceptor/index.js new file mode 100644 index 000000000000..856cb3bf5a4e --- /dev/null +++ b/projects/finceptor/index.js @@ -0,0 +1,15 @@ +const FINC_TOKEN_CONTRACT = '0xA856098dCBc1b2B3a9C96C35c32bC4f71E49AEd2'; +const FINCEPTOR_STAKING_AMOUNTS_CONTRACT = '0xA8a15EC4D496521D3a4B70e3cC2c15fF1701E3BE'; + +async function staking(api) { + const stakedBalance = await api.call({ abi: 'uint256:totalStaked', target: FINCEPTOR_STAKING_AMOUNTS_CONTRACT, }) + api.add(FINC_TOKEN_CONTRACT, stakedBalance) +} + +module.exports = { + methodology: 'gets the total number of FINC tokens locked in all active staking contracts of Finceptor.', + bsc: { + tvl: () => ({}), + staking, + } +} \ No newline at end of file diff --git a/projects/fire/index.js b/projects/fire/index.js index 9c32a5a1f6ce..9021e42e275f 100644 --- a/projects/fire/index.js +++ b/projects/fire/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -8,12 +9,7 @@ const config = { ], }, bitcoin: { - owners: [ - 'bc1q36c0rp4ydl6uvvguhw9nr7njm49addzkgftqev', - 'bc1q3z0khuld6nd7esv46nxj9ketteqw9qz86peyeh', - 'bc1q4hz59t7v0uxujuyrhp9679uppur7ke9u3vshvd', - 'bc1qdlrh7ycyqxe62vk5m70y353vmep9ullxx5j9ar', - ] + owners: bitcoinAddressBook.fire }, ripple: { owners: [ diff --git a/projects/firefly/index.js b/projects/firefly/index.js index 144e22c91ffe..5e6b5086ccb4 100644 --- a/projects/firefly/index.js +++ b/projects/firefly/index.js @@ -1,5 +1,6 @@ const { uniV3Export } = require("../helper/uniswapV3") + module.exports = uniV3Export({ manta: { factory: "0x8666EF9DC0cA5336147f1B11f2C4fC2ecA809B95", fromBlock: 1776716, }, -}) +}) \ No newline at end of file diff --git a/projects/firoza-finance/index.js b/projects/firoza-finance/index.js new file mode 100644 index 000000000000..d7af333b1a6c --- /dev/null +++ b/projects/firoza-finance/index.js @@ -0,0 +1,30 @@ +const { getConfig } = require('../helper/cache') +const { sumERC4626Vaults } = require('../helper/erc4626'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const POOL_API_URL = "https://firoza.finance/api/pools"; + +async function tvl(api) { + const poolAddresses = await getConfig('firoza', POOL_API_URL); + const assets = await api.multiCall({ abi: 'address:asset', calls: poolAddresses}) + return sumTokens2({ api, tokensAndOwners2: [assets, poolAddresses] }) +} + +async function borrowed(api) { + const poolAddresses = await getConfig('firoza', POOL_API_URL); + const assets = await api.multiCall({ abi: 'address:asset', calls: poolAddresses}) + await sumERC4626Vaults({ api, calls: poolAddresses, isOG4626: true, }); + const calls = assets.map((target, i) => ({ target, params: poolAddresses[i] })); + const tokenBals = await api.multiCall({ abi: 'erc20:balanceOf', calls }) + tokenBals.forEach((bal, i) => api.add(assets[i], bal * -1)) + return sumTokens2({ api }) +} + + +module.exports = { + methodology: "TVL counts the tokens deposited in the Firoza Finance pools.", + islm: { tvl, borrowed, }, + hallmarks: [ + [1688169600, "Launch on ISLM"] + ], +}; \ No newline at end of file diff --git a/projects/fisclend/index.js b/projects/fisclend/index.js new file mode 100644 index 000000000000..4730fc90a45f --- /dev/null +++ b/projects/fisclend/index.js @@ -0,0 +1,6 @@ +const { compoundExports2 } = require('../helper/compound') + +module.exports = { + apechain: compoundExports2({comptroller: '0xd11443B079D62700061F7311fC48C40B30BCEA91', cether: '0xB1974B31b60C7134978e5574F5f1fC8A16535b5D'}), + wc: compoundExports2({comptroller: '0xE3de48DCF4968B419BB55421D6B5bF2c049DaFB2', cether: '0xCD04992D1D8d42BB432AD794103c3B498016Da88'}), +} diff --git a/projects/fixes-coins/index.js b/projects/fixes-coins/index.js index 4cf80a4fc277..924a420ba0b3 100644 --- a/projects/fixes-coins/index.js +++ b/projects/fixes-coins/index.js @@ -1,5 +1,5 @@ // Fixes Inscription Protocol - 𝔉rc20 Treasury Pool: https://fixes.world/ -const { post } = require("../helper/http"); +const { callCadence } = require("../helper/chain/flow"); let queryTVLCode = ` import LiquidStaking from 0xd6f80565193ad727 @@ -59,22 +59,9 @@ fun main(): UFix64 { } `; -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); - + const flowTokenTVL = await callCadence(queryTVLCode, true); return { flow: flowTokenTVL }; } catch (error) { throw new Error("Couln't query scripts of Fixes coins", error); diff --git a/projects/fixes-frc20-staking/index.js b/projects/fixes-frc20-staking/index.js index da5d742b8105..119d797cb1de 100644 --- a/projects/fixes-frc20-staking/index.js +++ b/projects/fixes-frc20-staking/index.js @@ -1,5 +1,5 @@ // Fixes Inscription Protocol - Staking Pool: https://fixes.world/ -const { post } = require("../helper/http"); +const { callCadence } = require("../helper/chain/flow"); let queryTVLCode = ` import FRC20Staking from 0xd2abb5dbf5e08666 @@ -11,7 +11,7 @@ import FRC20Indexer from 0xd2abb5dbf5e08666 access(all) fun main(): UFix64 { let acctsPool = FRC20AccountsPool.borrowAccountsPool() - let stakingTokens = acctsPool.getFRC20Addresses(type: FRC20AccountsPool.ChildAccountType.Staking) + let stakingTokens = acctsPool.getAddresses(type: FRC20AccountsPool.ChildAccountType.Staking) var totalTVL = 0.0 let ticks = stakingTokens.keys @@ -59,22 +59,9 @@ fun main(): UFix64 { } `; -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); - + const flowTokenTVL = await callCadence(queryTVLCode, true); return { flow: flowTokenTVL }; } catch (error) { throw new Error( diff --git a/projects/fixes-frc20/index.js b/projects/fixes-frc20/index.js index 588f1d23d86d..332ac4ca58a5 100644 --- a/projects/fixes-frc20/index.js +++ b/projects/fixes-frc20/index.js @@ -1,11 +1,14 @@ // Fixes Inscription Protocol - 𝔉rc20 Treasury Pool: https://fixes.world/ -const { post } = require("../helper/http"); +const { callCadence } = require("../helper/chain/flow"); let queryTVLCode = ` import FRC20Indexer from 0xd2abb5dbf5e08666 import FGameLottery from 0xd2abb5dbf5e08666 import FGameLotteryRegistry from 0xd2abb5dbf5e08666 import FGameLotteryFactory from 0xd2abb5dbf5e08666 +import FRC20FTShared from 0xd2abb5dbf5e08666 +import FRC20Staking from 0xd2abb5dbf5e08666 +import FRC20AccountsPool from 0xd2abb5dbf5e08666 access(all) fun main(): UFix64 { @@ -17,6 +20,7 @@ fun main(): UFix64 { let balance = indexer.getPoolBalance(tick: tick) totalBalance = totalBalance + balance } + // FLOW lottery jackpot balance let registry = FGameLotteryRegistry.borrowRegistry() let flowLotteryPoolName = FGameLotteryFactory.getFIXESMintingLotteryPoolName() @@ -26,26 +30,25 @@ fun main(): UFix64 { totalBalance = totalBalance + jackpotBalance } } + + // Unclaimed FLOW Reward in the staking reward pool + let acctsPool = FRC20AccountsPool.borrowAccountsPool() + let platformStakingTick = FRC20FTShared.getPlatformStakingTickerName() + if let stakingPoolAddr = acctsPool.getFRC20StakingAddress(tick: platformStakingTick) { + if let stakingPool = FRC20Staking.borrowPool(stakingPoolAddr) { + if let detail = stakingPool.getRewardDetails("") { + totalBalance = totalBalance + detail.totalReward + } + } + } + return totalBalance } `; -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); - + const flowTokenTVL = await callCadence(queryTVLCode, true); return { flow: flowTokenTVL }; } catch (error) { throw new Error( diff --git a/projects/flapdotsh/index.js b/projects/flapdotsh/index.js new file mode 100644 index 000000000000..289eb41a3c42 --- /dev/null +++ b/projects/flapdotsh/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/unwrapLPs"); +const coreAssets = require("../helper/coreAssets.json"); + +const portal = [ + "0xe2ce6ab80874fa9fa2aae65d277dd6b8e65c9de0", +]; + +const tokens = [coreAssets.null]; + +module.exports = { + bsc: { + tvl: sumTokensExport({ owners: portal, tokens }) + }, +}; \ No newline at end of file diff --git a/projects/flashpulse/index.js b/projects/flashpulse/index.js index 3b4834e09e45..46da0dcaecde 100644 --- a/projects/flashpulse/index.js +++ b/projects/flashpulse/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - pulse: { tvl: getUniTVL({ factory: '0xD2871d0d39A9cb0cB0505309A5C1F521df25a987', useDefaultCoreAssets: true, fetchBalances: true, }), }, + pulse: { tvl: getUniTVL({ factory: '0xD2871d0d39A9cb0cB0505309A5C1F521df25a987', useDefaultCoreAssets: true, }), }, } \ No newline at end of file diff --git a/projects/flast-protocol/index.js b/projects/flast-protocol/index.js index 8ae381c12300..9f22dd9dff25 100644 --- a/projects/flast-protocol/index.js +++ b/projects/flast-protocol/index.js @@ -2,6 +2,9 @@ const { sumTokensExport, nullAddress } = require("../helper/unwrapLPs") module.exports = { methodology: "Value of user deposited ETH on Flast Protocol is considered as TVL", + hallmarks: [ + [1712880000, "Rug Pull"] + ], blast: { tvl: sumTokensExport({ owner: '0x7474796140775d8719584AA9923102ad7bf56490', tokens: [nullAddress] }), }, diff --git a/projects/flipster/index.js b/projects/flipster/index.js index e980af38f1d5..3c9e1e14cb8a 100644 --- a/projects/flipster/index.js +++ b/projects/flipster/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -12,9 +13,7 @@ const config = { ] }, bitcoin: { - owners: [ - '31iAUikiV7yKEYBzbA1iHPcanHNsLBFe8C' - ] + owners: bitcoinAddressBook.flipster }, arbitrum: { owners: [ diff --git a/projects/float-capital/index.js b/projects/float-capital/index.js index 35632c7c60a1..18520aec8b50 100644 --- a/projects/float-capital/index.js +++ b/projects/float-capital/index.js @@ -1,7 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens, unwrapCreamTokens } = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const vaults = [ "0xce5da4bebBA980BeC39da5b118750A47a23D4B85", @@ -19,68 +16,16 @@ const avaults = [ "0x47a21F14794b6229cc2a1ddfe4498C9e48f1C16c", ]; const avDAI = "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a"; -const DAI = ADDRESSES.avax.DAI; -const transforms = { - "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a": - ADDRESSES.ethereum.DAI, // avDAI - [ADDRESSES.avax.DAI]: - ADDRESSES.ethereum.DAI, // DAI -}; -async function polyTvl(time, ethBlock, chainBlocks) { - const balances = {}; - await sumTokens( - balances, - vaults.map((v) => [amDAI, v]), - chainBlocks.polygon, - "polygon", - (addr) => `polygon:${addr}` - ); - return balances; +async function polyTvl(api) { + return sumTokens2({ api, owners: vaults, token: amDAI}) } -const qiDAI = "avax:0x835866d37afb8cb8f8334dccdaf66cf01832ff5d" - -async function avaxTvl(time, ethBlock, chainBlocks) { - const balances = {}; - await sumTokens( - balances, - avaults.map((v) => [avDAI, v]), - chainBlocks.avax, - "avax", - (addr) => { - return transforms[addr.toLowerCase()] ?? `avax:${addr}`; - } - ); - const [{ output: jDAIRate }, { output: jDAIBalance }] = await Promise.all([ - sdk.api.abi.call({ - chain: 'avax', - target: '0xc988c170d0E38197DC634A45bF00169C7Aa7CA19', - block: chainBlocks.avax, - abi: abi.exchangeRateStored - }), - sdk.api.erc20.balanceOf({ - target: "0xc988c170d0E38197DC634A45bF00169C7Aa7CA19", - owner: "0xcD62196CC117EA7fd9525ADe37e44d01209e8EBB", - block: chainBlocks.avax, - chain: 'avax' - }) - ]) - sdk.util.sumSingleBalance(balances, `avax:${DAI}`, jDAIRate * jDAIBalance / 10 ** 18) - await unwrapCreamTokens( - balances, - [[ - "0x835866d37afb8cb8f8334dccdaf66cf01832ff5d", - "0xEb2A90ED68017Ac1B068077C5D1537f4C544036C" - ]], - chainBlocks.avax, - "avax", - (addr) => { - return transforms[addr.toLowerCase()] ?? `avax:${addr}`; - } - ); - return balances; +async function avaxTvl(api) { + await sumTokens2({ api, owners: avaults, token: avDAI}) + await sumTokens2({ api, owner: '0xcD62196CC117EA7fd9525ADe37e44d01209e8EBB', token: '0xc988c170d0E38197DC634A45bF00169C7Aa7CA19'}) + return sumTokens2({ api, owner: '0xEb2A90ED68017Ac1B068077C5D1537f4C544036C', token: '0x835866d37afb8cb8f8334dccdaf66cf01832ff5d'}) } module.exports = { diff --git a/projects/florence-finance/index.js b/projects/florence-finance/index.js index 5858527103e9..59432e80bfb1 100644 --- a/projects/florence-finance/index.js +++ b/projects/florence-finance/index.js @@ -5,6 +5,9 @@ const ETH_EURS = "0xdb25f211ab05b1c97d595516f45794528a807ad8"; const ARB_FLR = "0x9b6226dd0191a77d032f56a6d383044ee99944c3"; const ARB_AGEUR = "0xfa5ed56a203466cbbc2430a43c66b9d8723528e7"; +const BASE_FLR = "0x4ee4bea687D5cE6245198db136D32aeC02806A83"; +const BASE_EURC = "0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42"; + async function getTotalSupply(token, { api }) { const totalSupply = await api.call({ abi: "function totalSupply() external view returns (uint256)", @@ -30,9 +33,15 @@ async function getBorrowedOnArbitrum(api) { api.add(ARB_AGEUR, borrowed); //Decimals of FLR and agEUR are both 18. No conversion needed. } +async function getBorrowedOnBase(api) { + const borrowed = await getTotalSupply(BASE_FLR, { api }); //FLR on Base are not multi-chain so there is no need to subtract anything yet. + api.add(BASE_EURC, borrowed / 1e12); //12 decimals (FLR) -> 2 decimals (EURC) +} + module.exports = { methodology: "The Florin token (FLR) is minted whenever a new loan is funded and burned when a loan matures and is repaid. Since the Florin token is 1:1 redeemable for EUR the borrowed amount is denominated in the protocols treasuries EUR stablecoin of the respective chain. Consequently the total supply of Florin equals the amount borrowed through the protocol. To avoid double counting, the amount of FLR held in the bridge contract is subtracted from the total supply. ", ethereum: { start: 16077400, borrowed: getBorrowedOnEthereum, tvl: () => ({}) }, arbitrum: { start: 126183369, borrowed: getBorrowedOnArbitrum, tvl: () => ({}) }, + base: { start: 18941407, borrowed: getBorrowedOnBase, tvl: () => ({}) }, }; \ No newline at end of file diff --git a/projects/fluid-protocol/index.js b/projects/fluid-protocol/index.js new file mode 100644 index 000000000000..d9537addb7e7 --- /dev/null +++ b/projects/fluid-protocol/index.js @@ -0,0 +1,12 @@ +const { sumTokens } = require("../helper/chain/fuel") + +async function tvl(api) { + const contractId = '0xb18340bfe68c0b3a4fbd3a3ae2c014be94c16569b7f360cf53efe1b7023e545e' + + return sumTokens({ api, owner: contractId }) +} + +module.exports = { + fuel: { tvl }, + timetravel: false, +} diff --git a/projects/fluid/index.js b/projects/fluid/index.js index 1f4e067c8cc9..6bbdee01b38f 100644 --- a/projects/fluid/index.js +++ b/projects/fluid/index.js @@ -18,10 +18,14 @@ const config = { }, weETH: "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", zircuit: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", + weETHs: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", }, arbitrum: { liquidityResolver: (block) => "0x46859d33E662d4bF18eEED88f74C36256E606e44", }, + base: { + liquidityResolver: (block) => "0x35A915336e2b3349FA94c133491b915eD3D3b0cd", + }, }; async function getListedTokens(api) { @@ -45,6 +49,15 @@ async function tvl(api) { params: [config.ethereum.weETH, config.liquidity], }) ); + // add WeETHs deployed to Zircuit + api.add( + config.ethereum.weETHs, + await api.call({ + target: config.ethereum.zircuit, + abi: "function balance(address, address) public view returns (uint256 balance)", + params: [config.ethereum.weETHs, config.liquidity], + }) + ); } return api.sumTokens({ @@ -62,7 +75,7 @@ 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, + abi: api.chain == "ethereum" && api.block < 19992056 ? abi.getOverallTokensDataLegacy : abi.getOverallTokensData, params: [tokens], }); api.add( @@ -75,5 +88,6 @@ module.exports = { methodology: methodologies.lendingMarket, ethereum: { tvl, borrowed }, arbitrum: { tvl, borrowed }, + base: { tvl, borrowed }, }; // node test.js projects/fluid/index.js diff --git a/projects/fluidity-money/index.js b/projects/fluidity-money/index.js index 530a1a9920a2..8acb56eb3c4a 100644 --- a/projects/fluidity-money/index.js +++ b/projects/fluidity-money/index.js @@ -1,5 +1,5 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); -const { getTokenSupply } = require("../helper/solana") +const { getTokenSupplies } = require("../helper/solana") const ATOKENS_ETHEREUM = ['0x028171bCA77440897B824Ca71D1c56caC55b68A3', '0x101cc05f4A51C0319f570d5E146a8C625198e636', '0xd4937682df3C8aEF4FE912A96A74121C0829E664']; const APOOL_ETHEREUM = ['0xFC66c25dbDb0606e7F9cA1d2754Eb0A0f8306dA9', '0x5E88f6dc0aa126FA28A137B24d0B4d7231352a0B', '0xB7a2930e66D84Da74CdcFE4f97FaE9fC8f1114e8']; const ATOKENS_ARBITRUM = ['0x6ab707Aca953eDAeFBc4fD23bA73294241490620', '0x625E7708f30cA75bfd92586e17077590C60eb4cD', '0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE', '0x724dc807b04555b71ed48a6896b6f41593b8c637']; @@ -19,8 +19,8 @@ async function tvl_arb(api) { async function tvl_sol(api) { const fUSDC = 'Ez2zVjw85tZan1ycnJ5PywNNxR6Gm4jbXQtZKyQNu3Lv' - const supply = await getTokenSupply(fUSDC) - api.add(fUSDC, supply * 1e6) + const res = await getTokenSupplies([fUSDC]) + api.add(fUSDC, res[fUSDC]) } module.exports = { diff --git a/projects/flux/index.js b/projects/flux/index.js index 742dba09dc0a..c6662fd03ac5 100644 --- a/projects/flux/index.js +++ b/projects/flux/index.js @@ -15,6 +15,7 @@ const getFluxTVLDetail = 'function getFluxTVLDetail() view returns (uint256 tota module.exports = { misrepresentedTokens: true, + deadFrom: '2022-12-07', }; Object.keys(config).forEach(chain => { @@ -31,7 +32,9 @@ Object.keys(config).forEach(chain => { tether: (totalSupply - totalBorrow) / 1e18 } }, - borrowed: async (_, _b, {[chain]: block}) => { + borrowed: () => ({}), // bad debt + + /*async (_, _b, {[chain]: block}) => { const { reportContract } = config[chain] const { output: { totalBorrow, } } = await sdk.api.abi.call({ target: reportContract, @@ -42,7 +45,7 @@ Object.keys(config).forEach(chain => { return { tether: totalBorrow / 1e18 } - }, + },*/ staking: async (_, _b, {[chain]: block}) => { const { reportContract } = config[chain] const { output: { totalStaked, } } = await sdk.api.abi.call({ @@ -56,4 +59,5 @@ Object.keys(config).forEach(chain => { } }, } -}) \ No newline at end of file +}) + diff --git a/projects/fluxbeam-xyz/index.js b/projects/fluxbeam-xyz/index.js index 85f3641269f6..9b6a164e6d17 100644 --- a/projects/fluxbeam-xyz/index.js +++ b/projects/fluxbeam-xyz/index.js @@ -21,4 +21,5 @@ async function tvl(api) { module.exports = { timetravel: false, solana: { tvl, }, + isHeavyProtocol: true, } diff --git a/projects/fluxfinance/index.js b/projects/fluxfinance/index.js index d8c8cfbc06b4..e63ad31fea97 100644 --- a/projects/fluxfinance/index.js +++ b/projects/fluxfinance/index.js @@ -5,5 +5,5 @@ const comptroller = "0x95Af143a021DF745bc78e845b54591C53a8B3A51"; module.exports = { 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, then we get the price of each token from coingecko.`, - ethereum: compoundExports(comptroller, "ethereum"), + ethereum: compoundExports(comptroller), }; diff --git a/projects/fluxusbase/index.js b/projects/fluxusbase/index.js new file mode 100644 index 000000000000..510b0046d5f7 --- /dev/null +++ b/projects/fluxusbase/index.js @@ -0,0 +1,11 @@ +const { uniTvlExport } = require('../helper/calculateUniTvl.js') + +module.exports = { + misrepresentedTokens: true, + base: { + tvl: uniTvlExport("0x27c2d144b106B26Be3d0dEB6c14c5CFA2e9a507C", undefined, undefined, { + allPairsLength: 'uint256:allPairsLength', + allPairs: 'function allPairs(uint256) view returns (address)', + }, { useDefaultCoreAssets: true, hasStablePairs: true, }), + }, +} \ No newline at end of file diff --git a/projects/fodl/index.js b/projects/fodl/index.js index 7065b1bf1153..49b7a76d45b2 100644 --- a/projects/fodl/index.js +++ b/projects/fodl/index.js @@ -2,53 +2,68 @@ const abi = require('./abi.json') const { sumTokensExport } = require('../helper/unwrapLPs'); const { sliceIntoChunks } = require('../helper/utils'); -// taken from https://app.fodl.finance/config.json -const config = { +module.exports = { ethereum: { - position_nft: '0x70febba7d45cfe6d99847ba4ccc393373b1ea8aa', - lens_contract: '0x080155C42b0854C3A718B610cC5183e963851Afb', - pool2: [ - ['0xa5c475167f03b1556c054e0da78192cd2779087f', '0xf958a023d5b1e28c32373547bdde001cad17e9b4'], - ['0xce7e98d4da6ebda6af474ea618c6b175729cd366', '0xa7453338ccc29e4541e6c6b0546a99cc6b9eb09a'], - ], - staking: [ - ['0x4c2e59d098df7b6cbae0848d66de2f8a4889b9c3', '0x7e05540A61b531793742fde0514e6c136b5fbAfE'], - ], + tvl: () => ({}), }, polygon: { - position_nft: '0x7243c51c24b302b01094785f3c826f9311525613', - lens_contract: '0xbfE6971Fc6F195bcacB72beE3427f5b4d8C3dc07', - pool2: [ - ['0x2fc4dfcee8c331d54341f5668a6d9bcdd86f8e2f', '0xea7336c408ec8012e6b97368198512597e49c88a'], - ], + tvl: () => ({}), }, bsc: { - position_nft: '0x4c2e59d098df7b6cbae0848d66de2f8a4889b9c3', - lens_contract: '0x6032035731c9F0b2E53Da63ca15444375E946559', - }, + tvl: () => ({}), + } } -module.exports = { - methodology: "FODL leverages users positions on Aave and Compound. The fodl lens contract is used to get the positions metadata, especially supplyAmount and supplyTokenAddress, which counts as the TVL of the position of the user. Pool2 TVL are the tokens locked in the SUSHI pools", -}; - -Object.keys(config).forEach(chain => { - const { position_nft, lens_contract, pool2, staking, } = config[chain] - module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }, { api }) => { - const allPositions = await api.fetchList({ lengthAbi: 'erc20:totalSupply', itemAbi: abi.tokenByIndex, target: position_nft, }) - for (const positions of sliceIntoChunks(allPositions, 50)) { - const data = await api.multiCall({ abi: abi.getPositionsMetadata, calls: sliceIntoChunks(positions, 10).map(i => ({ params: [i] })), target: lens_contract, }) - data.forEach(j => { - j.forEach(i => api.add(i.supplyTokenAddress, i.supplyAmount)) - }) - } - } - } +module.exports.deadFrom = '2023-01-01' + +// taken from https://app.fodl.finance/config.json +// const config = { +// ethereum: { +// position_nft: '0x70febba7d45cfe6d99847ba4ccc393373b1ea8aa', +// lens_contract: '0x080155C42b0854C3A718B610cC5183e963851Afb', +// pool2: [ +// ['0xa5c475167f03b1556c054e0da78192cd2779087f', '0xf958a023d5b1e28c32373547bdde001cad17e9b4'], +// ['0xce7e98d4da6ebda6af474ea618c6b175729cd366', '0xa7453338ccc29e4541e6c6b0546a99cc6b9eb09a'], +// ], +// staking: [ +// ['0x4c2e59d098df7b6cbae0848d66de2f8a4889b9c3', '0x7e05540A61b531793742fde0514e6c136b5fbAfE'], +// ], +// }, +// polygon: { +// position_nft: '0x7243c51c24b302b01094785f3c826f9311525613', +// lens_contract: '0xbfE6971Fc6F195bcacB72beE3427f5b4d8C3dc07', +// pool2: [ +// ['0x2fc4dfcee8c331d54341f5668a6d9bcdd86f8e2f', '0xea7336c408ec8012e6b97368198512597e49c88a'], +// ], +// }, +// bsc: { +// position_nft: '0x4c2e59d098df7b6cbae0848d66de2f8a4889b9c3', +// lens_contract: '0x6032035731c9F0b2E53Da63ca15444375E946559', +// }, +// } + +// module.exports = { +// methodology: "FODL leverages users positions on Aave and Compound. The fodl lens contract is used to get the positions metadata, especially supplyAmount and supplyTokenAddress, which counts as the TVL of the position of the user. Pool2 TVL are the tokens locked in the SUSHI pools", +// }; + +// Object.keys(config).forEach(chain => { +// const { position_nft, lens_contract, pool2, staking, } = config[chain] +// module.exports[chain] = { +// tvl: async (_, _b, { [chain]: block }, { api }) => { +// const allPositions = await api.fetchList({ lengthAbi: 'erc20:totalSupply', itemAbi: abi.tokenByIndex, target: position_nft, }) +// for (const positions of sliceIntoChunks(allPositions, 50)) { +// const data = await api.multiCall({ abi: abi.getPositionsMetadata, calls: sliceIntoChunks(positions, 10).map(i => ({ params: [i] })), target: lens_contract, }) +// data.forEach(j => { +// j.forEach(i => api.add(i.supplyTokenAddress, i.supplyAmount)) +// }) +// } +// } +// } + +// if (pool2) +// module.exports[chain].pool2 = sumTokensExport({ tokensAndOwners: pool2, chain, }) - if (pool2) - module.exports[chain].pool2 = sumTokensExport({ tokensAndOwners: pool2, chain, }) +// if (staking) +// module.exports[chain].staking = sumTokensExport({ tokensAndOwners: staking, chain, }) +// }) - if (staking) - module.exports[chain].staking = sumTokensExport({ tokensAndOwners: staking, chain, }) -}) diff --git a/projects/folks-xchain/constants.js b/projects/folks-xchain/constants.js new file mode 100644 index 000000000000..efaf73e65d5e --- /dev/null +++ b/projects/folks-xchain/constants.js @@ -0,0 +1,103 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const HubPoolAbi = { + getDepositData: "function getDepositData() view returns (uint16 optimalUtilisationRatio, uint256 totalAmount, uint256 interestRate, uint256 interestIndex)", + getVariableBorrowData: "function getVariableBorrowData() view returns (uint32 vr0, uint32 vr1, uint32 vr2, uint256 totalAmount, uint256 interestRate, uint256 interestIndex)", + getStableBorrowData: "function getStableBorrowData() view returns (uint32 sr0, uint32 sr1, uint32 sr2, uint32 sr3, uint16 optimalStableToTotalDebtRatio, uint16 rebalanceUpUtilisationRatio, uint16 rebalanceUpDepositInterestRate, uint16 rebalanceDownDelta, uint256 totalAmount, uint256 interestRate, uint256 averageInterestRate)" +} +const HubPools = { + 'avax': [ + { // USDC + poolAddress: "0x88f15e36308ED060d8543DA8E2a5dA0810Efded2", + tokenAddress: ADDRESSES.avax.USDC, + }, + { // AVAX + poolAddress: "0x0259617bE41aDA4D97deD60dAf848Caa6db3F228", + tokenAddress: ADDRESSES.null, + chainPoolAddress: '0xe69e068539Ee627bAb1Ce878843a6C76484CBd2c', + }, + { // sAVAX + poolAddress: "0x7033105d1a527d342bE618ab1F222BB310C8d70b", + tokenAddress: ADDRESSES.avax.SAVAX, + chainPoolAddress: '0x23a96D92C80E8b926dA40E574d615d9e806A87F6', + }, + { // wETH_ava + poolAddress: "0x795CcF6f7601edb41E4b3123c778C56F0F19389A", + tokenAddress: ADDRESSES.avax.WETH_e, + chainPoolAddress: '0x0e563B9fe6D9EF642bDbA20D53ac5137EB0d78DC', + }, + { // BTCb_ava + poolAddress: "0x1C51AA1516e1156d98075F2F64e259906051ABa9", + tokenAddress: ADDRESSES.avax.BTC_b, + chainPoolAddress: '0xef7a6EBEDe2ad558DB8c36Df65365b209E5d57dC', + }, + { // SolvBTC + poolAddress: "0x307bCEC89624660Ed06C97033EDb7eF49Ab0EB2D", + tokenAddress: '0xbc78D84Ba0c46dFe32cf2895a19939c86b81a777', + }, + ], + 'ethereum': [ + // excluding USDC cause bridged + // excluding SolvBTC cause bridged + { // ETH_eth + poolAddress: "0xB6DF8914C084242A19A4C7fb15368be244Da3c75", + tokenAddress: ADDRESSES.null, + chainPoolAddress: '0xe3B0e4Db870aA58A24f87d895c62D3dc5CD05883', + }, + { // wBTC_eth + poolAddress: "0x9936812835476504D6Cf495F4F0C718Ec19B3Aff", + chainPoolAddress: "0xb39c03297E87032fF69f4D42A6698e4c4A934449", + tokenAddress: ADDRESSES.ethereum.WBTC, + }, + ], + 'base': [ + // excluding USDC cause bridged + // excluding SolvBTC cause bridged + { // ETH_base + poolAddress: "0x51958ed7B96F57142CE63BB223bbd9ce23DA7125", + tokenAddress: ADDRESSES.null, + chainPoolAddress: '0xe3B0e4Db870aA58A24f87d895c62D3dc5CD05883', + }, + { // cbBTC_base + poolAddress: "0x9eD81F0b5b0E9b6dE00F374fFc7f270902576EF7", + tokenAddress: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf", + chainPoolAddress: '0x50d5Bb3Cf57D2fB003b602A6fD10F90baa8567EA', + }, + ], + 'bsc': [ + // excluding SolvBTC cause bridged + { // BNB + poolAddress: "0x89970d3662614a5A4C9857Fcc9D9C3FA03824fe3", + tokenAddress: ADDRESSES.null, + chainPoolAddress: '0x5f2F4771B7dc7e2F7E9c1308B154E1e8957ecAB0', + }, + { // ETHB_bsc + poolAddress: "0x18031B374a571F9e060de41De58Abb5957cD5258", + tokenAddress: ADDRESSES.bsc.ETH, + chainPoolAddress: '0x4Db12F554623E4B0b3F5bAcF1c8490D4493380A5', + }, + { // BTCB_bsc + poolAddress: "0xC2FD40D9Ec4Ae7e71068652209EB75258809e131", + tokenAddress: ADDRESSES.bsc.BTCB, + chainPoolAddress: '0x12Db9758c4D9902334C523b94e436258EB54156f', + }, + ], + 'arbitrum': [ + // excluding USDC cause bridged + // excluding SolvBTC cause bridged + { // ETH_arb + poolAddress: "0x44E0d0809AF8Ee37BFb1A4e75D5EF5B96F6346A3", + tokenAddress: ADDRESSES.null, + chainPoolAddress: '0x37d761883a01e9F0B0d7fe59EEC8c21D94393CDD', + }, + { // ARB + poolAddress: "0x1177A3c2CccDb9c50D52Fc2D30a13b2c3C40BCF4", + tokenAddress: ADDRESSES.arbitrum.ARB, + chainPoolAddress: '0x1b2a8d56967d00700DD5C94E27B1a116a1deF8Df', + }, + ] +} + +module.exports = { + HubPoolAbi, + HubPools, +}; diff --git a/projects/folks-xchain/index.js b/projects/folks-xchain/index.js new file mode 100644 index 000000000000..9e78218194dc --- /dev/null +++ b/projects/folks-xchain/index.js @@ -0,0 +1,35 @@ +const sdk = require('@defillama/sdk') +const { HubPools, HubPoolAbi, } = require("./constants"); + +async function tvl(api) { + const tokensAndOwners = HubPools[api.chain].map(pool => [pool.tokenAddress, pool.chainPoolAddress ?? pool.poolAddress]) + return api.sumTokens({ tokensAndOwners }) +} + +async function borrowed(api) { + const HubPoolsChain = HubPools[api.chain] + let chainApi = api + if (api.chain !== 'avax') { + chainApi = new sdk.ChainApi({ chain: 'avax', timestamp: api.timestamp }) + await chainApi.getBlock() + } + const targets = HubPoolsChain.map(pool => pool.poolAddress) + + const [varBorrowsData, stableBorrowsData] = await Promise.all([ + await chainApi.multiCall({ calls: targets, abi: HubPoolAbi.getVariableBorrowData, }), + await chainApi.multiCall({ calls: targets, abi: HubPoolAbi.getStableBorrowData, }) + ]); + + HubPoolsChain.forEach((pool, idx) => { + api.add(pool.tokenAddress, Number(varBorrowsData[idx][3]) + Number(stableBorrowsData[idx][8])) + }) + return api.getBalances() +} + +module.exports = { + methodology: "The Folks Finance xChain states are saved in the Hub chain contracts i.e. Avalanche; TVL counts deposited total amount values for each pool, borrowed counts variable and stable borrowed total amount values for each pool", +} + +Object.keys(HubPools).forEach(chain => { + module.exports[chain] = { tvl, borrowed, } +}) \ No newline at end of file diff --git a/projects/forge-game/index.js b/projects/forge-game/index.js new file mode 100644 index 000000000000..836208b84ce4 --- /dev/null +++ b/projects/forge-game/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require('../helper/chain/ton'); +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + methodology: 'Counts the pre-market wallet size as the TVL.', + timetravel: false, + ton: { + tvl: sumTokensExport({ owner: 'UQAGNpAAIaDrvGWdUCB7ycc_S5tLO0S6PPK0UkrrQb27AWKM', tokens: [ADDRESSES.null]}), + } +} \ No newline at end of file diff --git a/projects/fortress-lending/index.js b/projects/fortress-lending/index.js index a3b0cc4754b4..9e1ff2321b1a 100644 --- a/projects/fortress-lending/index.js +++ b/projects/fortress-lending/index.js @@ -1,12 +1,14 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const { compoundExports } = require("../helper/compound"); -const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", ADDRESSES.bsc.WBNB) +const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491") module.exports = { + deadFrom: '2023-02-16', bsc: { tvl: sdk.util.sumChainTvls([lendingTvl]), borrowed }, -}; \ No newline at end of file +}; + +module.exports.bsc.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/fortunafi-fbill/index.js b/projects/fortunafi-fbill/index.js deleted file mode 100644 index 208728f2e2f6..000000000000 --- a/projects/fortunafi-fbill/index.js +++ /dev/null @@ -1,32 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') - -const contracts = { - canto: { - token: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08' - }, - arbitrum: { - token: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08' - }, - blast: { - token: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08' - } -} - -const tvl = async (api) => { - const nav = await api.call({ target: contracts[api.chain].token, abi: 'function nav() external view returns (uint256)' }); - - switch (api.chain) { - case 'blast': - api.add(ADDRESSES['blast'].USDB, nav); - break; - default: - api.add(ADDRESSES[api.chain].USDC, nav / 1e12); - } -} - -module.exports = { - misrepresentedTokens: true, - canto: { tvl }, - arbitrum: { tvl }, - blast: { tvl } -}; diff --git a/projects/fortunafi-ifbill/index.js b/projects/fortunafi-ifbill/index.js deleted file mode 100644 index 0b20c6c11da9..000000000000 --- a/projects/fortunafi-ifbill/index.js +++ /dev/null @@ -1,31 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') - -const contracts = { - canto: { - token: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b' - }, - arbitrum: { - token: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b' - }, - blast: { - token: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b' - } -}; - -const tvl = async (_, _1, _2, { api }) => { - const nav = await api.call({ target: contracts[api.chain].token, abi: 'function nav() external view returns (uint256)' }); - - switch (api.chain) { - case 'blast': - api.add(ADDRESSES['blast'].USDB, nav); - break; - default: - api.add(ADDRESSES[api.chain].USDC, nav / 1e12); - } -} - -module.exports = { - canto: { tvl }, - arbitrum: { tvl }, - blast: { tvl } -}; diff --git a/projects/fortunafi/index.js b/projects/fortunafi/index.js new file mode 100644 index 000000000000..fa3ecdece16a --- /dev/null +++ b/projects/fortunafi/index.js @@ -0,0 +1,31 @@ + +const config = { + canto: { + fbill: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08', + fCOIN: '0x855EA9979189383ef5A85eB74Ed3a02E2604EA81', + ifBill: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b', + }, + arbitrum: { + fbill: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08', + fCOIN: '0x108Ec61bd5A91F5596F824832524C6b6002E3F03', + ifBill: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b', + }, + blast: { + fbill: '0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08', + fCOIN: '0xE85Ae7e8Fa0Ee69426019b7D3E77843673807ABE', + ifBill: '0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b', + }, + ethereum: { + fCOIN: '0x2378aC4EEAAe44695E1e3d0fcAEEd6ba8b0F5108', + }, +} + +Object.keys(config).forEach(chain => { + const tokens = Object.values(config[chain]) + module.exports[chain] = { + tvl: async (api) => { + const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: tokens}) + api.add(tokens, supplies) + } + } +}) diff --git a/projects/four-meme/index.js b/projects/four-meme/index.js new file mode 100644 index 000000000000..aade92ebd33c --- /dev/null +++ b/projects/four-meme/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const config = { + bsc: { + owners: Object.values({ + tokenManager: "0xEC4549caDcE5DA21Df6E6422d448034B5233bFbC", + tokenManager2: "0x5c952063c7fc8610FFDB798152D69F0B9550762b", + }), + tokens: [ADDRESSES.null, ADDRESSES.bsc.USDT,], + }, +}; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { tvl: sumTokensExport(config[chain]) } +}) \ No newline at end of file diff --git a/projects/fourdex/index.js b/projects/fourdex/index.js index b4e580a8d3c6..6972d0808751 100644 --- a/projects/fourdex/index.js +++ b/projects/fourdex/index.js @@ -5,7 +5,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x0f93649C2BA0F64fA939eCe899f1afD0b15C7Bd2", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/fpi/index.js b/projects/fpi/index.js index 24cf40c7a7fb..99d24c8518ed 100644 --- a/projects/fpi/index.js +++ b/projects/fpi/index.js @@ -1,7 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const frax = ADDRESSES.ethereum.FRAX -const fxs = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0" +const fxs = ADDRESSES.ethereum.FXS async function tvl(api){ const balances = {} diff --git a/projects/fragmetric/index.js b/projects/fragmetric/index.js new file mode 100644 index 000000000000..462f79a03840 --- /dev/null +++ b/projects/fragmetric/index.js @@ -0,0 +1,25 @@ +const { sumTokens2 } = require("../helper/solana"); + +async function tvl() { + return sumTokens2({ + tokenAccounts: [ + "4b3xtGBwmP9FQyQ85HDmyEtQrLdoVzz6NBwBjaRBzJuS", + "BXUyJdESgoyssvATKa3omD7zHtdeztpWnG13mDUQ6fcM", + "B2vjfDaLsaJ32ESoFsVf7NPS2hd5f4QisiPLiXBrS1BK", + "7rtyMjMKPrmKfciayvxaZdKiY9D7Rx9o3JtW3QvsUnsc", + "HSKvv9UFCn4c6Jq3j8iiJfFgXFjRE6dr6QhWX2KD8gGU", + "3KdpoeWuwaXLuukf56p8e1FtDKjY8pCmtZdmZejUctwP", + "9grKYUmguSLVC9RHW1xKcLpiAphJrmcDkTVTCg9ebpFz", + "EbMiibdEBswBKxATPtYEiaRcx7uzJvyWvexVzUJ6iyje", + ], + solOwners: [ + "3H22A3T3CMyoGzAURZ4szV5Hmt64Dooo5g9Ns8h1kYy7", + ] + }) +} + +module.exports = { + timetravel: false, + solana: { tvl }, + methodology: 'TVL is calculated by summing all restaked assets.', +}; diff --git a/projects/franklinTempleton-finance/index.js b/projects/franklinTempleton-finance/index.js index bbbaf4b88308..01f33d2aabff 100644 --- a/projects/franklinTempleton-finance/index.js +++ b/projects/franklinTempleton-finance/index.js @@ -1,10 +1,15 @@ const { toUSDTBalances } = require('../helper/balances'); -const BENJI_STELLAR = {ticker: "BENJI", address: 'GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5'} -const BENJI_POLYGON = '0x408a634b8a8f0de729b48574a3a7ec3fe820b00a' +const BENJI = { + stellar: {ticker: "BENJI", address: 'GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5'}, + arbitrum: '0xb9e4765bce2609bc1949592059b17ea72fee6c6a', + polygon: '0x408a634b8a8f0de729b48574a3a7ec3fe820b00a', + avax: '0xe08b4c1005603427420e64252a8b120cace4d122', + base: '0x60cfc2b186a4cf647486e42c42b11cc6d571d1e4' +} const stellarTvl = async (api) => { - const stellarApi = `https://api.stellar.expert/explorer/public/asset/${BENJI_STELLAR.ticker}-${BENJI_STELLAR.address}` + const stellarApi = `https://api.stellar.expert/explorer/public/asset/${BENJI[api.chain].ticker}-${BENJI[api.chain].address}` const response = await fetch(stellarApi) const {supply, toml_info} = await response.json() const adjustedSupply = toUSDTBalances((supply / Math.pow(10, toml_info.decimals))) @@ -12,17 +17,19 @@ const stellarTvl = async (api) => { return api.add(tokenAddress, tokenBalance, { skipChain: true }) } -const polygonTvl = async (api) => { +const evmTVL = async (api) => { const [decimals, totalSupply] = await Promise.all([ - api.call({target: BENJI_POLYGON, abi:'erc20:decimals'}), - api.call({target: BENJI_POLYGON, abi:'erc20:totalSupply'}) + api.call({target: BENJI[api.chain], abi:'erc20:decimals'}), + api.call({target: BENJI[api.chain], abi:'erc20:totalSupply'}) ]) + const adjustedSupply = toUSDTBalances((totalSupply / Math.pow(10, decimals))) const [[tokenAddress, tokenBalance]] = Object.entries(adjustedSupply); - api.add(tokenAddress, tokenBalance, {skipChain: true} ) -} + api.add(tokenAddress, tokenBalance, { skipChain: true }) -module.exports = { - stellar: {tvl: stellarTvl}, - polygon: {tvl: polygonTvl}, } + +Object.keys(BENJI).forEach((chain) => { + module.exports[chain] = { tvl: chain === 'stellar' ? stellarTvl : evmTVL }; +}); + diff --git a/projects/frax-ETH/index.js b/projects/frax-ETH/index.js index c8d9d99ba583..af96654e63fe 100644 --- a/projects/frax-ETH/index.js +++ b/projects/frax-ETH/index.js @@ -1,10 +1,120 @@ +const { get } = require("../helper/http"); +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk") -const token = '0x5E8422345238F34275888049021821E8E08CAa1f' + +const abi = { + coins: "function coins(uint256 arg0) view returns (address)", + get_balances: "function get_balances() view returns (uint256[2])", + lockedLiquidityOf: "function lockedLiquidityOf(address account) view returns (uint256)", + redemptionQueueAccounting: "function redemptionQueueAccounting() view returns (uint128 etherLiabilities, uint128 unclaimedFees)", + get_balances2: "function get_balances() view returns (uint256[])", +} + +/** + * Config Ethereum + */ + +const frxETH = "0x5E8422345238F34275888049021821E8E08CAa1f" +const treasury = "0x8306300ffd616049FD7e4b0354a64Da835c1A81C"; +const minter = "0xbAFA44EFE7901E04E39Dad13167D089C559c1138"; +const redeemer = "0x82bA8da44Cd5261762e629dd5c605b17715727bd" +const st_frxETH = "0x4d9f9D15101EEC665F77210cB999639f760F831E"; +const frxeth_ng = '0x9c3B46C0Ceb5B9e304FCd6D88Fc50f7DD24B31Bc' +const stakingProxyConvex_1 = '0x32a2849100ed63878ba8ee6e924EB052A57ecB44' +const stakingProxyConvex_2 = '0x74da8EB74DD94Dbd3B501eb16D8CB2C5222dBDa9' +const stakingConvex_1 = "0x68921998fbc43B360D3cF14a03aF4273CB0cFA44" +const stakingConvex_2 = "0xB4fdD7444E1d86b2035c97124C46b1528802DA35" + +const url = "https://api.frax.finance/v2/frxeth/validators" + +/** + * Config Fraxtal + */ + +const wfrxETH = "0xFC00000000000000000000000000000000000006" +const treasury_2 = "0x0ae0548Ef97d3eC699cF375e2467E24B2f35847c" +const ezwfrxETH = "0x6e9b6660b94fa74A8087D7ee14Dc28698249D242" + +const unwrapperCRV = async (api, lps, treasury) => { + const [supplies, token0s, token1s, poolBalances, balanceOfs] = await Promise.all([ + api.multiCall({ calls: lps.map((lp) => ({ target: lp.pool })), abi: "erc20:totalSupply" }), + api.multiCall({ calls: lps.map((lp) => ({ target: lp.pool, params: [0] })), abi: abi.coins }), + api.multiCall({ calls: lps.map((lp) => ({ target: lp.pool, params: [1] })), abi: abi.coins }), + api.multiCall({ calls: lps.map((lp) => ({ target: lp.pool })), abi: abi.get_balances }), + api.multiCall({ calls: lps.map((lp) => ({ target: lp.pool, params: [treasury], skip: lp.balance !== undefined })), abi: "erc20:balanceOf" }), + ]) + + lps.forEach((lp, i) => { + const supply = supplies[i] + const token0 = token0s[i] + const token1 = token1s[i] + const poolBalance = poolBalances[i] + const balanceOf = lp.balance !== undefined ? lp.balance : balanceOfs[i]; + api.add(token0, balanceOf * poolBalance[0] / supply, { skipChain: true }) + api.add(token1, balanceOf * poolBalance[1] / supply, { skipChain: true }) + }) +}; + +const unwrapperCRVCVX = async (api, lps, treasury) => { + const balanceOfs = await api.multiCall({ calls: lps.map((lp) => ({ target: lp.staker, params: [lp.user] })) , abi: abi.lockedLiquidityOf }) + return unwrapperCRV(api, lps.map((lp, i) => ({...lp, balance: balanceOfs[i]})), treasury) +} + +const treasuryAssets = async (api, treasury) => { + await Promise.all([ + unwrapperCRV(api, [{ pool: st_frxETH }, { pool: frxeth_ng }], treasury), + unwrapperCRVCVX(api, [ + { user: stakingProxyConvex_1, staker: stakingConvex_1, pool: st_frxETH }, + { user: stakingProxyConvex_2, staker: stakingConvex_2, pool: frxeth_ng } + ], treasury) + ]) + + api.add(frxETH, await api.call({ target: frxETH, params: [treasury], abi: 'erc20:balanceOf' })) + api.add(ADDRESSES.ethereum.WETH, (await sdk.api.eth.getBalance({ target: treasury })).output) +} + +const redeemerAssets = async (api, redeemer) => { + const unclaimed = await api.call({ target: redeemer, abi: abi.redemptionQueueAccounting }) + api.add(ADDRESSES.ethereum.WETH, unclaimed.unclaimedFees) + api.add(ADDRESSES.ethereum.WETH, (await sdk.api.eth.getBalance({ target: redeemer })).output) +} + +const validatorsAssets = async (api) => { + const { validators } = await get(url) + const balances = validators.map((r) => r.balanceDec * Math.pow(10, 18)) + const totalBalance = balances.reduce((acc, balance) => acc + balance, 0); + api.add(ADDRESSES.ethereum.WETH, totalBalance) +} + + +const ethTvl = async (api) => { + await Promise.all([ + treasuryAssets(api, treasury), // frxETH Treasury + redeemerAssets(api, redeemer), // frxETH redeemer + validatorsAssets(api) // validators + ]) + + api.add(ADDRESSES.ethereum.WETH, (await sdk.api.eth.getBalance({ target: minter })).output) // frxETH Minter + api.removeTokenBalance(frxETH) +}; + +const fraxtalTvl = async (api) => { + const [supply, token0, token1, poolBalance, balanceOf] = await Promise.all([ + api.call({ target: ezwfrxETH, abi: "erc20:totalSupply" }), + api.call({ target: ezwfrxETH, params: [0], abi: abi.coins }), + api.call({ target: ezwfrxETH, params: [1], abi: abi.coins }), + api.call({ target: ezwfrxETH, abi: abi.get_balances2 }), + api.call({ target: ezwfrxETH, params: [treasury_2], abi: "erc20:balanceOf" }), + ]) + + api.add(token0 === wfrxETH ? frxETH : token0, balanceOf * poolBalance[0] / supply, { skipChain: true }) + api.add(token1 === wfrxETH ? frxETH : token1, balanceOf * poolBalance[1] / supply, { skipChain: true }) + api.add(frxETH, (await sdk.api.eth.getBalance({ target: treasury })).output, { skipChain: true }) + api.removeTokenBalance(frxETH) +} module.exports = { - ethereum: { - tvl: async (_, block) => ({ - ethereum: (await sdk.api.erc20.totalSupply({ target: token, block})).output/1e18 - }) - } -} \ No newline at end of file + methodology: "TVL represents all the on-chain assets backing frxETH", + ethereum: { tvl: ethTvl }, + fraxtal: { tvl: fraxtalTvl } +}; diff --git a/projects/fraxfinance/index.js b/projects/fraxfinance/index.js index 7203aed3a44a..acb073dfecc8 100644 --- a/projects/fraxfinance/index.js +++ b/projects/fraxfinance/index.js @@ -4,7 +4,7 @@ const { staking, } = require("../helper/staking"); const { sumTokens2, nullAddress, } = require("../helper/unwrapLPs"); const USDC = ADDRESSES.ethereum.USDC; -const FXS = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"; +const FXS = ADDRESSES.ethereum.FXS; const FRAX_3CRV = '0xd632f22692fac7611d2aa1c0d552930d43caed3b' const T_3CRV = '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' diff --git a/projects/fraxlend/index.js b/projects/fraxlend/index.js index c8bb6771f3fb..ef6e0a08debc 100644 --- a/projects/fraxlend/index.js +++ b/projects/fraxlend/index.js @@ -15,8 +15,8 @@ const registry_config = { const frax_config = { ethereum: ADDRESSES.ethereum.FRAX, - fraxtal: "0xFc00000000000000000000000000000000000001", - arbitrum: "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F" + fraxtal: ADDRESSES.fraxtal.FRAX, + arbitrum: ADDRESSES.arbitrum.FRAX } async function tvl(api) { diff --git a/projects/freestyle/index.js b/projects/freestyle/index.js index 4aadb02a6e11..fce0e463725f 100644 --- a/projects/freestyle/index.js +++ b/projects/freestyle/index.js @@ -5,7 +5,7 @@ const freestyleConfig = { base: { token: ADDRESSES.base.USDC, start: 1700006400, - graphUrl: "https://api.studio.thegraph.com/query/62454/analytics_base_8_2/version/latest", + graphUrl: "https://api-v2.morphex.trade/subgraph/3KhmYXgsM3CM1bbUCX8ejhcxQCtWwpUGhP7p9aDKZ94Z", accountSource: '0x6D63921D8203044f6AbaD8F346d3AEa9A2719dDD' }, } diff --git a/projects/froggy-protocol/index.js b/projects/froggy-protocol/index.js index c902b2be3c53..378ef0e03cba 100644 --- a/projects/froggy-protocol/index.js +++ b/projects/froggy-protocol/index.js @@ -23,4 +23,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-06-15')/1e3), 'Rug Pull ?'], ], + deadFrom: Math.floor(new Date('2023-06-15')/1e3) } \ No newline at end of file diff --git a/projects/fuel/index.js b/projects/fuel/index.js new file mode 100644 index 000000000000..617fa74d2db8 --- /dev/null +++ b/projects/fuel/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xAEB0c00D0125A8a788956ade4f4F12Ead9f65DDf", + "0xa4cA04d02bfdC3A2DF56B9b6994520E69dF43F67", + ], + fetchCoValentTokens: true, + }), + }, +}; diff --git a/projects/fujidao-v2/index.js b/projects/fujidao-v2/index.js index 1e1f2c241a18..dd832d0c0d7e 100644 --- a/projects/fujidao-v2/index.js +++ b/projects/fujidao-v2/index.js @@ -81,24 +81,25 @@ Object.keys(config).forEach(chain => { const assets = bassets.concat(yassets) const debtAssets = blogs.map(log => log.debtAsset) - - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) - const debtBals = await api.multiCall({ abi: 'uint256:totalDebt', calls: bvaults, permitFailure: true, }) - bals.forEach((bal, i) => { - api.add(assets[i], bal) - }) + const [bals, debtBals] = await Promise.all([ + api.multiCall({ abi: 'uint256:totalAssets', calls: vaults, permitFailure: true }), + api.multiCall({ abi: 'uint256:totalDebt', calls: bvaults, permitFailure: true, }) + ]) - debtAssets.forEach((bal, i) => { - if (!debtBals[i]) { - return; - // if (+bal === 0) return; - // throw new Error(`No debt balance for ${bvaults[i]}`) - } - api.add(debtAssets[i], debtBals[i] * -1) + vaults.map((_, i) => { + const asset = assets[i] + const bal = bals[i] + if (!bal) return + api.add(asset, bal) }) - return api.getBalances() + bvaults.map((_, i) => { + const debtAsset = debtAssets[i] + const debtBal = debtBals[i] + if (!debtBal) return + api.add(debtAsset, debtBal * -1) + }) }, borrowed: async (api) => { let logs = []; @@ -119,17 +120,18 @@ Object.keys(config).forEach(chain => { } const vaults = logs.map(log => log.vault) const debtAssets = logs.map(log => log.debtAsset) - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults }) - const debtBals = (await api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true, })) - bals.forEach((bal, i) => { - if (!debtBals[i]) { - return; - // if (+bal === 0) return; - // throw new Error(`No debt balance for ${vaults[i]}`) - } - api.add(debtAssets[i], debtBals[i]) - }) - return api.getBalances() + + const [bals, debtBals] = await Promise.all([ + api.multiCall({ abi: 'uint256:totalAssets', calls: vaults, permitFailure: true }), + api.multiCall({ abi: 'uint256:totalDebt', calls: vaults, permitFailure: true }) + ]) + + vaults.forEach((_, i) => { + const debtBal = debtBals[i] + const debtAsset = debtAssets[i] + if (!debtBal) return + api.add(debtAsset, debtBal) + }) } } }) \ No newline at end of file diff --git a/projects/fulcrom/index.js b/projects/fulcrom/index.js index b31fd2f4870e..9f53c9cc65ea 100644 --- a/projects/fulcrom/index.js +++ b/projects/fulcrom/index.js @@ -2,6 +2,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const CRO_VAULT_ADDR = '0x8C7Ef34aa54210c76D6d5E475f43e0c11f876098'; const ZKSYNC_VAULT_ADDR = '0x7d5b0215EF203D0660BC37d5D09d964fd6b55a1E'; +const CRO_ZKEVM_VAULT_ADDR = '0xdDDf221d5293619572616574Ff46a2760f162075'; function fulExports({ vault, }) { return async (api) => { @@ -27,4 +28,7 @@ module.exports = { era: { tvl: fulExports({ vault: ZKSYNC_VAULT_ADDR, }), }, + cronos_zkevm: { + tvl: fulExports({ vault: CRO_ZKEVM_VAULT_ADDR, }), + }, } diff --git a/projects/fundex/index.js b/projects/fundex/index.js index c8a1a94223e2..ad99f429edb5 100644 --- a/projects/fundex/index.js +++ b/projects/fundex/index.js @@ -9,7 +9,8 @@ const config = { module.exports = { hallmarks: [ [1680134400, "Rugpull"] - ] + ], + deadFrom: '2023-03-30' }; Object.keys(config).forEach(chain => { module.exports[chain] = {tvl} }) diff --git a/projects/fusefi-lending/index.js b/projects/fusefi-lending/index.js index dacc669eb407..a3e80b5e524b 100644 --- a/projects/fusefi-lending/index.js +++ b/projects/fusefi-lending/index.js @@ -1,24 +1,10 @@ -const { usdCompoundExports } = require('../helper/compound'); +const { compoundExports2 } = require('../helper/compound'); -const unitroller_fuse = "0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340" - -const abis = { - oracle: "address:getRegistry", - underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", -} - -const olalending = usdCompoundExports(unitroller_fuse, "fuse", "0x025B0ff0920298e087308F3b2de0CF6399685909", abis) module.exports = { - fuse:{ - tvl: olalending.tvl, - borrowed: async function(api){ - if(api.timestamp >= 1648684800){ - return {} - } - return olalending.borrowed(api) - } - }, + fuse: compoundExports2({ comptroller: '0x26a562B713648d7F3D1E1031DCc0860A4F3Fa340'}), hallmarks: [ [1648684800, "Ola Finance exploit"] ] -} \ No newline at end of file +} + +module.exports.fuse.borrowed = () => ({}) \ No newline at end of file diff --git a/projects/fwx-dex/index.js b/projects/fwx-dex/index.js new file mode 100644 index 000000000000..42496072ef90 --- /dev/null +++ b/projects/fwx-dex/index.js @@ -0,0 +1,17 @@ +const { getUniTVL } = require('../helper/unknownTokens'); + +module.exports = { + misrepresentedTokens: true, + avax: { + tvl: getUniTVL({ + factory: '0x2131Bdb0E0B451BC1C5A53F2cBC80B16D43634Fa', + useDefaultCoreAssets: true, + }) + }, + base: { + tvl: getUniTVL({ + factory: '0x3512DA8F30D9AE6528e8e0787663C14Fe263Fbea', + useDefaultCoreAssets: true, + }) + } +}; \ No newline at end of file diff --git a/projects/fwx/index.js b/projects/fwx/index.js index bf3ad8919dc4..c5a59d46593f 100644 --- a/projects/fwx/index.js +++ b/projects/fwx/index.js @@ -1,73 +1,54 @@ -const { getLogs2 } = require('../helper/cache/getLogs') -const ADDRESSES = require("../helper/coreAssets.json"); -const VECTOR = require("../vector/vectorContracts.json"); - -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 tokensAndOwners = []; -for (const [symbol, token] of Object.entries(tokens)) { - tokensAndOwners.push([token.contractAddr, token.pool]); - tokensAndOwners.push([token.contractAddr, coreModuleProxy]); - tokensAndOwners.push([token.contractAddr, xliplessDex]); -} +const { getConfig } = require('../helper/cache') module.exports = { avax: { tvl, }, -}; + base: { + tvl, + } +} + +const dexes = { + avax: [ + "0x82E90fB94fd9a5C19Bf38648DD2C9639Bde67c74", // xliplessDex + ], + base: [ + "0xaf5a41Ad65752B3CFA9c7F90a516a1f7b3ccCdeD" // perp + ] +} async function tvl(api) { - 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]) - }) + + const { assets } = await getConfig('fwx/' + api.chain, "https://app.fwx.finance/api/v2/assets?chain_id=" + api.chainId) + + let tokensAndOwners = []; + for (let i = 0; i < assets.length; i++) { + const asset = assets[i] + const tokenAddr = asset.token_address + const poolAddr = asset.pool_address + const coreAddr = asset.core_address + const dexAddrs = dexes[api.chain] + + if (poolAddr != "") { + tokensAndOwners.push( + [tokenAddr, poolAddr], + ); + } + + if (coreAddr != "") { + tokensAndOwners.push( + [tokenAddr, coreAddr], + ); + } + + for (let i = 0; i < dexAddrs.length; i++) { + const dexAddr = dexAddrs[i] + tokensAndOwners.push( + [tokenAddr, dexAddr], + ); + } + } + return api.sumTokens({ tokensAndOwners }) -} \ No newline at end of file +} diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js index a4f998796bb1..914f8e123518 100644 --- a/projects/fx-Protocol/index.js +++ b/projects/fx-Protocol/index.js @@ -1,13 +1,26 @@ +const ADDRESSES = require('../helper/coreAssets.json') const treasuries = [ - "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0", - "0xED803540037B0ae069c93420F89Cd653B6e3Df1f", - "0xcfEEfF214b256063110d3236ea12Db49d2dF2359", - "0x781BA968d5cc0b40EB592D5c8a9a3A4000063885", - "0x38965311507D4E54973F81475a149c09376e241e", - "0x63Fe55B3fe3f74B42840788cFbe6229869590f83", - "0xdFac83173A96b06C5D6176638124d028269cfCd2" + "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0", + "0xED803540037B0ae069c93420F89Cd653B6e3Df1f", + "0xcfEEfF214b256063110d3236ea12Db49d2dF2359", + "0x781BA968d5cc0b40EB592D5c8a9a3A4000063885", + "0x38965311507D4E54973F81475a149c09376e241e", + "0x63Fe55B3fe3f74B42840788cFbe6229869590f83", + "0xdFac83173A96b06C5D6176638124d028269cfCd2" ]; - +const baseTokenRate = [ + // '', + '0x81A777c4aB65229d1Bf64DaE4c831bDf628Ccc7f', + '0x7ceD6167b5A08111dC8d0D2f9F7E482c4Da62506', + '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', + '0xE3fF08070aB3aD7eeE7a1cab35105F27DF8EfF10', + // '', + '0x6Eb03222179F83126735D7E9FdE94571D716D399' +] +const cvxAddress = ADDRESSES.ethereum.CVX; +const aCVX = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777"; +const uniBTC = "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568"; +const uniBTC_Genesis_Gauge = "0x1D20671A21112E85b03B00F94Fd760DE0Bef37Ba" module.exports = { doublecounted: true, ethereum: { @@ -15,9 +28,48 @@ module.exports = { }, }; +async function getACVXInfo(api) { + const totalAssets = await api.api.call( + { + target: aCVX, + abi: 'uint256:totalAssets', + }) + const totalSupply = await api.api.call( + { + target: aCVX, + abi: 'uint256:totalSupply', + }) + return totalAssets / totalSupply +} + +async function getUniBTCTvl(api) { + const totalSupply = await api.api.call( + { + target: uniBTC_Genesis_Gauge, + abi: 'uint256:totalSupply', + }) + return totalSupply +} +async function getBaseTokenRate(api) { + const rates = await api.multiCall({ abi: 'uint256:getRate', calls: baseTokenRate }) + rates.splice(0, 0, 1e18); + rates.splice(5, 0, 1e18); + return rates +} + async function tvl(api) { + const aCvxRate = await getACVXInfo(api) + const rates = await getBaseTokenRate(api) const tokens = await api.multiCall({ abi: 'address:baseToken', calls: treasuries }) const bals = await api.multiCall({ abi: 'uint256:totalBaseToken', calls: treasuries }) const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) - bals.forEach((bal, i) => api.add(tokens[i], bal / 10 ** (18 - decimals[i]))) + const uniBTCTvl = await getUniBTCTvl(api) + bals.forEach((bal, i) => { + if (tokens[i].toLowerCase() === aCVX.toLowerCase()) { + api.add(cvxAddress, bal/(rates[i]/1e18)*aCvxRate / 10 ** (18 - decimals[i])) + } else { + api.add(tokens[i], bal/(rates[i]/1e18) / 10 ** (18 - decimals[i])) + } + }) + api.add(uniBTC, uniBTCTvl) } \ No newline at end of file diff --git a/projects/fxdao/api.js b/projects/fxdao/api.js new file mode 100644 index 000000000000..8843008c09f8 --- /dev/null +++ b/projects/fxdao/api.js @@ -0,0 +1,28 @@ +const { SorobanRpc, Networks, Address, xdr, Asset, scValToNative } = require('@stellar/stellar-sdk'); + +const VAULTS_CONTRACT_ID = "CCUN4RXU5VNDHSF4S4RKV4ZJYMX2YWKOH6L4AKEKVNVDQ7HY5QIAO4UB"; +const rpcUrl = 'https://soroban-rpc.creit.tech/'; +const server = new SorobanRpc.Server(rpcUrl); + +async function tvl(api) { + const response = await server.getContractData( + Asset.native().contractId(Networks.PUBLIC), + xdr.ScVal.scvVec([ + xdr.ScVal.scvSymbol('Balance'), + new Address(VAULTS_CONTRACT_ID).toScVal(), + ]), + SorobanRpc.Durability.Persistent + ); + const balance = scValToNative(response.val.value().val()).amount; + const parsedBalance = Number(balance) / 1e7; + api.addCGToken('stellar', parsedBalance); + return api.getBalances() +} + +module.exports = { + timetravel: false, + methodology: `Takes the total amount of XLMs locked in the Vaults contract, the XLMs are the collateral of the issued assets by the protocol.`, + stellar: { + tvl, + }, +}; diff --git a/projects/fxdao/index.js b/projects/fxdao/index.js new file mode 100644 index 000000000000..d90f5cb24e0e --- /dev/null +++ b/projects/fxdao/index.js @@ -0,0 +1,7 @@ +const { getExports } = require('../helper/heroku-api') + +module.exports = { + timetravel: false, + methodology: `Takes the total amount of XLMs locked in the Vaults contract, the XLMs are the collateral of the issued assets by the protocol.`, + ...getExports("fxdao", ['stellar']) +}; diff --git a/projects/fyde/index.js b/projects/fyde/index.js index ca92d3c59305..802dfef06c96 100644 --- a/projects/fyde/index.js +++ b/projects/fyde/index.js @@ -5,6 +5,8 @@ const RESTAKING_AGGREGATOR = "0x3f69F62e25441Cf72E362508f4d6711d53B05341"; const DEPOSIT_ESCROW = "0x63ec950633Eb85797477166084AD0a7121910470"; const ORACLE = "0x05198327206123E89c24ABd9A482316449bD2aEe" const WETH = ADDRESSES.ethereum.WETH; +const YIELDMANAGER = "0xB615A7E4D1Ed426470Ac2Df14F3153fA2DcCC3ba" +const PTTOKENS = ["0x1c085195437738d73d75DC64bC5A3E098b7f93b1", "0x6ee2b5e19ecba773a352e5b21415dc419a700d1d"] async function tvl(api) { const tokens = await api.fetchList({ lengthAbi: 'getAssetsListLength', itemAbi: 'assetsList', target: FYDE_CONTRACT }) @@ -38,7 +40,10 @@ async function tvl(api) { // 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 }) + return api.sumTokens({ ownerTokens: [ + [tokensEscrow, DEPOSIT_ESCROW], + [PTTOKENS, YIELDMANAGER], + ],}) } module.exports = { diff --git a/projects/g8keep/index.js b/projects/g8keep/index.js new file mode 100644 index 000000000000..c41239e85838 --- /dev/null +++ b/projects/g8keep/index.js @@ -0,0 +1,20 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumUnknownTokens } = require('../helper/unknownTokens') + +const config = { + base: { factory: '0x3C0B43867Cd04fEdfD6a95497e5ea7e3aFF8cCaE', fromBlock: 21977940 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event TokenDeployed (address indexed token, address indexed pair, address indexed deployer, string symbol)', fromBlock, }) + const tokens = logs.map(log => log.pair) + return sumUnknownTokens({api, owner: factory, tokens, useDefaultCoreAssets: true, lps: tokens}) + } + } +}) + +module.exports.doublecounted = true +module.exports.misrepresentedTokens = true \ No newline at end of file diff --git a/projects/gainsNetwork.js b/projects/gainsNetwork.js index 7e99fc19dff3..46b86f0da03e 100644 --- a/projects/gainsNetwork.js +++ b/projects/gainsNetwork.js @@ -6,35 +6,54 @@ const { sumTokens2 } = require("./helper/unwrapLPs"); const tokens = { polygon: { DAI: ADDRESSES.polygon.DAI, - dQUICK: "0xf28164a485b0b2c90639e47b0f377b4a438a16b1", + USDC: ADDRESSES.polygon.USDC_CIRCLE, + WETH: ADDRESSES.polygon.WETH_1 }, arbitrum: { - DAI: ADDRESSES.optimism.DAI, + DAI: ADDRESSES.arbitrum.DAI, + USDC: ADDRESSES.arbitrum.USDC_CIRCLE, + WETH: ADDRESSES.arbitrum.WETH + }, + base: { + USDC: ADDRESSES.base.USDC, }, }; async function polyTvl(api) { const tokensAndOwners = [ - [tokens.polygon.dQUICK, "0x151757c2E830C467B28Fe6C09c3174b6c76aA0c5"], - [tokens.polygon.dQUICK, "0x203F5c9567d533038d2da70Cbc20e6E8B3f309F9"], - [tokens.polygon.DAI, "0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD"], - [tokens.polygon.DAI, "0xd7052EC0Fe1fe25b20B7D65F6f3d490fCE58804f"], - [tokens.polygon.DAI, "0x91993f2101cc758D0dEB7279d41e880F7dEFe827"], - [tokens.polygon.DAI, "0xaee4d11a16B2bc65EDD6416Fb626EB404a6D65BD"], + [tokens.polygon.DAI, "0x91993f2101cc758D0dEB7279d41e880F7dEFe827"], // gDAI + [tokens.polygon.USDC, "0x29019Fe2e72E8d4D2118E8D0318BeF389ffe2C81"], // gUSDC + [tokens.polygon.WETH, "0x1544E1fF1a6f6Bdbfb901622C12bb352a43464Fb"], // gETH + [tokens.polygon.DAI, "0x209A9A01980377916851af2cA075C2b170452018"], // Diamond + [tokens.polygon.WETH, "0x209A9A01980377916851af2cA075C2b170452018"], // Diamond + [tokens.polygon.USDC, "0x209A9A01980377916851af2cA075C2b170452018"], // Diamond ]; return sumTokens2({ api, tokensAndOwners }); } async function arbiTvl(api) { const tokensAndOwners = [ - [tokens.arbitrum.DAI, "0xd85E038593d7A098614721EaE955EC2022B9B91B"], - [tokens.arbitrum.DAI, "0xcFa6ebD475d89dB04cAd5A756fff1cb2BC5bE33c"], + [tokens.arbitrum.DAI, "0xd85E038593d7A098614721EaE955EC2022B9B91B"], // gDAI + [tokens.arbitrum.USDC, "0xd3443ee1e91aF28e5FB858Fbd0D72A63bA8046E0"], // gUSDC + [tokens.arbitrum.WETH, "0x5977A9682D7AF81D347CFc338c61692163a2784C"], // gETH + [tokens.arbitrum.DAI, "0xFF162c694eAA571f685030649814282eA457f169"], // Diamond + [tokens.arbitrum.USDC, "0xFF162c694eAA571f685030649814282eA457f169"], // Diamond + [tokens.arbitrum.WETH, "0xFF162c694eAA571f685030649814282eA457f169"], // Diamond + ]; + return sumTokens2({ api, tokensAndOwners }); +} +async function baseTvl(api) { + const tokensAndOwners = [ + [tokens.base.USDC, "0xad20523A7dC37bAbc1CC74897E4977232b3D02e5"], // gUSDC + [tokens.base.USDC, "0x6cD5aC19a07518A8092eEFfDA4f1174C72704eeb"], // Diamond ]; return sumTokens2({ api, tokensAndOwners }); } // node test.js projects/gainsNetwork.js module.exports = { hallmarks: [ - [1672531200,"Launch on Arbitrum"] + [1672531200,"Launch on Arbitrum"], + [1705553229,"Launched gETH and gUSDC"], + [1727650801,"Launch on Base"], ], polygon: { tvl: polyTvl, @@ -49,4 +68,8 @@ module.exports = { tvl: arbiTvl, staking: staking(['0x6b8d3c08072a020ac065c467ce922e3a36d3f9d6', '0x7edDE7e5900633F698EaB0Dbc97DE640fC5dC015'], '0x18c11fd286c5ec11c3b683caa813b77f5163a122'), }, + base: { + tvl: baseTvl, + staking: staking(['0x28efAa11199DAF45AA8fBf95f920e5bc090DCbF3'], '0xFB1Aaba03c31EA98A3eEC7591808AcB1947ee7Ac'), + }, }; diff --git a/projects/galador-io/index.js b/projects/galador-io/index.js index 8d3f6eb06441..6e98786ece23 100644 --- a/projects/galador-io/index.js +++ b/projects/galador-io/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, mantle: { - tvl: getUniTVL({ factory: '0x6F602b6F11F174c627813262fA713F334ca20aA6', fetchBalances: true, useDefaultCoreAssets: true }), + tvl: getUniTVL({ factory: '0x6F602b6F11F174c627813262fA713F334ca20aA6', useDefaultCoreAssets: true }), }, }; \ No newline at end of file diff --git a/projects/gamblefi/index.js b/projects/gamblefi/index.js index 9e6513d03818..753272d60707 100644 --- a/projects/gamblefi/index.js +++ b/projects/gamblefi/index.js @@ -1,50 +1,20 @@ -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const sdk = require("@defillama/sdk"); const betifystaking = "0x335CAC92af7015BE7802170B62Ebc4C74900484d"; const betify = "0xD465b6B4937D768075414D413e981Af0b49349Cc"; const treasury = "0x596a6DFf0CF36fABf75EDeB6aA2992C950Ff14bA"; const dao = "0xEe376093ccDB3D81f226C2290868219687226845"; -const wBETSLIP = "0x3e7dfdd82965515e9b6398d91b991f5d4c830ef6"; const revenueShare = "0x40822C8E1389dE62980691bF0AFBd5B8D1D56cB7"; -async function tvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const transform = (addr) => - addr.toLowerCase() === "0xF2001B145b43032AAF5Ee2884e456CCd805F677D" - ? "0xF2001B145b43032AAF5Ee2884e456CCd805F677D" - : `cronos:${addr}`; - - await sumTokensAndLPsSharedOwners( - balances, - [ - // [usdc, false] - ["0xf2001b145b43032aaf5ee2884e456ccd805f677d", false], // DAI - ["0x76f0adfff61fd9a542a36a98b96909ec7d3a8c53", true], // BETIFY-DAI - ["0xe2c5275d86D2fB860F19a2CbBED9967d39AA73e8", true], // BETIFY-MMF - ["0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", false], // WCRO - ["0x3e7dfdd82965515e9b6398d91b991f5d4c830ef6", false], // wBETSLIP - ], - [treasury, dao, revenueShare], - chainBlocks.metis, - "cronos", - transform - ); - - const wbetslipAddress = transform(wBETSLIP); - - const betslip = await sdk.api.abi.call({ - target: wBETSLIP, - abi: 'function wBTSToBTS(uint256 _amount) view returns (uint256)', - chain: "cronos", - block: chainBlocks.cronos, - params: [sdk.util.convertToBigInt(balances[wbetslipAddress])], - }); - balances[transform(betify)] = betslip.output; - delete balances[wbetslipAddress]; - - return balances; +async function tvl(api) { + return api.sumTokens({ owners: [treasury, dao, revenueShare], tokens: [ + "0xf2001b145b43032aaf5ee2884e456ccd805f677d", + "0x76f0adfff61fd9a542a36a98b96909ec7d3a8c53", + "0xe2c5275d86D2fB860F19a2CbBED9967d39AA73e8", + ADDRESSES.cronos.WCRO_1, + "0x3e7dfdd82965515e9b6398d91b991f5d4c830ef6", + ] }) } module.exports = { cronos: { diff --git a/projects/gammaswap/index.js b/projects/gammaswap/index.js index 189b291cc641..2b3d893e3e07 100644 --- a/projects/gammaswap/index.js +++ b/projects/gammaswap/index.js @@ -1,5 +1,6 @@ const { getLogs } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const config = { arbitrum: { @@ -28,4 +29,6 @@ Object.keys(config).forEach(chain => { return sumTokens2({ ownerTokens, api, resolveLP: true, }) } } -}) \ No newline at end of file +}) + +module.exports.arbitrum.staking = staking("0x9b4D784E1cCaf038AEa4BFa837262704caF78B66", "0xb08d8becab1bf76a9ce3d2d5fa946f65ec1d3e83") \ No newline at end of file diff --git a/projects/garden/index.js b/projects/garden/index.js index a5244db1cc39..bb24cd53f2c0 100644 --- a/projects/garden/index.js +++ b/projects/garden/index.js @@ -1,17 +1,16 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/sumTokens"); const sdk = require("@defillama/sdk"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') 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] }), + sumTokensExport({ owners: bitcoinAddressBook.garden }), ]), }, ethereum: { diff --git a/projects/gaspump/index.js b/projects/gaspump/index.js new file mode 100644 index 000000000000..364e27923331 --- /dev/null +++ b/projects/gaspump/index.js @@ -0,0 +1,21 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { fetchURL } = require('../helper/utils'); + +async function fetchTvl(api) { + const response = await fetchURL("https://api.gas111.com/api/v1/internal/tokens/balances-list") + for (const pool of response.data) { + api.add(ADDRESSES.ton.TON, pool.bonding_curve_balance) + } +} + + +module.exports = { + methodology: ` + Each token launched via gaspump has a bonding curve. The TVL is the sum of all bonding curve balances. + It is slightly different from the address balance, which is composed from curve balance + fees accumulated. + `.trim(), + timetravel: false, + ton: { + tvl: fetchTvl + } +} diff --git a/projects/gate-io/index.js b/projects/gate-io/index.js index 7c7a17595643..b91e6d5440eb 100644 --- a/projects/gate-io/index.js +++ b/projects/gate-io/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -72,14 +73,7 @@ const config = { ] }, bitcoin: { - owners: [ - '14kmvhQrWrNEHbrSKBySj4qHGjemDtS3SF', - '162bzZT2hJfv5Gm3ZmWfWfHJjCtMD6rHhw', - '1EkkGXR7dTbZbrKFKoe6YEP4gj4GzMeKvw', - '1G47mSr3oANXMafVrR8UC4pzV7FEAzo3r9', - '1HpED69tpKSaEaWpY3Udt1DtcVcuCUoh2Y', - '3HroDXv8hmzKRtaSfBffRgedKpru8fgy6M', - ] + owners: bitcoinAddressBook.gateIo }, tron: { owners: [ @@ -108,6 +102,11 @@ const config = { 'rNnWmrc1EtNRe5SEQEs9pFibcjhpvAiVKF', 'rNu9U5sSouNoFunHp9e9trsLV6pvsSf54z', ] + }, + starknet: { + owners: [ + '0x00e91830f84747f37692127b20d4e4f9b96482b1007592fee1d7c0136ee60e6d' + ] } } diff --git a/projects/gearbox/index.js b/projects/gearbox/index.js index c524bc3bd53f..44405b03bf3b 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.2 + ** Binary release: https://github.com/Gearbox-protocol/defillama/releases/tag/v1.4.1 ** ** ** @@ -16,6 +16,7 @@ var getLogs = require("../helper/cache/getLogs"); var ADDRESS_PROVIDER_V3 = { ethereum: "0x9ea7b04da02a5373317d745c1571c84aad03321d", arbitrum: "0x7d04eCdb892Ae074f03B5D0aBA03796F90F3F2af", + optimism: "0x3761ca4BFAcFCFFc1B8034e69F19116dD6756726", }; // src/adapter/pools/abi.ts @@ -480,6 +481,9 @@ var adapter_default = { arbitrum: { tvl, }, + optimism: { + tvl, + }, methodology: `Retrieves the tokens in each Gearbox pool (WETH/DAI/WBTC/USDC/wstETH) & value of all Credit Accounts (V1/V2/V3) denominated in the underlying token.`, misrepresentedTokens: true, }; diff --git a/projects/geist/index.js b/projects/geist/index.js index b787ec300ab9..85b8b5e8c101 100644 --- a/projects/geist/index.js +++ b/projects/geist/index.js @@ -23,6 +23,7 @@ function lending(borrowed) { } module.exports = { + deadFrom: '2023-10-18', methodology: methodologies.lendingMarket, fantom: { tvl: lending(false), @@ -34,3 +35,5 @@ module.exports = { [1665090175, "BSC Bridge hacker deposits coins"] ], }; + +module.exports.fantom.borrowed = () => ({}) // bad debt diff --git a/projects/genesis-dao/index.js b/projects/genesis-dao/index.js new file mode 100644 index 000000000000..060d5973b47d --- /dev/null +++ b/projects/genesis-dao/index.js @@ -0,0 +1,18 @@ +const genAddress = '0x99999999999997fceB5549c58aB66dF52385ca4d'; +const sGenAddress = '0x8888888888888e9b808caA0a8BB7e2268fd17351'; + +async function stakedGen(api) { + const sGenSupply = await api.call({ + abi: 'erc20:totalSupply', + target: sGenAddress + }); + + api.add(genAddress, sGenSupply) +} + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: stakedGen + } +}; diff --git a/projects/ghost-ex/index.js b/projects/ghost-ex/index.js index 6185e9a65bf4..40a6fac188ce 100644 --- a/projects/ghost-ex/index.js +++ b/projects/ghost-ex/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xbf246e99a848d9bf592c216118973204162d9650", useDefaultCoreAssets: true, - fetchBalances: true, }), }, } diff --git a/projects/glorifinance/index.js b/projects/glorifinance/index.js index b01f0c7f7442..497c06162241 100644 --- a/projects/glorifinance/index.js +++ b/projects/glorifinance/index.js @@ -24,3 +24,5 @@ module.exports = mergeExports([ arbi_helper, { arbitrum: lend, } ]) +module.exports.deadFrom='2024-04-30', +module.exports.arbitrum.borrowed = () => ({}) // bad debt diff --git a/projects/gluon-gold/index.js b/projects/gluon-gold/index.js new file mode 100644 index 000000000000..04e44f05a728 --- /dev/null +++ b/projects/gluon-gold/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require('../helper/sumTokens') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ergo: { + tvl: sumTokensExport({ + owners: [ + 'E81MR2gGkYE1vDkdcGYns4wYehfJLdX6hpwHMGrhwKEirNBZ6JRUKopeU1i7jT4NkgdM8GpL8bhFCyXFJuSaj8tiWSs28rq6Go3H5regcwr67yWiAy97RmXh94ierf8YuELivuMfwkEZd4X81RrfFJ2GDKzxmSdqUP6D4mXqepnxWcCvqGgk7DR1tKKuBJNroWaDSuDwrKASw68KuGspCbd1pgHs2iWzxirT4NTXq2rfPqmSJ7cqUQnd1mamB583H2ZC4esNzjqyMcvsQi6QFePSg8bwYbCTs4e8Nz42bZoUNQktFpteqwhcA5NRwXN7vDVQBGgHXr8KY3fDKmhoQiwTbrZLB5qzJ1UpCoAd4h88CERG7VbH4z5nyJC5c3j1SuEE5dSXPNtYR6yiGhNq2TCHNb24f5eZcBpBUQ6qviecoDtxPb78qnR2gBn4HcHGBWBZxfXJ3ZC7NPtNWreWWPuGMF5QF7EgswjALFHNDzRdkJpbsbrdaVbFNq9vC6Adug2P5NXnBjsr7wYTQrB4neWFNLS4vWQqgTYu3Cuap1V7mc13u7tK6X3s1wod6psy6cTWak1SEYtUcjwwvjHhQqn8R2D9G81jiH7efpCt9JdgCYoamioDfLaTFx7S2Su55bjLaD8JLsUyNL1LkDcmcUfhtiTAkM1mUDGswAHk6wDtoVUEuR59T94LUv9SFddZ2p1vJYi32AUAEZu66UiGkGeBDnNSq38mgiwta1X6SsNtv1mgZjkLx45Vun538ekYwWZ51EcvRgMScogtZ5xBDk1RRPn3HkXQLWGKr4yEFSwjuDNy8d4LbWUJ8n4prMvxQ8G5h7rUj9dJ5kz7YzKZRNF5VBmCAacYocgUUnEwQbVbkvFDDt7FQAQnNmY7tyjDQEJaeAviWp2Gtoewh7ShDDLgX69gB9XcAjuYn9Tbfvm6FLnfNE9qusqL76GnaPeJRf6LNR6JczQVBGhS4NUy6sBSSfq4oWFYbShUGTe3zLG9JFMcdAKZR7NwyHyKBM5Zj5w5kXroL1xLPahxBz6hiQmz9xcJGGWNQsNR2Acirx3PmQ1V23sSqjhLmDMRVYquStc8o86JUH7KzBjm12nAfdq4pN6LAfKdCvLwdQQn9MQxmcquog9EiQccdURgF9NJK1CwWgcgrfXLtSkm5JwbTPgQjd5HFR9y26DtLJr36RWZHrbv9zvv9GawT3J2jWQEk9Ue41zMRp9jjMP57S4JdWdVvPuxYSJf2e7y4diN9w3XxQYZv21Eq91DduD9dWE7aYbdJiXu2DpM8VRdTpC9K3xXhzSkczHWKpftYZyNQq8KQsQBPHLc5pQFfi7Fqr4YCPk4ZFmRSiY6MsnkJc2rtzYAi9BKh9wAGZteAE8oWqphhiTBbEwHUiZdXAKe1BSPrQFsrc2Q6oizcgwm4rjmESMv3PGoQCpCAuvQL1kd9TULwsng7vRyMsUUh2KvCFSHrpqaDEpXEXH5rjFRzzwL2FBU6VATpeDj2BBS5NcxwrDqCcbEBerq3QYHSkQr1dd3MeATt5HzaGyA8xLvfohHdgZ4rWGT9zQf7rCk2xPeh1G8KRqSEDE4SUtBZxZbxF34dPxJDr4xqzjG2FKPtptkmXrBWNV3DVxPn5V8WL8bCo6HraLdUcmDJN7kn8dYSEgFhr4nwtCt4yKdsVtmAHEMhaMmGVRd92kiE5Xtc2ey3ZsHuWHRQX1T5Dw8xCCJngGcas3eMMr2J2N8cYFJkqCzuNPn8JZM9wqQBNay7ygsSR8Jj2ffo6veKRZSkcLzpCLWrxYj7LhMRxLkxLGY64GmWXL1aoyjQar3mFph6ZYmYUD3G934YTRKkUpV56VsNmSVxrNFbRCEotZ2s5Xzn5UJDU3NtaqDE4WqckKK7AXXB7DTLKfwT39RxjFep7xep6HThP7TfhL15KwB1RhgYF8cmExFwWoiMKsGkF9P3Jy6PZBVa4pWEXGCF8pUfprjKUffUm8wa8c4UQXNKSGd19y9sscamFqa5iEsxmDFXti6bqcGmG58ggneM8k9P91QBzoMy1JZFxv955n9CQV27wWJmaWRErjrpbtgJQmVx1fhQDCmQJvTHduSYmZBjYRi7TrYkjfBc1pheMgH6uzxJ6LJ92T7B1kPqvMTwiDareuW7mcR9rNwUNorWZMvH8uACNd1sqoERGtfVLkNTirmWJ6nfnqw1WPPgiCQ5nBcixusHy26btdvEVmjDjx9iNb3RPJKCiDbQLBq1yZEbyTCu8T9yRXvCexFqz4DPN5NmjFFPvPtgmvpds1DEdGVVTfwAY4THxLTVyD4z87FEk5gGzn1Csod1ZDNctHpYpPpfk9CVgzXwp3z2D75KJvNu9jUVvMyVBS53WdnELYwcEsWdappt9y2fmefQmYuAww3ekvFGDA4KnxfpCCixHMcrSZX6khifCuqn6prTDFDAT7ssCt7QJKB7KpGreh9tE7SHqSAAkPUuiJNHqn6xPHVKFGmrV5fjy1zNMGLdpebEL5f37jXzPGCpmRXJ9ZCz3REznoZNNg1o4UJoACKuvcfbcg91CMZS6ZvhNp6WXYMNSZqgCcGpkTSS5Dvy5hHTy71bJhSoQPvusCP8v5C5ammcpiDSHeKoKyUJy5JghCnAiAYqZoN9MMATR64YmBqmzFxVqHdE9WqYYwkt7EerA2szprVoh5UwWfUFMkyCiAUUxmYdPodLpYaVZwBcMv5SiZuWEnX51H1oowEVj7qhr3SGRapBpYZmiLDdVSKtqru11XfQJfbCiG4uYk3U9ZsvzcZv5oXTmKCB4XEKFv7bK8w3wbpmgBCYJMZZ5JrTE8iZKKgL3TmiM9q2v1ggxtVq932axuw4ncELjL6oJ4Bo7Uck2zogD11KvhTGuSHwBk84cUpqCMSsauFiVSaZ47uYXKdAXNZKF3JRvzNjGePgDRnPMMruyztbNfNgRM3fz39s6NYRVGMth6MS5jbw1PYkYhp4nv66bjPpU7tGXuy6JhsT3iAZ52nKzNN88pPKJVMhi9mtA5hQtmTNfzQGZtC7EfVz5yd7TKXgPhUaCYD4KQSKASvi66nwkee1NUDPPA6kYU12ppV6PCzXg3Q6AX5mWPQv8eAg5PxUVCvAvRpuvZNUZWRCbJxgQEgNRfCYbsdT27z4MFttDw54bPDNZfWcNBP7Q6FRq5iJ6EcaXGof3sWPvjKXQ3G3VGBBJ4JhkzAFMcv274tnCMvfE6xQt4DDHFsWjTHbR4Mp8UZ49gDnUWqtMPH1KVXFQKJdDBUTmDrBSM3u33Ed3dKefqzeqWvhLvXVnfdSrUJhqa3bFsKzwMyeGjxdyuide5rZRff4JsT5Hb8erq4qUwckcWErv6L4kgJZc6MWREswrQn4KbrDHNUU1RxXzCKnhQfYMsKQT11XKB2uwHnF4b1CTkTJhafQSxiHFGA4KTP1qpftK3HtJaDRnw7wGoJqVoptAgBC6hmbWd1SdqDHC2e5dQUvXDciqkAv8vwWMxK6UWXzPkv4MMf11Dnmh1PFtbnZ26sJmoPwp4gWmWsidqtGvKRYdFiadMSAWfkpTQnWmQV5tBU51SbFMihDhSYHc835fVvEHZWzZUj2FhqSazJaoCgPiaQN38zeJ4SE2rZ8vhXy4m2UXuB1ZjsvHVqLJvmbgC33CqEMicoT4P4vjuhHUsVuwspcWYkW87ZaCj5qMfqxt4ZnygnGssjsQfXK6GMtNeR4iDJK9qHncBbJ5ye5Lih2tyU1JFB2FcZYB7dQSHGpUS6bMFktFNgPhCZ5CGjgCiKQAYBe4jx6TJDinLjWQ9P', + ], + tokens: [ADDRESSES.null], + }) + } +} \ No newline at end of file diff --git a/projects/goldbank/index.js b/projects/goldbank/index.js index bc8ad244898b..12bfafede893 100644 --- a/projects/goldbank/index.js +++ b/projects/goldbank/index.js @@ -5,9 +5,12 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-06-11') / 1e3), 'Project rugged'], ], + deadFrom: '2023-06-11', methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", arbitrum: { - ...compoundExports(unitroller, "arbitrum"), + ...compoundExports(unitroller), }, -}; \ No newline at end of file +}; + +module.exports.arbitrum.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/goldlink/index.js b/projects/goldlink/index.js index d698d4a49199..bfcf494ed2cf 100755 --- a/projects/goldlink/index.js +++ b/projects/goldlink/index.js @@ -7,4 +7,7 @@ module.exports = { arbitrum: { tvl: sumERC4626VaultsExport({ vaults: ['0xd8dd54df1a7d2ea022b983756d8a481eea2a382a',], isOG4626: true, }), }, + avax: { + tvl: sumERC4626VaultsExport({ vaults: ['0xbE6eB54D1e96CC59338BE9A281d840AcE82df095',], isOG4626: true, }), + } } \ No newline at end of file diff --git a/projects/goldstation-dex/index.js b/projects/goldstation-dex/index.js new file mode 100644 index 000000000000..7a965859b339 --- /dev/null +++ b/projects/goldstation-dex/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require('../helper/unknownTokens'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + misrepresentedTokens: true, + klaytn: { + tvl: getUniTVL({ factory: '0x347E5ce6764DF9DF85487BEA523D3e242762aE88', useDefaultCoreAssets: true }), + staking: sumTokensExport({ tokensAndOwners: [ + ['0x4836cc1f355bb2a61c210eaa0cd3f729160cd95e', '0x4d55B04AC52b2CA41ad04337FF13CbAefbdC8954'], + ]}) + } +} + diff --git a/projects/goldstation-rwa/index.js b/projects/goldstation-rwa/index.js new file mode 100644 index 000000000000..ba828d7a0344 --- /dev/null +++ b/projects/goldstation-rwa/index.js @@ -0,0 +1,19 @@ +const { sumUnknownTokens } = require('../helper/unknownTokens'); + +const GPC = '0x27397bfbefd58a437f2636f80a8e70cfc363d4ff'; + +async function tvl(api) { + const supply = await api.call({ abi: 'erc20:totalSupply', target: GPC }) + api.add(GPC, supply) + + const lps = ['0xCd13CD31fb61345Abe7B7376A4664784622817EE'] + return sumUnknownTokens({ api, lps, useDefaultCoreAssets: true }) +} + +module.exports = { + misrepresentedTokens: true, + klaytn: { + tvl, + } +} + diff --git a/projects/goldstation-staking/index.js b/projects/goldstation-staking/index.js new file mode 100644 index 000000000000..8a2dba4ab12d --- /dev/null +++ b/projects/goldstation-staking/index.js @@ -0,0 +1,11 @@ +const klayStakingContract = '0x6569B14043c03537B5B125F5Ac5De3605a47dC76'; + +async function tvl(api) { + const totalStaked = await api.call({ target: klayStakingContract, abi: "uint256:totalStaked", }); + api.addGasToken(totalStaked); +} + +module.exports = { + klaytn: { tvl } +} + diff --git a/projects/goose-farm/index.js b/projects/goose-farm/index.js new file mode 100644 index 000000000000..3da68cd42f52 --- /dev/null +++ b/projects/goose-farm/index.js @@ -0,0 +1,25 @@ +const chainList = [ + {symbol: 'bsc', address: '0x0874f961178879cdbde3500544c49f864f232899', decimals: 18,}, + {symbol: 'ethereum', address: '0xe8a01d8dac4af19ec7a22cf87f3d141ce6e7e9fb', decimals: 6}, + {symbol: 'arbitrum', address: '0x0874F961178879cDbDe3500544C49F864F232899', decimals: 6}, + {symbol: 'op_bnb', address: '0x857aB0b4F236F7DD7E5AC5F96C0bbEbF230c2D3B', decimals: 18}, +] + +const getTvl = async (api, chain) => { + const lpToken= await api.call({ abi: 'address:lpToken', target: chain.address}) + const token= await api.call({ abi: 'address:token', target: chain.address}) + const supply= await api.call({ abi: 'uint256:totalSupply', target: lpToken}) + const price= await api.call({ abi: 'uint256:price', target: lpToken}) + api.addTokens(token, supply * price/Math.pow(10, chain.decimals)); +} + +const tvlFunctions = chainList.reduce((acc, chain) => { + acc[chain.symbol] = { + tvl: async (api) => getTvl(api, chain) + } + return acc; +}, {}); + +module.exports = { + ...tvlFunctions, +}; \ No newline at end of file diff --git a/projects/gracy-staking/index.js b/projects/gracy-staking/index.js index dd0adac97c14..74ab5df19869 100644 --- a/projects/gracy-staking/index.js +++ b/projects/gracy-staking/index.js @@ -5,15 +5,13 @@ const STAKING_CONTRACT_SEASON_1 = "0x76A2A3ebeCc73871cc24e4807C4cBA57D03b0b2c"; const STAKING_CONTRACT_SEASON_2 = "0xa0EE760C52b10d2A21E563526248CA389D9C47E6"; const STAKING_CONTRACT_SEASON_3 = "0xAb6aD663b42c7031b52737cbcBF9f70cb88fD9FC"; const STAKING_CONTRACT_SEASON_4 = "0x4f1043ABb51648E817b8e62EcABc157F91E61c52"; +const STAKING_CONTRACT_SEASON_5 = "0x6e05d3a61f5026EEa67d0a82843d5E82eb3E2608"; +const STAKING_CONTRACT_SEASON_6 = "0xE5ff1432DC7BE35CC73216A8cc468608398AD433"; module.exports = { - ethereum: { - tvl: () => ({}), - staking: stakings([ - STAKING_CONTRACT_SEASON_1, - STAKING_CONTRACT_SEASON_2, - STAKING_CONTRACT_SEASON_3, - STAKING_CONTRACT_SEASON_4, - ], GRACY_TOKEN), - }, + ethereum: { + tvl: () => ({}), + staking: stakings([STAKING_CONTRACT_SEASON_1, STAKING_CONTRACT_SEASON_2, STAKING_CONTRACT_SEASON_3, STAKING_CONTRACT_SEASON_4, STAKING_CONTRACT_SEASON_5, STAKING_CONTRACT_SEASON_6, + ], GRACY_TOKEN), + }, }; diff --git a/projects/grafun/index.js b/projects/grafun/index.js new file mode 100644 index 000000000000..fb73c3eea577 --- /dev/null +++ b/projects/grafun/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') +module.exports = { + methodology: "TVL is calculated by aggregating the market value of BNB tokens held within the Token Sale Factory smart contract.", + start: 42593135, + bsc: { + tvl: sumTokensExport({ owner: '0x8341b19a2A602eAE0f22633b6da12E1B016E6451', token: nullAddress }) + } +}; diff --git a/projects/grape-finance/index.js b/projects/grape-finance/index.js index 3e8edd942034..6a2164ea145a 100644 --- a/projects/grape-finance/index.js +++ b/projects/grape-finance/index.js @@ -1,4 +1,4 @@ -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const { staking } = require("../helper/staking"); const grape = "0x5541D83EFaD1f281571B343977648B75d95cdAC2"; @@ -15,7 +15,7 @@ const LPTokens = [ module.exports = { avax:{ tvl: async () => ({}), - pool2: pool2Exports(rewardpool, LPTokens, "avax"), + pool2: pool2(rewardpool, LPTokens, "avax"), staking: staking(boardroom, wine) } } \ No newline at end of file diff --git a/projects/grave/index.js b/projects/grave/index.js index 559c5d3f7118..dda9c9f03a9c 100644 --- a/projects/grave/index.js +++ b/projects/grave/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakingPricedLP } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const GRAVE = "0x3700a92dd231F0CaC37D31dBcF4c0f5cCb1db6Ca" const GSHARE = "0xffe04bf98c7111360bf7a6c56b343915543cd941" @@ -13,26 +12,13 @@ const graveAvaxLp = "0x10e882acfae3cf63e96741fabc41c19025e7be2a" const gShareAvaxLp = "0xae427ad7a54f5490ef76b3bde3663b0e45c7a102" -async function atvl(timestamp, block, chainBlocks) { - const balances = {}; - const transform = addr => 'avax:'+addr; - await sumTokensAndLPsSharedOwners( - balances, - [ - [ADDRESSES.avax.WAVAX, false], - [ADDRESSES.avax.USDC_e, false], - [ADDRESSES.avax.JOE, false], - ["0x070092b3A985f9E5424351D68730c9A318ad96eb", false], - - ], - [GenMasterchef], - chainBlocks.avax, - "avax", - transform, - ); - - - return balances; +async function atvl(api) { + return api.sumTokens({ owner: GenMasterchef, tokens: [ + ADDRESSES.avax.WAVAX, + ADDRESSES.avax.USDC_e, + ADDRESSES.avax.JOE, + "0x070092b3A985f9E5424351D68730c9A318ad96eb", + ]}) } const pool2LPs = [ @@ -43,7 +29,7 @@ const pool2LPs = [ module.exports = { avax:{ tvl: atvl, - pool2: pool2Exports(GShareRewardPool,pool2LPs,"avax"), + pool2: pool2(GShareRewardPool,pool2LPs,"avax"), staking: stakingPricedLP(ASYLUM, GSHARE, "avax", gShareAvaxLp, "wrapped-avax") } }; \ No newline at end of file diff --git a/projects/gravita-protocol/index.js b/projects/gravita-protocol/index.js index e8ad230f8197..05686b9570d2 100644 --- a/projects/gravita-protocol/index.js +++ b/projects/gravita-protocol/index.js @@ -1,4 +1,5 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumERC4626Vaults } = require("../helper/erc4626"); const ADMIN_ADDRESSES = { arbitrum: "0x4928c8F8c20A1E3C295DddBe05095A9aBBdB3d14", @@ -10,18 +11,20 @@ const ADMIN_ADDRESSES = { mantle: "0x4F39F12064D83F6Dd7A2BDb0D53aF8be560356A6", }; +const erc4626Vaults = { + ethereum: [ + "0xBB22d59B73D7a6F3A8a83A214BECc67Eb3b511fE", // WETH Vault - constellation + "0x1DB1Afd9552eeB28e2e36597082440598B7F1320", // RPL Vault - constellation + ] +} + async function tvl(api) { const adminContract = ADMIN_ADDRESSES[api.chain]; - const collAddresses = await api.call({ - abi: "address[]:getValidCollateral", - target: adminContract, - }); - const activePool = await api.call({ - abi: "address:activePool", - target: adminContract, - }); - const balances = await sumTokens2({ api, tokens: collAddresses, owner: activePool }); - return balances + const vaults = erc4626Vaults[api.chain] ?? [] + const collAddresses = await api.call({ abi: "address[]:getValidCollateral", target: adminContract, }); + const activePool = await api.call({ abi: "address:activePool", target: adminContract, }); + await sumTokens2({ api, tokens: collAddresses, owner: activePool, }); + await sumERC4626Vaults({ api, calls: vaults, isOG4626: true,}); } module.exports = { diff --git a/projects/gudchain/index.js b/projects/gudchain/index.js index 3d6d22fec118..05acdf355112 100644 --- a/projects/gudchain/index.js +++ b/projects/gudchain/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs"); const launchBridge = "0xd759e176DEF0F14e5C2D300238d41b1CBB5585BF"; @@ -8,14 +9,14 @@ module.exports = { owner: launchBridge, start: 20203960, tokens: [ - "0x0000000000000000000000000000000000000000", - "0xae7ab96520DE3A18E5e111B5EaAb095312D7fE84", + ADDRESSES.null, + ADDRESSES.ethereum.STETH, "0xa2E3356610840701BDf5611a53974510Ae27E2e1", "0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa", - "0x6B175474E89094C44Da98b954EedeAC495271d0F", - "0x83F20F44975D03b1b09e64809B757c47f942BEeA", - "0xdAC17F958D2ee523a2206206994597C13D831ec7", - "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.SDAI, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC ] }) } diff --git a/projects/h2-finance/index.js b/projects/h2-finance/index.js new file mode 100644 index 000000000000..6f884585f9cd --- /dev/null +++ b/projects/h2-finance/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports= uniTvlExport('cronos_zkevm', '0x50704Ac00064be03CEEd817f41E0Aa61F52ef4DC') \ No newline at end of file diff --git a/projects/h2-v3/index.js b/projects/h2-v3/index.js new file mode 100644 index 000000000000..6e444b0a3a66 --- /dev/null +++ b/projects/h2-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + cronos_zkevm: { + factory: "0x301cbe34dd38Cf69295Bf2698DC9be3B9EECEdFa", + fromBlock: 79, + }, +}); \ No newline at end of file diff --git a/projects/hades-money/index.js b/projects/hades-money/index.js index 991b828d2a9f..f1389c2562cc 100644 --- a/projects/hades-money/index.js +++ b/projects/hades-money/index.js @@ -1,5 +1,5 @@ const { staking } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const hades = "0x88C37E0bc6a237e96bc4A82774A38BBc30efF3Cf"; const hellshare = "0xEfB15eF34f85632fd1D4C17FC130CcEe3D3D48aE"; @@ -15,6 +15,6 @@ module.exports = { metis: { tvl: async () => ({}), staking: staking(masonry, hellshare), - pool2: pool2Exports(hellsharerewardpool, pool2LPs, "metis") + pool2: pool2(hellsharerewardpool, pool2LPs, "metis") } } \ No newline at end of file diff --git a/projects/halotrade-v3/index.js b/projects/halotrade-v3/index.js new file mode 100644 index 000000000000..7987242427cf --- /dev/null +++ b/projects/halotrade-v3/index.js @@ -0,0 +1,29 @@ +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') +const { sumTokens2 } = require('../helper/unwrapLPs') + +module.exports = { + aura: { tvl }, +} + +async function tvl(api) { + const pools = await getConfig('halo-trade/uni-v3-pools', undefined, { + fetcher: async () => { + let page = 0 + let size = 100 + let hasMore = true + const pools = [] + do { + const { data: { res: { results } } } = await get(`https://api.halotrade.zone/api/v1/evm/univ3/halo-pool/poolList?page=${page}&pageSize=${size}`) + page++ + hasMore = results.length === size + pools.push(...results.map(i => i.poolContractAddr)) + } while (hasMore) + return pools + } + }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: pools }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: pools }) + const ownerTokens = pools.map((v, i) => [[token0s[i], token1s[i]], v]) + return sumTokens2({ api, ownerTokens }) +} \ No newline at end of file diff --git a/projects/harbor-protocol.js b/projects/harbor-protocol.js index 5894faf0485f..7f365981c0c8 100644 --- a/projects/harbor-protocol.js +++ b/projects/harbor-protocol.js @@ -10,5 +10,7 @@ async function tvl({ chain }) { } module.exports = { + deadFrom: "2024-09-17", + hallmarks: [[1692403200, "Exploit on Harbor Protocol"]], comdex: { tvl } } \ No newline at end of file diff --git a/projects/harmony-swap/index.js b/projects/harmony-swap/index.js new file mode 100644 index 000000000000..93d1e4e2ec10 --- /dev/null +++ b/projects/harmony-swap/index.js @@ -0,0 +1,5 @@ +const { uniV3Export, uniV3GraphExport } = require("../helper/uniswapV3"); + +module.exports = { + harmony: { tvl: uniV3GraphExport({ graphURL: 'GVkp9F6TzzC5hY4g18Ukzb6gGcYDfQrpMpcj867jsenJ', name: 'harmony-swap' }) } +} \ No newline at end of file diff --git a/projects/hashkey-exchange/index.js b/projects/hashkey-exchange/index.js index 2786278e13d7..3057fb06a9e8 100644 --- a/projects/hashkey-exchange/index.js +++ b/projects/hashkey-exchange/index.js @@ -1,4 +1,5 @@ const { cexExports } = require("../helper/cex"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { avax: { @@ -8,12 +9,7 @@ const config = { ], }, bitcoin: { - owners: [ - "bc1qqe394jlqq86muq23d4vrnhzzvcv8jnepgt8lx7", - "1NfJSiqBw4fb74KgVQrPsk5W5aqitAD1Xv", - // "bc1qlrawqecuwgpzzwh04pkhtfsqsk33kald22ds3c", // bosera funds https://www.bosera.com/english/index.html - "18oxobhCNKnHjb7nEFDmPdXbCZthFWezrm", - ], + owners: bitcoinAddressBook.hashkeyExchange }, ethereum: { owners: [ diff --git a/projects/hashkey/index.js b/projects/hashkey/index.js index 5694e7c5e023..e47181151c5d 100644 --- a/projects/hashkey/index.js +++ b/projects/hashkey/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -8,10 +9,7 @@ const config = { ], }, bitcoin: { - owners: [ - "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", - "1DywJMqHHMWuP7xyfkRqJZCEe7GdEKFRcp" - ], + owners: bitcoinAddressBook.hashkey, }, litecoin: { owners: [ diff --git a/projects/hbtc.js b/projects/hbtc.js index c75e4383f43a..9fc2122d5820 100644 --- a/projects/hbtc.js +++ b/projects/hbtc.js @@ -1,9 +1,7 @@ -const sdk = require('@defillama/sdk') - -async function tvl(ts, block) { - return { - '0x0316EB71485b0Ab14103307bf65a021042c6d380': (await sdk.api.erc20.totalSupply({ target: '0x0316EB71485b0Ab14103307bf65a021042c6d380', block })).output - } +async function tvl(api) { + const hbtc = '0x0316EB71485b0Ab14103307bf65a021042c6d380' + const supply = await api.call({ abi: 'erc20:totalSupply', target: hbtc }) + api.add(hbtc, supply) } module.exports = { diff --git a/projects/headstarter/index.js b/projects/headstarter/index.js new file mode 100644 index 000000000000..4b58cc3448b5 --- /dev/null +++ b/projects/headstarter/index.js @@ -0,0 +1,70 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const STAKING_CONTRACT = "0x000000000000000000000000000000000070eac5"; +const HST = "0x00000000000000000000000000000000000ec585"; + +const ENTITIES = [ + { + token: "0x000000000000000000000000000000000048fda4", + contracts: [ + "0x00000000000000000000000000000000004e3387", + "0x00000000000000000000000000000000004e3395", + "0x00000000000000000000000000000000004d6daa", + "0x0000000000000000000000000000000000575c04", + ], + }, + { + token: "0x000000000000000000000000000000000030fb8b", + contracts: [ + "0x00000000000000000000000000000000005737f0", + "0x00000000000000000000000000000000005737e1", + "0x0000000000000000000000000000000000571a8d", + "0x0000000000000000000000000000000000571a8a", + "0x000000000000000000000000000000000056d9ea", + "0x0000000000000000000000000000000000575c04", + ], + }, + { + token: "0x00000000000000000000000000000000005c9f70", + contracts: [ + "0x00000000000000000000000000000000005cb45b", + "0x00000000000000000000000000000000005cb45f", + "0x0000000000000000000000000000000000575c04", + ], + }, +]; + +const HST_ENTITIES = [ + { + token: HST, + contracts: [ + STAKING_CONTRACT, + "0x00000000000000000000000000000000000f5ad1", + "0x00000000000000000000000000000000000fc16c", + "0x0000000000000000000000000000000000101201", + "0x0000000000000000000000000000000000575c04", + ], + }, +]; + +const getTokensAndOwners = (entities) => { + return entities.map(({ token, contracts}) => contracts.map(i => [token, i])).flat(); +}; + +const tvl = async (api) => { + const tokensAndOwners = getTokensAndOwners(ENTITIES); + return sumTokens2({api, tokensAndOwners }); +}; + +const staking = async (api) => { + const tokensAndOwners = getTokensAndOwners(HST_ENTITIES); + return sumTokens2({api, tokensAndOwners }); +}; + +module.exports = { + methodology: "We count the HST tokens locked in the HeadStarter contracts.", + hedera: { + tvl, + staking, + }, +}; diff --git a/projects/hedgehog-markets/index.js b/projects/hedgehog-markets/index.js new file mode 100644 index 000000000000..a700868ce533 --- /dev/null +++ b/projects/hedgehog-markets/index.js @@ -0,0 +1,146 @@ +const { PublicKey } = require("@solana/web3.js"); +const { getProvider, sumTokens2, getConnection, decodeAccount } = require("../helper/solana"); +const { Program } = require("@project-serum/anchor"); + +async function tvl(api) { + const provider = getProvider(); + const connection = getConnection(); + + const tokenAccounts = []; + const owners = []; + + await getClassicMarketTokenAccounts(); + await addP2PDepositTokenAccounts(); + await addP2PLuloBalances(); + await addParlay(); + await addParimutuel(); + + const balances = api.getBalances(); + + await sumTokens2({ owners, balances }); + + return sumTokens2({ tokenAccounts, balances }); + + async function getClassicMarketTokenAccounts() { + const classicMarketProgramId = "D8vMVKonxkbBtAXAxBwPPWyTfon8337ARJmHvwtsF98G"; + const idl = await Program.fetchIdl(classicMarketProgramId, provider); + + const program = new Program(idl, classicMarketProgramId, provider); + const markets = await program.account.market.all(); + const collateralAccounts = markets.map(({ account }) => account.marketCollateral); + tokenAccounts.push(...collateralAccounts); + } + + + async function addP2PDepositTokenAccounts() { + const programId = new PublicKey("P2PototC41acvjMc9cvAoRjFjtaRD5Keo9PvNJfRwf3"); + + const result = await connection.getProgramAccounts(programId, { + encoding: "base64", + // We only care about the market addresses. + dataSlice: { offset: 0, length: 0 }, + filters: [ + // Market accounts have a discriminator of 3 at offset 0. + { memcmp: { offset: 0, bytes: "4" } }, + ], + }); + + for (const { pubkey } of result) { + // Market deposit account. + const [deposit] = PublicKey.findProgramAddressSync( + [Buffer.from("deposit"), pubkey.toBuffer()], + programId, + ); + + tokenAccounts.push(deposit); + } + } + + async function addParlay() { + const programId = new PublicKey("PLYaNRbQs9GWyVQdcLrzPvvZu7NH4W2sneyHcEimLr7"); + const poolOwner = "8Y46GkrbUqXnbs6kPD6SWr44NjcKPEWYzvpAn8UB5duR"; + owners.push(poolOwner); + + const accounts = await connection.getProgramAccounts(programId, { + // We only care about: + // - mint address (69..101) + // - entry count (101..105) + // - entry cost (105..113) + dataSlice: { offset: 69, length: 44 }, + filters: [ + // Market accounts have a discriminator of 3 at offset 0. + { memcmp: { offset: 0, bytes: "4" } }, + // Open markets have a state of 0 at offset 149. + { memcmp: { offset: 149, bytes: "1" } }, + ], + }); + + accounts.forEach(({ account }) => { + const data = decodeAccount("hhParlay", account); + + api.add(data.mint.toString(), Number(data.entryCount) * Number(data.entryCost)); + }); + } + + async function addP2PLuloBalances() { + // https://github.com/Hedgehog-Markets/hedgehog-program-library/blob/master/p2p/idl.json + const programId = new PublicKey("P2PzLraW8YF87BxqZTZ5kgrfvzcrKGPnqUBNhqmcV9B"); + const poolOwner = "J9EH18EWSo8s69gouHGNy5zFHkhcHRbb9zBZXwSG4cHy"; + owners.push(poolOwner); + + const accounts = await connection.getProgramAccounts(programId, { + // We only care about: + // - mint address (73..105) + // - yes amount (113..121) + // - no amount (121..129) + dataSlice: { offset: 69, length: 56 }, + filters: [ + // Market accounts have a discriminator of 3 at offset 0. + { memcmp: { offset: 0, bytes: "4" } }, + // Open markets have a state of 0 at offset 129. + { memcmp: { offset: 129, bytes: "1" } }, + ], + }); + + accounts.forEach(({ account: { data } }) => { + const mint = new PublicKey(data.slice(0, 32)).toString(); + const yesAmount = Number(data.readUInt8(40)); + const noAmount = Number(data.readUInt8(48)); + api.add(mint, yesAmount + noAmount); + }); + } + + async function addParimutuel() { + const programId = new PublicKey("PARrVs6F5egaNuz8g6pKJyU4ze3eX5xGZCFb3GLiVvu"); + const poolOwner = "3SAUPiGiATqv8TBgvzSJqpLxLGF6LbJamvimueJQT7WT"; + owners.push(poolOwner); + + const accounts = await connection.getProgramAccounts(programId, { + filters: [ + // Market accounts have a discriminator of 3 at offset 0. + { memcmp: { offset: 0, bytes: "4" } }, + // Open markets have a state of 0 at offset 149. + { memcmp: { offset: 149, bytes: "1" } }, + ], + }); + + accounts.forEach(({ account: { data } }) => { + const token = new PublicKey(data.slice(69, 69 + 32)).toString(); + // Amounts is a u64 array with u8 length prefix at offset 131. + const amountsLen = data.readUint8(131); + + let amounts = []; + for (let i = 0; i < amountsLen; i++) { + amounts.push(data.readBigUint64LE(132 + i * 8).toString()); + } + + api.add(token, amounts); + }); + } +} + +module.exports = { + timetravel: false, + solana: { tvl }, + methodology: "TVL consists of deposits made into Hedgehog Markets.", +}; diff --git a/projects/helio-money/index.js b/projects/helio-money/index.js index a780961f1417..94e1253e48de 100644 --- a/projects/helio-money/index.js +++ b/projects/helio-money/index.js @@ -1,66 +1,97 @@ const ADDRESSES = require("../helper/coreAssets.json"); +const { staking } = require("../helper/staking"); const { sumTokensExport } = require("../helper/unknownTokens"); +const lisLPs = [ + "0xe8f4644637f127aFf11F9492F41269eB5e8b8dD2", // Lista LP Stable-LP + "0xFf5ed1E64aCA62c822B178FFa5C36B40c112Eb00", // Lista LP aSnBNB-WBNB + "0x4b2D67Bf25245783Fc4C33a48962775437F9159c", // Lista LP aUSDT-LISTA + "0xC23d348f9cC86dDB059ec798e87E7F76FBC077C1", // Lista LP aHAY-USDT + "0xF6aB5cfdB46357f37b0190b793fB199D62Dcf504", // Lista LP UV-17-THE + "0x1Cf9c6D475CdcA67942d41B0a34BD9cB9D336C4d", // Lista LP sAMM-HAY/FRAX + ]; + +const abi = { + lpToken: "address:lpToken", + lpTotalSupply: "uint256:lpTotalSupply", +}; + +const pool2 = async (api) => { + const [lisLpTokens, lisLpBalances] = await Promise.all([ + api.multiCall({calls: lisLPs.map((lis) => ({ target: lis })), abi: abi.lpToken }), + api.multiCall({calls: lisLPs.map((lis) => ({ target: lis })), abi: abi.lpTotalSupply }), + ]); + + lisLPs.forEach((_lp, i) => { + api.add(lisLpTokens[i], lisLpBalances[i]) + }) +} + module.exports = { - 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"] - ], - bsc: { - tvl: sumTokensExport({ - tokensAndOwners: [ - // BNB - [ADDRESSES.null, "0x986b40C2618fF295a49AC442c5ec40febB26CC54"], + 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"] + ], + bsc: { + tvl: sumTokensExport({ + tokensAndOwners: [ + // BNB + [ADDRESSES.null, "0x986b40C2618fF295a49AC442c5ec40febB26CC54"], - //slisBNB - [ - "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B", - "0x6F28FeC449dbd2056b76ac666350Af8773E03873", - ], + //slisBNB + [ + "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B", + "0x6F28FeC449dbd2056b76ac666350Af8773E03873", + ], - // slisBNB - [ - "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B", - "0x91e49983598685DD5ACAc90CEb4061A772f6E5Ae", - ], + // slisBNB + [ + "0xB0b84D294e0C75A6abe60171b70edEb2EFd14A1B", + "0x91e49983598685DD5ACAc90CEb4061A772f6E5Ae", + ], - // eth - [ADDRESSES.bsc.ETH, "0xA230805C28121cc97B348f8209c79BEBEa3839C0"], + // eth + [ADDRESSES.bsc.ETH, "0xA230805C28121cc97B348f8209c79BEBEa3839C0"], - // eth => wBETH - [ - "0xa2E3356610840701BDf5611a53974510Ae27E2e1", - "0xf45C3b619Ee86F653805E007fE211B7e930E0b3B", - ], + // eth => wBETH + [ + "0xa2E3356610840701BDf5611a53974510Ae27E2e1", + "0xf45C3b619Ee86F653805E007fE211B7e930E0b3B", + ], - // wbeth - [ - "0xa2E3356610840701BDf5611a53974510Ae27E2e1", - "0xA230805C28121cc97B348f8209c79BEBEa3839C0", - ], + // wbeth + [ + "0xa2E3356610840701BDf5611a53974510Ae27E2e1", + "0xA230805C28121cc97B348f8209c79BEBEa3839C0", + ], - // BTCB - [ - ADDRESSES.bsc.BTCB, - "0xad9eAAe95617c39019aCC42301a1dCa4ea5b6f65", - ], - // ezETH - [ - ADDRESSES.blast.ezETH, - "0xd7E33948e2a43e7C1ec2F19937bf5bf8BbF9BaE8", - ], - // weETH - [ - ADDRESSES.blast.weETH, - "0x2367f2Da6fd39De6944218CC9EC706BCdc9a6918", - ], - // STONE - [ - ADDRESSES.scroll.STONE, - "0x876cd9a380Ee7712129b52f8293F6f06056c3104", - ], - ], - }), - }, + // BTCB + [ADDRESSES.bsc.BTCB, "0xad9eAAe95617c39019aCC42301a1dCa4ea5b6f65"], + // ezETH + [ADDRESSES.blast.ezETH, "0xd7E33948e2a43e7C1ec2F19937bf5bf8BbF9BaE8"], + // weETH + [ADDRESSES.blast.weETH, "0x2367f2Da6fd39De6944218CC9EC706BCdc9a6918"], + // STONE + [ADDRESSES.scroll.STONE, "0x876cd9a380Ee7712129b52f8293F6f06056c3104"], + // solvBTC + [ + "0x4aae823a6a0b376De6A78e74eCC5b079d38cBCf7", + "0xA94AA72e033b39AD7CD448f38Bc1eda5B52f7079", + ], + // BBTC + [ + "0xF5e11df1ebCf78b6b6D26E04FF19cD786a1e81dC", + "0x157c9a692ee99C39272856055957083a928cE299", + ], + // wstETH + [ + "0x26c5e01524d2E6280A48F2c50fF6De7e52E9611C", + "0xf8Ca8D2B59A97125751af1069d4a5C4F7eB7A677", + ], + ], + }), + pool2, + staking: staking('0xd0C380D31DB43CD291E2bbE2Da2fD6dc877b87b3','0xFceB31A79F71AC9CBDCF853519c1b12D379EdC46') + }, }; diff --git a/projects/helius-sol/index.js b/projects/helius-sol/index.js new file mode 100644 index 000000000000..97dc4ee5b997 --- /dev/null +++ b/projects/helius-sol/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('3wK2g8ZdzAH8FJ7PKr2RcvGh7V9VYson5hrVsJM5Lmws', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/helper/abis/blindex.json b/projects/helper/abis/blindex.json deleted file mode 100644 index 3ee9c7df2daf..000000000000 --- a/projects/helper/abis/blindex.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "bdstable_pools_array": "function bdstable_pools_array(uint256) view returns (address)", - "getBdStablesPoolsLength": "uint256:getBdStablesPoolsLength", - "getBDStablePoolCollateral": "address:collateral_token", - "getBDStable": "function bdstables(uint256) view returns (address)", - "getBdStablesLength": "uint256:getBdStablesLength", - "getBDXPriceUsdD12": "uint256:BDX_price_d12" -} \ No newline at end of file diff --git a/projects/helper/abis/blockng.json b/projects/helper/abis/blockng.json deleted file mode 100644 index ef90ca5bb64b..000000000000 --- a/projects/helper/abis/blockng.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "getPoolInfo": "function getPoolInfo(address, address, uint256, uint256) view returns (tuple(address lpTokenAddress, address subTokenAddress, string subTokenSymbol, address dexFactory, address gaugeAddress, uint256 gaugeTotalSupply, uint256 lpPrice, uint256 gaugeAPR, address bribeAddress, int256 weights, uint256 punkId)[] beams)", - "numberOfPool": "function numberOfPool(address voter) view returns (uint256 len)" -} \ No newline at end of file diff --git a/projects/helper/balancer.js b/projects/helper/balancer.js index 8ab6be241de3..4167dbc582be 100644 --- a/projects/helper/balancer.js +++ b/projects/helper/balancer.js @@ -1,5 +1,6 @@ const { sumTokens2 } = require('./unwrapLPs'); -const { getLogs } = require('./cache/getLogs') +const { getLogs } = require('./cache/getLogs'); +const { cachedGraphQuery } = require('./cache'); function onChainTvl(vault, fromBlock, { blacklistedTokens = [], preLogTokens = [], onlyUseExistingCache, permitFailure } = {}) { return async (api) => { @@ -51,7 +52,22 @@ function v1Tvl(bPoolFactory, fromBlock, { blacklistedTokens = [] } = {}) { } } +function balV2GraphExport({ vault, blacklistedTokens = [], graphURL, name, permitFailure, }) { + return async (api) => { + if (!graphURL) { + throw new Error('graphURL is required') + } + if (!name) { + throw new Error('name is required (it is used as id for caching)') + } + const query = `{ tokens(first: 1000) { address } }` + const tokens = (await cachedGraphQuery(name, graphURL, query)).tokens.map(t => t.address) + return sumTokens2({ api, owner: vault, tokens, blacklistedTokens, permitFailure }) + } +} + module.exports = { onChainTvl, v1Tvl, + balV2GraphExport, }; diff --git a/projects/helper/bitcoin-book/21Co.js b/projects/helper/bitcoin-book/21Co.js new file mode 100644 index 000000000000..f5c4e25efb80 --- /dev/null +++ b/projects/helper/bitcoin-book/21Co.js @@ -0,0 +1,4 @@ +module.exports = [ + '1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW', + '12WZhMFFLHQ4rCMSkeBfbJXRk7aGWyBh1M' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/ainn-layer2.js b/projects/helper/bitcoin-book/ainn-layer2.js new file mode 100644 index 000000000000..adcec5f7ec06 --- /dev/null +++ b/projects/helper/bitcoin-book/ainn-layer2.js @@ -0,0 +1,20 @@ +module.exports = [ + "bc1q6dtp7ayaj5k2zv0z5ayhkdsvmtvdqgyaa9zs53", + "3H8cmLndtkBs7kiHByhHAddTzy8taUwYPt", + "bc1pepsapf26n8y2f4uftlmhy60ksghx6rqlxdcj4uacfqrkcg6pmncs52rzuu", + "bc1qu4ru2sph5jatscx5xuf0ttka36yvuql7hl5h4c", + "1JA46eiDpfx589wawn5RvtEXgwc518QfhZ", + "bc1qaajdlp5yrj5f77wq2ndtfqnmsamvvxhpy95662zkzykn9qhvdgys580hcs", + "368vZZKUWDFZRLWMFNRJzHo1HnibNeAJir", + "33hE9Wq65kjbiLsGD1NYwwNatP6hbsZv5H", + "32GU8Jux7SbsEbaAaLUnEQmc6JemLF6BUb", + "3CP5WJ2JSLCew7SETWUe5FxpBGrekMBiwk", + "39Fvw2Ho1fEkyDsos5sNTN5iMJZKzTL526", + "3Kptt4TZZRcjuGH8ikoQ8mV1TVxq45dnuS", + "3G4sMXWAAVTvTXTksr8u9zuu7W8RKsicEz", + "335DRGzLLG2tu4H4PnFBHYAwcj5pvV8zei", + "bc1qqg3cdyadq25zn99sdprr4lgpsxg2za998eygy8", + "bc1qw4vp94e9egkaxc04qsu5z9aq5pqpku2p6pzer8", + "bc1q3q7afjarz7l6v49538qs2prffhtawf38ss85k8", + "bc1q3smt9ut40eld6tgn42sdlp9yrx98s90unqw3pl" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/allo.js b/projects/helper/bitcoin-book/allo.js new file mode 100644 index 000000000000..b8d3311f0b93 --- /dev/null +++ b/projects/helper/bitcoin-book/allo.js @@ -0,0 +1,9 @@ +module.exports = [ + "bc1pn87rjuhzl3sr9tffhgx3nrrq7rhyxg7y58dl0uk5kyhmkfj26ssqz76lfc", + "bc1pu64y7m8hdekc5h4xtdl8ru9g3ct5n6mghmaqs8qtqecznccvy38s8tvdv4", + "bc1pjgn7m39vu02el3xpk2rtgt5kww8g5tkhmc55zevjld4n6cc9tuyq6akrq0", + "bc1pn29hejmt2mrslsa0ttfknp268qrpsmc7wqmw4ddxqytctzjl50ws2yrpmt", + "bc1pkpddzz2px40f803qug3l28c7d99qvvjkccgzj7tc80xx29pkd2vq3lqrg3", + "bc1p23su0d2sxwg95c7ny0p5vn4vf83jmvhyzacw3srjv84hmvynkacqe52r9d", + "bc1pn6rqr5z8yu5z9qphs0ccmcnt2c8ye04e3f2590rdxsd2mga0harq9k4207" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/avalanche-btc.js b/projects/helper/bitcoin-book/avalanche-btc.js new file mode 100644 index 000000000000..ac1edf073ea0 --- /dev/null +++ b/projects/helper/bitcoin-book/avalanche-btc.js @@ -0,0 +1,3 @@ +module.exports = [ + 'bc1q2f0tczgrukdxjrhhadpft2fehzpcrwrz549u90', // https://prnt.sc/unrBvLvw3z1t +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/avalon-cedefi.js b/projects/helper/bitcoin-book/avalon-cedefi.js new file mode 100644 index 000000000000..9451bd241a4d --- /dev/null +++ b/projects/helper/bitcoin-book/avalon-cedefi.js @@ -0,0 +1,8 @@ +module.exports = [ + '32DgQPVHSV6FSxLnw68nggvchp3ZNKquxA', + 'bc1qr5nz7n8ulcdz0w3s6fska80fawxhvqlh273qypm3rkjequ9wpmhs65ppw7', + 'bc1qhu98nf6ddz6ja73rn72encdr8ezsyhexwpdzap0vcs7lg2wpmrnq5ygfsl', + 'bc1qg6asmzjr7nr5f5upg3xqyrdxl2tq8ef58hha7t0s82mzzx6zjxesyccp4h', + 'bc1qxe3md4lehg8gmrlx3e8xqju5mytt266l4hcy8khl6tm5mahghmeqtxlgqq', + 'bc1qy48h0kuv0r3e330wjfs6r74sk49pkzumnm907t5mhqjxml22r3ss2ucuxc', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bevm.js b/projects/helper/bitcoin-book/bevm.js new file mode 100644 index 000000000000..35666effefa0 --- /dev/null +++ b/projects/helper/bitcoin-book/bevm.js @@ -0,0 +1,4 @@ +module.exports = [ + "bc1p43kqxnf7yxcz5gacmqu98cr2r5gndtauzrwpypdzmsgp7n3lssgs5wruvy", + "bc1p2s98z85m7dwc7agceh58j54le0nedmqwxvuuj4ex4mwpsv52pjxqkczev9", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/biconomy-cex.js b/projects/helper/bitcoin-book/biconomy-cex.js new file mode 100644 index 000000000000..ac3d3c548cf5 --- /dev/null +++ b/projects/helper/bitcoin-book/biconomy-cex.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qx70fn2550vhjetc748wmg4lzv5gy7t56ns92v8" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bigone.js b/projects/helper/bitcoin-book/bigone.js new file mode 100644 index 000000000000..1c05303a86ba --- /dev/null +++ b/projects/helper/bitcoin-book/bigone.js @@ -0,0 +1,4 @@ +module.exports = [ + 'bc1qu02z43yduyjx6saeea4l54qqulvz568qnzgaes', + '1L5D4Eq2RkEKuN717Gc817MH1Sxs5WwMQh' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/binance-btc.js b/projects/helper/bitcoin-book/binance-btc.js new file mode 100644 index 000000000000..ee46fb4aa6f2 --- /dev/null +++ b/projects/helper/bitcoin-book/binance-btc.js @@ -0,0 +1,3 @@ +module.exports = [ + '3LYJfcfHPXYJreMsASk2jkn69LWEYKzexb' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/binance.js b/projects/helper/bitcoin-book/binance.js new file mode 100644 index 000000000000..d5ea8de294b6 --- /dev/null +++ b/projects/helper/bitcoin-book/binance.js @@ -0,0 +1,40 @@ +module.exports = [ + '1PJiGp2yDLvUgqeBsuZVCBADArNsk6XEiw', + '1Pzaqw98PeRfyHypfqyEgg5yycJRsENrE7', + '32bhzEniykYRFADVaRM5PYswsjC23cxtes', + '34GUzCVLbdkMQ2UdVTaA4nxPwoovVS7y2J', + '34HpHYiyQwg69gFmCq2BGHjF1DZnZnBeBP', + '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo', + '36zSLdRv1jyewjaC12fqK5fptn7PqewunL', + '38DN2uFMZPiHLHJigfv4kWC9JWJrNnhLcn', + '38Xnrq8MZiKmYmwobbYdZQ5nnCbX1qvQfE', + '395vnFScKQ1ay695C6v7gf89UzoFpx3WuJ', + '39884E3j6KZj82FK4vcCrkUvWYL5MQaS3v', + '3AQ8bAh88TQU7JV1H3ovXrwsuV6s3zYZuN', + '3AeUiDpPPUrUBS377584sFCpx8KLfpX9Ry', + '3CySuFKbBS29M7rE5iJakZRNqb3msMeFoN', + '3E97AjYaCq9QYnfFMtBCYiCEsN956Rvpj2', + '3FHNBLobJnbCTFTVakh5TXmEneyf5PT61B', + '3HdGoUTbcztBnS7UzY4vSPYhwr424CiWAA', + '3JFJPpH8Chwo7CDbyYQ4XcfgcjEP1FGRMJ', + '3JJmF63ifcamPLiAmLgG96RA599yNtY3EQ', + '3JqPhvKkAPcFB3oLELBT7z2tQdjpnxuDi9', + '3Jy7A2rThtU9xm4o8gR3a9pvQuxXnRNuNF', + '3LQUu4v9z6KNch71j7kbj8GPeAGUo1FW6a', + '3LcgLHzTvjLKBixBvkKGiadtiw2GBSKKqH', + '3LtrsjtyLsHoG8WQMe2RFw3de4pLTQZNcY', + '3M219KR5vEneNb47ewrPfWyb5jQ2DjxRP6', + '3Me9QACjioepv2L2oKTC9QQ87NH6vFe1Zj', + '3NPL82eaehTFh4r3StpHqVQBTnZJFaGsyy', + '3NXCvmLGz9SxYi6TnjbBQfQMcwiZ1iQETa', + '3NjHh71XgjikBoTNYdWgXiNeZcLaKNThgb', + '3Qxak1CZhLyZ7GVckKphLURdLBCjMfz9bA', + 'bc1qdtmav38lca8yu3rrcknnqx5242cckgxqws7m72', + 'bc1q32lyrhp9zpww22phqjwwmelta0c8a5q990ghs6', + 'bc1q78ufzeu8w8fwvxuphrdlg446xhyptf28fkatu5', + 'bc1q7t9fxfaakmtk8pj7tdxjvwsng6y9x76czuaf5h', + 'bc1qm34lsc65zpw79lxes69zkqmk6ee3ewf0j77s3h', + // added on the 27/08/2024 + '3PXBET2GrTwCamkeDzKCx8DeGDyrbuGKoc', + '3QK5vQ9hucSg8ZC8Vizq83qEWeHFLAWMud', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bing-cex.js b/projects/helper/bitcoin-book/bing-cex.js new file mode 100644 index 000000000000..853a2aafcb7e --- /dev/null +++ b/projects/helper/bitcoin-book/bing-cex.js @@ -0,0 +1,4 @@ +module.exports = [ + 'bc1qr8e6kmev99jxnk7hpyhex434t59ke5tpvmnyd3', + 'bc1qzzn5tszxn3ha87xfke540k8pr4favsk9cusakq' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitfinex.js b/projects/helper/bitcoin-book/bitfinex.js new file mode 100644 index 000000000000..34cc9d09cbe1 --- /dev/null +++ b/projects/helper/bitcoin-book/bitfinex.js @@ -0,0 +1,5 @@ +module.exports = [ + '1Kr6QSydW9bFQG1mXiPNNu6WpJGmUa9i1g', // BTC hot wallet + '3JZq4atUahhuA9rLhXLMhhTo133J9rF97j', // BTC cold wallet + 'bc1qgdjqv0av3q56jvd82tkdjpy7gdp9ut8tlqmgrpmv24sq90ecnvqqjwvw97', // BTC cold wallet +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitget.js b/projects/helper/bitcoin-book/bitget.js new file mode 100644 index 000000000000..0b7284235f63 --- /dev/null +++ b/projects/helper/bitcoin-book/bitget.js @@ -0,0 +1,14 @@ +module.exports = [ + '1FWQiwK27EnGXb6BiBMRLJvunJQZZPMcGd', + '1GDn5X4R5vjdSvFPrq1MJubXFkMHVcFJZv', + '3GbdoiTnQrJYatcr2nhq7MYASSCWEKmN6L', + '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 +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitlayer-bridge.js b/projects/helper/bitcoin-book/bitlayer-bridge.js new file mode 100644 index 000000000000..85e16abf14ed --- /dev/null +++ b/projects/helper/bitcoin-book/bitlayer-bridge.js @@ -0,0 +1,13 @@ +module.exports = [ + "132Cka5Vdw9FcFX3eb28xikKAMvhuMJGwi", + "3JszuRdFFEz1WbQKam4XjAtnZsYX62RLMX", + "33uhW878fbvVxZuZ216q2XvgdajLdG4rN4", + "32a7u8tM45GPSdjzy7PbRvuncEvHFxnYR4", + "3D3a4fPJ5HKw43Qd6QHtoJ6RvMUL7UBDT5", + "19M7Z1E8Bs4pkXmHJrrJtngmVMUmgFu4K2", + "bc1p87c2auxxj372evzhd5f5huddtrladtkn3z4p94ew32qvwcsgujestjj45r", + "bc1puqn6dw6etk6yg8zruvf2s94cmhxkfncsaumwhtfhu5qy3e6m94sq37eq66", + "bc1pvnh3zy48ml3nhzhqrtc7endhj9rrtrv5puy2775p3jwka8y99aqsz78uu2", + "bc1pxpp82hc4t4flkyqtjdnzr3q72qh9st78gfge50vzlrjtp9c6yn4s5zq5vk", + "bc1p7agkadaau66jtva9n8k5pg3lsctuyqur8a2l5y9hzwqkh5nlmd0skuhws3", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitmake.js b/projects/helper/bitcoin-book/bitmake.js new file mode 100644 index 000000000000..9e7ad5a81fd7 --- /dev/null +++ b/projects/helper/bitcoin-book/bitmake.js @@ -0,0 +1,4 @@ +module.exports = [ + // wallet provide by a bitmake team + "3F12ncAyx4VkfpvnS7ZxdpggFx4p9RKfVe" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitmark.js b/projects/helper/bitcoin-book/bitmark.js new file mode 100644 index 000000000000..fe27815ffb68 --- /dev/null +++ b/projects/helper/bitcoin-book/bitmark.js @@ -0,0 +1,3 @@ +module.exports = [ + "37RJkdkzPXCMYSTq74berJYj9FmNn7wFP5" +] \ No newline at end of file diff --git a/projects/bitmex/bitcoin.json b/projects/helper/bitcoin-book/bitmex.js similarity index 98% rename from projects/bitmex/bitcoin.json rename to projects/helper/bitcoin-book/bitmex.js index 6330181ac2f9..373032a01e77 100644 --- a/projects/bitmex/bitcoin.json +++ b/projects/helper/bitcoin-book/bitmex.js @@ -1,4 +1,4 @@ -[ +module.exports = [ "3BMEXqGpG4FxBA1KWhRFufXfSTRgzfDBhJ", "3BMEXxSMT2b2kvsnC4Q35d2kKJZ4u9bSLh", "3BMEXfK7c3STqJjYmy2VQTGtzD3QAXNz3T", @@ -215,5 +215,7 @@ "3BMEXXy7yH5viqjjh7PCAR7WNCPE1F4H3G", "3BMEXD6G3WMUbMR27DQVLBcmZHMuiKie8d", "3BMEXKjhrEtLUaBHMbowXuFfyRzo832dU9", - "bc1qmexfaq7ldjgs0pjntlye62dtzc53899sk6lz2v2q2w2nux0u7gwsl4mq8s" + "bc1qmexfaq7ldjgs0pjntlye62dtzc53899sk6lz2v2q2w2nux0u7gwsl4mq8s", + "bc1qchctnvmdva5z9vrpxkkxck64v7nmzdtyxsrq64", + "bc1qk4m9zv5tnxf2pddd565wugsjrkqkfn90aa0wypj2530f4f7tjwrqntpens" ] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitstable-finance.js b/projects/helper/bitcoin-book/bitstable-finance.js new file mode 100644 index 000000000000..4f62f4b7d6d7 --- /dev/null +++ b/projects/helper/bitcoin-book/bitstable-finance.js @@ -0,0 +1,5 @@ +module.exports = [ + "bc1p36wvtxursam9cq8zmc9ppvsqf9ulefm7grvlfc4tzc5j83rcggsqh6nxw5", // Native(BTC) + "bc1p0uw83vg0h32v7kypyvjn9nextku2h7axjdeefy2ewstevnqffaksjzhrdf", // BRC20 deposit + "bc1pvngqf24g3hhr5s4ptv472prz576uye8qmagy880ydq5gzpd30pdqtua3rd" // BRC20 farm +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitunix-cex.js b/projects/helper/bitcoin-book/bitunix-cex.js new file mode 100644 index 000000000000..f0daa7428e06 --- /dev/null +++ b/projects/helper/bitcoin-book/bitunix-cex.js @@ -0,0 +1,5 @@ +module.exports = [ + "bc1qxh9ruwejxz7ztzxejafd74tyxg4sgfeqxun42f", + "bc1qhjfnumgcsqsx6grxa7mfl7rr5g3u8xl4gtt7tr", + "bc1qkvrddql6hh00apslzsxnysl75hhnm5fpqdah37" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bitvenus.js b/projects/helper/bitcoin-book/bitvenus.js new file mode 100644 index 000000000000..60563624c692 --- /dev/null +++ b/projects/helper/bitcoin-book/bitvenus.js @@ -0,0 +1,7 @@ +module.exports = [ + // '3FdoFGYYcD1EU7ekrt2x2u2mFrjmxouMJG', + // '358pjjkYRG8exw2BKZnn7Q9s6SCb7wZEWN', + // '3C1ykoWkHBMZwmY8PUUMVxtJJSBkZBCtN8', + 'bc1qrm2a7u9xyeffvulm6e589qvesmt0v0rjxqfkhv', + 'bc1qvht34dma2uy23l9j862nnqr38a42kjr66e6lec' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/blofin-cex.js b/projects/helper/bitcoin-book/blofin-cex.js new file mode 100644 index 000000000000..a81fceca5993 --- /dev/null +++ b/projects/helper/bitcoin-book/blofin-cex.js @@ -0,0 +1,5 @@ +module.exports = [ + "1PM8huQVFSirUT7eAwNm3rBBYTsDRzCaf3", + "1Jw4meLNYAaDcNxJwQdMTRVw74hGPcuV8W", + "bc1q6377fdmkvkhgzpw8drgu76jxulsl5wmmgwtrxu" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/boringdao.js b/projects/helper/bitcoin-book/boringdao.js new file mode 100644 index 000000000000..0cd7f4217c42 --- /dev/null +++ b/projects/helper/bitcoin-book/boringdao.js @@ -0,0 +1,3 @@ +module.exports = [ + '33ZibwpiZe4bM5pwpAdQNqqs2RthLkpJer' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bsquaredBRC20.js b/projects/helper/bitcoin-book/bsquaredBRC20.js new file mode 100644 index 000000000000..1398765ff1e7 --- /dev/null +++ b/projects/helper/bitcoin-book/bsquaredBRC20.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1q97ctqygjgj0ljxgge4q735ujxvlad8smass7f0axc6x3ggffr8xqwn69hc" // Bitcoin Multisig Addresses +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bsquaredBTC.js b/projects/helper/bitcoin-book/bsquaredBTC.js new file mode 100644 index 000000000000..6d334b2b184b --- /dev/null +++ b/projects/helper/bitcoin-book/bsquaredBTC.js @@ -0,0 +1,20 @@ +module.exports = [ + "bc1q4fsk5pgnmnu7ngp79xclsw2t0yk46sjqw22ffz", // pre deposited wallets //Bitcoin Multisig Addresses + "bc1qva5m5e7da2zm590z03tdnj42u9q2uye3hgrehwrzgg8j4kxq9seq9rvw0m", // Bitcoin Multisig Addresses + "bc1qjv2lfrv672rqagycs5zdsggmury0cz2vufek46jj86ddqynyp2qsxm3qfs", // Bitcoin Multisig Addresses + + // Bitcoin Custodian Addresses + "131fpYjELat58RVzPp2A9Bo8oNuKiP4vxg", + "bc1qr4cpjazz6hhjh44yrshqw4xs4e3eld60wnsq2m", + "14UwPgMLZY6rLZRDxxvmNWQ9rMkg2iraHG", + "bc1quetqhxs809mwgms0rhae4cw98chzqe0er8fryr", + "34ThPcBtz5ayRybbg1MXnQWBGtUzqUDCMa", + "bc1q082azm83lgpln7puvn4egc9dumlaqfqkqmsght", + "bc1qxxgxywxcq0q405849fyrlxa2zu4nxukf4ytg57", + "3LcCJLivWmaomMyhnyt4pqg8iWi2ECU92T", + "bc1qe4xx7eg5c4qjq8838zv05f7uzfmyyyftdpy48t", + "3GPVsXtvbfFNRYbLwJowaL7EXo8hqakfkv", + "bc1q8axfvwqa0fqds5w6vva9g5kej9e4mp4ap3dmff", + "bc1q6crqwsg59s2j4v5gvd94775pjj8l0fmflmv9jd", + "19M7Z1E8Bs4pkXmHJrrJtngmVMUmgFu4K2" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/btse.js b/projects/helper/bitcoin-book/btse.js new file mode 100644 index 000000000000..f827da29cc5d --- /dev/null +++ b/projects/helper/bitcoin-book/btse.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qaxyju6n2x2tednv8e7hgnhnz44vrfcmuhjxpfk" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/bybit.js b/projects/helper/bitcoin-book/bybit.js new file mode 100644 index 000000000000..cecc36f59f34 --- /dev/null +++ b/projects/helper/bitcoin-book/bybit.js @@ -0,0 +1,10 @@ +module.exports = [ + "bc1q2qqqt87kh33s0er58akh7v9cwjgd83z5smh9rp", + "bc1q9w4g79ndel72lygvwtqzem67z6uqv4yncvqjz3yn8my9swnwflxsutg4cx", + "bc1qjysjfd9t9aspttpjqzv68k0ydpe7pvyd5vlyn37868473lell5tqkz456m", + "1GrwDkr33gT6LuumniYjKEGjTLhsL5kmqC", + "bc1qs5vdqkusz4v7qac8ynx0vt9jrekwuupx2fl5udp9jql3sr03z3gsr2mf0f", + // added on the 15th of july 2024. + "bc1qa2eu6p5rl9255e3xz7fcgm6snn4wl5kdfh7zpt05qp5fad9dmsys0qjg0e", + "16jVbMCcqq1deKrMB3esL2HPso7kvqUsec" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/cake-defi.js b/projects/helper/bitcoin-book/cake-defi.js new file mode 100644 index 000000000000..624456f3928f --- /dev/null +++ b/projects/helper/bitcoin-book/cake-defi.js @@ -0,0 +1,3 @@ +module.exports = [ + "3GcSHxkKY8ADMWRam51T1WYxYSb2vH62VL" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/coindcx.js b/projects/helper/bitcoin-book/coindcx.js new file mode 100644 index 000000000000..4522d9ea5acb --- /dev/null +++ b/projects/helper/bitcoin-book/coindcx.js @@ -0,0 +1,26 @@ +module.exports = [ + '12hGEyxk4zMLquxiMiFrkvYSohsXz2D3uZ', + 'bc1qz22hegkllltcydg3pz3an6h352mjmyp7n2vhd9', + '1MzSJodjNmACPKyj9VUv9X55Pby87osLhc', + 'bc1qucl4n347qc6e48w85xdxcv86sm3an8fr250hhm', + '1F6CrpEnHEZh6gQtJ7cf1MtK7Y8GYKoP4i', + 'bc1qn2xm6agnanuyuwfcfw92el7nvt2lpsqr5s5c0w', + '17mxRZ9WeXigSwg3Cm62HxeATnuUphMxGL', + 'bc1qffg4ya27430vv5ymg2lhf4mj7tvtc3ur5qyyq3', + '1JV3umtGC6H6tFUVoFyV5KwbJDscUwrtX7', + 'bc1qhlyrdhfqry06nj902p9dxdftm4pxkhdqeum8y8', + '1KXxS6QnzpB8mSLm5kmXJXqvZF7wVvQDCw', + 'bc1qedxsgzuj8ga644gwlqw4nw7f3xncq4g2rskmzu', + '12T8i8tpeczk5JGf8ppZf1w6SFBRwEa9y4', + 'bc1qpl5kqjkugyncr72a4fhxvm0360ehfdl27e00ja', + '1PRwacjHVksLNTkSYNkiWkRgTm1yDSgLMG', + 'bc1q7c9ylgjsyc0yaxwm84jjh6avfajzfe7dhk6e0e', + '1477uXZ1NfUaaZZdnztQ7h8ftGRpuWQPfA', + 'bc1qygg2x02cfy0e6r7798v4qrcjjkzm8tl5t0xkwf', + 'bc1qljm7vwdgdy6ca97stsyjyl3zdjtkdsdm8vnh8f', + 'bc1qqhwh3tcg5duwq7hdlnlr5n2tg2uq755cwmkjqn', + 'bc1qqe4g7sjxzk90nsgj0mwufwcdtd7kufg7k32xch', + '1avi3SkWKGLis8dGCP9JUnFfVeheP8wkt', + 'bc1qmulc2ju4kykj24xuw0fu73h9h3usa897xhaucz', // + '3Dm2TL1pt1VzeBCq9jgvQG81QPv19PyReh' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/coinex.js b/projects/helper/bitcoin-book/coinex.js new file mode 100644 index 000000000000..387e8adfb697 --- /dev/null +++ b/projects/helper/bitcoin-book/coinex.js @@ -0,0 +1,19 @@ +module.exports = [ + '189myj1KAbiCWfqWhT6Td4noANKBuag3QN', + '1C2Pxf3ghtKyM4mKC3xSLKrN33YcKnKF2a', + '1JZw5HYSoAEfvGGVQ4U2JihZaQkjcXrr2i', + '16M3n9p6CLATDnpsJNTjCn22AaxzErxg5V', + '15cYMF4jcRwpcbjENMdMizCzAmd7Pc51So', + '18JQXgQ4GjZAuYCy1fNAFGHVEAWUui2q9h', + '1LGbUy11yMaNC9s73q7vEad8JTZyczCima', + '1DGXwH2gzBYM6UrVE57DaaQ3hJJm3s32YK', + '152GodsXfK5kYMdH4spzYD3Ttm1u2oNipN', + '18oxoXCq5mah3GjLjGCS3BRTQxxN7738rL', + '1H21g458T25SnAzvFDJiBrcyhfwHiCH5YF', + '14BhR6aE8Fkt2c8E1m2ydx76fBz5kpt62K', + '1Ef59jZsv87uAcwBZdDhNxiSbCceQ6bFTA', + '14ukjw4r3UFC5A8yvG7yt2GdvLUHEWtskS', + '141TDnaiLEW1vE5xd42Dw8HEhDCA2qrZTr', + '1Ew9SPwBHY8GjHd3uBxhtGcvVmyBN7PHcw', + '1LYrQCjUf54vf9G4qwFpJQ9RCyL2DprPqQ', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/coinsquare.js b/projects/helper/bitcoin-book/coinsquare.js new file mode 100644 index 000000000000..1452f7562d47 --- /dev/null +++ b/projects/helper/bitcoin-book/coinsquare.js @@ -0,0 +1,12 @@ +module.exports = [ + '1P7cDFGeWm6ezez6XGXTAjvm8qcsGiMXe7', + 'bc1q0k5rpdwf7wnq3fuk7dfjqd59p3ke7ufqmlkfp4', + 'bc1qdstretw2uvhjen7hvgaya3nsjgr430x9jhqf4a', + 'bc1qez6ezccleuac4dnj5cpexz5mz3j0j3j655j6qn', + 'bc1qg6a9kpmge0fdwtrymjvq3cydfzgpcge7e05e7z', + 'bc1qg8fywv20ztsp0edtf53zpsnxeu5cqxrmdwmtjd', + 'bc1qm5mqpgtt2ufucfdvhu5xcdgs3vzehwu62wsyqy', + 'bc1qmkkejzrq7ayfjpy7w8gmkhd3uwcy7nryr5apch', + 'bc1qsjc50kf72r4q44ac28v3vrukaxjg4w30rh0cmm', + 'bc1qyz9mssutu8xxcgjvsucz38qvxt7hxwtnm5eh8k', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/coinw.js b/projects/helper/bitcoin-book/coinw.js new file mode 100644 index 000000000000..c81128c1b947 --- /dev/null +++ b/projects/helper/bitcoin-book/coinw.js @@ -0,0 +1,4 @@ +module.exports = [ + '14Z9KSmCo1UjvBiXj2j9er35GmGmaFxsmE', + '1KYBKqRjGbRynSiyoiHndULssXrEeWhvU8', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/crypto-com.js b/projects/helper/bitcoin-book/crypto-com.js new file mode 100644 index 000000000000..f092053a2a7a --- /dev/null +++ b/projects/helper/bitcoin-book/crypto-com.js @@ -0,0 +1,10 @@ +module.exports = [ + 'bc1qpy4jwethqenp4r7hqls660wy8287vw0my32lmy', + '3LhhDLBVWBZChNQv8Dn4nDKFnCyojG1FqN', + '3QsGsAXQ4rqRNvh5pEW55hf3F9PEyb7rVq', + 'bc1qr4dl5wa7kl8yu792dceg9z5knl2gkn220lk7a9', + 'bc1q4c8n5t00jmj8temxdgcc3t32nkg2wjwz24lywv', + '14m3sd9HCCFJW4LymahJCKMabAxTK4DAqW', + 'bc1qjqy709gqpse60hdsm2d2v0dzzu7yp5dej7fdrpl2x3taccvujq4s0vzsyd', + 'bc1qcdqj2smprre85c78d942wx5tauw5n7uw92r7wr' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/deribit.js b/projects/helper/bitcoin-book/deribit.js new file mode 100644 index 000000000000..d918bf65a1a9 --- /dev/null +++ b/projects/helper/bitcoin-book/deribit.js @@ -0,0 +1,16 @@ +module.exports = [ + // from https://insights.deribit.com/exchange-updates/proof-of-reserves-deribit/ + "bc1qa3phj5uhnuauk6r62cku6r6fl9rawqx4n6d690", + "bc1qtq5zfllw9fs9w6stnfgalf9v59fgrcxxyawuvm", + "1MDq7zyLw6oKichbFiDDZ3aaK59byc6CT8", + "1932eKraQ3Ad9MeNBHb14WFQbNrLaKeEpT", + "13JJ1nxDeX5fMsDeyGHiLoK8rF2ayGq1cX", + "1MdrdcEzfiJdvs6eVSwUx6bWboPX8if5U3", + "35WHp4Hid61peyH4tuhNunwRj2gtNB41Lo", + "34ZHV8dd6uucEUABUydWpKi6F4qKQntEUf", + // added on the 26/06/2024 + "bc1qzwhw94uldd3c8736lsxrda6t6x56030f8zk8nr", + "bc1qrmuxak470z7zch5f3gz05dc6h4ngwqdq4wx80w", + "bc1qf6lm99tp5p27hsmyskve236nsv32lnfwt4h8wk", + "14HeA1YRUiJGb95HVpVTBuavMUBYGk6y7R", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/elSalvador.js b/projects/helper/bitcoin-book/elSalvador.js new file mode 100644 index 000000000000..ba5ef8fda8a3 --- /dev/null +++ b/projects/helper/bitcoin-book/elSalvador.js @@ -0,0 +1,3 @@ +module.exports = [ + '32ixEdVJWo3kmvJGMTZq5jAQVZZeuwnqzo' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/fastex.js b/projects/helper/bitcoin-book/fastex.js new file mode 100644 index 000000000000..bcd87353da3f --- /dev/null +++ b/projects/helper/bitcoin-book/fastex.js @@ -0,0 +1,3 @@ +module.exports = [ + 'bc1qs7yen7ljpvyw7vn58ql6zfaddqf4rcjalsgmt5' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/fbi-dprk.js b/projects/helper/bitcoin-book/fbi-dprk.js new file mode 100644 index 000000000000..f0913effe259 --- /dev/null +++ b/projects/helper/bitcoin-book/fbi-dprk.js @@ -0,0 +1,9 @@ +module.exports = [ + //source https://www.fbi.gov/news/press-releases/fbi-identifies-cryptocurrency-funds-stolen-by-dprk + "3LU8wRu4ZnXP4UM8Yo6kkTiGHM9BubgyiG", + "39idqitN9tYNmq3wYanwg3MitFB5TZCjWu", + "3AAUBbKJorvNhEUFhKnep9YTwmZECxE4Nk", + "3PjNaSeP8GzLjGeu51JR19Q2Lu8W2Te9oc", + "3NbdrezMzAVVfXv5MTQJn4hWqKhYCTCJoB", + "34VXKa5upLWVYMXmgid6bFM4BaQXHxSUoL" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/fetchers.js b/projects/helper/bitcoin-book/fetchers.js new file mode 100644 index 000000000000..6a2e351d29ff --- /dev/null +++ b/projects/helper/bitcoin-book/fetchers.js @@ -0,0 +1,127 @@ +const { getConfig } = require('../cache') +const axios = require('axios'); +const { getEnv } = require('../env') +const { get } = require('../http') +const sdk = require('@defillama/sdk') + +const abi = { getQualifiedUserInfo: 'function getQualifiedUserInfo(address _user) view returns ((bool locked, string depositAddress, string withdrawalAddress) info)' } + +module.exports = { + bedrock: async () => { + const API_URL = 'https://raw.githubusercontent.com/Bedrock-Technology/uniBTC/refs/heads/main/data/tvl/reserve_address.json' + const { btc } = await getConfig('bedrock.btc_address', API_URL) + return btc + }, + exsatCreditStaking: async () => { + const { data: response } = await axios.post('https://rpc-us.exsat.network/v1/chain/get_table_rows', { + json: true, + code: "custody.xsat", + scope: "custody.xsat", + table: "custodies", + limit: "100", + show_payer: true + }) + return response.rows.map(row => row.data.btc_address); + }, + fbtc: async () => { + const api = new sdk.ChainApi({ chain: 'ethereum' }) + const staticAddresses = await getConfig('fbtc', undefined, { + fetcher: async () => { + const token = getEnv('FBTC_ACCESS_TOKEN') + const { result } = await get('https://fbtc.phalcon.blocksec.com/api/v1/extension/fbtc-reserved-addr', { + headers: { + 'access-token': token + } + }) + return result.map(r => r.address) + } + }) + + const users = await api.call({ abi: 'address[]:getQualifiedUsers', target: '0xbee335BB44e75C4794a0b9B54E8027b111395943' }) + const userInfos = await api.multiCall({ abi: abi.getQualifiedUserInfo, target: '0xbee335BB44e75C4794a0b9B54E8027b111395943', calls: users }) + userInfos.forEach(i => staticAddresses.push(i.depositAddress)) + return staticAddresses + }, + lombard: async () => { + const API_URL = 'https://mainnet.prod.lombard.finance/api/v1/addresses' + const BATCH_SIZE = 1000 + + return getConfig('lombard', undefined, { + fetcher: async () => { + let allAddresses = []; + let offset = 0; + let batchNumber = 1; + let hasMore = true; + + while (hasMore) { + const { addresses: data, has_more } = await get(`${API_URL}?limit=${BATCH_SIZE}&offset=${offset}`); + const newAddresses = data.map(a => a.btc_address); + + allAddresses.push(...newAddresses); + sdk.log(`Batch ${batchNumber} completed: ${newAddresses.length} addresses`); + + hasMore = has_more; + offset += BATCH_SIZE; + batchNumber++; + } + + return allAddresses; + } + }) + }, + solvBTC: async () => { + const API_URL = 'https://raw.githubusercontent.com/solv-finance/solv-protocol-defillama/refs/heads/main/bitcoin.json' + return Object.values(await getConfig('solv-protocol/solv-btc-lst', API_URL)).flat(); + }, + pumpBTC: async () => { + const API_URL = 'https://dashboard.pumpbtc.xyz/api/dashboard/asset/tokenowners' + return getConfig('pumpbtc/v2', undefined, { + fetcher: async () => { + const { data } = await axios.get(API_URL) + return data.data.bitcoin.owners + } + }) + }, + tBTC: async () => { + const API_URL = 'https://api.threshold.network/tbtc/wallets/pof' + const { wallets } = await getConfig('tbtc/wallets', API_URL) + return wallets.filter(i => +i.walletBitcoinBalance > 0).map(wallet => wallet.walletBitcoinAddress) + }, + exsatBridge: async () => { + const API_URL = 'https://raw.githubusercontent.com/exsat-network/exsat-defillama/refs/heads/main/bridge-bitcoin.json' + const API2_URL = 'https://rpc-us.exsat.network/v1/chain/get_table_rows' + + const config = await getConfig('exsat', API_URL) + const custody_addresses = config['custody_addresses']; + const custody_ids = config['custody_ids']; + const owners = [...custody_addresses]; + + for (let custody_id of custody_ids) { + let lower_bound = null; + let hasMore = true; + + while (hasMore) { + const { data: response } = await axios.post(API2_URL, { + "json": true, + "code": "brdgmng.xsat", + "scope": custody_id, + "table": "addrmappings", + "lower_bound": lower_bound, + "upper_bound": null, + "index_position": 1, + "key_type": "", + "limit": "100", + "reverse": false, + "show_payer": true + }); + + const addrs = response.rows.map(row => row.data.btc_address); + owners.push(...addrs); + + hasMore = response.more; + lower_bound = response.next_key; + } + } + return owners + } +} \ No newline at end of file diff --git a/projects/helper/bitcoin-book/fire.js b/projects/helper/bitcoin-book/fire.js new file mode 100644 index 000000000000..bf91f24ca24b --- /dev/null +++ b/projects/helper/bitcoin-book/fire.js @@ -0,0 +1,6 @@ +module.exports = [ + 'bc1q36c0rp4ydl6uvvguhw9nr7njm49addzkgftqev', + 'bc1q3z0khuld6nd7esv46nxj9ketteqw9qz86peyeh', + 'bc1q4hz59t7v0uxujuyrhp9679uppur7ke9u3vshvd', + 'bc1qdlrh7ycyqxe62vk5m70y353vmep9ullxx5j9ar', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/flipster.js b/projects/helper/bitcoin-book/flipster.js new file mode 100644 index 000000000000..7ec436017ad5 --- /dev/null +++ b/projects/helper/bitcoin-book/flipster.js @@ -0,0 +1,3 @@ +module.exports = [ + "31iAUikiV7yKEYBzbA1iHPcanHNsLBFe8C" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/garden.js b/projects/helper/bitcoin-book/garden.js new file mode 100644 index 000000000000..11ad3a29caad --- /dev/null +++ b/projects/helper/bitcoin-book/garden.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qhww67feqfdf6xasjat88x5stqa6vzx0c6fgtnj" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/gate-io.js b/projects/helper/bitcoin-book/gate-io.js new file mode 100644 index 000000000000..2a8cb8f5a9f6 --- /dev/null +++ b/projects/helper/bitcoin-book/gate-io.js @@ -0,0 +1,8 @@ +module.exports = [ + '14kmvhQrWrNEHbrSKBySj4qHGjemDtS3SF', + '162bzZT2hJfv5Gm3ZmWfWfHJjCtMD6rHhw', + '1EkkGXR7dTbZbrKFKoe6YEP4gj4GzMeKvw', + '1G47mSr3oANXMafVrR8UC4pzV7FEAzo3r9', + '1HpED69tpKSaEaWpY3Udt1DtcVcuCUoh2Y', + '3HroDXv8hmzKRtaSfBffRgedKpru8fgy6M', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/hashkey-exchange.js b/projects/helper/bitcoin-book/hashkey-exchange.js new file mode 100644 index 000000000000..978a0da1c224 --- /dev/null +++ b/projects/helper/bitcoin-book/hashkey-exchange.js @@ -0,0 +1,6 @@ +module.exports = [ + "bc1qqe394jlqq86muq23d4vrnhzzvcv8jnepgt8lx7", + "1NfJSiqBw4fb74KgVQrPsk5W5aqitAD1Xv", + // "bc1qlrawqecuwgpzzwh04pkhtfsqsk33kald22ds3c", // bosera funds https://www.bosera.com/english/index.html + "18oxobhCNKnHjb7nEFDmPdXbCZthFWezrm", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/hashkey.js b/projects/helper/bitcoin-book/hashkey.js new file mode 100644 index 000000000000..9dbb016d3bad --- /dev/null +++ b/projects/helper/bitcoin-book/hashkey.js @@ -0,0 +1,4 @@ +module.exports = [ + "bc1qyvppkaa74d9jvtz664a6uxmj09hf0eyg3uhx4h", + "1DywJMqHHMWuP7xyfkRqJZCEe7GdEKFRcp" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/hibt.js b/projects/helper/bitcoin-book/hibt.js new file mode 100644 index 000000000000..24ca126ecd38 --- /dev/null +++ b/projects/helper/bitcoin-book/hibt.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qpxntlx09kqvpwl7vmjw9f28yvytdqkdx8xh63w" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/hope-money.js b/projects/helper/bitcoin-book/hope-money.js new file mode 100644 index 000000000000..3bc94a71f0af --- /dev/null +++ b/projects/helper/bitcoin-book/hope-money.js @@ -0,0 +1,7 @@ +module.exports = [ + '15PYHP5ZW29B3o19jFNKz6RyRdHCtzJj5H', + '16BLcAyJR8unm8RpQT9PGTwh5uPpZEf2ut', + '3JoCB8ifwhL4YKo9rCYMgVGbqxBqnpQpdS', + '179fgM9yyTHj4ZCTfAcGhUFiQMXuPx5xrF', + '1LaC3Xt8RZWYH1pjcvXxrWxLvXe7iR3ybe' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/hotbit.js b/projects/helper/bitcoin-book/hotbit.js new file mode 100644 index 000000000000..2ac17bafc87b --- /dev/null +++ b/projects/helper/bitcoin-book/hotbit.js @@ -0,0 +1,3 @@ +module.exports = [ + "1MiFZMJkFMhMrubjjo6f5oEhh7XgSwXWgp" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/huobi.js b/projects/helper/bitcoin-book/huobi.js new file mode 100644 index 000000000000..ee1188524dcc --- /dev/null +++ b/projects/helper/bitcoin-book/huobi.js @@ -0,0 +1,14 @@ +module.exports = [ + "12qTdZHx6f77aQ74CPCZGSY47VaRwYjVD8", + "143gLvWYUojXaWZRrxquRKpVNTkhmr415B", + // '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', this wallet is backing USDD acording here https://prnt.sc/i3cFaak7H9Y8. For that reason, it should not included as HTX. + //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 + "14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D", + "1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj", + "1HckjUpRGcrrRAtFaaCAUaGjsPx9oYmLaZ", // add on 08/08/2023 (we defillama) + "1L15W6b9vkxV81xW5HDtmMBycrdiettHEL", // add on 08/08/2023 (we defillama) + "14o5ywJJmLPJe8egNo7a5fSdtEgarkus33", // add on 08/08/2023 (we defillama) + "1BuiWj9wPbQwNY97xU53LRPhzqNQccSquM", // add on 08/08/2023 (we defillama) + "1AQLXAB6aXSVbRMjbhSBudLf1kcsbWSEjg", // add on 23/02/2024 (we defillama) + "1ENWYLQZJRAZGtwBmoWrhmTtDUtJ5LseVj", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/imbtc.js b/projects/helper/bitcoin-book/imbtc.js new file mode 100644 index 000000000000..e92993a2c369 --- /dev/null +++ b/projects/helper/bitcoin-book/imbtc.js @@ -0,0 +1,3 @@ +module.exports = [ + '3JMjHDTJjKPnrvS7DycPAgYcA6HrHRk8UG', '3GH4EhMi1MG8rxSiAWqfoiUCMLaWPTCxuy' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/index.js b/projects/helper/bitcoin-book/index.js new file mode 100644 index 000000000000..0db660450d85 --- /dev/null +++ b/projects/helper/bitcoin-book/index.js @@ -0,0 +1,186 @@ +const ainn = require('./ainn-layer2.js') +const allo = require('./allo.js') +const avalanche = require('./avalanche-btc.js') +const fetchers = require('./fetchers.js') +const bevm = require('./bevm.js') +const binance = require('./binance.js') +const binance2 = require('./binance-btc.js') +const bitstable = require('./bitstable-finance.js') +const boringdao = require('./boringdao.js') +const bsquaredBTC = require('./bsquaredBTC.js') +const bsquaredBRC20 = require('./bsquaredBRC20.js') +const elSalvador = require('./elSalvador.js') +const garden = require('./garden.js') +const hopeMoney = require('./hope-money.js') +const krakenBTC = require('./kraken-btc.js') +const lorenzo = require('./lorenzo.js') +const lorenzo2 = require('./lorenzo-enzoBTC.js') +const merlin = require('./merlin.js') +const multibit = require('./multibit.js') +const obelisk = require('./obelisk.js') +const roup = require('./roup.js') +const tronBTC = require('./tron-btc.js') +const wbtc = require('./wbtc.js') +const xlink = require('./xlink.js') +const xlinkLST = require('./xlinkLST.js') +const xrgb = require('./xrgb.js') +const imbtc = require('./imbtc.js') +const twentyOneCo = require('./21Co.js') +const avalonCedefi = require('./avalon-cedefi.js') +const pstakeBTC = require('./pstake-btc.js') +const biconomy = require('./biconomy-cex.js') +const bigone = require('./bigone.js') +const bingCex = require('./bing-cex.js') +const bitfinex = require('./bitfinex.js') +const bitget = require('./bitget.js') +const bitmake = require('./bitmake.js') +const bitmark = require('./bitmark.js') +const bitmex = require('./bitmex.js') +const bitunixCex = require('./bitunix-cex.js') +const bitvenus = require('./bitvenus.js') +const blofinCex = require('./blofin-cex.js') +const btse = require('./btse.js') +const bybit = require('./bybit.js') +const cakeDefi = require('./cake-defi.js') +const coindcx = require('./coindcx.js') +const coinex = require('./coinex.js') +const coinsquare = require('./coinsquare.js') +const coinw = require('./coinw.js') +const cryptoCom = require('./crypto-com.js') +const deribit = require('./deribit.js') +const fbiDprk = require('./fbi-dprk.js') +const mtGoxEntities = require('./mt-gox-entities.js') +const silkroadFBIEntities = require('./silkroad-fbifunds-entities.js') +const fastex = require('./fastex.js') +const fire = require('./fire.js') +const flipster = require('./flipster.js') +const gateIo = require('./gate-io.js') +const hashkey = require('./hashkey.js') +const hashkeyExchange = require('./hashkey-exchange.js') +const hibt = require('./hibt.js') +const hotbit = require('./hotbit.js') +const huobi = require('./huobi.js') +const kleverExchange = require('./klever-exchange.js') +const korbit = require('./korbit.js') +const kraken = require('./kraken.js') +const kucoin = require('./kucoin.js') +const latoken = require('./latoken.js') +const maskex = require('./maskex.js') +const mento = require('./mento.js') +const mexcCex = require('./mexc-cex.js') +const mtGox = require('./mt-gox.js') +const nbx = require('./nbx.js') +const nonkyc = require('./nonkyc.js') +const okcoin = require('./okcoin.js') +const okex = require('./okex.js') +const phemex = require('./phemex.js') +const pionexCex = require('./pionex-cex.js') +const probit = require('./probit.js') +const robinhood = require('./robinhood.js') +const rosenBridge = require('./rosen-bridge.js') +const silkroad = require('./silkroad.js') +const swissborg = require('./swissborg.js') +const toobit = require('./toobit.js') +const indiaCovid = require('./india-covid.js') +const wooCEX = require('./woo-cex.js') +const bitlayerBridge = require('./bitlayer-bridge.js') + +const p2pb2b = ['39BFtTzZjj6o2s7eewefFQxqM4617VmhEK'] +const teleswap = [ + '3CAQAw7m95axbY761Xq8d9DADhjNaX9b8o', // POLYGON_LOCKER + '3KLdeu9maZAfccm3TeRWEmUMuw2e8SLo4v', // BNB_LOCKER + '3E2hwnq5BsmP1ea6JUhjdKZjh2wy4NuQ8T', // BSQUARED_LOCKER + '31uHNFfbejkbUD2B26o2CARfU1ALJ6x6Ag', // BOB_LOCKER + '3LNsey3ceG9ZHkQ7bcfAjwnew7KVujHt29', // BRC20_LOCKER +] + +module.exports = { + ...fetchers, + bitlayerBridge, + teleswap, + ainn, + allo, + avalanche, + bevm, + binance, + binance2, + bitstable, + boringdao, + bsquaredBTC, + bsquaredBRC20, + elSalvador, + garden, + hopeMoney, + krakenBTC, + lorenzo, + lorenzo2, + merlin, + multibit, + obelisk, + roup, + tronBTC, + wbtc, + xlink, + xlinkLST, + xrgb, + imbtc, + twentyOneCo, + avalonCedefi, + pstakeBTC, + biconomy, + bigone, + bingCex, + bitfinex, + bitget, + bitmake, + bitmark, + bitmex, + bitunixCex, + bitvenus, + blofinCex, + btse, + bybit, + cakeDefi, + coindcx, + coinex, + coinsquare, + coinw, + cryptoCom, + deribit, + fbiDprk, + mtGoxEntities, + silkroadFBIEntities, + fastex, + fire, + flipster, + gateIo, + hashkey, + hashkeyExchange, + hibt, + hotbit, + huobi, + kleverExchange, + korbit, + kraken, + kucoin, + latoken, + maskex, + mento, + mexcCex, + mtGox, + nbx, + nonkyc, + okcoin, + okex, + phemex, + pionexCex, + probit, + robinhood, + rosenBridge, + silkroad, + swissborg, + toobit, + indiaCovid, + wooCEX, + p2pb2b, +} \ No newline at end of file diff --git a/projects/helper/bitcoin-book/india-covid.js b/projects/helper/bitcoin-book/india-covid.js new file mode 100644 index 000000000000..ec4208aeecc5 --- /dev/null +++ b/projects/helper/bitcoin-book/india-covid.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1q220k2449fau0pxu9hfn28q3w4k99ep9hwsa5fa" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/klever-exchange.js b/projects/helper/bitcoin-book/klever-exchange.js new file mode 100644 index 000000000000..6c2d7acf097b --- /dev/null +++ b/projects/helper/bitcoin-book/klever-exchange.js @@ -0,0 +1,5 @@ +module.exports = [ + 'bc1qze8pn5vywzk8enqdr9ve28lyas23kurzd37027', + 'bc1qgy5zyuvsw5wnt5lrx3m62tt2pmdl69avd5vw6n', + 'bc1qk4l4u3lh7rrufsw0z6vmkln5kesf0a9q0srnkr' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/korbit.js b/projects/helper/bitcoin-book/korbit.js new file mode 100644 index 000000000000..ccdfbe18b486 --- /dev/null +++ b/projects/helper/bitcoin-book/korbit.js @@ -0,0 +1,23 @@ +module.exports = [ + '1JtAupan5MSPXxSsWFiwA79bY9LD2Ga1je', + '3E8BTrBB7jxAemyUqSnN4YFLMC22cShZJZ', + '3GoBetHTvfnaRNQbR4yy5YNUjX4d8mTQKK', + 'bc1q09j44e0xxxusj3zsan20x7tuvtumxfv9smlq27t0nwp57gxf7htqq6m9lj', + 'bc1q0uffd8egas4w87dxq998ttfl6j3jtw6k7cafce9v4mvr5qc9tvfq9czqk9', + 'bc1q33m8td986p3vcnap9zqpx3d8v8zujtkvqacsya5xfvf945vmvxzqth4h4t', + 'bc1q3yn06lfl8ayjukya52ksff0uaveurfc8lm3ftdgu8ywvwanx8lqswj7w9u', + 'bc1q4sv2fxlp6w08wkq8ywmughxkm7n75d2fmrgnmvwun6rhepyknjxqm99v4x', + 'bc1q7fww9657ts2au45wh0ed39rjze6ja93z0498z4j89pqjky266wzs0sz8ka', + 'bc1q9pnwfyd4jtkulyk4w057wsdjhykaw6fftw06k2cn2m3y7jlsfe2qvxvm8e', + 'bc1qa8may4g0yzezjyesqcq0mwggy5wwzl0yhs0a8tk9ucej5qg6ujfqscv2jq', + 'bc1qgkx4ee8ac3as5y4ddhw6uedyk9adsywdzgc0fzxv304lcrh4qs9sn96agt', + 'bc1qku6z53kuyaj9r898kj6esqnwz7wke82mwgw43vhu33ld7sx3200s2u9p9x', + 'bc1ql0p3klhr2d8z07ja3t5d5dnxrenhp4gcjeszxpfflr08zaqqx5zqpkeqnl', + 'bc1qnerwvz93pcj653r5yd4hnd2d7np2drhdhyruj7qdvl3psc5wnf0q6x9me4', + 'bc1qs9ut74nue7vjknz2eqxegmtuzqhjzx9y8tzjymvlg05v8a5ffr5qz402cx', + 'bc1qsk6h7d2l7e7r2a8krlxjn6wdnhhszyrtzcugdsfa5zz4syajzl5spd52h5', + 'bc1qsmqvkwrsy5xw2hm885l5fv7s2hxzauz5fn9jayfmd86305wehrts2lztgs', + 'bc1qtlen0nuvln3aqcn2r3nljshdmzakq7z5z4rexpk23mj8u8lmc8ysc29jct', + 'bc1qzdt5z4f46jak59jku5jmvv3f2ru20htqs7jhy0whazgd5v4626eq4vkxqz', + 'bc1qzu4lnzfpskwsvnyvzud9a7ru4d2ft7whqvl5d3kskxxhgeupnjjquzvt97', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/kraken-btc.js b/projects/helper/bitcoin-book/kraken-btc.js new file mode 100644 index 000000000000..cb54d312afcb --- /dev/null +++ b/projects/helper/bitcoin-book/kraken-btc.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qqwf6hexnnswmj6yuhz5xyj20frtp8exv7mclck" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/kraken.js b/projects/helper/bitcoin-book/kraken.js new file mode 100644 index 000000000000..c08929826050 --- /dev/null +++ b/projects/helper/bitcoin-book/kraken.js @@ -0,0 +1,16 @@ +module.exports = [ + 'bc1qnhmemsqfhycvp6g50v732h7wfwdt68el4ux5ttu8xwsrzngmxv0qr55aga', + 'bc1qa5aux0l2c3l99tpmd9c85770kqpksg3g6dxaw03jj6lphnwy4lqq68xfgc', + 'bc1q3gqqnn9hr0uachfk6rv3qhf3pp9z8a4z63ksc5qu0c2vvtykqd9qj3fyum', + 'bc1qplr053c80nzlqapuatfslyhmns6sfn32qzz3xkdn36jjryw8vsys8y7wlc', + 'bc1qhxv3pg2hsnw3m9jukuc6erjwwd03rzwhd2k6zh5uf6s2lwpuv3rq9zefru', + 'bc1q08n37tm63z3f0myqe6zjx7ymtng8c9qedpwpplq95qkmx0cpke7qyz4y8v', + 'bc1q02cq8du8r7ktuy5l0ltc4cv82xnaw4upaaw8y4rq6uycdp0k5nmquljtzk', + 'bc1qcf9qe8ytx5qlcq0ft4vm2xm3fyfvurrkende46hpmwwnzpctfu3szxpve2', + 'bc1qrj5vg73fxs6h6pmdjld387j5szkswc2y39rfutw8gl93h647wpksukyln9', + 'bc1q9hqaqzyf6zsd330pkvtq5uxcxprzr368zdsxx5srtep7kepx523q2gd0ef', + 'bc1q36l8mssxdlncj7njkqvayv3jumked9jdtjxete66cxnzluf4j0msjm4w80', + 'bc1qs8cyln26t2f5rwu2frnqvtltfxt0qqql0elmhrpsexlzveap82eqtyvsgu', + 'bc1qcds58swh4g6zsdmws9ltcdpqz4l44utu5wv9vfpmemps3whgdacqkakrk0', + 'bc1q75tsfq2c5cqp2ss32qksmnzd9yea2mjsjktdmrz900dcmg43ck4s66sgjx', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/kucoin.js b/projects/helper/bitcoin-book/kucoin.js new file mode 100644 index 000000000000..713bd603fb1b --- /dev/null +++ b/projects/helper/bitcoin-book/kucoin.js @@ -0,0 +1,114 @@ +module.exports = [ + 'bc1q04p5psjsp7j80sq6u4djgqk3c7pk6n93q43ply', + '38fJPq4dYGPoJizEUGCL9yWkqg73cJmC2n', + 'bc1q0243pvcnutwtm3m6t005402yk8utq4kfqqghhu', + 'bc1q080rkmk3kj86pxvf5nkxecdrw6nrx3zzy9xl7q', + 'bc1q07yhcr2qmwkc32z4gfaemtjtx90am6e6rpl9sg', + 'bc1q224fr84g5xqvp2lkwmzvyec9frwk5w5f5v5w38', + 'bc1q204dfzksn4l0rhhajm9fyd5h92dac8tnuur8jp', + '37nA3mMvQwPGVh6BKdLXKBiPjLFVbRLZEp', + 'bc1q0h72mfwgtsnfkcmpsnt3kmrrp4z5x3v469mz0k', + 'bc1q0l84mekaaszjfst7lswaheu7gcymv2h2k8z6fl', + 'bc1q2hpdg7pwghz9um27hqsmv2sg3f8f9fwtjvdenx', + 'bc1q3yy6h7x9wtffu8f7hpkhlyssw3s28xzj0nydye', + 'bc1q3kwpxug0q0w55qjrfrcykxu2yn02xhzn49fnxw', + 'bc1q2wxfd36s204jkpfmez2u0nh7540cctur2v27ht', + 'bc1q3g7sltlncshtqcu9wyhqavzxlfa4tj97whapup', + 'bc1q4jszmgxml90ernkn3l908sn4hr94zk6wynp788', + 'bc1q3sevrnv8khxe6fnl87ad8e4fjefu7rmp39pxl6', + 'bc1q4xt86cp0xf6zsrfsgspnfm8579ksurxppae66a', + 'bc1q4f8uwyargzd8eajj2vrdjz4l0hvhjdlpmchstm', + 'bc1q3fzjrvlvsl6j58x38gzk0c8dgvfudsqcsdqyry', + 'bc1q5h4ucvz7qqnhypekhd8jusc8z8msytxflzfs8s', + 'bc1q5ty9r24qftnx7c0vw0y76d5kneekse7hl878yv', + 'bc1q6z680y2fkmmu49ykm0dm0temp25p034p034fme', + 'bc1q5qsadcuj0at2xk4lfca5zull8mkgwfm06qduq4', + 'bc1q80elat9h0nfhuzvuvn4yl2nh0eqxwfzas5afnv', + 'bc1q6dr8nqmgm5qvuukuf5ux3m0fdthnhx033uv3vr', + 'bc1q6tj4wm295pndmx4dywkg27rj6vqfxl5gn8j7zr', + 'bc1q5w44vqvfpnwzpclwhdmx98uenwdtdfd85qtw34', + 'bc1q82qe6w4afzt2l94wn4d9e0uchj8t2x2dtdf2pu', + 'bc1q5cza73vpzhrsruy4e7gudvq6xv6vfs9hjs5pl3', + 'bc1qa482xwlzz479nyep2ve0z6t9t29dg0zem9wqt2', + 'bc1q8yja3gw33ngd8aunmfr4hj820adc9nlsv0syvz', + 'bc1q9uddlcfqdyh6dlu3pptchazr0va0cshnqss2yk', + 'bc1qa8jaa3pss396sx52hkft5ta2dey69fkrt8mfsc', + 'bc1q9020xphp6ukc4j72hy52gk2nxujwt4kr8dq6eu', + 'bc1q8jjlupqcvxv25usqu8hvlnd8ym0stcpq4jfy9x', + 'bc1q98mvmv9nl4p744tdf2zh3uzv30yea2njy0le9d', + 'bc1q9hrcsckdwrezlw7gspefeyk9nyqmwpy3ea8wwx', + 'bc1qa3h4re6gf6qmmesjqfzn0vu2rmc6e00s4gjjle', + 'bc1q9wvygkq7h9xgcp59mc6ghzczrqlgrj9k3ey9tz', + 'bc1qfyr7tvv0a2dcq6xp4dgr5nemfmnak2e2scn6hg', + 'bc1qdhqxc3h6dnc6x0k8emtcnuyt8aspy83w0g9xht', + 'bc1qfcuvuaam666pv777ad59wwue5l7j36hr95f8gv', + 'bc1qf3wwg8dayutammv2e6lahudyc7j2ef579hyx3m', + 'bc1qamlau4w545vsjsmnhzmztlv3sy4tu6v9cnxtcg', + 'bc1qea6uvmc2kqndhewtlnc9duh5aa30ptvp3mhk9h', + 'bc1qgrxsrmrhsapvh9addyx6sh8j4rw0sn9xtur9uq', + 'bc1qcyjkktrvwatdqyvpm04vs3k2x5r4ystnw7msrk', + 'bc1qggwgcwnjvlma9hr569jhgx2yuncaaq0ace5ywp', + 'bc1qartr66auwm2tlcjp7cqgs8cx4p6q7lydrtwf4p', + 'bc1qkrewa0m37wjmkcgs0w2gh9zhjqclkq74ckt4x4', + 'bc1qk947xflcafthv8k6gx7m2cvwzqzy68kl5npkyw', + 'bc1qh573eaggrqexqx7xzm4e57k6sm9r7zpuxwqxzn', + 'bc1qj5gnrfdmcftzxgrwcdts4plw4kaydjs5kq560l', + 'bc1qlldl5qma9glxwt3j06eef05590uyy2td3ye90c', + 'bc1qhafun32xkhxpec8dq3kpxyq5x9ur437mj4dusy', + 'bc1qh6tqdv9k2pew6vyvrmg76ae55n5rwa2djmyyyk', + 'bc1qjxv6j2sv6za57khvvd5yu9jxkv3g3qvxh6sach', + 'bc1qjefrh2gf28g6x56eeausc30gxewamj7qwtzfpg', + 'bc1qhs4u46ygdskuljadnxn6thqsrjw3nf9r8nfclm', + 'bc1qnl68wnf3d6jz532dl65hj9urw9j2432fjg03nr', + 'bc1qnetky45z2vguazzczuy7x2446vsjn4ku76d5k8', + 'bc1qlw4dv8nt5uc35dkmftlt3nt0rl0cte4he998qt', + 'bc1qnvdx4dt8kn68csvcqvdtnlzw8hadapk9e9k857', + 'bc1qnqhcfntmlh2nnu5rp25szqgxw7v3783xrgcd44', + 'bc1qp22u6u75j2nvvhychyfd9uxr6s2jkf5p985rct', + 'bc1qnxn6352sn9mm6dxgmfrn43fgtu0l2kcx2y3ddh', + 'bc1qm882j3900we3eewa5fdw4hlwlnef35phmsn7x8', + 'bc1qpafgjjmqlv32m6m6qpte2ldlz0wcuj3ajyt8gd', + 'bc1qmtvfu97nlrl8qtujvj5jg47dc0p3w8sun6esaf', + 'bc1qr9hf2v2gf6haq7tsvckel7u6ja46fnqfkt6u5p', + 'bc1qpuhnd3gqhqlezgcuuhc2ywfw2w03uyz0seg802', + 'bc1qr77hw0dek5f8uvmeazd3egym2m3npjf2nvrza5', + 'bc1qpdfchk5j5tvkwf0z4kpftysv88h5szz4ms8try', + 'bc1qprpm6caxcuewnme4at7h2skhv2rury274a0vln', + 'bc1qq9u67zacfe3vz40e36nltn3agt9hf75g7av2xx', + 'bc1qrf9llyljmwy8egcjjsw0z0a8n5sgjlhcemezcl', + 'bc1qqx0udc7ndr77yg4v7rwuugnwk8n8xqaydmakfu', + 'bc1qqg92jrprgh0vdq3pd8wctnzqyuwn5kp20hhfh6', + 'bc1qpnmkhx9ndgnk639wh5gyuex4nsx7s8t8d33pzt', + 'bc1qtcxldruuuhvk8zjmw3a3dpwfvu2d0m9qyctv82', + 'bc1qtlgfyl9yjyluwzyyayp2fs0r4kcjtv2axsmzl8', + 'bc1qs84j4s45nztsx9759vkha0wvvx28dlqk7p2n5y', + 'bc1qteec4z0tcvv40r6py855gg77rwnhe9ege42x0t', + 'bc1qrt7rkpswpgmcag7txzf6ps9mvepwgndshqdx6d', + 'bc1quqy97s6lj3mty7hdp4at7uvmlzssh57jezx85v', + 'bc1qseaaa4hnexjugx26p605getpdnkwy3up64uws9', + 'bc1qudtghe07cfslxyv36zk5ums65c32xcw0nz6zhg', + 'bc1qsfdf47l3ftsqv2muvfftnulcp4qwzypuxm9k30', + 'bc1qul97gsvkpfju6fa53cezzxx5wmv4t8rl6gdt62', + 'bc1qv3v2u78m6vec2jqe7w0esm6rccmysccdvkpr3t', + 'bc1qwjftm2nl65gmevmutfqe8q7k0aaahlxt3a9wam', + 'bc1qvh0zexe6422t85x3kzgvms9fd984606uhf44ug', + 'bc1qvj8a4kjq888c2l22pdgjx3cgaq94vm3hjzyq6l', + 'bc1qwgzyz8xpwdrx54rsm5p74ksc6wkxr8y4ncejwh', + 'bc1qvvqafwsqr2rquyvym4l6rtt7ayukpmw2sfxn7f', + 'bc1qvkzdg9x58zyupept40zcjhmztn3l2flqss2f4x', + 'bc1quyayxjg0r68wsj6c2zcu3f7nnj9um5pwdgr36m', + 'bc1qw83c8j8pf2azegtyeszqqdaafgqj4hl3xcdy95', + 'bc1qwxg6gra5g9tlvztr9qphzpruch30ka40e4tl48', + 'bc1qz0q4hyn5k8plleax2g52jsr0k07vgtqcr634g3', + 'bc1qz0nfyvylrvn9h2rqm7lcegzv79du2p5jezgept', + 'bc1qxfgeqygy229hrjrwmklzgwme70h8mmrjcyueag', + 'bc1qyz4zr7cv2922cjua9xrezsda82gl8z653w6ru4', + 'bc1qxnsr0al2lw7hqg90j05x9s0gxm5g4skmcslrut', + 'bc1qymcn42gst8jvcu4y9c6tf6ngfs38j66hd5zvhs', + 'bc1qzghz50r66hlp4wufyy55m5a3jjl5grkmetygsg', + 'bc1qyatvzh0ndg464ph7txwjw6kgkczw8kw03lcgg7', + 'bc1qy8054ua06akklh6avf06crt4u2hu4skasr5ead', + 'bc1qy7uquly0ha78lmn47hedd7e0swkmwpyft9j7e2', + 'bc1qzy4lg8yg6dsn0dppx3a4kq8tqe2hhrh6af3778', + 'bc1qzkqzmlj47z0ww253xu2egewcw4wagz6qfa6fr8' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/latoken.js b/projects/helper/bitcoin-book/latoken.js new file mode 100644 index 000000000000..220be747b8b8 --- /dev/null +++ b/projects/helper/bitcoin-book/latoken.js @@ -0,0 +1,5 @@ +module.exports = [ + "bc1q48amr6l7dvacdppgucvnswwuyleaqh4dus8z8h", + "bc1q2cgh9nxn7cqmqhk4hc5fu6mju8nzy9a20qqqh8", //cold + "bc1qw5fc9ml9vm4xq5c6xkcdu3vtwyw4gdn8lw0uwq" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/lorenzo-enzoBTC.js b/projects/helper/bitcoin-book/lorenzo-enzoBTC.js new file mode 100644 index 000000000000..bb7e56d6cbc9 --- /dev/null +++ b/projects/helper/bitcoin-book/lorenzo-enzoBTC.js @@ -0,0 +1,4 @@ +module.exports = [ + 'bc1qndzgrwj3y2lhcklme4t72jxq3df2h05vjdgzpp', + '19wFRSr3GYHmVQtnmbkx7Wkjw3jZdyYB9a' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/lorenzo.js b/projects/helper/bitcoin-book/lorenzo.js new file mode 100644 index 000000000000..13ccded61ae1 --- /dev/null +++ b/projects/helper/bitcoin-book/lorenzo.js @@ -0,0 +1,32 @@ +module.exports = [ + "bc1qaf6laj9m7jteztyz4lulrtcjtpusfcfnd7r7xn", + "bc1qf6cj2z2e2mzuvfrl80vgt53k7jc2vf36ckahgy", + "bc1q5hc68n6krnzgzswf7rknha2aqxzrzup4vlhce8", + "bc1qpxpmr3zdjulqnwa3jdvm83tpaek6dv3kc75ms7", + "bc1qaml9d9mqgfhsfuaa2ymutdl4psj8c2undx9n72", + "bc1qutgngqyrflxrfmk9k28ucvq0s2v8a43nwfwv02", + "bc1qrx3fpr5j6sprxett45c2kl9p4pajyxep0mapfd", + "bc1q00t2ntm46c2nfvcer6ukj6npaxjurujthse4qq", + "bc1q3pzhncle68gct6me08kn5kf9awkevt6ettwrmg", + "bc1qw6cvwx8ajprmp2lzkhrsps2qx4k9r2pj4xj98x", + + //btc script-address after lorenzo stake to babylon + //cap 1, Delegate to Lorenzo FP(db9160428e401753dc1a9952ffd4fa3386c7609cf8411d2b6d79c42323ca9923) + "bc1pjy5mq7vlqkq6nldxghauq0sqgh3hjdrp2adl7tcalkavt9ly5g8q3zkymk", + "bc1pck8hnfa76k9gqtddyjvt0syzlxj5atfr5g0dk0ktmdr9u9h2gnesge0f5v", + + //cap2, Delegate to Lorenzo FP(db9160428e401753dc1a9952ffd4fa3386c7609cf8411d2b6d79c42323ca9923) + "bc1pf2x7w0wwutvj5qznrxygpv5wcj3nvzq9dqhpmkyfk84nkg778q0qa605e8", + "bc1pstunan5nv657dqx32tdup3y8uxq6eja6z3d4kukspjpq23gxf4zqdce4hn", + + //cap2, Delegate to BSquaredNetwork FP(2f8ec74d558fe7a97d10be230bf1485db9be675228abfbf957ba050c714b679a) + "bc1py54xje6lxdd8ej9hqxdxnp5dyjwu2eda2rxa2yuaptv3lrw3t2tscly6y7", + "bc1pydkry09hpqqv4hxrrlrgpddky4u39xrpqd0xvsf9smjpd65s49qqnq5zel", + + //cap2, Delegate to ChainUp FP(31287a9728f7b11863b9c56fc4cca103f0473dcgitdc6746ed7f79050d3adff644b) + "bc1p6dltgypr57fc648txjj7zwk6k605ca9x2ul0pycld22x86jcvxmsg7547j", + "bc1pw8za3k5upa565n0kv55e89a8l0hkzpnfenj767j0cwfu7rn83yhqvuehcd", + + //cap2, Delegate to Lombard FP(609b4b8e27e214fd830e69a83a8270a03f7af356f64dde433a7e4b81b2399806) + "bc1pa56692v3hxguvu8vgu5d7dh9twlj7wm87qvzvxdru3rnluv8nmdqk58ewz" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/maskex.js b/projects/helper/bitcoin-book/maskex.js new file mode 100644 index 000000000000..22f1111072f5 --- /dev/null +++ b/projects/helper/bitcoin-book/maskex.js @@ -0,0 +1,4 @@ +module.exports = [ + // this wallet was collected from https://blog.maskex.com/news/announcements/embracing-transparency-maskex-reveals-wallet-addresses + "39DUz1NCkLu25GczWiAjjgZBu4mUjKbdNA" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/mento.js b/projects/helper/bitcoin-book/mento.js new file mode 100644 index 000000000000..2a3f5957985d --- /dev/null +++ b/projects/helper/bitcoin-book/mento.js @@ -0,0 +1,4 @@ +module.exports = [ + '38EPdP4SPshc5CiUCzKcLP9v7Vqo5u1HBL', + '3KWX93e2zPPQ2eWCsUwPAB6VhAKKPLACou' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/merlin.js b/projects/helper/bitcoin-book/merlin.js new file mode 100644 index 000000000000..ce4d8c18511b --- /dev/null +++ b/projects/helper/bitcoin-book/merlin.js @@ -0,0 +1,28 @@ +module.exports = [ + "bc1qtu66zfqxj6pam6e0zunwnggh87f5pjr7vdr5cd", + "15zVuow5e9Zwj4nTrxSH3Rvupk32wiKEsr", + "bc1q4gfsheqz7ll2wdgfwjh2l5hhr45ytc4ekgxaex", + "bc1qua5y9yhknpysslxypd4dahagj9jamf90x4v90x", + "bc1qm64dsdz853ntzwleqsrdt5p53w75zfrtnmyzcx", + "1EEU18ZvWrbMxdXEuqdii6goDKbAbaXiA1", + "bc1qptgujmlkez7e6744yctzjgztu0st372mxs6702", + "16LDby5cWxzQqTFJrA1DDmbwABumCQHteG", + "bc1qq3c6kehun66sdek3q0wmu540n3vg0hgrekkjce", + "124SzTv3bBXZVPz2Li9ADs9oz4zCfT3VmM", + "bc1qyqt9zs42qmyf373k7yvy0t3askxd927v304xlv", + "bc1qgxdqf7837dxe8xkhvctgc499kwh5xw7ap3uwhs", // add on 25/02/2024 + "bc1pruhkl5exjt0z824cafauf750f5g08azuvgcjctv0enz5csayaj7ss3j5wc", // add on 25/02/2024 + "bc1q97vmervc8x9hzr4z4yvzn3x4rk74se6e8x8sgy", // add on 25/02/2024 + "bc1q2lzqzjcq472x8v0kgdcn4m5y8cq95ysnxm6vemu0qsuqgzyge06sqmqdal", // add on 25/02/2024 + "bc1qcmj5lkumeycyn35lxc3yr32k3fzue87yrjrna6", //nft_vault_address; + "bc1qq76dy32nnk5sha36etg6pdj94vl5zrskavux2f", // add on 12/05/2024 + "36n825H7orW1u8yWmvR4zs2CWfmkY2rkpK", // add on 12/05/2024 + "bc1p35l88j3ashhktg75tjctt6pacrgpyr93ldt7yw484dm4expq073qk4n0a0", // add on 12/05/2024 + "bc1pahkqca39mfcfay7nueczyhn9v8wq96x7mp4pjxpsdpsnurxzuwuqnhsdg3", // this wallet was provide by merlin team chain on the 14/08/2024 + "1A7oMBdQir24ESgk8LDccM4MUKJx6d2mCw", // this wallet was provide by merlin team chain on the 14/08/2024 + "bc1q0hgd38zjp2v2rahqverkmdaak4vc8fynyatqet", + "3BN9ECDCAjgxaQUmJCBCM7JtJZaCeB6rL6", + "17z6W1Eq1A7hWcWQiDxUcFTZBVCMsYrLye", + "1McbLy27nLVzJ4ubMnFm3jxnQ3nbq2mpr2", + "17vH7EX655n5L4iPAfVXPn3rVzZbrgKYBC" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/mexc-cex.js b/projects/helper/bitcoin-book/mexc-cex.js new file mode 100644 index 000000000000..0200d05ca56c --- /dev/null +++ b/projects/helper/bitcoin-book/mexc-cex.js @@ -0,0 +1,3 @@ +module.exports = [ + "13uZyaPbt4rTwYQ8xWFySVUzWH3pk2P5c7" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/mt-gox-entities.js b/projects/helper/bitcoin-book/mt-gox-entities.js new file mode 100644 index 000000000000..862186f08086 --- /dev/null +++ b/projects/helper/bitcoin-book/mt-gox-entities.js @@ -0,0 +1,7 @@ +module.exports = [ + // https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/mt-gox.js b/projects/helper/bitcoin-book/mt-gox.js new file mode 100644 index 000000000000..a0581b199974 --- /dev/null +++ b/projects/helper/bitcoin-book/mt-gox.js @@ -0,0 +1,81 @@ +module.exports = [ + "17Tf4bVQaCzwWrDWGRPC97RLCHnU4LY8Qr", + "1BzK87zuqidZn489Wb2oLSktrjKrX7TLKe", + "1Drshi4RAuvxk4T6Bkq959ZvLbvy7b1wvD", + "1EiiKCCnFgHjEvPZdu29qqgdBm8zTvpU3U", + "14p4w3TRCd6NMRSnzTmgdvQhNnbrAmzXmy", + "12KkeeRkiNS13GMbg7zos9KRn9ggvZtZgx", + "12T4oSNd4t9ty9fodgNd47TWhK35pAxDYN", + "15kNZcrhxeFZgVVLK2Yjzd69tRidbFdJEZ", + "1LS5EFRRMDgMQusW6zokQUHjzNUfy6HHCQ", + "1FrV9hv1AW34BGJvobJatyzUWYDWB9epRW", + "1HdKXsNQtzDcfB6PGM7DWTgX9vhBWsz1ak", + "1Fu4YgM3Y9CxvioGPqkSzkydAC8MVaPN1D", + "1G23Uzwj55k2A9TRwaTknqGav66oDTkWCu", + "1GkZQcDy8V6pmHFZqUBUBCnN9dc2hoWasD", + "1Hm6XDmhKCHz68wDEYTapN9MEanke8iwUk", + "15SeCwVCFx5cWyrcdD1Zp1D1zxjH2SELPg", + "15U4VsmWG1cdXAtizvQsW4r7iMxzp64Tgu", + "16jZZkMYqjUWUtQ9DfDvHdH5ko5BcnH9XQ", + "16w6sZBDP58yyeyZAcvnxcEGJpwR9amM6g", + "19Cr4zXpKw43xLJhFZW9iv4DDNtQk2TDeB", + "1GyDutntMuYyA2vQGW5HFcKLfx4cbDdbJq", + "17etv2L3nhk6SCcWSNW4eoZkBy84izAm17", + "18ok25NTkdrUzdByFJCNVsqVYkujZ8aP45", + "199Yxz2TJGtND3QKsHTptTJivqSaUZBvku", + "1AZu7TQmKBAes2duNDctYwjAB9nhHczUnA", + "17KcBp8g76Ue8pywgjta4q8Ds6wK4bEKp7", + "1LLc8aA9C9LLULGbYCYSFKXgxKP2DXdCqP", + "1CZsoJfkknbnW5fKrt1oR7N1ALE5WmDGP1", + "1DedUxzgwErg4ipNi988wPgLk5thwciKcc", + "1H4K3dGfNbAN4AUfyUrpkGpjrd83sntDpV", + "13sXfpp2V16nnxYvW9FHHoBdMa3k98uJw8", + "13Wv5hGhubAWgSPWtXYh6s1s7HX2N1psYg", + "14mP6caC5dFhHdVAPCjPKM8Nm36MBDR5pM", + "155FsTtEFq4eGCcBxDseuwLKPbmtWbyHJR", + "156HpsWfgkWYLT63uhTAGUSUF3ZMnB9WWj", + "15QcKCa84ZCHxbsqXDoKhi5XbmQB8jPEAd", + "1EK8vW7UYaYHKiW4TZmYJKtwcZLM14VjvP", + "1Hb8DmmvvtTYv5RBLuGtDxznkZwVpd5Vjy", + "1HuPVqz2xvf1rdNFUqd62vRTyxP3jeX9Ch", + "13xGCc4TPSYY9GYxBGVNox82KxyjkFnxMX", + "13ahgw8sM95EDbugT3tdb8TYoMU46Uw7PX", + "1439q4Na8v88kPBqoyg8F4ueL9SYr8ANWj", + "13dXFMyG22EsUsvaWhCqUo7SXuX7rBPog6", + "14USZ558Rr28AZwdJQyciSQkN4JT1cEoj2", + "1FhRuUkk8Bfx8FJDemtxhKAR4F8GCNKrXG", + "1Mm9brripN4RPTzkGnRrbt5uDWdqbfk2iX", + "1LueUjEuBgc7cQhsWT8zAfTjcWmrNBZXaR", + "1LXi3x7hyt17cxncscGE887WCrC6XDNZ4P", + "19KiFrafXEyJCUDYFEv3B6tBUwyfFo7kNU", + "18YDgRhxsomuBZ1g9d8Y1JuRmxDhF8Bvff", + "18hcZVFPqDNAovJmb9vA6hEJrDz6uWXNGh", + "1BDZBTb4KE5oq6wAgA6EvAe3uCFRrAbPao", + "195HvmjXgoF3M5vFaBC8swZPhwrE7VhxRD", + "18KDS3q6a4YV9Nn8jcyMvNoVPfcrfemeag", + "19c8sUa54yQuRTVDfJa3iDkkCaFkzBJLPB", + "1B6kJM75iu5ty1HAHMMz6tT1HhjoGNTCa9", + "18M1Z337NqLtK9V69bssnQUYsvb7hmfSFS", + "19eihBKk6e5YD2QXAe4SVUsxRLLnTDKsfv", + "1C5aU4Xnpd3txbxehk46UZgiuNB8QdpHCH", + "1BXyJc6BVuTFnHQCcjiWX2xmCPNVfaSZeb", + "1Ar6meJQCkNoC9wnPcyRNNpzX5fBDaGcKd", + "1CRjKZJu8LvTutnSKq4zTJ4yiqrzMAArYW", + "1HweN9p41BY2RBunsPqyVuheEq7gVoxA9u", + "1HX4s3JeFU3x1eQgPNQVAdx6FoCtbb1hr8", + "1HzEPuenagLEWj68igDXBBXrzc293RuR5V", + "1JtgU6Uo1RAt5eiMf34EehyatUezBQP36C", + "1JVmoJT3471FjsX5H4hAeR1RyrDgpkHbpm", + "1JVU43LNKXqa9W5fCh8tppxDDEWgfeNg46", + "1JztCg7eKSkb1vi7NzGJynXpLZmoaFtYud", + "1KFDUSZuapMv7YaDmL6cyrHTQhma1MtFYs", + "1MkyfwJf7uhWTmVGGQXfcT5ip31DoHMxsz", + "1LzwbLgdKd4eFLkpRdeajkH1YJkVCip2zj", + "1MPJJzRaT8vLhowNB4dVyWRxxu79dq7WkB", + "1MvpYtqgBH7CXbTutrSVCTNHPzm9vakuRy", + "1N5X4kcZ56uRh24XrZoztS9Vb8G7j1Joop", + "1Pq7hooZbEAz5y3QMnqFY8C5xqTdrjUwcA", + "1PRXQEoL8vzEzoJJ9hbtAP6NaV2daccAUn", + "1PxGTuJzDx1ceFHx4Z5CHaWuhiPBNovmZD", + "1NA3Tj4b1jtx9eGELe31Jw4DrzTqKP3ayH" //https://www.cryptoground.com/mtgox-cold-wallet-monitor/ +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/multibit.js b/projects/helper/bitcoin-book/multibit.js new file mode 100644 index 000000000000..d9c9bf3c7a26 --- /dev/null +++ b/projects/helper/bitcoin-book/multibit.js @@ -0,0 +1,5 @@ +module.exports = [ + 'bc1p6r6hx759e3ulvggvd9x3df0rqh27jz59nvfjd2fzmh3wqyt6walq82u38z', // hot wallet + 'bc1pyyms2ssr0hagy5j50r5n689e6ye0626v3c98j5fw0jk6tz3vrgts7nt56g', // cold wallet + 'bc1qmcrpqanjnrw58y0fvq08fqchgxv5aylctew7vxlkalfns3rpedxsx4hxpu', // cold wallet +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/nbx.js b/projects/helper/bitcoin-book/nbx.js new file mode 100644 index 000000000000..b8d0715362a7 --- /dev/null +++ b/projects/helper/bitcoin-book/nbx.js @@ -0,0 +1,4 @@ +module.exports = [ + 'bc1qd79ypayqr03lmvcqc40udn6yuq4mve34ychy6a', + 'bc1qgxrcuzn62qjk3e3echysa9srg87la26x0qn2sa', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/nonkyc.js b/projects/helper/bitcoin-book/nonkyc.js new file mode 100644 index 000000000000..efdc101acd18 --- /dev/null +++ b/projects/helper/bitcoin-book/nonkyc.js @@ -0,0 +1,3 @@ +module.exports = [ + // "bc1qy8xx8fcsmdlc447ls4wzw2tn3y6c6cy64wckhz" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/obelisk.js b/projects/helper/bitcoin-book/obelisk.js new file mode 100644 index 000000000000..713f0b042202 --- /dev/null +++ b/projects/helper/bitcoin-book/obelisk.js @@ -0,0 +1,12 @@ +module.exports = [ + 'bc1p0tr3dgulgpx43dkktjxy8z2azz6yvx4j7s0lelj67tlwct0wnqtqeakfer', + '14ejzLtUSMsjZE8Pp2LUhX3Pf7BbXPeZyP', + 'bc1pr6pga0d44xm3t8z36qnya6sfznsm8fwkn507x6gqt86xtnvm4h4sj2zqus', + 'bc1qy4pkldj4dqxtqypz6awwj7y8vahkht8uqhdlw3', + 'bc1qyd4g2r0n0p9u775z7062rz8j88xxy27kmmh5aj', + '155FvRapVDRbFYxaxGxJ9eCQjgr7X2yC6g', + 'bc1qjnhtrjgr4y0new266twr6x6703lshszuey8zwm', + 'bc1quxgdtm6n9zau50n6aptcyn55gm0r5xjhvl8399', + 'bc1qt887udazek8rl89ck43nar4397a8qkp9qe9qdp', + 'bc1qunzwmk6gkx3ugxd4kmult6vl8vlws0w2jfume8jhnyxmz47ucy4qkhqwu6' +] diff --git a/projects/helper/bitcoin-book/okcoin.js b/projects/helper/bitcoin-book/okcoin.js new file mode 100644 index 000000000000..41c3c4daa9e6 --- /dev/null +++ b/projects/helper/bitcoin-book/okcoin.js @@ -0,0 +1,4 @@ +module.exports = [ + // we only added wallets with more than 0.1 BTC + "bc1q2s3rjwvam9dt2ftt4sqxqjf3twav0gdx0k0q2etxflx38c3x8tnssdmnjq", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/okex.js b/projects/helper/bitcoin-book/okex.js new file mode 100644 index 000000000000..359fcec6d0e3 --- /dev/null +++ b/projects/helper/bitcoin-book/okex.js @@ -0,0 +1,186 @@ +module.exports = [ + '1LnoZawVFFQihU8d8ntxLMpYheZUfyeVAK', + '1JQULE6yHr9UaitLr4wahTwJN7DaMX7W1Z', + '1DcT5Wij5tfb3oVViF8mA8p4WrG98ahZPT', + '1CY7fykRLWXeSbKB885Kr4KjQxmDdvW923', + 'bc1quhruqrghgcca950rvhtrg7cpd7u8k6svpzgzmrjy8xyukacl5lkq0r8l2d', + '16rF2zwSJ9goQ9fZfYoti5LsUqqegb5RnA', + '1FY6RL8Ju9b6CGsHTK68yYEcnzUasufyCe', + '1MbNM3jwxMjRzeA9xyHbMyePN68MY4Jxb', + '1Lj2mCPJYbbC2X6oYwV6sXnE8CZ4heK5UD', + '178E8tYZ5WJ6PpADdpmmZd67Se7uPhJCLX', + '1BsdDaJtgFZrLfzEXvh6cD4VhtHHSHhMea', + '14kHu26yWkVD8qAnBfcFXHXxgquNoSpKum', + '1AumBaQDRaCC3cKKQVRHeyvoSPWNdDzsKP', + '1DnHx95d2t5URq2SYvVk6kxGryvTEbTnTs', + '13rCGm4Z3PDeYwo5a7GTT4jFYnRFBZbKr1', + '15Exz1BAVan4Eweagy1rcPJnfyc6KJ4GvL', + '18QUDxjDZAqAJorr4jkSEWHUDGLBF9uRCc', + '1M6E6vPaYsuCb34mDNS2aepu2aJyL6xBG4', + '1CE8chGD6Nu8qjcDF2uR1wMKyoWb8Kyxwz', + '1FTgXfXZRxMQcKSNeuFvWYVPsNgurTJ7BZ', + '13jTtHxBPFwZkaCdm6BwJMMJkqvTpBZccw', + '1FfgXrQUjX5nQ4zsiLBWjvFwW61jQHCqn', + '1DVTB9YKi4KNjyEbAHPp17T8R1Pp17nSmA', + '162z6mSSHzfTqb2Sn3NUk5r1Y2oGoCMCoM', + '3KbDzhb8B5pUU7Wk1y26J8D4cxYLmxJsca', + '3A8tCFwWyHQey1npTAWYTtrjLPKLXpSpLd', + '33a278YeJBRvQuemSo6yeugafqdS4x98TM', + 'bc1qc3g2dx3fn9s27v92n555r2tzhkxhad2wc0wm0ahlgpmhsr325mpssz80s6', + '3ABQAsnVgK8gDCBtWeEuoRvG3zdgABrDHQ', + '3AWGaggM87Nnhit5DwYYfXyvzW1NYutCw2', + '3QLVSDvh1r9u28PDWUDyg3nR7HqxrUZ4jA', + '3QFtYbR22en2AizTb7JVFA9bL2rf1fbNJr', + 'bc1qrp6msfnqxrl2gp4phmq6mcz995xc6m8n6fn8nygjfg8p63ncy4gsp3xn0e', + '31qq3eDdNyvyoDGrNYAAN5GU2BagDNANFf', + '3BdEq8vnX1o1J4Zpwj6wkPh5FxrgxLAibr', + '3AVMfb3vJi9CbQEGyoHmpgptgbJioyKykQ', + '3MYUxfT4mx8imVz7R8bVs71NisrYnmjUbT', + '3FS1EFCqZM7KEhsVoiNu7NC8658Kq4oCiY', + '3BiWZUFxpjJN6W93Fz3aCcCPBTrpYWwyoS', + '3NiufwUuJZnUHmgSopESaeLBJkALzJMcgk', + '3JcWcMPtxGaCuhKeucTMe1V865t7UhrNnT', + 'bc1qh0w73elagqvhfkkulrah0s2epdp922d3e6r8w43uz0e8ujafcjeqcz8lwa', + '3MWakirPr7MnizUAtWuDJmt919PZciSBvi', + '3LEV2xDk8D7uy4PVEGFZUm9fcT6XvCvHen', + '3FR7ZCHv26jaWWzv7EBPAXGgBpFuVFUnH3', + '38X48VjATu2AHowPzHefNqVvKyheGzVv8k', + '3AgGgHDcqd9sxYiagskZH3EPswwqza1TXd', + '3CGKuMZrkQQd4zj8FsTmDhineKACFpQBZX', + '32hhwGNtGTZ4J1LLz7p6o55Kxm7mzgREJ4', + '3E9GBso3ipQb2fbT3PNbeqgj8RkgJcR4X5', + '34MdsKf8zE6NeAy98TS1yxUTEoBkDT2ZwZ', + '3J7F1pczapCk1sRef6Hmvh9NfU6QiV3w55', + 'bc1qdk55vq5vrzt44pn93t9e3rwecw2dy4pcwc5gwugdjm3sh9xuqu3qzcwt4h', + '3PDMVx1YRhySaPEtCV2AT1aEq9DwgPU4uq', + '33j5fuJc14aff3Z6vHZBxaHEKMdNmKbRxQ', + 'bc1qvg6drx4rdcv85pteka94eskh740wrtgulg3tp7gcmm43vgund4sss4vzyq', + '3QUyiuBQF46KAMM7wdnDnu8GKVQYieRQ1N', + '35D2tNKFmqiVrvXan6tdxgatZoCBimASmZ', + '35Wvz1krBwzgQ7REXS7iJp3Qz7k3rmFNNF', + '3LMYZ3jPoKW2jscuT8fj8Nh4d66W3uX8us', + 'bc1q37nz0uheu4997ufs84efw7jw248mk9v83sgpmvsr6nawhaadx5lq2hclpt', + '3Mkfqxh6BuYCAiKxuvVWKn64N2xvReB3wM', + '3ANAufFoSaVJefhAZ7h9qViqdfJKoCWvbC', + 'bc1qnw79hhts8r84gykqkctyhu3j4gckll9gqxktzqgx5a54m347zf7qxhcyn8', + '3MYrRpUhNWxB8Ydk9gvMou5yZNtXNynxcT', + '3LFcssbNQRmRCCEUSbpDA5yzhsFH5waDoe', + '3NEwT3x6nrab6Wxddwb7jbWY8KYqJkewGA', + '35uFYLvWLQuEo6GxSGHT8JigaoUyqmNJjE', + '3DWvnsbAJJTLufQ4AhQY7LsVQrKoLjEHXQ', + '3PdNS2nqeE6G7cTcVmGjAVjz6HaPcX2FGj', + 'bc1qwkkedj4nzep7dw05s335x6n23520eq955mpcwypftn5q4n9japmqejkxlp', + '3Qae3YK3eKSoM57jpVYjvWkS7E2KnPFHSU', + '34HVDP9RFA9MpopGQ4TutLLVMFhhJFM9AX', + '39ZEaLMDxWi5EWx9cQ2W3ixDP8rWHhz8GY', + '39XwkmkcMAakYG9E564F6RZcp1RSMhUw8X', + '3QpVtFcEdVPTWqZbo8cSZwRgbHMbSEDoeP', + '3PHu7Z1dtRYbeum2SNWFCA4Fmq8r3UeXdQ', + '39AabFsw5ew4QcAC7zpeNkuk58FoZnJkvy', + '3NXxvFdsXK8DPRuGKbhNsvtP5FoL1s6hzF', + '3Jg623UZuqvvFLYbBsqqYiBCAyWUQUDG8k', + '3DgW9QH2GoVVoqwJd3paooAScy2vusEJDu', + 'bc1q8nne4amt4wjdaa0yxuzyw949xjd7fh2w9whh4uvh6haf6c5n2kvswnxk0e', + '38jFY6wBwBpFHtM4L88jF5o155SRVvr2wT', + '3CtTopUBx6QZomCjQDvbW65RtgsWn8g9LS', + '3KPPCAsWf6dxamkMBTeH2svaTVS7xgeL9q', + '3HoEwvrqYRnrizFN7gTg5ouSbV3Tek9pab', + '33yFzhVfaY9phULdN8kBfz2UfyUVZhFHNH', + '3Akts59LQNb7GU3gtHQcxh2r9zDfyUE2FJ', + '3EdYLLYiYpoLt9sEQ9KQQ3LbF56YRoiFPw', + '3GGLdxjaqvaguzTX9z4UTYaCoeu6sUyvNi', + '3M8Xbr9vobCoxMCWwxsS9doTP6HNQvx3op', + '3LcquVjVeDpFn1oJBs6mu2H5cc3EVCcJ2i', + '34Nr2xntQYxtnBARQmzswbuB1hNhnKvkoV', + '373oyKosqPkcYEsF7ipbw13WwDmvoNGgpG', + '34dhaAMB9sCBidT1LpjpbmZjkecsDpGhxH', + '3NRgSpzcsGA5mkjKinjTgBzfBYc9CBGXwW', + '3FMAKm9fEXfNXYtb6qBGaJvG3DRKtvPy5E', + '365S7mJV4MVqBfutYw65KuURCiohnMhzWh', + '3JJ4LULa6VtcVVxZC9tsNN9JM693mcrCeE', + '3CB7RwASFyWfYNCSWrri8crPhfK6yynMQ9', + '3HzYEwURshSeJZJn1ak5ioHKQV5rfZPXY8', + 'bc1qvusjx72vh3qkvw36jdqvl6sdye8ne8hfdaveejprj6xc24mpd8wsrf6w07', + '36U5xAL6FzFetzebPNT1ZQnANEk1TurVJr', + '3LkDsn4LZgYnMqZF2wAXCVs6kc72xpNLLz', + '3Gmt31zvMb52fJRRvLV3Pr3XTeDvVjGHAr', + '3DdCY3f5Ky92nSen5M2M2bzbBLUhMWafG6', + 'bc1qck2mvm6wp8xqxlk98eyl89kgwtmgw02cgqwsjstkg4uerqpqclxq6se9wu', + '3BexyYLsJQuN96qDRsnrU9yACnUSxxjWXx', + 'bc1qt5t0qhww0w7uaczxn9du7yu2l2hgpnen06r42u98du3cs6tqvezqatj38e', + '36PCQLrcXhNG3BZPeaND3zCW7cHgzDVYp3', + '3KGGtqwaQahxaN4GovThCyNdg6THK17Lrv', + '3FLnTqeKpK8CXiEA39b77pCT85sVWJXzN5', + '3AL5dD3jvpDHu8Qn7yZxGdpztWxieKxF4R', + '3G7e21FgygBmWDRMykauLANpuBK8iKqXpJ', + '3Kg2JcNnBczmHSX3udTfrKdqDy1gkrVZak', + '3QJBNEMY6TezfEBXGoc5PUKoLSCcWUd1Y5', + '3QQ8Cotsxbs9qrAyqLKaPjofzvcy5qipCY', + '34SG5K1QrntsigARCZJxNv8NwfSmQxPsDi', + '37Pd5nJZyXwjoGSwKW3ivWfeaW8VSjCey4', + '39J18vgfymGnJ2EYp6fb13rHNKBASbuMtf', + '3JwZq9s3yBhi8FikgYu2RvhjyBAhnSiLgy', + '3H4T7yRpphtyzpDUEiwBTtBa3fBMvHaKUZ', + 'bc1qrysu5ykl5pdlk7d9j0z5rwak5h9rus6cx2udc0s9tqhf5842nqgsdtgtly', + '3JqwqaLxqnDqXuJuKKp41UFSiFR1CuqznP', + '3JqzTCvFxye7nrVWGTBH2CNqZ7bbFppBww', + '3KWKbaAsf5qmbyBHXnVH6YqBgP4ZcNkUsc', + '3FbmQz3WvASHgCQUz3C2JmGdkd1gQFLdC2', + '3FMrfjg6zD3CTXSHLAiRcn3RFyBR8MMFR9', + '3KeFqqpbJawWvAudsi4q8Zx9Lewponyyht', + '32G39DN4kb9Sd6hk8RKySDf1QVFmQeAwtU', + '3BqZtfY5wZk7qHQaQJ4gBmqGLnakH8ybRy', + '3K1WNLse7M28jbowGsZmNaMV9FsM9yW3fE', + '351qZH3E9rwXg5ZDY3tgvsYhkm9CnYV25N', + '321DUXbk9gEEKG72DU2TcADDyfZXkX3fHP', + '3E5jAXsSi5x7oj6GQuM6WQPuVZaXeYd3sU', + '3HEBzhigBkmhVf7kx1KFXif42AqQWr8KH6', + '39smXTQdqD2W767ipLishHV4diSV4xNFxA', + '3GQ4DGB2tfS6YrwfVg9MF7KBRCLWkugLWR', + '3AEKc9AokfB1nBvsdS8LVFJysZSQBJRrny', + '3G3Sis7s9Jjex2Pcaerh17HvSJ19qHNuMg', + '33YfoFAdobotJkMPUqSh2ms9frvRRfRzpu', + '3G38Zn3mvixfamrKJJtsubiEL5gCQAGnSo', + '3KTFyMGHcjWjWE1UqZRM3T4WnHuQt95iRo', + '3JQmpJYkZrVczaNDCyQoLe6JXV3vGFY8ce', + '36EMwG1FHCrp2MLm474CnE9rTQDWFF1uTF', + '392Bq5jWV8NWUTdV59VCqoYviY5KP9q9Ee', + '3G1no1sZwQuNYd5H3m6seWw9oy4E4Yu1pP', + '3K376tvxysV4XDtTTEUF47Xc8LHdjof6kR', + '39ciFiDp9yj1vLSxHh6c13DiVFhcBab7NT', + '3DUGtYyorAm9vhpo3KbMURMiR2CByP6BoM', + '3DeCWk98Wp6bG9apmqCCqTfRc8uVdQ1vyw', + 'bc1qpkgxexfg8ah0j0ffk3ge3d4para29r8ugx02ch7daja3s8u4247qw2d2jq', + '3BnCzXEqQi7VDMfCaGY9zbSySuy5uQUaRp', + '3GkiKw8DBm3nSqjL1mZLJdp4yq6WEkkyoR', + '3LTvYTkSk2jq4a6mPVMadJ9vzv1V6RMDGq', + '34Fg3q75hcnjyCoL5FLPKaDM1bewFCPKsv', + '357DauGAnsbGpMgAApUqTFHCgyE2kXA9SD', + '3K1sq7TwuVEbvyADV2oNz6DYX2EhWSrVxC', + '3LWHs1HvAF362RHUc6MKL4jUPWcTw382pj', + '35oBhEfzDyCMz4KY6j49iu8xjtbHQ9GL7H', + '3CZTmeG25AXcjYurJ59mcFR3BvS4onF61M', + '3C766rkZjRvmvhGmyGeH2x33ciUrZHarvE', + '3DXZB5fAv4ujHv3dfBPnU6qaDR4HDUEuwY', + '3LnMEFH8kYMeZ8d524cj4RgXMVmniHaBSF', + 'bc1q2gp7s58gf75sg5g8v6ah8z90ghk8dqksa62u27gmz850cnaclshsfjvlr0', + '3Ca537VX1HufiVRfKVogWcD85RV3iuFs53', + '3BxyyKih6788xBQKk8aMg1cD3qP1x7Gqgr', + '3LceSbWiDHYvy59BW2swjiEQZkqvaijcsz', + '3MjPfBpz8oDcEJZphpBuiwRnvCAASFsgT1', + '3DdvsQoGp4wtvCAbyNBEZjCoWoWQL6TssG', + '32ZB86r6jT4DkAtnYYSHP99xtcai8LePLP', + '36yNiwCxiEtubUpzBLGPeSBCbubCy9i3QW', + '3GQUyZH3EPoaHFzjWr5peAKSQFNGxxmVw1', + '37wL3HQgir55T4o2Lv4Ygrsgat5W7iPnnd', + '38qt6S3zQKizRnafitwEdz4dTj1fx72dgY', + '3EqD1B8pMgdRE9iPEgUXAzpcyxihW4tbgA', + '3P7a4wgoTDKn8F2g2VB62pHiV22XzJGGbd', + '3FyaksZvXsZxEShwdpNMK7awgDE4kBuKmN', + '36CVsC2nLzvFejTuBXvCFnt3p5QsKaGzwh', + '3BjsuL5pVVWBFSMtoB9cg2d2hsJzJFpo3B', + '34w5Da4HJ54AWTZVo8JrujhV1v8iRZho3e', + '3DuUe32HgxGg8RQ5sFk9drcKRVmwNCAHhV', + '3MoQyLh75Niz1s573waSP8pc95sqQcdJXd', + '3Bvj92ASRnTnqj9kdABSgXJgrBDy6XEgzq', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/phemex.js b/projects/helper/bitcoin-book/phemex.js new file mode 100644 index 000000000000..662e7ca67138 --- /dev/null +++ b/projects/helper/bitcoin-book/phemex.js @@ -0,0 +1,3 @@ +module.exports = [ + "3PiGxVdpMjWSsH8X8BypdwcsmPW5cmE4Ta" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/pionex-cex.js b/projects/helper/bitcoin-book/pionex-cex.js new file mode 100644 index 000000000000..ef591d3c194f --- /dev/null +++ b/projects/helper/bitcoin-book/pionex-cex.js @@ -0,0 +1,19 @@ +module.exports = [ + "1D2Pds2XyiDe7CknDumKkdSECuepGsBCSR", + "bc1qs0jdyydyd4kv7fwqre4suhz33mcuy3838xdsla", + "1JkmFSbqijbrv6JdyVx2hNwyE8nzEy3Cs5", + "bc1qctq0v0vecjxp4de66znkh0dcczkvuqjwwt0za4", + "1KH7cEFwFvKfnx7KjMaQUescVSigz3FMaJ", + "bc1qeplx7cy5xx37m9mtrh9qefeuswansr0c9mvewa", + "1BgvqcFm2cYRg8HCrd4qWnC7iA6tQqoeme", + "bc1qw5lxcrk7l2xsy2wx5mapdz58g29xde4x56le3s", + "1A4Ag6y473avEbjVm5N4HAqiVCE6NxLRCS", + "bc1qvdf8f85dn69csyka5tzjezsl66hdhmmfgwgfzz", + "1PDgKsiQo8hkA5pxYBwS1ooXv9jFNJCFh5", + "bc1q7wufvquhtmmd7eepjdu76lumj6efmfl2p6sgch", + "1CNEXYtt6WYZuMwJF7AjNYr39nxbrUTRoh", + "bc1q0jkkjr2qr4wl3v399algvsjuk8g7vlm3yaqufu", + "17UcdCaVWpmgpuZsKfKdWRUUViAzoQFY3H", + "bc1qguymjgurnywqac3rrplr2nmkl26cf5jyyq3vkv", + "1D9YPYQevtEsk26exBjCY2pKfhDsXTxJEE" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/probit.js b/projects/helper/bitcoin-book/probit.js new file mode 100644 index 000000000000..a68a94a01ad5 --- /dev/null +++ b/projects/helper/bitcoin-book/probit.js @@ -0,0 +1,5 @@ +module.exports = [ + "19EgVpboqNjortWyhJSDAGRvHDtduqiSfr", + "19AtrEvJv7UY75tvWkXMxLUAYibxpZhFfN", + "17PpCEuQUT7xxP1ocfhvFdwQyrB5dG1dQP" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/pstake-btc.js b/projects/helper/bitcoin-book/pstake-btc.js new file mode 100644 index 000000000000..86a053a920e0 --- /dev/null +++ b/projects/helper/bitcoin-book/pstake-btc.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qajcp935tuvqakut95f0sc9qm09hxjj6egexl9d", "bc1pzq0ve6e7j6jt4ckx8uzdjyddrfda9ew8dxvrjmkxmfnj9yz68zeqgqh9cl", "bc1pjp9pg0d6wcejlg576st4s8d424zx443mdumdhvjcxx5ehnfk4xcqyru7ay", "bc1px92pntcj0wd5076nnymp787a7qczsaauuefgntxngdwvkd584xgsaagem2", "bc1pxhkczd3jq9nq50p2xll99edhxlx5dj6ztgw5pgtzszjtlvg7tl4s8ttf04" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/robinhood.js b/projects/helper/bitcoin-book/robinhood.js new file mode 100644 index 000000000000..784b2493ee52 --- /dev/null +++ b/projects/helper/bitcoin-book/robinhood.js @@ -0,0 +1,5 @@ +module.exports = [ + "bc1qprdf80adfz7aekh5nejjfrp3jksc8r929svpxk", + "bc1qmxcagqze2n4hr5rwflyfu35q90y22raxdgcp4p", + "bc1ql49ydapnjafl5t2cp9zqpjwe6pdgmxy98859v2" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/rosen-bridge.js b/projects/helper/bitcoin-book/rosen-bridge.js new file mode 100644 index 000000000000..064b7f1c73f9 --- /dev/null +++ b/projects/helper/bitcoin-book/rosen-bridge.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1qs0852en99dfctv0egj2qxnmc79mhjgn9ap975t" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/roup.js b/projects/helper/bitcoin-book/roup.js new file mode 100644 index 000000000000..7ebc03299dc9 --- /dev/null +++ b/projects/helper/bitcoin-book/roup.js @@ -0,0 +1,6 @@ +module.exports = [ + 'bc1pv5lu5aklz64sye9f4zmnjkfg8j6s2tllu3fem4cs9t0hcrnz5e7qy0qw6e', + 'bc1p2tncs8egnj8e6qt46np3qla70mfx4telu92v4c9hp3pg8khqp37s9lvmfx', + 'bc1phnxqw4gfq349wm2xcqgqk77544ssqwa6ycuhjh7hdxks4mtjg33qrfenw5', + 'bc1pfsu3ts4equ7rdy63dgt7shkqlu2n5kw8p0z7p7c8lsrh2yqg40fsvz4ev3' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/silkroad-fbifunds-entities.js b/projects/helper/bitcoin-book/silkroad-fbifunds-entities.js new file mode 100644 index 000000000000..862186f08086 --- /dev/null +++ b/projects/helper/bitcoin-book/silkroad-fbifunds-entities.js @@ -0,0 +1,7 @@ +module.exports = [ + // https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/silkroad.js b/projects/helper/bitcoin-book/silkroad.js new file mode 100644 index 000000000000..862186f08086 --- /dev/null +++ b/projects/helper/bitcoin-book/silkroad.js @@ -0,0 +1,7 @@ +module.exports = [ + // https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ + "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", + 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', + 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', + 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/swissborg.js b/projects/helper/bitcoin-book/swissborg.js new file mode 100644 index 000000000000..d9b9a863f467 --- /dev/null +++ b/projects/helper/bitcoin-book/swissborg.js @@ -0,0 +1,8 @@ +module.exports = [ + '18DowXoMUQT5EU8zPTDTrq4hrwmi8ddCcc', + 'bc1qfu6su3qz4tn0et634mv7p090a0cgameq6rdvuc', + 'bc1qutkfwnuq4v0zdkenqt5vyuxlrmsezldzue5znc', + '1Mgs8zLJ7JyngcNRUscayyPHnnYJpJS5x2', + 'bc1qc8ee9860cdnkyej0ag5hf49pcx7uvz89lkwpr9', + '1JgXCkk3gjmgfgjT2vvnjpvqfvNNTFCRpM', +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/toobit.js b/projects/helper/bitcoin-book/toobit.js new file mode 100644 index 000000000000..7156f1b2d45d --- /dev/null +++ b/projects/helper/bitcoin-book/toobit.js @@ -0,0 +1,3 @@ +module.exports = [ + "3926KKKCqcLaWpAau73TMo19sNv23s1wji" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/tron-btc.js b/projects/helper/bitcoin-book/tron-btc.js new file mode 100644 index 000000000000..debb9f64836c --- /dev/null +++ b/projects/helper/bitcoin-book/tron-btc.js @@ -0,0 +1,5 @@ +module.exports = [ + // On the 23/10/2024 , defillma receive a PoR from Tron/HTX team with the respective BTC collateral backing BTC on tron chain + "1NBX1UZE3EFPTnYNkDfVhRADvVc8v6pRYu", + "14NEbSYdjumn9h4spMjbp3PdUpeXuM5PBZ" +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/wbtc.js b/projects/helper/bitcoin-book/wbtc.js new file mode 100644 index 000000000000..3fe67c4ea761 --- /dev/null +++ b/projects/helper/bitcoin-book/wbtc.js @@ -0,0 +1,341 @@ + module.exports = [ + // WALLETS FROM HERE https://wbtc.network/dashboard/audit + "31oMgrBjhbAr1ZZjFUFYfDT1ZYvx3Qp9qL", + "31qyn946XELbPKMaSWhk2SfFN8ikqLJ1GY", + "31rYKY9PysQgRoc6eB9fwJ3e89F5dcvRM4", + "31sADuWnUApAxzXJZTaEziCn9DhZVUajwK", + "31sW8NHLr9MELRdoGPWrEk6wBd1pj2uzkB", + "31x6dwHmXYHqd7YiwvJNPX8ryvDj8Cdht1", + "32Cav9GPxma3wRprn2FtPQ7gxmCZ8ZEmzv", + "32Ks4Rtb1A5NtzexGq6zEeqHta6hoqvCZW", + "32Ver3t9feJgByfNLF8pggtNFPMf22iC3Q", + "32fN3YjNhtAzUjBHfTVFtiPBFPgy1MkBAC", + "32hJnfPp6ZDnmkJ3tosoo6PvEemFr1z1Bd", + "32hPQh4EMBS14BMutrW2WJ4V76yxuXHJdF", + "32iT1QaoQD61rZgCNLccNqAdbnx4HwgvZE", + "32m8wzKabRRF7o6JRXN1srLSA5FzND769o", + '32oLNY3suWAZvYTBeAaFFSk32rJtS8w9i8', + '32okkzumvdoocdjN18SzbnTTNd2omQvvt3', + '337ot6fHGs4NCZwg2cKwShhrYX46g8ACtQ', + '33K5r4QntjmmD4mzSHq3WQJQtf4Dw8jvcZ', + '33PbQFD2eAouKnKVTBvZTFWE2pRzLgJdro', + '33ZA8VjwL2oucQceCP9WLEVunLkLvhaaPb', + '33epzdB4nk3FWHtUpHMQrzTWxiehSti11v', + '33gNdUGQTBT7cUbNx4892keGA2L64ixrfJ', + '33jqiX8NtPd8empn7ibEc2tn25GUx8iUE8', + '33xpP9NhBBmQt3XS1mD2g4pi1FZNuUFVR8', + '343uVxqsriiveWxekC6s3mNaERzsbfke3h', + '34CyVpeNgNNEoBdEoSSH6aTjrUZDavaUtr', + '34MPipmU3suumfX7WxTUTxmLX2uVK1Np8R', + '34MSicAL7qVGkevFPLwyc9KohGzoUSnu3Q', + '34Qg9U75RNPqAmZzF2amJ1XNGQyVek7HkQ', + '34whRPeeSYTPcihybfXmkG2uoShUdT3d2d', + '3573rMHLB3VABY7VaXMWhRoCBVspLGC4xV', + '35AY8sKs3yt3FbZpsmAtgvSXBZtvqqwc8e', + '35HfRwMwqB7sNTwijoG4fGHBmfWMm48aaB', + '35LMppVy98ofPKeUXUk79FUSkVC8yiXHUF', + '35QASqiGmQmHoccRc8pk9EtPVDFZDrFA59', + '35ULMyVnFoYaPaMxwHTRmaGdABpAThM4QR', + '35bXvntqjj5LnEpRVqU9bLcAPtT9crggYj', + '35cv1mcZBJkvkjY2KQSdmbo7Mq7E2yEVZD', + '35dn2Sfsi9qmqZke8SfSVcaggED9uJYQhn', + '35sfxCN1Gz37dq9KkpTfW56W59CK46JMY6', + '36RYMHxKrvNvrFcovZVXEQWC11LLbPE56V', + '36U3VfLRN9kbQQXRGwP5SGUYebSB3MqVnp', + '36ZsF5YgJDW25eZKS6gnZMqW4gr6wv9xp1', + '36h9DtMdqYWTxSg1yys2exZPFQoQXv8QRL', + '36jGhq48YgvjJWtEpqrc57QzXcBJQyCsS7', + '36jYq75ewM9AMTfnKRTwkPBBWwJtGg4CsE', + '36m2gCFRpkikK6AXUQGKLabKmd8PMjwx1Z', + '371SbkDHpTvRuYTwayWsBNsXK93Tj4sDAd', + '37Tgw6PStVEAyfAJT8yEvLAcxkoRYK3hDz', + '37Tob2tV9LRVzJng6Z4YCLyPsmq8n2xMQi', + '37aZoS67WApGWTDsn2rYDsxebhTdZSR1sh', + '37hV1tJYctQLPin7vCSjpDL34PpiiUTyTx', + '37kFT7mcJqgkqKbd66VbgkHSQgnys2V7hp', + '38EovPeRhGniW3cpYLJwptCqJkx9Y1Pg7G', + '38J1ce6tPUgy958VBkGGa2AmFU3LQLJ2Gv', + '38R6URq21qncKbYiiRXPi2MVx8xYRgDtWD', + '38b9cazfu4SxqoahgdiHEMSo1aNDdKquRm', + '38bzm6nhQMFJe71jJw1U7CbgNrVNpkonZF', + '39P2pJ9EmN3qmPAm1TTZPzp6T5LSsJq3eQ', + '39RMkGSQUQjifV2TpgRNYW73JK38xwA3NJ', + '39WQqCosC8ZD4S9XBPHRnnRUeVRvNctnnm', + '39e7mxbeNmRRnjfy1qkphv1TiMcztZ8VuE', + '39mayj82aZdb6UWs9qQAZZrC3VzfxUQP7c', + '39pEDUwFFj28sN5muXrmT5mAbDJSf6qEL2', + '39ydxDT3H6KygeXQn8f1tYXk6BtCTrsutw', + '3A25qkpmhCrYGEZh39wc71u89dSXGCYSvd', + '3A2wJ7LBiR4NhPbJSLNVfzZk6vDeYYPrit', + '3A37hJV9JPWR4UMCXC3QvKSeVGiRwgGtiU', + '3AKea5UYSyMc2oRRdQYhkn57nXWMm5woDz', + '3APCmmVbkpKSmLkTbGUvdPUyfqA4CZ25a4', + '3ARRJS9VNVkMdiESpxq2AGfpZUQRUvdGgd', + '3AdKaaTBFPQgpFen9YERPmrfV7QVvkYQfp', + '3AfJyKGXVBUcaWdyJeWxsasq1dHPw8pRZz', + '3Agd6vor95XcHvf1MPKE69KEpNbZTKD6JF', + '3B9UDWZNPdtL81JLnnPEJoiurcmaGx8DZm', + '3BCWh8prqQDsZDi6Pmvut9HJrhii1Vk7Ak', + '3BCm2gVB29QDFLWt768jjTwKoe1N1QVwSU', + '3BJJ68V6H1CoEx4MWdhqVk2kFpPUNVbs3T', + '3BPbdokvatbZEFJHuVUstG9zeSDLr5RdvL', + '3BTqdvZt5MYYWLAGXt8psAMSAa8Gh2AVPA', + '3CDy1xZavmpd27jV6TZm5teH8U6hrdXRES', + '3CPEGQzA227hHR2jUf66MdgBJ5wPnDdaW9', + '3CQBneh4TJtHGUP4QS3mfJc75NoiGgKwV3', + '3CdzzKFGY7ZahrMCM1tBgoxrgSPUWX4RVY', + '3Cr3vRcZD5q4XbXCVTo8sFCN9Xb7z5isth', + '3CrWGaRncSudU3EZPEhvWqeU2PG1xutr5x', + '3CuoRMhRXvsxdYsNL4kmKDJyAhaDB7SmBn', + '3CxK8MVHuqXW85z4MF7A4FYk8k6jKPFgPW', + '3DDUy5Ze4TaqKFpktAhHcmmffz9KKGtTrb', + '3DJNy9xMcMsNdmdipTgqME3TJCRkv7uS2g', + '3DhbEcm1SuJjTRxZBXxHyceYGm7GdRB2pM', + '3DiJgisVit4pqj4ByKxi5p1qdjGDxpGfR4', + '3ERNo3RAgP8o5jqELPKUEV47ADm4JtvKBd', + '3EedqW1fD4QRFmrPgkZZZvzHRzj9f4xVSX', + '3EmKqHZhXic3TymhuY8NLS7Bdk91erm4V7', + '3Epe1CixppBP9QSQ7DkvsWNKsgifTaxMY2', + '3ErNFK17MbH3GAGfakMwTrKo8uHmBuuVX1', + '3EuEvwodW88xEuwecsLb76x16tLxcUZAxx', + '3FDtvkk7hpZq5GuEJxt3Ps95vjtdDEfJ4T', + '3FFgKaYkEf1M73QtzuY9DGqC7VeM2sAQhT', + '3FHRnMSaGMAaLcoHbA5EVcEuYVxTEZdTyp', + '3FKkCxSZe1c4xZiVyJVBTbvzs9Lj1snqVC', + '3FVsTChmR7WYgfnU3CAmrrD3kqmaRMaJCC', + '3GE2pWumzKXnNMA9PFggsBwyk7NYSJvGGg', + '3GTk9xdRHnPQ61Pm7Jnv2Z8hsXv5FMVyeY', + '3HFrW63zQ58PypYhSYgHB2gij5VirsyRAm', + '3HGSCuXjnfEncUCPQ4GzNrv3BHcmLZFdeT', + '3HHLh4HSK8wj1w3YW9i4Chdnuybgadhpz1', + '3HM8YGKhwwnZKmrUEoGroEgaG3dv8xkVZz', + '3HVCDPPbAqiRwRjXhvu7PSDkLGgEajexuH', + '3HaHcbNmhJKgJ3dtbm2tg8XH87BJkRx7QE', + '3HauLvRoUBueiiLwebk19w6rnUTYJkdwNW', + '3Hdj2n5DEKPGsRd5md85exAXdwnRbomWTy', + '3HpHptRrwK5x9i7uULvk116QhsAnRJfJb8', + '3HziaqLNy8PpyQFLdwr2yxCjwEjRUjN6Eg', + '3J37HnDBzWN1sm65mbD9U5zvKrp2bzhuYJ', + '3JDewabYE785vTmaQe3MuHvUvEZJQTx8HU', + '3JMDjCYxxi5MF3aXRx8Dg13Rign3masTXj', + '3JcNkH5QWYuSfiQYADq4yV2hAYnQ8KC74t', + '3Jj1juATP11jHfBvRiu3BbzdJCNeRskqzJ', + '3JqwUY7pUwEWu2hz6mwzZKSQnvKyRRXCQM', + '3JvmhjuxvLVM8NQzAwwMvzWAK6zDLQ5Aor', + '3K2mpXMDFe7cT1baogitkRGeXqCYeDw6J5', + '3K43ux5cCAxfKgymq5eHnHS1toC9nrERbT', + '3KAGrSyTsKLckBgN7AiAfojbScfjGAHwFz', + '3KT7jvZyvhok3fkZt8Y9w8tcqpyQW5Jg8s', + '3KTeq879YjzhqkAXzZmdapJAVC6qz5qEth', + '3KWe9k7TG2j7xNw8BP9YHXBeHy1knC1xGS', + '3KXKTXR9YxHuhm863nqnSrKznkYtcx7wC7', + '3KeG7RzDwGaTywRfQgPCQaeyMgi7C89eQc', + '3KwPoNu1FxihhyRKjv1VG6C3FPy8vgjyse', + '3Kx4doXvL4UhDrKJqn8FoS5wVU3VeS9ebM', + '3LScoRmRA3kknxF5dLxz6wfw3z4LXRiVyT', + '3LbLR4uiq7RFrWgDKHfdgktAC88qtwY2Li', + '3LrxWneLHwvbNrMKXorkc17wxHqCCpNGkq', + '3MJ4rpTvuiTxYhTppNx7NokNUDZg26ofi1', + '3MLH54DXCtmydRocRZz9pEkfTTGWribBa3', + '3MM2BiaXBACfKUtVsyNr2RDXyNEhunez6v', + "3MPcUSHeWCSxCUsJtTS2L2zZfWLvorNFef", + "3MUJjyx13waUriNPkVnemdoJAiJT6nBmef", + "3MkzCjZjodyaBXz7W8i9NTjduEdykdkd89", + "3MnCLWSq31hetgbVA1Xn1VxVVb31SPeSKa", + '3Muz5dT5EguQgTiXgQ1eqJYNkjjQuSMgsb', + "3MwfxJqsy943oqYhbdKiaBrFSK9xbyiAi9", + "3MzRi499Cbcr4795iRnznfC97EFji23h7n", + "3NW5tDLFceDb1a75QkGampkuuceZ3YPMUX", + "3NfBFZRgKfHVJy7rSTutZyGpa5M2GpRdwu", + "3NmVi1xVYZj5YXU8wcQyoUfcVRCLcYhqqQ", + "3NsC2NXzKum7sVWQLQ3YYB3o9JbTz5FoaV", + "3P4EDeK5fxCLEQzM7iQ7n95DWgG1cXSaqG", + "3PRCCQMdWwjEKy89iVdL8LouknsgygwWpL", + "3PRHbh8ajUXv5wPD11CxFRs1hWBo8vR3zW", + "3PfcB36gDa47YkrbRtzZSwmrKSMsBSrhr6", + "3PkGNCt85M3aNQkBqiT5Psgmz8FjNujEKK", + "3PnoF45bZhJcPKGLf4nQzyQVAEFsxBxQQa", + "3PxV5m54ZwMDheUyFecvRVQHJK7WG1t49V", + "3Py2iN5SEwSCtT5QHkDU1qhbvmdmMZ8cpK", + "3PyK2LYBfYMUXsa8sMhTSHQZ8StQy3Xoz8", + "3QSd3JjJ35VAf5Shv3EPVpGCi5eVMQr6dk", + "3QWaxXXXbobqpWprekwzANeFuNrYXmaNXU", + "3QbVP6bTSXN2tXG66MTKtHtiJ1coKXnrjP", + "3QdyHj1i4y5CywEFWJ5PwoqGzDxGyJGPeb", + "3QjqS6A7uyoCx1vcXQoqtLatubFmsHe1ps", + "3QmVyCw6YnEvt1jXLeF5863uHPLRaKhWs5", + 'bc1q02kjkf8gp628thqdfrm54tay5pjw05w297d6p6ez5andhp9gf0nqjaa2e4', + 'bc1q02py7892mlqafaz9wevclp8ve4dl4z6hy4sqp973sz2u4fvpxnmqnzfc2f', + 'bc1q09z8m23n7w7gtqsxpgwun0zvra9jwzf4z9c48cezq36q3zvmsuyqdmyjkn', + 'bc1q0vac8d7jkyds2ux4jqwu6mu943z8keyxq4twaw8p8md8j8rtj94s9wrrl8', + 'bc1q20yv979atkvtmecs5kj88a0pmf85ht500pmp7p2ztd54tz0u60psj7c702', + 'bc1q26ds9juuyjtsek5czqasrvmptf46xan2hfyx88jqzpz2pzly3p6qrwd6e6', + 'bc1q2az30y4lst2x9wlu77kzzdym8n9qr77n0kqmevs4ahf7dmzw624sck5vm5', + 'bc1q2ssdu5v40zmntqc76kaxw0xf67eathhpg59xczh9vpp2qlf3mdrsgr49s8', + 'bc1q2vlwakkk247pnppptdv3kgxj23yptykyd3ge9vvlk2w8h98v7pysmmknxv', + 'bc1q2wyzh5ex2cr7wcth0zsm7ueycg2rkfw28fy2g6axky6r9su9zcls8qngt2', + 'bc1q32phcv5dhwkw59xljxsz2nw8g4he4ssduw7c6d3d6005skfy9gysa6crgk', + 'bc1q35fxxu53qsmv77cjt6ucdj5wu4r8rae8eakq5j5v8nzgjtcmnpvqp6g3sf', + 'bc1q3aqsr7dsajmslelacclkgmmyhd7t6hkeevpw50f5areathvfmwnq4nwt3y', + 'bc1q3cpmjfcfkh8t47q99y5wgwxzvhsw8lywzgvnvnlrlwe6h8xcqw7qjwf646', + 'bc1q3cpz06gvfatn0rgamwk7lws7c7qyt4napdr6h7fsj54zg2fy9wtsahl7xt', + 'bc1q3eff85qd4rhuu8gvn933fvtzg0ys3y5amchq8wzhhylhqvfh8kxsu4kde7', + 'bc1q3l6qerg2gyzxpuk0mmhswkgedrqcqe3eesyhatwauyv980syulfspttjcs', + 'bc1q3qw5de93m5ukxra5md872kjyl29arplm8c4vrh9jggsxp88kk2zs74u39g', + 'bc1q3uzg46kmqexn04rkhsd74t34225tqv88xp3jglr2hpxxu5ujrwyq9amgrx', + 'bc1q424nhx6tpljt65aren3q5hmsx4dwt22g9574lpjnlvtc309gtkhqdtwcss', + 'bc1q47vlc3v9vfqh2sr8f47ukaws408wcr95r27t26y9qxgc72yzg9hs58yzek', + 'bc1q4agva2hg94cdr7xdeg4e7wekq0vkrqggn4kqruns85e69xtx750s7dc2hy', + 'bc1q4ma898qglhvqsjs725emwtmayr0pwj9nmgguqac44styjpjc04ws8hwp7k', + 'bc1q4nalse7wwqe6sx3slmkyywetlzn3tdud77jesadx02v885qjs74spqtg5w', + 'bc1q4xmshjnx7up2940zld0dls42jnec86drca3ph7cjhtsdlfgq3ycsntpvpw', + 'bc1q5anhs0xpsayee84r5yqazljkfn9k92d6dkjfpyq509sfmsdkhfts2vh8l8', + 'bc1q5d93mqzlntc95687tq2un302rnfa6vnlnche7pdxzuypyl2cewnsqrzxc2', + 'bc1q5nzdfhdjv6dh5r2pgdmtxhvkan8stl2h7zrhth908slszrzu2snqm3ds3q', + 'bc1q5qv0gtcfdumqrf9fjhd82uud7whpsam7j9e2dq3k9jy3mj2rm3aq8yj3u9', + 'bc1q5rxwzkcl9hux2ltuppg5jl4c4ld52l3hk7kq8g6qqnjluk6kq5xqp5dpzd', + 'bc1q68r3tjqwch4q5nyqf03a3n3ugcef75klsmqfa4g72k63npwn59hqj2d6hh', + 'bc1q6aw25ef99245cxc4l9m5nvn5fel6tmrze3nfxtstv08yf5jkdvfs5rrajc', + 'bc1q6xdt8tmlp5p6exvsmuf62yswm4vnk0rmm950sdhlqgyxluahv3qqquz3uh', + 'bc1q6z0cm8gzhxz87e5xdlvkpnldj9zspustx7hedll73zg4n0hqemhsrm4d8l', + 'bc1q7awsmqawsstwlxtt48lt6y2hv2qjsju85jgz07yr4hhdcu5df0sqwxc63z', + 'bc1q7h0eyvjp58p5wz563p04lhjt2nef9q089mcdchr9jzz74lq5wzusqckmj2', + 'bc1q7trechgv0g6kgwdcu3wsxkqn9lrc6edzdgvdvpt9a9rg04l7gtvs26hps3', + 'bc1q866pgqwgxvuqvqmkmcfh8n52dtgz3fv3nh5cq3mufqv0ssz8q93qc2eadh', + 'bc1q86aapgzcr7078499tlhp4aatylujug9d2rxwccaekmjgv8j6f93qljjhx6', + 'bc1q89mxkg0dhr3m6vs2gzr3wqccwpzrmnpsldnjc22ztldhqueawtzsq82ydf', + 'bc1q8nr29r27mlkvj0duseshuw5vueywt4640tyrt9jusrk0c9kz2klqg4n66l', + 'bc1q8qlz3znvuq0mk62j0dld5hj3a5uf2y06tcuvtz2x3gffs6gxejnsx2hfk7', + 'bc1q8sw5c5sx3s0r5tujaq6hahnjq88yvrdhepss7qdfaz5evjux6nls63mnuw', + 'bc1q8xamcp8xc3rdh4vqtexgrqfmwlkw0mkruz3gkwaw027erjsrnd0see34cc', + 'bc1q8znctxhsh6knhp07z7ufw8zusucef9vxq7rjrhgf0wecxl7aqcrqz06gmu', + 'bc1q93hcme2prs7upr9zkdakl85jje3leg8g2qf70kstacjuyzy95xkq7h35ft', + 'bc1q99gvfs8e2fsd8zw74wdg4fmfg46n2uf5pjlpt87h93qar044rspsxwck6k', + 'bc1q9eammdvuqyhswd3wqp84d56ah0hyuus62smarhsdw3l3rycjgrhqsskvuq', + 'bc1q9j8l760q75cep90p9gq6dsj3p9d55ewpwkhcmw8dnzcd7tmfg03sc0vmqh', + 'bc1q9xlm3uydvuu3nn8dan0zqyr7e6p3pjh7gxnw7jyv0tujl44dgt6sedtus3', + 'bc1qagrn5sn73azr85navkf0ukh336qvktfunejkzauu9adsuvfvpklq6qut3m', + 'bc1qasluf865jx838k9nad2r2rnp04w3txqtyu7kapuxrv0m7rv90sxqhvjxuv', + 'bc1qc342v9mt8j354pjyaqkweu9nrztcj6cc8udgyezk7dxhjddjcn8q7w9fuc', + 'bc1qc46r9xy82z23s6q9lglhzf60fdxxq5y26x34kdx7dx8549mdtu4slym95w', + 'bc1qcd7jv45swrxgwlj55gfnlxf3tvsm4ek0yer4xac5a909jtxzrgvqyv5v0p', + 'bc1qd7dd9qc0pehqx5a2arlpmlgh30xpfufx9hpf2kfrnpqz2x7jl0xqpmcru6', + 'bc1qd8wk5eesxtynkrjx42temma0spfy0955tr5e5lp267aqhalvpjwq79l4yh', + 'bc1qdj65qknp4cnvxagp0pqnjl3g7d3s8gzxqzrrlh6gutju0ytdfwmsfeetdt', + 'bc1qdt0gu9n7ykyvyhe4v7cmftugsn5qw59rm4tdxn4f8vxs6s694n8qp9u2az', + 'bc1qe46f05uenszej6hvzmxjw8fxyskc6utv4cueeaa77jjea87vjh7ql8wgd5', + 'bc1qe4we3wxhj4f0wy40ftfxfvawmt4hgkgvtmpnn3lv5wme8yzfrltsckhg9g', + 'bc1qer4qvha5nxz09qn7gt7xntvrz2crnaxrd7ju4nmcjm7r9uerc9xqa9gdxd', + 'bc1qesmtfxs4n4ws86242uqpztseyh7l5tgswd0zce5nggaky44t9c4sfwczj2', + 'bc1qetecvjtaya283z7zk9lftqtv03ajx27ekz6uxjpscpap7crkvgmst355jn', + 'bc1qeuz6l0qusf9pd923v8w086j8umn765a7hqvu4su0dfq90ckym47qhvaux3', + 'bc1qezmmhc5k7ccnc6q7l8dhkg9phcnehysq2y3ahdzzcweph5ang9xs0egasc', + 'bc1qf5p8wp6neu0raugt6t7zhm6vjhy3taf8q7rqwuhgdmdnhvpz2c7s8xtrtx', + 'bc1qfcxzh8ag5pv37qywg8wylherg64k7skz0qm0ghc36x7awrd8xszsfxc4k3', + 'bc1qfenuya7nskcjlyxpg0gttrjap9e5gtncxga0vvl8rekyeup55n0slzlhr8', + 'bc1qfeuww8le80ae7qat3kpzspsh7pa8na3qx9fuc4qpdt3w5q3dkavsc02wk4', + 'bc1qfn70w8peuvvywupd8u667g832necv3w6sqellzvd7aaj8l52nhhsfzs6a4', + 'bc1qfpwewuyg8erj2cejamms0682v7ncgdgufdq8efa0maef3uzunkgsvdwyzm', + 'bc1qfugah0e9fw9ze34dpqf22yxqxnxh49wrcq9d3kuqc9dydfhn4pjsjqfpky', + 'bc1qg0amsvtlglecc6x46rzjprjh7wscjzlgqu6n52zw9nz0cck2r5sqwew946', + 'bc1qg54vzuplejd6ymxlma6q7rfyc9zqqes8wvz4xs09mhpclak9z73sf3x3km', + 'bc1qgs30czhkxhxn5qsunlzac0xeznyaxg267p5t8gjupzg7u97vz4zqyuf60l', + 'bc1qgsgj3dh8dztq05v9dzethjcpjqtptm5tsrruprz4w7awzpfrku8qjjegyc', + 'bc1qgxww03juwr8vfp28tzpmyyku3j6hxrgpl0v6natkk2ucwu4weweskcqvnl', + 'bc1qh4r87gzpcx3lz7faz349yvp8yr6zyr2706m2xzsuwcwlptkqsj6svkaqtf', + 'bc1qhagykgzhhh7yt5knsypklpqsgdelrvw5vz73erujapcgh3x5wxrq8c0y9x', + 'bc1qhgfkccy09hr7hlky0jeyz89afan8qh66wa26t4se4mlqda6298hqrtk5zr', + 'bc1qhkw43w4cvzec3836hqrdmxksm20l35yk7gnvysqprd6gareztfsq4uplfs', + 'bc1qhm46vtwep0awkdphurmc2ku3lfp8l7z9f6wn9va42lc3z24zd2fsvnvzk3', + 'bc1qhpnmnswf8ls2q97vg4qzlr2a6c2xpr46zp59e7q9uh5j59ask2ysld0euq', + 'bc1qj2dz58v8etgq3aud24yrgffk73d9cue80kfswl58d5w4vvhdfsyskxtll5', + 'bc1qj38tl824hkgl7qluy32lklp6qfd9d9zqa9qlyeh28khfh9grxwastu3xnw', + 'bc1qj8vt7h7ufrgqlhhcu22vl3jrvx3kluml57kha352k9fex23jphvsuwme6r', + 'bc1qjgua88vymvkctq9t4mcd4q4mlqnr3r07lylp90f7epc9p6qcv6asteyjec', + 'bc1qjpgs63vqgfkalm8janwmelw4mr4wg50axnmx5ueh4ru2xnl3lg7q80yl32', + 'bc1qk8plwr04uu6mvpcf3wtfmg579ztqn59q7yfx39drl9r97q4wcx2q43rvw3', + 'bc1qk9fhnvv7a0nxzxxj503v7mfy3uwdugymj09ugkrda5895cfxa5vsnzp8l5', + 'bc1qkd53jhtmhwv74x2c8hnnfzspatcjdzk0h3f2czqzrav0yxpd5y4szkslrs', + 'bc1qkn3s4hzjthfmt68sk30m69knjauwphsha2paqzexjjmlfc6h7f3sggfn52', + 'bc1qksptar8mpay2mfwzwep3aqxevnc8jj8d4rd82v3v0hm5p3y93w2q5eufa8', + 'bc1ql26wgacxjhuefzcph2wpsyftqzd07kzkczv60d85hj7280qkrz2qlgrhf7', + 'bc1ql33nnw3ngcf343jtmzpe8ps8809nqe0530rv6neu7cefkz6dtcfqn3wzav', + 'bc1qlg2gcz8hzfdt49jgs0438c7ahg4967nfkflzj3m0r5dz3xz7njrqpxxj2j', + 'bc1qlnz5vejmvv6sdy9k3c7a07nlf6c053g0ren0m8kmmsrx677nyllsg6qr2m', + 'bc1qltg30ayn5wexka07ta2x5dnfjf20rqnemf4sfnsase082yfqetfq0s20hv', + 'bc1qmfjm5hlgjfw3tc6cz77nzjcc5xg5mjhrlm6kqewczapae2yhucrs5c0qvf', + 'bc1qmfwcwfntr2adas7yz5l3wn6pnm8rj55l8fk5vgny34wld6d0vfcsg48tta', + 'bc1qmfwq5cjm55m0kcfemjyv6rj8nfunslfjtuhyqawksw892dhvu6wscem2t5', + 'bc1qmmdfeczme4q99ccpmgfx3zxwwwff9nnjhdux47hucwttrjdpqj9s2x8rds', + 'bc1qmur9p99tzxtrq0232tl6nssyejrmwet3m265xg0cgl7uh2qxsy7q0m8fvu', + 'bc1qn3r3kqf90txgcsdxzu2s0p5avp79axlf98lzrwlmpnmxc3ak0vwsuxrepa', + 'bc1qn8w83eglpp7xdtgyjaysgrve5cjjr2yfhsq2x5xyn6cmvup0uwlsq2t5xl', + 'bc1qnpnpcn4gwssvkjpe27zzfex2t997l7garmc2s8fenmk0fpydek2s6zp9yz', + 'bc1qp24kgu3r5n3q6k03230yj6dzr4styppjlvtr3ptdsd7sxql8pcgqwall05', + 'bc1qp27x9j8damzuxc0x7cqkcaf39q4825aafmx3g6mlvh2wd5tzr8kscsjplw', + 'bc1qp6cmqa7hgdean0z8jl7uf20rzf7wgvstmjlxekft3l2vn22zwl2qhunr3h', + 'bc1qparrejjdyc8hcd7hgljlx53wy7ncrjkaz670w3ef0ade369y22eqkujzy0', + 'bc1qpdthtpfcmju642wq4eqxl4uz5hfgtztvtv7u6wrdepnkdsugueusujpg76', + 'bc1qpp5wu443kdfur2vhzwms8d46gq8c2vgu692sgyn79z56gkq4mkvs07gjkd', + 'bc1qpvvt2md0t7435mc8dmlgd5euyc0636vlw8ew25e8pf83uc68km5qpvqpfx', + 'bc1qpwtgr4rld3wr39r762ngvuk8qgvgkrrxra4jdnmn06z4nfgh4vtsluyd3t', + 'bc1qq3p9mqvegpadextyqzxy46ukf5yxc7ej50ksq3w63f895q0t8rzsfe5jym', + 'bc1qqces3upduq6e0c2w0k6mr9n4tkgvzkggteuatqc4eyxawwkuxzpsfgdxzh', + 'bc1qqjmfwnxrjx0khaxf8qa6ccnz7s94k9wa8lelpdy2fn6jf9ffks8s5r4frd', + 'bc1qqlm6edz9azp0d6y4mjc8j8an4q8du2jajgwj65mmz6nkk53yannqvtnvnn', + 'bc1qqlus6fyt05kewddukpge8u0lszp4ffn49mqnr3pvrh2whptf2fhsy6ynmn', + 'bc1qqvf7qq7wvx6pkp5aqvzdxs0rgqkjgqe7ev63hnppxq05t6v3w5ysskzjs5', + 'bc1qr20qujcyr87y3uk2fgkq93u0jtzl6wa4el90we4txgcwgx6avxzsuj0wcx', + 'bc1qr6cvgewvlts5f9wa8u3cpnlmth0mzn0x96ap34hknpaayuyknrlssqfq3n', + 'bc1qrm7nze8cqyazdlhmw8ffeusxucqtvyw3pvtple0047tdkupdnmustkla3w', + 'bc1qrsayv4jq9uf6rpmwsxan3yqxuqtyelwt7k8298ejl8h9tkrunthspnlm6y', + 'bc1qs0q2svqpeaka6f8jakx74j4rydxdmxq4wz7xfy45m6t8xfxzy0zsckrym5', + 'bc1qs48aaups6tzwcs372yqhakcjakfgf6w6aguj0w7gex75vrnjegmsp5hx8n', + 'bc1qsgthnvghgs9wl87kzhkx9xda4xyu35cxfteupjnvxv3zuvgtdyzs9a23te', + 'bc1qsln2s8xu7sv84wj5sv2pjnfpev8lkcqpzmzukmygcll26vf0kwfs6awzkj', + 'bc1qsp7twu469a8p3enevzwdnjhrcmtmc7ljydqxxp4p69u4ggj9wazqa9gsgw', + 'bc1qsrms3khzhupjxph0u2sy6sz8c9q4g6nqm3dy53nrlagw3lc5zmsstg8pft', + 'bc1qsuzvly8z6kr080at2twdlfs8j87gu08kmwlfstafm2lajdvfclyqtvq00a', + 'bc1qsva32zdzx7cd9996qdlxkpl0dnyk4s44myx53zpetf4u7rfg89fswjzza5', + 'bc1qsw4hj3dvqcvtntvsflx8474f52nt6zer5k9pyem6n6g27p8nc4xsrj5fxc', + 'bc1qszmwz85wktn6k7tg953pugtedmssguaavl8qukv77s5u0g5mx3tsmw6pg4', + 'bc1qt3mw55ccejx97tyjdl9dhe60wvextxddg8udxz9n8q8efwhr37wseag63j', + 'bc1qt4ck5563ra7r3xjqlfqm7au407q2dmc0p6wvgyzy239nyyn4vsesfwwsa2', + 'bc1qteyfers4wvfhp6apw4s720tzvp9xafkvvfh7k0sxmu8vrxvt2m5snw45v8', + 'bc1qu4g30hr7lz3qd9jn68x4f2ycl3s533jdtv96g5n96d40kac5l5tshhkvq5', + 'bc1qu5k2h4y9cynds4j3t5d94xg78zpzhx3elk6w93e28xmxrnn37wuql9xf4t', + 'bc1quljnxvuryumd7c44u7f8dwflas5aghecg8ln029v2s7ffezun86qn0wyng', + 'bc1quryt5u9j5rec96c4h6xxatn74nqcen244q3dtgwtpjkma36vvrmq9mjecg', + 'bc1quxy0mlwssdmzsxgk2ct42p09ef7mc9qwmpdjuzy9f3h3ye2k6jzsvmmrsh', + 'bc1quywrhxx6t7mkqshcll3q99qrqlal73l668wldgrcxpa4yvuj2x3qrhsg9m', + 'bc1quzwyq3wewr74vvgwa6nqfj6n6rsc2tsh046glq0n76x9alcpgmzsf24s6x', + 'bc1qv0u3a7jdaygq680cu52puk4xrrr4ckpjqqgg88x66cmfnrfj5c4sre60e9', + 'bc1qv837fuujjlu50z3l6y48vxkv4vd09vve58t92welmxy9lnu5l2usp6hd0j', + 'bc1qva8lqtdcemj9swc6trk4je45xzckqhs3fthst2hy0k3plywfeq5s639wn0', + 'bc1qvfmnrg59p8a3csj032uyzl3mdtv5y46g3mx33krz5kweyvq78f5swvdmna', + 'bc1qvqaqr0jyxf3nphux7gla78dqa9psfpyy0v8med9t63f0x6n2k40s7knecs', + 'bc1qvtckv82yw4efeu9ez8y37rne5ghzxeqjl3cqnsyxf4gm3zhuhc8swt5u3h', + 'bc1qwdgyle9p2gcvyn22sg2tg6jaqkxewjz5xfj229p989dcteu42adqnau2lw', + 'bc1qwfeq7rehmzm5434vaa485s98788cmyyrac2w65nulvucsg7cueesly7x05', + 'bc1qwfydpavg240d4j87nrg0ayqhfzwrt9revzw7a9dpyxujnlpu2xus07f6ud', + 'bc1qwvrrxxqhc6l9zd8rwj39sl8n39v69tju9sfc59dqxl3fjx8jnfqswzs93f', + 'bc1qwwkwppejx79uszdgfrpaaqc24wepvjy729xhx2zyd3qyf3ftfqrs672m9d', + 'bc1qx8xlxd6qnmqprgjs6yr4nd870tt4d8yuupwq4qhl3hh24ulpmk4qem46px', + 'bc1qxfkxl66ee59xpxr30tcexvh9zgtvf7gwtyauj29n6txj7c7a9e9quhcaaz', + 'bc1qxlj7ls9zptgj779w0gzfvt8chpl29xdcv5qjqdw7g462uf0c90wsvkw74y', + 'bc1qxnxp0qdzx07jw3tskcp79xzs7p6p2wpwx4sn7myrx8vgj42f4prsrlcknw', + 'bc1qxqnj2gdznm37yhdw679nx6rqs44hkd2lddj2gn4uyaa5htmjvmzsyjcu7d', + 'bc1qxtf7mx5scgetaaz30w6ngndq8xctegjacvphz2tgky5r9et0q5uqwyks8t', + 'bc1qxu9s6qy6hld9uvd75em9t550q7ppezsmkheldsyny0pzj9yd7e6sqg3qv6', + 'bc1qy30syv0sqafmkt2m4h6lf9tjeddurh9cypa9p8wras2hfjf4y4uqzdz5sk', + 'bc1qy6tfy7k9cjp40m2lcq2s8wrsn88jdn3ffj5ph7uvwxuamfntaylqk38dwp', + 'bc1qyc4v5dtapyta9mcu5n5t9va72rzd9g75z83qxxm90ne4vzhgleeqf9lcfl', + 'bc1qyd5989kz0jgayxelnz7wlnnk5gyn36v7cecjrkgvph4260aew2rsqzx3ua', + 'bc1qyujyd6q7dtnh76wchgavwgxpklkwm73vqllududlx2uunx28zdhsxnvd47', + 'bc1qyvpmf6uv8xgxrvcwc5w630d4vg2s9ztpd64fe0e9ylxtuy34e4lqnmv3sq', + 'bc1qzck7505r8ahwq9g4xuwr60lpflxv5h75y0jntgasd0t9g7psvmqsr902f8', + 'bc1qzgw25sgrn45909quqlydd9729ksj32mfcvwzl44ekf2kkgctz09qvr779j', + 'bc1qzha6dcp9mq8ne7s3cxgp052qzux3jg25fp7cxpshrz0a0005h3gs30vqpf', + 'bc1qzk7gnzhyqcl9x7f52lckdhlznv94k87gpm3fsafvn487euaymmasz95cwa', + 'bc1qztewvcfe424fxat7s2uautmy5ctnsnurul474e2emexfnlj6upsqem0g8d', +]; \ No newline at end of file diff --git a/projects/helper/bitcoin-book/woo-cex.js b/projects/helper/bitcoin-book/woo-cex.js new file mode 100644 index 000000000000..d633c3db58d2 --- /dev/null +++ b/projects/helper/bitcoin-book/woo-cex.js @@ -0,0 +1,4 @@ +module.exports = [ + 'bc1qh78w4qq9v2dqntjtxne97kp9u2485jdqrfsghh', + 'bc1qm4hycszv0v0qel3swxqyp57nkpnnrda4rc55lm' +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/xlink.js b/projects/helper/bitcoin-book/xlink.js new file mode 100644 index 000000000000..605481c046c3 --- /dev/null +++ b/projects/helper/bitcoin-book/xlink.js @@ -0,0 +1,17 @@ +module.exports = [ + "bc1pylrcm2ym9spaszyrwzhhzc2qf8c3xq65jgmd8udqtd5q73a2fulsztxqyy", + "bc1qh604n2zey83dnlwt4p0m8j4rvetyersm0p6fts", + "31wQsi1uV8h7mL3QvBXQ3gzkH9zXNTp5cF", + "bc1q9hs56nskqsxmgend4w0823lmef33sux6p8rzlp", + "32jbimS6dwSEebMb5RyjGxcmRoZEC5rFrS", + "bc1qlhkfxlzzzcc25z95v7c0v7svlp5exegxn0tf58", + "3MJ8mbu4sNseNeCprG85emwgG9G9SCort7", + "bc1qeph95q50cq6y66elk3zzp48s9eg66g47cptpft", + "bc1qfcwjrdjk3agmg50n4c7t4ew2kjqqxc09qgvu7d", + "1882c4wfo2CzNo4Y4LCqxKGQvz7BsE7nqJ", + "1KGnLjKyqiGSdTNH9s6okFk2t5J7R6CdWt", + "bc1qt2kjf5guf4dvv4mvnswyk8ksaeuh5xyhc5gz64", + "19GTEWTnVgenpDWSdQEAT9LJqMFQ7Yogsu", + "bc1qxmwuugmcnn5k3hz22cxephy2vkevvt2knsd6u4", + "1617Cf4qmjqVyiN5weQRo8sZvQvyDjshKP", +] \ No newline at end of file diff --git a/projects/helper/bitcoin-book/xlinkLST.js b/projects/helper/bitcoin-book/xlinkLST.js new file mode 100644 index 000000000000..efad41974e45 --- /dev/null +++ b/projects/helper/bitcoin-book/xlinkLST.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1p78mvfa550t7acg6wm9cl9543zf68ulhqkxex5pvhv8wnw4qpl3gqmpjy2s" +]; \ No newline at end of file diff --git a/projects/helper/bitcoin-book/xrgb.js b/projects/helper/bitcoin-book/xrgb.js new file mode 100644 index 000000000000..674626416827 --- /dev/null +++ b/projects/helper/bitcoin-book/xrgb.js @@ -0,0 +1,3 @@ +module.exports = [ + "bc1ptm05s4f6f8j78zhx62lzx0dep07f2597nlgeltmm4sjn5stdu6gq4sxg2w" +] \ No newline at end of file diff --git a/projects/helper/cache/compound.js b/projects/helper/cache/compound.js index 7eec645fc9a3..5aef7b0d52d3 100644 --- a/projects/helper/cache/compound.js +++ b/projects/helper/cache/compound.js @@ -1,17 +1,11 @@ const sdk = require('@defillama/sdk'); const abi = require('../abis/compound.json'); -const { nullAddress, unwrapLPsAuto } = require('../unwrapLPs'); -const { requery } = require("../requery"); -const { getCache, setCache } = require("../cache"); +const { nullAddress, } = require('../unwrapLPs'); const { getChainTransform, getFixBalancesSync, } = require('../portedTokens'); -const { usdtAddress } = require('../balances'); -const agoraAbi = require("../../agora/abi.json"); -const project = 'compound' -const getKey = (chain, addr) => `${chain}/${addr}` -function compoundExports(comptroller, { blacklistedTokens = [], resolveLps = false, transformAdress, abis = {}} = {}) { +function compoundExports(comptroller, { blacklistedTokens = [], transformAdress, abis = {}} = {}) { let response abis = { ...abi, ...abis } diff --git a/projects/helper/cex.js b/projects/helper/cex.js index 3c4210a714eb..279a3ca7fbcf 100644 --- a/projects/helper/cex.js +++ b/projects/helper/cex.js @@ -86,7 +86,7 @@ const defaultTokens = { '0xaaef88cea01475125522e117bfe45cf32044e238', // GF '0x949d48eca67b17269629c7194f4b727d4ef9e5d6', // MC '0xbb0e17ef65f82ab018d8edd776e8dd940327b28b', // AXS - '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', // FXS + ADDRESSES.ethereum.FXS, // FXS '0xd417144312dbf50465b1c641d016962017ef6240',// cqt '0xcb84d72e61e383767c4dfeb2d8ff7f4fb89abc6e', //VEGA '0xcccd1ba9f7acd6117834e0d28f25645decb1736a', //ecox @@ -109,6 +109,7 @@ const defaultTokens = { "0x23878914efe38d27c4d67ab83ed1b93a74d4086a", //aEthUSDT "0x4d5f47fa6a74757f35c14fd3a6ef8e3c9bc514e8", // aEthWETH "0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c", // aEthUSDC + "0x6982508145454ce325ddbe47a25d4ec3d2311933" // PEPE ], tron: [ nullAddress, @@ -173,6 +174,8 @@ const defaultTokens = { '0xe9d78bf51ae04c7e1263a76ed89a65537b9ca903', // GMEX '0x59769630b236398c2471eb26e6a529448030d94f', //NKYC nonkyc exchange token '0xbf5140a22578168fd562dccf235e5d43a02ce9b1', // UNI + '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe + '0x2024b9be6b03f2a57d3533ae33c7e1d0b0b4be47', //Bitcointry exchange token BTTY ], eos: [ ["eosio.token", "EOS", "eos"], @@ -188,6 +191,7 @@ const defaultTokens = { '0x088cd8f5ef3652623c22d48b1605dcfe860cd704', //vela ADDRESSES.arbitrum.LPT, //lpt '0x51fc0f6660482ea73330e414efd7808811a57fa2', //premia + '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe ], avax: [ nullAddress, diff --git a/projects/helper/chain/alephium.js b/projects/helper/chain/alephium.js index 1c6defca2e54..d1ff69bdb911 100644 --- a/projects/helper/chain/alephium.js +++ b/projects/helper/chain/alephium.js @@ -1,49 +1,80 @@ -const axios = require("axios") -const basex = require('base-x') +const axios = require("axios"); +const basex = require("base-x"); -const ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' -const bs58 = basex(ALPHABET) +const ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +const bs58 = basex(ALPHABET); -const EXPLORER_API_HOST = 'https://backend-v115.mainnet.alephium.org' -const NODE_API_HOST = 'https://chadnode.ayin.app' +const EXPLORER_API_HOST = "https://backend.mainnet.alephium.org"; +const NODE_API_HOST = "https://node.mainnet.alephium.org"; async function getAlphBalance(address) { - return (await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/balance`)).data + return (await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/balance`)) + .data; } async function getTokensBalance(address) { - return (await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/tokens-balance`)).data + return ( + await axios.get(`${EXPLORER_API_HOST}/addresses/${address}/tokens-balance`) + ).data; } async function contractMultiCall(payload) { - const result = (await axios.post(`${NODE_API_HOST}/contracts/multicall-contract`, {calls: payload})).data - return result.results.map((r) => tryGetCallResult(r)) + const result = ( + await axios.post(`${NODE_API_HOST}/contracts/multicall-contract`, { + calls: payload, + }) + ).data; + return result.results.map((r) => tryGetCallResult(r)); } function tryGetCallResult(result) { - if (result.type === 'CallContractFailed') { - throw new Error(`Failed to call contract, error: ${result.error}`) + if (result.type === "CallContractFailed") { + throw new Error(`Failed to call contract, error: ${result.error}`); } - return result + return result; +} + +async function getTokenInfo(tokenId) { + const [metadata] = ( + await axios.post(`${EXPLORER_API_HOST}/tokens/fungible-metadata`, [tokenId]) + ).data; + + return metadata; } function contractIdFromAddress(address) { - const decoded = bs58.decode(address) + const decoded = bs58.decode(address); - if (decoded.length == 0) throw new Error('Address string is empty') - const addressType = decoded[0] - const addressBody = decoded.slice(1) + if (decoded.length == 0) throw new Error("Address string is empty"); + const addressType = decoded[0]; + const addressBody = decoded.slice(1); if (addressType == 0x03) { - return Buffer.from(addressBody).toString('hex') + return Buffer.from(addressBody).toString("hex"); } else { - throw new Error(`Invalid contract address type: ${addressType}`) + throw new Error(`Invalid contract address type: ${addressType}`); } } -module.exports = { - getAlphBalance, - getTokensBalance, - contractIdFromAddress, - contractMultiCall +function hexToBinUnsafe(hex) { + const bytes = []; + for (let i = 0; i < hex.length; i += 2) { + bytes.push(parseInt(hex.slice(i, i + 2), 16)); + } + return new Uint8Array(bytes); } + +function addressFromContractId(contractId) { + const hash = hexToBinUnsafe(contractId); + const bytes = new Uint8Array([0x03, ...hash]); + return bs58.encode(bytes); +} + +module.exports = { + getAlphBalance, + getTokensBalance, + getTokenInfo, + contractIdFromAddress, + addressFromContractId, + contractMultiCall, +}; diff --git a/projects/helper/chain/algorand.js b/projects/helper/chain/algorand.js index 9a36d84581f2..af9476fc014b 100644 --- a/projects/helper/chain/algorand.js +++ b/projects/helper/chain/algorand.js @@ -4,7 +4,6 @@ const axios = require('axios') const { getApplicationAddress } = require('./algorandUtils/address') const { RateLimiter } = require("limiter"); const coreAssets = require('../coreAssets.json') -const ADDRESSES = coreAssets const sdk = require('@defillama/sdk'); const { default: BigNumber } = require('bignumber.js'); const stateCache = {} diff --git a/projects/helper/chain/aptos.js b/projects/helper/chain/aptos.js index 4fc537924983..da5bffe902b6 100644 --- a/projects/helper/chain/aptos.js +++ b/projects/helper/chain/aptos.js @@ -103,7 +103,7 @@ async function getTableData({ table, data }) { async function function_view({ functionStr, type_arguments = [], args = [] }) { const response = await http.post(`${endpoint()}/v1/view`, { "function": functionStr, "type_arguments": type_arguments, arguments: args }) - return response + return response.length === 1 ? response[0] : response } function hexToString(hexString) { diff --git a/projects/helper/chain/bitcoin.js b/projects/helper/chain/bitcoin.js index ac1a531d9c7a..d024efff4cfe 100644 --- a/projects/helper/chain/bitcoin.js +++ b/projects/helper/chain/bitcoin.js @@ -1,31 +1,77 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') const { getEnv } = require('../env') +const { getUniqueAddresses } = require('../tokenMapping') +const { RateLimiter } = require("limiter"); const url = addr => 'https://blockstream.info/api/address/' + addr +const url2 = addr => 'https://rpc.ankr.com/http/btc_blockbook/api/address/' + addr +const url3 = addrs => 'https://blockchain.info/multiaddr?active=' + addrs.join('|') const delay = 3 * 60 * 60 // 3 hours const balancesNow = { } + +const limiter = new RateLimiter({ tokensPerInterval: 1, interval: 10_000 }); + +async function _sumTokensBlockchain({ balances = {}, owners = [], }) { + console.time('bitcoin' + owners.length + '___' + owners[0]) + const STEP = 200 + for(let i=0; i async (...args) => { + await limiter.removeTokens(tokensToRemove); + return fn(...args); +} + +const sumTokensBlockchain = withLimiter(_sumTokensBlockchain) + async function getBalanceNow(addr) { if (balancesNow[addr]) return balancesNow[addr] + try { + + const { chain_stats: { + funded_txo_sum, spent_txo_sum, + } } = await get(url(addr)) + + balancesNow[addr] = (funded_txo_sum - spent_txo_sum) / 1e8 + + } catch (e) { + sdk.log('bitcoin balance error', addr, e.toString()) - const { chain_stats: { - funded_txo_sum, spent_txo_sum, - } } = await get(url(addr)) + const { balance } = await get(url2(addr)) + balancesNow[addr] = balance + } - balancesNow[addr] = (funded_txo_sum - spent_txo_sum) / 1e8 return balancesNow[addr] } async function sumTokens({ balances = {}, owners = [], timestamp }) { if (typeof timestamp === "object" && timestamp.timestamp) timestamp = timestamp.timestamp - const bitBals = [] + owners = getUniqueAddresses(owners, 'bitcoin') + const now = Date.now() / 1e3 + + if (!timestamp || (now - timestamp) < delay) { + try { + await sumTokensBlockchain({ balances, owners }) + return balances + } catch (e) { + sdk.log('bitcoin sumTokens error', e.toString()) + } + } + for (const addr of owners) - bitBals.push(await getBalance(addr, timestamp)) - sdk.util.sumSingleBalance(balances, 'bitcoin', bitBals.reduce((a, i) => a + i, 0)) + sdk.util.sumSingleBalance(balances, 'bitcoin', await getBalance(addr, timestamp)) return balances } diff --git a/projects/helper/chain/cosmos.js b/projects/helper/chain/cosmos.js index fda290201eb4..404411154b83 100644 --- a/projects/helper/chain/cosmos.js +++ b/projects/helper/chain/cosmos.js @@ -42,7 +42,8 @@ const endPoints = { nolus: "https://pirin-cl.nolus.network:1317", nibiru: "https://lcd.nibiru.fi", bostrom: "https://lcd.bostrom.cybernode.ai", - joltify: "https://lcd.joltify.io" + joltify: "https://lcd.joltify.io", + noble: "https://api.noble.xyz" }; const chainSubpaths = { @@ -75,7 +76,10 @@ async function query(url, block, chain) { return (await get(endpoint)).result; } -async function queryV1Beta1({ chain, paginationKey, block, url } = {}) { +async function queryV1Beta1({ chain, paginationKey, block, url, api } = {}) { + if (api) { + chain = api.chain + } const subpath = chainSubpaths[chain] || "cosmos"; let endpoint = `${getEndpoint(chain)}/${subpath}/${url}`; if (block !== undefined) { @@ -118,7 +122,13 @@ async function getBalance({ token, owner, block, chain } = {}) { return Number(data.balance); } -async function sumCW20Tokens({ balances = {}, tokens, owner, block, chain } = {}) { +async function sumCW20Tokens({ balances, tokens, owner, block, chain, api, } = {}) { + if (api) { + if (!chain) chain = api.chain; + if (!balances) balances = api.getBalances(); + } else { + if (!balances) balances = {}; + } await Promise.all( tokens.map(async (token) => { const balance = await getBalance({ token, owner, block, chain, }); @@ -139,7 +149,7 @@ async function getDenomBalance({ denom, owner, block, chain } = {}) { return balance ? Number(balance.amount) : 0; } -async function getBalance2({ balances = {}, owner, block, chain, tokens, blacklistedTokens, } = {}) { +async function getBalance2({ balances = {}, owner, block, chain, tokens, blacklistedTokens, api, } = {}) { const subpath = "cosmos"; let endpoint = `${getEndpoint( chain @@ -153,7 +163,9 @@ async function getBalance2({ balances = {}, owner, block, chain, tokens, blackli for (const { denom, amount } of data) { if (blacklistedTokens?.includes(denom)) continue; if (tokens && !tokens.includes(denom)) continue; - sdk.util.sumSingleBalance(balances, denom.replaceAll('/', ':'), amount); + if (api) api.add(denom, amount); + else + sdk.util.sumSingleBalance(balances, denom.replaceAll('/', ':'), amount); } return balances; } @@ -177,7 +189,8 @@ async function lpMinter({ token, block, chain } = {}) { return data.minter; } -async function queryContract({ contract, chain, data }) { +async function queryContract({ contract, chain, data, api }) { + if (api) chain = api.chain; if (typeof data !== "string") data = JSON.stringify(data); data = Buffer.from(data).toString("base64"); return ( @@ -195,7 +208,7 @@ const multipleEndpoints = { "https://sei-m.api.n0ok.net", "https://sei-api.lavenderfive.com", "https://api-sei.stingray.plus" - ] + ], } async function queryContractWithRetries({ contract, chain, data }) { @@ -220,7 +233,7 @@ async function queryContractWithRetries({ contract, chain, data }) { } } -async function queryManyContracts({ contracts = [], chain, data, permitFailure = false}) { +async function queryManyContracts({ contracts = [], chain, data, permitFailure = false }) { const parallelLimit = 25 const { results, errors } = await PromisePool .withConcurrency(parallelLimit) @@ -280,7 +293,13 @@ async function queryContractStore({ return query(url, block, chain); } -async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, blacklistedTokens, }) { +async function sumTokens({ balances, owners = [], chain, owner, tokens, blacklistedTokens, api, }) { + if (api) { + if (!chain) chain = api.chain; + if (!balances) balances = api.getBalances(); + } else { + if (!balances) balances = {}; + } if (!tokens?.length || (tokens?.length === 1 && tokens[0] === ADDRESSES.null)) tokens = undefined; if (owner) owners = [owner] log(chain, "fetching balances for ", owners.length); @@ -288,7 +307,7 @@ async function sumTokens({ balances = {}, owners = [], chain, owner, tokens, bla const { errors } = await PromisePool.withConcurrency(parallelLimit) .for(owners) - .process(async (owner) => getBalance2({ balances, owner, chain, tokens, blacklistedTokens, })); + .process(async (owner) => getBalance2({ balances, owner, chain, tokens, blacklistedTokens, api, })); if (errors && errors.length) throw errors[0]; return transformBalances(chain, balances); @@ -311,5 +330,5 @@ module.exports = { getTokenBalance, getToken, sumCW20Tokens, - queryContractWithRetries + queryContractWithRetries, }; diff --git a/projects/helper/chain/eos.js b/projects/helper/chain/eos.js index 4799d9d3ccc2..4122653edab2 100644 --- a/projects/helper/chain/eos.js +++ b/projects/helper/chain/eos.js @@ -40,7 +40,12 @@ function get_precision(symbol) { async function get_staked(account_name, symbol, chain = "eos") { const response = await post(`${RPC_ENDPOINTS[chain]}/v1/chain/get_account`, { account_name }) try { - return response.voter_info.staked / (10 ** get_precision(symbol)) + let refunding = 0; + if(response.refund_request){ + refunding += parseFloat(response.refund_request.cpu_amount); + refunding += parseFloat(response.refund_request.net_amount); + } + return refunding + (response.voter_info.staked / (10 ** get_precision(symbol))) } catch (e) { return 0; } diff --git a/projects/helper/chain/flow.js b/projects/helper/chain/flow.js new file mode 100644 index 000000000000..33e5c9c6f781 --- /dev/null +++ b/projects/helper/chain/flow.js @@ -0,0 +1,31 @@ +// const sdk = require('@defillama/sdk') + +const { post } = require('../http') +const { getEnv } = require('../env') + +const endpoint = () => getEnv('FLOW_RPC') + +async function callCadenceScript(script, isNumber = false) { + const queryCodeBase64 = Buffer.from(script, "utf-8").toString("base64"); + const response = await post( + `${endpoint()}/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); + + if (isNumber) { + return Number(resJson.value); + } else { + return resJson; + } +} + +module.exports = { + endpoint: endpoint(), + callCadence: callCadenceScript, +}; diff --git a/projects/helper/chain/fuel.js b/projects/helper/chain/fuel.js new file mode 100644 index 000000000000..43ead7d6cc41 --- /dev/null +++ b/projects/helper/chain/fuel.js @@ -0,0 +1,55 @@ + +const { GraphQLClient, } = require('graphql-request') +const { transformBalances } = require('../portedTokens') +const { fuel: { query }} = require('./rpcProxy') +const client = new GraphQLClient('https://mainnet.fuel.network/v1/graphql') + +async function sumTokens({ api, owner, owners, token, tokens = [], tokensAndOwners = [] }) { + if (token) + tokens = [token] + if (owner) + owners = [owner] + + if (owners.length && !tokens.length) { + await addAllTokenBalances({ api, owners }) + } else if (owners.length) + tokensAndOwners = tokens.map(token => owners.map(owner => [token, owner])).flat() + + tokensAndOwners = getUniqueToA(tokensAndOwners) + + if (tokensAndOwners.length) { + const query = tokensAndOwners.map(([token, owner], i) => `q${i}: contractBalance( + contract: "${owner}" asset: "${token}" + ) { contract assetId amount}`).join('\n'); + + const results = await client.request(`{${query}}`) + Object.values(results).forEach(i => api.add(i.assetId, i.amount)) + } + + return transformBalances('fuel', api.getBalances()) + + function getUniqueToA(toa) { + toa = toa.map(i => i.join('-').toLowerCase()) + toa = new Set(toa) + return [...toa].map(i => i.split('-')) + } +} + +async function addAllTokenBalances({ api, owners = [] }) { + + for (const owner of owners) { + const query = `contractBalances( + filter: { contract: "${owner}" }, first: 1000 + ) { nodes { assetId amount } }` + + const results = await client.request(`{${query}}`) + results.contractBalances.nodes.forEach(node => { + api.add(node.assetId, node.amount); + }) + } +} + +module.exports = { + sumTokens, + query, +} \ No newline at end of file diff --git a/projects/helper/chain/litecoin.js b/projects/helper/chain/litecoin.js index f24b942d5b73..400d6f6d20b7 100644 --- a/projects/helper/chain/litecoin.js +++ b/projects/helper/chain/litecoin.js @@ -1,10 +1,22 @@ const sdk = require('@defillama/sdk') const { get } = require('../http') +const { PromisePool } = require('@supercharge/promise-pool') // const url = addr => 'https://chainz.cryptoid.info/ltc/api.dws?q=getbalance&a=' + addr -const url = addr => 'https://ltc.tokenview.io/api/address/balancetrend/ltc/' + addr +const url1 = addr => 'https://ltc.tokenview.io/api/address/balancetrend/ltc/' + addr +const url = addr => 'https://explorer.litecoin.net/api/address/' + addr async function getBalance(addr) { + try { + const {chain_stats} = await get(url(addr)) + return (chain_stats.funded_txo_sum - chain_stats.spent_txo_sum) / 1e8 + } catch (e) { + console.error(e) + return getBalance1(addr) + } +} + +async function getBalance1(addr) { // return get(url(addr)) const {data} = await get(url(addr)) return +Object.values(data[0])[0] @@ -12,10 +24,14 @@ async function getBalance(addr) { async function sumTokens({ balances = {}, owners = [] }) { let total = 0 - for (const owner of owners) { + + await PromisePool + .withConcurrency(5) + .for(owners) + .process(async owner => { const balance = await getBalance(owner) total += balance - } + }) sdk.util.sumSingleBalance(balances, 'litecoin', total) return balances } diff --git a/projects/helper/chain/near.js b/projects/helper/chain/near.js index 958ad675dc83..c79feedea24d 100644 --- a/projects/helper/chain/near.js +++ b/projects/helper/chain/near.js @@ -13,6 +13,7 @@ function transformAddress(addr) { } const endpoint = "https://rpc.mainnet.near.org" +// const endpoint = "https://near.lava.build" const tokenMapping = { 'wrap.near': { name: 'near', decimals: 24, }, @@ -43,6 +44,13 @@ const tokenMapping = { 'token.sweat': { name: 'sweatcoin', decimals: 18 }, 'v2-nearx.stader-labs.near': { name: 'stader-nearx', decimals: 24 }, '17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1': { name: 'usd-coin', decimals: 6 }, + 'edge-fast.near': { name: 'edge-video-ai', decimals: 24 }, + '802d89b6e511b335f05024a65161bce7efc3f311.factory.bridge.near': { name: 'linear-protocol-lnr', decimals: 18 }, + 'ftv2.nekotoken.near': { name: 'neko', decimals: 24 }, + 'token.lonkingnearbackto2024.near': { name: 'lonk-on-near', decimals: 8 }, + 'blackdragon.tkn.near': { name: 'black-dragon', decimals: 24 }, + 'gear.enleap.near': { name: 'near-tinker-union-gear', decimals: 18 }, + 'token.0xshitzu.near': { name: 'shitzu', decimals: 18 }, } async function view_account(account_id) { diff --git a/projects/helper/chain/radixdlt.js b/projects/helper/chain/radixdlt.js index 84bd13960866..eaafd8f80c89 100644 --- a/projects/helper/chain/radixdlt.js +++ b/projects/helper/chain/radixdlt.js @@ -30,11 +30,12 @@ async function sumTokens({ owner, owners = [], api, transformLSU = false, }) { return fixBalances(api.getBalances()) } -async function queryAddresses({ addresses = [], }) { +async function queryAddresses({ addresses = [], miscQuery = {}}) { let items = [] const chunks = sliceIntoChunks(addresses, 20) for (const chunk of chunks) { const body = { + ...miscQuery, "addresses": chunk, "opt_ins": { "explicit_metadata": ["name"] } } diff --git a/projects/helper/chain/rpcProxy.js b/projects/helper/chain/rpcProxy.js new file mode 100644 index 000000000000..203d0308cb6f --- /dev/null +++ b/projects/helper/chain/rpcProxy.js @@ -0,0 +1,37 @@ +const axios = require('axios') +const { getEnv } = require('../env') + +const client = axios.create({ + baseURL: getEnv('RPC_PROXY_URL'), + timeout: 30000, +}) + + +module.exports = { + fuel: { + query: async ({ contractId, abi, method }) => { + const { data } = await client.post('/fuel/query', { contractId, abi, method }) + return data + } + }, + ripple: { + gatewayBalances: async ({ account, hotwallet }) => { + const { data } = await client.post('/ripple/gateway_balances', { account, hotwallet }) + return data + } + }, + injective: { + mitoVaultQuery: async ({ address }) => { + const { data } = await client.get('/injective/mito-vault/' + address) + return data + }, + getMarkets: async (body) => { + const { data } = await client.post('/injective/orderbook/markets', body) + return data + }, + getOrders: async (body) => { + const { data } = await client.post('/injective/orderbook/orders', body) + return data + }, + }, +} \ No newline at end of file diff --git a/projects/helper/chain/sui.js b/projects/helper/chain/sui.js index 01b174963586..aa832b2077f9 100644 --- a/projects/helper/chain/sui.js +++ b/projects/helper/chain/sui.js @@ -9,6 +9,7 @@ const { sliceIntoChunks, getUniqueAddresses } = require('../utils') //https://docs.sui.io/sui-jsonrpc const endpoint = () => getEnv('SUI_RPC') +const graphEndpoint = () => getEnv('SUI_GRAPH_RPC') async function getObject(objectId) { return (await call('sui_getObject', [objectId, { @@ -32,8 +33,8 @@ async function queryEvents({ eventType, transform = i => i }) { } async function getObjects(objectIds) { - if (objectIds.length > 49) { - const chunks = sliceIntoChunks(objectIds, 49) + if (objectIds.length > 9) { + const chunks = sliceIntoChunks(objectIds, 9) const res = [] for (const chunk of chunks) res.push(...(await getObjects(chunk))) return res @@ -73,8 +74,9 @@ async function getDynamicFieldObjects({ parent, cursor = null, limit = 48, items async function call(method, params, { withMetadata = false } = {}) { if (!Array.isArray(params)) params = [params] const { - result + result, error } = await http.post(endpoint(), { jsonrpc: "2.0", id: 1, method, params, }) + if (!result && error) throw new Error(`[sui] ${error.message}`) if (['suix_getAllBalances'].includes(method)) return result return withMetadata ? result : result.data } @@ -139,6 +141,28 @@ async function sumTokens({ balances = {}, owners = [], blacklistedTokens = [], t return api.getBalances() } +async function queryEventsByType({ eventType, transform = i => i }) { + const query = `query GetEvents($after: String, $eventType: String!) { + events(first: 50, after: $after, filter: { eventType: $eventType }) { + pageInfo { + endCursor + hasNextPage + } + nodes { + json + } + } +}` + const items = [] + let after = null + do { + const { events: { pageInfo: { endCursor, hasNextPage}, nodes } } = await sdk.graph.request(graphEndpoint(), query, {variables: { after, eventType}}) + after = hasNextPage ? endCursor : null + items.push(...nodes.map(i => i.json).map(transform)) + } while (after) + return items +} + module.exports = { endpoint: endpoint(), call, @@ -150,4 +174,5 @@ module.exports = { getDynamicFieldObjects, dexExport, sumTokens, + queryEventsByType, }; diff --git a/projects/helper/chain/ton.js b/projects/helper/chain/ton.js index 2efa80e6a5fa..e9f9e10cfd51 100644 --- a/projects/helper/chain/ton.js +++ b/projects/helper/chain/ton.js @@ -11,6 +11,17 @@ async function getTonBalance(addr) { return res.balance } +async function getJettonBalances(addr) { + const response = await get(`https://tonapi.io/v2/accounts/${addr}/jettons?currencies=usd`) + + const res = { } + response.balances.forEach(val => { + res[val.jetton.address] = { balance: val.balance, price: val.price.prices.USD, decimals: val.jetton.decimals } + }) + + return res +} + async function _sumTokensAccount({ api, addr, tokens = [], onlyWhitelistedTokens = false }) { if (tokens.includes(ADDRESSES.null)) { const balance = await getTonBalance(addr) @@ -28,6 +39,23 @@ async function _sumTokensAccount({ api, addr, tokens = [], onlyWhitelistedTokens }) } +async function getTokenRates({ tokens = [] }) { + const { rates } = await get(`https://tonapi.io/v2/rates?` + ( + new URLSearchParams({ tokens: tokens.join(','), currencies: "usd" }) + ).toString()); + + const tokenPrices = {}; + + tokens.forEach(tokenAddress => { + if (rates[tokenAddress]) { + const usdPrice = rates[tokenAddress].prices.USD; + tokenPrices[tokenAddress] = usdPrice; + } + }); + + return tokenPrices +} + const sumTokensAccount = rateLimited(_sumTokensAccount) async function sumTokens({ api, tokens, owners = [], owner, onlyWhitelistedTokens = false }) { @@ -70,7 +98,9 @@ async function call({ target, abi, params = [] }) { module.exports = { getTonBalance, + getTokenRates, sumTokens, sumTokensExport, call, + getJettonBalances, } \ No newline at end of file diff --git a/projects/helper/chains.json b/projects/helper/chains.json index e813d66cb9da..06c355b3f3bd 100644 --- a/projects/helper/chains.json +++ b/projects/helper/chains.json @@ -11,14 +11,17 @@ "aptos", "arbitrum", "arbitrum_nova", + "assetchain", "ancient8", "archway", "area", + "apechain", "astar", "astrzk", "aura", "aurora", "avax", + "band", "base", "beam", "bevm", @@ -55,6 +58,7 @@ "cardano", "celestia", "celo", + "chainflip", "chainx", "chihuahua", "chz", @@ -70,6 +74,7 @@ "crab", "crescent", "cronos", + "cronos_zkevm", "csc", "cube", "curio", @@ -80,6 +85,7 @@ "defichain_evm", "defiverse", "degen", + "dexalot", "dexit", "dfs", "dfk", @@ -89,6 +95,7 @@ "dydx", "dymension", "echelon", + "eclipse", "edg", "elastos", "elrond", @@ -108,6 +115,7 @@ "ethereumclassic", "ethf", "ethpow", + "etn", "europa", "everscale", "evmos", @@ -121,6 +129,7 @@ "fsc", "ftn", "functionx", + "fuel", "fuse", "fusion", "genesys", @@ -129,6 +138,7 @@ "godwoken", "godwoken_v1", "goerli", + "gravity", "gravitybridge", "grove", "harmony", @@ -136,6 +146,7 @@ "heco", "hedera", "heiko", + "hela", "hoo", "hpb", "hydra", @@ -143,6 +154,7 @@ "hyperliquid", "icon", "icp", + "idex", "imx", "inevm", "injective", @@ -151,6 +163,7 @@ "iotex", "islm", "jbc", + "joltify", "juno", "kadena", "karak", @@ -173,6 +186,7 @@ "lightlink_phoenix", "linea", "liquidchain", + "lisk", "litecoin", "loop", "lukso", @@ -182,6 +196,7 @@ "manta_atlantic", "mantle", "map", + "matchain", "mayachain", "meer", "merlin", @@ -196,6 +211,7 @@ "mode", "moonbeam", "moonriver", + "morph", "multivac", "muuchain", "mvc", @@ -205,6 +221,7 @@ "neo", "neo3", "neon_evm", + "neox", "neutron", "new", "nibiru", @@ -226,6 +243,7 @@ "orai", "ore", "osmosis", + "ox_chain", "ozone", "palette", "palm", @@ -240,6 +258,7 @@ "polkadot", "polygon", "polygon_zkevm", + "polynomial", "pool2", "posi", "proton", @@ -250,11 +269,13 @@ "radixdlt", "rari", "real", + "rbn", "reef", "regen", "rei", "reichain", "renec", + "reya", "ripple", "rollux", "ronin", @@ -263,12 +284,15 @@ "rss3_vsl", "rvn", "saakuru", + "sanko", "sapphire", "scroll", "secret", "sei", + "shape", "shibarium", "shiden", + "shido", "shimmer_evm", "sifchain", "smartbch", @@ -307,6 +331,7 @@ "ultra", "ultron", "umee", + "unit0", "vechain", "velas", "venom", @@ -316,6 +341,7 @@ "wan", "waves", "wax", + "wc", "wemix", "xai", "xdai", @@ -325,12 +351,12 @@ "zeniq", "zeta", "zilliqa", + "zircuit", + "zkcro", "zkfair", "zklink", "zksync", "zora", "zyx", - "joltify", - "sanko", - "ox_chain" + "xsat" ] diff --git a/projects/helper/compound.js b/projects/helper/compound.js index 1431b9681c32..eee33c2a430d 100644 --- a/projects/helper/compound.js +++ b/projects/helper/compound.js @@ -1,342 +1,60 @@ -const ADDRESSES = require('./coreAssets.json') - -const sdk = require('@defillama/sdk'); const abi = require('./abis/compound.json'); -const { unwrapUniswapLPs } = require('./unwrapLPs'); -const { requery } = require("./requery"); -const { getChainTransform, transformBalances } = require('./portedTokens'); -const { usdtAddress } = require('./balances'); -const agoraAbi = require("./../agora/abi.json"); -const { sumTokens2, nullAddress, unwrapLPsAuto, } = require('./unwrapLPs') +const { sumTokens2, nullAddress, } = require('./unwrapLPs') const methodologies = require('./methodologies'); -// ask comptroller for all markets array -async function getAllCTokens(comptroller, block, chain, allMarketsAbi = abi['getAllMarkets']) { - return (await sdk.api.abi.call({ - block, - target: comptroller, - params: [], - abi: allMarketsAbi, - chain - })).output; -} - // returns [{cToken, underlying}] -async function getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklist = [], abis = {}) { - const marketKey = `${chain}:${comptroller}:${block}` - - if (!marketsCache[marketKey]) marketsCache[marketKey] = _getMarkets() - return marketsCache[marketKey] - - async function _getMarkets() { - let allCTokens = await getAllCTokens(comptroller, block, chain, abis.getAllMarkets); - const markets = [] - const calls = [] - allCTokens.forEach(cToken => { - cToken = cToken.toLowerCase() - if (blacklist.includes(cToken)) return; - if (cether && (cToken === cether.toLowerCase?.() || cether.includes(cToken))) { - markets.push({ underlying: cetheEquivalent, cToken }) - return; - } - if (cToken === '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5'.toLowerCase()) { - markets.push({ underlying: ADDRESSES.ethereum.WETH, cToken }) //cETH => WETH - return; - } - if (cToken === '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c'.toLowerCase() && chain === 'avax') { - markets.push({ underlying: ADDRESSES.avax.WAVAX, cToken }) - return; - } - if (['0xd2ec53e8dd00d204d3d9313af5474eb9f5188ef6', '0x0aeadb9d4c6a80462a47e87e76e487fa8b9a37d7'].includes(cToken) && chain === 'rsk') { - markets.push({ underlying: ADDRESSES.rsk.WRBTC1, cToken }) - return; - } - - calls.push({ target: cToken }) - }) - - const underlyings = await sdk.api.abi.multiCall({ - abi: abi['underlying'], - calls, - chain, block, - }) - - await requery(underlyings, chain, block, abi) - - const isCeth = underlyings.output.find(i => !i.output) - if (isCeth) - throw new Error(`${isCeth.input.target} market rugged, is that market CETH?`) - - underlyings.output.forEach(({ output, input: { target } }) => markets.push({ cToken: target, underlying: output })) - - return markets; - } -} -async function unwrapPuffTokens(balances, lpPositions, block) { - const pricePerShare = (await sdk.api.abi.multiCall({ - block, - abi: agoraAbi.getPricePerFullShare, - calls: lpPositions.map(p => ({ - target: p.token - })), - chain: 'metis' - })).output; - const underlying = (await sdk.api.abi.multiCall({ - block, - abi: agoraAbi.want, - calls: lpPositions.map(p => ({ - target: p.token - })), - chain: 'metis' - })).output; - - const newLpPositions = []; - for (let i = 0; i < lpPositions.length; i++) { - newLpPositions.push({ balance: lpPositions[i].balance * pricePerShare[i].output / 10 ** 18, token: underlying[i].output }) - } - - await unwrapUniswapLPs( - balances, - newLpPositions, - block, - 'metis' - ); +async function getMarkets(comptroller, api, cether, cetheEquivalent = nullAddress, blacklist = [], abis = {}) { + + if (cether) { + if (!Array.isArray(cether)) cether = [cether] + cether = new Set(cether.map(i => i.toLowerCase())) + } + const blacklistSet = new Set([...blacklist].map(i => i.toLowerCase())) + const cTokens = (await api.call({ abi: abis.getAllMarkets, target: comptroller })).map(i => i.toLowerCase()) + const underlyings = await api.multiCall({ abi: abi.underlying, calls: cTokens, permitFailure: true }) + + const markets = [] + underlyings.forEach((underlying, i) => { + const cToken = cTokens[i] + if (cether?.has(cToken)) underlying = cetheEquivalent + if (blacklistSet.has(cToken)) return; + if (underlying) markets.push({ cToken, underlying }) + else throw new Error(`Market rugged, is that market CETH? ${cToken}`) + }) + return markets; } -let marketsCache = {} - -function getCompoundV2Tvl(comptroller, chain, transformAdress, - cether = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent = ADDRESSES.ethereum.WETH, - borrowed = false, checkForLPTokens = undefined, - { - fetchBalances = false, - blacklistedTokens = [], - abis = {}, - resolveLPs = true, - } = {}) { +function _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, borrowed = false, { blacklistedTokens = [], abis = {}, } = {}) { abis = { ...abi, ...abis } - blacklistedTokens = blacklistedTokens.map(i => i.toLowerCase()) return async (api) => { - if (!api) { - api = new sdk.ChainApi({ chain, }) - } - chain = api.chain - const block = api.block - if (!transformAdress) transformAdress = await getChainTransform(chain) - let balances = {}; - let markets = await getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklistedTokens, abis) - if (!borrowed && fetchBalances) { - return sumTokens2({ api, tokensAndOwners: markets.map(i => [i.underlying, i.cToken]), blacklistedTokens, }) - } - const cTokenCalls = markets.map(market => ({ - target: market.cToken, - })) - // Get V2 tokens locked - let v2Locked = await sdk.api.abi.multiCall({ - block, - chain, - calls: cTokenCalls, - abi: borrowed ? abis.totalBorrows : abis.getCash, - }); - - let symbols; - if (checkForLPTokens !== undefined) { - symbols = await sdk.api.abi.multiCall({ - block, - chain, - calls: cTokenCalls, - abi: "erc20:symbol", - }); - } - - const lpPositions = [] - markets.forEach((market, idx) => { - const underlying = market.underlying.toLowerCase() - if (blacklistedTokens.includes(underlying)) return; - let getCash = v2Locked.output.find((result) => result.input.target === market.cToken); - if (checkForLPTokens !== undefined && checkForLPTokens(symbols.output[idx].output)) { - lpPositions.push({ - token: underlying, - balance: getCash.output - }) - } else { - sdk.util.sumSingleBalance(balances, transformAdress(underlying), getCash.output) - } - }); - - if (comptroller == "0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da") { - await unwrapPuffTokens(balances, lpPositions, block) - } else if (lpPositions.length > 0) { - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) - } - - if (resolveLPs) await unwrapLPsAuto({ balances, block, chain, abis}) - - return transformBalances(chain, balances); - } -} - -const BigNumber = require('bignumber.js').default; -const { toUSDTBalances } = require('./balances'); - -// ask comptroller for oracle -async function getOracle(block, chain, comptroller, oracleAbi) { - const { output: oracle } = await sdk.api.abi.call({ - target: comptroller, - abi: oracleAbi, - block, - chain: chain, - }); - return oracle; -} - -async function getUnderlyingDecimalsMultiple(block, chain, marketData, cether) { - marketData = marketData.filter(i => i.underlying) - const response = {} - const calls = marketData.map(i => ({ target: i.underlying })) - const { output: decimals } = await sdk.api.abi.multiCall({ - calls, - abi: "erc20:decimals", - block, - chain, - permitFailure: true, - }) - - decimals.forEach(({ output }, i) => { - if (output !== null) - response[marketData[i].cToken] = output - }) - - return response -} - -async function getCashMultiple(block, chain, tokens, borrowed) { - const calls = tokens.map(t => ({ target: t })) - const { output: cash } = await sdk.api.abi.multiCall({ - calls, - abi: borrowed ? abi.totalBorrows : abi['getCash'], - block, - chain, - }); - const response = {} - cash.forEach(({ input, output }) => response[input.target] = output) - return response; -} + let markets = await getMarkets(comptroller, api, cether, cetheEquivalent, blacklistedTokens, abis) + const cTokens = markets.map(market => market.cToken) + const tokens = markets.map(market => market.underlying) + if (!borrowed) + return sumTokens2({ api, tokensAndOwners2: [tokens, cTokens], blacklistedTokens, resolveLP: true, }) -async function getUnderlyingPriceMultiple(block, chain, oracle, tokens, methodAbi) { - const calls = tokens.map(t => ({ params: [t] })) - const { output: underlyingPrice } = await sdk.api.abi.multiCall({ - target: oracle, - abi: methodAbi, - block, - chain, - calls, - }); - const response = {} - underlyingPrice.forEach(({ input, output }) => response[input.params[0]] = output) - return response; -} + let v2Locked = await api.multiCall({ calls: cTokens, abi: borrowed ? abis.totalBorrows : abis.getCash, }) + api.add(tokens, v2Locked) + blacklistedTokens.forEach(token => api.removeTokenBalance(token)) -function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { - oracle: abi['oracle'], - underlyingPrice: abi['getUnderlyingPrice'], - getAllMarkets: abi['getAllMarkets'] -}, { - blacklist = [], - cetheEquivalent = undefined, -} = {}) { - return async (timestamp, ethBlock, { [chain]: block }) => { - let tvl = new BigNumber('0'); - blacklist = blacklist.map(i => i.toLowerCase()) - const marketData = await getMarkets(comptroller, block, chain, cether, cetheEquivalent, blacklist, abis) - let allMarkets = marketData.map(i => i.cToken); - // allMarkets = allMarkets.filter(token => !blacklist.includes(token.toLowerCase())) // taken care of by getMarkets - let oracle = await getOracle(block, chain, comptroller, abis.oracle); - const amounts = await getCashMultiple(block, chain, allMarkets, borrowed) - const decimalsAll = await getUnderlyingDecimalsMultiple(block, chain, marketData, cether) - const underlyingPrices = await getUnderlyingPriceMultiple(block, chain, oracle, allMarkets, abis.underlyingPrice) - - allMarkets.forEach(token => { - let amount = new BigNumber(amounts[token]); - let decimals = decimalsAll[token] ?? 0; - let locked = amount.div(10 ** decimals); - let underlyingPrice = new BigNumber(underlyingPrices[token]).div(10 ** (18 + 18 - decimals)) - tvl = tvl.plus(locked.times(underlyingPrice)); - }) - return toUSDTBalances(tvl.toNumber()); + return sumTokens2({ api, resolveLP: true, }); } } -function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens = [], fetchBalances, abis = {}, resolveLPs=true } = {}) { - if (cether !== undefined && cetheEquivalent === undefined) { - throw new Error("You need to define the underlying for native cAsset") - } - return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, false, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }), - borrowed: getCompoundV2Tvl(comptroller, chain, transformAdressRaw, cether, cetheEquivalent, true, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, resolveLPs }) - } -} - -function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEquivalent, options) { - return { - tvl: async (...args) => { - const transformAddress = await getChainTransform(chain) - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false, undefined, options)(...args) - }, - borrowed: async (...args) => { - const transformAddress = await getChainTransform(chain) - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true, undefined, options)(...args) - }, - } -} - -function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress) { - return { - [chain]: compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress) - } -} - -function usdCompoundExports(comptroller, chain, cether, abis, options = {}) { - return { - tvl: getCompoundUsdTvl(comptroller, chain, cether, false, abis, options,), - borrowed: getCompoundUsdTvl(comptroller, chain, cether, true, abis, options,) - } -} - -function compoundExportsWithDifferentBase(comptroller, chain, token) { - const raw = usdCompoundExports(comptroller, chain) - async function tvl(...params) { - const tvl = await raw.tvl(...params) - return { - [token]: Number(tvl[usdtAddress]) / 1e6 - } - } - - async function borrowed(...params) { - const tvl = await raw.borrowed(...params) - return { - [token]: Number(tvl[usdtAddress]) / 1e6 - } - } +function compoundExports(comptroller, cether, cetheEquivalent = nullAddress, { blacklistedTokens = [], abis = {}, } = {}) { return { - tvl, - borrowed + tvl: _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, false, { blacklistedTokens, abis, }), + borrowed: _getCompoundV2Tvl(comptroller, cether, cetheEquivalent, true, { blacklistedTokens, abis, }) } } -function compoundExports2({ comptroller, chain, cether, cetheEquivalent = nullAddress, transformAdressRaw, checkForLPTokens, blacklistedTokens = [], fetchBalances = true, abis = {} }) { - return compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens, { blacklistedTokens, fetchBalances, abis, }) +function compoundExports2({ comptroller, cether, cetheEquivalent = nullAddress, blacklistedTokens = [], abis = {}, }) { + return compoundExports(comptroller, cether, cetheEquivalent, { blacklistedTokens, abis, }) } module.exports = { methodology: methodologies.lendingMarket, - getCompoundV2Tvl, compoundExports, compoundExports2, - getCompoundUsdTvl, - compoundExportsWithAsyncTransform, - fullCoumpoundExports, - usdCompoundExports, - compoundExportsWithDifferentBase }; diff --git a/projects/helper/coreAssets.json b/projects/helper/coreAssets.json index 9fd47702a747..8201ef6787cd 100644 --- a/projects/helper/coreAssets.json +++ b/projects/helper/coreAssets.json @@ -167,7 +167,8 @@ "ETHIX": "0xec3f3e6d7907acda3a7431abd230196cda3fbb19", "SDAI": "0xaf204776c7245bF4147c2612BF6e5972Ee483701", "XHOPR": "0xD4fdec44DB9D44B8f2b6d529620f9C0C7066A2c1", - "DAI_1": "0x678df3415fc31947da4324ec63212874be5a82f8" + "DAI_1": "0x678df3415fc31947da4324ec63212874be5a82f8", + "sDAI": "0xaf204776c7245bf4147c2612bf6e5972ee483701" }, "okexchain": { "USDC": "0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85", @@ -220,7 +221,9 @@ "USDC": "0x7F5c764cBc14f9669B88837ca1490cCa17c31607", "USDC_CIRCLE": "0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85", "DAI": "0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1", - "WBTC": "0x68f180fcCe6836688e9084f035309E29Bf0A2095" + "WBTC": "0x68f180fcCe6836688e9084f035309E29Bf0A2095", + "weETH": "0x5a7facb970d094b6c7ff1df0ea68d99e6e73cbff", + "ezETH": "0x2416092f143378750bb29b79ed961ab195cceea5" }, "moonriver": { "WMOVR": "0xe3c7487eb01c74b73b7184d198c7fbf46b34e5af", @@ -436,6 +439,7 @@ }, "klaytn": { "WKLAY": "0x57d1a61e4fd09fbf16e35b04959e94dcf2032974", + "WKLAY_1": "0x19aac5f612f524b754ca7e7c41cbfa2e981a4432", "BORA": "0x02cbe46fb8a1f579254a9b485788f2d86cad51aa", "DAI": "0xcb2c7998696ef7a582dfd0aafadcd008d03e791a", "USDC": "0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a", @@ -464,7 +468,8 @@ "aDAI": "0x2ff5371dad5c6ef76d55213b7c5a519f6654ba17", "aDAI_Wormhole_": "0xe9a88c33abf71c902f7581321d05e6516cbca761", "USDK": "0xd2137fdf10bd9e4e850c17539eb24cfe28777753", - "NPT": "0xe06597d02a2c3aa7a9708de2cfa587b128bd3815" + "NPT": "0xe06597d02a2c3aa7a9708de2cfa587b128bd3815", + "stKaia": "0x42952B873ed6f7f0A7E4992E2a9818E3A9001995" }, "nova": { "NUSD": "0x1f5396f254ee25377a5c1b9c6bff5f44e9294fff" @@ -487,6 +492,7 @@ }, "cronos": { "WCRO": "0xca2503482e5d6d762b524978f400f03e38d5f962", + "WCRO_1": "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", "USDC": "0xc21223249ca28397b4b6541dffaecc539bff0c59", "WBTC": "0x062e66477faf219f25d27dced647bf57c3107d52", "SVN": "0x654bac3ec77d6db497892478f854cf6e8245dca9", @@ -513,7 +519,6 @@ "_AVAX": "0x525bd1f949ffa2a0c5820f3b6fe61bb897466ff7", "SWAPZ": "0x9b6fbf0ea23faf0d77b94d5699b44062e5e747ac", "DAI": "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d", - "SCAR": "0x8d9fb713587174ee97e91866050c383b5cee6209", "sVLX": "0xaadbaa6758fc00dec9b43a0364a372605d8f1883", "VLX": "0x2b1abeb48f875465bf0d3a262a2080ab1c7a3e39", "ETH_1": "0x380f73bad5e7396b260f737291ae5a8100baabcd", @@ -1034,6 +1039,15 @@ "ETH": "0x7c598c96d02398d89fbcb9d41eab3df0c16f227d", "USDT": "0x922d641a426dcffaef11680e5358f34d97d112e1" }, + "rollux": { + "WSYS": "0x4200000000000000000000000000000000000006", + "USDC": "0x368433cac2a0b8d76e64681a9835502a1f2a8a30", + "WETH": "0xaa1c53afd099e415208f47fcfa2c880f659e6904", + "USDT": "0x28c9c7fb3fe3104d2116af26cc8ef7905547349c", + "WBTC": "0x2a4dc2e946b92ab4a1f7d62844eb237788f9056c", + "ETH": "0xaa1c53afd099e415208f47fcfa2c880f659e6904", + "BTC": "0x2a4dc2e946b92ab4a1f7d62844eb237788f9056c" + }, "vision": { "USDT": "0x1db6cdc620388a0b6046b20cd59503a0839adcff", "VBTC": "0x4dE4B92C12dD4584873e72447573382C41da5597", @@ -1089,7 +1103,8 @@ "TT_USDT": "0x4f3c8e20942461e2c3bdd8311ac57b0c222f2b82", "TT_ETH": "0x6576bb918709906dcbfdceae4bb1e6df7c8a1077", "TT_USDC": "0x22e89898a04eaf43379beb70bf4e38b1faf8a31e", - "TT_BUSD": "0xbeb0131d95ac3f03fd15894d0ade5dbf7451d171" + "TT_BUSD": "0xbeb0131d95ac3f03fd15894d0ade5dbf7451d171", + "veTT": "0xc3c857a9e5be042c8acf4f2827aa053e93b5d039" }, "conflux": { "WCFX": "0x14b2d3bc65e74dae1030eafd8ac30c533c976a9b", @@ -1216,6 +1231,7 @@ "ATOM_2": "27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2", "USDC": "B3504E092456BA618CC28AC671A71FB08C6CA0FD0BE7C8A5B5A3E2DD933CC9E4", "USDC_1": "E1616E7C19EA474C565737709A628D6F8A23FF9D3E9A7A6871306CF5E0A5341E", + "USDC_2": "B559A80D62249C8AA07A380E2A2BEA6E5CA9A6F079C912C3A9E9B494105E4F81", "GRAV": "C950356239AD2A205DE09FDF066B1F9FF19A7CA7145EA48A5B19B76EE47E52F7", "SCRT": "A358D7F19237777AF6D8AD0E0F53268F8B18AE8A53ED318095C14D6D7F3B2DB5", "AXL": "903A61A498756EA560B85A85132D3AEE21B5DEDD41213725D22ABF276EA6945E", @@ -1240,6 +1256,7 @@ "AXLUSDC": "BFF0D3805B50D93E2FA5C0B2DDF7E0B30A631076CD80BC12A48C0E95404B4A41", "AXLUSDC_1": "EAC38D55372F38F1AFD68DF7FE9EF762DCF69F26520643CF3F9D292A738D8034", "AXLUSDC_2": "295548A78785A1007F232DE286149A6FF512F180AF5657780FC89C009E2C348F", + "AXLUSDT": "57503D7852EF4E1899FE6D71C5E81D7C839F76580F86F21E39348FC2BC9D7CE2", "UST": "B448C0CA358B958301D328CCDC5D5AD642FC30A6D3AE106FF721DB315F3DDE5C", "UST_1": "6F4968A73F90CF7DE6394BF937D6DF7C7D162D74D839C13F53B41157D315E05F", "G-WETH": "DBF5FA602C46392DE9F4796A0FC7D02F3A8A3D32CA3FAA50B761D4AA6F619E95", @@ -1262,6 +1279,8 @@ "GRAV_boot": "C23D820C5B6009E544AFC8AF5A2FEC288108AEDBFAEFDBBDD6BE54CC23069559", "JUNO_boot": "8D9262E35CAE362FA74AE05E430550757CF8D842EC1B241F645D3CB7179AFD10", "TIA": "D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877", + "TIA1": "773B4D0A3CD667B2275D5A4A7A2F0909C0BA0F4059C0B9181E680DDF4965DCC7", + "AXL_WETH": "A585C2D15DCD3B010849B453A2CFCB5E213208A5AB665691792684C26274304D", "EVMOS_boot": "4B322204B4F59D770680FE4D7A565DDC3F37BFF035474B717476C66A4F83DD72" }, "starknet": { @@ -1294,7 +1313,8 @@ "MEGA": "EQBf6-YoR9xylol_NwjHrLkrTFAZJCX-bsd-Xx_902OaPaBf", "WEMIX": "EQCf7Nb341dxOE3N0jimngRxGEV8T3zo-eU2EZVs_nchNhhZ", "jUSDT": "EQBynBO23ywHy_CgarY9NK9FTz0yDsG82PtcbSTQgGoXwiuA", - "USDT": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs" + "USDT": "EQCxE6mUtQJKFnGfaROTKOt1lZbDiiX1kCixRv7Nw2Id_sDs", + "NOT": "EQAvlWFDxGF2lXm67y4yzC17wYKD9A0guwPkMs1gOsM__NOT" }, "defichain": { "DFI": "DFI", @@ -1358,7 +1378,8 @@ "WBTC": "0xBBeB516fb02a01611cBBE0453Fe3c580D7281011", "USDT": "0x493257fD37EDB34451f62EDf8D2a0C418852bA4C", "BUSD": "0x2039bb4116B4EFc145Ec4f0e2eA75012D6C0f181", - "DAI": "0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656" + "DAI": "0x4B9eb6c0b6ea15176BBF62841C6B2A8a398cb656", + "ZK": "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E" }, "polygon_zkevm": { "WETH": "0x4F9A0e7FD2Bf6067db6994CF12E4495Df938E6e9", @@ -1394,7 +1415,8 @@ "USDC_ARB": "0xe32d3ebafa42e6011b87ef1087bbc6053b499bf6f095807b9013aff5a6ecd7bb::coin::COIN", "USDC_BNB": "0x909cba62ce96d54de25bec9502de5ca7b4f28901747bbf96b76c2e63ec5f1cba::coin::COIN", "BUCK": "0xce7ff77a83ea0cb6fd39bd8748e2ec89a3f41e8efdc3f4eb123e0ca37b184db2::buck::BUCK", - "SUI": "0x2::sui::SUI" + "SUI": "0x2::sui::SUI", + "USDC_CIRCLE": "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC" }, "grove": { "WGRV": "0xE85f139488c689038028a3EB8fC38dcC29D4C340" @@ -1420,7 +1442,8 @@ "USDC": "0x15D38573d2feeb82e7ad5187aB8c1D52810B1f07", "USDT": "0x0Cb6F5a34ad42ec934882A05265A7d5F59b51A2f", "HEX": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39", - "DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305" + "DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305", + "sDAI": "0x30fcb23a906493371b1721c8feb8815804808d74" }, "onus": { "WONUS": "0x4c761e48d1e735af551cc38abcbdce1d7faac6e4", @@ -1470,7 +1493,10 @@ "WETH": "0x4200000000000000000000000000000000000006", "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", "USDC": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", - "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" + "DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb", + "USDT": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2", + "rETH": "0xb6fe221fe9eef5aba221c348ba20a1bf5e73624c", + "wstETH": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452" }, "sei": { "SEI": "usei", @@ -1487,7 +1513,9 @@ }, "op_bnb": { "WBNB": "0x4200000000000000000000000000000000000006", - "USDT": "0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3" + "USDT": "0x9e5aac1ba1a2e6aed6b32689dfcf62a509ca96f3", + "ETH": "0xe7798f023fc62146e8aa1b36da45fb70855a77ea", + "FDUSD": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb" }, "archway": { "ARCH": "aarch" @@ -1518,7 +1546,9 @@ "USDT": "secret18wpjn83dayu4meu6wnn29khfkwdxs7kyrz9c8f" }, "aura": { - "AURA": "uaura" + "AURA": "uaura", + "WAURA": "0xDE47A655a5d9904BD3F7e1A536D8323fBD99993A", + "USDT": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd" }, "shibarium": { "WETH": "0x8ed7d143ef452316ab1123d28ab302dc3b80d3ce", @@ -1575,7 +1605,8 @@ "BIFI": "0x047938C3aD13c1eB821C8e310B2B6F889b6d0003", "WBTC": "0x7b8FAC5F29E101BaaB33c5f9c39d4F85ba2cc7C1", "BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E", - "BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555" + "BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555", + "BtcUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555" }, "scroll": { "WETH": "0x5300000000000000000000000000000000000004", @@ -1711,14 +1742,19 @@ "WBTC_1": "0xB880fd278198bd590252621d4CD071b1842E9Bcd" }, "ftn": { - "USDC": "0x4237e0A5b55233D5B6D6d1D9BF421723954130D8" + "USDC": "0x4237e0A5b55233D5B6D6d1D9BF421723954130D8", + "stFTN": "0x780fb5aca83f2e3f57ee18cc3094988ef49d8c3d", + "mUSDC": "0x4b7708ee3ccbd3f9af68208e69ad31f611e1befe", + "mUSDT": "0xb7dc5eca6de5cb9b46ac405d3d4596333714f3f7" }, "q": { "WBTC": "0xde397e6C442A3E697367DecBF0d50733dc916b79", "WDAI": "0xDeb87c37Dcf7F5197026f574cd40B3Fc8Aa126D1", "WUSDC": "0x79Cb92a2806BF4f82B614A84b6805963b8b1D8BB", "WETH": "0xd56F9ffF3fe3BD0C7B52afF9A42eb70E05A287Cc", - "ELK": "0xeEeEEb57642040bE42185f49C52F7E9B38f8eeeE" + "ELK": "0xeEeEEb57642040bE42185f49C52F7E9B38f8eeeE", + "QUSD": "0xE31DD093A2A0aDc80053bF2b929E56aBFE1B1632", + "WQ": "0xd07178e3eCbC78De110Df84fe1A979D5f349784a" }, "zklink": { "WBTC": "0xda4aaed3a53962c83b35697cd138cc6df43af71f", @@ -1756,7 +1792,8 @@ "ETH": "0xeceeefcee421d8062ef8d6b4d814efe4dc898265", "WBTC": "0x5fd55a1b9fc24967c4db09c513c3ba0dfa7ff687", "USDT": "0xd567b3d7b8fe3c79a1ad8da978812cfc4fa05e75", - "AXLUSDC": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd" + "AXLUSDC": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd", + "USDC": "0x0ce35b0d42608ca54eb7bcc8044f7087c18e7717" }, "xlayer": { "WOKB": "0xe538905cf8410324e03a5a23c1c177a474d59b2b", @@ -1797,7 +1834,11 @@ "USDC_1": "0x75E20C5d4aade76143b8b74d1C5E2865347f9d3B" }, "lac": { - "LAC": "0x2911a1ab18546cb501628be8625c7503a2a7db54" + "LAC": "0x2911a1ab18546cb501628be8625c7503a2a7db54", + "WETH": "0x42c8c9c0f0a98720dacdaeac0c319cb272b00d7e", + "WBTC": "0xf54b8cb8eeee3823a55dddf5540ceaddf9724626", + "USDT": "0x7dc8b9e3b083c26c68f0b124ca923aaec7fbee39", + "USDC": "0x51115241c7b8361eee88d8610f71d0a92cee5323" }, "bob": { "WETH": "0x4200000000000000000000000000000000000006", @@ -1807,20 +1848,31 @@ "STETH": "0x85008aE6198BC91aC0735CB5497CF125ddAAc528", "STONE": "0x96147a9ae9a42d7da551fd2322ca15b71032f342", "RETH": "0xb5686c4f60904ec2bda6277d6fe1f7caa8d1b41a", - "TBTC": "0xbba2ef945d523c4e2608c9e1214c2cc64d4fc2e2" + "TBTC": "0xbba2ef945d523c4e2608c9e1214c2cc64d4fc2e2", + "SolvBTC": "0x541fd749419ca806a8bc7da8ac23d346f2df8b77", + "SolvBTC_BBN": "0xCC0966D8418d412c599A6421b760a847eB169A8c", + "FBTC": "0xc96de26018a54d51c097160568752c4e3bd6c364", + "satUSD": "0x78Fea795cBFcC5fFD6Fb5B845a4f53d25C283bDB", + "uniBTC": "0x236f8c0a61dA474dB21B693fB2ea7AAB0c803894", + "pumpBTC": "0x1fcca65fb6ae3b2758b9b2b394cb227eae404e1e" }, "btr": { - "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2" + "ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2", + "WBTC": "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f" }, "taiko": { "USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b", "USDT": "0x2def195713cf4a606b49d07e520e22c17899a736", "USDC_e": "0x19e26b0638bf63aa9fa4d14c6baf8d52ebe86c5c", + "DAI": "0x7d02A3E0180451B17e5D7f29eF78d06F8117106C", + "TAIKO": "0xA9d23408b9bA935c230493c40C73824Df71A0975", + "LRC": "0xd347949f8c85d9f3d6b06bfc4f8c2e07c161f064", "WETH": "0xA51894664A773981C6C112C43ce576f315d5b1B6" }, "stellar": { "XLM": "CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA", - "USDC": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75" + "USDC": "CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75", + "EURC": "CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV" }, "lukso": { "WLYX": "0x2db41674f2b882889e5e1bd09a3f3613952bc472" @@ -1859,6 +1911,142 @@ }, "rari": { "WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0", - "USDC.e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" + "USDC_e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" + }, + "real": { + "RWA": "0x4644066f535ead0cde82d209df78d94572fcbf14" + }, + "saakuru": { + "WOAS": "0x557a526472372f1F222EcC6af8818C1e6e78A85f", + "USDC_e": "0x739222D8A9179fE05129C77a8fa354049c088CaA" + }, + "bouncebit": { + "wstBBTC": "0x8f083eafcbba2e126ad9757639c3a1e25a061a08", + "BBUSD": "0x77776b40C3d75cb07ce54dEA4b2Fd1D07F865222" + }, + "reya": { + "WETH": "0x6b48c2e6a32077ec17e8ba0d98ffc676dfab1a30", + "USDC": "0x3B860c0b53f2e8bd5264AA7c3451d41263C933F2", + "RUSD": "0xa9f32a851b1800742e47725da54a09a7ef2556a3" + }, + "neutron": { + "NTRN": "untrn" + }, + "noble": { + "USDC": "uusdc", + "USDY": "ausdy", + "uusdc": "uusdc", + "ausdy": "ausdy" + }, + "ripple": { + "XRP": "XRP" + }, + "polynomial": { + "USDC": "0x17C9D8Cef7Ef072844EEaEdE1F9f54C7E3fa8743", + "SDAI": "0x615172e47c0C5A6dA8ea959632Ac0166f7a59eDc", + "sUSDe": "0x2A06DEAc3E863c23DD6a89Eeacd80aBA9E08B77B" + }, + "cronos_zkevm": { + "wzkCRO": "0xc1bf55ee54e16229d9b369a5502bfe5fc9f20b6d", + "ETH": "0x898b3560affd6d955b1574d87ee09e46669c60ea", + "USDC": "0xaa5b845f8c9c047779bedf64829601d8b264076c" + }, + "neox": { + "WGAS": "0x008cd7f573998cb841a5d82a857ed1f0ce03a653", + "WGAS_1": "0xde41591ed1f8ed1484ac2cd8ca0876428de60eff" + }, + "gravity": { + "wG": "0xbb859e225ac8fb6be1c7e38d87b767e95fef0ebd", + "WETH": "0xf6f832466Cd6C21967E0D954109403f36Bc8ceaA", + "USDC_e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" + }, + "idex": { + "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6" + }, + "etn": { + "WETN": "0x138dafbda0ccb3d8e39c19edb0510fc31b7c1c77" + }, + "bitkub": { + "KKUB": "0x67ebd850304c70d983b2d1b93ea79c7cd6c3f6b5" + }, + "shape": { + "WETH": "0x4200000000000000000000000000000000000006", + "WETH_1": "0x48A9B22b80F566E88f0f1DcC90Ea15A8A3bAE8a4" + }, + "hela": { + "hUSDC": "0xf5b85320a772b436cb8105441a3db9ba29437b4a", + "hUSDT": "0xd3442073fa7ccf8a7c39d95dc125cd59497aa078", + "WHLUSD": "0x3a035615e101373fa9ba21c5bea7fe4026fc40b4" + }, + "lisk": { + "USDT": "0x05d032ac25d322df992303dca074ee7392c117b9", + "WETH": "0x4200000000000000000000000000000000000006", + "LSK": "0xac485391eb2d7d88253a7f1ef18c37f4242d1a24" + }, + "flow": { + "WFLOW": "0xd3bF53DAC106A0290B0483EcBC89d40FcC961f3e", + "ankrFLOWEVM": "0x1b97100eA1D7126C4d60027e231EA4CB25314bdb", + "USDC_e": "0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52" + }, + "matchain": { + "WBNB": "0x4200000000000000000000000000000000000006" + }, + "fuel": { + "USDC": "0x286c479da40dc953bddc3bb4c453b608bba2e0ac483b077bd475174115395e6b", + "ETH": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07", + "USDT": "0xa0265fb5c32f6e8db3197af3c7eb05c48ae373605b8165b6f4a51c5b0ba4812e", + "sDAI": "0x9e46f919fbf978f3cad7cd34cca982d5613af63ff8aab6c379e4faa179552958", + "mBTC": "0xaf3111a248ff7a3238cdeea845bb2d43cf3835f1f6b8c9d28360728b55b9ce5b", + "METH": "0xafd219f513317b1750783c6581f55530d6cf189a5863fd18bd1b3ffcec1714b4", + "RZETH": "0x91b3559edb2619cde8ffb2aa7b3c3be97efd794ea46700db7092abeee62281b0" + }, + "wc": { + "USDC_e": "0x79A02482A880bCE3F13e09Da970dC34db4CD24d1", + "WLD": "0x2cFc85d8E48F8EAB294be644d9E25C3030863003", + "WBTC": "0x03c7054bcb39f7b2e5b2c7acb37583e32d70cfa3", + "WETH": "0x4200000000000000000000000000000000000006" + }, + "apechain": { + "WAPE": "0x48b62137EdfA95a428D35C09E44256a739F6B557", + "sDAI": "0xA2235d059F80e176D931Ef76b6C51953Eb3fBEf4", + "ApeETH": "0xcF800F4948D16F23333508191B1B1591daF70438" + }, + "zircuit": { + "WETH": "0x4200000000000000000000000000000000000006" + }, + "hedera": { + "XSAUCE": "0x00000000000000000000000000000000001647e8", + "USDC": "0x000000000000000000000000000000000006f89a", + "KARATE": "0x000000000000000000000000000000000022d6de", + "HBARX": "0x00000000000000000000000000000000000cba44", + "SAUCE": "0x00000000000000000000000000000000000b2ad5", + "WHBAR": "0x0000000000000000000000000000000000163b5a", + "DOVU": "0x000000000000000000000000000000000038b3db", + "HLQT": "0x00000000000000000000000000000000005c9f70", + "HST": "0x00000000000000000000000000000000000ec585", + "PACK": "0x0000000000000000000000000000000000492a28", + "STEAM": "0x000000000000000000000000000000000030fb8b" + }, + "morph": { + "WETH": "0x5300000000000000000000000000000000000011", + "USDT": "0xc7d67a9cbb121b3b0b9c053dd9f469523243379a", + "WBTC": "0x803dce4d3f4ae2e17af6c51343040dee320c149d" + }, + "eclipse": { + "ETH": "So11111111111111111111111111111111111111112", + "ETH_1": "9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP", + "SOL": "BeRUj3h7BqkbdfFU7FBNYbodgf8GCHodzKvF9aVjNNfL", + "USDC": "AKEWE7Bgh87GPp171b4cJPSSZfmZwQ3KaqYqXoKLNAEE", + "WIF": "841P4tebEgNux2jaWSjCoi9LhrVr9eHGjLc758Va3RPH" + }, + "unit0": { + "UNIT": "0xcf43f7703d9b4e8835f977ef364b4014fa7e856e" + }, + "rbn": { + "WRBNT": "0x6ed1f491e2d31536d6561f6bdb2adc8f092a6076" + }, + "shido": { + "WSHIDO": "0x8cbaffd9b658997e7bf87e98febf6ea6917166f7", + "USDC": "0x80b5a32e4f032b2a058b4f29ec95eefeeb87adcd" } -} +} \ No newline at end of file diff --git a/projects/helper/curvePools.js b/projects/helper/curvePools.js index 4c4cd6f354bb..b87da2c8dde2 100644 --- a/projects/helper/curvePools.js +++ b/projects/helper/curvePools.js @@ -347,7 +347,7 @@ module.exports = { swapContract: '0x59bf0545fca0e5ad48e13da269facd2e8c886ba4', underlyingTokens: [ '0x64343594ab9b56e99087bfa6f2335db24c2d1f17', - '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', + ADDRESSES.arbitrum.FRAX, ] }, // pBTC-sBTC Ethereum @@ -389,7 +389,7 @@ module.exports = { }, '0x961226b64ad373275130234145b96d100dc0b655': { swapContract: '0x961226b64ad373275130234145b96d100dc0b655', - underlyingTokens: ['0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0'] + underlyingTokens: [ADDRESSES.ethereum.FXS] }, // TOKEMAKS END diff --git a/projects/helper/env.js b/projects/helper/env.js index a5dd7389b105..fcd578c0968e 100644 --- a/projects/helper/env.js +++ b/projects/helper/env.js @@ -4,25 +4,32 @@ const BOOL_KEYS = [ ] const DEFAULTS = { + EVMOS_MULTICALL_CHUNK_SIZE: "3", // evmos reduced gas limit, this is a workaround to make multicall work STARKNET_RPC: 'https://starknet-mainnet.public.blastapi.io', COVALENT_KEY: 'ckey_72cd3b74b4a048c9bc671f7c5a6', SOLANA_RPC: 'https://mainnet.helius-rpc.com/?api-key=0109717a-77b4-498a-bc3c-a0b31aa1b3bf', + ECLIPSE_RPC: 'https://eclipse.lgns.net', APTOS_RPC: 'https://aptos-mainnet.pontem.network', SUI_RPC: 'https://fullnode.mainnet.sui.io/', + SUI_GRAPH_RPC: 'https://sui-mainnet.mystenlabs.com/graphql', + FLOW_RPC: 'https://rest-mainnet.onflow.org', + FLOW_EVM_RPC: 'https://mainnet.evm.nodes.onflow.org', MULTIVERSX_RPC: 'https://api.multiversx.com', ANKR_API_KEY: '79258ce7f7ee046decc3b5292a24eb4bf7c910d7e39b691384c7ce0cfb839a01', RENEC_RPC: "https://api-mainnet-beta.renec.foundation:8899/", - BSQUARED_RPC: "https://rpc.bsquared.network,https://b2-mainnet.alt.technology", // add manually, short name is b2-mainnet - 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", + IDEX_RPC: "https://xchain-rpc.idex.io", + ETN_RPC: "https://rpc.ankr.com/electroneum", + MATCHAIN_RPC: "https://rpc.matchscan.io,https://rpc.matchain.io", + MATCHAIN_RPC_MULTICALL: "0xDa91510Bd8c50bfa54FC2BE2dD6dAbE03eA8496c", + SHAPE_RPC:'https://mainnet.shape.network', + SHAPE_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", + APECHAIN_RPC_MULTICALL: "0xcA11bde05977b3631167028862bE2a173976CA11", + MORPH_RPC_MULTICALL: "0x33A213b1049D5AD2eeE6e61dAe040955e60383D4", + WC_RPC: "https://worldchain-mainnet.g.alchemy.com/public", + APECHAIN_RPC: "https://rpc.apechain.com", + RPC_PROXY_URL: "https://rpc-proxy.llama.fi", + UNIT0_RPC: "https://rpc.unit0.dev", + RBN_RPC: "https://governors.mainnet.redbelly.network", } const ENV_KEYS = [ @@ -36,6 +43,7 @@ const ENV_KEYS = [ 'SUMMER_AJNA_ENDPOINT', 'SUMMER_CONFIRMED_VAULTS_ENDPOINT', 'ETHEREUM_TOKENS_ENDPOINT', + 'FBTC_ACCESS_TOKEN', 'UNISAT_AUTH' ] diff --git a/projects/helper/hodltree/calculateBalances.js b/projects/helper/hodltree/calculateBalances.js deleted file mode 100644 index 0f1031e71cc7..000000000000 --- a/projects/helper/hodltree/calculateBalances.js +++ /dev/null @@ -1,54 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const { - ethContracts, - polygonContracts, - dexTypes -} = require('../../config/hodltree'); -const { getChainTransform } = require('../portedTokens'); -const { calculateEM } = require('./calculateEM'); -const { calculateFlashloan } = require('./calculateFlashloan'); -const { calculateLendBorrow } = require('./calculateLendBorrow'); - -async function calculateHodltreeBalances(dexes, chain, chainBlocks, transform) { - let tokenBalances = []; - for (let dex of dexes) { - let res; - switch (dex.dexType) { - case dexTypes.dexType.flashloan: - res = await calculateFlashloan(dex, chain, chainBlocks) - break - - case dexTypes.dexType.lendBorrow: - res = await calculateLendBorrow(dex, chain, chainBlocks) - break - - case dexTypes.dexType.em: - res = await calculateEM(dex, chain, chainBlocks) - break - } - tokenBalances = tokenBalances.concat(res); - } - const balances = {}; - tokenBalances.map((tokenBalancePair) => { - sdk.util.sumSingleBalance(balances, transform(tokenBalancePair[0]), tokenBalancePair[1]); - }) - - return balances; -} - -async function calculateHodltreeBalancesEth(timestamp, block, chainBlocks) { - const transform = await getChainTransform('ethereum'); - return calculateHodltreeBalances(ethContracts, 'ethereum', chainBlocks, transform); -} - -async function calculateHodltreeBalancesPolygon(timestamp, block, chainBlocks) { - const transform = await getChainTransform('polygon') - return calculateHodltreeBalances(polygonContracts, 'polygon', chainBlocks, transform); - -} - -module.exports = { - calculateHodltreeBalancesEth, - calculateHodltreeBalancesPolygon -} \ No newline at end of file diff --git a/projects/helper/hodltree/calculateEM.js b/projects/helper/hodltree/calculateEM.js deleted file mode 100644 index 1b9a45f76b32..000000000000 --- a/projects/helper/hodltree/calculateEM.js +++ /dev/null @@ -1,40 +0,0 @@ -const sdk = require('@defillama/sdk'); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateEM(dex, chain, chainBlocks) { - let tokens = []; - let calls = []; - dex.contracts.map((contract) => { - let token = contract.miscInfo.token; - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }) - }) - - const flashloanBalances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], flashloanBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateEM -} \ No newline at end of file diff --git a/projects/helper/hodltree/calculateFlashloan.js b/projects/helper/hodltree/calculateFlashloan.js deleted file mode 100644 index be4068eb7db1..000000000000 --- a/projects/helper/hodltree/calculateFlashloan.js +++ /dev/null @@ -1,41 +0,0 @@ -const sdk = require('@defillama/sdk'); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateFlashloan(dex, chain, chainBlocks) { - let tokens = []; - let calls = []; - dex.contracts.map((contract) => { - for (let token of contract.miscInfo.tokensIn) { - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }) - } - }) - - const flashloanBalances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], flashloanBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateFlashloan -} \ No newline at end of file diff --git a/projects/helper/hodltree/calculateLendBorrow.js b/projects/helper/hodltree/calculateLendBorrow.js deleted file mode 100644 index 1ac01b6e5d57..000000000000 --- a/projects/helper/hodltree/calculateLendBorrow.js +++ /dev/null @@ -1,41 +0,0 @@ -const sdk = require('@defillama/sdk'); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateLendBorrow(dex, chain, chainBlocks) { - let calls = []; - let tokens = []; - - dex.contracts.map((contract) => { - let token = contract.miscInfo.tokenIn; - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }); - }); - - const lendBorrowBalances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], lendBorrowBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateLendBorrow -} \ No newline at end of file diff --git a/projects/helper/karpatkey.js b/projects/helper/karpatkey.js index d412e0fe79a4..9484f6ce62d2 100644 --- a/projects/helper/karpatkey.js +++ b/projects/helper/karpatkey.js @@ -1,29 +1,14 @@ const { sumSingleBalance } = require("@defillama/sdk/build/generalUtil") const { fetchURL } = require("./utils") -const symbolToId = { - "BAL":"balancer", - "DAI":"dai", - "ETH":"ethereum", - "USDC":"usd-coin", - "USDT":"tether", - "WBTC":"bitcoin", - "WETH":"ethereum", - "rETH2":"reth2", - "stETH":"staked-ether", - "sETH2":"seth2", - "rETH": "rocket-pool-eth", - "ankrETH":"ankreth", - "cbETH":"coinbase-wrapped-staked-eth", - "ETHx": "stader-ethx", - "GNO": "gnosis", - wstETH: "wrapped-steth", - WXDAI: "dai", - XDAI: "dai" -} - const MONTH = 30*24*3600e3 +const chainMapping = { + "Gnosis": "xdai", + "Avalanche": "avax", + "Binance": "bsc" +} + async function karpatKeyTvl({timestamp}, daoName, tokenToExclude) { const {data} = await fetchURL("https://aumapi.karpatkey.dev/our_daos_token_details") let date = new Date(timestamp*1e3) @@ -37,8 +22,9 @@ async function karpatKeyTvl({timestamp}, daoName, tokenToExclude) { } const balances = {} monthlyData.forEach(bal=>{ - if(symbolToId[bal.token_symbol] && tokenToExclude !== bal.token_symbol){ - sumSingleBalance(balances, symbolToId[bal.token_symbol], bal.token_balance) + if(tokenToExclude !== bal.token_symbol){ + const chain = chainMapping[bal.blockchain] ?? bal.blockchain.toLowerCase() + sumSingleBalance(balances, chain +':' + bal.token_address, bal.value) } else { console.log(`Skipping ${bal.token_symbol}`) } diff --git a/projects/helper/ohm.js b/projects/helper/ohm.js index 59ed5d231219..79502966dfee 100644 --- a/projects/helper/ohm.js +++ b/projects/helper/ohm.js @@ -1,26 +1,15 @@ -const { staking, stakingUnknownPricedLP } = require('./staking') -const { sumTokensAndLPsSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown } = require('./unwrapLPs') +const { staking, } = require('./staking') +const { sumTokens2 } = require('./unwrapLPs') -function ohmTvl(treasury, treasuryTokens, chain = 'ethereum', stakingAddress, stakingToken, transformOriginal = undefined, fix, tokenOnCoingecko = true) { - let transform = transformOriginal - const tvl = async (time, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const balances = {} - await sumTokensAndLPsSharedOwners(balances, tokenOnCoingecko?treasuryTokens:treasuryTokens.filter(t=>t[1]===false), [treasury], block, chain, transform || (addr => `${chain}:${addr}`)) - if(!tokenOnCoingecko){ - await Promise.all(treasuryTokens.filter(t=>t[1]===true).map(t=> - sumLPWithOnlyOneTokenOtherThanKnown(balances, t[0], treasury, stakingToken, block, chain, transform) - )) - } - if (fix) fix(balances) - return balances +function ohmTvl(treasury, treasuryTokens, chain = 'ethereum', stakingAddress, stakingToken) { + const tvl = async (api) => { + const tokens = treasuryTokens.map(t => t[0]) + return sumTokens2({ api, tokens, owner: treasury, resolveLP: true, }) } return { [chain]: { tvl, - staking: tokenOnCoingecko? - staking(stakingAddress, stakingToken, chain, transform ? transform(stakingToken) : undefined) - : stakingUnknownPricedLP(stakingAddress, stakingToken, chain, treasuryTokens.find(t=>t[1]===true)[0], transform) + staking: staking(stakingAddress, stakingToken) } } } diff --git a/projects/helper/pool2.js b/projects/helper/pool2.js index bc4a64d17744..82589cad5f67 100644 --- a/projects/helper/pool2.js +++ b/projects/helper/pool2.js @@ -1,163 +1,26 @@ const { _BASE_TOKEN_, _QUOTE_TOKEN_ } = require('./abis/dodo.json') -const sdk = require('@defillama/sdk') -const { default: BigNumber } = require('bignumber.js') -const { unwrapUniswapLPs, sumTokensAndLPsSharedOwners, sumTokensExport, } = require('./unwrapLPs'); -const { getFixBalancesSync } = require('../helper/portedTokens') -const masterchefAbi = require("./abis/masterchef.json") -const token0Abi = 'address:token0' -const token1Abi = 'address:token1' -const { isLP, getPoolInfo } = require('./masterchef') +const { sumTokensExport, sumTokens2, } = require('./unwrapLPs'); const { sumTokensExport: uSumExport } = require('./unknownTokens') -function pool2(stakingContract, lpToken, chain, transformAddress) { +function pool2(stakingContract, lpToken) { if (!Array.isArray(stakingContract)) stakingContract = [stakingContract] if (!Array.isArray(lpToken)) lpToken = [lpToken] if (arguments.length === 2) return uSumExport({ tokens: lpToken, owners: stakingContract, useDefaultCoreAssets: true }) - return pool2s(stakingContract, lpToken, chain, transformAddress) + return pool2s(stakingContract, lpToken) } -function pool2s(stakingContracts, lpTokens, chain = "ethereum", transformAddress = undefined) { +function pool2s(stakingContracts, lpTokens) { return async (api) => { - chain = api.chain ?? chain - const block = api.block - const balances = {} - let transform = transformAddress - if (transform === undefined) { - transform = addr => `${chain}:${addr}` - } - await sumTokensAndLPsSharedOwners(balances, lpTokens.map(token => [token, true]), stakingContracts, block, chain, transform) - const fixBalances = getFixBalancesSync(chain) - fixBalances(balances) - return balances + return sumTokens2({ api, tokens: lpTokens, owners: stakingContracts, resolveLP: true}) } } -function pool2Exports(stakingContract, lpTokens, chain, transformAddress) { - return pool2s([stakingContract], lpTokens, chain, transformAddress) -} - -function dodoPool2(stakingContract, lpToken, chain = "ethereum", transformAddress = addr => addr) { - return async (_timestamp, _ethBlock, chainBlocks) => { - const balances = {} - const block = chainBlocks[chain] - const [baseToken, quoteToken, totalSupply] = await Promise.all([_BASE_TOKEN_, _QUOTE_TOKEN_, "erc20:totalSupply"].map(abi => sdk.api.abi.call({ - target: lpToken, - chain, - block, - abi - }).then(r => r.output))) - const [baseTokenBalance, quoteTokenBalance, stakedLPBalance] = await Promise.all([ - [baseToken, lpToken], [quoteToken, lpToken], [lpToken, stakingContract] - ].map(token => sdk.api.abi.call({ - target: token[0], - params: [token[1]], - chain, - block, - abi: 'erc20:balanceOf' - }).then(r => r.output))) - sdk.util.sumSingleBalance(balances, baseToken, BigNumber(baseTokenBalance).times(stakedLPBalance).div(totalSupply).toFixed(0)) - sdk.util.sumSingleBalance(balances, quoteToken, BigNumber(quoteTokenBalance).times(stakedLPBalance).div(totalSupply).toFixed(0)) - return balances - } -} - - -async function pool2BalanceFromMasterChef(balances, masterchef, token, block, chain = "ethereum", transformAddress = (addr) => addr, poolInfoAbi = masterchefAbi.poolInfo) { - const poolInfo = await getPoolInfo(masterchef, block, chain, poolInfoAbi) - - let symbols = ( - await sdk.api.abi.multiCall({ - calls: poolInfo.map((p) => ({ - target: p.output.lpToken, - })), - abi: "erc20:symbol", - block, - chain, - }) - ).output; - - let lpTokens = []; - - for (let i = 0; i < symbols.length; i++) { - let symbol = symbols[i]; - if (symbol.output === null) { - continue; - } - if (isLP(symbol.output, symbol.input.target, chain)) { - lpTokens.push(symbol.input.target); - } - } - - let [tokens0, tokens1] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: lpTokens.map((p) => ({ - target: p, - })), - abi: token0Abi, - block, - chain, - }), - sdk.api.abi.multiCall({ - calls: lpTokens.map((p) => ({ - target: p, - })), - abi: token1Abi, - block, - chain, - }), - ]); - - let pool2LPs = []; - - for (let i = 0; i < lpTokens.length; i++) { - if ( - tokens0.output[i].output.toLowerCase() === token.toLowerCase() || - tokens1.output[i].output.toLowerCase() === token.toLowerCase() - ) { - pool2LPs.push(lpTokens[i]); - } - } - - let lpBalances = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map((p) => ({ - target: p, - params: masterchef - })), - abi: "erc20:balanceOf", - block, - chain, - })).output; - - let lpPositions = lpBalances.map((p) => ({ - balance: p.output, - token: p.input.target - })); - - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); - -} - -function pool2BalanceFromMasterChefExports(masterchef, token, chain = "ethereum", transformAddress = (addr) => addr, poolInfoAbi = masterchefAbi.poolInfo) { - - return async (_timestamp, _ethBlock, chainBlocks) => { - let balances = {}; - - await pool2BalanceFromMasterChef(balances, masterchef, token, chainBlocks[chain], chain, transformAddress, poolInfoAbi); - - return balances; - } -} - -function pool2UniV3({ stakingAddress, chain = 'ethereum' }) { +function pool2UniV3({ stakingAddress, }) { return sumTokensExport({ owner: stakingAddress, resolveUniV3: true }) } module.exports = { pool2, - pool2Exports, - dodoPool2, pool2s, - pool2BalanceFromMasterChef, - pool2BalanceFromMasterChefExports, pool2UniV3, } \ No newline at end of file diff --git a/projects/helper/portedTokens.js b/projects/helper/portedTokens.js index 1db3a4f770c1..f24b23c6f366 100644 --- a/projects/helper/portedTokens.js +++ b/projects/helper/portedTokens.js @@ -16,6 +16,7 @@ async function transformInjectiveAddress() { addr = addr.replace(/\//g, ':') if (addr.startsWith('peggy0x')) return `ethereum:${addr.replace('peggy', '')}` + if (addr.startsWith('injective:') || addr.startsWith('ethereum:')) return addr return `injective:${addr}`; }; } @@ -112,7 +113,7 @@ async function getChainTransform(chain) { 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 + if (addr.startsWith('0x') || ['solana', 'kava', 'renec', 'eclipse'].includes(chain)) return chainStr return addr }; } diff --git a/projects/helper/solana.js b/projects/helper/solana.js index 04b20842c185..67fbc7ca8aab 100644 --- a/projects/helper/solana.js +++ b/projects/helper/solana.js @@ -9,7 +9,15 @@ const { sleep, sliceIntoChunks, log, } = require('./utils') const { decodeAccount } = require('./utils/solana/layout') const sdk = require('@defillama/sdk'); -const { TOKEN_PROGRAM_ID, ASSOCIATED_PROGRAM_ID, } = require('@project-serum/anchor/dist/cjs/utils/token'); + +/** Address of the SPL Token program */ +const TOKEN_PROGRAM_ID = new PublicKey('TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA') + +/** Address of the SPL Token 2022 program */ +const TOKEN_2022_PROGRAM_ID = new PublicKey('TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb') + +/** Address of the SPL Associated Token Account program */ +const ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey('ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL') const blacklistedTokens_default = [ 'CowKesoLUaHSbAMaUxJUj7eodHHsaLsS65cy8NFyRDGP', @@ -22,7 +30,8 @@ const blacklistedTokens_default = [ '5fTwKZP2AK39LtFN9Ayppu6hdCVKfMGVm79F2EgHCtsi', //WHEY ] -let connection, provider +let connection = {} +let provider = {} const endpoint = (isClient) => { if (isClient) return getEnv('SOLANA_RPC_CLIENT') ?? getEnv('SOLANA_RPC') @@ -30,58 +39,97 @@ const endpoint = (isClient) => { } const renecEndpoint = () => getEnv('RENEC_RPC') +const eclipseEndpoint = () => getEnv('ECLIPSE_RPC') + const endpointMap = { solana: endpoint, renec: renecEndpoint, + eclipse: eclipseEndpoint, } function getConnection(chain = 'solana') { - if (!connection) connection = new Connection(endpointMap[chain](true)) - return connection + if (!connection[chain]) connection[chain] = new Connection(endpointMap[chain](true)) + return connection[chain] } function getProvider(chain = 'solana') { - if (!provider) { + if (!provider[chain]) { const dummy_keypair = Keypair.generate(); const wallet = new Wallet(dummy_keypair); - provider = new Provider(getConnection(chain), wallet) + provider[chain] = new Provider(getConnection(chain), wallet) } - return provider; + return provider[chain] } -async function getTokenSupply(token) { - const tokenSupply = await http.post(endpoint(), { - jsonrpc: "2.0", - id: 1, - method: "getTokenSupply", - params: [token], - }); - return tokenSupply.result.value.uiAmount; + +function getAssociatedTokenAddress(mint, owner,) { + if (typeof mint === 'string') mint = new PublicKey(mint) + if (typeof owner === 'string') owner = new PublicKey(owner) + const [associatedTokenAddress] = PublicKey.findProgramAddressSync([owner.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()], ASSOCIATED_TOKEN_PROGRAM_ID); + return associatedTokenAddress; +} + + +async function getTokenSupplies(tokens, { api } = {}) { + const sleepTime = tokens.length > 2000 ? 2000 : 200 + const connection = getConnection() + tokens = tokens.map(i => typeof i === 'string' ? new PublicKey(i) : i) + const res = await runInChunks(tokens, chunk => connection.getMultipleAccountsInfo(chunk), { sleepTime }) + const response = {} + res.forEach((data, idx) => { + if (!data) { + sdk.log(`Invalid account: ${tokens[idx]}`) + return; + } + try { + data = decodeAccount('mint', data) + response[tokens[idx].toString()] = data.supply.toString() + if (api) api.add(tokens[idx].toString(), data.supply.toString()) + } catch (e) { + sdk.log(`Error decoding account: ${tokens[idx]}`) + } + }) + return response } async function getTokenAccountBalances(tokenAccounts, { individual = false, allowError = false, chain = 'solana' } = {}) { - log('total token accounts: ', tokenAccounts.length) + const sleepTime = tokenAccounts.length > 2000 ? 2000 : 200 + log('total token accounts: ', tokenAccounts.length, 'sleepTime: ', sleepTime) tokenAccounts.forEach((val, i) => { if (typeof val === 'string') tokenAccounts[i] = new PublicKey(val) }) const connection = getConnection(chain) const balancesIndividual = [] const balances = {} - const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk)) + const res = await runInChunks(tokenAccounts, chunk => connection.getMultipleAccountsInfo(chunk), { sleepTime }) res.forEach((data, idx) => { + if (!data) { sdk.log(`Invalid account: ${tokenAccounts[idx]}`) if (allowError) return; else throw new Error(`Invalid account: ${tokenAccounts[idx]}`) } - data = decodeAccount('tokenAccount', data) - const mint = data.mint.toString() - const amount = data.amount.toString() - if (individual) - balancesIndividual.push({ mint, amount }) - else - sdk.util.sumSingleBalance(balances, mint, amount) + + try { + + data = decodeAccount('tokenAccount', data) + const mint = data.mint.toString() + const amount = data.amount.toString() + if (individual) + balancesIndividual.push({ mint, amount }) + else + sdk.util.sumSingleBalance(balances, mint, amount) + + } catch (e) { + if (individual) + balancesIndividual.push({ mint: 'error', amount: 0 }) + + sdk.log(`Error decoding account: ${tokenAccounts[idx]}`) + if (allowError) return; + else throw new Error(`Error decoding account: ${tokenAccounts[idx]}`) + } + }) return individual ? balancesIndividual : balances @@ -105,7 +153,7 @@ function exportDexTVL(DEX_PROGRAM_ID, getTokenAccounts, chain = 'solana') { const chunks = sliceIntoChunks(tokenAccounts, 99) const results = [] for (const chunk of chunks) - results.push(...await getTokenAccountBalances(chunk, { individual: true, chain, })) + results.push(...await getTokenAccountBalances(chunk, { individual: true, chain, allowError: true, })) const data = [] for (let i = 0; i < results.length; i = i + 2) { @@ -139,8 +187,13 @@ function sumTokensExport({ tokenAccounts, owner, owners, tokens, solOwners, blac return (api) => sumTokens2({ api, chain: api.chain, tokenAccounts, owner, owners, tokens, solOwners, blacklistedTokens, allowError, tokensAndOwners, ...rest }) } +function getEndpoint(chain) { + return endpointMap[chain]() +} + async function sumTokens2({ - balances = {}, + api, + balances, tokensAndOwners = [], tokens = [], owners = [], @@ -150,7 +203,16 @@ async function sumTokens2({ blacklistedTokens = [], allowError = false, computeTokenAccount = false, + chain = 'solana', }) { + + if (api) chain = api.chain + if (!balances) { + if (api) balances = api.getBalances() + else balances = {} + } + + const endpoint = getEndpoint(chain) blacklistedTokens.push(...blacklistedTokens_default) if (!tokensAndOwners.length) { if (owner) tokensAndOwners = tokens.map(t => [t, owner]) @@ -159,10 +221,14 @@ async function sumTokens2({ if (!tokensAndOwners.length) { const _owners = getUniqueAddresses([...owners, owner].filter(i => i), 'solana') - 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) + if (_owners.length) { + const data = await getOwnerAllAccounts(_owners) + const tokenBalances = {} + for (const item of data) { + if (blacklistedTokens.includes(item.mint) || +item.amount < 1e6) continue; + sdk.util.sumSingleBalance(tokenBalances,item.mint, item.amount) + } + await transformBalances({ tokenBalances, balances, chain, }) } } @@ -176,20 +242,20 @@ async function sumTokens2({ tokensAndOwners = getUnique(tokensAndOwners) log('total balance queries: ', tokensAndOwners.length) await runInChunks(tokensAndOwners, async (chunk) => { - const tokenBalances = await getTokenBalances(chunk) - transformBalances({ tokenBalances, balances, }) + const tokenBalances = await getTokenBalances(chunk, chain) + transformBalances({ tokenBalances, balances, chain, }) }, { sleepTime: 400 }) } if (tokenAccounts.length) { tokenAccounts = getUniqueAddresses(tokenAccounts, 'solana') - const tokenBalances = await getTokenAccountBalances(tokenAccounts, { allowError }) - await transformBalances({ tokenBalances, balances, }) + const tokenBalances = await getTokenAccountBalances(tokenAccounts, { allowError, chain }) + await transformBalances({ tokenBalances, balances, chain, }) } if (solOwners.length) { - const solBalance = await getSolBalances(solOwners) + const solBalance = await getSolBalances(solOwners, { chain }) sdk.util.sumSingleBalance(balances, 'solana:' + ADDRESSES.solana.SOL, solBalance) } @@ -206,10 +272,10 @@ async function sumTokens2({ } async function getOwnerAllAccounts(owners) { - console.log('fetching sol token balances for', owners.length, 'owners') + sdk.log('fetching sol token balances for', owners.length, 'owners', chain,) return runInChunks(owners, async (chunk) => { const body = chunk.map(i => formOwnerBalanceQuery(i)) - const tokenBalances = await http.post(endpoint(), body) + 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, @@ -234,9 +300,9 @@ async function sumTokens2({ } } - async function getSolBalances(accounts) { - const connection = getConnection() - + async function getSolBalances(accounts, { chain} = {}) { + const connection = getConnection(chain) + const balances = await runInChunks(accounts, async (chunk) => { chunk = chunk.map(i => typeof i === 'string' ? new PublicKey(i) : i) const accountInfos = await connection.getMultipleAccountsInfo(chunk) @@ -254,14 +320,15 @@ async function sumTokens2({ return tokensAndOwners.map(([mint, owner]) => { return PublicKey.findProgramAddressSync( [owner.toBuffer(), programBuffer, mint.toBuffer(),], - ASSOCIATED_PROGRAM_ID + ASSOCIATED_TOKEN_PROGRAM_ID )[0] }) } - async function getTokenBalances(tokensAndAccounts) { + async function getTokenBalances(tokensAndAccounts, chain) { + const endpoint = getEndpoint(chain) const body = tokensAndAccounts.map(([token, account], i) => formTokenBalanceQuery(token, account, i)) - const tokenBalances = await http.post(endpoint(), body); + const tokenBalances = await http.post(endpoint, body); const balances = {} tokenBalances.forEach(({ result: { value } = {} } = {}) => { if (!value) return; @@ -286,8 +353,8 @@ async function sumTokens2({ } } -async function transformBalances({ tokenBalances, balances = {}, }) { - await transformBalancesOrig('solana', tokenBalances) +async function transformBalances({ tokenBalances, balances = {}, chain = 'solana' }) { + await transformBalancesOrig(chain, tokenBalances) for (const [token, balance] of Object.entries(tokenBalances)) sdk.util.sumSingleBalance(balances, token, balance) return balances @@ -340,7 +407,6 @@ async function runInChunks(inputs, fn, { chunkSize = 99, sleepTime } = {}) { module.exports = { endpoint: endpoint(), - getTokenSupply, getMultipleAccounts, exportDexTVL, getProvider, @@ -353,4 +419,9 @@ module.exports = { blacklistedTokens_default, getStakedSol, getSolBalanceFromStakePool, + getTokenSupplies, + TOKEN_PROGRAM_ID, + ASSOCIATED_TOKEN_PROGRAM_ID, + TOKEN_2022_PROGRAM_ID, + getAssociatedTokenAddress, }; diff --git a/projects/helper/token.js b/projects/helper/token.js index f122188e8901..c84b3e14d8d3 100644 --- a/projects/helper/token.js +++ b/projects/helper/token.js @@ -97,7 +97,7 @@ async function ankrGetTokens(address, { onlyWhitelisted = true, skipCacheRead = jsonrpc: '2.0', method: 'ankr_getAccountBalance', params: { - blockchain: Object.values(ankrChainMapping).filter(i => i !== 'eth'), + blockchain: Object.values(ankrChainMapping), onlyWhitelisted, nativeFirst: true, skipSyncCheck: true, @@ -106,7 +106,7 @@ async function ankrGetTokens(address, { onlyWhitelisted = true, skipCacheRead = id: 42 } }; - const tokens = {} + const tokens = cache.tokens ?? {} const { data: { result: { assets } } } = await axios.request(options) const tokenCache = { timestamp: timeNow, tokens, } for (const asset of assets) { @@ -117,7 +117,7 @@ async function ankrGetTokens(address, { onlyWhitelisted = true, skipCacheRead = for (const [chain, values] of Object.entries(tokens)) { tokens[chain] = getUniqueAddresses(values) } - tokens.eth = await getETHTokens(address, onlyWhitelisted) + // tokens.eth = await getETHTokens(address, onlyWhitelisted) await setCache(project, key, tokenCache) return tokens diff --git a/projects/helper/tokenMapping.js b/projects/helper/tokenMapping.js index 794f68d8bdf3..4fac0bd54006 100644 --- a/projects/helper/tokenMapping.js +++ b/projects/helper/tokenMapping.js @@ -19,7 +19,9 @@ coreAssets = JSON.parse(JSON.stringify(coreAssets)) 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 caseSensitiveChains = [...ibcChains, 'solana', 'tezos', 'ton', 'algorand', 'aptos', 'near', 'bitcoin', 'waves', 'tron', 'litecoin', 'polkadot', 'ripple', 'elrond', 'cardano', 'stacks', 'sui', 'ergo', 'mvc', 'renec', 'doge', 'stellar', 'massa', + 'eclipse', +] const transformTokens = { // Sample Code @@ -40,38 +42,31 @@ const fixBalancesTokens = { ozone: { // '0x83048f0bf34feed8ced419455a4320a735a92e9d': { coingeckoId: "ozonechain", decimals: 18 }, // was mapped to wrong chain }, - xdc: { - '0x8f9920283470f52128bf11b0c14e798be704fd15': { coingeckoId: 'comtech-gold', decimals: 18 }, - }, - - real: { - '0x4644066f535ead0cde82d209df78d94572fcbf14': { coingeckoId: 're-al', decimals: 18 }, - '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143': { coingeckoId: 'arcana-2', decimals: 18 }, - '0xce1581d7b4ba40176f0e219b2cac30088ad50c7a': { coingeckoId: 'pearl', decimals: 18 }, + apechain: { + '0x0000000000000000000000000000000000000000': { coingeckoId: "apecoin", decimals: 18 }, }, - airdao: { - [ADDRESSES.null]: { coingeckoId: 'amber', decimals: 18 }, - [ADDRESSES.airdao.USDC]: { coingeckoId: 'usd-coin', decimals: 18 }, + etlk: { + '0x796ea11fa2dd751ed01b53c372ffdb4aaa8f00f9': { coingeckoId: "usd-coin", decimals: 6 }, + '0x2c03058c8afc06713be23e58d2febc8337dbfe6a': { coingeckoId: "tether", decimals: 6 }, + '0xfc24f770f94edbca6d6f885e12d4317320bcb401': { coingeckoId: "weth", decimals: 18 }, }, - lukso: { - [ADDRESSES.null]: { coingeckoId: "lukso-token-2", decimals: 18 }, - [ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 }, + shido: { + '0x8cbaffd9b658997e7bf87e98febf6ea6917166f7': { coingeckoId: "shido-2", decimals: 18 } // WSHIDO }, - bfc: { - '0x6906Ccda405926FC3f04240187dd4fAd5DF6d555': { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, }, + ethereum: { + '0x777B2913b1BB171A83cA3cdf79CB40523Ac76fDb': { coingeckoId: "ignition-fbtc", decimals: 8 }, }, - pulse: { - '0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 }, + arbitrum: { + '0xbbeb34F9d50e0BABe1bd03Fd4120296354510529': { coingeckoId: "ignition-fbtc", decimals: 8 }, }, - saakuru: { - '0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 }, - '0x739222D8A9179fE05129C77a8fa354049c088CaA': { coingeckoId: 'usd-coin', decimals: 6 } + bsc: { + '0x2B25f4F134a56054b2b6388C2750F1eA3877e02b': { coingeckoId: "ignition-fbtc", decimals: 8 }, }, - bouncebit: { - '0x8f083eafcbba2e126ad9757639c3a1e25a061a08': { coingeckoId: 'bouncebit-btc', decimals: 18 } + mantle: { + '0x93C6afA1882ea5E5bF403cA8fcb5aF87409EeCd0': { coingeckoId: "ignition-fbtc", decimals: 8 }, }, - ripple: { - "XRP": { coingeckoId: "ripple", decimals: 6 }, + bob: { + '0xd681C5574b7F4E387B608ed9AF5F5Fc88662b37c': { coingeckoId: "ignition-fbtc", decimals: 8 }, }, base: { "0xe4b20925D9E9a62F1E492e15a81dC0de62804dd4": { coingeckoId: "bitcoin-usd-btcfi", decimals: 18 } @@ -80,7 +75,7 @@ const fixBalancesTokens = { ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) }) -function getUniqueAddresses(addresses, chain) { +function getUniqueAddresses(addresses, chain = 'ethereum') { const toLowerCase = !caseSensitiveChains.includes(chain) const set = new Set() addresses.forEach(i => set.add(toLowerCase ? i.toLowerCase() : i)) diff --git a/projects/helper/tomb.js b/projects/helper/tomb.js index ba6f784d496d..7473d16b0cdd 100644 --- a/projects/helper/tomb.js +++ b/projects/helper/tomb.js @@ -1,5 +1,5 @@ const { staking, stakingUnknownPricedLP } = require("./staking"); -const { pool2Exports } = require("./pool2"); +const { pool2 } = require("./pool2"); const sdk = require("@defillama/sdk"); const token0Abi = 'address:token0' const token1Abi = 'address:token1' @@ -12,7 +12,7 @@ function tombTvl(token, share, rewardPool, masonry, pool2LPs, chain = "ethereum" [chain]: { tvl: async () => ({}), staking: staking(masonry, share, chain), - pool2: pool2Exports(rewardPool, pool2LPs, chain, transform) + pool2: pool2(rewardPool, pool2LPs, chain, transform) } } } diff --git a/projects/helper/uniswapV3.js b/projects/helper/uniswapV3.js index 726e43b289ff..64f03f3199ec 100644 --- a/projects/helper/uniswapV3.js +++ b/projects/helper/uniswapV3.js @@ -44,12 +44,14 @@ function uniV3Export(config) { return exports } -function uniV3GraphExport({ blacklistedTokens = [], graphURL, name, minTVLUSD = 10,}) { +function uniV3GraphExport({ blacklistedTokens = [], graphURL, name, minTVLUSD = 0,}) { return async (api) => { const size = 1000 // let lastId = '' // let pools + const minTvlFilter = minTVLUSD ? `totalValueLockedUSD_gt: ${minTVLUSD}` : '' + const graphQueryPagedWithBlock = ` query poolQuery($lastId: String, $block: Int) { pools(block: { number: $block } first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: ${minTVLUSD}}) { @@ -61,7 +63,7 @@ function uniV3GraphExport({ blacklistedTokens = [], graphURL, name, minTVLUSD = ` const graphQueryPagedWithoutBlock = ` query poolQuery($lastId: String) { - pools(first:${size} where: {id_gt: $lastId totalValueLockedUSD_gt: ${minTVLUSD}}) { + pools(first:${size} where: {id_gt: $lastId ${minTvlFilter}}) { id token0 { id } token1 { id } diff --git a/projects/helper/unwrapLPs.js b/projects/helper/unwrapLPs.js index dc96b0908fc2..e8eb59a1cd9f 100644 --- a/projects/helper/unwrapLPs.js +++ b/projects/helper/unwrapLPs.js @@ -4,7 +4,6 @@ const BigNumber = require("bignumber.js"); const token0 = 'address:token0' const symbol = 'string:symbol' const { getPoolTokens, getPoolId, bPool, getCurrentTokens, } = require('./abis/balancer.json') -const { requery } = require('./requery') const { getChainTransform, getFixBalances } = require('./portedTokens') const { getUniqueAddresses, normalizeAddress } = require('./tokenMapping') const creamAbi = require('./abis/cream.json') @@ -103,53 +102,6 @@ async function addTokensAndLPs(balances, tokens, amounts, block, chain = "ethere await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) } -/* -tokens [ - [token, isLP] - eg ["0xaaa", true] -] -*/ -async function sumTokensAndLPsSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map(t => owners.map(o => ({ - target: t[0], - params: o - }))).flat(), - abi: 'erc20:balanceOf', - block, - chain - }) - await requery(balanceOfTokens, chain, block, 'erc20:balanceOf') - const isLP = {} - tokens.forEach(token => { - isLP[token[0].toLowerCase()] = token[1] - }) - const lpBalances = [] - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target.toLowerCase() - const balance = result.output - if (isLP[token] === true) { - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - if (lpBalances.length > 0) { - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) - } -} - -async function sumTokensSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress) { - if (transformAddress === undefined) { - transformAddress = addr => `${chain}:${addr}` - } - await sumTokensAndLPsSharedOwners(balances, tokens.map(t => [t, false]), owners, block, chain, transformAddress) -} - async function sumLPWithOnlyOneToken(balances, lpToken, owner, listedToken, block, chain = "ethereum", transformAddress = id => id) { const [balanceOfLP, balanceOfTokenListedInLP, lpSupply] = await Promise.all([ sdk.api.erc20.balanceOf({ @@ -239,7 +191,7 @@ async function unwrapUniswapV3NFT({ balances, owner, owners, nftAddress, block, let positionIds = uniV3ExtraConfig.positionIds if (!positionIds) { - if (!owners && owner) owners = [owner] + if (!owners?.length && owner) owners = [owner] owners = getUniqueAddresses(owners, chain) const { output: lengths } = await sdk.api.abi.multiCall({ block, chain, abi: wildCreditABI.balanceOf, @@ -261,7 +213,6 @@ async function unwrapUniswapV3NFT({ balances, owner, owners, nftAddress, block, block, chain, abi: wildCreditABI.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) @@ -350,7 +301,7 @@ async function unwrapSlipstreamNFT({ balances, owner, positionIds = [], nftAddre if (!factories[factoryKey]) factories[factoryKey] = sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain }) let factory = (await factories[factoryKey]).output - if (!positionIds) { + if (!positionIds || positionIds.length === 0) { 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, @@ -514,7 +465,9 @@ async function sumBalancerLps(balances, tokensAndOwners, block, chain, transform } const nullAddress = ADDRESSES.null -const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'] +const gasTokens = [nullAddress, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', '0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', + '0x000000000000000000000000000000000000800a', // zksync era gas token +] /* tokensAndOwners [ [token, owner] - eg ["0xaaa", "0xbbb"] @@ -589,40 +542,6 @@ async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereu return balances } -async function unwrapCreamTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress = id => id) { - const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.exchangeRateStored, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.underlying, - block, - chain - }) - ]) - balanceOfTokens.output.forEach((balanceCall, i) => { - const underlying = underlyingTokens.output[i].output - const balance = BigNumber(balanceCall.output).times(exchangeRates.output[i].output).div(1e18).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance) - }) -} const cvx_abi = { cvxBRP_pid: "uint256:pid", @@ -666,15 +585,6 @@ async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, cha return balances } -async function genericUnwrapCvxDeposit({ api, owner, token, balances }) { - if (!balances) balances = await api.getBalances() - const [bal, cToken] = await api.batchCall([ - { target: token, params: owner, abi: 'erc20:balanceOf' }, - { target: token, abi: 'address:curveToken' }, - ]) - sdk.util.sumSingleBalance(balances, cToken, bal, api.chain) - return balances -} async function genericUnwrapCvxRewardPool({ api, owner, pool, balances }) { if (!balances) balances = await api.getBalances() @@ -867,6 +777,8 @@ async function sumTokens2({ }, resolveICHIVault = false, solidlyVeNfts = [], + convexRewardPools = [], + auraPools = [], }) { if (api) { chain = api.chain ?? chain @@ -906,8 +818,8 @@ async function sumTokens2({ if (resolveNFTs) { const coreNftTokens = whitelistedNFTs[api.chain] ?? [] - const nftTokens = await Promise.all(owners.map(i => covalentGetTokens(i, api))) - nftTokens.forEach((tokens, i) => ownerTokens.push([[tokens, coreNftTokens].flat(), owners[i]])) + const nftTokens = await Promise.all(owners.map(i => covalentGetTokens(i, api, { onlyWhitelisted: false}))) + nftTokens.forEach((nfts, i) => ownerTokens.push([[nfts, tokens, coreNftTokens].flat(), owners[i]])) } if (solidlyVeNfts.length) { @@ -918,6 +830,24 @@ async function sumTokens2({ .flat() ) } + + if (convexRewardPools.length) { + const convexRewardPoolsTokensAndOwners = convexRewardPools.map(poolAddress => { + return owners.map(owner => [poolAddress, owner]) + }).flat(); + await unwrapConvexRewardPools({ api, tokensAndOwners: convexRewardPoolsTokensAndOwners }); + } + + if (auraPools.length) { + const tokensAndOwners = auraPools.map(poolAddress => { + return owners.map(owner => [poolAddress, owner]) + }).flat(); + Promise.all( + tokensAndOwners.map(([pool, owner]) => { + return unwrapAuraPool({ api, auraPool: pool, owner }) + }) + ); + } if (ownerTokens.length) { ownerTokens.map(([tokens, owner]) => { @@ -1002,7 +932,25 @@ function sumTokensExport({ balances, tokensAndOwners, tokensAndOwners2, tokens, 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 }) { +async function unwrapAuraPool({ api, chain, block, auraPool, owner, balances, isBPool = false, isV2 = true }) { + if (!api) { + api = new sdk.ChainApi({ chain, block, }) + } + balances = balances || api.getBalances() + const [lpSupply, lpTokens, balancerToken] = await api.batchCall([ + { abi: 'erc20:totalSupply', target: auraPool }, + { abi: 'erc20:balanceOf', target: auraPool, params: owner }, + { abi: 'address:asset', target: auraPool }, + ]); + if (+lpTokens === 0) return balances; + const [vault] = await api.batchCall([ + { abi: 'address:getVault', target: balancerToken }, + ]); + const auraRatio = lpTokens / lpSupply; + return unwrapBalancerToken({ api, chain, block, balancerToken, owner: vault, balances, isBPool, isV2, extraRatio: auraRatio }) +} + +async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, balances, isBPool = false, isV2 = true, extraRatio = 1 }) { if (!api) { api = new sdk.ChainApi({ chain, block, }) } @@ -1012,14 +960,17 @@ async function unwrapBalancerToken({ api, chain, block, balancerToken, owner, ba { abi: 'erc20:balanceOf', target: balancerToken, params: owner }, ]) if (+lpTokens === 0) return balances - const ratio = lpTokens / lpSupply + const ratio = lpTokens / lpSupply * extraRatio if (isV2) { const poolId = await api.call({ abi: 'function getPoolId() view returns (bytes32)', target: balancerToken }) const vault = await api.call({ abi: 'address:getVault', target: balancerToken }) const [tokens, bals] = await api.call({ abi: 'function getPoolTokens(bytes32) view returns (address[], uint256[],uint256)', target: vault, params: poolId }) tokens.forEach((v, i) => { - sdk.util.sumSingleBalance(balances, v, bals[i] * ratio, api.chain) + // handle balancer composable metapools case where the pool contains the LP itself, we can skip it for our calc + if(v.toLowerCase() !== balancerToken.toLowerCase()) { + sdk.util.sumSingleBalance(balances, v, bals[i] * ratio, api.chain) + } }) } else { let underlyingPool = balancerToken @@ -1132,13 +1083,10 @@ module.exports = { unwrapUniswapLPs, unwrapSlipstreamNFT, addTokensAndLPs, - sumTokensAndLPsSharedOwners, sumTokensAndLPs, sumTokens, sumBalancerLps, - unwrapCreamTokens, sumLPWithOnlyOneToken, - sumTokensSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown, genericUnwrapCvx, unwrapLPsAuto, @@ -1147,7 +1095,6 @@ module.exports = { sumTokens2, unwrapBalancerToken, sumTokensExport, - genericUnwrapCvxDeposit, genericUnwrapCvxRewardPool, genericUnwrapCvxFraxFarm, genericUnwrapCvxPrismaPool, diff --git a/projects/helper/utils.js b/projects/helper/utils.js index 153da04c3d86..86edb86dbb7c 100644 --- a/projects/helper/utils.js +++ b/projects/helper/utils.js @@ -68,7 +68,8 @@ function isLP(symbol, token, chain) { if (chain === 'moonriver' && ['HBLP'].includes(symbol)) return true if (chain === 'ethpow' && ['LFG_LP'].includes(symbol)) return true if (chain === 'aurora' && ['wLP'].includes(symbol)) return true - if (chain === 'oasis' && ['LPT'].includes(symbol)) return true + if (chain === 'oasis' && ['LPT', 'GLP'].includes(symbol)) return true + if (chain === 'iotex' && ['MIMO-LP'].includes(symbol)) return true if (chain === 'base' && ['RCKT-V2'].includes(symbol)) return true if (chain === 'wan' && ['WSLP'].includes(symbol)) return true if (chain === 'telos' && ['zLP'].includes(symbol)) return true @@ -99,6 +100,7 @@ function isLP(symbol, token, chain) { if (chain === 'btn' && /(XLT)$/.test(symbol)) return true //xenwave LP if (['fantom', 'nova',].includes(chain) && ['NLT'].includes(symbol)) return true if (chain === 'ethereumclassic' && symbol === 'ETCMC-V2') return true + if (chain === 'shibarium' && ['SSLP', 'ChewyLP'].includes(symbol)) return true let label if (symbol.startsWith('ZLK-LP') || symbol.includes('DMM-LP') || (chain === 'avax' && 'DLP' === symbol) || symbol === 'fChe-LP') @@ -255,7 +257,8 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' labelMapping[label] = token return } - if (!token.startsWith('0x') || chain === 'starknet') return; + const blacklistedChains = ['starknet', 'solana', 'sui', 'aptos', 'fuel'] + if (!token.startsWith('0x') || blacklistedChains.includes(chain)) return; if (!label.startsWith(chain)) ethTokens.push(token) else @@ -303,12 +306,16 @@ async function debugBalances({ balances = {}, chain, log = false, tableLabel = ' }) sdk.log('Balance table for [%s] %s', chain, tableLabel) - const filtered = logObj.filter(i => { + let filtered = logObj.filter(i => { const symbol = i.symbol?.toLowerCase() ?? '' if (/\.(com|net|org|xyz|site|io)/.test(symbol)) return false if (/claim|access|airdrop/.test(symbol)) return false return true }) + if (filtered.length > 300) { + sdk.log('Too many unknowns to display #'+filtered.length, 'displaying first 100') + filtered = filtered.slice(0, 100) + } if (filtered.length) console.table(filtered) } diff --git a/projects/helper/utils/solana/layout.js b/projects/helper/utils/solana/layout.js index b7523fd96eba..42e27acd27d9 100644 --- a/projects/helper/utils/solana/layout.js +++ b/projects/helper/utils/solana/layout.js @@ -5,7 +5,7 @@ const { parsePhoenix } = require('./layouts/phoenix-dex') const { RAYDIUM_LIQUIDITY_STATE_LAYOUT_CLMM, RAYDIUM_STABLE_STATE_LAYOUT_V1, } = require('./layouts/raydium-layout') 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 { ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, PARLAY_LAYOUT_PARTIAL, HH_PARI_LAYOUT_PARTIAL, } = require('./layouts/mixed-layout'); 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"); @@ -63,6 +63,8 @@ const customDecoders = { sanctumValidatorLsts: parseSanctumLstStateList, stakePoolPartial: defaultParseLayout(STAKE_POOL_PARTIAL), stakePool: defaultParseLayout(STAKE_POOL_LAYOUT), + hhParlay: defaultParseLayout(PARLAY_LAYOUT_PARTIAL), + hhPari: defaultParseLayout(HH_PARI_LAYOUT_PARTIAL), } function decodeAccount(layout, accountInfo) { diff --git a/projects/helper/utils/solana/layouts/mixed-layout.js b/projects/helper/utils/solana/layouts/mixed-layout.js index 77e760154d53..53962af37c5f 100644 --- a/projects/helper/utils/solana/layouts/mixed-layout.js +++ b/projects/helper/utils/solana/layouts/mixed-layout.js @@ -250,7 +250,27 @@ const ESOLStakePoolLayout = BufferLayout.struct([ u32("maxValidatorYieldPerEpochNumerator") ]); + +const PARLAY_LAYOUT_PARTIAL = BufferLayout.struct([ + publicKey('mint'), + u32("entryCount"), + u64('entryCost'), +]); + +const HH_PARI_LAYOUT_PARTIAL = BufferLayout.struct([ + publicKey('mint'), + u64("closeTimestamp"), + u64("resolveTimestamp"), + u64("outcomeTimestamp"), + u16("creatorFee"), + u16("platformFee"), + u8('state'), + u8('outcome'), + BufferLayout.seq(u64(), u8().span, 'amounts'), +]); + module.exports = { - ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, + ReserveLayout, ReserveLayoutLarix, MintLayout, AccountLayout, TokenSwapLayout, ESOLStakePoolLayout, + PARLAY_LAYOUT_PARTIAL, HH_PARI_LAYOUT_PARTIAL, } diff --git a/projects/helper/whitelistedExportKeys.json b/projects/helper/whitelistedExportKeys.json index 8aa6014b2003..e6d5646e6c8f 100644 --- a/projects/helper/whitelistedExportKeys.json +++ b/projects/helper/whitelistedExportKeys.json @@ -9,12 +9,9 @@ "borrowed", "start", "doublecounted", - "treasury", "hallmarks", - "incentivized", - "offers", + "isHeavyProtocol", "deadFrom", - "broken", "ownTokens", "vesting" ] \ No newline at end of file diff --git a/projects/hermes-finance/index.js b/projects/hermes-finance/index.js index a44ac2602ac6..9cb0bd2a3af1 100644 --- a/projects/hermes-finance/index.js +++ b/projects/hermes-finance/index.js @@ -1,5 +1,5 @@ const { staking } = require('../helper/staking'); -const { pool2Exports } = require('../helper/pool2'); +const { pool2 } = require('../helper/pool2'); const hermes = "0xB15f02F9Da8CD1f99E9dd375F21dc96D25ddd82C"; const hermesShares = "0xfa4b6db72a650601e7bd50a0a9f537c9e98311b2"; @@ -15,6 +15,6 @@ module.exports = { avax:{ tvl: async () => ({}), staking: staking(olympus, hermesShares), - pool2: pool2Exports(hShareRewardPool, pool2LPs, "avax") + pool2: pool2(hShareRewardPool, pool2LPs, "avax") } } \ No newline at end of file diff --git a/projects/hexaswap/index.js b/projects/hexaswap/index.js index 4feae8d0c75f..583e1cd8c01c 100644 --- a/projects/hexaswap/index.js +++ b/projects/hexaswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, telos: { tvl: getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0x7853cDd20592aaff59D6e89B59bF67499564C525', }) diff --git a/projects/hibt/index.js b/projects/hibt/index.js index f2544d5e6a4d..5c7a3a96e875 100644 --- a/projects/hibt/index.js +++ b/projects/hibt/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -7,13 +8,14 @@ const config = { ], }, bitcoin: { - owners: [ - 'bc1qpxntlx09kqvpwl7vmjw9f28yvytdqkdx8xh63w' - ] + owners: bitcoinAddressBook.hibt }, tron: { owners: [ - 'TWVCro8i15sJjmwRKfV53gPnCsgz2ThQSc' + 'TWVCro8i15sJjmwRKfV53gPnCsgz2ThQSc', + 'TGoPfFBjoZ6wFFia1NAFio21Pi9Sc8KFw5', + 'TXzjxSsfS2YDc8wktEjbUAHnETWdAgN3aF', + 'TWkAzr1bfTbm84awjbBgyThPqZPs6GbskW' ] }, } diff --git a/projects/hinkal/registryTokens.js b/projects/hinkal/registryTokens.js index 338d3f06a32e..6481f4fa5022 100644 --- a/projects/hinkal/registryTokens.js +++ b/projects/hinkal/registryTokens.js @@ -45,7 +45,7 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", "0xdf55670e27bE5cDE7228dD0A6849181891c9ebA1", "0x9D0464996170c6B9e75eED71c68B99dDEDf279e8", - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + ADDRESSES.ethereum.FXS, ADDRESSES.ethereum.cvxFXS, "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", "0xB30dA2376F63De30b42dC055C93fa474F31330A5", @@ -252,6 +252,9 @@ const ETHEREUM_REGISTRY_TOKENS = [ "0xEEda34A377dD0ca676b9511EE1324974fA8d980D", "0x0d86883faf4ffd7aeb116390af37746f45b6f378", "0x73a15fed60bf67631dc6cd7bc5b6e8da8190acf5", + "0x35d8949372d46b7a3d5a56006ae77b215fc69bc0", + "0x1f7e9321ce32af1f9ea1185fd10d31fea31ffd95", + "0x270B7748CdF8243bFe68FaCE7230ef0fCE695389", ]; const ARBITRUM_REGISTRY_TOKENS = [ @@ -263,7 +266,7 @@ const ARBITRUM_REGISTRY_TOKENS = [ ADDRESSES.optimism.DAI, ADDRESSES.arbitrum.MIM, "0x7f90122BF0700F9E7e1F688fe926940E8839F353", - "0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F", + ADDRESSES.arbitrum.FRAX, "0x11cDb42B0EB46D95f990BeDD4695A6e3fA034978", "0x64343594Ab9b56e99087BfA6F2335Db24c2d1F17", "0x641441c631e2F909700d2f41FD87F0aA6A6b4EDb", @@ -569,7 +572,7 @@ const POLYGON_REGISTRY_TOKENS = [ "0x4e3Decbb3645551B8A19f0eA1678079FCB33fB4c", ADDRESSES.polygon.WMATIC_2, "0xf8a57c1d3b9629b77b6726a042ca48990A84Fb49", - "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89", + ADDRESSES.polygon.FRAX, "0xA691D34Abf93C0A77998e53B564bEcfaf46Dae27", "0xaA91CDD7abb47F821Cf07a2d38Cc8668DEAf1bdc", "0x8343091F2499FD4b6174A46D067A920a3b851FF9", @@ -907,7 +910,7 @@ const BASE_REGISTRY_TOKENS = [ ADDRESSES.base.DAI, "0xd07379a755A8f11B57610154861D694b2A0f615a", "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22", - "0xB6fe221Fe9EeF5aBa221c348bA20A1Bf5e73624c", + ADDRESSES.base.rETH, "0x9EaF8C1E34F05a589EDa6BAfdF391Cf6Ad3CB239", "0xf6C5F01C7F3148891ad0e19DF78743D31E390D1f", "0x6e53131F68a034873b6bFA15502aF094Ef0c5854", diff --git a/projects/hliquity/index.js b/projects/hliquity/index.js new file mode 100644 index 000000000000..dc53a952b203 --- /dev/null +++ b/projects/hliquity/index.js @@ -0,0 +1,6 @@ +const { getLiquityTvl } = require("../helper/liquity"); + +module.exports = { + methodology: 'the amount of locked hbar in the HLiquity protocol', + hedera: { tvl: getLiquityTvl('0x00000000000000000000000000000000005c9f66')} +}; \ No newline at end of file diff --git a/projects/hodltree/index.js b/projects/hodltree/index.js index 5701812cb1c6..5807c16e165d 100644 --- a/projects/hodltree/index.js +++ b/projects/hodltree/index.js @@ -1,16 +1,46 @@ -const { calculateHodltreeBalancesEth, calculateHodltreeBalancesPolygon } = require("../helper/hodltree/calculateBalances"); - +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { - methodology: - `Flashloan pools: sum of all available liquidity + methodology: + `Flashloan pools: sum of all available liquidity Lend-borrow contracts: sum of tokens provided as collateral and tokens provided by lenders Elastic-Modules: sum of tokens provided by hedgers and amount of tokens to hedge `, - ethereum: { - tvl: calculateHodltreeBalancesEth - }, - polygon: { - tvl: calculateHodltreeBalancesPolygon +} + +const config = { + ethereum: { + flashloan: '0x2e5a08c26cb22109e585784c4f99363bb3e199ab', tokensAndOwners: [ + // em + ['0x28e598846febb750effc384853fbce82988eaaa2', '0x95142849d31eaa20b5b9ab746dff27ff400ce6bf'], + [ADDRESSES.ethereum.sUSD, '0xce596bf99d21e46fa91143c03d7a356682b67859'], + [ADDRESSES.ethereum.sUSD, '0xb7ead8c418f3d03bc22dd538c22600abe7209e72'], + ['0xba100000625a3754423978a60c9317c58a424e3D', '0x78E52d69fA8e0F036fFEF0BcDc4C289DB0DF63E2'], + [ADDRESSES.ethereum.USDC, '0x87B46E49681E08E3adDF8A90F6a1fb5183079033'], + [ADDRESSES.ethereum.USDC, '0xcB72e764Ab46535aAD13cbF55b1F06cB15347A95'], + + // lend-borrow + [ADDRESSES.ethereum.WETH, '0xb3e1912fa5d9d219da8c65cda407cc998849428b'], + ['0xBcca60bB61934080951369a648Fb03DF4F96263C', '0x8ac9425260b6da02db07da7980b09525ebf3b6a0'], + ['0x028171bCA77440897B824Ca71D1c56caC55b68A3', '0x45d5a790da3bfa305efca81eac652678ae3a90a6'], + ] + }, + polygon: { + flashloan: '0xCAFDa65B1031535F1766C6b1E3b5efF5520c7C0f', tokensAndOwners: [ + // lend-borrow + [ADDRESSES.polygon.WMATIC_2, '0x2F35d311fd2F0b0dA65FA268B86831279FB4fd98'], + ['0x1a13f4ca1d028320a707d99520abfefca3998b7f', '0xbfb5215aD157Cd6C8B22494dC54Ff4B74bA18C09'], + ['0x27f8d03b3a2196956ed754badc28d73be8830a6e', '0x0Cf91744D15684b91E6705e56f6dC820647B3067'], + ] + }, +} + +Object.keys(config).forEach(chain => { + const { flashloan, tokensAndOwners = [] } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const fTokens = await api.fetchList({ lengthAbi: 'N_TOKENS', itemAbi: 'TOKENS', target: flashloan }) + fTokens.forEach(fToken => tokensAndOwners.push([fToken, flashloan])) + await api.sumTokens({ tokensAndOwners }) } -}; - \ No newline at end of file + } +}) \ No newline at end of file diff --git a/projects/homecoin/index.js b/projects/homecoin/index.js index 87375a41a396..96479b80ab3c 100644 --- a/projects/homecoin/index.js +++ b/projects/homecoin/index.js @@ -52,9 +52,10 @@ const borrowed = async (_, ethBlock) => { module.exports = { misrepresentedTokens: true, start: HOME_START, + deadFrom: '2022-11-09', ethereum: { tvl, - borrowed, + borrowed: ()=>({}), // it's all bad debt }, methodology: "The base TVL metric counts only USDC liquidity in the protocol." + diff --git a/projects/honeyswap/index.js b/projects/honeyswap/index.js index 5d94a36f0cbd..99d67f7e8833 100644 --- a/projects/honeyswap/index.js +++ b/projects/honeyswap/index.js @@ -9,12 +9,6 @@ module.exports = { blacklist: [ '0x4f4f9b8d5b4d0dc10506e5551b0513b61fd59e75', ], - log_minTokenValue: 1e5, - log_coreAssetPrices: [ - 1/1e18, - 197/1e18, - 1824/1e18, - ] }) }, polygon: { diff --git a/projects/hope-lend/index.js b/projects/hope-lend/index.js index f40f2632f11f..3b9d5302aed7 100644 --- a/projects/hope-lend/index.js +++ b/projects/hope-lend/index.js @@ -9,6 +9,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-10-18')/1e3), 'Protocol was hacked!'], ], + deadFrom: '2023-10-18' }; delete module.exports.ethereum.borrowed \ No newline at end of file diff --git a/projects/hope-money/index.js b/projects/hope-money/index.js index 19aae3e2e074..4e7fbd7f0a38 100644 --- a/projects/hope-money/index.js +++ b/projects/hope-money/index.js @@ -1,18 +1,11 @@ const { sumTokensExport } = require('../helper/sumTokens') const ADDRESSES = require('../helper/coreAssets.json') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: 'Tokens held in coinbase custody. Reserve info taken from: https://hope.money/gomboc.html', doublecounted: true, - bitcoin: { - tvl: sumTokensExport({ owners: [ - '15PYHP5ZW29B3o19jFNKz6RyRdHCtzJj5H', - '16BLcAyJR8unm8RpQT9PGTwh5uPpZEf2ut', - '3JoCB8ifwhL4YKo9rCYMgVGbqxBqnpQpdS', - '179fgM9yyTHj4ZCTfAcGhUFiQMXuPx5xrF', - '1LaC3Xt8RZWYH1pjcvXxrWxLvXe7iR3ybe' - ]}) - }, + bitcoin: { tvl: sumTokensExport({ owners: bitcoinAddressBook.hopeMoney }) }, ethereum: { tvl: sumTokensExport({ tokensAndOwners: [ diff --git a/projects/hope-swap/index.js b/projects/hope-swap/index.js index 1c8fabe0c415..00c5071ad3b5 100644 --- a/projects/hope-swap/index.js +++ b/projects/hope-swap/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, ethereum: { - tvl: getUniTVL({ factory: '0x26F53fbADeEb777fb2A122dC703433d79241b64e', useDefaultCoreAssets: true, fetchBalances: true }), + tvl: getUniTVL({ factory: '0x26F53fbADeEb777fb2A122dC703433d79241b64e', useDefaultCoreAssets: true, }), }, }; \ No newline at end of file diff --git a/projects/hotbit/index.js b/projects/hotbit/index.js index 1d37046092c3..a8d828a135fe 100644 --- a/projects/hotbit/index.js +++ b/projects/hotbit/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bsc: { @@ -22,7 +23,7 @@ const config = { ] }, bitcoin: { - owners: ['1MiFZMJkFMhMrubjjo6f5oEhh7XgSwXWgp'] + owners: bitcoinAddressBook.hotbit }, ripple: { owners: ['rJKBidE4Av6ZaFTBcAucZXCpU7QvNXyfpT'] diff --git a/projects/houdiniswap/index.js b/projects/houdiniswap/index.js index 837ba71d33f0..2586d7e86a3a 100644 --- a/projects/houdiniswap/index.js +++ b/projects/houdiniswap/index.js @@ -1,15 +1,8 @@ -const { stakings } = require("../helper/staking") +const { staking } = require("../helper/staking") module.exports={ ethereum:{ tvl:()=>({}), - staking: stakings([ - "0x488B813ED84aB52857cA90ade050f8ca126bEda6", - "0xf9FA02cC165dBd70fF34d27b5AC9E0AE6D74D756", - "0xE42aDCB4B9F2e3E6acb70399c420Cb6D6795B09d", - "0xE3507B38342CCB9Aa03E5AF2deA6C1F54351F553", - "0xf7E1edF3E4EC64360aFB739EBD2c0F40A5CC57D3", - "0x979a7307Dd7Ba386b52F08a9A35a26807affbCC9" - ], "0x888cea2bbdd5d47a4032cf63668d7525c74af57a") + staking: staking("0x4401c51110e7d3a970Fe48AeaeE8249b181210a1","0x922D8563631B03C2c4cf817f4d18f6883AbA0109") } } \ No newline at end of file diff --git a/projects/hourglass/index.js b/projects/hourglass/index.js new file mode 100644 index 000000000000..f0ac27afab9f --- /dev/null +++ b/projects/hourglass/index.js @@ -0,0 +1,44 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +const ethereum_pitchfxs = '0x11ebe21e9d7bf541a18e1e3ac94939018ce88f0b'; + +const config = { + ethereum: { factory: '0x679619FA685a18782a86dD5850124A75E83daD8F', fromBlock: 19877998 }, + mantle: { factory: '0x624bd5ba06A856C4D5f60c8Ba29eeE1f684Ddf05', fromBlock: 65870976 }, +} + +module.exports = { + methodology: 'TVL accounts for all assets deposited into our boosted vaults. It also includes the amount of FXS time-locked and minted as pitchFXS.', +}; + + +Object.keys(config).forEach(chain => { + const { factory, fromBlock, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + if (chain === 'ethereum') + await computePitchfxsTvl(api) + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event NewMaturityCreated (uint256 deploymentIndex, address depositor, address[] receipts)', + fromBlock, + }) + + const vaults = logs.map(log => log.depositor) + const tokens = await api.multiCall({ abi: 'address:getUnderlying', calls: vaults }) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults] }) + } + } +}) + +const computePitchfxsTvl = async (api) => { + const balance = await api.call({ + target: ethereum_pitchfxs, + params: [], + abi: 'erc20:totalSupply', + }); + + api.addToken(ADDRESSES.ethereum.FXS, balance); +} diff --git a/projects/huckleberry-lending/index.js b/projects/huckleberry-lending/index.js index 0316dbf678f7..3d8df54037e4 100644 --- a/projects/huckleberry-lending/index.js +++ b/projects/huckleberry-lending/index.js @@ -1,18 +1,7 @@ -const { usdCompoundExports } = require('../helper/compound') -const sdk = require('@defillama/sdk') - +const { compoundExports2 } = require('../helper/compound') const unitroller = '0xcffef313b69d83cb9ba35d9c0f882b027b846ddc' -const lendingMarket = usdCompoundExports(unitroller, "moonriver", "0x455D0c83623215095849AbCF7Cc046f78E3EDAe0") - - - module.exports = { - methodology: "Liquidity on DEX and supplied and borrowed amounts found using the comptroller address(0xcffef313b69d83cb9ba35d9c0f882b027b846ddc)", - misrepresentedTokens: true, - moonriver: { - tvl: lendingMarket.tvl, - borrowed: lendingMarket.borrowed - } + moonriver: compoundExports2({ comptroller: unitroller, cether: '0x455d0c83623215095849abcf7cc046f78e3edae0' }), } \ No newline at end of file diff --git a/projects/hundredfinance/index.js b/projects/hundredfinance/index.js index 54510aaca7d1..09e4115b0481 100644 --- a/projects/hundredfinance/index.js +++ b/projects/hundredfinance/index.js @@ -1,76 +1,20 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {compoundExports, compoundExportsWithAsyncTransform} = require('../helper/compound') -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); +const { compoundExports2 } = require('../helper/compound') const comptroller = "0x0f390559f258eb8591c8e31cf0905e97cf36ace2" -const usdcEth = ADDRESSES.ethereum.USDC -const usdcFantom = ADDRESSES.fantom.USDC -const usdcArbitrum = ADDRESSES.arbitrum.USDC - -const daiEth = ADDRESSES.ethereum.DAI -const daiFantom = ADDRESSES.fantom.DAI - -const usdtEth = ADDRESSES.ethereum.USDT -const usdtArbitrum = ADDRESSES.arbitrum.USDT - -const usdcFantomBAMM = "0xEDC7905a491fF335685e2F2F1552541705138A3D" -const daiFantomBAMM = "0x6d62d6Af9b82CDfA3A7d16601DDbCF8970634d22" -const usdcArbitrumBAMM = "0x04208f296039f482810B550ae0d68c3E1A5EB719" -const usdtArbitrumBAMM = "0x24099000AE45558Ce4D049ad46DDaaf71429b168" - - -const bamms = { - "fantom" : [ - {"bamm" : usdcFantomBAMM, "underlying" : usdcFantom, "underlyingEth" : usdcEth }, - { "bamm" : daiFantomBAMM, "underlying" : daiFantom, "underlyingEth" : daiEth } - ], - "arbitrum" : [ - {"bamm" : usdcArbitrumBAMM, "underlying" : usdcArbitrum, "underlyingEth" : usdcEth }, - { "bamm" : usdtArbitrumBAMM, "underlying" : usdtArbitrum, "underlyingEth" : usdtEth } - ] -} - -async function bammTvlFunc(chain, retTvl, unixTimestamp, ethBlock, chainBlocks) { - const block = chainBlocks[chain] - - const balances = await retTvl(unixTimestamp, ethBlock, chainBlocks) - - for(let bamm of bamms[chain]) { - const bammBalance = ( - await sdk.api.erc20.balanceOf({ - target: bamm["underlying"], - owner: bamm["bamm"], - block: block, - chain: chain, - }) - ).output; - - const ethToken = bamm["underlyingEth"] - sdk.util.sumSingleBalance(balances, ethToken, bammBalance) - } - - return balances -} - -function tvlWithBamm() { - const chain = arguments[1] - const retVal = compoundExportsWithAsyncTransform(...arguments) - return {tvl: async(...args)=> bammTvlFunc(chain, retVal.tvl, ...args), borrowed: retVal.borrowed} -} - -module.exports={ +module.exports = { hallmarks: [ [1647302400, "Reentrancy attack"], [1681541920, "Protocol hacked (oc Optimism)"], ], - ethereum:compoundExports(comptroller, "ethereum", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", ADDRESSES.ethereum.WETH), - arbitrum:tvlWithBamm(comptroller, "arbitrum", "0x8e15a22853A0A60a0FBB0d875055A8E66cff0235", ADDRESSES.arbitrum.WETH), - fantom:tvlWithBamm(comptroller, "fantom", "0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D", ADDRESSES.fantom.WFTM), - harmony:compoundExportsWithAsyncTransform(comptroller, "harmony", "0xbb93C7F378B9b531216f9aD7b5748be189A55807", ADDRESSES.harmony.WONE), - moonriver:compoundExportsWithAsyncTransform("0x7d166777bd19a916c2edf5f1fc1ec138b37e7391", "moonriver", "0xd6fcBCcfC375c2C61d7eE2952B329DcEbA2D4e10", "0x98878b06940ae243284ca214f92bb71a2b032b8a"), - xdai:compoundExportsWithAsyncTransform("0x6bb6ebCf3aC808E26545d59EA60F27A202cE8586", "xdai", "0x6eDCB931168C9F7C20144f201537c0243b19dCA4", ADDRESSES.xdai.WXDAI), - polygon:compoundExportsWithAsyncTransform("0xedba32185baf7fef9a26ca567bc4a6cbe426e499", "polygon", "0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31", ADDRESSES.polygon.WMATIC_2), - optimism:compoundExportsWithAsyncTransform("0x5a5755E1916F547D04eF43176d4cbe0de4503d5d", "optimism", "0x1A61A72F5Cf5e857f15ee502210b81f8B3a66263", ADDRESSES.tombchain.FTM), + ethereum: compoundExports2({ comptroller, cether: '0xfcd8570ad81e6c77b8d252bebeba62ed980bd64d' }), + arbitrum: compoundExports2({ comptroller, cether: '0x8e15a22853a0a60a0fbb0d875055a8e66cff0235' }), + fantom: compoundExports2({ comptroller, cether: '0xfCD8570AD81e6c77b8D252bEbEBA62ed980BD64D' }), + harmony: compoundExports2({ comptroller, cether: '0xbb93c7f378b9b531216f9ad7b5748be189a55807' }), + moonriver: compoundExports2({ comptroller: "0x7d166777bd19a916c2edf5f1fc1ec138b37e7391", cether: '0xd6fcbccfc375c2c61d7ee2952b329dceba2d4e10' }), + xdai: compoundExports2({ comptroller: "0x6bb6ebCf3aC808E26545d59EA60F27A202cE8586", cether: '0x6edcb931168c9f7c20144f201537c0243b19dca4' }), + polygon: compoundExports2({ comptroller: "0xedba32185baf7fef9a26ca567bc4a6cbe426e499", cether: '0xEbd7f3349AbA8bB15b897e03D6c1a4Ba95B55e31' }), + optimism: compoundExports2({ comptroller: "0x5a5755E1916F547D04eF43176d4cbe0de4503d5d", cether: '0x1A61A72F5Cf5e857f15ee502210b81f8B3a66263' }), } + +module.exports.optimism.borrowed = () => ({}) diff --git a/projects/huobi/index.js b/projects/huobi/index.js index 5c5744cc79d9..5f92f4e4d5a6 100644 --- a/projects/huobi/index.js +++ b/projects/huobi/index.js @@ -1,200 +1,235 @@ -const { cexExports } = require('../helper/cex') -const { mergeExports, sliceIntoChunks, sleep } = require('../helper/utils') -const { post, get } = require('../helper/http') -const sdk = require('@defillama/sdk') +const { cexExports } = require("../helper/cex"); +const { mergeExports, sliceIntoChunks, sleep } = require("../helper/utils"); +const { post, get } = require("../helper/http"); +const sdk = require("@defillama/sdk"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + const config = { bitcoin: { - owners: [ - '12qTdZHx6f77aQ74CPCZGSY47VaRwYjVD8', - '143gLvWYUojXaWZRrxquRKpVNTkhmr415B', - '1KVpuCfhftkzJ67ZUegaMuaYey7qni7pPj', - //These 3 addresses has 48,555 #Bitcoin. This is only less than 3% of the total high value assets we have, including btc, usd, stablecoins, T-bills.. According to Justin Sun https://twitter.com/justinsuntron/status/1590311559242612743 - '14XKsv8tT6tt8P8mfDQZgNF8wtN5erNu5D', - '1LXzGrDQqKqVBqxfGDUyhC6rTRBN5s8Sbj', - '1HckjUpRGcrrRAtFaaCAUaGjsPx9oYmLaZ', // add on 08/08/2023 (we defillama) - '1L15W6b9vkxV81xW5HDtmMBycrdiettHEL', // add on 08/08/2023 (we defillama) - '14o5ywJJmLPJe8egNo7a5fSdtEgarkus33', // add on 08/08/2023 (we defillama) - '1BuiWj9wPbQwNY97xU53LRPhzqNQccSquM', // add on 08/08/2023 (we defillama) - '1AQLXAB6aXSVbRMjbhSBudLf1kcsbWSEjg', // add on 23/02/2024 (we defillama) - '1ENWYLQZJRAZGtwBmoWrhmTtDUtJ5LseVj' - ], + owners: bitcoinAddressBook.huobi, }, ethereum: { owners: [ - '0xa929022c9107643515f5c777ce9a910f0d1e490c', - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0xcac725bef4f114f728cbcfd744a731c2a463c3fc', - '0x0511509A39377F1C6c78DB4330FBfcC16D8A602f', - '0x1205E4f0D2f02262E667fd72f95a68913b4F7462', - '0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E', - '0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B', - '0xc589b275e60dda57ad7e117c6dd837ab524a5666', - '0x6b2286fc3a9265bab3f064808022aca54de4b6ce', // add on 08/08/2023 (we defillama) - '0x3d655889d197125fb90dcb72e4a287a8410ed1b9', // add on 08/08/2023 (we defillama) - '0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a', // add on 08/08/2023 (we defillama) - '0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e', // add on 08/08/2023 (we defillama) - '0xeee28d484628d41a82d01e21d12e2e78d69920da', // add on 08/08/2023 (we defillama) - '0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b', // add on 08/08/2023 (we defillama) - '0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e', // add on 08/08/2023 (we defillama) - '0x1062a747393198f70f71ec65a582423dba7e5ab3', // add on 08/08/2023 (we defillama) - '0xab5c66752a9e8167967685f1450532fb96d5d24f', // add on 08/08/2023 (we defillama) - '0xdb0e89a9b003a28a4055ef772e345e8089987bfd', // add on 08/08/2023 (we defillama) - '0xfdb16996831753d5331ff813c29a93c76834a0ad', // add on 08/08/2023 (we defillama) - '0x46705dfff24256421a05d056c29e81bdc09723b8', // add on 08/08/2023 (we defillama) - '0xfd54078badd5653571726c3370afb127351a6f26', // add on 08/08/2023 (we defillama) - '0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33', // add on 08/08/2023 (we defillama) - '0x18916e1a2933cb349145a280473a5de8eb6630cb', // add on 08/08/2023 (we defillama) - '0xfa4b5be3f2f84f56703c42eb22142744e95a2c58', // add on 08/08/2023 (we defillama) - '0x0a98fb70939162725ae66e626fe4b52cff62c2e5', // add on 08/08/2023 (we defillama) - '0x918800e018a0eeea672740f88a60091c7d327a79', // add on 08/08/2023 (we defillama) - '0xadb2b42f6bd96f5c65920b9ac88619dce4166f94', // add on 08/08/2023 (we defillama) - '0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65', // add on 08/08/2023 (we defillama) - '0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c', // add on 08/08/2023 (we defillama) - '0xf881bcb3705926cea9c598ab05a837cf41a833a9', // add on 08/08/2023 (we defillama) - '0xa03400e098f4421b34a3a44a1b4e571419517687', - '0x598273ea2cabd9f798564877851788c5e0d5b7b9', // start add on 23/02/2024 (we defillama) - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0x4fb312915b779b1339388e14b6d079741ca83128', - '0x30741289523c2e4d2a62c7d6722686d14e723851', - '0x5c985e89dde482efe97ea9f1950ad149eb73829b', - '0xe4818f8fde0c977a01da4fa467365b8bf22b071e', - '0xe93381fb4c4f14bda253907b18fad305d799241a', // end add on 23/02/2024 (we defillama) - '0x6663613FbD927cE78abBF7F5Ca7e2c3FE0d96d18', // add on 22/07/2024 + "0xa929022c9107643515f5c777ce9a910f0d1e490c", + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0xcac725bef4f114f728cbcfd744a731c2a463c3fc", + "0x0511509A39377F1C6c78DB4330FBfcC16D8A602f", + "0x1205E4f0D2f02262E667fd72f95a68913b4F7462", + "0xE4818f8fDe0C977A01DA4Fa467365B8bF22b071E", + "0x5C985E89DDe482eFE97ea9f1950aD149Eb73829B", + "0xc589b275e60dda57ad7e117c6dd837ab524a5666", + "0x6b2286fc3a9265bab3f064808022aca54de4b6ce", // add on 08/08/2023 (we defillama) + "0x3d655889d197125fb90dcb72e4a287a8410ed1b9", // add on 08/08/2023 (we defillama) + "0x2abc22eb9a09ebbe7b41737ccde147f586efeb6a", // add on 08/08/2023 (we defillama) + "0xa5d7f0f7027fa8f4d1be8042e1e43bbdec36951e", // add on 08/08/2023 (we defillama) + "0xeee28d484628d41a82d01e21d12e2e78d69920da", // add on 08/08/2023 (we defillama) + "0x6748f50f686bfbca6fe8ad62b22228b87f31ff2b", // add on 08/08/2023 (we defillama) + "0x34189c75cbb13bdb4f5953cda6c3045cfca84a9e", // add on 08/08/2023 (we defillama) + "0x1062a747393198f70f71ec65a582423dba7e5ab3", // add on 08/08/2023 (we defillama) + "0xab5c66752a9e8167967685f1450532fb96d5d24f", // add on 08/08/2023 (we defillama) + "0xdb0e89a9b003a28a4055ef772e345e8089987bfd", // add on 08/08/2023 (we defillama) + "0xfdb16996831753d5331ff813c29a93c76834a0ad", // add on 08/08/2023 (we defillama) + "0x46705dfff24256421a05d056c29e81bdc09723b8", // add on 08/08/2023 (we defillama) + "0xfd54078badd5653571726c3370afb127351a6f26", // add on 08/08/2023 (we defillama) + "0x07ef60deca209ea0f3f3f08c1ad21a6db5ef9d33", // add on 08/08/2023 (we defillama) + "0x18916e1a2933cb349145a280473a5de8eb6630cb", // add on 08/08/2023 (we defillama) + "0xfa4b5be3f2f84f56703c42eb22142744e95a2c58", // add on 08/08/2023 (we defillama) + "0x0a98fb70939162725ae66e626fe4b52cff62c2e5", // add on 08/08/2023 (we defillama) + "0x918800e018a0eeea672740f88a60091c7d327a79", // add on 08/08/2023 (we defillama) + "0xadb2b42f6bd96f5c65920b9ac88619dce4166f94", // add on 08/08/2023 (we defillama) + "0x42dc966b7ecc3c6cc73e7bc04862859d5bddce65", // add on 08/08/2023 (we defillama) + "0xe8d8a02601f54acb6fb69537be1f1d7cc76ccd8c", // add on 08/08/2023 (we defillama) + "0xf881bcb3705926cea9c598ab05a837cf41a833a9", // add on 08/08/2023 (we defillama) + "0xa03400e098f4421b34a3a44a1b4e571419517687", + "0x598273ea2cabd9f798564877851788c5e0d5b7b9", // start add on 23/02/2024 (we defillama) + "0x4fb312915b779b1339388e14b6d079741ca83128", + "0x30741289523c2e4d2a62c7d6722686d14e723851", + "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) - ] + "0x0316eb71485b0ab14103307bf65a021042c6d380", // HBTC , we already track their backed BTC (1btc wallet on the list) + ], }, polygon: { owners: [ - '0xd70250731a72c33bfb93016e3d1f0ca160df7e42', - '0x9a7ffd7f6c42ab805e0edf16c25101964c6326b6', // add on 23/02/2024 - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0x2177c77a1f3c4900de7668662706633db4688726', - ] + "0xd70250731a72c33bfb93016e3d1f0ca160df7e42", + "0x9a7ffd7f6c42ab805e0edf16c25101964c6326b6", // add on 23/02/2024 + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0x2177c77a1f3c4900de7668662706633db4688726", + ], }, litecoin: { owners: [ - 'MNky8PL58UjL14mcZm3ESvEkYQkzMY9kfu', - 'LYmdXiH1u6UN2bFetfTGnNuFgEG64FWVLU', - 'MGZv8pEkrsmpa2YAXRVXTtdCPBMnnR28fY', - 'MCRXTQ5uuBh6Qt8t4LuqZNvruZ5SmWXjrY' - ] + "MNky8PL58UjL14mcZm3ESvEkYQkzMY9kfu", + "LYmdXiH1u6UN2bFetfTGnNuFgEG64FWVLU", + "MGZv8pEkrsmpa2YAXRVXTtdCPBMnnR28fY", + "MCRXTQ5uuBh6Qt8t4LuqZNvruZ5SmWXjrY", + ], }, solana: { owners: [ - '88xTWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQZ21XMAZ', - 'BY4StcU9Y2BpgH8quZzorg31EGE4L1rjomN8FNsCBEcx', // add on 23/02/2024 - '8NBEbxLknGv5aRYefFrW2qFXoDZyi9fSHJNiJRvEcMBE', - '5bJcc9eb2XE7mqcET2xDuAdMGuXWybb4YPmAHLjKLhQG', - ] + "88xTWZMeKfiTgbfEmPLdsUCQcZinwUfk25EBQZ21XMAZ", + "BY4StcU9Y2BpgH8quZzorg31EGE4L1rjomN8FNsCBEcx", // add on 23/02/2024 + "8NBEbxLknGv5aRYefFrW2qFXoDZyi9fSHJNiJRvEcMBE", + "5bJcc9eb2XE7mqcET2xDuAdMGuXWybb4YPmAHLjKLhQG", + ], }, tron: { owners: [ - 'TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub', - 'TKgD8Qnx9Zw3DNvG6o83PkufnMbtEXis4T', - 'TCQQjfccKdMi4CnPAzmZW5TALH4HbwceVb', - 'TNaRAoLUyYEV2uF7GUrzSjRQTU8v5ZJ5VR', - 'TDToUxX8sH4z6moQpK3ZLAN24eupu2ivA4', - 'TCiRCBNFrL6bFKWL94yWQi5hNMGNp1Nu27', - 'TGn1uvntAVntT1pG8o7qoKkbViiYfeg6Gj', - 'TAuUCiH4JVNBZmDnEDZkXEUXDARdGpXTmX', - 'TF2fmSbg5HAD34KPUH7WtWCxxvgXHohzYM', - 'THZovMcKoZaV9zzFTWteQYd2f3NEvnzxAM', - 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', - 'TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM', - 'TUJGLHo3rq4EAUY1LHRhNkHPX8qmrv9WFs', // add on 08/08/2023 (we defillama) - 'TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd', // add on 08/08/2023 (we defillama) - 'TU1ZA8T2g8PvLK8BfM7N94xpmSSpyfxZoK', - 'TFTWNgDBkQ5wQoP8RXpRznnHvAVV8x5jLu', // add on 23/02/2024 - 'TK86Qm97uM848dMk8G7xNbJB7zG1uW3h1n', - 'TT5iK8oqGEyRKJAnRwrLSZ4fM5y77F2LNT', - ] + "TYh6mgoMNZTCsgpYHBz7gttEfrQmDMABub", + "TKgD8Qnx9Zw3DNvG6o83PkufnMbtEXis4T", + "TCQQjfccKdMi4CnPAzmZW5TALH4HbwceVb", + "TNaRAoLUyYEV2uF7GUrzSjRQTU8v5ZJ5VR", + "TDToUxX8sH4z6moQpK3ZLAN24eupu2ivA4", + "TCiRCBNFrL6bFKWL94yWQi5hNMGNp1Nu27", + "TGn1uvntAVntT1pG8o7qoKkbViiYfeg6Gj", + "TAuUCiH4JVNBZmDnEDZkXEUXDARdGpXTmX", + "TF2fmSbg5HAD34KPUH7WtWCxxvgXHohzYM", + "THZovMcKoZaV9zzFTWteQYd2f3NEvnzxAM", + // 'TZ1SsapyhKNWaVLca6P2qgVzkHTdk6nkXa', // this wallet is backing USDD acording here https://prnt.sc/lvIQUtCNbk2X. For that reason, it should not included as HTX. + "TDvf1dSBhR7dEskJs17HxGHheJrjXhiFyM", + "TUJGLHo3rq4EAUY1LHRhNkHPX8qmrv9WFs", // add on 08/08/2023 (we defillama) + "TRSXRWudzfzY4jH7AaMowdMNUXDkHisbcd", // add on 08/08/2023 (we defillama) + "TU1ZA8T2g8PvLK8BfM7N94xpmSSpyfxZoK", + "TFTWNgDBkQ5wQoP8RXpRznnHvAVV8x5jLu", // add on 23/02/2024 + "TK86Qm97uM848dMk8G7xNbJB7zG1uW3h1n", + "TT5iK8oqGEyRKJAnRwrLSZ4fM5y77F2LNT", + ], }, algorand: { - owners: ['J4AEINCSSLDA7LNBNWM4ZXFCTLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM'] + owners: ["J4AEINCSSLDA7LNBNWM4ZXFCTLTOZT5LG3F5BLMFPJYGFWVCMU37EZI2AM"], }, avax: { owners: [ - '0xe195b82df6a797551eb1acd506e892531824af27', - '0xa77ff0e1c52f58363a53282624c7baa5fa91687d', //start add on 23/02/2024 - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0x8b6a3587676719a4fecbb24b503a3634c44a44d5', - ] + "0xe195b82df6a797551eb1acd506e892531824af27", + "0xa77ff0e1c52f58363a53282624c7baa5fa91687d", //start add on 23/02/2024 + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0x8b6a3587676719a4fecbb24b503a3634c44a44d5", + ], }, eos: { - owners: ['vuniyuoxoeub'], + owners: ["vuniyuoxoeub"], }, ripple: { owners: [ - 'rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT', - 'raC4udvEeeni6aLPHbz9RKjHTQiWxKPfom', - 'ra4haepf6fehiCfVvB33j1D7vmv7JJD8M5', // add on 23/02/2024 - 'rNPuS242i9ufMPEMusnjYPxyyu4STqSDGq', - 'rPzT7GA6vWU3PvYSXBpdP5fQPnzwVLwL24', + "rKUDvXFJMFu65LqPTH3Yfpii4rbKT9bSQT", + "raC4udvEeeni6aLPHbz9RKjHTQiWxKPfom", + "ra4haepf6fehiCfVvB33j1D7vmv7JJD8M5", // add on 23/02/2024 + "rNPuS242i9ufMPEMusnjYPxyyu4STqSDGq", + "rPzT7GA6vWU3PvYSXBpdP5fQPnzwVLwL24", ], }, arbitrum: { owners: [ - '0xf2dbc42875e7764edbd89732a15214a9a0deb085', - '0xce7ec11a5f306c6b896526149db1a86c7d1531e2', // add on 23/02/2024 - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0x82d015d74670d8645b56c3f453398a3e799ee582', - ], + "0xf2dbc42875e7764edbd89732a15214a9a0deb085", + "0xce7ec11a5f306c6b896526149db1a86c7d1531e2", // add on 23/02/2024 + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0x82d015d74670d8645b56c3f453398a3e799ee582", + ], }, optimism: { owners: [ - '0x9ef21be1c270aa1c3c3d750f458442397fbffcb6', - '0xe0b7a39fef902c21bad124b144c62e7f85f5f5fa', // add on 23/02/2024 - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0xd3cc0c7d40366a061397274eae7c387d840e6ff8' - ], + "0x9ef21be1c270aa1c3c3d750f458442397fbffcb6", + "0xe0b7a39fef902c21bad124b144c62e7f85f5f5fa", // add on 23/02/2024 + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0xd3cc0c7d40366a061397274eae7c387d840e6ff8", + ], }, bsc: { owners: [ - '0xdd3cb5c974601bc3974d908ea4a86020f9999e0c', // add on 23/02/2024 - '0x18709e89bd403f470088abdacebe86cc60dda12e', - '0xafdfd157d9361e621e476036fee62f688450692b', - ], + "0xdd3cb5c974601bc3974d908ea4a86020f9999e0c", // add on 23/02/2024 + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0xafdfd157d9361e621e476036fee62f688450692b", + ], }, -} + starknet: { + owners: [ + "0x03fd14213a96e9d90563ebe1b224f357c6481a755ee6f046c8ce9acd9b8654a7", + ], + }, + doge: { + owners: [ + "DRRU8L7fF4k9w7SF3Z6ei8onPCsh9hjGX1", + "9ztZpRN3v9xv5JhAT7MTtmy4DfyMEAG8YU", + "DLzCvKskasu4Adj3XgbyNitKBukBSa5JPP", + ], + }, + cardano: { + owners: [ + "addr1q8wk8rw6xeqzerhahlhweuukkxme0fjsy4xqsqze3m4r8lxavwxa5djq9j80m0lwaneedvdhj7n9qf2vpqq9nrh2x07qfmr8sf", + "addr1q9n8v7e76pt4mmvxqprc4k7nk5nqz4x2flplfr0azq9dtnz5wckfyaph0sj98f7nc5g98q9dv2v8ece9jm8w30upgfvq4zhpjy", + "DdzFFzCqrhsuQV5ohP1EBh9d4UjmmWDb2Vui2s2SACSBDeEW74kHhp3zj9hvLFDb9mK7hRr7fbctu1UYatPaF1omXiXPwf12bn7DQvbT" + ], + }, + core: { + owners: [ + "0x18709e89bd403f470088abdacebe86cc60dda12e", + "0x6635dbb3d78671be495a6d876940752a0c4e7743", + "0x27387a41fd7c6cf86b4c96a54a4a1d8bd0b926bf" + ], + }, + sui: { + owners: [ + "0d9948b61478ec1609b4c00cd0162131109e7fd60d7d2ebb539cb414f3ec7b9d", + "0x1f7b27844f2c4a0262b2c481f7ab956d10ace524c5a7b06c3742cfb8701db714", + ], + }, + ton: { + owners: [ + "EQBf6sUcCkUrRCMzmpOW22P3BOD4XgL_solOp3M4n6Vb8_1c", + "EQC2bRkktc-ZATV_VK8B1dmN3KXZRKiblMiyvFW_aUzNTwxS", + "EQA9Q1P4Wtm5orpfWgV_DTbqoeRUx7h8LCqdx38x5RwIkuS3", + "EQCFr3jo0DXpIBF82mVGFc3zcdRkSAtinhENPFMQ2FqzYqDB" + ], + }, +}; module.exports = mergeExports([ cexExports(config), - { ethereum: { tvl: stakingTVL, } } -]) -module.exports.methodology = 'We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT.' - + { ethereum: { tvl: stakingTVL } }, +]); +module.exports.methodology = + "We added the wallets from here https://github.com/huobiapi/Tool-Node.js-VerifyAddress/blob/main/snapshot/huobi_por_20230701.csv . We are not tracking 3 wallets, 2 on Heco Chain, 1 on BTTC chain. We also count stUSDT."; +module.exports.hallmarks = [[1723066836, "remove usdd collateral"]]; async function stakingTVL() { - const withdrawalAddress = '0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d' - let fetchedValidators = 2400 - let size = 200 - let ethBalance = (await sdk.api2.eth.getBalance({ target: '0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d'})).output/1e18 + const withdrawalAddress = "0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d"; + let fetchedValidators = 2400; + let size = 200; + let ethBalance = + ( + await sdk.api2.eth.getBalance({ + target: "0x08DeB6278D671E2a1aDc7b00839b402B9cF3375d", + }) + ).output / 1e18; do { - const validators = (await get(`https://beaconcha.in/api/v1/validator/withdrawalCredentials/${withdrawalAddress}?limit=${size}&offset=${fetchedValidators}`)).data.map(i => i.publickey) - fetchedValidators += validators.length - await addValidatorBalance(validators) - await sleep(10000) - } while (fetchedValidators % size === 0) + const validators = ( + await get( + `https://beaconcha.in/api/v1/validator/withdrawalCredentials/${withdrawalAddress}?limit=${size}&offset=${fetchedValidators}` + ) + ).data.map((i) => i.publickey); + fetchedValidators += validators.length; + await addValidatorBalance(validators); + await sleep(10000); + } while (fetchedValidators % size === 0); return { - ethereum: ethBalance - } + ethereum: ethBalance, + }; async function addValidatorBalance(validators) { if (validators.length > 100) { - const chunks = sliceIntoChunks(validators, 100) - for (const chunk of chunks) await addValidatorBalance(chunk) + const chunks = sliceIntoChunks(validators, 100); + for (const chunk of chunks) await addValidatorBalance(chunk); return; } - const { data } = await post('https://beaconcha.in/api/v1/validator', { - indicesOrPubkey: validators.join(',') - }) + const { data } = await post("https://beaconcha.in/api/v1/validator", { + indicesOrPubkey: validators.join(","), + }); - - data.forEach((i) => ethBalance += i.balance/1e9) + data.forEach((i) => (ethBalance += i.balance / 1e9)); } -} \ No newline at end of file +} diff --git a/projects/hydro-farm/index.js b/projects/hydro-farm/index.js new file mode 100644 index 000000000000..8260dc4d3e91 --- /dev/null +++ b/projects/hydro-farm/index.js @@ -0,0 +1,94 @@ +const { queryContract, endPoints, } = require("../helper/chain/cosmos"); +const { get } = require("../helper/http"); +const { injective: { mitoVaultQuery } } = require("../helper/chain/rpcProxy") + +// Contract +const lrpManager = "inj1rv7ztpa8nkywc89a05eys52fzgezlnzjq3grkz" +const vaultMaster = "inj1vcqkkvqs7prqu70dpddfj7kqeqfdz5gg662qs3" + +async function getAllRegisteredVaults(api) { + let startAfterSubaccount + let results = [] + let loop = true + + while (loop) { + const { registered_vaults } = await queryContract({ + chain: api.chain, + contract: vaultMaster, + data: { + get_registered_vaults: { + start_after_subaccount: startAfterSubaccount, + limit: 30, + } + } + }) + + if (registered_vaults.length === 0) { + loop = false + return results + } + + results.push(...registered_vaults) + const lastOne = results[results.length - 1] + startAfterSubaccount = lastOne.vault.master_subaccount_id + } +} + +async function getMitoLpPrice(api, lrp, vaults) { + const { vault_subaccount_id } = await queryContract({ chain: api.chain, contract: lrp.yield_proxy_address, data: { config: {} } }) + const { vault: { address } } = vaults.find((vault) => vault.vault.master_subaccount_id === vault_subaccount_id) + const res = await mitoVaultQuery({ address }) + return res.lpTokenPrice +} + +async function tvl(api) { + const { lrps } = await queryContract({ chain: api.chain, contract: lrpManager, data: { lrps: { limit: 100 } } }) + const vaults = await getAllRegisteredVaults(api) + + for (const lrp of lrps) { + const { total_supply: lrpTotalSupply } = await queryContract({ chain: api.chain, contract: lrp.lrp_address, data: { token_info: {} } }) + if (+lrpTotalSupply === 0) continue; + + const { contract_info } = await get(`${endPoints[api.chain]}/cosmwasm/wasm/v1/contract/${lrp.yield_proxy_address}`, undefined, api.chain) + const isDojo = contract_info.label.includes("dojo") + const isMito = contract_info.label.includes("mito") + + if (isDojo) { + const asset_infos = lrp.bond_tokens.map((i) => { + if (i.native) return { native_token: { denom: i.native } } + console.error({ lrp, i, contract_info, lrpTotalSupply }) + throw new Error("Unknown asset_infos") + }) + + // get LP contract address + const { contract_addr } = await queryContract({ + chain: api.chain, contract: 'inj1pc2vxcmnyzawnwkf03n2ggvt997avtuwagqngk', data: { + pair: { asset_infos } + } + }) + const { assets, total_share } = await queryContract({ chain: api.chain, contract: contract_addr, data: { pool: {} } }) + const ratio = lrpTotalSupply / total_share + assets.forEach((asset) => { + api.add(getToken(asset), asset.amount * ratio) + }) + + } else if (isMito) { + const lpPrice = await getMitoLpPrice(api, lrp, vaults) + api.addUSDValue(lpPrice * lrpTotalSupply) + } else { + console.error("Unknown lrp type", { lrp, contract_info }) + } + } +} + +module.exports = { + methodology: "Liquidity on hydro-protocol", + misrepresentedTokens: true, + injective: { + tvl, + }, +}; + +function getToken(asset) { + return asset.info.native_token?.denom ?? asset.info.token?.contract_addr +} \ No newline at end of file diff --git a/projects/hyperdrive/index.js b/projects/hyperdrive/index.js new file mode 100644 index 000000000000..adffd93fc4e8 --- /dev/null +++ b/projects/hyperdrive/index.js @@ -0,0 +1,60 @@ +const ethers = require("ethers") +const { nullAddress } = require('../helper/unwrapLPs') + +const FUTURE_REGISTRY_ADDRESS = "0x6668310631Ad5a5ac92dC9549353a5BaaE16C666" +const GET_POOL_CONFIG_ABI = "function getPoolConfig() view returns (tuple(address baseToken, address vaultSharesToken, address linkerFactory, bytes32 linkerCodeHash, uint256 initialVaultSharePrice, uint256 minimumShareReserves, uint256 minimumTransactionAmount, uint256 circuitBreakerDelta, uint256 positionDuration, uint256 checkpointDuration, uint256 timeStretch, address governance, address feeCollector, address sweepCollector, address checkpointRewarder, tuple(uint256 curve, uint256 flat, uint256 governanceLP, uint256 governanceZombie) fees))"; +const POSITION_ABI = "function position(bytes32 id, address user) view returns (tuple(uint256 supplyShares, uint128 borrowShares, uint128 collateral))"; + +const config = { + ethereum: { registry: '0xbe082293b646cb619a638d29e8eff7cf2f46aa3a', }, + xdai: { registry: '0x666fa9ef9bca174a042c4c306b23ba8ee0c59666', }, + base: {}, + linea: {}, +} + +Object.keys(config).forEach(chain => module.exports[chain] = { tvl }) + +async function tvl(api) { + const { registry = FUTURE_REGISTRY_ADDRESS, } = config[api.chain] + const instances = await api.fetchList({ lengthAbi: 'getNumberOfInstances', itemAbi: 'getInstanceAtIndex', target: registry }) + const vaultNames = await api.multiCall({ abi: 'string:name', calls: instances }) + const vaultConfig = await api.multiCall({ abi: GET_POOL_CONFIG_ABI, calls: instances }) + const vaults = vaultNames.map((name, i) => ({ name, config: vaultConfig[i], address: instances[i] })) + const morphoVaults = [] + const morphoVaultInfos = [] + const tokensAndOwners = [] + + for (const vault of vaults) { + if (vault.name.includes("Morpho")) { + morphoVaults.push(vault.address) + morphoVaultInfos.push(vault) + } else if (vault.config.vaultSharesToken !== nullAddress) { + tokensAndOwners.push([vault.config.vaultSharesToken, vault.address]) + } else { + tokensAndOwners.push([vault.config.baseToken, vault.address]) + } + } + + const mVaults = await api.multiCall({ abi: 'address:vault', calls: morphoVaults}) + const mCollaterals = await api.multiCall({ abi: 'address:collateralToken', calls: morphoVaults}) + const mOracles = await api.multiCall({ abi: 'address:oracle', calls: morphoVaults}) + const mIrms = await api.multiCall({ abi: 'address:irm', calls: morphoVaults}) + const mLltvs = await api.multiCall({ abi: 'uint256:lltv', calls: morphoVaults}) + + const morphoMarketIds = morphoVaultInfos.map((vault, i) => { + const abiCoder = ethers.AbiCoder.defaultAbiCoder(); + const packedIds = abiCoder.encode( + ['address', 'address', 'address', 'address', 'uint256'], + [vault.config.baseToken, mCollaterals[i], mOracles[i], mIrms[i], mLltvs[i]] + ); + return ethers.keccak256(packedIds); + }) + const positionCalls = morphoVaults.map((vault, i) => ({ target: mVaults[i], abi: POSITION_ABI, params: [morphoMarketIds[i], vault], })) + const positions = await api.multiCall({ calls: positionCalls, abi: POSITION_ABI }) + positions.forEach((position, i) => { + api.add(morphoVaultInfos[i].config.baseToken, position.supplyShares / 1e6) + api.add(mCollaterals[i], position.borrowShares * -1 / 1e6) + }) + + return api.sumTokens({ tokensAndOwners }) +} diff --git a/projects/iTrustfinance/index.js b/projects/iTrustfinance/index.js index 3b82c128a949..b66dd9fd195d 100644 --- a/projects/iTrustfinance/index.js +++ b/projects/iTrustfinance/index.js @@ -1,7 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const vaults = [ // sNXM (Nexus Mutual Strategy Vault) @@ -31,29 +28,10 @@ const erc20Tokens = [ ]; /*** Vaults and staking TVL Portions ***/ -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - for (const vault of vaults) { - const supply = ( - await sdk.api.abi.call({ - abi: abi.totalSupply, - target: vault, - ethBlock, - }) - ).output; - - sdk.util.sumSingleBalance(balances, NXM, supply); - } - - await sumTokensAndLPsSharedOwners( - balances, - erc20Tokens.map(token => [token, false]), - vaults, - chainBlocks["ethereum"] - ); - - return balances; +const ethTvl = async (api) => { + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: vaults}) + api.add(NXM, supplies) + return api.sumTokens({ owners: vaults, tokens: erc20Tokens}) }; module.exports = { diff --git a/projects/ibtc/index.js b/projects/ibtc/index.js new file mode 100644 index 000000000000..24fcdef49a22 --- /dev/null +++ b/projects/ibtc/index.js @@ -0,0 +1,13 @@ +const ibtcContract = "0x8154Aaf094c2f03Ad550B6890E1d4264B5DdaD9A"; + +async function tvl(api) { + // 1iBTC=1XBTC=1BTC(exsat)=1BTC + const ibtcTotalSupply = await api.call({ target: ibtcContract, abi: "uint256:totalSupply" }) + api.addCGToken('bitcoin', ibtcTotalSupply / 1e18) +} + +module.exports = { + xsat: { + tvl + }, +} diff --git a/projects/icecreamswap/index.js b/projects/icecreamswap/index.js index e660e4e15883..738a9baeedcb 100644 --- a/projects/icecreamswap/index.js +++ b/projects/icecreamswap/index.js @@ -3,6 +3,8 @@ const { getUniTVL, } = require('../helper/unknownTokens') const config = { shimmer_evm: '0x24cb308a4e2F3a4352F513681Bd0c31a0bd3BA31', bob: '0x7b2a5C88AB9367147F6ac384F857CbaDF5aA70a7', + lightlink_phoenix: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d', + taiko: '0xC87De04e2EC1F4282dFF2933A2D58199f688fC3d' } const chains = [...Object.keys(config), 'base', 'telos', 'core', 'dogechain', 'fuse', 'xdc', 'bitgert', 'scroll', 'neon_evm', 'blast' ] diff --git a/projects/iceswap/index.js b/projects/iceswap/index.js index eb2acf7e1dbb..26fcdd3422e8 100644 --- a/projects/iceswap/index.js +++ b/projects/iceswap/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require("../helper/unknownTokens"); const FACTORY = "0x79b8F15a3bEEcd5014B748499Ec89692665ea368"; -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, diff --git a/projects/ichifarm/index.js b/projects/ichifarm/index.js index 982a5bf1f65c..119f8af69126 100644 --- a/projects/ichifarm/index.js +++ b/projects/ichifarm/index.js @@ -79,6 +79,11 @@ const config = { { factory: '0x8a76c26E0089111989C14EF56b9733aa38B94148', fromBlock: 20999423, isAlgebra: false, }, // zkSync Era ] }, + /* europa: { + vaultConfigs: [ + { factory: '0x1B0ef045830466171D617dD0F1142aD699A4Cd63', fromBlock: 5607229, isAlgebra: false, }, // Sushi + ] + }, */ evmos: { vaultConfigs: [ { factory: '0x7c6389714719c68caac8ae06bae6e878b3605f6d', fromBlock: 19029984, isAlgebra: false, }, // Forge @@ -90,16 +95,26 @@ const config = { { factory: '0x89FFdaa18b296d9F0CF02fBD88e5c633FEFA5f34', fromBlock: 79156621, isAlgebra: true, }, // Spiritswap ] }, - // hedera: { - // vaultConfigs: [ - // { factory: '0xb62399d23d1c81f08ea445a42d7f15cc12090a71', fromBlock: 59010832, isAlgebra: false, }, // Saucerswap - // ] - // }, - // kava: { - // vaultConfigs: [ - // { factory: '0x2d2c72C4dC71AA32D64e5142e336741131A73fc0', fromBlock: 8864638, isAlgebra: false, }, // Kinetix - // ] - // }, + flare: { + vaultConfigs: [ + { factory: '0x85a4dd4ed356A7976a8302b1b690202d58583c55', fromBlock: 30879155, isAlgebra: false, }, // SparkDex + ] + }, + fuse: { + vaultConfigs: [ + { factory: '0xfBf38920cCbCFF7268Ad714ae5F9Fad6dF607065', fromBlock: 30026180, isAlgebra: false, }, // Voltage + ] + }, + /* hedera: { + vaultConfigs: [ + { factory: '0xb62399d23d1c81f08ea445a42d7f15cc12090a71', fromBlock: 59010832, isAlgebra: false, }, // Saucerswap + ] + }, */ + kava: { + vaultConfigs: [ + { factory: '0x2d2c72C4dC71AA32D64e5142e336741131A73fc0', fromBlock: 8864638, isAlgebra: false, }, // Kinetix + ] + }, linea: { vaultConfigs: [ { factory: '0xb0e7871d53BE1b1d746bBfD9511e2eF3cD70a6E7', fromBlock: 4722347, isAlgebra: false, }, // Linehub @@ -114,6 +129,11 @@ const config = { { factory: '0xbBB97d634460DACCA0d41E249510Bb741ef46ad3', fromBlock: 39366721, isAlgebra: false, }, // Cleo ] }, + mode: { + vaultConfigs: [ + { factory: '0x9FAb4bdD4E05f5C023CCC85D2071b49791D7418F', fromBlock: 12395812, isAlgebra: true, }, // Kim + ] + }, op_bnb: { vaultConfigs: [ { factory: '0xADDA3A15EA71c223a82Af86d4578EF2B076035F1', fromBlock: 13911597, isAlgebra: true, }, // Thena @@ -133,6 +153,27 @@ const config = { { factory: '0x1721cB3ff3cAF70a79bDE9d771B27646ed8115b1', fromBlock: 11102475, isAlgebra: true, }, // QuickSwap ] }, + real: { + vaultConfigs: [ + { factory: '0x860F3881aCBbF05D48a324C5b8ca9004D31A146C', fromBlock: 599247, isAlgebra: false, }, // Pearl + ] + }, + rsk: { + vaultConfigs: [ + { factory: '0x8cCd02E769e6A668a447Bd15e134C31bEccd8182', fromBlock: 6753128, isAlgebra: false, }, // Uniswap + ] + }, + scroll: { + vaultConfigs: [ + { factory: '0xb42D5956cDe4386B65C087CfCD16910aB6114F15', fromBlock: 5264782, isAlgebra: false, }, // Metavault + { factory: '0x9FAb4bdD4E05f5C023CCC85D2071b49791D7418F', fromBlock: 4728729, isAlgebra: false, }, // Uniswap + ] + }, + taiko: { + vaultConfigs: [ + { factory: '0x9FAb4bdD4E05f5C023CCC85D2071b49791D7418F', fromBlock: 11578, isAlgebra: true, }, // Henjin + ] + }, } Object.keys(config).forEach(chain => { @@ -179,8 +220,9 @@ Object.keys(config).forEach(chain => { onlyArgs: true, fromBlock, }) - const vaultBalances = await api.multiCall({ abi: abi.getTotalAmounts, calls: logs.map(l => l.ichiVault) }) + const vaultBalances = await api.multiCall({ abi: abi.getTotalAmounts, calls: logs.map(l => l.ichiVault), permitFailure: true }) vaultBalances.forEach((b, i) => { + if (!b) return const { tokenA, tokenB } = logs[i] if (!blacklistedTokens.includes(tokenA.toLowerCase())) api.add(tokenA, b.total0) if (!blacklistedTokens.includes(tokenB.toLowerCase())) api.add(tokenB, b.total1) diff --git a/projects/icpswap/index.js b/projects/icpswap/index.js index e0cfff7225b3..291c1d488ac9 100644 --- a/projects/icpswap/index.js +++ b/projects/icpswap/index.js @@ -1,28 +1,12 @@ const { get } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances') -const { PromisePool } = require('@supercharge/promise-pool') module.exports = { misrepresentedTokens: true, icp: { tvl }, } -async function tvl() { - let tvl = 0 - let pairs = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pairs') - if (typeof pairs === 'string') pairs = JSON.parse(pairs.replace('},]', '}]')) - - const { errors } = await PromisePool.withConcurrency(15) - .for(pairs) - .process(async ({ pool_id }) => { - const res = await get(`https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/pool_tvl?poolId=${pool_id}&limit=1`) - if (res.length > 0) - tvl += +res[0].tvlUSD - }) - - if (errors && errors.length) - throw errors[0] - - return toUSDTBalances(tvl) +async function tvl(api) { + let { tvlUSD } = await get('https://uvevg-iyaaa-aaaak-ac27q-cai.raw.ic0.app/overview') + api.addCGToken('tether', Math.round(tvlUSD)) } diff --git a/projects/idex-v4/index.js b/projects/idex-v4/index.js new file mode 100644 index 000000000000..d515e069e26b --- /dev/null +++ b/projects/idex-v4/index.js @@ -0,0 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + idex: { + tvl: sumTokensExport({ owner: '0xF0b08bd86f8479a96B78CfACeb619cfFeCc5FBb5', tokens: [ADDRESSES.rari.USDC_e]}), + } +} \ No newline at end of file diff --git a/projects/idle/index.js b/projects/idle/index.js index 6cd4367607f8..e15ae60c793e 100644 --- a/projects/idle/index.js +++ b/projects/idle/index.js @@ -41,8 +41,7 @@ const contracts = { // "0xd0DbcD556cA22d3f3c142e9a3220053FD7a247BC", // "0x1f5A97fB665e295303D2F7215bA2160cc5313c8E", // "0x8E0A8A5c1e5B3ac0670Ea5a613bB15724D51Fc37", // Instadapp stETH - "0x9e0c5ee5e4B187Cf18B23745FCF2b6aE66a9B52f", // Amphor wstETH - "0x1EB1b47D0d8BCD9D761f52D26FCD90bBa225344C" // Ethena USDe + "0xf6223C567F21E33e859ED7A045773526E9E3c2D5" // Fasanara Yield vault ] }, polygon: { diff --git a/projects/iguana-v2/index.js b/projects/iguana-v2/index.js new file mode 100644 index 000000000000..15546e8e6d4a --- /dev/null +++ b/projects/iguana-v2/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'etlk': '0x3eebf549D2d8839E387B63796327eE2C8f64A0C4' +}) \ No newline at end of file diff --git a/projects/iguana-v3/index.js b/projects/iguana-v3/index.js new file mode 100644 index 000000000000..7c5a9ab7d891 --- /dev/null +++ b/projects/iguana-v3/index.js @@ -0,0 +1,4 @@ +const { uniV3GraphExport } = require("../helper/uniswapV3"); + + +module.exports.etlk = { tvl: uniV3GraphExport({ name: 'iguana-etlk', graphURL: 'https://api.studio.thegraph.com/query/86688/exchange-v3-etherlink/version/latest' }) } \ No newline at end of file diff --git a/projects/imbtc.js b/projects/imbtc.js index e83d4b92af20..57fffe932e45 100644 --- a/projects/imbtc.js +++ b/projects/imbtc.js @@ -1,13 +1,15 @@ - -const sdk = require('@defillama/sdk') - -async function tvl(ts, block) { - return { - 'bitcoin': (await sdk.api.erc20.totalSupply({ target: '0x3212b29E33587A00FB1C83346f5dBFA69A458923', block })).output / 1e8 - } -} +const { sumTokens } = require('./helper/chain/bitcoin') +const { imbtc } = require('./helper/bitcoin-book/index.js') module.exports = { - ethereum: { tvl }, - methodology: `TVL for imBTC consists of the BTC deposits in custody that were used to mint imBTC` + ethereum: { tvl: () => ({}) }, + bitcoin: { + tvl: () => sumTokens({ + owners: imbtc, + }) + }, + methodology: `TVL for imBTC consists of the BTC deposits in custody that were used to mint imBTC`, + hallmarks: [ + [Math.floor(new Date('2024-01-31') / 1e3), 'Project ceases operation'], + ], } diff --git a/projects/imf-money/index.js b/projects/imf-money/index.js index 486c45d8afed..3a1aa03f603f 100644 --- a/projects/imf-money/index.js +++ b/projects/imf-money/index.js @@ -1,10 +1,11 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const PEPE_TOKEN_CONTRACT = '0x6982508145454Ce325dDbE47a25d4ec3d2311933'; +const MOG_TOKEN_CONTRACT = '0xaaee1a9723aadb7afa2810263653a34ba2c21c7a'; 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}), + tvl: sumTokensExport({ owner: LOCKED_MONEY_CONTRACT, tokens: [PEPE_TOKEN_CONTRACT,MOG_TOKEN_CONTRACT]}), } }; diff --git a/projects/impermax/impermaxHelper.js b/projects/impermax/impermaxHelper.js index 0817f51d849b..b748b736bfbe 100644 --- a/projects/impermax/impermaxHelper.js +++ b/projects/impermax/impermaxHelper.js @@ -92,6 +92,7 @@ function impermaxHelper(exportsObj, config, blacklistedPools) { async function getUVTokens(rawPools, underlyings, uSymbols, api) { var impermaxSymbol; + var stableImpermaxSymbol; switch (api.chain) { case 'ethereum': impermaxSymbol = 'UNI-V2' @@ -107,9 +108,11 @@ function impermaxHelper(exportsObj, config, blacklistedPools) { case 'scroll': case 'base': case 'mantle': + case 'optimism': default: impermaxSymbol = 'STKD-UNI-V2' - return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol) + stableImpermaxSymbol = 'STKD-STBL' + return underlyings.filter((_, i) => uSymbols[i] === impermaxSymbol || uSymbols[i] === stableImpermaxSymbol) } } diff --git a/projects/impermax/index.js b/projects/impermax/index.js index 27efed1a61a1..1d78ec640be2 100644 --- a/projects/impermax/index.js +++ b/projects/impermax/index.js @@ -49,7 +49,7 @@ const config = { '0x9b4ae930255CB8695a9F525dA414F80C4C7a945B', ] }, - scroll: { + scroll: { factories: [ '0x02Ff7B4d96EeBF8c9B34Fae0418E591e11da3099', '0xFBD17F3AA7d6506601D2bF7e15a6C96081296a01', // scroll stablefactory @@ -66,8 +66,18 @@ const config = { factories: [ '0x3047523D5ed0df1545B1C440BdAaB095f1f3cf5C' ] + }, + optimism: { + factories: [ + '0xa058Ba91958cD30D44c7B0Cf58A369876Fb70B05' + ] + }, + real: { + factories: [ + '0x3b1f3a48a70e372144307a4b126a5cda46e169ad', + '0x2944e1544cE201ae19e6385490bBA13DaA5f44e4' + ] } - } const blacklistedPools = { @@ -79,14 +89,29 @@ const blacklistedPools = { '0xdf5096804705d135656b50b62f9ee13041253d97', // YPIE-ETH ], polygon: [ - '0x76483d4ba1177f69fa1448db58d2f1dbe0fb65fa', // IMX-WETH - '0x8ce3bf56767dd87e87487f3fae63e557b821ea32', // IMX-WETH - '0xd4f5f9643a4368324ac920414781b1c5655baed1', // IMX-WETH - '0x5f819f510ca9b1469e6a3ffe4ecd7f0c1126f8f5', // IMX-WETH - '0x23312fceadb118381c33b34343a61c7812f7a6a3', // IMX-WETH - '0x5ed3147f07708a269f744b43c489e6cf3b60aec4', // USDT-DAI - '0xb957d5a232eebd7c4c4b0a1af9f2043430304e65', // USDC-rUSD - '0x87B94444d0f2c1e4610A2De8504D5d7b81898221', // QUICK-POLYDOGE + // QuickSwap + "0x5ed3147F07708A269f744B43c489e6Cf3B60aEC4", //DAI-USDT + "0x87B94444d0f2c1e4610A2De8504D5d7b81898221", //QUICK-POLYDOGE + "0x5f819f510ca9b1469e6a3ffe4ecd7f0c1126f8f5", //IMX-ETH [OLD] + "0xb957D5a232EEbD7C4c4B0A1af9F2043430304E65", //rUSD-USDC + "0x23312FCEADb118381C33B34343A61c7812f7a6a3", //IMX-ETH + "0x76483D4Ba1177F69FA1448dB58d2f1dBE0Fb65fa", //IMX-QUICK + "0xD4f5F9643A4368324aC920414781B1c5655BaeD1", //IMX-QUICK + "0x8ce3bf56767dD87E87487f3fae63e557B821Ea32", //IMX-WETH + "0x8ce3bf56767dd87e87487f3fae63e557b821ea32", //IMX-ETH + // Pearl + "0x2712fbb291d8784b7bf75e50f472968d0bd43fc1", //USDR-ETH + "0x7c91c66f7df3d23858937b0d419fd10b72bdc6d3", //USDR-BTC + "0xbde0990EeB2509931a0f73f78010F00191D746BA", //USDR-MATIC + "0x281Db118b0CB2865d9370c98AaC6e42523582AED", //USDR-PEARL + "0x822363B6dFaa8C41c1ADa904F1829143375EA6Da", //USDR-TNGBL + "0x6467FeF60a061f541967415fcBcDFb6Dc964f711", //USDR-IBEX + // Satin + "0x7166f0509bd1deedf90e42046025d929078089b4", //MATIC-LIBERA + "0x06D3AE1Cfe7D3D27B8b9f541E2d76e5f33778923", //SATIN-CASH + "0x3E626179241585235FF7B002cc4dC5439338990e", //IBEX-WETH + "0xCB091859dd1d994d513721fB9722Ca9f8839A825", //ETH-CASH + "0x7b750A5C4c0c7b36D206383353AB3c54DeE74deF", //MATIC-CASH ], arbitrum: [ '0xb7e5e74b52b9ada1042594cfd8abbdee506cc6c5', // IMX-WETH @@ -95,10 +120,30 @@ const blacklistedPools = { '0x4062f4775bc001595838fbaae38908b250ee07cf', // SWPR-ETH ], avax: [ - '0xde0037afbe805c00d3cec67093a40882880779b7', // IMX-WETH - '0xe9439f67201894c30f1c1c6b362f0e9195fb8e2c', // IMX-WETH - '0xa34862a7de51a0e1aee6d3912c3767594390586d', // IMX-WETH - '0x69c1c44e8742b66d892294a7eeb9aac51891b0eb', // USDC-UST + // Traderjoe + "0x21249FC0Ad45fB3e33C12BE0fA2B81000A290C5f", //SPELL-AVAX + "0xa34862a7de51a0e1aee6d3912c3767594390586d", //IMX-AVAX OLD + // Pangolin V1 + "0xE9439f67201894C30F1C1c6b362F0e9195FB8e2C", //IMX-AVAX + // Pangolin V2 + "0xde0037aFbE805C00d3CEc67093A40882880779b7", //IMX-AVAX + "0x69c1C44e8742b66D892294a7EEB9aac51891B0EB", //USDC-UST + "0xc6E68d77d0f4FA925A1cF2611dAB6b10900Eaf2B", //UST-AVAX + // Thorus + "0xd60709441b483453e84aD8E1C30F2e9EE116851D", //USDC-THO + // Pangolin + "0xE429Fbdc3275e29cA4c11F9c1EB4C8Cee1fCAda3", //WBTC-USDC + "0xc532a2885027677c4BE61F710F7D41941dBaD1B1", //ETH-AVAX + "0x677dCE0683e6Db30325cD97e8d04D138F34821A6", //PNG-AVAX + "0x65A9a0b25A2397e67Fe688361Bf4113cf4Fa5313", //USDT-AVAX + // Glacier + "0x96f1F13865f11E2EC0E15051415f420dAC440EC1", //WETH-USDT.e + "0x674A38dE6dC83FBde29784C9A974D38a11EbFB37", //BTC.b-AVAX + "0x4ab56108FD36F5da28b56a43b17909f745d560e4", //AVAX-USDT + "0x29327d37Ee0395a22dd419E2E81F3Bf2da066cfe", //GMX-USDC + "0x0d4E0EaFA9002957371a0cadbD3BF168d6D0741A", //fBOMB-AVAX + "0x7AEDD611c361cfc53d14953A6CbDC2d4Cd48AC94", //AVAX-WMEMO + "0x8dc6fae7fedd7a60ecbb27c17af830f5811d773e", //MMTH-BTC.b ], moonriver: [ '0x6ed3bc66dfcc5ac05daec840a75836da935fac97', // IMX-WETH @@ -109,9 +154,16 @@ const blacklistedPools = { '0x877a330af63094d88792b9ca28ac36c71673eb1c', // IMX-FTM '0xb97b6ed451480fe6466a558e9c54eaac32e6c696', // OXD-FTM ], - scroll: [], + scroll: [ + "0x94d81405985A4c34EaC4945d2b98c74258EdD07F", // tkn/chi - stakedlp + "0xE8f4895DF06a0c69A9BA87509EfdBBFBAFe86c2d", // weth/tkn - stakedlp + "0x7c80Be56a6f23A3E598822648baaFD7524fe1239", // chi/wUKRE stakedlp + "0xDD14d0c651C63e1EeA5bd8b250cf99757425D68F", // chi/usdc stakedlp + ], base: [], - mantle: [] + mantle: [], + optimism: [], + real: [] } module.exports = {} diff --git a/projects/increment-liquidStaking/index.js b/projects/increment-liquidStaking/index.js index 50b89e3ca2e1..e5c617680052 100644 --- a/projects/increment-liquidStaking/index.js +++ b/projects/increment-liquidStaking/index.js @@ -1,11 +1,12 @@ // increment liquid staking link: https://app.increment.fi/staking const { post } = require('../helper/http') -let queryLiquidStakingTVLCode = - "import DelegatorManager from 0xd6f80565193ad727\ -pub fun main(): UFix64 {\ - return DelegatorManager.getTotalValidStakingAmount()\ -}"; +let queryLiquidStakingTVLCode = ` +import DelegatorManager from 0xd6f80565193ad727 + +access(all) fun main(): UFix64 { + return DelegatorManager.getTotalValidStakingAmount() +}`; const queryCodeBase64 = Buffer.from(queryLiquidStakingTVLCode, 'utf-8').toString('base64'); diff --git a/projects/infinite/index.js b/projects/infinite/index.js new file mode 100644 index 000000000000..5b7c53d3aa01 --- /dev/null +++ b/projects/infinite/index.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const ITP_VAULT_ADDRRESS= '0x23371aEEaF8718955C93aEC726b3CAFC772B9E37' +const ITP_ON_OPTIMISM = "0x0a7B751FcDBBAA8BB988B9217ad5Fb5cfe7bf7A0"; +const VELO_PRICE_ORACLE = "0x395942C2049604a314d39F370Dfb8D87AAC89e16"; +const WETH_TOKEN_ADDRESS = ADDRESSES.optimism.WETH_1; +const VELO_TOKEN_ADDRESS = "0x3c8b650257cfb5f272f799f5e2b4e65093a11a05"; +const OP_TOKEN_ADDRESS = ADDRESSES.optimism.OP; +const USDC_OP_TOKEN_ADDRESS = ADDRESSES.optimism.USDC_CIRCLE; +const ITP_STAKED_ABI = "function getVaultInfo() view returns (uint256, uint256, uint256, uint256, uint256, uint256[], uint256)"; + +const getStakedTVL = async (api) => { + const { chain } = api + let stakedTVL = 0; + if(chain === 'optimism'){ + const fetchVeloPrice = await api.call( { + abi: "function getManyRatesWithConnectors(uint8, address[]) view returns (uint256[] memory rates)", + target: VELO_PRICE_ORACLE, + params: [ + 1, + [ + ITP_ON_OPTIMISM, + VELO_TOKEN_ADDRESS, + WETH_TOKEN_ADDRESS, + OP_TOKEN_ADDRESS, + USDC_OP_TOKEN_ADDRESS, + ], + ], + }) + const price = parseInt(fetchVeloPrice[0]) / Math.pow(10, 18) + + const stakedBalance = await api.call({ + abi: ITP_STAKED_ABI, + target: ITP_VAULT_ADDRRESS, + }); + const staked = parseInt(stakedBalance[0]) / Math.pow(10, 18) + stakedTVL = staked * price + } + api.addUSDValue(stakedTVL) +} + +module.exports = { + optimism: { + tvl: () => ({}), + staking: getStakedTVL + }, +} diff --git a/projects/infusion/index.js b/projects/infusion/index.js index 65c9f6f5d959..4b751f0c0adb 100644 --- a/projects/infusion/index.js +++ b/projects/infusion/index.js @@ -3,6 +3,6 @@ const { getUniTVL } = require('../helper/unknownTokens.js') module.exports = { misrepresentedTokens: true, base: { - tvl: getUniTVL({ factory: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f', hasStablePools: true, useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: '0x2D9A3a2bd6400eE28d770c7254cA840c82faf23f', hasStablePools: true, useDefaultCoreAssets: true, }), }, } diff --git a/projects/injective-orderbook-spot/index.js b/projects/injective-orderbook-spot/index.js new file mode 100644 index 000000000000..75da5bb07c98 --- /dev/null +++ b/projects/injective-orderbook-spot/index.js @@ -0,0 +1,8 @@ +const { getOrderBookTvl, TYPES } = require('../injective-orderbook/util') + +module.exports = { + timetravel: false, + injective: { + tvl: getOrderBookTvl(TYPES.SPOT), + } +} \ No newline at end of file diff --git a/projects/injective-orderbook/index.js b/projects/injective-orderbook/index.js index 4be227fa2a05..7a7a4304fd2e 100644 --- a/projects/injective-orderbook/index.js +++ b/projects/injective-orderbook/index.js @@ -1,6 +1,8 @@ -const { getExports } = require('../helper/heroku-api') +const { getOrderBookTvl, TYPES } = require('./util') module.exports = { timetravel: false, - ...getExports("injective-orderbook", ['injective']), -} + injective: { + tvl: getOrderBookTvl(TYPES.DERIVATIVES), + } +} \ No newline at end of file diff --git a/projects/injective-orderbook/util.js b/projects/injective-orderbook/util.js new file mode 100644 index 000000000000..8a0d89ff562c --- /dev/null +++ b/projects/injective-orderbook/util.js @@ -0,0 +1,39 @@ +const { injective: { getMarkets, getOrders } } = require('../helper/chain/rpcProxy') + +const TYPES = { + BANK: 'BANK', + SPOT: 'SPOT', + DERIVATIVES: 'DERIVATIVES', +} + +function getOrderBookTvl(typeStr) { + return async (api) => { + const markets = await getMarkets({ type: typeStr }) + const orders = await getOrders({ type: typeStr, marketIds: markets.map(i => i.marketId) }) + const marketObj = {} + for (const market of markets) + marketObj[market.marketId] = market + + for (const order of orders) marketObj[order.marketId].orderbook = order.orderbook + for (const { quoteDenom, baseDenom, orderbook: { buys, sells, } } of markets) { + for (const { price, quantity } of buys) + api.add(quoteDenom, Math.floor(quantity * price)) + + for (const { quantity } of sells) { + + if (typeStr === TYPES.SPOT) { + api.add(baseDenom, Math.floor(quantity)) + } else if (typeStr === TYPES.DERIVATIVES) { + const price = buys.length ? buys[0].price : 0 + api.add(quoteDenom, Math.floor(quantity * price)) + } + } + } + return api.getBalances() + } +} + +module.exports = { + TYPES, + getOrderBookTvl +} \ No newline at end of file diff --git a/projects/intentx.js b/projects/intentx.js index 9b82e7597d46..06c4e3000ab4 100644 --- a/projects/intentx.js +++ b/projects/intentx.js @@ -3,9 +3,9 @@ const { request, } = require("graphql-request"); const config = { - blast: { token: ADDRESSES.blast.USDB, start: 1710115200, graphUrl: "https://api.studio.thegraph.com/query/62472/intentx-analytics_082_blast/version/latest", accountSource: '0x083267D20Dbe6C2b0A83Bd0E601dC2299eD99015'}, - base: { token: ADDRESSES.base.USDbC, start: 1700006400, graphUrl: "https://api.studio.thegraph.com/query/62472/intentx-analytics_082/version/latest", accountSource: '0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86'}, - mantle: { token: ADDRESSES.mantle.USDC, start: 1712966400, graphUrl: "https://subgraph-api.mantle.xyz/subgraphs/name/mantle_intentx-analytics_082", accountSource: '0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456' }, + blast: { token: ADDRESSES.blast.USDB, start: 1710115200, graphUrl: "https://api.goldsky.com/api/public/project_cm0bho0j0ji6001t8e26s0wv8/subgraphs/intentx-blast-analytics-083/latest/gn", accountSource: '0x083267D20Dbe6C2b0A83Bd0E601dC2299eD99015'}, + base: { token: ADDRESSES.base.USDbC, start: 1700006400, graphUrl: "https://api.goldsky.com/api/public/project_cm0bho0j0ji6001t8e26s0wv8/subgraphs/intentx-base-analytics-083/latest/gn", accountSource: '0x8Ab178C07184ffD44F0ADfF4eA2ce6cFc33F3b86'}, + mantle: { token: ADDRESSES.mantle.USDC, start: 1712966400, graphUrl: "https://api.goldsky.com/api/public/project_cm0bho0j0ji6001t8e26s0wv8/subgraphs/intentx-mantle-analytics-083/latest/gn", accountSource: '0xECbd0788bB5a72f9dFDAc1FFeAAF9B7c2B26E456' }, } async function tvl(api) { @@ -46,9 +46,10 @@ module.exports = { [1704200400, "0.8.2 Migration"], [config.blast.start, "Blast Deploy"], [config.mantle.start, "Mantle Deploy"], + [1725753600, "0.8.3 Migration"] ], } Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) diff --git a/projects/intuition/index.js b/projects/intuition/index.js new file mode 100644 index 000000000000..4c6e84d21244 --- /dev/null +++ b/projects/intuition/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs'); + +const ETHMULTIVAULT = "0x430BbF52503Bd4801E51182f4cB9f8F534225DE5"; // Intuition's EthMultiVault contract address on Base mainnet + +module.exports = { + methodology: "The TVL is calculated based on the current ETH balance held within Intuition's EthMultiVault contract on the Base mainnet.", + base: { + tvl: sumTokensExport({ owner: ETHMULTIVAULT, tokens: [nullAddress] }), + } +} diff --git a/projects/inuswap/index.js b/projects/inuswap/index.js index 1cb8565c425f..f608b398b47a 100644 --- a/projects/inuswap/index.js +++ b/projects/inuswap/index.js @@ -8,6 +8,7 @@ module.exports = { hallmarks: [ [1663200000, "Rug Pull"] ], + deadFrom: '2022-09-15', dogechain: { tvl: getUniTVL({ useDefaultCoreAssets: true, diff --git a/projects/invar-finance/index.js b/projects/invar-finance/index.js index a90980778178..5ebb73cc6654 100644 --- a/projects/invar-finance/index.js +++ b/projects/invar-finance/index.js @@ -1,39 +1,14 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abis = require("./abis.js"); -const BigNumber = require("bignumber.js"); +const { sumTokensExport } = require('../helper/unwrapLPs.js'); -const USDC_ADDRESS = ADDRESSES.ethereum.USDC; -const RE_NFT = "0x502818ec5767570F7fdEe5a568443dc792c4496b"; const INVARIA2222 = "0x10a92B12Da3DEE9a3916Dbaa8F0e141a75F07126"; -const toUSDCBalaces = (amount, unitPrice) => ({ - [USDC_ADDRESS] : BigNumber(amount).dp(0, BigNumber.ROUND_DOWN).times(unitPrice).toFixed(0) -}); - -async function tvl(timestamp, block) { - const stakingNFTs = (await sdk.api.abi.call({ - block, - target: RE_NFT, - abi: abis.balanceOf, - params: [INVARIA2222, 1], - })).output; - - const nftUnitPrice = (await sdk.api.abi.call({ - block, - target: RE_NFT, - abi: abis.SellingPrice, - })).output; - - return toUSDCBalaces(stakingNFTs, nftUnitPrice); -} - module.exports = { - misrepresentedTokens: true, methodology: "Counts the number of staking nfts time the unit price of nft", ethereum: { - tvl, + tvl: sumTokensExport({ owner:INVARIA2222, token: ADDRESSES.ethereum.USDC}), }, + deadFrom: '2023-11-12', start: 15389792, }; diff --git a/projects/invariant/index.js b/projects/invariant/index.js index 0098e4a90e37..82fb0475e988 100644 --- a/projects/invariant/index.js +++ b/projects/invariant/index.js @@ -1,13 +1,25 @@ const { sumTokens2 } = require('../helper/solana') +const { getConfig } = require('../helper/cache') -async function tvl() { - return sumTokens2({ owner: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt' }) +const config = { + solana: 'J4uBbeoWpZE8fH58PM1Fp9n9K6f1aThyeVCyRdJbaXqt', + eclipse: 'D4P9HJYPczLFHvxBgpLKooy7eWczci8pr4x9Zu7iYCVN', } module.exports = { timetravel: false, - solana: { - tvl - }, methodology: "TVL is a sum of the locked capital in each liquidity pool", }; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + if (chain === 'eclipse') { + const { tokensData } = await getConfig('invariant/eclipse', 'https://stats.invariant.app/svm/full_snap/eclipse-mainnet') + const tokens = tokensData.map(t => t.address) + return sumTokens2({ owner: config[chain], tokens, api }) + } + return sumTokens2({ owner: config[chain], api }) + } + } +}) diff --git a/projects/inverse/index.js b/projects/inverse/index.js index 51eb1d2e1062..bc6051005421 100644 --- a/projects/inverse/index.js +++ b/projects/inverse/index.js @@ -1,16 +1,12 @@ +const { compoundExports2 } = require('../helper/compound') const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const BigNumber = require("bignumber.js"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); // Anchor const anchorStart = 11915867; const comptroller = "0x4dcf7407ae5c07f8681e1659f626e114a7667339"; -const ignore = ["0x7Fcb7DAC61eE35b3D4a51117A7c58D53f0a8a670"]; // anDOLA will be counted through the stabilizer -const anETH = "0x697b4acAa24430F254224eB794d2a85ba1Fa1FB8"; -const wETH = ADDRESSES.ethereum.WETH; // Stabilizer const stabilizer = "0x7eC0D931AFFBa01b77711C2cD07c76B970795CDd"; @@ -24,193 +20,37 @@ const vaults = [ "0x2dCdCA085af2E258654e47204e483127E0D8b277", // inDAI->ETH ]; -// ask comptroller for all markets array -async function getAllTokens(block) { - let tokens = ( - await sdk.api.abi.call({ - block, - target: comptroller, - params: [], - abi: abi["getAllMarkets"], - }) - ).output; - return tokens.filter(function (token) { - return ignore.indexOf(token) === -1; - }); +async function vaultsTVL(api) { + const tokens = await api.multiCall({ abi: abi.underlying, calls: vaults}) + const bals = await api.multiCall({ abi: abi.totalSupply, calls: vaults}) + api.add(tokens, bals) } -async function getAllUnderlying(block, tokens) { - let allUnderlying = ( - await sdk.api.abi.multiCall({ - block, - calls: tokens.filter((token) => token !== anETH).map( - (token) => ({ - target: token, - }) - ), - abi: abi["underlying"], - permitFailure: true, - }) - ).output; +async function stabilizerTVL(api) { + if (api < anchorStart) + return; - allUnderlying.push({ - input: { - target: anETH, - }, - success: true, - output: wETH, - }); - return allUnderlying; + const supply = await api.call({ target: stabilizer, abi: abi["supply"], }) + api.add(dai, supply); } -async function getCashes(block, tokens) { - return ( - await sdk.api.abi.multiCall({ - block, - calls: tokens.map((token) => ({ - target: token, - })), - abi: abi["getCash"], - }) - ).output; -} - -async function getTotalSupplies(block, tokens) { - return ( - await sdk.api.abi.multiCall({ - block, - calls: tokens.map((token) => ({ - target: token, - })), - abi: abi["totalSupply"], - }) - ).output; -} - -async function anchorTVL(block) { - const balances = {}; - if (block < anchorStart) { - return balances; - } - - const tokens = await getAllTokens(block); - const [allUnderlying, cashes] = await Promise.all([ - getAllUnderlying(block, tokens), - getCashes(block, tokens), - ]); - - tokens.forEach((token) => { - let cash = cashes.find( - (result) => result.input.target === token - ); - let underlying = allUnderlying.find( - (result) => result.input.target === token - ); - if (cash && underlying) { - balances[underlying.output] = BigNumber( - balances[underlying.output] || 0 - ).plus(cash.output); - } - }); - - return balances; -} - -async function vaultsTVL(block) { - const balances = {}; - - const [allUnderlying, totalSupplies] = await Promise.all([ - getAllUnderlying(block, vaults), - getTotalSupplies(block, vaults), - ]); +async function tvl(api) { + const compTvl = compoundExports2({ comptroller, cether: ['0x697b4acaa24430f254224eb794d2a85ba1fa1fb8', '0x8e103eb7a0d01ab2b2d29c91934a9ad17eb54b86'], blacklistedTokens: ['0x865377367054516e17014ccded1e7d814edc9ce4']}).tvl - vaults.forEach((token) => { - let totalSupply = totalSupplies.find( - (result) => result.input.target === token - ); - let underlying = allUnderlying.find( - (result) => result.input.target === token - ); - if (totalSupply && underlying) { - balances[underlying.output] = BigNumber( - balances[underlying.output] || 0 - ).plus(totalSupply.output); - } - }); - - return balances; -} - -async function stabilizerTVL(block) { - if (block < anchorStart) { - return {}; - } - - const supply = ( - await sdk.api.abi.call({ - block, - target: stabilizer, - abi: abi["supply"], - }) - ).output; - - return { - [dai]: BigNumber(supply), - }; -} - -async function tvl(timestamp, block) { - const balances = {}; - - const [ - anchorBalances, - vaultBalances, - stabilizerBalances, - ] = await Promise.all([ - anchorTVL(block), - vaultsTVL(block), - stabilizerTVL(block), + await Promise.all([ + compTvl(api), + vaultsTVL(api), + stabilizerTVL(api), ]); - - const lps = [] - Object.entries(anchorBalances).forEach(([token, value]) => { - const balance = BigNumber(balances[token] || 0); - if(token === '0xAA5A67c256e27A5d80712c51971408db3370927D'){ - token = "0x865377367054516e17014ccded1e7d814edc9ce4" - } - if(token === "0x5BA61c0a8c4DccCc200cd0ccC40a5725a426d002"){ - lps.push({ - token, - balance: value.toFixed(0) - }) - } else { - balances[token] = balance.plus(BigNumber(value)).toFixed(); - } - }); - - Object.entries(vaultBalances).forEach(([token, value]) => { - const balance = BigNumber(balances[token] || 0); - balances[token] = balance.plus(BigNumber(value)).toFixed(); - }); - - Object.entries(stabilizerBalances).forEach(([token, value]) => { - const balance = BigNumber(balances[token] || 0); - balances[token] = balance.plus(BigNumber(value)).toFixed(); - }); - await unwrapUniswapLPs(balances, lps, block) - - return balances; + return sumTokens2({ api, resolveLP: true, }) } module.exports = { methodology: "DOLA curve metapool replaced by DOLA", hallmarks: [ - [1648771200, "INV price hack"], - [1655380800, "Inverse Frontier Deprecated"], - [1670701200, "Launch of FiRM"], - [1696204800, "Borrow against INV on FiRM"], - [1707177600, "Launch of sDOLA"], -], + [1648771200, "INV price hack"], + [1655380800, "Inverse Frontier Deprecated"] + ], start: 1607731200, // Dec 12 2020 00:00:00 GMT+0000 ethereum: { tvl } }; diff --git a/projects/iolend/index.js b/projects/iolend/index.js new file mode 100644 index 000000000000..ea6d5126f4ea --- /dev/null +++ b/projects/iolend/index.js @@ -0,0 +1,8 @@ +const { aaveExports, methodology } = require("../helper/aave"); + +module.exports = { + methodology, + iotaevm: { + ...aaveExports('iotaevm', '0xA9Bb7ebb4F51B0e0BbD0FaE640e32298a0Bcf4A5'), + }, +}; diff --git a/projects/ionic/index.js b/projects/ionic/index.js index fd64d1f9e15e..a7c095deb88c 100644 --- a/projects/ionic/index.js +++ b/projects/ionic/index.js @@ -6,4 +6,14 @@ module.exports = mergeExports([{ mode: compoundExports2({ comptroller: '0xfb3323e24743caf4add0fdccfb268565c0685556' }) }, { mode: compoundExports2({ comptroller: '0x8fb3d4a94d0aa5d6edaac3ed82b59a27f56d923a' }) + }, { + base: compoundExports2({ comptroller: '0x05c9C6417F246600f8f5f49fcA9Ee991bfF73D13' }) + }, { + bob: compoundExports2({ comptroller: '0x9cFEe81970AA10CC593B83fB96eAA9880a6DF715' }) + }, { + fraxtal: compoundExports2({ comptroller: '0xB5141403e811fFFE02f4d49Ea8d4a7B0b9590658' }) + }, { + optimism: compoundExports2({ comptroller: '0xaFB4A254D125B0395610fdc8f1D022936c7b166B' }) + }, { + lisk: compoundExports2({ comptroller: '0xF448A36feFb223B8E46e36FF12091baBa97bdF60' }) }]) \ No newline at end of file diff --git a/projects/ipor-fusion/index.js b/projects/ipor-fusion/index.js new file mode 100644 index 000000000000..edef674d2cf9 --- /dev/null +++ b/projects/ipor-fusion/index.js @@ -0,0 +1,16 @@ +const { getConfig } = require('../helper/cache') + +const IPOR_GITHUB_ADDRESSES_URL = "https://raw.githubusercontent.com/IPOR-Labs/ipor-abi/main/mainnet/addresses.json"; + +async function tvl(api) { + const config = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL); + const calls = config[api.chain].vaults.map(vault => vault.PlasmaVault); + return api.erc4626Sum2({ calls }) +} + +module.exports = { + methodology: `Counts the tokens deposited into IPOR Fusion Vaults.`, + ethereum: { tvl }, + arbitrum: { tvl }, + base: { tvl }, +}; diff --git a/projects/ipor/abi.js b/projects/ipor/abi.js index ec952bd711b4..b206dea50a7a 100644 --- a/projects/ipor/abi.js +++ b/projects/ipor/abi.js @@ -2,6 +2,7 @@ module.exports = { abi: { getAccruedBalance: "function getAccruedBalance() view returns (uint256 totalCollateralPayFixed, uint256 totalCollateralReceiveFixed, uint256 liquidityPool, uint256 vault)", getAmmBalance: "function getAmmBalance(address asset) view returns (uint256 totalCollateralPayFixed, uint256 totalCollateralReceiveFixed, uint256 liquidityPool, uint256 vault)", + getBalancesForOpenSwap: " function getBalancesForOpenSwap(address asset) external view returns (uint256 totalCollateralPayFixed, uint256 totalNotionalPayFixed, uint256 totalCollateralReceiveFixed, uint256 totalNotionalReceiveFixed, uint256 liquidityPool)", getAsset: "address:getAsset", } }; diff --git a/projects/ipor/index.js b/projects/ipor/index.js index 8b3c6f95057e..11b43e51c901 100644 --- a/projects/ipor/index.js +++ b/projects/ipor/index.js @@ -1,4 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { abi } = require("./abi"); const { getConfig } = require('../helper/cache') @@ -14,37 +13,24 @@ async function tvlEthereum(api) { return await calculateTvlForV1(api); } } -async function tvlArbitrum(_, block, _1, {api}) { - const addresses = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL); - for (const pool of addresses.arbitrum.pools) { - await api.sumTokens({owner: pool.AmmTreasury, tokens: [pool.asset]}); - } - return api.getBalances(); -} async function calculateTvlForV2(api) { - const addresses = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL) + const chain = api.chain + const {[chain]: { IporProtocolRouter, pools, vaults }} = await getConfig('ipor/assets', IPOR_GITHUB_ADDRESSES_URL) - const assets = [ - ADDRESSES.ethereum.USDT, // USDT - ADDRESSES.ethereum.USDC, // USDC - ADDRESSES.ethereum.DAI, // DAI - ] + let assets = vaults.map(i => i.asset) + assets = [...new Set(assets)] - const output = await api.multiCall({ abi: abi.getAmmBalance, calls: assets, target: addresses.ethereum.IporProtocolRouter }) + const res = await api.multiCall({ abi: abi.getBalancesForOpenSwap, calls: assets, target: IporProtocolRouter }) const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: assets }) - output.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool, vault }, i) => { + res.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool, }, i) => { const balance = +totalCollateralPayFixed + +totalCollateralReceiveFixed + +liquidityPool const decimal = 18 - decimals[i] api.add(assets[i], balance / (10 ** decimal)) }); - - for (const pool of addresses.ethereum.pools) { - await api.sumTokens({owner: pool.AmmTreasury, tokens: [pool.asset]}); - } - - return api.getBalances(); + const tokensAndOwners = pools.map(pool => [pool.asset, pool.AmmTreasury]); + return api.sumTokens({ tokensAndOwners, blacklistedTokens: assets }); } async function calculateTvlForV1(api) { @@ -53,11 +39,11 @@ async function calculateTvlForV1(api) { '0x137000352B4ed784e8fa8815d225c713AB2e7Dc9', // USDC '0xEd7d74AA7eB1f12F83dA36DFaC1de2257b4e7523', // DAI ] - const output = await api.multiCall({ abi: abi.getAccruedBalance, calls: miltonAddresses, }) + const res = await api.multiCall({ abi: abi.getAccruedBalance, calls: miltonAddresses, }) const tokens = await api.multiCall({ abi: abi.getAsset, calls: miltonAddresses, }) const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) - output.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool }, i) => { + res.forEach(({ totalCollateralPayFixed, totalCollateralReceiveFixed, liquidityPool }, i) => { const balance = +totalCollateralPayFixed + +totalCollateralReceiveFixed + +liquidityPool const decimal = 18 - decimals[i] api.add(tokens[i], balance / (10 ** decimal)) @@ -72,6 +58,12 @@ module.exports = { tvl: tvlEthereum }, arbitrum: { - tvl: tvlArbitrum - } + tvl: calculateTvlForV2 + }, + base: { + tvl: calculateTvlForV2 + }, + hallmarks:[ + [1674648000, "Liquidity Mining Start"] + ], }; diff --git a/projects/ironbank/index.js b/projects/ironbank/index.js index 0f55648591df..d1c485f53aa4 100644 --- a/projects/ironbank/index.js +++ b/projects/ironbank/index.js @@ -1,11 +1,9 @@ -const { getCompoundV2Tvl, compoundExports, usdCompoundExports } = require("../helper/compound"); +const { compoundExports2 } = require("../helper/compound"); - - -const ftmSFIreplace = addr=> addr==="0x924828a9Fb17d47D0eb64b57271D10706699Ff11" ? "0xb753428af26e81097e7fd17f40c88aaa3e04902c":`fantom:${addr}` module.exports = { start: 1599552000, // 09/08/2020 @ 8:00am (UTC) - ethereum: compoundExports("0xAB1c342C7bf5Ec5F02ADEA1c2270670bCa144CbB", "ethereum",undefined,undefined,undefined,undefined,{ + ethereum: compoundExports2({ + comptroller: '0xAB1c342C7bf5Ec5F02ADEA1c2270670bCa144CbB', blacklistedTokens: [ '0x96E61422b6A9bA0e068B6c5ADd4fFaBC6a4aae27', //ibEUR '0x95dfdc8161832e4ff7816ac4b6367ce201538253', //ibKRW @@ -17,10 +15,7 @@ module.exports = { '0x4e3a36A633f63aee0aB57b5054EC78867CB3C0b8', //old hacked sUSD cream market ] }), - fantom: { - tvl: getCompoundV2Tvl("0x4250a6d3bd57455d7c6821eecb6206f507576cd2", "fantom", ftmSFIreplace, undefined, undefined, false), - borrowed: getCompoundV2Tvl("0x4250a6d3bd57455d7c6821eecb6206f507576cd2", "fantom", ftmSFIreplace, undefined, undefined, true) - }, - avax:compoundExports("0x2eE80614Ccbc5e28654324a66A396458Fa5cD7Cc", "avax"), - optimism: compoundExports("0xE0B57FEEd45e7D908f2d0DaCd26F113Cf26715BF", "optimism") -}; + fantom: compoundExports2({ comptroller: '0x4250a6d3bd57455d7c6821eecb6206f507576cd2' }), + avax: compoundExports2({ comptroller: '0x2eE80614Ccbc5e28654324a66A396458Fa5cD7Cc' }), + optimism: compoundExports2({ comptroller: '0xE0B57FEEd45e7D908f2d0DaCd26F113Cf26715BF' }), +} diff --git a/projects/ironfinance/index.js b/projects/ironfinance/index.js index cbf70410913b..574f4a1346b8 100644 --- a/projects/ironfinance/index.js +++ b/projects/ironfinance/index.js @@ -128,24 +128,24 @@ const fantomTvl = async (timestamp, ethBlock, chainBlocks) => { return tvl; }; -const {tvl: polygonLending, borrowed: polygonBorrowed} = - compoundExports(Contracts.polygon.lend.ironController, "polygon", "0xCa0F37f73174a28a64552D426590d3eD601ecCa1", Contracts.polygon.wrappedNative) -const {tvl: fantomLending, borrowed: fantomBorrowed} = - compoundExports(Contracts.fantom.lend.ironController, "fantom", "0xdfce3E14a8c77D32fe2455a9E56424F149E2F271", Contracts.fantom.wrappedNative) +const { tvl: polygonLending, borrowed: polygonBorrowed } = + compoundExports(Contracts.polygon.lend.ironController, "0xCa0F37f73174a28a64552D426590d3eD601ecCa1", Contracts.polygon.wrappedNative) +const { tvl: fantomLending, borrowed: fantomBorrowed } = + compoundExports(Contracts.fantom.lend.ironController, "0xdfce3E14a8c77D32fe2455a9E56424F149E2F271", Contracts.fantom.wrappedNative) module.exports = { - polygon: { + polygon: { tvl: sdk.util.sumChainTvls([polygonTvl, polygonLending]), borrowed: polygonBorrowed }, - avax:{ + avax: { tvl: avaxTvl, }, fantom: { - tvl: sdk.util.sumChainTvls([fantomTvl, fantomLending]), + tvl: sdk.util.sumChainTvls([fantomTvl, fantomLending]), borrowed: fantomBorrowed }, hallmarks: [ - [1652270400,"Re-entrancy Exploit"] + [1652270400, "Re-entrancy Exploit"] ], }; diff --git a/projects/issuaa/index.js b/projects/issuaa/index.js index 54a0b8406a4a..b6b40250bd18 100644 --- a/projects/issuaa/index.js +++ b/projects/issuaa/index.js @@ -11,7 +11,7 @@ module.exports = { factory: '0xC7e06CAF7880421cD21E98656B4755B3Df61537b', useDefaultCoreAssets: true, hasStablePools: true, - fetchBalances: true, + fetchBalances: true, // get reserves call fails }) } } \ No newline at end of file diff --git a/projects/ithaca/index.js b/projects/ithaca/index.js index 4f6229cbf4b4..201b6181ee7e 100644 --- a/projects/ithaca/index.js +++ b/projects/ithaca/index.js @@ -4,6 +4,10 @@ const { sumTokensExport } = require("../helper/unwrapLPs"); const ITHACA_FUNDLOCK_CONTRACT = '0x4a20d341315b8ead4e5ebecc65d95080a47a7316'; const WETH_CONTRACT = ADDRESSES.arbitrum.WETH; const USDC_CONTRACT = ADDRESSES.arbitrum.USDC_CIRCLE; +const ITHACA_WETH_AAVE_STRATEGY_CONTRACT = '0xb2dd2f67132e2e5bc37cb2c1d3b193909b7fb26c' +const ITHACA_USDC_AAVE_STRATEGY_CONTRACT = '0x9f494058e0501498f09fd0173d5024e1d3a6fc57' +const AWETH_CONTRACT = '0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8' +const AUSDC_CONTRACT = '0x724dc807b04555b71ed48a6896b6F41593b8C637' module.exports = { timetravel: true, @@ -11,9 +15,13 @@ module.exports = { methodology: 'counts the number of WETH and USDC in Ithaca Fundlock contract', start: 176036233, arbitrum: { - tvl: sumTokensExport({ - owner: ITHACA_FUNDLOCK_CONTRACT, - tokens: [ WETH_CONTRACT, USDC_CONTRACT ], + tvl: sumTokensExport({ + tokensAndOwners: [ + [WETH_CONTRACT, ITHACA_FUNDLOCK_CONTRACT], + [USDC_CONTRACT, ITHACA_FUNDLOCK_CONTRACT], + [AWETH_CONTRACT, ITHACA_WETH_AAVE_STRATEGY_CONTRACT], + [AUSDC_CONTRACT, ITHACA_USDC_AAVE_STRATEGY_CONTRACT], + ], }), } }; \ No newline at end of file diff --git a/projects/ixswap/index.js b/projects/ixswap/index.js index 31154e2017a6..e0bdaeac3a24 100644 --- a/projects/ixswap/index.js +++ b/projects/ixswap/index.js @@ -8,7 +8,7 @@ const STAKING_CONTRACTS = [ module.exports = { polygon:{ - tvl: getUniTVL({ factory: '0xc2D0e0bc81494adB71Ce9Aa350cC875DaE12D81D', fetchBalances: true, blacklistedTokens: [IXS_POLYGON] }), + tvl: getUniTVL({ factory: '0xc2D0e0bc81494adB71Ce9Aa350cC875DaE12D81D', blacklistedTokens: [IXS_POLYGON] }), staking: staking(STAKING_CONTRACTS, IXS_POLYGON), }, } \ No newline at end of file diff --git a/projects/izumi-iziswap/index.js b/projects/izumi-iziswap/index.js index 256c2d5b2acf..bb866ab41271 100644 --- a/projects/izumi-iziswap/index.js +++ b/projects/izumi-iziswap/index.js @@ -35,6 +35,8 @@ const poolHelpers = { 'bob': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], 'taiko': ['0x33531bDBFE34fa6Fd5963D0423f7699775AacaaF'], 'core': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'gravity': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], + 'iotex': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], } // iziswap liquidityManager contracts const blacklistedTokens = [ diff --git a/projects/jadeswap/index.js b/projects/jadeswap/index.js index a1dde66f4078..e6f021309402 100644 --- a/projects/jadeswap/index.js +++ b/projects/jadeswap/index.js @@ -4,7 +4,6 @@ const sdk = require("@defillama/sdk"); const uniTvl = getUniTVL({ factory: "0xb20a6389cA872d094f3c7A8180fE5BAb431BD794", useDefaultCoreAssets: true, - fetchBalances: true, }); const masterchef = "0xcC507803A4b832684154C4E395D92A6EDbEAfE52"; const jade = "0x7c70229F108D3d506Cff8Ea243FFA57344Fc4cE1"; diff --git a/projects/jarvis/index.js b/projects/jarvis/index.js index cbdab35beeb9..4bdd6b4dd4bd 100644 --- a/projects/jarvis/index.js +++ b/projects/jarvis/index.js @@ -36,64 +36,34 @@ async function tvl(api) { const { synthpoolRegistry, version } = contracts[chain] const { fixedRateRegistry, fixedRateVersion } = contracts[chain] const { selfMintingRegistry, creditLineVersion } = contracts[chain] - const block = api.block - const balances = {} // Get liquidityPools by calling getElements(synth, collateral, version) // For v5, the collateral is stored in the liquidity pools directly // Get collaterals, usually single collat, USDC on polygon, BUSD on BSC, but might be multiple collats later on - const collaterals = await api.call({ - abi: abi["SynthereumPoolRegistry_getCollaterals"], - target: synthpoolRegistry, - }) + const collaterals = await api.call({ abi: abi["SynthereumPoolRegistry_getCollaterals"], target: synthpoolRegistry, }) // Get synth token symbols - jEUR, jCHF etc - const syntheticTokens = await api.call({ - abi: abi["SynthereumPoolRegistry_getSyntheticTokens"], - target: synthpoolRegistry, - }) + const syntheticTokens = await api.call({ abi: abi["SynthereumPoolRegistry_getSyntheticTokens"], target: synthpoolRegistry, }) if (chain === 'polygon' || chain === 'bsc') { // Get collateral for SynthereumFixedRate Wrappers - const fixedRateCollaterals = await api.call({ - abi: abi["SynthereumFixedRateRegistry_getCollaterals"], - target: fixedRateRegistry, - }) + const fixedRateCollaterals = await api.call({ abi: abi["SynthereumFixedRateRegistry_getCollaterals"], target: fixedRateRegistry, }) // Get synthTokens for SynthereumFixedRate Wrappers - jEUR, jCHF etc. - const fixedRateSynthTokens = await api.call({ - abi: abi["SynthereumFixedRateRegistry_getSyntheticTokens"], - target: fixedRateRegistry, - }) + const fixedRateSynthTokens = await api.call({ abi: abi["SynthereumFixedRateRegistry_getSyntheticTokens"], target: fixedRateRegistry, }) // Get fixedRateWrappers by calling SynthereumFixedRateRegistry_getElements const params_list_fixedRate = fixedRateCollaterals.map(fixedRateCollateral => fixedRateSynthTokens.map(fixedRateSynth => [fixedRateSynth, fixedRateCollateral, fixedRateVersion])).flat().map(i => ({ params: i })) - const elements_obj_fixedRate = await api.multiCall({ - abi: abi["SynthereumFixedRateRegistry_getElements"], - target: fixedRateRegistry, - calls: params_list_fixedRate - }) + const elements_obj_fixedRate = await api.multiCall({ abi: abi["SynthereumFixedRateRegistry_getElements"], target: fixedRateRegistry, calls: params_list_fixedRate }) const fixedRateWrappers = elements_obj_fixedRate.flat(2) const fixedRateCalls = fixedRateWrappers - const fixedRateCollateralTokens = await api.multiCall({ - abi: abi.collateralToken, - calls: fixedRateCalls, - }) - const fixedRateTotalCollateralAmounts = await api.multiCall({ - abi: abi.totalPegCollateral, - calls: fixedRateCalls, - }) - fixedRateCollateralTokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, chain + ':' + data, fixedRateTotalCollateralAmounts[i]) - }) + const fixedRateCollateralTokens = await api.multiCall({ abi: abi.collateralToken, calls: fixedRateCalls, }) + const fixedRateTotalCollateralAmounts = await api.multiCall({ abi: abi.totalPegCollateral, calls: fixedRateCalls, }) + api.add(fixedRateCollateralTokens, fixedRateTotalCollateralAmounts) } // Get synthereumPools by calling SynthereumPoolRegistry_getElements - const params_list = collaterals.map(collateral => syntheticTokens.map(synth => [synth, collateral, version])).flat().map(i => ({ params: i })) - const elements_obj = await api.multiCall({ - abi: abi["SynthereumPoolRegistry_getElements"], - target: synthpoolRegistry, - calls: params_list - }) + const params_list = collaterals.map(collateral => syntheticTokens.map(synth => ({ params: [synth, collateral, version]}))).flat() + const elements_obj = await api.multiCall({ abi: abi["SynthereumPoolRegistry_getElements"], target: synthpoolRegistry, calls: params_list }) const liquidityPools = elements_obj.flat(2) if (version === 6) { @@ -103,66 +73,39 @@ async function tvl(api) { '0xBC988A0146178825C26c255989cfd5083Bae672C', '0x8FEceC5629EED60D18Fd3438aae4a8E69723D190', ].map(i => i.toLowerCase()) - const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())).map(a => ({ target: a })) - const collateralTokens = await api.multiCall({ - abi: abi.collateralToken, - calls - }) - const totalCollateralAmounts = await api.multiCall({ - abi: abi.totalCollateralAmount, - calls - }) + const calls = liquidityPools.filter(i => !blacklistedPools.includes(i.toLowerCase())) + const collateralTokens = await api.multiCall({ abi: abi.collateralToken, calls }) + const totalCollateralAmounts = await api.multiCall({ abi: abi.totalCollateralAmount, calls, permitFailure: true }) collateralTokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, chain + ':' + data, totalCollateralAmounts[i].totalCollateral) + const totalCollateralAmount = totalCollateralAmounts[i] + if (!totalCollateralAmount) return + api.add(data, totalCollateralAmount.totalCollateral) }) } else if (version === 5) { // Get balances of every LiquidityPool and SynthToken Contracts - await sumTokens2({ api, balances, owners: liquidityPools, tokens: collaterals }) + await sumTokens2({ api, owners: liquidityPools, tokens: collaterals }) } if (chain === 'polygon' || chain === 'bsc' || chain === 'optimism' || chain === 'arbitrum') { // Get collateral token addresses from self minting registry - const { output: selfMintingCollaterals } = await sdk.api.abi.call({ - abi: abi["SynthereumSelfMintingRegistry_getCollaterals"], - target: selfMintingRegistry, - block, - chain - }) + const selfMintingCollaterals = await api.call({ abi: abi["SynthereumSelfMintingRegistry_getCollaterals"], target: selfMintingRegistry, }) // Get synth token symbols - jEUR, jCHF etc - const { output: selfMintingSyntheticTokens } = await sdk.api.abi.call({ - abi: abi["SynthereumSelfMintingRegistry_getSyntheticTokens"], - target: selfMintingRegistry, - block, - chain - }) + const selfMintingSyntheticTokens = await api.call({ abi: abi["SynthereumSelfMintingRegistry_getSyntheticTokens"], target: selfMintingRegistry, }) // Get creditLineDerivatives by calling SynthereumSelfMintingRegistry_getElements - const params_list_creditline = selfMintingCollaterals.map(selfMintingCollateral => selfMintingSyntheticTokens.map(selfMintingSynth => [selfMintingSynth, selfMintingCollateral, creditLineVersion])).flat() - const { output: elements_obj_creditline } = await sdk.api.abi.multiCall({ - abi: abi["SynthereumSelfMintingRegistry_getElements"], - calls: params_list_creditline.map(params => ({ - target: selfMintingRegistry, - params: params - })), - block, - chain + const params_list_creditline = selfMintingCollaterals.map(selfMintingCollateral => selfMintingSyntheticTokens.map(selfMintingSynth => ({ params: [selfMintingSynth, selfMintingCollateral, creditLineVersion]}))).flat() + const elements_obj_creditline = await api.multiCall({ + abi: abi["SynthereumSelfMintingRegistry_getElements"], target: selfMintingRegistry, calls: params_list_creditline, }) - const creditLineDerivatives = elements_obj_creditline.map(e => e.output).flat(2) + const creditLineDerivatives = elements_obj_creditline.flat(2) - const creditLineCalls = creditLineDerivatives.map(f => ({ target: f })) - const { output: creditLineCollateralTokens } = await sdk.api.abi.multiCall({ - abi: abi.collateralToken, - chain, block, calls: creditLineCalls, - }) - const { output: creditLineTotalCollateralAmounts } = await sdk.api.abi.multiCall({ - abi: abi.getGlobalPositionData, - chain, block, calls: creditLineCalls, - }) + const creditLineCalls = creditLineDerivatives + const creditLineCollateralTokens = await api.multiCall({ abi: abi.collateralToken, calls: creditLineCalls, }) + const creditLineTotalCollateralAmounts = await api.multiCall({ abi: abi.getGlobalPositionData, calls: creditLineCalls, }) creditLineCollateralTokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, chain + ':' + data.output, creditLineTotalCollateralAmounts[i].output.totCollateral) + api.add(data, creditLineTotalCollateralAmounts[i].totCollateral) }) } - return balances } module.exports = { diff --git a/projects/jaspervault/index.js b/projects/jaspervault/index.js index a327a6ec8b90..f6abdb3bedca 100644 --- a/projects/jaspervault/index.js +++ b/projects/jaspervault/index.js @@ -1,19 +1,31 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs") +const dlcBTC_arbitrum = '0x050C24dBf1eEc17babE5fc585F06116A259CC77A' +const cbBTC_base = '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf' module.exports = { arbitrum: { tvl: sumTokensExport({ owners: [ - '0xE980FD1dEA4E93c25B7f5B27351CF069C4f63a41', - '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89', - '0x5954B84F4ba745E1A85E9A5875ce3bDf863200ba', - '0xaaa5a76b9397eE41309CC15Bd71a5ae99662d6cd', - '0x3cF1A20AE73ff128D3A40F4492fdE59F2B2D1e8C', - '0x1eb466780e412C796A7BEdA541CfF47E0571A000', - '0x1DDD814589376Db497F91eFD2E6AFF969822a951' + '0x5954B84F4ba745E1A85E9A5875ce3bDf863200ba', // ETH CALL + '0x3cF1A20AE73ff128D3A40F4492fdE59F2B2D1e8C', // WBTC CALL + '0x1eb466780e412C796A7BEdA541CfF47E0571A000', // ARB CALL + '0x69ff3c3344C4F945205ddeA9A66c99c0A07D8aae', // WSOL CALL + '0x7A5A597d5c1D09F919e91Db5A986A4Dd2DEc0Af4', // dlcBTC CALL + '0xE26f15B3cc23e8a5adE4c10CCc69e50520eE2a89', // ETH WBTC dlcBTC PUT + '0x1DDD814589376Db497F91eFD2E6AFF969822a951' // ETH WBTC dlcBTC PUT ], - tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.ARB] + tokens: [ADDRESSES.arbitrum.WBTC, ADDRESSES.null, ADDRESSES.arbitrum.USDT, ADDRESSES.arbitrum.ARB, dlcBTC_arbitrum] + }) + }, + base: { + tvl: sumTokensExport({ + owners: [ + '0x37a4f273B341C077230aA2d967590b8a74D37598', // ETH CALL + '0x4FAF5c3809E8Dc966Ff7AeDDFb501AF6f85Fbeb7', // cbBTC CALL + '0x8aB7037c4073200c907da014C626222624E1Fc47', // ETH cbBTC PUT + ], + tokens: [ADDRESSES.null, cbBTC_base] }) }, } diff --git a/projects/jbc/index.js b/projects/jbc/index.js index 0f32be4f1e95..bd8d385e1616 100644 --- a/projects/jbc/index.js +++ b/projects/jbc/index.js @@ -14,6 +14,7 @@ module.exports = { hallmarks: [ [1681516800, "Rug Pull"] ], + deadFrom: '2023-04-15', arbitrum: { tvl: sumTokensExport({ tokensAndOwners }), pool2: pool2({ stakingContract: '0x0F6f73c7ecCE4FB9861E25dabde79CBA112550b3', lpToken, useDefaultCoreAssets: true, }), diff --git a/projects/jellyverse/index.js b/projects/jellyverse/index.js index 382b6f667755..c64f1b4dab58 100644 --- a/projects/jellyverse/index.js +++ b/projects/jellyverse/index.js @@ -1,19 +1,20 @@ -const { onChainTvl } = require('../helper/balancer') - -const config = { - vault: "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875", - startingBlock: 81_247_457, -}; +const { cachedGraphQuery } = require('../helper/cache') module.exports = { sei: { - tvl: onChainTvl(config.vault, config.startingBlock, { - preLogTokens: [ - '0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1', - '0xB75D0B03c06A926e488e2659DF1A861F860bD3d1', - '0x5f0E07dFeE5832Faa00c63F2D33A0D79150E8598', - '0x5Cf6826140C1C56Ff49C808A1A75407Cd1DF9423', - ] - }), + tvl, + } +} + +async function tvl(api) { + let tokens = await cachedGraphQuery('jellyverse', 'https://graph.mainnet.jellyverse.org/subgraphs/name/jelly/verse', `query q($lastId: ID){ + tokens (where: {id_gt: $lastId} first: 1000) { + id + address + pool { id } } +}`, { fetchById: true }) + const vault = "0xFB43069f6d0473B85686a85F4Ce4Fc1FD8F00875" + tokens = tokens.filter(t => !t.pool).map(t => t.address) + return api.sumTokens({ owner: vault, tokens }) } diff --git a/projects/jetfuelfinance/index.js b/projects/jetfuelfinance/index.js index ff15a4a38a55..4988a81dad5f 100644 --- a/projects/jetfuelfinance/index.js +++ b/projects/jetfuelfinance/index.js @@ -109,7 +109,7 @@ const bscTvl = async (timestamp, block, chainBlocks) => { return balances; }; -const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "bsc", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", ADDRESSES.bsc.WBNB) +const {tvl:lendingTvl, borrowed} = compoundExports("0x67340bd16ee5649a37015138b3393eb5ad17c195", "0xE24146585E882B6b59ca9bFaaaFfED201E4E5491", ADDRESSES.bsc.WBNB) module.exports = { bsc: { diff --git a/projects/jiblend/index.js b/projects/jiblend/index.js index 77e2bef40cd7..849fc5eb6779 100644 --- a/projects/jiblend/index.js +++ b/projects/jiblend/index.js @@ -4,6 +4,5 @@ module.exports = { jbc: compoundExports2({ comptroller: '0x603122Cdd36abCD164e448e1f3fbd33730edf35a', cether: '0xAc3e5aD93DDeac9B32772c8A864B5E73820c5d16', - fetchBalances: true, }) }; \ No newline at end of file diff --git a/projects/jones-dao/addresses.js b/projects/jones-dao/addresses.js index 6bcdf633baf2..2588230f71b2 100644 --- a/projects/jones-dao/addresses.js +++ b/projects/jones-dao/addresses.js @@ -45,20 +45,21 @@ module.exports = { "0xF46Ce0C13577232D5F29D9Bd78a9Cab278755346", "0x42448fDDCec02124cf6dB19a9f91Dea7bB0e88e5", ], + smartLpArbFactories: [ + "0xFEFd54D82337d3Dacb5DE53083C22BA41ca76CC5", + "0xb385809cCdB2BD87A5Cd32ad09287399F0318a92", + "0xf965734b1750E64D9a01c991C5E630D279C34fd2", + "0xb754D87BdAb6Cc8c903abC2Bda9cE6B3c9481e60", + "0xB2cBa14C94B30297DBFbCB7517d9105D67bB692d" + ], tokens: { - arb: ADDRESSES.arbitrum.ARB, aura: "0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF", dpx: "0x6C2C06790b3E3E3c38e12Ee22F8183b37a13EE55", - dpx_eth: "0x0C1Cf6883efA1B496B01f654E247B9b419873054", glp: ADDRESSES.arbitrum.fsGLP, gohm: "0x8D9bA570D6cb60C7e3e0F31343Efe75AB8E65FB1", jones: "0x10393c20975cf177a3513071bc110f7962cd67da", - jglp: "0x7241bC8035b65865156DDb5EdEf3eB32874a3AF6", rdpx: "0x32Eb7902D4134bf98A28b963D26de779AF92A212", - rdpx_eth: "0x7418F5A2621E13c05d1EFBd71ec922070794b90a", usdc: ADDRESSES.arbitrum.USDC_CIRCLE, uvrt: "0xa485a0bc44988B95245D5F20497CCaFF58a73E99", - weth: ADDRESSES.arbitrum.WETH, - wjaura: "0xcB9295ac65De60373A25C18d2044D517ed5da8A9", }, }; diff --git a/projects/jones-dao/aura-locker-abi.json b/projects/jones-dao/aura-locker-abi.json deleted file mode 100644 index 32a964f6ed10..000000000000 --- a/projects/jones-dao/aura-locker-abi.json +++ /dev/null @@ -1,48 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - } - ], - "name": "lockedBalances", - "outputs": [ - { - "internalType": "uint256", - "name": "total", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "unlockable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "locked", - "type": "uint256" - }, - { - "components": [ - { - "internalType": "uint112", - "name": "amount", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "unlockTime", - "type": "uint32" - } - ], - "internalType": "struct AuraLocker.LockedBalance[]", - "name": "lockData", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/projects/jones-dao/index.js b/projects/jones-dao/index.js index 15c9d2157869..5b1e2dfd97bb 100644 --- a/projects/jones-dao/index.js +++ b/projects/jones-dao/index.js @@ -4,7 +4,6 @@ const { pool2s } = require("../helper/pool2"); const { stakings } = require("../helper/staking"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const lockerABI = require("./aura-locker-abi.json"); const addresses = require("./addresses"); const jAssetToAsset = { @@ -14,80 +13,77 @@ const jAssetToAsset = { "0x1f6fa7a58701b3773b08a1a16d06b656b0eccb23": addresses.tokens.rdpx, // jrdpx }; -async function tvl(api) { +const tokensAndOwners = [ + [addresses.tokens.uvrt, addresses.glp.stableRewardTracker], + [addresses.tokens.uvrt, addresses.glp.router], + [addresses.tokens.glp, addresses.glp.leverageStrategy], +]; + +const abi = { + locker: "function lockedBalances(address _user) view returns (uint256 total, uint256 unlockable, uint256 locked, (uint112 amount, uint32 unlockTime)[] lockData)", + glpManager: "function getLPManagerContracts(uint256 _nonce) view returns (address lp,address viewer,address swapper,address receiver,address priceHelper,address lpManager,address doubleTracker,address singleTrackerZero,address singleTrackerOne,address compounder,address router)" +} + +async function tvl_arbitrum (api) { const [metavaultTokens, metavaultBalances, optionVaultTokens, optionVaultBalances, jusdcTvl] = await Promise.all([ - api.multiCall({ - abi: "address:depositToken", - calls: addresses.metaVaultsAddresses, - }), - api.multiCall({ - abi: "uint256:workingBalance", - calls: addresses.metaVaultsAddresses, - }), - api.multiCall({ - abi: "address:asset", - calls: addresses.optionVaultAddresses, - }), - api.multiCall({ - abi: "uint256:totalAssets", - calls: addresses.optionVaultAddresses, - }), - sdk.api.abi.call({ - abi: "uint256:totalAssets", - target: addresses.jusdc.underlyingVault, - chain: "arbitrum", - }), + api.multiCall({ abi: "address:depositToken", calls: addresses.metaVaultsAddresses }), + api.multiCall({ abi: "uint256:workingBalance", calls: addresses.metaVaultsAddresses }), + api.multiCall({ abi: "address:asset", calls: addresses.optionVaultAddresses }), + api.multiCall({ abi: "uint256:totalAssets", calls: addresses.optionVaultAddresses }), + api.call({ abi: "uint256:totalAssets", target: addresses.jusdc.underlyingVault }), ]); api.addTokens(metavaultTokens, metavaultBalances); api.addTokens(optionVaultTokens, optionVaultBalances); - api.addTokens(addresses.tokens.usdc, jusdcTvl.output); + api.addTokens(addresses.tokens.usdc, jusdcTvl); - const tokensAndOwners = [ - [addresses.tokens.uvrt, addresses.glp.stableRewardTracker], - [addresses.tokens.uvrt, addresses.glp.router], - [addresses.tokens.glp, addresses.glp.leverageStrategy], - ]; + for (const factoryAddress of addresses.smartLpArbFactories) { + const contracts = await api.fetchList({ lengthAbi: 'nonce', itemAbi: abi.glpManager, target: factoryAddress, startFromOne: true }) + const lpManagers = contracts.map(c => c.lpManager) - return sumTokens2({ api, tokensAndOwners }); -} - -async function tvl_ethereum(api) { - const balances = {}; + const [token0s, token1s, aums] = await Promise.all([ + api.multiCall({ abi: "address:token0", calls: lpManagers, permitFailure: true }), + api.multiCall({ abi: "address:token1", calls: lpManagers, permitFailure: true }), + api.multiCall({ abi: "function aum() returns (uint256 amount0, uint256 amount1)", calls: lpManagers, permitFailure: true }) + ]) - const leftoverStrategy = await sdk.api.erc20 - .balanceOf({ - target: addresses.tokens.aura, - owner: addresses.aura.strategy, + lpManagers.forEach((_lp, i) => { + const token0 = token0s[i] + const token1 = token1s[i] + const aum = aums[i] + if (!token0 || !token1 || !aum) return + api.add(token0, aum.amount0) + api.add(token1, aum.amount1) }) - .then((result) => result.output); - sdk.util.sumSingleBalance(balances, addresses.tokens.aura, leftoverStrategy); + } - const lockedBalance = await sdk.api.abi - .call({ - abi: lockerABI.at(0), - target: addresses.aura.locker, - params: addresses.aura.strategy, - }) - .then((result) => result.output[0]); - sdk.util.sumSingleBalance(balances, addresses.tokens.aura, lockedBalance); + return sumTokens2({ api, tokensAndOwners }); +} - return balances; +async function tvl_ethereum(api) { + const [leftoverStrategy, total] = await Promise.all([ + api.call({ target: addresses.tokens.aura, params: [addresses.aura.strategy], abi: 'erc20:balanceOf' }), + api.call({ target: addresses.aura.locker, params: [addresses.aura.strategy], abi: abi.locker }).then(res => res.total) + ]); + + [leftoverStrategy, total].forEach((bals) => { + api.add(addresses.tokens.aura, bals) + }); } + module.exports = { arbitrum: { - tvl, + tvl: tvl_arbitrum, + staking: stakings(addresses.stakingContracts, addresses.tokens.jones, "arbitrum"), pool2: pool2s(addresses.lpStaking, addresses.lps, "arbitrum", (addr) => { addr = addr.toLowerCase(); return `arbitrum:${jAssetToAsset[addr] ?? addr}`; }), - staking: stakings(addresses.stakingContracts, addresses.tokens.jones, "arbitrum"), }, ethereum: { tvl: tvl_ethereum, }, }; -// node test.js projects/jones-dao/index.js diff --git a/projects/joule/index.js b/projects/joule/index.js new file mode 100644 index 000000000000..bdbcff59f96a --- /dev/null +++ b/projects/joule/index.js @@ -0,0 +1,43 @@ +const { getResource } = require("../helper/chain/aptos") + +const CONTRACT_ADDRESS = "0x2fe576faa841347a9b1b32c869685deb75a15e3f62dfe37cbd6d52cc403a16f6" + +function replaceAtWith0x(str) { + if (str.startsWith('@')) { + return '0x' + str.slice(1); + } else { + return str; + } +} + +async function getPoolsData() { + const res = await getResource("0x7f83b020b8ab60dbdc4208029fa6aa0804bf5a71eeaca63382d24622b9e6f647", `${CONTRACT_ADDRESS}::pool::PoolConfigsMap`) + + const poolConfigsMap = res.pool_configs_map.data; + + return poolConfigsMap.map(item => ({ + coin: replaceAtWith0x(item.key), + total_lend: item.value.total_lend, + total_borrow: item.value.total_borrow + })); +} + +module.exports = { + timetravel: false, + methodology: + "Aggregates TVL for all markets in Joule.", + aptos: { + tvl: async (api) => { + const marketsData = await getPoolsData() + marketsData.forEach(({ coin, total_lend }) => { + api.add(coin, total_lend) + }) + }, + borrowed: async (api) => { + const marketsData = await getPoolsData() + marketsData.forEach(({ coin, total_borrow }) => { + api.add(coin, total_borrow) + }) + }, + } +}; diff --git a/projects/jpeg-d/index.js b/projects/jpeg-d/index.js index 7e4e67ed8423..7b86f1c40adf 100644 --- a/projects/jpeg-d/index.js +++ b/projects/jpeg-d/index.js @@ -12,17 +12,7 @@ module.exports = { hallmarks: [ [1666003500, "pETH borrows"], [1669551000, "JPEG LTV boost"], - [1670518800, "APE staking"], - [1674669600, "Autoglyphs & Fidenza support"], - [1675166400, "Ringers & Chromie Squiggle support"], - [1675598400, "70% LTV for CryptoPunks & BAYC"], - [1678665600, "Otherdeeds support"], - [1678665600, "Meebits support"], - [1679529600, "BAKC support"], - [1683662400, "P2P Ape Staking"], - [1684108800, "Milady support"], [1690730000, "pETH-ETH Curve pool drained"], - [1692651600, "pETH-WETH relaunch"], [1694680200, "pETH Citadel relaunch"], ], }; diff --git a/projects/jumpdefi/index.js b/projects/jumpdefi/index.js index b75f250f770b..ead26216fd4a 100644 --- a/projects/jumpdefi/index.js +++ b/projects/jumpdefi/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require("../helper/unknownTokens"); -module.exports = uniTvlExport("telos", "0xff59EBFf3e3F72E8162eA2aB0a0d1C9258692dF5", { fetchBalances: true }); +module.exports = uniTvlExport("telos", "0xff59EBFf3e3F72E8162eA2aB0a0d1C9258692dF5"); diff --git a/projects/jupSOL/index.js b/projects/jupSOL/index.js new file mode 100644 index 000000000000..ad1870130917 --- /dev/null +++ b/projects/jupSOL/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('8VpRhuxa7sUUepdY3kQiTmX9rS5vx4WgaXiAnXq4KCtr', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/justlend.js b/projects/justlend.js index ca90788a59f5..33547deab2e0 100644 --- a/projects/justlend.js +++ b/projects/justlend.js @@ -1,6 +1,44 @@ -const { compoundExports2 } = require('./helper/compound') +const { unhexifyTarget, } = require('@defillama/sdk/build/abi/tron'); const ADDRESSES = require('./helper/coreAssets.json') +const { sumTokens } = require('./helper/sumTokens') + +const comptroller = 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7' module.exports = { - tron: compoundExports2({ comptroller: 'TGjYzgCyPobsNS9n6WcbdLVR9dH7mWqFx7', cether: '0x2c7c9963111905d29eb8da37d28b0f53a7bb5c28', cetheEquivalent: ADDRESSES.null, transformAdressRaw: i => 'tron:' + i }), + tron: { + tvl, borrowed, + }, }; + +async function tvl(api) { + const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(unhexifyTarget) + const cMarkets = ['TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP'] + const tokensAndOwners = [] + const otherMarkets = [] + for (let i = 0; i < markets.length; i++) { + if (cMarkets.includes(markets[i])) { + tokensAndOwners.push([ADDRESSES.null, markets[i]]) + } else + otherMarkets.push(markets[i]) + } + + const underlyings = await api.multiCall({ abi: 'address:underlying', calls: otherMarkets }) + underlyings.forEach((t, i) => tokensAndOwners.push([t, otherMarkets[i]])) + return sumTokens({ chain: 'tron', tokensAndOwners }) +} + +async function borrowed(api) { + const markets = (await api.call({ abi: 'address[]:getAllMarkets', target: comptroller })).map(unhexifyTarget) + const cMarkets = ['TE2RzoSV3wFK99w6J9UnnZ4vLfXYoxvRwP'] + const otherMarkets = [] + for (let i = 0; i < markets.length; i++) { + if (!cMarkets.includes(markets[i])) + otherMarkets.push(markets[i]) + } + + const underlyings = await api.multiCall({ abi: 'address:underlying', calls: otherMarkets }) + const uBorrowed = await api.multiCall({ abi: 'uint256:totalBorrows', calls: otherMarkets }) + const cBorrowed = await api.multiCall({ abi: 'uint256:totalBorrows', calls: cMarkets }) + api.add(underlyings, uBorrowed) + api.add(ADDRESSES.null, cBorrowed) +} diff --git a/projects/jvault/index.js b/projects/jvault/index.js new file mode 100644 index 000000000000..260a6a9aeba4 --- /dev/null +++ b/projects/jvault/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { fetchURL } = require('../helper/utils'); + +async function staking(api) { + + // API is used to get all vaults and their TVLs to avoid scan of all blockchain for matching vaults + // also Jettons values are converted to TON using DEXs prices + const response = await fetchURL("https://jvault.xyz/staking/stake?type=json") + for (const pool of response.data.pools) { + api.add(ADDRESSES.ton.TON, pool.ton_tvl * 1e9) + } +} + + +module.exports = { + methodology: 'Counts balances of all tokens based on DEXs prices in all vaults.', + timetravel: false, + ton: { + tvl: () => ({}), + staking, + } +} diff --git a/projects/k9-finance/index.js b/projects/k9-finance/index.js new file mode 100644 index 000000000000..7c8e195d0b4f --- /dev/null +++ b/projects/k9-finance/index.js @@ -0,0 +1,59 @@ +const { sumUnknownTokens } = require("../helper/unknownTokens"); + +const vestingSettingsAbi = "function settings() view returns (bool lockedOnly, uint64 backingRatio, uint64 vestingRatio, uint64 vestingPeriod)" + +const BONE_TOKEN = "0x9813037ee2218799597d83D4a5B6F3b6778218d9"; +const BONE_CONTRACT = "0x3358FCA51d7C0408750FBbE7777012E0b67C027F"; + +const REAL_YIELD_STAKING = "0xe13824Fb7b206E585c775B30431600528572C3E7"; +const KNINE_TOKEN = "0x91fbB2503AC69702061f1AC6885759Fc853e6EaE"; + +const FARMING_FABRIC = "0x8ed1A7c4736b5835560b0f9E961B8E3581774D42"; + +const VESTING = "0xf7384ba80A51979eC8cc0F17a843089ffD706f0a"; + +async function tvl(api) { + const bonesBalance = await api.call({ abi: "uint256:getTotalPooledBONE", target: BONE_CONTRACT, }); + // api.addToken(BONE_TOKEN, bonesBalance); + api.addCGToken('bone-shibaswap', bonesBalance / 1e18) +} + +async function pool2(api) { + const poolsAddresses = await api.call({ abi: "address[]:getAllCreatedPools", target: FARMING_FABRIC, }); + + const tokens = await api.multiCall({ abi: "address:pool", calls: poolsAddresses, }); + const bals = await api.multiCall({ abi: "uint256:intermediate", calls: poolsAddresses, }); + api.add(tokens, bals) + return sumUnknownTokens({ api, lps: tokens, useDefaultCoreAssets: true, resolveLP: true, }) +} + +async function vesting(api) { + const vestingSettings = await api.call({ abi: vestingSettingsAbi, target: VESTING, }); + const esKNINEAddress = await api.call({ abi: "address:esKNINE", target: VESTING, }); + + const esKNINEBalance = await api.call({ abi: "erc20:balanceOf", target: esKNINEAddress, params: VESTING, }); + const vestingRatio = vestingSettings[2]; + + const KNINEAmount = esKNINEBalance * vestingRatio / 100 + api.addToken(KNINE_TOKEN, KNINEAmount); + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: ['0xF3452bCdEcaDa5E08ce56EC3D2BF8e35ECFFFF91'], }) +} +async function staking(api) { + const bal = await api.call({ abi: "erc20:balanceOf", target: KNINE_TOKEN, params: REAL_YIELD_STAKING, }); + + api.addToken(KNINE_TOKEN, bal); + return sumUnknownTokens({ api, useDefaultCoreAssets: true, lps: ['0xF3452bCdEcaDa5E08ce56EC3D2BF8e35ECFFFF91'],}) +} + +module.exports = { + methodology: + "Counts the liquidity locked inside the K9 Finance DAO protocol, including: the BONE amount locked at the Liquid Staking, the KNINE amount locked at the Real Yield Staking, the KNINE amount locked at the Vesting, the LP tokens locked at the Farming.", + ethereum: { + tvl, + }, + shibarium: { + staking, + pool2, + vesting, + }, +}; diff --git a/projects/kai/index.js b/projects/kai/index.js index 6cccb37455eb..cd9c63b41dd9 100644 --- a/projects/kai/index.js +++ b/projects/kai/index.js @@ -1,11 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') const sui = require("../helper/chain/sui"); -const UsdcVault = { +const wUsdcVault = { id: '0x7a2f75a3e50fd5f72dfc2f8c9910da5eaa3a1486e4eb1e54a825c09d82214526', tType: ADDRESSES.sui.USDC } -const UsdtVault = { +const wUsdtVault = { id: '0x0fce8baed43faadf6831cd27e5b3a32a11d2a05b3cd1ed36c7c09c5f7bcb4ef4', tType: ADDRESSES.sui.USDT } @@ -13,9 +13,13 @@ const SuiVault = { id: '0x16272b75d880ab944c308d47e91d46b2027f55136ee61b3db99098a926b3973c', tType: ADDRESSES.sui.SUI } +const UsdcVault = { + id: '0x5663035df5f403ad5a015cc2a3264de30370650bc043c4dab4d0012ea5cb7671', + tType: ADDRESSES.sui.USDC_CIRCLE +} async function tvl(api) { - const vaults = [UsdcVault, UsdtVault, SuiVault] + const vaults = [wUsdcVault, wUsdtVault, SuiVault, UsdcVault] const vaultObjs = await sui.getObjects(vaults.map(v => v.id)) for (let i = 0; i < vaults.length; i++) { diff --git a/projects/kaiafun/index.js b/projects/kaiafun/index.js new file mode 100644 index 000000000000..9d220060dad0 --- /dev/null +++ b/projects/kaiafun/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); + +// Canonical WKLAY +const WKLAY = '0x19aac5f612f524b754ca7e7c41cbfa2e981a4432'; + +module.exports.klaytn = { + start: 165171284, + methodology: 'TVL counts Canonical WKLAY coins in KaiaFun\'s Core Contract.', + tvl: sumTokensExport({ + owners: ["0x080f8b793fe69fe9e65b5ae17b10f987c95530bf"], + tokens: [WKLAY] + }), +}; diff --git a/projects/kalax/index.js b/projects/kalax/index.js index ed945f180c71..79466e4f9902 100644 --- a/projects/kalax/index.js +++ b/projects/kalax/index.js @@ -1,30 +1,75 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/unwrapLPs") -const KALAX = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D" -const farms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5',"0x1CB8f6cecf7c8FBB9863417f8371Cb2A076C9115"] +const blastKalax = "0x2F67F59b3629Bf24962290DB9edE0CD4127e606D" +const blastfarms = ['0xE63153C3360aCa0F4e7Ca7A1FC61c2215FAEF5A1', '0xFe899401A1d86cC1113020fb40878c76239142a5',"0x1CB8f6cecf7c8FBB9863417f8371Cb2A076C9115"] +const scrollKalax = "0x1f4F171676f8cb3B1C3FD38867B3B160679F934A" +const scrollFarms = ['0xB99AeDd16714A7393768273F9AbFF4C4F48980eD'] async function tvl(api) { + let farms = api.chain === 'blast'?blastfarms:scrollFarms + let kalax = api.chain === 'blast'?blastKalax:scrollKalax + 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)) + if(api.chain === 'blast'){ + pools + .filter((i) => i.assets !== kalax) + .forEach((i) => api.add(i.assets, i.tvl)) + }else{ + pools + .filter((i) => i.assets !== kalax) + .forEach((i)=>{ + if(i.assets === ADDRESSES.linea.WETH_1){ + i.assets =ADDRESSES.null + } + api.add(i.assets, i.tvl) + }) + } return sumTokens2({ api, resolveLP: true }) } + +const usdt = ADDRESSES.scroll.USDT +const scrollKalaLp = "0x4fc09BE6eB49764CcAE4e95Bd2B93f67a34c0188" async function staking(api) { + let farms = api.chain === 'blast'?blastfarms:scrollFarms + let kalax = api.chain === 'blast'?blastKalax:scrollKalax + 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)) + if(api.chain === 'blast'){ + pools.filter((i) => i.assets === kalax).forEach((i) => api.add(i.assets, i.tvl)) + }else{ + let pool = pools.find(i=>i.assets === kalax) + let poolTvl = pool.tvl + let sqrtPriceX96 =await api.call({ + abi:abiInfo.state, + target:scrollKalaLp + }) + let p = (sqrtPriceX96 / 2 ** 96) ** 2 + let rate = p * 10**12 + let usdtNum = poolTvl/10**18 * rate * 10**6 + api.add(usdt,usdtNum) + } } module.exports = { + hallmarks:[ + [1728777600,'Rugpull'] + ], blast: { tvl, staking, }, + scroll:{ + tvl, + staking + } } const abiInfo = { poolInfos: "function getPoolTotalTvl() view returns (tuple(uint256 pid, address assets, uint256 tvl)[])", + state: + "function state()external view returns(uint160 sqrtPrice_96)" } diff --git a/projects/kamino/api.js b/projects/kamino/api.js index 29a30ff91268..c0c58e761c91 100644 --- a/projects/kamino/api.js +++ b/projects/kamino/api.js @@ -1,4 +1,4 @@ -const { Kamino } = require('@hubbleprotocol/kamino-sdk') +const { Kamino } = require('@kamino-finance/kliquidity-sdk') const { getConnection, } = require('../helper/solana') async function tvl() { diff --git a/projects/kannagi-finance/index.js b/projects/kannagi-finance/index.js index 5e3dc9686dd7..26c9249b8c50 100644 --- a/projects/kannagi-finance/index.js +++ b/projects/kannagi-finance/index.js @@ -35,4 +35,5 @@ helperReturn.era.tvl = tvlFunWrapper return helperReturn; } -module.exports = {...yieldHelperWrapper(), hallmarks:[[1690589340, "Rug"]]} +module.exports = {...yieldHelperWrapper(), hallmarks:[[1690589340, "Rug"]]}, +module.exports.deadFrom='2023-07-29' diff --git a/projects/kapinus/index.js b/projects/kapinus/index.js index 601109737aa0..6a2d5369cab5 100644 --- a/projects/kapinus/index.js +++ b/projects/kapinus/index.js @@ -7,7 +7,6 @@ module.exports = { factory: '0x70e881fa43a7124e36639b54162395451cef1922', abi: 'uint256:allPairs', useDefaultCoreAssets: true, - fetchBalances: true, }) }, }; diff --git a/projects/karak/index.js b/projects/karak/index.js index 4596dcbd6e4d..b3e20d84828c 100644 --- a/projects/karak/index.js +++ b/projects/karak/index.js @@ -1,21 +1,38 @@ +const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require("../helper/unwrapLPs") const config = { - ethereum: { factory: '0x54e44dbb92dba848ace27f44c0cb4268981ef1cc', }, - arbitrum: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad', }, - karak: { factory: '0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C', }, - mantle: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, - bsc: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD', }, - blast: { factory: '0x58b5dc145ca2BE84fe087614CFe36055be609BB3', }, + ethereum: { v1: { factory: '0x54e44dbb92dba848ace27f44c0cb4268981ef1cc' }, v2: { factory: '0x7A91498D5fA6705d35c9406b752d6D50f49C9510', block: 21189340 }}, + arbitrum: { v1: { factory: '0x399f22ae52a18382a67542b3de9bed52b7b9a4ad' }, v2: { factory: '0xc4B3D494c166eBbFF9C716Da4cec39B579795A0d', block: 261874079 }}, + karak: { v1: { factory:'0xB308474350D75447cA8731B7Ce87c9ee9DA03B1C' }, v2: { factory: '0x1368AE21e85c9FA25f1aB579b6D3C6e20Ad6db04', block: 13814008 }}, + mantle: { v1: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD'}, v2: { factory: '0x993E140Ba530E8Ffe1135ecef07ce7484f26CAA3', block: 71616200 }}, + bsc: { v1: { factory: '0x4a2b015CcB8658998692Db9eD4522B8e846962eD'}, v2: { factory: '0x93036971877E084DD303463628494c150572856D', block: 43813383 }}, + blast: { v1: { factory: '0x58b5dc145ca2BE84fe087614CFe36055be609BB3'} }, + fraxtal: { v1: { factory: '0xdF922c74CC0dc394022ea002Af5aFaa32348670e'}, v2: { factory: '0x04962047B6a9E8c99C8Da874D34c4285a87d541E', block: 11669871 } }, +} + +const eventAbi = 'event DeployedVault(address operator, address vault, address asset)' + +const karak_v1_tvl = async (api, { factory }) => { + const vaults = await api.call({ abi: 'address[]:getVaults', target: factory }) + const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) +} + +const karak_v2_tvl = async (api, { factory, block }) => { + const logs = await getLogs2({ api, target: factory, fromBlock: block, eventAbi }) + const vaults = logs.map(log => log[1]) + const tokens = logs.map(log => log[2]) + return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) +} + +const tvl = async (api, factories) => { + const { v1, v2 } = factories + if (v1) await karak_v1_tvl(api, v1) + if (v2) await karak_v2_tvl(api, v2) } Object.keys(config).forEach(chain => { - const { factory, } = config[chain] - module.exports[chain] = { - tvl: async (api) => { - const vaults = await api.call({ abi: 'address[]:getVaults', target: factory }) - const tokens = await api.multiCall({ abi: 'address:asset', calls: vaults }) - return sumTokens2({ api, tokensAndOwners2: [tokens, vaults] }) - } - } + const factories = config[chain] + module.exports[chain] = { tvl: (api) => tvl(api, factories) } }) diff --git a/projects/kayak-uni-v3/index.js b/projects/kayak-uni-v3/index.js new file mode 100644 index 000000000000..9ed424e05f15 --- /dev/null +++ b/projects/kayak-uni-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + scroll: { factory: '0x359d8BC3c4C70b8b73cf911aA5EfEC004146b663', fromBlock: 8564317, }, +}) diff --git a/projects/kayak/index.js b/projects/kayak/index.js index 9227635cfa69..3204e9d4f33c 100644 --- a/projects/kayak/index.js +++ b/projects/kayak/index.js @@ -2,7 +2,8 @@ const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') const config = { - avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, } + avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, }, + scroll: { factory: '0xA218beD0C2b487599A3799Bc318428e5219A7978', fromBlock: 8563591, }, } Object.keys(config).forEach(chain => { diff --git a/projects/kdlaunch/index.js b/projects/kdlaunch/index.js index d1c4dd306851..2da059a049bf 100644 --- a/projects/kdlaunch/index.js +++ b/projects/kdlaunch/index.js @@ -1,40 +1,12 @@ const { fetchLocal, mkMeta } = require("../helper/pact"); const network = (chainId) => `https://api.chainweb.com/chainweb/0.0/mainnet01/chain/${chainId}/pact`; -const GAS_PRICE = 0.00000001; const creationTime = () => Math.round(new Date().getTime() / 1000) - 10; const getReserve = (tokenData) => { return parseFloat(tokenData.decimal ? tokenData.decimal : tokenData); } -const getTokenToKadena = async (token) => { - const chainId = '3'; - let data = await fetchLocal({ - pactCode: ` - (use free.exchange) - (let* - ( - (p (get-pair ${token} coin)) - (reserveA (reserve-for p ${token})) - (reserveB (reserve-for p coin)) - )[reserveA reserveB]) - `, - meta: mkMeta("account", chainId, GAS_PRICE, 3000, creationTime(), 600), - }, network(chainId)); - - if (data.result.status === "success") { - const tokenReserve = getReserve(data.result.data[0]); - const kadenaReserve = getReserve(data.result.data[1]); - return kadenaReserve / tokenReserve; - } - - throw new Error(`Kadena fetch failed`); -} - -const fetchKdlPrice = async () => { - return await getTokenToKadena("kdlaunch.token"); -} const getTotalStakedKdl = async () => { const chainId = '1'; @@ -54,10 +26,9 @@ const getTotalStakedKdl = async () => { } async function fetchStakingTvl() { - const kdlPrice = await fetchKdlPrice(); const stakedKdl = await getTotalStakedKdl(); return { - kadena: stakedKdl * kdlPrice + kdlaunch: stakedKdl } } diff --git a/projects/keep3r/index.js b/projects/keep3r/index.js index 1c0b7e2ce049..8bbbffe31d5a 100644 --- a/projects/keep3r/index.js +++ b/projects/keep3r/index.js @@ -1,99 +1,53 @@ -const sdk = require("@defillama/sdk"); - const abis = require("./abis.js").abis; const registry = require("./registry.js").registry; -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -async function staking(_timestamp, block) { - const { KP3R, VKP3R } = registry; - const balances = {}; - - await sumTokensAndLPsSharedOwners(balances, [[KP3R, false]], [VKP3R], block); +const { staking } = require('../helper/staking'); +const { sumTokens2 } = require("../helper/unwrapLPs.js"); - // @dev should return stakingTvl - return balances; -} - -async function borrowed(_timestamp, block) { - /** @type {Balances} */ - const balances = {}; +async function borrowed(api) { const cyTokens = Object.values(registry.cTokens); - const { output: borrowed } = await sdk.api.abi.multiCall({ - block: block, - calls: cyTokens.map((coin) => ({ - target: coin, - })), - abi: abis.totalBorrows, - }); + const borrowed = await api.multiCall({ calls: cyTokens, abi: abis.totalBorrows, }); const ib = Object.values(registry.ibTokens); for (const idx in borrowed) { - sdk.util.sumSingleBalance( - balances, - ib[idx].toLowerCase(), - borrowed[idx].output - ); + api.add(ib[idx], borrowed[idx]) } - - return balances; } -async function tvl(_timestamp, block) { - /** @type {Balances} */ - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [registry.CVX, false], - [registry.DAI, false], - [registry.KP3R, false], - [registry.SUSHI, false], - [registry.CRV, false], - [registry.CVXCRV, false], - [registry.SPELL, false], - [registry.WETH, false], - ].concat( - [ - [registry.KPR_WETH_SUSHI_POOL, false], - [registry.USDC_ibAUD_POOL, false], - [registry.USDC_ibEUR_POOL, false], - [registry.USDC_ibKRW_POOL, false], - [registry.USDC_ibJPY_POOl, false], - [registry.USDC_ibGBP_POOL, false], - [registry.USDC_ibCHF_POOL, false], - ], - Object.values(registry.ibTokens).map((t) => [t, false]) - ), - [registry.YEARN_DEPLOYER, registry.BOND_TREASURY].concat( +async function tvl(api) { + const tokens = [ + registry.CVX, + registry.DAI, + registry.KP3R, + registry.SUSHI, + registry.CRV, + registry.CVXCRV, + registry.SPELL, + registry.WETH, + registry.KPR_WETH_SUSHI_POOL, + registry.USDC_ibAUD_POOL, + registry.USDC_ibEUR_POOL, + registry.USDC_ibKRW_POOL, + registry.USDC_ibJPY_POOl, + registry.USDC_ibGBP_POOL, + registry.USDC_ibCHF_POOL, + ].concat(Object.values(registry.ibTokens)) + + await api.sumTokens({ + tokens, owners: [registry.YEARN_DEPLOYER, registry.BOND_TREASURY].concat( Object.values(registry.cTokens), Object.values(registry.ibCrvGauges) ), - block - ); - - await sumTokensAndLPsSharedOwners( - balances, - Object.values(registry.Kp3rV2Klps).map((t) => [t, false]), - [registry.KP3RV2], - block - ); - - await sumTokensAndLPsSharedOwners( - balances, - Object.values(registry.Kp3rV1Slps).map((t) => [t, false]), - [registry.KP3R], - block - ); - - return balances; + }) + await api.sumTokens({ tokens: Object.values(registry.Kp3rV2Klps), owner: registry.KP3RV2, }) + await api.sumTokens({ tokens: Object.values(registry.Kp3rV1Slps), owner: registry.KP3R, }) + return sumTokens2({ api, resolveLP: true, }) } module.exports = { ethereum: { tvl, - staking, + staking: staking(registry.VKP3R, registry.KP3R), borrowed }, }; diff --git a/projects/kefirswap/index.js b/projects/kefirswap/index.js index a459ae97e6b3..cdd05b8a8ae0 100644 --- a/projects/kefirswap/index.js +++ b/projects/kefirswap/index.js @@ -9,6 +9,7 @@ module.exports = { hallmarks: [ [1656806400, "Rug Pull"] ], + deadFrom: '2022-07-03', methodology: "Count TVL as liquidity on the dex", misrepresentedTokens: true, kava: { diff --git a/projects/kelp-dao/index.js b/projects/kelp-dao/index.js index 806e3ee6714b..607e09eb1c16 100644 --- a/projects/kelp-dao/index.js +++ b/projects/kelp-dao/index.js @@ -1,14 +1,49 @@ +const sdk = require('@defillama/sdk') const DEPOSIT_POOL = "0x036676389e48133B63a802f8635AD39E752D375D"; +const rstETH = '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7' + +const oft_tokens = { + 'arbitrum' : '0x4186BFC76E2E237523CBC30FD220FE055156b41F', + 'optimism' : '0x4186BFC76E2E237523CBC30FD220FE055156b41F', + 'manta' : '0x4186BFC76E2E237523CBC30FD220FE055156b41F', + 'mode' : '0x4186BFC76E2E237523CBC30FD220FE055156b41F', + 'blast' : '0x4186BFC76E2E237523CBC30FD220FE055156b41F', + 'scroll' : '0x65421ba909200b81640d98B979d07487C9781B66', + 'base' : '0x1Bc71130A0e39942a7658878169764Bbd8A45993', + 'era' : '0xd4169E045bcF9a86cC00101225d9ED61D2F51af2', + 'linea' : '0xD2671165570f41BBB3B0097893300b6EB6101E6C', + 'xlayer' : '0x5a71f5888ee05b36ded9149e6d32ee93812ee5e9', +} async function tvl(api) { + const supplies = await oft_supplies(api) const config = await api.call({ abi: 'address:lrtConfig', target: DEPOSIT_POOL}) - const tokens= await api.call({ abi: 'address[]:getSupportedAssetList', target: config}) + const tokens = await api.call({ abi: 'address[]:getSupportedAssetList', target: config}) const bals = await api.multiCall({ abi: 'function getTotalAssetDeposits(address) external view returns (uint256)', calls: tokens, target: DEPOSIT_POOL}) api.addTokens(tokens, bals); + api.addTokens(rstETH, - supplies) // We subtract the rstETH oft on other chains from ethereum chain to avoid double counting once bridged return api.getBalances() } + +const oft_tvls = async (api, oft) => { + const oft_supply = await api.call({ abi: 'erc20:totalSupply', target: oft}) + api.add(rstETH, oft_supply, { skipChain: true }) +} + +const oft_supplies = async (api) => { + const totalSupplies = await Promise.all( + Object.keys(oft_tokens).map(async (chain) => { + const chainApi = new sdk.ChainApi({ chain, timestamp: api.timestamp}) + // await chainApi.getBlock() + return chainApi.call({ abi: 'erc20:totalSupply', target: oft_tokens[chain] }); + }) + ); + return totalSupplies.reduce((sum, value) => sum + Number(value), 0); +} + module.exports = { + timetravel: false, doublecounted: true, methodology: "deposited LSTs in deposit pool, node delegator contracts and from them into eigenlayer strategy contracts", @@ -16,3 +51,13 @@ module.exports = { tvl, }, }; + +Object.keys(oft_tokens).forEach((chain) => { + const contract = oft_tokens[chain]; + module.exports[chain] = { + tvl: async (api) => oft_tvls(api, contract), + }; +}); + + + diff --git a/projects/kelp-gain/index.js b/projects/kelp-gain/index.js new file mode 100644 index 000000000000..02aeab10953e --- /dev/null +++ b/projects/kelp-gain/index.js @@ -0,0 +1,9 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + doublecounted: true, + methodology: "TVL corresponds to the sum of rsETH from all active loans managed by the pool and the rsETH balance held within the pool.", + ethereum: { + tvl: sumERC4626VaultsExport({ vaults: ['0xe1b4d34e8754600962cd944b535180bd758e6c2e'], isOG4626: true }), + }, +} diff --git a/projects/kewl/index.js b/projects/kewl/index.js index 90684e422586..2a18513e6055 100644 --- a/projects/kewl/index.js +++ b/projects/kewl/index.js @@ -9,7 +9,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xA0BB8f9865f732C277d0C162249A4F6c157ae9D0", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/kiloex/index.js b/projects/kiloex/index.js index 20e21e32fe3e..057ded5fa8fa 100644 --- a/projects/kiloex/index.js +++ b/projects/kiloex/index.js @@ -1,23 +1,66 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unwrapLPs"); -const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356"]; -const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46"]; +const owners = ["0x1c3f35F7883fc4Ea8C4BCA1507144DC6087ad0fb", "0xfE03be1b0504031e92eDA810374222c944351356","0xef7aF0804AAB3885da59a8236fabfA19DDc6Cf48"]; +const opbnb_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x1Bc6F42D6D1680115A52F82DFA29265085E91d93"]; const manta_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46", "0x471C5e8Cc0fEC9aeeb7ABA6697105fD6aaaDFf99","0xa10f74374b8bE9E9C8Fb62c1Dc17B8D4247E332A"]; const manta_stone_token = "0xEc901DA9c68E90798BbBb74c11406A32A70652C3"; const manat_manta_token = "0x95CeF13441Be50d20cA4558CC0a27B601aC544E5"; -const taiko_owners = ["0x735D00A9368164B9dcB2e008d5Cd15b367649aD5", "0x235C5C450952C12C8b815086943A7bBCF96bc619"]; +const taiko_owners = ["0x735D00A9368164B9dcB2e008d5Cd15b367649aD5", "0x235C5C450952C12C8b815086943A7bBCF96bc619","0x2646E743A8F47b8d2427dBcc10f89e911f2dBBaa"]; +const bsquared_owners = ["0xA2E2F3726DF754C1848C8fd1CbeA6aAFF84FC5B2", "0x1EbEd4024308afcb05E6938eF8Ebd1ec5d6E8C46","0xB20Faa4BA0DdEbDe49299557f4F1ebB5532745e3"]; +const base_owners = ["0x43E3E6FFb2E363E64cD480Cbb7cd0CF47bc6b477", "0x7BC8D56cC78cF467C7230B77De0fcBDea9ac44cE","0xdf5ACC616cD3ea9556EC340a11B54859a393ebBB"]; module.exports = { start: 1690971144, - bsc: { tvl: sumTokensExport({ owners, tokens: [ADDRESSES.bsc.USDT], }) }, + bsc: { tvl: sumTokensExport({ owners, tokens: [ + ADDRESSES.bsc.USDT, ADDRESSES.ethereum.FDUSD, ADDRESSES.scroll.STONE, + ADDRESSES.bsc.WBNB, //WBNB + '0xba2ae424d960c26247dd6c32edc70b295c744c43', //DOGE + ADDRESSES.bsc.BTCB, //BTCB + '0xb0b84d294e0c75a6abe60171b70edeb2efd14a1b',//slisBNB + '0x0782b6d8c4551b9760e74c0545a9bcd90bdc41e5',//lisUSD + ADDRESSES.bsc.USDC, //usdc + '0xf6718b2701d4a6498ef77d7c152b2137ab28b8a3', //stBTC + '0x4aae823a6a0b376de6a78e74ecc5b079d38cbcf7', //SolvBTC + ], }) }, op_bnb: { - tvl: sumTokensExport({ owners: opbnb_owners, tokens: [ADDRESSES.op_bnb.USDT] }) + tvl: sumTokensExport({ owners: opbnb_owners, tokens: [ + ADDRESSES.op_bnb.USDT, + ADDRESSES.base.DAI, //FDUSD + ADDRESSES.optimism.WETH_1, //WBNB + ADDRESSES.defiverse.USDC, //BTCB + ADDRESSES.defiverse.ETH, //ETH + + ] }) }, manta: { - tvl: sumTokensExport({ owners: manta_owners, tokens: [ADDRESSES.manta.USDT, manta_stone_token, manat_manta_token] }) + tvl: sumTokensExport({ owners: manta_owners, tokens: [ + ADDRESSES.manta.USDT, manta_stone_token, manat_manta_token, + '0x7746ef546d562b443ae4b4145541a3b1a3d75717', //vMANTA + ADDRESSES.manta.USDC, //USDC + ] }) }, taiko: { - tvl: sumTokensExport({ owners: taiko_owners, tokens: [ADDRESSES.taiko.USDC] }) + tvl: sumTokensExport({ owners: taiko_owners, tokens: [ + ADDRESSES.taiko.USDC, + ADDRESSES.taiko.USDC_e, //USDC.e + ] }) + }, + bsquared: { + tvl: sumTokensExport({ owners: bsquared_owners, tokens: [ + ADDRESSES.bsquared.USDT, + ADDRESSES.bsquared.USDC, //USDC + ADDRESSES.bsquared.BSTONE, //BSTONE + ADDRESSES.bsquared.UBTC,//uBTC + ] }) + }, + base: { + tvl: sumTokensExport({ owners: base_owners, tokens: [ + ADDRESSES.base.USDC, //USDC + '0x3b86ad95859b6ab773f55f8d94b4b9d443ee931f', //SolvBTC + '0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf',//cbBTC + '0x04c0599ae5a44757c0af6f9ec3b93da8976c150a',//weETH + '0xc1cba3fcea344f92d9239c08c0568f6f2f0ee452',//wstETH + ] }) }, }; diff --git a/projects/kinetix-v2/index.js b/projects/kinetix-v2/index.js index b8c1fa524f37..e954dd1f3604 100644 --- a/projects/kinetix-v2/index.js +++ b/projects/kinetix-v2/index.js @@ -6,14 +6,12 @@ module.exports = { tvl: getUniTVL({ factory: "0xE8E917BC80A26CDacc9aA42C0F4965d2E1Fa52da", useDefaultCoreAssets: true, - 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 4f26b6b52c7c..8361c26f38dc 100644 --- a/projects/kinetix-v3/index.js +++ b/projects/kinetix-v3/index.js @@ -1,12 +1,16 @@ -const { uniV3Export } = require("../helper/uniswapV3"); +const { uniV3GraphExport } = require('../helper/uniswapV3') -module.exports = uniV3Export({ +module.exports = { kava: { - factory: "0x2dBB6254231C5569B6A4313c6C1F5Fe1340b35C2", - fromBlock: 6069472, + tvl: uniV3GraphExport({ + graphURL: 'https://kava-graph-node.metavault.trade/subgraphs/name/kinetixfi/v3-subgraph', + name: 'kinetixfi/kava-v3', + }) }, base: { - factory: "0xdDF5a3259a88Ab79D5530eB3eB14c1C92CD97FCf", - fromBlock: 14195510, - }, -}); + tvl: uniV3GraphExport({ + graphURL: 'https://api.studio.thegraph.com/query/55804/kinetixfi-base-v3/version/latest', + name: 'kinetixfi/base-v3', + }) + } +} diff --git a/projects/kinetix/index.js b/projects/kinetix/index.js index d6e0c167622d..062d667e7cb5 100644 --- a/projects/kinetix/index.js +++ b/projects/kinetix/index.js @@ -1,7 +1,12 @@ const { gmxExports } = require('../helper/gmx') +const { staking } = require('../helper/staking'); + +const KAI_ADDRESS_KAVA = "0x52369B1539EA8F4e1eadEEF18D85462Dcf9a3658" +const veKAI_ADDRESS_KAVA = "0x2A0A26D08E2F7A8E86431Ddf6910Fe7cD59b9908" module.exports = { kava: { - tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }) + tvl: gmxExports({ vault: "0xa721f9f61CECf902B2BCBDDbd83E71c191dEcd8b", }), + staking: staking(veKAI_ADDRESS_KAVA, KAI_ADDRESS_KAVA), }, }; \ No newline at end of file diff --git a/projects/kittypunch/index.js b/projects/kittypunch/index.js new file mode 100644 index 000000000000..013a8ba469de --- /dev/null +++ b/projects/kittypunch/index.js @@ -0,0 +1,5 @@ +const { uniTvlExports } = require("../helper/unknownTokens") + +module.exports = uniTvlExports({ + flow: "0x29372c22459a4e373851798bFd6808e71EA34A71" +}) \ No newline at end of file diff --git a/projects/klap/index.js b/projects/klap/index.js index ff539335d605..4c7c3a510790 100644 --- a/projects/klap/index.js +++ b/projects/klap/index.js @@ -2,6 +2,9 @@ const { aaveExports } = require("../helper/aave"); const methodologies = require("../helper/methodologies"); module.exports = { + deadFrom: "2023-09-17", methodology: methodologies.lendingMarket, klaytn: aaveExports('klaytn', '0x969E4A05c2F3F3029048e7943274eC2E762497AB'), } + +module.exports.klaytn.borrowed = () => ({}) // bad debt diff --git a/projects/klaylend/index.js b/projects/klaylend/index.js index e0eb6d0f5983..a0fe37858779 100644 --- a/projects/klaylend/index.js +++ b/projects/klaylend/index.js @@ -12,4 +12,5 @@ module.exports = masterchefExports({ }) module.exports.hallmarks = [ [1662336000, "Rug Pull"] -] \ No newline at end of file +], +module.exports.deadFrom = 1662336000 \ No newline at end of file diff --git a/projects/klend/index.js b/projects/klend/index.js index 1cc6f5d58f86..b8f20192f42a 100644 --- a/projects/klend/index.js +++ b/projects/klend/index.js @@ -1,19 +1,19 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); -const {compoundExports} = require('../helper/compound'); -const {unwrapUniswapLPs} = require('../helper/unwrapLPs'); +const { compoundExports } = require('../helper/compound'); +const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); // BSC const unitroller = "0xA6bEd5B7320941eA185A315D1292492F7Fdd1e5c"; const kBnb = "0x2C334c6cBC0547e759084bD8D469f933B17Ff481"; const wbnb = ADDRESSES.bsc.WBNB const bscPools = [ - "0xf1D447656692d51d4DB7057104Ac6E97029A7790", - "0x95D4D2D88C96cE96c97A912Aa7122715716013D4" + "0xf1D447656692d51d4DB7057104Ac6E97029A7790", + "0x95D4D2D88C96cE96c97A912Aa7122715716013D4" ]; const okexPools = [ - "0x2404c9F6Ba2d4D5c73d86b3E3b9D7F6c70ba3448", - "0x5A74de8e3D0c46c106AB769d50bf9CAF8681D30d" + "0x2404c9F6Ba2d4D5c73d86b3E3b9D7F6c70ba3448", + "0x5A74de8e3D0c46c106AB769d50bf9CAF8681D30d" ]; const lpAbi = 'address:lp' // OKEX @@ -23,60 +23,56 @@ const wokt = ADDRESSES.okexchain.WOKT async function pool2Tvl(balances, chainBlocks, chain, pools) { - let lpofPools = (await sdk.api.abi.multiCall({ - calls: pools.map(p => ({ - target: p - })), - abi: lpAbi, - block: chainBlocks, - chain: chain - })).output; + let lpofPools = (await sdk.api.abi.multiCall({ + calls: pools.map(p => ({ + target: p + })), + abi: lpAbi, + block: chainBlocks, + chain: chain + })).output; - let lpBalances = (await sdk.api.abi.multiCall({ - calls: lpofPools.map(p => ({ - target: p.output, - params: p.input.target - })), - abi: "erc20:balanceOf", - block: chainBlocks, - chain: chain - })).output; + let lpBalances = (await sdk.api.abi.multiCall({ + calls: lpofPools.map(p => ({ + target: p.output, + params: p.input.target + })), + abi: "erc20:balanceOf", + block: chainBlocks, + chain: chain + })).output; - let lpPositions = []; - for (let i in lpBalances) { - lpPositions.push({ - balance: lpBalances[i].output, - token: lpBalances[i].input.target - }); - } + let lpPositions = []; + for (let i in lpBalances) { + lpPositions.push({ + balance: lpBalances[i].output, + token: lpBalances[i].input.target + }); + } - await unwrapUniswapLPs(balances, lpPositions, chainBlocks, chain, addr=>`${chain}:${addr}`); + await unwrapUniswapLPs(balances, lpPositions, chainBlocks, chain, addr => `${chain}:${addr}`); } async function bscPool2(timestamp, block, chainBlocks) { - let balances = {}; - - await pool2Tvl(balances, chainBlocks.bsc, "bsc", bscPools); - - return balances; + let balances = {}; + await pool2Tvl(balances, chainBlocks.bsc, "bsc", bscPools); + return balances; } async function okexPool2(timestamp, block, chainBlocks) { - let balances = {}; - - await pool2Tvl(balances, chainBlocks.okexchain, "okexchain", okexPools); - - return balances; + let balances = {}; + await pool2Tvl(balances, chainBlocks.okexchain, "okexchain", okexPools); + return balances; } module.exports = { - bsc: { - ...compoundExports(unitroller, "bsc", kBnb, wbnb), - pool2: bscPool2 - }, - okexchain: { - ...compoundExports(okexUnitroller, "okexchain", kOkt, wokt), - pool2: okexPool2 - } + bsc: { + ...compoundExports(unitroller, kBnb, wbnb), + pool2: bscPool2 + }, + okexchain: { + ...compoundExports(okexUnitroller, kOkt, wokt), + pool2: okexPool2 + } } \ No newline at end of file diff --git a/projects/klever-exchange/index.js b/projects/klever-exchange/index.js index 75626130cf1d..2c6c205e08bd 100644 --- a/projects/klever-exchange/index.js +++ b/projects/klever-exchange/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -18,11 +19,7 @@ const config = { ] }, bitcoin: { - owners: [ - 'bc1qze8pn5vywzk8enqdr9ve28lyas23kurzd37027', - 'bc1qgy5zyuvsw5wnt5lrx3m62tt2pmdl69avd5vw6n', - 'bc1qk4l4u3lh7rrufsw0z6vmkln5kesf0a9q0srnkr' - ] + owners: bitcoinAddressBook.kleverExchange }, } diff --git a/projects/klondike/index.js b/projects/klondike/index.js index 80b23854d4dc..4e8df2ff23ab 100644 --- a/projects/klondike/index.js +++ b/projects/klondike/index.js @@ -1,8 +1,7 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const stakingContract = "0xAcbdB82f07B2653137d3A08A22637121422ae747"; const KlonX = "0xbf15797BB5E47F6fB094A4abDB2cfC43F77179Ef"; @@ -23,31 +22,12 @@ const fundContracts = [ "0x3BE908C22D21ab32C5A04CFCa3a9A70d4FEfc098", ]; -async function ethTvl(block) { - const balances = {}; - - for (const pool of [KWBTCWBTCLPKlonXPool, KXUSDDAILPKlonXPool]) { - await sumTokensAndLPsSharedOwners( - balances, - pool == KWBTCWBTCLPKlonXPool - ? [[WBTC_KBTC_UNI, true]] - : [[KXUSD_DAI_UNI, true]], - [pool] - ); - } - - const tokenAddresses = ( - await sdk.api.abi.call({ - abi: abi.allAllowedTokens, - target: fundContracts[0], - }) - ).output; - - for (const token of tokenAddresses) { - await sumTokensAndLPsSharedOwners(balances, [[token, false]], fundContracts); - } - - return balances; +async function ethTvl(api) { + const tokenAddresses = await api.call({ abi: abi.allAllowedTokens, target: fundContracts[0], }) + tokenAddresses.push(WBTC_KBTC_UNI, KXUSD_DAI_UNI) + fundContracts.push(KWBTCWBTCLPKlonXPool, KXUSDDAILPKlonXPool) + + return sumTokens2({ api, tokens: tokenAddresses, owners: fundContracts, resolveLP: true }) } module.exports = { diff --git a/projects/knightdex/index.js b/projects/knightdex/index.js index dade05359cda..4baf3d71203e 100644 --- a/projects/knightdex/index.js +++ b/projects/knightdex/index.js @@ -2,6 +2,6 @@ const {getUniTVL} = require("../helper/unknownTokens"); module.exports = { op_bnb: { - tvl: getUniTVL({factory: "0xAe9F4488CC751637b18070c5453a3b7Acc137a3b", useDefaultCoreAssets: true, fetchBalances: true, }) + tvl: getUniTVL({factory: "0xAe9F4488CC751637b18070c5453a3b7Acc137a3b", useDefaultCoreAssets: true, }) }, } diff --git a/projects/knitfinance/index.js b/projects/knitfinance/index.js index c3adaaece5f2..81226c1fbcb0 100644 --- a/projects/knitfinance/index.js +++ b/projects/knitfinance/index.js @@ -51,6 +51,7 @@ module.exports = { }; function addChain(chain) { + module.exports.deadFrom = "2023-02-01" module.exports[chain] = { tvl: async () => { const balances = {} diff --git a/projects/kogefarm/abi.json b/projects/kogefarm/abi.json deleted file mode 100644 index 710604369642..000000000000 --- a/projects/kogefarm/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "balance": "uint256:balance", - "token": "address:token" -} \ No newline at end of file diff --git a/projects/kogefarm/index.js b/projects/kogefarm/index.js index 0ca96c5eac3f..6708969d4518 100644 --- a/projects/kogefarm/index.js +++ b/projects/kogefarm/index.js @@ -1,5 +1,4 @@ const { sumUnknownTokens } = require('../helper/unknownTokens') -const abi = require('./abi.json') const { getConfig } = require('../helper/cache') const kogeMasterChefAddr = '0x6275518a63e891b1bC54FEEBBb5333776E32fAbD' @@ -27,32 +26,56 @@ const _kogePool2 = [ ] const config = { - kava: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/kava_vault_addresses.json', }, - moonriver: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/movr_vault_addresses.json', }, - fantom: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/ftm_vault_addresses.json', }, - polygon: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/vaultaddresses', }, + kava: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/kava_vault_addresses.json' }, + moonriver: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/movr_vault_addresses.json' }, + fantom: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/ftm_vault_addresses.json' }, + polygon: { endpoint: 'https://raw.githubusercontent.com/kogecoin/vault-contracts/main/vaultaddresses' }, +} + +const abi = { + strategy: "function strategy() view returns (address)", + balance: "uint256:balance", + token: "address:token", + balanceOfPool: "function balanceOf() view returns (uint256)" } Object.keys(config).forEach(chain => { - const { endpoint } = config[chain] + const { endpoint } = config[chain]; module.exports[chain] = { tvl: async (api) => { - let info = (await getConfig('kogefarm/' + chain, endpoint)) - if (typeof info === 'string') info = JSON.parse(vaults.replace(/,(\s*[}\]])/g, '$1')) - let vaults = chain === 'polygon' ? info : info.map(v => v.vault) - if (chain === 'polygon') - vaults = vaults.filter(v => !_kogePool2.includes(v)) - const tokens = await api.multiCall({ abi: abi.token, calls: vaults }) - const bals = await api.multiCall({ abi: abi.balance, calls: vaults }) - api.addTokens(tokens, bals) - return sumUnknownTokens({ api, resolveLP: true, }) + let info = await getConfig('kogefarm/' + chain, endpoint); + if (typeof info === 'string') info = JSON.parse(info.replace(/,(\s*[}\]])/g, '$1')); + + let vaults = chain === 'polygon' ? info : info.map(v => v.vault); + if (chain === 'polygon') { + vaults = vaults.filter(v => !_kogePool2.includes(v)); + const [tokens, bals] = await Promise.all([ + api.multiCall({ abi: abi.token, calls: vaults }), + api.multiCall({ abi: abi.balance, calls: vaults }) + ]); + api.addTokens(tokens, bals); + + } else { + const [tokens, strategies] = await Promise.all([ + api.multiCall({ abi: abi.token, calls: vaults }), + api.multiCall({ abi: abi.strategy, calls: vaults }) + ]); + + const balanceOfPools = await api.multiCall({ calls: strategies, abi: abi.balanceOfPool }); + api.addTokens(tokens, balanceOfPools); + } + return sumUnknownTokens({ api, resolveLP: true }); } - } -}) + }; +}); + + module.exports.polygon.pool2 = async (api) => { - const tokens = await api.multiCall({ abi: abi.token, calls: _kogePool2 }) - const bals = await api.multiCall({ abi: abi.balance, calls: _kogePool2 }) + const [tokens, bals] = await Promise.all([ + api.multiCall({ abi: abi.token, calls: _kogePool2 }), + api.multiCall({ abi: abi.balance, calls: _kogePool2 }) + ]) api.addTokens(tokens, bals) return sumUnknownTokens({ api, resolveLP: true, tokens: ['0x3885503aef5e929fcb7035fbdca87239651c8154'], owner: kogeMasterChefAddr, }) } diff --git a/projects/kokomo/index.js b/projects/kokomo/index.js index 3a95257d7ab4..da8909d969de 100644 --- a/projects/kokomo/index.js +++ b/projects/kokomo/index.js @@ -4,6 +4,9 @@ module.exports = { hallmarks: [ [1680264000,"Rug Pull"] ], - optimism: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633', 'optimism'), - arbitrum: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633', 'arbitrum'), + optimism: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633'), + arbitrum: compoundExports('0x91c471053bA4697B13d62De1E850Cc89EbE23633'), } + +module.exports.optimism.borrowed = () => ({}) +module.exports.deadFrom = 1680264000 \ No newline at end of file diff --git a/projects/korbit/index.js b/projects/korbit/index.js index ce8fb929e0c1..03fb6da66a2f 100644 --- a/projects/korbit/index.js +++ b/projects/korbit/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -14,29 +15,7 @@ const config = { ], }, bitcoin: { - owners: [ - '1JtAupan5MSPXxSsWFiwA79bY9LD2Ga1je', - '3E8BTrBB7jxAemyUqSnN4YFLMC22cShZJZ', - '3GoBetHTvfnaRNQbR4yy5YNUjX4d8mTQKK', - 'bc1q09j44e0xxxusj3zsan20x7tuvtumxfv9smlq27t0nwp57gxf7htqq6m9lj', - 'bc1q0uffd8egas4w87dxq998ttfl6j3jtw6k7cafce9v4mvr5qc9tvfq9czqk9', - 'bc1q33m8td986p3vcnap9zqpx3d8v8zujtkvqacsya5xfvf945vmvxzqth4h4t', - 'bc1q3yn06lfl8ayjukya52ksff0uaveurfc8lm3ftdgu8ywvwanx8lqswj7w9u', - 'bc1q4sv2fxlp6w08wkq8ywmughxkm7n75d2fmrgnmvwun6rhepyknjxqm99v4x', - 'bc1q7fww9657ts2au45wh0ed39rjze6ja93z0498z4j89pqjky266wzs0sz8ka', - 'bc1q9pnwfyd4jtkulyk4w057wsdjhykaw6fftw06k2cn2m3y7jlsfe2qvxvm8e', - 'bc1qa8may4g0yzezjyesqcq0mwggy5wwzl0yhs0a8tk9ucej5qg6ujfqscv2jq', - 'bc1qgkx4ee8ac3as5y4ddhw6uedyk9adsywdzgc0fzxv304lcrh4qs9sn96agt', - 'bc1qku6z53kuyaj9r898kj6esqnwz7wke82mwgw43vhu33ld7sx3200s2u9p9x', - 'bc1ql0p3klhr2d8z07ja3t5d5dnxrenhp4gcjeszxpfflr08zaqqx5zqpkeqnl', - 'bc1qnerwvz93pcj653r5yd4hnd2d7np2drhdhyruj7qdvl3psc5wnf0q6x9me4', - 'bc1qs9ut74nue7vjknz2eqxegmtuzqhjzx9y8tzjymvlg05v8a5ffr5qz402cx', - 'bc1qsk6h7d2l7e7r2a8krlxjn6wdnhhszyrtzcugdsfa5zz4syajzl5spd52h5', - 'bc1qsmqvkwrsy5xw2hm885l5fv7s2hxzauz5fn9jayfmd86305wehrts2lztgs', - 'bc1qtlen0nuvln3aqcn2r3nljshdmzakq7z5z4rexpk23mj8u8lmc8ysc29jct', - 'bc1qzdt5z4f46jak59jku5jmvv3f2ru20htqs7jhy0whazgd5v4626eq4vkxqz', - 'bc1qzu4lnzfpskwsvnyvzud9a7ru4d2ft7whqvl5d3kskxxhgeupnjjquzvt97', - ] + owners: bitcoinAddressBook.korbit }, ripple: { owners: [ diff --git a/projects/kraken-btc/index.js b/projects/kraken-btc/index.js new file mode 100644 index 000000000000..fee50c310ceb --- /dev/null +++ b/projects/kraken-btc/index.js @@ -0,0 +1,7 @@ +const { sumTokensExport } = require('../helper/sumTokens') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +// https://www.kraken.com/kbtc +module.exports = { + bitcoin: { tvl: sumTokensExport({ owners: bitcoinAddressBook.krakenBTC }) } +} \ No newline at end of file diff --git a/projects/kraken/index.js b/projects/kraken/index.js index 89911dc81a60..f690c4eb3087 100644 --- a/projects/kraken/index.js +++ b/projects/kraken/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -21,21 +22,11 @@ const config = { ], }, bitcoin: { + owners: bitcoinAddressBook.kraken, + }, + starknet: { owners: [ - 'bc1qnhmemsqfhycvp6g50v732h7wfwdt68el4ux5ttu8xwsrzngmxv0qr55aga', - 'bc1qa5aux0l2c3l99tpmd9c85770kqpksg3g6dxaw03jj6lphnwy4lqq68xfgc', - 'bc1q3gqqnn9hr0uachfk6rv3qhf3pp9z8a4z63ksc5qu0c2vvtykqd9qj3fyum', - 'bc1qplr053c80nzlqapuatfslyhmns6sfn32qzz3xkdn36jjryw8vsys8y7wlc', - 'bc1qhxv3pg2hsnw3m9jukuc6erjwwd03rzwhd2k6zh5uf6s2lwpuv3rq9zefru', - 'bc1q08n37tm63z3f0myqe6zjx7ymtng8c9qedpwpplq95qkmx0cpke7qyz4y8v', - 'bc1q02cq8du8r7ktuy5l0ltc4cv82xnaw4upaaw8y4rq6uycdp0k5nmquljtzk', - 'bc1qcf9qe8ytx5qlcq0ft4vm2xm3fyfvurrkende46hpmwwnzpctfu3szxpve2', - 'bc1qrj5vg73fxs6h6pmdjld387j5szkswc2y39rfutw8gl93h647wpksukyln9', - 'bc1q9hqaqzyf6zsd330pkvtq5uxcxprzr368zdsxx5srtep7kepx523q2gd0ef', - 'bc1q36l8mssxdlncj7njkqvayv3jumked9jdtjxete66cxnzluf4j0msjm4w80', - 'bc1qs8cyln26t2f5rwu2frnqvtltfxt0qqql0elmhrpsexlzveap82eqtyvsgu', - 'bc1qcds58swh4g6zsdmws9ltcdpqz4l44utu5wv9vfpmemps3whgdacqkakrk0', - 'bc1q75tsfq2c5cqp2ss32qksmnzd9yea2mjsjktdmrz900dcmg43ck4s66sgjx', + '0x620102ea610be8518125cf2de850d0c4f5d0c5d81f969cff666fb53b05042d2' ], }, } diff --git a/projects/kriya-dex-earn/index.js b/projects/kriya-dex-earn/index.js index f96382b54907..60cbaecb1fe4 100644 --- a/projects/kriya-dex-earn/index.js +++ b/projects/kriya-dex-earn/index.js @@ -1,11 +1,14 @@ const { fetchURL } = require("../helper/utils"); const sui = require("../helper/chain/sui"); -const vaultUrl = +const clmmVaultUrl = "https://88ob93rfva.execute-api.ap-southeast-1.amazonaws.com/release/vaults"; -async function vaultTVL(api) { - const vaults = (await fetchURL(vaultUrl))?.data; +const llVaultUrl = + "https://4sacq88271.execute-api.ap-southeast-1.amazonaws.com/release/vaults"; + +async function clmmVaultTVL(api) { + const vaults = (await fetchURL(clmmVaultUrl))?.data; for (const vault of vaults) { const tokenX = Number(vault?.coinA); const tokenY = Number(vault?.coinB); @@ -15,12 +18,26 @@ async function vaultTVL(api) { } } +async function llVaultTVL(api) { + const vaults = (await fetchURL(llVaultUrl))?.data; + for (const vault of vaults) { + const aumBaseTokenReserve = Number(vault?.aumInBaseToken); + + api.add(vault?.pool?.tokenXType, aumBaseTokenReserve); + } +} + +async function vaultsTVL(api) { + await llVaultTVL(api); + await clmmVaultTVL(api); +} + module.exports = { timetravel: true, misrepresentedTokens: false, methodology: "Collets all the TVL from the KriyaDEX vaults. The TVL is denominated in USD.", sui: { - tvl: vaultTVL, + tvl: vaultsTVL, }, }; diff --git a/projects/kryptonite/index.js b/projects/kryptonite/index.js index d2584d3830c4..dc3a8ad3c530 100644 --- a/projects/kryptonite/index.js +++ b/projects/kryptonite/index.js @@ -1,5 +1,11 @@ const { queryContractWithRetries, getToken, getTokenBalance } = require("../helper/chain/cosmos"); +const getReservesAbi = "function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)"; +const totalSupplyAbi = "uint256:totalSupply"; +const decimalsAbi = "uint256:decimals"; +const token0Abi = "address:token0"; +const token1Abi = "address:token1"; + // node test.js projects/kryptonite/index.js const config = { sei: { @@ -23,13 +29,32 @@ const config = { lp: "sei1hxh76ty0fk9esq3qsvrhzz6fsvmh55j59xnduswn6dfnsyjs06vqcye8yf", pair: "sei1qgyrkxvnydcvtzj8w6e4n2p07pykxw4y25ntncz5a4puz6fd6e9slq6jgk", staking: "sei1400dydwghdkpxz9tqzv2f9nr7p04tvwawkvxsxf9xqvylec593fs73vr53" + }, + { + name: "SEILOR-USEI-WLP", + lp: "sei1lahjp2h2wchtncxsszpjeu5kr77wmn6uh354hu0l57pym9p3mvys8qnpp6", + lpEvm: "0xe7d76b9affb1f7a7bcf0b9206386d570e16bc17a", + pair: "sei1lahjp2h2wchtncxsszpjeu5kr77wmn6uh354hu0l57pym9p3mvys8qnpp6", + staking: "sei1ckske9cf8kw9ea66n5p3xpnz4ns3ruw052zcyhdsqpm54jjy3t9qjn7c7l", + wrapperLpEvm: true + }, + { + name: "STSEI-USEI-WLP", + lp: "sei16pe95h9uujjdp660tzsuv0utp9zymw926j604lx3p53rsy2tjh3s7ypvnu", + lpEvm: "0xa543dfa5c278d0d8499676e17b7f6bfd8ce18e39", + pair: "sei16pe95h9uujjdp660tzsuv0utp9zymw926j604lx3p53rsy2tjh3s7ypvnu", + staking: "sei1488mn0n3j3dv36nk9t2zkz3c5x8xsmfkmx36qg57z2xnkl6a5tns6stzm6", + wrapperLpEvm: true } ], coinGeckoMap: { usei: "sei-network", - sei1ln7ntsqmxl8s502f83km9a475zyhcfhpj7v2fsm3pcmckdyys3tsktx9vk: "sei-network", - sei1xq7g6asf63mkv7t5jkfu6uf8jpzkvwnu4zl2kh4cfvk0ynxvvksqf7z3d2: "sei-network", - sei10knxlv9e54z0xcywdhtycc63uf970aefeec73ycqwd75ep9nu45sh66m6a: "kryptonite", + "0xE30feDd158A2e3b13e9badaeABaFc5516e95e8C7": "sei-network", // wSEI EVM + sei1xq7g6asf63mkv7t5jkfu6uf8jpzkvwnu4zl2kh4cfvk0ynxvvksqf7z3d2: "sei-network", // bSEI + sei1ln7ntsqmxl8s502f83km9a475zyhcfhpj7v2fsm3pcmckdyys3tsktx9vk: "kryptonite-staked-sei", // stSEI + "0xe5085112160fF75ee89a540Cdba570eAFdAF7f57": "kryptonite-staked-sei", // stSEI EVM + sei10knxlv9e54z0xcywdhtycc63uf970aefeec73ycqwd75ep9nu45sh66m6a: "kryptonite", // SEILOR + "0x89aeC21572F6637cCbd0d66861AAAC46Dd775ed1": "kryptonite", // SEILOR EVM sei1hrndqntlvtmx2kepr0zsfgr7nzjptcc72cr4ppk4yav58vvy7v3s4er8ed: "seiyan" } }, @@ -64,26 +89,47 @@ Object.keys(config).forEach(chain => { }, pool2: async (api) => { // Logic for calculating the value of staked LP tokens - for (let { lp, pair, staking, pairInfo } of seilorLps) { - const lpTokenInfo = await queryContractWithRetries({ contract: lp, chain, data: { token_info: {} } }); - const stakingState = await queryContractWithRetries({ contract: staking, chain, data: { query_staking_state: {} } }); - if (!pairInfo) { - pairInfo = await queryContractWithRetries({ contract: pair, chain, data: { pair: {} } }); - } - const token0Obj = pairInfo.asset_infos[0]; - const token1Obj = pairInfo.asset_infos[1]; - const token0 = getToken(token0Obj); - const token1 = getToken(token1Obj); - const token0Balance = await getTokenBalance({ token: token0Obj, owner: pair, chain }); - const token1Balance = await getTokenBalance({ token: token1Obj, owner: pair, chain }); - const token0Staked = token0Balance * stakingState.total_supply / lpTokenInfo.total_supply / 10 ** 6; - const token1Staked = token1Balance * stakingState.total_supply / lpTokenInfo.total_supply / 10 ** 6; - const token0CoinGeckoId = getCoinGeckoId(chain, token0); - const token1CoinGeckoId = getCoinGeckoId(chain, token1); + for (let { lp, pair, staking, pairInfo, wrapperLpEvm, lpEvm } of seilorLps) { + if (!wrapperLpEvm) { + const lpTokenInfo = await queryContractWithRetries({ contract: lp, chain, data: { token_info: {} } }); + const stakingState = await queryContractWithRetries({ contract: staking, chain, data: { query_staking_state: {} } }); + if (!pairInfo) { + pairInfo = await queryContractWithRetries({ contract: pair, chain, data: { pair: {} } }); + } + const token0Obj = pairInfo.asset_infos[0]; + const token1Obj = pairInfo.asset_infos[1]; + const token0 = getToken(token0Obj); + const token1 = getToken(token1Obj); + const token0Balance = await getTokenBalance({ token: token0Obj, owner: pair, chain }); + const token1Balance = await getTokenBalance({ token: token1Obj, owner: pair, chain }); + const token0Staked = token0Balance * stakingState.total_supply / lpTokenInfo.total_supply / 10 ** 6; + const token1Staked = token1Balance * stakingState.total_supply / lpTokenInfo.total_supply / 10 ** 6; - api.add(token0CoinGeckoId, token0Staked, { skipChain: true }); - api.add(token1CoinGeckoId, token1Staked, { skipChain: true }); + api.add(getCoinGeckoId(chain, token0), token0Staked, { skipChain: true }); + api.add(getCoinGeckoId(chain, token1), token1Staked, { skipChain: true }); + } else { + // Logic for calculating the value of staked wrapper EVM LP tokens + const stakingState = await queryContractWithRetries({ contract: staking, chain, data: { query_staking_state: {} } }); + + const [reserveAmounts, totalSupply, token0, token1] = await api.batchCall([ + { target: lpEvm, abi: getReservesAbi }, + { target: lpEvm, abi: totalSupplyAbi }, + { target: lpEvm, abi: token0Abi }, + { target: lpEvm, abi: token1Abi } + ]); + const [token0Decimals, token1Decimals] = await api.batchCall([ + { target: token0, abi: decimalsAbi }, + { target: token1, abi: decimalsAbi } + ]); + + const token0Staked = reserveAmounts[0] * stakingState.total_supply / totalSupply / 10 ** token0Decimals; + const token1Staked = reserveAmounts[1] * stakingState.total_supply / totalSupply / 10 ** token1Decimals; + + api.add(getCoinGeckoId(chain, token0), token0Staked, { skipChain: true }); + api.add(getCoinGeckoId(chain, token1), token1Staked, { skipChain: true }); + } } + return api.getBalances(); } }; diff --git a/projects/kucoin/index.js b/projects/kucoin/index.js index f158e6a2fb48..4f0ecfb981bd 100644 --- a/projects/kucoin/index.js +++ b/projects/kucoin/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -42,120 +43,7 @@ const config = { ] }, bitcoin: { - owners: [ - 'bc1q04p5psjsp7j80sq6u4djgqk3c7pk6n93q43ply', - '38fJPq4dYGPoJizEUGCL9yWkqg73cJmC2n', - 'bc1q0243pvcnutwtm3m6t005402yk8utq4kfqqghhu', - 'bc1q080rkmk3kj86pxvf5nkxecdrw6nrx3zzy9xl7q', - 'bc1q07yhcr2qmwkc32z4gfaemtjtx90am6e6rpl9sg', - 'bc1q224fr84g5xqvp2lkwmzvyec9frwk5w5f5v5w38', - 'bc1q204dfzksn4l0rhhajm9fyd5h92dac8tnuur8jp', - '37nA3mMvQwPGVh6BKdLXKBiPjLFVbRLZEp', - 'bc1q0h72mfwgtsnfkcmpsnt3kmrrp4z5x3v469mz0k', - 'bc1q0l84mekaaszjfst7lswaheu7gcymv2h2k8z6fl', - 'bc1q2hpdg7pwghz9um27hqsmv2sg3f8f9fwtjvdenx', - 'bc1q3yy6h7x9wtffu8f7hpkhlyssw3s28xzj0nydye', - 'bc1q3kwpxug0q0w55qjrfrcykxu2yn02xhzn49fnxw', - 'bc1q2wxfd36s204jkpfmez2u0nh7540cctur2v27ht', - 'bc1q3g7sltlncshtqcu9wyhqavzxlfa4tj97whapup', - 'bc1q4jszmgxml90ernkn3l908sn4hr94zk6wynp788', - 'bc1q3sevrnv8khxe6fnl87ad8e4fjefu7rmp39pxl6', - 'bc1q4xt86cp0xf6zsrfsgspnfm8579ksurxppae66a', - 'bc1q4f8uwyargzd8eajj2vrdjz4l0hvhjdlpmchstm', - 'bc1q3fzjrvlvsl6j58x38gzk0c8dgvfudsqcsdqyry', - 'bc1q5h4ucvz7qqnhypekhd8jusc8z8msytxflzfs8s', - 'bc1q5ty9r24qftnx7c0vw0y76d5kneekse7hl878yv', - 'bc1q6z680y2fkmmu49ykm0dm0temp25p034p034fme', - 'bc1q5qsadcuj0at2xk4lfca5zull8mkgwfm06qduq4', - 'bc1q80elat9h0nfhuzvuvn4yl2nh0eqxwfzas5afnv', - 'bc1q6dr8nqmgm5qvuukuf5ux3m0fdthnhx033uv3vr', - 'bc1q6tj4wm295pndmx4dywkg27rj6vqfxl5gn8j7zr', - 'bc1q5w44vqvfpnwzpclwhdmx98uenwdtdfd85qtw34', - 'bc1q82qe6w4afzt2l94wn4d9e0uchj8t2x2dtdf2pu', - 'bc1q5cza73vpzhrsruy4e7gudvq6xv6vfs9hjs5pl3', - 'bc1qa482xwlzz479nyep2ve0z6t9t29dg0zem9wqt2', - 'bc1q8yja3gw33ngd8aunmfr4hj820adc9nlsv0syvz', - 'bc1q9uddlcfqdyh6dlu3pptchazr0va0cshnqss2yk', - 'bc1qa8jaa3pss396sx52hkft5ta2dey69fkrt8mfsc', - 'bc1q9020xphp6ukc4j72hy52gk2nxujwt4kr8dq6eu', - 'bc1q8jjlupqcvxv25usqu8hvlnd8ym0stcpq4jfy9x', - 'bc1q98mvmv9nl4p744tdf2zh3uzv30yea2njy0le9d', - 'bc1q9hrcsckdwrezlw7gspefeyk9nyqmwpy3ea8wwx', - 'bc1qa3h4re6gf6qmmesjqfzn0vu2rmc6e00s4gjjle', - 'bc1q9wvygkq7h9xgcp59mc6ghzczrqlgrj9k3ey9tz', - 'bc1qfyr7tvv0a2dcq6xp4dgr5nemfmnak2e2scn6hg', - 'bc1qdhqxc3h6dnc6x0k8emtcnuyt8aspy83w0g9xht', - 'bc1qfcuvuaam666pv777ad59wwue5l7j36hr95f8gv', - 'bc1qf3wwg8dayutammv2e6lahudyc7j2ef579hyx3m', - 'bc1qamlau4w545vsjsmnhzmztlv3sy4tu6v9cnxtcg', - 'bc1qea6uvmc2kqndhewtlnc9duh5aa30ptvp3mhk9h', - 'bc1qgrxsrmrhsapvh9addyx6sh8j4rw0sn9xtur9uq', - 'bc1qcyjkktrvwatdqyvpm04vs3k2x5r4ystnw7msrk', - 'bc1qggwgcwnjvlma9hr569jhgx2yuncaaq0ace5ywp', - 'bc1qartr66auwm2tlcjp7cqgs8cx4p6q7lydrtwf4p', - 'bc1qkrewa0m37wjmkcgs0w2gh9zhjqclkq74ckt4x4', - 'bc1qk947xflcafthv8k6gx7m2cvwzqzy68kl5npkyw', - 'bc1qh573eaggrqexqx7xzm4e57k6sm9r7zpuxwqxzn', - 'bc1qj5gnrfdmcftzxgrwcdts4plw4kaydjs5kq560l', - 'bc1qlldl5qma9glxwt3j06eef05590uyy2td3ye90c', - 'bc1qhafun32xkhxpec8dq3kpxyq5x9ur437mj4dusy', - 'bc1qh6tqdv9k2pew6vyvrmg76ae55n5rwa2djmyyyk', - 'bc1qjxv6j2sv6za57khvvd5yu9jxkv3g3qvxh6sach', - 'bc1qjefrh2gf28g6x56eeausc30gxewamj7qwtzfpg', - 'bc1qhs4u46ygdskuljadnxn6thqsrjw3nf9r8nfclm', - 'bc1qnl68wnf3d6jz532dl65hj9urw9j2432fjg03nr', - 'bc1qnetky45z2vguazzczuy7x2446vsjn4ku76d5k8', - 'bc1qlw4dv8nt5uc35dkmftlt3nt0rl0cte4he998qt', - 'bc1qnvdx4dt8kn68csvcqvdtnlzw8hadapk9e9k857', - 'bc1qnqhcfntmlh2nnu5rp25szqgxw7v3783xrgcd44', - 'bc1qp22u6u75j2nvvhychyfd9uxr6s2jkf5p985rct', - 'bc1qnxn6352sn9mm6dxgmfrn43fgtu0l2kcx2y3ddh', - 'bc1qm882j3900we3eewa5fdw4hlwlnef35phmsn7x8', - 'bc1qpafgjjmqlv32m6m6qpte2ldlz0wcuj3ajyt8gd', - 'bc1qmtvfu97nlrl8qtujvj5jg47dc0p3w8sun6esaf', - 'bc1qr9hf2v2gf6haq7tsvckel7u6ja46fnqfkt6u5p', - 'bc1qpuhnd3gqhqlezgcuuhc2ywfw2w03uyz0seg802', - 'bc1qr77hw0dek5f8uvmeazd3egym2m3npjf2nvrza5', - 'bc1qpdfchk5j5tvkwf0z4kpftysv88h5szz4ms8try', - 'bc1qprpm6caxcuewnme4at7h2skhv2rury274a0vln', - 'bc1qq9u67zacfe3vz40e36nltn3agt9hf75g7av2xx', - 'bc1qrf9llyljmwy8egcjjsw0z0a8n5sgjlhcemezcl', - 'bc1qqx0udc7ndr77yg4v7rwuugnwk8n8xqaydmakfu', - 'bc1qqg92jrprgh0vdq3pd8wctnzqyuwn5kp20hhfh6', - 'bc1qpnmkhx9ndgnk639wh5gyuex4nsx7s8t8d33pzt', - 'bc1qtcxldruuuhvk8zjmw3a3dpwfvu2d0m9qyctv82', - 'bc1qtlgfyl9yjyluwzyyayp2fs0r4kcjtv2axsmzl8', - 'bc1qs84j4s45nztsx9759vkha0wvvx28dlqk7p2n5y', - 'bc1qteec4z0tcvv40r6py855gg77rwnhe9ege42x0t', - 'bc1qrt7rkpswpgmcag7txzf6ps9mvepwgndshqdx6d', - 'bc1quqy97s6lj3mty7hdp4at7uvmlzssh57jezx85v', - 'bc1qseaaa4hnexjugx26p605getpdnkwy3up64uws9', - 'bc1qudtghe07cfslxyv36zk5ums65c32xcw0nz6zhg', - 'bc1qsfdf47l3ftsqv2muvfftnulcp4qwzypuxm9k30', - 'bc1qul97gsvkpfju6fa53cezzxx5wmv4t8rl6gdt62', - 'bc1qv3v2u78m6vec2jqe7w0esm6rccmysccdvkpr3t', - 'bc1qwjftm2nl65gmevmutfqe8q7k0aaahlxt3a9wam', - 'bc1qvh0zexe6422t85x3kzgvms9fd984606uhf44ug', - 'bc1qvj8a4kjq888c2l22pdgjx3cgaq94vm3hjzyq6l', - 'bc1qwgzyz8xpwdrx54rsm5p74ksc6wkxr8y4ncejwh', - 'bc1qvvqafwsqr2rquyvym4l6rtt7ayukpmw2sfxn7f', - 'bc1qvkzdg9x58zyupept40zcjhmztn3l2flqss2f4x', - 'bc1quyayxjg0r68wsj6c2zcu3f7nnj9um5pwdgr36m', - 'bc1qw83c8j8pf2azegtyeszqqdaafgqj4hl3xcdy95', - 'bc1qwxg6gra5g9tlvztr9qphzpruch30ka40e4tl48', - 'bc1qz0q4hyn5k8plleax2g52jsr0k07vgtqcr634g3', - 'bc1qz0nfyvylrvn9h2rqm7lcegzv79du2p5jezgept', - 'bc1qxfgeqygy229hrjrwmklzgwme70h8mmrjcyueag', - 'bc1qyz4zr7cv2922cjua9xrezsda82gl8z653w6ru4', - 'bc1qxnsr0al2lw7hqg90j05x9s0gxm5g4skmcslrut', - 'bc1qymcn42gst8jvcu4y9c6tf6ngfs38j66hd5zvhs', - 'bc1qzghz50r66hlp4wufyy55m5a3jjl5grkmetygsg', - 'bc1qyatvzh0ndg464ph7txwjw6kgkczw8kw03lcgg7', - 'bc1qy8054ua06akklh6avf06crt4u2hu4skasr5ead', - 'bc1qy7uquly0ha78lmn47hedd7e0swkmwpyft9j7e2', - 'bc1qzy4lg8yg6dsn0dppx3a4kq8tqe2hhrh6af3778', - 'bc1qzkqzmlj47z0ww253xu2egewcw4wagz6qfa6fr8' - ] + owners: bitcoinAddressBook.kucoin }, arbitrum: { owners: [ @@ -217,6 +105,11 @@ const config = { '0xd6216fc19db775df9774a6e33526131da7d19a2c', '0xfb6a733bf7ec9ce047c1c5199f18401052eb062d', ], + }, + starknet: { + owners: [ + '0x0566ec9d06c79b1ca32970519715a27f066e76fac8971bbd21b96a50db826d90' + ], } } diff --git a/projects/kumu-finance/index.js b/projects/kumu-finance/index.js index f2c9a5ed3198..a1ce5305f4f8 100644 --- a/projects/kumu-finance/index.js +++ b/projects/kumu-finance/index.js @@ -44,6 +44,7 @@ module.exports = { hallmarks: [ [1662336000, "Rug Pull"] ], + deadFrom: '2022-09-25', klaytn: { tvl, staking } diff --git a/projects/kyber/index.js b/projects/kyber/index.js index 069bb63b2092..57595dea3d46 100644 --- a/projects/kyber/index.js +++ b/projects/kyber/index.js @@ -2,40 +2,18 @@ const sdk = require("@defillama/sdk") const { cachedGraphQuery } = require("../helper/cache"); const { sumTokens2 } = require('../helper/unwrapLPs') -const chains = { - ethereum: { - graphId: "mainnet", - }, - arbitrum: { - graphId: "arbitrum-one", - }, - polygon: { - graphId: "matic", - }, - avax: { - graphId: "avalanche", - }, - bsc: { - graphId: "bsc", - }, - fantom: { - graphId: "fantom", - }, - cronos: { - graphId: "cronos", - }, - optimism: { - graphId: "optimism", - }, - linea: { - graphId: 'linea' - }, - base: { - graphId: 'base' - }, - scroll: { - graphId: 'scroll' - } +const CONFIG = { + ethereum: { graphId: "mainnet" }, + arbitrum: { graphId: "arbitrum-one", blacklistedTokens: ['0x0df5dfd95966753f01cb80e76dc20ea958238c46'] }, // rWETH + polygon: { graphId: "matic" }, + avax: { graphId: "avalanche" }, + bsc: { graphId: "bsc" }, + fantom: { graphId: "fantom" }, + cronos: { graphId: "cronos" }, + optimism: { graphId: "optimism" }, + linea: { graphId: 'linea' }, + base: { graphId: 'base' }, + scroll: { graphId: 'scroll' } }; async function fetchPools(chain) { @@ -76,12 +54,11 @@ async function fetchPools(chain) { return toa; } -function elastic(chain) { +function elastic(graphId, blacklistedTokens = []) { return async (api) => { - if (!("graphId" in chains[chain])) return {}; - - const pools = await fetchPools(chains[chain].graphId); - return sumTokens2({ api, tokensAndOwners: pools }) + if (!graphId) return + const pools = await fetchPools(graphId); + return sumTokens2({ api, tokensAndOwners: pools, blacklistedTokens }) } } @@ -92,10 +69,10 @@ module.exports = { [1700611200,'Protocol exploit'], ], }; -Object.keys(chains).forEach(chain => { - module.exports[chain] = { - tvl: elastic(chain) - }; -}); + +Object.keys(CONFIG).forEach((chain) => { + const { graphId, blacklistedTokens } = CONFIG[chain] + module.exports[chain] = { tvl: elastic(graphId, blacklistedTokens)} +}) 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/kyotoswap/index.js b/projects/kyotoswap/index.js index 9e449835eef7..c15b026003b7 100644 --- a/projects/kyotoswap/index.js +++ b/projects/kyotoswap/index.js @@ -8,7 +8,6 @@ const KSWAP = "0x29ABc4D03D133D8Fd1F1C54318428353CE08727E"; module.exports = { methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs`, misrepresentedTokens: true, - incentivized: true, bsc: { tvl: getUniTVL({ factory: FACTORY, diff --git a/projects/kyros/index.js b/projects/kyros/index.js new file mode 100644 index 000000000000..7015c61d162e --- /dev/null +++ b/projects/kyros/index.js @@ -0,0 +1,15 @@ +const { sumTokens2 } = require("../helper/solana"); + +async function tvl() { + return sumTokens2({ + tokenAccounts: [ + "CRFtzwkekKorgdTRSdvsYeqL1vEuVvwGRvweuWCyaRt3", // jitoSOL token account in kySOL Vault address + ] + }) +} + +module.exports = { + timetravel: false, + solana: { tvl }, + methodology: 'The TVL is calculated by summing all restaked assets.', +}; diff --git a/projects/laari-fi/index.js b/projects/laari-fi/index.js index d36349d111c8..28baf4b78556 100644 --- a/projects/laari-fi/index.js +++ b/projects/laari-fi/index.js @@ -13,4 +13,5 @@ module.exports = yieldHelper({ poolInfo: 'function poolInfo(uint256) view returns (address want, uint256, uint256, uint256, uint256, uint256, uint256, uint256 amount, uint256, address strat)', }, }) -module.exports.hallmarks=[[1697068800, "Rug Pull"]] \ No newline at end of file +module.exports.hallmarks=[[1697068800, "Rug Pull"]], +module.exports.deadFrom='2023-10-12' \ No newline at end of file diff --git a/projects/lachain-yield-market.js b/projects/lachain-yield-market.js index fb34d20f73fe..417f2d4fd039 100644 --- a/projects/lachain-yield-market.js +++ b/projects/lachain-yield-market.js @@ -1,4 +1,5 @@ const utils = require('./helper/utils'); +const { deadFrom } = require('./ladex-exchange'); async function fetch() { const response = await utils.fetchURL(`https://farms-info.lachain.io/farms/beefy`); @@ -20,6 +21,7 @@ async function fetch() { } module.exports = { + deadFrom: '2024-01-01', lachain: { fetch }, fetch, } diff --git a/projects/ladex-exchange/index.js b/projects/ladex-exchange/index.js index 1ad19b40b809..84f750c54835 100644 --- a/projects/ladex-exchange/index.js +++ b/projects/ladex-exchange/index.js @@ -2,6 +2,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const factory_contract = "0xD707d9038C1d976d3a01c770f01CB73a1fd305Cd" module.exports = { + deadFrom: '2024-01-01', lachain: { tvl: getUniTVL({ factory: factory_contract, useDefaultCoreAssets: true }), } diff --git a/projects/latoken/index.js b/projects/latoken/index.js index fe04fb0fe9a1..2042ea7eb8d4 100644 --- a/projects/latoken/index.js +++ b/projects/latoken/index.js @@ -1,12 +1,9 @@ const { cexExports } = require("../helper/cex"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bitcoin: { - owners: [ - "bc1q48amr6l7dvacdppgucvnswwuyleaqh4dus8z8h", - "bc1q2cgh9nxn7cqmqhk4hc5fu6mju8nzy9a20qqqh8", //cold - "bc1qw5fc9ml9vm4xq5c6xkcdu3vtwyw4gdn8lw0uwq" - ] + owners: bitcoinAddressBook.latoken }, ethereum: { owners: [ diff --git a/projects/lavarage/index.js b/projects/lavarage/index.js new file mode 100644 index 000000000000..1c6db59d14fa --- /dev/null +++ b/projects/lavarage/index.js @@ -0,0 +1,196 @@ +const { getProvider, sumTokens2 } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); +const anchor = require("@project-serum/anchor"); +const bs58 = require('bs58'); + +const solProgramId = "CRSeeBqjDnm3UPefJ9gxrtngTsnQRhEJiTA345Q83X3v"; +const usdcProgramId = "1avaAUcjccXCjSZzwUvB2gS3DzkkieV2Mw8CjdN65uu"; +const stakingProgramId = "85vAnW1P89t9tdNddRGk6fo5bDxhYAY854NfVJDqzf7h"; +const TOKEN_PROGRAM_ID = new PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"); +const SPL_ASSOCIATED_TOKEN_PROGRAM_ID = new PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"); + +const edgeCaseTimestamps = [ + { start: 1713880000, end: 1713885480 }, // 10:32 AM - 10:58 AM ET on April 23, 2024 + { start: 1713874500, end: 1713876060 }, // 8:15 AM - 8:41 AM ET on April 23, 2024 +]; + +const idleAccount = new PublicKey("bkhAyULeiXwju7Zmy4t3paDHtVZjNaofVQ4VgEdTWiE"); +const deployedAccount = new PublicKey("6riP1W6R3qzUPWYwLGtXEC23aTqmyAEdDtXzhntJquAh"); +const multisigAccount = new PublicKey("DkPYEECBc28iute8vWvAuAU4xiM91Sht59p7FHZbmNQv"); +const pendingUnstakeAccount = new PublicKey("HTnwdgfXrA6gZRiQsnfxLKbvdcqnxdbuC2FJsmCCVMw9"); +const usdcAddress = new PublicKey("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"); +const iscAddress = new PublicKey("J9BcrQfX4p9D1bvLzRNCbMDv8f44a9LFdeqNE4Yk2WMD"); +const usdcPoolAccount = new PublicKey("9m3wEeK3v5yyqDGMnDiDRR3FjCwZjRVB4n92pieGtTbP"); +const iscPoolAccount = new PublicKey("CrsxVEF7YNGAk9QwwbB2vuesUWoDopfgFAhA9apoCJ2z"); + +function getPositionFilters() { + const sizeFilter = { dataSize: 178 }; + const value = BigInt(9999); + const valueBuffer = Buffer.alloc(8); + valueBuffer.writeBigUInt64LE(value, 0); + const val0Filter = { + memcmp: { + offset: 40, + bytes: bs58.encode(Buffer.from(new Uint8Array(8))), + }, + } + const val9999Filter = { + memcmp: { + offset: 40, + bytes: bs58.encode(valueBuffer), + }, + } + return [ + [sizeFilter, val0Filter], + [sizeFilter, val9999Filter], + ] +} + +async function tvl(api) { + const provider = getProvider(); + for (const programId of [solProgramId, usdcProgramId]) { + + const program = new anchor.Program(lavarageIDL, programId, provider); + const pools = await program.account.pool.all() + const poolMap = {} + pools.forEach((pool) => { + poolMap[pool.publicKey.toBase58()] = pool.account.collateralType.toBase58() + }) + for (const filter of getPositionFilters()) { + const positions = await program.account.position.all(filter) + positions.forEach(({ account }) => { + let { closeStatusRecallTimestamp, pool, collateralAmount, timestamp } = account + const token = poolMap[pool.toBase58()] + const closeTS = closeStatusRecallTimestamp.toNumber() + const ts = timestamp.toNumber() + if ((closeTS && !isWithinEdgeCaseTimeRange(ts)) || !token) return; + api.add(token, collateralAmount.toString()) + }) + } + } + return sumTokens2({ + balances: api.getBalances(), tokenAccounts: [ + getAssociatedTokenAddress(usdcAddress, usdcPoolAccount), + getAssociatedTokenAddress(iscAddress, iscPoolAccount), + ], solOwners: [ + deployedAccount, pendingUnstakeAccount, + ] + }) +} + +function getAssociatedTokenAddress(mint, owner,) { + const [associatedTokenAddress] = PublicKey.findProgramAddressSync([owner.toBuffer(), TOKEN_PROGRAM_ID.toBuffer(), mint.toBuffer()], SPL_ASSOCIATED_TOKEN_PROGRAM_ID); + return associatedTokenAddress; +} + +function isWithinEdgeCaseTimeRange(closeTimestamp) { + return edgeCaseTimestamps.some( + ({ start, end }) => closeTimestamp >= start && closeTimestamp <= end + ); +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, +}; + +const lavarageIDL = { + version: "0.1.0", + name: "lavarage", + instructions: [], + accounts: [ + { + name: "pool", + type: { + kind: "struct", + fields: [ + { + name: "interestRate", + type: "u8", + }, + { + name: "collateralType", + type: "publicKey", + }, + { + name: "maxBorrow", + type: "u64", + }, + { + name: "nodeWallet", + type: "publicKey", + }, + { + name: "maxExposure", + type: "u64", + }, + { + name: "currentExposure", + type: "u64", + }, + ], + }, + }, + { + name: "position", + type: { + kind: "struct", + fields: [ + { + name: "pool", + type: "publicKey", + }, + { + name: "closeStatusRecallTimestamp", + type: "u64", + }, + { + name: "amount", + type: "u64", + }, + { + name: "userPaid", + type: "u64", + }, + { + name: "collateralAmount", + type: "u64", + }, + { + name: "timestamp", + type: "i64", + }, + { + name: "trader", + type: "publicKey", + }, + { + name: "seed", + type: "publicKey", + }, + { + name: "closeTimestamp", + type: "i64", + }, + { + name: "closingPositionSize", + type: "u64", + }, + { + name: "interestRate", + type: "u8", + }, + { + name: "lastInterestCollect", + type: "i64", + }, + ], + }, + }, + ], + types: [], + events: [], + errors: [], +}; diff --git a/projects/lazyotter/index.js b/projects/lazyotter/index.js index 4dd3d84cda09..e39cfda97022 100644 --- a/projects/lazyotter/index.js +++ b/projects/lazyotter/index.js @@ -1,10 +1,31 @@ -const aaveVaults = ["0x7100409baaeda121ab92f663e3ddb898f11ff745", "0x844Ccc93888CAeBbAd91332FCa1045e6926a084d"]; +// [usdc, weth, wstETH] +const aaveVaults = ["0xF91caE959D134065f39DDaa41d66E254dfaFc6f8", "0x81A47E298d634273Afe43AD58EaC5888983d21c4", "0x22EdDd86Ee6e1dcD2eAb06f80ee39B3c084a1E77"]; + +// [eth/usdc, eth/wbtc, eth/wrsETH, eth/wstETH, usdc/usdt] +const ambientVaultHelper = "0x9b5BD88893d73d114d252Cff7CFd4f2705eEFAe7" +const ambientVaults = ["0x07ab0C3A3D9e286ba790FF57f205970bC462BB21", "0x018B3ac371344735025cB01d79871Be0e4AB351C", "0x7D1E707011bA5be76806037532c266fA6eb0699f", "0xe18acadfb098fbf4017108a5C83Fa901B062a53d", "0xfbB0D0cB3324Ec90c6667D9E2b8B98dB8F73a3e6"] + +// [USDC, USDT, wstETH, weETH, wrsETH, STONE] +const rhoMarketsVault = [ + "0x1BA2A898b5EfB716557696e3E42E6479882fCDE1", + "0x87131c9Bb4878067742dd5D60596ED3b353493FD", + "0xfAe6c6E62bc5374a229960891Ec9707e8671a219", + "0x74a28efb7275c3871aCCaE2917f6EE073039042d", + "0x4220F7297eBa7cE583826eC754A0CBE29E4e6F6f", + "0x235ea5d1EA9407334E0AF8F45BA6c9A69DF9AC18" +] async function tvl(api) { - const tokens = await api.multiCall({ abi: "address:asset", calls: aaveVaults }); - const aTokens = await api.multiCall({ abi: "address:aToken", calls: aaveVaults }); - const tokensAndOwners2 = [tokens.concat(aTokens), aaveVaults.concat(aaveVaults)]; - return api.sumTokens({ tokensAndOwners2 }); + await api.erc4626Sum2({ calls: aaveVaults.concat(rhoMarketsVault), }); + const ambAssets = await api.multiCall({ abi: 'uint256:totalAssets', calls: ambientVaults}) + const calls = ambAssets.map((v, i) => ({ params: [ambientVaults[i], v]})) + const res = await api.multiCall({ abi: 'function previewAmountByAsset(address vault, uint256 assets) view returns (uint256, uint256)', calls, target: ambientVaultHelper}) + const quoteTokens = await api.multiCall({ abi: 'address:quoteToken', calls: ambientVaults}) + const baseTokens = await api.multiCall({ abi: 'address:baseToken', calls: ambientVaults}) + for (const i in res){ + api.add(quoteTokens[i], res[i][0]) + api.add(baseTokens[i], res[i][1]) + } } module.exports = { diff --git a/projects/lemonX/index.js b/projects/lemonX/index.js new file mode 100644 index 000000000000..bc6051bb817c --- /dev/null +++ b/projects/lemonX/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + core: { + tvl: gmxExports({ vault: '0xC2acC8e5Be6613f53C71AE5E386D39a40a4761aA', }) + }, +} \ No newline at end of file diff --git a/projects/lendexe/index.js b/projects/lendexe/index.js index 376990d3fbf5..b4b942c905ff 100644 --- a/projects/lendexe/index.js +++ b/projects/lendexe/index.js @@ -4,8 +4,7 @@ const { nullAddress } = require('../helper/tokenMapping') const { lendingMarket } = require("../helper/methodologies"); -const u = undefined -const { tvl, borrowed } = compoundExports('0x2c7b7A776b5c3517B77D05B9313f4699Fb38a8d3',u,'0x36e66547e27a5953f6ca3d46cc2663d9d6bdc59e', nullAddress, undefined, undefined, { fetchBalances: true, blacklistedTokens: ['0x53011e93f21ec7a74cdfbb7e6548f1abce306833'] }) +const { tvl, borrowed } = compoundExports('0x2c7b7A776b5c3517B77D05B9313f4699Fb38a8d3','0x36e66547e27a5953f6ca3d46cc2663d9d6bdc59e', nullAddress, { blacklistedTokens: ['0x53011e93f21ec7a74cdfbb7e6548f1abce306833'] }) const mapping = { [ADDRESSES.ethereum.USDC]: 6, diff --git a/projects/lendoraprotocol/index.js b/projects/lendoraprotocol/index.js index 0f1065f74cc8..22078344ca94 100644 --- a/projects/lendoraprotocol/index.js +++ b/projects/lendoraprotocol/index.js @@ -4,13 +4,17 @@ const { staking } = require('../helper/staking') module.exports = { scroll: compoundExports2({ comptroller: '0xA27CDE1F3dcaaF653624049Fc3b1a720eC1D4e91', - fetchBalances: true, cether: '0xBC7fA7C2dF265d073Be6D1c88468AEB5c06ba07c', }), }; + +module.exports.deadFrom = '2023-12-04', + module.exports.scroll.staking = staking( ['0xca4fb5541D0f2899549e5f454155E1B34acc9379', '0x578E4f84663260e5C5c64d5310Dd76aA3CEC633c'], '0x3e6c99915803631D200441CdF6D84786912b0871', 'scroll' ) + +module.exports.scroll.borrowed = () => ({}) // bad debt diff --git a/projects/levana/index.js b/projects/levana/index.js index 15aa1fa68bec..41ddd123cbb6 100644 --- a/projects/levana/index.js +++ b/projects/levana/index.js @@ -56,6 +56,7 @@ const config = { osmosis: { factory: 'osmo1ssw6x553kzqher0earlkwlxasfm2stnl3ms3ma2zz4tnajxyyaaqlucd45' }, sei: { factory: 'sei18rdj3asllguwr6lnyu2sw8p8nut0shuj3sme27ndvvw4gakjnjqqper95h' }, injective: { factory: 'inj1vdu3s39dl8t5l88tyqwuhzklsx9587adv8cnn9' }, + neutron: { factory: 'neutron1an8ls6d57c4qcvjq0jmm27jtrpk65twewfjqzdn7annefv7gadqsjs7uc3' } } diff --git a/projects/level-money/index.js b/projects/level-money/index.js new file mode 100644 index 000000000000..d4876546097a --- /dev/null +++ b/projects/level-money/index.js @@ -0,0 +1,46 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const AUSDC = '0x98C23E9d8f34FEFb1B7BD6a91B7FF122F4e16F5c'; +const AUSDT = '0x23878914EFE38d27C4D67Ab83ed1b93A74D4086a'; + +const LEVEL_WRAPPED_AUSDC = '0x78c6B27Be6DB520d332b1b44323F94bC831F5e33'; +const LEVEL_WRAPPED_AUSDT = '0xb723377679b807370Ae8615ae3E76F6D1E75a5F2'; + +const LEVEL_STAKING_CONTRACT = '0x7FDA203f6F77545548E984133be62693bCD61497'; +const LEVEL_RESERVE_MANAGERS = ['0x70D544F75c2228D68EE04BC63e6e4Bae8F31fCEF', '0x7B2c2C905184CEf1FABe920D4CbEA525acAa6f14']; +const LEVEL_WRAPPED_TOKENS = [LEVEL_WRAPPED_AUSDC, LEVEL_WRAPPED_AUSDT]; + +const LEVEL_USD_POINTS_FARM = '0x80B73eF4534FE245300017A5197451973559c00f'; + +const LEVEL_USD_USDC_CURVE_LP_TOKEN = '0x1220868672d5b10f3e1cb9ab519e4d0b08545ea4'; + +const TOKEN_CONTRACTS = [ + ADDRESSES.ethereum.USDT, // USDT + ADDRESSES.ethereum.USDC, // USDC + ADDRESSES.ethereum.DAI, // DAI + ADDRESSES.ethereum.SDAI, // sDAI + ADDRESSES.ethereum.sUSDe, // sUSD + ADDRESSES.ethereum.USDe, // USDe + ADDRESSES.ethereum.FRAX, // FRAX + "0x0022228a2cc5E7eF0274A7Baa600d44da5aB5776", // stUSD + "0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32", // sFRAX + "0xa663b02cf0a4b149d2ad41910cb81e23e1c41c32", // sFRAX + "0x57F5E098CaD7A3D1Eed53991D4d66C45C9AF7812", // wUSDM + "0x73A15FeD60Bf67631dC6cd7Bc5B6e8da8190aCF5", // USD0 + "0x35D8949372D46B7a3D5A56006AE77B215fc69bC0", // USD0++ + "0x15700B564Ca08D9439C58cA5053166E8317aa138", // deUSD + "0x5C5b196aBE0d54485975D1Ec29617D42D9198326", // stdeUSD + AUSDC, + AUSDT, +]; + +module.exports = { + ethereum: { + tvl: sumTokensExport({ + owners: [LEVEL_STAKING_CONTRACT, ...LEVEL_RESERVE_MANAGERS, ...LEVEL_WRAPPED_TOKENS], + tokens: TOKEN_CONTRACTS, + }), + pool2: sumTokensExport({ owner: LEVEL_USD_POINTS_FARM, tokens: [LEVEL_USD_USDC_CURVE_LP_TOKEN] }) + } +}; diff --git a/projects/lifinity-v2/index.js b/projects/lifinity-v2/index.js index db5e782803a0..846353ac456f 100644 --- a/projects/lifinity-v2/index.js +++ b/projects/lifinity-v2/index.js @@ -1,21 +1,28 @@ const { getProvider, sumTokens2, } = require('../helper/solana') const { Program } = require("@project-serum/anchor"); -async function getTokenAccounts(programId, idl) { - const provider = getProvider() +async function getTokenAccounts(programId, idl, chain) { + const provider = getProvider(chain) + console.log(programId, chain) const program = new Program(idl, programId, provider) const data = await program.account.amm.all() return data.map(({ account: { tokenAAccount, tokenBAccount }}) => ([tokenAAccount, tokenBAccount,])).flat() } -async function tvl() { - const tokenAccounts = await getTokenAccounts('2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c', v2Idl) - return sumTokens2({ tokenAccounts, }) +const config = { + solana: '2wT8Yq49kHgDzXuPxZSaeLaH1qbmGXtEyPy64bL7aD3c', + eclipse: '4UsSbJQZJTfZDFrgvcPBRCSg5BbcQE6dobnriCafzj12', +} + +async function tvl(api) { + const tokenAccounts = await getTokenAccounts(config[api.chain], v2Idl, api.chain) + return sumTokens2({ tokenAccounts, api, }) } module.exports = { timetravel: false, solana: { tvl, }, + eclipse: { tvl, }, } const v2Idl = { diff --git a/projects/lila-finance/index.js b/projects/lila-finance/index.js index 5a0817457045..dbc86ded8a52 100644 --- a/projects/lila-finance/index.js +++ b/projects/lila-finance/index.js @@ -10,7 +10,7 @@ async function tvl(api) { data = data.filter(i => i.strategy !== ADDRESSES.null) const aTokens = await api.multiCall({ abi: 'address:aToken', calls: data.map(i => i.strategy)}) const ownerTokens = data.map((i, idx) => [[i.asset, aTokens[idx]], i.strategy]) - return api.sumTokens({ ownerTokens }) + return api.sumTokens({ ownerTokens, blacklistedTokens: ['0x42c248d137512907048021b30d9da17f48b5b7b2'] }) } module.exports = { diff --git a/projects/limitless-exchange/index.js b/projects/limitless-exchange/index.js new file mode 100644 index 000000000000..265a506c3354 --- /dev/null +++ b/projects/limitless-exchange/index.js @@ -0,0 +1,23 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const eventAbi = "event FixedProductMarketMakerCreation(address indexed creator, address fixedProductMarketMaker, address indexed conditionalTokens, address indexed collateralToken, bytes32[] conditionIds, uint256 fee)"; +const config = [ + { factory: "0x8E50578ACa3C5E2Ef5ed2aA4bd66429B5e44C16E", resolver: "0x15A61459d65D89A25a9e91e0dc9FC69598791505", fromBlock: 13547870 }, + { factory: "0xc397D5d70cb3B56B26dd5C2824d49a96c4dabF50", resolver: "0xc9c98965297bc527861c898329ee280632b76e18", fromBlock: 13547845 }, +]; + +const getMarkets = async ({ factory, resolver, fromBlock }, api) => { + const logs = await getLogs2({ api, target: factory, eventAbi, fromBlock }); + const tokens = logs.map(i => i.collateralToken) + return api.sumTokens({ owner: resolver, tokens }); +}; + +const tvl = async (api) => { + for (const marketConfig of config) { + await getMarkets(marketConfig, api); + } +}; + +module.exports = { + methodology: "The TVL represents the total amount of tokens deposited in the prediction markets", + base: { tvl } +}; diff --git a/projects/limitless/index.js b/projects/limitless/index.js index a0edc079acc5..da315123fc9b 100644 --- a/projects/limitless/index.js +++ b/projects/limitless/index.js @@ -4,10 +4,11 @@ const { getUniqueAddresses } = require("../helper/utils") const sdk = require('@defillama/sdk') const config = { - 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', }, + base: { postionManager: '0x6822063E39f1b8F40373402Ac96963B383877B3C', 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: '0xf3B0362a5F210Fd826E74b3b10b269D4044085e5', factory: '0x1F98431c8aD98523631AE4a59f267346ea31F984', limWETH: '0x3a4F8E8512624226d2aC14fE496Bb9A4DdB73a9a', marginContract: '0x3611CD2B957514222a94C93e1A9a5be66b0b2841', graphEndpoint: 'https://api.studio.thegraph.com/query/71042/limitless-subgraph-arbitrum/version/latest', dataProvider: '0x9139929dFbEeDfB03bbF8B59b4005BC631529b14', lmQuoter: '0x2E4a9Eb87375D518F4c4473a845D56AAbf1967FE', }, linea: { postionManager: '0x726e3116AE07f43A7E1921c635352B75e2DEa4Ad', factory: '0x31FAfd4889FA1269F7a13A66eE0fB458f27D72A9', limWETH: '0x5188b47Cb80D1A3E22Cc6221792F199f1Fb0DD3c', }, } + const liquidityProvidedQuery = ` query($lastId: String, $block: Int) { liquidityProvideds( diff --git a/projects/lineabank/index.js b/projects/lineabank/index.js index 876dc1ede344..39cb80e2b081 100644 --- a/projects/lineabank/index.js +++ b/projects/lineabank/index.js @@ -19,9 +19,9 @@ const abis = { Object.keys(config).forEach(chain => { const comptroller = config[chain] - module.exports[chain] = compoundExports2({ comptroller, fetchBalances: true, abis, }) + module.exports[chain] = compoundExports2({ comptroller, abis, }) }) module.exports = mergeExports([module.exports, { - linea: compoundExports2({ comptroller: '0x43Eac5BFEa14531B8DE0B334E123eA98325de866', fetchBalances: true, abis, }), + linea: compoundExports2({ comptroller: '0x43Eac5BFEa14531B8DE0B334E123eA98325de866', abis, }), }]) \ No newline at end of file diff --git a/projects/linehub-v2/index.js b/projects/linehub-v2/index.js index 28159d8de6d8..4bd21a19cdad 100644 --- a/projects/linehub-v2/index.js +++ b/projects/linehub-v2/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x7811DeF28977060784cC509641f2DD23584b7671", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/liquidity-slicing/index.js b/projects/liquidity-slicing/index.js new file mode 100644 index 000000000000..4737eeb06712 --- /dev/null +++ b/projects/liquidity-slicing/index.js @@ -0,0 +1,56 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { ethers } = require('ethers'); + +const abi = { + "checkContract": "function checkContract(uint16,bytes32) view returns (uint256)", + "nodeStates": "function nodeStates(uint256,bytes32) view returns (uint256 totalStaked,uint256,uint256)" +} + + +const MANAGER_CONTRACT_ADDRESS = "0x1F0ea3b63F3Fca05719E54E7469Ef897754eF666"; + +const config = { + manta: { + transformToken: "manta-network", + chainId: 2, + decimals: 18, + delegator: { + "0x89060B31DB21C6cB4e946EaCB28EFefF085C275a": ["0x2847e7f2823a5048f4ae2cd808a5e978aa6ce41fcbb6e7e7bbbb1b64446b0639"] + }, + validator: { + "0xaB21907461313127Ce944F6f168888d93C091363": ["0x8e8103383262ff2256490767e2338ffc452bf602b0addede203da3218cc9d241"] + } + }, + aleo: { + transformToken: "aleo", + chainId: 5, + decimals: 6, + delegator: { + "0x52ade9c48599d71603cf661f98c9b7bd21cfb8ba448efd6204e89096b969c30c": ["0xbb57045a8a9c39dfb06baaf5ed6cb02343a17feecbf63aba9b15a6694476140f"] + }, + validator: { + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff": ["0x0000000000000000000000000000000000000000000000000000000000000005"] + } + } +}; + +async function tvl(api) { + for (const chain of Object.keys(config)) { + const { transformToken: tokenId, chainId, decimals, delegator, validator, } = config[chain]; + const allConfig = { ...delegator, ...validator }; + + for (const [hostAddr, nodes] of Object.entries(allConfig)) { + const i = await api.call({ abi: abi.checkContract, target: MANAGER_CONTRACT_ADDRESS, params: [chainId, ethers.zeroPadValue(hostAddr, 32)] }); + const calls = nodes.map(v => ({ params: [i, v] })) + const stakes = (await api.multiCall({ abi: abi.nodeStates, calls, target: MANAGER_CONTRACT_ADDRESS })).map(i => i.totalStaked) + stakes.forEach(val => api.addCGToken(tokenId, val / (10 ** decimals))) + } + } +} + +module.exports = { + arbitrum: { + start: 224198345, + tvl, + } +} diff --git a/projects/liqwid/index.js b/projects/liqwid/index.js index bfa1a678b133..ba25beed08e7 100644 --- a/projects/liqwid/index.js +++ b/projects/liqwid/index.js @@ -11,99 +11,124 @@ module.exports = { } }; - -const endpoint = 'https://api.liqwid.finance/graphql' - -const queryAdaLoans = `query ($page: Int) { - Page (page: $page) { - pageInfo { - currentPage - hasNextPage - } - loan(marketId: "Ada") { - collaterals { - id - amount +const endpoint = 'https://v2.api.liqwid.finance/graphql' + +const queryAdaLoans = `query($input: LoansInput){ + liqwid { + data { + loans(input: $input) { + page + pagesCount + results { + collaterals { + qTokenAmount + market { + id + } + } + } } } } } ` -const query = `query ($page: Int) { - Page (page: $page) { - pageInfo { - currentPage - hasNextPage - } - market { - asset { - marketId - name - qTokenId - qTokenPolicyId - } - state { - totalSupply - utilization - } - marketId - decimals - info { - params { - underlyingClass { - value0 { - symbol - name - } - } - } - scripts { - actionToken { - script { - value0 { - value0 - } - } +const query = `query($input: MarketsInput) { + liqwid { + data { + markets(input: $input) { + page + pagesCount + results { + id + asset { + id + currencySymbol + name + decimals } + supply + liquidity + borrow + utilization } } } } } ` + const tokenMapping = { - ADA: 'lovelace', + Ada: 'lovelace', DJED: '8db269c3ec630e06ae29f74bc39edd1f87c819f1056206e879a1cd61446a65644d6963726f555344', + USDM: 'c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d', DAI: 'dai', - + USDC: 'usd-coin', + USDT: 'tether', } -const getToken = market => tokenMapping[market.marketId.toUpperCase()] ?? market.info.params.underlyingClass.value0.symbol + toHex(market.info.params.underlyingClass.value0.name) +const getToken = (market) => tokenMapping[market.id] ?? market.asset.currencySymbol + market.asset.name const getOptimBondTVL = async () => { - const getLoans = async (pageIndex) => { - const { Page: { pageInfo, loan: loans } } = await graphQuery(endpoint, queryAdaLoans, { page: pageIndex }) - - if (!pageInfo.hasNextPage) { - return loans + const getLoans = async (pageIndex = 0, collectedLoans = []) => { + const { + liqwid: { + data: { loans }, + }, + } = await graphQuery(endpoint, queryAdaLoans, { + input: { + marketIds: 'Ada', + page: pageIndex, + }, + }) + + const allLoans = [...collectedLoans, ...loans.results] + + // Check if we've reached the last page + if (pageIndex < loans.pagesCount - 1) { + return await getLoans(pageIndex + 1, allLoans) } - return [...loans, ...(await getLoans(pageIndex + 1))] + + return allLoans } - const loans = await getLoans(0) - const relevantLoans = - loans.filter(l => (l.collaterals.filter(c => c.id === "OptimBond1")).length != 0) - const bonds = - relevantLoans.map(l => l.collaterals[0].amount).reduce((acc, amount) => - acc + Number(amount), 0) + const loans = await getLoans() + const relevantLoans = loans.filter((l) => + l.collaterals.some((c) => c.market.id === 'OptimBond1'), + ) + const bonds = relevantLoans + .flatMap((l) => l.collaterals) + .filter((c) => c.market.id === 'OptimBond1') + .reduce((acc, collateral) => acc + collateral.qTokenAmount, 0) return bonds } async function tvl(api) { - const { Page: { market: markets } } = await graphQuery(endpoint, query, { page: 0 }) + const getMarkets = async (pageIndex = 0, collectedMarkets = []) => { + const { + liqwid: { + data: { markets }, + }, + } = await graphQuery(endpoint, query, { + input: { + page: pageIndex, + }, + }) + + const allMarkets = [...collectedMarkets, ...markets.results] + + // Check if we've reached the last page + if (pageIndex < markets.pagesCount - 1) { + return await getMarkets(pageIndex + 1, allMarkets) + } - markets.forEach(market => add(api, market, market.state.totalSupply)) + return allMarkets + } + + const markets = await getMarkets() + markets.forEach((market) => + add(api, market, market.liquidity * 10 ** market.asset.decimals), + ) add(api, "OptimBond1", await getOptimBondTVL()) } @@ -117,36 +142,29 @@ function add(api, market, bal) { } async function borrowed(api) { - const { Page: { market: markets } } = await graphQuery(endpoint, query) - - markets.forEach(market => { - const utilization = market.state.utilization - const availability = 1 - utilization - const totalBorrowed = market.state.totalSupply * utilization / availability - add(api, market, totalBorrowed) - }) -} - -function base64ToHex(base64) { - return base64 - /* // Step 1: Decode the Base64 string to a byte array - const binaryData = atob(base64); + const getMarkets = async (pageIndex = 0, collectedMarkets = []) => { + const { + liqwid: { + data: { markets }, + }, + } = await graphQuery(endpoint, query, { + input: { + page: pageIndex, + }, + }) + + const allMarkets = [...collectedMarkets, ...markets.results] + + // Check if we've reached the last page + if (pageIndex < markets.pagesCount - 1) { + return await getMarkets(pageIndex + 1, allMarkets) + } - // Step 2: Convert each byte to its hexadecimal representation - const hexArray = []; - for (let i = 0; i < binaryData.length; i++) { - const byte = binaryData.charCodeAt(i).toString(16).padStart(2, '0'); - hexArray.push(byte); + return allMarkets } - // Step 3: Concatenate the hexadecimal values to form the final hexadecimal string - return hexArray.join(''); */ + const markets = await getMarkets() + markets.forEach((market) => { + add(api, market, market.borrow * 10 ** market.asset.decimals) + }) } - -function toHex(str) { - let hex = '' - for (let i = 0; i < str.length; i++) { - hex += str.charCodeAt(i).toString(16); - } - return hex -} \ No newline at end of file diff --git a/projects/lisk-l2/index.js b/projects/lisk-l2/index.js new file mode 100644 index 000000000000..9d4cb7703aa0 --- /dev/null +++ b/projects/lisk-l2/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') +const config = { + ethereum: { + owners: ['0x2658723bf70c7667de6b25f99fcce13a16d25d08', '0x26dB93F8b8b4f7016240af62F7730979d353f9A7',], + tokens: [nullAddress], + } +} + +Object.keys(config).forEach(chain => { + const { owners, tokens = [], blacklistedTokens, } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens, fetchCoValentTokens: true, blacklistedTokens, }) + } +}) \ No newline at end of file diff --git a/projects/lixir/index.js b/projects/lixir/index.js index dcf15c971546..5d003a73f6c2 100644 --- a/projects/lixir/index.js +++ b/projects/lixir/index.js @@ -1,75 +1,38 @@ -const sdk = require('@defillama/sdk'); const abi = require('./abi.json') -const {staking} = require('../helper/staking') +const { staking } = require('../helper/staking'); const oldRegistry = "0x3228f22d98d81A859aCC9890c3874FfF864a8Bd4"; const newRegistry = "0x18bf8A3eE39Be5730189A0C88D90f744e3c55B20"; const vault_role = "0x0e2208c692f4f271957e6c9d7c9785b7c2c3a7e329d54eecdfaa3c5f48b0cd51"; const lixirToken = "0xd0345D30FD918D7682398ACbCdf139C808998709"; -// node test.js projects/lixir/index.js -async function ethTvl(timestamp, block) { - let balances = await vaultTvl(oldRegistry, block, {}); - await vaultTvl(newRegistry, block, balances) - return balances//await newVaultTvl(block, newVaults, balances); +async function ethTvl(api) { + await vaultTvl(oldRegistry, api); + await vaultTvl(newRegistry, api) } -async function vaultTvl(registry, block, balances, pool2 = false) { - const count = Number((await sdk.api.abi.call({ - target: registry, - block, - params: [vault_role], - abi: abi.getRoleMemberCount - })).output) - const vaults = await sdk.api.abi.multiCall({ - block, - abi: abi.getRoleMember, - calls: [...Array(count)].map((_, i) => ({ - target: registry, - params: [vault_role, i], - })) - }) +async function vaultTvl(registry, api) { + const count = await api.call({ abi: abi.getRoleMemberCount, target: registry, params: vault_role }) + const calls = [] + for (let i = 0; i < count; i++) + calls.push({ params: [vault_role, i] }) - const calls = vaults.output.map(v=>({ - target: v.output - })) - const [totals, token0, token1] = await Promise.all([ - abi.calculateTotals, - abi.token0, - abi.token1 - ].map(abi=>sdk.api.abi.multiCall({ - block, - abi, - calls - }))) + const vaults = await api.multiCall({ abi: abi.getRoleMember, target: registry, calls, }) + const token0s = await api.multiCall({ abi: abi.token0, calls: vaults }) + const token1s = await api.multiCall({ abi: abi.token1, calls: vaults }) + const totals = await api.multiCall({ abi: abi.calculateTotals, calls: vaults }) - for(let i =0; i i[0]) - const symbolMapping = await getSymbols(chain, tokens) + const symbolMapping = await getSymbols(api.chain, tokens) tokensAndOwners = tokensAndOwners.filter(([token]) => isWhitelistedToken(symbolMapping[token], token, isVesting)) if (isVesting) - tokensAndOwners.push(...await getTokensAndOwners(vesting, chain, block, true)) - return sumTokens2({ tokensAndOwners, chain, block, }) + tokensAndOwners.push(...await getTokensAndOwners(vestingContract, api, true)) + return sumTokens2({ tokensAndOwners, api, resolveLP: true, }) } -async function getTokensAndOwners(contract, chain, block, isVestingContract) { +async function getTokensAndOwners(contract, api, isVestingContract) { const abis = { count: isVestingContract ? abi.escrows_length : abi.getLlamaPayContractCount, vault: isVestingContract ? abi.escrows : abi.getLlamaPayContractByIndex, } - const { output:contractCount } = await sdk.api.abi.call({ - target: contract, - abi: abis.count, - chain, block, - }) - - const { output: llamaPayContractsRes } = await sdk.api.abi.multiCall({ - target: contract, - abi: abis.vault, - calls: getParamCalls(contractCount), - chain, block, - }) - - const llamaPayContracts = llamaPayContractsRes.map(i => i.output) - const { output: llamaPayTokens } = await sdk.api.abi.multiCall({ - calls: llamaPayContracts.map(i => ({ target: i })) , - abi: abi.token, - chain, block, - }) - - return llamaPayTokens.map(({ output}, i) => ([output, llamaPayContracts[i]])) + const llamaPayContracts = await api.fetchList({ lengthAbi: abis.count, itemAbi: abis.vault, target: contract }) + const llamaPayTokens = await api.multiCall({ calls: llamaPayContracts, abi: abi.token, }) + return llamaPayTokens.map((token, i) => ([token, llamaPayContracts[i]])) } const chains = [ @@ -64,8 +45,6 @@ const chains = [ "metis" ] -module.exports = {} - chains.forEach(chain => { let contract = llamaPayDefault let vestingContract = llamaPayVesting @@ -74,14 +53,14 @@ chains.forEach(chain => { case 'avax': contract = llamaPayAvax; break; case 'meter': contract = llamaPayMeter; vestingContract = llamaPayMeterVesting; break; case 'metis': contract = llamaPayMetis; break; - case 'kava': contract = llamaPayKava ; vestingContract = llamaPayKavaVesting; break; + case 'kava': contract = llamaPayKava; vestingContract = llamaPayKavaVesting; break; } module.exports[chain] = { hallmarks: [ - [Math.floor(new Date('2022-10-03')/1e3), 'Vesting tokens are not included in tvl'], + [Math.floor(new Date('2022-10-03') / 1e3), 'Vesting tokens are not included in tvl'], ], - tvl: async (_, _b, { [chain]: block }) => calculateTvl(contract, vestingContract, block, chain, false), - vesting: async (_, _b, { [chain]: block }) => calculateTvl(contract, vestingContract, block, chain, true), + tvl: async (api) => calculateTvl(contract, vestingContract, api, false), + vesting: async (api) => calculateTvl(contract, vestingContract, api, true), } }) \ No newline at end of file diff --git a/projects/lobis.js b/projects/lobis.js index 5ca84c198591..444a4e7c517e 100644 --- a/projects/lobis.js +++ b/projects/lobis.js @@ -6,7 +6,7 @@ module.exports = ohmTvl(treasury, [ //curve [ADDRESSES.ethereum.CRV, false], //frax - ["0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", false], + [ADDRESSES.ethereum.FXS, false], //Sushi LP ["0x2734f4a846d1127f4b5d3bab261facfe51df1d9a", true], ], "ethereum", "0x3818eff63418e0a0ba3980aba5ff388b029b6d90", "0xdec41db0c33f3f6f3cb615449c311ba22d418a8d") diff --git a/projects/lobster-protocol/index.js b/projects/lobster-protocol/index.js new file mode 100644 index 000000000000..f136ccff46ab --- /dev/null +++ b/projects/lobster-protocol/index.js @@ -0,0 +1,30 @@ +const DHEDGE_FACTORY_ABI = "function getManagedPools(address manager) view returns (address[] managedPools)"; +const LOBSTER_POOL_ABI = "function getFundSummary() view returns (tuple(string name, uint256 totalSupply, uint256 totalFundValue))"; + +const CONFIG_DATA = { + arbitrum: { + dhedgeFactory: "0xffFb5fB14606EB3a548C113026355020dDF27535", + lobsterManager: "0x6EBb1B5Be9bc93858f71714eD03f67BF237473cB", + } +} + +async function tvl(api) { + const { dhedgeFactory, lobsterManager } = CONFIG_DATA[api.chain]; + + const pools = await api.call({ abi: DHEDGE_FACTORY_ABI, target: dhedgeFactory, params: lobsterManager, }); + const poolSummaries = await api.multiCall({ abi: LOBSTER_POOL_ABI, calls: pools, }) + api.addCGToken('tether', poolSummaries.reduce((acc, p) => acc + +p.totalFundValue/1e18, 0)) +} + +module.exports = { + misrepresentedTokens: true, + start: 1704067199, // Sunday 31 December 2023 23:59:59 + methodology: + "Aggregates total value of Lobster protocol vaults on Arbitrum", + arbitrum: { + tvl, + }, + hallmarks: [ + [1710971510, "First Arbitrum Vault Release"], + ], +} \ No newline at end of file diff --git a/projects/logx-v2/index.js b/projects/logx-v2/index.js new file mode 100644 index 000000000000..adc4a2f6c0a7 --- /dev/null +++ b/projects/logx-v2/index.js @@ -0,0 +1,32 @@ +const { staking } = require('../helper/staking') + +module.exports = { + methodology: "Tokens locked in HypCollateral contracts on different chains.", +} + +const config = { + base: ['0xaca5146bc74230e77DAB543d3a14F26c8c63939e',], + arbitrum: ['0x4882520D47491561F51ea96aBC0397776Efc6cFd', '0x1d9B044393804CCFa2da3127470C9F65D4E0E5E6',], + mantle: ['0x4417613C0fe034f7D333BF8a6247EaAAF1d51965', '0x650e8941E4d90b70576fDF1b05dbDc962DA2cab8',], + mode: ['0x4882520D47491561F51ea96aBC0397776Efc6cFd','0x8BF17893f08C570fBA78E9268d3aFc61f42557f1'], + bob: ['0xaca5146bc74230e77DAB543d3a14F26c8c63939e','0x1e7c3B771b27A29116E4Df5a2DCC54FDaAC902db'], + sei: ['0xc010f83ae18dC5f40e888898F6605F075686432e','0x0B3b4FAFDe8baFde82C3BfD38538B7aEe4407498'], + scroll: ['0x1C70cc9F8236C4Ae2ce3d34d4Da4696Aea611f90','0xcfFe53CEd05A750Fa58304c11997a0335dE731b6'], + kroma: ['0xaca5146bc74230e77DAB543d3a14F26c8c63939e','0x1e7c3B771b27A29116E4Df5a2DCC54FDaAC902db'], + taiko: ['0x650e8941E4d90b70576fDF1b05dbDc962DA2cab8','0x1d9B044393804CCFa2da3127470C9F65D4E0E5E6'], + optimism: ['0x650e8941E4d90b70576fDF1b05dbDc962DA2cab8','0x4417613C0fe034f7D333BF8a6247EaAAF1d51965'], + linea: ['0xaca5146bc74230e77DAB543d3a14F26c8c63939e','0x1e7c3B771b27A29116E4Df5a2DCC54FDaAC902db'] +} + +Object.keys(config).forEach(chain => { + let vault = config[chain] + module.exports[chain] = { + tvl: async (api) => { + if (!Array.isArray(vault)) vault = [vault] + const tokens = await api.multiCall({ abi: 'address:wrappedToken', calls: vault }) + return api.sumTokens({ tokensAndOwners2: [tokens, vault] }) + } + } +}) + +module.exports.arbitrum.staking = staking('0x89E86f7d2398e8C1070d321D18c1Ce75aBF09b75', '0x59062301Fb510F4ea2417B67404CB16D31E604BA') \ No newline at end of file diff --git a/projects/logx/index.js b/projects/logx/index.js index a90d5d4e53fa..35bd2953645b 100644 --- a/projects/logx/index.js +++ b/projects/logx/index.js @@ -2,6 +2,9 @@ const { nullAddress } = require("../helper/tokenMapping") module.exports = { methodology: "USDC.e in the vault", + hallmarks: [ + [Math.floor(new Date('2024-09-10')/1e3), 'v1 is deprecated'], + ], } const config = { diff --git a/projects/lolik/index.js b/projects/lolik/index.js index e79176466159..a26d2d8d6568 100644 --- a/projects/lolik/index.js +++ b/projects/lolik/index.js @@ -1,6 +1,7 @@ +const ADDRESSES = require('../helper/coreAssets.json') async function tvl(api) { - const pooledFTN = await api.call({ target: '0x780Fb5AcA83F2e3F57EE18cc3094988Ef49D8c3d', abi: "uint256:getTotalPooledFtn" }) + const pooledFTN = await api.call({ target: ADDRESSES.ftn.stFTN, abi: "uint256:getTotalPooledFtn" }) return { 'coingecko:fasttoken': pooledFTN / 1e18, diff --git a/projects/lombard-vault/index.js b/projects/lombard-vault/index.js new file mode 100644 index 000000000000..d169e56869ce --- /dev/null +++ b/projects/lombard-vault/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require('../helper/unwrapLPs'); +const vaults = [ + '0x5401b8620E5FB570064CA9114fd1e135fd77D57c', +] + +module.exports = { + doublecounted: true, + ethereum: { + tvl: sumTokensExport({ owners: vaults, fetchCoValentTokens: true, tokenConfig: { + onlyWhitelisted: false, + }, resolveUniV3: true,}), + }, +} \ No newline at end of file diff --git a/projects/lombard/index.js b/projects/lombard/index.js new file mode 100644 index 000000000000..8789b8cfd0a3 --- /dev/null +++ b/projects/lombard/index.js @@ -0,0 +1,13 @@ +const { sumTokens } = require('../helper/chain/bitcoin') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.lombard() }) +} + +module.exports = { + doublecounted:true, + timetravel: false, + isHeavyProtocol: true, + bitcoin: { tvl } +} \ No newline at end of file diff --git a/projects/loopfi/index.js b/projects/loopfi/index.js index 1cc6ccdb44f9..496e556f1674 100644 --- a/projects/loopfi/index.js +++ b/projects/loopfi/index.js @@ -2,6 +2,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unwrapLPs") const LOOP_PRELAUNCH = "0xaBEEcB1d3414550B30694bB37ac24CAaD0b82aE9" +const LOOP_PRELAUNCH_SCROLL = "0x640befeAd1A7ce841ef878058A7003EC260ebAE8" +const LOOP_PRELAUNCH_BTC = "0x497Fb40D610C29E66d06F3B18Cd9966053abB49A" +const LOOP_PRELAUNCH_YNETH = "0xa67C60AE18BE09F074a6c733a1cc06B63Ae53589" const tokens = { WETH: ADDRESSES.ethereum.WETH, @@ -13,14 +16,36 @@ const tokens = { pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72", } +const tokensScroll = { + WETH: ADDRESSES.scroll.WETH, + STONE: ADDRESSES.scroll.STONE, + weETH: '0x01f0a31698C4d065659b9bdC21B3610292a1c506', + wrsETH: '0xa25b25548B4C98B0c7d3d27dcA5D5ca743d68b7F', + pufETH: '0xc4d46E8402F476F269c379677C99F18E22Ea030e', +} + +const tokensBtc = { + WBTC: ADDRESSES.ethereum.WBTC, + swBTC: '0x8DB2350D78aBc13f5673A411D4700BCF87864dDE' +} + +const tokensYieldnest = { + ynETH: '0x09db87A538BD693E9d08544577d5cCfAA6373A48' +} + module.exports = { methodology: - "Counts the number of WETH and LRT tokens in the LoopFi Prelaunch Contract.", + "Counts the number of WETH, WBTC and LRT tokens in the LoopFi Prelaunch Contracts in Ethereum and Scroll networks.", start: 1718390875, ethereum: { tvl: sumTokensExport({ - owner: LOOP_PRELAUNCH, - tokens: Object.values(tokens), - }), + ownerTokens: [[Object.values(tokens), LOOP_PRELAUNCH], [Object.values(tokensBtc), LOOP_PRELAUNCH_BTC], [Object.values(tokensYieldnest), LOOP_PRELAUNCH_YNETH]], + }) }, + scroll: { + tvl: sumTokensExport({ + owner: LOOP_PRELAUNCH_SCROLL, + tokens: Object.values(tokensScroll), + }) + } } diff --git a/projects/loopring/index.js b/projects/loopring/index.js index 9dfd04a6f141..eb0990b64442 100644 --- a/projects/loopring/index.js +++ b/projects/loopring/index.js @@ -1,4 +1,6 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') module.exports = { ethereum: { @@ -12,4 +14,18 @@ module.exports = { fetchCoValentTokens: true, }), }, + taiko: { + tvl: + sumTokensExport({ + owners: ['0x3e71a41325e1d6B450307b6535EC48627ac4DaCC'], + tokens: [ + ADDRESSES.null, + ADDRESSES.taiko.USDC, + ADDRESSES.taiko.USDT, + ADDRESSES.taiko.DAI, + ADDRESSES.taiko.LRC, + ADDRESSES.taiko.TAIKO + ] + }), + } }; diff --git a/projects/lore/index.js b/projects/lore/index.js new file mode 100644 index 000000000000..35520fc00160 --- /dev/null +++ b/projects/lore/index.js @@ -0,0 +1,5 @@ +const { aaveExports } = require('../helper/aave') + +module.exports = { + scroll: aaveExports("scroll", "0xBc6DE4458b7D6fbf82240ce8cC0CA6a2f4986eb5"), +} diff --git a/projects/lorenzo-bsc-lst/index.js b/projects/lorenzo-bsc-lst/index.js new file mode 100644 index 000000000000..09fedff989cf --- /dev/null +++ b/projects/lorenzo-bsc-lst/index.js @@ -0,0 +1,20 @@ +const sdk = require('@defillama/sdk'); + +async function bscTvl(api) { + const stBTCTokenAddress = '0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3'; + const totalSupply = await api.call({ + abi: 'erc20:totalSupply', + target: stBTCTokenAddress, + }); + + const balances = {}; + sdk.util.sumSingleBalance(balances, 'coingecko:bitcoin', totalSupply / (1e18)); + return balances; +} + +module.exports = { + methodology: "Lorenzo, As the Bitcoin Liquidity Finance Layer", + bsc: { + tvl: bscTvl, + } +}; \ No newline at end of file diff --git a/projects/lorenzo-enzoBTC/index.js b/projects/lorenzo-enzoBTC/index.js new file mode 100644 index 000000000000..1f26d167d716 --- /dev/null +++ b/projects/lorenzo-enzoBTC/index.js @@ -0,0 +1,7 @@ +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') +const { sumTokensExport } = require("../helper/sumTokens"); + +module.exports = { + methodology: "enzoBTC, Lorenzo Wrapped Bitcoin", + bitcoin: { tvl: sumTokensExport({ owners: bitcoinAddressBook.lorenzo2 }) } +}; \ No newline at end of file diff --git a/projects/lorenzo/index.js b/projects/lorenzo/index.js index c0ee691cba96..cf0fbcf01ee0 100644 --- a/projects/lorenzo/index.js +++ b/projects/lorenzo/index.js @@ -1,23 +1,8 @@ const { sumTokensExport } = require("../helper/sumTokens"); - -const LorenzoOwners = [ - "bc1pzd6luyardlle9f7lul2y8fl72c22p6vxspc4k4g4gzgjf8975s0sr042yt", - "bc1p7agkadaau66jtva9n8k5pg3lsctuyqur8a2l5y9hzwqkh5nlmd0skuhws3", - "bc1qaf6laj9m7jteztyz4lulrtcjtpusfcfnd7r7xn", - "bc1qf6cj2z2e2mzuvfrl80vgt53k7jc2vf36ckahgy", - "bc1q5hc68n6krnzgzswf7rknha2aqxzrzup4vlhce8", - "bc1qpxpmr3zdjulqnwa3jdvm83tpaek6dv3kc75ms7", - "bc1qaml9d9mqgfhsfuaa2ymutdl4psj8c2undx9n72", - "bc1qutgngqyrflxrfmk9k28ucvq0s2v8a43nwfwv02", - "bc1qrx3fpr5j6sprxett45c2kl9p4pajyxep0mapfd", - "bc1q00t2ntm46c2nfvcer6ukj6npaxjurujthse4qq", - "bc1q3pzhncle68gct6me08kn5kf9awkevt6ettwrmg", - "bc1qw6cvwx8ajprmp2lzkhrsps2qx4k9r2pj4xj98x" -]; +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: "Lorenzo, As the Bitcoin Liquidity Finance Layer", - bitcoin: { - tvl: sumTokensExport({ owners : LorenzoOwners }), - } + doublecounted:true, + bitcoin: { tvl: sumTokensExport({ owners : bitcoinAddressBook.lorenzo }) } }; \ No newline at end of file diff --git a/projects/loxodrome-perp/index.js b/projects/loxodrome-perp/index.js new file mode 100644 index 000000000000..8aded92dff57 --- /dev/null +++ b/projects/loxodrome-perp/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + iotex: { + tvl: gmxExports({ vault: '0x13904291B7d3e87d23070d22Bc34FA514F99Db18' }) + }, +} \ No newline at end of file diff --git a/projects/lucidly/index.js b/projects/lucidly/index.js new file mode 100644 index 000000000000..2934990891b3 --- /dev/null +++ b/projects/lucidly/index.js @@ -0,0 +1,18 @@ +async function tvl(api) { + const registryAddress = '0x3C2A24c9296eC8B1fdb8039C937DaC7CBca3976c'; + + const pools = await api.call({ + abi: 'function getPoolAddresses() view returns (address[])', + target: registryAddress, + }); + + const tokens = await api.fetchList({ lengthAbi: 'numTokens', itemAbi: 'tokens', calls: pools, groupedByInput: true, }) + const ownerTokens = pools.map((v, i) => [tokens[i], v]) + return api.sumTokens({ ownerTokens }) +} + + +module.exports = { + start: 1693971707, + ethereum: { tvl } +}; diff --git a/projects/lulo/index.js b/projects/lulo/index.js new file mode 100644 index 000000000000..084fb15f9264 --- /dev/null +++ b/projects/lulo/index.js @@ -0,0 +1,33 @@ +const sdk = require('@defillama/sdk') + +const endpoint = 'http://api.flexlend.fi/stats' +const startTimestamp = 1704067200 // 2024-01-01 + +async function tvl(options) { + const balances = {} + const request = { + method: 'GET', + headers: { + accept: 'application/json', + 'x-lulo-api-key': String(process.env.LULO_API_KEY || ''), + }, + } + + const response = await fetch(`${endpoint}?timestamp=${options.timestamp}`, request) + + const { data } = await response.json() + + data.map(d => { + sdk.util.sumSingleBalance(balances, d.mintAddress, d.tokens, 'solana') + }) + return balances +} + +module.exports = { + doublecounted: true, + timetravel: true, + start: startTimestamp, + methodology: + 'Volume is calculated by summing the total USD value of deposited funds in Lulo across all tokens', + solana: { tvl }, +} diff --git a/projects/lynx/index.js b/projects/lynx/index.js index 38ecda6e9e89..b1234d9e1ec9 100644 --- a/projects/lynx/index.js +++ b/projects/lynx/index.js @@ -12,8 +12,24 @@ const config = { ], ], }, + mode: { + tokenAndOwnerPair: [ + [ + // MODE Token + "0xDfc7C877a950e49D2610114102175A06C2e3167a", + // OFTChipAdapter (owner) + "0x3b7ED1cDF0Fc64d95c0D0428b9Cc99b6A9a5CB94", + ], + ], + }, fantom: { tokenAndOwnerPair: [ + [ + // WFTM Token + ADDRESSES.fantom.WFTM, + // OFTChipAdapter (owner) + "0x614aA983f54409D475aeC5D18120FECFD6320eF4" + ], [ // FTM Token "0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE", @@ -22,11 +38,11 @@ const config = { ], [ // USDC Token - "0x04068da6c83afcfa0e13ba15a6696662335d5b75", + ADDRESSES.fantom.USDC, // OFTChipAdapter (owner) "0x194609ea1C1D77e66eaB28C48CE266A48f3bC30a", ], - [ + [ // FSONIC Token "0x05e31a691405d06708a355c029599c12d5da8b28", // OFTChipAdapter (owner) @@ -90,7 +106,7 @@ const config = { tokenAndOwnerPair: [ [ // stEUR Token - "0x004626a008b1acdc4c74ab51644093b155e59a23", + ADDRESSES.celo.STEUR, // OFTChipAdapter (owner) "0xc5e782e2a4e2cfcb7ed454cf5a7b6aa2bb424b90", ], diff --git a/projects/m0/index.js b/projects/m0/index.js new file mode 100644 index 000000000000..3bb30964b3af --- /dev/null +++ b/projects/m0/index.js @@ -0,0 +1,18 @@ +const { getLogs2 } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') + +const minterGateway = '0xf7f9638cb444d65e5a40bf5ff98ebe4ff319f04e' +const eventAbi = "event MinterActivated(address indexed minter, address indexed caller)" +const abi = 'function collateralOf(address minter_) view returns (uint240)' + +const tvl = async (api) => { + const logs = await getLogs2({ api, target: minterGateway, eventAbi, fromBlock: 19818447, extraKey: 'MinterActivated' }) + const minters = [...new Set(logs.map(log => log.minter))]; + const collateralOf = await api.multiCall({ target: minterGateway, calls: minters, abi }) + api.add(ADDRESSES.ethereum.USDC, collateralOf) +} + +module.exports = { + methodology: "TVL corresponds to the value minted by an institution by depositing short-term T-bills", + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/macaron/config.js b/projects/macaron/config.js index 15ca85d9a0c7..af0703676f70 100644 --- a/projects/macaron/config.js +++ b/projects/macaron/config.js @@ -1,1011 +1,250 @@ -const ADDRESSES = require('../helper/coreAssets.json') const vaults_bsc = [ { - "sousId": 0, "stakingToken": { "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" + "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", }, - "earningToken": { - "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" - }, - "contractAddress": { - "56": "0xCd59d44E94Dec10Bb666f50f98cD0B1593dC3a3A", - "97": "" - }, - "masterchef": { - "56": "0x73feaa1eE314F8c655E354234017bE2193C9E24E", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "10", - "sortOrder": 1, - "isFinished": true + "contractAddress": "0xCd59d44E94Dec10Bb666f50f98cD0B1593dC3a3A", + "masterchef": "0x73feaa1eE314F8c655E354234017bE2193C9E24E", }, { - "sousId": 1, "stakingToken": { "symbol": "BAKE", - "address": { - "56": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", - "97": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5" - }, - "decimals": 18, - "projectLink": "https://www.bakeryswap.org/" - }, - "earningToken": { - "symbol": "BAKE", - "address": { - "56": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", - "97": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5" - }, - "decimals": 18, - "projectLink": "https://www.bakeryswap.org/" + "address": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", }, - "contractAddress": { - "56": "0xBB7ac3eB02c6d012cc8e2d916678De8843Eb8A56", - "97": "" - }, - "masterchef": { - "56": "0x20eC291bB8459b6145317E7126532CE7EcE5056f", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.39375", - "sortOrder": 1, - "isFinished": true + "contractAddress": "0xBB7ac3eB02c6d012cc8e2d916678De8843Eb8A56", + "masterchef": "0x20eC291bB8459b6145317E7126532CE7EcE5056f", }, { - "sousId": 2, "stakingToken": { "symbol": "BANANA", - "address": { - "56": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apeswap.finance/" - }, - "earningToken": { - "symbol": "BANANA", - "address": { - "56": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apeswap.finance/" - }, - "contractAddress": { - "56": "0xd474366F6c80230507481495F3C1490e62E3093F", - "97": "" - }, - "masterchef": { - "56": "0x5c8d727b265dbafaba67e050f2f739caeeb4a6f9", - "97": "" + "address": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "2.5", - "sortOrder": 1, - "isFinished": false + "contractAddress": "0xd474366F6c80230507481495F3C1490e62E3093F", + "masterchef": "0x5c8d727b265dbafaba67e050f2f739caeeb4a6f9", }, { - "sousId": 3, "stakingToken": { "symbol": "BAKE", - "address": { - "56": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", - "97": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5" - }, - "decimals": 18, - "projectLink": "https://www.bakeryswap.org/" + "address": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", }, - "earningToken": { - "symbol": "BAKE", - "address": { - "56": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5", - "97": "0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5" - }, - "decimals": 18, - "projectLink": "https://www.bakeryswap.org/" - }, - "contractAddress": { - "56": "0x6dAc44A858Cb51e0d4d663A6589D2535A746607A", - "97": "" - }, - "masterchef": { - "56": "0x6a8DbBfbB5a57d07D14E63E757FB80B4a7494f81", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.025315565", - "sortOrder": 1, - "isFinished": false + "contractAddress": "0x6dAc44A858Cb51e0d4d663A6589D2535A746607A", + "masterchef": "0x6a8DbBfbB5a57d07D14E63E757FB80B4a7494f81", } ] const choco_pools_bsc = [ { - "sousId": 0, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "contractAddress": { - "56": "0xFcDE390bF7a8B8614EC11fa8bde7565b3E64fe0b", - "97": "0x09B7e4A3E9d3c5d5Da59B2F371ABC3a81Ff6c443" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0715", - "sortOrder": 1, - "isFinished": false + "contractAddress": "0xFcDE390bF7a8B8614EC11fa8bde7565b3E64fe0b", }, { - "sousId": 1, "stakingToken": { "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", }, - "contractAddress": { - "56": "0xCded81aa5Ab3A433CadF77Fd5aC8B6fD973906e1", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0022", - "sortOrder": 3, - "isFinished": true, + "contractAddress": "0xCded81aa5Ab3A433CadF77Fd5aC8B6fD973906e1", "isCLP": true, - "syrupAddresses": { - "56": "0x009cF7bC57584b7998236eff51b98A168DceA9B0", - "97": "" - } + "syrupAddresses": "0x009cF7bC57584b7998236eff51b98A168DceA9B0", }, { - "sousId": 3, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "earningToken": { - "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" - }, - "contractAddress": { - "56": "0xF69bdcDB577F98753d4890Cc5aCfF3BE00177584", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.002", - "sortOrder": 4, - "isFinished": false, - "isCLP": false + "contractAddress": "0xF69bdcDB577F98753d4890Cc5aCfF3BE00177584", }, { - "sousId": 4, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" - }, - "contractAddress": { - "56": "0x7DB34B681c759918079C67EeF08868225F34fbcB", - "97": "" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.810185185", - "sortOrder": 5, - "isFinished": false, - "isCLP": false + "contractAddress": "0x7DB34B681c759918079C67EeF08868225F34fbcB", }, { - "sousId": 5, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "TBAKE", - "address": { - "56": "0x26d6e280f9687c463420908740ae59f712419147", - "97": "" - }, - "decimals": 18, - "projectLink": "https://bakerytools.io/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "contractAddress": { - "56": "0x13ED683DDf483d1f0bd2AE02b01D4d1D451D6c5b", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "1.099", - "sortOrder": 6, - "isFinished": false, - "isCLP": false + "contractAddress": "0x13ED683DDf483d1f0bd2AE02b01D4d1D451D6c5b", }, { - "sousId": 6, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "BREW", - "address": { - "56": "0x790Be81C3cA0e53974bE2688cDb954732C9862e1", - "97": "" - }, - "decimals": 18, - "projectLink": "https://cafeswap.finance/" - }, - "contractAddress": { - "56": "0x0f819C8E6A7c0F0906CBc84b9b1e6642f9634E61", - "97": "" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.00498", - "sortOrder": 5, - "isFinished": false, - "isCLP": false + "contractAddress": "0x0f819C8E6A7c0F0906CBc84b9b1e6642f9634E61", }, { - "sousId": 7, "stakingToken": { "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" - }, - "earningToken": { - "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" + "address": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", }, - "contractAddress": { - "56": "0x903A20CDbAC174250eAcc7437720929f0dE97B99", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.950347", - "sortOrder": 7, - "isFinished": false, - "isCLP": false + "contractAddress": "0x903A20CDbAC174250eAcc7437720929f0dE97B99", }, { - "sousId": 8, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "Helmet", - "address": { - "56": "0x948d2a81086a075b3130bac19e4c6dee1d2e3fe8", - "97": "" - }, - "decimals": 18, - "projectLink": "https://www.helmet.insure/" - }, - "contractAddress": { - "56": "0x82cF07a989835b68260989F13Bc853f8fe48ad04", - "97": "" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.06510416", - "sortOrder": 3, - "isFinished": false, - "isCLP": false + "contractAddress": "0x82cF07a989835b68260989F13Bc853f8fe48ad04", }, { - "sousId": 9, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "earningToken": { - "symbol": "HOTCROSS", - "address": { - "56": "0x4FA7163E153419E0E1064e418dd7A99314Ed27b6", - "97": "" - }, - "decimals": 18, - "projectLink": "https://www.hotcross.com/" - }, - "contractAddress": { - "56": "0xc8De98F603af53a5D52AF6AA153d9e15b0002B2c", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0992476", - "sortOrder": 3, - "isFinished": false, - "isCLP": false + "contractAddress": "0xc8De98F603af53a5D52AF6AA153d9e15b0002B2c", }, { - "sousId": 10, "stakingToken": { "symbol": "SMG", - "address": { - "56": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", - "97": "" - }, - "decimals": 8, - "projectLink": "https://smaugs.com/" + "address": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", }, - "earningToken": { - "symbol": "SMG", - "address": { - "56": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", - "97": "" - }, - "decimals": 8, - "projectLink": "https://smaugs.com/" - }, - "contractAddress": { - "56": "0xf3D514263239672455306D188DD5f045E61deD03", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.138", - "sortOrder": 3, - "isFinished": true, - "isCLP": false + "contractAddress": "0xf3D514263239672455306D188DD5f045E61deD03", }, { - "sousId": 11, "stakingToken": { "symbol": "SMG", - "address": { - "56": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", - "97": "" - }, - "decimals": 8, - "projectLink": "https://smaugs.com/" - }, - "earningToken": { - "symbol": "SMG", - "address": { - "56": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", - "97": "" - }, - "decimals": 8, - "projectLink": "https://smaugs.com/" - }, - "contractAddress": { - "56": "0xC85C50988AEC8d260853443B345CAE63B7432b7A", - "97": "" + "address": "0x6bfd576220e8444ca4cc5f89efbd7f02a4c94c16", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.138", - "sortOrder": 3, - "isFinished": false, - "isCLP": false + "contractAddress": "0xC85C50988AEC8d260853443B345CAE63B7432b7A", }, { - "sousId": 12, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "earningToken": { - "symbol": "DUEL", - "address": { - "56": "0x297817ce1a8de777e7ddbed86c3b7f9dc9349f2c", - "97": "" - }, - "decimals": 18, - "projectLink": "https://www.duel.network/" - }, - "contractAddress": { - "56": "0xF60EDbF7D95E79878f4d448F0CA5622479eB8790", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.11574", - "sortOrder": 2, - "isFinished": false, - "isCLP": false + "contractAddress": "0xF60EDbF7D95E79878f4d448F0CA5622479eB8790", }, { - "sousId": 13, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" - }, - "contractAddress": { - "56": "0x99d3334CC9dF44Fb2788C2161FB296fb6Cf14a57", - "97": "" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.001", - "sortOrder": 3, - "isFinished": false, - "isCLP": false + "contractAddress": "0x99d3334CC9dF44Fb2788C2161FB296fb6Cf14a57", }, { - "sousId": 14, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "wBNB", - "address": { - "56": ADDRESSES.bsc.WBNB, - "97": "0xae13d989dac2f0debff460ac112a837c89baa7cd" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "contractAddress": { - "56": "0xD80bdF70b17bA4fDd0383171623D782D00c8be2E", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.000011574", - "sortOrder": 3, - "isFinished": false, - "isCLP": false, - "isLockPool": true + "contractAddress": "0xD80bdF70b17bA4fDd0383171623D782D00c8be2E", }, { - "sousId": 15, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "contractAddress": { - "56": "0x28D0e8f18FA73824C91ca77e28727d79b815aEF1", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0008", - "sortOrder": 3, - "isFinished": false, - "isCLP": false, - "isLockPool": true + "contractAddress": "0x28D0e8f18FA73824C91ca77e28727d79b815aEF1", }, { - "sousId": 16, "stakingToken": { "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" - }, - "earningToken": { - "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" + "address": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", }, - "contractAddress": { - "56": "0xa71aFD72A7ed03d2ad9D08A20cdadf17b067f33a", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.81", - "sortOrder": 6, - "isFinished": false, - "isCLP": false + "contractAddress": "0xa71aFD72A7ed03d2ad9D08A20cdadf17b067f33a", }, { - "sousId": 17, "stakingToken": { "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "TAPE", - "address": { - "56": "0xf63400ee0420ce5b1ebdee0c942d7de1c734a41f", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apetools.co/" + "address": "0xacb2d47827c9813ae26de80965845d80935afd0b", }, - "contractAddress": { - "56": "0x765c1a0b22130d0e8a61dbb125c1eec5710383f1", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.81", - "sortOrder": 3, - "isFinished": false, - "isCLP": false, - "isLockPool": true + "contractAddress": "0x765c1a0b22130d0e8a61dbb125c1eec5710383f1", }, { - "sousId": 18, "stakingToken": { "symbol": "BANANA", - "address": { - "56": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", - "97": "" - }, - "decimals": 18, - "projectLink": "https://apeswap.finance/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", }, - "contractAddress": { - "56": "0x4f0a992B465C1D8482b4E2a0861B6cAEE8B3171f", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "", - "sortOrder": 4, - "isFinished": false, - "isCLP": false, - "isLockPool": false, - "isBBChef": true + "contractAddress": "0x4f0a992B465C1D8482b4E2a0861B6cAEE8B3171f", }, { - "sousId": 19, "stakingToken": { "symbol": "BSW", - "address": { - "56": "0x965F527D9159dCe6288a2219DB51fc6Eef120dD1", - "97": "" - }, - "decimals": 18, - "projectLink": "https://biswap.org/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0x965F527D9159dCe6288a2219DB51fc6Eef120dD1", }, - "contractAddress": { - "56": "0x2a1Bf8e04633e397207d63F234d281fEf781B6F5", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "", - "sortOrder": 4, - "isFinished": false, - "isCLP": false, - "isLockPool": false, - "isBBChef": true + "contractAddress": "0x2a1Bf8e04633e397207d63F234d281fEf781B6F5", }, { - "sousId": 20, "stakingToken": { "symbol": "CAKE", - "address": { - "56": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", - "97": "0xa35062141Fa33BCA92Ce69FeD37D0E8908868AAe" - }, - "decimals": 18, - "projectLink": "https://pancakeswap.finance/" + "address": "0x0e09fabb73bd3ade0a17ecc321fd13a19e81ce82", }, - "earningToken": { - "symbol": "MCRN", - "address": { - "56": "0xacb2d47827c9813ae26de80965845d80935afd0b", - "97": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "contractAddress": { - "56": "0x7C454456fc9E86EA1cF1e524FF8B8EbA613189E5", - "97": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "", - "sortOrder": 1, - "isFinished": false, - "isCLP": false, - "isLockPool": false, - "isBBChef": true + "contractAddress": "0x7C454456fc9E86EA1cF1e524FF8B8EbA613189E5", } ] const choco_pools_polygon = [ { - "sousId": 0, "stakingToken": { "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "contractAddress": { - "137": "0xC200cE4853d97e5f11320Bb8ee17F4D895f5e7BB", - "80001": "0xcE702936B63B6C9c3E059b315807BbE6212F1647" + "address": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0085", - "sortOrder": 1, - "isFinished": false + "contractAddress": "0xC200cE4853d97e5f11320Bb8ee17F4D895f5e7BB", }, { - "sousId": 1, "stakingToken": { "symbol": "QUICK", - "address": { - "137": "0x831753dd7087cac61ab5644b308642cc1c33dc13", - "80001": "" - }, - "decimals": 18, - "projectLink": "https://quickswap.exchange/" + "address": "0x831753dd7087cac61ab5644b308642cc1c33dc13", }, - "earningToken": { - "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "contractAddress": { - "137": "0xDeC7950840a32010410dcfFDC735911151604Ba5", - "80001": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.002", - "sortOrder": 2, - "isFinished": true, + "contractAddress": "0xDeC7950840a32010410dcfFDC735911151604Ba5", "isCLP": true, - "syrupAddresses": { - "137": "0xf28164A485B0B2C90639E47b0f377b4a438a16B1", - "80001": "" - } + "syrupAddresses": "0xf28164A485B0B2C90639E47b0f377b4a438a16B1", }, { - "sousId": 2, "stakingToken": { "symbol": "QUICK", - "address": { - "137": "0x831753dd7087cac61ab5644b308642cc1c33dc13", - "80001": "" - }, - "decimals": 18, - "projectLink": "https://quickswap.exchange/" - }, - "earningToken": { - "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "contractAddress": { - "137": "0x4b68bA327Cad4d8C4d0Bc783d686d08CFAa5C5D3", - "80001": "" + "address": "0x831753dd7087cac61ab5644b308642cc1c33dc13", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.002", - "sortOrder": 3, - "isFinished": false, + "contractAddress": "0x4b68bA327Cad4d8C4d0Bc783d686d08CFAa5C5D3", "isCLP": true, - "syrupAddresses": { - "137": "0xf28164A485B0B2C90639E47b0f377b4a438a16B1", - "80001": "" - } + "syrupAddresses": "0xf28164A485B0B2C90639E47b0f377b4a438a16B1", }, { - "sousId": 3, "stakingToken": { "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", }, - "earningToken": { - "symbol": "QUICK", - "address": { - "137": "0x831753dd7087cac61ab5644b308642cc1c33dc13", - "80001": "" - }, - "decimals": 18, - "projectLink": "https://quickswap.exchange/" - }, - "contractAddress": { - "137": "0xdb5640313fc4c958D3Fb2CF546d57dF142882acf", - "80001": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0000125", - "sortOrder": 4, - "isFinished": false, - "isCLP": false + "contractAddress": "0xdb5640313fc4c958D3Fb2CF546d57dF142882acf", }, { - "sousId": 4, "stakingToken": { "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "earningToken": { - "symbol": "QUICK", - "address": { - "137": "0x831753dd7087cac61ab5644b308642cc1c33dc13", - "80001": "" - }, - "decimals": 18, - "projectLink": "https://quickswap.exchange/" - }, - "contractAddress": { - "137": "0x337CC5daBaf1f874ACec0031d3d682CAF6DD2FC8", - "80001": "" + "address": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.0000125", - "sortOrder": 3, - "isFinished": false, - "isCLP": false, - "isLockPool": true + "contractAddress": "0x337CC5daBaf1f874ACec0031d3d682CAF6DD2FC8", }, { - "sousId": 5, "stakingToken": { "symbol": "MCRN", - "address": { - "137": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", - "80001": "0xfb53da50e544b06ecdc6827ab0df60a3b3801021" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" + "address": "0xba25b552c8a098afdf276324c32c71fe28e0ad40", }, - "earningToken": { - "symbol": "wMATIC", - "address": { - "137": ADDRESSES.polygon.WMATIC_2, - "80001": "" - }, - "decimals": 18, - "projectLink": "https://macaronswap.finance/" - }, - "contractAddress": { - "137": "0xA7661a7aeAF507a7782C230a45a002519cFC158C", - "80001": "" - }, - "poolCategory": "Core", - "harvest": true, - "tokenPerBlock": "0.00195216", - "sortOrder": 2, - "isFinished": false, - "isCLP": false, - "isLockPool": true + "contractAddress": "0xA7661a7aeAF507a7782C230a45a002519cFC158C", } ] - module.exports = { bsc: { masterchef: '0xFcDE390bF7a8B8614EC11fa8bde7565b3E64fe0b', token: '0xacb2d47827c9813ae26de80965845d80935afd0b'.toLowerCase(), chocochef: 'https://api.macaronswap.finance/chocofalls?chainId=56', pools: choco_pools_bsc, - masterchefPools: 'https://api.macaronswap.finance/magicboxes?chainId=56', - vaults: 'https://api.macaronswap.finance/boostpools', vaults_json: vaults_bsc, LPs: [ '0xe8D5d81dac092Ae61d097f84EFE230759BF2e522'.toLowerCase(), '0xc8f900cd8052862a8a5abf9278ad088611b2bd04'.toLowerCase(), ], - erc20s: [ - //MCRN - // "0xacb2d47827c9813ae26de80965845d80935afd0b", - //BANANA - "0x603c7f932ed1fc6575303d8fb018fdcbb0f39a95", - //CAKE - "0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82", - - ], - treasury: "0x67f1D48a8991009e0b092e9C34ca16f7d6072ec1", - chainId: 56, }, polygon: { masterchef: '0xC200cE4853d97e5f11320Bb8ee17F4D895f5e7BB', token: '0xba25b552c8a098afdf276324c32c71fe28e0ad40'.toLowerCase(), - chocochef: 'https://api.macaronswap.finance/chocofalls?chainId=137', pools: choco_pools_polygon, LPs: [ '0xfc53defcF4e21B868DaCEAA6350D507493F57110'.toLowerCase(), '0xde84c8f0562eB56A5fc8f07819cEF1FAf9Df3EBc'.toLowerCase(), ], - masterchefPools: 'https://api.macaronswap.finance/magicboxes?chainId=137', - chainId: 137, } } diff --git a/projects/macaron/index.js b/projects/macaron/index.js index c1d7c566b9dd..58c43124446a 100644 --- a/projects/macaron/index.js +++ b/projects/macaron/index.js @@ -1,52 +1,31 @@ const abi = require("./abi.json"); const config = require("./config"); -const { sumTokens, unwrapUniswapLPs, } = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); - -const { getChainTransform, } = require("../helper/portedTokens"); - -module.exports = {} +const { sumTokensExport, sumTokens2, } = require("../helper/unwrapLPs"); function setChainTVL(chain) { - const { masterchef, pools, vaults_json, chainId, erc20s, LPs, token, } = config[chain] - let getTvl - - async function getAllTVL(ts, _block, chainBlocks) { - const transform = await getChainTransform(chain) - const block = chainBlocks[chain] - const balances = { - tvl: {}, - staking: {}, - pool2: {}, - } - - const lengthOfPool = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterchef, - chain, block, - }) - ).output - - const lpPositionCalls = []; - - for (let index = 0; index < lengthOfPool; index++) - lpPositionCalls.push({ params: [index] }) - - const { output: mcPools } = await sdk.api.abi.multiCall({ - target: masterchef, calls: lpPositionCalls, block, chain, abi: abi.poolInfo + const { masterchef, pools, vaults_json, LPs, token, } = config[chain] + const stakingOwners = [masterchef] + const pool2Owners = [masterchef] + if (vaults_json) { + vaults_json.forEach(pool => { + const symbol = pool.stakingToken?.symbol?.toLowerCase() + const addr = pool.stakingToken.address.toLowerCase() + if (symbol === 'mcrn') + stakingOwners.push(addr) + else if (symbol.includes('mcrn') && symbol.endsWith('lp')) { + LPs.push(addr) + pool2Owners.push(pool.contractAddress.toLowerCase()) + } }) + } - const masterchefPools = [] + const blacklistedTokens = [...LPs, token] + async function tvl(api) { + const tokensAndOwners = [] - mcPools.forEach(({ output }) => { - masterchefPools.push(output) - }) + const masterchefPools = await api.fetchList({ target: masterchef, lengthAbi: abi.poolLength, itemAbi: abi.poolInfo }) - const toaTvl = [] const toaSyrup = [] - const toaPool2 = [] - const toaStaking = [] const syrupMapping = {} // handle masterchef @@ -58,12 +37,7 @@ function setChainTVL(chain) { syrupMapping[syrup] = addr return; } - if (addr === token) - toaStaking.push([addr, masterchef]) - else if (LPs.includes(addr)) - toaPool2.push([addr, masterchef]) - else - toaTvl.push([addr, masterchef]) + tokensAndOwners.push([addr, masterchef]) }) // handle chocochef and boost pools @@ -71,52 +45,27 @@ function setChainTVL(chain) { pools.push(...vaults_json) pools.forEach(pool => { - const symbol = pool.stakingToken?.symbol?.toLowerCase() - const masterchef = pool.contractAddress[chainId].toLowerCase() - const addr = pool.stakingToken.address[chainId].toLowerCase() - if (symbol === 'mcrn') - toaStaking.push([addr, masterchef]) - else if (symbol.includes('mcrn') && symbol.endsWith('lp')) - toaPool2.push([addr, masterchef]) - else - toaTvl.push([addr, masterchef]) + const masterchef = pool.contractAddress + const addr = pool.stakingToken.address + tokensAndOwners.push([addr, masterchef]) }) const balanceCalls = toaSyrup.map(([token, address]) => ({ target: token, params: [address] })) - const { output: syrupBalances } = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', calls: balanceCalls, block, chain - }) + const syrupBalances = await api.multiCall({ abi: 'erc20:balanceOf', calls: balanceCalls, }) - const lpPositions = [] - syrupBalances.forEach(({ input, output }) => { - lpPositions.push({ - token: syrupMapping[input.target], - balance: output - }) + syrupBalances.forEach((bal, i) => { + api.add(syrupMapping[toaSyrup[i][0]], bal) }) - await sumTokens(balances.tvl, toaTvl, block, chain, transform) - await sumTokens(balances.pool2, toaPool2, block, chain, transform) - await sumTokens(balances.staking, toaStaking, block, chain, transform) - await unwrapUniswapLPs(balances.tvl, lpPositions, block, chain, transform) - return balances - } - - function getTvlFunction(key) { - return async (ts, _block, chainBlocks) => { - if (!getTvl) getTvl = getAllTVL(ts, _block, chainBlocks) - return (await getTvl)[key] - } + return sumTokens2({ api, tokensAndOwners, blacklistedTokens, resolveLP: true }) } - const chainExports = { - tvl: getTvlFunction('tvl'), - pool2: getTvlFunction('pool2'), - staking: getTvlFunction('staking'), + module.exports[chain] = { + tvl, + pool2: sumTokensExport({ tokens: LPs, owners: pool2Owners, resolveLP: true }), + staking: sumTokensExport({ token, owners: stakingOwners, }), } - - module.exports[chain] = chainExports } Object.keys(config).forEach(setChainTVL) \ No newline at end of file diff --git a/projects/magma/index.js b/projects/magma/index.js index 944f4132a01b..739350a3e562 100644 --- a/projects/magma/index.js +++ b/projects/magma/index.js @@ -6,7 +6,8 @@ module.exports = { iotex: { tvl: sdk.util.sumChainTvls([ getLiquityTvl('0x21d81DABF6985587CE64C2E8EB12F69DF2178fe2'), - getLiquityTvl('0xAeB0B38040aDdc4a2b520919f13944D9bC944435') + getLiquityTvl('0xAeB0B38040aDdc4a2b520919f13944D9bC944435'), + getLiquityTvl('0xFF5F4bA96586EDae7E7D838D8770dFB3376Ec245', { nonNativeCollateralToken: true, collateralToken: "0x236f8c0a61dA474dB21B693fB2ea7AAB0c803894" }) ]), // staking: staking('0x037a2e9a464fbA409D0E55600836864B410d6Dd8', '0x6C0bf4b53696b5434A0D21C7D13Aa3cbF754913E'), // disabled as backing of WEN is already counted towards tvl }, diff --git a/projects/mahaxyz/index.js b/projects/mahaxyz/index.js new file mode 100644 index 000000000000..683bfdfc359a --- /dev/null +++ b/projects/mahaxyz/index.js @@ -0,0 +1,64 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs.js'); + +const eth = { + // tokens + dai: ADDRESSES.ethereum.DAI, + maha: "0x745407c86df8db893011912d3ab28e68b62e49b0", + usdc: ADDRESSES.ethereum.USDC, + usdt: ADDRESSES.ethereum.USDT, + weth: ADDRESSES.ethereum.WETH, + zai: "0x69000405f9dce69bd4cbf4f2865b79144a69bfe0", + + // peg stability modules + psmUSDC: '0x69000052a82e218ccb61fe6e9d7e3f87b9c5916f', + + // pools + zaiUsdcCurve: "0x6ee1955afb64146b126162b4ff018db1eb8f08c3", + zaiMahaCurve: "0x0086ef314a313018c70a2cd92504c7d1038a25aa", + + // pool staking contracts + zaiMahaCurveStaking: "0x237efe587f2cb44597063dc8403a4892a60a5a4f", + zaiUsdcCurveStaking: "0x154F52B347D8E48b8DbD8D8325Fe5bb45AAdCCDa", +}; + + +const base = { + usdc: ADDRESSES.base.USDC, + maha: '0x554bba833518793056CF105E66aBEA330672c0dE', + usdz: '0x0A27E060C0406f8Ab7B64e3BEE036a37e5a62853', + + // pools + zaiUsdcAerodrome: "0x72d509aff75753aaad6a10d3eb98f2dbc58c480d", + zaiMahaAerodrome: "0x6B22E989E1D74621ac4c8bcb62bcC7EE7c25b45A", + + // staking contracts + zaiUsdcStaking: "0x1097dFe9539350cb466dF9CA89A5e61195A520B0", + zaiMahaStaking: "0x7D5a39744608A809c850f63CB1A3d3f9b4cAc586", +} + +Object.keys(eth).forEach((k) => (eth[k] = eth[k].toLowerCase())); + +const collaterals = [eth.usdc, eth.usdt, eth.dai]; +const pegStabilityModules = [eth.psmUSDC] + +module.exports = { + ethereum: { + pool2: sumTokensExport({ + tokensAndOwners: [ + [eth.zaiMahaCurve, eth.zaiMahaCurveStaking], + [eth.zaiUsdcCurve, eth.zaiUsdcCurveStaking] + ] + }), + tvl: sumTokensExport({ owners: pegStabilityModules, tokens: collaterals }), + }, + base: { + pool2: sumTokensExport({ + tokensAndOwners: [ + [base.zaiMahaAerodrome, base.zaiMahaStaking], + [base.zaiUsdcAerodrome, base.zaiUsdcStaking], + ], + resolveLP: true, + }), + } +}; diff --git a/projects/maia-dao/index.js b/projects/maia-dao/index.js index 7b1ebdd7e63f..596a9bd012e5 100644 --- a/projects/maia-dao/index.js +++ b/projects/maia-dao/index.js @@ -1,92 +1,26 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { getChainTransform } = require('../helper/portedTokens'); -const { unwrapUniswapLPs, sumTokens2, } = require('../helper/unwrapLPs'); +const { sumTokens2, } = require('../helper/unwrapLPs'); const abis = require("./abis.json"); const HERMES = '0xb27bbeaaca2c00d6258c3118bab6b5b6975161c8'; -const excludedTokens = ["0xa3e8e7eb4649ffc6f3cbe42b4c2ecf6625d3e802"]; +const blacklistedTokens = ["0xa3e8e7eb4649ffc6f3cbe42b4c2ecf6625d3e802"]; const multisig = '0x77314eAA8D99C2Ad55f3ca6dF4300CFC50BdBC7F'; const tokens = [ADDRESSES.metis.WETH, ADDRESSES.metis.Metis, ADDRESSES.metis.m_USDC, ADDRESSES.metis.m_USDT, ADDRESSES.metis.DAI, '0xEfFEC28996aAff6D55B6D108a46446d45C3a2E71', '0x5ab390084812E145b619ECAA8671d39174a1a6d1',]; -async function tvl(timestamp, _, { metis: block }) { - const chain = 'metis' - const balances = {}; - const transform = await getChainTransform(chain); +async function tvl(api) { - const hermesBalance = (await sdk.api.abi.call({ + const hermesBalance = await api.call({ target: '0xa4C546c8F3ca15aa537D2ac3f62EE808d915B65b', abi: abis.locked, params: [2], - block, - chain: 'metis' - })).output; - - balances[`metis:${HERMES}`] = BigInt(hermesBalance.amount - 8424424910000000000000000).toString() - - const noPairs = (await sdk.api.abi.call({ - target: '0x879828da3a678D349A3C8d6B3D9C78e9Ee31137F', - abi: abis.length, - block, - chain: 'metis' - })).output; - - const pairAddresses = (await sdk.api.abi.multiCall({ - target: '0x879828da3a678D349A3C8d6B3D9C78e9Ee31137F', - calls: Array.from({ length: Number(noPairs) }, (_, k) => ({ - params: k, - })), - abi: abis.pools, - block, - chain: 'metis' - })).output; - - let gauges = (await sdk.api.abi.multiCall({ - target: '0x879828da3a678D349A3C8d6B3D9C78e9Ee31137F', - calls: pairAddresses.map(a => ({ - params: a.output - })), - abi: abis.gauges, - block, - chain: 'metis' - })).output; - - let pairBalances = [] - - for (let i = 0; i < Number(noPairs); i++) { - pairBalances.push( - await sdk.api.abi.call({ - target: gauges[i].output, - abi: abis.balanceOf, - params: [multisig], - block: block, - chain: "metis", - }) - ); - } - - let lpPositions = []; - for (let i = 0; i < pairBalances.length; i++) { - if ( - pairAddresses[i].output && - excludedTokens.includes(pairAddresses[i].output.toLowerCase()) - ) { - continue; - } - lpPositions.push({ - balance: pairBalances[i].output, - token: pairAddresses[i].output - }); - } - - await unwrapUniswapLPs( - balances, - lpPositions, - block, - 'metis', - transform - ); - return sumTokens2({ balances, owner: multisig, tokens, chain, block, resolveLP: 'true', }) + }) + api.add(HERMES, hermesBalance.amount - 8424424910000000000000000) + const pairs = await api.fetchList({ lengthAbi: abis.length, itemAbi: abis.pools, target: '0x879828da3a678D349A3C8d6B3D9C78e9Ee31137F' }) + + const gauges = await api.multiCall({ abi: abis.gauges, calls: pairs, target: '0x879828da3a678D349A3C8d6B3D9C78e9Ee31137F'}) + const bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: gauges.map(gauge => ({ target: gauge, params: [multisig] }))}) + api.add(pairs, bals) + return sumTokens2({ owner: multisig, tokens, api, resolveLP: 'true', blacklistedTokens, }) } module.exports = { diff --git a/projects/maker-rwa/index.js b/projects/maker-rwa/index.js index d25b128706ff..e1f80c3b05f6 100644 --- a/projects/maker-rwa/index.js +++ b/projects/maker-rwa/index.js @@ -1,185 +1,79 @@ const ADDRESSES = require('../helper/coreAssets.json') -// const utils = require('web3-utils'); -const sdk = require('@defillama/sdk'); -const MakerSCDConstants = require("../maker/abis/makerdao.js"); -const MakerMCDConstants = require("../maker/abis/maker-mcd.js"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs2 } = require('../helper/cache/getLogs') -async function getJoins(block, api) { - // let rely = utils.sha3("rely(address)").substr(0, 10); - // let relyTopic = utils.padRight(rely, 64); - let relyTopic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' +const MCD_VAT = '0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b' +const VAT_topic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' +const START_VAT_BLOCK = 8928152 - let joins = []; - let failed = []; - const failedSet = new Set(failedJoins) +const MCD_DOG = '0x135954d155898d42c90d2a57824c690e0c7bef1b' +const DOG_topic = '0x4ff2caaa972a7c6629ea01fae9c93d73cc307d13ea4c369f9bbbb7f9b7e9461d' +const START_DOG_BLOCK = 12317310 - // get list of auths - const auths = ( - await getLogs({ - api, - target: MakerMCDConstants.VAT, - fromBlock: MakerMCDConstants.STARTBLOCK, - topics: [relyTopic], - }) - ).map(i => `0x${i.topics[1].substr(26)}`).filter(i => !failedSet.has(i)) - - const ilks = await api.multiCall({ - abi: MakerMCDConstants.ilk, - calls: auths, - permitFailure: true, - }); +const abi = { + ilk: 'function ilk() view returns (bytes32)', + ilks: 'function ilks (bytes32) view returns (uint256 art, uint256 rate, uint256 spot, uint256 line,uint256 dust)', + gem: "address:gem", + dog: "address:dog", +} - ilks.forEach((_, i) => { - const token = auths[i].toLowerCase() - if (_) joins.push(token) - else failed.push(token) +const getJoins = async (api) => { + const logs = (await getLogs2({ api, target: MCD_VAT, fromBlock: START_VAT_BLOCK, topics: [VAT_topic] })).map(log => { + return '0x' + log.topics[1].slice(-40); }) - if (failed.length) sdk.log('failed', failed) - - return joins; + const ilks = await api.multiCall({ abi: abi.ilk, calls: logs, permitFailure: true }) + + return logs.map((auth, i) => { + const ilk = ilks[i]; + if (!ilk) return null + return auth.toLowerCase(); + }).filter(Boolean); } -async function tvl(api) { - const block = api.block - let toa = [] - - const blacklistedJoins = [ - '0x7b3799b30f268ba55f926d7f714a3001af89d359', - '0x41ca7a7aa2be78cf7cb80c0f4a9bdfbc96e81815', - ] - if (block > MakerMCDConstants.STARTBLOCK) { - let joins = await getJoins(block, api); - const dogSet = new Set(dogs) - joins = joins.filter(i => !blacklistedJoins.includes(i) && !dogSet.has(i)) - - const { output: gems } = await sdk.api.abi.multiCall({ - abi: MakerMCDConstants.gem, - block, calls: joins.map(i => ({ target: i })), - permitFailure: true, - }) - const dogCalls = dogs.map(i => ({ target: i })) - - gems.forEach(({ success, output, input: { target } }) => { - target = target.toLowerCase() - if (!success) { - dogCalls.push({ target }) - return; - } - - toa.push([output, target]) - }) - - const { output: dogRes } = await sdk.api.abi.multiCall({ - abi: MakerMCDConstants.dog, - calls: dogCalls, block, - permitFailure: true, - }) - - const failedCalls = dogRes.filter(i => !i.success) - if (failedCalls.length) { - failedCalls.forEach(i => sdk.log('Failed both gem and dog calls', i.input.target)) - throw new Error('Failed both gem and dog calls') - } - } +const getDogs = async (api) => { + const logs = (await getLogs2({ api, target: MCD_DOG, fromBlock: START_DOG_BLOCK, topics: [DOG_topic], })).map(log => { + return '0x' + log.data.slice(-40); + }) - toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) - const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) + const dogs = await api.multiCall({ abi: abi.dog, calls: logs, permitFailure: true }) + + return logs.map((auth, i) => { + const dog = dogs[i]; + if (!dog) return null + return auth.toLowerCase(); + }).filter(Boolean); +} - const owners = [] - toa.map((_, i) => { - if (!symbols[i].startsWith('RWA')) return; - owners.push(toa[i][1]) - }) - const ilks = await api.multiCall({ abi: 'function ilk() view returns (bytes32)', calls: owners }) - const res = await api.multiCall({ abi: 'function ilks (bytes32) view returns (uint256 art, uint256 rate, uint256 spot, uint256 line,uint256 dust)', calls:ilks, target:'0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B' }) +const tvl = async (api) => { + const [joins/*, dogs*/] = await Promise.all([ + getJoins(api), + // getDogs(api) + ]) + + const tokens = await api.multiCall({ abi: abi.gem, calls: joins, permitFailure: true }) + + let toas = joins.map((join, i) => { + const token = tokens[i]; + if (!token) return null + return [token, join] + }).filter(Boolean) + + toas = toas.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toas.map(t => t[0]) }) + const owners = toas.map((toa, i) => { + if (!symbols[i].startsWith('RWA')) return null + return toa[1] + }).filter(Boolean) + + const ilks = await api.multiCall({ abi: abi.ilk, calls: owners }) + const res = await api.multiCall({ abi: abi.ilks, calls: ilks, target:'0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B' }) res.forEach(i => api.add(ADDRESSES.ethereum.DAI, i.art)) - - return api.getBalances() } module.exports = { - methodology: `Counts all the tokens being used as collateral of CDPs. - - On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, + methodology: `Counts all the tokens being used as collateral of CDPs. On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, start: 1513566671, // 12/18/2017 @ 12:00am (UTC) ethereum: { tvl }, }; - -const dogs = [ - '0x832dd5f17b30078a5e46fdb8130a68cbc4a74dc0', - '0x9dacc11dcd0aa13386d295eaeebbd38130897e6f', - '0xc67963a226eddd77b91ad8c421630a1b0adff270', - '0x71eb894330e8a4b96b8d6056962e7f116f50e06f', - '0xc2b12567523e3f3cbd9931492b91fe65b240bc47', - '0x0227b54adbfaeec5f1ed1dfa11f54dcff9076e2c', - '0x3d22e6f643e2f4c563fd9db22b229cbb0cd570fb', - '0xdc90d461e148552387f3ab3ebee0bdc58aa16375', - '0x006aa3eb5e666d8e006aa647d4afab212555ddea', - '0xf5c8176e1eb0915359e46ded16e52c071bb435c0', - '0x2bb690931407dca7ece84753ea931ffd304f0f38', - '0x81c5cdf4817dbf75c7f08b8a1cdab05c9b3f70f7', - '0x6aac067bb903e633a422de7be9355e62b3ce0378', - '0x3713f83ee6d138ce191294c131148176015bc29a', - '0x834719bea8da68c46484e001143bdde29370a6a3', - '0x8723b74f598de2ea49747de5896f9034cc09349e', - '0x9f6981ba5c77211a34b76c6385c0f6fa10414035', - '0x93ae03815baf1f19d7f18d9116e4b637cc32a131', - '0x2ac4c9b49051275acb4c43ec973082388d015d48', - '0x4fc53a57262b87abda61d6d0db2be7e9be68f6b8', - '0xb15afab996904170f87a64fe42db0b64a6f75d24', - '0x6aa0520354d1b84e1c6abfe64a708939529b619e', - '0xb0ece6f5542a4577e2f1be491a937ccbbec8479e', - '0x854b252ba15eafa4d1609d3b98e00cc10084ec55', - '0xe4b82be84391b9e7c56a1fc821f47569b364dd4a', - '0x046b1a5718da6a226d912cfd306ba19980772908', - '0x5590f23358fe17361d7e4e4f91219145d8ccfcb3', - '0x0f6f88f8a4b918584e3539182793a0c276097f44', - '0xfc9d6dd08bee324a5a8b557d2854b9c36c2aec5d', - '0xbcb396cd139d1116bd89562b49b9d1d6c25378b0', - '0xa47d68b9db0a0361284fa04ba40623fcbd1a263e', - '0x66609b4799fd7ce12ba799ad01094abd13d5014d', - '0x9b3310708af333f6f379fa42a5d09cbaa10ab309', - '0x5322a3551bc6a1b39d5d142e5e38dc5b4bc5b3d2', - '0x29342f530ed6120bdb219d602dafd584676293d1', - '0x5048c5cd3102026472f8914557a1fd35c8dc6c9e', - '0x49a33a28c4c7d9576ab28898f4c9ac7e52ea457a', - '0xa93b98e57dde14a3e301f20933d59dc19bf8212e', - '0xe30663c6f83a06edee6273d72274ae24f1084a22', - '0x39f29773dcb94a32529d0612c6706c49622161d1', - '0xf93cc3a50f450ed245e003bfecc8a6ec1732b0b2', - '0xb55da3d3100c4ebf9de755b6ddc24bf209f6cc06', - '0x1926862f899410bfc19fefb8a3c69c7aed22463a', - '0x3ea60191b7d5990a3544b6ef79983fd67e85494a', - '0x27ca5e525ea473ed52ea9423cd08ccc081d96a98', - '0xd9e758bd239e5d568f44d0a748633f6a8d52cbbb', -] - -const failedJoins = [ - '0xbaa65281c2fa2baacb2cb550ba051525a480d3f4', - '0x65c79fcb50ca1594b025960e539ed7a9a6d434a3', - '0x19c0976f590d67707e62397c87829d896dc0f1f1', - '0x197e90f9fad81970ba7976f33cbd77088e5d7cf7', - '0x78f2c2af65126834c51822f56be0d7469d7a523e', - '0xab14d3ce3f733cacb76ec2abe7d2fcb00c99f3d5', - '0xbe8e3e3618f7474f8cb1d074a26affef007e98fb', - '0x4d95a049d5b0b7d32058cd3f2163015747522e99', - '0xa41b6ef151e06da0e34b009b86e828308986736d', - '0xa5679c04fc3d9d8b0aab1f0ab83555b301ca70ea', - '0xc7bdd1f2b16447dcf3de045c4a039a60ec2f0ba3', - '0x88f88bb9e66241b73b84f3a6e197fbba487b1e30', - '0xbb856d1742fd182a90239d7ae85706c2fe4e5922', - '0x29cfbd381043d00a98fd9904a431015fef07af2f', - '0x135954d155898d42c90d2a57824c690e0c7bef1b', - '0x1eb4cf3a948e7d72a198fe073ccb8c7a948cd853', - '0x2cc583c0aacdac9e23cb601fda8f1a0c56cdcb71', - '0x09e05ff6142f2f9de8b6b65855a1d56b6cfe4c58', - '0xa4c22f0e25c6630b2017979acf1f865e94695c4b', - '0x0e2e8f1d1326a4b9633d96222ce399c708b19c28', - '0x60744434d6339a6b27d73d9eda62b6f66a0a04fa', - '0x12f36cdea3a28c35ac8c6cc71d9265c17c74a27f', -] diff --git a/projects/maker/index.js b/projects/maker/index.js index 3775e50cd29a..d50414d7c735 100644 --- a/projects/maker/index.js +++ b/projects/maker/index.js @@ -1,103 +1,73 @@ const ADDRESSES = require('../helper/coreAssets.json') -// const utils = require('web3-utils'); -const sdk = require('@defillama/sdk'); -const MakerSCDConstants = require("./abis/makerdao.js"); -const MakerMCDConstants = require("./abis/maker-mcd.js"); +const { getLogs2 } = require('../helper/cache/getLogs') const { sumTokens2 } = require('../helper/unwrapLPs') -const { getLogs } = require('../helper/cache/getLogs') -async function getJoins(block, api) { - // let rely = utils.sha3("rely(address)").substr(0, 10); - // let relyTopic = utils.padRight(rely, 64); - let relyTopic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' +const MCD_VAT = '0x35d1b3f3d7966a1dfe207aa4514c12a259a0492b' +const VAT_topic = '0x65fae35e00000000000000000000000000000000000000000000000000000000' +const START_VAT_BLOCK = 8928152 - let joins = []; - let failed = []; - const failedSet = new Set(failedJoins) +const MCD_DOG = '0x135954d155898d42c90d2a57824c690e0c7bef1b' +const DOG_topic = '0x4ff2caaa972a7c6629ea01fae9c93d73cc307d13ea4c369f9bbbb7f9b7e9461d' +const START_DOG_BLOCK = 12317310 - // get list of auths - const auths = ( - await getLogs({ - api, - target: MakerMCDConstants.VAT, - fromBlock: MakerMCDConstants.STARTBLOCK, - topics: [relyTopic], - }) - ).map(i => `0x${i.topics[1].substr(26)}`).filter(i => !failedSet.has(i)) - - const ilks = await api.multiCall({ - abi: MakerMCDConstants.ilk, - calls: auths, - permitFailure: true, - }); +const abi = { + ilk: "function ilk() view returns (bytes32)", + gem: "address:gem", + Pie: "uint256:Pie", + dog: "address:dog", +} - ilks.forEach((_, i) => { - const token = auths[i].toLowerCase() - if (_) joins.push(token) - else failed.push(token) +const getJoins = async (api) => { + const logs = (await getLogs2({ api, target: MCD_VAT, fromBlock: START_VAT_BLOCK, topics: [VAT_topic] })).map(log => { + return '0x' + log.topics[1].slice(-40); }) - if (failed.length) sdk.log('failed', failed) - - return joins; + const ilks = await api.multiCall({ abi: abi.ilk, calls: logs, permitFailure: true }) + + return logs.map((auth, i) => { + const ilk = ilks[i]; + if (!ilk) return null + return auth.toLowerCase(); + }).filter(Boolean); } -async function tvl(api) { - const block = api.block - let toa = [ - [MakerSCDConstants.WETH_ADDRESS, MakerSCDConstants.TUB_ADDRESS,], - ] - - const blacklistedJoins = [ - '0x7b3799b30f268ba55f926d7f714a3001af89d359', - '0x41ca7a7aa2be78cf7cb80c0f4a9bdfbc96e81815', - ] - if (block > MakerMCDConstants.STARTBLOCK) { - let joins = await getJoins(block, api); - const dogSet = new Set(dogs) - joins = joins.filter(i => !blacklistedJoins.includes(i) && !dogSet.has(i)) - - const { output: gems } = await sdk.api.abi.multiCall({ - abi: MakerMCDConstants.gem, - block, calls: joins.map(i => ({ target: i })), - permitFailure: true, - }) - const dogCalls = dogs.map(i => ({ target: i })) - - gems.forEach(({ success, output, input: { target } }) => { - target = target.toLowerCase() - if (!success) { - dogCalls.push({ target }) - return; - } +const getDogs = async (api) => { + const logs = (await getLogs2({ api, target: MCD_DOG, fromBlock: START_DOG_BLOCK, topics: [DOG_topic], skipCache: true, skipCacheRead: true })).map(log => { + return '0x' + log.data.slice(-40); + }) - toa.push([output, target]) - }) + const dogs = await api.multiCall({ abi: abi.dog, calls: logs, permitFailure: true }) + + return logs.map((auth, i) => { + const dog = dogs[i]; + if (!dog) return null + return auth.toLowerCase(); + }).filter(Boolean); +} - const { output: dogRes } = await sdk.api.abi.multiCall({ - abi: MakerMCDConstants.dog, - calls: dogCalls, block, - permitFailure: true, - }) +const tvl = async (api) => { + const [joins/*, dogs*/] = await Promise.all([ + getJoins(api), + // getDogs(api) + ]) - const failedCalls = dogRes.filter(i => !i.success) - if (failedCalls.length) { - failedCalls.forEach(i => sdk.log('Failed both gem and dog calls', i.input.target)) - throw new Error('Failed both gem and dog calls') - } - } + const tokens = await api.multiCall({ abi: abi.gem, calls: joins, permitFailure: true }) - toa = toa.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) - const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toa.map(t => t[0]) }) - const gUNIToa = toa.filter((_, i) => symbols[i] === 'G-UNI') - toa = toa.filter((_, i) => symbols[i] !== 'G-UNI' && !symbols[i].startsWith('RWA')) + let toas = joins.map((join, i) => { + const token = tokens[i]; + if (!token) return null + return [token, join] + }).filter(Boolean) - const balances = await sumTokens2({ api, tokensAndOwners: toa, resolveLP: true, }) - await unwrapGunis({ api, toa: gUNIToa, balances, }) - return balances + toas = toas.filter(i => i[0].toLowerCase() !== ADDRESSES.ethereum.SAI.toLowerCase()) + const symbols = await api.multiCall({ abi: 'erc20:symbol', calls: toas.map(([token]) => token) }) + const gUNIToa = toas.filter((_, i) => symbols[i] === 'G-UNI') + toas = toas.filter((_, i) => symbols[i] !== 'G-UNI' && !symbols[i].startsWith('RWA')) + await unwrapGunis({ api, toa: gUNIToa, }) + return sumTokens2({ api, tokensAndOwners: toas, resolveLP: true}) } -async function unwrapGunis({ api, toa, balances = {} }) { +async function unwrapGunis({ api, toa, }) { const lps = toa.map(i => i[0]) const balanceOfCalls = toa.map(t => ({ params: t[1], target: t[0] })) const [ @@ -114,93 +84,17 @@ async function unwrapGunis({ api, toa, balances = {} }) { const ratio = bal / supplies[i] const token0Bal = uBalances[i][0] * ratio const token1Bal = uBalances[i][1] * ratio - sdk.util.sumSingleBalance(balances, token0s[i], token0Bal) - sdk.util.sumSingleBalance(balances, token1s[i], token1Bal) + api.add(token0s[i], token0Bal) + api.add(token1s[i], token1Bal) }) - sdk.util.removeTokenBalance(balances, ADDRESSES.ethereum.DAI) // remove dai balances - return balances + api.removeTokenBalance(ADDRESSES.ethereum.DAI) // remove dai balances } + module.exports = { - methodology: `Counts all the tokens being used as collateral of CDPs. - - On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, + methodology: `Counts all the tokens being used as collateral of CDPs. On the technical level, we get all the collateral tokens by fetching events, get the amounts locked by calling balanceOf() directly, unwrap any uniswap LP tokens and then get the price of each token from coingecko`, start: 1513566671, // 12/18/2017 @ 12:00am (UTC) ethereum: { tvl }, -}; - -const dogs = [ - '0x832dd5f17b30078a5e46fdb8130a68cbc4a74dc0', - '0x9dacc11dcd0aa13386d295eaeebbd38130897e6f', - '0xc67963a226eddd77b91ad8c421630a1b0adff270', - '0x71eb894330e8a4b96b8d6056962e7f116f50e06f', - '0xc2b12567523e3f3cbd9931492b91fe65b240bc47', - '0x0227b54adbfaeec5f1ed1dfa11f54dcff9076e2c', - '0x3d22e6f643e2f4c563fd9db22b229cbb0cd570fb', - '0xdc90d461e148552387f3ab3ebee0bdc58aa16375', - '0x006aa3eb5e666d8e006aa647d4afab212555ddea', - '0xf5c8176e1eb0915359e46ded16e52c071bb435c0', - '0x2bb690931407dca7ece84753ea931ffd304f0f38', - '0x81c5cdf4817dbf75c7f08b8a1cdab05c9b3f70f7', - '0x6aac067bb903e633a422de7be9355e62b3ce0378', - '0x3713f83ee6d138ce191294c131148176015bc29a', - '0x834719bea8da68c46484e001143bdde29370a6a3', - '0x8723b74f598de2ea49747de5896f9034cc09349e', - '0x9f6981ba5c77211a34b76c6385c0f6fa10414035', - '0x93ae03815baf1f19d7f18d9116e4b637cc32a131', - '0x2ac4c9b49051275acb4c43ec973082388d015d48', - '0x4fc53a57262b87abda61d6d0db2be7e9be68f6b8', - '0xb15afab996904170f87a64fe42db0b64a6f75d24', - '0x6aa0520354d1b84e1c6abfe64a708939529b619e', - '0xb0ece6f5542a4577e2f1be491a937ccbbec8479e', - '0x854b252ba15eafa4d1609d3b98e00cc10084ec55', - '0xe4b82be84391b9e7c56a1fc821f47569b364dd4a', - '0x046b1a5718da6a226d912cfd306ba19980772908', - '0x5590f23358fe17361d7e4e4f91219145d8ccfcb3', - '0x0f6f88f8a4b918584e3539182793a0c276097f44', - '0xfc9d6dd08bee324a5a8b557d2854b9c36c2aec5d', - '0xbcb396cd139d1116bd89562b49b9d1d6c25378b0', - '0xa47d68b9db0a0361284fa04ba40623fcbd1a263e', - '0x66609b4799fd7ce12ba799ad01094abd13d5014d', - '0x9b3310708af333f6f379fa42a5d09cbaa10ab309', - '0x5322a3551bc6a1b39d5d142e5e38dc5b4bc5b3d2', - '0x29342f530ed6120bdb219d602dafd584676293d1', - '0x5048c5cd3102026472f8914557a1fd35c8dc6c9e', - '0x49a33a28c4c7d9576ab28898f4c9ac7e52ea457a', - '0xa93b98e57dde14a3e301f20933d59dc19bf8212e', - '0xe30663c6f83a06edee6273d72274ae24f1084a22', - '0x39f29773dcb94a32529d0612c6706c49622161d1', - '0xf93cc3a50f450ed245e003bfecc8a6ec1732b0b2', - '0xb55da3d3100c4ebf9de755b6ddc24bf209f6cc06', - '0x1926862f899410bfc19fefb8a3c69c7aed22463a', - '0x3ea60191b7d5990a3544b6ef79983fd67e85494a', - '0x27ca5e525ea473ed52ea9423cd08ccc081d96a98', - '0xd9e758bd239e5d568f44d0a748633f6a8d52cbbb', -] - -const failedJoins = [ - '0xbaa65281c2fa2baacb2cb550ba051525a480d3f4', - '0x65c79fcb50ca1594b025960e539ed7a9a6d434a3', - '0x19c0976f590d67707e62397c87829d896dc0f1f1', - '0x197e90f9fad81970ba7976f33cbd77088e5d7cf7', - '0x78f2c2af65126834c51822f56be0d7469d7a523e', - '0xab14d3ce3f733cacb76ec2abe7d2fcb00c99f3d5', - '0xbe8e3e3618f7474f8cb1d074a26affef007e98fb', - '0x4d95a049d5b0b7d32058cd3f2163015747522e99', - '0xa41b6ef151e06da0e34b009b86e828308986736d', - '0xa5679c04fc3d9d8b0aab1f0ab83555b301ca70ea', - '0xc7bdd1f2b16447dcf3de045c4a039a60ec2f0ba3', - '0x88f88bb9e66241b73b84f3a6e197fbba487b1e30', - '0xbb856d1742fd182a90239d7ae85706c2fe4e5922', - '0x29cfbd381043d00a98fd9904a431015fef07af2f', - '0x135954d155898d42c90d2a57824c690e0c7bef1b', - '0x1eb4cf3a948e7d72a198fe073ccb8c7a948cd853', - '0x2cc583c0aacdac9e23cb601fda8f1a0c56cdcb71', - '0x09e05ff6142f2f9de8b6b65855a1d56b6cfe4c58', - '0xa4c22f0e25c6630b2017979acf1f865e94695c4b', - '0x0e2e8f1d1326a4b9633d96222ce399c708b19c28', - '0x60744434d6339a6b27d73d9eda62b6f66a0a04fa', - '0x12f36cdea3a28c35ac8c6cc71d9265c17c74a27f', -] +}; \ No newline at end of file diff --git a/projects/makiswap/abi.json b/projects/makiswap/abi.json deleted file mode 100644 index f73548ff075a..000000000000 --- a/projects/makiswap/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "totalPairs": "uint256:totalPairs", - "allPairs": "function allPairs(uint256) view returns (address)" -} \ No newline at end of file diff --git a/projects/makiswap/index.js b/projects/makiswap/index.js index 1092095a4e15..dbc74e410678 100644 --- a/projects/makiswap/index.js +++ b/projects/makiswap/index.js @@ -1,107 +1,14 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - -const abi = require("./abi.json"); +const { staking } = require("../helper/staking"); +const { getUniTVL } = require("../helper/unknownTokens"); const factory = "0x11cdC9Bd86fF68b6A6152037342bAe0c3a717f56"; const maki = "0x5FaD6fBBA4BbA686bA9B8052Cf0bd51699f38B93"; const makiChef = "0x4cb4c9C8cC67B171Ce86eB947cf558AFDBcAB17E"; -const ignoreLPs = [ - "0x329bae377d60df25e58a17b3d0b1d46cf2f4fd8b", - "0x4db7c033137c2843481a686cc0cb415ad09fa764", - "0x5e9cdc40d1acf45fef65313142e40c72059bcb98", -]; - -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - let poolLength = ( - await sdk.api.abi.call({ - target: factory, - abi: abi.totalPairs, - block: chainBlocks.heco, - chain: "heco", - }) - ).output; - let allPools = ( - await sdk.api.abi.multiCall({ - calls: Array.from({ length: Number(poolLength) }, (_, k) => ({ - target: factory, - params: k, - })), - abi: abi.allPairs, - block: chainBlocks.heco, - chain: "heco", - }) - ).output; - let supply = ( - await sdk.api.abi.multiCall({ - calls: allPools.map((p) => ({ - target: p.output, - })), - abi: "erc20:totalSupply", - block: chainBlocks.heco, - chain: "heco", - }) - ).output; - let ignoreLPSupply = ( - await sdk.api.abi.multiCall({ - calls: ignoreLPs.map((p) => ({ - target: p, - })), - abi: "erc20:totalSupply", - block: chainBlocks.heco, - chain: "heco", - }) - ).output; - let lpPositions = []; - supply.forEach((p) => { - let addr = p.output.toLowerCase(); - if (addr === "0") { - return; - } - lpPositions.push({ - balance: p.output, - token: p.input.target, - }); - }); - ignoreLPSupply.forEach((p) => { - lpPositions.push({ - balance: p.output, - token: p.input.target, - }); - }); - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks.heco, - "heco", - (addr) => { - return `heco:${addr}`; - }, - ignoreLPs - ); - return balances; -} - -async function staking(timestamp, block, chainBlocks) { - let balances = {}; - let balance = ( - await sdk.api.erc20.balanceOf({ - target: maki, - owner: makiChef, - block: chainBlocks.heco, - chain: "heco", - }) - ).output; - sdk.util.sumSingleBalance(balances, `heco:${maki}`, balance); - return balances; -} - module.exports = { - methodology: "TVL consists of LPs created by the factory contract", + misrepresentedTokens: true, heco: { - tvl, - staking, + tvl: getUniTVL({ factory, useDefaultCoreAssets: true, abis: { allPairsLength: 'uint256:totalPairs'}}), + staking: staking(makiChef, maki), }, -}; +} \ No newline at end of file diff --git a/projects/mangrove/index.js b/projects/mangrove/index.js index 30240ab1cbb6..4063ddd38040 100644 --- a/projects/mangrove/index.js +++ b/projects/mangrove/index.js @@ -1,9 +1,12 @@ const abi = require("./abi.json"); const { BigNumber } = require("bignumber.js"); -const mgvReader = "0x26fD9643Baf1f8A44b752B28f0D90AEBd04AB3F8"; +const mgvReaders = { + blast: "0x26fD9643Baf1f8A44b752B28f0D90AEBd04AB3F8", + arbitrum: "0x7E108d7C9CADb03E026075Bf242aC2353d0D1875", +}; -const getOffers = async (api, { tkn0, tkn1, tickSpacing }) => { +const getOffers = async (api, mgvReader, { tkn0, tkn1, tickSpacing }) => { let total = BigNumber(0); let currentId = 0; do { @@ -25,7 +28,7 @@ const getOffers = async (api, { tkn0, tkn1, tickSpacing }) => { return total; }; -async function getMangroveTVL(api) { +async function getMangroveTVL(api, mgvReader) { const markets = await api.call({ target: mgvReader, abi: abi.openMarkets, @@ -33,18 +36,30 @@ async function getMangroveTVL(api) { for (const market of markets) { const [tkn0, tkn1, tickSpacing] = market; - const tkn0TPV = await getOffers(api, { tkn0, tkn1, tickSpacing }); - const tkn1TPV = await getOffers(api, { tkn0: tkn1, tkn1: tkn0, tickSpacing }); + const tkn0TPV = await getOffers(api, mgvReader, { + tkn0, + tkn1, + tickSpacing, + }); + const tkn1TPV = await getOffers(api, mgvReader, { + tkn0: tkn1, + tkn1: tkn0, + tickSpacing, + }); api.addTokens([tkn0, tkn1], [tkn0TPV, tkn1TPV]); } } module.exports = { - blast: { - tvl: getMangroveTVL, - }, misrepresentedTokens: false, - methodology: "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", + methodology: + "TVL is calculated by getting the total promised liquidity on the orderbook on a specific block.", start: 1708992000, }; + +for (const chain in mgvReaders) { + module.exports[chain] = { + tvl: (api) => getMangroveTVL(api, mgvReaders[chain]), + }; +} diff --git a/projects/manifest-trade/index.js b/projects/manifest-trade/index.js new file mode 100644 index 000000000000..9208b0fc6711 --- /dev/null +++ b/projects/manifest-trade/index.js @@ -0,0 +1,83 @@ +const { PublicKey } = require("@solana/web3.js"); +const { getConnection, sumTokens2, } = require("../helper/solana"); + +const PROGRAM_ADDRESS = 'MNFSTqtC93rEfYHB6hF82sKdZpUDFWkViLByLd1k1Ms'; +const PROGRAM_ID = new PublicKey(PROGRAM_ADDRESS); +function getVaultAddress(market, mint) { + const [vaultAddress, _unusedBump] = PublicKey.findProgramAddressSync( + [Buffer.from('vault'), market.toBuffer(), mint.toBuffer()], + PROGRAM_ID, + ); + return vaultAddress; +} +function getGlobalVaultAddress(mint) { + const [globalVaultAddress, _unusedBump] = PublicKey.findProgramAddressSync( + [Buffer.from('global-vault'), mint.toBuffer()], + PROGRAM_ID, + ); + return globalVaultAddress; +} + +async function listMarketPublicKeys( + connection, +) { + const accounts = await connection.getProgramAccounts(PROGRAM_ID, { + filters: [ + { + memcmp: { + offset: 0, + bytes: '8K9hj5OfcUM=', + encoding: 'base64', + }, + }, + ], + }); + + return accounts.map((a) => a.pubkey); +} + +async function tvl() { + const connection = getConnection(); + const marketPks = await listMarketPublicKeys(connection); + + const vaultAccounts = []; + let globalAccounts = []; + for (const pk of marketPks) { + const [buffer, _slot] = await connection + .getAccountInfoAndContext(pk) + .then( + ( + getAccountInfoAndContext, + ) => { + return [ + getAccountInfoAndContext.value?.data, + getAccountInfoAndContext.context.slot, + ]; + }, + ); + + let offset = 16; + const baseMint = new PublicKey(buffer.subarray(offset, offset + 32)); + const quoteMint = new PublicKey(buffer.subarray(offset + 32, offset + 32 + 32)); + + const baseVaultPk = getVaultAddress(pk, baseMint); + const quoteVaultPk = getVaultAddress(pk, quoteMint); + vaultAccounts.push(baseVaultPk); + vaultAccounts.push(quoteVaultPk); + + const baseGlobalPk = getGlobalVaultAddress(baseMint); + const quoteGlobalPk = getGlobalVaultAddress(quoteMint); + globalAccounts.push(baseGlobalPk); + globalAccounts.push(quoteGlobalPk); + } + + const tokenAccounts = vaultAccounts.concat(globalAccounts); + return sumTokens2({ tokenAccounts, allowError: true }) +} + +module.exports = { + timetravel: false, + solana: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/manifesto/index.js b/projects/manifesto/index.js index 41468a3c6876..a5817ea1986f 100644 --- a/projects/manifesto/index.js +++ b/projects/manifesto/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require("../helper/unknownTokens"); +const { deadFrom } = require('../mosquitos-finance'); const lps = [ '0xF65af1E61D7aC87d73E347D17E369Dc2118E9517', ] @@ -8,6 +9,7 @@ module.exports = { hallmarks: [ [1676332800, "Rug Pull"] ], + deadFrom: 1676332800, misrepresentedTokens: true, canto: { tvl: sumTokensExport({ diff --git a/projects/manta-myield/index.js b/projects/manta-myield/index.js new file mode 100644 index 000000000000..103f0e0a58ec --- /dev/null +++ b/projects/manta-myield/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/mantle-restaking/index.js b/projects/mantle-restaking/index.js new file mode 100644 index 000000000000..8ad5875e8036 --- /dev/null +++ b/projects/mantle-restaking/index.js @@ -0,0 +1,24 @@ +const targets = [ + '0x6DfbE3A1a0e835C125EEBb7712Fffc36c4D93b25', // eigenPos1 + '0x021180A06Aa65A7B5fF891b5C146FbDaFC06e2DA', // eigenPos2 + '0x52EA8E95378d01B0aaD3B034Ca0656b0F0cc21A2', // karakPos + '0x919531146f9a25dfc161d5ab23b117feae2c1d36', // symbioticPos +] + +const mETH = '0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa' +const boringVault = '0x33272D40b247c4cd9C646582C9bbAD44e85D4fE4' +const delayedWithdraw = '0x12be34be067ebd201f6eaf78a861d90b2a66b113' + +const abi = "function getUnderlyings() view returns (address[] assets, uint256[] amounts)" + +const tvl = async (api) => { + const allocateds = await api.multiCall({ calls: targets, abi }) + allocateds.forEach(({ assets: [asset], amounts: [amount] }) => api.add(asset, amount)); + return api.sumTokens({ tokens: [mETH], owners: [boringVault, delayedWithdraw] }) +} + +module.exports = { + doublecounted: true, + methodology: 'TVL corresponds to the sum of mETH deposited across various restaking protocols + the funds pending withdrawal or deposit', + ethereum: { tvl } +} diff --git a/projects/mantradao.js b/projects/mantradao.js index f2bc28967a74..c64fa9605ec5 100644 --- a/projects/mantradao.js +++ b/projects/mantradao.js @@ -1,41 +1,83 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const { sumTokens } = require("./helper/unwrapLPs"); -const { compoundExports } = require("./helper/compound"); -const { stakingAssetsETH, stakingAssetsBSC, stakingAssetsPOLYGON, } = require("./config/mantra-dao/contracts/naked-staking-contracts"); -const { lpStakingAssetsETH, lpStakingAssetsBSC, lpStakingAssetsPOLYGON, } = require("./config/mantra-dao/contracts/lp-staking-contracts"); +const { sumTokensExport } = require('./helper/unwrapLPs') +const { compoundExports2 } = require("./helper/compound"); -const chainConfig = { - ethereum: { staking: stakingAssetsETH, pool2: lpStakingAssetsETH, }, - bsc: { staking: stakingAssetsBSC, pool2: lpStakingAssetsBSC, }, - polygon: { staking: stakingAssetsPOLYGON, pool2: lpStakingAssetsPOLYGON, }, +module.exports = { + ethereum: compoundExports2({ comptroller: "0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7", cether: '0x4F905f75F5576228eD2D0EA508Fb0c32a0696090', blacklistedTokens: ['0x3593d125a4f7849a1b059e64f4517a86dd60c95d'] }) } -const comptroller = "0x606246e9EF6C70DCb6CEE42136cd06D127E2B7C7" -const zenETH = "0x4F905f75F5576228eD2D0EA508Fb0c32a0696090" -const zenETHEquivalent = ADDRESSES.ethereum.WETH; - -module.exports = {} - -Object.keys(chainConfig).forEach(chain => { - const { staking, pool2 } = chainConfig[chain] - let ethAdditional = {} - - if (chain === 'ethereum') - ethAdditional = compoundExports(comptroller, "ethereum", zenETH, zenETHEquivalent) - - module.exports[chain] = { - tvl: () => ({}), - staking: async (ts, _block, chainBlocks) => { - const block = chainBlocks[chain] - const tokens = staking.map(i => [i.token, i.contract,]) - return sumTokens(undefined, tokens, block, chain) - }, - pool2: async (ts, _block, chainBlocks) => { - const block = chainBlocks[chain] - const tokens = pool2.map((p) => [p.pairAddress, p.contract,]) - return sumTokens(undefined, tokens, block, chain) - }, - ...ethAdditional, - } -}) +const config = { + ethereum: { + staking: [ + ["0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", "0x9E15Ad979919bB4db331Bfe864475Ae3BFFebA93"], + ["0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", "0xa01892d97e9c8290c2c225fb0b756bfe26bc9802"], + ["0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", "0x04493F715B08DeA8af77814d600bEf22f1f0C63B"], + ["0x3593D125a4f7849a1B059E64F4517A86Dd60c95d", "0x1eA973A69643091410721C7D91aA5499CF8D2Cb7"], + ["0xaf9f549774ecedbd0966c52f250acc548d3f36e5", "0x456DF576962289256A92290C9E48EE116B8Cb413"], + ["0xdef1da03061ddd2a5ef6c59220c135dec623116d", "0xdbc34d084393ed8d7b750FfCCea5A139EC7b9349"], + ["0x7eaF9C89037e4814DC0d9952Ac7F888C784548DB", "0x4Cd4c0eEDb2bC21f4e280d0Fe4C45B17430F94A9"], + ["0x8a40c222996f9F3431f63Bf80244C36822060f12", "0x6BcDC61A7A6d86f7b7B66d461b7eF7fa268571a0"], + ["0x4eed0fa8de12d5a86517f214c2f11586ba2ed88d", "0x1dfdb0fb85402dc7f8d72d92ada8fbbb3ffc8633"], + ["0x5eaa69b29f99c84fe5de8200340b4e9b4ab38eac", "0x2d0ea72db9f9a63f4b185eab1ca74137d808ebfa"], + ["0x67b6d479c7bb412c54e03dca8e1bc6740ce6b99c", "0x6ae05b5db520011bf76645ebb4d6a697e5b3774b"], + ["0x8b0e42f366ba502d787bb134478adfae966c8798", "0x6f0db359309CAD297D2e7952a4F5f081bDC1e373"], + ["0x8b0E42F366bA502d787BB134478aDfAE966C8798", "0xb96e42c0de658ca26048b0e200f9a1e05ad89e0f"], + ["0xd2dda223b2617cb616c1580db421e4cfae6a8a85", "0x39621A555554A7FF77F2b64185c53E04C90cD540"], + ["0x4eED0fa8dE12D5a86517f214C2f11586Ba2ED88D", "0xa571309B1267676568Bf9f155606a08790896Fe2"], + ["0x93C9175E26F57d2888c7Df8B470C9eeA5C0b0A93", "0xb19b94d53D362CDfC7360C951a85ca2c1d5400BA"], + ], + pool2: [ + ["0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", "0x5f81a986611C600a3656d9adc202283186C6121D"], + ["0x2d9fd51e896ff0352cb6d697d13d04c2cb85ca83", "0xfc8e3b55897d8cef791451bbe69b204b9c58fc8a"], + ["0xe46935ae80e05cdebd4a4008b6ccaa36d2845370", "0x91fe14df53eae3a87e310ec6edcdd2d775e1a23f"], + ["0x6d9d2427cfa49e39b4667c4c3f627e56ae586f37", "0x55e0F2cE66Fa8C86ef478fa47bA0bE978eFC2647"], + ["0x1f07f8e712659087914b96db4d6f6e4fee32285e", "0xb12f0CbcC89457d44323139e6Bb0526Fd82f12F2"], + ["0x1f07f8e712659087914b96db4d6f6e4fee32285e", "0x18Ba986ED3128fc7E3E86a09E902436e900a899c"], + ["0x2a182e532a379cb2c7f1b34ce3f76f3f7d3596f7", "0x6406788d1CD4fdD823ef607A924c00a4244a841d"], + ["0x4fc47579ecf6aa76677ee142b6b75faf9eeafba8", "0xe2a80A76B084B51CFAe5B2C3e0FF5232e0408201"], + ["0xc62bf2c79f34ff24e2f97982af4f064161ed8949", "0xFF964d0bf9f81c401932A6B975EAE54129712eE5"], + ] + }, + bsc: { + staking: [ + ["0x651cd665bd558175a956fb3d72206ea08eb3df5b", "0x7dd79e93dba1d677574d0b5e99721f2e4b45e297"], + ["0x96058f8c3e16576d9bd68766f3836d9a33158f89", "0x004c0908518e19aa8b27a55c171564097fa3c354"], + ["0x4518231a8fdf6ac553b9bbd51bbb86825b583263", "0xF0185520Cc773502f0f208433ca178f2f57157A9"], + ["0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", "0xEfc2d65302eb6345A7C0e212B791e0d45C2C3c91"], + ["0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", "0x41A32C610FA23dEa9E85D471CAD66ea828853153"], + ["0xf78d2e7936f5fe18308a3b2951a93b6c4a41f5e2", "0xEf2663d96e48a543D9EA96A39869aB54f7F5D872"], + ], + pool2: [ + ["0xC309a6d2F1537922E06f15aA2eb21CaA1b2eEDb6", "0xF25897a7EDf1Dfa9C65f5DB7Ec4Bad868873805B"], + ["0x49837a48abde7c525bdc86d9acba39f739cbe22c", "0xcbf42ace1dbd895ffdcabc1b841488542626014d"], + ["0x0b49580278b403ca13055bf4d81b6b7aa85fd8b9", "0x92fCe8AfFB2A68d418BaDF8E360E0CDe06c39356"], + ["0x538e61bd3258304e9970f4f2db37a217f60436e1", "0x1E8BC897bf03ebac570Df7e5526561f8a42eCe05"], + ["0xb8b4383b49d451bbea63bc4421466e1086da6f18", "0xD862866599CA681c492492E1B7B9aB80066f2FaC"], + ["0x5a26eb7c9c72140d01039eb172dcb8ec98d071bd", "0x4F905f75F5576228eD2D0EA508Fb0c32a0696090"], + ["0x5548bd47293171d3bc1621edccd953bcc9b814cb", "0x5B4463bBD7B2E870601e91161e0F1F7f84CDE214"], + ["0x560b96f81a2190ff6ac84ebfd17788bab3679cbc", "0x398a5FEE22E0dEb67dA1bD15FA4841b6Aa64c471"], + ["0xB62c57Bda4C126E21A726e3D28734bfb1151231e", "0x3ba3E2f3cACcDbE3C56D3046FFe859cc9deE08a0"], + ] + }, + polygon: { + staking: [ + ["0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", "0xCdD0f77A2A158B0C7cFe38d00443E9A4731d6ea6"], + ["0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", "0xD77F495Ce60cd9414F99670bEc8657A021e34C83"], + ["0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", "0x427756E0BBb792f24018E670D570b1b147DbF1F8"], + ["0x3f6b3595ecf70735d3f48d69b09c4e4506db3f47", "0xd1ecDC553651daB068486d9c4d066eCDC614416e"], + ], + pool2: [ + ["0xff2bbcb399ad50bbd06debadd47d290933ae1038", "0xCBf42Ace1dBD895FFDCaBC1b841488542626014d"], + ["0x1dF661fC4319415a2f990bd5F49D5cA70EFDee1C", "0x11c70CAA910647d820bD014d676Dcd97EDD64A99"], + ] + }, +} +Object.keys(config).forEach(chain => { + const { staking = [], pool2 = [], } = config[chain] + if (!module.exports[chain]) + module.exports[chain] = {} + module.exports.deadFrom='2024-07-09' + module.exports[chain].staking = sumTokensExport({ tokensAndOwners: staking }) + module.exports[chain].pool2 = sumTokensExport({ tokensAndOwners: pool2, resolveLP: true, }) + module.exports.ethereum.borrowed = () => ({}) // bad debt +}) \ No newline at end of file diff --git a/projects/manxswap/index.js b/projects/manxswap/index.js index d64fbeb8c7df..6366c787fd77 100644 --- a/projects/manxswap/index.js +++ b/projects/manxswap/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xFF073cEd2867F7085eC058f5C5Bd6Cf0d9B1Af8f", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/maple-syrup/index.js b/projects/maple-syrup/index.js index bf031ef8e119..8682bef97fd2 100644 --- a/projects/maple-syrup/index.js +++ b/projects/maple-syrup/index.js @@ -1,5 +1,6 @@ const rwaPools = [ '0x80ac24aA929eaF5013f6436cdA2a7ba190f5Cc0b', + '0x356b8d89c1e1239cbbb9de4815c39a1474d5ba7d' ] async function tvl(api) { diff --git a/projects/mare-finance-v2/index.js b/projects/mare-finance-v2/index.js index c4848883feaf..a6807bbd8827 100644 --- a/projects/mare-finance-v2/index.js +++ b/projects/mare-finance-v2/index.js @@ -6,6 +6,6 @@ const unitroller = "0xFcD7D41D5cfF03C7f6D573c9732B0506C72f5C72"; module.exports = { methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", kava: { - ...compoundExports(unitroller, "kava"), + ...compoundExports(unitroller), }, } \ No newline at end of file diff --git a/projects/mare-finance/index.js b/projects/mare-finance/index.js index 3239fb097132..77b498d2320a 100644 --- a/projects/mare-finance/index.js +++ b/projects/mare-finance/index.js @@ -5,8 +5,11 @@ const unitroller = "0x4804357AcE69330524ceb18F2A647c3c162E1F95"; module.exports = { methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", + deadFrom: '2023-07-08', kava: { - ...compoundExports(unitroller, "kava"), + ...compoundExports(unitroller), staking: staking(['0x2c4A1f47c3E15F468399A87c4B41ec0d19297772', '0x194AAd54F363D28aDEaE53A7957d63B9BCf8a6b2'], '0xd86C8d4279CCaFbec840c782BcC50D201f277419') }, -} \ No newline at end of file +} + +module.exports.kava.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/marginal/index.js b/projects/marginal/index.js new file mode 100644 index 000000000000..8516807bad88 --- /dev/null +++ b/projects/marginal/index.js @@ -0,0 +1,17 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + base: { factory: '0x407fA8029852A8386a907287018CEAFd7242C621', fromBlock: 17016522 }, + ethereum: { factory: '0x95D95C41436C15b50217Bf1C0f810536AD181C13', fromBlock: 20297876 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event PoolCreated (address indexed token0, address indexed token1, uint24 maintenance, address indexed oracle, address pool)', fromBlock, }) + const ownerTokens = logs.map(log => [[log.token0, log.token1], log.pool]) + return api.sumTokens({ ownerTokens }) + } + } +}) \ No newline at end of file diff --git a/projects/margined-protocol/index.js b/projects/margined-protocol/index.js index 6a796969ddc6..05dc8c3e5493 100644 --- a/projects/margined-protocol/index.js +++ b/projects/margined-protocol/index.js @@ -1,19 +1,44 @@ -const { sumTokensExport} = require('../helper/sumTokens') -const contractAddresses = [ - 'osmo1rk4hregdr63rlqqj0k2rjzk6kz7w6v6tw8f5fqx2wg8203eam5equ67tdl', - 'osmo1zttzenjrnfr8tgrsfyu8kw0eshd8mas7yky43jjtactkhvmtkg2qz769y2', - 'osmo18pfsg9n2kn6epty7uhur7vxfszadvflx6f66569ejc469k8p64pqrve3yz', -] +const { queryContract } = require('../helper/chain/cosmos') + +const osmosisVaults = { + stOSMO: "osmo16s3sxs5886p42kteunp6370pken2n5ukzszz0trkr39epqtawn2qk4r9l5", + stTIA: "osmo1q3w9kedgtc8sdh7xlcr77ydv3qu7fs2e3q6xznysp2lrdfyz9xyqv26yqv", + ampOSMO: "osmo1cztgw4e467vjljd0s2flz8asu3x3wg9q0ttga9t6kzmpyaauxxrs2gjshq", + bOSMO: "osmo159f7axyc32cyfgzx0gs9r98jwpgutj5qz4ns97xvu7nw3xzpavzsg2uxr3", + qOSMO: "osmo18vk0rsu4qwzx74g9alu2f7x5zs99sluwkuh5wp70yed2ne4pmutqf9lvdu", + usdcaxlGrid: "osmo1qngwlgzt0r3fdg6zgln5wa6mr5c7t6fek3qqgxesujjak5ds747sy6qu2f", + // usdtGrid: "osmo1cj8tzmvun6urr0djrax7v92jyk86gnp8hsep0hacf83quvknq5lsutucjj", + OSMORedemption: "osmo15fqmdl8lfl9h0qflljd63ufw9j2m7xmsk3hu5vsn8xpta4hk5chqt7mddc", + TIARedemption: "osmo1reyz7pwu7y9e7lmzqg6j4h7jcv32du7n7jhnk2lz93a9lxr56ess2qtgzl", + ATOMRedemption: "osmo1hvl5kj4xzdj4udxjv2dzk2zfqhzkd9afqygwq3t84tn53e0250zqrltj48", +} + +const neutronVaults = { + ATOMFund: "neutron1puedrclm6rn33x3zv66xg6m23qcdagayqua6jj2wqzvfznlqef8qe53wr2", + NTRNStructured: "neutron13h4jzme5880knnc23xvwu9gytynnxu5cc0fek6fndmjyctzznj9sd5yhhy", + ATOMdATOM: "neutron1f99ujxefjr4jqmskc7hvg09am6pdq2j2c5049xwl0de4cavc4rfsl866y0", + wBTCUSDC: "neutron17fyzkafg4scrd6xu0sp9llrl6hazegza7yer4erlea0kvk30yxsqk2xqfd", + NTRNUSDC: "neutron1t0fl9k43g86sv60ghx9vtwed9rpgtf49rxzm05ff477j23h52c6s0urdc7", + TIAUSDC: "neutron1wv8pl7tsatzx6n9yaqfksvu5y0x7j50g6mhy636udwfn3vyqp0hsu7g8yk", +} + +const config = { + osmosis: osmosisVaults, + neutron: neutronVaults, +} module.exports = { - methodology: 'Total collateral held on power perpetual contracts', - osmosis: { - tvl: sumTokensExport({ owners: contractAddresses}), - }, - hallmarks:[ - [Math.floor(new Date('2023-11-06') / 1e3), 'sqOSMO contract deployed'], - [Math.floor(new Date('2023-11-21') / 1e3), 'sqATOM contract deployed'], - [Math.floor(new Date('2024-01-19') / 1e3), 'sqTIA contract deployed'], - ] + methodology: 'Total TVL on vaults', +} + +Object.keys(config).forEach(chain => module.exports[chain] = { tvl }) + +async function tvl(api) { + const vaults = config[api.chain] + for (const contract of Object.values(vaults)) { + let vaultInfo = await queryContract({ contract, api, data: { 'info': {} }, }); + let totalAssets = await queryContract({ contract, api, data: { 'total_assets': {} }, }); + api.add(vaultInfo.base_token, totalAssets); + } } diff --git a/projects/marinade.js b/projects/marinade.js index 18b1555992ec..21e776536f2a 100644 --- a/projects/marinade.js +++ b/projects/marinade.js @@ -1,7 +1,8 @@ const { getProvider, sumTokens2, } = require("./helper/solana") const { Program, } = require("@project-serum/anchor"); +const ADDRESSES = require('./helper/coreAssets.json') -async function tvl() { +async function tvl(api) { const provider = getProvider() const programId = 'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD' const idl = await Program.fetchIdl(programId, provider) @@ -10,12 +11,15 @@ async function tvl() { account: { validatorSystem: { totalActiveBalance }, availableReserveBalance, + emergencyCoolingDown, }, },] = await program.account.state.all() - const balances = { - solana: (+totalActiveBalance + +availableReserveBalance) / 1e9 - } - return sumTokens2({ balances, solOwners: ['UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q'] }) // Liq Pool Sol Leg Pda + + api.add(ADDRESSES.solana.SOL, totalActiveBalance) + api.add(ADDRESSES.solana.SOL, availableReserveBalance) + api.add(ADDRESSES.solana.SOL, emergencyCoolingDown) + + return sumTokens2({ api, solOwners: ['UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q'] }) // Liq Pool Sol Leg Pda } module.exports = { @@ -24,5 +28,5 @@ module.exports = { ], timetravel: false, solana: { tvl }, - methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN and SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q`, -} + methodology: `We sum the amount of SOL staked, SOL in reserve address: Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN, SOL in the Liquidity pool: UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q, and the emergency cooling down balance.`, +} \ No newline at end of file diff --git a/projects/mars/index.js b/projects/mars/index.js index 166827d8bbfe..6894881fe668 100644 --- a/projects/mars/index.js +++ b/projects/mars/index.js @@ -1,167 +1,126 @@ -const sdk = require('@defillama/sdk'); +const { queryContract } = require('../helper/chain/cosmos'); +const axios = require('axios'); +const BigNumber = require('bignumber.js'); -const { endPoints, queryContract, sumTokens} = require('../helper/chain/cosmos'); -const { getChainTransform } = require('../helper/portedTokens'); -const { get } = require('../helper/http'); - -const addresses = { +const contractAddresses = { osmosis: { + params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent', redBank: 'osmo1c3ljch9dfw5kf52nfwpxd2zmj2ese7agnx0p9tenkrryasrle5sqf3ftpg', - creditManager: 'osmo1f2m24wktq0sw3c0lexlg7fv4kngwyttvzws3a3r3al9ld2s2pvds87jqvf', - params: 'osmo1nlmdxt9ctql2jr47qd4fpgzg84cjswxyw6q99u4y4u4q6c2f5ksq7ysent' }, neutron: { + params: 'neutron1x4rgd7ry23v2n49y7xdzje0743c5tgrnqrqsvwyya2h6m48tz4jqqex06x', redBank: 'neutron1n97wnm7q6d2hrcna3rqlnyqw2we6k0l8uqvmyqq6gsml92epdu7quugyph', - } -} - - -// OSMOSIS + }, +}; -async function osmosisTVL() { - let balances = {}; - await addRedBankTvl(balances, 'osmosis'); - await addCreditManagerTvl(balances, 'osmosis'); - await osmosisSumVaultsTVL(balances); - return balances; -} +const poolsApis = { + osmosis: 'https://api.astroport.fi/api/pools?chainId=osmosis-1', + neutron: 'https://api.astroport.fi/api/pools?chainId=neutron-1', +}; -async function osmosisSumVaultsTVL(balances) { - let coins = []; - let vaultPagesRemaining = true; +async function tvl(api) { + const chain = api.chain; + const { params, redBank } = contractAddresses[chain]; let startAfter = null; - const pageLimit = 10; - const osmosisDenomTransform = await getChainTransform('osmosis'); - - while (vaultPagesRemaining) { - const roverVaultConfigs = await queryContract({ - contract: addresses.osmosis.params, - chain: 'osmosis', - data: { 'all_vault_configs': { limit: pageLimit, 'start_after': startAfter } } - }); + const pageLimit = 5; - if(roverVaultConfigs.length === pageLimit) { - startAfter = roverVaultConfigs[roverVaultConfigs.length - 1].vault; - vaultPagesRemaining = true - } else { - vaultPagesRemaining = false; - } - - await osmosisAddCoinsForVaultsInfoPage(coins, roverVaultConfigs); - } + do { + const assetParams = await queryContract({ + contract: params, + chain, + data: { all_asset_params: { limit: pageLimit, start_after: startAfter } }, + }); - coins.forEach(coin => { - sdk.util.sumSingleBalance(balances, osmosisDenomTransform(coin.denom), coin.amount); - }) -} + if (assetParams.length === pageLimit) startAfter = assetParams[assetParams.length - 1].denom; + else startAfter = null; -async function osmosisAddCoinsForVaultsInfoPage(coins, roverVaultConfigsPage) { - let vaultsMetadata = roverVaultConfigsPage.map(rvi => ({ fieldsVaultInfo: rvi })); - - // query the vault info for the vault contract itself to get the vault's - // base token - await Promise.all(vaultsMetadata.map(async vm => { - let vaultInfo = await queryContract({ - contract: vm.fieldsVaultInfo.addr, - chain: 'osmosis', - data: { 'info': {} } - }); - vm.vaultInfo = vaultInfo; - })); - - // get total vault shares owned by fields for each vault - await Promise.all(vaultsMetadata.map(async vm => { - let vaultShares = await cosmosDenomBalanceStr( - 'osmosis', - vm.vaultInfo.vault_token, - addresses.osmosis.creditManager - ); - vm.vaultShares = vaultShares; - })); - - // convert vault shares to vault base asset - await Promise.all(vaultsMetadata.map( async vm => { - let query = { - contract: vm.fieldsVaultInfo.addr, - chain: 'osmosis', - data: { 'convert_to_assets': { amount: vm.vaultShares } } - }; - let amount = await queryContract(query); - vm.baseTokenAmount = amount; - })); - - // Add coins to then be added to balances - // * For gamm lp tokens compute the share of underlying assets and add those - // * For other assets, add as is - await Promise.all(vaultsMetadata.map( async vm => { - const baseToken = vm.vaultInfo['base_token']; - if (baseToken.startsWith('gamm/pool/')) { - let poolId = baseToken.split('/')[2]; - const url = `osmosis/gamm/v1beta1/pools/${poolId}`; - const query = await cosmosLCDQuery(url, 'osmosis'); - const pool = query.pool; - pool['pool_assets'].forEach(asset => { - const denom = asset.token.denom; - const amount = asset.token.amount * vm.baseTokenAmount / pool['total_shares'].amount; - coins.push({denom, amount}); - }); - } else { - coins.push({denom: baseToken, amount: vm.baseTokenAmount}); - } - })); -} + await addCoinsFromAssetParams(assetParams); + } while (startAfter); -// NEUTRON - -async function neutronTVL() { - let balances = {}; - await addRedBankTvl(balances, 'neutron'); - return balances; -} + do { + const markets = await queryContract({ + contract: contractAddresses[chain].redBank, + chain, + data: { 'markets': { 'limit': pageLimit, 'start_after': startAfter } }, + }); -// HELPERS + if (markets.length === pageLimit) startAfter = markets[markets.length - 1].denom; + else startAfter = null; -async function addRedBankTvl(balances, chain) { - await sumTokens({balances, owners: [addresses[chain].redBank], chain}); -} + await deductCoinsFromMarkets(markets); + } while (startAfter); -async function addCreditManagerTvl(balances, chain) { - await sumTokens({balances, owners: [addresses[chain].creditManager], chain}); -} + async function addCoinsFromAssetParams(assetParams) { + const assetDenoms = assetParams.map((asset) => asset.denom); -function getEndpoint(chain) { - if (!endPoints[chain]) throw new Error('Chain not found: ' + chain); - return endPoints[chain]; -} + // fetch pool infos from the poolsApi based on chain + const poolInfos = await axios.get(poolsApis[chain]); -async function cosmosLCDQuery(url, chain) { - let endpoint = `${getEndpoint(chain)}/${url}`; - let request = await get(endpoint); - return request; -} + // query the deposited amount for each asset and add it to the depositCoins array + await Promise.all( + assetDenoms.map(async (denom) => { + const totalDepositInfo = await queryContract({ + contract: params, + chain, + data: { 'total_deposit': { 'denom': denom } }, + }); + // check if the token is a liquidity pool share (deposited via farm) + // and find it in the api data + const poolInfo = poolInfos.data.find((pool) => pool.lpAddress === denom); + + if (poolInfo) { + // check for the underlying asset and calculate how much underlying assets a pool share holds + const totalShares = poolInfo.poolTotalShare; + const poolAssets = poolInfo.assets; + poolAssets.forEach((asset) => { + const amount = new BigNumber(asset.amount); + const amountPerShare = amount.div(totalShares); + + // add the underlying tokens to the api + api.add(asset.denom, amountPerShare.times(totalDepositInfo.amount).integerValue(BigNumber.ROUND_DOWN).toString()); + }); + } else { + // if the it's a token and not a liquidity pool share, add it to the api + api.add(denom, totalDepositInfo.amount); + } + }), + ); + } -async function cosmosDenomBalanceStr(chain, denom, owner) { - let url = `cosmos/bank/v1beta1/balances/${owner}/by_denom?denom=${denom}`; - let balance = await cosmosLCDQuery(url, chain); - return balance.balance.amount; + async function deductCoinsFromMarkets(markets) { + // query the underlying debt amount from the debt_total_scaled + await Promise.all( + markets.map(async (market) => { + const totalDebt = await queryContract({ + contract: redBank, + chain, + data: { + 'underlying_debt_amount': { + 'denom': market.denom, + 'amount_scaled': market['debt_total_scaled'], + }, + }, + }); + api.add(market.denom, totalDebt * -1); + }), + ); + } } module.exports = { timetravel: false, - methodology: 'For each chain, sum token balances in Red Bank/Credit Manager smart contracts to approximate net deposits, plus vault underlying assets held in Rover', - osmosis: { - tvl: osmosisTVL, - }, - neutron: { - tvl: neutronTVL, - }, + methodology: + "For each chain, sum token balances by querying the total deposit amount for each asset in the chain's params contract.", + osmosis: { tvl }, + neutron: { tvl }, terra: { tvl: () => 0, }, - hallmarks:[ + hallmarks: [ [1651881600, 'UST depeg'], [1675774800, 'Relaunch on Osmosis'], - [1690945200, 'Red Bank launch on Neutron'], - [1696906800, 'Mars V2 launch on Osmosis'], - ] + [1690945200, 'Launch on Neutron'], + [1696906800, 'Mars v2 launch on Osmosis'], + [1724166000, 'Mars v2 launch on Neutron'], + ], }; diff --git a/projects/marswap/index.js b/projects/marswap/index.js index c798121331e0..2d9a76dc739a 100644 --- a/projects/marswap/index.js +++ b/projects/marswap/index.js @@ -7,6 +7,7 @@ const config = { shibarium: ["0xBe0223f65813C7c82E195B48F8AAaAcb304FbAe7","0xd871a3f5d3bB9c00DDB0cC772690351B9712968D"], base: ["0xeE42fe6d6Be1eF43701DDAbc417AD22d82C5ecC3"], cronos: ["0xD716B78F0002C23190B024fc93C33CF73E30b8A6"], + cronos_zkevm: ["0xc547615d77b2d5c1add3d744342d8CB027873e82"] } module.exports = { diff --git a/projects/maskex/index.js b/projects/maskex/index.js index c8de7c1a07b3..fe02cb33e7e1 100644 --- a/projects/maskex/index.js +++ b/projects/maskex/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -69,9 +70,7 @@ const config = { ] }, bitcoin: { - owners: [ - '39DUz1NCkLu25GczWiAjjgZBu4mUjKbdNA', // this wallet was collected from https://blog.maskex.com/news/announcements/embracing-transparency-maskex-reveals-wallet-addresses - ] + owners: bitcoinAddressBook.maskex } } diff --git a/projects/maverick-v2/index.js b/projects/maverick-v2/index.js index a8018ec25844..b3c4cf7dcb0a 100644 --- a/projects/maverick-v2/index.js +++ b/projects/maverick-v2/index.js @@ -74,4 +74,12 @@ module.exports = maverickTVL({ }, ], }, + scroll: { + factories: [ + { + address: "0x0A7e848Aca42d879EF06507Fca0E7b33A0a63c1e", + startBlock: 7332349, + }, + ], + }, }); diff --git a/projects/maxapy/index.js b/projects/maxapy/index.js new file mode 100644 index 000000000000..72b46a70518d --- /dev/null +++ b/projects/maxapy/index.js @@ -0,0 +1,23 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + doublecounted: true, + methodology: "Counts total value locked in ERC4626 vaults", +} + +const config = { + ethereum: [ + "0x9847c14fca377305c8e2d10a760349c667c367d4", + "0x349c996c4a53208b6eb09c103782d86a3f1bb57e", + ], + polygon: [ + "0xe7fe898a1ec421f991b807288851241f91c7e376", + "0xa02aa8774e8c95f5105e33c2f73bdc87ea45bd29", + ] +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumERC4626VaultsExport({ vaults: config[chain], isOG4626: true, }) + } +}) diff --git a/projects/maximizer/index.js b/projects/maximizer/index.js index ba02b163b04a..96f30b08e13e 100644 --- a/projects/maximizer/index.js +++ b/projects/maximizer/index.js @@ -1,232 +1,14 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const BigNumber = require("bignumber.js"); -const { sumTokensAndLPsSharedOwners, unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); -const allocatorAbi = require("./allocatorAbi.json"); -const pngStakingAbi = require("./stakingRewardsAbi.json"); -const joeStakingAbi = require("./stableJoeStakingAbi.json"); -const veptpAbi = require("./veptpAbi.json"); -const qiTokenAbi = require("./qiTokenAbi.json"); const MaximizerStaking = "0x6d7AD602Ec2EFdF4B7d34A9A53f92F06d27b82B1"; -const Treasury = "0x22cF6c46b4E321913ec30127C2076b7b12aC6d15"; -const Deployer = "0xb2Fe117269292D41c3b5bdD6B600Fc80239AfBeC"; -const PngAllocator = "0x1ff1E60e7af648DFE7B95E025214bfCd6f3D9524"; -const JoeAllocator = "0x7613D00f7b49E514Ce84d6369EA12Cc98219Ed40"; -const BenqiAllocator = '0x1e3834DA9a9B4d4016427554Ef31ff4e1F41d4Ed'; - const MAXI = "0x7C08413cbf02202a1c13643dB173f2694e0F73f0"; -const SMAXI = "0xEcE4D1b3C2020A312Ec41A7271608326894076b4"; -const DAIe = ADDRESSES.avax.DAI; -const USDC = ADDRESSES.avax.USDC; -const USDCe = ADDRESSES.avax.USDC_e; -const WAVAX = ADDRESSES.avax.WAVAX; -const PNG = "0x60781C2586D68229fde47564546784ab3fACA982"; -const QI = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; -const JOE = ADDRESSES.avax.JOE; -const XJOE = ADDRESSES.avax.xJOE; -const ISA = "0x3EeFb18003D033661f84e48360eBeCD181A84709"; -const PTP = "0x22d4002028f537599bE9f666d1c4Fa138522f9c8"; -const VEPTP = "0x5857019c749147EEE22b1Fe63500F237F3c1B692"; -const MORE = "0xd9D90f882CDdD6063959A9d837B05Cb748718A05"; -const MONEY = "0x0f577433Bf59560Ef2a79c124E9Ff99fCa258948"; -const HEC = "0xC7f4debC8072e23fe9259A5C0398326d8EfB7f5c"; -const SAVAX = ADDRESSES.avax.SAVAX; -const MAXI_DAI_JLP = "0xfBDC4aa69114AA11Fae65E858e92DC5D013b2EA9"; -const MAXI_WAVAX_PGL = "0xbb700450811a30c5ee0dB80925Cf1BA53dBBd60A"; -const PNG_WAVAX_PGL = "0xd7538cABBf8605BdE1f4901B47B8D42c61DE0367"; -const QI_WAVAX_PGL = "0xE530dC2095Ef5653205CF5ea79F8979a7028065c"; -const JOE_WAVAX_JLP = "0x454E67025631C065d3cFAD6d71E6892f74487a15"; -const ISA_WAVAX_JLP = "0x9155f441FFDfA81b13E385bfAc6b3825C05184Ee"; -const PTP_WAVAX_JLP = "0xCDFD91eEa657cc2701117fe9711C9a4F61FEED23"; -const MORE_WAVAX_JLP = "0xb8361D0E3F3B0fc5e6071f3a3C3271223C49e3d9"; -const HEC_WAVAX_JLP = "0x4dc5291cdc7ad03342994e35d0ccc76de065a566"; -const AVAX_QITOKEN = "0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c"; -const QI_QITOKEN = "0x35Bd6aedA81a7E5FC7A7832490e71F757b0cD9Ce"; -const DAI_QITOKEN = "0x835866d37AFB8CB8F8334dCCdaf66cf01832Ff5D"; -const USDC_QITOKEN = "0xB715808a78F6041E46d61Cb123C9B4A27056AE9C"; -const SAVAX_QITOKEN = "0xF362feA9659cf036792c9cb02f8ff8198E21B4cB"; - -const PngStaking = "0x88afdaE1a9F58Da3E68584421937E5F564A0135b"; -const JoeStaking = "0x1a731B2299E22FbAC282E7094EdA41046343Cb51"; - -const Allocators = [ - { allocator: PngAllocator, stakeToken: PNG, yieldToken: PNG, yieldStaking: PngStaking, abi: pngStakingAbi.balanceOf, params: [ PngAllocator ], transformResult: (result) => result.output }, - { allocator: JoeAllocator, stakeToken: JOE, yieldToken: JOE, yieldStaking: JoeStaking, abi: joeStakingAbi.getUserInfo, params: [ JoeAllocator, USDC ], transformResult: (result) => result.output.amount }, -]; -const Allocations = [ - { allocator: PngAllocator, token: PNG_WAVAX_PGL, pid: 0 }, - { allocator: PngAllocator, token: QI_WAVAX_PGL, pid: 19 }, - { allocator: PngAllocator, token: MAXI_WAVAX_PGL, pid: 42 }, - { allocator: JoeAllocator, token: JOE_WAVAX_JLP, pid: 0 }, - { allocator: JoeAllocator, token: ISA_WAVAX_JLP, pid: 36 }, - { allocator: JoeAllocator, token: HEC_WAVAX_JLP, pid: 41 }, - { allocator: JoeAllocator, token: MORE_WAVAX_JLP, pid: 44 }, -]; - -const BenqiMarkets = [ - { qiToken: AVAX_QITOKEN, underlyingToken: WAVAX }, - { qiToken: QI_QITOKEN, underlyingToken: QI }, - { qiToken: DAI_QITOKEN, underlyingToken: DAIe }, - { qiToken: USDC_QITOKEN, underlyingToken: USDC }, - { qiToken: SAVAX_QITOKEN, underlyingToken: SAVAX }, -]; - -const Tokens = [ - [MAXI, false], - [SMAXI, false], - [DAIe, false], - [USDC, false], - [WAVAX, false], - [PNG, false], - [QI, false], - [JOE, false], - [ISA, false], - [PTP, false], - [MORE, false], - [MONEY, false], - [HEC, false], - [MAXI_DAI_JLP, true], - [MAXI_WAVAX_PGL, true], - [PNG_WAVAX_PGL, true], - [QI_WAVAX_PGL, true], - [JOE_WAVAX_JLP, true], - [ISA_WAVAX_JLP, true], - [PTP_WAVAX_JLP, true], - [MORE_WAVAX_JLP, true], - [HEC_WAVAX_JLP, true], -]; - -function compareToIgnoreCase(a, b) { - return a.toLowerCase() === b.toLowerCase(); -} - -const transformAddress = (addr) => { - let resultantAddress = addr; - // sMAXI -> MAXI - if (compareToIgnoreCase(addr, SMAXI)) { - resultantAddress = MAXI; - } - // USDC -> USDC.e - if (compareToIgnoreCase(addr, USDC)) { - resultantAddress = USDCe; - } - // MONEY -> DAI - if (compareToIgnoreCase(addr, MONEY)) { - resultantAddress = DAIe; - } - // xJOE -> JOE - if (compareToIgnoreCase(addr, XJOE)) { - resultantAddress = JOE; - } - return `avax:${resultantAddress.toLowerCase()}`; -}; - -const chainConfig = (chainBlocks) => ({ - block: chainBlocks.avax, - chain: "avax", - transformAddress, -}); - -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = await sdk.api.abi.call({ - abi: "erc20:balanceOf", - target: MAXI, - params: MaximizerStaking, - block: chainBlocks.avax, - chain: "avax", - }); - - sdk.util.sumSingleBalance(balances, "avax:" + MAXI, stakingBalance.output); - - return balances; -}; - -async function tvl(timestamp, block, chainBlocks) { - const config = chainConfig(chainBlocks); - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - Tokens, - [Treasury], - config.block, - config.chain, - config.transformAddress, - ); - - const allocatedLps = await sdk.api.abi.multiCall({ - calls: Allocations.map(allocation => ({ - target: allocation.allocator, - params: [allocation.token] - })), - abi: allocatorAbi.balanceOf, - ...config, - }); - - await unwrapUniswapLPs( - balances, - Allocations.map((allocation, index) => ({ - balance: allocatedLps.output[index].output, - token: allocation.token, - })), - config.block, - config.chain, - config.transformAddress, - ); - - const stakedYieldTokens = (await Promise.all( - Allocators.map(allocator => ( - sdk.api.abi.call({ - target: allocator.yieldStaking, - params: allocator.params, - abi: allocator.abi, - ...config, - }) - )) - )).map((result, index) => Allocators[index].transformResult(result)); - - const pendingYieldTokens = (await sdk.api.abi.multiCall({ - calls: Allocators.map(allocator => ({ - target: allocator.allocator, - })), - abi: allocatorAbi.pending, - ...config, - })).output.map(result => result.output); - - for (const [index, allocator] of Allocators.entries()) { - sdk.util.sumSingleBalance(balances, config.transformAddress(allocator.stakeToken), stakedYieldTokens[index]); - sdk.util.sumSingleBalance(balances, config.transformAddress(allocator.yieldToken), pendingYieldTokens[index]); - } - - for (const market of BenqiMarkets) { - const [balance, exchangeRate] = await Promise.all([ - sdk. - api.abi.call({ target: market.qiToken, abi: qiTokenAbi.balanceOf, params: [BenqiAllocator], ...config }), - sdk.api.abi.call({ target: market.qiToken, abi: qiTokenAbi.exchangeRateStored, params: [], ...config }), - ]); - const underlyingTokenBalance = new BigNumber(balance.output).times(new BigNumber(exchangeRate.output)).div(new BigNumber(1e18)); - sdk.util.sumSingleBalance(balances, config.transformAddress(market.underlyingToken), underlyingTokenBalance.toFixed(0)); - } - - const stakedPtp = (await sdk.api.abi.call({ - target: VEPTP, - abi: veptpAbi.getStakedPtp, - params: [Deployer], - ...config, - })).output; - sdk.util.sumSingleBalance(balances, config.transformAddress(PTP), stakedPtp); - - return balances; -} +const staking = async (api) => api.sumTokens({ owner: MaximizerStaking, token: MAXI }) module.exports = { - avax:{ - tvl, + avax: { + tvl: () => ({}), staking, }, + deadFrom: '2022-06-13', methodology: "Counts MAXI, MAXI LP (MAXI-DAI.e JLP, MAXI-WAVAX PGL), DAI.e, USDC, WAVAX, liquidity tokens (PGL, JLP), single partner tokens on the treasury and allocators", }; diff --git a/projects/mayachain/index.js b/projects/mayachain/index.js index 4880587fd77c..d793d9602dc0 100644 --- a/projects/mayachain/index.js +++ b/projects/mayachain/index.js @@ -10,6 +10,7 @@ const chainMapping = { THOR: "thorchain", DASH: "dash", ARB: "arbitrum", + XRD: "radixdlt", }; const tokenGeckoMapping = { @@ -18,6 +19,7 @@ const tokenGeckoMapping = { "ETH.PEPE": "pepe", "ETH.ETH": "ethereum", "ETH.USDC": "usd-coin", + "ETH.MOG":"mog-coin", "KUJI.USK": "usk", "KUJI.KUJI": "kujira", "THOR.RUNE": "thorchain", @@ -37,6 +39,7 @@ const tokenGeckoMapping = { "ARB.USDT": "tether", "ARB.WBTC": "wrapped-bitcoin", "ARB.WSTETH": "wrapped-steth", + "XRD.XRD": "radix", }; const tokenToDecimalMapping = { @@ -45,6 +48,7 @@ const tokenToDecimalMapping = { "ETH.PEPE": 18, "ETH.ETH": 18, "ETH.USDC": 6, + "ETH.MOG":18, "KUJI.USK": 8, "KUJI.KUJI": 8, "THOR.RUNE": 8, @@ -65,6 +69,7 @@ const tokenToDecimalMapping = { "ARB.USDT": 6, "ARB.WBTC": 8, "ARB.WSTETH": 18, + "XRD.XRD": 8, }; async function tvl(api) { @@ -89,9 +94,9 @@ async function tvl(api) { let [baseToken, address] = token.split("-"); if (chain === "ethereum" || chain === "arbitrum") { - assetDepth = - assetDepth * - 10 ** (+tokenToDecimalMapping[chainStr + "." + baseToken] - 8); + let decimal = tokenToDecimalMapping[chainStr + "." + baseToken]; + if (decimal === undefined || isNaN(decimal)) return + assetDepth = assetDepth * 10 ** (+decimal - 8); // e.g. ETH.USDC-0XA0B86991C6218B36C1D19D4A2E9EB0CE3606EB48 address = address && address.includes('-') ? address.split("-")[1] : address diff --git a/projects/meanfinance/addresses.js b/projects/meanfinance/addresses.js index e06c3fb11a5d..5139a45ed63a 100644 --- a/projects/meanfinance/addresses.js +++ b/projects/meanfinance/addresses.js @@ -44,7 +44,7 @@ const TOKENS_IN_LEGACY_VERSIONS = { '0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b', // AVAX '0x3066818837c5e6ed6601bd5a91b0762877a6b731', // UMA '0x3a58a54c066fdc0f2d55fc9c89f0415c92ebf3c4', // stMATIC - '0x45c32fa6df82ead1e2ef74d17b76547eddfaff89', // FRAX + ADDRESSES.polygon.FRAX, // FRAX '0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c', // jEUR '0x50b728d8d964fd00c2d0aad81718b71311fef68a', // SNX '0x53e0bca35ec356bd5dddfebbd1fc0fd03fabad39', // LINK diff --git a/projects/meanfinance/index.js b/projects/meanfinance/index.js index 3be9d2b6e73b..0fa35f6c9d6d 100644 --- a/projects/meanfinance/index.js +++ b/projects/meanfinance/index.js @@ -67,6 +67,7 @@ module.exports = { moonbeam: getV2TvlObject('moonbeam'), avax: getV2TvlObject('avax'), rsk: getV2TvlObject('rsk'), + base: getV2TvlObject('base'), 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 index a18cfc7fcec8..24a222d970a0 100644 --- a/projects/mellow-protocol-v2/index.js +++ b/projects/mellow-protocol-v2/index.js @@ -10,7 +10,13 @@ const config = { '0x49cd586dd9BA227Be9654C735A659a1dB08232a9', '0x82dc3260f599f4fC4307209A1122B6eAa007163b', '0xd6E09a5e6D719d1c881579C9C8670a210437931b', - '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811' + '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811', + '0x5E362eb2c0706Bd1d134689eC75176018385430B', + '0x7F43fDe12A40dE708d908Fb3b9BFB8540d9Ce444', + '0x3a828C183b3F382d030136C824844Ea30145b4c7', + '0x64047dD3288276d70A4F8B5Df54668c8403f877F', + '0x7b31F008c48EFb65da78eA0f255EE424af855249', + '0x4f3Cc6359364004b245ad5bE36E6ad4e805dC961', ], }, } diff --git a/projects/memecooking/index.js b/projects/memecooking/index.js new file mode 100644 index 000000000000..615d3d10ba94 --- /dev/null +++ b/projects/memecooking/index.js @@ -0,0 +1,11 @@ +const { addTokenBalances } = require("../helper/chain/near"); + +const MEMECOOKING_CONTRACT = 'meme-cooking.near'; +const FT_NEAR = 'wrap.near' + +module.exports = { + methodology: 'Amount of wNEAR in the MEMECOOKING contract', + near: { + tvl: () => addTokenBalances([FT_NEAR], MEMECOOKING_CONTRACT), + } +}; \ No newline at end of file diff --git a/projects/memeta/index.js b/projects/memeta/index.js new file mode 100644 index 000000000000..ce86a6650327 --- /dev/null +++ b/projects/memeta/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json'); + +async function tvl(api) { + const MEMETA_CONTRACT_ADDRESS = "0xD76A1A03C4873042c50ba77cE455C793C70d1b2d"; + + return api.sumTokens({ + owner: MEMETA_CONTRACT_ADDRESS, + tokens: [ + ADDRESSES.manta.WETH, + ADDRESSES.manta.USDC, + ADDRESSES.manta.USDT, + ADDRESSES.manta.WBTC, + ], + }); +} + +module.exports = { + manta: { tvl }, +}; \ No newline at end of file diff --git a/projects/mento/index.js b/projects/mento/index.js index addb839a4b0b..b9435c49b4df 100644 --- a/projects/mento/index.js +++ b/projects/mento/index.js @@ -1,6 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, } = require('../helper/unwrapLPs') const { sumTokensExport, } = require('../helper/sumTokens') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: 'TVL counts all assets deposited as collateral to mint Mento stablecoins.', @@ -19,6 +20,6 @@ module.exports = { }) }, bitcoin: { - tvl: sumTokensExport({ owners: ['38EPdP4SPshc5CiUCzKcLP9v7Vqo5u1HBL', '3KWX93e2zPPQ2eWCsUwPAB6VhAKKPLACou'], }) + tvl: sumTokensExport({ owners: bitcoinAddressBook.mento }) } } diff --git a/projects/meowfinance/index.js b/projects/meowfinance/index.js index 1c7ba6969542..c3a033e0771c 100644 --- a/projects/meowfinance/index.js +++ b/projects/meowfinance/index.js @@ -1,21 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { pool2Exports } = require("../helper/pool2"); -const { stakingUnknownPricedLP } = require("../helper/staking"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { pool2 } = require("../helper/pool2"); +const { staking } = require("../helper/staking"); const meow = "0x41F4CC9613E31d4E77C428b40D53537Da24264Ee"; const meowMining = "0xba1a3dACa919616aA462E93A80EFbe82753f9087"; const meowFtm = "0x150Aeb5389d56E258c2bbb42c7e67e944EDEE913"; -const treasuryContract = "0x7d25f49C648B2a12B5f530Df929204352cb6080e"; - -const translate = { - [ADDRESSES.fantom.fUSDT]: - ADDRESSES.ethereum.USDT, - [ADDRESSES.fantom.DAI]: - ADDRESSES.ethereum.DAI, -}; const workers = [ "0x5f1D549826e1AE30D653aD17e7277Fb7C6AC7EDD", // SpiritswapWorker_USDC_FTM_Spirit_Worker @@ -37,172 +26,29 @@ const workers = [ "0xC14f48826EB564201Bf7D7111f0b46e2301bF36A", // SpookyswapWorker_fUSDT_FTM_Spooky_Worker ]; -async function calcTvl(block, chain, borrow) { - let balances = {}; - const poolLength = ( - await sdk.api.abi.call({ - target: meowMining, - abi: abi.poolLength, - block, - chain, - }) - ).output; - const poolInfo = ( - await sdk.api.abi.multiCall({ - calls: Array.from({ length: Number(poolLength) }, (_, k) => ({ - target: meowMining, - params: k, - })), - abi: abi.poolInfo, - block, - chain, - }) - ).output; - const symbols = ( - await sdk.api.abi.multiCall({ - calls: poolInfo.map((p) => ({ - target: p.output.stakeToken, - })), - abi: "erc20:symbol", - block, - chain, - }) - ).output; - let ibTokens = []; - symbols.forEach((p) => { - if (p.output.startsWith("ib")) { - ibTokens.push(p.input.target); - } - }); - const underlyingtoken = ( - await sdk.api.abi.multiCall({ - calls: ibTokens.map((p) => ({ - target: p, - })), - abi: abi.token, - block, - chain, - }) - ).output; - const totalToken = ( - await sdk.api.abi.multiCall({ - calls: ibTokens.map((p) => ({ - target: p, - })), - abi: abi.totalToken, - block, - chain, - }) - ).output; - const vaultDebtVal = ( - await sdk.api.abi.multiCall({ - calls: ibTokens.map((p) => ({ - target: p, - })), - abi: abi.vaultDebtVal, - block, - chain, - }) - ).output; - for (let i = 0; i < ibTokens.length; i++) { - let token = underlyingtoken[i].output.toLowerCase(); - let total = Number(totalToken[i].output); - let debt = Number(vaultDebtVal[i].output); - if (translate[token] !== undefined) { - token = translate[token]; - } else { - token = `fantom:${token}`; - } - if (!borrow) { - sdk.util.sumSingleBalance(balances, token, total - debt); - } else { - sdk.util.sumSingleBalance(balances, token, debt); - } - } - return balances; +async function calcTvl(api, borrow) { + if (borrow) return {} + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: meowMining}) + return api.sumTokens({ owner: meowMining, tokens: poolInfos.map(p => p.stakeToken), blacklistedTokens: [meowFtm] }) } -async function tvl(timestamp, block, chainBlocks) { - let balances = await calcTvl(chainBlocks.fantom, "fantom", false); - const lpTokens = ( - await sdk.api.abi.multiCall({ - calls: workers.map((p) => ({ - target: p, - })), - abi: abi.lpToken, - block: chainBlocks.fantom, - chain: "fantom", - }) - ).output; - const masterchefs = ( - await sdk.api.abi.multiCall({ - calls: workers.map((p) => ({ - target: p, - })), - abi: abi.masterchef, - block: chainBlocks.fantom, - chain: "fantom", - }) - ).output; - const pids = ( - await sdk.api.abi.multiCall({ - calls: workers.map((p) => ({ - target: p, - })), - abi: abi.pid, - block: chainBlocks.fantom, - chain: "fantom", - }) - ).output; - const userInfos = ( - await sdk.api.abi.multiCall({ - calls: Array.from({ length: workers.length }, (_, k) => ({ - target: masterchefs[k].output, - params: [pids[k].output, workers[k]], - })), - abi: abi.userInfo, - block: chainBlocks.fantom, - chain: "fantom", - }) - ).output; - let lpPos = []; - for (let i = 0; i < workers.length; i++) { - if (userInfos[i].output.amount === "0") continue; - lpPos.push({ - token: lpTokens[i].output, - balance: userInfos[i].output.amount, - }); - } - await unwrapUniswapLPs( - balances, - lpPos, - chainBlocks.fantom, - "fantom", - (addr) => `fantom:${addr}` - ); - return balances; +async function tvl(api) { + await calcTvl(api, false); + const lpTokens = await api.multiCall({ abi: abi.lpToken, calls: workers}) + const shares = await api.multiCall({ abi: 'uint256:totalShare', calls: workers}) + const bals = (await api.multiCall({ abi: 'function shareToBalance(uint256) view returns (uint256)', calls: lpTokens.map((lp, i) => ({ target: lp, params: shares[i] })), permitFailure: true})).map(b => b || 0) + api.add(lpTokens, bals) } -async function borrowed(timestamp, block, chainBlocks) { - return await calcTvl(chainBlocks.fantom, "fantom", true); +async function borrowed(api) { + return await calcTvl(api, true); } module.exports = { fantom: { tvl, borrowed, - pool2: pool2Exports( - meowMining, - [meowFtm], - "fantom", - (addr) => `fantom:${addr}` - ), - staking: stakingUnknownPricedLP( - meowMining, - meow, - "fantom", - meowFtm, - (addr) => `fantom:${addr}` - ), + pool2: pool2(meowMining, [meowFtm],), + staking: staking(meowMining, meow,), }, }; diff --git a/projects/merchant/index.js b/projects/merchant/index.js index 67e383e77043..bfb0bcb625e6 100644 --- a/projects/merchant/index.js +++ b/projects/merchant/index.js @@ -1,9 +1,12 @@ const { compoundExports2 } = require("../helper/compound"); + + module.exports = { hallmarks: [ [1720051200,"Rug Pull"] ], + deadFrom: '2024-07-06', methodology: "Same as Compound Finance, we just count all the tokens supplied (not borrowed money) on the lending markets", merlin: { @@ -12,4 +15,8 @@ module.exports = { linea: { ...compoundExports2({ comptroller: '0xE54F37bbb8b7417EE4e0447DA0F8b922Fc7bb8Fa'}), }, -}; +} + +module.exports.merlin.borrowed = () => ({}) // bad debt +module.exports.linea.borrowed = () => ({}) // bad debt + diff --git a/projects/mercurial.js b/projects/mercurial.js index 7848842675be..747ab9a66324 100644 --- a/projects/mercurial.js +++ b/projects/mercurial.js @@ -99,7 +99,9 @@ async function tvl() { tokensAndOwners.push([i.tokenAMint, i.aVault]) tokensAndOwners.push([i.tokenBMint, i.bVault]) }) - return sumTokens2({ tokensAndOwners }) + const balances = await sumTokens2({ tokensAndOwners }) + delete balances['solana:AwRErBEFGTnohzfLeRSBH9HddQEy2oeRxnWLrbvFFh95'] + return balances } module.exports = { diff --git a/projects/meridian-lend/index.js b/projects/meridian-lend/index.js index ab48dae7a710..df360e037e56 100644 --- a/projects/meridian-lend/index.js +++ b/projects/meridian-lend/index.js @@ -16,4 +16,5 @@ module.exports = { telos: v2("telos", "0xb84171C0824B4F3C0B415706C99A4A8ED5779b75"), meter: v2("meter", "0x64Be9ee529E555860DA0705819138F41247e76E6"), fuse: v2("fuse", "0xbdD3d2f93cc1c6C951342C42Ef0795323CE83719"), + taiko: v2("taiko", "0x8Cf3E0e7aE4eB82237d0931388EA72D5649D76e0"), } \ No newline at end of file diff --git a/projects/meridian-swap/index.js b/projects/meridian-swap/index.js new file mode 100644 index 000000000000..c6aba3608ea5 --- /dev/null +++ b/projects/meridian-swap/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports={ + misrepresentedTokens: true, + telos:{ + tvl: getUniTVL({ factory: '0x1F2542D8F784565D526eeaDC9F1ca8Fbb75e5996', useDefaultCoreAssets: true }), + } +} \ No newline at end of file diff --git a/projects/merlin-l2/index.js b/projects/merlin-l2/index.js index ab92d570c537..8d2762206a13 100644 --- a/projects/merlin-l2/index.js +++ b/projects/merlin-l2/index.js @@ -2,39 +2,17 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk'); const { sumTokensExport: sumBRC20TokensExport } = require("../helper/chain/brc20"); const { sumTokensExport } = require('../helper/sumTokens'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') // https://medium.com/@merlinchaincrypto/merlins-seal-the-biggest-fair-launch-of-layer2-5614001b2582 // https://bridge.merlinchain.io/api/v1/token_mapping?after=0&size=100 -const owners = [ - "bc1qtu66zfqxj6pam6e0zunwnggh87f5pjr7vdr5cd", - "15zVuow5e9Zwj4nTrxSH3Rvupk32wiKEsr", - "bc1q4gfsheqz7ll2wdgfwjh2l5hhr45ytc4ekgxaex", - "bc1qua5y9yhknpysslxypd4dahagj9jamf90x4v90x", - "bc1qm64dsdz853ntzwleqsrdt5p53w75zfrtnmyzcx", - "1EEU18ZvWrbMxdXEuqdii6goDKbAbaXiA1", - "bc1qptgujmlkez7e6744yctzjgztu0st372mxs6702", - "16LDby5cWxzQqTFJrA1DDmbwABumCQHteG", - "bc1qq3c6kehun66sdek3q0wmu540n3vg0hgrekkjce", - "124SzTv3bBXZVPz2Li9ADs9oz4zCfT3VmM", - "bc1qyqt9zs42qmyf373k7yvy0t3askxd927v304xlv", - "bc1qgxdqf7837dxe8xkhvctgc499kwh5xw7ap3uwhs", // add on 25/02/2024 - "bc1pruhkl5exjt0z824cafauf750f5g08azuvgcjctv0enz5csayaj7ss3j5wc", // add on 25/02/2024 - "bc1q97vmervc8x9hzr4z4yvzn3x4rk74se6e8x8sgy", // add on 25/02/2024 - "bc1q2lzqzjcq472x8v0kgdcn4m5y8cq95ysnxm6vemu0qsuqgzyge06sqmqdal", // add on 25/02/2024 - "bc1qcmj5lkumeycyn35lxc3yr32k3fzue87yrjrna6", //nft_vault_address; - "bc1qq76dy32nnk5sha36etg6pdj94vl5zrskavux2f", // add on 12/05/2024 - "36n825H7orW1u8yWmvR4zs2CWfmkY2rkpK", // add on 12/05/2024 - "bc1p35l88j3ashhktg75tjctt6pacrgpyr93ldt7yw484dm4expq073qk4n0a0", // add on 12/05/2024 - -] - module.exports = { methodology: "Staking tokens via BitStable counts as TVL", bitcoin: { tvl: sdk.util.sumChainTvls([ - sumTokensExport({ owners }), - sumBRC20TokensExport({ owners }), + sumTokensExport({ owners: bitcoinAddressBook.merlin }), + sumBRC20TokensExport({ owners: bitcoinAddressBook.merlin }), ]), }, ethereum: { diff --git a/projects/merlin/index.js b/projects/merlin/index.js index 26f8863233b0..d668ed0d98a1 100644 --- a/projects/merlin/index.js +++ b/projects/merlin/index.js @@ -6,4 +6,5 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-04-26')/1e3), 'Project Rugged!'], ], + deadFrom: Math.floor(new Date('2023-04-26')/1e3) }; diff --git a/projects/mero/index.js b/projects/mero/index.js index 05888cb2f96a..b4c184a15716 100644 --- a/projects/mero/index.js +++ b/projects/mero/index.js @@ -1,52 +1,15 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { createIncrementArray } = require('../helper/utils') - - -const chain = "ethereum" const addressProviders = [ '0x139c15e21b0f6e43fc397face5de5b7d5ae6874a', '0xa298d39715AE492e4CAF3Ccb33cBF57abC5238d7', ] -async function tvl(timestamp, block) { - const balances = {} - const { output: vaultCounts } = await sdk.api.abi.multiCall({ - calls: addressProviders.map(i => ({ target: i })), - abi: abi.poolsCount, - chain, block, - }) - const vaultCallsList = [] - vaultCounts.forEach((j, idx) => { - createIncrementArray(j.output).forEach(i => vaultCallsList.push({ params: i, target: addressProviders[idx] })) - }) - - const { output: vaultsOut } = await sdk.api.abi.multiCall({ - abi: abi.getPoolAtIndex, - calls: vaultCallsList, - chain, block, - }) - - const strategies = vaultsOut.map(i => i.output) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.getUnderlying, - calls: strategies.map(i => ({ target: i })), - chain, block, - }) - - const { output: deposits } = await sdk.api.abi.multiCall({ - abi: abi.totalUnderlying, - calls: strategies.map(i => ({ target: i })), - chain, block, - }) - - tokens.forEach((data, i) => { - sdk.util.sumSingleBalance(balances, data.output, deposits[i].output) - }) - - return balances +async function tvl(api) { + const strategies = await api.fetchList({ lengthAbi: abi.poolsCount, itemAbi: abi.getPoolAtIndex, calls: addressProviders}) + const tokens = await api.multiCall({ abi: abi.getUnderlying, calls: strategies}) + const deposits = await api.multiCall({ abi: abi.totalUnderlying, calls: strategies}) + api.add(tokens, deposits) } module.exports = { diff --git a/projects/meso-finance/index.js b/projects/meso-finance/index.js new file mode 100644 index 000000000000..dcf145f8b0e0 --- /dev/null +++ b/projects/meso-finance/index.js @@ -0,0 +1,50 @@ +const { function_view } = require("../helper/chain/aptos") +const methodologies = require("../helper/methodologies") + +let _poolData + +function getPoolData() { + if (!_poolData) { + _poolData = new Promise(fetchPoolData) + } + + return _poolData + + async function fetchPoolData(resolve, reject) { + try { + const poolAddresses = await getPoolAddresses() + const poolInfos = await Promise.all(poolAddresses.map(getPoolInfo)) + resolve(poolInfos) + } catch (e) { reject(e) } + } + + async function getPoolAddresses() { + const pools = await function_view({ functionStr: "0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::meso::pools" }) + return pools['data'].map(obj => { return { coin: obj.key, poolAddress: obj.value.inner } }) + } + + async function getPoolInfo(pool) { + const [poolInfo] = await function_view({ functionStr: "0x68476f9d437e3f32fd262ba898b5e3ee0a23a1d586a6cf29a28add35f253f6f7::lending_pool::pool_info", args: [pool.poolAddress] }) + return { coin: pool.coin, poolSupply: poolInfo.total_reserves, totalDebt: poolInfo.total_debt } + } +} + +module.exports = { + timetravel: false, + methodology: methodologies.lendingMarket, + aptos: { + tvl: async (api) => { + const poolInfos = await getPoolData() + poolInfos.forEach(({ coin, poolSupply, }) => { + api.add(coin, poolSupply) + }) + }, + + borrowed: async (api) => { + const poolInfos = await getPoolData() + poolInfos.forEach(({ coin, totalDebt }) => { + api.add(coin, totalDebt) + }) + } + }, +} \ No newline at end of file diff --git a/projects/metapoly/index.js b/projects/metapoly/index.js index 9db34bbe92c5..fd16f28d7d22 100644 --- a/projects/metapoly/index.js +++ b/projects/metapoly/index.js @@ -1,7 +1,4 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { sumTokens2 } = require('../helper/unwrapLPs') -const { getChainTransform } = require('../helper/portedTokens') const config = { kava: { @@ -17,59 +14,18 @@ const config = { }; module.exports = { - misrepresentedTokens: true, + deadFrom: '2023-07-21', methodology: "We use the totalSupply() method which includes the interest accrued on the deposited USDC.", }; Object.keys(config).forEach((chain) => { module.exports[chain] = { - tvl: async (_, _b, { [chain]: block }) => { + tvl: async (api) => { const vaults = Object.values(config[chain].vaults); - const tokensAndOwners = [] - const { output: underlyingAssets } = await sdk.api.abi.multiCall({ - abi: abi.UNDERLYING_ASSET_ADDRESS, - calls: vaults.map((i) => ({ target: i })), - chain, - block, - }); - underlyingAssets.forEach(i => tokensAndOwners.push([i.output, i.input.target])) - return sumTokens2({ chain, block, tokensAndOwners }) - }, - borrowed: async (_, _b, { [chain]: block }) => { - const vaults = Object.values(config[chain].vaults); - const [ - { output: decimals }, - { output: tokenBalances }, - { output: underlyingAssets }, - ] = await Promise.all([ - 'erc20:decimals', - abi.totalSupply, - abi.UNDERLYING_ASSET_ADDRESS - ].map(abi => sdk.api.abi.multiCall({ abi, calls: vaults.map((i) => ({ target: i })), chain, block, }))) - - const { output: underlyingDecimals } = await sdk.api.abi.multiCall({ - abi: 'erc20:decimals', - calls: underlyingAssets.map((i) => ({ target: i.output })), - chain, - block, - }); - const { output: underlyingBalances } = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: underlyingAssets.map((i, j) => ({ target: i.output, params: vaults[j] })), - chain, - block, - }); - const transformAddress = await getChainTransform(chain) - const balances = {} - tokenBalances.forEach(({ output: total }, i) => { - const token = transformAddress(underlyingAssets[i].output) - const decimalChange = underlyingDecimals[i].output - decimals[i].output - const amountInPool = underlyingBalances[i].output - const debt = (total * (10 ** decimalChange)) - amountInPool - if (debt > 0) sdk.util.sumSingleBalance(balances, token, Number(debt).toFixed(0)) - }) - return balances; + const tokens = await api.multiCall({ abi: abi.UNDERLYING_ASSET_ADDRESS, calls: vaults}) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults]}) }, + borrowed: () => ({}), }; }); diff --git a/projects/metapool.js b/projects/metapool.js index 92d45bdc3e73..6a4680ac698b 100644 --- a/projects/metapool.js +++ b/projects/metapool.js @@ -1,9 +1,8 @@ -const utils = require('./helper/utils'); +const utils = require('./helper/utils') const ADDRESSES = require('./helper/coreAssets.json') -const sdk = require("@defillama/sdk") async function tvl() { - const totalTvl = await utils.fetchURL('http://validators.narwallets.com:7000/metrics_json') + const totalTvl = await utils.fetchURL('http://validators.narwallets.com:7000/metrics_json') return { near: totalTvl.data.tvl @@ -11,11 +10,12 @@ async function tvl() { } module.exports = { - methodology: 'TVL counts the NEAR tokens that are staked.', - near: { tvl, }, - aurora: { - tvl: async (_, block, chainBlocks) => ({ - ["aurora:" + ADDRESSES.aurora.AURORA]: (await sdk.api.erc20.totalSupply({ target: "0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F", chain:"aurora", block: chainBlocks.aurora})).output - }) + methodology: 'TVL counts the NEAR tokens that are staked.', + near: { tvl, }, + aurora: { + tvl: async (api) => { + const totalSupply = await api.call({ abi: 'erc20:totalSupply', target: '0xb01d35D469703c6dc5B369A1fDfD7D6009cA397F' }) + api.add(ADDRESSES.aurora.AURORA ,totalSupply) } - } \ No newline at end of file + } +} \ No newline at end of file diff --git a/projects/metastreet-airdrop-pass/index.js b/projects/metastreet-airdrop-pass/index.js new file mode 100644 index 000000000000..02e3a35ca40b --- /dev/null +++ b/projects/metastreet-airdrop-pass/index.js @@ -0,0 +1,17 @@ +async function tvl(api) { + const factory = '0xA8a7e295c19b7D9239A992B8D9C053917b8841C6' + const delegateV2 = '0x00000000000000447e69651d841bD8D104Bed493' + const delegations = await api.call({ abi: abi.getIncomingDelegations, target: delegateV2, params: factory }) + delegations.filter(i => i.type_ === '3').forEach(i => api.add(i.contract_, 1)) +} + +module.exports = { + ethereum: { + tvl, + }, + methodology: "TVL is calculated by summing the value of underlying NFTs of the delegation tokens owned by MetaStreet Airdrop Pass Factory." +} + +const abi = { + "getIncomingDelegations": "function getIncomingDelegations(address to) view returns ((uint8 type_, address to, address from, bytes32 rights, address contract_, uint256 tokenId, uint256 amount)[] delegations_)", +} diff --git a/projects/metavault-amm-v2/index.js b/projects/metavault-amm-v2/index.js new file mode 100644 index 000000000000..7245d4eaef40 --- /dev/null +++ b/projects/metavault-amm-v2/index.js @@ -0,0 +1,7 @@ + +const { uniTvlExports } = require("../helper/unknownTokens"); + +module.exports = uniTvlExports({ + scroll: '0xCc570Ec20eCB62cd9589FA33724514BDBc98DC7E', + linea: '0xCc570Ec20eCB62cd9589FA33724514BDBc98DC7E', +}) diff --git a/projects/metavault.trade/index.js b/projects/metavault.trade/index.js index fa7420216d38..9fc38e23755e 100644 --- a/projects/metavault.trade/index.js +++ b/projects/metavault.trade/index.js @@ -1,36 +1,19 @@ -const sdk = require("@defillama/sdk") const abi = require('./abi') const { staking } = require("../helper/staking"); -const { sumTokens } = require('../helper/unwrapLPs') -// Polygon const polygonVault = "0x32848E2d3aeCFA7364595609FB050A301050A6B4"; const polygonStaking = "0xE8e2E78D8cA52f238CAf69f020fA961f8A7632e9"; // Staked MVX, sMVX const polygonMVX = "0x2760e46d9bb43dafcbecaad1f64b93207f9f0ed7"; -const chain= 'polygon' +const polygonMvxVester = "0x543e07eb4a260e10310fbcf2403e97c762a8db0b" // New Vester -const polygonTVL = async (timestamp, _block, { [chain]: block}) => { - const calls = [] - const { output: size } = await sdk.api.abi.call({ - target: polygonVault, - abi: abi.allWhitelistedTokensLength, - chain, block, - }) - for (let i = 0;i < +size; i++) - calls.push({params: i}) - const { output: tokens } = await sdk.api.abi.multiCall({ - target: polygonVault, - abi: abi.allWhitelistedTokens, - calls, - chain, block, - }) - const toa = tokens.map(i => [i.output, polygonVault]) - return sumTokens({}, toa, block, chain) +const polygonTVL = async (api) => { + const tokens = await api.fetchList({ lengthAbi: abi.allWhitelistedTokensLength, itemAbi: abi.allWhitelistedTokens, target: polygonVault}) + return api.sumTokens({ tokens, owner: polygonVault }) }; module.exports = { polygon: { - staking: staking(polygonStaking, polygonMVX), + staking: staking([polygonStaking, polygonMvxVester], polygonMVX, ), tvl: polygonTVL, }, }; \ No newline at end of file diff --git a/projects/metavault/index.js b/projects/metavault/index.js index d4f00986cab3..49b59edd4125 100644 --- a/projects/metavault/index.js +++ b/projects/metavault/index.js @@ -1,16 +1,13 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const readerAbi = require("./reader.json"); const mvlpManagerAbi = require("./mvlpManager.json"); const { staking } = require("../helper/staking"); -const { sumTokens2 } = require('../helper/unwrapLPs'); -const { default: BigNumber } = require("bignumber.js"); +const { sumTokensExport } = require('../helper/unwrapLPs'); const DAI_ADDRESS = ADDRESSES.ethereum.DAI; const USDC_ADDRESS = ADDRESSES.ethereum.USDC; const MVLP_ADDRESS = "0x9F4f8bc00F48663B7C204c96b932C29ccc43A2E8"; -const MVLP_DECIMALS = 18; const REDEEM_CONTRACT = "0xd15C4677A81Ac9d744a01ecaAad684E6d296b8f3"; const GOV_CLUB_CONTRACT = "0x12fc8b560925166c39E85c70E9fD4058Ca9e11c9"; @@ -23,65 +20,41 @@ const READER_CONTRACT = "0x01dd8B434A83cbdDFa24f2ef1fe2D6920ca03734"; // getToke const stakingAddress = "0x42162457006DB4DA3a7af5B53DFee5A891243b4D"; // Governance Staking const stakingTokenAddress = "0x788B6D2B37Aa51D916F2837Ae25b05f0e61339d1"; // MVD -const ADDRESS_ZERO = ADDRESSES.null; -async function getTvl(timestamp, block) { - const toa = [ - [DAI_ADDRESS, REDEEM_CONTRACT,], - [USDC_ADDRESS, GOV_CLUB_CONTRACT,], - ] +const mvdStakingAddressArbitrum = "0xFA69292726A53d62111c9485C03ac551Ba05679b"; // gMVD Staking +const mvdTokenAddressArbitrum = "0x15a808ed3846D25e88AE868DE79F1bcB1Ac382B5"; // MVD - return sumTokens2({ tokensAndOwners: toa, block }) -} +const ADDRESS_ZERO = ADDRESSES.null; -async function polygon(_, _b, { polygon: block }) { - const chain = 'polygon' +async function polygon(api) { // Metavault DAO MVLP Holdings - const aums = ( - await sdk.api.abi.call({ - target: MVLP_MANAGER_CONTRACT, - abi: mvlpManagerAbi.getAums, - chain, block, - }) - ).output; - - const averageAums = (+aums[0] + +aums[1]) / 2 - - const supplies = ( - await sdk.api.abi.call({ - target: READER_CONTRACT, - params: [ADDRESS_ZERO, [MVLP_ADDRESS]], - chain, block, - abi: readerAbi.getTokenBalancesWithSupplies, - }) - ).output; - + const aums = await api.call({ target: MVLP_MANAGER_CONTRACT, abi: mvlpManagerAbi.getAums, }) + const supplies = await api.call({ target: READER_CONTRACT, params: [ADDRESS_ZERO, [MVLP_ADDRESS]], abi: readerAbi.getTokenBalancesWithSupplies, }) + const metavaultDaoMvlpHoldings = await api.call({ abi: 'erc20:balanceOf', target: MVLP_TRACKER_CONTRACT, params: MVD_DAO_MULTI_SIG_WALLET, }) + const mvlpSupply = supplies[1]; - + const averageAums = (+aums[0] + +aums[1]) / 2 const mvlpPrice = averageAums / mvlpSupply - - const metavaultDaoMvlpHoldings = ( - await sdk.api.erc20.balanceOf({ - chain, block, - target: MVLP_TRACKER_CONTRACT, - owner: MVD_DAO_MULTI_SIG_WALLET, - }) - ).output; - - const daoMvlpHoldingsValue = metavaultDaoMvlpHoldings * mvlpPrice; - - const sum = BigNumber(daoMvlpHoldingsValue / 1e24).toFixed(0); - - return { - [USDC_ADDRESS]: sum, - }; + const daoMvlpHoldingsValue = metavaultDaoMvlpHoldings * mvlpPrice / 1e30 + api.addUSDValue(daoMvlpHoldingsValue) } module.exports = { + hallmarks: [ + [1676592000, "Launch on Arbitrum"] + ], misrepresentedTokens: true, + arbitrum: { + staking: staking(mvdStakingAddressArbitrum, mvdTokenAddressArbitrum,), + }, ethereum: { - tvl: getTvl, + tvl: sumTokensExport({ + tokensAndOwners: [ + [DAI_ADDRESS, REDEEM_CONTRACT,], + [USDC_ADDRESS, GOV_CLUB_CONTRACT,], + ] + }), staking: staking(stakingAddress, stakingTokenAddress,), }, polygon: { diff --git a/projects/metf-finance/index.js b/projects/metf-finance/index.js index 5347c8b59ccd..18295b7d6bae 100644 --- a/projects/metf-finance/index.js +++ b/projects/metf-finance/index.js @@ -1,116 +1,10 @@ -const abi = 'function balanceOf(address token) view returns (uint256)' -const pairPrice = 'function getPairPrice(address pair, uint256 amount) view returns (uint256 valueInMMF, uint256 valueInUSD)'; -const valueOfAsset = 'function valueOfAsset(address asset, uint256 amount) view returns (uint256 valueInCRO, uint256 valueInUSD)' -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const { pool2 } = require('../helper/pool2') - -const treasury = "0xE25737b093626233877EC0777755c5c4081580be" -const MMF_METF_BOND = "0x127966303484140EF3692C49CfF154eaAe50cEe3" -const calculator = "0xa2B417088D63400d211A4D5EB3C4C5363f834764" - -const ZERO = new BigNumber(0); -const ETHER = new BigNumber(10).pow(18); - -const tokens = ["0x97749c9B61F878a880DfE312d2594AE07AEd7656", - "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", - "0x50c0C5bda591bc7e89A342A3eD672FB59b3C46a7"] - -const LPs = ["0xbA452A1c0875D33a440259B1ea4DcA8f5d86D9Ae", - "0xB6E1705BfAFcf1efEE83C135C0F0210653bAB8F0", - // "0xd7385f46FFb877d8c8Fe78E5f5a7c6b2F18C05A7", //moved to pool2 -] - - -async function newTVL(timestamp, block, chainBlocks) { - block = chainBlocks.cronos - const balances = {} - const prices = {} - - let data = await sdk.api.abi.multiCall({ - calls: LPs.map((address) => ({ - target: MMF_METF_BOND, - params: [address, ETHER.toString()], - })), - block, - abi: pairPrice, - chain: "cronos", - }); - - data.output.forEach((call) => { - let value = call && call.output && new BigNumber(call.output.valueInUSD); - if (value) { - prices[call.input.params[0]] = value.dividedBy(ETHER); - } - }); - - let data3 = await sdk.api.abi.multiCall({ - calls: tokens.map((address) => ({ - target: calculator, - params: [address, ETHER.toString()], - })), - block, - abi: valueOfAsset, - chain: "cronos", - }); - data3.output.forEach((call) => { - let value = call && call.output && new BigNumber(call.output.valueInUSD); - if (value) { - prices[call.input.params[0]] = value.dividedBy(ETHER); - } - }); - - - let data2 = await sdk.api.abi.multiCall({ - calls: [...tokens, ...LPs].map((address) => ({ - target: treasury, - params: address, - })), - block, - abi: abi, - chain: "cronos", - }) - - data2.output.forEach((call) => { - let value = call && call.output && new BigNumber(call.output); - if (value) { - if (prices[call.input.params[0]]) { - balances[`cronos:${call.input.params[0]}`] = value.dividedBy(ETHER).multipliedBy(prices[call.input.params[0]]) - } else { - balances[`cronos:${call.input.params[0]}`] = value.dividedBy(ETHER) - } - } - }); - - let tvlall = Object.values(balances).reduce((tvl, bn) => { - return tvl.plus(bn) - }, ZERO) - - return { - tether: tvlall.toNumber(), - }; -} - -async function staking(timestamp, block, chainBlocks) { - block = chainBlocks.cronos - const staked = (await sdk.api.abi.call({ - target: "0xb8df27c687c6af9afe845a2afad2d01e199f4878", - params: "0x1A6aD4bac521a98556A4C0Da5946654c5DC7Ce0A", // masterchef - abi: 'erc20:balanceOf', - block: block, - chain: 'cronos' - })).output - const balances = { - ["cronos:0xb8df27c687c6af9afe845a2afad2d01e199f4878"]: staked - } - return balances -} - +const { pool2 } = require('../helper/pool2'); +const { staking } = require("../helper/staking"); module.exports = { cronos: { - tvl: newTVL, - staking: staking, + tvl: () => ({}), // tvl is 0 for ohm forks + staking: staking('0x1A6aD4bac521a98556A4C0Da5946654c5DC7Ce0A', '0xb8df27c687c6af9afe845a2afad2d01e199f4878'), pool2: pool2("0xE25737b093626233877EC0777755c5c4081580be", "0xd7385f46FFb877d8c8Fe78E5f5a7c6b2F18C05A7") } } \ No newline at end of file diff --git a/projects/methlab-xyz/index.js b/projects/methlab-xyz/index.js index 4867d111643b..12dffbc60e61 100644 --- a/projects/methlab-xyz/index.js +++ b/projects/methlab-xyz/index.js @@ -1,48 +1,38 @@ -const { getLogs } = require('../helper/cache/getLogs') +const { getLogs2 } = require('../helper/cache/getLogs') const { mergeExports } = require('../helper/utils') const { uniV3Export } = require('../helper/uniswapV3') + + +const abi = { + evt_Strategy: 'event StrategyStatusChange (address indexed strategy, bool status)', + evt_VaultAdded: 'event VaultAdded (address indexed vault)', + evt_LoanAdded: 'event LoanAdded (address indexed vault, address indexed loan, address loanImplUsed)', + strategy_collToken: 'address:collToken', + strategy_borrowToken: 'address:borrowToken' +} + const config = { - mantle: { - factories: [{ target: '0x6Cc0c2D8F9533dFd2276337DdEaBBCEE9dd0747F', fromBlock: 51253051 },], - } + mantle: { factory: '0xB375DfF90F8dafeA50E2EA7a0666B426Ed786C5D', fromBlock: 69177970 } } Object.keys(config).forEach(chain => { - const { factories } = config[chain] + const { factory, fromBlock } = config[chain]; + module.exports[chain] = { tvl: async (api) => { - const vaults = [] - for (const { target, fromBlock, } of factories) { - const logs = await getLogs({ api, target, fromBlock, onlyArgs: true, eventAbi: 'event VaultAdded (address indexed vault)' }) - vaults.push(...logs.map(log => log.vault)) - } - const counters = await api.multiCall({ abi: abi.collectionCounter, calls: vaults }) - const callOwners = [] - const calls = [] - for (let i = 0; i < vaults.length; i++) { - const counter = counters[i] - for (let j = 0; j < +counter; j++) { - calls.push({ target: vaults[i], params: j }) - callOwners.push(vaults[i]) - } - } - const results = await api.multiCall({ abi: abi.collection, calls }) - const tokenSet = new Set() - results.forEach((result, i) => { - tokenSet.add(result.collToken) - tokenSet.add(result.borrowToken) - // tokensAndOwners.push([result.collToken, callOwners[i]]) - // tokensAndOwners.push([result.borrowToken, callOwners[i]]) - }) - return api.sumTokens({ owners: vaults, tokens: Array.from(tokenSet), blacklistedTokens: ['0x401307732d732dd3b05ac1138b8661c0f55830ea'] }) + const logArgs = { api, target: factory, fromBlock }; + + const strategies = (await getLogs2({ ...logArgs, eventAbi: abi.evt_Strategy, extraKey: 'strategy' })).map(log => log.strategy); + const vaults = (await getLogs2({ ...logArgs, eventAbi: abi.evt_VaultAdded, extraKey: 'vault' })).map(log => log.vault); + const loans = (await getLogs2({ ...logArgs, eventAbi: abi.evt_LoanAdded, extraKey: 'loan' })).map(log => log.loan); + + const collTokens = await api.multiCall({ abi: abi.strategy_collToken, calls: strategies }); + const borrowTokens = await api.multiCall({ abi: abi.strategy_borrowToken, calls: strategies }); + const tokens = collTokens.concat(borrowTokens) + return api.sumTokens({ tokens, owners: loans.concat(vaults), blacklistedTokens: ['0x401307732d732dd3b05ac1138b8661c0f55830ea'] }); } } -}) - -const abi = { - "collection": "function collection(uint256 collectionId) view returns ((address collToken, address borrowToken, uint256 minSingleLoanAmt, uint256 maxSingleLoanAmt, uint256 expiresAt, bool isEnabled, (uint256 strikePrice, uint256 interestRate, uint256 duration)[] intents))", - "collectionCounter": "uint256:collectionCounter", -} +}); module.exports = mergeExports([ module.exports, diff --git a/projects/mexc-cex/index.js b/projects/mexc-cex/index.js index 9c9323c29d6d..88110da6adf3 100644 --- a/projects/mexc-cex/index.js +++ b/projects/mexc-cex/index.js @@ -1,10 +1,9 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bitcoin: { - owners: [ - "13uZyaPbt4rTwYQ8xWFySVUzWH3pk2P5c7" - ], + owners: bitcoinAddressBook.mexcCex, }, ethereum:{ owners: [ @@ -38,6 +37,11 @@ const config = { owners:[ "0xdf90c9b995a3b10a5b8570a47101e6c6a29eb945", ] + }, + starknet: { + owners:[ + "0x069a7818562b608ce8c5d0039e7f6d1c6ee55f36978f633b151858d85c022d2f", + ] } } diff --git a/projects/microcreditproject/index.js b/projects/microcreditproject/index.js new file mode 100644 index 000000000000..6399d79c0afe --- /dev/null +++ b/projects/microcreditproject/index.js @@ -0,0 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +const TOKENS = [ + ADDRESSES.functionx.WFX, + ADDRESSES.islm.USDC, +] + +const INVESTMENT_CONTRACT = '0x951d1571C75C519Cc3D09b6B71595C6aCe1c06dB' +const PROFIT_SHARE_CONTRACT = '0x165D74d2DEFe37794371eB63c63999ab5620DBfB' + +module.exports = { + islm: { + tvl: sumTokensExport({ + owners: [INVESTMENT_CONTRACT, PROFIT_SHARE_CONTRACT], + tokens: TOKENS + }), + }, +} diff --git a/projects/microswap/index.js b/projects/microswap/index.js new file mode 100644 index 000000000000..7ab543aad117 --- /dev/null +++ b/projects/microswap/index.js @@ -0,0 +1,22 @@ +const { yieldHelper } = require("../helper/yieldHelper"); + +const abis = { + name: "string:name", + wantLockedTotal: "uint256:wantLockedTotal", + poolInfo: "function poolInfo(uint256) view returns (address want, uint256 allocPoint, uint256 lastRewardTime, address strategy, uint256 earlyWithdrawFee, uint256 earlyWithdrawTime)", +} + +async function getTokenBalances ({ api, poolInfos, }) { + const strategies = poolInfos.map(i => i.strategy) + return api.multiCall({ abi: abis.wantLockedTotal, calls: strategies }) +} + +module.exports = yieldHelper({ + project: 'microswap', + chain: 'cronos_zkevm', + masterchef: '0x19A497E9c034c0D66952366F46f0e4e8b27465a8', + nativeToken: '', + abis, + getTokens: ({ poolInfos, }) => poolInfos.map(i => i.want), + getTokenBalances, +}) diff --git a/projects/midas-capital/index.js b/projects/midas-capital/index.js index eb015c39e4be..817abd45a01a 100644 --- a/projects/midas-capital/index.js +++ b/projects/midas-capital/index.js @@ -1,10 +1,10 @@ const sdk = require("@defillama/sdk"); -const { compoundExportsWithAsyncTransform } = require("../helper/compound"); +const { compoundExports2 } = require("../helper/compound"); module.exports = { hallmarks: [ - [Math.floor(new Date('2023-06-17')/1e3), 'Protocol was exploited for $600k'], + [Math.floor(new Date('2023-06-17') / 1e3), 'Protocol was exploited for $600k'], ] } @@ -55,39 +55,10 @@ const pools = { function getTvl(chain) { const config = pools[chain] ?? { pools: [] }; - const tvls = config.pools.map((pool) => - compoundExportsWithAsyncTransform(pool, chain, undefined, undefined, { resolveLPs: true }) - ); - let _tvl = sdk.util.sumChainTvls(tvls.map((t) => t.tvl)) - let _borrowed = sdk.util.sumChainTvls(tvls.map((t) => t.borrowed)) - let tvl = _tvl - let borrowed = _borrowed - if (chain === "bsc") { - tvl = resolveHypervisor(_tvl) - borrowed = resolveHypervisor(_borrowed) - } - return { tvl, borrowed }; + const tvls = config.pools.map((comptroller) => compoundExports2({ comptroller })); + let tvl = sdk.util.sumChainTvls(tvls.map((t) => t.tvl)) + let borrowed = sdk.util.sumChainTvls(tvls.map((t) => t.borrowed)) + return { tvl, borrowed } } Object.keys(pools).forEach(chain => module.exports[chain] = getTvl(chain)) - -function resolveHypervisor(tvlFunc) { - return async (...args) => { - const { api } = args[3] - const balances = await tvlFunc(...args) - let bscTokens = Object.keys(balances).filter(t => t.startsWith('bsc:')).map(t => t.slice(4)) - const res = await api.multiCall({ abi: 'function getTotalAmounts() view returns (uint256,uint256)', calls: bscTokens, permitFailure: true }) - const hyperVisorTokens = bscTokens.filter((t, i) => res[i]) - const totalAmounts = res.filter(i => i) - const token0s = await api.multiCall({ abi: 'address:token0', calls: hyperVisorTokens, }) - const token1s = await api.multiCall({ abi: 'address:token1', calls: hyperVisorTokens, }) - const totalSupplies = await api.multiCall({ abi: 'function totalSupply() returns (uint256)', calls: hyperVisorTokens, }) - hyperVisorTokens.forEach((token, i) => { - const bal = balances[`bsc:${token}`] / totalSupplies[i] - delete balances[`bsc:${token}`] - sdk.util.sumSingleBalance(balances, token0s[i], totalAmounts[i][0] * bal, api.chain) - sdk.util.sumSingleBalance(balances, token1s[i], totalAmounts[i][1] * bal, api.chain) - }) - return balances - } -} \ No newline at end of file diff --git a/projects/midas/index.js b/projects/midas/index.js index bf220ae80cc9..2377b64c49ff 100644 --- a/projects/midas/index.js +++ b/projects/midas/index.js @@ -1,18 +1,22 @@ -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 config = { + ethereum: { + mTBILL: '0xDD629E5241CbC5919847783e6C96B2De4754e438', + mBASIS: '0x2a8c22E3b10036f3AEF5875d04f8441d4188b656', + mBTC: '0x007115416AB6c266329a03B09a8aa39aC2eF7d9d' + }, + base: { + mTBILL: '0xDD629E5241CbC5919847783e6C96B2De4754e438', + mBASIS: '0x1C2757c1FeF1038428b5bEF062495ce94BBe92b2', + } } -const chains = ["ethereum"]; +async function tvl(api) { + const tokens = Object.values(config[api.chain]) + const bals = await api.multiCall({ abi: 'uint256:totalSupply', calls: tokens}) + api.add(tokens, bals) +} -chains.forEach((chain) => { - module.exports[chain] = { tvl }; -}); -module.exports.misrepresentedTokens = true \ No newline at end of file +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl } +}) \ No newline at end of file diff --git a/projects/milkomeda-djed/config.json b/projects/milkomeda-djed/config.json deleted file mode 100644 index b7e39bcf8599..000000000000 --- a/projects/milkomeda-djed/config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "djedAddress": { - "milkomeda": "0x67A30B399F5Ed499C1a6Bc0358FA6e42Ea4BCe76", - "milkomeda_a1": "0x..." - }, - "reserveTokenAddress": { - "milkomeda": "0xAE83571000aF4499798d1e3b0fA0070EB3A3E3F9", - "milkomeda_a1": "0x..." - } - } \ No newline at end of file diff --git a/projects/milkomeda-djed/index.js b/projects/milkomeda-djed/index.js index c1ed78e7b80d..499b345b1e31 100644 --- a/projects/milkomeda-djed/index.js +++ b/projects/milkomeda-djed/index.js @@ -1,24 +1,15 @@ -const sdk = require('@defillama/sdk'); -const { transformBalances } = require('../helper/portedTokens'); - +const ADDRESSES = require('../helper/coreAssets.json') const abi = require('./abi.json'); -const config = require("./config.json"); - -async function tvl(chain, chainBlocks) { - const balances = {}; - - const reserve = (await sdk.api.abi.call({ - abi: abi.Djed.reserve, chain: chain, target: config.djedAddress[chain], params: [ 0 ], block: chainBlocks[chain], - })).output; - sdk.util.sumSingleBalance(balances, config.reserveTokenAddress[chain], reserve); // Using WADA address instead of mADA - return transformBalances(chain, balances); +async function tvl(api) { + const reserve = await api.call({ abi: abi.Djed.reserve, target:'0x67A30B399F5Ed499C1a6Bc0358FA6e42Ea4BCe76', params: 0 }) + api.add(ADDRESSES.milkomeda.WADA, reserve); // Using WADA address instead of mADA } module.exports = { methodology: 'The TVL of each Djed deployment on Milkomeda C1.', milkomeda: { start: 10440400, - tvl: (timestamp, block, chainBlocks) => tvl('milkomeda', chainBlocks) + tvl, }, }; diff --git a/projects/milkyway/index.js b/projects/milkyway/index.js index 369279adf464..d1884ee3f22d 100644 --- a/projects/milkyway/index.js +++ b/projects/milkyway/index.js @@ -1,7 +1,10 @@ const { compoundExports } = require("../helper/compound"); module.exports = { + deadFrom: '2023-12-15', timetravel: false, // milkomeda api's for staked coins can't be queried at historical points start: 1599552000, // 09/08/2020 @ 8:00am (UTC) - milkomeda: compoundExports("0x0Dd4E2B7E0E8a2Cd1258a9023D3a5062381554Cf", "milkomeda"), + milkomeda: compoundExports("0x0Dd4E2B7E0E8a2Cd1258a9023D3a5062381554Cf"), }; + +module.exports.milkomeda.borrowed = () => ({}) // bad debt diff --git a/projects/mimas-finance/index.js b/projects/mimas-finance/index.js index f4463ff27d02..839232c6ddeb 100644 --- a/projects/mimas-finance/index.js +++ b/projects/mimas-finance/index.js @@ -1,20 +1,19 @@ +const ADDRESSES = require('../helper/coreAssets.json') const {compoundExports} = require('../helper/compound') const { stakingUnknownPricedLP } = require("../helper/staking"); const token = "0x10C9284E6094b71D3CE4E38B8bFfc668199da677"; const stakingContract = "0x268E2E1e5a465034Ee5742DA578feb41B228ad7B"; -const wCRO = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; +const wCRO = ADDRESSES.cronos.WCRO_1; const mmCRO = "0xff024211741059a2540b01f5Be2e75fC0c1b3d82"; module.exports = { cronos: { ...compoundExports( "0xdD8c94211dD19155EFFbd57EAb6D4e0DE31A3b9E", - "cronos", mmCRO, wCRO, - addr => `cronos:${addr}`, ), staking: stakingUnknownPricedLP(stakingContract, token, "cronos", "0xf56FDfeeF0Ba3de23DaB13a85602bd7BF135E80f", addr=>`cronos:${addr}`) } diff --git a/projects/mimo/index.js b/projects/mimo/index.js index 20213b249ad1..a39a0a93873d 100755 --- a/projects/mimo/index.js +++ b/projects/mimo/index.js @@ -1,39 +1,36 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require('../helper/unwrapLPs'); const config = { - ethereum: { - vaultCore: ['0x4026BdCD023331D52533e3374983ded99CcBB6d4'], - collaterals: [ - ADDRESSES.ethereum.WETH, //wETH - ADDRESSES.ethereum.WBTC, //wBTC - ADDRESSES.ethereum.USDC, //USDC + ethereum: + { + vaultCore: [ + '0x68E88c802F146eAD2f99F3A91Fb880D1A2509672', //PAR + '0x917b9D8E62739986EC182E0f988C7F938651aFD7', //paUSD ], }, polygon: { - vaultCore: ['0x03175c19cb1d30fa6060331a9ec181e04cac6ab0'], - collaterals: [ - ADDRESSES.polygon.WMATIC_2, //wMATIC - ADDRESSES.polygon.WETH_1, //wETH - ADDRESSES.polygon.WBTC, //wBTC - ADDRESSES.polygon.USDC, //USDC + vaultCore: [ + '0x78C48A7d7Fc69735fDab448fe6068bbA44a920E6', //PAR + '0xc0459Eff90be3dCd1aDA71E1E8BDB7619a16c1A4', //paUSD ], }, fantom: { vaultCore: ['0xB2b4feB22731Ae013344eF63B61f4A0e09fa370e'], - collaterals:[ - ADDRESSES.fantom.WFTM, //wFTM - '0x74b23882a30290451A17c44f4F05243b6b58C76d', //ETH - '0x321162Cd933E2Be498Cd2267a90534A804051b11', //BTC - ADDRESSES.fantom.USDC, //USDC - ], } } -module.exports = {}; Object.keys(config).forEach(chain => { - const { vaultCore: owners, collaterals: tokens } = config[chain] - module.exports[chain] = { - tvl: sumTokensExport({ chain, owners, tokens, }) + const { vaultCore } = config[chain] + module.exports[chain] = { tvl } + + async function tvl(api) { + const ownerTokens = [] + for (const vault of vaultCore) { + const addressProvider = await api.call({ abi: 'address:a', target: vault}) + const config = await api.call({ abi: 'address:config', target: addressProvider}) + const tokenConfig = await api.fetchList({ lengthAbi: 'numCollateralConfigs', itemAbi: "function collateralConfigs(uint256 _id) view returns ((address collateralType, uint256 debtLimit, uint256 liquidationRatio, uint256 minCollateralRatio, uint256 borrowRate, uint256 originationFee, uint256 liquidationBonus, uint256 liquidationFee))", target: config}) + const tokens = tokenConfig.map(t => t.collateralType) + ownerTokens.push([tokens, vault]) + } + return api.sumTokens({ ownerTokens }) } }) \ No newline at end of file diff --git a/projects/mimoswap-v3/index.js b/projects/mimoswap-v3/index.js new file mode 100644 index 000000000000..59d78a216c66 --- /dev/null +++ b/projects/mimoswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + iotex: { factory: "0xF36788bF206f75F29f99Aa9d418fD8164b3B8198", fromBlock: 27707694, blacklistedTokens: ['0x95cb18889b968ababb9104f30af5b310bd007fd8'] } +}) \ No newline at end of file diff --git a/projects/mimswap/index.js b/projects/mimswap/index.js index 2a11adf308f2..3aaae42c05dc 100644 --- a/projects/mimswap/index.js +++ b/projects/mimswap/index.js @@ -2,6 +2,7 @@ const { getLogs2 } = require('../helper/cache/getLogs') const config = { arbitrum: { factory: '0x8D0Cd3eEf1794F59F2B3a664Ef07fCAD401FEc73', fromBlock: 205217727 }, + ethereum: { factory: '0xDF46F6b1a5F794F21eaD4008C7De4E02Dc045297', fromBlock: 20537337 }, blast: { factory: '0x7E05363E225c1c8096b1cd233B59457104B84908', fromBlock: 1067907 }, kava: { factory: '0x7Ad0e580d8458BbeF71EC6A1755c59651E1EAaa7', fromBlock: 10023543 }, } diff --git a/projects/mind-restake/index.js b/projects/mind-restake/index.js index ede72d4bf6ca..f9890c22c08b 100644 --- a/projects/mind-restake/index.js +++ b/projects/mind-restake/index.js @@ -1,6 +1,7 @@ const config = { ethereum: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196", - scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d" + scroll: "0xea3E87699D11B77Fba754Bf0257a25664B97437d", + bsc: "0x6a5D488EC17d6a7a1872AaB88feC90c1B2Df4196", }; module.exports = { diff --git a/projects/mindgames/index.js b/projects/mindgames/index.js index baa654776e6e..875588edae3f 100644 --- a/projects/mindgames/index.js +++ b/projects/mindgames/index.js @@ -4,7 +4,7 @@ const xCRX = "0x35AfE95662fdf442762a11E4eD5172C81fBceF7e"; const CRX = "0xb21Be1Caf592A5DC1e75e418704d1B6d50B0d083"; const factory = "0x7C7F1c8E2b38d4C06218565BC4C9D8231b0628c0"; -const tvl = getUniTVL({ factory, useDefaultCoreAssets: true, fetchBalances: true }) +const tvl = getUniTVL({ factory, useDefaultCoreAssets: true, }) module.exports = { misrepresentedTokens: true, diff --git a/projects/miningtycoon/index.js b/projects/miningtycoon/index.js index a4fa74814672..58c93d98551f 100644 --- a/projects/miningtycoon/index.js +++ b/projects/miningtycoon/index.js @@ -1,70 +1,20 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json'); +const { staking } = require('../helper/staking'); -const tokenFarm = '0xBdfbeecF52bCfF5aa8cc1B8A4B737B2Af3D1BA2F'; const tokenFarm2 = '0x8A6AE8076A1866877e006cC9b4bd0378646A9bD5'; - const NTToken = '0x8b70512b5248e7c1f0f6996e2fde2e952708c4c9'; -const USDTToken = ADDRESSES.heco.USDT; - -const bsc_tokenFarm = '0xA05Cbf21620553Ade9a3368f1b20D81eEe74a1FC'; const bsc_tokenFarm2 = '0x973fEAf394F5E882B0F8a9B5CDC0b3E28AA08926'; - const bsc_NTToken = '0xfbcf80ed90856AF0d6d9655F746331763EfDb22c'; -const bsc_USDTToken = ADDRESSES.bsc.USDT; - -async function tvl(timestamp, ethBlock, chainBlocks) { - let balances = {}; - - const USDTBalance = (await sdk.api.abi.call({ - chain: "heco", - target: USDTToken, - params: [tokenFarm2], - abi: 'erc20:balanceOf', - })).output; - - const bsc_USDTBalance = (await sdk.api.abi.call({ - chain: "bsc", - target: bsc_USDTToken, - params: [bsc_tokenFarm2], - abi: 'erc20:balanceOf', - })).output; - - balances = {}; - balances['heco:'+USDTToken] = USDTBalance; - balances['bsc:'+bsc_USDTToken] = bsc_USDTBalance; - - return balances; -} - -async function staking(timestamp, ethBlock, chainBlocks) { - const NTBalance = (await sdk.api.abi.call({ - chain: "heco", - target: NTToken, - params: [tokenFarm2], - block: chainBlocks.heco, - abi: 'erc20:balanceOf', - })).output; - - const bsc_NTBalance = (await sdk.api.abi.call({ - chain: "bsc", - target: bsc_NTToken, - params: [bsc_tokenFarm2], - block: chainBlocks.bsc, - abi: 'erc20:balanceOf', - })).output; - - return { - ['heco:'+NTToken]: NTBalance, - ['bsc:'+bsc_NTToken]: bsc_NTBalance, - } -} module.exports = { methodology: 'TVL counts USDT staked to earn NT tokens and the staking portion of TVL counts the NT tokens that are staked to earn more NT tokens', bsc:{ - tvl, - staking + tvl: staking(bsc_tokenFarm2, ADDRESSES.bsc.USDT), + staking: staking(bsc_tokenFarm2, bsc_NTToken) + }, + heco:{ + tvl: staking(tokenFarm2, ADDRESSES.heco.USDT), + staking: staking(tokenFarm2, NTToken) }, } \ No newline at end of file diff --git a/projects/minotaur-money/index.js b/projects/minotaur-money/index.js index ea0fd70eafdc..70644bf6aadf 100644 --- a/projects/minotaur-money/index.js +++ b/projects/minotaur-money/index.js @@ -10,7 +10,7 @@ const tokens = [ ["0xf5a5f547612e95c688971fb68334a80ceb3c542b", true], // MINO-DAI ["0x1c139f4b953ce0c0f6aa1cd1755727ad5aba5080", true], // MINO-WCRO [ADDRESSES.cronos.WBTC, false], // WBTC - ["0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", false], // WCRO + [ADDRESSES.cronos.WCRO_1, false], // WCRO ["0xe44fd7fcb2b1581822d0c862b68222998a0c299a", false] // WETH ]; diff --git a/projects/mint-chain/index.js b/projects/mint-chain/index.js new file mode 100644 index 000000000000..6bbbe77044d9 --- /dev/null +++ b/projects/mint-chain/index.js @@ -0,0 +1,16 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + '0x2b3F201543adF73160bA42E1a5b7750024F30420', + '0x59625d1FE0Eeb8114a4d13c863978F39b3471781' + ], + fetchCoValentTokens: true, + permitFailure: true + }), + }, +}; diff --git a/projects/mint-club-v2/index.js b/projects/mint-club-v2/index.js index e9344c7e30fd..6a245f13c10f 100644 --- a/projects/mint-club-v2/index.js +++ b/projects/mint-club-v2/index.js @@ -10,14 +10,15 @@ const V2_BOND_CONTRACTS = { blast: "0x621c335b4BD8f2165E120DC70d3AfcAfc6628681", degen: "0x3bc6B601196752497a68B2625DB4f2205C3b150b", zora: "0xc5a076cad94176c2996B32d8466Be1cE757FAa27", - klaytn: "0xc5a076cad94176c2996B32d8466Be1cE757FAa27" + klaytn: "0xc5a076cad94176c2996B32d8466Be1cE757FAa27", + ham: "0xc5a076cad94176c2996B32d8466Be1cE757FAa27" } const ownTokens = { bsc: ['0x1f3Af095CDa17d63cad238358837321e95FC5915'] } -const chains = ['avax', 'ethereum', 'optimism', 'arbitrum', 'polygon', 'bsc', 'base', 'blast', 'degen', 'zora', 'klaytn'] +const chains = ['avax', 'ethereum', 'optimism', 'arbitrum', 'polygon', 'bsc', 'base', 'blast', 'degen', 'zora', 'klaytn', 'ham'] chains.forEach(chain => { const BOND_CONTRACT = V2_BOND_CONTRACTS[chain] ?? '0xc5a076cad94176c2996B32d8466Be1cE757FAa27' diff --git a/projects/mira-ly/index.js b/projects/mira-ly/index.js new file mode 100644 index 000000000000..83252fe01dd2 --- /dev/null +++ b/projects/mira-ly/index.js @@ -0,0 +1,20 @@ +const { sumTokens } = require("../helper/chain/fuel") +// const { configPost } = require('../helper/cache') + +async function tvl(api) { + const contractId = '0x2e40f2b244b98ed6b8204b3de0156c6961f98525c8162f80162fcf53eebd90e7' + // const { pools } = await configPost('mira-ly', 'https://prod.api.mira.ly/pools', { "volume_hours": 24, "apr_days": 1 }) + // const tokens = pools.map(i => i.id.split('_').slice(0, 2)).flat() + // const provider = await fuels.Provider.create('https://mainnet.fuel.network/v1/graphql') + // const contract = new fuels.Contract(contractId, abi, provider) + // const { value } = await contract.functions.total_assets().get() + // console.log(contract.functions, +value) + return sumTokens({ api, owner: contractId, }) +} + +module.exports = { + fuel: { tvl }, + timetravel: false, +} + +// https://github.com/mira-amm/mira-v1-ts/blob/main/sway_abis/contracts/mira_amm_contract/release/mira_amm_contract-abi.json diff --git a/projects/mitosis/index.js b/projects/mitosis/index.js index e0b048e7703a..885708245cbe 100644 --- a/projects/mitosis/index.js +++ b/projects/mitosis/index.js @@ -1,6 +1,66 @@ const ADDRESSES = require('../helper/coreAssets.json'); const { sumTokens2 } = require('../helper/unwrapLPs'); -const sdk = require('@defillama/sdk'); + +const UNIETH_ADDRESS = { + ethereum: { + asset: "0xf1376bcef0f78459c0ed0ba5ddce976f1ddf51f4", + vault: "0x02Ff1F648Ff443B5d88214341F0acE6ECFb94cF3", + }, + arbitrum: { + asset: "0x3d15fd46ce9e551498328b1c83071d9509e2c3a0", + vault: "0x7E8cffBe165c6905a8AceC0f37B341c00353e8BA", + }, + scroll: { + asset: "0x15eefe5b297136b8712291b632404b66a8ef4d25", + vault: "0xA0EeB418213f8472cba2c842378E1bB64e28bd28", + }, + linea: { + asset: "0x15eefe5b297136b8712291b632404b66a8ef4d25", + vault: "0x56ceD49205e5D9b4d8D9B29f4aBfbe7bb8b08768", + }, +}; + +const uniBTC_ADDRESS = { + ethereum: { + asset: "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568", + vault: "0xA1eBd23c4364e7491633237A0d9359D82c629182", + }, + arbitrum: { + asset: "0x6B2a01A5f79dEb4c2f3c0eDa7b01DF456FbD726a", + vault: "0x73981B0496fC08e9136BAF74b79d32A4d4F2a007", + }, + optimism: { + asset: "0x93919784C523f39CACaa98Ee0a9d96c3F32b593e", + vault: "0x5616Fe2762687Cd8a9158c27F62aff84E36821Be", + }, + bsc: { + asset: "0x6B2a01A5f79dEb4c2f3c0eDa7b01DF456FbD726a", + vault: "0xaDd58517c5D45c8ed361986f193785F8Ed1ABFc2", + }, +}; + +const ezETH_ADDRESS = { + ethereum: { + asset: "0xbf5495Efe5DB9ce00f80364C8B423567e58d2110", + vault: "0x0109e9f292516dAB3E15EfC61811C5e5a7FA5358", + }, + arbitrum: { + asset: "0x2416092f143378750bb29b79eD961ab195CcEea5", + vault: "0xbEd575b0FeDa4F84b71144634693DaCc07749471", + }, + blast: { + asset: "0x2416092f143378750bb29b79eD961ab195CcEea5", + vault: "0x8506fD66FCeD711c11F9E837EcAEC0F87C3F60A0", + }, + linea: { + asset: "0x2416092f143378750bb29b79eD961ab195CcEea5", + vault: "0x96d6cE4e83dB947fF6bD1Ab0B377F23cd5D9ec2D", + }, + mode: { + asset: "0x2416092f143378750bb29b79eD961ab195CcEea5", + vault: "0xbEd575b0FeDa4F84b71144634693DaCc07749471" + } +}; const WEETH_ADDRESS = { ethereum: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", @@ -14,14 +74,18 @@ const WEETH_ADDRESS = { }; const VAULT_weETHs = { - ethereum: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", + ethereum: "0x917cee801a67f933f2e6b33fc0cd1ed2d5909d88", }; const CAP_ADDRESS = { - scroll: "0x4a6219E25a41FD4165fbd158D89723a7175EA382", ethereum: "0x451d791b6e9a9b8c9237bb55e58a7757342b16f9", + arbitrum: "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2", + optimism: "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2", + mode: "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2", + manta: "0xb883ee478d3b7fea8a5357a3c3e27e2d2292b1d2", blast: "0x096430ef0a653c067df32e93ff77090e084169de", linea: "0xcd32876b9b483eb75e8ca74935e4b51725f33a91", + scroll: "0xcd32876b9B483eb75e8ca74935E4b51725F33A91", }; const vaults = { @@ -29,60 +93,111 @@ const vaults = { 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; -}; - -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); -}; - +/** + * @param { + * ( + * { + * type: 'cap'; + * data: { + * asset: string; + * cap: string; + * } + * } | { + * type: 'vault'; + * data: { + * asset: string; + * cap: string; + * } + * } + * )[]} inputs + */ +const chainTVL = (inputs) => async (api) => { + for (const { type, data } of inputs) { + if (type === 'cap') { + const tvl = await api.call({ abi: "uint256:load", target: data.cap }); + api.add(data.asset, tvl); + } else if (type === 'vault') { + await sumTokens2({ api, owner: data.vault, tokens: [data.asset] }); + } + } +} module.exports = { + doublecounted: true, ethereum: { - tvl: sdk.util.sumChainTvls([ethCapTVL, ethVaultTVL]) + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.ethereum, cap: CAP_ADDRESS.ethereum }}, + { type: 'vault', data: { asset: VAULT_weETHs.ethereum, vault: vaults.ethereum }}, + { type: 'vault', data: UNIETH_ADDRESS.ethereum }, + { type: 'vault', data: uniBTC_ADDRESS.ethereum }, + { type: 'vault', data: ezETH_ADDRESS.ethereum }, + ], + ), }, scroll: { - tvl: scrollVaultTVL, + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.scroll, cap: CAP_ADDRESS.scroll }}, + { type: 'vault', data: UNIETH_ADDRESS.scroll }, + ] + ), }, arbitrum: { - tvl: capTVL("arbitrum"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.arbitrum, cap: CAP_ADDRESS.arbitrum }}, + { type: 'vault', data: UNIETH_ADDRESS.arbitrum }, + { type: 'vault', data: uniBTC_ADDRESS.arbitrum }, + { type: 'vault', data: ezETH_ADDRESS.arbitrum }, + ] + ), }, optimism: { - tvl: capTVL("optimism"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.optimism, cap: CAP_ADDRESS.optimism }}, + { type: 'vault', data: uniBTC_ADDRESS.optimism }, + ], + ), }, mode: { - tvl: capTVL("mode"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.mode, cap: CAP_ADDRESS.mode }}, + { type: 'vault', data: ezETH_ADDRESS.mode }, + ], + ), }, manta: { - tvl: capTVL("manta"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.manta, cap: CAP_ADDRESS.manta }}, + ], + ), }, blast: { - tvl: capTVL("blast"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.blast, cap: CAP_ADDRESS.blast }}, + { type: 'vault', data: ezETH_ADDRESS.blast }, + ], + ), }, linea: { - tvl: capTVL("linea"), + tvl: chainTVL( + [ + { type: 'cap', data: { asset: WEETH_ADDRESS.linea, cap: CAP_ADDRESS.linea }}, + { type: 'vault', data: UNIETH_ADDRESS.linea }, + { type: 'vault', data: ezETH_ADDRESS.linea }, + ], + ), }, + bsc: { + tvl: chainTVL( + [ + { type: 'vault', data: uniBTC_ADDRESS.bsc }, + ] + ) + } }; - - - - diff --git a/projects/mm-stableswap/index.js b/projects/mm-stableswap/index.js index 6a9e1175c4a5..4c1466a82ce4 100644 --- a/projects/mm-stableswap/index.js +++ b/projects/mm-stableswap/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const MM3BasePool = "0x61bB2F4a4763114268a47fB990e633Cb40f045F8"; @@ -8,29 +8,10 @@ const USDT = ADDRESSES.cronos.USDT; const USDC = ADDRESSES.cronos.USDC; -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [USDT, false], - [USDC, false], - [DAI, false], - ], - [MM3BasePool], - chainBlocks["cronos"], - 'cronos', - addr=>`cronos:${addr}`, - ); - - return balances; -} - module.exports = { - doublecounted: true, - cronos:{ - tvl, - }, - methodology: "Counts DAI, USDC, & USDT tokens on the 3MM Base Pool for tvl", + doublecounted: true, + cronos: { + tvl: sumTokensExport({ tokens: [DAI, USDC, USDT], owner: MM3BasePool }), + }, + methodology: "Counts DAI, USDC, & USDT tokens on the 3MM Base Pool for tvl", }; diff --git a/projects/mobydex/index.js b/projects/mobydex/index.js index 5aac8a274a14..adc3beace9c9 100644 --- a/projects/mobydex/index.js +++ b/projects/mobydex/index.js @@ -5,7 +5,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x9864C78acCe7837Ad1DA8f9BbECcf2dbE562e698", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/modemax-dex/index.js b/projects/modemax-dex/index.js new file mode 100644 index 000000000000..1fa244d491e0 --- /dev/null +++ b/projects/modemax-dex/index.js @@ -0,0 +1,5 @@ +const {uniTvlExports} = require('../helper/unknownTokens.js') + +module.exports = uniTvlExports({ + mode: '0x423A079C43e4eD7ca561Ef04765eDB796F0Ec6c6' +}) \ No newline at end of file diff --git a/projects/modemax-perp-v2/index.js b/projects/modemax-perp-v2/index.js new file mode 100644 index 000000000000..90d38037169e --- /dev/null +++ b/projects/modemax-perp-v2/index.js @@ -0,0 +1,7 @@ +const { gmxExports } = require('../helper/gmx') + +module.exports = { + mode: { + tvl: gmxExports({ vault: '0xc3d266Af004B2556f2f900e88e9C73Ac42978AE6' }) + }, +}; diff --git a/projects/modemax-perp/index.js b/projects/modemax-perp/index.js new file mode 100644 index 000000000000..4c85a95ab3f4 --- /dev/null +++ b/projects/modemax-perp/index.js @@ -0,0 +1,7 @@ +const { gmxExportsV2 } = require('../helper/gmx.js') + +module.exports = { + mode: { + tvl: gmxExportsV2({ eventEmitter: '0xd63352120c45378682d705f42a9F085E79E3c888', fromBlock: 25655, }) + } +} diff --git a/projects/mole/index.js b/projects/mole/index.js index 2e7e443aa5c9..3fe52bf72bca 100644 --- a/projects/mole/index.js +++ b/projects/mole/index.js @@ -15,8 +15,10 @@ async function aptosTvl() { return {...lyfTvl}; } -async function suiTvl(api) { - return calLyfTvlSui(api) +async function suiTvl() { + const { api } = arguments[3] + + const lyfTvl = await calLyfTvlSui(api) } // run command: node test.js projects/mole/index.js diff --git a/projects/mole/lyf.js b/projects/mole/lyf.js index 966b803e48fa..d07d8610db47 100644 --- a/projects/mole/lyf.js +++ b/projects/mole/lyf.js @@ -4,10 +4,9 @@ const BigNumber = require("bignumber.js"); const { coreTokens } = require("../helper/chain/aptos"); const { getResources } = require("../helper/chain/aptos"); const { getConfig } = require('../helper/cache') -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); +const { unwrapUniswapLPs, addUniV3LikePosition } = require("../helper/unwrapLPs"); const sui = require('../helper/chain/sui') const { transformBalances } = require("../helper/portedTokens"); -const { i32BitsToNumber } = require("./utils") async function getProcolAddresses(chain) { // if (chain === 'avax') { @@ -17,16 +16,17 @@ async function getProcolAddresses(chain) { // ) // ); // } - - if (chain === 'aptos') { + + if(chain === 'aptos') { return ( - await getConfig('mole/' + chain, + await getConfig('mole/'+chain, "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.aptos_mainnet.json" ) ); - } else if (chain === 'sui') { + }else if(chain === 'sui') { return ( - await getConfig('mole/' + chain, + // modify the hosts for raw.githubusercontent.com ip if it cannot be retrieved. + await getConfig('mole/'+chain, "https://raw.githubusercontent.com/Mole-Fi/mole-protocol/main/.sui_mainnet.json" ) ); @@ -37,7 +37,7 @@ async function getProcolAddresses(chain) { async function calLyfTvl(chain, block) { /// @dev Initialized variables const balances = {}; - const transform = addr => 'avax:' + addr + const transform = addr => 'avax:'+addr /// @dev Getting all addresses from Github const addresses = await getProcolAddresses(chain); @@ -125,18 +125,18 @@ async function calLyfTvlAptos() { /// @dev unwrap LP to get underlaying token balances for workers that are working with LPs await unwrapPancakeSwapLps({ - balances, - lps, - account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', - poolStr: 'swap::TokenPairReserve', - token0Reserve: i => i.data.reserve_x, - token1Reserve: i => i.data.reserve_y + balances, + lps, + account: '0xc7efb4076dbe143cbcd98cfaaa929ecfc8f299203dfff63b95ccb6bfe19850fa', + poolStr: 'swap::TokenPairReserve', + token0Reserve: i => i.data.reserve_x, + token1Reserve: i => i.data.reserve_y }) /// @dev getting all unused liquidity on each vault resources.filter(i => i.type.includes("vault::VaultInfo")) .map(i => { - const token = i.type.split('<')[1].replace('>', ''); + const token = i.type.split('<')[1].replace('>',''); sdk.util.sumSingleBalance(balances, token, new BigNumber(i.data.coin.value).minus(i.data.reserve_pool).toFixed(0)) }) @@ -149,7 +149,7 @@ function sumPancakeWorkerStakingLps(resources, lps, workers) { i.type.includes("pancake_worker::WorkerInfo") || i.type.includes("delta_neutral_pancake_asset_worker::WorkerInfo") || i.type.includes("delta_neutral_pancake_stable_worker::WorkerInfo") - ) && workers[i.type.split('::', 1)[0]] + ) && workers[i.type.split('::',1)[0]] ) workerInfos.forEach(i => { @@ -158,7 +158,7 @@ function sumPancakeWorkerStakingLps(resources, lps, workers) { const lp = lpWithSuffix.substr(0, lpWithSuffix.length - 1); const amount = new BigNumber(i.data.total_balance ?? i.data.total_lp_balance) - if (lps[lp] === undefined) { + if(lps[lp] === undefined) { lps[lp] = { amount: amount } } else { lps[lp].amount = lps[lp].amount.plus(amount); @@ -174,13 +174,13 @@ async function unwrapPancakeSwapLps({ token0Reserve = i => i.data.coin_x_reserve.value, token1Reserve = i => i.data.coin_y_reserve.value, getTokens = i => i.type.split('<')[1].replace('>', '').split(', ') -}) { +}){ const coinInfos = {} const lpReserves = {} for (const lpType in lps) { - if (lps.hasOwnProperty(lpType)) { + if(lps.hasOwnProperty(lpType)){ coinInfos[`0x1::coin::CoinInfo<${lpType}>`] = lpType; - const tokens = getTokens({ type: lpType }) + const tokens = getTokens({type: lpType}) lpReserves[`${account}::${poolStr}<${tokens[0]}, ${tokens[1]}>`] = lpType; } } @@ -188,7 +188,7 @@ async function unwrapPancakeSwapLps({ let pools = await getResources(account); let lpInfos = pools; pools = pools.filter((i) => { - if (!i.type.includes(poolStr)) { + if(!i.type.includes(poolStr)){ return false } @@ -197,7 +197,7 @@ async function unwrapPancakeSwapLps({ }); lpInfos.forEach(i => { const lpType = coinInfos[i.type]; - if (lpType) { + if(lpType){ lps[lpType].totalSupply = new BigNumber(i.data.supply.vec[0].integer.vec[0].value) } }); @@ -238,71 +238,47 @@ async function calLyfTvlSui(api) { const workerInfos = await sui.getObjects(workerInfoIds) let poolIds = [] - workerInfos.forEach(workerInfo => { - let poolId = workerInfo.fields.position_nft.fields.pool - // poolId = poolId.replace('0x0', '0x') - if (!poolIds.includes(poolId)) { - poolIds.push(poolId) + workerInfos.forEach(workerInfo => + { + let poolId = workerInfo.fields.position_nft.fields.pool + // poolId = poolId.replace('0x0', '0x') + if (!poolIds.includes(poolId)) { + poolIds.push(poolId) + } } - } ) - const poolInfos = await sui.getObjects(poolIds) + const poolInfos = await sui.getObjects(poolIds) let poolMap = new Map() - poolInfos.forEach(poolInfo => { - // const poolId = poolInfo.fields.id.id.replace('0x0', '0x') - poolMap.set(poolInfo.fields.id.id, poolInfo) - } + poolInfos.forEach(poolInfo => + { + // const poolId = poolInfo.fields.id.id.replace('0x0', '0x') + poolMap.set(poolInfo.fields.id.id, poolInfo) + } ) - workerInfos.forEach(workerInfo => { - let poolId = workerInfo.fields.position_nft.fields.pool - - let coinAamount = 0 - let coinBamount = 0 - computeCLMMPositionBalances() - - const [coinA, coinB] = poolMap.get(poolId).type.replace('>', '').split('<')[1].split(', ') - api.add(coinA, coinAamount) - api.add(coinB, coinBamount) - - // code copied from uni v3 NFT resolver - function computeCLMMPositionBalances() { - const tickToPrice = (tick) => 1.0001 ** tick - - const liquidity = workerInfo.fields.position_nft.fields.liquidity - const tickLowerIndex = i32BitsToNumber(workerInfo.fields.position_nft.fields.tick_lower_index.fields.bits) - const tickUpperIndex = i32BitsToNumber(workerInfo.fields.position_nft.fields.tick_upper_index.fields.bits) - const bottomTick = tickLowerIndex - const topTick = tickUpperIndex - const tick = i32BitsToNumber(poolMap.get(poolId).fields.current_tick_index.fields.bits) - const sa = tickToPrice(bottomTick / 2) - const sb = tickToPrice(topTick / 2) - - if (tick < bottomTick) { - coinAamount = liquidity * (sb - sa) / (sa * sb) - } else if (tick < topTick) { - const price = tickToPrice(tick) - const sp = price ** 0.5 - - coinAamount = liquidity * (sb - sp) / (sp * sb) - coinBamount = liquidity * (sp - sa) - } else { - coinBamount = liquidity * (sb - sa) - } - } + for (const workerInfo of workerInfos) { + const liquidity = workerInfo.fields.position_nft.fields.liquidity + const tickLower = workerInfo.fields.position_nft.fields.tick_lower_index.fields.bits + const tickUpper = workerInfo.fields.position_nft.fields.tick_upper_index.fields.bits + const poolId = workerInfo.fields.position_nft.fields.pool + const currentSqrtPrice = poolMap.get(poolId).fields.current_sqrt_price + const tick = Math.floor(Math.log(currentSqrtPrice ** 2) / Math.log(1.0001)); + const [token0, token1] = poolMap.get(poolId).type.replace('>', '').split('<')[1].split(', ') + addUniV3LikePosition({ api, token0, token1, liquidity, tickLower, tickUpper, tick }) } - ) // calculate the Vault TVL. const vaultInfoIds = addresses.Vaults.map(valut => valut.vaultInfo) const vaultInfos = await sui.getObjects(vaultInfoIds) - + for (let i = 0; i < vaultInfos.length; i++) { const baseToken = addresses.Vaults[i].baseToken const tokenAmount = vaultInfos[i].fields.value.fields.coin - api.add(baseToken, tokenAmount) + const vaultDebtVal = vaultInfos[i].fields.value.fields.vault_debt_val + const vaultAmount = parseInt(tokenAmount) + parseInt(vaultDebtVal) + api.add(baseToken, vaultAmount.toString()) } } @@ -312,3 +288,4 @@ module.exports = { calLyfTvlAptos, calLyfTvlSui, } + \ No newline at end of file diff --git a/projects/mole/utils.js b/projects/mole/utils.js deleted file mode 100644 index fc5220af102e..000000000000 --- a/projects/mole/utils.js +++ /dev/null @@ -1,12 +0,0 @@ - -function asIntN(int, bits = 32) { - return Number(BigInt.asIntN(bits, BigInt(int))); -} - -function i32BitsToNumber(v) { - return asIntN(BigInt(v), 32); -} - -module.exports = { - i32BitsToNumber, -} diff --git a/projects/moneta/index.js b/projects/moneta/index.js new file mode 100644 index 000000000000..5b8585093376 --- /dev/null +++ b/projects/moneta/index.js @@ -0,0 +1,21 @@ +const { addressesUtxosAssetAll, getScriptsDatum } = require('../helper/chain/cardano/blockfrost') + +const usdm_count_nft_asset = "e319d8e6629ff7991c8ae4f8aec2e0f10463ebdf29b57d26d34914f65553444d5f434f554e54" +const count_address = "addr1wyl82v9qy06hsz50hqqdy0u6xw9hdewy7twjahgek2tpp7c0qajez" + +async function tvl(api) { + const utxo = (await addressesUtxosAssetAll(count_address, usdm_count_nft_asset))[0] + const datum_hash = utxo.data_hash + const datum = await getScriptsDatum(datum_hash) + const total_value_locked = datum.json_value.fields[0].int / 1_000_000 + api.addUSDValue(total_value_locked) +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "Gets the total circulating supply of USDM from the datum of the USDM counter UTxO.", + cardano: { + tvl + } +} \ No newline at end of file diff --git a/projects/monox/index.js b/projects/monox/index.js index c67ebfd3fbd2..3252b85a7773 100644 --- a/projects/monox/index.js +++ b/projects/monox/index.js @@ -1,41 +1,31 @@ const ADDRESSES = require('../helper/coreAssets.json') -const {sumTokensSharedOwners} = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unwrapLPs') -async function eth(timestamp, ethBlock, chainBlocks){ - const block = chainBlocks.ethereum - const balances = {} - await sumTokensSharedOwners(balances, [ +module.exports = { + hallmarks: [ + [1669766400, "swap contract exploit"] + ], + ethereum: { + tvl: sumTokensExport({ + owner: '0x59653E37F8c491C3Be36e5DD4D503Ca32B5ab2f4', tokens: [ "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3", "0x92e187a03b6cd19cb6af293ba17f2745fd2357d5", ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.USDC - ], ["0x59653E37F8c491C3Be36e5DD4D503Ca32B5ab2f4"], ethBlock) - return balances -} - -async function polygon(timestamp, ethBlock, chainBlocks){ - const block = chainBlocks.polygon - const balances = {} - await sumTokensSharedOwners(balances, [ + ] + }) + }, + polygon: { + tvl: sumTokensExport({ + owner: '0x3826367A5563eCE9C164eFf9701146d96cC70AD9', tokens: [ ADDRESSES.polygon.WBTC, ADDRESSES.polygon.USDT, ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH_1, ADDRESSES.polygon.WMATIC_2, - ], ["0x3826367A5563eCE9C164eFf9701146d96cC70AD9"], block, "polygon") - return balances -} - -module.exports = { - hallmarks: [ - [1669766400, "swap contract exploit"] - ], - ethereum:{ - tvl:eth - }, - polygon:{ - tvl:polygon - } + ] + }) + } } \ No newline at end of file diff --git a/projects/monprotocol/index.js b/projects/monprotocol/index.js new file mode 100644 index 000000000000..a0aa6bdbcac3 --- /dev/null +++ b/projects/monprotocol/index.js @@ -0,0 +1,15 @@ +const { staking } = require('../helper/staking') +const tokenAddress = '0xc555D625828c4527d477e595fF1Dd5801B4a600e'; +const stakingContracts = [ + '0x65A8b32bc4dE5E0156DBa85Ce615d9ef8ea59780', + '0xd0c40b774ecfBc7B0632d23F871Cc0E523aad8F3', + '0xa305A8C63a5305Cc2D4d58c41F1d7C662C95475b', + '0x57136E05e6b1F502bd56B5439fCC1039A8250ED2' +] +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking(stakingContracts, tokenAddress), + }, + methodology: 'Counts the balance of staked tokens in the staking, claims, and rewards registry.', +}; diff --git a/projects/monroeprotocol/index.js b/projects/monroeprotocol/index.js index ae9ce664015e..1e80fd1868b5 100644 --- a/projects/monroeprotocol/index.js +++ b/projects/monroeprotocol/index.js @@ -1,33 +1,56 @@ const { createIncrementArray } = require("../helper/utils"); const { getLogs } = require('../helper/cache/getLogs') -const CHAINS = ["ethereum", "manta", "avax", "iotex"] +const V1_CHAINS = ["ethereum", "manta", "avax"] +const V2_CHAINS = ["manta", "avax"] +const CHAINS = [...new Set([...V2_CHAINS,...V1_CHAINS])] // Where possible contracts are deployed using deterministic addresses -const DEFAULT_ADDRESSES = { +const V1_ADDRESSES = { controller: "0xb2E609ef662889a32452598F0131863035974878", monusd: "0xDf3d57c3480951958Cef19905E4cf7FC1bA9ad42" } -const SPECIAL_ADDRESSES = { +const V1_SPECIAL_ADDRESSES = { zklink: { controller: "0xD620b0613568406F427a6f5d4ecA301870a1A3d5", monusd: "0x051baaA86328Fc7F522431932B8010F66f260A6a" } } +const DETERMINISTIC_roeUSD = "0x87196DB491ee1C77B91853CB79C118A322d6A9c0" +// V2 addresses +const V2_ADDRESSES = { + manta: "0xF88DF111343BffE7a2d89FB770d77A264d53f043", + avax: "0xF88DF111343BffE7a2d89FB770d77A264d53f043", + arbitrum: DETERMINISTIC_roeUSD, + ethereum: DETERMINISTIC_roeUSD +} async function tvl(api) { - const addresses = SPECIAL_ADDRESSES.hasOwnProperty(api.chain) ? SPECIAL_ADDRESSES[api.chain] : DEFAULT_ADDRESSES - const vaultLength = await api.call({ abi: "uint:getVaultsLength", target: addresses.controller }) - const vaultCalls = createIncrementArray(vaultLength) - const owners = [] const tokens = [] + + // V1 + if (V1_CHAINS.indexOf(api.chain) > -1){ + const addresses = V1_SPECIAL_ADDRESSES.hasOwnProperty(api.chain) ? V1_SPECIAL_ADDRESSES[api.chain] : V1_ADDRESSES + const vaultLength = await api.call({ abi: "uint:getVaultsLength", target: addresses.controller }) + const vaultCalls = createIncrementArray(vaultLength) - const vaults = await api.multiCall({ abi: "function mintVaults(uint vaultId) view returns (address)", calls: vaultCalls, target: addresses.monusd}) - const _tokens = await api.multiCall({ abi: 'address:collateralAsset', calls: vaults}) - tokens.push(..._tokens) - owners.push(...vaults) + const vaults = await api.multiCall({ abi: "function mintVaults(uint vaultId) view returns (address)", calls: vaultCalls, target: addresses.monusd}) + const _tokens = await api.multiCall({ abi: 'address:collateralAsset', calls: vaults}) + tokens.push(..._tokens) + owners.push(...vaults) + } + + // V2 + if (V2_CHAINS.indexOf(api.chain) > -1) { + const vaultLengthV2 = await api.call({ abi: "uint:getVaultsLength", target: V2_ADDRESSES[api.chain] }) + const vaultCallsV2 = createIncrementArray(vaultLengthV2) + const vaultsV2 = await api.multiCall({ abi: "function vaults(uint vaultId) view returns (address)", calls: vaultCallsV2, target: V2_ADDRESSES[api.chain]}) + const _tokensV2 = await api.multiCall({ abi: 'address:collateralAsset', calls: vaultsV2}) + tokens.push(..._tokensV2) + owners.push(...vaultsV2) + } return api.sumTokens({ tokensAndOwners2: [tokens, owners]}) } @@ -37,6 +60,9 @@ module.exports = { methodology: "Adds up the total value locked as collateral in Monroe vaults", start: 1710288000, // March 13, 2024 00:00 GMT + hallmarks: [ + [1722000000, "V2 Launch"] + ], }; CHAINS.forEach((chain) => { diff --git a/projects/moonflowerfarmers/index.js b/projects/moonflowerfarmers/index.js index 57653f28ac7e..27f8f2bc3317 100644 --- a/projects/moonflowerfarmers/index.js +++ b/projects/moonflowerfarmers/index.js @@ -1,42 +1,10 @@ -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const MFF = "0x78b65477bba78fc11735801d559c386611d07529"; const contract = "0xDE707357D10D86aE21373b290eAbBA07360896F6"; -const sdk = require("@defillama/sdk"); -const abi = require("../vexchange/abi.json"); - -async function staking(timestamp, _, {aurora: block}) { - const balances = {}; - const MFFPrice = await getMFFPrice(block); - - await sumTokensAndLPsSharedOwners( - balances, - [[MFF, false]], - [contract], - block, - "aurora", - (addr) => `aurora:${addr}` - ); - - balances.terrausd = (balances[`aurora:${MFF}`] * MFFPrice) / 10 ** 18; - delete balances[`aurora:${MFF}`]; - - return balances; -} -async function getMFFPrice(block) { - const reserves = ( - await sdk.api.abi.call({ - target: "0x3c508FC05C289BA989CF877bb2e3f6e54eF3fc95", - abi: abi.getReserves, - block, - chain: "aurora", - }) - ).output; - return reserves[0] / reserves[1]; -} +const { staking } = require('../helper/staking') module.exports = { aurora: { tvl: () => ({}), - staking, + staking: staking(contract, MFF), }, }; diff --git a/projects/moonswap/index.js b/projects/moonswap/index.js index ba0db0ebce98..b23e9ce2bcf4 100644 --- a/projects/moonswap/index.js +++ b/projects/moonswap/index.js @@ -11,4 +11,4 @@ module.exports = { }) }, misrepresentedTokens: true, -} // node test.js projects/moonswap/index.js \ No newline at end of file +} \ No newline at end of file diff --git a/projects/moonswap/onchain.js b/projects/moonswap/onchain.js deleted file mode 100644 index bc5bace50efb..000000000000 --- a/projects/moonswap/onchain.js +++ /dev/null @@ -1,112 +0,0 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const factoryAbi = require("../helper/abis/factory.json"); -const token0 = 'address:token0' -const token1 = 'address:token1' -const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' - -async function tvl(timestamp, ethBlock, chainBlocks) { - let balances = {}; - let factoryAddress = '0x056973F631A5533470143bB7010C9229C19C04d2' - - // GET NUMBER OF POOLS FROM FACTORY - const pairLength = Number(( - await sdk.api.abi.call({ - target: factoryAddress, - abi: factoryAbi.allPairsLength, - chain: 'moonriver', - block: chainBlocks['moonriver'], - }) - ).output); - const allPairNums = Array.from(Array(pairLength).keys()); - - // GET POOL ADDRESSES - const pairs = await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain: 'moonriver', - calls: allPairNums.map((num) => ({ - target: factoryAddress, - params: [num], - })), - }); - const pairAddresses = pairs.output.map(r => r.output.toLowerCase()) - - // FIND TOKEN BALANCES - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain: 'moonriver', - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block: chainBlocks['moonriver'], - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain: 'moonriver', - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block: chainBlocks['moonriver'], - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain: 'moonriver', - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block: chainBlocks['moonriver'], - }) - .then(({ output }) => output), - ]); - - // CALCULATE VALUE OF POOLS WRT TOKENS OF KNOWN VALUE - for (let n = 0; n < pairLength; n++) { - const tokenIds = [ - getTokenId(token0Addresses[n].output.toLowerCase()), - getTokenId(token1Addresses[n].output.toLowerCase()) - ]; - - const tokenId = tokenIds[0] ? tokenIds[0] : tokenIds[1]; - const side = tokenIds[0] ? 0 : 1; - - if (!tokenId) { - continue; - } else if (balances[tokenId[0]]) { - balances[tokenId[0]] = Number(balances[tokenId[0]]) - + Number(reserves[n].output[side]) * 2 / 10**tokenId[1]; - } else { - balances[tokenId[0]] = - reserves[n].output[side] * 2 / 10**tokenId[1]; - } - } - return balances; -} - -function getTokenId(address) { - switch(address) { - case '0x98878b06940ae243284ca214f92bb71a2b032b8a': - return ['moonriver', 18] - case [ADDRESSES.moonriver.USDC]: - return ['usd-coin', 6] - case [ADDRESSES.moonriver.USDT]: - return ['tether', 6] - case [ADDRESSES.moonriver.ETH]: - return ['ethereum', 18] - case '0x5d9ab5522c64e1f6ef5e3627eccc093f56167818': - return ['binance-usd', 18] - default: - return false; - } -} -// node test.js projects/moonswap/index.js -module.exports = { - misrepresentedTokens: true, - tvl, - methodology: 'tvl is calculated by summing the value of moonswap pools that contain at least one of MOVR, USDC, USDT, ETH and BUSD. This is read from the blockchain, accounts for most of the value locked in the AMM, and was done because these tokens can be valued on CoinGecko. Currently, staking is not counted due to most moonriver tokens being difficult to value in USD.' - }; \ No newline at end of file diff --git a/projects/moonthat-gg/index.js b/projects/moonthat-gg/index.js new file mode 100644 index 000000000000..4c30d858d738 --- /dev/null +++ b/projects/moonthat-gg/index.js @@ -0,0 +1,22 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + ethereum: { factory: '0x966983F93309D726a888adff08331ac81b522971', fromBlock: 20815952 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event CommunityLaunchCreated (address indexed singleton, bytes32 indexed coinId, address indexed proxy)', fromBlock, }) + const proxies = logs.map(log => log.proxy) + await api.sumTokens({ tokens: [ADDRESSES.null], owners: proxies }) // add ETH deposited to initial pool + const tokens = await api.multiCall({ abi: 'address:tokenAddress', calls: proxies }) + const utilities = await api.multiCall({ abi: 'address:MOONTHAT_UNISWAP_V3_UTILITY', calls: proxies }) + const vaults = await api.multiCall({ abi: 'address:moonThatUniswapV3Vault', calls: utilities }) + return sumTokens2({ api, owners: vaults, resolveUniV3: true, blacklistedTokens: tokens }) + } + } +}) \ No newline at end of file diff --git a/projects/moonwell-apollo/index.js b/projects/moonwell-apollo/index.js index ef0aec347537..76e813457dd9 100644 --- a/projects/moonwell-apollo/index.js +++ b/projects/moonwell-apollo/index.js @@ -1,28 +1,16 @@ -const { usdCompoundExports } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { staking } = require('../helper/staking') const moonriverConfig = { comptroller: '0x0b7a0EAA884849c6Af7a129e899536dDDcA4905E', - chain: 'moonriver', nativeTokenMarket: '0x6a1A771C7826596652daDC9145fEAaE62b1cd07f', stakingContract: '0xCd76e63f3AbFA864c53b4B98F57c1aA6539FDa3a', stakingTokenAddress: '0xBb8d88bcD9749636BC4D2bE22aaC4Bb3B01A58F1' } -// Moonriver -const moonriverTVL = usdCompoundExports( - moonriverConfig.comptroller, - moonriverConfig.chain, - moonriverConfig.nativeTokenMarket -) - -const moonriverStaking = staking( - moonriverConfig.stakingContract, - moonriverConfig.stakingTokenAddress, - 'moonriver' -) +const moonriverStaking = staking(moonriverConfig.stakingContract, moonriverConfig.stakingTokenAddress) module.exports = { - moonriver: { ...moonriverTVL, staking: moonriverStaking } + moonriver: { ...compoundExports2({ comptroller: moonriverConfig.comptroller, cether: '0x6a1a771c7826596652dadc9145feaae62b1cd07f' }), staking: moonriverStaking } } diff --git a/projects/moonwell/index.js b/projects/moonwell/index.js index 0554398a7902..8d1c764eb73d 100644 --- a/projects/moonwell/index.js +++ b/projects/moonwell/index.js @@ -1,38 +1,28 @@ -const { usdCompoundExports } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { staking } = require('../helper/staking'); const moonbeamConfig = { comptroller: '0x8E00D5e02E65A19337Cdba98bbA9F84d4186a180', - chain: 'moonbeam', nativeTokenMarket: '0x091608f4e4a15335145be0A279483C0f8E4c7955', - stakingContract: '0x8568A675384d761f36eC269D695d6Ce4423cfaB1', stakingTokenAddress: '0x511aB53F793683763E5a8829738301368a2411E3' } -// Moonbeam -const moonbeamTVL = usdCompoundExports( - moonbeamConfig.comptroller, - moonbeamConfig.chain, - moonbeamConfig.nativeTokenMarket -) - -const moonbeamStaking = staking( - moonbeamConfig.stakingContract, - moonbeamConfig.stakingTokenAddress, - 'moonbeam' -) +const moonbeamStaking = staking( moonbeamConfig.stakingContract, moonbeamConfig.stakingTokenAddress,) const baseConfig = { comptroller: '0xfBb21d0380beE3312B33c4353c8936a0F13EF26C', - chain: 'base' } -// Moonbeam -const baseTVL = usdCompoundExports(baseConfig.comptroller, baseConfig.chain) +const optimismConfig = { + comptroller: '0xCa889f40aae37FFf165BccF69aeF1E82b5C511B9', +} module.exports = { - moonbeam: { ...moonbeamTVL, staking: moonbeamStaking }, - base: { ...baseTVL }, + moonbeam: compoundExports2({ comptroller: moonbeamConfig.comptroller, cether: '0x091608f4e4a15335145be0a279483c0f8e4c7955' }), + base: compoundExports2({ comptroller: baseConfig.comptroller, }), + optimism: compoundExports2({ comptroller: optimismConfig.comptroller, }), hallmarks: [[1659312000, 'Nomad Bridge Exploit']] } + +module.exports.moonbeam.staking = moonbeamStaking \ No newline at end of file diff --git a/projects/more-markets/index.js b/projects/more-markets/index.js new file mode 100644 index 000000000000..8fe40b7574a1 --- /dev/null +++ b/projects/more-markets/index.js @@ -0,0 +1,51 @@ +const { getLogs2 } = require("../helper/cache/getLogs") +const { sumTokens2 } = require('../helper/unwrapLPs') + +const abi = { + "idToMarketParams": "function idToMarketParams(bytes32 Id) returns (bool isPremiumMarket, address loanToken, address collateralToken, address oracle, address irm, uint256 lltv, address creditAttestationService, uint96 irxMaxLltv, uint256[] categoryLltv)", + "market": "function market(bytes32 input) returns (uint128 totalSupplyAssets, uint128 totalSupplyShares, uint128 totalBorrowAssets, uint128 totalBorrowShares, uint128 lastUpdate, uint128 fee, uint256 premiumFee)" +} + +module.exports = { + methodology: `Collateral (supply minus borrows) in the balance of the MORE Markets contracts`, +}; + +const config = { + flow: { + moreMarkets: "0x94A2a9202EFf6422ab80B6338d41c89014E5DD72", + fromBlock: 2871764, + }, +}; + +Object.keys(config).forEach((chain) => { + const { moreMarkets, fromBlock, } = config[chain]; + module.exports[chain] = { + tvl: async (api) => { + const marketIds = await getMarkets(api); + const tokens = (await api.multiCall({ target: moreMarkets, calls: marketIds, abi: abi.idToMarketParams, })) + .map((i) => [i.collateralToken, i.loanToken]) + .flat(); + return sumTokens2({ api, owner: moreMarkets, tokens, }); + }, + borrowed: async (api) => { + const marketIds = await getMarkets(api); + const marketInfo = await api.multiCall({ target: moreMarkets, calls: marketIds, abi: abi.idToMarketParams, }); + const marketData = await api.multiCall({ target: moreMarkets, calls: marketIds, abi: abi.market, }); + marketData.forEach((i, idx) => { + api.add(marketInfo[idx].loanToken, i.totalBorrowAssets); + }); + return sumTokens2({ api }) + }, + }; + + async function getMarkets(api) { + const logs = await getLogs2({ + api, + target: moreMarkets, + eventAbi: "event CreateMarket(bytes32 indexed id, (bool,address,address,address,address,uint256,address,uint96,uint256[]) marketParams)", + fromBlock, + }); + return logs.map((i) => i.id); + } + +}) \ No newline at end of file diff --git a/projects/morkie/index.js b/projects/morkie/index.js new file mode 100644 index 000000000000..de3b74d8b4cd --- /dev/null +++ b/projects/morkie/index.js @@ -0,0 +1,11 @@ +const { staking } = require('../helper/staking'); + +module.exports = { + polygon: { + tvl: () => ({}), + staking: staking( + '0xee1198CF7575dfb2D5D666964322B6569B23E56b', + '0xAFb755c5f2ea2aadBaE693d3BF2Dc2C35158dC04' + ) + } +}; diff --git a/projects/morph/index.js b/projects/morph/index.js new file mode 100644 index 000000000000..2426de75e028 --- /dev/null +++ b/projects/morph/index.js @@ -0,0 +1,13 @@ +const { getConfig } = require('../helper/cache') +const { nullAddress } = require('../helper/tokenMapping') + +async function tvl(api) { + const { tokens } = await getConfig('morph/bridge', 'https://raw.githubusercontent.com/morph-l2/morph-list/main/src/mainnet/tokenList.json') + const tokensAndOwners = tokens.filter(i => i.chainId === '1').map(i => [i.address, i.gatewayAddress]) + tokensAndOwners.push([nullAddress, '0xDc71366EFFA760804DCFC3EDF87fa2A6f1623304']) + return api.sumTokens({ tokensAndOwners }) +} + +module.exports = { + ethereum: { tvl }, +} \ No newline at end of file diff --git a/projects/morpho-blue/index.js b/projects/morpho-blue/index.js index d6139ec2e203..03b0bac87bd0 100644 --- a/projects/morpho-blue/index.js +++ b/projects/morpho-blue/index.js @@ -12,12 +12,13 @@ const config = { }, base: { morphoBlue: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", + blackList: ['0x6ee1955afb64146b126162b4ff018db1eb8f08c3'], fromBlock: 13977148, }, }; -Object.keys(config).forEach((chain) => { - const { morphoBlue, fromBlock } = config[chain]; +Object.keys(config).forEach((chain) => { + const { morphoBlue, fromBlock, blackList = [] } = config[chain]; module.exports[chain] = { tvl: async (api) => { const marketIds = await getMarkets(api); @@ -30,7 +31,7 @@ Object.keys(config).forEach((chain) => { ) .map((i) => [i.collateralToken, i.loanToken]) .flat(); - return api.sumTokens({ owner: morphoBlue, tokens }); + return api.sumTokens({ owner: morphoBlue, tokens, blacklistedTokens: blackList }); }, borrowed: async (api) => { const marketIds = await getMarkets(api); diff --git a/projects/mortgageFi/index.js b/projects/mortgageFi/index.js new file mode 100644 index 000000000000..72d359817dbe --- /dev/null +++ b/projects/mortgageFi/index.js @@ -0,0 +1,17 @@ +const config = { + arbitrum: { pools: ['0x9Be2Cf73E62DD3b5dF4334D9A36888394822A33F'] }, + base: { pools: ['0x1bE87D273d47C3832Ab7853812E9A995A4DE9EEA'] }, +} + +Object.keys(config).forEach(chain => { + const { pools, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const cTokens = await api.multiCall({ abi: 'address:contractCoin', calls: pools }) + const sTokens = await api.multiCall({ abi: 'address:stablecoin', calls: pools }) + const tokens = cTokens.concat(sTokens) + const owners = pools.concat(pools) + return api.sumTokens({ tokensAndOwners2: [tokens, owners] }) + } + } +}) \ No newline at end of file diff --git a/projects/mosquitos-finance/index.js b/projects/mosquitos-finance/index.js index a5c8a930b566..740d31607438 100644 --- a/projects/mosquitos-finance/index.js +++ b/projects/mosquitos-finance/index.js @@ -141,6 +141,7 @@ module.exports = { [1678320000, "Rug Pull"] ], timetravel: false, + deadFrom: 1678320000, aptos: { tvl, staking diff --git a/projects/movegpt/index.js b/projects/movegpt/index.js index 75d2ac6e69d3..26730dbc7c01 100644 --- a/projects/movegpt/index.js +++ b/projects/movegpt/index.js @@ -5,14 +5,12 @@ const POOL_2 = "0x9141a7ebbf2c8ab9101d6b657321e1cc78314b71b8e8780508986119660ffe 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] - } - ) + 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)) diff --git a/projects/movepump/index.js b/projects/movepump/index.js new file mode 100644 index 000000000000..d0223b9a721c --- /dev/null +++ b/projects/movepump/index.js @@ -0,0 +1,15 @@ +const { getResources } = require('../helper/chain/aptos') +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(api) { + const resources = await getResources("0x766ec6a18eed729b6b62f8af38f7a62dbc847b84bec29063c8b0d46830a82401") + resources.forEach((resource) => { + if (resource.type.includes('movepump_launch::Pool<')) { + api.add(ADDRESSES.aptos.APT, resource.data.real_aptos_reserves.value) + } + }) +} + +module.exports = { + aptos: { tvl } +} \ No newline at end of file diff --git a/projects/mover/abi.json b/projects/mover/abi.json deleted file mode 100644 index 2ac8dafd3761..000000000000 --- a/projects/mover/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "inceptionLPPriceUSDC": "uint256:inceptionLPPriceUSDC", - "lpTokensBalance": "uint256:lpTokensBalance" -} \ No newline at end of file diff --git a/projects/mover/baseLedgerPoolAbi.json b/projects/mover/baseLedgerPoolAbi.json deleted file mode 100644 index b4c9952f594d..000000000000 --- a/projects/mover/baseLedgerPoolAbi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalAssetAmount": "uint256:totalAssetAmount" -} \ No newline at end of file diff --git a/projects/mover/index.js b/projects/mover/index.js index 915a3b7f12ca..e31fd5ccc9b3 100644 --- a/projects/mover/index.js +++ b/projects/mover/index.js @@ -1,8 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const baseLedgerAbi = require("./baseLedgerPoolAbi.json"); -const savingsPoolAbi = require("./savingsPoolAbi.json"); -const savingsPlusPoolAbi = require("./savingsPlusPoolAbi.json"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); @@ -13,46 +9,18 @@ const MOVER_WETH_SLP = "0x87b918e76c92818DB0c76a4E174447aeE6E6D23f"; const savingsPool = "0xAF985437DCA19DEFf89e61F83Cd526b272523719"; const savingsPlusPolygonPool = "0x77D5333d97A092cA01A783468E53E550C379dc3C"; -const USDC = ADDRESSES.ethereum.USDC; -const USDCinPolygon = ADDRESSES.polygon.USDC; const baseLedgerPool = '0x1f15F293C1Cd3d05d58d3EdeAf0C72c5A2dfeaFf'; const UBT = '0x8400D94A5cb0fa0D041a3788e395285d61c9ee5e'; -async function tvlEth(timestamp, block) { - const balances = {}; - - let stakedUBT = (await sdk.api.abi.call({ - abi: baseLedgerAbi.totalAssetAmount, - target: baseLedgerPool, - block - })).output; - - sdk.util.sumSingleBalance(balances, UBT, stakedUBT); - - - let savingsStakedUSDC = (await sdk.api.abi.call({ - abi: savingsPoolAbi.totalAssetAmount, - target: savingsPool, - block - })).output; - - sdk.util.sumSingleBalance(balances, USDC, savingsStakedUSDC); - return balances; +async function tvlEth(api) { + const [stakedUBT, savingsStakedUSDC] = await api.multiCall({ abi: "uint256:totalAssetAmount", calls: [baseLedgerPool, savingsPool] }) + api.add(UBT, stakedUBT) + api.add(ADDRESSES.ethereum.USDC, savingsStakedUSDC) } -async function tvlPolygon(timestamp, block, chainBlocks) { - const balances = {}; - const transform = i => `polygon:${i}`; - - let savingsPlusStakedUSDC = (await sdk.api.abi.call({ - chain: "polygon", - abi: savingsPlusPoolAbi.totalAssetAmount, - target: savingsPlusPolygonPool, - block: chainBlocks["polygon"], - })).output; - - sdk.util.sumSingleBalance(balances, transform(USDCinPolygon), savingsPlusStakedUSDC); - return balances; +async function tvlPolygon(api) { + const [savingsStakedUSDC] = await api.multiCall({ abi: "uint256:totalAssetAmount", calls: [savingsPlusPolygonPool] }) + api.add(ADDRESSES.polygon.USDC, savingsStakedUSDC) } module.exports = { diff --git a/projects/mover/savingsPlusPoolAbi.json b/projects/mover/savingsPlusPoolAbi.json deleted file mode 100644 index b4c9952f594d..000000000000 --- a/projects/mover/savingsPlusPoolAbi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalAssetAmount": "uint256:totalAssetAmount" -} \ No newline at end of file diff --git a/projects/mover/savingsPoolAbi.json b/projects/mover/savingsPoolAbi.json deleted file mode 100644 index b4c9952f594d..000000000000 --- a/projects/mover/savingsPoolAbi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalAssetAmount": "uint256:totalAssetAmount" -} \ No newline at end of file diff --git a/projects/mozaic/index.js b/projects/mozaic/index.js index d46b1e6e47f9..3e4a2804ba82 100644 --- a/projects/mozaic/index.js +++ b/projects/mozaic/index.js @@ -7,7 +7,21 @@ const vaults = { kava: "0x5712ab97A299a8A4544BCc728B7f3E9663965443", } +const theseusVaults = { + arbitrum: { vault: '0x6D8E0Ac94fb79Cd3520f546ce1c23A6F27F16EaC', gmxPlugin: '0xD4497259a3535ae311AB0F6ad68Da43a676919Db' }, +} + async function tvl(api) { + if (theseusVaults[api.chain]) { + const { vault, gmxPlugin } = theseusVaults[api.chain] + const tokens = await api.call({ abi: 'address[]:getAcceptedTokens', target: vault }) + const gmxPoolAbi = "function getPools() view returns ((uint8 poolId, address indexToken, address longToken, address shortToken, address marketToken)[])" + const gmxTokens = await api.call({ abi: gmxPoolAbi, target: gmxPlugin }) + const ownerTokens = [[tokens, vault], [gmxTokens.map(t => t.marketToken), gmxPlugin]] + await api.sumTokens({ ownerTokens }) + } + + const vault = vaults[api.chain]; const tokens = await api.call({ abi: 'function getAcceptingTokens () view returns (address[])', target: vault, }); const bals = await api.multiCall({ abi: 'function getStakedAmountPerToken(address token) view returns (uint256)', calls: tokens, target: vault }) diff --git a/projects/mswap/index.js b/projects/mswap/index.js new file mode 100644 index 000000000000..ec7fa7cde4d8 --- /dev/null +++ b/projects/mswap/index.js @@ -0,0 +1,5 @@ +const { uniTvlExports } = require('../helper/unknownTokens'); + +module.exports = uniTvlExports({ + matchain: '0x338bCC4efd3cA000D123d7352b362Fc6D5B3D829' +}) diff --git a/projects/mt-gox/index.js b/projects/mt-gox/index.js index 90343648020e..359462a574d8 100644 --- a/projects/mt-gox/index.js +++ b/projects/mt-gox/index.js @@ -1,89 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: [ - "17Tf4bVQaCzwWrDWGRPC97RLCHnU4LY8Qr", - "1BzK87zuqidZn489Wb2oLSktrjKrX7TLKe", - "1Drshi4RAuvxk4T6Bkq959ZvLbvy7b1wvD", - "1EiiKCCnFgHjEvPZdu29qqgdBm8zTvpU3U", - "14p4w3TRCd6NMRSnzTmgdvQhNnbrAmzXmy", - "12KkeeRkiNS13GMbg7zos9KRn9ggvZtZgx", - "12T4oSNd4t9ty9fodgNd47TWhK35pAxDYN", - "15kNZcrhxeFZgVVLK2Yjzd69tRidbFdJEZ", - "1LS5EFRRMDgMQusW6zokQUHjzNUfy6HHCQ", - "1FrV9hv1AW34BGJvobJatyzUWYDWB9epRW", - "1HdKXsNQtzDcfB6PGM7DWTgX9vhBWsz1ak", - "1Fu4YgM3Y9CxvioGPqkSzkydAC8MVaPN1D", - "1G23Uzwj55k2A9TRwaTknqGav66oDTkWCu", - "1GkZQcDy8V6pmHFZqUBUBCnN9dc2hoWasD", - "1Hm6XDmhKCHz68wDEYTapN9MEanke8iwUk", - "15SeCwVCFx5cWyrcdD1Zp1D1zxjH2SELPg", - "15U4VsmWG1cdXAtizvQsW4r7iMxzp64Tgu", - "16jZZkMYqjUWUtQ9DfDvHdH5ko5BcnH9XQ", - "16w6sZBDP58yyeyZAcvnxcEGJpwR9amM6g", - "19Cr4zXpKw43xLJhFZW9iv4DDNtQk2TDeB", - "1GyDutntMuYyA2vQGW5HFcKLfx4cbDdbJq", - "17etv2L3nhk6SCcWSNW4eoZkBy84izAm17", - "18ok25NTkdrUzdByFJCNVsqVYkujZ8aP45", - "199Yxz2TJGtND3QKsHTptTJivqSaUZBvku", - "1AZu7TQmKBAes2duNDctYwjAB9nhHczUnA", - "17KcBp8g76Ue8pywgjta4q8Ds6wK4bEKp7", - "1LLc8aA9C9LLULGbYCYSFKXgxKP2DXdCqP", - "1CZsoJfkknbnW5fKrt1oR7N1ALE5WmDGP1", - "1DedUxzgwErg4ipNi988wPgLk5thwciKcc", - "1H4K3dGfNbAN4AUfyUrpkGpjrd83sntDpV", - "13sXfpp2V16nnxYvW9FHHoBdMa3k98uJw8", - "13Wv5hGhubAWgSPWtXYh6s1s7HX2N1psYg", - "14mP6caC5dFhHdVAPCjPKM8Nm36MBDR5pM", - "155FsTtEFq4eGCcBxDseuwLKPbmtWbyHJR", - "156HpsWfgkWYLT63uhTAGUSUF3ZMnB9WWj", - "15QcKCa84ZCHxbsqXDoKhi5XbmQB8jPEAd", - "1EK8vW7UYaYHKiW4TZmYJKtwcZLM14VjvP", - "1Hb8DmmvvtTYv5RBLuGtDxznkZwVpd5Vjy", - "1HuPVqz2xvf1rdNFUqd62vRTyxP3jeX9Ch", - "13xGCc4TPSYY9GYxBGVNox82KxyjkFnxMX", - "13ahgw8sM95EDbugT3tdb8TYoMU46Uw7PX", - "1439q4Na8v88kPBqoyg8F4ueL9SYr8ANWj", - "13dXFMyG22EsUsvaWhCqUo7SXuX7rBPog6", - "14USZ558Rr28AZwdJQyciSQkN4JT1cEoj2", - "1FhRuUkk8Bfx8FJDemtxhKAR4F8GCNKrXG", - "1Mm9brripN4RPTzkGnRrbt5uDWdqbfk2iX", - "1LueUjEuBgc7cQhsWT8zAfTjcWmrNBZXaR", - "1LXi3x7hyt17cxncscGE887WCrC6XDNZ4P", - "19KiFrafXEyJCUDYFEv3B6tBUwyfFo7kNU", - "18YDgRhxsomuBZ1g9d8Y1JuRmxDhF8Bvff", - "18hcZVFPqDNAovJmb9vA6hEJrDz6uWXNGh", - "1BDZBTb4KE5oq6wAgA6EvAe3uCFRrAbPao", - "195HvmjXgoF3M5vFaBC8swZPhwrE7VhxRD", - "18KDS3q6a4YV9Nn8jcyMvNoVPfcrfemeag", - "19c8sUa54yQuRTVDfJa3iDkkCaFkzBJLPB", - "1B6kJM75iu5ty1HAHMMz6tT1HhjoGNTCa9", - "18M1Z337NqLtK9V69bssnQUYsvb7hmfSFS", - "19eihBKk6e5YD2QXAe4SVUsxRLLnTDKsfv", - "1C5aU4Xnpd3txbxehk46UZgiuNB8QdpHCH", - "1BXyJc6BVuTFnHQCcjiWX2xmCPNVfaSZeb", - "1Ar6meJQCkNoC9wnPcyRNNpzX5fBDaGcKd", - "1CRjKZJu8LvTutnSKq4zTJ4yiqrzMAArYW", - "1HweN9p41BY2RBunsPqyVuheEq7gVoxA9u", - "1HX4s3JeFU3x1eQgPNQVAdx6FoCtbb1hr8", - "1HzEPuenagLEWj68igDXBBXrzc293RuR5V", - "1JtgU6Uo1RAt5eiMf34EehyatUezBQP36C", - "1JVmoJT3471FjsX5H4hAeR1RyrDgpkHbpm", - "1JVU43LNKXqa9W5fCh8tppxDDEWgfeNg46", - "1JztCg7eKSkb1vi7NzGJynXpLZmoaFtYud", - "1KFDUSZuapMv7YaDmL6cyrHTQhma1MtFYs", - "1MkyfwJf7uhWTmVGGQXfcT5ip31DoHMxsz", - "1LzwbLgdKd4eFLkpRdeajkH1YJkVCip2zj", - "1MPJJzRaT8vLhowNB4dVyWRxxu79dq7WkB", - "1MvpYtqgBH7CXbTutrSVCTNHPzm9vakuRy", - "1N5X4kcZ56uRh24XrZoztS9Vb8G7j1Joop", - "1Pq7hooZbEAz5y3QMnqFY8C5xqTdrjUwcA", - "1PRXQEoL8vzEzoJJ9hbtAP6NaV2daccAUn", - "1PxGTuJzDx1ceFHx4Z5CHaWuhiPBNovmZD", - "1NA3Tj4b1jtx9eGELe31Jw4DrzTqKP3ayH" //https://www.cryptoground.com/mtgox-cold-wallet-monitor/ - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.mtGox } } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/mugglelink/index.js b/projects/mugglelink/index.js new file mode 100644 index 000000000000..ad522f471606 --- /dev/null +++ b/projects/mugglelink/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const muglelinkAddr = "UQCSo48F-bJSIq-DLve3vVNfGFmmIR-qPlKPdZ2De8c_mPbE" + +module.exports = { + methodology: 'Counts MuggleLink address balance as TVL.', + ton: { + tvl: sumTokensExport({ owner: muglelinkAddr, tokens: [ADDRESSES.ton.TON, ADDRESSES.ton.USDT]}), + } +} diff --git a/projects/multex/index.js b/projects/multex/index.js new file mode 100644 index 000000000000..4d88671860c8 --- /dev/null +++ b/projects/multex/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shape', '0x74Eac16615ed3b5A8Df2d00d72C72780beDED02A') \ No newline at end of file diff --git a/projects/multibit/index.js b/projects/multibit/index.js index a5b461cea9f3..b3529a4d97ac 100644 --- a/projects/multibit/index.js +++ b/projects/multibit/index.js @@ -2,36 +2,33 @@ const abi = require("./abi.json"); const { getConfig } = require('../helper/cache') const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/chain/brc20') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const BRIDGE_TOKENS = "https://api.multibit.exchange/support/token"; const config = { // https://app.multibit.exchange/staking - ethereum: { stakingPool: "0x2EDfFbc62C3dfFD2a8FbAE3cd83A986B5bbB5495", tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT] }, + ethereum: { stakingPool: "0x2EDfFbc62C3dfFD2a8FbAE3cd83A986B5bbB5495", tokens: [ADDRESSES.null, ADDRESSES.ethereum.USDT], chainKey: 'eth' }, bsc: {}, polygon: {}, + bouncebit: { chainKey: 'bb'}, } module.exports = { methodology: `Tokens bridged via MultiBit are counted as TVL`, bitcoin: { tvl: sumTokensExport({ - owners: [ - 'bc1p6r6hx759e3ulvggvd9x3df0rqh27jz59nvfjd2fzmh3wqyt6walq82u38z', // hot wallet - 'bc1pyyms2ssr0hagy5j50r5n689e6ye0626v3c98j5fw0jk6tz3vrgts7nt56g', // cold wallet - 'bc1qmcrpqanjnrw58y0fvq08fqchgxv5aylctew7vxlkalfns3rpedxsx4hxpu', // cold wallet - ], - blacklistedTokens: ['MUBI', 'BSSB'] + owners: bitcoinAddressBook.multibit, + blacklistedTokens: ['MUBI', 'BSSB', 'savm'] // more SAVM is bridged than circulating supply according to coingecko & etherscan }), }, } Object.keys(config).forEach(chain => { - const { stakingPool, tokens = [ADDRESSES.null] } = config[chain] + const { stakingPool, tokens = [ADDRESSES.null], chainKey = chain } = config[chain] module.exports[chain] = { tvl: async (api) => { const data = await getConfig('multibit', BRIDGE_TOKENS) - const key = chain === 'ethereum' ? 'eth': chain - const owner = data.find(v => v.chain === key)?.real?.contract + const owner = data.find(v => v.chain === chainKey)?.real?.contract if (!owner) return {} return api.sumTokens({ owner, tokens, }) } diff --git a/projects/multiplierfinance/index.js b/projects/multiplierfinance/index.js index 2eb0e191d80d..d0033b5e0172 100644 --- a/projects/multiplierfinance/index.js +++ b/projects/multiplierfinance/index.js @@ -1,109 +1,59 @@ const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const { getParamCalls } = require('../helper/utils') const YieldContract = "0xE4Baf69B887843aB6A0e82E8BAeA49010fF619af"; const LendingPool = "0xbc3534b076EDB8E8Ef254D81b81DC193c53057F7"; const LendingPoolV2 = "0x503fba251cdc4c06a1eeea4faf89e3fafc5923a6"; -const ethTvl = async (timestamp, block, chainBlocks) => { - const tokens = [nullAddress] - const { output: length } = await sdk.api.abi.call({ - target: YieldContract, - abi: abi.getNoOfErc20s, block, - }) - - const { output } = await sdk.api.abi.multiCall({ - target: YieldContract, - abi: abi.erc20List, - calls: getParamCalls(length), block, - }) - - output.forEach(i => tokens.push(i.output)) - return sumTokens2({ tokens, owner: YieldContract, block, }) +const ethTvl = async (api) => { + const tokens = await api.fetchList({ lengthAbi: abi.getNoOfErc20s, itemAbi: abi.erc20List, target: YieldContract }) + tokens.push(nullAddress) + return sumTokens2({ tokens, owner: YieldContract, }) }; -const chain = 'bsc' - -async function getReservesData(block) { - const { output: tokens } = await sdk.api.abi.call({ - abi: abi.getReserves, - target: LendingPool, - chain, block, - }) - - const { output: reservesData } = await sdk.api.abi.multiCall({ - abi: abi.getReserveData, - target: LendingPool, - calls: tokens.map(i => ({ params: i })), - chain, block, - }) - - return reservesData.map(({ input: { params: [token]}, output}) => { - output.token = token - return output - }) +async function getReservesData(api) { + const tokens = await api.call({ abi: abi.getReserves, target: LendingPool, }) + const res = await api.multiCall({ abi: abi.getReserveData, target: LendingPool, calls: tokens, }) + tokens.map((v, i) => res[i].token = v) + return res } -async function tvl(_, _b, { bsc: block }) { - const data = await getReservesData(block) +async function tvl(api) { + const data = await getReservesData(api) const tokensAndOwners = data.map(i => ([i.token, i.mTokenAddress])) - return sumTokens2({ tokensAndOwners, chain, block, }) + return sumTokens2({ tokensAndOwners, api, }) } -async function borrowed(_, _b, { bsc: block }) { - const balances = {} - const data = await getReservesData(block) - data.forEach(i => sdk.util.sumSingleBalance(balances,'bsc:'+i.token,i.totalBorrowsVariable)) - return balances +async function borrowed(api) { + const data = await getReservesData(api) + data.forEach(i => api.add(i.token, i.totalBorrowsVariable)) + return api.getBalances() } -async function tvlV2(_, _b, { bsc: block }) { - const data = await getReservesDataV2(block) +async function tvlV2(api) { + const data = await getReservesDataV2(api) const tokensAndOwners = data.map(i => ([i.token, i.aTokenAddress])) - return sumTokens2({ tokensAndOwners, chain, block, }) + return sumTokens2({ tokensAndOwners, api, }) } -async function borrowedV2(_, _b, { bsc: block }) { - const balances = {} - const data = await getReservesDataV2(block) - const { output: supplyVariable } = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: data.map(i => ({ target: i.variableDebtTokenAddress})), - chain, block, - }) - const { output: supplyStable } = await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', - calls: data.map(i => ({ target: i.stableDebtTokenAddress})), - chain, block, - }) +async function borrowedV2(api) { + const data = await getReservesDataV2(api) + const supplyVariable = await api.multiCall({ abi: 'erc20:totalSupply', calls: data.map(i => i.variableDebtTokenAddress), }) + const supplyStable = await api.multiCall({ abi: 'erc20:totalSupply', calls: data.map(i => i.stableDebtTokenAddress), }) data.forEach((i, idx) => { - sdk.util.sumSingleBalance(balances,'bsc:'+i.token,supplyVariable[idx].output) - sdk.util.sumSingleBalance(balances,'bsc:'+i.token,supplyStable[idx].output) + api.add(i.token, supplyVariable[idx]) + api.add(i.token, supplyStable[idx]) }) - return balances + return api.getBalances() } -async function getReservesDataV2(block) { - const { output: tokens } = await sdk.api.abi.call({ - abi: abiv2.getReservesList, - target: LendingPoolV2, - chain, block, - }) - - const { output: reservesData } = await sdk.api.abi.multiCall({ - abi: abiv2.getReserveData, - target: LendingPoolV2, - calls: tokens.map(i => ({ params: i })), - chain, block, - }) - - return reservesData.map(({ input: { params: [token]}, output}) => { - output.token = token - return output - }) +async function getReservesDataV2(api) { + const tokens = await api.call({ abi: abiv2.getReservesList, target: LendingPoolV2, }) + const res = await api.multiCall({ abi: abiv2.getReserveData, target: LendingPoolV2, calls: tokens, }) + tokens.map((v, i) => res[i].token = v) + return res } const abiv2 = { @@ -117,6 +67,6 @@ module.exports = { }, bsc: { tvl: sdk.util.sumChainTvls([tvl, tvlV2]), - borrowed: sdk.util.sumChainTvls([borrowed, borrowedV2]), + borrowed: sdk.util.sumChainTvls([borrowedV2, ]), }, }; diff --git a/projects/mversex/index.js b/projects/mversex/index.js index 7dc4f3812b7b..64f498af32ed 100644 --- a/projects/mversex/index.js +++ b/projects/mversex/index.js @@ -2,6 +2,6 @@ const { getUniTVL } = require("../helper/unknownTokens"); module.exports = { misrepresentedTokens: true, kava: { - tvl: getUniTVL({ factory: "0x266F951c525130a4E230bB40F0e3525C6C99B9c5", useDefaultCoreAssets: true, fetchBalances: true, }), + tvl: getUniTVL({ factory: "0x266F951c525130a4E230bB40F0e3525C6C99B9c5", useDefaultCoreAssets: true, }), }, }; diff --git a/projects/myx-finance/index.js b/projects/myx-finance/index.js index 5033e2c8a3f4..4e491d969b2a 100644 --- a/projects/myx-finance/index.js +++ b/projects/myx-finance/index.js @@ -4,6 +4,7 @@ const ADDRESSES = require('../helper/coreAssets.json') const config = { arbitrum: { vault: '0x8932aA60A7b5EfEFA8Ec3ee899Fd238D029d10c6', fromBlock: 175954437 }, linea: { vault: '0x03f61a185efEEEFdd3Ba032AFa8A0259337CEd64', fromBlock: 2390784 }, + op_bnb: { vault: '0xCB9724cf580C09f3Cd7391F7fE20b5BF9cC4C428', fromBlock: 35581884 }, } Object.keys(config).forEach((chain) => { diff --git a/projects/nabla/index.js b/projects/nabla/index.js new file mode 100644 index 000000000000..e1fc5d84811c --- /dev/null +++ b/projects/nabla/index.js @@ -0,0 +1,23 @@ + +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + base: { factory: '0x791Fee7b66ABeF59630943194aF17B029c6F487B', fromBlock: 19980311 }, + arbitrum: { factory: '0x7bcFc8b8ff61456ad7C5E2be8517D01df006d18d', fromBlock: 240797440 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: "event SwapPoolRegistered(address indexed sender, address pool, address asset)", fromBlock, }) + const pools = logs.map(log => log.pool) + const tokensAndOwners = logs.map(i => [i.asset, i.pool]) + let backstops = await api.multiCall({ abi: 'address:backstop', calls: pools }) + backstops = [...new Set(backstops)] + const bTokens = await api.multiCall({ abi: 'address:asset', calls: backstops }) + backstops.forEach((backstop, i) => tokensAndOwners.push([bTokens[i], backstop])) + return api.sumTokens({ tokensAndOwners }) + } + } +}) diff --git a/projects/nanoswap/index.js b/projects/nanoswap/index.js index 71ed6df848f2..8abc026ab4d4 100644 --- a/projects/nanoswap/index.js +++ b/projects/nanoswap/index.js @@ -1,12 +1,10 @@ const { getUniTVL } = require('../helper/unknownTokens') -const NANO = "0x28f45eA79c50d3ED9e1FA8A41dC8595F636eC34D"; const FACTORY = "0x41726eb94341fD27D5103DF3Cd6C387560c75B70" const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, - fetchBalances: true, }) diff --git a/projects/native-lend/index.js b/projects/native-lend/index.js index bc24c5182be8..8b68a4c95d40 100644 --- a/projects/native-lend/index.js +++ b/projects/native-lend/index.js @@ -11,8 +11,8 @@ const config = { zklink: "0x4AC97E2727B0e92AE32F5796b97b7f98dc47F059", bsc: "0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9", mantle:"0x48A6FE0Fa8DfF6D290Bd21aB6BCC1DDAeb9f2D0e", - ethereum:"0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9" - + ethereum:"0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9", + zeta:"0x3ba16AC2A67D126BF1DBa0a81E6C75073EFd95d9" }; Object.keys(config).forEach((chain) => { diff --git a/projects/navi/index.js b/projects/navi/index.js index 24a12baa10c0..d4f0bd2ca3f8 100644 --- a/projects/navi/index.js +++ b/projects/navi/index.js @@ -5,6 +5,14 @@ const decimalShift = { [ADDRESSES.sui.USDC]: -3, // USDC [ADDRESSES.sui.USDT]: -3, // USDT [ADDRESSES.sui.WETH]: -1, // WETH + ["0x2053d08c1e2bd02791056171aab0fd12bd7cd7efad2ab8f6b9c8902f14df2ff2::ausd::AUSD"]: -3, // AUSD + [ADDRESSES.sui.WBTC]: -1, // WBTC + [ADDRESSES.sui.USDC_CIRCLE]: -3, // native USDC + ['0xd0e89b2af5e4910726fbcd8b8dd37bb79b29e5f83f7491bca830e94f7f226d29::eth::ETH']: -1, // native ETH + ['0x960b531667636f39e85867775f52f6b1f220a058c4de786905bdf761e06a56bb::usdy::USDY']: -3, // USDY + ['0xf16e6b723f242ec745dfd7634ad072c42d5c1d9ac9d62a39c381303eaa57693a::fdusd::FDUSD']: -3, // FDUSD + ['0x5145494a5f5100e645e4b0aa950fa6b68f614e8c59e17bc5ded3495123a79178::ns::NS']: -3, // NS + ['0x5f496ed5d9d045c5b788dc1bb85f54100f2ede11e46f6a232c29daada4c5bdb6::coin::COIN']: -1, //stBTC } const storageId = "0xbb4e2f4b6205c2e2a2db47aeb4f830796ec7c005f88537ee775986639bc442fe" diff --git a/projects/nayms/index.js b/projects/nayms/index.js index 0aeb90282ece..de6cd8b4111f 100644 --- a/projects/nayms/index.js +++ b/projects/nayms/index.js @@ -10,13 +10,23 @@ const tokens = [ ADDRESSES.ethereum.USDM, ]; +const tokensBase = [ + ADDRESSES.base.WETH, + ADDRESSES.base.USDC, + ADDRESSES.ethereum.USDM, +]; + const owner = "0x39e2f550fef9ee15b459d16bD4B243b04b1f60e5"; +const ownerBase = "0x546Fb1621CF8C0e8e3ED8E3508b7c5100ADdBc03"; module.exports = { methodology: "Sum assets on Nayms", start: 1681990619, // Thu Apr 20 13:36:59 2023 GMT + hallmarks: [[1681990619, "Nayms V3 Launch"]], ethereum: { tvl: sumTokensExport({ owner, tokens }), }, - hallmarks: [[1681990619, "Nayms V3 Launch"]], + base: { + tvl: sumTokensExport({ owner: ownerBase, tokens: tokensBase }), + }, }; diff --git a/projects/nbx/index.js b/projects/nbx/index.js index eb0c922834f4..055766e16a38 100644 --- a/projects/nbx/index.js +++ b/projects/nbx/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -15,10 +16,7 @@ const config = { ] }, bitcoin: { - owners: [ - 'bc1qd79ypayqr03lmvcqc40udn6yuq4mve34ychy6a', - 'bc1qgxrcuzn62qjk3e3echysa9srg87la26x0qn2sa', - ] + owners: bitcoinAddressBook.nbx } } diff --git a/projects/nearlenddao/index.js b/projects/nearlenddao/index.js new file mode 100644 index 000000000000..c3591ac0b1a8 --- /dev/null +++ b/projects/nearlenddao/index.js @@ -0,0 +1,29 @@ +const { call, sumSingleBalance, sumTokens } = require('../helper/chain/near') +const NEARLEND_DAO_CONTRACT = 'v1.nearlend-official.near' + +async function borrowed() { + const balances = {}; + const assetsCallResponse = await call(NEARLEND_DAO_CONTRACT, 'get_assets_paged', {}); + + assetsCallResponse.forEach(([token, asset]) => { + const extraDecimals = asset.config.extra_decimals; + sumSingleBalance(balances, token, asset.borrowed.balance / (10 ** extraDecimals)); + }) + + return balances; +} + +async function tvl(api) { + const assetsCallResponse = await call(NEARLEND_DAO_CONTRACT, 'get_assets_paged', {}); + const tokens = assetsCallResponse.map(([token]) => token); + return sumTokens({ owners: [NEARLEND_DAO_CONTRACT], tokens }); +} + +module.exports = { + near: { + tvl, + borrowed, + }, + timetravel: false, + methodology: 'Summed up all the tokens deposited in their main lending contract' +} diff --git a/projects/nearpad/index.js b/projects/nearpad/index.js index d4091a13d8f3..063948ac8a47 100644 --- a/projects/nearpad/index.js +++ b/projects/nearpad/index.js @@ -1,26 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require('../helper/unknownTokens') -const tokens = [ - "0x885f8CF6E45bdd3fdcDc644efdcd0AC93880c781", - "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB", - ADDRESSES.aurora.NEAR, - ADDRESSES.aurora.USDT_e, - "0xe3520349F477A5F6EB06107066048508498A291b", - ADDRESSES.aurora.USDC_e, - "0xF4eB217Ba2454613b15dBdea6e5f22276410e89e", - ADDRESSES.aurora.AURORA, - "0xFa94348467f64D5A457F75F8bc40495D33c65aBB", - "0x74974575d2f1668c63036d51ff48dbaa68e52408", - "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970", - ADDRESSES.aurora.FRAX, -]; - - module.exports = { misrepresentedTokens: true, aurora: { tvl: getUniTVL({ factory: '0x34484b4E416f5d4B45D4Add0B6eF6Ca08FcED8f1', useDefaultCoreAssets: true }), }, -}; -// node test.js projects/nearpad/index.js +} diff --git a/projects/neftyblocks/index.js b/projects/neftyblocks/index.js new file mode 100644 index 000000000000..252d39347794 --- /dev/null +++ b/projects/neftyblocks/index.js @@ -0,0 +1,28 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +const tokens = [ + ["eosio.token", "WAX", "wax"], + ["alien.worlds", "TLM", "alien-worlds"], + ["token.nefty", "NEFTY", "nefty"], + ["token.fusion", "LSWAX", "waxfusion-staked-wax"], +]; + +// NeftyBlocks +// https://neftyblocks.com +async function wax() { + const accounts = ["blend.nefty", "up.nefty", "neftyblocksd", "neftyblocksp", "market.nefty", "swap.nefty", "swap.we"]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +async function staking() { + const accounts = ["stake.nefty", "reward.nefty"]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +module.exports = { + methodology: `NeftyBlocks TVL is achieved by querying token balances from NFT market and swap contracts.`, + wax: { + tvl: wax, + staking + }, +} \ No newline at end of file diff --git a/projects/neku/index.js b/projects/neku/index.js index d53cb04b9299..481b15c1bc0f 100644 --- a/projects/neku/index.js +++ b/projects/neku/index.js @@ -1,9 +1,8 @@ -const { usdCompoundExports } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') -const unitroller = "0xD5B649c7d27C13a2b80425daEe8Cb6023015Dc6B" -// node test.js projects/neku/index.js +const comptroller = "0xD5B649c7d27C13a2b80425daEe8Cb6023015Dc6B" module.exports = { - arbitrum:usdCompoundExports(unitroller, "arbitrum", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), - moonriver:usdCompoundExports(unitroller, "moonriver", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), - bsc: usdCompoundExports(unitroller, "bsc", "0xBC4a19345c598D73939b62371cF9891128ecCB8B"), + arbitrum: compoundExports2({ comptroller, cether: '0xbc4a19345c598d73939b62371cf9891128eccb8b' }), + moonriver: compoundExports2({ comptroller, cether: '0xbc4a19345c598d73939b62371cf9891128eccb8b' }), + bsc: compoundExports2({ comptroller, cether: '0xbc4a19345c598d73939b62371cf9891128eccb8b' }), } \ No newline at end of file diff --git a/projects/neopin-staking/index.js b/projects/neopin-staking/index.js index 05ca37668657..a2f9b78e1d34 100644 --- a/projects/neopin-staking/index.js +++ b/projects/neopin-staking/index.js @@ -11,6 +11,7 @@ module.exports = { "0xf9d92BAd7b1410dfFB0a204B7aa418C9fd5A898F", "0xf20816C9bdcb25da3ba79b206e9b7107ae02ae10", "0x489d6d679F1CA4cFE6976C55B54427D1AaDb8057", + "0x184E039D35cce96511E32c1aF85907664fb0e646" ], tokens: [nullAddress], }), diff --git a/projects/nest-staking/index.js b/projects/nest-staking/index.js new file mode 100644 index 000000000000..9c9bec13c468 --- /dev/null +++ b/projects/nest-staking/index.js @@ -0,0 +1,17 @@ + +const RWA_STAKING = "0xdbd03d676e1cf3c3b656972f88ed21784372acab" +const RESERVE_STAKING = "0xba0ae7069f94643853fce3b8af7f55acbc11e397" +const SBTC = "0x094c0e36210634c3CfA25DC11B96b562E0b07624" +const STONE = "0x7122985656e38bdc0302db86685bb972b145bd3c" + +async function tvl(api) { + // Get allowed stablecoins from RWA Staking + const stablecoins = await api.call({ target: RWA_STAKING, abi: 'address[]:getAllowedStablecoins', }) + const ownerTokens = [[stablecoins, RWA_STAKING], [[SBTC, STONE], RESERVE_STAKING]] + return api.sumTokens({ ownerTokens}) +} + +module.exports = { + methodology: "Counts total value locked in both RWA Staking (stablecoins) and Reserve Staking (SBTC and STONE) contracts", + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/nest/index.js b/projects/nest/index.js index a19ee7ba4860..0d0d815c4fb8 100644 --- a/projects/nest/index.js +++ b/projects/nest/index.js @@ -1,56 +1,48 @@ -const sdk = require("@defillama/sdk"); -const { getChainTransform } = require("../helper/portedTokens"); -const { sumTokensSharedOwners } = require("../helper/unwrapLPs"); -const contracts = require('./contracts'); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); -function staking(chain) { - return async (timestamp, block, chainBlocks) => { - return { - [contracts.NEST.ethereum]: - (await sdk.api.abi.multiCall({ - target: contracts.NEST[chain], - calls: contracts.stakingContracts[chain].map(h => ({ - params: h - })), - block: chainBlocks[chain], - abi: 'erc20:balanceOf', - chain - })).output.map(b => b.output) - .reduce((a, b) => Number(a) + Number(b), 0) - }; - }; -} - -function tvl(chain) { - return async (timestamp, block, chainBlocks) => { - const balances = {}; - const transform = await getChainTransform(chain); - - if (!contracts.tvlContracts.hasOwnProperty([chain])) { - return balances; - } +module.exports = { + methodology: "Counts NEST tokens that have been staked in the nest dapp", +}; - await sumTokensSharedOwners( - balances, - contracts.tokens[chain], - contracts.tvlContracts[chain], - chainBlocks[chain], - chain, - transform - ); - return balances; - }; +const config = { + ethereum: { + tvlContracts: ['0xE544cF993C7d477C7ef8E91D28aCA250D135aa03'], + tokens: [ + "0x0316EB71485b0Ab14103307bf65a021042c6d380" + ], + NEST: '0x04abEdA201850aC0124161F037Efd70c74ddC74C', + stakingContracts: [ + "0xaA7A74a46EFE0C58FBfDf5c43Da30216a8aa84eC", + "0x505eFcC134552e34ec67633D1254704B09584227", + "0x9a5C88aC0F209F284E35b4306710fEf83b8f9723", + "0x34B931C7e5Dc45dDc9098A1f588A0EA0dA45025D", + "0xE544cF993C7d477C7ef8E91D28aCA250D135aa03" + ] + }, + bsc: { + tvlContracts: ['0x9484f12044b9d5707AfeaC5BD02b5E0214381801'], + tokens: [ + ADDRESSES.bsc.USDT + ], + NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', + stakingContracts: ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] + }, + polygon: { + NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', + stakingContracts: ["0x09CE0e021195BA2c1CDE62A8B187abf810951540"] + }, + kcc: { + NEST: '0x98f8669F6481EbB341B522fCD3663f79A3d1A6A7', + stakingContracts: ["0x7DBe94A4D6530F411A1E7337c7eb84185c4396e6"] + }, } -const chainExports = Object.keys(contracts.stakingContracts).reduce((a, chain) => ({ - ...a, [chain]: { - tvl: tvl(chain), - staking: staking(chain) - } -}), {}) - -module.exports = { - methodology: "Counts NEST tokens that have been staked in the nest dapp", - ...chainExports -}; \ No newline at end of file +Object.keys(config).forEach(chain => { + const { NEST: token, stakingContracts = [], tokens = [], tvlContracts = [] } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ tokens, owners: tvlContracts }), + staking: token ? sumTokensExport({ token, owners: stakingContracts }) : undefined, + } +}) \ No newline at end of file diff --git a/projects/neuralai/index.js b/projects/neuralai/index.js new file mode 100644 index 000000000000..50b710982462 --- /dev/null +++ b/projects/neuralai/index.js @@ -0,0 +1,14 @@ +const { staking } = require('../helper/staking'); + +const CONTRACT_ADDRESS = "0xbe2cf8DA9887e2AB997Ed53cC49263eBD09B20C3"; +const TOKENS = [ + "0x32B053F2CBA79F80ada5078cb6b305da92BDe6e1", // neural + "0x77E06c9eCCf2E797fd462A92B6D7642EF85b0A44" // wtao +]; + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking(CONTRACT_ADDRESS, TOKENS), + }, +}; diff --git a/projects/newland/index.js b/projects/newland/index.js index 3f979353ef6b..58cb18ef7d4f 100644 --- a/projects/newland/index.js +++ b/projects/newland/index.js @@ -3,21 +3,12 @@ const abi = require("./abi.json") const { unwrapLPsAuto, } = require("../helper/unwrapLPs"); const { getChainTransform } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const BoosterStakingChef_Heco = "0x7970234cDfa8898853Eaa1e2586cE933d9054af8"; const MdexStakingChef_Heco = "0x44aEfA01E92d170C915D87C2AB03D03cA49D5cb5"; const LavaStakingChef_heco = "0x9B948c946BE7F062D2075744142896F08D32a8A5"; const SushiStakingChef_Ethereum = "0x0503866eD9F304Ec564F145d22994F7f11838596"; -const treasuryAddress = "0xB3FC6B9be3AD6b2917d304d4F5645a311bCFd0A8"; -const erc20Tokens = [ - //MDX - "0x25d2e80cb6b86881fd7e07dd263fb79f4abe033c", - //BOO - "0xff96dccf2763d512b6038dc60b7e96d1a9142507", -]; - const calcTvl = async (balances, chain, block, poolInfo, StakingChef, transform) => { const lengthOfPool = ( await sdk.api.abi.call({ @@ -42,14 +33,6 @@ const calcTvl = async (balances, chain, block, poolInfo, StakingChef, transform) }) }; -/*** Treasury ***/ -const Treasury = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - let transformAddress = await getChainTransform('heco') - await sumTokensAndLPsSharedOwners(balances, erc20Tokens.map(t => [t, false]), [treasuryAddress], chainBlocks["heco"], "heco", transformAddress); - return balances; -}; - /*** Heco TVL Portion ***/ const hecoTvl = async (timestamp, ethBlock, { heco: block }) => { const balances = {}; diff --git a/projects/nexon/index.js b/projects/nexon/index.js index 58dc85629cce..243ef0fd3772 100644 --- a/projects/nexon/index.js +++ b/projects/nexon/index.js @@ -1,16 +1,9 @@ const sdk = require('@defillama/sdk') const { compoundExports, compoundExports2 } = require('../helper/compound'); -const { nullAddress } = require('../helper/tokenMapping'); const comptroller = "0x0171cA5b372eb510245F5FA214F5582911934b3D" -const abis = { - getReservesABI: 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)' -} - -const lendingMarket = compoundExports(comptroller, 'era', '0x1BbD33384869b30A323e15868Ce46013C82B86FB', nullAddress, undefined, undefined, { - resolveLPs: true, abis -}) +const lendingMarket = compoundExports(comptroller, '0x1BbD33384869b30A323e15868Ce46013C82B86FB') const lendingMarket2 = compoundExports2({ comptroller: '0xc955d5fa053d88e7338317cc6589635cd5b2cf09', cether: '0x22d8b71599e14f20a49a397b88c1c878c86f5579', blacklistedTokens: [ '0x247b1891c1d04d5972658824dcfbab71b0e9ca1d', diff --git a/projects/nfthive/index.js b/projects/nfthive/index.js new file mode 100644 index 000000000000..8df589effb75 --- /dev/null +++ b/projects/nfthive/index.js @@ -0,0 +1,27 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +const tokens = [ + ["eosio.token", "WAX", "wax"], + ["alien.worlds", "TLM", "alien-worlds"], + ["wuffi", "WUF", "wuffi"], +]; + +// NFTHive +// https://nfthive.io +async function wax() { + const accounts = ["nfthivedrops", "nfthivepacks", "nfthivecraft"]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +async function staking() { + const accounts = ["nfthivevault"]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +module.exports = { + methodology: `NFTHive TVL is achieved by querying token balances from NFT market contracts.`, + wax: { + tvl: wax, + staking + }, +} \ No newline at end of file diff --git a/projects/nightmare/index.js b/projects/nightmare/index.js index c3d3efe515f7..caa5aff4caaa 100644 --- a/projects/nightmare/index.js +++ b/projects/nightmare/index.js @@ -7,4 +7,5 @@ module.exports = masterchefExports({ }) module.exports.hallmarks = [ [1646179200, "Rug Pull"] -] \ No newline at end of file +], +module.exports.deadFrom='2022-03-02' \ No newline at end of file diff --git a/projects/nimbora-yield/index.js b/projects/nimbora-yield/index.js index 41ba202628e5..70f2db349333 100644 --- a/projects/nimbora-yield/index.js +++ b/projects/nimbora-yield/index.js @@ -28,7 +28,7 @@ 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 underlying = parseAddress(strategyInfo.underlying) == ADDRESSES.starknet.DAI_1 ? ADDRESSES.starknet.DAI : parseAddress(strategyInfo.underlying); const strategyTvl = await call({ target: strategyInfo.tokenManager, abi: totalAssetsAbi }); api.add(underlying, strategyTvl) } diff --git a/projects/noble/index.js b/projects/noble/index.js new file mode 100644 index 000000000000..ec6c78975283 --- /dev/null +++ b/projects/noble/index.js @@ -0,0 +1,30 @@ +const { queryV1Beta1 } = require('../helper/chain/cosmos'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const NOBLE_DENOMS_URL = 'bank/v1beta1/denoms_metadata'; +const NOBLE_SUPPLY_URL = 'bank/v1beta1/supply/'; + +const IGNORE_DENOMS = ['ufrienzies', 'ustake']; + +async function tvl(api) { + const { metadatas } = await queryV1Beta1({ api, url: NOBLE_DENOMS_URL }); + + for (const metadata of metadatas) { + const baseDenom = metadata.base; + + // ignore invalid denoms + if (IGNORE_DENOMS.includes(baseDenom)) + continue; + + // fetch supply for denom + const { amount } = await queryV1Beta1({ api, url: `${NOBLE_SUPPLY_URL}${baseDenom}` }); + api.add(baseDenom, amount.amount); + } + return sumTokens2({ api }); +} + +module.exports = { + noble: { + tvl, + }, +}; diff --git a/projects/nolus/index.js b/projects/nolus/index.js index b1983f2736a5..653dab1afba0 100644 --- a/projects/nolus/index.js +++ b/projects/nolus/index.js @@ -12,11 +12,36 @@ const osmosisAxlOracleAddr = 'nolus1vjlaegqa7ssm2ygf2nnew6smsj8ref9cmurerc7pzwxq const osmosisAxlLeaserAddr = 'nolus1wn625s4jcmvk0szpl85rj5azkfc6suyvf75q6vrddscjdphtve8s5gg42f' const osmosisAxlLppAddr = 'nolus1qg5ega6dykkxc307y25pecuufrjkxkaggkkxh7nad0vhyhtuhw3sqaa3c5' +// Osmosis stATOM Protocol Contracts (OSMOSIS-OSMOSIS-ST_ATOM) pirin-1 +const osmosisStAtomOracleAddr = 'nolus1mtcv0vhpt94s82mcemj5sc3v94pq3k2g62yfa5p82npfnd3xqx8q2w8c5f' +const osmosisStAtomLeaserAddr = 'nolus1xv0erzdcphnpkf8tr76uynldqx6sspw7782zg9wthz8xpemh7rnsv4nske' +const osmosisStAtomLppAddr = 'nolus1jufcaqm6657xmfltdezzz85quz92rmtd88jk5x0hq9zqseem32ysjdm990' + +// Osmosis allBTC Protocol Contracts (OSMOSIS-OSMOSIS-ALL_BTC) pirin-1 +const osmosisBtcOracleAddr = 'nolus1y0nlrnw25mh2vxhaupamwca4wdvuxs26tq4tnxgjk8pw0gxevwfq5ry07c' +const osmosisBtcLeaserAddr = 'nolus1dzwc9hu9aqlmm7ua4lfs2lyafmy544dd8vefsmjw57qzcanhsvgsf4u3ld' +const osmosisBtcLppAddr = 'nolus1w2yz345pqheuk85f0rj687q6ny79vlj9sd6kxwwex696act6qgkqfz7jy3' + +// Osmosis allSOL Protocol Contracts (OSMOSIS-OSMOSIS-ALL_SOL) pirin-1 +const osmosisSolOracleAddr = 'nolus153kmhl85vavd03r9c7ardw4fgydge6kvvhrx5v2uvec4eyrlwthsejc6ce' +const osmosisSolLeaserAddr = 'nolus1lj3az53avjf8s9pzwvfe86d765kd7cmnhjt76vtqxjvn08xu0c6saumtza' +const osmosisSolLppAddr = 'nolus1qufnnuwj0dcerhkhuxefda6h5m24e64v2hfp9pac5lglwclxz9dsva77wm' + +// Osmosis AKT Protocol Contracts (OSMOSIS-OSMOSIS-AKT) pirin-1 +const osmosisAktOracleAddr = 'nolus12sx0kr60rptp846z2wvuwyxn47spg55dcnzwrhl4f7nfdduzsrxq7rfetn' +const osmosisAktLeaserAddr = 'nolus1shyx34xzu5snjfukng323u5schaqcj4sgepdfcv7lqfnvntmq55sj94hqt' +const osmosisAktLppAddr = 'nolus1lxr7f5xe02jq6cce4puk6540mtu9sg36at2dms5sk69wdtzdrg9qq0t67z' + // Astroport Protocol Contracts (NEUTRON-ASTROPORT-USDC_AXELAR) pirin-1 const astroportOracleAddr = 'nolus1jew4l5nq7m3xhkqzy8j7cc99083m5j8d9w004ayyv8xl3yv4h0dql2dd4e' const astroportLppAddr = 'nolus1qqcr7exupnymvg6m63eqwu8pd4n5x6r5t3pyyxdy7r97rcgajmhqy3gn94' const astroportLeaserAddr = 'nolus1et45v5gepxs44jxewfxah0hk4wqmw34m8pm4alf44ucxvj895kas5yrxd8' +// Astroport Noble USDC Protocol Contracts (NEUTRON-ASTROPORT-USDC_NOBLE) pirin-1 +const astroportNobleOracleAddr = 'nolus1vhzdx9lqexuqc0wqd48c5hc437yzw7jy7ggum9k25yy2hz7eaatq0mepvn' +const astroportNobleLeaserAddr = 'nolus1aftavx3jaa20srgwclakxh8xcc84nndn7yvkq98k3pz8ydhy9rvqkhj8dz' +const astroportNobleLppAddr = 'nolus17vsedux675vc44yu7et9m64ndxsy907v7sfgrk7tw3xnjtqemx3q6t3xw6' + const _6Zeros = 1000000 const nativeTokens = { @@ -42,15 +67,24 @@ async function getLeases(leaseAddresses) { return await queryManyContracts({ permitFailure: true, contracts: leaseAddresses, chain: 'nolus', data: {} }) } -async function getLppTvl(lppAddresses) { +async function getLppTvl(lppAddresses) { const lpps = await queryManyContracts({ contracts: lppAddresses, chain: 'nolus', data: { 'lpp_balance': [] } }) - + let totalLpp = 0 + let divisor = _6Zeros; // Default 6 decimals + + // Adjust divisor based on specific addresses for allBTC and allSOL + if (lppAddresses.includes(osmosisBtcLppAddr)) { + divisor = 100000000; // 8 decimals for BTC + } else if (lppAddresses.includes(osmosisSolLppAddr)) { + divisor = 1000000000; // 9 decimals for SOL + } + lpps.forEach(v => { totalLpp += Number(v.balance.amount) }) - return totalLpp / _6Zeros + return totalLpp / divisor; } function sumAssests(balances, leases, currencies) { @@ -59,21 +93,24 @@ function sumAssests(balances, leases, currencies) { let ticker = v.opened.amount.ticker const amount = parseInt(v.opened.amount.amount, 10) const currencyData = find(currencies, (n) => n.ticker == ticker) - if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) { - sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount) + if (currencyData) { + if (nativeTokens.hasOwnProperty(currencyData.dex_symbol)) { + sdk.util.sumSingleBalance(balances, nativeTokens[currencyData.dex_symbol], amount) + } + sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount) } - sdk.util.sumSingleBalance(balances, currencyData.dex_symbol, amount) } }) } -function find (collection, predicate) { +function find(collection, predicate) { for (let i = 0; i < collection.length; i++) { if (predicate(collection[i])) { - return collection[i]; + return collection[i] } } - return undefined; + + return undefined } async function tvl(protocols) { @@ -95,14 +132,19 @@ module.exports = { tvl: async () => { return { 'axlusdc': await getLppTvl([osmosisAxlLppAddr, astroportLppAddr]), - 'usd-coin': await getLppTvl([osmosisNobleLppAddr]) + 'usd-coin': await getLppTvl([osmosisNobleLppAddr, astroportNobleLppAddr]), + 'stride-staked-atom': await getLppTvl([osmosisStAtomLppAddr]), + 'osmosis-allbtc': await getLppTvl([osmosisBtcLppAddr]), + 'osmosis-allsol': await getLppTvl([osmosisSolLppAddr]), + 'akash-network': await getLppTvl([osmosisAktLppAddr]) } } }, neutron: { tvl: async () => { return await tvl([ - { leaser: astroportLeaserAddr, oracle: astroportOracleAddr } + { leaser: astroportLeaserAddr, oracle: astroportOracleAddr }, + { leaser: astroportNobleLeaserAddr, oracle: astroportNobleOracleAddr }, ]) } }, @@ -111,6 +153,10 @@ module.exports = { return await tvl([ { leaser: osmosisNobleLeaserAddr, oracle: osmosisNobleOracleAddr }, { leaser: osmosisAxlLeaserAddr, oracle: osmosisAxlOracleAddr }, + { leaser: osmosisStAtomLeaserAddr, oracle: osmosisStAtomOracleAddr }, + { leaser: osmosisBtcLeaserAddr, oracle: osmosisBtcOracleAddr }, + { leaser: osmosisSolLeaserAddr, oracle: osmosisSolOracleAddr }, + { leaser: osmosisAktLeaserAddr, oracle: osmosisAktOracleAddr } ]) } } diff --git a/projects/nomad/index.js b/projects/nomad/index.js index 03d5464f891f..a9b18f894b41 100644 --- a/projects/nomad/index.js +++ b/projects/nomad/index.js @@ -29,7 +29,7 @@ const TOKEN_ADDRESSES = [ }, { // FXS - 'ethereum': '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0' + 'ethereum': ADDRESSES.ethereum.FXS }, { 'ethereum': ADDRESSES.ethereum.WETH diff --git a/projects/nonkyc/index.js b/projects/nonkyc/index.js index 3715eed48065..160c768d6afa 100644 --- a/projects/nonkyc/index.js +++ b/projects/nonkyc/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { /* @@ -30,9 +31,7 @@ const config = { }, /* bitcoin: { - owners: [ - 'bc1qy8xx8fcsmdlc447ls4wzw2tn3y6c6cy64wckhz', - ] + owners: bitcoinAddressBook.nonkyc }, // remove it for now /* bitcoincash: { diff --git a/projects/notional/index.js b/projects/notional/index.js index 9bdcd283002d..ac2292616b6a 100644 --- a/projects/notional/index.js +++ b/projects/notional/index.js @@ -17,5 +17,7 @@ async function tvl(api) { } module.exports = { + deadFrom: '2024-08-22', + hallmarks: [[1724284800, "End of Deprecation process for migrating from Notional V2 to Notional V3"]], ethereum: { tvl }, }; \ No newline at end of file diff --git a/projects/novation/index.js b/projects/novation/index.js index aeb46c52392f..43c94998ca9f 100644 --- a/projects/novation/index.js +++ b/projects/novation/index.js @@ -6,7 +6,7 @@ const config = { Object.keys(config).forEach(chain => { const comptroller = config[chain] module.exports[chain] = compoundExports2({ - comptroller, fetchBalances: true, abis: { + comptroller, abis: { getAllMarkets: "address[]:allMarkets", totalBorrows: "uint256:totalBorrow", }, diff --git a/projects/nxfi/idl.js b/projects/nxfi/idl.js index 266eb8dc3f5e..a5f3932a13ab 100644 --- a/projects/nxfi/idl.js +++ b/projects/nxfi/idl.js @@ -511,6 +511,9 @@ module.exports = { }, { "name": "SwitchboardV2" + }, + { + "name": "PythV2" } ] } @@ -521,4 +524,4 @@ module.exports = { "metadata": { "address": "7YYkqwXp812NMe6nWny2JAGsm6b3CVvbQKiMo8SuaPMg" } -} \ No newline at end of file +} diff --git a/projects/nxfinance/index.js b/projects/nxfinance/index.js index 98400c018acd..01d45f48f78a 100644 --- a/projects/nxfinance/index.js +++ b/projects/nxfinance/index.js @@ -1,16 +1,25 @@ const { Program } = require("@project-serum/anchor"); const { getProvider, } = require("../helper/solana"); -const nxIdl = require("./nx-idl.json"); +const nxIdlV1 = require("./nx-idl-v1.json"); +const nxIdlV2 = require("./nx-idl-v2.json"); -const NX_PROGRAM_ADDR = "EHBN9YKtMmrZhj8JZqyBQRGqyyeHw5xUB1Q5eAHszuMt"; +const NX_PROGRAM_ADDR_V1 = "EHBN9YKtMmrZhj8JZqyBQRGqyyeHw5xUB1Q5eAHszuMt"; +const NX_PROGRAM_ADDR_V2 = "NXFiKimQN3QSL3CDhCXddyVmLfrai8HK36bHKaAzK7g"; 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()) + const nx_program_v1 = new Program(nxIdlV1, NX_PROGRAM_ADDR_V1, provider) + const nx_program_v2 = new Program(nxIdlV2, NX_PROGRAM_ADDR_V2, provider) + const res = await Promise.all([ + nx_program_v1.account.marginPool.all(), + nx_program_v2.account.collateralPool.all(), + nx_program_v2.account.lendingPool.all() + ]) + + for (let value of res) + for (let { account: pool } of value) + api.add(pool.tokenMint.toBase58(), pool.depositTokens.toString()) } module.exports = { diff --git a/projects/nxfinance/nx-idl.json b/projects/nxfinance/nx-idl-v1.json similarity index 100% rename from projects/nxfinance/nx-idl.json rename to projects/nxfinance/nx-idl-v1.json diff --git a/projects/nxfinance/nx-idl-v2.json b/projects/nxfinance/nx-idl-v2.json new file mode 100644 index 000000000000..deb4ab748646 --- /dev/null +++ b/projects/nxfinance/nx-idl-v2.json @@ -0,0 +1,167 @@ +{ + "version": "0.1.0", + "name": "nx_lend", + "instructions": [], + "accounts": [ + { + "name": "CollateralPool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "nxMarket", + "docs": [ + "Market's pubkey" + ], + "type": "publicKey" + }, + { + "name": "marketAuthority", + "docs": [ + "The pool authority to act" + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": [ + "The token the pool allows lending and borrowing on" + ], + "type": "publicKey" + }, + { + "name": "depositTokens", + "docs": [ + "The total amount of tokens available in the pool's vault" + ], + "type": "u64" + }, + { + "name": "depositNotes", + "docs": [ + "The total amount of notes issued to depositors of tokens." + ], + "type": "u64" + } + ] + } + }, + { + "name": "LendingPool", + "type": { + "kind": "struct", + "fields": [ + { + "name": "nxMarket", + "docs": [ + "Market's pubkey" + ], + "type": "publicKey" + }, + { + "name": "tokenMint", + "docs": [ + "The pool authority to act", + "The token the pool allows lending and borrowing on" + ], + "type": "publicKey" + }, + { + "name": "borrowTokens", + "docs": [ + "The total amount of tokens borrowed, that need to be repaid to", + "the pool." + ], + "type": "u64" + }, + { + "name": "borrowNotes", + "docs": [ + "The total amount of notes issued to borrowers of tokens" + ], + "type": "u64" + }, + { + "name": "depositTokens", + "docs": [ + "The total amount of tokens available in the pool's vault" + ], + "type": "u64" + }, + { + "name": "depositNotes", + "docs": [ + "The total amount of notes issued to depositors of tokens." + ], + "type": "u64" + }, + { + "name": "depositInterest", + "type": "u64" + }, + { + "name": "borrowInterest", + "docs": [ + "Amount of unrepaid interest by borrowers, for loan note exchange rate calculation" + ], + "type": "u64" + }, + { + "name": "protocolFee", + "docs": [ + "10% of interest goes to the protocol," + ], + "type": "u64" + }, + { + "name": "accruedUntil", + "docs": [ + "The time the interest was last accrued up to" + ], + "type": "i64" + }, + { + "name": "utilizationFlag", + "docs": [ + "If the utilization rate is flagged as full" + ], + "type": "u16" + }, + { + "name": "interestRateConfigs", + "type": { + "vec": { + "defined": "InterestRateData" + } + } + } + ] + } + } + ], + "types": [ + { + "name": "InterestRateData", + "type": { + "kind": "struct", + "fields": [ + { + "name": "utilizationRate", + "docs": [ + "y=kx+b x=utilization_rate y=interest_rate" + ], + "type": "i32" + }, + { + "name": "kValue", + "type": "i32" + }, + { + "name": "bValue", + "type": "i32" + } + ] + } + } + ] +} \ No newline at end of file diff --git a/projects/oas-jumbo/index.js b/projects/oas-jumbo/index.js new file mode 100644 index 000000000000..7dc07a7ae8a7 --- /dev/null +++ b/projects/oas-jumbo/index.js @@ -0,0 +1,29 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const CONTRACT_ADDRESSES = { + environmentContract: ADDRESSES.findora.FRA, // Environment contract address + stakesManagerContract: "0x0000000000000000000000000000000000001001", // Stakes manager contract address + oasJumboStaking: "0x7e6347ddC55dF19B94C9FE893bf551CFc8C2208b", // OAS Jumbo staking contract address +}; + +const contractAbis = { + getStakerStakes: { + abi: "function getStakerStakes(address staker, uint256 epoch, uint256 cursor,uint256 howMany) returns (address[] memory validators, uint256[] memory oasStakes, uint256[] memory woasStakes, uint256[] memory soasStakes, uint256 newCursor)", + }, +}; + +module.exports = { + oas: { + tvl: async (api) => { + // Fetch current epoch + const epoch = await api.call({ abi: 'uint256:epoch', target: CONTRACT_ADDRESSES.environmentContract, }); + + // Fetch staker stakes + const { oasStakes } = await api.call({ + abi: contractAbis.getStakerStakes.abi, + target: CONTRACT_ADDRESSES.stakesManagerContract, + params: [CONTRACT_ADDRESSES.oasJumboStaking, epoch, 12, 1], + }); + api.addGasToken(oasStakes) + } + }, +}; diff --git a/projects/obelisk/index.js b/projects/obelisk/index.js new file mode 100644 index 000000000000..c1788b0cbbae --- /dev/null +++ b/projects/obelisk/index.js @@ -0,0 +1,21 @@ +const { sumTokens } = require('../helper/chain/bitcoin') +const sdk = require('@defillama/sdk') + +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const abi = { + getCustodyAddrInfo: "function getCustodyAddrInfo() view returns (tuple(string mark, string btcAddr)[])" +} + +async function tvl() { + const api = new sdk.ChainApi({ chain: 'ethereum' }) + const addrInfos = await api.call({abi: abi.getCustodyAddrInfo, target: '0x9F836f8A27F1579258388BFab16ab16E278B1a2C' }) + const btcAddresses = addrInfos.map(info => info.btcAddr) + btcAddresses.forEach(addr => bitcoinAddressBook.obelisk.push(addr)) + return sumTokens({ owners: bitcoinAddressBook.obelisk }) +} + +module.exports = { + timetravel: false, + bitcoin: { tvl } +} \ No newline at end of file diff --git a/projects/oceanpoint/index.js b/projects/oceanpoint/index.js new file mode 100644 index 000000000000..faa9d512b53c --- /dev/null +++ b/projects/oceanpoint/index.js @@ -0,0 +1,20 @@ +const { staking } = require('../helper/staking'); + +const CONTRACTS = [ + "0x13299657e662894b933Bb3Ee73F7f8dA94b55451", + "0x1802f66868d0649687a7a6bc9b8a4292e148daec", + "0x6f1e92fb8a685aaa0710bad194d7b1aa839f7f8a", + "0x57ba886442d248C2E7a3a5826F2b183A22eCc73e" +]; + +const ERC20_TOKENS = [ + "0x509A38b7a1cC0dcd83Aa9d06214663D9eC7c7F4a" +]; + +module.exports = { + ethereum: { + tvl: () => ({}), + pool2: staking(CONTRACTS, '0x0E85fB1be698E777F2185350b4A52E5eE8DF51A6'), + staking: staking(CONTRACTS, ERC20_TOKENS), + } +}; diff --git a/projects/oceanus/index.js b/projects/oceanus/index.js index cba3392edfe6..58baa650b734 100644 --- a/projects/oceanus/index.js +++ b/projects/oceanus/index.js @@ -1,8 +1,5 @@ -const { staking } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const treasuryContract = "0xF29EEC2563b1E6a1ed87ff7DDfB164474d1Ecb50"; +const { pool2 } = require("../helper/pool2"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const OShareRewardPool = "0xc4a5b1CdCcD8CF80aC7cB5B86Fe5a8D64DBA9D0F"; const lpPool2Addresses = [ @@ -18,30 +15,13 @@ const stakingContracts = [ const OSHARE = "0x28100159d8b2acc4e45ec7ebdb875265bb752385"; const SEA = "0x41607272ce6f2a42732ae382f00f8f9ce68d78f3"; -async function Staking(timestamp, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [SEA, false], - [OSHARE, false], - ], - stakingContracts, - chainBlocks["metis"], - "metis", - (addr) => `metis:${addr}` - ); - - return balances; -} module.exports = { misrepresentedTokens: true, metis: { - tvl: (async) => ({}), - staking: Staking, - pool2: pool2Exports(OShareRewardPool, lpPool2Addresses, "metis"), + tvl: () => ({}), + staking: sumTokensExport(stakingContracts, [SEA, OSHARE], ), + pool2: pool2(OShareRewardPool, lpPool2Addresses,), }, methodology: "Counts liquidity on the Pool2s and Staking parts", }; diff --git a/projects/ocelex-v1/index.js b/projects/ocelex-v1/index.js new file mode 100644 index 000000000000..a061c1757b92 --- /dev/null +++ b/projects/ocelex-v1/index.js @@ -0,0 +1,6 @@ +const { uniTvlExport } = require("../helper/unknownTokens"); + +module.exports = uniTvlExport("zircuit", "0xdd018347c29a27088eb2d0bf0637d9a05b30666c", { + hasStablePools: true, + useDefaultCoreAssets: true, +}); diff --git a/projects/ocelex/index.js b/projects/ocelex/index.js new file mode 100644 index 000000000000..01e0e7e3b41e --- /dev/null +++ b/projects/ocelex/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + zircuit: { + factory: "0x03057ae6294292b299a1863420edD65e0197AFEf", + fromBlock: 3709368, + isAlgebra: true, + }, +}) \ No newline at end of file diff --git a/projects/octopus-finance/index.js b/projects/octopus-finance/index.js new file mode 100644 index 000000000000..c7e73156baff --- /dev/null +++ b/projects/octopus-finance/index.js @@ -0,0 +1,16 @@ +const { yieldHelper, } = require("../helper/yieldHelper") +const { mergeExports } = require("../helper/utils") +const vault = '0xf561349868e5E8b633cfA524796150085Be1950A' +const oc = '0x057153eb8ad87BD483Ff9EC4E411B8C3BcE90FF0' +const abis = { + poolInfo: 'function poolInfo(uint256) view returns (address want, uint256, uint256, uint256, uint256, uint256, uint256, uint256 amount, uint256, address strat)', + poolLength: 'function poolLength() view returns (uint256)', +} +const octopus = yieldHelper({ + project: 'octopus-finance', + chain: 'arbitrum', + masterchef: vault, + nativeToken: oc, + abis, +}) +module.exports = mergeExports([octopus]) diff --git a/projects/oddz/index.js b/projects/oddz/index.js index f180e0708219..d6328c6bdbd3 100644 --- a/projects/oddz/index.js +++ b/projects/oddz/index.js @@ -1,115 +1,20 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -async function getTotalCollateral(pools, chain, block) { - const balances = {}; - await Promise.all( - pools.map((pool) => - sdk.api.erc20 - .balanceOf({ - target: pool[1], - owner: pool[0], - chain, - block, - }) - .then((result) => - sdk.util.sumSingleBalance(balances, pool[2], result.output) - ) - ) - ); - return balances; -} -const bscPools = [ - // pool, token, representation - [ - "0x99f29c537c70897f60c9774d3f13bd081D423467", - ADDRESSES.bsc.USDC, - "bsc:" + ADDRESSES.bsc.USDC, - ], // oUSD -]; - -const bscStakingPool = [ - [ - "0x636f9d2Bb973D2E54d2577b9976DedFDc21E6672", - "0xcd40f2670cf58720b694968698a5514e924f742d", - "bsc:0xcd40f2670cf58720b694968698a5514e924f742d", - ], // sODDZ -]; - -const bscPool2 = [ - [ - "0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", - "0xcd40f2670cf58720b694968698a5514e924f742d", - "bsc:0xcd40f2670cf58720b694968698a5514e924f742d", - ], // sODDZ - [ - "0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", - ADDRESSES.bsc.WBNB, - "bsc:" + ADDRESSES.bsc.WBNB, - ], // ODDZ-BNB -]; - - -const avaxPools = [ - // pool, token, representation - [ - "0x6a165bA195D9d331b2A1C9648328d409aA599465", - ADDRESSES.avax.USDC_e, - "avax:" + ADDRESSES.avax.USDC_e, - ], // oUSD -]; - -const avaxStakingPool = [ - [ - "0xd0A145aF8F200Fc8e4d118c6e4d4a77eE1ba8E2e", - "0xB0a6e056B587D0a85640b39b1cB44086F7a26A1E", - "avax:0xB0a6e056B587D0a85640b39b1cB44086F7a26A1E", - ], // sODDZ -]; - -const avaxPool2 = [ - [ - "0xBAe8Ee2D95Aa5c68Fe8373Cd0208227E94075D5d", - "0xb0a6e056b587d0a85640b39b1cb44086f7a26a1e", - "avax:0xb0a6e056b587d0a85640b39b1cb44086f7a26a1e", - ], // sODDZ - [ - "0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", - ADDRESSES.avax.WAVAX, - "avax:" + ADDRESSES.avax.WAVAX, - ], // ODDZ-AVAX -]; - - -async function bsc(_timestamp, block, chainBlocks) { - return getTotalCollateral(bscPools, "bsc", chainBlocks["bsc"]); -} -async function pool2(timestamp, block, chainBlocks) { - return getTotalCollateral(bscPool2, "bsc", chainBlocks["bsc"]); -} -async function bscStaking(timestamp, block, chainBlocks) { - return getTotalCollateral(bscStakingPool, "bsc", chainBlocks["bsc"]); -} - -async function avax(_timestamp, block, chainBlocks) { - return getTotalCollateral(avaxPools, "avax", chainBlocks["avax"]); -} -async function pool3(timestamp, block, chainBlocks) { - return getTotalCollateral(avaxPool2, "avax", chainBlocks["avax"]); -} -async function avaxStaking(timestamp, block, chainBlocks) { - return getTotalCollateral(avaxStakingPool, "avax", chainBlocks["avax"]); -} - - -module.exports = { +const { sumTokensExport } = require('../helper/unwrapLPs') +const config = { bsc: { - tvl: bsc, - pool2, - staking: bscStaking, + tvl: { tokensAndOwners: [[ADDRESSES.bsc.USDC, "0x99f29c537c70897f60c9774d3f13bd081D423467"]] }, + staking: { tokensAndOwners: [["0xcd40f2670cf58720b694968698a5514e924f742d", "0x636f9d2Bb973D2E54d2577b9976DedFDc21E6672",]] }, + pool2: { tokensAndOwners: [["0x3c2c77353E2F6AC1578807b6b2336Bf3a3CbB014", "0xA3Fc4F2D307d8202468a223f35Bba978114A994C",],], resolveLP: true }, }, avax: { - tvl: avax, - pool2: pool2, - staking: avaxStaking, + tvl: { tokensAndOwners: [[ADDRESSES.avax.USDC_e, "0x6a165bA195D9d331b2A1C9648328d409aA599465"]] }, + staking: { tokensAndOwners: [["0xB0a6e056B587D0a85640b39b1cB44086F7a26A1E", "0xd0A145aF8F200Fc8e4d118c6e4d4a77eE1ba8E2e",]] }, + pool2: { tokensAndOwners: [["0xBAe8Ee2D95Aa5c68Fe8373Cd0208227E94075D5d", "0x8fD9f9AEd3a1a823693580CCcf482A04Db2Ad4f3",],], resolveLP: true }, }, -}; \ No newline at end of file +} + +Object.keys(config).forEach(chain => { + const _config = config[chain] + module.exports[chain] = {} + Object.keys(_config).forEach(key => module.exports[chain][key] = sumTokensExport(_config[key])) +}) diff --git a/projects/oh-finance/abi.json b/projects/oh-finance/abi.json deleted file mode 100644 index 81c99ed36ffd..000000000000 --- a/projects/oh-finance/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "virtualBalance": "uint256:virtualBalance", - "underlying": "address:underlying" -} \ No newline at end of file diff --git a/projects/oh-finance/index.js b/projects/oh-finance/index.js index 5f3915a3d8c0..260b5ee73730 100644 --- a/projects/oh-finance/index.js +++ b/projects/oh-finance/index.js @@ -1,39 +1,47 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abi.json') +const CONFIG = { + ethereum: [ + "0xa528639aae2e765351dcd1e0c2dd299d6279db52", // usdc + ], + avax: [ + "0x8B1Be96dc17875ee01cC1984e389507Bb227CaAB", // usdc.e + "0xd96AbEcf6AA022735CFa9CB512d63645b0834720", // usdt.e + "0xF74303DD14E511CCD90219594e8069d36Da01DCD", // dai.e + "0xe001DeCc1763F8BadBbc1b10c2D6db0900f9B928", // usdc + "0xB3ce618F43b53Cdc12077FB937f9fF465BcE1f60", // usdt + ], + moonriver: [ + "0x4C211F45876d8EC7bAb54CAc0e32AAD15095358A", // usdc + "0xdeA7Ff1D84B7E54587b434C1A585718857CF61d1", // usdt + ], + metis: [ + "0x4C211F45876d8EC7bAb54CAc0e32AAD15095358A", // m.usdc + "0xc53bC2517Fceff56308b492AFad4A53d96d16ed8", // m.usdt + ], +}; + +const abi = { + virtualBalance: "uint256:virtualBalance", + underlying: "address:underlying", +}; + +async function getBankTvl(api, vaults) { + const [investeds, underlyings] = await Promise.all([ + api.multiCall({ calls: vaults, abi: abi.virtualBalance, permitFailure: true }), + api.multiCall({ calls: vaults, abi: abi.underlying, permitFailure: true }), + ]); + + vaults.forEach((_vault, i) => { + const invested = investeds[i] + const underlying = underlyings[i] + if (!invested || !underlying ) return + api.add(underlying, invested) + }) -function getBankTvl(bankAddress, chain){ - return async (time, ethBlock, {[chain]: block})=>{ - const invested = await sdk.api.abi.call({target: bankAddress, block, chain, abi:abi.virtualBalance}) - const underlying = await sdk.api.abi.call({target: bankAddress, block, chain, abi:abi.underlying}) - return { - [chain+":"+underlying.output]: invested.output - } - } } -module.exports={ - ethereum:{ - tvl: getBankTvl("0xa528639aae2e765351dcd1e0c2dd299d6279db52", "ethereum"), // usdc - }, - avax:{ - tvl: sdk.util.sumChainTvls([ - getBankTvl("0x8B1Be96dc17875ee01cC1984e389507Bb227CaAB", "avax"), // usdc.e - getBankTvl("0xd96AbEcf6AA022735CFa9CB512d63645b0834720", "avax"), // usdt.e - getBankTvl("0xF74303DD14E511CCD90219594e8069d36Da01DCD", "avax"), // dai.e - getBankTvl("0xe001DeCc1763F8BadBbc1b10c2D6db0900f9B928", "avax"), // usdc - getBankTvl("0xB3ce618F43b53Cdc12077FB937f9fF465BcE1f60", "avax"), // usdt - ]) - }, - moonriver: { - tvl: sdk.util.sumChainTvls([ - getBankTvl("0x4C211F45876d8EC7bAb54CAc0e32AAD15095358A","moonriver"), // usdc - getBankTvl("0xdeA7Ff1D84B7E54587b434C1A585718857CF61d1","moonriver"), // usdt - ]) - }, - metis: { - tvl: sdk.util.sumChainTvls([ - getBankTvl("0x4C211F45876d8EC7bAb54CAc0e32AAD15095358A", "metis"), // m.usdc - getBankTvl("0xc53bC2517Fceff56308b492AFad4A53d96d16ed8", "metis"), // m.usdt - ]) - } -} \ No newline at end of file +Object.keys(CONFIG).forEach((chain) => { + const vaults = CONFIG[chain]; + module.exports[chain] = { + tvl: (api) => getBankTvl(api, vaults), + }; +}); diff --git a/projects/ohmw/index.js b/projects/ohmw/index.js index 15fa36da8118..e25c32f5dcde 100644 --- a/projects/ohmw/index.js +++ b/projects/ohmw/index.js @@ -1,7 +1,10 @@ +const { deadFrom } = require("../mosquitos-finance"); + module.exports= { hallmarks: [ [1670457600, "Rug Pull"] ], + deadFrom: 1670457600, ethpow: { tvl: () => ({}), } diff --git a/projects/okcoin/index.js b/projects/okcoin/index.js index c3ec17a84c5e..bc7d9f051bab 100644 --- a/projects/okcoin/index.js +++ b/projects/okcoin/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -13,10 +14,7 @@ const config = { ], }, bitcoin: { - owners: [ - // we only added wallets with more than 0.1 BTC - "bc1q2s3rjwvam9dt2ftt4sqxqjf3twav0gdx0k0q2etxflx38c3x8tnssdmnjq", - ] + owners: bitcoinAddressBook.okcoin }, tron: { owners: [ diff --git a/projects/okex/index.js b/projects/okex/index.js index 0c715e9c570f..497d554ac6fb 100644 --- a/projects/okex/index.js +++ b/projects/okex/index.js @@ -1,194 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { - bitcoin: { - owners: [ - '1LnoZawVFFQihU8d8ntxLMpYheZUfyeVAK', - '1JQULE6yHr9UaitLr4wahTwJN7DaMX7W1Z', - '1DcT5Wij5tfb3oVViF8mA8p4WrG98ahZPT', - '1CY7fykRLWXeSbKB885Kr4KjQxmDdvW923', - 'bc1quhruqrghgcca950rvhtrg7cpd7u8k6svpzgzmrjy8xyukacl5lkq0r8l2d', - '16rF2zwSJ9goQ9fZfYoti5LsUqqegb5RnA', - '1FY6RL8Ju9b6CGsHTK68yYEcnzUasufyCe', - '1MbNM3jwxMjRzeA9xyHbMyePN68MY4Jxb', - '1Lj2mCPJYbbC2X6oYwV6sXnE8CZ4heK5UD', - '178E8tYZ5WJ6PpADdpmmZd67Se7uPhJCLX', - '1BsdDaJtgFZrLfzEXvh6cD4VhtHHSHhMea', - '14kHu26yWkVD8qAnBfcFXHXxgquNoSpKum', - '1AumBaQDRaCC3cKKQVRHeyvoSPWNdDzsKP', - '1DnHx95d2t5URq2SYvVk6kxGryvTEbTnTs', - '13rCGm4Z3PDeYwo5a7GTT4jFYnRFBZbKr1', - '15Exz1BAVan4Eweagy1rcPJnfyc6KJ4GvL', - '18QUDxjDZAqAJorr4jkSEWHUDGLBF9uRCc', - '1M6E6vPaYsuCb34mDNS2aepu2aJyL6xBG4', - '1CE8chGD6Nu8qjcDF2uR1wMKyoWb8Kyxwz', - '1FTgXfXZRxMQcKSNeuFvWYVPsNgurTJ7BZ', - '13jTtHxBPFwZkaCdm6BwJMMJkqvTpBZccw', - '1FfgXrQUjX5nQ4zsiLBWjvFwW61jQHCqn', - '1DVTB9YKi4KNjyEbAHPp17T8R1Pp17nSmA', - '162z6mSSHzfTqb2Sn3NUk5r1Y2oGoCMCoM', - '3KbDzhb8B5pUU7Wk1y26J8D4cxYLmxJsca', - '3A8tCFwWyHQey1npTAWYTtrjLPKLXpSpLd', - '33a278YeJBRvQuemSo6yeugafqdS4x98TM', - 'bc1qc3g2dx3fn9s27v92n555r2tzhkxhad2wc0wm0ahlgpmhsr325mpssz80s6', - '3ABQAsnVgK8gDCBtWeEuoRvG3zdgABrDHQ', - '3AWGaggM87Nnhit5DwYYfXyvzW1NYutCw2', - '3QLVSDvh1r9u28PDWUDyg3nR7HqxrUZ4jA', - '3QFtYbR22en2AizTb7JVFA9bL2rf1fbNJr', - 'bc1qrp6msfnqxrl2gp4phmq6mcz995xc6m8n6fn8nygjfg8p63ncy4gsp3xn0e', - '31qq3eDdNyvyoDGrNYAAN5GU2BagDNANFf', - '3BdEq8vnX1o1J4Zpwj6wkPh5FxrgxLAibr', - '3AVMfb3vJi9CbQEGyoHmpgptgbJioyKykQ', - '3MYUxfT4mx8imVz7R8bVs71NisrYnmjUbT', - '3FS1EFCqZM7KEhsVoiNu7NC8658Kq4oCiY', - '3BiWZUFxpjJN6W93Fz3aCcCPBTrpYWwyoS', - '3NiufwUuJZnUHmgSopESaeLBJkALzJMcgk', - '3JcWcMPtxGaCuhKeucTMe1V865t7UhrNnT', - 'bc1qh0w73elagqvhfkkulrah0s2epdp922d3e6r8w43uz0e8ujafcjeqcz8lwa', - '3MWakirPr7MnizUAtWuDJmt919PZciSBvi', - '3LEV2xDk8D7uy4PVEGFZUm9fcT6XvCvHen', - '3FR7ZCHv26jaWWzv7EBPAXGgBpFuVFUnH3', - '38X48VjATu2AHowPzHefNqVvKyheGzVv8k', - '3AgGgHDcqd9sxYiagskZH3EPswwqza1TXd', - '3CGKuMZrkQQd4zj8FsTmDhineKACFpQBZX', - '32hhwGNtGTZ4J1LLz7p6o55Kxm7mzgREJ4', - '3E9GBso3ipQb2fbT3PNbeqgj8RkgJcR4X5', - '34MdsKf8zE6NeAy98TS1yxUTEoBkDT2ZwZ', - '3J7F1pczapCk1sRef6Hmvh9NfU6QiV3w55', - 'bc1qdk55vq5vrzt44pn93t9e3rwecw2dy4pcwc5gwugdjm3sh9xuqu3qzcwt4h', - '3PDMVx1YRhySaPEtCV2AT1aEq9DwgPU4uq', - '33j5fuJc14aff3Z6vHZBxaHEKMdNmKbRxQ', - 'bc1qvg6drx4rdcv85pteka94eskh740wrtgulg3tp7gcmm43vgund4sss4vzyq', - '3QUyiuBQF46KAMM7wdnDnu8GKVQYieRQ1N', - '35D2tNKFmqiVrvXan6tdxgatZoCBimASmZ', - '35Wvz1krBwzgQ7REXS7iJp3Qz7k3rmFNNF', - '3LMYZ3jPoKW2jscuT8fj8Nh4d66W3uX8us', - 'bc1q37nz0uheu4997ufs84efw7jw248mk9v83sgpmvsr6nawhaadx5lq2hclpt', - '3Mkfqxh6BuYCAiKxuvVWKn64N2xvReB3wM', - '3ANAufFoSaVJefhAZ7h9qViqdfJKoCWvbC', - 'bc1qnw79hhts8r84gykqkctyhu3j4gckll9gqxktzqgx5a54m347zf7qxhcyn8', - '3MYrRpUhNWxB8Ydk9gvMou5yZNtXNynxcT', - '3LFcssbNQRmRCCEUSbpDA5yzhsFH5waDoe', - '3NEwT3x6nrab6Wxddwb7jbWY8KYqJkewGA', - '35uFYLvWLQuEo6GxSGHT8JigaoUyqmNJjE', - '3DWvnsbAJJTLufQ4AhQY7LsVQrKoLjEHXQ', - '3PdNS2nqeE6G7cTcVmGjAVjz6HaPcX2FGj', - 'bc1qwkkedj4nzep7dw05s335x6n23520eq955mpcwypftn5q4n9japmqejkxlp', - '3Qae3YK3eKSoM57jpVYjvWkS7E2KnPFHSU', - '34HVDP9RFA9MpopGQ4TutLLVMFhhJFM9AX', - '39ZEaLMDxWi5EWx9cQ2W3ixDP8rWHhz8GY', - '39XwkmkcMAakYG9E564F6RZcp1RSMhUw8X', - '3QpVtFcEdVPTWqZbo8cSZwRgbHMbSEDoeP', - '3PHu7Z1dtRYbeum2SNWFCA4Fmq8r3UeXdQ', - '39AabFsw5ew4QcAC7zpeNkuk58FoZnJkvy', - '3NXxvFdsXK8DPRuGKbhNsvtP5FoL1s6hzF', - '3Jg623UZuqvvFLYbBsqqYiBCAyWUQUDG8k', - '3DgW9QH2GoVVoqwJd3paooAScy2vusEJDu', - 'bc1q8nne4amt4wjdaa0yxuzyw949xjd7fh2w9whh4uvh6haf6c5n2kvswnxk0e', - '38jFY6wBwBpFHtM4L88jF5o155SRVvr2wT', - '3CtTopUBx6QZomCjQDvbW65RtgsWn8g9LS', - '3KPPCAsWf6dxamkMBTeH2svaTVS7xgeL9q', - '3HoEwvrqYRnrizFN7gTg5ouSbV3Tek9pab', - '33yFzhVfaY9phULdN8kBfz2UfyUVZhFHNH', - '3Akts59LQNb7GU3gtHQcxh2r9zDfyUE2FJ', - '3EdYLLYiYpoLt9sEQ9KQQ3LbF56YRoiFPw', - '3GGLdxjaqvaguzTX9z4UTYaCoeu6sUyvNi', - '3M8Xbr9vobCoxMCWwxsS9doTP6HNQvx3op', - '3LcquVjVeDpFn1oJBs6mu2H5cc3EVCcJ2i', - '34Nr2xntQYxtnBARQmzswbuB1hNhnKvkoV', - '373oyKosqPkcYEsF7ipbw13WwDmvoNGgpG', - '34dhaAMB9sCBidT1LpjpbmZjkecsDpGhxH', - '3NRgSpzcsGA5mkjKinjTgBzfBYc9CBGXwW', - '3FMAKm9fEXfNXYtb6qBGaJvG3DRKtvPy5E', - '365S7mJV4MVqBfutYw65KuURCiohnMhzWh', - '3JJ4LULa6VtcVVxZC9tsNN9JM693mcrCeE', - '3CB7RwASFyWfYNCSWrri8crPhfK6yynMQ9', - '3HzYEwURshSeJZJn1ak5ioHKQV5rfZPXY8', - 'bc1qvusjx72vh3qkvw36jdqvl6sdye8ne8hfdaveejprj6xc24mpd8wsrf6w07', - '36U5xAL6FzFetzebPNT1ZQnANEk1TurVJr', - '3LkDsn4LZgYnMqZF2wAXCVs6kc72xpNLLz', - '3Gmt31zvMb52fJRRvLV3Pr3XTeDvVjGHAr', - '3DdCY3f5Ky92nSen5M2M2bzbBLUhMWafG6', - 'bc1qck2mvm6wp8xqxlk98eyl89kgwtmgw02cgqwsjstkg4uerqpqclxq6se9wu', - '3BexyYLsJQuN96qDRsnrU9yACnUSxxjWXx', - 'bc1qt5t0qhww0w7uaczxn9du7yu2l2hgpnen06r42u98du3cs6tqvezqatj38e', - '36PCQLrcXhNG3BZPeaND3zCW7cHgzDVYp3', - '3KGGtqwaQahxaN4GovThCyNdg6THK17Lrv', - '3FLnTqeKpK8CXiEA39b77pCT85sVWJXzN5', - '3AL5dD3jvpDHu8Qn7yZxGdpztWxieKxF4R', - '3G7e21FgygBmWDRMykauLANpuBK8iKqXpJ', - '3Kg2JcNnBczmHSX3udTfrKdqDy1gkrVZak', - '3QJBNEMY6TezfEBXGoc5PUKoLSCcWUd1Y5', - '3QQ8Cotsxbs9qrAyqLKaPjofzvcy5qipCY', - '34SG5K1QrntsigARCZJxNv8NwfSmQxPsDi', - '37Pd5nJZyXwjoGSwKW3ivWfeaW8VSjCey4', - '39J18vgfymGnJ2EYp6fb13rHNKBASbuMtf', - '3JwZq9s3yBhi8FikgYu2RvhjyBAhnSiLgy', - '3H4T7yRpphtyzpDUEiwBTtBa3fBMvHaKUZ', - 'bc1qrysu5ykl5pdlk7d9j0z5rwak5h9rus6cx2udc0s9tqhf5842nqgsdtgtly', - '3JqwqaLxqnDqXuJuKKp41UFSiFR1CuqznP', - '3JqzTCvFxye7nrVWGTBH2CNqZ7bbFppBww', - '3KWKbaAsf5qmbyBHXnVH6YqBgP4ZcNkUsc', - '3FbmQz3WvASHgCQUz3C2JmGdkd1gQFLdC2', - '3FMrfjg6zD3CTXSHLAiRcn3RFyBR8MMFR9', - '3KeFqqpbJawWvAudsi4q8Zx9Lewponyyht', - '32G39DN4kb9Sd6hk8RKySDf1QVFmQeAwtU', - '3BqZtfY5wZk7qHQaQJ4gBmqGLnakH8ybRy', - '3K1WNLse7M28jbowGsZmNaMV9FsM9yW3fE', - '351qZH3E9rwXg5ZDY3tgvsYhkm9CnYV25N', - '321DUXbk9gEEKG72DU2TcADDyfZXkX3fHP', - '3E5jAXsSi5x7oj6GQuM6WQPuVZaXeYd3sU', - '3HEBzhigBkmhVf7kx1KFXif42AqQWr8KH6', - '39smXTQdqD2W767ipLishHV4diSV4xNFxA', - '3GQ4DGB2tfS6YrwfVg9MF7KBRCLWkugLWR', - '3AEKc9AokfB1nBvsdS8LVFJysZSQBJRrny', - '3G3Sis7s9Jjex2Pcaerh17HvSJ19qHNuMg', - '33YfoFAdobotJkMPUqSh2ms9frvRRfRzpu', - '3G38Zn3mvixfamrKJJtsubiEL5gCQAGnSo', - '3KTFyMGHcjWjWE1UqZRM3T4WnHuQt95iRo', - '3JQmpJYkZrVczaNDCyQoLe6JXV3vGFY8ce', - '36EMwG1FHCrp2MLm474CnE9rTQDWFF1uTF', - '392Bq5jWV8NWUTdV59VCqoYviY5KP9q9Ee', - '3G1no1sZwQuNYd5H3m6seWw9oy4E4Yu1pP', - '3K376tvxysV4XDtTTEUF47Xc8LHdjof6kR', - '39ciFiDp9yj1vLSxHh6c13DiVFhcBab7NT', - '3DUGtYyorAm9vhpo3KbMURMiR2CByP6BoM', - '3DeCWk98Wp6bG9apmqCCqTfRc8uVdQ1vyw', - 'bc1qpkgxexfg8ah0j0ffk3ge3d4para29r8ugx02ch7daja3s8u4247qw2d2jq', - '3BnCzXEqQi7VDMfCaGY9zbSySuy5uQUaRp', - '3GkiKw8DBm3nSqjL1mZLJdp4yq6WEkkyoR', - '3LTvYTkSk2jq4a6mPVMadJ9vzv1V6RMDGq', - '34Fg3q75hcnjyCoL5FLPKaDM1bewFCPKsv', - '357DauGAnsbGpMgAApUqTFHCgyE2kXA9SD', - '3K1sq7TwuVEbvyADV2oNz6DYX2EhWSrVxC', - '3LWHs1HvAF362RHUc6MKL4jUPWcTw382pj', - '35oBhEfzDyCMz4KY6j49iu8xjtbHQ9GL7H', - '3CZTmeG25AXcjYurJ59mcFR3BvS4onF61M', - '3C766rkZjRvmvhGmyGeH2x33ciUrZHarvE', - '3DXZB5fAv4ujHv3dfBPnU6qaDR4HDUEuwY', - '3LnMEFH8kYMeZ8d524cj4RgXMVmniHaBSF', - 'bc1q2gp7s58gf75sg5g8v6ah8z90ghk8dqksa62u27gmz850cnaclshsfjvlr0', - '3Ca537VX1HufiVRfKVogWcD85RV3iuFs53', - '3BxyyKih6788xBQKk8aMg1cD3qP1x7Gqgr', - '3LceSbWiDHYvy59BW2swjiEQZkqvaijcsz', - '3MjPfBpz8oDcEJZphpBuiwRnvCAASFsgT1', - '3DdvsQoGp4wtvCAbyNBEZjCoWoWQL6TssG', - '32ZB86r6jT4DkAtnYYSHP99xtcai8LePLP', - '36yNiwCxiEtubUpzBLGPeSBCbubCy9i3QW', - '3GQUyZH3EPoaHFzjWr5peAKSQFNGxxmVw1', - '37wL3HQgir55T4o2Lv4Ygrsgat5W7iPnnd', - '38qt6S3zQKizRnafitwEdz4dTj1fx72dgY', - '3EqD1B8pMgdRE9iPEgUXAzpcyxihW4tbgA', - '3P7a4wgoTDKn8F2g2VB62pHiV22XzJGGbd', - '3FyaksZvXsZxEShwdpNMK7awgDE4kBuKmN', - '36CVsC2nLzvFejTuBXvCFnt3p5QsKaGzwh', - '3BjsuL5pVVWBFSMtoB9cg2d2hsJzJFpo3B', - '34w5Da4HJ54AWTZVo8JrujhV1v8iRZho3e', - '3DuUe32HgxGg8RQ5sFk9drcKRVmwNCAHhV', - '3MoQyLh75Niz1s573waSP8pc95sqQcdJXd', - '3Bvj92ASRnTnqj9kdABSgXJgrBDy6XEgzq', - ],//BTC DONE - }, + bitcoin: { owners: bitcoinAddressBook.okex }, ethereum: { owners: [ '0x03ae1a796dfe0400439211133d065bda774b9d3e', @@ -566,7 +381,12 @@ const config = { owners: [ '0x834d639b10d20dcb894728aa4b9b572b2ea2d97073b10eacb111f338b20ea5d7' ] - }// + }, + starknet:{ + owners: [ + '0x0269ea391a9c99cb6cee43ff589169f547cbc48d7554fdfbbfa7f97f516da700' + ] + } } module.exports = cexExports(config) diff --git a/projects/olafinance/index.js b/projects/olafinance/index.js index 4b62fa29928a..d4246edb8dac 100644 --- a/projects/olafinance/index.js +++ b/projects/olafinance/index.js @@ -1,13 +1,5 @@ -const {usdCompoundExports} = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') -const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" - -const abis = { - oracle: "address:getRegistry", - underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", - } - - -module.exports={ - fantom:usdCompoundExports(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) +module.exports = { + fantom: compoundExports2({ comptroller: '0x892701d128d63c9856A9Eb5d967982F78FD3F2AE'}) } \ No newline at end of file diff --git a/projects/olympus/index.js b/projects/olympus/index.js index 2a83b091b661..f3713bd1ac6a 100644 --- a/projects/olympus/index.js +++ b/projects/olympus/index.js @@ -31,7 +31,7 @@ const addressMap = { "0xb23dfc0c4502a271976f1ee65321c51be2529640": "0x76fcf0e8c7ff37a47a799fa2cd4c13cde0d981c9", //aura50OHM-50DAI -> 50OHM-50DAI "0xc8418af6358ffdda74e09ca9cc3fe03ca6adc5b0": - "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0", // veFXS -> FXS + ADDRESSES.ethereum.FXS, // veFXS -> FXS "0x3fa73f1e5d8a792c80f426fc8f84fbf7ce9bbcac": "0xc0c293ce456ff0ed870add98a0828dd4d2903dbf", //vlAURA -> AURA [ADDRESSES.ethereum.vlCVX]: diff --git a/projects/omniprotocol/index.js b/projects/omniprotocol/index.js index 8ba29232f9a3..f06775fd7ac7 100644 --- a/projects/omniprotocol/index.js +++ b/projects/omniprotocol/index.js @@ -14,4 +14,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2022-07-10')/1e3), 'reentrancy hack'], ], -}; \ No newline at end of file + deadFrom: '2022-07-10', +}; + +module.exports.ethereum.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/ondofinance/index.js b/projects/ondofinance/index.js index 5db659f803a5..2b4705d921b2 100644 --- a/projects/ondofinance/index.js +++ b/projects/ondofinance/index.js @@ -1,4 +1,5 @@ -const { getTokenSupply } = require("../helper/solana"); +const ADDRESSES = require('../helper/coreAssets.json') +const { getTokenSupplies } = require("../helper/solana"); const sui = require("../helper/chain/sui"); const { aQuery } = require("../helper/chain/aptos"); const { get } = require("../helper/http"); @@ -30,7 +31,10 @@ const config = { USDY: "0xcfea864b32833f157f042618bd845145256b1bf4c0da34a7013b76e42daa53cc", }, noble: { - USDY: "ausdy", + USDY: ADDRESSES.noble.USDY, + }, + arbitrum: { + USDY: "0x35e050d3C0eC2d29D269a8EcEa763a183bDF9A9D", }, }; @@ -49,14 +53,8 @@ Object.keys(config).forEach((chain) => { tvl: async (api) => { let supplies; if (chain === "solana") { - supplies = await Promise.all(fundAddresses.map(getTokenSupply)).catch( - (error) => { - throw error; - } - ); - - const scaledSupplies = supplies.map((supply) => supply * 1_000_000); - api.addTokens(fundAddresses, scaledSupplies); + supplies = await getTokenSupplies(fundAddresses) + api.addTokens(Object.keys(supplies), Object.values(supplies)); } else if (chain === "sui") { let usdySupply = await getUSDYTotalSupplySUI(); api.addTokens(fundAddresses, [usdySupply]); @@ -72,25 +70,12 @@ Object.keys(config).forEach((chain) => { 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}`); + const res = await get(`https://rest.cosmos.directory/noble/cosmos/bank/v1beta1/supply/by_denom?denom=ausdy`); api.addTokens(config.ethereum.USDY, parseInt(res.amount.amount), { skipChain: true, }); } else { - 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); - } + supplies = await api.multiCall({ abi: "erc20:totalSupply", calls: fundAddresses, }) api.addTokens(fundAddresses, supplies); } - return api.getBalances(); }, }; }); diff --git a/projects/onsenswap/index.js b/projects/onsenswap/index.js index a5ca229177f4..2e76f4eeae30 100644 --- a/projects/onsenswap/index.js +++ b/projects/onsenswap/index.js @@ -7,7 +7,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x0E15a1a03bD356B17F576c50d23BF7FC00305590", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/onx.js b/projects/onx.js index c29a45c357f2..a42c16f5307e 100644 --- a/projects/onx.js +++ b/projects/onx.js @@ -1,7 +1,232 @@ -const { ethTvl, getEthereumStaking, getEthereumPoolTvl, getEthereumBorrows, } = require('./config/onx/ethereum'); -const { vaults: fVaults } = require('./config/onx/fantom/vaults'); -const { vaults: pVaults } = require('./config/onx/polygon/vaults'); -const { vaults: aVaults } = require('./config/onx/avalanche/vaults'); + +const { staking } = require('./helper/staking') +const ADDRESSES = require('./helper/coreAssets.json') + + +const config = { + polygon: { vaults: [ + //dualMaticUsdc + ['0x6e7a5fafcec6bb1e78bae2a1f0b612012bf14827', '0x36D14424Cc5a18893e93A0f8FdD42DC40562887E'], + //dualMaticEth + ['0xadbf1854e5883eb8aa7baf50705338739e558e5b', '0xfe51dE20719d05152Ace63a069446Bb5C89511DB'], + //dualMaticUsdt + ['0x604229c960e5cacf2aaeac8be68ac07ba9df81c3', '0x067E7586Eb8733bF108167C15cBAbee4c629C37A'], + //dualMaticQuick + ['0x019ba0325f1988213d448b3472fa1cf8d07618d7', '0x849031F78970639F8Dc9Dc3E962e0d0079D1051c'], + //EthUsdc + ['0x853ee4b2a13f8a742d64c8f088be7ba2131f670d', '0x185A1cfdb7173b224d08E61F1Cb21Fd5Fd6ee8CD'], + //wBtcEth + ['0xdc9232e2df177d7a12fdff6ecbab114e2231198d', '0xf1ba3ef65262ee4058462e65a3a09a7571193400'], + //ethUsdt + ['0xf6422b997c7f54d1c6a6e103bcb1499eea0a7046', '0x353856185fBB65a098b971B6d492CC3c245D9a59'], + //quickEth + ['0x1bd06b96dd42ada85fdd0795f3b4a79db914add5', '0x9767218525A443AE1B04A2a84Cf2f6D646C2fA06'], + //aaveEth + ['0x90bc3e68ba8393a3bf2d79309365089975341a43', '0xbB760a23924a23e5270c659349c753d16e7C1078'], + //ethDai + ['0x4a35582a710e1f4b2030a3f826da20bfb6703c09', '0x0d553115D2c1E2b734d66De1Eba4BAe1a88cB175'], + //wbtcUsdc + ['0xf6a637525402643b0654a54bead2cb9a83c8b498', '0x248Eecc8286A8C6484B4A87e1F32f0bc2d7971D4'], + //linkEth + ['0x5ca6ca6c3709e1e6cfe74a50cf6b2b6ba2dadd67', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], + //usdcQuick + ['0x1f1e4c845183ef6d50e9609f16f6f9cae43bc9cb', '0x7E9dA60002dAF64778C78Ac90dD5bdc9391acb00'], + //usdcUsdt + ['0x2cf7252e74036d1da831d11089d326296e64a728', '0x1a130be9a0E9046936E5461D3e8727b6aF7d0C2C'], + //avaxMatic + ['0xeb477ae74774b697b5d515ef8ca09e24fee413b5', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], + //solMatic + ['0x898386dd8756779a4ba4f1462891b92dd76b78ef', '0x0A1EfAF7dd833F9D8EF9f2f095bf1d6C725FF110'], + //bnbUsdc + ['0x40a5df3e37152d4daf279e0450289af76472b02e', '0x43bE6849BC355735D77238AcfDBcEB7bE8673f02'], + //ftmMatic + ['0xd2b61a42d3790533fedc2829951a65120624034a', '0xF020de990036D5aE107860592Bde0E53892F1531'], + //daiUsdc + ['0xf04adbf75cdfc5ed26eea4bbbb991db002036bdd', '0x260e6fB68C787CdA2E9ea104f9e3a3923E4119f6'], + //daiUsdt + ['0x59153f27eefe07e5ece4f9304ebba1da6f53ca88', '0x32B750721Ad93f62b21402526354d53ac46953C2'], + ] }, + avax: { vaults: [ + //usdcAvax + ['0xa389f9430876455c36478deea9769b7ca4e3ddb1', '0x8025d4deDa0C7512d44438a7DC597612B4108F07'], + //wethAvax + ['0xfe15c2695f1f920da45c30aae47d11de51007af9', '0xf7AcA362510b327bDAca693611353b6a837cBDB2'], + //avaxUsdte + ['0xed8cbd9f0ce3c6986b22002f03c6475ceb7a6256', '0x897Fb124aCdF5A685d9258645ffee0058464817A'], + //joeAvax [not available] + ['0x454e67025631c065d3cfad6d71e6892f74487a15', '0x02e9bc3EF29A3f51EdE6e4c4F70fdcb894CD6Cf5'], + //wBtcAvax + ['0xd5a37dc5c9a396a03dd1136fc76a1a02b1c88ffa', '0x8922E41342C6160fAf4dC40f2c1fCFCd94E98779'], + //linkAvax + ['0x6f3a0c89f611ef5dc9d96650324ac633d02265d3', '0x55F42961b3aD4E2A08f1780C7434dd8EC5f7FcE4'], + //joeUsdce + ['0x67926d973cd8ee876ad210faaf7dffa99e414acf', '0xD9F63Cc588822cD3eF802D900808E946d13CE609'], + //bnbAvax + ['0xeb8eb6300c53c3addbb7382ff6c6fbc4165b0742', '0x4decafaCD4591e52f85e8FE69F82F2400176BB33'], + //joeUsdte + ['0x1643de2efb8e35374d796297a9f95f64c082a8ce', '0xfD127Bc3b6153b043fFD8d7f38272593700b124c'], + // //spellAvax [not available] + ['0x62cf16bf2bc053e7102e2ac1dee5029b94008d99', '0x9eE877279DFE8e5F20614db88e50CD72B4efDEAD'], + // //xavaAvax [not available] + ['0x72c3438cf1c915ecf5d9f17a6ed346b273d5bf71', '0x54720637Fa477eD87Cd06F674247a649A5168eB6'], + //linkeUsdce + ['0xb9f425bc9af072a91c423e31e9eb7e04f226b39d', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], + //wethUsdce + ['0x199fb78019a08af2cb6a078409d0c8233eba8a0c', '0x2C858E3181988f2E4458f14768aE204E5BF2Ee0e'], + //pefiAvax [not available] + ['0xb78c8238bd907c42be45aebdb4a8c8a5d7b49755', '0x276F74C24Cc4443Ecb4967Db77572BE50aeD4117'], + //wbtceAvax + ['0x62475f52add016a06b398aa3b2c2f2e540d36859', '0x008E6bf114D686713dC233487e360A158433e519'], + //aaveAvax + ['0xc3e6d9f7a3a5e3e223356383c7c055ee3f26a34f', '0xE7c34e1946A10a3A28BEd4B0Cb5B7F0d85F5368D'], + //qiAvax + ['0x2774516897ac629ad3ed9dcac7e375dda78412b9', '0x0240269d999301d03aAe390104584F7517f52ECd'], + // //avaxBoo [not available] + ['0xebf50b8089a0c5e7c5de23f644fcd723818f65b3', '0xB4a805Ad532BB92501507C9eAc27FD0BAe4d68A1'], + // //maiAvax [not available] + ['0x23ddca8de11eccd8000263f008a92e10dc1f21e8', '0x2071fD6779B701aa71c4a48b8f37970160e5FE75'], + // //h20Avax [not available] + ['0x9615a11eaa912eae869e9c1097df263fc3e105f3', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], + ] }, + fantom: { vaults: [ + //xBoo + ['0x841fad6eae12c286d1fd18d1d525dffa75c7effe', '0x95d0d6A7D75A5b086d2823C38F6Dd80a50fD0d93',], + //BooFtm + ['0xec7178f4c41f346b2721907f5cf7628e388a7a58', '0x62CA6F1640776070ECa70E09d9AF27352a43a5D8'], + //UsdcFtm + ['0x2b4c76d0dc16be1c31d4c1dc53bf9b45987fc75c', '0x6b42A98af10C2E94a6951c94b8Ac5B5EEB23c8AF'], + //fUsdtFtm + ['0x5965E53aa80a0bcF1CD6dbDd72e6A9b2AA047410', '0xC033338F7605B1555b1d3FC2a3626b2b76a0E042'], + //DaiFtm + ['0xe120ffBDA0d14f3Bb6d6053E90E63c572A66a428', '0xf1Ba3EF65262ee4058462E65A3A09a7571193400'], + //btc + ['0xFdb9Ab8B9513Ad9E419Cf19530feE49d412C3Ee3', '0x0f16CBDaF6c8115cDde59876cF232903E95D488A'], + //eth + ['0xf0702249F4D3A25cD3DED7859a165693685Ab577', '0x7396241a8a45E6252A2b5bBB571CBdfF599E16F1'], + //link + ['0x89d9bC2F2d091CfBFc31e333D6Dc555dDBc2fd29', '0x8D20fB2F4F96E897Fed7E3E50f8A403aFc59dA23'], + //aave + ['0xeBF374bB21D83Cf010cC7363918776aDF6FF2BF6', '0xE663F7d6AFB3A3Ef458D5c4a068E29368a46Eb87'], + //sushi + ['0xf84E313B36E86315af7a06ff26C8b20e9EB443C3', '0x32B750721Ad93f62b21402526354d53ac46953C2'], + //crv + ['0xB471Ac6eF617e952b84C6a9fF5de65A9da96C93B', '0x424B1AE0AF693d4577dde25081E970cb656013C7'], + //bnb + ['0x956DE13EA0FA5b577E4097Be837BF4aC80005820', '0x1fA1B8D94B922e3C9821f66363a75237c36096af'], + //any + ['0x5c021D9cfaD40aaFC57786b409A9ce571de375b4', '0xE41718b549B935358A2f62acbD289F3dcccABB18'], + //mim + ['0x6f86e65b255c9111109d2D2325ca2dFc82456efc', '0xfB271303B157d2e3d91CF86C7956eb46180d62E5'], + //yfi + ['0x0845c0bFe75691B1e21b24351aAc581a7FB6b7Df', '0x4CddFEf40f13F16520b7f98f269f772560A8fb9a'], + //btcEth + ['0xEc454EdA10accdD66209C57aF8C12924556F3aBD', '0x58bC3B5949C6784819A606645d616D8D2dA7594B'], + //spell + ['0x78f82c16992932EfDd18d93f889141CcF326DBc2', '0x4aFa2C780d0d2b139886A532d1D1959f4D316ee7'], + //joe + ['0xd518737Ff601c2A7C67F55EbbEb0a4e3fF5C0C35', '0xbE0093F744287Ea0478cc75c6320043a8b79E845'], + ] }, +} + +async function tvl(api) { + const { vaults } = config[api.chain] + const pools = vaults.map(i => i[1]) + const tokens = vaults.map(i => i[0]) + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) +} + +const tokenAddresses = { + onx: "0xe0ad1806fd3e7edf6ff52fdb822432e847411033", + sOnx: "0xa99f0ad2a539b2867fcfea47f7e71f240940b47c", + onxFarm: "0x168f8469ac17dd39cd9a2c2ead647f814a488ce9", + onxTripleFarm: "0x30D1A19EA928cCf46634cBC2944D2D89Be636f22", + onxWethSushiPair: "0x62f22A47e5D2F8b71cC44fD85863753618312f67", + pool: "0x47F3E6C1Ef0cBe69502167095b592e61de108BaA", + aethToken: "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", + onsToken: "0xfC97C0c12438B6E4CF246cD831b02FeF4950DCAD", + oneVault: "0x3BdF1977d87EDAD8e0617efCEa958F6d43A4C30E", + onePools: [ + '0x54c532E367031F56c401C6024aC4ABEfF2b03534', + '0xbc2346C3c7F3998A12A1c8E7Be44734EcC832763', + '0xe64796FCc97c33A2193Ba60f013F3fA5D4712d56', + '0xe659fA84e0C687760245046BA63329d44320997c', + '0x19Eb6536777713aCdAcA8dd9A3AD9843D74E9E3b', + '0x1B72255a11DF705Bb598E670830E03A19F2D242f', + '0x7058EE5467edef417746aab0B8cabbbE36eF1798', + '0x9792eE4c36a622a8CF9566b037c57519A9fe8a56', + ] +} + +const getEthereumStaking = staking(tokenAddresses.sOnx, tokenAddresses.onx) + +const getEthereumBorrows = async (api) => { + api.add(ADDRESSES.null, await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalBorrow' })) +} + +async function getEthereumPoolTvl(api) { + const pools = ['0xAdb6d1cB866a52C5E8C1e79Ff8e0559c12F4D7a3'] + const tokens = ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f'] + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) + return api.sumTokens({ owners: [tokenAddresses.onxFarm, tokenAddresses.onxTripleFarm], tokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) +} + +async function ethTvl(api) { + await Promise.all([addFarmTvl, addOnePoolTvl, addVaultTvl, addOneVaultTvl, ethStakeTvl].map(i => i())) + + async function ethStakeTvl() { + let totalStake = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalStake' }) + let totalBorrow = await api.call({ target: tokenAddresses.pool, abi: 'uint256:totalPledge' }) + api.add(ADDRESSES.null, totalStake - totalBorrow) + } + + + async function addVaultTvl() { + const vaults = [ + ['0xceff51756c56ceffca006cd410b03ffc46dd3a58', '0x2abCe7c4C77e215fcCc189E02Fc5D2A30b52a06a'], + ['0x397ff1542f962076d0bfe58ea045ffa2d347aca0', '0x637c871C559ade45b37074fCF3B8081Ec81c55FC'], + ['0x06da0fd433c1a5d7a4faa01111c044910a184553', '0xeAaE5CEfce1092eb3eA1DA7622B3cF4fb20B8b81'], + + ['0x795065dcc9f64b5614c407a6efdc400da6221fb0', '0xdC6f222c4504C43225a89b84E3aae15Ad0DFDF0F'], + ['0x36e2fcccc59e5747ff63a03ea2e5c0c2c14911e7', '0x10A8dc3C0Db7BDFE1Db36d113c2685e60daaFEb8'], + ['0xfa5bc40c3bd5afa8bc2fe6b84562fee16fb2df5f', '0x6901Aac9813f3EfAae32F44E9b579f08A12707AD'], + ['0x1241f4a348162d99379a23e73926cf0bfcbf131e', '0x121eF4eEc2bb4D5eD91347166F02c0763af1C49A'], + ['0x088ee5007c98a9677165d78dd2109ae4a3d04d0c', '0x431b1F5356EcAc2D86b2313907B747B16D11066f'], + + ['0xc3d03e4f041fd4cd388c549ee2a29a9e5075882f', '0x5EA1b54C522f279ecC0182d9b35229d6435D42b7'], + ['0xd75ea151a61d06868e31f8988d28dfe5e9df57b4', '0x9DB4AFCABdB25C89424c88e720dD47D6be43BdBe'], + ['0xc40d16476380e4037e6b1a2594caf6a6cc8da967', '0xbd3a37e3690ad4e145c39983D0Aaf8bd5f5e2F29'], + ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], + ['0x31503dcb60119a812fee820bb7042752019f2355', '0x8d47f6fd4602B1ecF7928C0f1AEF9C215E3596b4'], + + ['0xba13afecda9beb75de5c56bbaf696b880a5a50dd', '0x659217CdA99658AeBA399B4a79FB03D96B3c46bC'], + ['0xf55c33d94150d93c2cfb833bcca30be388b14964', '0xcedB7921013A012c5538C0d2925a90AA817Bef4D'], + ] + const pools = vaults.map(i => i[1]) + const tokens = vaults.map(i => i[0]) + const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) + api.addTokens(tokens, bals) + } + + async function addFarmTvl() { + const farm = '0x168f8469ac17dd39cd9a2c2ead647f814a488ce9' + const pools = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address token, uint256,uint256,uint256)', target: farm }) + return api.sumTokens({ owner: farm, tokens: pools.map(i => i.token), blacklistedTokens: ['0x0652687e87a4b8b5370b05bc298ff00d205d9b5f', tokenAddresses.onxWethSushiPair] }) + } + async function addOnePoolTvl() { + const pools = tokenAddresses.onePools + const tokens = await api.multiCall({ abi: 'address:stakingToken', calls: pools }) + return api.sumTokens({ tokensAndOwners2: [tokens, pools] }) + } + + async function addOneVaultTvl() { + const vault = tokenAddresses.oneVault + const aETH = await api.call({ abi: 'address:aEth', target: vault }) + const aETHb = await api.call({ abi: 'address:aETHb', target: vault }) + return api.sumTokens({ tokens: [aETH, aETHb], owner: vault }) + } +} module.exports = { doublecounted: true, @@ -14,18 +239,4 @@ module.exports = { polygon: { tvl, }, avax: { tvl, }, fantom: { tvl, }, -}; - -const config = { - polygon: { vaults: pVaults }, - avax: { vaults: aVaults }, - fantom: { vaults: fVaults }, -} - -async function tvl(api) { - const { vaults } = config[api.chain] - const pools = vaults.map(i => i[1]) - const tokens = vaults.map(i => i[0]) - const bals = await api.multiCall({ abi: 'uint256:underlyingBalanceWithInvestment', calls: pools }) - api.addTokens(tokens, bals) -} \ No newline at end of file +}; \ No newline at end of file diff --git a/projects/onyx-v2/index.js b/projects/onyx-v2/index.js new file mode 100644 index 000000000000..2af4a93b412a --- /dev/null +++ b/projects/onyx-v2/index.js @@ -0,0 +1,5 @@ +const { compoundExports2 } = require('../helper/compound'); + +module.exports = { + ethereum: compoundExports2({ comptroller: "0xcC53F8fF403824a350885A345ED4dA649e060369", cether: "0x2ccb7d00a9e10d0c3408b5eefb67011abfacb075"}), +}; diff --git a/projects/opbanana/index.js b/projects/opbanana/index.js index a6cadaa2b9af..e4b677f9e519 100644 --- a/projects/opbanana/index.js +++ b/projects/opbanana/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - op_bnb: { tvl: getUniTVL({ factory: '0xdF9161aa1D60f129E185D43e2862BD4826E88Aa8', useDefaultCoreAssets: true, fetchBalances: true, }), }, + op_bnb: { tvl: getUniTVL({ factory: '0xdF9161aa1D60f129E185D43e2862BD4826E88Aa8', useDefaultCoreAssets: true, }), }, } \ 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 000000000000..ed1af17aa653 --- /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/opendao/abi.json b/projects/opendao/abi.json deleted file mode 100644 index b6ed2c180377..000000000000 --- a/projects/opendao/abi.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "getAllMarkets": "address[]:getAllMarkets", - "getCash": "uint256:getCash", - "underlying": "address:underlying", - "symbol": "string:symbol", - "totalBorrows": "uint256:totalBorrows", - "poolInfo": "function poolInfo(uint256) view returns (address lpToken, uint256 allocPoint, uint256 lastRewardBlock, uint256 accSushiPerShare)", - "poolLength": "uint256:poolLength", - "cash": "address:cash" -} \ No newline at end of file diff --git a/projects/opendao/index.js b/projects/opendao/index.js index ddd0cb7f8047..82a65c002301 100644 --- a/projects/opendao/index.js +++ b/projects/opendao/index.js @@ -1,13 +1,8 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json") const { pool2s } = require("../helper/pool2"); -const { unwrapUniswapLPs } = require('../helper/unwrapLPs'); +const { compoundExports2 } = require('../helper/compound'); -/*** Ethereum Addresses ***/ const comptroller = "0x959Fb43EF08F415da0AeA39BEEf92D96f41E41b3"; -const farmContract = "0x9C3c5a058B83CBbE3Aa0a8a8711c2BD5080ccCa7"; - const farmContractsBSC = [ // Farm ID 41 "0x92702dcCD53022831edd3FCBfEabbBA31BC29bB6", @@ -38,113 +33,6 @@ const pool2LpsBSC = [ "0x507d84fe072Fe62A5F2e1F917Be8Cc58BdC53eF8" ]; -const calc = async (balances, balance, comptroller, chain = "ethereum") => { - let chainBlocks = {}; - - const allMarkets = ( - await sdk.api.abi.call({ - abi: abi.getAllMarkets, - target: comptroller, - chain: chain, - block: chainBlocks[chain] - }) - ).output; - - const getBalance = ( - await sdk.api.abi.multiCall({ - abi: balance, - calls: allMarkets.map(markets => ({ - target: markets, - })), - chain: chain, - block: chainBlocks[chain] - }) - ).output.map(bal => bal.output); - - const underlyings = ( - await sdk.api.abi.multiCall({ - abi: abi.underlying, - calls: allMarkets.map(markets => ({ - target: markets, - })), - chain: chain, - block: chainBlocks[chain] - }) - ).output.map(under => under.output); - - const symbols = ( - await sdk.api.abi.multiCall({ - abi: abi.symbol, - calls: underlyings.map(underlying => ({ - target: underlying, - })), - chain: chain, - block: chainBlocks[chain] - }) - ).output.map(symbol => symbol.output); - - const lpPositions = []; - underlyings.forEach((underlying, idx) => { - if (symbols[idx] == 'UNI-V2') { - lpPositions.push({ - token: underlying, - balance: getBalance[idx] - }) - } else { - sdk.util.sumSingleBalance(balances, `${chain}:${underlying}`, getBalance[idx]); - } - }); - - await unwrapUniswapLPs( - balances, - lpPositions, - chainBlocks[chain], - chain, - addr => `${chain}:${addr}` - ); -}; - -const ethTvl = async () => { - const balances = {}; - - await calc(balances, abi.getCash, comptroller); - - const poolLength = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: farmContract, - }) - ).output; - - for (let i = 0; i < poolLength; i++) { - const lpFarm = ( - await sdk.api.abi.call({ - abi: abi.poolInfo, - target: farmContract, - params: i - }) - ).output.lpToken; - - const cashAddress = ( - await sdk.api.abi.call({ - abi: abi.cash, - target: lpFarm, - }) - ).output; - - const balance = ( - await sdk.api.erc20.balanceOf({ - target: cashAddress, - owner: lpFarm - }) - ).output; - - sdk.util.sumSingleBalance(balances, cashAddress, balance); - } - - return balances; -}; - const vaults = [ "0x0a234ef34614a4eed1c1430a23b46f95df5f4257", // pOPEN "0xfff0cc78a7e7ce5d6ba60f23628ff9a63beee87f", // OCP @@ -153,44 +41,22 @@ const vaults = [ "0xcfefc606c4c010c242431f60a7afc13461df399c", // ROSEN ]; -async function bscTvl(timestamp, block, chainBlocks) { - let balances = {}; - let underlying = ( - await sdk.api.abi.multiCall({ - calls: vaults.map((p) => ({ - target: p, - })), - abi: abi.underlying, - block: chainBlocks.bsc, - chain: "bsc", - }) - ).output; - let underlyingBalances = ( - await sdk.api.abi.multiCall({ - calls: underlying.map((p) => ({ - target: p.output, - params: p.input.target, - })), - abi: "erc20:balanceOf", - block: chainBlocks.bsc, - chain: "bsc", - }) - ).output; - underlyingBalances.forEach((p) => { - sdk.util.sumSingleBalance(balances, `bsc:${p.input.target}`, p.output); - }); - return balances; +async function bscTvl(api) { + const tokens = await api.multiCall({ abi: 'address:underlying', calls: vaults}) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults]}) } module.exports = { misrepresentedTokens: true, ethereum: { pool2: pool2s(farmContractsBSC, pool2LpsBSC), - tvl: ethTvl + ...compoundExports2({ comptroller }) }, bsc: { tvl: bscTvl, }, methodology: "We count liquidity on the Markets same as compound, and we export Borrowing part too", -} \ No newline at end of file +} + +delete module.exports.ethereum.borrowed \ No newline at end of file diff --git a/projects/opendelta/index.js b/projects/opendelta/index.js new file mode 100644 index 000000000000..e721a8efa445 --- /dev/null +++ b/projects/opendelta/index.js @@ -0,0 +1,38 @@ +const { PublicKey, } = require("@solana/web3.js") +const { getConnection, } = require("../helper/solana") + +const OPB_MINT_ADDRESS = "opbrKSFxFXRHNg75xjpEAbJ5R6e6GYZ6QKEqdvcBq7c" + +async function tvl(api) { + const connection = getConnection() + const { value: { data: { parsed: { info: { supply, decimals, extensions }}}}} = await connection.getParsedAccountInfo(new PublicKey(OPB_MINT_ADDRESS)) + const { state } = extensions.find(e => e.extension === 'interestBearingConfig') + api.addUSDValue(computeSupply(supply, state, decimals)) + + function computeSupply(supply, extensionData, decimals) { + // Compute the supply based on the interest-bearing extension + const { currentRate, initializationTimestamp, preUpdateAverageRate, lastUpdateTimestamp, } = extensionData + + const currentTimestamp = Math.floor(Date.now() / 1000) + const timeElapsed = lastUpdateTimestamp - initializationTimestamp + const timeElapsedSinceLastUpdate = currentTimestamp - lastUpdateTimestamp + const interestRate = currentRate / 1e4 + const interestRatePre = preUpdateAverageRate / 1e4 + const ONE_YEAR = 365.24 * 24 * 60 * 60 + const interestAccruedCurrent = Math.exp(interestRate * timeElapsedSinceLastUpdate / ONE_YEAR) + const interestAccruedPre = Math.exp(interestRatePre * timeElapsed / ONE_YEAR) + + const computedSupply = supply * (interestAccruedCurrent * interestAccruedPre) + return computedSupply / Math.pow(10, decimals) + } + +} + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + methodology: "TVL is calculated by multiplying the OPB token supply by the current USD value of 1.0 OPB. Initially worth $1.0, 1.0 OPB now reflects its increased value from accrued interest, derived using amountToUiAmount approach of Solana Token2022 Interest Bearing extension.", + solana: { + tvl, + }, +} diff --git a/projects/openeden-tbill/index.js b/projects/openeden-tbill/index.js index a14084e08013..b917bf45ccc1 100644 --- a/projects/openeden-tbill/index.js +++ b/projects/openeden-tbill/index.js @@ -1,5 +1,11 @@ -async function tvl(api) { - let contract = '0xdd50C053C096CB04A3e3362E2b622529EC5f2e8a' +const { getTokenSupplies } = require('../helper/solana') +const { ripple } = require('../helper/chain/rpcProxy') + +const tbill = "0xdd50C053C096CB04A3e3362E2b622529EC5f2e8a" +const solTbill = '4MmJVdwYN8LwvbGeCowYjSx7KoEi6BJWg8XXnW4fDDp6' + +async function evmTvl(api) { + let contract = tbill if (api.chain === 'arbitrum') contract = '0xF84D28A8D28292842dD73D1c5F99476A80b6666A' const [bal, token] = await api.batchCall([ { abi: 'uint256:totalAssets', target: contract }, @@ -8,7 +14,25 @@ async function tvl(api) { api.add(token, bal) } +async function solTvl (api) { + const res = await getTokenSupplies([solTbill]) + console.log(res) + Object.entries(res).forEach(([token, balance]) => { + api.add(token, balance) + }) +} + +async function ripplTvl (api) { + const issuerAddress = "rJNE2NNz83GJYtWVLwMvchDWEon3huWnFn"; + const subscriptionOperatorAddress = "rB56JZWRKvpWNeyqM3QYfZwW4fS9YEyPWM"; + + const data = await ripple.gatewayBalances({ account: issuerAddress, hotwallet: subscriptionOperatorAddress }) + api.add(tbill, Number(data.obligations?.TBL) * 1e6, { skipChain: true }) +} + module.exports = { - ethereum: { tvl }, - arbitrum: { tvl }, + ethereum: { tvl: evmTvl }, + arbitrum: { tvl: evmTvl }, + ripple: { tvl: ripplTvl }, + solana: { tvl: solTvl } } \ No newline at end of file diff --git a/projects/openworld-lev-farm/index.js b/projects/openworld-lev-farm/index.js new file mode 100644 index 000000000000..72760f72bdee --- /dev/null +++ b/projects/openworld-lev-farm/index.js @@ -0,0 +1,34 @@ +const { get } = require('../helper/http') +const { getConfig } = require('../helper/cache') + +const positionManager = '0x0b95Ea9Eb46716d20991163AE60eD2e16645Ef38'; +const getValueFarmAbi = 'function getFarmValue(address) view returns (address token0, uint256 amount0, address token1, uint256 amount1)'; +const OPEN = '0x58cb98a966f62aa6f2190eb3aa03132a0c3de3d5' + +async function tvl(api) { + const vaults = await getConfig('open-world/lev-farming-vaults/'+api.chain, undefined, { + fetcher: async () => { + const data = await get('https://analytic.ow.finance/lending-synthetic') + return data.data.map(v => v.vaultAddress) + } + }) + const farms = await getConfig('open-world/lev-farming-farms/'+api.chain, undefined, { + fetcher: async () => { + const data = await get('https://product-exploration.ow.finance/pools') + return data.data.map(v => v.workerAddress) + } + }) + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults }) + await api.sumTokens({ tokensAndOwners2: [tokens, vaults], }) + const farmData = await api.multiCall({ abi: getValueFarmAbi, calls: farms, target: positionManager }) + for (const i of farmData) { + api.add(i.token0, i.amount0) + api.add(i.token1, i.amount1) + } + + api.removeTokenBalance(OPEN) +} + +module.exports = { + arbitrum: { tvl }, +} \ No newline at end of file diff --git a/projects/optidoge/index.js b/projects/optidoge/index.js index 5952b44af6a8..f624917a68a5 100644 --- a/projects/optidoge/index.js +++ b/projects/optidoge/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const sdk = require('@defillama/sdk') -const {pool2Exports} = require("../helper/pool2") +const {pool2} = require("../helper/pool2") const {stakingUnknownPricedLP} = require("../helper/staking") const weth = ADDRESSES.ethereum.WETH @@ -18,7 +18,7 @@ async function tvl(time, _ethBlock, {optimism: block}){ module.exports = { optimism: { tvl, - pool2: pool2Exports("0x7Dbe3714371bB9FF72369AFc88703AbD2694E322", ["0x91d62ac270e5bb371a25f81c9e74f16b53448efd"], "optimism"), + pool2: pool2("0x7Dbe3714371bB9FF72369AFc88703AbD2694E322", ["0x91d62ac270e5bb371a25f81c9e74f16b53448efd"], "optimism"), staking: stakingUnknownPricedLP("0x015C4b2250F7aAC41274FeB95eFf00016C0CE08c", "0x93d97dbb1bb5290c78c23885e8026047dc8998a8", "optimism", "0x91d62ac270e5bb371a25f81c9e74f16b53448efd", addr=>`optimism:${addr}`) } } diff --git a/projects/opus/index.js b/projects/opus/index.js new file mode 100644 index 000000000000..5f101278cf20 --- /dev/null +++ b/projects/opus/index.js @@ -0,0 +1,23 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens } = require('../helper/chain/starknet') + +const tokensAndOwners = [ + // Gates + [ADDRESSES.starknet.ETH, "0x0315ce9c5d3e5772481181441369d8eea74303b9710a6c72e3fcbbdb83c0dab1"], + [ADDRESSES.starknet.STRK, "0x031a96fe18fe3fdab28822c82c81471f1802800723c8f3e209f1d9da53bc637d"], + [ADDRESSES.starknet.WBTC, "0x05bc1c8a78667fac3bf9617903dbf2c1bfe3937e1d37ada3d8b86bf70fb7926e"], + [ADDRESSES.starknet.WSTETH, "0x02d1e95661e7726022071c06a95cdae092595954096c373cde24a34bb3984cbf"], + // Transmuters + [ADDRESSES.starknet.USDC, "0x03878595db449e1af7de4fb0c99ddb01cac5f23f9eb921254f4b0723a64a23cb"], +] + +async function tvl(api) { + return await sumTokens({ api, tokensAndOwners: tokensAndOwners }); +} + +module.exports = { + methodology: 'Total value of collateral deposited by users into the smart contracts of Opus', + starknet: { + tvl, + }, +} diff --git a/projects/oraclefreedollar/index.js b/projects/oraclefreedollar/index.js new file mode 100644 index 000000000000..a1e60a0d5431 --- /dev/null +++ b/projects/oraclefreedollar/index.js @@ -0,0 +1,16 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + bsc: { factory: '0xFe00054AF44E24f0B4bd49b1A2d2984C4264aabE', fromBlock: 37882077, }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event PositionOpened (address indexed owner, address indexed position, address ofd, address collateral, uint256 price)', fromBlock, }) + const tokensAndOwners = logs.map(log => [log.collateral, log.position]) + return api.sumTokens({ tokensAndOwners }) + } + } +}) \ No newline at end of file diff --git a/projects/oraidex-v3/index.js b/projects/oraidex-v3/index.js new file mode 100644 index 000000000000..664b36bb8b23 --- /dev/null +++ b/projects/oraidex-v3/index.js @@ -0,0 +1,36 @@ +const { sumTokens, sumCW20Tokens, queryContract } = require('../helper/chain/cosmos') +const { getUniqueAddresses } = require('../helper/utils') + +const AMM_V3_CONTRACT = "orai10s0c75gw5y5eftms5ncfknw6lzmx0dyhedn75uz793m8zwz4g8zq4d9x9a" + +const isNativeToken = denom => !denom.startsWith("orai1") + +async function tvl(api) { + const CHUNK_SIZE = 100 + const pools = [] + let hasMore = true + + while (hasMore) { + const startAfter = pools.length == 0 ? undefined : pools[pools.length - 1].pool_key + const res = await queryContract({ + chain: api.chain, + contract: AMM_V3_CONTRACT, + data: { pools: { limit: CHUNK_SIZE, startAfter } } + }) + + pools.push(...res) + hasMore = res.length === CHUNK_SIZE + } + + let cw20Tokens = pools.map(pool => [pool.pool_key.token_x, pool.pool_key.token_y]).flat().filter(token => !isNativeToken(token)) + cw20Tokens = getUniqueAddresses(cw20Tokens, true) + + await sumTokens({ owner: AMM_V3_CONTRACT, api, }) + return sumCW20Tokens({ api, tokens: cw20Tokens, owner: AMM_V3_CONTRACT }) +} + +module.exports = { + timetravel: false, + methodology: "Liquidity on pool V3", + orai: { tvl } +} \ No newline at end of file diff --git a/projects/orange-finance/index.js b/projects/orange-finance/index.js index a342e569c15a..110b87f8f8fb 100644 --- a/projects/orange-finance/index.js +++ b/projects/orange-finance/index.js @@ -1,29 +1,18 @@ const ADDRESSES = require("../helper/coreAssets.json"); const VAULTS = [ - // alpha - { address: "0x1c99416c7243563ebEDCBEd91ec8532fF74B9a39", asset: ADDRESSES.arbitrum.USDC }, // UniswapV3 ETH-USDC.e Dynamic Hedge Vault - { address: "0x16F6617680333e90f18aA89a85817d347078b7b8", asset: ADDRESSES.arbitrum.USDC }, // UniswapV3 ETH-USDC.e DN Vault - { address: "0x810fd69F58fF7Ff8553D43a5D3DCE3853960cAa6", asset: ADDRESSES.arbitrum.USDC }, // UniswapV3 ETH-USDC.e DN Vault - { address: "0xb9c5425084671221d7d5a547dbf1bdcec26c8b7d", asset: ADDRESSES.arbitrum.USDC }, // Camelot ETH-USDC.e DN Vault - // broken { address: "0xdB8a12EeC655748A74576BD8E0acAbdF8e622508", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Camelot USDC-USDC.e Stable Vault - { address: "0x690633417eA231073c53f00D30f194489196dfaD", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Camelot USDC-WETH DN Vault - { address: "0x7B9d8c413ACE4008E22dcF08C3A79A9178682e13", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-ARB DN Vault - { address: "0x32790eAf83B52E53d54bFD4779832d6aDEAC880E", asset: ADDRESSES.arbitrum.WETH }, // UniswapV3 WETH-WBTC DN Vault - { address: "0x3870eECe85e6CDD013511Afb4ac6A7C4c1688bEa", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-USDC.e DN Vault // app - strategy - { address: "0x706b3bcA6d6deD8c61d73270c228f276f4414B5e", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Camelot USDC-ARB DN Vault - { address: "0xF47ecD6514D66A635b2933765Bc7A64895e27139", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-ARB DN Vault { address: "0xd6ecEb3978bf2b76958b96E8A207246b98C7d639", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Camelot USDC-DAI Stable Vault - { address: "0x2854038d756Aaef87E801d0d617Df5219838bd05", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Camelot USDC-WETH DN Vault - { address: "0x68EC0e9A000c2063b64DC98B8C58d019CCBFb01a", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-USDC DN Vault { address: "0x0B48540e214bc196e1D0954834876691fE19068D", asset: ADDRESSES.arbitrum.USDC }, // Camelot USDC-USDT Stable Vault - { address: "0xe4762eAcD41BD6BfB87eCdd3eC815d242b72F4AF", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-WBTC DN Vault - { address: "0xb70671F6b436C755389D3f7a2C61a39296D1ccda", asset: ADDRESSES.arbitrum.WETH }, // Camelot WETH-USDT DN Vault { address: "0x59671Aa8F4E5adCcb26f4c88F0d6047B0ae7620b", asset: ADDRESSES.arbitrum.USDC }, // Camelot USDC.e-USDC Stable Vault // app - lpdfi - { address: "0x65Fb7fa8731710b435999cB7d036D689097548e8", asset: ADDRESSES.arbitrum.WETH }, // Stryke CLAMM WETH-USDC +-2.5% Automator v1 { address: "0xe1B68841E764Cc31be1Eb1e59d156a4ED1217c2C", asset: ADDRESSES.arbitrum.WETH }, // Stryke CLAMM WETH-USDC +-2.5% Automator v2 + { address: "0x5f6D5a7e8eccA2A53C6322a96e9a48907A8284e0", asset: ADDRESSES.arbitrum.WETH }, // Stryke CLAMM WETH-USDC Automator v2 + { address: "0x22dd31a495CafB229131A16C54a8e5b2f43C1162", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Stryke CLAMM USDC-WBTC Automator v2 + { address: "0x708790D732c5886D56b0cBBEd7b60ABF47848FaA", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Stryke CLAMM USDC-ARB Automator v2 + { address: "0x01E371c500C49beA2fa985334f46A8Dc906253Ea", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Stryke CLAMM USDC-WBTC Automator v2 + { address: "0xE32132282D181967960928b77236B3c472d5f396", asset: ADDRESSES.arbitrum.USDC_CIRCLE }, // Stryke CLAMM USDC-ARB Automator v2 + { address: "0x3D2692Bb38686d0Fb9B1FAa2A3e2e5620EF112A9", asset: "0x13A7DeDb7169a17bE92B0E3C7C2315B46f4772B3" }, // Stryke CLAMM BOOP-WETH Automator v2 ]; async function tvl(api) { @@ -34,7 +23,7 @@ async function tvl(api) { module.exports = { doublecounted: true, - start: 107356480, + start: 154577707, arbitrum: { tvl, }, diff --git a/projects/oraprotocol/index.js b/projects/oraprotocol/index.js new file mode 100644 index 000000000000..72f3df35ff41 --- /dev/null +++ b/projects/oraprotocol/index.js @@ -0,0 +1,29 @@ +const contracts = [ + "0xc0b2FdA4EDb0f7995651B05B179596b112aBE0Ff", + "0x0a7Df7BC7a01A4b6C9889d5994196C1600D4244a", + "0x5982241e50Cb4C42cb51D06e74A97EAaCa3a8CE2", + "0xDF03600C34cacE7496A0A8Ef102B4bCe718958a2", + "0x3e0598fee8a73d09c06b3de3e205ba7ff8edb004" +]; + + +module.exports = { + ethereum: { + tvl, staking, + } +}; + +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:stakingTokenAddress', calls: contracts }) + return api.sumTokens({ tokensAndOwners2: [tokens, contracts] }) +} + +async function staking(api) { + + const contracts = [ + "0x07b022bd57e22c8c5abc577535cf25e483dae3df", + "0x4f5e12233ed7ca1699894174fcbd77c7ed60b03d", + ]; + const tokens = await api.multiCall({ abi: 'address:stakingTokenAddress', calls: contracts }) + return api.sumTokens({ tokensAndOwners2: [tokens, contracts] }) +} \ No newline at end of file diff --git a/projects/orbitalswap/index.js b/projects/orbitalswap/index.js index 09847f3e5d10..85b3a09f5a3b 100644 --- a/projects/orbitalswap/index.js +++ b/projects/orbitalswap/index.js @@ -8,7 +8,6 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { methodology: `Uses factory(0x1A04Afe9778f95829017741bF46C9524B91433fB) address and whitelisted tokens address to find and price Liquidity Pool pairs`, misrepresentedTokens: true, - incentivized: true, bsc: { tvl: getUniTVL({ factory: '0x1A04Afe9778f95829017741bF46C9524B91433fB', useDefaultCoreAssets: true }), staking: staking(MasterChefContract, ORB), diff --git a/projects/orbiter-one/index.js b/projects/orbiter-one/index.js index e142370c62c9..2aa7a99264bd 100644 --- a/projects/orbiter-one/index.js +++ b/projects/orbiter-one/index.js @@ -3,7 +3,6 @@ const { compoundExports2 } = require('../helper/compound') const moonbeamConfig = { comptroller: "0x27DC3DAdBfb40ADc677A2D5ef192d40aD7c4c97D", cether: "0xCc444ca6bba3764Fc55BeEFe4FFA27435cF6c259", - fetchBalances: true, } module.exports = { diff --git a/projects/orca/index.js b/projects/orca/index.js index a3c21e323d8c..2f25675e57d4 100644 --- a/projects/orca/index.js +++ b/projects/orca/index.js @@ -2,13 +2,13 @@ const { getProvider, sumTokens2, exportDexTVL, } = require('../helper/solana') const { Program, } = require("@project-serum/anchor"); const sdk = require('@defillama/sdk') -async function tvl() { - const provider = getProvider() +async function tvl(api) { + const provider = getProvider(api.chain) const programId = 'whirLbMiicVdio4qvUfM5KAg6Ct8VwpYzGff3uctyCc' const program = new Program(whirpoolIDL, programId, provider) const whirlpools = await program.account.whirlpool.all() - const tokenAccounts = whirlpools.map(({ account}) => [account.tokenVaultA, account.tokenVaultB]).flat() - return sumTokens2({ tokenAccounts, }) + const tokenAccounts = whirlpools.map(({ account }) => [account.tokenVaultA, account.tokenVaultB]).flat() + return sumTokens2({ tokenAccounts, api, }) } /* async function orcaPoolTvlViaConfig() { @@ -22,14 +22,15 @@ async function tvl() { return sumTokens2({ tokenAccounts, blacklistedTokens, }) } */ -const orcaV1Tvl = exportDexTVL('DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1') -const orcaV2Tvl = exportDexTVL('9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP') +const orcaV1Tvl = exportDexTVL('DjVE6JNiYqPL2QXyCUUh8rNjHrbz9hXHNYt99MQ59qw1') +const orcaV2Tvl = exportDexTVL('9W959DqEETiGZocYWCQPaJ6sBmUzgfxXfqGeTEdp3aQP') module.exports = { timetravel: false, solana: { tvl: sdk.util.sumChainTvls([orcaV1Tvl, orcaV2Tvl, tvl]) }, + eclipse: { tvl }, hallmarks: [ [1628565707, "Token+LM launch"], [1667865600, "FTX collapse"] diff --git a/projects/orcadao/index.js b/projects/orcadao/index.js index 61f59d074663..58a98b746ac4 100644 --- a/projects/orcadao/index.js +++ b/projects/orcadao/index.js @@ -1,10 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const {pool2Exports} = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners, sumTokens } = require("../helper/unwrapLPs"); -const {staking} = require("../helper/staking"); +const { pool2 } = require("../helper/pool2"); +const { staking } = require("../helper/staking"); +const { sumTokens2 } = require('../helper/unwrapLPs'); const orca = "0x8b1d98a91f853218ddbb066f20b8c63e782e2430"; const podLeader = "0x111E1E97435b57467E79d4930acc4B7EB3d478ad"; @@ -16,64 +14,33 @@ const pool2LPs = [ // [[Collateral, Bank]] const banksAndCollateral = [ - ["0x330cc45c8f60fef7f9d271a7512542b3d201a48d","0x64D56b4B6C844015EC07e52A1267D5d5d4F4E5BD"], // YAK BENQI WBTC - ["0x9669fe1ea0d8883661289461b90a10b71ae400ee","0xEa03cDCdD912522400d21Ee89A5bC46Bffe11AC3"], // YAK BENQI DAI - ["0x07b0e11d80ccf75cb390c9be6c27f329c119095a","0xAf8d16500A58b868C34be9106d674b820d67C979"], // YAK BENQI USDT - [ADDRESSES.avax.WAVAX,"0xC029713E92383426C9b387b124C0BF6271d08b80"], // AVAX - ["0x8b414448de8b609e96bd63dcf2a8adbd5ddf7fdd","0x2b583646EC93245562Fd08A3b5f44Aa55417766B"], // YAK BENQI AVAX - ["0x0eac97a78a93b75549d49145df41dbe9cd520874","0xd694F97dd5874fA4e712FDFB781231D93642D29b"], // YAK BENQI USDC - ["0x957ca4a4aa7cdc866cf430bb140753f04e273bc0","0x8aee038726715d78C49dFb2f12e76DE70C2F48eC"], // YAK AAVE AVAX - ["0x4084f32a91f4d8636ca08386efe70c6e302f1d84","0x22a86D96b26308ba1971F8080AAD965884061076"], // YAK BENQI LINK - ["0x7d2d076000611e44740d636843384412399e31b9","0xc59b6794e5DeE450d264669f34e7849A90083774"], // YAK BENQI WETH - ["0xb634a71a54d3382ff6896eb22244b4a4e54c0a82","0x8b61488Ca2D727826c7Afe4eDbF810159F17D398"], // YAK AAVE WETH - ["0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1","0xa1A34E32c24911daA45e338dB9D785c1b323F280"], // YAK JOE - ["0x0f7f48d4b66bf5a53d4f21fa6ffca45f70cef770","0x18419976Ba05dd9cE44544B8d91590704aFA4a29"], // YAK AAVE WBTC - ["0xbf5bffbf7d94d3b29abe6eb20089b8a9e3d229f7","0xC09caDDA753c54292BeB1D10429bD175556b8b5E"], // YAK QI - [ADDRESSES.avax.WETH_e,"0x4805D6563B36a02C5012c11d6e15552f50066d58"], // WETH - [ADDRESSES.avax.WBTC_e,"0x1eA60d781376C06693dFB21d7e5951cAEc13F7E4"], // WBTC + ["0x330cc45c8f60fef7f9d271a7512542b3d201a48d", "0x64D56b4B6C844015EC07e52A1267D5d5d4F4E5BD"], // YAK BENQI WBTC + ["0x9669fe1ea0d8883661289461b90a10b71ae400ee", "0xEa03cDCdD912522400d21Ee89A5bC46Bffe11AC3"], // YAK BENQI DAI + ["0x07b0e11d80ccf75cb390c9be6c27f329c119095a", "0xAf8d16500A58b868C34be9106d674b820d67C979"], // YAK BENQI USDT + [ADDRESSES.avax.WAVAX, "0xC029713E92383426C9b387b124C0BF6271d08b80"], // AVAX + ["0x8b414448de8b609e96bd63dcf2a8adbd5ddf7fdd", "0x2b583646EC93245562Fd08A3b5f44Aa55417766B"], // YAK BENQI AVAX + ["0x0eac97a78a93b75549d49145df41dbe9cd520874", "0xd694F97dd5874fA4e712FDFB781231D93642D29b"], // YAK BENQI USDC + ["0x957ca4a4aa7cdc866cf430bb140753f04e273bc0", "0x8aee038726715d78C49dFb2f12e76DE70C2F48eC"], // YAK AAVE AVAX + ["0x4084f32a91f4d8636ca08386efe70c6e302f1d84", "0x22a86D96b26308ba1971F8080AAD965884061076"], // YAK BENQI LINK + ["0x7d2d076000611e44740d636843384412399e31b9", "0xc59b6794e5DeE450d264669f34e7849A90083774"], // YAK BENQI WETH + ["0xb634a71a54d3382ff6896eb22244b4a4e54c0a82", "0x8b61488Ca2D727826c7Afe4eDbF810159F17D398"], // YAK AAVE WETH + ["0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1", "0xa1A34E32c24911daA45e338dB9D785c1b323F280"], // YAK JOE + ["0x0f7f48d4b66bf5a53d4f21fa6ffca45f70cef770", "0x18419976Ba05dd9cE44544B8d91590704aFA4a29"], // YAK AAVE WBTC + ["0xbf5bffbf7d94d3b29abe6eb20089b8a9e3d229f7", "0xC09caDDA753c54292BeB1D10429bD175556b8b5E"], // YAK QI + [ADDRESSES.avax.WETH_e, "0x4805D6563B36a02C5012c11d6e15552f50066d58"], // WETH + [ADDRESSES.avax.WBTC_e, "0x1eA60d781376C06693dFB21d7e5951cAEc13F7E4"], // WBTC ] -const translateToken = { - "0x957ca4a4aa7cdc866cf430bb140753f04e273bc0": "avax:" + ADDRESSES.avax.WAVAX, - "0x0f7f48d4b66bf5a53d4f21fa6ffca45f70cef770": "avax:" + ADDRESSES.avax.WBTC_e, - "0xb634a71a54d3382ff6896eb22244b4a4e54c0a82": "avax:" + ADDRESSES.avax.WETH_e, - "0x3a91a592a06390ca7884c4d9dd4cba2b4b7f36d1": "avax:" + ADDRESSES.avax.JOE, - "0x8b414448de8b609e96bd63dcf2a8adbd5ddf7fdd": "avax:0x8729438eb15e2c8b576fcc6aecda6a148776c0f5", - "0x4084f32a91f4d8636ca08386efe70c6e302f1d84": "avax:0x5947bb275c521040051d82396192181b413227a3", - "0x9669fe1ea0d8883661289461b90a10b71ae400ee": "avax:" + ADDRESSES.avax.DAI, - "0x330cc45c8f60fef7f9d271a7512542b3d201a48d": "avax:" + ADDRESSES.avax.WBTC_e, - "0x07b0e11d80ccf75cb390c9be6c27f329c119095a": "avax:" + ADDRESSES.avax.USDt, - "0x0eac97a78a93b75549d49145df41dbe9cd520874": "avax:" + ADDRESSES.avax.USDC_e, - "0x7d2d076000611e44740d636843384412399e31b9": "avax:" + ADDRESSES.avax.WETH_e, - "0xbf5bffbf7d94d3b29abe6eb20089b8a9e3d229f7": "avax:0x8729438eb15e2c8b576fcc6aecda6a148776c0f5" +async function tvl(api) { + return api.sumTokens({ tokensAndOwners: banksAndCollateral }) } -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokens(balances, banksAndCollateral, chainBlocks.avax, "avax", addr=> { - addr = addr.toLowerCase(); - if (translateToken[addr] !== undefined) { - return translateToken[addr]; - } - return `avax:${addr}`; - }); - return balances; -} - -async function borrowed(timestamp, block, chainBlocks) { - let balances = {}; - const debt = (await sdk.api.abi.multiCall({ - calls: banksAndCollateral.map(p => ({ - target: p[1] - })), - abi: abi.totalDebt, - block: chainBlocks.avax, - chain: "avax" - })).output; - debt.forEach(p => { - sdk.util.sumSingleBalance(balances, `avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70`, p.output) - }); - return balances; +async function borrowed(api) { + const debt = await api.multiCall({ + calls: banksAndCollateral.map(p => p[1]), + abi: "uint256:totalDebt", + }) + api.add(ADDRESSES.avax.DAI, debt) } const treasuryContract = "0x10131d4f3193a59A46d3ab57D765f2604e77B4E3"; @@ -81,24 +48,24 @@ const usdc = ADDRESSES.avax.USDC_e const ocraAvaiPGL = "0x1A9Bd67c82C0e8E47C3ad2FA772FCb9B7A831A37"; const orcaWavaxPGL = "0x73e6CB72a79dEa7ed75EF5eD6f8cFf86C9128eF5"; const avaiUsdc = "0xeD7a2B4054757Cfdb632Af15Ad528624F0fFf3B0"; -async function treasury (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, [ - [usdc, false], - [orca, false], - [ocraAvaiPGL, true], - [orcaWavaxPGL, true], - [avaiUsdc, true] - ], [treasuryContract], chainBlocks.avax, "avax", addr=>`avax:${addr}`); - return balances; +async function treasury(api) { + return sumTokens2({ + api, owner: treasuryContract, tokens: [ + usdc, + orca, + ocraAvaiPGL, + orcaWavaxPGL, + avaiUsdc, + ], resolveLP: true, + }) } module.exports = { - avax:{ + avax: { methodology: "Tokens locked in as collateral is counted as TVL", tvl, borrowed, - pool2: pool2Exports(podLeader, pool2LPs, "avax", addr=>`avax:${addr}`), + pool2: pool2(podLeader, pool2LPs, "avax", addr => `avax:${addr}`), treasury, staking: staking(podLeader, orca) } diff --git a/projects/orderly-network/index.js b/projects/orderly-network/index.js index 134328ecb166..961147687cc2 100644 --- a/projects/orderly-network/index.js +++ b/projects/orderly-network/index.js @@ -11,6 +11,10 @@ const owner = '0x816f722424b49cf1275cc86da9840fbd5a6167e9' const tokenAddress = { arbitrum: ADDRESSES.arbitrum.USDC_CIRCLE, optimism: ADDRESSES.optimism.USDC_CIRCLE, + base: ADDRESSES.base.USDC, + mantle: ADDRESSES.mantle.USDC, + polygon: ADDRESSES.polygon.USDC_CIRCLE, + ethereum: ADDRESSES.ethereum.USDC } async function tvl() { @@ -37,5 +41,17 @@ module.exports = { optimism: { tvl: sumTokensExport({ owner, tokens: [tokenAddress.optimism] }), }, + base: { + tvl: sumTokensExport({ owner, tokens: [tokenAddress.base] }), + }, + mantle: { + tvl: sumTokensExport({ owner, tokens: [tokenAddress.mantle] }), + }, + polygon: { + tvl: sumTokensExport({ owner, tokens: [tokenAddress.polygon] }), + }, + ethereum: { + tvl: sumTokensExport({ owner, tokens: [tokenAddress.ethereum] }), + }, methodology: 'All the tokens deposited into Orderly Network by chain' }; diff --git a/projects/origami/index.js b/projects/origami/index.js index 22e1c67a613d..2401bcb86ae2 100644 --- a/projects/origami/index.js +++ b/projects/origami/index.js @@ -2,31 +2,63 @@ const sdk = require("@defillama/sdk"); const { cachedGraphQuery } = require('../helper/cache') const GRAPH_URLS = { - ethereum: sdk.graph.modifyEndpoint('GGN8RoYQBiw2Ui6wUeaKcHsBBSrQzQoryYi2feoTKwPX'), // ethereum - arbitrum: sdk.graph.modifyEndpoint('AHT1ffJhw7NWdeH3XYbWzMmy5USbB22K3ecVDu8azGuF'), // arbitrum + ethereum: sdk.graph.modifyEndpoint('https://subgraph.satsuma-prod.com/a912521dd162/templedao/origami-mainnet/api'), // ethereum + arbitrum: sdk.graph.modifyEndpoint('https://subgraph.satsuma-prod.com/a912521dd162/templedao/origami-arbitrum/api'), // arbitrum } +const osUSDS = '0x0f90a6962e86b5587b4c11ba2b9697dc3ba84800' + module.exports = { doublecounted: true, } Object.keys(GRAPH_URLS).forEach(chain => { - const endpoint = GRAPH_URLS[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') - tokens = await api.multiCall({ abi: 'address:baseToken', calls: tokens }) - - const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: vaults }) - const supplies = await api.multiCall({ abi: 'uint256:totalSupply', calls: vaults }) - const reserves = await api.multiCall({ abi: 'uint256:reservesPerShare', calls: vaults }) - const bals = reserves.map((reserve, i) => reserve * supplies[i] / 10 ** decimals[i]) - console.log(tokens, bals, vaults, api.chain) - api.add(tokens, bals) - } - } + module.exports[chain] = { tvl } }) + +async function tvl(api) { + const { metrics: [{ investmentVaults }] } = await cachedGraphQuery('origami/' + api.chain, GRAPH_URLS[api.chain], '{ metrics { investmentVaults { id kinds } } }') + + const isLeveraged = vault => !!vault.kinds.find(v => v === 'Leverage') + const levVaults = investmentVaults.filter(isLeveraged).map(v => v.id) + const nonLevVaults = investmentVaults.filter(v => !isLeveraged(v)).map(v => v.id) + + const [decimals, supplies, reserves, rawNonLevTokens] = await Promise.all([ + api.multiCall({ abi: 'uint8:decimals', calls: nonLevVaults, permitFailure: true }), + api.multiCall({ abi: 'uint256:totalSupply', calls: nonLevVaults, permitFailure: true }), + api.multiCall({ abi: 'uint256:reservesPerShare', calls: nonLevVaults, permitFailure: true }), + api.multiCall({ abi: 'address:reserveToken', calls: nonLevVaults, permitFailure: true }) + ]) + + await Promise.all(nonLevVaults.map(async (_vault, i) => { + const decimal = decimals[i] + const supply = supplies[i] + const reserve = reserves[i] + const rawNonLevToken = rawNonLevTokens[i] + if (!decimals || !supply || !reserve || !rawNonLevToken) return + const nonLevToken = await api.call({ abi: 'address:baseToken', target: rawNonLevToken }) + const bal = reserve * supply / 10 ** decimal + api.add(nonLevToken, bal) + })) + + const [levReserveTokens, assetsAndLiabilities] = await Promise.all([ + api.multiCall({ calls: levVaults, abi: 'address:reserveToken', permitFailure: true }), + api.multiCall({ abi: 'function assetsAndLiabilities() external view returns (uint256 assets,uint256 liabilities,uint256 ratio)', calls: levVaults, permitFailure: true }) + ]) + + levVaults.forEach((_vault, i) => { + const levReserveToken = levReserveTokens[i] + const assetsAndLiability = assetsAndLiabilities[i] + if(!levReserveToken || !assetsAndLiability) return + const levBal = assetsAndLiability.assets - assetsAndLiability.liabilities + api.add(levReserveToken, levBal) + }) + + if (api.chain ==='ethereum') { + const [asset, totalAssets] = await Promise.all([ + api.call({ target: osUSDS, abi: 'address:asset' }), + api.call({ target: osUSDS, abi: 'uint256:totalAssets' }) + ]) + api.add(asset, totalAssets) + } +} diff --git a/projects/originarm/index.js b/projects/originarm/index.js new file mode 100644 index 000000000000..87afd109f1cc --- /dev/null +++ b/projects/originarm/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: async (api) => { + const originLidoArm = "0x85b78aca6deae198fbf201c82daf6ca21942acc6"; + const outstandingSteth = await api.call({abi: 'uint256:lidoWithdrawalQueueAmount', target: originLidoArm }) + api.add(ADDRESSES.ethereum.STETH, outstandingSteth) + return api.sumTokens({ owner: originLidoArm, tokens: [ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.STETH] }) + }, + }, +}; diff --git a/projects/origindollar/index.js b/projects/origindollar/index.js index 17a994be45f4..71d75c69131c 100644 --- a/projects/origindollar/index.js +++ b/projects/origindollar/index.js @@ -1,35 +1,12 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { staking, stakings } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const vault = "0xE75D77B1865Ae93c7eaa3040B038D7aA7BC02F70"; -const ethTvl = async (timestamp, ethBlock) => { - const balances = {}; - - // Account DAI, USDT and USDC backing up the minted OUSD - const stablecoins = ( - await sdk.api.abi.call({ - abi: abi.getAllAssets, - target: vault, - block: ethBlock, - }) - ).output; - - for (let i = 0; i < stablecoins.length; i++) { - const balance_stablecoin = ( - await sdk.api.abi.call({ - abi: abi.checkBalance, - target: vault, - params: stablecoins[i], - block: ethBlock, - }) - ).output; - - sdk.util.sumSingleBalance(balances, stablecoins[i], balance_stablecoin); - } - - return balances; +const ethTvl = async (api) => { + const tokens = await api.call({ abi: abi.getAllAssets, target: vault}) + const bals = await api.multiCall({ abi: abi.checkBalance, calls: tokens, target: vault}) + api.add(tokens, bals) }; module.exports = { diff --git a/projects/originether/index.js b/projects/originether/index.js index ceea8da76904..2bba3ade3dc7 100644 --- a/projects/originether/index.js +++ b/projects/originether/index.js @@ -1,38 +1,46 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') const abi = require("../origindollar/abi.json"); -const vault = "0x39254033945aa2e4809cc2977e7087bee48bd7ab"; - -const ethTvl = async (timestamp, ethBlock) => { - const balances = {}; - - // Account WETH, rETH, frxETH and stETH backing up the minted OUSD - const backingAssets = ( - await sdk.api.abi.call({ - abi: abi.getAllAssets, - target: vault, - block: ethBlock, - }) - ).output; - - for (let i = 0; i < backingAssets.length; i++) { - const backingAssetBalance = ( - await sdk.api.abi.call({ - abi: abi.checkBalance, - target: vault, - params: backingAssets[i], - block: ethBlock, - }) - ).output; - - sdk.util.sumSingleBalance(balances, backingAssets[i], backingAssetBalance); - } - - return balances; -}; + +const ethTvl = async (api) => { + const vault = "0x39254033945aa2e4809cc2977e7087bee48bd7ab"; + const nativeStaking = '0x34eDb2ee25751eE67F68A45813B22811687C0238' + const nativeStaking2 = '0x4685dB8bF2Df743c861d71E6cFb5347222992076' + const stakingBalance1 = await api.call({ abi: abi.checkBalance, target: nativeStaking, params: ADDRESSES.ethereum.WETH }) + api.add(ADDRESSES.ethereum.WETH, stakingBalance1) + const stakingBalance2 = await api.call({ abi: abi.checkBalance, target: nativeStaking2, params: ADDRESSES.ethereum.WETH }) + api.add(ADDRESSES.ethereum.WETH, stakingBalance2) + + // add ETH part of curve LP + const convexStrategy = '0x1827F9eA98E0bf96550b2FC20F7233277FcD7E63' + const lp = await api.call({ abi: 'address:curvePool', target: convexStrategy}) + const ethIndex = await api.call({ abi: 'uint128:ethCoinIndex', target: convexStrategy}) + const lpBalance = await api.call({ abi: abi.checkBalance, target: convexStrategy, params: ADDRESSES.ethereum.WETH}) + const lpSupply = await api.call({ abi: 'erc20:totalSupply', target: lp}) + const ethInPool = await api.call({ abi: 'function balances(uint256) view returns (uint256)', target: lp, params: ethIndex}) + const ethLPBalance = (lpBalance / lpSupply) * ethInPool + api.add(ADDRESSES.ethereum.WETH, ethLPBalance) + + + return api.sumTokens({ owner: vault, tokens: [ADDRESSES.ethereum.WETH] }) +} + +async function baseTvl(api) { + const vault = '0x98a0CbeF61bD2D21435f433bE4CD42B56B38CC93' + const aeroAMO = '0xF611cC500eEE7E4e4763A05FE623E2363c86d2Af' + const dripper = await api.call({ target: vault, abi: 'function dripper() view returns (address)' }) + const [amountWeth, _amountOETH] = await api.call({ abi: 'function getPositionPrincipal() view returns (uint256, uint256)', target: aeroAMO }) + api.add(ADDRESSES.base.WETH, amountWeth) + return api.sumTokens({ owners: [vault], tokens: [ADDRESSES.base.WETH] }) + +} + module.exports = { ethereum: { tvl: ethTvl, }, + base: { + tvl: baseTvl, + }, }; diff --git a/projects/osmosis-ibc/index.js b/projects/osmosis-ibc/index.js new file mode 100644 index 000000000000..17df9eda62c9 --- /dev/null +++ b/projects/osmosis-ibc/index.js @@ -0,0 +1,21 @@ +const { get } = require('../helper/http') +const { PromisePool } = require('@supercharge/promise-pool') + +async function tvl(api) { + const res = await get( + `https://raw.githubusercontent.com/osmosis-labs/assetlists/main/osmosis-1/generated/chain_registry/assetlist.json` + ) + + await PromisePool.withConcurrency(10) + .for(res.assets) + .process(async (c) => { + const { base: address } = c; + if (!address.startsWith("ibc/")) return; + const res = await get(`https://lcd.osmosis.zone/cosmos/bank/v1beta1/supply/by_denom?denom=${address}`) + if (res && res.amount) api.add(address, res.amount.amount, { skipChain: true }) + }) +} + +module.exports = { + cosmos: { tvl } +} diff --git a/projects/ostium/index.js b/projects/ostium/index.js new file mode 100644 index 000000000000..84cb47d2ab2e --- /dev/null +++ b/projects/ostium/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json'); +const { sumTokensExport } = require('../helper/unwrapLPs'); + +const owners = [ + '0x20D419a8e12C45f88fDA7c5760bb6923Cee27F98', +]; + +const tokens = [ + ADDRESSES.arbitrum.USDC_CIRCLE, +]; + +module.exports = { + arbitrum: { + tvl: sumTokensExport({ owners, tokens }), + } +} diff --git a/projects/ourbit/index.js b/projects/ourbit/index.js new file mode 100644 index 000000000000..7253f71ac53b --- /dev/null +++ b/projects/ourbit/index.js @@ -0,0 +1,50 @@ +const { cexExports } = require('../helper/cex') + +const config = { + ethereum: { + owners: [ + "0xf81b45b1663b7ea8716c74796d99bbe4ea26f488", + "0x18D080B89570e4B996EB17fA1F0206F0CE35d604", + ], + }, + tron: { + owners: [ + "TApNqy5BNx11TiNa7oibbBUV63BY5a2sNE", + "TJP6zoGwWwUmANvMdrtqYq9iWA8qMAAY4q" + ], + }, + bsc: { + owners: [ + "0xdbf7122c0b7af893580df087eabac0b3be3e9483", + "0x6c6EC4beeAa53171a0ce0691D5c9A5FaAF509a8A" + ], + }, + optimism: { + owners: [ + "0x944d6b4c2bf808f9324ca0675f1d7e0e92a35436", + ], + }, + avax: { + owners: [ + "0x8fc27c899fb2c1044608516450e385378195639d", + ], + }, + arbitrum: { + owners: [ + "0x040432c11ee833bdcaac2495329b65bee7cca6d9", + ], + }, + solana: { + owners: [ + "7UhjbynicBP8rqcobwsAJDfRMjwgHSgdxcYNJmLwxfms", + "3pjwKq9yuzpVYfD4h5jMZLLfV8oSd8YiwpoAaB5oZS3H" + ], + }, + bitcoin: { + owners: [ + "bc1q2cvpg2c74puqke4py0ufr0aauj4m5vdeaqpjxv", + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/owna/index.js b/projects/owna/index.js index 6410e55c5c58..aec21d0ed737 100644 --- a/projects/owna/index.js +++ b/projects/owna/index.js @@ -87,9 +87,13 @@ config.chains.forEach(async chainInfo => { }; } + module.exports.deadFrom='2023-11-16', module.exports[chain] = { tvl: sumTokensExport({ chain, tokens, owners: [lendingContract] }), - borrowed: totalBorrowed, - offers: totalOffers, + borrowed: () => ({}) // bad debt totalBorrowed, + //offers: totalOffers, } }) + + + diff --git a/projects/oxiswap/index.js b/projects/oxiswap/index.js new file mode 100644 index 000000000000..86eb48f42d3b --- /dev/null +++ b/projects/oxiswap/index.js @@ -0,0 +1,12 @@ +const { sumTokens } = require("../helper/chain/fuel") + +async function tvl(api) { + const pairContract = '0x0da1be8528c8f546521ba9507d334cdb06cbc8b8842b3c0a871b1b4195635363'; + return sumTokens({ api, owners: [pairContract] }); +} + +module.exports = { + methodology: "TVL is calculated by summing the value of all tokens held in the pair contract.", + fuel: { tvl }, + timetravel: false, +}; \ No newline at end of file diff --git a/projects/p2pb2b/index.js b/projects/p2pb2b/index.js new file mode 100644 index 000000000000..87281e64a0af --- /dev/null +++ b/projects/p2pb2b/index.js @@ -0,0 +1,30 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + bitcoin: { + owners: bitcoinAddressBook.p2pb2b, + }, + ethereum: { + owners: [ + '0xcfed1443a1ed773119ed1a41a39b3b66f0ffde0f', + '0x302f4d246fc1E283AF3239311B8B84bD5a1c7736', + '0x03feA254cfA7434004E8d495725bCbB7cCc40454', + '0x7a2556e23ce7bc1ADFBDCa650130390A10C05f63' + ], + }, + bsc: { + owners: [ + '0x83455d6c365dcbac10855c623da884b552aaefdd', + '0x03feA254cfA7434004E8d495725bCbB7cCc40454' + ] + }, + polygon: { + owners: [ + '0x302f4d246fc1E283AF3239311B8B84bD5a1c7736' + ] + } +} + +module.exports = cexExports(config) +module.exports.methodology = 'We are only tracking part of their cold wallets for P2PB2B, more information here https://coinmarketcap.com/exchanges/p2b/' diff --git a/projects/palmaswap/index.js b/projects/palmaswap/index.js index 6cacfa927a3e..784385db044b 100644 --- a/projects/palmaswap/index.js +++ b/projects/palmaswap/index.js @@ -11,6 +11,7 @@ module.exports = { hallmarks: [ [1679356800, "Rug Pull"] ], + deadFrom: '2023-03-21', core: { tvl: sdk.util.sumChainTvls([uniTvl, staking({ owners: [masterchef], diff --git a/projects/pancake-stryke/index.js b/projects/pancake-stryke/index.js new file mode 100644 index 000000000000..c73068a60ff7 --- /dev/null +++ b/projects/pancake-stryke/index.js @@ -0,0 +1,21 @@ +const config = { + arbitrum: { + pools: [ + "0x501B03BdB431154b8Df17BF1c00756E3a8F21744", // WETHUSDC + "0x550e7E236912DaA302F7d5D0d6e5D7b6EF191f04", // WBTCUSDC + "0x4eed3A2b797Bf5630517EcCe2e31C1438A76bb92", // ARBUSDC + ], + }, +} + +Object.keys(config).forEach(chain => { + const { pools } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const callAssets = await api.multiCall({ abi: 'address:callAsset', calls: pools }) + const putAssets = await api.multiCall({ abi: 'address:putAsset', calls: pools }) + + return api.sumTokens({ tokensAndOwners2: [callAssets.concat(putAssets), pools.concat(pools)]}) + } + } +}) \ No newline at end of file diff --git a/projects/pancake-swap-stableswap/index.js b/projects/pancake-swap-stableswap/index.js index 6b32638f1ac3..b389701e6f7b 100644 --- a/projects/pancake-swap-stableswap/index.js +++ b/projects/pancake-swap-stableswap/index.js @@ -9,6 +9,7 @@ module.exports = { const config = { bsc: [{ target: '0x25a55f9f2279a54951133d503490342b50e5cd15', fromBlock: 25535459, token3: true, },], + ethereum: [{ target: '0xD173bf0851D2803177CC3928CF52F7b6bd29D054', fromBlock: 20362671, token3: true, },], arbitrum: [{ target: '0x5D5fBB19572c4A89846198c3DBEdB2B6eF58a77a', fromBlock: 169319653, token3: true, },], } diff --git a/projects/panko/index.js b/projects/panko/index.js new file mode 100644 index 000000000000..a6cdfbbe5073 --- /dev/null +++ b/projects/panko/index.js @@ -0,0 +1,31 @@ +const { uniV3Export } = require("../helper/uniswapV3") +const { getLogs2 } = require('../helper/cache/getLogs') +const { mergeExports } = require("../helper/utils") +const { nullAddress } = require("../helper/unwrapLPs") + +const uniTvl = uniV3Export({ + taiko: { factory: '0x99960D7076297a1E0C86f3cc60FfA5d6f2B507B5', fromBlock: 433329 } +}) + +const stableswapConfig = { + taiko: { factory: '0x542E849ff47da056c127F35710b01242A59705d2', fromBlock: 433341 } +} +const stableTvl = {} + +Object.keys(stableswapConfig).forEach(chain => { + const { factory, fromBlock, } = stableswapConfig[chain] + stableTvl[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ + api, + factory, + eventAbi: 'event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)', + fromBlock, + }) + const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB, i.tokenC].filter(i => i !== nullAddress), i.swapContract]) + return api.sumTokens({ ownerTokens }) + } + } +}) + +module.exports = mergeExports([uniTvl, stableTvl]) \ No newline at end of file diff --git a/projects/paperdao/index.js b/projects/paperdao/index.js index b3ef80894e35..68b7a9d4daac 100644 --- a/projects/paperdao/index.js +++ b/projects/paperdao/index.js @@ -11,5 +11,8 @@ const blacklist = [ module.exports = { methodology, - ethpow: compoundExports("0x5e496e7F241B13c514A78B7E840bc3cC744D7215", "ethpow", "0xb9e008f2C039fB994C8adD806F8aF709899aA95e", ADDRESSES.ethereum.WETH, undefined, undefined, { blacklistedTokens: blacklist }) -} \ No newline at end of file + ethpow: compoundExports("0x5e496e7F241B13c514A78B7E840bc3cC744D7215", "0xb9e008f2C039fB994C8adD806F8aF709899aA95e", ADDRESSES.ethereum.WETH, { blacklistedTokens: blacklist }) +} + +module.exports.deadFrom='2023-05-01', +module.exports.ethpow.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/papparico-finance/index.js b/projects/papparico-finance/index.js new file mode 100644 index 000000000000..2858568558fe --- /dev/null +++ b/projects/papparico-finance/index.js @@ -0,0 +1,32 @@ +const { sumTokensExport } = require("../helper/unknownTokens"); + +const PPFT_TOKEN_CONTRACT = "0x59BAfb7168972EcCA5e395F7dA88e71eCe47a260"; +const PPFT_MAIN_LP = "0xb036145476Ad16782eC05C7EC340D7e3cE6D09b7"; + +const STAKING_CONTRACT = "0x535503d5c23bCA9896383003A46A8AD6c9CB2fe2"; +const SINGLE_STAKING_CONTRACT = "0xFc8d5d6B280BF5E8d8DB12d0fF8a0f7d1A6ECf78"; +const VAULTS_CONTRACT = "0x828CC5D75594e4d0D072566cC07F64E863A0d11E"; +const LP_MINING_CONTRACT = "0x3E35810A663c7eE28a0A6f6A0984146CbB163c6c"; + +const XPPFT_TOKEN = "0x961105dD9bE34B64A27251d72B6D8F086847bc1c"; +const XPPFT_LP = "0xA99F134FC1e922Bc78Aa78c5897ce1eeF925b179"; +const LP_MINING_CONTRACT_V2 = "0x2490AFBf1609119bB76E5e936f4ce4cBed815947"; +const lps = [PPFT_MAIN_LP, XPPFT_LP]; + +module.exports = { + start: 13406569, + cronos: { + tvl: () => ({}), + staking: sumTokensExport({ + owners: [STAKING_CONTRACT, SINGLE_STAKING_CONTRACT, VAULTS_CONTRACT,], + tokens: [PPFT_TOKEN_CONTRACT, XPPFT_TOKEN], + lps, + useDefaultCoreAssets: true, + }), + pool2: sumTokensExport({ + owners: [LP_MINING_CONTRACT, LP_MINING_CONTRACT_V2], + tokens: lps, + useDefaultCoreAssets: true, + }), + } +}; \ No newline at end of file diff --git a/projects/papyrusswap/index.js b/projects/papyrusswap/index.js index 6edf5fb367aa..988ab5d1232e 100644 --- a/projects/papyrusswap/index.js +++ b/projects/papyrusswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xD5f3D3fb72210bfe71a59c05e0b8D72973baa2a6', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0xD5f3D3fb72210bfe71a59c05e0b8D72973baa2a6') \ No newline at end of file diff --git a/projects/parallel-lending/index.js b/projects/parallel-lending/index.js index ca943193127a..2c365e77b31a 100644 --- a/projects/parallel-lending/index.js +++ b/projects/parallel-lending/index.js @@ -1,7 +1,13 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + // deadFrom: '2024-08-17', timetravel: false, misrepresentedTokens: true, ...getExports("parallel-lending", ['heiko', 'parallel'], ['borrowed']), -} \ No newline at end of file +} + +const chains = ['heiko', 'parallel'] +chains.forEach(chain => { + Object.keys(module.exports[chain]).forEach(key => module.exports[chain][key] = () => ({})) +}) \ No newline at end of file diff --git a/projects/parallel-staking/index.js b/projects/parallel-staking/index.js index c49199a2b026..8a64eb93ca86 100644 --- a/projects/parallel-staking/index.js +++ b/projects/parallel-staking/index.js @@ -1,6 +1,12 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + // deadFrom: '2024-08-17', timetravel: false, ...getExports("parallel-staking", ['heiko', 'parallel']), -} \ No newline at end of file +} + +const chains = ['heiko', 'parallel'] +chains.forEach(chain => { + Object.keys(module.exports[chain]).forEach(key => module.exports[chain][key] = () => ({})) +}) \ No newline at end of file diff --git a/projects/parallel-stream/index.js b/projects/parallel-stream/index.js index bb1791d8427e..45c848afe2c7 100644 --- a/projects/parallel-stream/index.js +++ b/projects/parallel-stream/index.js @@ -1,7 +1,13 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + // deadFrom: '2024-08-17', timetravel: false, misrepresentedTokens: true, ...getExports("parallel-stream", ['heiko', 'parallel']), -} \ No newline at end of file +} + +const chains = ['heiko', 'parallel'] +chains.forEach(chain => { + Object.keys(module.exports[chain]).forEach(key => module.exports[chain][key] = () => ({})) +}) \ No newline at end of file diff --git a/projects/parallel.js b/projects/parallel.js index b9eb689f5cd9..d216a1336d1e 100644 --- a/projects/parallel.js +++ b/projects/parallel.js @@ -1,6 +1,12 @@ const { getExports } = require('./helper/heroku-api') module.exports = { + // deadFrom: '2024-08-17', timetravel: false, ...getExports("parallel-crowdloan", ['heiko', 'parallel']), -} \ No newline at end of file +} + +const chains = ['heiko', 'parallel'] +chains.forEach(chain => { + Object.keys(module.exports[chain]).forEach(key => module.exports[chain][key] = () => ({})) +}) \ No newline at end of file diff --git a/projects/parallelamm/index.js b/projects/parallelamm/index.js index 24412eac1a80..9fd270af21ac 100644 --- a/projects/parallelamm/index.js +++ b/projects/parallelamm/index.js @@ -1,7 +1,13 @@ const { getExports } = require('../helper/heroku-api') module.exports = { + // deadFrom: '2024-08-17', timetravel: false, misrepresentedTokens: true, ...getExports("parallelamm", ['heiko', 'parallel']), -} \ No newline at end of file +} + +const chains = ['heiko', 'parallel'] +chains.forEach(chain => { + Object.keys(module.exports[chain]).forEach(key => module.exports[chain][key] = () => ({})) +}) diff --git a/projects/parraton/index.js b/projects/parraton/index.js new file mode 100644 index 000000000000..56b7d866a50b --- /dev/null +++ b/projects/parraton/index.js @@ -0,0 +1,28 @@ +const { get } = require('../helper/http') +const ADDRESSES = require("../helper/coreAssets.json"); + +async function tvl(api) { + const vaults = await get('https://api.parraton.com/v1/vaults') + const tvl =vaults.reduce((acc, vault) => { + acc += Number(vault.tvlUsd) + return acc + }, 0) + api.add(ADDRESSES.ton.USDT, tvl * 1e6) +} + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + methodology: ` +The methodology for calculating TVL includes both the TON balance and LP token +data for each vault. We convert the TON balance to its USD equivalent and add it +to the value of DeDust LP tokens, which is calculated using on-chain data +(reserve0, reserve1, total LP supply). The value of LP tokens is determined by +their share of pool reserves, adjusted to USD. The total TVL is the sum of these +values across all vaults. The calculation is performed on the Parraton API side. + `.trim(), + + ton: { + tvl + } +} \ No newline at end of file diff --git a/projects/paxe/index.js b/projects/paxe/index.js new file mode 100644 index 000000000000..eb070c98bc78 --- /dev/null +++ b/projects/paxe/index.js @@ -0,0 +1,13 @@ +const { staking } = require("../helper/staking") + +const PAXE_TOKEN = "0xd2A3eec06719D5Ac66248003B5488E02165dd2fa" +const PAXE_FARMING_CONTRACT = '0xbA576f5ecbA5182a20f010089107dFb00502241f' +const RESTAKING_POOL = '0x269e1ceb128ccCD5684BbAFF9906D69eD1e9e9C8' + +module.exports = { + methodology: 'We count the TVL on the PAXE token in the farming contract and the restaking pool', + bsc: { + tvl: () => ({}), + staking: staking([RESTAKING_POOL, PAXE_FARMING_CONTRACT], PAXE_TOKEN) + } +} diff --git a/projects/paxo-finance/index.js b/projects/paxo-finance/index.js index 099a49b8c152..c7a7964b2b02 100644 --- a/projects/paxo-finance/index.js +++ b/projects/paxo-finance/index.js @@ -3,10 +3,10 @@ const { lendingMarket } = require('../helper/methodologies') const { staking } = require("../helper/staking"); module.exports = { - polygon: compoundExports('0x1eDf64B621F17dc45c82a65E1312E8df988A94D3', 'polygon'), - xdc: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'xdc'), - linea: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'linea'), - boba: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b', 'boba'), + polygon: compoundExports('0x1eDf64B621F17dc45c82a65E1312E8df988A94D3'), + xdc: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b'), + linea: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b'), + boba: compoundExports('0x301C76e7b60e9824E32991B8F29e1c4a03B4F65b'), 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/pearl-v1-5/index.js b/projects/pearl-v1-5/index.js new file mode 100644 index 000000000000..081aea6645a0 --- /dev/null +++ b/projects/pearl-v1-5/index.js @@ -0,0 +1,10 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + 'real': { + tvl: getUniTVL({ + factory: '0xAed0A784f357BE9C3f8113BB227a7517a3444Efe', useDefaultCoreAssets: true, hasStablePools: true + }) + } +}; \ No newline at end of file diff --git a/projects/pearl-v2/index.js b/projects/pearl-v2/index.js index cb27a24cc661..d1a1ed5c33d6 100644 --- a/projects/pearl-v2/index.js +++ b/projects/pearl-v2/index.js @@ -1,11 +1,8 @@ const { uniV3Export } = require('../helper/uniswapV3') - -const ownTokens = [ - '0xaec9e50e3397f9ddc635c6c429c8c7eca418a143', - '0x4644066f535ead0cde82d209df78d94572fcbf14', - '0x25ea98ac87a38142561ea70143fd44c4772a16b6', -] +const { staking } = require('../helper/staking') module.exports = uniV3Export({ - 'real': { factory: '0xeF0b0a33815146b599A8D4d3215B18447F2A8101', fromBlock: 33062, blacklistedTokens: ownTokens,} -}) \ No newline at end of file + 'real': { factory: '0xeF0b0a33815146b599A8D4d3215B18447F2A8101', fromBlock: 33062, }, +}) + +module.exports.real.staking = staking('0x7f8F92C2446E044af45DCf15476Bc931Fd1d0020', '0xB08F026f8a096E6d92eb5BcbE102c273A7a2d51C') \ No newline at end of file diff --git a/projects/peerme/index.js b/projects/peerme/index.js index 77cad14bf378..2e94c842b065 100644 --- a/projects/peerme/index.js +++ b/projects/peerme/index.js @@ -11,10 +11,10 @@ const PROTOCOL_ADDRESSES = [ ]; async function getDaoAddresses() { - return await getConfig( + return (await getConfig( "peerme", API_BASE_URL + "/integrations/defi-llama/dao-addresses" - ); + )).filter(address => address !== null); } async function tvl() { diff --git a/projects/pegasusdao.js b/projects/pegasusdao.js index a0f79091183d..89b3fb8a1aa4 100644 --- a/projects/pegasusdao.js +++ b/projects/pegasusdao.js @@ -14,7 +14,7 @@ const lps = [ const shareLps = "0x72c1f5fb7e5513a07e1ff663ad861554887a0a0a"; const genesisPool = "0x64bfCBe4480B53E8234Ca258a96720F29fe6A6fB"; const genesisTokens = [ - "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23", + ADDRESSES.cronos.WCRO_1, ADDRESSES.cronos.USDC, "0x97749c9b61f878a880dfe312d2594ae07aed7656", "0xb8df27c687c6af9afe845a2afad2d01e199f4878", diff --git a/projects/pell/index.js b/projects/pell/index.js index 1ba12511bec8..5ec2b569094b 100644 --- a/projects/pell/index.js +++ b/projects/pell/index.js @@ -1,7 +1,7 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { getConfig } = require('../helper/cache') -const chains = ['merlin', 'bouncebit', 'btr', 'bsc', 'bsquared', 'core', 'bevm', 'mantle', 'scroll', 'bob'] +const chains = ['ethereum', 'arbitrum', 'merlin', 'bouncebit', 'btr', 'bsc', 'base', 'bsquared', 'core', 'bevm', 'mantle', 'scroll', 'bob', 'ailayer', 'iotex', 'rsk'] chains.forEach(chain => { module.exports[chain] = { diff --git a/projects/pendle/v1.js b/projects/pendle/v1.js index 2ab549e92ed9..ea0aa7f361f3 100644 --- a/projects/pendle/v1.js +++ b/projects/pendle/v1.js @@ -1,8 +1,3 @@ -const { - sumTokensAndLPsSharedOwners, - unwrapUniswapLPs -} = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const contracts = require("./contracts"); const { staking } = require("../helper/staking"); @@ -18,125 +13,82 @@ const avaxFundedContracts = Object.keys(contracts.v1.avax.funded); const avaxOtTokens = Object.keys(contracts.v1.avax.otTokens); const avaxPool2Contracts = Object.keys(contracts.v1.avax.pool2); -async function ethTvl(timestamp, block) { - const balances = {}; - let lpBalances = []; +async function ethTvl(api) { const masterChefContract = "0xc2edad668740f1aa35e4d8f227fb8e17dca888cd"; - const masterChefDeposits = await sdk.api.abi.call({ + const masterChefDeposits = await api.call({ target: masterChefContract, abi: abi.userInfo, params: [1, ethFundedContracts[4]], - block: block }); - lpBalances.push({ - token: ethTokens.SLP_ETHUSDC, - balance: masterChefDeposits.output.amount - }); - await unwrapUniswapLPs(balances, lpBalances, block); - - await sumTokensAndLPsSharedOwners( - balances, - [ - [ethTokens.USDC, false], - [ethTokens.aUSDC, false], - [ethTokens.cDAI, false], - [ethTokens.SLP_ETHUSDC, false], - [ethTokens.SLP_PENDLEETH, false], - [ethTokens.SUSHI, false], - [ethTokens.COMP, false], - [ethTokens.wxBTRFLY, false], - [ethTokens.SLP_OT_aUSDC_21, false], - [ethTokens.SLP_OT_aUSDC_22, false], - [ethTokens.SLP_OT_cDAI_21, false], - [ethTokens.SLP_OT_cDAI_22, false], - [ethTokens.SLP_OT_ETHUSDC_22, false], - [ethTokens.SLP_OT_wxBTRFLY_22, false] - ], - ethFundedContracts, - block - ); - for (let token of ethOtTokens) { - delete balances[token.toLowerCase()]; - } - delete balances[ethTokens.PENDLE]; - - return balances; + api.add(ethTokens.SLP_ETHUSDC, masterChefDeposits.amount); + await api.sumTokens({ + owners: ethFundedContracts, tokens: [ + ethTokens.USDC, + ethTokens.aUSDC, + ethTokens.cDAI, + ethTokens.SLP_ETHUSDC, + ethTokens.SLP_PENDLEETH, + ethTokens.SUSHI, + ethTokens.COMP, + ethTokens.wxBTRFLY, + ethTokens.SLP_OT_aUSDC_21, + ethTokens.SLP_OT_aUSDC_22, + ethTokens.SLP_OT_cDAI_21, + ethTokens.SLP_OT_cDAI_22, + ethTokens.SLP_OT_ETHUSDC_22, + ethTokens.SLP_OT_wxBTRFLY_22, + ] + }) + + ethOtTokens.push(ethTokens.PENDLE); + + ethOtTokens.map(i => api.removeTokenBalance(i)) + return api.getBalances() } -async function avaxTvl(timestamp, _, { avax: block }) { - const transform = addr => 'avax:'+addr - const balances = {}; - +async function avaxTvl(api) { const masterChefContract = "0xd6a4F121CA35509aF06A0Be99093d08462f53052"; - const TIME = "avax:0xb54f16fb19478766a268f172c9480f8da1a7c9c3"; - balances[transform(avaxTokens.xJOE)] = (await sdk.api.abi.call({ + const xJOEBalance = (await api.call({ target: masterChefContract, abi: abi.userInfo, params: [24, avaxFundedContracts[0]], - block: block, - chain: "avax" - })).output.amount; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [avaxTokens.USDC, false], - [avaxTokens.qiAVAX, false], - [avaxTokens.qiUSDC, false], - [avaxTokens.xJOE, false], - [avaxTokens.JLP_PENDLEAVAX, false], - [avaxTokens.WAVAX, false], - [avaxTokens.JOE, false], - [avaxTokens.QI, false], - [avaxTokens.MIM, false], - [avaxTokens.wMEMO, false], - [avaxTokens.JLP_OT_PAP, false], - [avaxTokens.JLP_OT_qiUSDC, false], - [avaxTokens.JLP_OT_qiAVAX, false], - [avaxTokens.JLP_OT_xJOE, false], - [avaxTokens.JLP_OT_wMEMO, false] - ], - avaxFundedContracts, - block, - "avax", - transform - ); - - balances[TIME] = (await sdk.api.abi.call({ - target: avaxTokens.wMEMO, - abi: abi.wMEMOToMEMO, - params: [balances[`avax:${avaxTokens.wMEMO}`]], - block: block, - chain: "avax" - })).output; - delete balances[`avax:${avaxTokens.wMEMO}`]; - - for (let token of avaxOtTokens) { - delete balances[`avax:${token.toLowerCase()}`]; - } - - return balances; + })).amount + api.add(avaxTokens.xJOE, xJOEBalance); + await api.sumTokens({ + owners: avaxFundedContracts, tokens: [ + avaxTokens.USDC, + avaxTokens.qiAVAX, + avaxTokens.qiUSDC, + avaxTokens.xJOE, + avaxTokens.JLP_PENDLEAVAX, + avaxTokens.WAVAX, + avaxTokens.JOE, + avaxTokens.QI, + avaxTokens.MIM, + avaxTokens.wMEMO, + avaxTokens.JLP_OT_PAP, + avaxTokens.JLP_OT_qiUSDC, + avaxTokens.JLP_OT_qiAVAX, + avaxTokens.JLP_OT_xJOE, + avaxTokens.JLP_OT_wMEMO, + ] + }) + + avaxOtTokens.map(i => api.removeTokenBalance(i)) + return api.getBalances() } -async function avaxPool2(timestamp, _, { avax: block }) { - const transform = addr => 'avax:'+addr - const pool2 = {}; - - await sumTokensAndLPsSharedOwners( - pool2, - [ - [avaxTokens.JLP_PENDLEAVAX, false], - [avaxTokens.PENDLE, false], - [avaxTokens.JOE, false] - ], - avaxPool2Contracts, - block, - "avax", - transform - ); - return pool2; +async function avaxPool2(api) { + await api.sumTokens({ + owners: avaxPool2Contracts, tokens: [ + avaxTokens.JLP_PENDLEAVAX, + avaxTokens.PENDLE, + avaxTokens.JOE, + ] + }) + return api.getBalances() } module.exports = { diff --git a/projects/pendle/v2.js b/projects/pendle/v2.js index beb4e471bb99..93db46e33423 100644 --- a/projects/pendle/v2.js +++ b/projects/pendle/v2.js @@ -3,58 +3,63 @@ const contracts = require("./contracts"); const { staking } = require("../helper/staking"); const { getLogs } = require("../helper/cache/getLogs"); const bridgedAssets = [ADDRESSES.ethereum.STETH, ADDRESSES.ethereum.EETH]; -const { getConfig } = require('../helper/cache') +const { getConfig } = require('../helper/cache'); const config = { ethereum: { factory: "0x27b1dacd74688af24a64bd3c9c1b143118740784", - factoryV3: "0x1A6fCc85557BC4fB7B534ed835a03EF056552D52", - factoryV4: '0x3d75Bd20C983edb5fD218A1b7e0024F1056c7A2F', fromBlock: 16032059, - fromBlockV3: 18669498, - fromBlockV4: 20323253 + factories: [ + { factory: "0x1a6fcc85557bc4fb7b534ed835a03ef056552d52", fromBlock: 18669498 }, // v3 + { factory: "0x3d75bd20c983edb5fd218a1b7e0024f1056c7a2f", fromBlock: 20323253 }, // v4 + { factory: "0x6fcf753f2c67b83f7b09746bbc4fa0047b35d050", fromBlock: 20512280 }, // v5 + ], }, arbitrum: { factory: "0xf5a7de2d276dbda3eef1b62a9e718eff4d29ddc8", - factoryV3: "0x2FCb47B58350cD377f94d3821e7373Df60bD9Ced", - factoryV4: '0xd9f5e9589016da862D2aBcE980A5A5B99A94f3E8', fromBlock: 62979673, - fromBlockV3: 154873897, - fromBlockV4: 233004891 + factories: [ + { factory: "0x2fcb47b58350cd377f94d3821e7373df60bd9ced", fromBlock: 154873897 }, // v3 + { factory: "0xd9f5e9589016da862d2abce980a5a5b99a94f3e8", fromBlock: 233004891 }, // v4 + { factory: "0xd29e76c6f15ada0150d10a1d3f45accd2098283b", fromBlock: 242035998 }, // v5 + ], }, bsc: { - factory: "0x2bEa6BfD8fbFF45aA2a893EB3B6d85D10EFcC70E", - factoryV3: "0xC40fEbF5A33b8C92B187d9be0fD3fe0ac2E4B07c", - factoryV4: '0x7D20e644D2A9e149e5be9bE9aD2aB243a7835d37', + factory: "0x2bea6bfd8fbff45aa2a893eb3b6d85d10efcc70e", fromBlock: 34060741, - fromBlockV3: 33884419, - fromBlockV4: 40539593, + factories: [ + { factory: "0xc40febf5a33b8c92b187d9be0fd3fe0ac2e4b07c", fromBlock: 33884419 }, // v3 + { factory: "0x7d20e644d2a9e149e5be9be9ad2ab243a7835d37", fromBlock: 40539593 }, // v4 + { factory: "0x7c7f73f7a320364dbb3c9aaa9bccd402040ee0f9", fromBlock: 41294178 }, // v5 + ], pts: [ - "0x5eC2ae0AFDEc891E7702344dc2A31C636B3627Eb", - "0x70c1138B54ba212776d3A9d29b6160C54C31cd5d", - "0x04eb6B56ff53f457c8E857ca8D4fbC8d9a531c0C", + "0x5ec2ae0afdec891e7702344dc2a31c636b3627eb", + "0x70c1138b54ba212776d3a9d29b6160c54c31cd5d", + "0x04eb6b56ff53f457c8e857ca8d4fbc8d9a531c0c", ], }, optimism: { - factory: "0x17F100fB4bE2707675c6439468d38249DD993d58", - factoryV3: "0x4A2B38b9cBd83c86F261a4d64c243795D4d44aBC", - factoryV4: '0x73Be47237F12F36203823BAc9A4d80dC798B7015', + factory: "0x17f100fb4be2707675c6439468d38249dd993d58", fromBlock: 108061448, - fromBlockV3: 112783590, - fromBlockV4: 122792017 + factories: [ + { factory: "0x4a2b38b9cbd83c86f261a4d64c243795d4d44abc", fromBlock: 112783590 }, // v3 + { factory: "0x73be47237f12f36203823bac9a4d80dc798b7015", fromBlock: 122792017 }, // v4 + { factory: "0x02adf72d5d06a9c92136562eb237c07696833a84", fromBlock: 123998311 }, // v5 + ], }, mantle: { - factoryV3: "0xD228EC1f7D4313fe321fab511A872475D07F5bA6", - factoryV4: '0xCa274A44a52241c1a8EFb9f84Bf492D8363929FC', - fromBlockV3: 61484384, - fromBlockV4: 66526601 + factories: [ + { factory: "0xd228ec1f7d4313fe321fab511a872475d07f5ba6", fromBlock: 61484384 }, // v3 + { factory: "0xca274a44a52241c1a8efb9f84bf492d8363929fc", fromBlock: 66526601 }, // v4 + { factory: "0xcb02435716b0143d4ac1bdf370302d619e714126", fromBlock: 67661738 }, // v5 + ], }, }; module.exports = {}; Object.keys(config).forEach((chain) => { - const { factory, factoryV3, factoryV4, fromBlock, pts, fromBlockV3, fromBlockV4 } = config[chain]; + const { factory, fromBlock, pts, factories, } = config[chain]; module.exports[chain] = { tvl: async (api) => { const logs = factory @@ -70,36 +75,20 @@ Object.keys(config).forEach((chain) => { fromBlock, }) : []; + for (let { factory, fromBlock } of factories) { + logs.push( + ...(await getLogs({ + api, + target: factory, + eventAbi: + "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", + onlyArgs: true, + fromBlock, + })) + ); + } - const logsV3 = factoryV3 - ? await getLogs({ - api, - target: factoryV3, - topic: [ - "0xae811fae25e2770b6bd1dcb1475657e8c3a976f91d1ebf081271db08eef920af", - ], - eventAbi: - "event CreateNewMarket (address indexed market, address indexed PT, int256 scalarRoot, int256 initialAnchor, uint256 lnFeeRateRoot)", - onlyArgs: true, - fromBlock: fromBlockV3, - }) - : []; - - 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)); + const pt = logs.map((i) => i.PT); if (pts) pt.push(...pts); let sy = [ ...new Set( diff --git a/projects/penpie/index.js b/projects/penpie/index.js index 6a4d98f2f13c..6c6d6534deb7 100644 --- a/projects/penpie/index.js +++ b/projects/penpie/index.js @@ -3,19 +3,17 @@ const config = require("./config"); const { staking } = require('../helper/staking') async function tvl(api) { - const { masterPenpie, vlPNP } = config[api.chain]; + const { masterPenpie, vlPNP, pendleStaking, mPENDLE, } = config[api.chain]; const poolTokens = await api.fetchList({ lengthAbi: MasterMagpieAbi.poolLength, itemAbi: MasterMagpieAbi.registeredToken, 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, }) - poolTokens.forEach((token, i) => { - api.add(token, poolInfos[i].sizeOfPool) - }) - if (vlPNP) - api.removeTokenBalance(vlPNP) + const blacklistedTokens = [] + if (vlPNP) blacklistedTokens.push(vlPNP) + if (mPENDLE && masterPenpie) await api.sumTokens({ tokens: [mPENDLE], owner: masterPenpie }) + return api.sumTokens({ tokens: poolTokens, owner: pendleStaking, blacklistedTokens }) } Object.keys(config).forEach((chain) => { diff --git a/projects/pepedex/index.js b/projects/pepedex/index.js index ef089cbf8f7e..6e4f3674ca75 100644 --- a/projects/pepedex/index.js +++ b/projects/pepedex/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, ethereum: { tvl: getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0x460b2005b3318982feADA99f7ebF13e1D6f6eFfE', }) diff --git a/projects/percent/index.js b/projects/percent/index.js index 47443768f6eb..02fa8ec81b14 100644 --- a/projects/percent/index.js +++ b/projects/percent/index.js @@ -1,12 +1,9 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { stakings } = require("../helper/staking"); -const { getCompoundV2Tvl } = require("../helper/compound"); +const { compoundExports2 } = require("../helper/compound"); const comptroller = "0xf47dD16553A934064509C40DC5466BBfB999528B"; -const pETH = "0x45F157b3d3d7C415a0e40012D64465e3a0402C64"; -const pETHEquivalent = ADDRESSES.ethereum.WETH; const pool2Contract = "0x23b53026187626Ed8488e119767ACB2Fe5F8de4e"; const lpOfPool2 = "0xEB85B2E12320a123d447Ca0dA26B49E666b799dB"; @@ -69,26 +66,11 @@ module.exports = { ethereum: { staking: stakings(stakingContracts, PCT), pool2: pool2, - borrowed: getCompoundV2Tvl( - comptroller, - "ethereum", - (addr) => addr, - pETH, - pETHEquivalent, - true - ), - tvl: sdk.util.sumChainTvls([ - getCompoundV2Tvl( - comptroller, - "ethereum", - (addr) => addr, - pETH, - pETHEquivalent - ), - ethTvl, - ]), - }, + ...compoundExports2({ comptroller, cether: '0x45f157b3d3d7c415a0e40012d64465e3a0402c64' }), + }, methodology: "Same as compound, we get all the liquidity and the borrowed part on the lending markets", }; + +module.exports.ethereum.tvl = sdk.util.sumChainTvls([module.exports.ethereum.tvl, ethTvl]) \ No newline at end of file diff --git a/projects/perfect-pool/index.js b/projects/perfect-pool/index.js new file mode 100644 index 000000000000..3eabd8a9c758 --- /dev/null +++ b/projects/perfect-pool/index.js @@ -0,0 +1,14 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") +const ADDRESSES = require('../helper/coreAssets.json') + +const NFT_ACE8 = '0x21F3ea812734b6492D88D268622CF068e9E6D596' +const NFT_ACE16 = '0x70A254c8201adbD88d88D17937d5e8aBb8B8095F' + +module.exports = { + start: 1725311445, + base: { + tvl: sumTokensExport( + { owners: [NFT_ACE8, NFT_ACE16], token: ADDRESSES.base.USDC }, + ), + } +} \ No newline at end of file diff --git a/projects/perifinance/abi.json b/projects/perifinance/abi.json deleted file mode 100644 index 4870780e8670..000000000000 --- a/projects/perifinance/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalIssuedPynths": "function totalIssuedPynths(bytes32 currencyKey) view returns (uint256 totalIssued)" -} \ No newline at end of file diff --git a/projects/perifinance/index.js b/projects/perifinance/index.js index 9daf0fe4d524..1810f4bbd6b2 100644 --- a/projects/perifinance/index.js +++ b/projects/perifinance/index.js @@ -1,97 +1,17 @@ -const sdk = require("@defillama/sdk"); -const { totalIssuedPynths } = require("./abi.json"); - -const BigNumber = require("bignumber.js"); - -const ethereum = "ethereum"; -const polygon = "polygon"; -const bsc = "bsc"; - const periFinanceContract = { - ethereum: "0x3a9a93A04eFB22e632632Ab584fF45DEB7321aC8", - polygon: "0x7C4cE79655Ac1e84400bC5962b4B75c2b86Bd974", - bsc: "0x82995a4170318f5E26CA6b650A337738dcc8114c", -}; - -const pUSD = "pUSD"; -const tokenKey = "usd-coin"; - -const totalIssuedPynthByChain = async (chain) => { - const currencyKey = rightPad(asciiToHex(pUSD), 64); - - const { output: totalIssuedPynth } = await sdk.api.abi.call({ - abi: totalIssuedPynths, - params: currencyKey, - target: periFinanceContract[chain], - chain, - }); - return totalIssuedPynth; -}; - -const getTVL = (totalIssuedPynths) => { - return BigNumber(totalIssuedPynths) - .div(10 ** 18) - .times(4); -}; - -const tvlByChain = (chain) => async (timestamp, block) => { - const totalIssuedPynth = await totalIssuedPynthByChain(chain); - - const tvl = getTVL(totalIssuedPynth); - - // toFixed(0) just converts the numbers into strings - return { - [tokenKey]: tvl.toFixed(0), - }; -}; - -module.exports = { - ethereum: { - tvl: tvlByChain(ethereum), - }, - bsc: { - tvl: tvlByChain(bsc), - }, - polygon: { - tvl: tvlByChain(polygon), - }, -}; - - -/** - * Should be called to get hex representation (prefixed by 0x) of ascii string - * - * @method asciiToHex - * @param {String} str - * @returns {String} hex representation of input string - */ - function asciiToHex (str) { - if(!str) - return "0x00"; - var hex = ""; - for(var i = 0; i < str.length; i++) { - var code = str.charCodeAt(i); - var n = code.toString(16); - hex += n.length < 2 ? '0' + n : n; - } - - return "0x" + hex; + ethereum: "0x0207157a7c154bFdEAD22751474c68660A4a540b", + polygon: "0x8f151e700772d6e8Dc7dA8B260c9e0C3eCbF4174", + bsc: "0x2Da103C31c4A80f828ea4158bD090e926003e8ad", + base: "0x0f2Af7246e1FcbEC5e334092B1F0D91BDA924faD", + moonriver: "0xB2f5Cd646Aab5f887150945576d51a8B5902F288", + moonbeam: "0x0f2Af7246e1FcbEC5e334092B1F0D91BDA924faD", } -/** - * Should be called to pad string to expected length - * - * @method rightPad - * @param {String} string to be padded - * @param {Number} chars that result string should have - * @param {String} sign, by default 0 - * @returns {String} right aligned string - */ -function rightPad(string, chars, sign) { - var hasPrefix = /^0x/i.test(string) || typeof string === 'number'; - string = string.toString(16).replace(/^0x/i,''); +Object.keys(periFinanceContract).forEach(chain => module.exports[chain] = { tvl }) - var padding = (chars - string.length + 1 >= 0) ? chars - string.length + 1 : 0; - - return (hasPrefix ? '0x' : '') + string + (new Array(padding).join(sign ? sign : "0")); -} \ No newline at end of file +async function tvl(api) { + const contract = periFinanceContract[api.chain]; + const pUSD = await api.call({ abi: 'function pUSD() view returns (bytes32)', target: contract}) + const totalIssued = await api.call({ abi: "function totalIssuedPynths(bytes32 currencyKey) view returns (uint256 totalIssued)", target: contract, params: pUSD}) + api.addCGToken("usd-coin", totalIssued * 4 / 1e18) +} diff --git a/projects/perseid-finance/index.js b/projects/perseid-finance/index.js index fe2325cb810e..ac8fe9197837 100644 --- a/projects/perseid-finance/index.js +++ b/projects/perseid-finance/index.js @@ -38,6 +38,7 @@ module.exports = { hallmarks: [ [1699578000,"Rug Pull"] ], + deadFrom: '2023-11-10', scroll: { tvl: getTvl(false), staking: getTvl(true), diff --git a/projects/pheasantswap/index.js b/projects/pheasantswap/index.js index 4941297bcf09..0b83580755f0 100644 --- a/projects/pheasantswap/index.js +++ b/projects/pheasantswap/index.js @@ -1,5 +1,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { - enuls: { tvl: getUniTVL({ factory: '0x7bf960B15Cbd9976042257Be3F6Bb2361E107384', useDefaultCoreAssets: true, fetchBalances: true }), }, + enuls: { tvl: getUniTVL({ factory: '0x7bf960B15Cbd9976042257Be3F6Bb2361E107384', useDefaultCoreAssets: true,}), }, } diff --git a/projects/phemex/index.js b/projects/phemex/index.js index 8aaad51c9925..3bb13492a33a 100644 --- a/projects/phemex/index.js +++ b/projects/phemex/index.js @@ -1,10 +1,9 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { bitcoin: { - owners: [ - '3PiGxVdpMjWSsH8X8BypdwcsmPW5cmE4Ta', - ] + owners: bitcoinAddressBook.phemex }, ethereum: { owners: [ diff --git a/projects/photon-protocol/index.js b/projects/photon-protocol/index.js index 0028dd3dab7b..c5d25c1aeac8 100644 --- a/projects/photon-protocol/index.js +++ b/projects/photon-protocol/index.js @@ -1,24 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakingUnknownPricedLP } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const photon = "0x2F1305F0619ADa14688A4291953bd7d284f9C2a5"; const stakingContract = "0x81177472Ce36A9b1AB573804CD215C72cEb76F36"; const photonbusd = "0xEBAa17dA7D5C616441290669E9D2c982c8B1Da25"; //PHOTON-BUSD const treasury = "0x0f90591b01DE6F832e8B8E4ec3525efD423BCaD1"; -const treasuryTokens = [ - [ADDRESSES.bsc.BUSD, false], // BUSD -]; - -async function tvl (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, treasuryTokens, [treasury], chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`); - return balances; -} module.exports = { - bsc: { - tvl, - staking: stakingUnknownPricedLP(stakingContract, photon, "bsc", photonbusd, addr=>`bsc:${addr}`) - } + bsc: { + tvl: sumTokensExport({ tokens: [ADDRESSES.bsc.BUSD], owner: treasury }), + staking: stakingUnknownPricedLP(stakingContract, photon, "bsc", photonbusd, addr => `bsc:${addr}`) + } } \ No newline at end of file diff --git a/projects/phuture/index.js b/projects/phuture/index.js index 59f633ace711..5fef08de283e 100644 --- a/projects/phuture/index.js +++ b/projects/phuture/index.js @@ -71,19 +71,19 @@ const indexTvl = (chain) => async (timestamp, block, chainBlocks) => { const savingsVaultTvl = (chain) => async (api) => { const calls = networks[chain]["savingsVaults"] - const assets = await api.multiCall({ - abi: savingsVaultAbi.asset, calls, - }) - const totalAssets = await api.multiCall({ - abi: savingsVaultAbi.totalAssets, calls, - }) - const balances = {} + const [assets, totalAssets] = await Promise.all([ + api.multiCall({ abi: savingsVaultAbi.asset, calls }), + api.multiCall({ abi: savingsVaultAbi.totalAssets, calls, permitFailure: true }) + ]) - totalAssets.forEach((bal, i) => { - const token = assets[i] - if (!bal && calls[i].toLowerCase() === '0x6bad6a9bcfda3fd60da6834ace5f93b8cfed9598') return; - sdk.util.sumSingleBalance(balances, token, bal, chain) + const balances = {}; + calls.forEach((call, i) => { + const asset = assets[i] + const bal = totalAssets[i] + if(!bal) return; + sdk.util.sumSingleBalance(balances, asset, bal, chain) }) + return balances }; diff --git a/projects/piedao/pieDAO.js b/projects/piedao/pieDAO.js index 70636d9d6db6..831a56b5c24e 100644 --- a/projects/piedao/pieDAO.js +++ b/projects/piedao/pieDAO.js @@ -9,8 +9,14 @@ tokensAndOwners.push( ['0xFAE2809935233d4BfE8a56c2355c4A2e7d1fFf1A', '0x8314337d2b13e1A61EadF0FD1686b2134D43762F'], ) -const pieABI = require("../config/piedao/abi/IPie.json"); -const pieStakingAll = require("../config/piedao/abi/IStakingAll.json"); +const pieABI = { + "totalSupply": "uint256:totalSupply", + "calcTokensForAmount": "function calcTokensForAmount(uint256 _amount) view returns (address[] tokens, uint256[] amounts)" +} +const pieStakingAll = { + "poolCount": "uint256:poolCount", + "getPoolToken": "function getPoolToken(uint256 _poolId) view returns (address)" +} async function addPools(api) { const stakingC = '0x6de77A304609472A4811a0BFD47d8682Aebc29df' diff --git a/projects/piggybankdao/index.js b/projects/piggybankdao/index.js index 35ae27603281..fa5a36a6a6a7 100644 --- a/projects/piggybankdao/index.js +++ b/projects/piggybankdao/index.js @@ -1,33 +1,17 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {sumTokensAndLPsSharedOwners, sumLPWithOnlyOneToken} = require('../helper/unwrapLPs') const { stakingPricedLP } = require('../helper/staking') -const treasury = "0x6687379035822ee15e2164f9C1280fBEAd0D7627"; const PB_TOKEN = "0x0E75CDb914DdCcA683357dD94d26Caa39BC14B16" const LP_TOKEN = "0xd3a6eebbe6f6d9197a7fc2aaaf94d8b0ec51f8a8"; const STAKING_ADDRESS = "0xE4738791690AF507C8C7Bf5981ef541568C7C312" const COREASSETNAME = "magic-internet-money"; const CHAIN = "avax"; -const MIM = "0x130966628846bfd36ff31a822705796e8cb8c18d" - - -async function avaxTvl(time, ethBlock, chainBlocks){ - const balances = {} - const transform = addr => 'avax:'+addr - await sumLPWithOnlyOneToken(balances, "0xd3a6eebbe6f6d9197a7fc2aaaf94d8b0ec51f8a8", treasury, MIM, chainBlocks.avax, "avax", transform) - await sumTokensAndLPsSharedOwners(balances, [ - [MIM, false], - [ADDRESSES.avax.WBTC_e, false] - ], [treasury], chainBlocks.avax, "avax", transform) - return balances -} module.exports={ deadFrom: 1648765747, misrepresentedTokens: true, avax:{ - tvl: avaxTvl, + tvl: () => ({}), staking: stakingPricedLP(STAKING_ADDRESS, PB_TOKEN, CHAIN, LP_TOKEN, COREASSETNAME, true), } } diff --git a/projects/pionex-cex/index.js b/projects/pionex-cex/index.js new file mode 100644 index 000000000000..7abac83d7025 --- /dev/null +++ b/projects/pionex-cex/index.js @@ -0,0 +1,36 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + ethereum: { + owners: [ + "0xf6d4e5a7c5215f91f59a95065190cca24bf64554", + "0x2a8a276019d3ec549ae657c945ef60aab4e33c9b", + "0xa008dc1281aa6bff98b2c253ee8fd759ba918103", + "0x28410a70acc5f01e4efe892bcc38b70f3bcf014b", + "0x4608fbf5fd78879ba0a75c6c0b0f5e53e188d3e2", + "0x5e483d7803a8b39f0d6792a0431176a91fde6e31", + "0x7175a01564ac4a83dd396e288a2707dee86caf63", + "0x4998cb57364531560f4048213ba9b529ec27f14f", + "0x02104cae462af17739cc4315ef9ac710a9ed22a7" + ], + }, + bitcoin: { + owners: bitcoinAddressBook.pionexCex, + }, + tron: { + owners: [ + "TYULGbfdheMSQBv7skFxNbgo7mbNjsWSrF", + "TDr8tDBgYLtrfPmC4erXp7eRgvVNM32EKp", + "TQZPjLBwG8JW7J8LJ3vBbXU6UxAyxH1367", + "TDe3wqxhTSPimeQkJVKNBkCjRnUj839MKj", + "TGMX4ipWLrjqZq7yM4cGVNr124BFrRYtWz", + "TJZj4RS6v6U3HCpTSJ7CwNycRcoi7BREGx", + "TLK8GVBqJNmcyaN5mpSPSzQfTjsSxb7sC9", + "TGgMNPxdyUgdYwMSbMkpTPvaSkrRakKqcK", + "TAA7sxJ259JgstGPjanb5sB6ZJuCPtCobs" + ], + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/pit/index.js b/projects/pit/index.js new file mode 100644 index 000000000000..dc7bf29106cb --- /dev/null +++ b/projects/pit/index.js @@ -0,0 +1,37 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') +const { getConfig } = require('../helper/cache') + +async function tvl(api) { + let data = await getConfig('pit/' + api.chain, `https://ydaemon.pit.finance/vaults/all?chainids=${api.chainId}&limit=100000`) + 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 => !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) + }) + return sumTokens2({ api, resolveLP: true, }) +} + + +module.exports = { + doublecounted: true +} + +const chains = ['sei'] + +chains.forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/pixel-swap/index.js b/projects/pixel-swap/index.js new file mode 100644 index 000000000000..a8cb5deee960 --- /dev/null +++ b/projects/pixel-swap/index.js @@ -0,0 +1,15 @@ +const { get } = require('../helper/http') + +async function tvl(api) { + const res = await get("https://api.pixelswap.io/apis/tokens"); + const tokens = res.data.tokens.map(i => i.address); + const balances = res.data.tokens.map(i => i.tokenBalance); + + api.addTokens(tokens, balances); + } + + module.exports = { + ton: { + tvl, + } + }; diff --git a/projects/pixelswap/index.js b/projects/pixelswap/index.js index c193fcdc7569..f974b5fa5bd2 100644 --- a/projects/pixelswap/index.js +++ b/projects/pixelswap/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const FACTORY = "0xD07739a9E9C46D3DedeD97c0edC49cea8BAB1Bb9" const ZKSYNC_FACTORY = "0x8435bd22e705DCeFCf6EF8b921E6dB534a4E9902" -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true, }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true,}) module.exports = { misrepresentedTokens: true, @@ -22,7 +22,6 @@ module.exports = { tvl: getUniTVL({ factory: ZKSYNC_FACTORY, useDefaultCoreAssets: true, - fetchBalances: true, }) }, scroll: { diff --git a/projects/planet-green/index.js b/projects/planet-green/index.js index a03e3671059a..af9a01976033 100644 --- a/projects/planet-green/index.js +++ b/projects/planet-green/index.js @@ -1,21 +1,14 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports, methodology, } = require("../helper/compound"); const { mergeExports } = require("../helper/utils"); - - const compoundTVL1 = compoundExports( '0xF54f9e7070A1584532572A6F640F09c606bb9A83', - 'bsc', '0x24664791B015659fcb71aB2c9C0d56996462082F', - ADDRESSES.bsc.WBNB ) const compoundTVL2 = compoundExports( '0x1e0C9D09F9995B95Ec4175aaA18b49f49f6165A3', - 'bsc', '0x190354707Ad8221bE30bF5f097fa51C9b1EbdB29', - ADDRESSES.bsc.WBNB ) // node test.js projects/planet-green/index.js diff --git a/projects/plantbaseswap/index.js b/projects/plantbaseswap/index.js index 86bf38a600d7..390f6a6c6539 100644 --- a/projects/plantbaseswap/index.js +++ b/projects/plantbaseswap/index.js @@ -3,7 +3,7 @@ const PLANT = "0x23082Dd85355b51BAe42248C961E7F83486e7694"; const FACTORY = "0xA081Ce40F079A381b59893b4Dc0abf8B1817af70" -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, }) module.exports = { diff --git a/projects/pluto-so/idl.json b/projects/pluto-so/idl.json new file mode 100644 index 000000000000..cb5ca018fb90 --- /dev/null +++ b/projects/pluto-so/idl.json @@ -0,0 +1,117 @@ +{ + "address": "5UFYdXHgXLMsDzHyv6pQW9zv3fNkRSNqHwhR7UPnkhzy", + "metadata": {"name": "pluto", "version": "0.1.0", "spec": "0.1.0", "description": "Created with Anchor"}, + "instructions": [], + "accounts": [ + {"name": "vaultEarn", "discriminator": [255, 18, 25, 189, 255, 106, 176, 136]}, + {"name": "vaultLeverage", "discriminator": [135, 160, 136, 66, 119, 36, 19, 115]} + ], + "events": [], + "errors": [], + "types": [ + { + "name": "vaultEarn", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "isInitialized", "type": "bool"}, + {"name": "version", "type": "u8"}, + {"name": "bump", "type": "u8"}, + {"name": "align0", "type": {"array": ["u8", 5]}}, + {"name": "protocol", "type": "pubkey"}, + {"name": "earnStats", "type": "pubkey"}, + {"name": "creator", "type": "pubkey"}, + {"name": "authority", "type": "pubkey"}, + {"name": "earnConfig", "type": "pubkey"}, + {"name": "vaultLiquidity", "type": "pubkey"}, + {"name": "priceOracle", "type": "pubkey"}, + {"name": "priceFeed", "type": {"array": ["u8", 64]}}, + {"name": "tokenProgram", "type": "pubkey"}, + {"name": "tokenMint", "type": "pubkey"}, + {"name": "tokenDecimal", "type": "u8"}, + {"name": "align1", "type": {"array": ["u8", 7]}}, + {"name": "lastUpdated", "type": "i64"}, + {"name": "unitSupply", "type": "u128"}, + {"name": "unitBorrowed", "type": "u128"}, + {"name": "unitLent", "type": "u128"}, + {"name": "unitLeverage", "type": "u128"}, + {"name": "index", "type": "u128"}, + {"name": "lastIndexUpdated", "type": "i64"}, + {"name": "apy", "type": {"defined": {"name": "rate"}}}, + {"name": "padding1", "type": {"array": ["u64", 64]}} + ] + } + }, + { + "name": "rate", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "lastUpdated", "type": "i64"}, + {"name": "lastValue", "type": "u32"}, + {"name": "align0", "type": {"array": ["u8", 4]}}, + {"name": "lastEmaHourUpdated", "type": "i64"}, + {"name": "emaHourly", "type": "u32"}, + {"name": "align1", "type": {"array": ["u8", 4]}}, + {"name": "lastEmaDayUpdated", "type": "i64"}, + {"name": "ema3d", "type": "u32"}, + {"name": "ema7d", "type": "u32"}, + {"name": "ema14d", "type": "u32"}, + {"name": "ema30d", "type": "u32"}, + {"name": "ema90d", "type": "u32"}, + {"name": "ema180d", "type": "u32"}, + {"name": "ema365d", "type": "u32"}, + {"name": "align2", "type": {"array": ["u8", 4]}}, + {"name": "padding1", "type": {"array": ["u64", 7]}} + ] + } + }, + { + "name": "vaultLeverage", + "serialization": "bytemuckunsafe", + "repr": {"kind": "c"}, + "type": { + "kind": "struct", + "fields": [ + {"name": "isInitialized", "type": "bool"}, + {"name": "version", "type": "u8"}, + {"name": "bump", "type": "u8"}, + {"name": "align0", "type": {"array": ["u8", 5]}}, + {"name": "protocol", "type": "pubkey"}, + {"name": "leverageStats", "type": "pubkey"}, + {"name": "creator", "type": "pubkey"}, + {"name": "authority", "type": "pubkey"}, + {"name": "leverageConfig", "type": "pubkey"}, + {"name": "borrowVault", "type": "pubkey"}, + {"name": "tokenCollateralPriceOracle", "type": "pubkey"}, + {"name": "tokenCollateralPriceFeed", "type": {"array": ["u8", 64]}}, + {"name": "tokenCollateralTokenProgram", "type": "pubkey"}, + {"name": "tokenCollateralTokenMint", "type": "pubkey"}, + {"name": "tokenCollateralVaultLiquidity", "type": "pubkey"}, + {"name": "tokenCollateralTokenDecimal", "type": "u8"}, + {"name": "align1", "type": {"array": ["u8", 7]}}, + {"name": "nativeCollateralPriceOracle", "type": "pubkey"}, + {"name": "nativeCollateralPriceFeed", "type": {"array": ["u8", 64]}}, + {"name": "nativeCollateralTokenProgram", "type": "pubkey"}, + {"name": "nativeCollateralTokenMint", "type": "pubkey"}, + {"name": "nativeCollateralVaultLiquidity", "type": "pubkey"}, + {"name": "nativeCollateralTokenDecimal", "type": "u8"}, + {"name": "align2", "type": {"array": ["u8", 7]}}, + {"name": "lastUpdated", "type": "i64"}, + {"name": "borrowingUnitSupply", "type": "u128"}, + {"name": "borrowingIndex", "type": "u128"}, + {"name": "unitSupply", "type": "u128"}, + {"name": "index", "type": "u128"}, + {"name": "lastIndexUpdated", "type": "i64"}, + {"name": "borrowingApy", "type": {"defined": {"name": "rate"}}}, + {"name": "apy", "type": {"defined": {"name": "rate"}}}, + {"name": "padding1", "type": {"array": ["u64", 64]}} + ] + } + } + ] +} \ No newline at end of file diff --git a/projects/pluto-so/index.js b/projects/pluto-so/index.js new file mode 100644 index 000000000000..0fa02757e886 --- /dev/null +++ b/projects/pluto-so/index.js @@ -0,0 +1,75 @@ +const { getProvider } = require("../helper/solana"); +const { Program } = require("@coral-xyz/anchor"); +const PlutosoIDL = require("./idl.json"); + +let program + +function getProgram() { + if (!program) { + program = new Program(PlutosoIDL, getProvider()); + } + return program; +} + +async function tvl(api) { + await earnTvl(api) + await leverageTvl(api) +} + +async function borrowed(api) { + return leverageTvl(api, true) +} + +const HNST_VAULT = 'C5uSiUij9P6nWUQBDF8CeJQnYQMeKJWhANRDirGHHD28' + +async function staking(api) { + const pluto = getProgram() + + const earnHnst = await pluto.account.vaultEarn.fetch(HNST_VAULT) + + let unitHnst = earnHnst.unitSupply.toString() / 1e8 + let indexHnst = earnHnst.index.toString() / 1e12 + let amountHnst = unitHnst * indexHnst + + api.add(earnHnst.tokenMint.toString(), amountHnst * (10 ** earnHnst.tokenDecimal)); +} + +async function earnTvl(api) { + const pluto = getProgram() + const vaultData = await pluto.account.vaultEarn.all() + vaultData.forEach(({ publicKey, account }) => { + if (publicKey.toString() === HNST_VAULT) return; + let unit = (account.unitSupply.toNumber() - account.unitBorrowed.toNumber()) / 1e8 + let index = account.index.toString() / 1e12 + let amount = unit * index + api.add(account.tokenMint.toString(), amount * (10 ** account.tokenDecimal)); + }) +} + +async function leverageTvl(api, isBorrow = false) { + const pluto = getProgram() + const vaultData = await pluto.account.vaultLeverage.all() + vaultData.forEach(({ account }) => { + if (isBorrow) { + let unit = account.borrowingUnitSupply.toString() / 1e8 + let index = account.borrowingIndex.toString() / 1e12 + let amount = unit * index + api.add(account.tokenCollateralTokenMint.toString(), amount * (10 ** account.tokenCollateralTokenDecimal)); + } else { + let unit = account.unitSupply.toString() / 1e8 + let index = account.index.toString() / 1e12 + let amount = unit * index + api.add(account.nativeCollateralTokenMint.toString(), amount * (10 ** account.nativeCollateralTokenDecimal)); + } + }) +} + +module.exports = { + timetravel: false, + methodology: "The Total Value Locked (TVL) is calculated as the sum of leveraged position assets and the available assets deposited in Earn Vaults.", + solana: { + staking, + tvl, + // borrowed, + }, +}; diff --git a/projects/polkamarkets/index.js b/projects/polkamarkets/index.js index f7805480d3a5..8d654cd55e4f 100644 --- a/projects/polkamarkets/index.js +++ b/projects/polkamarkets/index.js @@ -1,90 +1,79 @@ -const sdk = require("@defillama/sdk"); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') -const protocols = [ - { - chain: "moonriver", - predictionMarketContractAddress: "0xdcbe79f74c98368141798ea0b7b979b9ba54b026", - realitioContractAddress: "0x60d7956805ec5a698173def4d0e1ecdefb06cc57", - polkAddress: "0x8b29344f368b5fa35595325903fe0eaab70c8e1f" - }, - { - chain: "moonbeam", - predictionMarketContractAddress: "0x21DFb0a12D77f4e0D2cF9008d0C2643d1e36DA41", - realitioContractAddress: "0x83d3f4769a19f1b43337888b0290f5473cf508b2", - polkAddress: "0x8b29344f368b5fa35595325903fe0eaab70c8e1f" +const config = { + ethereum: { + polk: '0xd478161c952357f05f0292b56012cd8457f1cfbf', + stakingContracts: [ + "0xfa443f0ec4aed3e87c6d608ecf737a83d950427b", // realitio v1 + ], + v1: '0xc24a02d81dee67fd52cc95b0d04172032971ea10', }, - { - chain: "ethereum", - predictionMarketContractAddress: "0xc24a02d81dee67fd52cc95b0d04172032971ea10", - realitioContractAddress: "0xfa443f0ec4aed3e87c6d608ecf737a83d950427b", - polkAddress: "0xd478161c952357f05f0292b56012cd8457f1cfbf" - } -]; - -function chainTvl(chain) { - return async function tvl({timestamp}, ethBlock, chainBlocks) { - const balances = {}; - const chainProtocols = protocols.filter(protocol => protocol.chain === chain); - const block = chainBlocks[chain]; - - for (const protocol of chainProtocols) { - const balance = ( - await sdk.api.eth.getBalance({ - target: protocol.predictionMarketContractAddress, - params: timestamp, - chain, - block, - }) - ).output; - - sdk.util.sumSingleBalance(balances, protocol.chain, Number(balance) / 1e18); - } - - return balances; - } -} - -function chainStaking(chain) { - return async function staking(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const chainProtocols = protocols.filter(protocol => protocol.chain === chain); - const block = chainBlocks[chain]; - - for (const protocol of chainProtocols) { - const polkBalance = ( - await sdk.api.erc20.balanceOf({ - target: protocol.polkAddress, - owner: protocol.realitioContractAddress, - params: timestamp, - chain, - block, - }) - ).output; - - sdk.util.sumSingleBalance( - balances, - "polkamarkets", - Number(polkBalance) / 1e18 - ); - } - - return balances; - } -} - -module.exports = { - methodology: - "Polkamarkets TVL equals the contracts' EVM balance + bonds contracts' POLK balance.", moonriver: { - tvl: chainTvl('moonriver'), - staking: chainStaking('moonriver') + polk: '0x8b29344f368b5fa35595325903fe0eaab70c8e1f', + stakingContracts: [ + "0x60d7956805ec5a698173def4d0e1ecdefb06cc57", // realitio v1 + "0x9aB1213d360bEa3edA75D88D81D7fbfc9fd37F2b", // realitio v2 + ], + v1: '0xdcbe79f74c98368141798ea0b7b979b9ba54b026', + v2: { + contract: '0x6413734f92248D4B29ae35883290BD93212654Dc', + tokens: ['0x98878b06940ae243284ca214f92bb71a2b032b8a'], + }, }, moonbeam: { - tvl: chainTvl('moonbeam'), - staking: chainStaking('moonbeam') + polk: '0x8b29344f368b5fa35595325903fe0eaab70c8e1f', + stakingContracts: [ + "0x83d3f4769a19f1b43337888b0290f5473cf508b2", // realitio v1 + "0xf5872382381cc1a37993d185abb6281fe47f5380", // realitio v2 + ], + v1: '0x21DFb0a12D77f4e0D2cF9008d0C2643d1e36DA41', + v2: { + contract: '0xaaC0068EbE0BFff0FE5E3819af0c46850dC4Cc05', + tokens: ['0xacc15dc74880c9944775448304b263d191c6077f'], + }, }, - ethereum: { - tvl: chainTvl('ethereum'), - staking: chainStaking('ethereum') + polygon: { + polk: '0x996F19d4b1cE6D5AD72CEaaa53152CEB1B187fD0', + stakingContracts: [ + "0x83d3f4769a19f1b43337888b0290f5473cf508b2", // realitio v2 + ], + v2: { + contract: '0x60d7956805ec5a698173def4d0e1ecdefb06cc57', + tokens: [ADDRESSES.polygon.WMATIC_2, ADDRESSES.polygon.USDC, ADDRESSES.polygon.USDT], + }, + }, + xdai: { + polk: '0x9a2a80c38abb1fdc3cb0fbf94fefe88bef828e00', + stakingContracts: [ + "0x537dc41fbb4f9faa4b9d6f8e6c2eb9071274f72b", // predictionMarketV3Manager + "0xBC39fa757886E8A56422Abc460b1FFfc70bbaeC6", // predictionMarketV3Factory + ], + }, + celo: { + polk: '0xb4d8a602fff7790eec3f2c0c1a51a475ee399b2d', + stakingContracts: [ + "0x1f021be85d6b4d1867c43ef98d30ccc5a44791de", // predictionMarketV3Manager + "0x0ec82449555efbe9a67cc51de3ef23a56dd79352", // predictionMarketV3Factory + ], }, -}; +} + +module.exports = { + methodology: + "Polkamarkets TVL equals the V1 contracts' EVM balance + V2 contracts tokens balance.\n Polkamarkets staking TVL is the POLK balance of the V1+V2 bonds contracts, plus the POLK balance of V3 predictionMarketManager and predictionMarketFactory contracts.", +} + +Object.keys(config).forEach(chain => { + const { v1, v2, polk = ADDRESSES.null, stakingContracts = [] } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const ownerTokens = [] + if (v1) ownerTokens.push([[ADDRESSES.null], v1]) + if (v2) ownerTokens.push([v2.tokens, v2.contract]) + return sumTokens2({ api, ownerTokens, blacklistedTokens: polk ? [polk] : [] }) + }, + staking: staking(stakingContracts, polk ?? []), + } +}) diff --git a/projects/polter/index.js b/projects/polter/index.js index ccd803861128..50d421564c17 100644 --- a/projects/polter/index.js +++ b/projects/polter/index.js @@ -1,12 +1,28 @@ const { aaveV2Export } = require('../helper/aave') const { sumTokensExport } = require("../helper/unknownTokens") -const POLTER_CONTRACT = '0x5c725631FD299703D0A74C23F89a55c6B9A0C52F' -const MULTIFEE_CONTRACT = '0xb0F8fe472422Ae582a535b5418C82Ff0F9fa9267' -const POLTER_LP_CONTRACT = '0x44C85D45EB17C8A6b241807BE5c9c48201F91837' +const fantom = { + POLTER_CONTRACT: '0x5c725631FD299703D0A74C23F89a55c6B9A0C52F', + MULTIFEE_CONTRACT: '0xb0F8fe472422Ae582a535b5418C82Ff0F9fa9267', + POLTER_LP_CONTRACT: '0x44C85D45EB17C8A6b241807BE5c9c48201F91837', + POLTER_LENDINGPOOL_CONTRACT: '0x867fAa51b3A437B4E2e699945590Ef4f2be2a6d5' +} + +const base = { + POLTER_CONTRACT: '0xA0820613976B441E2c6A90E4877E2fb5f7D72552', + MULTIFEE_CONTRACT: '0x0B7B45A920Ae54f066b6c013fEdF27C37840dE38', + POLTER_LP_CONTRACT: '0xee7ef14845c466b30f7f4a41f5491df8824cb64e', + POLTER_LENDINGPOOL_CONTRACT: '0x33CA62504cebAB919f0FCa94562413ee121A9798' +} + module.exports = { - fantom: aaveV2Export('0x867fAa51b3A437B4E2e699945590Ef4f2be2a6d5'), + hallmarks: [ + [1731715200,"Price Oracle Exploit"] + ], + fantom: aaveV2Export(fantom.POLTER_LENDINGPOOL_CONTRACT), + base: aaveV2Export(base.POLTER_LENDINGPOOL_CONTRACT), } -module.exports.fantom.staking = sumTokensExport({ owner: MULTIFEE_CONTRACT, tokens: [POLTER_CONTRACT], lps: [POLTER_LP_CONTRACT], useDefaultCoreAssets: true, }) \ No newline at end of file +module.exports.fantom.staking = sumTokensExport({ owner: fantom.MULTIFEE_CONTRACT, tokens: [fantom.POLTER_CONTRACT], lps: [fantom.POLTER_LP_CONTRACT], useDefaultCoreAssets: true, }) +module.exports.base.staking = sumTokensExport({ owner: base.MULTIFEE_CONTRACT, tokens: [base.POLTER_CONTRACT], lps: [base.POLTER_LP_CONTRACT], useDefaultCoreAssets: true, }) diff --git a/projects/polygon/index.js b/projects/polygon/index.js index 90168975dadd..4af516fc7fe1 100644 --- a/projects/polygon/index.js +++ b/projects/polygon/index.js @@ -74,7 +74,7 @@ async function tvl(_, block, _c) { '0x1494ca1f11d487c2bbe4543e90080aeba4ba3c2b', '0xc944e90c64b2c07662a292be6244bdf05cda44a7', '0x04Fa0d235C4abf4BcF4787aF4CF447DE572eF828', - '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', + ADDRESSES.ethereum.FXS, '0x43Dfc4159D86F3A37A5A4B3D4580b888ad7d4DDd', '0x0cec1a9154ff802e7934fc916ed7ca50bde6844e', '0xa47c8bf37f92abed4a126bda807a7b7498661acd', diff --git a/projects/polylend/index.js b/projects/polylend/index.js index 9ba41447cc55..6244eecce6d5 100644 --- a/projects/polylend/index.js +++ b/projects/polylend/index.js @@ -1,7 +1,10 @@ const { aaveExports } = require("../helper/aave"); module.exports = { + deadFrom: '2023-11-23', polygon_zkevm: aaveExports("polygon_zkevm", undefined, undefined, [ "0x27268393Fb8CD0556A62C749C9E70aA537910acc", ]), }; + +module.exports.polygon_zkevm.borrowed = () => ({}) // bad debt diff --git a/projects/polynomial-bridge/index.js b/projects/polynomial-bridge/index.js new file mode 100644 index 000000000000..0823b48f2d27 --- /dev/null +++ b/projects/polynomial-bridge/index.js @@ -0,0 +1,48 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xDE1617Ddb7C8A250A409D986930001985cfad76F", // usdc vault + ADDRESSES.polynomial.SDAI, // sdai vault + "0xC6cfb996A7CFEB89813A68CD13942CD75553032b", // susde vault + "0x034cbb620d1e0e4C2E29845229bEAc57083b04eC" // eth bridge + ], + tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.SDAI, ADDRESSES.ethereum.sUSDe, nullAddress], + }), + }, + optimism: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xc374967634133F5Ed1DF5050276e5B33986625D3", // usdc vault + ], + tokens: [ADDRESSES.optimism.USDC_CIRCLE], + }), + }, + base: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0x038bc0f438C6b46FaCc5C83475925F4Dc111d79F", // usdc vault + ], + tokens: [ADDRESSES.base.USDC], + }), + }, + arbitrum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + ADDRESSES.polynomial.SDAI, // usdc vault + ], + tokens: [ADDRESSES.arbitrum.USDC_CIRCLE], + }), + }, +}; diff --git a/projects/polynomial-liquidity-layer/index.js b/projects/polynomial-liquidity-layer/index.js new file mode 100644 index 000000000000..dda769ab1fa6 --- /dev/null +++ b/projects/polynomial-liquidity-layer/index.js @@ -0,0 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + + +module.exports = { + polynomial: { + tvl: sumTokensExport({ owner: '0xc133983D6d9140923b5eaE52664221d9099cf119', tokens: [ADDRESSES.polynomial.USDC,ADDRESSES.polynomial.SDAI, ADDRESSES.polynomial.sUSDe]}) + } +} \ No newline at end of file diff --git a/projects/polynomial-trade/index.js b/projects/polynomial-trade/index.js index 31dfb2e3a12b..14eae14d24aa 100644 --- a/projects/polynomial-trade/index.js +++ b/projects/polynomial-trade/index.js @@ -4,18 +4,31 @@ const { get } = require('../helper/http'); // api const BASE_URL = "https://perps-v2-mainnet.polynomial.fi/snx-perps/tvl"; -async function tvl (timestamp, ethBlock) { +const BASE_URL_POLYNOMIAL_CHAIN = "https://perps-api-mainnet.polynomial.finance/core/portfolio/tvl"; + +async function tvl_optimism_chain (timestamp, ethBlock) { const perpApi = await get(BASE_URL); return { [`ethereum:${ADDRESSES.ethereum.sUSD}`]: perpApi.tvl * 1e18 }; } +async function tvl_polynomial_chain(timestamp, ethBlock) { + const perpApi = await get(BASE_URL_POLYNOMIAL_CHAIN); + return { + [`ethereum:${ADDRESSES.ethereum.USDC}`]: perpApi.tvl * 1e6 + }; +} + module.exports = { optimism: { - tvl + tvl:tvl_optimism_chain + }, + polynomial: { + tvl: tvl_polynomial_chain }, hallmarks:[ - [1679918400, "Trade Launch"] + [1679918400, "Trade Launch"], + [1724248800, "Polynomial Trade Launch"] ] } \ No newline at end of file diff --git a/projects/polyo-exchange/index.js b/projects/polyo-exchange/index.js index 3d98b3c4fc1d..88ef0ce6282a 100644 --- a/projects/polyo-exchange/index.js +++ b/projects/polyo-exchange/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { deadFrom } = require('../mosquitos-finance'); // polyo Asset Address const Asset_P01_BUSD = "0xC72e6f8041183EaD6f85839bD463F7aD0f14A40D"; @@ -31,5 +32,6 @@ module.exports = { }, hallmarks: [ [1662842254, "Rug pull"], - ] + ], + deadFrom: 1662842254 }; diff --git a/projects/pooltogether-v5/index.js b/projects/pooltogether-v5/index.js index 879280fd6d63..914ca37adf2e 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', 'base', 'arbitrum'] +const chains = ['optimism', 'base', 'arbitrum', 'ethereum', 'scroll', 'xdai'] module.exports = { doublecounted: true, diff --git a/projects/pooltogether/index.js b/projects/pooltogether/index.js index a85f11886843..8762e66ea9b4 100644 --- a/projects/pooltogether/index.js +++ b/projects/pooltogether/index.js @@ -6,9 +6,9 @@ module.exports = { doublecounted: true, hallmarks: [ [1_634_320_800, 'V4 Launch'], - [1_658_872_800, 'V4 OP Rewards Begin'], - [1_669_615_200, 'V4 OP Rewards Extended'], - [1_697_738_400, 'V5 Launch'] + [1_693_453_300, 'V5 Beta Launch'], + [1_697_738_400, 'V5 Canary Launch'], + [1_713_399_300, 'V5 Launch'] ], methodology: `TVL is the total tokens deposited in PoolTogether` } diff --git a/projects/pooltogether/v5.js b/projects/pooltogether/v5.js index b69a502a81ab..514d2c3765b6 100644 --- a/projects/pooltogether/v5.js +++ b/projects/pooltogether/v5.js @@ -2,9 +2,21 @@ const abi = require('./abi.json') const { sumTokens2 } = require('../helper/unwrapLPs') const V5_VAULT_FACTORIES = { - optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39'], - base: ['0xE32F6344875494ca3643198d87524519Dc396DDf'], - arbitrum: ['0x44Be003E55e7cE8a2e0ECC3266f8a9A9de2c07BC'] + optimism: ['0xF65FA202907D6046D1eF33C521889B54BdE08081', '0x6B17EE3a95BcCd605340454c5919e693Ef8EfF0E', '0xF0F151494658baE060034c8f4f199F74910ea806', '0x0C379e9b71ba7079084aDa0D1c1Aeb85d24dFD39', '0xec9f59bd06465b105e719c0b0483a4ed6a656775'], + base: ['0xE32F6344875494ca3643198d87524519Dc396DDf', '0xa55a74A457D8a24D68DdA0b5d1E0341746d444Bf'], + arbitrum: ['0x44Be003E55e7cE8a2e0ECC3266f8a9A9de2c07BC', '0x8020Fb37b21E0eF1707aDa7A914baf44F9045E52'], + ethereum: ['0x29c102109D6cb2D866CFEc380E0E10E9a287A75f', '0xd499CcF3e93F4cfb335Ac388E3C896D59cdDe7c3'], + scroll: ['0x3fdd8bFdF2F589c10C58457CDAE989C7943A30A5'], + xdai: ['0xc3aE3FE36A2645a93b2Fe350D81E80A14831e2A6'] +} + +const V5_NON_FACTORY_VAULTS = { + optimism: ['0xa52e38a9147f5ea9e0c5547376c21c9e3f3e5e1f'], + base: [], + arbitrum: [], + ethereum: [], + scroll: [], + xdai: [] } async function tvl(api) { @@ -15,6 +27,7 @@ async function tvl(api) { const _vaults = await api.fetchList({ lengthAbi: abi.totalVaults, itemAbi: abi.allVaults, target: factory }) vaults.push(..._vaults) } + vaults.push(...V5_NON_FACTORY_VAULTS[api.chain]) const tokens = await api.multiCall({ abi: abi.asset, calls: vaults }) const bals = await api.multiCall({ abi: abi.totalAssets, calls: vaults }) api.addTokens(tokens, bals) diff --git a/projects/poolz-vesting/index.js b/projects/poolz-vesting/index.js new file mode 100644 index 000000000000..a5f64f55e856 --- /dev/null +++ b/projects/poolz-vesting/index.js @@ -0,0 +1,27 @@ +const config = { + bsc: { factory: '0xd82c03bd0543b567c9cec7b822373be2b167f00f', POOLX: '0xbAeA9aBA1454DF334943951d51116aE342eAB255',lockedDealV2: '0x436CE2ce8d8d2Ccc062f6e92faF410DB4d397905', }, + base: { factory: '0x7ff9315f538df7ec76ec4815249dd30519726460', }, + arbitrum: { factory: '0x9cfd8c7834be0dfe41f3fe68c29124066d5cd13b', lockedDealV2: '0x7Ff9315f538dF7eC76Ec4815249Dd30519726460', }, + ethereum: { factory: '0x9ff1db30c66cd9d3311b4b22da49791610922b13', lockedDealV2: '0x285B4866257eF51FfBDD239c10dE5f9493413d8f', }, + manta: { factory: '0x7Ff9315f538dF7eC76Ec4815249Dd30519726460', }, + telos: { factory: '0x2Bb9cFF524C76eb2eA27bC6cDbB93447115D8dcC', }, + polygon: { factory: '0x06fd710fD167f1f08b61e457F41D6e7c7DD9AF3D', lockedDealV2: '0x9D13B213852669077131f8A24A676f27ab0C2931', }, +} + +Object.keys(config).forEach(chain => { + const { factory, POOLX, blacklistedTokens = [], lockedDealV2, } = config[chain] + module.exports[chain] = { + tvl: () => ({}), + vesting: async (api) => { + if (POOLX) blacklistedTokens.push(POOLX) + const tokens = await api.fetchList({ lengthAbi: 'totalVaults', itemAbi: 'vaultIdToTokenAddress', target: factory }) + const vaults = await api.fetchList({ lengthAbi: 'totalVaults', itemAbi: 'vaultIdToVault', target: factory }) + if (lockedDealV2) await api.sumTokens({ owner: lockedDealV2, tokens, blacklistedTokens, }) + return api.sumTokens({ tokensAndOwners2: [tokens, vaults], blacklistedTokens }) + } + } + if (POOLX) module.exports[chain].staking = async (api) => { + const vaults = await api.fetchList({ lengthAbi: 'totalVaults', itemAbi: 'vaultIdToVault', target: factory }) + return api.sumTokens({ owners: vaults, tokens: [POOLX] }) + } +}) \ No newline at end of file diff --git a/projects/popcorn/index.js b/projects/popcorn/index.js index ea9224672be2..876ecf8c7a14 100644 --- a/projects/popcorn/index.js +++ b/projects/popcorn/index.js @@ -2,7 +2,7 @@ const sdk = require('@defillama/sdk'); const { getConfig } = require('../helper/cache') const { addFraxVaultToTVL } = require("./fraxVault"); -const { staking } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const { sumTokens2 } = require('../helper/unwrapLPs'); const getVaultsAbi = 'address[]:getRegisteredAddresses'; @@ -36,11 +36,13 @@ async function tvl(api) { const veVCX = "0x0aB4bC35Ef33089B9082Ca7BB8657D7c4E819a1A"; const WETH_VCX_BAL_LP_TOKEN = "0x577A7f7EE659Aa14Dc16FD384B3F8078E23F1920"; +const stVCX = "0xE5d383FC43F6c370DdD3975cf9e363Ad42367697"; +const VCX = "0xce246eea10988c495b4a90a905ee9237a0f91543"; module.exports = { ethereum: { start: 12237585, - staking: staking(veVCX, WETH_VCX_BAL_LP_TOKEN), + staking: stakings([stVCX, veVCX], [VCX, WETH_VCX_BAL_LP_TOKEN]), tvl, }, bsc: { tvl, }, diff --git a/projects/poseidollar/index.js b/projects/poseidollar/index.js index 900db73c0840..4304969b4d13 100644 --- a/projects/poseidollar/index.js +++ b/projects/poseidollar/index.js @@ -93,8 +93,8 @@ async function suiTVL(api) { "0x3cfad71fc1f65addbadc0d4056fbd1106aa6b9a219e3ea1f5356a2f500d13182" ); - //TVL on PSH Earn - for (let i = 0; i < poolShareInfo.length; i++) { + //TVL on PSH Earn - ignoring pool 0, it is returning absurd value + for (let i = 1; i < poolShareInfo.length; i++) { api.add(poolShareInfo[i].coinX, poolShareInfo[i].coinXStaked) if (poolShareInfo[i].coinY) diff --git a/projects/powpeg/index.js b/projects/powpeg/index.js new file mode 100644 index 000000000000..e15c669a6378 --- /dev/null +++ b/projects/powpeg/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + rsk: { + // Powpeg (flyover) fast mod protocol + tvl: sumTokensExport({ owner: '0xAa9caf1e3967600578727f975F283446a3dA6612', tokens: [nullAddress] }) + } +} \ No newline at end of file diff --git a/projects/predict-fun/index.js b/projects/predict-fun/index.js new file mode 100644 index 000000000000..a4d1d1f4d8d3 --- /dev/null +++ b/projects/predict-fun/index.js @@ -0,0 +1,12 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs'); + +module.exports = { + blast: { + tvl: sumTokensExport({ owners: [ + '0xE1A2E68C401378050fdba9704FA8BCb1f72b98f4', + '0x8F9C9f888A4268Ab0E2DDa03A291769479bAc285' + ], tokens: [ADDRESSES.blast.USDB]}) + }, + methodology: `TVL is the total quantity of USDB held in the conditional tokens contract as well as USDB collateral submitted to every predict.fun market ever opened - once the markets resolve, participants are able to withdraw their share given the redemption rate and their input stake.` +} diff --git a/projects/predx/index.js b/projects/predx/index.js new file mode 100644 index 000000000000..3233e6c110b3 --- /dev/null +++ b/projects/predx/index.js @@ -0,0 +1,47 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + zklink: { + tvl: sumTokensExport({ + owners: ["0x21855483F45ab1801CbE4248b9a2F178320c444B"], + tokens: [ADDRESSES.zklink.USDT] + }), + }, + base: { + tvl: sumTokensExport({ + owners: ["0x10dE7F398C76341B5a5C33693C930609863F692C"], + tokens: [ADDRESSES.base.USDC] + }), + }, + sei: { + tvl: sumTokensExport({ + owners: ["0xACbd78769333697ebB2c859a8344d1507b45F044"], + tokens: ["0x3894085Ef7Ff0f0aeDf52E2A2704928d1Ec074F1"] + }), + }, + linea: { + tvl: sumTokensExport({ + owners: ["0x3F8D22db689A9c6F0560baCE255cdD854Ab84Ca5"], + tokens: [ADDRESSES.linea.USDC] + }), + }, + bsc: { + tvl: sumTokensExport({ + owners: ["0x2e8c67E73883e787A164cD9FeA592d0AcDbC61D4"], + tokens: [ADDRESSES.bsc.USDT] + }), + }, + mantle: { + tvl: sumTokensExport({ + owners: ["0x8D2DB5B86b7C079FF8F7190D788766EeB789F104"], + tokens: [ADDRESSES.mantle.USDC] + }), + }, + btr: { + tvl: sumTokensExport({ + owners: ["0x8E4fb0169aECB4768220d97aA1D0106322716678"], + tokens: ["0xf8C374CE88A3BE3d374e8888349C7768B607c755"] + }), + }, +} diff --git a/projects/preon/index.js b/projects/preon/index.js index 98fa07930675..44425b980c20 100644 --- a/projects/preon/index.js +++ b/projects/preon/index.js @@ -1,3 +1,4 @@ +//preon const ADDRESSES = require('../helper/coreAssets.json') const { sumTokens2 } = require("../helper/unwrapLPs"); @@ -16,6 +17,11 @@ const config = { [["0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE"], "0xdc4552609a3f673f0b72958f678d4a48d0e94ebd"], // aPolDAI ], }, + base: { + ownerTokens: [ + [[ADDRESSES.base.WETH], "0xEfaA597277Ce531e52018d42224aB579Bbe31a04"], // aeroAMO + ], + }, }; const extraConfig = { @@ -48,12 +54,25 @@ async function customTvl(api) { } } +async function baseTvl(api) { + const aeroAMO = '0xEfaA597277Ce531e52018d42224aB579Bbe31a04' + const [amountWeth, _amountOETH] = await api.call({ + abi: 'function getPositionPrincipal() view returns (uint256, uint256)', + target: aeroAMO + }) + api.add(ADDRESSES.base.USDC, amountWeth) + return api.getBalances() +} + async function tvl(api) { + if (api.chain === 'base') { + return baseTvl(api) + } await Promise.all([tokenTvl, customTvl].map((fn) => fn(api))); } module.exports = { - methodology: "Adds up the total value locked as collateral on the Preon Finance", + methodology: "Adds up the total value locked as collateral, as well as the AMO positions on Preon Finance", }; Object.keys(config).forEach((chain) => { diff --git a/projects/primex-finance/index.js b/projects/primex-finance/index.js index d2bc988eaba0..2065b18db1a1 100644 --- a/projects/primex-finance/index.js +++ b/projects/primex-finance/index.js @@ -5,6 +5,7 @@ const { abi } = require('./abi') const config = { polygon: { bucketsFactory: '0x7E6915D307F434E4171cCee90e180f5021c60089', + bucketsFactoryv2: '0x9649CfDCfAa9c80907e63dD9Cb161cBA2033F3A0', positionManager: '0x02bcaA4633E466d151b34112608f60A82a4F6035', traderBalanceVault: '0x0801896C67CF024606BcC92bd788d6Eb077CC74F', defaultTokens: { @@ -21,7 +22,7 @@ const config = { EPMX: "0xDc6D1bd104E1efa4A1bf0BBCf6E0BD093614E31A", OM: "0xc3ec80343d2bae2f8e680fdadde7c17e71e114ea", SAND: "0xbbba073c31bf03b8acf7c28ef0738decf3695683", - QUICK: "0xb5c064f955d8e7f38fe0460c556a72987494ee17", + QUICK: ADDRESSES.polygon.QUICK, UNI: "0xb33eaad8d922b1083446dc23f610c2567fb5180f", MANA: "0xa1c57f48f0deb89f569dfbe6e2b7f46d33606fd4", BAL: "0x9a71012b13ca4d3d0cdc72a177df3ef03b0e76a3", @@ -30,7 +31,13 @@ const config = { GHST: "0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7", AVAX: "0x2c89bbc92bd86f8075d1decc58c7f4e0107f286b", CRV: "0x172370d5cd63279efa6d502dab29171933a610af", - SUSHI: "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a" + SUSHI: "0x0b3f868e0be5597d5db7feb59e1cadbb0fdda50a", + SOL: "0x7dff46370e9ea5f0bad3c4e29711ad50062ea7a4", + PAXG: "0x553d3d295e0f695b9228246232edf400ed3560b5", + WSTETH: ADDRESSES.polygon.WSTETH, + LDO: "0xC3C7d422809852031b44ab29EEC9F1EfF2A58756", + FRAX: ADDRESSES.polygon.FRAX, + FXS: "0x1a3acf6d19267e2d3e7f898f42803e90c9219062" }, aaveTokens: { [ADDRESSES.polygon.WETH_1]: "0xe50fA9b3c56FfB159cB0FCA61F5c9D750e8128c8", @@ -42,6 +49,7 @@ const config = { }, arbitrum: { bucketsFactory: '0x4e6f7372bCE4083c779c17B240A94dc2EA57AE67', + bucketsFactoryv2: '0xB4d3A9f10D3D687FaF3b05b9aa3054856A1d7be8', positionManager: '0x86890E30cE9E1e13Db5560BbEb435c55567Af1cd', traderBalanceVault: '0xc08FFBBA8c5f42beb7e6dd29142cC61855a3076B', defaultTokens: { @@ -72,6 +80,20 @@ const config = { FXS: "0x9d2F299715D94d8A7E6F5eaa8E654E8c74a988A7", TIA: "0xD56734d7f9979dD94FAE3d67C7e928234e71cD4C", RPL: "0xB766039cc6DB368759C1E56B79AFfE831d0Cc507", + AAVE: "0xba5DdD1f9d7F570dc94a51479a000E3BCE967196", + WSTETH: ADDRESSES.arbitrum.WSTETH, + RETH: "0xEC70Dcb4A1EFa46b8F2D97C310C9c4790ba5ffA8", + WEETH: "0x35751007a407ca6feffe80b3cb397736d2cf4dbe", + ETHFI: "0x7189fb5B6504bbfF6a852B13B7B82a3c118fDc27", + EZETH: ADDRESSES.optimism.ezETH, + RSETH: "0x4186bfc76e2e237523cbc30fd220fe055156b41f", + USDE: ADDRESSES.arbitrum.USDe, + CBETH: "0x1debd73e752beaf79865fd6446b0c970eae7732f", + USDY: "0x35e050d3C0eC2d29D269a8EcEa763a183bDF9A9D", + TBTC: "0x6c84a8f1c29108f47a79964b5fe888d4f4d0de40", + FRAX: ADDRESSES.arbitrum.FRAX, + FRXETH: "0x178412e79c25968a32e89b11f63b33f733770c2a", + SFRXETH: "0x95ab45875cffdba1e5f451b950bc2e42c0053f39" }, aaveTokens: { [ADDRESSES.arbitrum.DAI]: "0x82E64f49Ed5EC1bC6e43DAD4FC8Af9bb3A2312EE", @@ -84,6 +106,7 @@ const config = { }, ethereum: { bucketsFactory: '0x7dE8607157124c894Ba9F18dd6138B5E8AAd5890', + bucketsFactoryv2: '0x55120da310A0c5fd81Fd3bb8C177F6649bE30ACc', positionManager: '0x99d63fEA4b3Ef6ca77941df3C5740dAd1586f0B8', traderBalanceVault: '0x156e2fC8e1906507412BEeEB6640Bf999a1Ea76b', defaultTokens: { @@ -103,7 +126,30 @@ const config = { COMP: "0xc00e94cb662c3520282e6f5717214004a7f26888", CRV: ADDRESSES.ethereum.CRV, ['1INCH']: '0x111111111117dC0aa78b770fA6A738034120C302', - EPMX: "0xA533f744B179F2431f5395978e391107DC76e103" + EPMX: "0xA533f744B179F2431f5395978e391107DC76e103", + POL: "0x455e53cbb86018ac2b8092fdcd39d8444affc3f6", + PAXG: "0x45804880de22913dafe09f4980848ece6ecbaf78", + WSTETH: ADDRESSES.ethereum.WSTETH, + RETH: ADDRESSES.ethereum.RETH, + SDAI: ADDRESSES.ethereum.SDAI, + WEETH: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", + ETHFI: "0xfe0c30065b384f05761f15d0cc899d4f9f9cc0eb", + LDO: ADDRESSES.ethereum.LIDO, + EZETH: "0xbf5495efe5db9ce00f80364c8b423567e58d2110", + RSETH: "0xa1290d69c65a6fe4df752f95823fae25cb99e5a7", + RSWETH: "0xfae103dc9cf190ed75350761e95403b7b8afa6c0", + USDE: ADDRESSES.ethereum.USDe, + SUSDE: ADDRESSES.ethereum.sUSDe, + PUFETH: "0xd9a442856c234a39a81a089c06451ebaa4306a72", + CDETH: ADDRESSES.ethereum.cbETH, + USDP: "0x8e870d67f660d95d5be530380d0ec0bd388289e1", + PYUSD: "0x6c3ea9036406852006290770bedfcaba0e23a0e8", + ONDO: "0xfaba6f8e4a5e8ab82f62fe7c39859fa577269be3", + TBTC: ADDRESSES.ethereum.tBTC, + FRAX: ADDRESSES.ethereum.FRAX, + FXS: ADDRESSES.ethereum.FXS, + FRXETH: "0x5e8422345238f34275888049021821e8e08caa1f", + SFRXETH: ADDRESSES.ethereum.sfrxETH }, aaveTokens: { [ADDRESSES.ethereum.WETH]: "0x4d5F47FA6A74757f35C14fD3a6Ef8E3C9BC514E8", @@ -120,19 +166,25 @@ const config = { module.exports = {} Object.keys(config).forEach(chain => { - const { bucketsFactory, positionManager, traderBalanceVault, defaultTokens, aaveTokens } = config[chain] + const { bucketsFactory, bucketsFactoryv2, positionManager, traderBalanceVault, defaultTokens, aaveTokens } = config[chain] module.exports[chain] = { tvl: async (api) => { const buckets = await api.call({ target: bucketsFactory, abi: abi.allBuckets }) const borrowedTokensAddresses = await api.multiCall({ abi: abi.borrowedAsset, calls: buckets }) + const bucketsv2 = await api.call({ target: bucketsFactoryv2, abi: abi.allBuckets }) + const borrowedTokensAddressesv2 = await api.multiCall({ abi: abi.borrowedAsset, calls: bucketsv2 }) + const tokensAndOwnersBucketsv2 = bucketsv2.map((b, i) => [borrowedTokensAddressesv2[i], b]) + const aTokensAndOwnersBucketsv2 = bucketsv2.map((b, i) => [aaveTokens[borrowedTokensAddressesv2[i].toLowerCase()], b]).filter((p) => p[0]) + const tokensAndOwnersBuckets = buckets.map((b, i) => [borrowedTokensAddresses[i], b]) const aTokensAndOwnersBuckets = buckets.map((b, i) => [aaveTokens[borrowedTokensAddresses[i].toLowerCase()], b]).filter((p) => p[0]) + const tokensAndOwnersPM = Object.values(defaultTokens).map(t => [t, positionManager]) const tokensAndOwnersTBV = Object.values(defaultTokens).map(t => [t, traderBalanceVault]) - const tokensAndOwners = tokensAndOwnersBuckets.concat(aTokensAndOwnersBuckets, tokensAndOwnersPM, tokensAndOwnersTBV) + const tokensAndOwners = tokensAndOwnersBuckets.concat(tokensAndOwnersBucketsv2, aTokensAndOwnersBuckets, aTokensAndOwnersBucketsv2, tokensAndOwnersPM, tokensAndOwnersTBV) return sumTokens2({ api, tokensAndOwners }) } diff --git a/projects/primitive/abi.json b/projects/primitive/abi.json deleted file mode 100644 index bb002254d713..000000000000 --- a/projects/primitive/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "risky": "address:risky", - "stable": "address:stable" -} \ No newline at end of file diff --git a/projects/primitive/index.js b/projects/primitive/index.js index 4ef2810089dd..92c9ae42a13b 100644 --- a/projects/primitive/index.js +++ b/projects/primitive/index.js @@ -5,6 +5,6 @@ const v1TVL = require('./v1') module.exports = { ethereum: { start: 1647932400, // unix timestamp (utc 0) specifying when the project began, or where live data begins - tvl: sdk.util.sumChainTvls([rmmTVL, v1TVL]), // + tvl: sdk.util.sumChainTvls([rmmTVL, v1TVL, ]), // }, } \ No newline at end of file diff --git a/projects/primitive/rmm.js b/projects/primitive/rmm.js index 74bfe74e2274..2656aace690e 100644 --- a/projects/primitive/rmm.js +++ b/projects/primitive/rmm.js @@ -1,29 +1,11 @@ -const sdk = require('@defillama/sdk') -const {sumTokens} = require("../helper/unwrapLPs"); -const abi = require("./abi.json"); - const engine_weth_usdc = '0xd3541aD19C9523c268eDe8792310867C57BE39e4' // WETH-USDC Pair const engines = [engine_weth_usdc] -module.exports = async function tvl(time, ethBlock, chainBlocks) { - const [{output: risky}, {output: stable}] = await Promise.all([ - sdk.api.abi.multiCall({ - abi: abi['risky'], - calls: engines.map(e => ({target: e})), - block: ethBlock, - }), - sdk.api.abi.multiCall({ - abi: abi['stable'], - calls: engines.map(e => ({target: e})), - block: ethBlock, - }) - ]) - - const tokensAndOwners = risky.map((call, idx) => [ - [call.output, call.input.target], - [stable[idx].output, call.input.target] - ]).flat() - const balances = {} - await sumTokens(balances, tokensAndOwners, ethBlock, 'ethereum') - return balances +module.exports = async function tvl(api) { + const risky = await api.multiCall({ abi: 'address:risky', calls: engines}) + const stable = await api.multiCall({ abi: 'address:stable', calls: engines}) + const toa = [] + risky.forEach((v, i) => toa.push([v, engines[i]])) + stable.forEach((v, i) => toa.push([v, engines[i]])) + return api.sumTokens({ tokensAndOwners: toa }) } \ No newline at end of file diff --git a/projects/primitive/v1.js b/projects/primitive/v1.js index da4c2082b7f8..ecf1b391b98f 100644 --- a/projects/primitive/v1.js +++ b/projects/primitive/v1.js @@ -1,270 +1,24 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js') -const getCacheBalances = 'function getCacheBalances() view returns (uint256, uint256)' const getUnderlyingTokenAddress = "address:getUnderlyingTokenAddress" const getStrikeTokenAddress = "address:getStrikeTokenAddress" -const redeemToken = "address:redeemToken" -const getPair = 'function getPair(address, address) view returns (address)' -const token0 = 'address:token0' -const token1 = 'address:token1' -const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' const { getLogs } = require('../helper/cache/getLogs') const START_BLOCK = 11142900 const REGISTRY = '0x16274044dab9635Df2B5AeAF7CeCb5f381c71680' -const FACTORY = '0xC0AEe478e3658e2610c5F7A4A2E1777cE9e4f2Ac' -const ZERO_ADDRESS = ADDRESSES.null module.exports = async function tvl(api) { - const block = api.block - - const logs = ( - await getLogs({ - api, - target: REGISTRY, - fromBlock: START_BLOCK, - topic: 'DeployedOptionClone(address,address,address)', - }) - ) - - const optionAddresses = logs - .map((log) => `0x${log.topics[2].substring(26)}`) - .map((optionAddress) => optionAddress.toLowerCase()) - - const allRedeemAddresses = logs - .map((log) => `0x${log.topics[3].substring(26)}`) - .map((redeemAddress) => redeemAddress.toLowerCase()) - - const [ - underlyingAddresses, - strikeAddresses, - redeemAddresses, - ] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: getUnderlyingTokenAddress, - calls: optionAddresses.map((optionAddress) => ({ - target: optionAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getStrikeTokenAddress, - calls: optionAddresses.map((optionAddress) => ({ - target: optionAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: redeemToken, - calls: optionAddresses.map((optionAddress) => ({ - target: optionAddress, - })), - block, - }) - .then(({ output }) => output), - ]) - - const options = {} - // add underlyingAddresses - underlyingAddresses.forEach((underlyingAddress) => { - const tokenAddress = underlyingAddress.output.toLowerCase() - - const optionAddress = underlyingAddress.input.target.toLowerCase() - options[optionAddress] = { - underlyingAddress: tokenAddress, - } - }) - - // add strikeAddresses - strikeAddresses.forEach((strikeAddress) => { - const tokenAddress = strikeAddress.output.toLowerCase() - const optionAddress = strikeAddress.input.target.toLowerCase() - options[optionAddress] = { - ...(options[optionAddress] || {}), - strikeAddress: tokenAddress, - } - }) - - redeemAddresses.forEach((redeemAddress) => { - const tokenAddress = redeemAddress.output.toLowerCase() - const optionAddress = redeemAddress.input.target.toLowerCase() - options[optionAddress] = { - ...(options[optionAddress] || {}), - redeemAddress: tokenAddress, - } - }) - - // The internally tracked balances of underlying and strike tokens in the Primitive option contracts - const caches = ( - await sdk.api.abi.multiCall({ - abi: getCacheBalances, - calls: Object.keys(options).map((optionAddress) => ({ - target: optionAddress, - })), - block, - }) - ).output - - // ===== Sushiswap Pools ===== - - const optionPairAddresses = ( - await sdk.api.abi.multiCall({ - abi: getPair, - calls: Object.keys(options).map((optionAddress, i) => ({ - target: FACTORY, - params: [ - options[optionAddress].underlyingAddress, - options[optionAddress].redeemAddress, - ], - })), - block, - }) - ).output - - const optionPairs = [] - - optionPairAddresses.forEach((optionPairAddress) => { - const marketAddress = optionPairAddress.output.toLowerCase() - if (marketAddress !== ZERO_ADDRESS) optionPairs.push(marketAddress) - }) - - const [token0Addresses, token1Addresses] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - calls: optionPairs.map((marketAddress) => ({ - target: marketAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - calls: optionPairs.map((marketAddress) => ({ - target: marketAddress, - })), - block, - }) - .then(({ output }) => output), - ]) - - const pairs = {} - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase() - - if ( - allRedeemAddresses.indexOf(tokenAddress) != -1 - ) { - const pairAddress = token0Address.input.target.toLowerCase() - pairs[pairAddress] = { - token0Address: tokenAddress, - } - } - }) - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase() - if ( - allRedeemAddresses.indexOf(tokenAddress) != -1 - ) { - const pairAddress = token1Address.input.target.toLowerCase() - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - } - }) - - // Reserves of option pools in Sushiswap - const reserves = ( - await sdk.api.abi.multiCall({ - abi: getReserves, - calls: Object.keys(pairs).map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - ).output - - // ===== Accumulators ===== - - // accumulate the balances in the Sushiswap option pools - const inSushiSwap = reserves.reduce((accumulator, reserve, i) => { - const pairAddress = reserve.input.target.toLowerCase() - const pair = pairs[pairAddress] || {} - - // handle reserve0 - if (pair.token0Address) { - const reserve0 = new BigNumber(reserve.output['0']) - if (!reserve0.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token0Address] || '0' - ) - - accumulator[pair.token0Address] = existingBalance - .plus(reserve0) - .toFixed() - } - } - - // handle reserve1 - if (pair.token1Address) { - const reserve1 = new BigNumber(reserve.output['1']) - - if (!reserve1.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token1Address] || '0' - ) - - accumulator[pair.token1Address] = existingBalance - .plus(reserve1) - .toFixed() - } - } - - return accumulator - }, {}) - - // accumulate the caches of Primitive with the reserves of Sushiswap - return caches.reduce((accumulator, cache, i) => { - const optionAddress = cache.input.target.toLowerCase() - const option = options[optionAddress] || {} - - // handle underlyingCache - if (option.underlyingAddress) { - const underlyingCache = new BigNumber(cache.output['0']) - - const existingBalance = new BigNumber( - accumulator[option.underlyingAddress] || '0' - ) - - accumulator[option.underlyingAddress] = existingBalance - .plus(underlyingCache) - .toFixed() - } - - // handle strikeCache - if (option.strikeAddress) { - const strikeCache = new BigNumber(cache.output['1']) - - const existingBalance = new BigNumber( - accumulator[option.strikeAddress] || '0' - ) - - accumulator[option.strikeAddress] = existingBalance - .plus(strikeCache) - .toFixed() - } - - return accumulator - }, inSushiSwap) + const logs = (await getLogs({ + api, + target: REGISTRY, + fromBlock: START_BLOCK, + onlyArgs: true, + eventAbi: 'event DeployedOptionClone (address indexed from, address indexed optionAddress, address indexed redeemAddress)' + })) + + const tokensAndOwners = [] + const options = logs.map(i => i.optionAddress) + const underlying = await api.multiCall({ abi: getUnderlyingTokenAddress, calls: options}) + const strikes = await api.multiCall({ abi: getStrikeTokenAddress, calls: options}) + underlying.forEach((v, i) => tokensAndOwners.push([v, options[i]])) + strikes.forEach((v, i) => tokensAndOwners.push([v, options[i]])) + return api.sumTokens({ tokensAndOwners }) } diff --git a/projects/printerfinancial/helper.js b/projects/printerfinancial/helper.js index 70070cafbacf..29a2c3c2c389 100644 --- a/projects/printerfinancial/helper.js +++ b/projects/printerfinancial/helper.js @@ -1,5 +1,5 @@ const { staking, stakingUnknownPricedLP } = require("../helper/staking"); -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const sdk = require("@defillama/sdk"); const token0Abi = 'address:token0' const token1Abi = 'address:token1' @@ -12,7 +12,7 @@ function printerTvl(token, share, rewardPool, masonry, pool2LPs, chain = "ethere [chain]: { tvl: async () => ({}), staking: staking(masonry, share, chain), - pool2: pool2Exports(rewardPool, pool2LPs, chain, transform) + pool2: pool2(rewardPool, pool2LPs, chain, transform) } } } diff --git a/projects/probit/index.js b/projects/probit/index.js index 7777210d33cd..70ae05486391 100644 --- a/projects/probit/index.js +++ b/projects/probit/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -16,11 +17,7 @@ const config = { ], }, bitcoin: { - owners: [ - "19EgVpboqNjortWyhJSDAGRvHDtduqiSfr", - "19AtrEvJv7UY75tvWkXMxLUAYibxpZhFfN", - "17PpCEuQUT7xxP1ocfhvFdwQyrB5dG1dQP" - ], + owners: bitcoinAddressBook.probit, }, fantom: { owners: [ diff --git a/projects/prosper/index.js b/projects/prosper/index.js deleted file mode 100644 index f4ee0239426b..000000000000 --- a/projects/prosper/index.js +++ /dev/null @@ -1,20 +0,0 @@ -const utils = require('../helper/utils') -const BigNumber = require('bignumber.js') - -const currentPoolEndpoint = 'https://avax.prosper.so/api/actualPool?chainId=43114&asset=AVAX%2FUSD&duration=60&token=AVAX' -const avaxCoingeckoId = 'avalanche-2' - -async function tvl(timestamp, block) { - const currentPool = await utils.fetchURL(currentPoolEndpoint) - const tvl = BigNumber(currentPool.data.bearsQuote).plus(currentPool.data.bullsQuote).div(1e18) - - return { - [avaxCoingeckoId]: tvl.toNumber() - } -} - -module.exports = { - avax:{ - tvl, - }, -} \ No newline at end of file diff --git a/projects/proton-loan/index.js b/projects/proton-loan/index.js index 47df70645edc..6a4457306235 100644 --- a/projects/proton-loan/index.js +++ b/projects/proton-loan/index.js @@ -74,11 +74,13 @@ async function getTotalStaking() { } module.exports = { + deadFrom: '2024-09-09', misrepresentedTokens: true, methodology: `Proton Loan TVL is the sum of all lending deposits in the Proton Loan smart contract and single-side staked LOAN.`, proton: { tvl: getLendingTvl(false), - borrowed: getLendingTvl(true), + borrowed: () => ({}), // bad debt getLendingTvl(true), staking: getTotalStaking }, -} \ No newline at end of file +} + diff --git a/projects/prxy/index.js b/projects/prxy/index.js index 87ffd3360444..b543a8ea95d7 100644 --- a/projects/prxy/index.js +++ b/projects/prxy/index.js @@ -1,14 +1,19 @@ const { staking } = require('../helper/staking') -const prxy = "0xab3d689c22a2bb821f50a4ff0f21a7980dcb8591"; -const btcpx = "0x9C32185b81766a051E08dE671207b34466DD1021"; +const ADDRESSES = require('../helper/coreAssets.json') + +const prxy = '0xab3d689c22a2bb821f50a4ff0f21a7980dcb8591' +const btcpx = '0x9C32185b81766a051E08dE671207b34466DD1021' +const abi = 'function getWithdrawalBtcAmount(address who, uint256 value) view returns (uint256 amount)' +const btc = ADDRESSES.ethereum.WBTC async function tvl(api) { const bal = await api.call({ abi: 'erc20:totalSupply', target: btcpx }) - api.add(btcpx, bal) + const totalSupplyInBtc = await api.call({ abi, target: btcpx, params: [btcpx, bal] }) + api.add(btc, totalSupplyInBtc, { skipChain: true }) } module.exports = { - polygon: { tvl, staking: staking('0x015CEe3aB6d03267B1B2c05D2Ac9e2250AF5268d', prxy), }, - ethereum: { tvl, }, + polygon: { tvl,staking: staking('0x015CEe3aB6d03267B1B2c05D2Ac9e2250AF5268d', prxy) }, + ethereum: { tvl }, methodology: `BTC Proxy offers a unique institutional-grade wrapped Bitcoin solution that leverages Polygon technology to bring Bitcoin to DeFi 2.0 with no gas and no slippage and insured custody. BTC Proxy features (3,3) Staking and Bonding via the PRXY Governance token`, }; diff --git a/projects/pstake-btc/index.js b/projects/pstake-btc/index.js new file mode 100644 index 000000000000..5d93995322c5 --- /dev/null +++ b/projects/pstake-btc/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport } = require("../helper/sumTokens"); +const sdk = require("@defillama/sdk"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +module.exports = { + methodology: `Total amount of BTC in ${ bitcoinAddressBook.pstakeBTC.join(", ")}. Restaked on babylon`, + doublecounted:true, + bitcoin: { tvl: sdk.util.sumChainTvls([sumTokensExport({ owners: bitcoinAddressBook.pstakeBTC })]) }, +}; diff --git a/projects/pstake/index.js b/projects/pstake/index.js index 5b6e1157ae13..000d7f5832c2 100644 --- a/projects/pstake/index.js +++ b/projects/pstake/index.js @@ -1,63 +1,69 @@ -const { nullAddress } = require('../helper/tokenMapping'); -const { get } = require('../helper/http') +const { nullAddress } = require("../helper/tokenMapping"); +const { get } = require("../helper/http"); const sdk = require("@defillama/sdk"); - +const { sumTokensExport } = require("../helper/sumTokens"); async function bsctvl(api) { - const bal = await api.call({ abi: 'function exchangeRate() external view returns (uint256 totalWei, uint256 poolTokenSupply)', target: '0xc228cefdf841defdbd5b3a18dfd414cc0dbfa0d8' }) + const bal = await api.call({ + abi: "function exchangeRate() external view returns (uint256 totalWei, uint256 poolTokenSupply)", + target: "0xc228cefdf841defdbd5b3a18dfd414cc0dbfa0d8", + }); return { - ['bsc:' + nullAddress]: bal.totalWei + ["bsc:" + nullAddress]: bal.totalWei, }; } -const baseEndpoint = 'https://api.persistence.one/pstake' +const baseEndpoint = "https://api.persistence.one/pstake"; const chainInfos = { cosmos: { name: "cosmos", decimals: 1e6, - endpoint: "/stkatom/atom_tvu" + endpoint: "/stkatom/atom_tvu", }, osmosis: { name: "osmosis", decimals: 1e6, - endpoint: "/stkosmo/osmo_tvu" + endpoint: "/stkosmo/osmo_tvu", }, dydx: { name: "dydx-chain", decimals: 1e18, - endpoint: "/stkdydx/dydx_tvu" + endpoint: "/stkdydx/dydx_tvu", }, stargaze: { name: "stargaze", decimals: 1e6, - endpoint: "/stkstars/stars_tvu" + endpoint: "/stkstars/stars_tvu", }, persistence: { name: "persistence", decimals: 1e6, - endpoint: "/stkxprt/xprt_tvu" - } -} + endpoint: "/stkxprt/xprt_tvu", + }, +}; function cosmostvl() { return async () => { - - let tvl = {} + let tvl = {}; for (const chain of Object.values(chainInfos)) { - const api = baseEndpoint + chain.endpoint + const api = baseEndpoint + chain.endpoint; - const amount = await get(api) + const amount = await get(api); const balance = {}; - sdk.util.sumSingleBalance(balance, chain.name, amount.amount.amount / chain.decimals); + sdk.util.sumSingleBalance( + balance, + chain.name, + amount.amount.amount / chain.decimals + ); - tvl[chain.name] = balance[chain.name] + tvl[chain.name] = balance[chain.name]; } - return tvl - } + return tvl; + }; } module.exports = { diff --git a/projects/pulsechain/index.js b/projects/pulsechain/index.js new file mode 100644 index 000000000000..133c1ce524d0 --- /dev/null +++ b/projects/pulsechain/index.js @@ -0,0 +1,13 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owner: '0x1715a3E4A142d8b698131108995174F37aEBA10D', + fetchCoValentTokens: true, + permitFailure: true + }), + }, +}; diff --git a/projects/pulserate/index.js b/projects/pulserate/index.js index feca6b1e783d..aa0ade521594 100644 --- a/projects/pulserate/index.js +++ b/projects/pulserate/index.js @@ -8,7 +8,6 @@ module.exports = { tvl: getUniTVL({ factory: "0xE2332E5297b18a21DcE0E6ac461e821C353A00cA", useDefaultCoreAssets: true, - fetchBalances: true, }), staking: sumTokensExport({ owners: ["0xD7A2F5A72079654E7997C615cC07A1b92D850b32"], diff --git a/projects/pumpbtc/index.js b/projects/pumpbtc/index.js index bce675989a47..cab2120c9c16 100644 --- a/projects/pumpbtc/index.js +++ b/projects/pumpbtc/index.js @@ -1,17 +1,47 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens } = require('../helper/sumTokens'); +const utils = require('../helper/utils'); +const { getConfig } = require('../helper/cache'); +const bitcoinBook = require('../helper/bitcoin-book'); +const { sumTokens2 } = require('../helper/unwrapLPs'); 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'], }, + +async function getStakingAddresses() { + let res = await utils.fetchURL('https://dashboard.pumpbtc.xyz/api/dashboard/asset/tokenowners') + + const btcAddresses = res.data.data || {} + return btcAddresses +} + +async function bitcoinTvl(api) { + const owners = await bitcoinBook.pumpBTC() + return sumTokens({ api, owners }) +} + +async function otherTvl(api) { + const addresses = await getConfig('pumpbtc/v2-other', undefined, { fetcher: getStakingAddresses }) + + if (!addresses[api.chain]) { + return; + } + + const { owners, tokens } = addresses[api.chain] + return sumTokens2({ api, owners, tokens }) } -Object.keys(config).forEach(chain => { - const { owners, tokens, } = config[chain] - module.exports[chain] = { - tvl: async (api) => api.sumTokens({ owners, tokens }) +module.exports.isHeavyProtocol = true; +module.exports.doublecounted = true; + +['bitcoin', 'ethereum', 'bsc', 'mantle', 'base', 'arbitrum', 'bob'].forEach(chain => { + if (chain == 'bitcoin') { + module.exports[chain] = { + tvl: bitcoinTvl, + } + } else { + module.exports[chain] = { + tvl: otherTvl + } } -}) +}) \ No newline at end of file diff --git a/projects/pumpxy/index.js b/projects/pumpxy/index.js new file mode 100644 index 000000000000..2358b7bb8fef --- /dev/null +++ b/projects/pumpxy/index.js @@ -0,0 +1,15 @@ +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') + +module.exports = { + methodology: "TVL is calculated by retrieving the ETH balance of all meme coin contracts deployed by the Zircuit factory contract. The factory contract dynamically manages meme coins, and their ETH holdings are summed up to calculate the total TVL.", + start: 1726030293, + zircuit: { + tvl, + }, +} + +async function tvl(api) { + const factory = '0x2FB9FbFF266CED68FCfEEC850e3ce9c58BB68Ec3'; + const memeCoins = await api.fetchList({ lengthAbi: 'allMemecoinsCount', itemAbi: 'allMemecoins', target: factory }) + return sumTokens2({ api, owners: memeCoins, token: nullAddress}) +} diff --git a/projects/purefi/index.js b/projects/purefi/index.js index 39cf6f11bae4..d5d9fd7cd130 100644 --- a/projects/purefi/index.js +++ b/projects/purefi/index.js @@ -1,5 +1,4 @@ const { staking, stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); /*** Ethereum Addresses ***/ const UFI = "0xcDa4e840411C00a614aD9205CAEC807c7458a0E3"; @@ -51,23 +50,8 @@ const farmingStakingContracts_polygon = [ "0xF1a44C75E4D92f4DA737485f96b0c2a1327d91b2", ]; -const polygonTvl = async (chainBlocks) => { - const balances = {}; - - let transformAddress = i => `polygon:${i}`; - await sumTokensAndLPsSharedOwners( - balances, - [ - [SAFLE_polygon, false], - [SCA_polygon, false], - ], - farmingStakingContracts_polygon, - chainBlocks["polygon"], - "polygon", - transformAddress - ); - - return balances; +const polygonTvl = async (api) => { + return api.sumTokens({ owners: farmingStakingContracts_polygon, tokens: [SAFLE_polygon, SCA_polygon,] }); }; module.exports = { @@ -82,6 +66,5 @@ module.exports = { staking: stakings(farmingStakingContracts_polygon, UFI_polygon), tvl: polygonTvl, }, - //tvl: (tvl) => ({}), methodology: "Counts tvl of the assets staked on the Farming seccion thgough Farming Contracts", }; diff --git a/projects/pv01/index.js b/projects/pv01/index.js new file mode 100644 index 000000000000..8f64d3c0e835 --- /dev/null +++ b/projects/pv01/index.js @@ -0,0 +1,21 @@ +const PV01_VAULT_FACTORY_ETHEREUM = '0x7eB37F9326E2474D5178Fd5224bc35E30A5398B5'; +const abi = { + getVaults: "function getVaults(string type_) view returns (address[])" +}; + +async function tvl(api) { + // Fetch the list of vaults from the factory + const vaults = await api.call({ abi: abi.getVaults, target: PV01_VAULT_FACTORY_ETHEREUM, params: ['BondPerpetualVault'] }); + // Fetch total supply for each vault + const supplies = await api.multiCall({ abi: "erc20:totalSupply", calls: vaults, }); + api.add(vaults, supplies) +} + +module.exports = { + methodology: + "Counts the total supply of rTBL (Rolling T-bill) tokens across all PV01 perpetual bond vaults.", + start: 20377028, + ethereum: { + tvl, + }, +}; diff --git a/projects/pwn/index.js b/projects/pwn/index.js index b4f34810cdb5..84e885cefff5 100644 --- a/projects/pwn/index.js +++ b/projects/pwn/index.js @@ -14,6 +14,8 @@ const PWN_BUNDLER_BSC = "0x4A75a527E97d853109aA6998a2B9E45a87A31e9f"; const PWN_V1_SIMPLE_LOAN = "0x50160ff9c19fbE2B5643449e1A321cAc15af2b2C"; const PWN_V1_1_SIMPLE_LOAN_A = "0x57c88D78f6D08b5c88b4A3b7BbB0C1AA34c3280A"; // Mainnet, Polygon, Arbitrum, BSC const PWN_V1_1_SIMPLE_LOAN_B = "0x4188C513fd94B0458715287570c832d9560bc08a"; // Cronos, Base, Optimism +const PWN_V1_2_SIMPLE_LOAN = "0x9A93AE395F09C6F350E3306aec592763c517072e"; +const PWN_V1_2_2_SIMPLE_LOAN = "0x0773d5F2f7b3264a9Eb285F085aCCcC53d5aAa4F"; module.exports = { misrepresentedTokens: true, @@ -26,6 +28,8 @@ module.exports = { PWN_BUNDLER_MAINNET, PWN_V1_SIMPLE_LOAN, PWN_V1_1_SIMPLE_LOAN_A, + PWN_V1_2_SIMPLE_LOAN, + PWN_V1_2_2_SIMPLE_LOAN, ], resolveNFTs: true, resolveArtBlocks: true, @@ -40,6 +44,8 @@ module.exports = { PWN_BUNDLER_POLYGON, PWN_V1_SIMPLE_LOAN, PWN_V1_1_SIMPLE_LOAN_A, + PWN_V1_2_SIMPLE_LOAN, + PWN_V1_2_2_SIMPLE_LOAN, ], fetchCoValentTokens: true, }), @@ -51,22 +57,32 @@ module.exports = { }, base: { tvl: sumTokensExport({ - owners: [PWN_BUNDLER_BASE, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, + owners: [PWN_BUNDLER_BASE, PWN_V1_1_SIMPLE_LOAN_B, PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, }), }, arbitrum: { tvl: sumTokensExport({ - owners: [PWN_BUNDLER_ARBITRUM, PWN_V1_1_SIMPLE_LOAN_A], fetchCoValentTokens: true, + owners: [PWN_BUNDLER_ARBITRUM, PWN_V1_1_SIMPLE_LOAN_A, PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, }), }, optimism: { tvl: sumTokensExport({ - owners: [PWN_BUNDLER_OPTIMISM, PWN_V1_1_SIMPLE_LOAN_B], fetchCoValentTokens: true, + owners: [PWN_BUNDLER_OPTIMISM, PWN_V1_1_SIMPLE_LOAN_B, PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, }), }, bsc: { tvl: sumTokensExport({ - owners: [PWN_BUNDLER_BSC, PWN_V1_1_SIMPLE_LOAN_A], fetchCoValentTokens: true, + owners: [PWN_BUNDLER_BSC, PWN_V1_1_SIMPLE_LOAN_A, PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, + }), + }, + linea: { + tvl: sumTokensExport({ + owners: [PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, + }), + }, + xdai: { + tvl: sumTokensExport({ + owners: [PWN_V1_2_SIMPLE_LOAN, PWN_V1_2_2_SIMPLE_LOAN], fetchCoValentTokens: true, }), }, mantle: { tvl: () => ({}) }, diff --git a/projects/pyswap/index.js b/projects/pyswap/index.js index 3f98df128350..f0198fb43931 100644 --- a/projects/pyswap/index.js +++ b/projects/pyswap/index.js @@ -15,7 +15,7 @@ const assets = [ let owners = [native_staking_contract_pool1, native_staking_contract_pool2, pys_staking_contract] let TVL_STAKING = sumTokensExport({ owners, tokens: assets }) -let TVL_AMM_DEX = getUniTVL({factory: "0x1434575AbB43103cFb40fd8147FB1e0B2ec3e2A1", useDefaultCoreAssets: true, fetchBalances: true,}) +let TVL_AMM_DEX = getUniTVL({factory: "0x1434575AbB43103cFb40fd8147FB1e0B2ec3e2A1", useDefaultCoreAssets: true,}) module.exports = { op_bnb: { diff --git a/projects/quantoswap/index.js b/projects/quantoswap/index.js index d8d0f067214d..e8083dc52915 100644 --- a/projects/quantoswap/index.js +++ b/projects/quantoswap/index.js @@ -11,6 +11,6 @@ module.exports = { misrepresentedTokens: true, ethereum: { staking: stakings(pools, QNS,), - tvl: getUniTVL({ useDefaultCoreAssets: true, factory, fetchBalances: true }) + tvl: getUniTVL({ useDefaultCoreAssets: true, factory}) }, }; \ No newline at end of file diff --git a/projects/quartzdefi/index.js b/projects/quartzdefi/index.js index ecb96cb18475..2823f30fca24 100644 --- a/projects/quartzdefi/index.js +++ b/projects/quartzdefi/index.js @@ -1,4 +1,4 @@ -const { pool2Exports } = require("../helper/pool2"); +const { pool2 } = require("../helper/pool2"); const { staking } = require("../helper/staking"); const sdk = require("@defillama/sdk"); const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); @@ -59,54 +59,17 @@ async function harmonyPool2(timestamp, block, chainBlocks) { return balances; } -async function harmonyStaking(timestamp, block, chainBlocks) { - let balances = {}; - const chain = "harmony"; - block = chainBlocks.harmony; - - const tokenBalances = (await sdk.api.abi.multiCall({ - calls: [ - { - target: qshare, - params: qshareboardroom - }, - { - target: quartz, - params: singleQuartzFarm - }, - { - target: quartz, - params: xquartz - } - ], - abi: "erc20:balanceOf", - block, - chain - })).output; - - tokenBalances.forEach(p => { - sdk.util.sumSingleBalance(balances, `harmony:${p.input.target}`, p.output); - }) - - return balances; -} module.exports = { misrepresentedTokens: true, harmony: { tvl: async () => ({}), - staking: harmonyStaking, + staking: staking([qshareboardroom, singleQuartzFarm, xquartz], [quartz]), pool2: harmonyPool2 }, bsc: { tvl: async () => ({}), staking: staking(aShareBoardroomAddress, ashareTokenAddress), - pool2: pool2Exports(ashareRewardPool, BSCLPTokens, "bsc", addr=> { - addr = addr.toLowerCase(); - if (addr === "0x36d53ed6380313f3823eed2f44dddb6d1d52f656") { - return "harmony:0xfa4b16b0f63f5a6d0651592620d585d308f749a4" - } - return `bsc:${addr}`; - }) + pool2: pool2(ashareRewardPool, BSCLPTokens) } } \ No newline at end of file diff --git a/projects/quasar/index.js b/projects/quasar/index.js index 2de7391a09fd..9846b1be3332 100644 --- a/projects/quasar/index.js +++ b/projects/quasar/index.js @@ -1,7 +1,7 @@ const { queryContract } = require('../helper/chain/cosmos') const { getConfig } = require('../helper/cache') -async function tvl(api) { +async function tvlOsmosis(api) { const data = await getConfig('quasar-vaults', 'https://api.quasar.fi/vaults') const vaults = data.filter(i => i.chainId === 'osmosis-1').map(i => i.address) for (const vault of vaults) { @@ -11,10 +11,22 @@ async function tvl(api) { return api.getBalances() } +async function tvlEthereum(api) { + const data = await getConfig('quasar-vaults', 'https://api.quasar.fi/vaults') + const vaults = data.filter(i => i.chainId === 1).map(i => i.address) + const tvlRes = await api.multiCall({ abi: 'function underlyingTvl() view returns (address[] tokens, uint256[] bals)', calls: vaults }) + tvlRes.forEach(({ tokens, bals }) => { + api.add(tokens, bals) + }) +} + module.exports = { timetravel: false, methodology: 'Total TVL on vaults', osmosis: { - tvl, + tvl: tvlOsmosis, }, -} \ No newline at end of file + ethereum: { + tvl: tvlEthereum + } +} diff --git a/projects/quenta/index.js b/projects/quenta/index.js new file mode 100644 index 000000000000..cda0b9e9dd7e --- /dev/null +++ b/projects/quenta/index.js @@ -0,0 +1,11 @@ + +const { sumTokensExport } = require("../helper/unwrapLPs"); + +const ioUSDC = '0x3b2bf2b523f54c4e454f08aa286d03115aff326c' +const ioUSDT = '0x6fbcdc1169b5130c59e72e51ed68a84841c98cd1' +const USDQ = '0xEE43369197F78CFDF0D8fc48D296964C50AC7B57' + +module.exports = { + iotex: { tvl: sumTokensExport({ owner: USDQ, tokens: [ioUSDC, ioUSDT], })}, + methodology: `The calculation method for Quenta's TVL is the total value of all stablecoins (ioUSDC, ioUSDT) staked in the USDQ contract.`, +}; diff --git a/projects/quicksilver/index.js b/projects/quicksilver/index.js index 8e135e4c820b..342ac38365e9 100644 --- a/projects/quicksilver/index.js +++ b/projects/quicksilver/index.js @@ -16,32 +16,15 @@ const coinGeckoIds = { async function tvl() { const balances = {}; + const { zones } = await get(endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones"); + const { supply } = await get(endPoints.quicksilver + "/cosmos/bank/v1beta1/supply"); - const { zones } = await get( - endPoints.quicksilver + "/quicksilver/interchainstaking/v1/zones" - ); - const { supply } = await get( - endPoints.quicksilver + "/cosmos/bank/v1beta1/supply" - ); - - zones.map((zone) => { - const balance = supply.find((coin) => { - return coin.denom === zone.local_denom; - }); - let amount = balance.amount / 1e6; - if (zone.base_denom === "adydx") - amount = balance.amount / 1e18 - + zones.forEach((zone) => { + const balance = supply.find((coin) => coin.denom === zone.local_denom); + if (!balance) return + const amount = zone.base_denom === "adydx" ? balance.amount / 1e18 : balance.amount / Math.pow(10, 6) const id = coinGeckoIds[zone.base_denom] - if (!id) { - throw new Error("Missing CoinGecko ID for denom " + zone.base_denom); - } - - sdk.util.sumSingleBalance( - balances, - id, - amount * zone.redemption_rate - ); + sdk.util.sumSingleBalance(balances, id, amount * zone.redemption_rate); }); return balances; @@ -50,7 +33,5 @@ async function tvl() { module.exports = { timetravel: false, methodology: "Sum of all the tokens that are liquid staked on Quicksilver", - quicksilver: { - tvl, - }, -}; // node test.js projects/quicksilver/index.js + quicksilver: { tvl }, +}; diff --git a/projects/quickswap-hydra/index.js b/projects/quickswap-hydra/index.js new file mode 100644 index 000000000000..7cb1af7a7442 --- /dev/null +++ b/projects/quickswap-hydra/index.js @@ -0,0 +1,14 @@ +const config = { + polygon_zkevm: '0x14c8FEA10fdc2d1357410f473e2CAa035a872517', + manta: '0x443Cf165B72e4b4331C0101A10553269972Ed4B8' +} + +Object.keys(config).forEach(chain => { + const target = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const tokens= await api.call({ abi: 'address[]:getAssetList', target}) + return api.sumTokens({ owner: target, tokens }) + } + } +}) \ No newline at end of file diff --git a/projects/quickswap-lending/index.js b/projects/quickswap-lending/index.js index cccbdb19a3ec..8e0b872df94d 100644 --- a/projects/quickswap-lending/index.js +++ b/projects/quickswap-lending/index.js @@ -11,7 +11,7 @@ const unitroller2 = "0x627742AaFe82EB5129DD33D237FF318eF5F76CBC" const unitroller3 = "0x1eD65DbBE52553A02b4bb4bF70aCD99e29af09f8" const cExports = [unitroller1, unitroller2, unitroller3, ].map(i => ({ - polygon: compoundExports(i, 'polygon') + polygon: compoundExports(i) })) module.exports = mergeExports([{ diff --git a/projects/quillswap/index.js b/projects/quillswap/index.js index 53b450e1c0c3..df73f2b7f4c1 100644 --- a/projects/quillswap/index.js +++ b/projects/quillswap/index.js @@ -1,6 +1,6 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b', { fetchBalances: true, }) +module.exports = uniTvlExport('scroll', '0xab8aEfe85faD683A6bDE16EeD04C3420C713324b') module.exports.hallmarks = [ [1698144638,"Liquidity Removed"], ] \ No newline at end of file diff --git a/projects/quoll/index.js b/projects/quoll/index.js index 98a1ea654303..2e8555f44add 100644 --- a/projects/quoll/index.js +++ b/projects/quoll/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { staking } = require("../helper/staking"); +const { stakings } = require("../helper/staking"); const abi = require('./abi.json'); const voterProxy = '0xe96c48C5FddC0DC1Df5Cf21d68A3D8b3aba68046'; const masterWombat = '0x489833311676B566f888119c29bd997Dc6C95830'; @@ -39,6 +39,7 @@ async function voterProxyBalances(api) { } async function tvl(api) { + api.add("0xf4c8e32eadec4bfe97e0f595add0f4450a863a11", await api.call({ abi: 'function balanceOfNFT(uint256) returns (uint256)', target: "0xfbbf371c9b0b994eebfcc977cef603f7f31c070d", params: [16274], })) api.add(wom, await api.call({ abi: 'erc20:balanceOf', target: veWom, params: [voterProxy], })) await voterProxyBalances(api) } @@ -48,8 +49,8 @@ module.exports = { "TVL of Quoll Finance consists of Wombat LP tokens staked in MasterWombat, WOM tokens locked in veWOM, and Quoll tokens locked in QUO Vote Lock contract.", bsc: { tvl, - staking: staking( - quoLocker, + staking: stakings( + [quoLocker, "0xc634c0A24BFF88c015Ff32145CE0F8d578B02F60"], quo, chain ), diff --git a/projects/rabbitswap-v3/index.js b/projects/rabbitswap-v3/index.js new file mode 100644 index 000000000000..33614fd56ba3 --- /dev/null +++ b/projects/rabbitswap-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + tomochain: { factory: '0x1F09b50e8cbAed8A157fEe28716d13AfE36A77E7', fromBlock: 86787787, isAlgebra: false }, +}) diff --git a/projects/rabbitx/index.js b/projects/rabbitx/index.js index 85f877326d74..80f40d495ce1 100644 --- a/projects/rabbitx/index.js +++ b/projects/rabbitx/index.js @@ -7,4 +7,8 @@ module.exports = { tvl: sumTokensExport({ owners: ['0xFc7f884DE22a59c0009C91733196b012Aecb8F41', '0x3b8F6D6970a24A58b52374C539297ae02A3c4Ae4', '0x7fAb440A0251dA67B316d2c0431E3Ccf4520Cd42',], tokens: [ADDRESSES.ethereum.USDT]}), staking: staking('0x0c378FB17E87B180256a87e3f671cd83Bf3236DB', '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e'), }, + blast: { + tvl: sumTokensExport({ owner: '0x3Ba925fdeAe6B46d0BB4d424D829982Cb2F7309e', tokens: [ADDRESSES.blast.USDB, ADDRESSES.blast.WETH]}), + staking: staking('0x67dBA61709D78806395acDBa3EF9Df686aF5dc24', '0x236bb48fcF61ce996B2C8C196a9258c176100c7d'), + }, } diff --git a/projects/racoon/index.js b/projects/racoon/index.js index e72eb0711e9a..969e3c014f65 100644 --- a/projects/racoon/index.js +++ b/projects/racoon/index.js @@ -1,5 +1,6 @@ module.exports = { base: { tvl: () => ({}) }, + deadFrom: 1693180800, hallmarks: [ [1693180800, "Rug Pull"] ] diff --git a/projects/radial/index.js b/projects/radial/index.js index 3ba2035c4e1d..f3d6c0ce01e4 100644 --- a/projects/radial/index.js +++ b/projects/radial/index.js @@ -1,243 +1,18 @@ const { - standardPoolInfoAbi, - getPoolInfo, - getSymbolsAndBalances, - isLP, - isYV, - } = require("../helper/masterchef"); - const sdk = require("@defillama/sdk"); - const { default: BigNumber } = require("bignumber.js"); - const { handleYearnTokens } = require("../creditum/helper.js"); - const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); - - const tokenAbi = 'address:token' - const token0Abi = 'address:token0' - const token1Abi = 'address:token1' - const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' - const shareValue = "uint256:getShareValue"; - const xSCREAM = "0xe3D17C7e840ec140a7A51ACA351a482231760824"; - const xCREDIT = "0xd9e28749e80D867d5d14217416BFf0e668C10645"; - const shareTarot = 'function shareValuedAsUnderlying(uint256 _share) returns (uint256 underlyingAmount_)'; - const xTAROT = "0x74D1D2A851e339B8cB953716445Be7E8aBdf92F4"; - const fBEET = "0xfcef8a994209d6916EB2C86cDD2AFD60Aa6F54b1"; - const masterChef = "0x6f536B36d02F362CfF4278190f922582d59E7e08"; - const chain = "fantom"; - const tokenIsOnCoingecko = true; - const includeYVTokens = true; - const stakingToken = "0xf04d7f53933becbf51ddf1f637fe7ecaf3d4ff94"; - - async function tvl(timestamp, ethBlock, {[chain]: block}) { - const transform = i => `fantom:${i}`; - - const poolInfo = await getPoolInfo( - masterChef, - block, - chain, - standardPoolInfoAbi - ); - const [symbols, tokenBalances] = await getSymbolsAndBalances( - masterChef, - block, - chain, - poolInfo - ); - - const balances = {}; - - const lpPositions = []; - - await Promise.all( - symbols.output.map(async (symbol, idx) => { - const balance = tokenBalances.output[idx].output; - const token = symbol.input.target.toLowerCase(); - if (token === stakingToken) { - return; - } else if (isLP(symbol.output, token, chain)) { - lpPositions.push({ - balance, - token, - }); - } else if (includeYVTokens && isYV(symbol.output)) { - let underlyingToken = ( - await sdk.api.abi.call({ - target: token, - abi: tokenAbi, - block, - chain, - }) - ).output; - sdk.util.sumSingleBalance( - balances, - transform(underlyingToken), - balance - ); - } else { - sdk.util.sumSingleBalance(balances, transform(token), balance); - } - }) - ); - - const [token0, token1] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: lpPositions.map((p) => ({ - target: p.token, - })), - abi: token0Abi, - block, - chain, - }), - sdk.api.abi.multiCall({ - calls: lpPositions.map((p) => ({ - target: p.token, - })), - abi: token1Abi, - block, - chain, - }), - ]); - - const pool2LpPositions = []; - const outsideLpPositions = []; - lpPositions.forEach((position, idx) => { - if ( - token0.output[idx].output.toLowerCase() === stakingToken || - token1.output[idx].output.toLowerCase() === stakingToken - ) { - pool2LpPositions.push(position); - } else { - outsideLpPositions.push(position); - } - }); - await unwrapUniswapLPs(balances, outsideLpPositions, block, chain, transform); - - if (!tokenIsOnCoingecko) { - const maxPool2ByToken = ( - await sdk.api.abi.multiCall({ - calls: pool2LpPositions.map((p) => ({ - target: stakingToken, - params: [p.token], - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output.reduce((max, curr) => { - if (BigNumber(curr.output).gt(max.output)) { - return curr; - } - return max; - }); - const poolAddress = maxPool2ByToken.input.params[0].toLowerCase(); - const poolReserves = await sdk.api.abi.call({ - block, - chain, - abi: getReservesAbi, - target: poolAddress, - }); - const posToken0 = token0.output.find( - (t) => t.input.target.toLowerCase() === poolAddress - ).output; - const posToken1 = token1.output.find( - (t) => t.input.target.toLowerCase() === poolAddress - ).output; - let price, otherToken; - if (posToken0.toLowerCase() === stakingToken) { - price = poolReserves.output[1] / poolReserves.output[0]; - otherToken = transform(posToken1); - } else { - price = poolReserves.output[0] / poolReserves.output[1]; - otherToken = transform(posToken0); - } - const transformedStakingToken = transform(stakingToken); - Object.values(balances).forEach((balance) => { - Object.entries(balance).forEach(([addr, bal]) => { - if (addr.toLowerCase() === transformedStakingToken) { - balance[otherToken] = BigNumber(bal).times(price).toFixed(0); - delete balance[addr]; - } - }); - }); - } - const calldata = { - chain, - block, - }; - - await handleYearnTokens( - balances, - [ - "0x637ec617c86d24e421328e6caea1d92114892439", - "0xef0210eb96c7eb36af8ed1c20306462764935607", - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0", - "0x0A0b23D9786963DE69CB2447dC125c49929419d8", - "0xCe2Fc0bDc18BD6a4d9A725791A3DEe33F3a23BB7", - "0x2C850cceD00ce2b14AA9D658b7Cad5dF659493Db", - "0xd817A100AB8A29fE3DBd925c2EB489D67F758DA9", - ], - "0x6f536B36d02F362CfF4278190f922582d59E7e08", - block, - chain, - transform - ); - - const screamShare = await sdk.api.abi.call({ - ...calldata, - target: xSCREAM, - abi: shareValue, - }); - - sdk.util.sumSingleBalance( - balances, - transform("0xe0654C8e6fd4D733349ac7E09f6f23DA256bF475"), - BigNumber(screamShare.output) - .times(balances['fantom:0xe3d17c7e840ec140a7a51aca351a482231760824']) - .div(1e18) - .toFixed(0) - ); - delete balances[transform(xSCREAM)]; - // node test.js projects/radial/index.js - const creditShare = await sdk.api.abi.call({ - ...calldata, - target: xCREDIT, - abi: shareValue, - }); - sdk.util.sumSingleBalance( - balances, - transform("0x77128dfdd0ac859b33f44050c6fa272f34872b5e"), - BigNumber(creditShare.output) - .times(balances['fantom:0xd9e28749e80d867d5d14217416bff0e668c10645']) - .div(1e18) - .toFixed(0) - ); - delete balances[transform(xCREDIT)]; - - const tarotShare = await sdk.api.abi.call({ - ...calldata, - target: xTAROT, - abi: shareTarot, - params: balances['fantom:0x74d1d2a851e339b8cb953716445be7e8abdf92f4'], - }); - sdk.util.sumSingleBalance( - balances, - transform("0xc5e2b037d30a390e62180970b3aa4e91868764cd"), - tarotShare.output - ); - delete balances[transform(xTAROT)]; - - sdk.util.sumSingleBalance( - balances, - transform("0xf24bcf4d1e507740041c9cfd2dddb29585adce1e"), - balances['fantom:0xfcef8a994209d6916eb2c86cdd2afd60aa6f54b1'] - ); - delete balances[transform(fBEET)]; - return balances; - } - - module.exports = { - fantom: { - tvl, - }, - }; - - // node test.js projects/radial/index.js - \ No newline at end of file + standardPoolInfoAbi, +} = require("../helper/masterchef"); +const { sumTokens2 } = require("../helper/unwrapLPs"); + +const masterChef = "0x6f536B36d02F362CfF4278190f922582d59E7e08"; +const stakingToken = "0xf04d7f53933becbf51ddf1f637fe7ecaf3d4ff94"; + +async function tvl(api) { + const info = await api.fetchList({ lengthAbi: 'poolLength', itemAbi: standardPoolInfoAbi, target: masterChef }) + return sumTokens2({ api, owner: masterChef, tokens: info.map(i => i.lpToken), blacklistedTokens: [stakingToken] }) +} + +module.exports = { + fantom: { + tvl, + }, +} \ No newline at end of file diff --git a/projects/radiant-v2/index.js b/projects/radiant-v2/index.js index fe7426a4f178..a02299a4b66b 100644 --- a/projects/radiant-v2/index.js +++ b/projects/radiant-v2/index.js @@ -1,10 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); -const { sumTokensExport } = require("../helper/unknownTokens"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const { aaveExports, methodology, } = require("../helper/aave"); + module.exports = { hallmarks: [ - [1704178500,"flash loan exploit"] + [1704178500,"flash loan exploit"], + [Math.floor(new Date('2024-10-16')/1e3), 'Multisig was compromised'], ], methodology, arbitrum: { @@ -22,4 +25,62 @@ module.exports = { // balancer pool is not unwrapped properly, so we use staking and rely on price api instead pool2: staking("0x28e395a54a64284dba39652921cd99924f4e3797", "0xcF7b51ce5755513d4bE016b0e28D6EDEffa1d52a") }, + base: { + ...aaveExports('base', '0x3eAF348Cf1fEC09C0f8d4f52AD3B8D894206b724'), + // balancer pool is not unwrapped properly, so we use staking and rely on price api instead + pool2: staking("0xD87F8a52a91680c993ece968B281bf92505A3741", "0x8a76639fe8e390ed16ea88f87beb46d6a5328254") + }, }; + +const config = { + bsc: {aTokens: [ + '0x34d4F4459c1b529BEbE1c426F1e584151BE2C1e5', + '0x4Ff2DD7c6435789E0BB56B0553142Ad00878a004', + '0x89d763e8532D256a3e3e60c1C218Ac71E71cF664', + '0x3bDCEf9e656fD9D03eA98605946b4fbF362C342b', + '0x455a281D508B4e34d55b31AC2e4579BD9b77cA8E', + '0x58b0BB56CFDfc5192989461dD43568bcfB2797Db', + '0x6350e53461c7C95964D699cfa4e84cec993eebb1' + ] , tokens: [ + ADDRESSES.bsc.BTCB, + ADDRESSES.bsc.USDT, + ADDRESSES.bsc.BUSD, + ADDRESSES.bsc.USDC, + ADDRESSES.bsc.ETH, + ADDRESSES.bsc.WBNB, + '0xa2E3356610840701BDf5611a53974510Ae27E2e1' + ]}, + arbitrum: {aTokens: [ + '0x727354712BDFcd8596a3852Fd2065b3C34F4F770', + '0xd69D402D1bDB9A2b8c3d88D98b9CEaf9e4Cd72d9', + '0x48a29E756CC1C097388f3B2f3b570ED270423b3d', + '0x0D914606f3424804FA1BbBE56CCC3416733acEC6', + '0x0dF5dfd95966753f01cb80E76dc20EA958238C46', + '0x42C248D137512907048021B30d9dA17f48B5b7B2', + '0x2dADe5b7df9DA3a7e1c9748d169Cd6dFf77e3d01', + '0x3a2d44e354f2d88EF6DA7A5A4646fd70182A7F55', + '0xb11A56DA177c5532D5E29cC8363d145bD0822c81', + '0x876F38f474e48A104c4af4F06cA488099C436C93', + '0xd15a6568Dc891Fd04Aa2f64aF56C66C2bede59d6', + '0x19f0bE6a603967c72bE32a30915a38d52cA31Ae2' + ] , tokens: [ + ADDRESSES.arbitrum.WBTC, + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.USDC, + ADDRESSES.optimism.DAI, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.WSTETH, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.USDC_CIRCLE, + '0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe', + '0x47c031236e19d024b42f8AE6780E44A573170703', + '0x70d95587d40A2caf56bd97485aB3Eec10Bee6336', + ADDRESSES.arbitrum.USDe + ]}, +} + +Object.keys(config).forEach(chain => { + const {aTokens, tokens,} = config[chain] + module.exports[chain].tvl = sumTokensExport({ tokensAndOwners2: [tokens, aTokens], }) + module.exports[chain].borrowed = () => ({}) +}) \ No newline at end of file diff --git a/projects/raindex/index.js b/projects/raindex/index.js new file mode 100644 index 000000000000..f67d3f26e170 --- /dev/null +++ b/projects/raindex/index.js @@ -0,0 +1,96 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const orderbooks = { + arbitrum: { + v3: [ + { address: "0x90caf23ea7e507bb722647b0674e50d8d6468234", start: 1710573200 }, + ], + v4: [ + { address: "0x550878091b2b1506069f61ae59e3a5484bca9166", start: 1727110056 }, + ] + }, + base: { + v3: [ + { address: "0x2aee87d75cd000583daec7a28db103b1c0c18b76", start: 1710593051 }, + ], + v4: [ + { address: "0xd2938e7c9fe3597f78832ce780feb61945c377d7", start: 1724856007 }, + { address: "0xa2f56f8f74b7d04d61f281be6576b6155581dcba", start: 1719934425 }, + { address: "0x32aCbdF51abe567C91b7a5cd5E52024a5Ca56844", start: 1724451937 }, + { address: "0x80DE00e3cA96AE0569426A1bb1Ae22CD4181dE6F", start: 1724168357 }, + { address: "0x7A44459893F99b9d9a92d488eb5d16E4090f0545", start: 1723404441 }, + ], + }, + bsc: { + v3: [ + { address: "0xb1d6d10561d4e1792a7c6b336b0529e4bfb5ea8f", start: 1710592564 }, + ], + v4: [ + { address: "0xd2938e7c9fe3597f78832ce780feb61945c377d7", start: 1727110200 }, + ] + }, + ethereum: { + v3: [ + { address: "0xf1224a483ad7f1e9aa46a8ce41229f32d7549a74", start: 1707183011 }, + ], + v4: [ + { address: "0x0eA6d458488d1cf51695e1D6e4744e6FB715d37C", start: 1729850783 }, + ] + }, + flare: { + v3: [ + { address: "0xb06202aA3Fe7d85171fB7aA5f17011d17E63f382", start: 1712406628 }, + ], + v4: [ + { address: "0xcee8cd002f151a536394e564b84076c41bbbcd4d", start: 1725430973 }, + { address: "0xaa3b14Af0e29E3854E4148f43321C4410db002bC", start: 1724097373 }, + { address: "0xA2Ac77b982A9c0999472c1De378A81d7363d926F", start: 1724079109 }, + { address: "0x582d9e838FE6cD9F8147C66A8f56A3FBE513a6A2", start: 1720717267 }, + ] + }, + linea: { + v3: [], + v4: [ + { address: "0x22410e2a46261a1b1e3899a072f303022801c764", start: 1727718941 }, + { address: "0xF97DE1c2d864d90851aDBcbEe0A38260440B8D90", start: 1722282647 }, + ] + }, + // matchain: { + // v3: [], + // v4: [ + // { address: "0x40312EDAB8Fe65091354172ad79e9459f21094E2", start: 1725285390 }, + // ] + // }, + polygon: { + v3: [ + { address: "0xde5abe2837bc042397d80e37fb7b2c850a8d5a6c", start: 1705929922 }, + { address: "0x34200e026fbac0c902a0ff18e77a49265ca6ac99", start: 1691086795 }, + { address: "0xd3edafeb9eaa454ce26e60a66ccda73939c343a4", start: 1698953082 }, + { address: "0xc95a5f8efe14d7a20bd2e5bafec4e71f8ce0b9a6", start: 1710528345 }, + { address: "0x95c9bf235435b660aa69f519904c3f175aab393d", start: 1698859456 }, + { address: "0xdcdee0e7a58bba7e305db3abc42f4887ce8ef729", start: 1701659318 }, + { address: "0x16d518706d666c549da7bd31110623b09ef23abb", start: 1702067640 }, + ], + v4: [ + { address: "0x7d2f700b1f6fd75734824ea4578960747bdf269a", start: 1726792922 }, + { address: "0x2f209e5b67a33b8fe96e28f24628df6da301c8eb", start: 1721758591 }, + { address: "0xb8CD71e3b4339c8B718D982358cB32Ed272e4174", start: 1723733415 }, + { address: "0x001B302095D66b777C04cd4d64b86CCe16de55A1", start: 1723728017 }, + { address: "0xAfD94467d2eC43D9aD39f835BA758b61b2f41A0E", start: 1721746069 }, + ] + }, +} + +async function tvl(api) { + const { v3 = [], v4 = [] } = orderbooks[api.chain] + const owners = v3.concat(v4).map(orderbook => orderbook.address) + return sumTokens2({ api, owners, fetchCoValentTokens: true, permitFailure: true }) +} + +module.exports = { + methodology: 'Balance of tokens held by Rain Orderbook contract.', +} + +Object.keys(orderbooks).forEach(chain => { + module.exports[chain] = { tvl } +}) diff --git a/projects/ram.js b/projects/ram.js index d6f67cd28f9f..f458c05fb460 100644 --- a/projects/ram.js +++ b/projects/ram.js @@ -1,9 +1,5 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const {usdCompoundExports} = require("./helper/compound"); - -const controllerAddress = "0x0d4fe8832857Bb557d8CFCf3737cbFc8aE784106"; +const { compoundExports2 } = require("./helper/compound"); module.exports = { - timetravel: true, // but we don't have a thundercore archive node atm - thundercore: usdCompoundExports(controllerAddress, "thundercore", "0xeF5A0CE54a519B1Db3F350EB902C4cFbf7671D88", undefined, { cetheEquivalent: ADDRESSES.thundercore.WTT }) -}; + thundercore: compoundExports2({ comptroller: '0x0d4fe8832857Bb557d8CFCf3737cbFc8aE784106', cether: '0xef5a0ce54a519b1db3f350eb902c4cfbf7671d88' }) +} \ No newline at end of file diff --git a/projects/rari/api.js b/projects/rari/api.js deleted file mode 100644 index 9b4d078af5be..000000000000 --- a/projects/rari/api.js +++ /dev/null @@ -1,11 +0,0 @@ -const { get } = require("../helper/http"); - -async function fetch() { - const { tvl } = await get("https://app.rari.capital/api/stats") - - return parseFloat(tvl); -} - -module.exports = { - fetch, -}; diff --git a/projects/rari/index.js b/projects/rari/index.js index 09a0a1f05496..38e025c3e7e5 100644 --- a/projects/rari/index.js +++ b/projects/rari/index.js @@ -1,12 +1,7 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { requery } = require("../helper/requery"); const abi = require("./abi"); -const { default: BigNumber } = require("bignumber.js"); -const { getCompoundV2Tvl } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { pool2 } = require('../helper/pool2'); -const { getBlock } = require("../helper/http"); -const { sliceIntoChunks } = require("../helper/utils"); const { sumTokens2 } = require("../helper/unwrapLPs"); const earnETHPoolFundControllerAddressesIncludingLegacy = [ @@ -16,23 +11,13 @@ const earnETHPoolFundControllerAddressesIncludingLegacy = [ ] const earnDAIPoolControllerAddressesIncludingLegacy = [ '0x7C332FeA58056D1EF6aB2B2016ce4900773DC399', - // '0x3F579F097F2CE8696Ae8C417582CfAFdE9Ec9966' ] const earnStablePoolAddressesIncludingLegacy = [ '0x4a785fa6fcd2e0845a24847beb7bddd26f996d4d', - // '0x27C4E34163b5FD2122cE43a40e3eaa4d58eEbeaF', - // '0x318cfd99b60a63d265d2291a4ab982073fbf245d', - // '0xb6b79D857858004BF475e4A57D4A446DA4884866', - // '0xD4be7E211680e12c08bbE9054F0dA0D646c45228', - // '0xB202cAd3965997f2F5E67B349B2C5df036b9792e', - // '0xe4deE94233dd4d7c2504744eE6d34f3875b3B439' ] -const fusePoolLensAddress = '0x8dA38681826f4ABBe089643D2B3fE4C6e4730493' const fusePoolDirectoryAddress = '0x835482FE0532f169024d5E9410199369aAD5C77E' const rariGovernanceTokenUniswapDistributorAddress = '0x1FA69a416bCF8572577d3949b742fBB0a9CD98c7' const RGTETHSushiLPTokenAddress = '0x18a797c7c70c1bf22fdee1c09062aba709cacf04' -const ETHAddress = ADDRESSES.null -const bigNumZero = BigNumber('0') const tokenMapWithKeysAsSymbol = { 'DAI': ADDRESSES.ethereum.DAI, @@ -44,144 +29,25 @@ const tokenMapWithKeysAsSymbol = { 'MUSD': '0xe2f2a5c287993345a840db3b0845fbc70f5935a5' } -const fusePoolData = {} -async function getFusePoolData(pools, block) { - const data = { output: [] } - const chunks = sliceIntoChunks(pools.map(i => ({ params: i.comptroller })), 25) - for (const chunk of chunks) { - const items = await sdk.api2.abi.multiCall({ - target: fusePoolLensAddress, - abi: abi['getPoolSummary'], - block, - calls: chunk - }) - data.output.push(...items.output) - } - return data -} - -async function getFusePools(timestamp, block, balances, borrowed) { - const fusePoolsAll = (await sdk.api.abi.call({ - target: fusePoolDirectoryAddress, - block, - abi: abi['getPublicPools'] - })) - - const fusePools = fusePoolsAll.output['1'] - - if (!fusePoolData[block]) - fusePoolData[block] = getFusePoolData(fusePools, block) - - const poolSummaries = await fusePoolData[block] - - for (let summaryResult of poolSummaries.output) { - if (summaryResult.success) { - const summary = summaryResult.output - // https://docs.rari.capital/fuse/#get-pools-by-account-with-data - let amount; - if (borrowed) { - amount = BigNumber(summary['1']) - } else { - amount = BigNumber(summary['0']).minus(summary['1']) - } - sdk.util.sumSingleBalance(balances, ETHAddress, amount.toFixed(0)) - } else { - const newBalances = await getCompoundV2Tvl(summaryResult.input.params[0], 'ethereum', id => id, undefined, undefined, borrowed)(timestamp, block, { ethereum: block }) - Object.entries(newBalances).forEach(entry => sdk.util.sumSingleBalance(balances, entry[0], entry[1])) - } - } -} - -async function borrowed(timestamp, block) { - if (block > 14684686) { - return {} // after fei hack - } - const balances = {} - await getFusePools(timestamp, block, balances, true) - return balances -} - -async function tvl(timestamp, block) { - const balances = {} - block = await getBlock(timestamp, 'ethereum', { ethereum: block }) - - const getEarnYieldProxyAddressAsArray = (block) => { - if (block <= 11306334) { - return ['0x35DDEFa2a30474E64314aAA7370abE14c042C6e8'] - } else if (block > 11306334 && block <= 11252873) { - return ['0x6dd8e1Df9F366e6494c2601e515813e0f9219A88'] - } else { - return ['0x35DDEFa2a30474E64314aAA7370abE14c042C6e8'] - } - } +async function tvl(api) { - const updateBalance = (token, amount) => { - token = token.toLowerCase() - sdk.util.sumSingleBalance(balances, token, amount.toFixed(0)) - } const getBalancesFromEarnPool = async (addresses) => { - const earnPoolData = (await sdk.api.abi.multiCall({ - calls: addresses.map((address) => ({ - target: address - })), - block, - abi: abi['getRawFundBalancesAndPrices'] - })).output.map((resp) => resp.output) - for (let j = 0; j < earnPoolData.length; j++) { - const poolData = earnPoolData[j] && earnPoolData[j]['0'] - for (let i = 0; poolData && i < poolData.length; i++) { - const tokenSymbol = poolData[i].toUpperCase() - const tokenContractAddress = tokenMapWithKeysAsSymbol[tokenSymbol] - if (tokenContractAddress) { - const tokenAmount = BigNumber(earnPoolData[j]['1'][i]) - if (tokenAmount.isGreaterThan(bigNumZero)) { - updateBalance(tokenContractAddress, tokenAmount) - } - const pools = earnPoolData[j]['2'][i] - const poolBalances = earnPoolData[j]['3'][i] - if (pools && poolBalances && pools.length === poolBalances.length) { - for (let k = 0; k < pools.length; k++) { - const poolBalance = BigNumber(poolBalances[k]) - if (poolBalance.isGreaterThan(bigNumZero)) { - updateBalance(tokenContractAddress, poolBalance) - } - } - } - } - } - } + const earnPoolData = (await api.multiCall({ calls: addresses, abi: abi['getRawFundBalancesAndPrices'], permitFailure: true, })) + earnPoolData.filter(i => i).forEach(([tokens, bals] = []) => { + tokens.forEach((token, i) => { + const mapped = tokenMapWithKeysAsSymbol[token.toUpperCase()] + if (mapped) api.add(mapped, bals[i]) + else console.log('unmapped', token, bals[i]) + }) + }) } // Earn yield pool - const earnYieldProxyAddress = getEarnYieldProxyAddressAsArray(block) + const earnYieldProxyAddress = ['0x35DDEFa2a30474E64314aAA7370abE14c042C6e8'].concat(earnETHPoolFundControllerAddressesIncludingLegacy).concat(earnDAIPoolControllerAddressesIncludingLegacy).concat(earnStablePoolAddressesIncludingLegacy) await getBalancesFromEarnPool(earnYieldProxyAddress) - //Earn ETH pool - const ethPoolData = (await sdk.api.abi.multiCall({ - block, - abi: abi['getRawFundBalances'], - calls: earnETHPoolFundControllerAddressesIncludingLegacy.map((address) => ({ - target: address - })) - })).output.map((resp) => resp.output).flat() - for (let i = 0; i < ethPoolData.length; i++) { - const ethAmount = BigNumber(ethPoolData[i]['0']) - if (ethAmount.isGreaterThan(bigNumZero)) { - updateBalance(ETHAddress, ethAmount) - } - } - - // Earn DAI pool - await getBalancesFromEarnPool(earnDAIPoolControllerAddressesIncludingLegacy) - - // Earn stable pool - await getBalancesFromEarnPool(earnStablePoolAddressesIncludingLegacy) - - // Fuse - // await getFusePools(timestamp, block, balances, false) - - return balances + await fuseTvl(api) } async function fuseTvl(api) { @@ -191,30 +57,15 @@ async function fuseTvl(api) { const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets }) return sumTokens2({api , tokensAndOwners2: [tokens, markets]}) } -async function fuseBorrowed(api) { - - const [_, pools] = (await api.call({ target: fusePoolDirectoryAddress, abi: abi['getPublicPools'] })) - const markets = (await api.multiCall({ abi: 'address[]:getAllMarkets', calls: pools.map(i => i.comptroller) })).flat() - const tokens = await api.multiCall({ abi: 'address:underlying', calls: markets }) - const bals = await api.multiCall({ abi: 'uint256:totalBorrows', calls: markets }) - api.addTokens(tokens, bals) - return api.getBalances() -} module.exports = { - misrepresentedTokens: true, doublecounted: true, start: 1596236058, // July 14, 2020 ethereum: { - tvl: sdk.util.sumChainTvls([tvl, fuseTvl]), + tvl, pool2: pool2(rariGovernanceTokenUniswapDistributorAddress, RGTETHSushiLPTokenAddress), - borrowed, - }, - arbitrum: { - // Borrowing is disabled, and Tetranode's locker is the only pool with significant tvl, so counting only that - tvl: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, false), - borrowed: getCompoundV2Tvl('0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716', 'arbitrum', undefined, undefined, undefined, true), }, + arbitrum: compoundExports2({ comptroller: '0xC7D021BD813F3b4BB801A4361Fbcf3703ed61716' }), hallmarks: [ [1651276800, "FEI hack"], [1649548800, "ICHI sell-off"], @@ -222,3 +73,6 @@ module.exports = { [1654905600, "Bhavnani's announcement"] ] } + +module.exports.arbitrum.borrowed = () => ({}) +module.exports.ethereum.borrowed = () => ({}) diff --git a/projects/rate-x/index.js b/projects/rate-x/index.js new file mode 100644 index 000000000000..b87ba3a32563 --- /dev/null +++ b/projects/rate-x/index.js @@ -0,0 +1,29 @@ +const { sumTokens2 } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); +const { getConnection } = require("../helper/solana"); + +async function tvl(api) { + const connection = getConnection(); + const lookupTableAddress = new PublicKey("eP8LuPmLaF1wavSbaB4gbDAZ8vENqfWCL5KaJ2BRVyV"); + + const lookupTableAccount = ( + await connection.getAddressLookupTable(lookupTableAddress) + ).value; + + const tokenAccounts = [] + for (let i = 0; i < lookupTableAccount.state.addresses.length; i++) { + const address = lookupTableAccount.state.addresses[i]; + tokenAccounts.push(address.toBase58()); + } + + return sumTokens2({ + tokenAccounts, + balances: api.getBalances() + }) +} + +module.exports = { + timetravel: false, + methodology: "TVL is calculated by summing the value of the traders' vault, LP vault, and earn vault.", + solana: { tvl }, +}; diff --git a/projects/raydium/api.js b/projects/raydium/api.js index 01ea1e8f65fb..f03307d7d0fb 100644 --- a/projects/raydium/api.js +++ b/projects/raydium/api.js @@ -3,6 +3,7 @@ const { sumTokens2 } = require('../helper/solana') module.exports = { timetravel: false, + isHeavyProtocol: true, } const { solana: { tvl } } = getExports("raydium", ['solana']) @@ -14,6 +15,8 @@ module.exports.solana = { async function tvlWithCheck(api) { const balances = await tvl(api) api.addBalances(balances) + api.removeTokenBalance('DS4QiZfkp39PsHXYCRV3NkyDUKV9SpTczp2qnAUg6Nt6') // ZMB + api.removeTokenBalance('HDa3zJc12ahykSsBRvgiWzr6WLEByf36yzKKbVvy4gnF') // SOS 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') diff --git a/projects/raydium/index.js b/projects/raydium/index.js index 816005d17ff4..ce47ced0ffd7 100644 --- a/projects/raydium/index.js +++ b/projects/raydium/index.js @@ -154,8 +154,10 @@ async function combinedTvl(api) { module.exports = { timetravel: false, + isHeavyProtocol: true, misrepresentedTokens: true, hallmarks: [[1667865600, "FTX collapse"]], + solana: { tvl: combinedTvl, staking: () => sumTokens2({ tokenAccounts: ['8tnpAECxAT9nHBqR1Ba494Ar5dQMPGhL31MmPJz1zZvY'] }) diff --git a/projects/real-veRWA/index.js b/projects/real-veRWA/index.js index e86393a00163..a7e76b780ef6 100644 --- a/projects/real-veRWA/index.js +++ b/projects/real-veRWA/index.js @@ -1,5 +1,6 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require('../helper/staking') -const RWAToken = '0x4644066f535Ead0cde82D209dF78d94572fCbf14' +const RWAToken = ADDRESSES.real.RWA const veRWA = '0xa7B4E29BdFf073641991b44B283FD77be9D7c0F4' module.exports = { diff --git a/projects/rebalance/index.js b/projects/rebalance/index.js index e3a7ab1ac1e4..1ba5accb8104 100644 --- a/projects/rebalance/index.js +++ b/projects/rebalance/index.js @@ -1,21 +1,32 @@ -const { sumERC4626VaultsExport } = require('../helper/erc4626') const config = { arbitrum: [ - '0x4DdbCB86FCa5B4678Bd132085C818b07cd5716D1', // rUSDT - '0xD430e22c3a0F8Ebd6813411084a5cb26937f6661', // rUSDC.e - '0x46cbC1397710e177810B84028F4bf6F8B75B6F71', // rWETH - '0x52952120EAd486EC7cdd4CA93EA13f2abA44cC20', // rFRAX - '0xD77B4AdfF67108f7Ea3155ce1fB67c5345ee89C8', // rDAI - ] -} + "0xCF86c768E5b8bcc823aC1D825F56f37c533d32F9", // rUSDT + "0x6eAFd6Ae0B766BAd90e9226627285685b2d702aB", // rUSDC + "0xa8aae282ab2e57B8E39ad2e70DA3566d315348A9", // rUSDC.e + "0xcd5357A4F48823ebC86D17205C12B0B268d292a7", // rWETH + "0x5A0F7b7Ea13eDee7AD76744c5A6b92163e51a99a", // rDAI + "0x3BCa6513BF284026b4237880b4e4D60cC94F686c", // rFRAX + ], +}; + +const abi = "function getDepositBalance(address user, address vault) view returns (uint256 balance)"; module.exports = { - methodology: - 'TVL displays the total amount of assets stored in the REBALANCE vault contracts.', + methodology: "TVL displays the total amount of assets stored in the REBALANCE vault contracts.", start: 1712143874, - hallmarks: [[1712143874, 'Profitable vaults deployment']], + hallmarks: [[1712143874, "Profitable vaults deployment"]], }; -Object.keys(config).forEach(chain => { - module.exports[chain] = { tvl: sumERC4626VaultsExport({ vaults: config[chain], isOG4626: true, }) } -}) \ No newline at end of file +Object.keys(config).forEach((chain) => { + module.exports[chain] = { tvl: (api) => tvl(api, config[chain]) }; +}); + +const tvl = async (api, vaults) => { + const [providers, assets] = await Promise.all([ + api.multiCall({ calls: vaults, abi: "address:activeProvider" }), + api.multiCall({ calls: vaults, abi: "address:asset" }), + ]); + + const balances = await api.multiCall({ calls: vaults.map((vault, i) => ({ target: providers[i], params: [vault, vault] })), abi }) + api.add(assets, balances) +}; diff --git a/projects/redacted/index.js b/projects/redacted/index.js index 8aedcf51b413..58c73dfb6726 100644 --- a/projects/redacted/index.js +++ b/projects/redacted/index.js @@ -1,13 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners, sumTokens2, genericUnwrapCvx } = require('../helper/unwrapLPs') -const sdk = require('@defillama/sdk') +const { sumTokens2, genericUnwrapCvx } = require('../helper/unwrapLPs') const treasuries = ["0xa52fd396891e7a74b641a2cb1a6999fcf56b077e", "0x086c98855df3c78c6b481b6e1d47bef42e9ac36b"] const cvxCRVStaking = '0x3Fe65692bfCD0e6CF84cB1E7d24108E434A7587e' const CVX = ADDRESSES.ethereum.CVX const cvxCRV = ADDRESSES.ethereum.cvxCRV -const FXS = '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0' +const FXS = ADDRESSES.ethereum.FXS const veFXS = '0xc8418aF6358FFddA74e09Ca9CC3Fe03Ca6aDC5b0' const CRV = ADDRESSES.ethereum.CRV const veCRV = '0x5f3b5DfEb7B28CDbD7FAba78963EE202a494e2A2' @@ -20,110 +19,72 @@ const BTRFLYV2 = '0xc55126051B22eBb829D00368f4B12Bde432de5Da' const cvxCRVPool = '0x0392321e86F42C2F94FBb0c6853052487db521F0' const rlBTRFLYAbi = { - lockedSupply: "uint256:lockedSupply", -} - -async function tvl(timestamp, block, chainBlocks){ - const balances = {} - - //Add tokens/curve LPs in wallet - await sumTokensAndLPsSharedOwners(balances, [ - [CVX, false], - [cvxCRV, false], - [FXS, false], - [CRV, false], - [AURA, false], - // BTRFLY/ETH Curve LP - ['0x7483Dd57f6488b0e194A151C57Df6Ec85C00aCE9', false], - [ADDRESSES.ethereum.USDC, false], - [ADDRESSES.ethereum.FRAX, false], - ], treasuries, block) - - //Add UniswapV3 LPs - await sumTokens2({ balances, owners: treasuries, block, resolveUniV3: true, }) - - //Add convex deposited curve LPs - await genericUnwrapCvx(balances, treasuries[0], cvxCRVPool, block, 'ethereum') - - //This causes an error and not sure why - //await genericUnwrapCvx(balances, treasuries[0], cvxFXSPool, block, 'ethereum') - - //Add vlCVX as CVX - const vlCVXBalance = await sdk.api.erc20.balanceOf({ - target: ADDRESSES.ethereum.vlCVX, - owner: treasuries[0], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, CVX, vlCVXBalance) + lockedSupply: "uint256:lockedSupply", +} - //Add vlAURA as AURA - const vlAURABalance = await sdk.api.erc20.balanceOf({ - target: AURALocker, - owner: treasuries[0], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, AURA, vlAURABalance) +async function tvl(api) { + const block = api.block + const balances = api.getBalances() + const tokens = [ + CVX, + cvxCRV, + FXS, + CRV, + AURA, + // BTRFLY/ETH Curve LP + '0x7483Dd57f6488b0e194A151C57Df6Ec85C00aCE9', + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.FRAX, + ] - //Add staked cvxCRV as cvxCRV - const cvxCRVStakedBalance = await sdk.api.erc20.balanceOf({ - target: cvxCRVStaking, - owner: treasuries[0], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, cvxCRV, cvxCRVStakedBalance) + //Add tokens/curve LPs in wallet + await api.sumTokens({ owners: treasuries, tokens }) - //Add veFXS as 1/4 FXS since locked for 4 years - const veFXSBalance = await sdk.api.erc20.balanceOf({ - target: veFXS, - owner: treasuries[0], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, FXS, veFXSBalance/4) + //Add UniswapV3 LPs + await sumTokens2({ api, owners: treasuries, resolveUniV3: true, }) - //Add veCRV as 1 CRV since locked for 4 years - const veCRVBalance = await sdk.api.erc20.balanceOf({ - target: veCRV, - owner: treasuries[0], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, CRV, veCRVBalance) + //Add convex deposited curve LPs + await genericUnwrapCvx(balances, treasuries[0], cvxCRVPool, block) - //Add sOHM as OHM since 1:1 - const sOHMBalance = await sdk.api.erc20.balanceOf({ - target: sOHM, - owner: treasuries[1], - chain: 'ethereum', - block: chainBlocks['ethereum'] - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, OHM, sOHMBalance) + //This causes an error and not sure why + //await genericUnwrapCvx(balances, treasuries[0], cvxFXSPool, block, 'ethereum') - return balances + //Add vlCVX as CVX + const [vlCVXBalance, vlAURABalance, cvxCRVStakedBalance, veFXSBalance, veCRVBalance, sOHMBalance] = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: [ + { target: ADDRESSES.ethereum.vlCVX, params: treasuries[0] }, + { target: AURALocker, params: treasuries[0] }, + { target: cvxCRVStaking, params: treasuries[0] }, + { target: veFXS, params: treasuries[0] }, + { target: veCRV, params: treasuries[0] }, + { target: sOHM, params: treasuries[1] }, + ] + }) + api.add(CVX, vlCVXBalance) + api.add(AURA, vlAURABalance) + api.add(cvxCRV, cvxCRVStakedBalance) + api.add(CRV, veCRVBalance) + api.add(OHM, sOHMBalance) + api.add(FXS, veFXSBalance / 4) + //Add vlAURA as AURA + //Add staked cvxCRV as cvxCRV + //Add veFXS as 1/4 FXS since locked for 4 years + //Add veCRV as 1 CRV since locked for 4 years + //Add sOHM as OHM since 1:1 } -async function staking(timestamp, block, chainBlocks) { - const balances = {} - - //Adding locked BTRFLY - const lockedBTRFLY = await sdk.api.abi.call({ - abi: rlBTRFLYAbi.lockedSupply, - target: rlBTRFLY, - chain: 'ethereum', - block: chainBlocks['ethereum'], - }).then(result => result.output) - sdk.util.sumSingleBalance(balances, BTRFLYV2, lockedBTRFLY) - - return balances +async function staking(api) { + + //Adding locked BTRFLY + const lockedBTRFLY = await api.call({ abi: rlBTRFLYAbi.lockedSupply, target: rlBTRFLY, }) + api.add(BTRFLYV2, lockedBTRFLY) } module.exports = { - methodology: "tvl = Treasury assets (bonding). staking = rlBTRFLY (locked tokens)", - ethereum:{ - tvl, - staking - }, + methodology: "tvl = Treasury assets (bonding). staking = rlBTRFLY (locked tokens)", + ethereum: { + tvl, + staking + }, } \ No newline at end of file diff --git a/projects/reddex/index.js b/projects/reddex/index.js new file mode 100644 index 000000000000..19ad1e6c3436 --- /dev/null +++ b/projects/reddex/index.js @@ -0,0 +1,7 @@ +const { uniTvlExports } = require('../helper/unknownTokens') + +module.exports = uniTvlExports({ + ethereum: '0xBC7D212939FBe696e514226F3FAfA3697B96Bf59', + bsc: '0x6D642253B6fD96d9D155279b57B8039675E49D8e', + rbn: '0x2E592dF6c56a8720E46bB00D17f8FaB391BF97c8', +}) diff --git a/projects/reffinance.js b/projects/reffinance.js index 1222b44a2118..4e41da809ca3 100644 --- a/projects/reffinance.js +++ b/projects/reffinance.js @@ -1,21 +1,27 @@ +const { default: BigNumber } = require('bignumber.js') const { call, sumSingleBalance, } = require('./helper/chain/near') const PROJECT_CONTRACT = 'v2.ref-finance.near' - +const PROJECT_DCL_CONTRACT = 'dclv2.ref-labs.near' async function tvl() { const balances = {} let poolIndex = 0 const numberOfPools = await call(PROJECT_CONTRACT, 'get_number_of_pools', {}) - + const allDclPools = await call(PROJECT_DCL_CONTRACT, 'list_pools', {}); + allDclPools.forEach((dclPoolDetail) => { + const { token_x, token_y, total_order_x, total_order_y, total_x, total_y } = dclPoolDetail; + sumSingleBalance(balances, token_x, BigNumber(total_order_x).plus(total_x).toFixed()); + sumSingleBalance(balances, token_y, BigNumber(total_order_y).plus(total_y).toFixed()); + }) do { const pools = await call(PROJECT_CONTRACT, 'get_pools', { from_index: poolIndex, limit: 500 }) pools .filter(({ shares_total_supply }) => +shares_total_supply > 0) // Token pair must have some liquidity .map(({ token_account_ids, pool_kind, amounts }) => { - if (!['SIMPLE_POOL', 'STABLE_SWAP', "RATED_SWAP"].includes(pool_kind)) throw new Error('Unknown pool kind.') + // if (!['SIMPLE_POOL', 'STABLE_SWAP', "RATED_SWAP"].includes(pool_kind)) throw new Error('Unknown pool kind.') token_account_ids.forEach((token, index) => { sumSingleBalance(balances, token, amounts[index]) }) diff --git a/projects/reform/index.js b/projects/reform/index.js new file mode 100644 index 000000000000..8a59d884b9c0 --- /dev/null +++ b/projects/reform/index.js @@ -0,0 +1,9 @@ +const { staking } = require('../helper/staking') + +module.exports = { + ethereum: { + tvl: () => ({}), + staking: staking('0x74ef3b69e8c475df8450eddda5dabd9b6dd17972', '0xea3eed8616877F5d3c4aEbf5A799F2e8D6DE9A5E'), + pool2: staking('0x74ef3b69e8c475df8450eddda5dabd9b6dd17972', '0xf4e14a7766a3316d6cefbaec614c714f2d4965d8') + } +} diff --git a/projects/relayChain/index.js b/projects/relayChain/index.js index b2ac00eb5849..15829e7bc8ca 100644 --- a/projects/relayChain/index.js +++ b/projects/relayChain/index.js @@ -104,7 +104,7 @@ const wbtcCronos = ADDRESSES.cronos.WBTC; const wethCronos = "0xe44fd7fcb2b1581822d0c862b68222998a0c299a"; const relayCronos = "0x9C29650a1B273A031A35F3121914aae882B144A4"; const busdCronos = ADDRESSES.oasis.USDT; -const wCronos = "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23"; +const wCronos = ADDRESSES.cronos.WCRO_1; diff --git a/projects/ren/index.js b/projects/ren/index.js index e52debcd52bb..a7aa4ac429df 100644 --- a/projects/ren/index.js +++ b/projects/ren/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { request, gql } = require("graphql-request"); const sdk = require("@defillama/sdk"); -const { getTokenSupply } = require('../helper/solana') const ethGraphUrl = sdk.graph.modifyEndpoint('AJaQdD8DUunuwHCbAsZk5h62AfyNG1etRtK9EcDH7gwH'); const bscGraphUrl = @@ -152,20 +151,17 @@ async function solana() { ["renLUNA", "8wv2KAykQstNAj2oW6AHANGBiFKVFhvMiyyzzjhkmGvE"], ] const balances = {} - await Promise.all(tokens.map(async token => { - balances[symbol(token[0])] = await getTokenSupply(token[1]) - })) return balances } module.exports = { - solana: { + solana: { tvl: solana }, ethereum: { tvl: eth, }, - avax:{ + avax: { tvl: avax, }, bsc: { @@ -187,3 +183,6 @@ module.exports = { tvl: optimism }, }; + + +Object.values(module.exports).forEach(chainExports => chainExports.tvl = () => ({})) diff --git a/projects/renegade-fi/index.js b/projects/renegade-fi/index.js new file mode 100644 index 000000000000..5b3503635af6 --- /dev/null +++ b/projects/renegade-fi/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") + +const config = { + arbitrum: { owners: ['0x30bD8eAb29181F790D7e495786d4B96d7AfDC518']} +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ ...config[chain], fetchCoValentTokens: true}) + } +}) \ No newline at end of file diff --git a/projects/renzo/index.js b/projects/renzo/index.js index 94b80e7611f8..4ba6f3fdcd24 100644 --- a/projects/renzo/index.js +++ b/projects/renzo/index.js @@ -1,13 +1,15 @@ const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require("../helper/solana"); 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"; +const SEI_EZ_ETH_ADDRESS = "0x6DCfbF4729890043DFd34A93A2694E5303BA2703"; async function L2Tvl(api) { - return { - [L1_EZ_ETH_ADDRESS]: await api.call({ target: L2_EZ_ETH_ADDRESS, abi: "erc20:totalSupply" }) - } + const targetAddress = api.chain === "sei" ? SEI_EZ_ETH_ADDRESS : L2_EZ_ETH_ADDRESS; + const supply = await api.call({ target: targetAddress, abi: "erc20:totalSupply" }); + return { [L1_EZ_ETH_ADDRESS]: supply }; } async function ethTvl(api) { @@ -18,15 +20,29 @@ async function ethTvl(api) { api.add(L1_PZ_ETH_ADDRESS, pzEthBalance); } -const chains = ["mode", "blast", "bsc", "linea", "arbitrum", "base"] +async function solanaTvl() { + return sumTokens2( + { + tokenAccounts: [ + "9VBi7unB9Sz5eBNUdvQH2xzUENXvNsaiEkP9p2Cabvsy" + ] + } + ) +} + +const chains = ["mode", "blast", "bsc", "linea", "arbitrum", "base", "optimism", "fraxtal","zircuit","sei" ] module.exports = { doublecounted: true, ethereum: { - tvl: ethTvl, + tvl: ethTvl + }, + solana: { + tvl: solanaTvl } } chains.forEach(chain => { module.exports[chain] = { tvl: L2Tvl } -}) \ No newline at end of file +}) + diff --git a/projects/reserve/index.js b/projects/reserve/index.js index 04f20a8752ce..7880018261dc 100644 --- a/projects/reserve/index.js +++ b/projects/reserve/index.js @@ -1,8 +1,6 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokens2, - genericUnwrapCvxDeposit, - unwrapCreamTokens, } = require("../helper/unwrapLPs.js"); const { getStargateLpValues, @@ -15,21 +13,34 @@ const chainConfigs = { deployerAddresses: [ "0xFd6CC4F251eaE6d02f9F7B41D1e80464D3d2F377", "0x5c46b718Cd79F2BBA6869A3BeC13401b9a4B69bB", + "0x1bd20253c49515d348dad1af70ff2c0473fea358", "0x15480f5b5ed98a94e1d36b52dd20e9a35453a38e", "0x43587CAA7dE69C3c2aD0fb73D4C9da67A8E35b0b", + "0x2204ec97d31e2c9ee62ead9e6e2d5f7712d3f1bf" ], rsr: "0x320623b8E4fF03373931769A31Fc52A4E78B5d70", vault: "0xaedcfcdd80573c2a312d15d6bb9d921a01e4fb0f", fromBlock: 16680995, erc4626Wrapped: ["0xaa91d24c2f7dbb6487f61869cd8cd8afd5c5cab2"], + subgraph_url: "https://subgraph.satsuma-prod.com/327d6f1d3de6/reserve/reserve-mainnet/api", }, base: { deployerAddresses: [ "0xf1B06c2305445E34CF0147466352249724c2EAC1", "0x9C75314AFD011F22648ca9C655b61674e27bA4AC", + "0xfd18ba9b2f9241ce40cde14079c1cda1502a8d0a", ], rsr: "0xab36452dbac151be02b16ca17d8919826072f64a", fromBlock: 5000000, + subgraph_url: "https://subgraph.satsuma-prod.com/327d6f1d3de6/reserve/reserve-base/api", + }, + arbitrum: { + deployerAddresses: [ + "0xfd7eb6b208e1fa7b14e26a1fb10ffc17cf695d68" + ], + rsr: "0xCa5Ca9083702c56b481D1eec86F1776FDbd2e594", + fromBlock: 64464546, + subgraph_url: "https://subgraph.satsuma-prod.com/327d6f1d3de6/reserve/reserve-arbitrum/api", }, }; @@ -152,13 +163,8 @@ async function tvl(api) { ); } - await Promise.all( - convexTokensAndOwners.map(([token, owner]) => - genericUnwrapCvxDeposit({ api, token, owner }) - ) - ); - - await unwrapCreamTokens(api.getBalances(), fluxListWithOwner, api.block); + await genericUnwrapCvxDeposit(api, convexTokensAndOwners) + await unwrapCreamTokens(api, fluxListWithOwner); await sumTokens2({ api, ownerTokens, blacklistedTokens }); } @@ -180,5 +186,62 @@ module.exports = { tvl, staking, }, + arbitrum: { + tvl, + staking, + }, methodology: `TVL accounts for the underlying ERC20 collateral which back RTokens.`, }; + + +async function unwrapCreamTokens(api, tokensAndOwners,) { + const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ + api.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + params: t[1] + })), + abi: 'erc20:balanceOf', + }), + api.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + })), + abi: "uint256:exchangeRateStored", + }), + api.multiCall({ + calls: tokensAndOwners.map(t => ({ + target: t[0], + })), + abi: "address:underlying", + }) + ]) + balanceOfTokens.forEach((balanceCall, i) => { + api.add(underlyingTokens[i], balanceCall * exchangeRates[i] / 1e18) + }) +} + +async function genericUnwrapCvxDeposit(api, tokensAndOwners) { + if (!tokensAndOwners.length) return; + const tokens = [...new Set(tokensAndOwners.map((t) => t[0]))]; + const uTokens = await api.multiCall({ abi: "address:curveToken", calls: tokens, permitFailure: true }); + const tokenMapping = {}; + tokens.forEach((token, i) => { + if (uTokens[i]) { + tokenMapping[token] = uTokens[i]; + } + }); + // Filter out tokens without curveToken + const validTokensAndOwners = tokensAndOwners.filter((t) => tokenMapping[t[0]]); + const balances = await api.multiCall({ + calls: validTokensAndOwners.map((t) => ({ + target: t[0], + params: t[1], + })), + abi: "erc20:balanceOf", + }); + balances.forEach((balance, i) => { + const token = validTokensAndOwners[i][0]; + api.add(tokenMapping[token], balance); + }); +} \ No newline at end of file diff --git a/projects/reservoir-protocol/index.js b/projects/reservoir-protocol/index.js new file mode 100644 index 000000000000..c6691b1af993 --- /dev/null +++ b/projects/reservoir-protocol/index.js @@ -0,0 +1,27 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + ethereum: [ + // https://docs.reservoir.xyz/products/proof-of-reserves + '0x0c7e4342534e6e8783311dCF17828a2aa0951CC7', + '0x9BB2c38F57883E5285b7c296c66B9eEA4769eF80', + '0x99A95a9E38e927486fC878f41Ff8b118Eb632b10', + // '0x31Eae643b679A84b37E3d0B4Bd4f5dA90fB04a61', - exluded RUSD because it is project's own token + ] +} + +Object.keys(config).forEach(chain => { + const funds = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const tokens = await api.multiCall({ abi: 'address:underlying', calls: funds }) + const bals = await api.multiCall({ abi: 'uint256:totalValue', calls: funds }) + const decimals = await api.multiCall({ abi: 'uint8:decimals', calls: tokens }) + bals.forEach((v, i) => bals[i] = v * 10 ** (decimals[i] - 18)) + api.add(tokens, bals) + return api.sumTokens({ + owner: '0x4809010926aec940b550D34a46A52739f996D75D', token: ADDRESSES.ethereum.USDC + }) + } + } +}) \ No newline at end of file diff --git a/projects/retrodefi/index.js b/projects/retrodefi/index.js index 46b98b9e7d2a..92f5bb7852f0 100644 --- a/projects/retrodefi/index.js +++ b/projects/retrodefi/index.js @@ -1,9 +1,7 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); // --- BSC Addresses --- const masterChefContractBsc = "0x738600B15B2b6845d7Fe5B6C7Cb911332Fb89949"; @@ -57,153 +55,24 @@ const pool2StratsPolygon = ["0xB045Ea272229f9c0c94ca36C1e805226c9C8c034"]; const excludePool2Polygon = ["0x312D2eAb1c01C0c3d74f41a3B7Dd5772aD9F3Ca2"]; -const calcTvl = async ( - balances, - chain, - block, - masterchef, - transformAddress, - excludePool2 -) => { - const poolLength = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterchef, - chain, - block, - }) - ).output; - - const lpPositions = []; - - for (let index = 0; index < poolLength; index++) { - const strat = ( - await sdk.api.abi.call({ - abi: abi.poolInfo, - target: masterchef, - params: index, - chain, - block, - }) - ).output.strat; - - const want = ( - await sdk.api.abi.call({ - abi: abi.poolInfo, - target: masterchef, - params: index, - chain, - block, - }) - ).output.want; - - const strat_bal = ( - await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: want, - params: strat, - chain, - block, - }) - ).output; - - const symbol = ( - await sdk.api.abi.call({ - abi: abi.symbol, - target: want, - chain, - block, - }) - ).output; - - if ( - excludePool2.some((addr) => addr.toLowerCase() === want.toLowerCase()) || - symbol.includes("RCUBE") || - symbol.includes("QBERT") || - symbol.includes("pQBERT") - ) { - continue - } else if (symbol.includes("LP")) { - lpPositions.push({ - token: want, - balance: strat_bal, - }); - } else { - sdk.util.sumSingleBalance(balances, `${chain}:${want}`, strat_bal); - } - } - - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); -}; - -const bscStaking = async (chainBlocks) => { - const balances = {}; - - const transformAddress = i => `bsc:${i}`; - for (const token of stakingTokensBsc) { - await sumTokensAndLPsSharedOwners( - balances, - [[token, false]], - retroStakingsBsc, - chainBlocks["bsc"], - "bsc", - transformAddress - ); - } - - return balances; -}; - -const polygonStaking = async (...params) => { - for (const stakingContract of retroStakingsPolygon) { - return staking(stakingContract, pQBERT)(...params); - } -}; - -const bscTvl = async (chainBlocks) => { - const balances = {}; - - const transformAddress = i => `bsc:${i}`; - - await calcTvl( - balances, - "bsc", - chainBlocks["bsc"], - masterChefContractBsc, - transformAddress, - excludePool2Bsc - ); - - return balances; -}; - -const polygonTvl = async (chainBlocks) => { - const balances = {}; - - const transformAddress = i => `polygon:${i}`; - - await calcTvl( - balances, - "polygon", - chainBlocks["polygon"], - masterChefContractPolygon, - transformAddress, - excludePool2Polygon - ); - - return balances; -}; +async function tvl(api) { + const masterchef = api.chain === "bsc" ? masterChefContractBsc : masterChefContractPolygon; + const blacklistedTokens = excludePool2Bsc.concat(excludePool2Polygon).concat([pQBERT]) + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength , itemAbi: abi.poolInfo, target: masterchef}) + const tokensAndOwners = poolInfos.map(poolInfo => [poolInfo.want, poolInfo.strat]) + return sumTokens2({ api, tokensAndOwners, blacklistedTokens, }) +} module.exports = { misrepresentedTokens: true, bsc: { - tvl: bscTvl, - staking: bscStaking, + tvl, + staking: staking(retroStakingsBsc, stakingTokensBsc), pool2: pool2s(pool2StratsBsc, excludePool2Bsc), }, polygon: { - tvl: polygonTvl, - staking: polygonStaking, + tvl, + staking: staking(retroStakingsPolygon, pQBERT), pool2: pool2s(pool2StratsPolygon, excludePool2Polygon), }, methodology: diff --git a/projects/return-finance/index.js b/projects/return-finance/index.js index 8a173a7ca469..3efa30dd642e 100644 --- a/projects/return-finance/index.js +++ b/projects/return-finance/index.js @@ -6,15 +6,17 @@ module.exports = { const config = { ethereum: [ - "0xFD360A096E4a4c3C424fc3aCd85da8010D0Db9a5", - "0x201254227f9fE57296C257397Be6c617389a8cCb", + "0xD8785CDae9Ec24b8796c45E3a2D0F7b03194F826", + "0xe5c26497D9492AD2328DFEE7dcA240e55cff1779", + "0xc2d4d9070236bA4ffefd7cf565eb98d11bFeB8E1", + "0x2C2f0FFbFA1B8b9C85400f1726e1bc0892e63D9F", ], avax: [ - "0x3B6385493a1d4603809dDbaE647200eF8baA53F5", - "0xB86e10A24172155aE20B524e6e8E17a244c4d3aE", + "0x0271A46c049293448C2d4794bCD51f953Bf742e8", + "0x3A3dAdbca3ec5a815431f45eca33EF1520388Ef2", ], - polygon: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"], - base: ["0x3B6385493a1d4603809dDbaE647200eF8baA53F5"], + polygon: ["0x0271A46c049293448C2d4794bCD51f953Bf742e8"], + base: ["0xd99d6D4EA1CDa97cC8eaE2A21007C47D3ae54d5F"], }; diff --git a/projects/reya-bridge/index.js b/projects/reya-bridge/index.js new file mode 100644 index 000000000000..759eab1cbe63 --- /dev/null +++ b/projects/reya-bridge/index.js @@ -0,0 +1,60 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xdff78a949e47c1e90f3dd6dd7fe2fa72b42a75f7", // usdc vault + "0x64df894688c5052beadc35371cf69151ebc5d658", // eth vault + ], + tokens: [ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WETH, nullAddress], + }), + }, + optimism: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0x9239609eED7c40C6DDcEC25D247Ef205103590B6", // usdc vault + "0xAd7bdD85fdA879fe7771A2546939972F202C1BaE", // eth vault + ], + tokens: [ADDRESSES.optimism.USDC, ADDRESSES.optimism.WETH], + }), + }, + polygon: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xC0acBb471465FCf848746D1837d8358aB891546c", // usdc vault + "0x72384be7092144cD9a57526B486827E4eA632351", // eth vault + ], + tokens: [ADDRESSES.polygon.USDC, ADDRESSES.polygon.WETH], + }), + }, + base: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0x77e61C6fcAEe80CA578B818DD583d2b78f99289C", // usdc vault + "0x2b3A8ABa1E055e879594cB2767259e80441E0497", // eth vault + ], + tokens: [ADDRESSES.base.USDC, ADDRESSES.base.WETH], + }), + }, + arbitrum: { + tvl: (api) => + sumTokens2({ + api, + owners: [ + "0xa0E9B6DA89BD0303A8163B81B8702388bE0Fde77", // usdc vault + "0xD7BBE2f6D1B52A27D2dAC28298DE3974a3d13047", // eth vault + ], + tokens: [ADDRESSES.arbitrum.USDC, ADDRESSES.arbitrum.WETH], + }), + }, +}; diff --git a/projects/reya-perp/index.js b/projects/reya-perp/index.js new file mode 100644 index 000000000000..1b13c74456a4 --- /dev/null +++ b/projects/reya-perp/index.js @@ -0,0 +1,6 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +module.exports = { + reya: { tvl: sumTokensExport({ owner: '0xA763B6a5E09378434406C003daE6487FbbDc1a80', tokens: [ADDRESSES.reya.RUSD, "0x4D3fEB76ab1C7eF40388Cd7a2066edacE1a2237D", "0x809B99df4DDd6fA90F2CF305E2cDC310C6AD3C2c", "0x2339D41f410EA761F346a14c184385d15f7266c4", "0xAAB18B45467eCe5e47F85CA6d3dc4DF2a350fd42", "0x6B48C2e6A32077ec17e8Ba0d98fFc676dfab1A30"]})} +} \ No newline at end of file diff --git a/projects/rfx-exchange/index.js b/projects/rfx-exchange/index.js new file mode 100644 index 000000000000..ed5b20d6e6c6 --- /dev/null +++ b/projects/rfx-exchange/index.js @@ -0,0 +1,7 @@ +const { gmxExportsV2 } = require("../helper/gmx"); + +module.exports = { + era: { + tvl: gmxExportsV2({ eventEmitter: '0x9f006f3a4177e645fc872b911cf544e890c82b1a', fromBlock: 46545081 }), + }, +}; diff --git a/projects/rhombus/index.js b/projects/rhombus/index.js new file mode 100644 index 000000000000..b8539b33fc97 --- /dev/null +++ b/projects/rhombus/index.js @@ -0,0 +1,5 @@ +const { aaveExports } = require("../helper/aave"); + +module.exports = { + klaytn: aaveExports(undefined, undefined, undefined, ['0x3eFC37753ec2501b406F3443cFD8D406B52abEa6'], { v3: true }) +} diff --git a/projects/rikkei-finance/index.js b/projects/rikkei-finance/index.js index 9ce99e76abba..f7438f7513ca 100644 --- a/projects/rikkei-finance/index.js +++ b/projects/rikkei-finance/index.js @@ -2,12 +2,9 @@ const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require("../helper/compound"); module.exports = { - bsc: { - ...compoundExports( - '0x4f3e801Bd57dC3D641E72f2774280b21d31F64e4', - 'bsc', - '0x157822aC5fa0Efe98daa4b0A55450f4a182C10cA', - ADDRESSES.bsc.WBNB - ) - } + bsc: compoundExports( + '0x4f3e801Bd57dC3D641E72f2774280b21d31F64e4', + '0x157822aC5fa0Efe98daa4b0A55450f4a182C10cA', + ADDRESSES.bsc.WBNB + ) }; \ No newline at end of file diff --git a/projects/rivusdao/index.js b/projects/rivusdao/index.js index 2c901fc67d0f..618151ac4c5e 100644 --- a/projects/rivusdao/index.js +++ b/projects/rivusdao/index.js @@ -1,18 +1,23 @@ const rTokens = [ - '0x5e17abe30f0b804730c4e4db0ad217d8c29d05a0', // rsTAO - '0xcD7D22146ea9F26d0208848B6a1A9d1Bb538245A', // rsCOMAI + // '0x5e17abe30f0b804730c4e4db0ad217d8c29d05a0', // rsTAO + // '0xcD7D22146ea9F26d0208848B6a1A9d1Bb538245A', // rsCOMAI '0x3d8ede6231243d56e7896477789a450ce7fd2ad3' // rsNMT - ] +] async function tvl(api) { - const tokens = await api.multiCall({ abi: 'address:wrappedToken', calls: rTokens}) - const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: rTokens}) - api.add(tokens, supplies) + const tokens = await api.multiCall({ abi: 'address:wrappedToken', calls: rTokens }) + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: rTokens }) + // const mintedBal = await api.call({ abi: 'erc20:balanceOf', target: rTokens[1], params: '0xA47F6159Ed855Ed7E9ec3Ca339b1B7491777d08E' }) + api.add(tokens, supplies) + // api.add(tokens[1], mintedBal * -1) } module.exports = { methodology: "TVL is calculated as the sum of the total supplies of rsTAO, rsCOMAI and rsNMT tokens.", ethereum: { tvl, - } + }, + hallmarks: [ + [Math.floor(new Date('2024-09-16')/1e3), 'Migration contract was hacked'], + ], }; diff --git a/projects/robinhood/index.js b/projects/robinhood/index.js index 4f5d002ceb3f..15a591175587 100644 --- a/projects/robinhood/index.js +++ b/projects/robinhood/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -8,11 +9,7 @@ const config = { ], }, bitcoin: { - owners: [ - "bc1qprdf80adfz7aekh5nejjfrp3jksc8r929svpxk", - "bc1qmxcagqze2n4hr5rwflyfu35q90y22raxdgcp4p", - "bc1ql49ydapnjafl5t2cp9zqpjwe6pdgmxy98859v2" - ], + owners: bitcoinAddressBook.robinhood, }, polygon: { owners: [ diff --git a/projects/rocketpool/abi.json b/projects/rocketpool/abi.json deleted file mode 100644 index e62ad3963955..000000000000 --- a/projects/rocketpool/abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "rocketNodeStaking.getNodeEffectiveRPLStake": "function getNodeEffectiveRPLStake(address _nodeAddress) view returns (uint256)", - "rocketNodeStaking.getTotalRPLStake": "uint256:getTotalRPLStake", - "rocketNetworkBalances.getTotalETHBalance": "uint256:getTotalETHBalance", - "rocketMinipoolQueue.getTotalLength": "uint256:getTotalLength", - "rocketMinipoolQueue.getTotalCapacity": "uint256:getTotalCapacity", - "rocketDepositPool.getBalance": "uint256:getBalance", - "rocketMinipoolManager.getMinipoolCountPerStatus": "function getMinipoolCountPerStatus(uint256 offset, uint256 limit) view returns (uint256 initialisedCount, uint256 prelaunchCount, uint256 stakingCount, uint256 withdrawableCount, uint256 dissolvedCount)", - "rocketMinipoolManager.getActiveMinipoolCount": "uint256:getActiveMinipoolCount", - "rocketMinipoolManager.getStakingMinipoolCount": "uint256:getStakingMinipoolCount", - "rocketVault.balanceOfToken": "function balanceOfToken(string _networkContractName, address _tokenAddress) view returns (uint256)", - "rocketVault.balanceOf": "function balanceOf(string _networkContractName) view returns (uint256)" -} \ No newline at end of file diff --git a/projects/rocketpool/index.js b/projects/rocketpool/index.js index b62bdf1b7392..3553ad32c4be 100644 --- a/projects/rocketpool/index.js +++ b/projects/rocketpool/index.js @@ -1,156 +1,73 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk") -const abi = require('./abi.json') -const rocketMinipoolManager = '0x6293B8abC1F36aFB22406Be5f96D893072A8cF3a' +const ETH = ADDRESSES.null +const RPL = '0xd33526068d116ce69f19a9ee46f0bd304f21a51f' +const rocketNodeManager = '0x2b52479F6ea009907e46fc43e91064D1b92Fdc86' const rocketVault = '0x3bDC69C4E5e13E52A65f5583c23EFB9636b469d6' -const rocketNodeStaking_contract = '0x3019227b2b8493e45Bf5d25302139c9a2713BF15' - -const weth = ADDRESSES.ethereum.WETH -const rpl = '0xd33526068d116ce69f19a9ee46f0bd304f21a51f' - -async function tvl(timestamp, ethBlock, chainBlocks) { - // Get ETH staked for rETH, which is given by users and Node Operators - // Also get RPL staked by Node Operators to spin up a node - - // Get minipool count per status - let offset = 0 - const limit = 400, statusesCount = 5 - let minipool_count_per_status = new Array(statusesCount).fill(0); - while (true) { // eslint-disable-line - const {output: activeMinipoolCount} = await sdk.api.abi.call({ - target: rocketMinipoolManager, - params: [offset, limit], - abi: abi['rocketMinipoolManager.getMinipoolCountPerStatus'], - block: ethBlock, - chain: 'ethereum' - }) - const activeMinipoolCount_arr = [...Array(statusesCount).keys()].map(i => activeMinipoolCount[i.toString()]) - minipool_count_per_status = minipool_count_per_status.map((sum, idx) => sum + parseInt(activeMinipoolCount[idx])) - if (activeMinipoolCount_arr.reduce((a, b)=> a + parseInt(b), 0) < limit) { break; } - offset += limit - } - - // Get ETH and RPL balance of multiple rocketpool contracts as well as RPL staked - const [ - {output: rocketDepositPoolBalance}, - {output: rocketTokenRETHBalance}, - {output: totalRPLStake}, - {output: rocketDAONodeTrustedActions_rplBalance}, - {output: rocketAuctionManager_rplBalance} - ] = await Promise.all([ - sdk.api.abi.call({ - target: rocketVault, - params: ['rocketDepositPool'], - abi: abi['rocketVault.balanceOf'], - block: ethBlock, - chain: 'ethereum' - }), - sdk.api.abi.call({ - target: rocketVault, - params: ['rocketTokenRETH'], - abi: abi['rocketVault.balanceOf'], - block: ethBlock, - chain: 'ethereum' - }), - sdk.api.abi.call({ - target: rocketNodeStaking_contract, - abi: abi['rocketNodeStaking.getTotalRPLStake'], - block: ethBlock, - chain: 'ethereum' - }), - sdk.api.abi.call({ - target: rocketVault, - params: ['rocketDAONodeTrustedActions', rpl], - abi: abi['rocketVault.balanceOfToken'], - block: ethBlock, - chain: 'ethereum' - }), - sdk.api.abi.call({ - target: rocketVault, - params: ['rocketAuctionManager', rpl], - abi: abi['rocketVault.balanceOfToken'], - block: ethBlock, - chain: 'ethereum' - }), +const rocketRewardsPool = '0xEE4d2A71cF479e0D3d0c3c2C923dbfEB57E73111' +const trustedNodeManager = '0xb8e783882b11Ff4f6Cef3C501EA0f4b960152cc9' +const rocketNodeStaking = '0xF18Dc176C10Ff6D8b5A17974126D43301F8EEB95' + +const abi = { + getNodeCount: "function getNodeCount() view returns (uint256)", + getNodeAddresses: "function getNodeAddresses(uint256 _offset, uint256 _limit) view returns (address[])", + getNodeDetails: "function getNodeDetails(address _nodeAddress) view returns ((bool exists, uint256 registrationTime, string timezoneLocation, bool feeDistributorInitialised, address feeDistributorAddress, uint256 rewardNetwork, uint256 rplStake, uint256 effectiveRPLStake, uint256 minimumRPLStake, uint256 maximumRPLStake, uint256 ethMatched, uint256 ethMatchedLimit, uint256 minipoolCount, uint256 balanceETH, uint256 balanceRETH, uint256 balanceRPL, uint256 balanceOldRPL, uint256 depositCreditBalance, uint256 distributorBalanceUserETH, uint256 distributorBalanceNodeETH, address withdrawalAddress, address pendingWithdrawalAddress, bool smoothingPoolRegistrationState, uint256 smoothingPoolRegistrationChanged, address nodeAddress))", + getPendingETHRewards: "function getPendingETHRewards() view returns (uint256)", + balanceOf: "function balanceOf(string _networkContractName) view returns (uint256)", + balanceOfToken: "function balanceOfToken(string _networkContractName, address _tokenAddress) view returns (uint256)", + getMemberAt: "function getMemberAt(uint256 _index) view returns (address)", + getMemberCount: "function getMemberCount() view returns (uint256)", + getMemberRPLBondAmount: "function getMemberRPLBondAmount(address _nodeAddress) view returns (uint256)", + getNodeETHProvided: "function getNodeETHProvided(address _nodeAddress) view returns (uint256)", +}; + +const tvl = async (api) => { + const [nodeLength, pendingETHRewards, depositPoolBalance] = await Promise.all([ + api.call({ target: rocketNodeManager, abi: abi.getNodeCount }), + api.call({ target: rocketRewardsPool, abi: abi.getPendingETHRewards }), + api.call({ target: rocketVault, abi: abi.balanceOf, params: ['rocketDepositPool'] }), ]) - // ETH staked in Rocketpool pools - const unmatched_minipools = minipool_count_per_status[0] * 16 // Unmatched minipools - const pending_minipools = minipool_count_per_status[1] * 32 // Pending minipools (matched but not staking yet) - const staking_minipools = minipool_count_per_status[2] * 32 // Staking minipools - const withdrawable_minipools = minipool_count_per_status[3] * 32 // Withdrawable minipools - // Deposit pool balance - // rocketDepositPool_balance = solidity.to_float(rp.call("rocketDepositPool.getBalance")) - // rETH collateral from withdrawn minipools - // rETH_collateral_from_withdrawn_minipools = solidity.to_float(w3.eth.getBalance(rp.get_address_by_name("rocketTokenRETH"))) + const addresses = await api.call({ target: rocketNodeManager, abi: abi.getNodeAddresses, params: [0, nodeLength] }); - const ETH_TVL = staking_minipools - + pending_minipools - + unmatched_minipools - + withdrawable_minipools - + parseFloat(rocketDepositPoolBalance) / 1e18 - + parseFloat(rocketTokenRETHBalance) / 1e18 - - // RPL staked - // rpl_tvl += "rocketNodeStaking.getTotalRPLStake")) // RPL staked by Node Operators - // rpl_tvl += solidity.to_float(rp.call("rocketVault.balanceOfToken", "rocketDAONodeTrustedActions", rpl)) // RPL bonded by the oDAO - // rpl_tvl += solidity.to_float(rp.call("rocketVault.balanceOfToken", "rocketAuctionManager", rpl)) // slashed RPL that hasn't been auctioned off yet - const RPL_tvl = parseFloat(totalRPLStake) + parseFloat(rocketDAONodeTrustedActions_rplBalance) + parseFloat(rocketAuctionManager_rplBalance) - -// pending_minipools: ${pending_minipools} -// unmatched_minipools: ${unmatched_minipools} -// withdrawable_minipools: ${withdrawable_minipools} -// rocketDepositPoolBalance: ${rocketDepositPoolBalance / 1e18} -// rocketTokenRETHBalance: ${rocketTokenRETHBalance / 1e18} -// = ETH_TVL: ${ETH_TVL}\n -// rocketNodeStaking.getTotalRPLStake: ${totalRPLStake/1e18} -// rocketDAONodeTrustedActions_rplBalance: ${rocketDAONodeTrustedActions_rplBalance/1e18} -// rocketAuctionManager_rplBalance: ${rocketAuctionManager_rplBalance/1e18} -// = RPL_tvl: ${RPL_tvl/1e18}\n`) - - const balances = { - [weth]: ETH_TVL * 1e18, - [rpl]: RPL_tvl + const batchSize = 100; + const batchedAddresses = []; + for (let i = 0; i < addresses.length; i += batchSize) { + batchedAddresses.push(addresses.slice(i, i + batchSize)); } - return balances -} -module.exports = { - methodology: "Rocketpool TVL is ethereum staked by the users and node operators - collateral provided against rETH - staked on beacon chain 32 * activeMinipoolCount + RPL staked by Node Operators to operate a node.", - ethereum: { - tvl, - }, + const results = await Promise.all( + batchedAddresses.map(async (batch) => { + const details = await api.multiCall({ calls: batch.map((address) => ({ target: rocketNodeManager, params: [address] })), abi: abi.getNodeDetails, permitFailure: true }) + const ethProvided = await api.multiCall({ calls: batch.map((address) => ({ target: rocketNodeStaking, params: [address] })), abi: abi.getNodeETHProvided, permitFailure: true }) + return { details: details ? details.filter((result) => result && result.exists) : [], ethProvided: ethProvided || [] }; + }) + ) + + const flattenedDetails = results.flatMap((result) => result.details); + const flattenedEthProvided = results.flatMap((result) => result.ethProvided); + + const { minipoolCount, ethMatched, nodeEthProvided } = flattenedDetails.reduce( + (acc, curr, index) => { + if (!curr) return acc; + acc.minipoolCount += Number(curr.minipoolCount) || 0; + acc.ethMatched += Number(curr.ethMatched) || 0; + acc.nodeEthProvided += Number(flattenedEthProvided[index]) || 0; + return acc; + }, + { minipoolCount: 0, ethMatched: 0, nodeEthProvided: 0 } + ); + + api.add(ETH, [pendingETHRewards, depositPoolBalance, ethMatched, nodeEthProvided]) } -/* -New Rocketpool TVL computation from tvl bot -minipool_count_per_status = call mulitple times rp.call("rocketMinipoolManager.getMinipoolCountPerStatus", offset, limit) - -# staking minipools -eth_tvl += minipool_count_per_status[2] * 32 -# pending minipools (matched but not staking yet) -eth_tvl += minipool_count_per_status[1] * 32 -# unmatched minipools -eth_tvl += minipool_count_per_status[0] * 16 -# withdrawable minipools -eth_tvl += minipool_count_per_status[3] * 32 -# deposit pool balance -eth_tvl += solidity.to_float(rp.call("rocketDepositPool.getBalance")) -# rETH collateral from withdrawn minipools -eth_tvl += solidity.to_float(w3.eth.getBalance(rp.get_address_by_name("rocketTokenRETH"))) - -# staked RPL -rpl_tvl += solidity.to_float(rp.call("rocketNodeStaking.getTotalRPLStake"))) -# RPL bonded by the oDAO -rpl_tvl += solidity.to_float(rp.call("rocketVault.balanceOfToken", "rocketDAONodeTrustedActions", rpl_address)) -# slashed RPL that hasn't been auctioned off yet -rpl_tvl += solidity.to_float(rp.call("rocketVault.balanceOfToken", "rocketAuctionManager", rpl_address)) - -// rocketDAONodeTrustedActions is RPL bonded by the oDAO Member. Rocketpool team considers them users, as they are independent entities. These Bonds can be slashed if the oDAO Member miss behaves. rocketAuctionManager is slashed RPL that hasn't been sold by the protocol yet. They consider it TVL because its RPL that will be sold for ETH and kept as additional rETH collateral - +const staking = async (api) => { + const trustedNodes = await api.fetchList({ target: trustedNodeManager, lengthAbi: abi.getMemberCount, itemAbi: abi.getMemberAt }) + api.add(RPL, await api.multiCall({ calls: trustedNodes.map((node) => ({ target: trustedNodeManager, params: [node] })), abi: abi.getMemberRPLBondAmount })) + return api.sumTokens({ owner: rocketVault, tokens: [RPL] }) +} -Previous incomplete simpler TVL: - - ETH locked in the deposit contract, which would be 32 * rocketMinipoolManager.getActiveMinipoolCount - - RPL locked by Node Operators rocketNodeStaking.getTotalRPLStake -*/ +module.exports = { + methodology: 'TVL represents the total ETH from the minipools as well as the staking rewards pending distribution', + ethereum: { tvl, staking } +} \ No newline at end of file diff --git a/projects/rockswap/index.js b/projects/rockswap/index.js index 07a9daa14e25..dd9f3edd9999 100644 --- a/projects/rockswap/index.js +++ b/projects/rockswap/index.js @@ -2,6 +2,6 @@ const { getUniTVL } = require('../helper/unknownTokens'); module.exports = { bitrock: { - tvl: getUniTVL({ factory: '0x02c73ecb9B82e545E32665eDc42Ae903F8AA86a9', useDefaultCoreAssets: true, fetchBalances: true }), + tvl: getUniTVL({ factory: '0x02c73ecb9B82e545E32665eDc42Ae903F8AA86a9', useDefaultCoreAssets: true}), } } diff --git a/projects/rollspace/index.js b/projects/rollspace/index.js index 82f3cb7aa0b0..5a38b0cdf827 100644 --- a/projects/rollspace/index.js +++ b/projects/rollspace/index.js @@ -1,9 +1,9 @@ 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 BSC_POOL_CONTRACT = '0x011b1b59Dac73AA584546dD05bbF300c9D4ecdA0'; +const BLAST_POOL_CONTRACT = '0x7b0DDc2BD91Cf1a7d4e026ebdEcd575Ef760D9B8'; +const BASE_POOL_CONTRACT = '0x0994c10372BB1d994a6EcCcF81E1225da589A010'; const MODE_POOL_CONTRACT = '0xbADaC8BDFdC6Ef7be408e94AbE3ddC6bec783E59'; module.exports = { diff --git a/projects/root-finance/index.js b/projects/root-finance/index.js new file mode 100644 index 000000000000..b731b4f68c30 --- /dev/null +++ b/projects/root-finance/index.js @@ -0,0 +1,55 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { queryAddresses, sumTokens } = require('../helper/chain/radixdlt'); + +const pools = [ + { + pool: 'component_rdx1cqasw720453g8pr2jc3nxq2h9rrv9cvfjy35q6jhskukqqs0t7qcky', + resource: ADDRESSES.radixdlt.XRD, + }, + { + pool: 'component_rdx1cqz0f5znwhyy2d4q2rhncetm5tfpvu2c73kvfertktkw33drxcawk8', + resource: 'resource_rdx1thrvr3xfs2tarm2dl9emvs26vjqxu6mqvfgvqjne940jv0lnrrg7rw', + }, + { + pool: 'component_rdx1cp5hd3a2daw4vuzx0hywn56ur2pmat7nnytl5v3pv36xky5hkpr84y', + resource: 'resource_rdx1t580qxc7upat7lww4l2c4jckacafjeudxj5wpjrrct0p3e82sq4y75', + }, + { + pool: 'component_rdx1cr87dx5laxnffdkyv4fsrwms3m62vexgye9x9xpxyrv63gzpgwt97d', + resource: ADDRESSES.radixdlt.WETH, + }, + { + pool: 'component_rdx1czuk76y4vhgd44sxly0un2tqegws670dqp0usl2tlsgfkhmdl8dad3', + resource: 'resource_rdx1t5kmyj54jt85malva7fxdrnpvgfgs623yt7ywdaval25vrdlmnwe97', + }, + { + pool: 'component_rdx1cqlfmwmhdmp0ln4gaera4skn3yz30p4k5ssv7lqflgh0rjeakwzs9f', + resource: 'resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf', + } +] + +async function fetchData(addresses) { + return await queryAddresses({ addresses }); +} + +async function tvl(api) { + return sumTokens({ api, owners: pools.map((item) => item.pool) }); +} + +async function borrowed(api) { + const [poolData,] = await Promise.all([ + fetchData(pools.map((item) => item.pool)), + ]); + + + pools.forEach((pool, i) => { + const { details } = poolData.find((item) => item.address === pool.pool); + api.add(pools[i].resource, Number(details.state.fields[1].value)); + }); +} + +module.exports = { + radixdlt: { tvl, borrowed }, + timetravel: false, +}; diff --git a/projects/rootstock-collective/index.js b/projects/rootstock-collective/index.js new file mode 100644 index 000000000000..74288207b153 --- /dev/null +++ b/projects/rootstock-collective/index.js @@ -0,0 +1,8 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +module.exports = { + rsk: { + tvl: () => ({}), + staking: sumTokensExport({ owner: '0x5db91e24BD32059584bbDb831A901f1199f3d459', tokens: ['0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5']}) + } +} diff --git a/projects/rose/abi.json b/projects/rose/abi.json deleted file mode 100644 index 5df5018200b8..000000000000 --- a/projects/rose/abi.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "balanceOf": "function balanceOf(address, address) view returns (uint256)", - "balances": "function balances(uint256 arg0) view returns (uint256)", - "totalBorrow": "function totalBorrow() view returns (uint128 elastic, uint128 base)" -} \ No newline at end of file diff --git a/projects/rose/index.js b/projects/rose/index.js index 3f6d920792ba..51ec625430e4 100644 --- a/projects/rose/index.js +++ b/projects/rose/index.js @@ -1,181 +1,47 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); +const { staking } = require('../helper/staking') + +const stablesPool = "0xc90dB0d8713414d78523436dC347419164544A3f" +const fraxPool = "0xa34315F1ef49392387Dd143f4578083A9Bd33E94" +const atustPool = "0x8fe44f5cce02D5BE44e3446bBc2e8132958d22B8" +const maiPool = "0x65a761136815B45A9d78d9781d22d47247B49D23" + +const DAI = "0xe3520349F477A5F6EB06107066048508498A291b" +const USDC = ADDRESSES.aurora.USDC_e +const USDT = ADDRESSES.aurora.USDT_e +const FRAX = ADDRESSES.aurora.FRAX +const UST = "0x5ce9F0B6AFb36135b5ddBF11705cEB65E634A9dC" +const MAI = ADDRESSES.moonbeam.MAI +const ROSE = "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970" +const STROSE = "0xe23d2289FBca7De725DC21a13fC096787A85e16F" +const NEAR = ADDRESSES.aurora.NEAR +const WETH = "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB" +const WBTC = "0xf4eb217ba2454613b15dbdea6e5f22276410e89e" + +const VASE = "0xee793001Ce9Fa988712B15a59CCf5dC7d54b22FF" -const abi = require("./abi.json"); - -// pool addresses -const stablesPool = "0xc90dB0d8713414d78523436dC347419164544A3f"; -const fraxPool = "0xa34315F1ef49392387Dd143f4578083A9Bd33E94"; -const atustPool = "0x8fe44f5cce02D5BE44e3446bBc2e8132958d22B8"; -const maiPool = "0x65a761136815B45A9d78d9781d22d47247B49D23"; -// const busdPool = "0xD6cb7Bb7D63f636d1cA72A1D3ed6f7F67678068a"; -const rusdPool = "0x79B0a67a4045A7a8DC04b17456F4fe15339cBA34"; - -// token addresses -const DAI = "0xe3520349F477A5F6EB06107066048508498A291b"; -const USDC = ADDRESSES.aurora.USDC_e; -const USDT = ADDRESSES.aurora.USDT_e; -const FRAX = ADDRESSES.aurora.FRAX; -const UST = "0x5ce9F0B6AFb36135b5ddBF11705cEB65E634A9dC"; -const MAI = ADDRESSES.moonbeam.MAI; -// const BUSD = "0x5C92A4A7f59A9484AFD79DbE251AD2380E589783"; -const RUSD = "0x19cc40283B057D6608C22F1D20F17e16C245642E"; -const ROSE = "0xdcD6D4e2B3e1D1E1E6Fa8C21C8A323DcbecfF970"; -const STROSE = "0xe23d2289FBca7De725DC21a13fC096787A85e16F"; -const NEAR = ADDRESSES.aurora.NEAR; -const WETH = "0xC9BdeEd33CD01541e1eeD10f90519d2C06Fe3feB"; -const WBTC = "0xf4eb217ba2454613b15dbdea6e5f22276410e89e"; - -// garden addresses -const gardenNear = "0x64C922E3824ab40cbbEdd6C8092d148C283d3D3D"; -const gardenUsdc = "0xfbAF3eBF228eB712b1267285787e51aDd70086bB"; -const gardenUsdt = "0x0F44fCD177098Cb2B063B50f6C62e4F1E1f9d596"; -const gardenWeth = "0x084355FDd5fcfd55d60C5B8626756a6906576f13"; -const gardenAtust = "0xe8F7F08D50e12145Cb722cfF861e6A9b43EADBA1"; -const gardenWbtc = "0x6bA5B45149996597d96e6dB19E4E1eFA81a6df97"; - -const VASE = "0xee793001Ce9Fa988712B15a59CCf5dC7d54b22FF"; - -// pool to underlying tokens map const poolToTokensMap = { [stablesPool]: [DAI, USDC, USDT], [fraxPool]: [FRAX], [atustPool]: [UST], [maiPool]: [MAI], - // [busdPool]: [BUSD], - [rusdPool]: [RUSD], -}; - -// garden to underlying tokens map -const gardenToTokensMap = { - [gardenNear]: [NEAR], - [gardenUsdc]: [USDC], - [gardenUsdt]: [USDT], - [gardenWeth]: [WETH], - [gardenAtust]: [UST], - [gardenWbtc]: [WBTC], -}; - -// tvl calculation -const tvl = async (timestamp, ethBlock, chainBlock) => { - let tvl = {}; - let calls = []; - - const block = chainBlock.aurora; - - Object.entries(poolToTokensMap).forEach(([poolAddress, poolTokens]) => { - poolTokens.forEach((_, tokenIndex) => { - calls.push({ - target: poolAddress, - params: tokenIndex, - }); - }); - }); - - // pool balances - const balances = await sdk.api.abi.multiCall({ - calls: calls, - block, - abi: abi.balances, - chain: "aurora", - }); - - balances.output.forEach((res) => { - const amount = res.output; - const poolAddress = res.input.target; - const tokenAddress = poolToTokensMap[poolAddress][res.input.params[0]]; - sdk.util.sumSingleBalance(tvl, `aurora:${tokenAddress}`, amount); - }); - - // unsupported stablecoin tokens - tvl["FRAX"] = new BigNumber(tvl[`aurora:${FRAX}`]) - .div(new BigNumber(10).pow(18)) - .toNumber(); - delete tvl[`aurora:${FRAX}`]; - tvl["RUSD"] = new BigNumber(tvl[`aurora:${RUSD}`]) - .div(new BigNumber(10).pow(18)) - .toNumber(); - delete tvl[`aurora:${RUSD}`]; - - // format calls to vase for collateral - calls = []; - Object.entries(gardenToTokensMap).forEach(([gardenAddress, gardenTokens]) => { - gardenTokens.forEach((gardenToken) => { - calls.push({ - target: VASE, - params: [gardenToken, gardenAddress], - }); - }); - }); - - const vaseCollateralBalances = await sdk.api.abi.multiCall({ - calls: calls, - block, - abi: abi.balanceOf, - chain: "aurora", - }); - - vaseCollateralBalances.output.forEach((res) => { - const amount = res.output; - const tokenAddress = res.input.params[0]; - sdk.util.sumSingleBalance(tvl, `aurora:${tokenAddress}`, amount); - }); - - return tvl; -}; - -// staking calculation -const staking = async (timestamp, ethBlock, chainBlock) => { - const balances = {}; - const stRoseTvl = await sdk.api.erc20.balanceOf({ - target: ROSE, - owner: STROSE, - chain: "aurora", - block: chainBlock.aurora, - }); - - sdk.util.sumSingleBalance(balances, `aurora:${ROSE}`, stRoseTvl.output); - return balances; -}; - -const borrowed = async (timestamp, ethBlock, chainBlock) => { - const calls = []; - Object.entries(gardenToTokensMap).forEach(([gardenAddress, gardenTokens]) => { - gardenTokens.forEach((_) => { - calls.push({ - target: gardenAddress, - params: [], - }); - }); - }); - - const borrowedAmounts = await sdk.api.abi.multiCall({ - calls: calls, - block: chainBlock.aurora, - abi: abi.totalBorrow, - chain: "aurora", - }); +} - borrowedAmounts.output.forEach((res) => { - const amount = res.output[0]; - sdk.util.sumSingleBalance(borrowed, `aurora:${RUSD}`, amount); - }); +const tvl = async (api) => { + const ownerTokens = [] - borrowed["RUSD"] = new BigNumber(borrowed[`aurora:${RUSD}`]) - .div(new BigNumber(10).pow(18)) - .toNumber(); - delete borrowed[`aurora:${RUSD}`]; + Object.entries(poolToTokensMap).forEach(([pool, tokens]) => ownerTokens.push([tokens, pool])) + const gardenTokens = [NEAR, USDC, USDT, WETH, UST, WBTC] + ownerTokens.push([gardenTokens, VASE]) - return borrowed; -}; + return api.sumTokens({ ownerTokens}) +} module.exports = { methodology: - "TVL is computed as the sum of the underlying token balances on all Rose liquidity pools. Staking accounts for total ROSE token staked. Borrowed accounts for debt in RUSD for all open collateralized debt positions.", + "TVL is computed as the sum of the underlying token balances on all Rose liquidity pools", aurora: { tvl, - staking, - borrowed + staking: staking(STROSE, ROSE), }, -}; +} diff --git a/projects/rosen-bridge/index.js b/projects/rosen-bridge/index.js index 35fbc3262e80..b2805905b47a 100644 --- a/projects/rosen-bridge/index.js +++ b/projects/rosen-bridge/index.js @@ -1,5 +1,6 @@ const { sumTokensExport } = require("../helper/sumTokens"); const ADDRESSES = require('../helper/coreAssets.json'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { timetravel: false, @@ -40,6 +41,6 @@ module.exports = { }), }, bitcoin: { - tvl: sumTokensExport({ owners: ['bc1qs0852en99dfctv0egj2qxnmc79mhjgn9ap975t']}) + tvl: sumTokensExport({ owners: bitcoinAddressBook.rosenBridge }) } }; diff --git a/projects/roup/index.js b/projects/roup/index.js index 0d424ca95900..edb73748678f 100644 --- a/projects/roup/index.js +++ b/projects/roup/index.js @@ -1,16 +1,12 @@ const { sumTokensExport } = require("../helper/sumTokens"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { timetravel: false, methodology: `Tokens bridged via ROUP are counted as TVL`, bitcoin: { tvl: sumTokensExport({ - owners: [ - 'bc1pv5lu5aklz64sye9f4zmnjkfg8j6s2tllu3fem4cs9t0hcrnz5e7qy0qw6e', - 'bc1p2tncs8egnj8e6qt46np3qla70mfx4telu92v4c9hp3pg8khqp37s9lvmfx', - 'bc1phnxqw4gfq349wm2xcqgqk77544ssqwa6ycuhjh7hdxks4mtjg33qrfenw5', - 'bc1pfsu3ts4equ7rdy63dgt7shkqlu2n5kw8p0z7p7c8lsrh2yqg40fsvz4ev3' - ], + owners: bitcoinAddressBook.roup, includeBRC20: true, blacklistedTokens: ['roup'], }), diff --git a/projects/routerprotocol/index.js b/projects/routerprotocol/index.js index c8fafab9c4f1..0433aa984d1b 100644 --- a/projects/routerprotocol/index.js +++ b/projects/routerprotocol/index.js @@ -97,7 +97,7 @@ const config = { contractAddress: "0x6e14f48576265272B6CAA3A7cC500a26050Be64E", tokens: [ { name: "usd-coin", address: ADDRESSES.cronos.USDC, decimals: 6 }, - { name: "wrapped-cro", address: "0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", decimals: 18 }, + { name: "wrapped-cro", address: ADDRESSES.cronos.WCRO_1, decimals: 18 }, { name: "wmatic", address: "0xad79AC3c5a5c15C6B9194F5568e451b3fc3C2B40", decimals: 18 }, { name: "wbnb", address: ADDRESSES.telos.ETH, decimals: 18 }, { name: "wrapped-avax", address: ADDRESSES.shiden.ETH, decimals: 18 }, diff --git a/projects/royco/index.js b/projects/royco/index.js new file mode 100644 index 000000000000..ebe975e45b16 --- /dev/null +++ b/projects/royco/index.js @@ -0,0 +1,19 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + ethereum: { factory: '0xbfac50c6b2c91ab756c1e5efab699438992cc1b2', fromBlock: 21183492 }, + arbitrum: { factory: '0xbfac50c6b2c91ab756c1e5efab699438992cc1b2', fromBlock: 274261481 }, + base: { factory: '0xbfac50c6b2c91ab756c1e5efab699438992cc1b2', fromBlock: 22384258 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event WrappedVaultCreated (address indexed underlyingVaultAddress, address indexed incentivizedVaultAddress, address owner, address inputToken, uint256 frontendFee, string name, string vaultSymbol)', fromBlock, }) + const tokensAndOwners = logs.map(log => [log.underlyingVaultAddress, log.incentivizedVaultAddress]) + return api.sumTokens({ tokensAndOwners }) + + } + } +}) diff --git a/projects/rumpel/index.js b/projects/rumpel/index.js new file mode 100644 index 000000000000..f35ddd91be7e --- /dev/null +++ b/projects/rumpel/index.js @@ -0,0 +1,164 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getLogs2 } = require("../helper/cache/getLogs") + +const CONTRACTS = { + RUMEPL_POINT_TOKENIZATION_VAULT: "0xe47F9Dbbfe98d6930562017ee212C1A1Ae45ba61", + RUMPEL_WALLET_FACTORY: "0x5774abcf415f34592514698eb075051e97db2937", + ETHENA_LP_STAKING: "0x8707f238936c12c309bfc2B9959C35828AcFc512", + MORPHO_BLUE: "0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb", + ZIRCUIT_RESTAKING_POOL: "0xF047ab4c75cebf0eB9ed34Ae2c186f3611aEAfa6", + FLUID_POSITION_RESOLVER: "0x3E3dae4F30347782089d398D462546eb5276801C", +}; + +const DEPLOYMENT = { + RUMPEL_WALLET_FACTORY: { + block: 20696108, + timestamp: 1725680627000, + }, +}; + +const TOKENS = { + AGETH: "0xe1B4d34E8754600962Cd944B535180Bd758E6c2e", + SUSDE: ADDRESSES.ethereum.sUSDe, + USDE: ADDRESSES.ethereum.USDe, + WSTETH: ADDRESSES.ethereum.WSTETH, + WBTC: ADDRESSES.ethereum.WBTC, + AMPHRETH:"0x5fD13359Ba15A84B76f7F87568309040176167cd", + WEETH: "0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee", + WEETHS: "0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88", + MSTETH: "0x49446A0874197839D15395B908328a74ccc96Bc0", + STETH: ADDRESSES.ethereum.STETH, + RSUSDE: "0x82f5104b23FF2FA54C2345F821dAc9369e9E0B26", + RSTETH: "0x7a4effd87c2f3c55ca251080b1343b605f327e3a", + RE7LRT: "0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a", + RE7RWBTC: "0x7F43fDe12A40dE708d908Fb3b9BFB8540d9Ce444", + KUSDE: "0xBE3cA34D0E877A1Fc889BD5231D65477779AFf4e", + KWEETH: "0x2DABcea55a12d73191AeCe59F508b191Fb68AdaC", + DC_WSTETH_COLLATERAL: "0xC329400492c6ff2438472D4651Ad17389fCb843a", + DC_SUSDE_COLLATERAL: "0x19d0D8e6294B7a04a2733FE433444704B791939A", + DC_LBTC_COLLATERAL: "0x9C0823D3A1172F9DdF672d438dec79c39a64f448", + YT_EBTC: "0xeB993B610b68F2631f70CA1cf4Fe651dB81f368e", + YT_WEETHK: "0x7B64b99A1fd80b6c012E354a14ADb352b5916CE1", + YT_AGETH: "0x3568f1d2e8058F6D99Daa17051Cb4a2930C83978", + YT_WEETHS: "0x719B51Dd92B7809A80A2E8c91D89367BF58f1D7A", + YT_SUSDE: "0xbE05538f48D76504953c5d1068898C6642937427", + YT_USDE: "0x5D8B3cd632c58D5CE75C2141C1C8b3b0C209b3ed", + YT_RE7LRT: "0x89E7f4E5210A77Ac0f20511389Df71eC98ce9971", + YT_RSTETH: "0x11CCff2F748a0100dBd457FF7170A54e12064Aba", + YT_AMPHRETH: "0x5dB8a2391a72F1114BbaE30eFc9CD89f4a29F988", +}; + +const FLUID_VAULTS = [ + { VAULT: "0xeAEf563015634a9d0EE6CF1357A3b205C35e028D", TOKEN: TOKENS.WEETH }, + { VAULT: "0x1c6068eC051f0Ac1688cA1FE76810FA9c8644278", TOKEN: TOKENS.WEETHS }, + { VAULT: "0x3996464c0fCCa8183e13ea5E5e74375e2c8744Dd", TOKEN: TOKENS.SUSDE }, + { VAULT: "0xBc345229C1b52e4c30530C614BB487323BA38Da5", TOKEN: TOKENS.SUSDE }, + { VAULT: "0xe210d8ded13Abe836a10E8Aa956dd424658d0034", TOKEN: TOKENS.SUSDE }, +] + +const MORPHO_SUSDE_MARKET_ID = + "0x39d11026eae1c6ec02aa4c0910778664089cdd97c3fd23f68f7cd05e2e95af48"; + +async function tvl(api) { + const owners = await getOwners(api); + + await Promise.all([sumBaseTokens, handleLockedUSDE, handleMorphoSuppliedSUSDE, handleZircuitAssets, handleStrategyTokenBalances, handleFluidPositions].map(async (fn) => fn())); + + async function sumBaseTokens() { + return api.sumTokens({ + owners, tokens: [TOKENS.AGETH, TOKENS.WEETH, TOKENS.USDE, TOKENS.SUSDE, TOKENS.MSTETH, TOKENS.WSTETH, TOKENS.STETH,TOKENS.WBTC,] + }) + } + + + async function handleLockedUSDE() { + const stakes = await api.multiCall({ + target: CONTRACTS.ETHENA_LP_STAKING, + abi: "function stakes(address,address) view returns (uint256 amount,uint152,uint104)", + calls: owners.map((owner) => ({ params: [owner, TOKENS.USDE] })), + }); + api.add(TOKENS.USDE, stakes.map(i => i.amount)) + } + + async function handleMorphoSuppliedSUSDE() { + const positions = await api.multiCall({ + target: CONTRACTS.MORPHO_BLUE, + abi: "function position(bytes32,address) view returns (uint256,uint128,uint128 amount)", + calls: owners.map((owner) => ({ params: [MORPHO_SUSDE_MARKET_ID, owner] })), + }); + api.add(TOKENS.USDE, positions.map(i => i.amount)) + } + + async function handleFluidPositions() { + const positions = await api.multiCall({ + target: CONTRACTS.FLUID_POSITION_RESOLVER, + abi: "function getAllVaultPositions(address) view returns ((uint256,address owner,uint256 supply,uint256)[])", + calls: FLUID_VAULTS.map(({ VAULT }) => ({ params: [VAULT] })), + }); + + for (let i = 0; i < positions.length; i++) { + const rumpelPositions = positions[i].filter(i => owners.includes(i.owner)); + api.add(FLUID_VAULTS[i].TOKEN, rumpelPositions.map(i => i.supply)) + } + } + + async function handleZircuitAssets() { + const assets = [TOKENS.WEETH, TOKENS.WEETHS, TOKENS.USDE, TOKENS.MSTETH, TOKENS.AMPHRETH] + const calls = [] + for (const asset of assets) + for (const owner of owners) + calls.push({ params: [asset, owner] }) + const tokens = calls.map(i => i.params[0]) + const bals = await api.multiCall({ target: CONTRACTS.ZIRCUIT_RESTAKING_POOL, abi: "function balance(address,address) view returns (uint256)", calls, }); + api.add(tokens, bals) + } + + async function handleStrategyTokenBalances() { + const tokens = [ + TOKENS.KWEETH, + TOKENS.KUSDE, + TOKENS.DC_WSTETH_COLLATERAL, + TOKENS.DC_SUSDE_COLLATERAL, + TOKENS.MSTETH, + TOKENS.RSUSDE, + TOKENS.RSTETH, + TOKENS.RE7LRT, + TOKENS.RE7RWBTC, + TOKENS.YT_EBTC, + TOKENS.YT_WEETHK, + TOKENS.YT_AGETH, + TOKENS.YT_WEETHS, + TOKENS.YT_SUSDE, + TOKENS.YT_USDE, + TOKENS.YT_RE7LRT, + TOKENS.YT_RSTETH, + TOKENS.YT_AMPHRETH, + ] + return api.sumTokens({ owners, tokens }) + } +} + +async function getOwners(api) { + const logs = await getLogs2({ + api, + target: CONTRACTS.RUMPEL_WALLET_FACTORY, + topic: "SafeCreated(address,address[],uint256)", + eventAbi: + "event SafeCreated(address indexed safe, address[] indexed owners, uint256 threshold)", + fromBlock: DEPLOYMENT.RUMPEL_WALLET_FACTORY.block, + }); + return logs + .map((log) => log.safe) + .concat(CONTRACTS.RUMEPL_POINT_TOKENIZATION_VAULT); +} + + + +module.exports = { + methodology: + "Sums up the supported tokens in Rumpel Wallets + Deposits in the Rumpel Point Tokenization Vault", + start: DEPLOYMENT.RUMPEL_WALLET_FACTORY.timestamp, + ethereum: { + tvl, + }, +}; diff --git a/projects/ruscet/index.js b/projects/ruscet/index.js new file mode 100644 index 000000000000..c555ed73f520 --- /dev/null +++ b/projects/ruscet/index.js @@ -0,0 +1,11 @@ +const { sumTokens } = require("../helper/chain/fuel") + +async function tvl(api) { + const contractId = '0x8002f2e86302ef9421558d0ae25a68cdfdbec5d27915cc2db49eded220799ecc' + return sumTokens({ api, owner: contractId }) +} + +module.exports = { + fuel: { tvl }, + timetravel: false, +} diff --git a/projects/sablier-v2/index.js b/projects/sablier-v2/index.js index 5f9969312844..25f8db886fc0 100644 --- a/projects/sablier-v2/index.js +++ b/projects/sablier-v2/index.js @@ -41,6 +41,8 @@ const config = { blast: { endpoints: ['BXoC2ToMZXnTmCjWftQRPh9zMyM7ysijMN54Nxzb2CEY'], }, scroll: { endpoints: ['HVcngokCByfveLwguuafrBC34xB65Ne6tpGrXHmqDSrh'], }, era: { endpoints: ['GY2fGozmfZiZ3xF2MfevohLR4YGnyxGxAyxzi9zmU5bY'], }, + mode: { endpoints: ['5ezGnVwNucVTW45WCb91VBiKBEdiqT4ceHDhh1KGigYG'], }, + linea: { endpoints: ['FoJnatzCZKyp9XjZyUBaw1juTb5ydnFvJvWUxS3oRCHZ'], }, } Object.keys(config).forEach(chain => { diff --git a/projects/safedollar/farm-utils.js b/projects/safedollar/farm-utils.js deleted file mode 100644 index 3dba529c5be0..000000000000 --- a/projects/safedollar/farm-utils.js +++ /dev/null @@ -1,105 +0,0 @@ -const sdk = require('@defillama/sdk'); -const farmPolygon = require('./farms-polygon.json'); - -const farmLPBalance = async ( - chain, - block, - masterChef, - lpToken, - token0, - token1, -) => { - const balances = ( - await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: [ - { - target: token0, - params: [lpToken], - }, - { - target: token1, - params: [lpToken], - }, - { - target: lpToken, - params: [masterChef], - }, - ], - block, - chain: chain, - }) - ).output; - - const lpTotalSuply = ( - await sdk.api.abi.call({ - target: lpToken, - abi: 'erc20:totalSupply', - chain: chain, - block, - }) - ).output; - - const token0Locked = (balances[2].output * balances[0].output) / lpTotalSuply; - const token1Locked = (balances[2].output * balances[1].output) / lpTotalSuply; - return [ - { token: `${chain}:${token0}`, locked: token0Locked }, - { token: `${chain}:${token1}`, locked: token1Locked }, - ]; -}; - -const farmSingleTokenBalance = async (chain, block, masterChef, token) => { - const masterChefBalance = ( - await sdk.api.abi.call({ - target: token, - abi: 'erc20:balanceOf', - params: [masterChef], - chain: chain, - block, - }) - ).output; - - return [{ token: `${chain}:${token}`, locked: masterChefBalance }]; -}; - - -const polygonFarmLocked = async (block) => { - const balances = {}; - const tokens = farmPolygon.tokens; - - const allPools = farmPolygon.farms - .map((t) => { - return t.pools.map((pool) => { - return Object.assign(pool, { - masterChef: t.masterChef, - }); - }); - }) - .reduce((acc, current) => [...acc, ...current], []); - - const promises = allPools.map((item) => { - return item.single - ? farmSingleTokenBalance('polygon', block, item.masterChef, item.lpToken) - : farmLPBalance( - 'polygon', - block, - item.masterChef, - item.lpToken, - tokens[item.token0], - tokens[item.token1], - ); - }); - - const data = await Promise.all(promises); - data.forEach((farm) => { - farm.forEach((item) => { - sdk.util.sumSingleBalance(balances, item.token, item.locked); - }); - }); - - return balances; -}; - -module.exports = { - polygonFarmLocked, -}; diff --git a/projects/safedollar/farms-polygon.json b/projects/safedollar/farms-polygon.json deleted file mode 100644 index 5c9f8352b537..000000000000 --- a/projects/safedollar/farms-polygon.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "tokens": { - "usdc": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", - "eth": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", - "weth": "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619", - "matic": "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", - "quick": "0x831753DD7087CaC61aB5644b308642cc1c33Dc13", - "sds": "0xAB72EE159Ff70b64beEcBbB0FbBE58b372391C54", - "safedollar": "0x66C59Dded4EF01a3412a8B019B6e41D4a8C49A35", - "susdc": "0xd2eba21c2e0d6f996fdd063ae20aca8264ac1929", - "smatic": "0xc1ac5c0b73ba01a31c93884c28a31e9985842c38" - }, - "farms": [ - { - "masterChef": "0x69E7Bbe85db0364397378364458952bEcB886920", - "reward": "sds", - "pools": [ - { - "id": 0, - "lpToken": "0x46A30dFece0E0fc0977eefd15bd0595fdDe15a10", - "token0": "usdc", - "token1": "sds", - "rewardToken": "sds" - }, - { - "id": 1, - "lpToken": "0x08e57E45b190d7b05003E6f80BA7cFdCA762cfb8", - "token0": "usdc", - "token1": "susdc", - "rewardToken": "sds" - }, - { - "id": 2, - "lpToken": "0x6649F12E210862e0045B3dFe7E6eA1F8F0565049", - "token0": "usdc", - "token1": "safedollar", - "rewardToken": "sds" - }, - { - "id": 3, - "lpToken": "0x853Ee4b2A13f8a742d64C8F088bE7bA2131f670d", - "token0": "usdc", - "token1": "weth", - "rewardToken": "sds" - }, - { - "id": 4, - "lpToken": "0xa14B83FbB32C5207ab84370a28d01E4720B9C348", - "token0": "safedollar", - "token1": "smatic", - "rewardToken": "sds" - }, - { - "id": 5, - "lpToken": "0xB949de02e5bB30DaC57460a61aBd4Fcd9c256f18", - "token0": "matic", - "token1": "smatic", - "rewardToken": "sds" - } - ] - }, - { - "masterChef": "0x46C6a9b8E3243FB0dfB069119D5Fc6a75EEc8604", - "reward": "safedollar", - "pools": [ - { - "id": 0, - "lpToken": "0x352db329B707773DD3174859F1047Fb4Fd2030BC", - "token0": "sds", - "rewardToken": "safedollar", - "single": true - } - ] - } - ] -} diff --git a/projects/safedollar/index.js b/projects/safedollar/index.js index 4daf15b48437..fabf82dbde66 100644 --- a/projects/safedollar/index.js +++ b/projects/safedollar/index.js @@ -1,63 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const farmUtils = require('./farm-utils'); -/** - * calculate collateral locked in safedollar - */ -const Contracts = { - SafeAssets: [{ - collateralAddress: "0x736Fb0CbB5F55941ecF6A811be4926c2cFa4dD4b", - address: ADDRESSES.polygon.USDC - },{ - collateralAddress: "0xbd75b2a992ea83abed729e60022c9fe8fe539e54", - address: ADDRESSES.polygon.WMATIC_2 - }], - - boardRoom: "0x46C6a9b8E3243FB0dfB069119D5Fc6a75EEc8604", - sds: "0xAB72EE159Ff70b64beEcBbB0FbBE58b372391C54" -} -const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { - // --- Sections of boardroom --- - const stakeboardroom$ = sdk - .api.abi.call({ - target: Contracts.sds, - abi: 'erc20:balanceOf', - chain: 'polygon', - block: chainBlocks['polygon'], - params: [Contracts.boardRoom], - }).then(x => x.output) - - const [farmTvl, sdsStaked] = await Promise.all([ - - farmUtils.polygonFarmLocked(chainBlocks['polygon']), - stakeboardroom$ - ]) - const balances = { - [`polygon:${Contracts.sds}`]: sdsStaked, - }; - // --- Sections of Safe Assets --- - const promises$ = Contracts.SafeAssets.map((item) => { - return sdk - .api.abi.call({ - target: item.address, - abi: 'erc20:balanceOf', - chain: 'polygon', - block: chainBlocks['polygon'], - params: [item.collateralAddress], - }).then(x => { - sdk.util.sumSingleBalance(balances, `polygon:${item.address}`, x.output) - }) - }); - const collateralBalance = await Promise.all(promises$) - for (const [token, balance] of Object.entries(farmTvl)) { - sdk.util.sumSingleBalance(balances, token, balance) - } - return balances -}; - module.exports = { polygon: { - tvl: polygonTvl, + tvl: () => ({}), }, - // broken: 'Api is down, discord seems deserted.', + deadFrom: '2022-04-27', }; \ No newline at end of file diff --git a/projects/sailing-portfolios/index.js b/projects/sailing-portfolios/index.js index 4eefd2366bd4..c07de05ebb17 100644 --- a/projects/sailing-portfolios/index.js +++ b/projects/sailing-portfolios/index.js @@ -10,7 +10,7 @@ async function tvl(api) { }) const tokens = await api.multiCall({ abi: 'address[]:getPortfolioAssets', calls: portfolios}) const ownerTokens = portfolios.map((portfolio, i) => [tokens[i], portfolio]) - return api.sumTokens({ ownerTokens }) + return api.sumTokens({ ownerTokens, blacklistedTokens: ['0x47a663C082926d0d913cAcB89240c3f4bc409a88','0x2d519b9308aeb0c57921030dd5de4e88c44cec7c'] }) } module.exports = { diff --git a/projects/sanctuary/index.js b/projects/sanctuary/index.js index b65ad97b15e8..112bb988232a 100644 --- a/projects/sanctuary/index.js +++ b/projects/sanctuary/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xAD71e466d6E9c5CbAC804dBF60dE2543d58B4b5B', { fetchBalances: true, }) +module.exports = uniTvlExport('scroll', '0xAD71e466d6E9c5CbAC804dBF60dE2543d58B4b5B', { }) diff --git a/projects/saru/index.js b/projects/saru/index.js new file mode 100644 index 000000000000..c334269529ea --- /dev/null +++ b/projects/saru/index.js @@ -0,0 +1,8 @@ +const { getUniTVL } = require("../helper/unknownTokens") + +module.exports = { + misrepresentedTokens: true, + apechain: { + tvl: getUniTVL({ factory: '0x57bfFa72db682f7eb6C132DAE03FF36bBEB0c459', useDefaultCoreAssets: true }) + } +}; \ No newline at end of file diff --git a/projects/sashimidao/index.js b/projects/sashimidao/index.js index 4c9606bee19b..36e3949a2a75 100644 --- a/projects/sashimidao/index.js +++ b/projects/sashimidao/index.js @@ -1,6 +1,5 @@ const { stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const sashimidaoStakings = [ "0x7dCb04c9e60B52E23f0F46FE2E5D00B234402dAA", @@ -8,41 +7,15 @@ const sashimidaoStakings = [ ]; const SASHI = "0xb88e3edb378ed7ddef10b86962d97fa0b8defb6d"; // SASHI is not on coingecko yet!!! -const treasuryAddress = "0xD4a23b563019cd148Dc148e69a84535cf8368282"; -const MIM = "0x130966628846bfd36ff31a822705796e8cb8c18d"; -const SASHI_MIM_JLP = "0x71f8DF8A958D5a09694312a79355655F44310084"; - -/*** Bonds TVL Portion (Treasury) *** - * Treasury TVL consists of MIM and Trisolaris JLP balances - ***/ -async function avaxTvl(timestamp, chainBlocks) { - const balances = {}; - - let transformAddress = addr => 'avax:'+addr - - await sumTokensAndLPsSharedOwners( - balances, - [ - [MIM, false], - [SASHI_MIM_JLP, true], - ], - [treasuryAddress], - chainBlocks["avax"], - "avax", - transformAddress - ); - - return balances; -} - module.exports = { hallmarks: [ [1642464000, "Rug Pull"] ], + deadFrom: 1642464000, misrepresentedTokens: true, avax: { staking: stakings(sashimidaoStakings, SASHI), - tvl: avaxTvl, + tvl: () => ({}), }, methodology: "Counts MIM and TLP (SASHI-MIM) on the treasury", }; diff --git a/projects/satori/index.js b/projects/satori/index.js index cd0d499a0ea2..190b1e3c747f 100644 --- a/projects/satori/index.js +++ b/projects/satori/index.js @@ -1,21 +1,22 @@ const ADDRESSES = require("../helper/coreAssets.json"); const { sumTokensExport } = require("../helper/unwrapLPs"); +const { sumTokensExport: sumTokensExportOfTon } = require("../helper/chain/ton"); + +const ethereum_LBTC = "0x8236a87084f8B84306f72007F36F2618A5634494"; +const ethereum_PumpBTC = "0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e"; +const base_PumpBTC = "0x23dA5F2d509cb43A59d43C108a43eDf34510eff1"; +const stBTC = "0xf6718b2701D4a6498eF77D7c152b2137Ab28b8A3"; -const USDT_TOKEN_CONTRACT = ADDRESSES.astarzk.USDT; -const EZETH_BASE = "0x2416092f143378750bb29b79eD961ab195CcEea5"; -const EZETH_LINEA = "0x2416092f143378750bb29b79eD961ab195CcEea5"; -const ZK = "0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E"; -const WALLET_ADDR = [ - "0x62e724cB4d6C6C7317e2FADe4A03001Fe7856940", - "0xA59a2365D555b24491B19A5093D3c99b119c2aBb", -]; module.exports = { methodology: - "TVL includes the total token value inside the protocol's liquidity pools.", + "Counts Satori smartcontract balance as TVL..", polygon_zkevm: { tvl: sumTokensExport({ - owners: WALLET_ADDR, - tokens: [USDT_TOKEN_CONTRACT], + owners: [ + "0x62e724cB4d6C6C7317e2FADe4A03001Fe7856940", + "0xA59a2365D555b24491B19A5093D3c99b119c2aBb", + ], + tokens: [ADDRESSES.astarzk.USDT], }), }, era: { @@ -24,7 +25,7 @@ module.exports = { "0x0842b33529516abe86CA8EA771aC4c84FDd0eeE0", "0x48756b37Fd643bB40F669804730024F02900C476", ], - tokens: [ADDRESSES.era.USDC, ZK], + tokens: [ADDRESSES.era.USDC, ADDRESSES.era.ZK], }), }, linea: { @@ -33,7 +34,7 @@ module.exports = { "0xfb371E70eEB32f4054F40514924e77213ca18425", "0xF96116e124eB3F62Ddc6a9cfbdc58d7F8A37c50A", ], - tokens: [ADDRESSES.linea.USDC, EZETH_LINEA], + tokens: [ADDRESSES.linea.USDC, ADDRESSES.blast.ezETH], }), }, scroll: { @@ -51,7 +52,7 @@ module.exports = { "0x668a9711b8d04362876dc5b6177ed362084d5aed", "0x5f075a6a11B2e25DF664Ce7419c274943017B595", ], - tokens: [ADDRESSES.base.USDC, EZETH_BASE], + tokens: [ADDRESSES.base.USDC, ADDRESSES.blast.ezETH,base_PumpBTC], }), }, xlayer: { @@ -63,4 +64,39 @@ module.exports = { tokens: [ADDRESSES.xlayer.USDC], }), }, + arbitrum:{ + tvl: sumTokensExport({ + owners: [ + "0x5aCCEb99De5cc07168C193396C1fdC3E3abEEED7", + "0xAE9a83510cbB26c58595BA671f131e0A03Fe9A03", + ], + tokens: [ADDRESSES.arbitrum.USDC_CIRCLE], + }), + }, + ton:{ + tvl: sumTokensExportOfTon({ + owners: [ + "EQDrGCJ3V8cMw92Gg8Tf9nfq3piaT_iI3EkCGVF0OUG0vWEh", + ], + tokens: [ADDRESSES.ton.USDT], + }), + }, + bsc:{ + tvl: sumTokensExport({ + owners: [ + "0x3b6F3f7F0e3e8cCa7bC11dFA4a8567A6479Ece54", + "0xD2F244164cd09e5cBb6360c4a17aAF976a34562a" + ], + tokens: [ADDRESSES.bsc.USDC,stBTC], + }), + }, + ethereum:{ + tvl: sumTokensExport({ + owners: [ + "0x0857f8a6e41e1c71f4065daebfe7ddb825cbffde", + "0xA394080628F175472Fee9eB316BD104fAB63FE40" + ], + tokens: [ADDRESSES.ethereum.USDC,ethereum_LBTC,stBTC,ethereum_PumpBTC], + }), + } }; diff --git a/projects/satoshi-protocol/index.js b/projects/satoshi-protocol/index.js index 6a24763e7d94..1206ea125caa 100644 --- a/projects/satoshi-protocol/index.js +++ b/projects/satoshi-protocol/index.js @@ -1,21 +1,82 @@ const { sumTokens2 } = require("../helper/unwrapLPs") +const { getLogs } = require("../helper/cache/getLogs"); +const AssetConfigSettingEventABI = "event AssetConfigSetting(address asset,uint256 feeIn,uint256 feeOut,uint256 debtTokenMintCap,uint256 dailyMintCap,address oracle,bool isUsingOracle,uint256 swapWaitingPeriod,uint256 maxPrice,uint256 minPrice)"; -function createExports(troveList) { + +function createExports({ + troveList, + nymInformation, // { address, fromBlock } +}) { return { tvl: async (api) => { - const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: troveList }) - return sumTokens2({ api, tokensAndOwners2: [tokens, troveList] }) + const tokens = []; + const owners = []; + if(troveList) { + owners.push(...troveList); + const collaterals = await getCollateralsFromTrove(api, troveList); + tokens.push(...collaterals); + } + + if(nymInformation) { + const assetList = await getAssetListFromNymContract(api, nymInformation.address, nymInformation.fromBlock); + assetList.forEach(asset => { + owners.push(nymInformation.address); + tokens.push(asset); + }) + } + + return sumTokens2({ api, tokensAndOwners2: [tokens, owners] }) }, } } +async function getCollateralsFromTrove(api, troveList) { + const tokens = await api.multiCall({ abi: 'address:collateralToken', calls: troveList }) + return tokens; +} + +async function getAssetListFromNymContract(api, nymContractAddress, fromBlock) { + const logs = await getLogs({api, target: nymContractAddress, fromBlock, eventAbi: AssetConfigSettingEventABI, onlyArgs: true}); + const assetList = logs.map(item => item.asset); + return assetList; +} + + + module.exports = { - bevm: createExports([ - '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // BEVM WBTC Collateral - '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // BEVM wstBTC Collateral - ]), - btr: createExports([ - '0xf1A7b474440702BC32F622291B3A01B80247835E', // BITLAYER WBTC Collateral - '0xe9897fe6C8bf96D5ef8B0ECC7cBfEdef9818232c', // BITLAYER stBTC Collateral - ]), + bevm: createExports({ + troveList: [ + '0x0598Ef47508Ec11a503670Ac3B642AAE8EAEdEFA', // BEVM WBTC Collateral + '0xa794a7Fd668FE378E095849caafA8C8dC7E84780', // BEVM wstBTC Collateral + ], + }), + btr: createExports({ + troveList: [ + '0xf1A7b474440702BC32F622291B3A01B80247835E', // BITLAYER WBTC Collateral + '0xe9897fe6C8bf96D5ef8B0ECC7cBfEdef9818232c', // BITLAYER stBTC Collateral + ], + nymInformation: { + address: '0xC562321a494290bE5FeDF9092cee35DE6f884D50', + fromBlock: 3442163, + } + }), + bob: createExports({ + troveList: [ + '0xc50D117C21054455aE9602237d3d17ca5Fa91288', // BOB WETH Collateral + '0xBDFedF992128CbF10974DC935976116e10665Cc9', // BOB WBTC Collateral + '0x8FAE9D3dBeE1c66b84E90df21A1DbdBab9262843', // BOB tBTC Collateral + '0xFFFE50D535aaA9B16499D2fDb3BbD94144ca5336', // BOB SolvBTC Collateral + '0xa0B2325BB635679cCFbf50570edd0C6F3D7dA81e', // BOB SolvBTC.BBN Collateral + ], + nymInformation: { + address: '0x7253493c3259137431a120752e410b38d0c715C2', + fromBlock: 4614620, + } + }), + bsquared: createExports({ + troveList: [ + '0xa79241206c3008bE4EB4B62A48A4F98303060D4f', // BSquare WBTC Collateral + '0xc6F361db5eC432E95D0A08A9Fbe0d7412971cE6c', // BSquare uBTC Collateral + ], + }), } diff --git a/projects/saturnswap/index.js b/projects/saturnswap/index.js new file mode 100644 index 000000000000..d9a275ed698e --- /dev/null +++ b/projects/saturnswap/index.js @@ -0,0 +1,52 @@ +const { sumTokensExport } = require('../helper/chain/cardano') + +module.exports = { + timetravel: false, + cardano: { + tvl: sumTokensExport({ scripts: ['addr1zyd0sj57d9lpu7cy9g9qdurpazqc9l4eaxk6j59nd2gkh4275jq4yvpskgayj55xegdp30g5rfynax66r8vgn9fldndsqzf5tn'] },), // 0x0f4b4f7f7e507f3b6e9e954d5f6f3f8f7fa06e0f + } +} + +/* +// graph query for info +https://api.saturnswap.io/v1/graphql +query { + pools(first: 1000, order: { pool_stats: { tvl: DESC } }) { + edges { + node { + lp_fee_percent + name + pool_stats { + tvl + user_fees_earned_1d + updated_at + volume_1d + reserve_token_two + reserve_token_one + price + } + token_project_one { + asset_name + id + policy_id + name + ticker + price + decimals + } + token_project_one_id + token_project_two { + asset_name + id + policy_id + name + price + decimals + ticker + } + } + } + } +} + +*/ \ No newline at end of file diff --git a/projects/scallop/index.js b/projects/scallop/index.js index c81835e12b24..e665812cdb26 100644 --- a/projects/scallop/index.js +++ b/projects/scallop/index.js @@ -30,7 +30,9 @@ async function suiTvl(api) { balanceSheets.forEach((e) => { const coinType = '0x' + e.fields.name.fields.name - const amount = new BigNumber(e.fields.value.fields.cash).toString() + const amount = new BigNumber(e.fields.value.fields.cash) + .minus(e.fields.value.fields.revenue) + .toString() api.add(coinType, amount) }) diff --git a/projects/scream/index.js b/projects/scream/index.js index 7ad0fd5a1b41..7a683d429c98 100644 --- a/projects/scream/index.js +++ b/projects/scream/index.js @@ -1,19 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { getCompoundV2Tvl } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { staking } = require('../helper/staking') -function lending(borrowed) { - return async (...params) => { - const transformAdress = i => `fantom:${i}` - const balances = await getCompoundV2Tvl("0x260e596dabe3afc463e75b6cc05d8c46acacfb09", "fantom", addr => { - if (addr === "0xAd84341756Bf337f5a0164515b1f6F993D194E1f") { - return ADDRESSES.ethereum.TUSD - } - return transformAdress(addr) - }, undefined, undefined, borrowed)(...params) - return Object.fromEntries(Object.entries(balances).filter(b => Number(b[1]) > 1)) - } -} module.exports = { hallmarks: [ @@ -22,7 +9,6 @@ module.exports = { methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets. fUSD is returned as TUSD", fantom: { staking: staking("0xe3d17c7e840ec140a7a51aca351a482231760824", "0xe0654C8e6fd4D733349ac7E09f6f23DA256bF475"), - tvl: lending(false), - borrowed: lending(true), + ...compoundExports2({ comptroller: "0x260e596dabe3afc463e75b6cc05d8c46acacfb09", }), } } diff --git a/projects/scribe-v4/index.js b/projects/scribe-v4/index.js new file mode 100644 index 000000000000..e9f4d28a25b4 --- /dev/null +++ b/projects/scribe-v4/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + scroll: { + factory: '0xDc62aCDF75cc7EA4D93C69B2866d9642E79d5e2e', + fromBlock: 7680915, + isAlgebra: true, + }, +}) diff --git a/projects/scribeswap/index.js b/projects/scribeswap/index.js index 8310f4499a1d..7278fc49fdbf 100644 --- a/projects/scribeswap/index.js +++ b/projects/scribeswap/index.js @@ -2,5 +2,5 @@ const { getUniTVL } = require('../helper/unknownTokens') module.exports = { misrepresentedTokens: true, - scroll: { tvl: getUniTVL({ factory: '0xb11826635f9253Bae9C426862b0f100950a71f8f', useDefaultCoreAssets: true, fetchBalances: true, }), }, + scroll: { tvl: getUniTVL({ factory: '0xb11826635f9253Bae9C426862b0f100950a71f8f', useDefaultCoreAssets: true, }), }, } \ No newline at end of file diff --git a/projects/scrollswap/index.js b/projects/scrollswap/index.js index 524ceeeb6975..acb846de398a 100644 --- a/projects/scrollswap/index.js +++ b/projects/scrollswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0x0082123Cf29a85f48Cd977D3000aec145A3B452F', { }) \ No newline at end of file diff --git a/projects/scrollswapfinance/index.js b/projects/scrollswapfinance/index.js index ad28d8a552d3..5a0d316356e5 100644 --- a/projects/scrollswapfinance/index.js +++ b/projects/scrollswapfinance/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('scroll', '0xaA4b3b63B0A828dc28b2De7Be6115198B080De09') \ No newline at end of file diff --git a/projects/securitize/index.js b/projects/securitize/index.js index 97790fae5b48..7f0cbae78c00 100644 --- a/projects/securitize/index.js +++ b/projects/securitize/index.js @@ -1,15 +1,13 @@ const ADDRESSES = require('../helper/coreAssets.json') -const BUIDL = "0x7712c34205737192402172409a8f7ccef8aa2aec" +const BUIDL = { + ethereum: '0x7712c34205737192402172409a8f7ccef8aa2aec', + polygon: '0x2893ef551b6dd69f661ac00f11d93e5dc5dc0e99', + avax: '0x53fc82f14f009009b440a706e31c9021e1196a2f', + optimism: '0xa1cdab15bba75a80df4089cafba013e376957cf5', + arbitrum: '0xa6525ae43edcd03dc08e775774dcabd3bb925872', +} -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 +Object.keys(BUIDL).forEach((chain) => { + module.exports[chain] = { tvl: async (api) => { api.add(ADDRESSES.ethereum.USDC, await api.call({ target: BUIDL[chain], abi: 'erc20:totalSupply' }), { skipChain: true }) } } +}) diff --git a/projects/seer/index.js b/projects/seer/index.js new file mode 100644 index 000000000000..e5fc7b982ca4 --- /dev/null +++ b/projects/seer/index.js @@ -0,0 +1,118 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const config = { + 'ethereum': { + marketFactory: ['0x1F728c2fD6a3008935c1446a965a313E657b7904'], + marketView: '0xAb797C4C6022A401c31543E316D3cd04c67a87fC', + collateralToken: ADDRESSES.ethereum.SDAI + }, + 'xdai': { + marketFactory: ['0x83183DA839Ce8228E31Ae41222EaD9EDBb5cDcf1'], + marketView: '0x995dC9c89B6605a1E8cc028B37cb8e568e27626f', + collateralToken: ADDRESSES.xdai.SDAI + }, +} + +const MARKET_VIEW_ABI = + 'function getMarket(address marketFactory, address market) public view returns (tuple(address id, string marketName, string[] outcomes, address parentMarket, uint256 parentOutcome, address[] wrappedTokens, uint256 outcomesSupply, uint256 lowerBound, uint256 upperBound, bytes32 parentCollectionId, bytes32 conditionId, bytes32 questionId, uint256 templateId, tuple(bytes32 content_hash, address arbitrator, uint32 opening_ts, uint32 timeout, uint32 finalize_ts, bool is_pending_arbitration, uint256 bounty, bytes32 best_answer, bytes32 history_hash, uint256 bond, uint256 min_bond)[] questions, bytes32[] questionsIds, string[] encodedQuestions,bool payoutReported) memory)' + +async function tvl(api) { + const { marketFactory, marketView, collateralToken } = config[api.chain] + // get all markets + const markets = await api.multiCall({ abi: 'address[]:allMarkets', calls: marketFactory }) + const dataCalls = markets.map((v, i) => { + return v.map(val => ({ params: [marketFactory[i], val] })) + }).flat() + + /* + * marketsData is an array of objects with the following structure: + * - id + * - parentMarket + * - parentOutcome + * - wrappedTokens + * - outcomesSupply + */ + const marketsData = (await api.multiCall({ abi: MARKET_VIEW_ABI, calls: dataCalls, target: marketView })).map(market => ({ + id: market.id, + parentMarket: market.parentMarket, + parentOutcome: market.parentOutcome, + wrappedTokens: market.wrappedTokens, + outcomesSupply: (market.wrappedTokens ?? []).map(_ => 0), + })) + + const idIndexMapping = [] + const supplyCalls = [] + marketsData.forEach((marketData, index) => { + marketData.wrappedTokens.forEach((outcomeToken, idx2) => { + idIndexMapping.push([index, idx2]) + supplyCalls.push(outcomeToken) + }) + }) + + const supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: supplyCalls }) + supplies.forEach((supply, i) => { + const [marketIndex, outcomeIndex] = idIndexMapping[i] + marketsData[marketIndex].outcomesSupply[outcomeIndex] = +supply + }) + + const totalSupply = calculateTotalSupply(marketsData); + + api.add(collateralToken, totalSupply); +} + +/** + * When a child market is created, the parent market's supply is decreased by the amount used to mint the child market. + * This function calculates the total supply of parent markets by merging child market supplies into parent markets + * and summing up the unique supplies. These unique supplies represent the TVL of sDAI backing the parent markets. + */ +function calculateTotalSupply(marketsData) { + const marketSupplies = new Map(); + const processedTokens = new Set(); + + marketsData.forEach((market, index) => { + const supply = market.outcomesSupply + const uniqueSupply = [] + let i = 0 + for (const token of market.wrappedTokens) { + if (!processedTokens.has(token)) { + uniqueSupply.push(supply[i]) + processedTokens.add(token) + } + i++ + } + + marketSupplies.set(market.id, uniqueSupply); + }); + + // Merge child market supplies into parent markets + marketsData.forEach((market) => { + if (market.parentMarket !== ADDRESSES.null) { + const parentSupply = marketSupplies.get(market.parentMarket); + const childSupply = marketSupplies.get(market.id); + + if (parentSupply && childSupply) { + // Add child market supply to the corresponding parent outcome + parentSupply[market.parentOutcome] = (parentSupply[market.parentOutcome] || 0) + childSupply.reduce((a, b) => a > b ? a : b, 0); + marketSupplies.set(market.parentMarket, parentSupply); + } + } + }); + + // Calculate total supply of parent markets (parent markets are backed by sDAI) + let totalSupply = 0; + marketsData.forEach((market) => { + if (market.parentMarket === ADDRESSES.null) { + const marketSupply = marketSupplies.get(market.id); + if (marketSupply) { + totalSupply += marketSupply.reduce((a, b) => a > b ? a : b, 0); + } + } + }); + + return totalSupply; +} + +module.exports = { + ethereum: { tvl }, + xdai: { tvl }, + methodology: 'TVL represents the total quantity of sDAI held in the conditional tokens contract. The sDAI is withdrawn when the participants merge or redeem their tokens.', +} diff --git a/projects/segment-finance/index.js b/projects/segment-finance/index.js index e2c25c3dad8b..0675098f7329 100644 --- a/projects/segment-finance/index.js +++ b/projects/segment-finance/index.js @@ -17,5 +17,7 @@ module.exports = { "bsc", ), }, - bob: compoundExports2({ comptroller: "0xcD7C4F508652f33295F0aEd075936Cd95A4D2911", cether: '0xd7c6cc5aef7396182c5d7ebdac66ff674f3ddcf4' }) + bob: compoundExports2({ comptroller: "0xcD7C4F508652f33295F0aEd075936Cd95A4D2911", cether: '0xd7c6cc5aef7396182c5d7ebdac66ff674f3ddcf4' }), + rsk: compoundExports2({ comptroller: "0x2eea8fbA494d5008ba72f80E0091Cc74dB5f9926", cether: '0x8F9958ec0FeeccCf0feC871B7bBB3D8d0B7A4D3c' }), + core: compoundExports2({ comptroller: "0xaba65b87eBEdB2D753b37AeCECD1E168341eE0DD", cether: '0xb57A4b3ccE8d999A1e6B0357c0a31C3808401B42' }), }; diff --git a/projects/sensi/index.js b/projects/sensi/index.js new file mode 100644 index 000000000000..5e578dac84bd --- /dev/null +++ b/projects/sensi/index.js @@ -0,0 +1,23 @@ +const { staking } = require('../helper/staking') +const SENSI_TOKEN_CONTRACT = '0x63e77cf206801782239d4f126cfa22b517fb4edb' +const SENSI_LOCKING_CONTRACT = '0xc13Aff57B67145012Ef3a4604bDB3f3dA17E114f' +const SENSI_SY_CONTRACT = '0x21B656d3818A1dD07B800c1FE728fB81921af3A3' + +const SY_ABI = { + "getSYPortfolio": "function getSYPortfolio() view returns ((uint256 totalPayToken, uint256 totalBuyInToken, uint256 rewardsInPool, uint256 rewardsLastRun, uint256 lockingLastRun, uint256 SENSICirculatingSupply, uint256 SYNFTCirculatingSupply, uint256 lastMintedSYNFTID, uint256 totalVaults, uint256 totalActiveVaults) SY_Portfolio)" +} + +async function tvl(api) { + const balance_of_SY = await api.call({ abi: SY_ABI.getSYPortfolio, target: SENSI_SY_CONTRACT }) + + const balance_of_SY_TVL = balance_of_SY.totalPayToken + api.add("0x0000000000000000000000000000000000000000", balance_of_SY_TVL) +} + +module.exports = { + methodology: 'Counts how many tokens are in Sensi Locks and in SmartYield', + bsc: { + tvl, + staking: staking(SENSI_LOCKING_CONTRACT, SENSI_TOKEN_CONTRACT), + } +} \ No newline at end of file diff --git a/projects/serum.js b/projects/serum.js index 0a399c1b0b47..5a6b55ee5818 100644 --- a/projects/serum.js +++ b/projects/serum.js @@ -28,6 +28,7 @@ async function tvl(api) { module.exports = { timetravel: false, + isHeavyProtocol: true, hallmarks: [ [1667826000, "FTX/Alameda collapse"], [1680310800, "Move to onchain data"], diff --git a/projects/settleton/index.js b/projects/settleton/index.js new file mode 100644 index 000000000000..2411e2d8f403 --- /dev/null +++ b/projects/settleton/index.js @@ -0,0 +1,25 @@ +const ADDRESSES = require("../helper/coreAssets.json"); +const { fetchURL } = require('../helper/utils'); + +async function fetchTvl(api) { + const response = await fetchURL("https://settleton.finance/apiV2/vaults") + for (const pool of response.data) { + api.add(ADDRESSES.ton.TON, pool.tvl * 1e9) + } +} + + +module.exports = { + methodology: ` + The methodology for calculating the total TVL is based on analyzing liquidity pool data and LP token balances. +For each Vaults we iterate through all LP tokens and calculate their price based on following onchain data: (reserve0, reserve1, total_lp_supply) +For each pool, a calculation is performed to determine the equivalent amount of TON based on the current pool reserves and the share of LP tokens held. +This calculation takes into account the reserve ratios and adjusts the token value to TON. +For multi-indices, the TVL of all pools is summed up, while for single indices, the value of the sole pool is used. The final TVL is represented in TON, and the index price is calculated by dividing the TVL by the total supply of the index. + `.trim(), + timetravel: false, + doublecounted: true, + ton: { + tvl: fetchTvl + } +} diff --git a/projects/shadeprotocol-lend/index.js b/projects/shadeprotocol-lend/index.js index 16ee7d06a877..a1ab55b5cd97 100644 --- a/projects/shadeprotocol-lend/index.js +++ b/projects/shadeprotocol-lend/index.js @@ -1,24 +1,27 @@ -const { get } = require("../helper/http") +const { post } = require("../helper/http") -// Total Collateral Deposited in Vaults -async function tvl(api) { - const data = await get('https://ruvzuawwz7.execute-api.us-east-1.amazonaws.com/prod-analytics-v1/lend') - - let totalValue = 0; +async function getData(api) { + const isoTimestamp = new Date((api.timestamp - 5 * 60 * 60) * 1000).toISOString() + const { data: { lendStatsHistories } } = await post('https://prodv1.securesecrets.org/graphql', { "operationName": "getLendHistory", "variables": { "intervalIso": isoTimestamp }, "query": "query getLendHistory($intervalIso: String!) {\n lendStatsHistories(\n query: {where: {time: {gte: $intervalIso}}, orderBy: {time: \"desc\"}}\n ) {\n averageLtv\n collateralUsd\n debtAmount\n debtUsd\n time\n __typename\n }\n}" }) + console.log(lendStatsHistories.length) + return lendStatsHistories[0] +} - for (let i = 0; i < data.collaterals.length; i++) { - // Add the value of each collateral to the total value - totalValue += data.collaterals[i].value; - } +async function tvl(api) { + const data = await getData(api) + api.addUSDValue(data.collateralUsd - data.debtUsd) +} - return { - tether: totalValue - } +async function borrowed(api) { + const data = await getData(api) + api.addUSDValue(data.debtUsd) } + module.exports = { misrepresentedTokens: true, secret: { - tvl + tvl, + borrowed, } } diff --git a/projects/sharelock/index.js b/projects/sharelock/index.js index d3810ed4ab7e..2e200275fd37 100644 --- a/projects/sharelock/index.js +++ b/projects/sharelock/index.js @@ -2,6 +2,6 @@ const { getUniTVL} = require("../helper/unknownTokens") module.exports = { era: { - tvl: getUniTVL({ factory: '0xea51CE8A1f9C1Cbbf5B89D9B1dA4A94fB1557866', fetchBalances: true, }) + tvl: getUniTVL({ factory: '0xea51CE8A1f9C1Cbbf5B89D9B1dA4A94fB1557866', }) }, } diff --git a/projects/sharkswap-finance/index.js b/projects/sharkswap-finance/index.js index 50caca035766..5389b3231dbf 100644 --- a/projects/sharkswap-finance/index.js +++ b/projects/sharkswap-finance/index.js @@ -1,7 +1,7 @@ const { getUniTVL } = require('../helper/unknownTokens') const FACTORY = "0x57592D44eb60011500961EF177BFf8D8691D5a8B" -const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, fetchBalances: true }) +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true }) module.exports = { misrepresentedTokens: true, diff --git a/projects/shekelswap/index.js b/projects/shekelswap/index.js index 90ba666ee662..eaede3fee1de 100644 --- a/projects/shekelswap/index.js +++ b/projects/shekelswap/index.js @@ -1,2 +1,2 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('arbitrum', '0xd78BA83aD495695940E97889E7191F717AfaC8E0', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('arbitrum', '0xd78BA83aD495695940E97889E7191F717AfaC8E0', { }) \ No newline at end of file diff --git a/projects/shibaswap/index.js b/projects/shibaswap/index.js index 772fb8ccf369..7502a85dc6c7 100644 --- a/projects/shibaswap/index.js +++ b/projects/shibaswap/index.js @@ -1,12 +1,13 @@ -const {getUniTVL} = require('../helper/unknownTokens') +const { getUniTVL } = require('../helper/unknownTokens'); -const FACTORY = '0x115934131916c8b277dd010ee02de363c09d037c'; +const FACTORY_ETHEREUM = '0x115934131916c8b277dd010ee02de363c09d037c'; +const FACTORY_SHIBARIUM = '0xc2b4218F137e3A5A9B98ab3AE804108F0D312CBC'; module.exports = { misrepresentedTokens: true, ethereum: { tvl: getUniTVL({ - factory: FACTORY, + factory: FACTORY_ETHEREUM, useDefaultCoreAssets: true, blacklist: [ '0x6ADb2E268de2aA1aBF6578E4a8119b960E02928F', @@ -17,5 +18,11 @@ module.exports = { '0xC1bfcCd4c29813eDe019D00D2179Eea838a67703' ], }) + }, + shibarium: { + tvl: getUniTVL({ + factory: FACTORY_SHIBARIUM, + useDefaultCoreAssets: true, + }) } -}; \ No newline at end of file +}; diff --git a/projects/shibbex/index.js b/projects/shibbex/index.js index 1550053513b5..d93bb5ae4dce 100644 --- a/projects/shibbex/index.js +++ b/projects/shibbex/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport('shibarium', '0x6369e8dFaD8DB8378179D74C187f1D5DEa47Fa9F', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('shibarium', '0x6369e8dFaD8DB8378179D74C187f1D5DEa47Fa9F', { }) \ No newline at end of file diff --git a/projects/shibui/index.js b/projects/shibui/index.js index 5f2242bb8451..f3f16e929cd6 100644 --- a/projects/shibui/index.js +++ b/projects/shibui/index.js @@ -1,58 +1,21 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); -const CHAINS = ["boba"]; const Boba_SHIBUI = "0xf08ad7c3f6b1c6843ba027ad54ed8ddb6d71169b"; -const Boba_BOBA = ADDRESSES.boba.BOBA; -const Boba_USDT = ADDRESSES.boba.USDT; -const Boba_SHIBUI_WETH = "0xcE9F38532B3d1e00a88e1f3347601dBC632E7a82"; const Boba_SHIBUI_USDT = "0x3f714fe1380ee2204ca499d1d8a171cbdfc39eaa"; -const Boba_4Koyo = "0xDAb3Fc342A242AdD09504bea790f9b026Aa1e709"; -const CHAIN_ORGANISED_DATA = { - boba: () => { - return [ - { - treasuryTokens: [ - [Boba_BOBA, false], - [Boba_USDT, false], - [Boba_SHIBUI_WETH, true], - [Boba_SHIBUI_USDT, true], - ], - treasuryKoyoTokens: [Boba_4Koyo], - treasuryAddresses: [ - "0x9596E01Ad72d2B0fF13fe473cfcc48D3e4BB0f70", // Hot treasury - ], - gaugeTokens: [Boba_SHIBUI_USDT], - gaugeAddresses: [ - "0x6b8f4Fa6E44e923f5A995A87e4d79B3Bb9f8aaa3", // SHIBUI-USDT<>WAGMIv3 - ], - }, - true, - ]; - }, -}; module.exports = { start: 394825, boba: { tvl: () => ({}), - pool2: (() => { - const chain = CHAINS[0]; - const [data] = CHAIN_ORGANISED_DATA[chain](); - - return pool2s(data.gaugeAddresses, data.gaugeTokens, chain); - })(), - staking: staking( - "0xabAF0A59Bd6E937F852aC38264fda35EC239De82", - Boba_SHIBUI, - CHAINS[0] - ), + pool2: pool2s([ + "0x6b8f4Fa6E44e923f5A995A87e4d79B3Bb9f8aaa3", // SHIBUI-USDT<>WAGMIv3 + ], [Boba_SHIBUI_USDT]), + staking: staking("0xabAF0A59Bd6E937F852aC38264fda35EC239De82", Boba_SHIBUI), }, } diff --git a/projects/shido-dex/index.js b/projects/shido-dex/index.js new file mode 100644 index 000000000000..5300e5c4570e --- /dev/null +++ b/projects/shido-dex/index.js @@ -0,0 +1,4 @@ +const { uniV3GraphExport } = require('../helper/uniswapV3') +module.exports = { + shido: { tvl: uniV3GraphExport({ graphURL: 'https://ljd1t705przomdjt11587.cleavr.xyz/subgraphs/name/shido/mainnet', name: 'shido-dex' }) } +} \ No newline at end of file diff --git a/projects/shinobi-sol/index.js b/projects/shinobi-sol/index.js new file mode 100644 index 000000000000..763e467561bc --- /dev/null +++ b/projects/shinobi-sol/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('spp1mo6shdcrRyqDK2zdurJ8H5uttZE6H6oVjHxN1QN', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/shoebillFinance-v2/index.js b/projects/shoebillFinance-v2/index.js index 720f27cd0e8f..61421cb7fe53 100644 --- a/projects/shoebillFinance-v2/index.js +++ b/projects/shoebillFinance-v2/index.js @@ -1,5 +1,6 @@ const { compoundExports2 } = require("../helper/compound"); const { mergeExports } = require("../helper/utils"); +const { aaveExports } = require("../helper/aave"); module.exports = mergeExports([ { @@ -87,4 +88,8 @@ module.exports = mergeExports([ cether: "0x4dA697a89ea1D166881362b56E6863294820eC97", }), }, + { + zeta: aaveExports(undefined, undefined, undefined, ['0x2B6647f63f6Fab5c73e96FBf974f4ed2AB8a4308'], { v3: true }) + } + ]); diff --git a/projects/sigmao/index.js b/projects/sigmao/index.js index 01cf185e7722..ac0acd04b51a 100644 --- a/projects/sigmao/index.js +++ b/projects/sigmao/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/sumTokens') module.exports = { diff --git a/projects/sigmausd/index.js b/projects/sigmausd/index.js index 81e46d3f511b..e191e5297df8 100644 --- a/projects/sigmausd/index.js +++ b/projects/sigmausd/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress } = require('../helper/tokenMapping') const { sumTokensExport } = require('../helper/chain/ergo') diff --git a/projects/silkroad-fbifunds/index.js b/projects/silkroad-fbifunds/index.js index 3adb8f92247a..8107e70c8472 100644 --- a/projects/silkroad-fbifunds/index.js +++ b/projects/silkroad-fbifunds/index.js @@ -1,14 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const config = { - bitcoin: { - owners: [ - "bc1qa5wkgaew2dkv56kfvj49j0av5nml45x9ek9hz6", //https://www.reddit.com/r/CryptoCurrency/comments/li1fw7/btc_silkroad_stash_seized_nov_2020_by_the_feds/ - 'bc1qmxjefnuy06v345v6vhwpwt05dztztmx4g3y7wp', - 'bc1qf2yvj48mzkj7uf8lc2a9sa7w983qe256l5c8fs', - 'bc1qe7nk2nlnjewghgw4sgm0r89zkjzsurda7z4rdg' - ], - }, -} - +const config = { bitcoin: { owners: bitcoinAddressBook.silkroad } } module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/silo/index.js b/projects/silo/index.js index d2d47ae58f98..c2659f15db43 100644 --- a/projects/silo/index.js +++ b/projects/silo/index.js @@ -10,7 +10,7 @@ const config = { factories: [ { START_BLOCK: 15307294, - SILO_FACTORY: '0x4D919CEcfD4793c0D47866C8d0a02a0950737589', // Silo Ethereum (Original) + SILO_FACTORY: '0x4D919CEcfD4793c0D47866C8d0a02a0950737589', // Silo Ethereum (Legacy) }, { START_BLOCK: 17391885, @@ -19,6 +19,10 @@ const config = { { START_BLOCK: 17782576, SILO_FACTORY: '0x2c0fA05281730EFd3ef71172d8992500B36b56eA' // Silo Ethereum (LLAMA Edition) + }, + { + START_BLOCK: 20367992, + SILO_FACTORY: '0xB7d391192080674281bAAB8B3083154a5f64cd0a', // Silo Ethereum (Main) } ] }, @@ -26,7 +30,7 @@ const config = { factories: [ { START_BLOCK: 51894508, - SILO_FACTORY: '0x4166487056A922D784b073d4d928a516B074b719', // Silo Arbitrum (Original) + SILO_FACTORY: '0x4166487056A922D784b073d4d928a516B074b719', // Silo Arbitrum (Main) } ] }, @@ -34,7 +38,15 @@ const config = { factories: [ { START_BLOCK: 120480601, - SILO_FACTORY: '0x6B14c4450a29Dd9562c20259eBFF67a577b540b9', // Silo Optimism (Original) + SILO_FACTORY: '0x6B14c4450a29Dd9562c20259eBFF67a577b540b9', // Silo Optimism (Main) + } + ] + }, + base: { + factories: [ + { + START_BLOCK: 16262586, + SILO_FACTORY: '0x408822E4E8682413666809b0655161093cd36f2b', // Silo Base (Main) } ] }, @@ -88,11 +100,12 @@ async function getSilos(api) { 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`, + methodology: `We calculate TVL by interacting with Silo Factory smart contracts on Ethereum and Arbitrum. For Ethereum, it queries Silo(Main)(0xB7d391192080674281bAAB8B3083154a5f64cd0a), (Legacy)(0x4D919CEcfD4793c0D47866C8d0a02a0950737589), (Convex Factory)(0x6d4A256695586F61b77B09bc3D28333A91114d5a), and (LLAMA Edition)(0x2c0fA05281730EFd3ef71172d8992500B36b56eA). On Arbitrum, we query the Silo Arbitrum factory(0x4166487056A922D784b073d4d928a516B074b719), On Optimism, we query the Silo Optimism factory(0x6B14c4450a29Dd9562c20259eBFF67a577b540b9), On Base, we query the Silo Base factory(0x408822E4E8682413666809b0655161093cd36f2b), we query the 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, }, + base: { tvl, borrowed, }, hallmarks: [ [1692968400, "Launch CRV market"] ] -} +} \ No newline at end of file diff --git a/projects/silostake/index.js b/projects/silostake/index.js index 101c07d4d951..0a54e7cfa7e8 100644 --- a/projects/silostake/index.js +++ b/projects/silostake/index.js @@ -36,7 +36,7 @@ Object.keys(config).forEach(chain => { // Logic for calculating TVL - just get total ustake. let state = await getState(chain, hub); - let total_ustake = state['total_ustake']; + let total_ustake = state['total_utoken']; api.add(coinGeckoId, total_ustake / 10 ** 6, { skipChain: true }); diff --git a/projects/singularityDAO/index.js b/projects/singularityDAO/index.js index b21c60136840..ab355cf205fe 100644 --- a/projects/singularityDAO/index.js +++ b/projects/singularityDAO/index.js @@ -1,10 +1,8 @@ const ADDRESSES = require('../helper/coreAssets.json') const abi = require("./abi.json"); const { cachedGraphQuery } = require('../helper/cache') -const sdk = require("@defillama/sdk"); const { sumTokens2 } = require("../helper/unwrapLPs"); -const { getParamCalls } = require("../helper/utils"); const AGIX_TOKEN = "0x5B7533812759B45C2B44C19e320ba2cD2681b542"; const NUNET_TOKEN = "0xF0d33BeDa4d734C72684b5f9abBEbf715D0a7935"; @@ -27,7 +25,7 @@ const graphEndpoint = "https://singularitydao.ai/api/dynaset-server/api/graphql"; -async function tvl(_, block) { +async function tvl(api) { const blacklistedTokens = [ SDAO_TOKEN, LP_TOKEN_SDAO_ETH, @@ -38,63 +36,26 @@ async function tvl(_, block) { const response = await cachedGraphQuery('singularity-dao', graphEndpoint, getDynasetQuery); const dynasets = response.dynaset.map((d) => d.address).flat(); - const { output: tokens } = await sdk.api.abi.multiCall({ - calls: dynasets.map((addr) => ({ target: addr })), - abi: abi.getCurrentTokens, - block, - permitFailure: true, - }); - const tokensAndOwners = []; - tokens - .filter((t) => t.output) - .map((t, index) => - t.output.forEach((token) => - tokensAndOwners.push([token, dynasets[index]]) - ) - ); - - let { output: forgetCount } = await sdk.api.abi.multiCall({ - abi: abis.totalForges, - calls: DYNASET_FORGES.map((i) => ({ target: i })), - block, - }); - - const calls = []; - forgetCount = forgetCount.map(({ input: { target }, output }) => { - let arry = getParamCalls(output); - arry.forEach((i) => (i.target = target)); - calls.push(...arry); - }); - - let { output: tokenInfo } = await sdk.api.abi.multiCall({ - abi: abis.forgeInfo, - calls, - block, - }); - - tokenInfo.forEach(({ input: { target }, output }) => { - tokensAndOwners.push([output.contributionToken, target]); - }); - - return sumTokens2({ tokensAndOwners, block, blacklistedTokens }); -} + const tokens = await api.multiCall({ calls: dynasets, abi: abi.getCurrentTokens, permitFailure: true, }); + const ownerTokens = []; + tokens.map((t, index) => t && ownerTokens.push([t, dynasets[index]])) + + const tokenInfos = await api.fetchList({ lengthAbi: abis.totalForges, itemAbi: abis.forgeInfo, targets: DYNASET_FORGES, groupedByInput: true }) + tokenInfos.forEach((info, i) => ownerTokens.push([info.map(i => i.contributionToken), DYNASET_FORGES[i]])) -// LP Pools ERC -// Staked LP tokens where one side of the market is the platform's own governance token. + return sumTokens2({ ownerTokens, api, blacklistedTokens }); +} -async function pool2(ts, block) { +async function pool2(api) { const tokensAndOwners = [ [LP_TOKEN_SDAO_ETH, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Unbonded [LP_TOKEN_SDAO_USDT, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Bonded 6M ]; - return sumTokens2({ tokensAndOwners, block, resolveLP: true }); + return sumTokens2({ tokensAndOwners, api, resolveLP: true }); } -// Staking pools ERC -// The platform's own tokens - -async function staking(ts, block) { +async function staking(api) { const tokensAndOwners = [ [SDAO_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], // Unbonded [SDAO_TOKEN, "0x74641ed232dbB8CBD9847484dD020d44453F0368"], // Bonded 6M @@ -105,16 +66,10 @@ async function staking(ts, block) { [AGIX_TOKEN, "0xfB85B9Ec50560e302Ab106F1E2857d95132120D0"], [AGIX_TOKEN, "0xb267deaace0b8c5fcb2bb04801a364e7af7da3f4"], ]; - return sumTokens2({ tokensAndOwners, block }); + return sumTokens2({ tokensAndOwners, api }); } -////////////////////////////////// -////// BNB CHAIN //////////////// -//////////////////////////////// - -// DYNASET BNB CHAIN - -async function tvlBNB(ts, EthBlock, { bsc: block }) { +async function tvlBNB(api) { const tokensAndOwners = [ [ADDRESSES.bsc.WBNB, DYNASETSBNB], // BNB [ADDRESSES.bsc.BUSD, DYNASETSBNB], // BUSD @@ -127,22 +82,18 @@ async function tvlBNB(ts, EthBlock, { bsc: block }) { ["0xCC42724C6683B7E57334c4E856f4c9965ED682bD", DYNASETSBNB], // BMATIC ["0xfA54fF1a158B5189Ebba6ae130CEd6bbd3aEA76e", DYNASETSBNB], // BSOL ]; - return sumTokens2({ tokensAndOwners, block, chain: "bsc" }); + return sumTokens2({ tokensAndOwners, api }); } -// Staking pools BNB - -async function stakingBNB(ts, EthBlock, { bsc: block }) { +async function stakingBNB(api) { const tokensAndOwners = [ [SDAO_TOKEN_BNB, "0x79292c62f593e08d9b850b790b07e7a0903fd007"], // Unbonded [SDAO_TOKEN_BNB, "0x17de46760F4c18C26eEc36117C23793299F564A8"], // Bonded ]; - return sumTokens2({ tokensAndOwners, block, chain: "bsc" }); + return sumTokens2({ tokensAndOwners, api }); } -// LP Pools BNB - -async function pool2BNB(ts, EthBlock, { bsc: block }) { +async function pool2BNB(api) { const tokensAndOwners = [ [ "0x6c805d2077025eaaa42fae7f764e61df42aadb14", @@ -157,7 +108,7 @@ async function pool2BNB(ts, EthBlock, { bsc: block }) { "0x79292c62f593e08d9b850b790b07e7a0903fd007", ], ]; - return sumTokens2({ tokensAndOwners, block, chain: "bsc", resolveLP: true }); + return sumTokens2({ tokensAndOwners, api, resolveLP: true }); } module.exports = { diff --git a/projects/skale/index.js b/projects/skale/index.js new file mode 100644 index 000000000000..f8ddabb789f2 --- /dev/null +++ b/projects/skale/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') +const depositBoxETH = '0x49F583d263e4Ef938b9E09772D3394c71605Df94'; +const depositBoxERC20 = '0x8fB1A35bB6fB9c47Fb5065BE5062cB8dC1687669'; + +module.exports = { + start: 1626697290, // Mon July 19 06:38:20 PM UTC 2021 + ethereum: { + tvl: sumTokensExport({ owners: [depositBoxETH, depositBoxERC20], fetchCoValentTokens: true, permitFailure: true }), + } +} \ No newline at end of file diff --git a/projects/snai-finance/index.js b/projects/snai-finance/index.js index c24c61d4eec1..4b6525e67005 100644 --- a/projects/snai-finance/index.js +++ b/projects/snai-finance/index.js @@ -1,6 +1,9 @@ const { methodology, compoundExports2 } = require("../helper/compound"); module.exports = { + deadFrom: '2024-06-15', base: compoundExports2({ comptroller: '0x784E1507193c060bC88e6699adC7c796Ebe0E14e', cether: '0x9649Eb0f03C7e85615cFDC7927c7E6B775Ef284d' }), methodology, -} \ No newline at end of file +} + +module.exports.base.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/snowbank.js b/projects/snowbank.js index a395f0226a37..45e333f821d1 100644 --- a/projects/snowbank.js +++ b/projects/snowbank.js @@ -1,51 +1,11 @@ -const { sumTokensAndLPsSharedOwners } = require("./helper/unwrapLPs"); -const sdk = require('@defillama/sdk'); - +const { staking } = require('./helper/staking') const TimeStaking = "0x85784d5e2CCae89Bcb39EbF0ac6Cdc93d42d99AD" const time = "0x7d1232b90d3f809a54eeaeebc639c62df8a8942f" -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stakingBalance = await sdk.api.abi.call({ - abi: 'erc20:balanceOf', - target: time, - params: TimeStaking, - block: chainBlocks.avax, - chain: 'avax' - }); - - sdk.util.sumSingleBalance(balances, 'avax:'+time, stakingBalance.output); - - return balances; -}; - -// https://app.wonderland.money/#/bonds -const treasury = "0xa82422A5FD4F9cB85cD4aAc393cD3296A27dD873" -const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [mim, false], - ["0x425c45adfb53861e5db8f17d9b072ab60d4404d8", true], - ["0xa3d2cfe49df9d1ea0dc589b69252e1eddc417d6d", true], - ], - [treasury], - chainBlocks.avax, - 'avax', - addr=>addr.toLowerCase()==="0x130966628846bfd36ff31a822705796e8cb8c18d"?"0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3":`avax:${addr}` - ); - - return balances; -} module.exports = { avax:{ - tvl, - staking + tvl: () => ({}), + staking: staking(TimeStaking, time) }, methodology: "Counts tokens on the treasury for tvl and staked SB for staking", diff --git a/projects/snowflake/index.js b/projects/snowflake/index.js index 4f9d577377e6..32a2562645e8 100644 --- a/projects/snowflake/index.js +++ b/projects/snowflake/index.js @@ -1,52 +1,30 @@ -const sdk = require("@defillama/sdk") const { staking } = require("../helper/staking"); -const { sumTokens2 } = require('../helper/unwrapLPs') const assetsAbi = require("./abi") const asssetsContract = "0x2c326AbbE089B786E7170da84e39F3d0c6650653" const bscAsssetsContract = "0xEaEC4e680F5D534772e888fbD558b3b29e1F2E89" -const chain = "polygon" -const chain2 = "bsc" - -async function tvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks[chain]; - const { output: toa } = await sdk.api.abi.call({ - target: asssetsContract, - abi: assetsAbi.getAssets, - chain, block, - }) - return sumTokens2({ chain: chain, block, tokensAndOwners: toa, }) +async function tvl(api) { + const tokensAndOwners = await api.call({ target: asssetsContract, abi: assetsAbi.getAssets, }) + return api.sumTokens({ tokensAndOwners }) } -async function bscTvl(timestamp, ethereumBlock, chainBlocks) { - const block = chainBlocks[chain2]; - const { output: toa } = await sdk.api.abi.call({ - target: bscAsssetsContract, - abi: assetsAbi.getAssets, - chain: chain2, block, - }) - return sumTokens2({ chain: chain2, block, tokensAndOwners: toa, }) +async function bscTvl(api) { + const tokensAndOwners = await api.call({ target: bscAsssetsContract, abi: assetsAbi.getAssets, }) + return api.sumTokens({ tokensAndOwners }) } module.exports = { hallmarks: [ - [1672448400,"Rug Pull"] + [1672448400, "Rug Pull"] ], - polygon:{ - tvl, - staking: staking( - "0xfD5D4caDe98366d0b09c03cB3cEe7D244c8b6146", //ve - "0xE0f463832295ADf63eB6CA053413a3f9cd8bf685", //snow - "polygon" - ), + // deadFrom: 1672448400, + polygon: { + tvl: () => ({}), + staking: () => ({}), }, bsc: { - tvl: bscTvl, - staking: staking( - "0xfD5D4caDe98366d0b09c03cB3cEe7D244c8b6146", //ve - "0xE0f463832295ADf63eB6CA053413a3f9cd8bf685", //snow - "bsc" - ), + tvl: () => ({}), + staking: () => ({}), } }; diff --git a/projects/sns/index.js b/projects/sns/index.js index 345445aaaa03..5cc53a5c9f1c 100644 --- a/projects/sns/index.js +++ b/projects/sns/index.js @@ -1,35 +1,19 @@ -const { get } = require('../helper/http') +const axios = require ("axios") -const SNS_URL = "https://sns-api.internetcomputer.org/api/v1/snses/" -const ICP_URL = "https://ledger-api.internetcomputer.org/accounts/" +const SNS_URL = "https://sns-api.internetcomputer.org/api/v1/snses" +const ICP_URL = "https://ledger-api.internetcomputer.org/accounts" async function tvl(api) { - let offset = 0; - const limit = 100; - var icp_balance = 0; - const a = true - while (a) { - let data = await get(SNS_URL + `?offset=${offset}&limit=${limit}&sort_by=name`); - let snses = data.data; - if (snses.length == undefined || snses.length == 0) { - break; - } + const { data } = await axios.get(SNS_URL) - for (let i = 0; i < snses.length; i++) { - let sns = snses[i]; - let root_canister_id = sns.root_canister_id; - let root_canister = await get( - SNS_URL + `${root_canister_id}`); - - let icp_ledger_treasury_accountidentifier = root_canister.icp_treasury_account; - let icp_ledger = await get( - ICP_URL + `${icp_ledger_treasury_accountidentifier}`); - icp_balance += parseInt(icp_ledger.balance); - } - offset += limit; + for (const sns of data.data) { + const root_canister_id = sns.root_canister_id + const root_canister = await axios.get(SNS_URL + `/${root_canister_id}`) + const icp_ledger_treasury_accountidentifier = root_canister.data.icp_treasury_account + const icp_ledger = await axios.get(ICP_URL + `/${icp_ledger_treasury_accountidentifier}`) + const icp_balance = parseInt(icp_ledger.data.balance) + api.addCGToken('internet-computer', icp_balance / 1e8) } - - api.addCGToken('internet-computer', icp_balance / 1e8) } module.exports = { diff --git a/projects/sofa-org/index.js b/projects/sofa-org/index.js index 488e83224e13..ca253f321c50 100644 --- a/projects/sofa-org/index.js +++ b/projects/sofa-org/index.js @@ -39,6 +39,24 @@ const config = { '0x8F9259a355933737F8F11f95d32460eCd5ED0706', '0x3AbC7053ec29e26c1429195fd971F280422ecA80', '0x071E0C2BE2b16c8B00173c6535eF8331b8e1feeD', + // okx + '0xe483d580664cd72B0A8cae0D65EFfA6587bd2263', + '0x21f759Bcb31739032A00b37e3560a216AE52eFDC', + '0x3191a0008415dEB5c5161C4B394Ec46C8C703f8c', + '0xC9Aa266e2E50EC2474cD881566845480F8daE931', + ], + // scrvusd + crvtokens: [ + '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', + '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', + '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367', + '0x0655977FEb2f289A4aB78af67BAB0d17aAb84367' + ], + crvUSDVaults: [ + '0xF5BF8aa4b571FF2Be9905289bfcEbC1D46408D9F', + '0x9832e7E40d5a1495cA7bdbCd6A5C0A90D28F6cFA', + '0x99595455Ba95b286F8e2614470b865e34f034Aa1', + '0xf421B050647CF6eB757dE873F212e04a5e324487', ], }, arbitrum: { @@ -79,20 +97,49 @@ const config = { '0xfA49f859a012e8b1795A81B23b21Db0bD40e7770', '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830', '0x4a5B4049a4aFae31278d36768704872f73dA67D1', - '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8',], + '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8', + // automator + '0x986Fa0383C39dBdA1B3A29Ac536fe5Df354Ed160', + '0x770f7fcEce69C68B208B80bBc4e3d1Bf8f9c0672', + '0x1e5A684d263F42BaC1f2bAd6fB379277D4D6c28C', + '0xBF898C0C2E7d415dE8FCcc78d1200D029a060560', + ], + crvtokens: [ + ], + crvUSDVaults: [ + ], + }, + bsc: { + vaults: [ + ], + aVaults: [ + // aBnbUSDT + '0x89c82D1B7616B0a465311FF077db6Bc21d43eA22', + '0x842E97BaA96cFE1534F1A50Da112C7800134656A', + '0x5DcEFCa5207c58dCbcf41eF017D1D0EB42d83701', + '0x4573382A9d101EB6DFa1C4B448f939c41fF3e81d', + '0x40144BC227f78A288FE9Ae6F4C7389C92C5aD9CF', + '0x41Df07a5E58D551164fCAEaD4c1ee67B77a84776', + '0xD0fb7977df47d7Fe946A21679DAbCe877f7A3a05', + '0xab08fF5dd91636fE556f692825Cadd7bA04A4c97', + ], + crvtokens: [ + ], + crvUSDVaults: [ + ], } - } Object.keys(config).forEach(chain => { - const { vaults = [], aVaults = [] } = config[chain] + const { vaults = [], aVaults = [], crvtokens = [], crvUSDVaults = [] } = 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()] }) + + return api.sumTokens({ tokensAndOwners2: [[tokens, tokens2, atokens, crvtokens].flat(), [vaults, aVaults, aVaults, crvUSDVaults].flat()] }) } } }) @@ -104,4 +151,5 @@ module.exports.ethereum.staking = staking([ '0x94Fe821E8Adde08aB97530D432Ff34A724FD7830', '0x4a5B4049a4aFae31278d36768704872f73dA67D1', '0x08c57aE48a89b6876A76dC618972Ef1602da7ED8', + '0x2B9aeA129B85F51A468274e7271434A83c3BB6b4', // StRCH ], '0x57b96d4af698605563a4653d882635da59bf11af') diff --git a/projects/sohei/index.js b/projects/sohei/index.js index 4882d9f1162a..1814816d7910 100644 --- a/projects/sohei/index.js +++ b/projects/sohei/index.js @@ -2,11 +2,15 @@ const {compoundExports} = require('../helper/compound'); const { nullAddress } = require('../helper/tokenMapping'); const ceth = "0x685d1f1a83ff64e75fe882e7818e4ad9173342ca"; -const chain = "arbitrum"; + + module.exports = { hallmarks: [ [1680480000, "Team out of funds announced"] ], - arbitrum: compoundExports('0x9f750cf10034f3d7a18221aec0bddab7fc6f32ba', chain, ceth, nullAddress, undefined, undefined, { blacklistedTokens: ['0x6e002cb9bf8c17409eeb6c593ef6548faddd2985']}), -}; \ No newline at end of file + deadFrom: '2023-04-20', + arbitrum: compoundExports('0x9f750cf10034f3d7a18221aec0bddab7fc6f32ba', ceth, nullAddress, { blacklistedTokens: ['0x6e002cb9bf8c17409eeb6c593ef6548faddd2985']}), +} + +module.exports.arbitrum.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/solace-finance/config.js b/projects/solace-finance/config.js index 51f428ae11d8..71d2817f982b 100644 --- a/projects/solace-finance/config.js +++ b/projects/solace-finance/config.js @@ -40,7 +40,7 @@ module.exports = { TokenTicker: "WMATIC", }, { - PoolToken: "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89", + PoolToken: ADDRESSES.polygon.FRAX, TokenTicker: "FRAX", }, { diff --git a/projects/solanahub-sol/index.js b/projects/solanahub-sol/index.js new file mode 100644 index 000000000000..c874fd186b83 --- /dev/null +++ b/projects/solanahub-sol/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('ECRqn7gaNASuvTyC5xfCUjehWZCSowMXstZiM5DNweyB', api) +} + +module.exports ={ + timetravel: false, + doublecounted: true, + methodology: "SolanaHub Staked SOL (hubSOL) is a tokenized representation on your staked SOL + stake rewards", + solana: { tvl }, +}; \ No newline at end of file diff --git a/projects/solar-studios/index.js b/projects/solar-studios/index.js new file mode 100644 index 000000000000..c519ab923f3a --- /dev/null +++ b/projects/solar-studios/index.js @@ -0,0 +1,20 @@ +const { getProvider, sumTokens2 } = require("../helper/solana"); +const { Program, } = require("@project-serum/anchor"); + + +async function tvl(api) { + + const provider = getProvider(api.chain) + const programId = 'sooGfQwJ6enHfLTPfasFZtFR7DgobkJD77maDNEqGkD' + const idl = await Program.fetchIdl(programId, provider) + const program = new Program(idl, programId, provider) + const data = await program.account.poolState.all() + console.log(data.length) + const tokenAccounts = data.map(({ account: { token0Vault, token1Vault }}) => ([token0Vault, token1Vault,])).flat() + return sumTokens2({ tokenAccounts, api, }) +} + +module.exports = { + timetravel: false, + eclipse: { tvl, }, +} diff --git a/projects/solayer-ssol/index.js b/projects/solayer-ssol/index.js new file mode 100644 index 000000000000..9ebc1a0a633c --- /dev/null +++ b/projects/solayer-ssol/index.js @@ -0,0 +1,44 @@ +const { sumTokens2, getConnection, getAssociatedTokenAddress, } = require("../helper/solana"); +const { PublicKey } = require("@solana/web3.js"); +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl(api) { + const connection = getConnection(); + + // add native SOL staking + const stakeAccount = await connection.getAccountInfo(new PublicKey('po1osKDWYF9oiVEGmzKA4eTs8eMveFRMox3bUKazGN2')) + api.add(ADDRESSES.solana.SOL, Number(stakeAccount.data.readBigUint64LE(258))) + + // get LST details + const data = await connection.getProgramAccounts(new PublicKey('sSo1iU21jBrU9VaJ8PJib1MtorefUV4fzC9GURa2KNn'), { + filters: [{ dataSize: 74, },], + }) + + // Build list of token accounts by deriving ATAs for each LST-vault pair + const tokenAccounts = data.map((i) => { + const offset = 8 + const lstMint = new PublicKey(i.account.data.slice(offset + 0, offset + 32)); + const vaultPubkey = new PublicKey(i.pubkey.toString()); + + // Derive the ATA for this LST and vault + const ata = getAssociatedTokenAddress(lstMint, vaultPubkey); + + return ata.toString() + }); + + + return sumTokens2({ + api, + tokenAccounts, + blacklistedTokens: [ + 'sSo1wxKKr6zW2hqf5hZrp2CawLibcwi1pMBqk5bg2G4', + 'testqcAoCvfFpuFNtdmrBnBMSfFoXKkSTJ3ky6cPKjx', + ] + }) +} + +module.exports = { + timetravel: false, + methodology: "TVL is calculated by summing all re-staked assets.", + solana: { tvl }, +}; diff --git a/projects/solayer-susd/index.js b/projects/solayer-susd/index.js new file mode 100644 index 000000000000..685aaf1439ef --- /dev/null +++ b/projects/solayer-susd/index.js @@ -0,0 +1,19 @@ +const { sumTokens2 } = require("../helper/solana"); +const ADDRESSES = require('../helper/coreAssets.json') + +async function tvl() { + // Sum up assets in sUSD pool + return sumTokens2({ + tokensAndOwners: [ + ['4MmJVdwYN8LwvbGeCowYjSx7KoEi6BJWg8XXnW4fDDp6', 'FhVcYNEe58SMtxpZGnTu2kpYJrTu2vwCZDGpPLqbd2yG'], + [ADDRESSES.solana.USDC, 'FhVcYNEe58SMtxpZGnTu2kpYJrTu2vwCZDGpPLqbd2yG'], + ] + }) +} + +module.exports = { + timetravel: false, + doublecounted: true, + methodology: "sUSD TVL is calculated by summing all assets backing the stablecoin", + solana: { tvl }, +}; \ No newline at end of file diff --git a/projects/solayer/index.js b/projects/solayer/index.js index 9657dd695238..589a239dfb6c 100644 --- a/projects/solayer/index.js +++ b/projects/solayer/index.js @@ -1,24 +1,36 @@ -const { sumTokens2, getConnection } = require("../helper/solana"); +const { sumTokens2, getConnection, } = require("../helper/solana"); const { PublicKey } = require("@solana/web3.js"); +const ADDRESSES = require('../helper/coreAssets.json') -async function tvl() { +async function tvl(api) { 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 - }; + // add SOL staking + const stakeAccount = await connection.getAccountInfo(new PublicKey('po1osKDWYF9oiVEGmzKA4eTs8eMveFRMox3bUKazGN2')) + api.add(ADDRESSES.solana.SOL, Number(stakeAccount.data.readBigUint64LE(258))) + + // get LST details + const data = await connection.getProgramAccounts(new PublicKey('sSo1iU21jBrU9VaJ8PJib1MtorefUV4fzC9GURa2KNn'), { + filters: [{ dataSize: 74, },], + }) + const tokensAndOwners = data.map((i) => { + const offset = 8 + const lstMint = new PublicKey(i.account.data.slice(offset + 0, offset + 32)); + return [lstMint.toString(), i.pubkey.toString()] + }) + + // add SUSD Backing + tokensAndOwners.push( + ['4MmJVdwYN8LwvbGeCowYjSx7KoEi6BJWg8XXnW4fDDp6', 'FhVcYNEe58SMtxpZGnTu2kpYJrTu2vwCZDGpPLqbd2yG'], + [ADDRESSES.solana.USDC, 'FhVcYNEe58SMtxpZGnTu2kpYJrTu2vwCZDGpPLqbd2yG'], + ) + + return sumTokens2({ + balances: api.getBalances(), tokensAndOwners, blacklistedTokens: [ + 'sSo1wxKKr6zW2hqf5hZrp2CawLibcwi1pMBqk5bg2G4', + 'testqcAoCvfFpuFNtdmrBnBMSfFoXKkSTJ3ky6cPKjx', + ] + }) } module.exports = { diff --git a/projects/solbank-finance/index.js b/projects/solbank-finance/index.js new file mode 100644 index 000000000000..bae3e57047bd --- /dev/null +++ b/projects/solbank-finance/index.js @@ -0,0 +1,10 @@ +const { sumTokensExport } = require('../helper/solana'); + +const contractAddress = '3Q3pE1izgCeAtTR23eufZy5vCEGtpWLBQcGD2HGd1cbU'; + +module.exports = { + solana: { + tvl: sumTokensExport({ owners: [contractAddress], blacklistedTokens: ['8twuNzMszqWeFbDErwtf4gw13E6MUS4Hsdx5mi3aqXAM'] }), + staking: sumTokensExport({ owners: [contractAddress], tokens: ['8twuNzMszqWeFbDErwtf4gw13E6MUS4Hsdx5mi3aqXAM'] }), + }, +}; \ No newline at end of file diff --git a/projects/solend/index.js b/projects/solend/index.js index d8c495f05e37..9670d6dda500 100644 --- a/projects/solend/index.js +++ b/projects/solend/index.js @@ -21,7 +21,11 @@ async function borrowed(api) { async function tvl() { const markets = (await getConfig('solend', solendConfigEndpoint)) - return sumTokens2({ owners: markets.map(i => i.authorityAddress)}); + return sumTokens2({ owners: markets.map(i => i.authorityAddress) }); +} + +async function eclipseTvl(api) { + return sumTokens2({ api, owners: ['5Gk1kTdDqqacmA2UF3UbNhM7eEhVFvF3p8nd9p3HbXxk'] }); } module.exports = { @@ -30,6 +34,7 @@ module.exports = { tvl, borrowed, }, + eclipse: { tvl: eclipseTvl }, 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.", hallmarks: [ diff --git a/projects/solidblast/index.js b/projects/solidblast/index.js index c8d28e993a82..a2a1b9960bb3 100644 --- a/projects/solidblast/index.js +++ b/projects/solidblast/index.js @@ -6,7 +6,6 @@ module.exports = { blast: { tvl: getUniTVL({ factory: "0x5a79cC04Ad1494A8Ec04cE5C1E25bB50A10111eA", - fetchBalances: true, useDefaultCoreAssets: true, }), }, diff --git a/projects/solidex/index.js b/projects/solidex/index.js index f5ba9f164a0c..6458e9471a54 100644 --- a/projects/solidex/index.js +++ b/projects/solidex/index.js @@ -1,60 +1,21 @@ -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs, sumTokens } = require('../helper/unwrapLPs'); const abis = require("./abis.json"); const SOLID = '0x888EF71766ca594DED1F0FA3AE64eD2941740A20'; - -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - const noPairs = (await sdk.api.abi.call({ - target: '0x3fAaB499b519fdC5819e3D7ed0C26111904cbc28', - abi: abis.allPairsLength, - block: chainBlocks.fantom, - chain: 'fantom' - })).output; - - const pairAddresses = (await sdk.api.abi.multiCall({ - target: '0x3fAaB499b519fdC5819e3D7ed0C26111904cbc28', - calls: Array.from({ length: Number(noPairs) }, (_, k) => ({ - params: k, - })), - abi: abis.allPairs, - block: chainBlocks.fantom, - chain: 'fantom' - })).output; - - let pairTokens = (await sdk.api.abi.multiCall({ - calls: pairAddresses.map(a => ({ - target: a.output - })), - abi: abis.tokens, - block: chainBlocks.fantom, - chain: 'fantom' - })).output; - - let tokensAndOwners = []; - for (let i = 0; i < pairTokens.length; i++) { - const owner = pairTokens[i].input.target; - (pairTokens[i].output || []).forEach(token => tokensAndOwners.push([token, owner])) - } - - await sumTokens(balances, tokensAndOwners, chainBlocks.fantom, 'fantom',); - - return balances; +async function tvl(api) { + const pairs = await api.fetchList({ lengthAbi: abis.allPairsLength, itemAbi: abis.allPairs, target: '0x3fAaB499b519fdC5819e3D7ed0C26111904cbc28' }) + const tokens = await api.multiCall({ abi: abis.tokens, calls: pairs}) + const ownerTokens = tokens.map((t, i) => [t, pairs[i]]) + return api.sumTokens({ ownerTokens }) } -async function staking(ts, _block, chainBlocks) { - const balances = {}; - balances[`fantom:${SOLID}`] = (await sdk.api.abi.call({ +async function staking(api) { + const { amount } = await api.call({ target: '0xcbd8fea77c2452255f59743f55a3ea9d83b3c72b', abi: abis.locked, params: [8], - block: chainBlocks.fantom, - chain: 'fantom' - })).output.amount - return balances + }) + api.add(SOLID, amount) } module.exports = { diff --git a/projects/solv-btc-lst/index.js b/projects/solv-btc-lst/index.js new file mode 100644 index 000000000000..3db1b193511e --- /dev/null +++ b/projects/solv-btc-lst/index.js @@ -0,0 +1,28 @@ +const { sumTokens } = require('../helper/chain/bitcoin'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js'); +const { getConfig } = require('../helper/cache.js'); + +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.solvBTC() }) +} + + +const solvbtclstListUrl = 'https://raw.githubusercontent.com/solv-finance/solv-protocol-defillama/refs/heads/main/solvbtc-lst.json'; + +async function evmTVL(api) { + let solvbtclst = await getConfig('solv-protocol/solv-btc-lst-evm', solvbtclstListUrl) + let { depositAddress: owners, tokens } = solvbtclst[api.chain]?.otherDeposit ?? {} + return api.sumTokens({ owners, tokens }) +} + +module.exports = { + methodology: 'Staked tokens via Babylon and Core are counted towards TVL, as they represent the underlying BTC assets securing their respective networks.', + doublecounted: true, + timetravel: false, + bitcoin: { tvl } +} + +const chains = ['ethereum'] +chains.forEach(chain => { + module.exports[chain] = { tvl: evmTVL } +}) \ No newline at end of file diff --git a/projects/solv-protocol-funds/index.js b/projects/solv-protocol-funds/index.js index c086c8a4c7e5..eaddedb068ca 100644 --- a/projects/solv-protocol-funds/index.js +++ b/projects/solv-protocol-funds/index.js @@ -16,7 +16,7 @@ const graphUrlList = { const slotListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/solv-protocol-rwa-slot/main/slot.json'; -const addressUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solv-funds.json'; +const addressUrl = 'https://raw.githubusercontent.com/solv-finance/solv-protocol-defillama/refs/heads/main/solv-funds.json'; async function tvl(api) { const address = (await getConfig('solv-protocol/funds', addressUrl)); @@ -30,103 +30,24 @@ async function tvl(api) { await vaultBalance(api, graphData); await otherDeposit(api, address); await ceffuBalance(api, address, graphData); - - return api.getBalances(); } -async function borrowed(api) { - const network = api.chain; - - const graphData = await getGraphData(api.timestamp, network, api); - if (graphData.pools.length > 0) { - const poolLists = graphData.pools; - - let address = (await getConfig('solv-protocol/funds', addressUrl)); - const depositAddress = filterDepositAddress(network, address); - - let fofFundPoolId = []; - if (address[network] && address[network]["fofFund"]) { - fofFundPoolId = address[network]["fofFund"]; - } - - let pools = []; - for (const pool of poolLists) { - if (depositAddress.length == 0 && depositAddress.indexOf(pool.vault) == -1 && fofFundPoolId.indexOf(pool.poolId) == -1) { - pools.push(pool); - } - } - - 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 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) => ({ - target: index[0], - params: [index[1]] - })), - }) +const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance/solv-protocol-defillama/refs/heads/main/solvbtc.json'; +async function getSolvBTCVAddresses(api) { + let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl)); - 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 (balance > 0) { - if (symbols[i] !== "SolvBTC") { - api.add(poolBaseInfos[i][1], balance) - } - } + const blacklisted = {} + if (!solvbtc[api.chain] || !solvbtc[api.chain]["otherDeposit"]) { + return blacklisted + } + let otherDeposit = solvbtc[api.chain]["otherDeposit"]; + for (const deposit of otherDeposit["depositAddress"]) { + for (const tokenAddress of otherDeposit["tokens"]) { + const key = `${tokenAddress}-${deposit}`.toLowerCase() + blacklisted[key] = true } } - return api.getBalances() + return blacklisted } async function otherDeposit(api, address) { @@ -300,7 +221,6 @@ async function lendle(api, address) { async function vaultBalance(api, graphData) { const network = api.chain; - const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solvbtc.json'; let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl)); if (graphData.pools.length > 0) { const poolLists = graphData.pools; @@ -328,27 +248,17 @@ async function vaultBalance(api, graphData) { vaults[`${poolBaseInfos[key][1].toLowerCase()}-${poolLists[key]["vault"].toLowerCase()}`] = [poolBaseInfos[key][1], poolLists[key]["vault"]] } } - - const symbols = await api.multiCall({ - abi: abi.symbol, - calls: Object.values(vaults).map((index) => ({ - target: index[0] - })), + const tokens = Object.values(vaults).map(([token]) => token) + + const symbols = await api.multiCall({ abi: abi.symbol, calls: tokens, }) + const blacklisted = await getSolvBTCVAddresses(api) + const blacklistedTokens = tokens.filter((token, i) => symbols[i].toLowerCase().includes('solvbtc')) + const tokensAndOwners = Object.values(vaults).filter(([token, owner]) => { + const key = `${token}-${owner}`.toLowerCase() + return !blacklisted[key] && !blacklistedTokens.includes(token) }) - - const balances = await api.multiCall({ - abi: abi.balanceOf, - calls: Object.values(vaults).map((index) => ({ - target: index[0], - params: [index[1]] - })), - }) - - for (const key in balances) { - if (symbols[key] !== "SolvBTC") { - api.add(Object.values(vaults)[key][0], balances[key]) - } - } + + return api.sumTokens({ tokensAndOwners, blacklistedTokens, }) } } @@ -357,7 +267,7 @@ async function ceffuBalance(api, address, graphData) { return; } let ceffuData = address[api.chain]["ceffu"]; - + let pools = []; for (const graph of graphData.pools) { if (graph['openFundShareSlot'] == ceffuData['slot']) { @@ -479,40 +389,10 @@ async function getGraphData(timestamp, chain, api) { }; } -function filterDepositAddress(network, address) { - let depositAddresses = []; - if (address[network]) { - if (address[network]["gm"]) { - for (let depositAddress of address[network]["gm"]["depositAddress"]) { - depositAddresses.push(depositAddress.toLowerCase()) - } - } - if (address[network]["mux"]) { - depositAddresses.push(address[network]["mux"]["account"].toLowerCase()) - } - if (address[network]["klp"]) { - for (let poolAddress of address[network]["klp"]["klpPool"]) { - depositAddresses.push(poolAddress.toLowerCase()) - } - } - if (address[network]["iziswap"]) { - for (let owner of address[network]["iziswap"]["owner"]) { - depositAddresses.push(owner.toLowerCase()) - } - } - if (address[network]["lendle"]) { - depositAddresses.push(address[network]["lendle"]["account"]["user"].toLowerCase()) - } - } - - return depositAddresses; -} - // node test.js projects/solv-protocol-funds ['ethereum', 'bsc', 'polygon', 'arbitrum', 'mantle', 'merlin'].forEach(chain => { module.exports[chain] = { - tvl, - borrowed + tvl } }) diff --git a/projects/solvbtc/index.js b/projects/solvbtc/index.js index 1c35f29559c7..e8cfcd145658 100644 --- a/projects/solvbtc/index.js +++ b/projects/solvbtc/index.js @@ -1,43 +1,22 @@ -const abi = require("./abi.json"); const { getConfig } = require("../helper/cache"); -const { cachedGraphQuery } = require("../helper/cache"); const { sumTokens2, } = require("../helper/unwrapLPs"); +const { sumTokens } = require("../helper/chain/bitcoin"); -// 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: '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', -} - -const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance-dev/slov-protocol-defillama/main/solvbtc.json'; +const solvbtcListUrl = 'https://raw.githubusercontent.com/solv-finance/solv-protocol-defillama/refs/heads/main/solvbtc.json'; -async function tvl(api) { +async function bitcoinTvl(api) { let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl)); - - await gm(api, solvbtc) - await vaultBalance(api, solvbtc); - await otherDeposit(api, solvbtc); - - return api.getBalances(); -} - -async function gm(api, solvbtc) { - if (!solvbtc[api.chain] || !solvbtc[api.chain]["gm"]) { + if (!solvbtc[api.chain]) { return; } - let gm = solvbtc[api.chain]["gm"]; - let tokens = [] - for (const pool of gm["depositAddress"]) { - for (const address of gm["gmTokens"]) { - tokens.push({ address, pool }) - } - } + return sumTokens({ owners: solvbtc[api.chain] }) +} - await sumTokens2({ api, tokensAndOwners: tokens.map(i => [i.address, i.pool]), permitFailure: true }); +async function tvl(api) { + let solvbtc = (await getConfig('solv-protocol/solvbtc', solvbtcListUrl)); + + await otherDeposit(api, solvbtc); } async function otherDeposit(api, solvbtc) { @@ -46,112 +25,25 @@ async function otherDeposit(api, solvbtc) { } let otherDeposit = solvbtc[api.chain]["otherDeposit"]; - let tokens = [] + let tokensAndOwners = [] for (const deposit of otherDeposit["depositAddress"]) { for (const tokenAddress of otherDeposit["tokens"]) { - tokens.push({ tokenAddress, deposit }) + tokensAndOwners.push([tokenAddress, deposit]) } } - await sumTokens2({ api, tokensAndOwners: tokens.map(i => [i.tokenAddress, i.deposit]), permitFailure: true }); -} - -async function concrete(slots, api) { - var slotsList = []; - var only = {}; - for (var i = 0; i < slots.length; i++) { - if (!only[slots[i].contractAddress]) { - slotsList.push(slots[i]); - only[slots[i].contractAddress] = true; - } - } - - const concreteLists = await api.multiCall({ - calls: slotsList.map((index) => index.contractAddress), - abi: abi.concrete, - }) - - let concretes = {}; - for (var k = 0; k < concreteLists.length; k++) { - concretes[slotsList[k].contractAddress] = concreteLists[k]; - } - - return concretes; + await sumTokens2({ api, tokensAndOwners, permitFailure: true }); } -async function vaultBalance(api, solvbtc) { - if (!solvbtc[api.chain] || !solvbtc[api.chain]["slot"]) { - return; - } - let slot = solvbtc[api.chain]["slot"]; - - const graphData = await getGraphData(api.timestamp, api.chain, api, slot); - if (graphData.pools.length > 0) { - const poolLists = graphData.pools; - - const poolConcretes = await concrete(poolLists, api); - - const poolBaseInfos = await api.multiCall({ - abi: abi.slotBaseInfo, - calls: poolLists.map((index) => ({ - target: poolConcretes[index.contractAddress], - params: [index.openFundShareSlot] - })), - }) - - let vaults = {}; - for (const key in poolLists) { - if (poolBaseInfos[key][1] && poolLists[key]["vault"]) { - vaults[`${poolBaseInfos[key][1].toLowerCase()}-${poolLists[key]["vault"].toLowerCase()}`] = [poolBaseInfos[key][1], poolLists[key]["vault"]] - } +// node test.js projects/solvbtc +['bitcoin', 'ethereum', 'bsc', 'polygon', 'arbitrum', 'mantle', 'merlin', 'avax', 'bob', 'base'].forEach(chain => { + if (chain == 'bitcoin') { + module.exports[chain] = { + tvl: bitcoinTvl, } - - const balances = await api.multiCall({ - abi: abi.balanceOf, - calls: Object.values(vaults).map((index) => ({ - target: index[0], - params: [index[1]] - })), - }) - - for (const key in balances) { - api.add(Object.values(vaults)[key][0], balances[key]) + } else { + module.exports[chain] = { + tvl } } -} - - -async function getGraphData(timestamp, chain, api, slot) { - - const slotDataQuery = `query PoolOrderInfos { - poolOrderInfos(first: 1000 where:{fundraisingEndTime_gt:${timestamp}, openFundShareSlot_in: ${JSON.stringify(slot)}}) { - marketContractAddress - contractAddress - navOracle - poolId - vault - openFundShareSlot - } - }`; - - let data; - if (graphUrlList[chain]) { - data = (await cachedGraphQuery(`solv-protocol/funds-graph-data/${chain}`, graphUrlList[chain], slotDataQuery, { api, })); - } - - let poolList = []; - if (data != undefined && data.poolOrderInfos != undefined) { - poolList = data.poolOrderInfos; - } - - return { - pools: poolList - }; -} - -// node test.js projects/solvbtc -['ethereum', 'bsc', 'polygon', 'arbitrum', 'mantle', 'merlin'].forEach(chain => { - module.exports[chain] = { - tvl - } }) diff --git a/projects/sorbetfinance/abi.json b/projects/sorbetfinance/abi.json deleted file mode 100644 index a3f879f2f9ae..000000000000 --- a/projects/sorbetfinance/abi.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "getDeployers": "address[]:getDeployers", - "getPools": "function getPools(address deployer) view returns (address[])", - "token0": "address:token0", - "token1": "address:token1", - "getUnderlyingBalances": "function getUnderlyingBalances() view returns (uint256 amount0Current, uint256 amount1Current)" -} \ No newline at end of file diff --git a/projects/sorbetfinance/index.js b/projects/sorbetfinance/index.js index a6e0f7ee3355..cfe8a07a34f8 100644 --- a/projects/sorbetfinance/index.js +++ b/projects/sorbetfinance/index.js @@ -1,85 +1,16 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); +const abi = { + "getPools": "function getPools(address deployer) view returns (address[])", + "getUnderlyingBalances": "function getUnderlyingBalances() view returns (uint256 amount0Current, uint256 amount1Current)" +} -const chainTvl = (chain, G_UNI_Factory) => async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const block = chainBlocks[chain] - - const getAllDeplores = ( - await sdk.api.abi.call({ - abi: abi.getDeployers, - target: G_UNI_Factory, - block, - chain, - }) - ).output; - - const getAllPools = ( - await sdk.api.abi.multiCall({ - abi: abi.getPools, - calls: getAllDeplores.map((deployer) => ({ - target: G_UNI_Factory, - params: deployer, - })), - block, - chain, - }) - ).output.map((pool) => pool.output); - - const allGelatoPools = [].concat.apply([], getAllPools); - - const token0 = ( - await sdk.api.abi.multiCall({ - abi: abi.token0, - calls: allGelatoPools.map((pool) => ({ - target: pool, - })), - block, - chain - }) - ).output.map((t0) => t0.output); - - const token1 = ( - await sdk.api.abi.multiCall({ - abi: abi.token1, - calls: allGelatoPools.map((pool) => ({ - target: pool, - })), - block, - chain, - }) - ).output.map((t1) => t1.output); - - const balanceOfPools = ( - await sdk.api.abi.multiCall({ - abi: abi.getUnderlyingBalances, - calls: allGelatoPools.map((pool) => ({ - target: pool, - })), - block, - chain - }) - ).output.map((bal) => bal.output); - - for (let i = 0; i < allGelatoPools.length; i++) { - sdk.util.sumSingleBalance(balances, `${chain}:${token0[i]}`, balanceOfPools[i].amount0Current); - sdk.util.sumSingleBalance(balances, `${chain}:${token1[i]}`, balanceOfPools[i].amount1Current); - } - - return balances; -}; +const config = { + ethereum: '0xEA1aFf9dbFfD1580F6b81A3ad3589E66652dB7D9', + optimism: '0x2845c6929d621e32B7596520C8a1E5a37e616F09', + polygon: '0x37265A834e95D11c36527451c7844eF346dC342a' +} module.exports = { doublecounted: true, - ethereum: { - tvl: chainTvl("ethereum", "0xEA1aFf9dbFfD1580F6b81A3ad3589E66652dB7D9"), - }, - optimism: { - tvl: chainTvl("optimism", "0x2845c6929d621e32B7596520C8a1E5a37e616F09"), - }, - polygon: { - tvl: chainTvl("polygon", "0x37265A834e95D11c36527451c7844eF346dC342a") - }, methodology: "Counts TVL that's on all the Pools through G-UNI Factory Contract", hallmarks:[ @@ -87,3 +18,20 @@ module.exports = { [1643056020, "Maker GUNI Cap to 500M"], ], }; + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + const G_UNI_Factory = config[chain] + const deployers = await api.call({ abi: "address[]:getDeployers", target: G_UNI_Factory}) + const pools = (await api.multiCall({ abi: abi.getPools, calls: deployers, target: G_UNI_Factory})).flat() + const token0s = await api.multiCall({ abi: "address:token0", calls: pools }) + const token1s = await api.multiCall({ abi: "address:token1", calls: pools }) + const bals = await api.multiCall({ abi: abi.getUnderlyingBalances, calls: pools }) + bals.forEach((bal, i) => { + api.add(token0s[i], bal.amount0Current) + api.add(token1s[i], bal.amount1Current) + }) + } + } +}) \ No newline at end of file diff --git a/projects/spacewhale/index.js b/projects/spacewhale/index.js new file mode 100644 index 000000000000..4d7113270456 --- /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/spadefinance/index.js b/projects/spadefinance/index.js index ddaece14bdb6..d5ab771e5924 100644 --- a/projects/spadefinance/index.js +++ b/projects/spadefinance/index.js @@ -8,4 +8,5 @@ module.exports = masterchefExports({ module.exports.hallmarks = [ [1647734400, "Rug Pull"] - ] + ], +module.exports.deadFrom='2022-03-20' diff --git a/projects/spark/index.js b/projects/spark/index.js new file mode 100644 index 000000000000..b39e27907731 --- /dev/null +++ b/projects/spark/index.js @@ -0,0 +1,11 @@ +const { sumTokens } = require("../helper/chain/fuel") + +async function tvl(api) { + const contractId = '0xfe2c524ad8e088f33d232a45dbea43e792861640b71aa1814b30506bf8430ee5' + return sumTokens({ api, owner: contractId, }) +} + +module.exports = { + fuel: { tvl }, + timetravel: false, +} \ No newline at end of file diff --git a/projects/sparkdex-v2/index.js b/projects/sparkdex-v2/index.js index 15b857585c40..1427df73c2bb 100644 --- a/projects/sparkdex-v2/index.js +++ b/projects/sparkdex-v2/index.js @@ -6,7 +6,6 @@ module.exports = { tvl: getUniTVL({ factory: "0x16b619B04c961E8f4F06C10B42FDAbb328980A89", useDefaultCoreAssets: true, - fetchBalances: true, }), }, }; diff --git a/projects/sparkdex-v3-1/index.js b/projects/sparkdex-v3-1/index.js new file mode 100644 index 000000000000..0b7f09c0ce44 --- /dev/null +++ b/projects/sparkdex-v3-1/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +module.exports = uniV3Export({ + flare: { factory: '0x8A2578d23d4C532cC9A98FaD91C0523f5efDE652', fromBlock: + 30717263, }, +}) diff --git a/projects/sparkswap/index.js b/projects/sparkswap/index.js index 154c1ac9e590..f1aa9de98461 100644 --- a/projects/sparkswap/index.js +++ b/projects/sparkswap/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { getUniTVL } = require("../helper/unknownTokens"); const { sumTokensExport, @@ -10,7 +11,7 @@ const pendleAbi = require("../pendle/abi.json"); const FACTORY = "0x955219A87eB0C6754fd247266af970F7d16906CD"; const SPARK_TOKEN = "0x6386704cD6f7A584EA9D23cccA66aF7EBA5a727e"; const SPARK_LP = "0x33208439e1B28B1d6fCfbB6334e9950027Ee3B52"; -const SDAI_TOKEN = "0x30FCB23A906493371b1721C8feb8815804808D74"; +const SDAI_TOKEN = ADDRESSES.pulse.sDAI; const SDAI_DAI_LP = "0xf32B9398a7277609772F328Fc2005D7DA5420E77"; const SDAI_SPARK_LP = "0x9095D464A29Abd1B840C1C5205FB602ae5b011FF"; const MASTERCHEF = "0x63c2a0083861F8C496A0A29BD8BA223E1180664e"; diff --git a/projects/spartacus/index.js b/projects/spartacus/index.js index 8042057ed5d4..8379f460d4f8 100644 --- a/projects/spartacus/index.js +++ b/projects/spartacus/index.js @@ -1,6 +1,7 @@ const { staking } = require('../helper/staking') module.exports = { + deadFrom: '2023-09-23', fantom: { tvl: () => 0, staking: staking("0x9863056B4Bdb32160A70107a6797dD06B56E8137", "0x5602df4A94eB6C680190ACCFA2A475621E0ddBdc") diff --git a/projects/spartan-protocol/abis/PoolFactory.json b/projects/spartan-protocol/abis/PoolFactory.json deleted file mode 100644 index 6e638c83f71c..000000000000 --- a/projects/spartan-protocol/abis/PoolFactory.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "getPool": "function getPool(address token) view returns (address pool)", - "getTokenAssets": "address[]:getTokenAssets" -} \ No newline at end of file diff --git a/projects/spartan-protocol/index.js b/projects/spartan-protocol/index.js index 05c0ee3a4e22..104cf4f6dbfe 100644 --- a/projects/spartan-protocol/index.js +++ b/projects/spartan-protocol/index.js @@ -1,48 +1,16 @@ -const sdk = require("@defillama/sdk"); - -const factoryAbi = require("./abis/PoolFactory.json"); +const factoryAbi = { + "getPool": "function getPool(address token) view returns (address pool)", + "getTokenAssets": "address[]:getTokenAssets" +} const factory = "0x2C577706579E08A88bd30df0Fd7A5778A707c3AD"; const sparta = "0x3910db0600eA925F63C36DdB1351aB6E2c6eb102"; -async function tvl(timestamp, ethBlock, chainBlocks) { - let tokens = await sdk.api.abi.call({ - target: factory, - abi: factoryAbi["getTokenAssets"], - block: chainBlocks.bsc, - params: [], - chain: "bsc", - }); // Get listed token array - tokens = tokens.output; - - let balances = {}; // Setup the balances object - for (let i = 0; i < tokens.length; i++) { - const poolAddress = sdk.api.abi.call({ - target: factory, - abi: factoryAbi["getPool"], - block: chainBlocks.bsc, - params: [tokens[i]], - chain: "bsc", - }); // PoolFactory.getPool(tokenAddr) - - const tokenBal = sdk.api.erc20.balanceOf({ - target: tokens[i], - owner: (await poolAddress).output, - chain: "bsc", - block: chainBlocks.bsc, - }); // Pool's token balance - const spartaBal = sdk.api.erc20.balanceOf({ - target: sparta, - owner: (await poolAddress).output, - chain: "bsc", - block: chainBlocks.bsc, - }); // Pool's sparta balance - - sdk.util.sumSingleBalance(balances, `bsc:${tokens[i]}`, (await tokenBal).output) - sdk.util.sumSingleBalance(balances, `bsc:${sparta}`, (await spartaBal).output) - } - - return balances; +async function tvl(api) { + let tokens = await api.call({ target: factory, abi: factoryAbi["getTokenAssets"], }) + const pools = await api.multiCall({ abi: factoryAbi.getPool, target: factory, calls: tokens }) + const ownerTokens = pools.map((pool, i) => [[tokens[i], sparta], pool]) + return api.sumTokens({ ownerTokens }) } module.exports = { diff --git a/projects/spectra/config.json b/projects/spectra/config.json index 1cdebca0c99f..8aa9dbeab4bc 100644 --- a/projects/spectra/config.json +++ b/projects/spectra/config.json @@ -6,5 +6,13 @@ "arbitrum": { "factory": "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60", "fromBlock": 204418891 + }, + "optimism": { + "factory": "0x9c594C2e2e2e5aa300be12596215188C324c3E7c", + "fromBlock": 122132149 + }, + "base": { + "factory": "0x51100574E1CF11ee9fcC96D70ED146250b0Fdb60", + "fromBlock": 16537568 } } diff --git a/projects/spectra/index.js b/projects/spectra/index.js index a0dfa4546ae7..cda61e4b6e30 100644 --- a/projects/spectra/index.js +++ b/projects/spectra/index.js @@ -5,6 +5,9 @@ const sdk = require("@defillama/sdk"); module.exports = { methodology: `All deposited underlying in Spectra Principal Tokens and all underlying supplied as liquidity in Spectra Markets`, + hallmarks: [ + [1717074000, "V2 Launch"] + ], }; const curvePoolDeployedTopic = diff --git a/projects/sperax-demeter-v2/index.js b/projects/sperax-demeter-v2/index.js new file mode 100644 index 000000000000..2c04b1014c3e --- /dev/null +++ b/projects/sperax-demeter-v2/index.js @@ -0,0 +1,9 @@ +async function tvl(api) { + const farms = await api.call({ target: '0x45bC6B44107837E7aBB21E2CaCbe7612Fce222e0', abi: 'address[]:getFarmList', }) + const tokensAndBals = await api.multiCall({ calls: farms, abi: 'function getTokenAmounts() view returns (address[], uint256[])', }) + tokensAndBals.forEach(([t, b]) => api.add(t, b)) +} + +module.exports = { + arbitrum: { tvl }, +} \ No newline at end of file diff --git a/projects/spherium/abi.json b/projects/spherium/abi.json deleted file mode 100644 index 8c892f3b37a7..000000000000 --- a/projects/spherium/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "getAllWhitelistedTokenNames": "string[]:getAllWhitelistedTokenNames", - "whitelistedTokenAddress": "function whitelistedTokenAddress(string) view returns (address)" -} \ No newline at end of file diff --git a/projects/spherium/constants.js b/projects/spherium/constants.js deleted file mode 100644 index 93e1e20f3813..000000000000 --- a/projects/spherium/constants.js +++ /dev/null @@ -1,20 +0,0 @@ -const bridgeAddr = "0x0b8c93c6aaeabfdf7845786188727aa04100cb61"; -const supportedChains = [ - "ethereum", - "bsc", - "polygon", - "avax", - "fantom", - "arbitrum", - "cronos", - "moonriver", - "moonbeam", - "optimism", - "aurora", - "okexchain", - "kcc", -]; -module.exports = { - bridgeAddr, - supportedChains, -}; diff --git a/projects/spherium/index.js b/projects/spherium/index.js index 770a55c88b9a..629630b861be 100644 --- a/projects/spherium/index.js +++ b/projects/spherium/index.js @@ -1,35 +1,33 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { supportedChains, bridgeAddr } = require("./constants"); -const { sumTokens2 } = require('../helper/unwrapLPs') +const abi = { + "getAllWhitelistedTokenNames": "string[]:getAllWhitelistedTokenNames", + "whitelistedTokenAddress": "function whitelistedTokenAddress(string) view returns (address)" +} +const bridgeAddr = "0x0b8c93c6aaeabfdf7845786188727aa04100cb61"; +const supportedChains = [ + "ethereum", + "bsc", + "polygon", + "avax", + "fantom", + "arbitrum", + "cronos", + "moonriver", + "moonbeam", + "optimism", + "aurora", + "okexchain", + "kcc", +]; const blackList = new Set(["SPHRI"]); -function chainTvl(chain) { - return async (_timestamp, _block, {[chain]: block}) => { - const tokens = await getTokens(chain, block) - return sumTokens2({ chain, block, owner: bridgeAddr, tokens, }) - }; -} - -async function getTokens(chain, block) { - let { output: tokenNames } = await sdk.api.abi.call({ - target: bridgeAddr, - abi: abi.getAllWhitelistedTokenNames, - chain, block, - }) +const tvl = async (api) => { + let tokenNames = await api.call({ target: bridgeAddr, abi: abi.getAllWhitelistedTokenNames, }) tokenNames = tokenNames.filter(i => !blackList.has(i)) - const { output: tokens } = await sdk.api.abi.multiCall({ - target: bridgeAddr, - abi: abi.whitelistedTokenAddress, - calls: tokenNames.map(i => ({ params: i})), - chain, block, - }) - return tokens.map(i => i.output) -} - -module.exports = {} + const tokens = await api.multiCall({ target: bridgeAddr, abi: abi.whitelistedTokenAddress, calls: tokenNames }) + return api.sumTokens({ owner: bridgeAddr, tokens, }) +}; supportedChains.forEach((chain) => { - module.exports[chain] = { tvl: chainTvl(chain) }; + module.exports[chain] = { tvl }; }); \ No newline at end of file diff --git a/projects/spiko/index.js b/projects/spiko/index.js new file mode 100644 index 000000000000..969fbee11a08 --- /dev/null +++ b/projects/spiko/index.js @@ -0,0 +1,21 @@ +const assets = { + polygon: [ + '0xe4880249745eAc5F1eD9d8F7DF844792D560e750', + '0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80' + ], + ethereum: [ + '0xe4880249745eAc5F1eD9d8F7DF844792D560e750', + '0xa0769f7A8fC65e47dE93797b4e21C073c117Fc80' + ] +} + +module.exports = {} + +Object.keys(assets).forEach(chain => { + module.exports[chain] = { + tvl: (api) => api.multiCall({ + abi: 'erc20:totalSupply', + calls: assets[api.chain].map(target => ({ target })) + }).then(supplies => api.add(assets[api.chain], supplies)) + } +}) \ No newline at end of file diff --git a/projects/spiritswap-lending/index.js b/projects/spiritswap-lending/index.js index d2d37e71439e..c1471d9c59c5 100644 --- a/projects/spiritswap-lending/index.js +++ b/projects/spiritswap-lending/index.js @@ -1,20 +1,8 @@ -const {usdCompoundExports} = require('../helper/compound') - -const abis = { - oracle: "address:getRegistry", - underlyingPrice: "function getPriceForUnderling(address cToken) view returns (uint256)", -} - -const unitroller_fantom = "0x892701d128d63c9856A9Eb5d967982F78FD3F2AE" - -const olalending = usdCompoundExports(unitroller_fantom, "fantom", "0xed8F2C964b47D4d607a429D4eeA972B186E6f111", abis) +const { compoundExports2 } = require('../helper/compound') module.exports = { hallmarks: [ [1693526400, "Lending Network deprecated"] ], - fantom:{ - tvl: olalending.tvl, - borrowed: olalending.borrowed - }, + fantom: compoundExports2({ comptroller: '0x892701d128d63c9856A9Eb5d967982F78FD3F2AE' }), } \ No newline at end of file diff --git a/projects/spl-governance/index.js b/projects/spl-governance/index.js index f68ef0c49f02..1abdbfd465b4 100644 --- a/projects/spl-governance/index.js +++ b/projects/spl-governance/index.js @@ -1,22 +1,36 @@ -const { getCache } = require('../helper/http') -const url = 'https://api.realms.today/stats/tvl' +const { PublicKey } = require('@solana/web3.js') +const { get } = require('../helper/http') +const { getConnection } = require('../helper/solana') +const { sliceIntoChunks } = require('../helper/utils') -async function tvl() { - const { tvl } = await getCache(url) - return tvlObject(tvl) -} +const url = 'https://realms-tvl.vercel.app/tvl/latest' -async function staking() { - const { ownTokens } = await getCache(url) - return tvlObject(ownTokens) -} +const isSolOrStable = (token) => ['sol', 'usd', 'btc', 'eth'].some(i => token.token_symbol.toLowerCase().includes(i)) + +async function tvl(api, isStaking = false) { + // const connnection = getConnection() + let { totalValueUsd: { tokens } } = await get(url) + const filterFn = isStaking ? i => !isSolOrStable(i) : isSolOrStable + tokens = tokens.filter(filterFn) + tokens.forEach(i => api.addUSDValue(i.value)) + /* const decimalsMap = {} + const _tokens = tokens.map(i => i.token) + const chunks = sliceIntoChunks(_tokens, 99) + + for (const chunk of chunks) { + const { value } = await connnection.getMultipleParsedAccounts(chunk.map(i => new PublicKey(i))) + value.forEach((val, i) => { + decimalsMap[chunk[i]] = val.data.parsed.info.decimals + }) + } -function tvlObject(obj) { - return Object.fromEntries(Object.entries(obj).filter(([_, i]) => +i > 1).map(([a, b]) => ['solana:'+a, b])) + for (const token of tokens) + api.add(token.token, +token.balance * 10 ** decimalsMap[token.token]) */ } module.exports = { - methodology: 'SOL token and stables held in the contracts are counted under tvl, gov tokens are counted under staking', + misrepresentedTokens: true, + methodology: 'SOL token and stables held in the contracts are counted under tvl, gov tokens are counted under staking', timetravel: false, - solana: { tvl, staking, } + solana: { tvl: api => tvl(api), staking: api => tvl(api, true), } } diff --git a/projects/splash.js b/projects/splash.js index 0e4c15d75fa4..2e4904dd0d04 100644 --- a/projects/splash.js +++ b/projects/splash.js @@ -2,6 +2,9 @@ const { get } = require('./helper/http'); async function cardanoTVL() { let { tvlAda } = await get('https://api2.splash.trade/platform-api/v1/platform/stats') + if(tvlAda>1e9){ + throw new Error("wrong") + } return { cardano: tvlAda }; } diff --git a/projects/spookyswap-v3/index.js b/projects/spookyswap-v3/index.js new file mode 100644 index 000000000000..ea06e35f49af --- /dev/null +++ b/projects/spookyswap-v3/index.js @@ -0,0 +1,10 @@ +const { uniV3Export } = require("../helper/uniswapV3"); + +const factory = "0x7928a2c48754501f3a8064765ECaE541daE5c3E6"; +const factory_bttc = "0xE12b00681dD2e90f51d9Edf55CE1A7D171338165"; + +module.exports = uniV3Export({ + fantom: { factory, fromBlock: 70992836, blacklistedTokens:['0x6e5e3ce13e2c7d4de000f93c4909164d0aa59f0b'] }, + //eon: { factory, fromBlock: 679684 }, + bittorrent: { factory: factory_bttc, fromBlock: 26441276 }, +}) diff --git a/projects/springsui/index.js b/projects/springsui/index.js new file mode 100644 index 000000000000..72797930af9d --- /dev/null +++ b/projects/springsui/index.js @@ -0,0 +1,16 @@ +const sui = require('../helper/chain/sui') + +async function tvl() { + const pool = await sui.getObject('0x15eda7330c8f99c30e430b4d82fd7ab2af3ead4ae17046fcb224aa9bad394f6b'); + const suiAmount = pool.fields.storage.fields.total_sui_supply / 10 ** 9 + return { + sui: suiAmount, + } +} + +module.exports = { + methodology: "Calculates the amount of SUI staked in SpringSui liquid staking contracts.", + sui: { + tvl, + } +} diff --git a/projects/squid-defi/index.js b/projects/squid-defi/index.js index 35a500bfefa2..d05e6a3752ac 100644 --- a/projects/squid-defi/index.js +++ b/projects/squid-defi/index.js @@ -1,118 +1,28 @@ -const sdk = require("@defillama/sdk"); const abi = require("../helper/abis/masterchef.json"); -const {unwrapUniswapLPs} = require("../helper/unwrapLPs.js"); +const { sumTokens2 } = require("../helper/unwrapLPs.js"); +const { pool2 } = require('../helper/pool2') +const { staking } = require('../helper/staking') const token = "0xd86Be84feC60Fedf263059BB1581e00d2168e19D"; const masterchef = "0x1610374513e989Fc263A5741A053fa023A6f212A"; const pool2LPs = [ - "0xeA3998615d2Bfe793E84318d5fE9D3Aa3d0F2F3f", - "0x628C669511C4be30DA1c3C7Da4725eCD074c1c8B", - "0x961C853477cAc8B9cfef953312331a2bE0C31C67", - "0x7815A02bf54aa25039cC40Ac63daA84D876D130C" + "0xeA3998615d2Bfe793E84318d5fE9D3Aa3d0F2F3f", + "0x628C669511C4be30DA1c3C7Da4725eCD074c1c8B", + "0x961C853477cAc8B9cfef953312331a2bE0C31C67", + "0x7815A02bf54aa25039cC40Ac63daA84D876D130C" ] -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - - let { output: poolLength } = await sdk.api.abi.call({ - target: masterchef, - abi: abi["poolLength"], - block: chainBlocks.fantom, - chain: "fantom" - }); - - let { output: poolInfo } = await sdk.api.abi.multiCall({ - calls: Array.from({length: Number(poolLength)}, (v, k) => ({ - target: masterchef, - params: k - })), - abi: abi["poolInfo"], - block: chainBlocks.fantom, - chain: "fantom" - }); - - let { output: symbols } = await sdk.api.abi.multiCall({ - calls: poolInfo.map(pool => ({ - target: pool.output.lpToken - })), - abi: "erc20:symbol", - block: chainBlocks.fantom, - chain: "fantom" - }); - - let {output: balance } = await sdk.api.abi.multiCall({ - calls: poolInfo.map(pool => ({ - target: pool.output.lpToken, - params: masterchef - })), - abi: "erc20:balanceOf", - block: chainBlocks.fantom, - chain: "fantom" - }); - - let lpPositions = []; - for (let i = 0; i < Number(poolLength); i++) { - if (balance[i].output === null || poolInfo[i].output.lpToken === token) { - continue; - } - if (symbols[i].output.endsWith("LP")) { - lpPositions.push({ - balance: balance[i].output, - token: poolInfo[i].output.lpToken - }) - } else { - sdk.util.sumSingleBalance(balances, `fantom:${poolInfo[i].output.lpToken}`, balance[i].output); - } - } - - await unwrapUniswapLPs(balances, lpPositions, chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`, [token]); - - return balances; -} - -async function pool2(timestamp, block, chainBlocks) { - let balances = {}; - - let {output: balance} = await sdk.api.abi.multiCall({ - calls: pool2LPs.map(pool => ({ - target: pool, - params: masterchef - })), - abi: "erc20:balanceOf", - block: chainBlocks.fantom, - chain: "fantom" - }); - - let lpPositions = Array.from({length: pool2LPs.length}, (v, k) => ({ - balance: balance[k].output, - token: pool2LPs[k] - })); - - await unwrapUniswapLPs(balances, lpPositions, chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`); - - return balances; -} - -async function staking(timestamp, block, chainBlocks) { - let balances = {} - - let {output: balance} = await sdk.api.erc20.balanceOf({ - target: token, - owner: masterchef, - block: chainBlocks.fantom, - chain: "fantom" - }); - - sdk.util.sumSingleBalance(balances, token, balance); - - return balances; +async function tvl(api) { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: masterchef }) + const tokens = poolInfos.map(pool => pool.lpToken) + return sumTokens2({ api, owner: masterchef, tokens, blacklistedTokens: [...pool2LPs, token], resolveLP: true }) } module.exports = { - fantom: { - tvl, - pool2, - staking - }, + fantom: { + tvl, + pool2: pool2(masterchef, pool2LPs), + staking: staking(masterchef, token) + }, } \ No newline at end of file diff --git a/projects/stab-protocol/index.js b/projects/stab-protocol/index.js new file mode 100644 index 000000000000..20e6b505c0ee --- /dev/null +++ b/projects/stab-protocol/index.js @@ -0,0 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') + +const { queryAddresses, sumTokens } = require('../helper/chain/radixdlt'); + +const STAB_COMPONENT = "component_rdx1cq70cjajtvllgk9z9wm9l8v6w8hsgtlw530cdgpraxprn4yevg89kf"; +const STAB_XRD_POOL_XRD_VAULT = "internal_vault_rdx1trk04c3sxffatj5h78w3266c8q07cvjlgq0zx44sask8wsam4q8rup"; +const ORACLE_COMPONENT = "component_rdx1cq7zsdqfh0mcwnutrevkz6wtml0vnav5fcmtf7rksmhk48urkyjg9c"; + +async function tvl(api) { + //get the token amounts of collaterals used in the STAB Protocol + const stabComponentTokens = await sumTokens({ owners: [STAB_COMPONENT], api }) + const xrdAmount = stabComponentTokens['radixdlt:resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd'] + const lsuLpAmount = stabComponentTokens['radixdlt:resource_rdx1thksg5ng70g9mmy9ne7wz0sc7auzrrwy7fmgcxzel2gvp8pj0xxfmf'] + + //calculate value of LSULP against XRD to get accurate price data + const [{ details: { state } }] = await queryAddresses({ addresses: [ORACLE_COMPONENT] } ) + const xrdPrice = state.fields[0].elements[0].fields[1].value + const lsuLpPrice = state.fields[0].elements[1].fields[1].value + const lsuLpMultiplier = lsuLpPrice / xrdPrice + + //add XRD and LSULP values to tvl + api.add('resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd', xrdAmount + lsuLpAmount * lsuLpMultiplier) + + //get the amount of XRD in the protocol native STAB/XRD pool (with 50/50 weights) + const stabXrdPoolXrdVault = await queryAddresses({ addresses: [STAB_XRD_POOL_XRD_VAULT] }); + const xrdAmountPool = stabXrdPoolXrdVault[0].details.balance.amount; + + //add only XRD value of pool to tvl (STAB value is excluded as backing of STAB tokens are already included in tvl) + api.add('resource_rdx1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxradxrd', xrdAmountPool) +} + +module.exports = { + methodology: 'Calculates TVL using the amount of collateral locked to borrow STAB using CDPs, and amount of STAB and XRD locked in the protocol-native STAB/XRD pool.', + radixdlt: { tvl }, + misrepresentedTokens: true, + timetravel: false, +}; diff --git a/projects/stabl-v2/index.js b/projects/stabl-v2/index.js index e013ecb1861e..d5d81924cc35 100644 --- a/projects/stabl-v2/index.js +++ b/projects/stabl-v2/index.js @@ -1,39 +1,15 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); const vault = "0x2D62f6D8288994c7900e9C359F8a72e84D17bfba"; -const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const stablecoins = ( - await sdk.api.abi.call({ - abi: abi.getAllAssets, - target: vault, - block: chainBlocks['polygon'], - chain: 'polygon' - }) - ).output; - - for (let i = 0; i < stablecoins.length; i++) { - const balance_stablecoin = ( - await sdk.api.abi.call({ - abi: abi.checkBalance, - target: vault, - params: stablecoins[i], - block: chainBlocks['polygon'], - chain: 'polygon' - }) - ).output; - - sdk.util.sumSingleBalance(balances, stablecoins[i], balance_stablecoin,'polygon'); - } - - return balances; -}; +async function tvl(api) { + const tokens = await api.call({ abi: abi.getAllAssets, target: vault }) + const bals = await api.multiCall({ abi: abi.checkBalance, target: vault, calls: tokens }) + api.add(tokens, bals) +} module.exports = { polygon: { - tvl: polygonTvl, + tvl, }, }; diff --git a/projects/stabl/index.js b/projects/stabl/index.js index fdfba33a8478..e9dda7454ff8 100644 --- a/projects/stabl/index.js +++ b/projects/stabl/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const vaults = { polygon: "0xd1bb7d35db39954d43e16f65f09dd0766a772cff", @@ -17,12 +16,10 @@ module.exports = { Object.keys(vaults).forEach(chain => { module.exports[chain] = { - tvl: async (_, _b, {[chain]: block}) => { - const { output } = await sdk.api.abi.call({ chain, block, abi, target: vaults[chain]}) - return { - // refilling wont work because at mar 26th the decimals used by checkBalance() changed - [`${chain}:${assets[chain]}`]: output/100 - } + tvl: async (api) => { + const bal = await api.call({ abi, target: vaults[chain]}) + // refilling wont work because at mar 26th the decimals used by checkBalance() changed + api.add(assets[chain], bal/100) } } }) diff --git a/projects/stabledoin/index.js b/projects/stabledoin/index.js index cc886e818d5c..a2059c5cd31d 100644 --- a/projects/stabledoin/index.js +++ b/projects/stabledoin/index.js @@ -8,6 +8,7 @@ module.exports = { hallmarks: [ [1666656000, "Rug Pull"] ], + deadFrom: 1666656000, dogechain: { tvl: sdk.util.sumChainTvls([ getUniTVL({ factory, useDefaultCoreAssets: true, }), diff --git a/projects/stablejack/index.js b/projects/stablejack/index.js index e44943b7302f..ae8f8296c2ae 100644 --- a/projects/stablejack/index.js +++ b/projects/stablejack/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') module.exports = { @@ -6,9 +7,9 @@ module.exports = { async function tvl(api) { const wsAVAX = '0x7aa5c727270c7e1642af898e0ea5b85a094c17a1' - const sAVAX = '0x2b2C81e08f1Af8835a78Bb2A90AE924ACE0eA4bE' + const sAVAX = ADDRESSES.avax.SAVAX 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}) + const sAvaxBal= await api.call({ abi: 'erc20:balanceOf', target: ADDRESSES.avax.SAVAX, params: wsAVAX}) api.add(sAVAX, wsAvaxBal * sAvaxBal / wsAvaxSupply) } \ No newline at end of file diff --git a/projects/stablekoi/abi.json b/projects/stablekoi/abi.json deleted file mode 100644 index 7e8058d689af..000000000000 --- a/projects/stablekoi/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalSupply": "uint256:totalSupply" -} \ No newline at end of file diff --git a/projects/stablekoi/index.js b/projects/stablekoi/index.js index 1d575933f521..a4d6392f42a2 100644 --- a/projects/stablekoi/index.js +++ b/projects/stablekoi/index.js @@ -1,76 +1,28 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens } = require("../helper/unwrapLPs"); -const { GraphQLClient, gql } = require("graphql-request"); -const abi = require("./abi.json"); -const sdk = require("@defillama/sdk"); -const { default: BigNumber } = require("bignumber.js"); -const { toUSDTBalances } = require("../helper/balances"); const { getConfig } = require('../helper/cache') -const chain = "godwoken"; - -async function tvl(ts, _block, chainBlocks) { - const balances = {}; +async function tvl(api) { const tokensAndOwners = []; const poolInfo = await getConfig('stable-koi-v0', "https://app.stablekoi.com/lists/poollist.json"); poolInfo.forEach((pool) => { pool.tokens.forEach((token) => tokensAndOwners.push([token, pool.address])); }); - await sumTokens(balances, tokensAndOwners, chainBlocks[chain], chain); - return balances + return api.sumTokens({ tokensAndOwners }) } -async function tvl_v1(ts, _block, chainBlocks) { - const balances = {}; - const chain = "godwoken_v1"; +async function tvl_v1(api) { const tokensAndOwners = []; - // const poolInfo = await get('https://app-v1.stablekoi.com/api/pools'); v1Pools.forEach((pool) => { pool.tokens.forEach((token) => tokensAndOwners.push([token.address, pool.address])); }); - await sumTokens(balances, tokensAndOwners, chainBlocks[chain], chain); - return balances + return api.sumTokens({ tokensAndOwners }) } -const yokaiInfoAPI = - "https://www.yokaiswap.com/subgraphs/name/yokaiswap/exchange"; -async function fetchTokenPriceFromYokaiSwap(token) { - const graphQLClient = new GraphQLClient(yokaiInfoAPI); - - const query = gql` - query tokens { - tokens(where:{id:\"${token.toLowerCase()}\"}) { - derivedUSD - } - } - `; - - const data = await graphQLClient.request(query); - - return (data.tokens[0] || { derivedUSD: 0 }).derivedUSD; -} - -const koi = "0xd66eb642eE33837531FdA61eb7Ab15B15658BcaB"; -const koiStakingRewards = "0x9d7AACf560e493A7B0666d85BDE216d6d38Ec429"; -async function staking(ts, _block, chainBlocks) { - const [{ output: totalStakedKOI }, { output: koiDecimals }, koiPrice] = - await Promise.all([ - sdk.api.abi.call({ - abi: abi.totalSupply, - target: koiStakingRewards, - chain, - block: chainBlocks[chain], - }), - sdk.api.erc20.decimals(koi, chain), - fetchTokenPriceFromYokaiSwap(koi), - ]); - - return toUSDTBalances( - BigNumber(totalStakedKOI) - .multipliedBy(BigNumber(koiPrice)) - .dividedBy(BigNumber(10).pow(BigNumber(koiDecimals))) - .toFixed(0) - ); +async function staking(api) { + const koi = "0xd66eb642eE33837531FdA61eb7Ab15B15658BcaB"; + const koiStakingRewards = "0x9d7AACf560e493A7B0666d85BDE216d6d38Ec429"; + const totalStakedKOI = await api.call({ abi: 'erc20:totalSupply', target: koiStakingRewards }) + api.add(koi, totalStakedKOI) } module.exports = { @@ -82,65 +34,39 @@ module.exports = { tvl: tvl_v1, }, hallmarks: [ - [Math.floor(new Date('2022-08-26')/1e3), "Add godwoken v1 chain tvl"], + [Math.floor(new Date('2022-08-26') / 1e3), "Add godwoken v1 chain tvl"], ], } const v1Pools = [ { - "name": "USDC|eth↔USDC|bsc", "address": "0xB76B94bA69f0C2c556ee86F57e57F5F20A705d18", "tokens": [ { - "name": "USD Coin (Ethereum)", "address": "0x186181e225dc1Ad85a4A94164232bD261e351C33", }, - { - "symbol": "USDC|bsc", - "address": ADDRESSES.godwoken_v1.USDC_bsc, - } + { "address": ADDRESSES.godwoken_v1.USDC_bsc, } ] }, { - "name": "USDC|eth↔USDT|eth", "address": "0xA1F83F8F142c1069d33a898498AFEA6257387133", "tokens": [ - { - "symbol": "USDC|eth", - "address": "0x186181e225dc1Ad85a4A94164232bD261e351C33", - }, - { - "symbol": "USDT|eth", - "address": "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50", - } + { "address": "0x186181e225dc1Ad85a4A94164232bD261e351C33", }, + { "address": "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50", } ] }, { - "name": "USDT|eth↔USDT|bsc", "address": "0x2c13f5DB105C6ab13ba183Abb7c0CBe38bE45A92", "tokens": [ - { - "symbol": "USDT|eth", - "address": "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50", - }, - { - "symbol": "USDT|bsc", - "address": ADDRESSES.godwoken_v1.USDT_bsc, - } + { "address": "0x8E019acb11C7d17c26D334901fA2ac41C1f44d50", }, + { "address": ADDRESSES.godwoken_v1.USDT_bsc, } ] }, { - "name": "WBTC|eth↔BTCB|bsc", "address": "0x2360D9699dc82b684F986fBcc2ddf3Ab54Ff60dD", "tokens": [ - { - "symbol": "WBTC|eth", - "address": ADDRESSES.godwoken_v1.WBTC_eth, - }, - { - "symbol": "BTCB|bsc", - "address": ADDRESSES.godwoken_v1.BTCB_bsc, - } + { "address": ADDRESSES.godwoken_v1.WBTC_eth, }, + { "address": ADDRESSES.godwoken_v1.BTCB_bsc, } ] } ] \ No newline at end of file diff --git a/projects/stacker/index.js b/projects/stacker/index.js index b882d291df30..3174e77fed02 100644 --- a/projects/stacker/index.js +++ b/projects/stacker/index.js @@ -1,27 +1,17 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); - const vaults = [ - // farm, token used - ['0x067b9FE006E16f52BBf647aB6799f87566480D2c', ADDRESSES.ethereum.USDC], // USDC - ['0x70e51DFc7A9FC391995C2B2f027BC49D4fe01577', ADDRESSES.ethereum.WETH], // WETH - ['0x17E9ed51feD2F190D50f5bd4f1a8C9CbCd36162A', ADDRESSES.ethereum.WBTC], // WBTC + '0x067b9FE006E16f52BBf647aB6799f87566480D2c', + '0x70e51DFc7A9FC391995C2B2f027BC49D4fe01577', + '0x17E9ed51feD2F190D50f5bd4f1a8C9CbCd36162A', ] -async function tvl(timestamp, block, chainBlocks) { - const balances = {} - await Promise.all(vaults.map(async vault=>{ - const supply = await sdk.api.erc20.totalSupply({ - target: vault[0], - block - }) - sdk.util.sumSingleBalance(balances, vault[1], supply.output) - })) - return balances +async function tvl(api) { + const tokens = await api.multiCall({ abi: 'address:underlyingContract', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:totalUnderlying', calls: vaults}) + api.add(tokens, bals) } module.exports = { - ethereum:{ + ethereum: { tvl, }, } \ No newline at end of file diff --git a/projects/stader/index.js b/projects/stader/index.js index 487a7b159b73..c308d5ed1948 100644 --- a/projects/stader/index.js +++ b/projects/stader/index.js @@ -1,80 +1,44 @@ const { nullAddress, sumTokens2 } = require("../helper/unwrapLPs"); const { get } = require("../helper/http"); + +const 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' }; let _res; async function getData() { - if (!_res) _res = get("https://universe.staderlabs.com/common/tvl"); + if (!_res) _res = await get('https://universe.staderlabs.com/common/tvl', { headers }) return _res; } -async function hbarTvl(timestamp) { - const res = await get("https://universe.staderlabs.com/common/tvl"); - return { - "hedera-hashgraph": res.hedera.native, - }; +async function hbarTvl() { + const res = await get('https://universe.staderlabs.com/common/tvl', { headers }) + return { "hedera-hashgraph": res.hedera.native }; } async function maticTvl() { const res = await getData(); - return { - "matic-network": res.polygon.native, - }; -} - -async function terra2Tvl() { - const res = await getData(); - return { - "terra-luna-2": res.terra.native, - }; + return { "matic-network": res.polygon.native }; } async function bscTvl() { const res = await getData(); - return { - binancecoin: res.bnb.native, - }; -} - -async function nearTvl() { - const res = await getData(); - return { - near: res.near.native, - }; + return { binancecoin: res.bnb.native }; } async function ethTvl(api) { - return await api.call({ - abi: "uint256:totalAssets", - target: "0xcf5ea1b38380f6af39068375516daf40ed70d299", - }); + return await api.call({ abi: "uint256:totalAssets", target: "0xcf5ea1b38380f6af39068375516daf40ed70d299" }); } module.exports = { timetravel: false, - methodology: - "We aggregated the assets staked across Stader staking protocols", - /*terra: { - tvl, - },*/ - hedera: { - tvl: hbarTvl, - }, + methodology: "We aggregated the assets staked across Stader staking protocols", + /*terra: { tvl },*/ + hedera: { tvl: hbarTvl }, // its on ethereum because funds are locked there - /* ethereum: { - tvl: maticTvl - }, */ - fantom: { - tvl: () => ({}), - }, - terra2: { - tvl: terra2Tvl, - }, - bsc: { - tvl: bscTvl, - }, - near: { - tvl: nearTvl, - }, + // ethereum: { tvl: maticTvl }, + fantom: { tvl: () => ({}) }, + terra2: { tvl: () => ({}) }, + bsc: { tvl: bscTvl }, + near: { tvl: () => ({}) }, ethereum: { tvl: async (api) => { const res = await getData(); diff --git a/projects/stake-ly/index.js b/projects/stake-ly/index.js index 6f0f46927cb4..cb3098ab7b1d 100644 --- a/projects/stake-ly/index.js +++ b/projects/stake-ly/index.js @@ -1,23 +1,11 @@ -const sdk = require("@defillama/sdk"); - -async function tvl(timestamp, _ethBlock, {klaytn: block}) { - const chain = "klaytn"; +async function tvl(api) { const stKlayAddress = "0xF80F2b22932fCEC6189b9153aA18662b15CC9C00" - - const pooledKlay = await sdk.api.abi.call({ - block, - chain, - target: stKlayAddress, - abi: "uint256:totalStaking", - }); - - return { - "klay-token": Number(pooledKlay.output) / 1e18, - }; + const pooledKlay = await api.call({ abi: 'uint256:totalStaking', target: stKlayAddress }) + api.addGasToken(pooledKlay) } module.exports = { - methodology: + methodology: "TVL is KLAY staked by the users and rewards accrued from node staking", start: 1663585837, klaytn: { diff --git a/projects/stake1/abi.json b/projects/stake1/abi.json deleted file mode 100644 index 02e2ecaf6fbb..000000000000 --- a/projects/stake1/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "see_s1ftm_circ": "uint256:see_s1ftm_circ", - "see_s1tomb_circ": "uint256:see_s1tomb_circ" -} \ No newline at end of file diff --git a/projects/stake1/contracts.json b/projects/stake1/contracts.json deleted file mode 100644 index cd3fd57c28dc..000000000000 --- a/projects/stake1/contracts.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "ftmVault": "0x3d2fa78f5e1aa2e7f29c965d0e22b32b8d5f14a9", - "tombVault": "0xA222fb9D2A811FAb3B334a5a9FA573C11fee73c1", - "avaxVault": "0x1689D5C5866909569a98B35da6A24090e4931C17", - "ethVault": "0xf9448f9a932474B5cAd9F05b86EA12376f2Fd770", - "Collateral": "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", - "FTM": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", - "AVAX": "fantom:0x511D35c52a3C244E7b8bd92c0C297755FbD89212", - "TOMB": "fantom:0x6c021ae822bea943b2e66552bde1d2696a53fbb7", - "WETH": "fantom:0x74b23882a30290451A17c44f4F05243b6b58C76d", - "DAI": "fantom:0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", - "pool2": "0x56995c729296c634cA367F8F3e5E5dEFF30D4511", - "daiPool2": "0x629670EAA62952990dd5b0658Ab6c6296fE2111b", - "ftmPool2": "0x4bd9B32677821939937FaDaEb30858806578339c" -} diff --git a/projects/stake1/index.js b/projects/stake1/index.js index e2dff3197879..57d2b22512fd 100644 --- a/projects/stake1/index.js +++ b/projects/stake1/index.js @@ -1,70 +1,29 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const contracts = require("./contracts.json"); -const { staking } = require("../helper/staking"); - -async function vaultTvl(balances, block, abi, target, coin) { - const ftmStaked = ((await sdk.api.abi.call({ - chain: 'fantom', - block, - target, - abi, - })).output); - - sdk.util.sumSingleBalance(balances, coin, ftmStaked); +const ADDRESSES = require('../helper/coreAssets.json') +const contracts = { + "ftmVault": "0x3d2fa78f5e1aa2e7f29c965d0e22b32b8d5f14a9", + "tombVault": "0xA222fb9D2A811FAb3B334a5a9FA573C11fee73c1", + "avaxVault": "0x1689D5C5866909569a98B35da6A24090e4931C17", + "ethVault": "0xf9448f9a932474B5cAd9F05b86EA12376f2Fd770", + "pool2": "0x56995c729296c634cA367F8F3e5E5dEFF30D4511", + "daiPool2": "0x629670EAA62952990dd5b0658Ab6c6296fE2111b", + "ftmPool2": "0x4bd9B32677821939937FaDaEb30858806578339c" } -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - await vaultTvl( - balances, - chainBlocks.fantom, - abi.see_s1ftm_circ, - contracts.ftmVault, - contracts.FTM - ); - await vaultTvl( - balances, - chainBlocks.fantom, - abi.see_s1ftm_circ, - contracts.ethVault, - contracts.WETH - ); - await vaultTvl( - balances, - chainBlocks.fantom, - abi.see_s1tomb_circ, - contracts.avaxVault, - contracts.AVAX - ); - await vaultTvl( - balances, - chainBlocks.fantom, - abi.see_s1tomb_circ, - contracts.tombVault, - contracts.TOMB - ); - - const daiBalances = (await sdk.api.abi.multiCall({ - chain: 'fantom', - block: chainBlocks.fantom, - calls: [ - contracts.ftmVault, - contracts.ethVault, - contracts.avaxVault, - contracts.tombVault - ].map((v) => ({ - target: contracts.Collateral, - params: [v], - })), - abi: 'erc20:balanceOf' - })).output - .map(b => b.output) - .reduce((acc, el) => Number(acc) + Number(el), 0); - - sdk.util.sumSingleBalance(balances, contracts.DAI, daiBalances); +const { staking } = require("../helper/staking"); - return balances; +async function tvl(api) { + return api.sumTokens({ + tokensAndOwners: [ + [ADDRESSES.fantom.WFTM, contracts.ftmVault], + ['0x74b23882a30290451A17c44f4F05243b6b58C76d', contracts.ethVault], + ['0x511D35c52a3C244E7b8bd92c0C297755FbD89212', contracts.avaxVault], + ['0x6c021ae822bea943b2e66552bde1d2696a53fbb7', contracts.tombVault], + [ADDRESSES.fantom.DAI, contracts.ftmVault], + [ADDRESSES.fantom.DAI, contracts.ethVault], + [ADDRESSES.fantom.DAI, contracts.avaxVault], + [ADDRESSES.fantom.DAI, contracts.tombVault], + ] + }) } module.exports = { @@ -72,9 +31,8 @@ module.exports = { tvl, // hitting pool2 staking contract twice while stake1 isnt on coingecko pool2: staking( - [contracts.pool2, contracts.pool2], + [contracts.pool2], [contracts.daiPool2, contracts.ftmPool2], - 'fantom' ) } }; // node test.js projects/stake1/index.js diff --git a/projects/stakedicp/index.js b/projects/stakedicp/index.js index 1f9728e2c097..54a68c79086f 100644 --- a/projects/stakedicp/index.js +++ b/projects/stakedicp/index.js @@ -1,4 +1,3 @@ -const BigNumber = require("bignumber.js"); const { get } = require("../helper/http"); const url = 'https://h6uvl-xiaaa-aaaap-qaawa-cai.raw.ic0.app/tvl'; @@ -10,7 +9,7 @@ async function tvl(_timestamp, _block) { throw new Error("Unknown"); } return { - "coingecko:internet-computer": BigNumber(tvl).div(1e8).toFixed(0), + "coingecko:internet-computer": tvl/1e8, }; } diff --git a/projects/stakeease/index.js b/projects/stakeease/index.js new file mode 100644 index 000000000000..9c914a3e6e97 --- /dev/null +++ b/projects/stakeease/index.js @@ -0,0 +1,16 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs") + +const SX_ETH_VAULT = "0x466B447D68112090ea46a98E15f22da44f87AF7F" + +module.exports = { + ethereum: { + tvl: sumTokensExport({ owner: SX_ETH_VAULT, tokens: [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.EETH, + '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110', + '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', + '0xA1290d69c65A6Fe4DF752f95823fae25cB99e5A7', + ]}), + } +}; diff --git a/projects/stakestone-btc/index.js b/projects/stakestone-btc/index.js new file mode 100644 index 000000000000..1a0bf4984b5f --- /dev/null +++ b/projects/stakestone-btc/index.js @@ -0,0 +1,26 @@ +const vaultABI = { + "getDepositAmounts": "function getDepositAmounts() view returns (address[], uint256[])" +} + +const VaultBSC = '0x3aa0670E24Cb122e1d5307Ed74b0c44d619aFF9b'; +const VaultETH = '0x7dBAC0aA440A25D7FB43951f7b178FF7A809108D'; + +const bscTvl = async (api) => { + const [btclist] = await api.call({ abi: vaultABI.getDepositAmounts, target: VaultBSC }) + return api.sumTokens({ owner: VaultBSC, tokens: btclist }) +} + +const ethTvl = async (api) => { + const [btclist] = await api.call({ abi: vaultABI.getDepositAmounts, target: VaultETH }) + return api.sumTokens({ owner: VaultETH, tokens: btclist }) +} + +module.exports = { + start: 42326440, + bsc: { + tvl: bscTvl, + }, + ethereum: { + tvl: ethTvl, + } +} diff --git a/projects/stakewise-v3/index.js b/projects/stakewise-v3/index.js new file mode 100644 index 000000000000..901bf64db1e5 --- /dev/null +++ b/projects/stakewise-v3/index.js @@ -0,0 +1,22 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); + +async function xdaiTvl(timestamp, ethBlock, { xdai: block }) { + const chain = "xdai" + const supply = await sdk.api.erc20.totalSupply({ + target: '0xF490c80aAE5f2616d3e3BDa2483E30C4CB21d1A0', + block, + chain + }) + + return { + [ADDRESSES.ethereum.GNO]: supply.output + } +} + +module.exports = { + methodology: 'Counts coins staked', + xdai:{ + tvl: xdaiTvl + } +} diff --git a/projects/standcash/index.js b/projects/standcash/index.js index 62665eeb70ea..d152d50ce012 100644 --- a/projects/standcash/index.js +++ b/projects/standcash/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { sumTokens2 } = require("../helper/unwrapLPs"); const boardroomContracts = "0x7F28D5a90b3A0BE2e34accDEF255eC13cf695b1e"; const SAS = "0x4c38d0e726b6c86f64c1b281348e725973542043"; @@ -52,29 +52,8 @@ const tokenAddresses = [ "0xE95A203B1a91a908F9B9CE46459d101078c2c3cb", ]; -async function pool2() { - const balances = {}; - - for (let i = 0; i < lpStakingContracts.length; i++) { - await sumTokensAndLPsSharedOwners( - balances, - [[lpAddresses[i], true]], - [lpStakingContracts[i]] - ); - } - - for (let i = 0; i < poolContracts.length; i++) { - await sumTokensAndLPsSharedOwners( - balances, - [ - [tokenAddresses[i], false], - [SAC, false], - ], - [poolContracts[i]] - ); - } - - return balances; +async function pool2(api) { + return sumTokens2({ api, owners: poolContracts.concat(lpStakingContracts), tokens: [...tokenAddresses, SAC, ...lpAddresses], resolveLP: true }) } module.exports = { @@ -82,7 +61,7 @@ module.exports = { ethereum: { staking: stakings(stakingContracts, SAS), pool2: pool2, - tvl: (tvl) => ({}), + tvl: () => ({}), }, methodology: "Counts liquidty on the Staking and Pool2 Only", }; diff --git a/projects/stargatefinance-v2/index.js b/projects/stargatefinance-v2/index.js index a06659ce58e8..cff96fe32721 100644 --- a/projects/stargatefinance-v2/index.js +++ b/projects/stargatefinance-v2/index.js @@ -83,6 +83,12 @@ const CONFIG = { '0x81F6138153d473E8c5EcebD3DC8Cd4903506B075', ], }, + sei: { + pools: [ + '0x45d417612e177672958dC0537C45a8f8d754Ac2E', //usdc pool + '0x0dB9afb4C33be43a0a0e396Fd1383B4ea97aB10a' + ], + }, } const createTvlFunction = (pools) => { diff --git a/projects/stargatefinance/index.js b/projects/stargatefinance/index.js index 3abc684a85e3..273babb7ad32 100644 --- a/projects/stargatefinance/index.js +++ b/projects/stargatefinance/index.js @@ -63,11 +63,12 @@ const CONFIG = { module.exports = { goerli: { - tvl: async (api) => { - return { - [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: '0xdD69DB25F6D620A7baD3023c5d32761D353D3De9', params: ['0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b'], }), - } - }, + tvl: () => ({}) + // tvl: async (api) => { + // return { + // [ADDRESSES.ethereum.WETH]: await api.call({ abi: 'erc20:balanceOf', target: '0xdD69DB25F6D620A7baD3023c5d32761D353D3De9', params: ['0x88124ef4a9ec47e691f254f2e8e348fd1e341e9b'], }), + // } + // }, }, } diff --git a/projects/starswap-starcoin/index.js b/projects/starswap-starcoin/index.js index ffc84f98a4f2..7c1a82d5a95b 100644 --- a/projects/starswap-starcoin/index.js +++ b/projects/starswap-starcoin/index.js @@ -18,7 +18,6 @@ module.exports = { methodology: `Starswap's TVL is achieved by making a call to it's API: https://swap-api.starcoin.org/main/v1/farmingTvlInUsd (Farming) and https://swap-api.starcoin.org/main/v1/syrupPoolTvlInUsd (Stake).`, misrepresentedTokens: true, timetravel: false, - incentivized: true, starcoin: { tvl, staking, diff --git a/projects/steakHut-lb/index.js b/projects/steakHut-lb/index.js index c1150bedcf04..2fd3a0043f77 100644 --- a/projects/steakHut-lb/index.js +++ b/projects/steakHut-lb/index.js @@ -33,6 +33,17 @@ const _vaults = { } async function tvl(api) { + //function to grab the tvl of enigma pools + async function fetchEnigmaData(factoryAddress) { + const enigmas = await api.fetchList({ lengthAbi: 'enigmaPositionNumber', itemAbi: 'enigmaAtIndex', target: factoryAddress }) + const token0s = await api.multiCall({ abi: 'address:token0', calls: enigmas }) + const token1s = await api.multiCall({ abi: 'address:token1', calls: enigmas }) + const bals = await api.multiCall({ abi: 'function getTotalAmounts() view returns (uint256 bal0, uint256 bal1)', calls: enigmas }) + bals.forEach(({ bal0, bal1 }, i) => { + api.add(token0s[i], bal0) + api.add(token1s[i], bal1) + }) + } //get the total shares from all vaults const vaults = _vaults[api.chain] const depositTokens = await api.multiCall({ abi: abi.want, calls: vaults }) @@ -61,15 +72,14 @@ async function tvl(api) { api.add(JOE_ADDRESS, await api.call({ target: HJOE_ADDRESS, abi: 'erc20:totalSupply' })) // engima tvl + const enigmaFactory_AVAX = `0xD751E0940CfadC35f84e60075d0f940a2545FB8d`; - const enigmas = await api.fetchList({ lengthAbi: 'enigmaPositionNumber', itemAbi: 'enigmaAtIndex', target: enigmaFactory_AVAX }) - const token0s = await api.multiCall({ abi: 'address:token0', calls: enigmas }) - const token1s = await api.multiCall({ abi: 'address:token1', calls: enigmas }) - const bals = await api.multiCall({ abi: 'function getTotalAmounts() view returns (uint256 bal0, uint256 bal1)', calls: enigmas }) - bals.forEach(({ bal0, bal1 }, i) => { - api.add(token0s[i], bal0) - api.add(token1s[i], bal1) - }) + const enigmaFactory_AVAX_PHAR = `0x653b809a4fa6ba0fc0a6dc1b3f92a362fcb6086d`; // Example BSC address + + // Fetch data for both factories + await fetchEnigmaData(enigmaFactory_AVAX); + await fetchEnigmaData(enigmaFactory_AVAX_PHAR); + } } diff --git a/projects/steakbank/abis.json b/projects/steakbank/abis.json deleted file mode 100644 index 7396c21e80b4..000000000000 --- a/projects/steakbank/abis.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lbnbMarketCapacityCountByBNB": "uint256:lbnbMarketCapacityCountByBNB" -} \ No newline at end of file diff --git a/projects/steakbank/index.js b/projects/steakbank/index.js index 9a4f7c52c8f8..c7a004d2cd7e 100644 --- a/projects/steakbank/index.js +++ b/projects/steakbank/index.js @@ -1,20 +1,8 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const abis = require('./abis.json') - const stakingContract = "0x79DB0dAa012F4b98F332A9D45c80A1A3FFaa6f9a" -const wbnb = "bsc:" + ADDRESSES.bsc.WBNB -async function tvl(timestamp, ethBlock, chainBlocks){ - const stakedBNB = await sdk.api.abi.call({ - target: stakingContract, - abi: abis.lbnbMarketCapacityCountByBNB, - block: chainBlocks['bsc'], - chain: 'bsc' - }) - return { - [wbnb]:stakedBNB.output - } +async function tvl(api){ + const staked = await api.call({ abi: "uint256:lbnbMarketCapacityCountByBNB", target: stakingContract}) + api.addGasToken(staked) } module.exports = { diff --git a/projects/steer/index.js b/projects/steer/index.js index 0f1e897d6f0d..32ad3085db13 100644 --- a/projects/steer/index.js +++ b/projects/steer/index.js @@ -60,7 +60,7 @@ const supportedChains = [ }, { name: 'Linea', - subgraphEndpoint: 'https://subgraph.steer.finance/linea/subgraphs/name/steerprotocol/steer-linea', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-linea/1.1.2/gn', chainId: 59144, identifier: 'linea' }, @@ -84,7 +84,7 @@ const supportedChains = [ }, { name: 'Scroll', - subgraphEndpoint: 'https://subgraph.steer.finance/scroll/subgraphs/name/steerprotocol/steer-scroll', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-scroll/1.1.1/gn', chainId: 534352, identifier: 'scroll' }, @@ -106,12 +106,6 @@ const supportedChains = [ chainId: 250, identifier: 'fantom' }, - // { - // name: 'Flare', - // subgraphEndpoint: '', - // chainId: 14, - // identifier: 'flare' - // }, { name: 'Blast', subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-blast/1.1.1/gn', @@ -126,7 +120,7 @@ const supportedChains = [ }, { name: 'AstarzkEVM', - subgraphEndpoint: 'https://subgraph.steer.finance/astarzkevm/subgraphs/name/steerprotocol/steer-astarzkevm', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-astar-zkevm/1.1.1/gn', chainId: 3776, identifier: 'astrzk' }, @@ -148,13 +142,42 @@ const supportedChains = [ chainId: 30, identifier: 'rsk' }, - + { + name: 'Celo', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-celo/1.1.1/gn', + chainId: 42220, + identifier: 'celo' + }, + { + name: 'ZklinkNova', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-zklink-nova/1.0.1/gn', + chainId: 810180, + identifier: 'zklink' + }, + { + name: 'Flare', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-flare/1.1.1/gn', + chainId: 14, + identifier: 'flare' + }, + { + name: 'ApeChain', + subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-apechain/1.1.1/gn', + chainId: 33139, + identifier: 'apechain' + }, // { - // name: 'Celo', - // subgraphEndpoint: 'https://subgraph-proxy-server-xf2uthetka-as.a.run.app/gateway-arbitrum/BPaFHyfVrhv3pdjGodpQcWggAg1Bcrvc9SFc2t2BXeho', - // chainId: 42220, - // identifier: 'celo' + // name: 'Bittorrent', + // subgraphEndpoint: 'https://api.goldsky.com/api/public/project_clohj3ta78ok12nzs5m8yag0b/subgraphs/steer-protocol-btt/1.1.1/gn', + // chainId: 199, + // identifier: 'bittorrent' // }, + { + name: 'Filecoin', + subgraphEndpoint: 'https://fil.subgraph.laconic.com/v1/steer-protocol/iRoheeEh2g6CdZ9OnunLwNCFHG8a7TAdtIYNNxboRSKVxgZfjq', + chainId: 314, + identifier: 'filecoin' + }, ] // Fetch active vaults and associated data @todo limited to 1000 per chain @@ -189,7 +212,8 @@ module.exports.arbitrum.staking = stakings( "0xaCdC6fC8F84fbA26f065489a7bf5837D7CDf546F", "0xff46e1B60dD9De89Aa04902D5c3c5ca01f8576A4", "0x1E6a358a1721e0D2B84f39FD328FC03A1b6e863B", - "0x3338B85fB1607C519962571B67061e02408475Bb" + "0x3338B85fB1607C519962571B67061e02408475Bb", + "0x6519A921d0E6F06524eff5DF976abc9A3ABF36cF" ], "0x1C43D05be7E5b54D506e3DdB6f0305e8A66CD04e", "arbitrum" diff --git a/projects/ston/index.js b/projects/ston/index.js index ea4db669f8ad..88664defbdca 100644 --- a/projects/ston/index.js +++ b/projects/ston/index.js @@ -1,4 +1,4 @@ -const { post } = require('../helper/http') +const { get } = require('../helper/http') const { transformDexBalances } = require('../helper/portedTokens') const sdk = require('@defillama/sdk') @@ -7,12 +7,11 @@ module.exports = { timetravel: false, ton: { tvl: async () => { - const { result: {pools}} = await post('https://app.ston.fi/rpc', {"jsonrpc":"2.0","id":2,"method":"pool.list","params":{}}) - sdk.log(pools.length) + const result = await get("https://api.ston.fi/v1/pools?dex_v2=true") return transformDexBalances({ chain: 'ton', - data: pools.map(i => ({ + data: result.pool_list.map(i => ({ token0: i.token0_address, token1: i.token1_address, token0Bal: i.reserve0, diff --git a/projects/stormtrade/index.js b/projects/stormtrade/index.js index 2e1eda396769..29a9b0ff2f85 100644 --- a/projects/stormtrade/index.js +++ b/projects/stormtrade/index.js @@ -11,9 +11,9 @@ module.exports = { 'EQDynReiCeK8xlKRbYArpp4jyzZuF6-tYfhFM0O5ulOs5H0L', // jUSDT vault 'EQDpJnZP89Jyxz3euDaXXFUhwCWtaOeRmiUJTi3jGYgF8fnj', // TON-M vault 'EQAz6ehNfL7_8NI7OVh1Qg46HsuC4kFpK-icfqK9J3Frd6CJ', // USDT vault - 'EQBwfRtqEf3ZzhkeGsmXiC7hzTh1C5zZZzLgDH5VL8gENQ2A' // Notcoin pre-market vault + 'EQAG8_BzwlWkmqb9zImr9RJjjgZZCLMOQXP9PR0B1PYHvfSS', // Notcoin vault ], - tokens: [ADDRESSES.ton.jUSDT, ADDRESSES.ton.USDT, ADDRESSES.ton.TON] + tokens: [ADDRESSES.ton.jUSDT, ADDRESSES.ton.USDT, ADDRESSES.ton.TON, ADDRESSES.ton.NOT] }) ) } diff --git a/projects/strategyx-finance/index.js b/projects/strategyx-finance/index.js index d097ce4f1942..f0da70c8f19e 100644 --- a/projects/strategyx-finance/index.js +++ b/projects/strategyx-finance/index.js @@ -6,4 +6,5 @@ module.exports = { hallmarks: [ [1658370720, "Rug pull"] ], + deadFrom: 1658370720 }; diff --git a/projects/stride/index.js b/projects/stride/index.js index ff146d5dab91..da125f6422fe 100644 --- a/projects/stride/index.js +++ b/projects/stride/index.js @@ -85,6 +85,12 @@ const chains = { denom: "aISLM", coinGeckoId: "islamic-coin", }, + + band: { + chainId: "laozi-mainnet", + denom: "uband", + coinGeckoId: "band-protocol", + } }; // inj uses 1e18 - https://docs.injective.network/learn/basic-concepts/inj_coin#base-denomination diff --git a/projects/strike/index.js b/projects/strike/index.js index 40f8308780bc..680fd0ef71b4 100644 --- a/projects/strike/index.js +++ b/projects/strike/index.js @@ -1,6 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {fullCoumpoundExports} = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound'); -const comptroller = "0xe2e17b2CBbf48211FA7eB8A875360e5e39bA2602" - -module.exports=fullCoumpoundExports(comptroller, "ethereum", "0xbEe9Cf658702527b0AcB2719c1FAA29EdC006a92", ADDRESSES.ethereum.WETH) \ No newline at end of file +module.exports.ethereum = compoundExports2({ comptroller: '0xe2e17b2CBbf48211FA7eB8A875360e5e39bA2602', cether: '0xbee9cf658702527b0acb2719c1faa29edc006a92' }) diff --git a/projects/strkfarm/erc4626.js b/projects/strkfarm/erc4626.js new file mode 100644 index 000000000000..d166b787bbaa --- /dev/null +++ b/projects/strkfarm/erc4626.js @@ -0,0 +1,48 @@ +const ERC4626Abi = [ + { + "name": "asset", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "state_mutability": "view" + }, + { + "name": "balanceOf", + "type": "function", + "inputs": [ + { + "name": "account", + "type": "core::starknet::contract_address::ContractAddress" + } + ], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view", + "customInput": 'address', + }, + { + "name": "total_assets", + "type": "function", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + } +] + +const ERC4626AbiMap = {} +ERC4626Abi.forEach(i => ERC4626AbiMap[i.name] = i) + +module.exports = { + ERC4626AbiMap +} \ No newline at end of file diff --git a/projects/strkfarm/index.js b/projects/strkfarm/index.js new file mode 100644 index 000000000000..40145a0d99b7 --- /dev/null +++ b/projects/strkfarm/index.js @@ -0,0 +1,88 @@ +/** + * STRKFarm is a yield aggregator and strategy builder on Starknet + * - We use various DeFi protocols on starknet to design yield strategies + */ + +const { multiCall } = require("../helper/chain/starknet"); +const ADDRESSES = require('../helper/coreAssets.json'); +const { ERC4626AbiMap } = require('./erc4626'); +const { ERC721StratAbiMap } = require('./sensei'); + +const STRATEGIES = { + "AutoCompounding": [{ // auto-compounds user tokens (e.g. STRK) by investing in zkLend + address: "0x00541681b9ad63dff1b35f79c78d8477f64857de29a27902f7298f7b620838ea", // STRK Auto-compounding + token: ADDRESSES.starknet.STRK + }, { + address: "0x016912b22d5696e95ffde888ede4bd69fbbc60c5f873082857a47c543172694f", // USDC Auto-compounding + token: ADDRESSES.starknet.USDC + }], + "Sensei": [{ // strategy using delta neutral looping across zklend and nostra protocols + address: "0x020d5fc4c9df4f943ebb36078e703369c04176ed00accf290e8295b659d2cea6", // STRK Sensei + token: ADDRESSES.starknet.STRK, + zToken: '0x06d8fa671ef84f791b7f601fa79fea8f6ceb70b5fa84189e3159d532162efc21' + }, { + address: "0x04937b58e05a3a2477402d1f74e66686f58a61a5070fcc6f694fb9a0b3bae422", + token: ADDRESSES.starknet.USDC, // USDC Sensei + zToken: '0x047ad51726d891f972e74e4ad858a261b43869f7126ce7436ee0b2529a98f486' + }, { + address: "0x9d23d9b1fa0db8c9d75a1df924c3820e594fc4ab1475695889286f3f6df250", + token: ADDRESSES.starknet.ETH, // ETH Sensei + zToken: '0x1b5bd713e72fdc5d63ffd83762f81297f6175a5e0a4771cdadbc1dd5fe72cb1' + }, { + address: "0x9140757f8fb5748379be582be39d6daf704cc3a0408882c0d57981a885eed9", + token: ADDRESSES.starknet.ETH, // ETH Sensei XL + zToken: '0x057146f6409deb4c9fa12866915dd952aa07c1eb2752e451d7f3b042086bdeb8' + }] +} + +// returns tvl and token of the AutoCompounding strategies +async function computeAutoCompoundingTVL(api) { + const contracts = STRATEGIES.AutoCompounding; + // though these will be zToken (i.e. zkLend token, e.g. zUSDC), + // according to zkLend, 1zToken = 1 underlying token + // so, 1 zSTRK == 1 STRK, 1 zUSDC == 1 USDC + const totalAssets = await multiCall({ + calls: contracts.map(c => c.address), + abi: ERC4626AbiMap.total_assets + }); + + api.addTokens(contracts.map(c => c.token), totalAssets); +} + +// returns tvl and token of the Sensei strategies +async function computeSenseiTVL(api) { + // Sensei strategies contain multiple LP tokens in each contract bcz of looping and borrow, + // but we only consider the zToken bal divided by a factor (to offset looping) as TVL + // - This is bcz any deposit by user first gets deposited into zkLend for zToken + const contracts = STRATEGIES.Sensei; + const settings = await multiCall({ + calls: contracts.map(c => c.address), + abi: ERC721StratAbiMap.get_settings + }); + + const DENOMINATOR_FACTOR = 1000000n; + const offsetFactors = settings.map(s => s.coefs_sum2); // The factor is in 10**6 terms + const balances = await multiCall({ + calls: contracts.map(c => ({ + target: c.zToken, + params: c.address, + })), + abi: ERC4626AbiMap.balanceOf + }); + + const adjustedBalances = balances.map((b, i) => (b * DENOMINATOR_FACTOR) / (DENOMINATOR_FACTOR + BigInt(offsetFactors[i]))); + api.addTokens(contracts.map(c => c.token), adjustedBalances); +} + +async function tvl(api) { + await computeAutoCompoundingTVL(api); + await computeSenseiTVL(api); +} + +module.exports = { + doublecounted: true, + methodology: "The TVL is calculated as a sum of total assets deposited into strategies", + starknet: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/strkfarm/sensei.js b/projects/strkfarm/sensei.js new file mode 100644 index 000000000000..fcd8f18beb76 --- /dev/null +++ b/projects/strkfarm/sensei.js @@ -0,0 +1,41 @@ +const ERC721StratAbi = [ + { + "name": "get_settings", + "type": "function", + "inputs": [], + "outputs": [ + { + "name": "fee_percent", + "type": "core::integer::u128" + }, + { + "name": "fee_receiver", + "type": "core::starknet::contract_address::ContractAddress" + }, + { + "name": "min_health_factor", + "type": "core::integer::u32" + }, + { + "name": "target_health_factor", + "type": "core::integer::u32" + }, + { + "name": "coefs_sum1", + "type": "core::integer::u128" + }, + { + "name": "coefs_sum2", + "type": "core::integer::u128" + } + ], + "state_mutability": "view" + } +] + +const ERC721StratAbiMap = {} +ERC721StratAbi.forEach(i => ERC721StratAbiMap[i.name] = i) + +module.exports = { + ERC721StratAbiMap +} \ No newline at end of file diff --git a/projects/strudel.js b/projects/strudel.js index bb5eda5226c3..98b70a04e914 100644 --- a/projects/strudel.js +++ b/projects/strudel.js @@ -1,11 +1,4 @@ -const sdk = require('@defillama/sdk') - -async function tvl(ts, block) { - return { - 'bitcoin': (await sdk.api.erc20.totalSupply({ target: '0xe1406825186D63980fd6e2eC61888f7B91C4bAe4', block })).output / 1e18 - } -} - module.exports = { - ethereum: { tvl }, + ethereum: { tvl: () => ({}) }, + // deadFrom: "2022-02-31", } diff --git a/projects/suibridge/index.js b/projects/suibridge/index.js new file mode 100644 index 000000000000..ba97a7bc1622 --- /dev/null +++ b/projects/suibridge/index.js @@ -0,0 +1,12 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owner: "0x312e67b47A2A29AE200184949093D92369F80B53", + fetchCoValentTokens: true, + permitFailure: true + }), + }, +}; \ No newline at end of file diff --git a/projects/suidollar/index.js b/projects/suidollar/index.js new file mode 100644 index 000000000000..5802b948d0c8 --- /dev/null +++ b/projects/suidollar/index.js @@ -0,0 +1,57 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sui = require("../helper/chain/sui"); + +const EVENT_TYPES = { + DEPOSIT: "0xe8087c2b86351ce15e8d72e83a39c5772c0b1d054015ae9671305e686cef5034::suidollar::Deposit", + WITHDRAW: "0xe8087c2b86351ce15e8d72e83a39c5772c0b1d054015ae9671305e686cef5034::suidollar::Withdraw" +}; + +async function getAllEvents(eventType) { + let hasMore = true; + let cursor = null; + let allEvents = []; + + while (hasMore) { + const events = await sui.queryEvents({ + eventType, + transform: i => i, + cursor, + limit: 50 + }); + + if (Array.isArray(events) && events.length > 0) { + allEvents = allEvents.concat(events); + } + + if (events.hasNextPage && events.nextCursor) { + cursor = events.nextCursor; + } else { + hasMore = false; + } + } + + return allEvents.map(event => eventType === EVENT_TYPES.DEPOSIT ? event.deposit_amount : event.amount) + .filter(amount => amount !== undefined); +} + +async function tvl(api) { + const deposits = await getAllEvents(EVENT_TYPES.DEPOSIT); + const withdraws = await getAllEvents(EVENT_TYPES.WITHDRAW); + + let totalBalance = 0n; + + deposits.forEach(amount => amount && (totalBalance += BigInt(amount))); + withdraws.forEach(amount => amount && (totalBalance -= BigInt(amount))); + + api.add(ADDRESSES.sui.USDC_CIRCLE, totalBalance); + + return api.getBalances(); +} + +module.exports = { + timetravel: false, + sui: { + tvl + }, + methodology: "Calculates TVL by tracking deposit and withdrawal events" +} \ No newline at end of file diff --git a/projects/suimarket/index.js b/projects/suimarket/index.js new file mode 100644 index 000000000000..23879551e91b --- /dev/null +++ b/projects/suimarket/index.js @@ -0,0 +1,20 @@ +const { queryEventsByType, getObjects, } = require('../helper/chain/sui') + +async function tvl(api) { + const eventType = '0xb61e324fa43746f5c24b2db3362afb382b644b32bce39a53f1f796a0109828e0::suimarket::EventCreated' + let events = await queryEventsByType({ eventType, transform: i => i.event_id }) + events = await getObjects(events) + + events.forEach(object => { + const coin = object.type.split('<')[1].replace('>', '') + const amount = object.fields.total_base_coin + api.add(coin, amount) + }) +} + +module.exports = { + timetravel: false, + sui: { + tvl + }, +} diff --git a/projects/sumer/index.js b/projects/sumer/index.js index aaf4cf6016e3..9170858fb42b 100644 --- a/projects/sumer/index.js +++ b/projects/sumer/index.js @@ -5,4 +5,6 @@ module.exports = { base: compoundExports2({ comptroller: '0x611375907733D9576907E125Fb29704712F0BAfA' }), arbitrum: compoundExports2({ comptroller: '0xBfb69860C91A22A2287df1Ff3Cdf0476c5aab24A' }), ethereum: compoundExports2({ comptroller: '0x60A4570bE892fb41280eDFE9DB75e1a62C70456F' }), + zklink: compoundExports2({ comptroller: '0xe6099D924efEf37845867D45E3362731EaF8A98D' }), + bsquared: compoundExports2({ comptroller: '0xdD9C863197df28f47721107f94eb031b548B5e48' }), } \ No newline at end of file diff --git a/projects/summitdefi/abi.json b/projects/summitdefi/abi.json deleted file mode 100644 index 8c164f4dfb00..000000000000 --- a/projects/summitdefi/abi.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "getPools": "address[]:getPools", - "tokensWithAllocation": "address[]:tokensWithAllocation", - "supply": "function supply(address _token) view returns (uint256)", - "getVault": "address:getVault", - "getPoolId": "function getPoolId() view returns (bytes32)", - "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" -} \ No newline at end of file diff --git a/projects/summitdefi/index.js b/projects/summitdefi/index.js index 2d3b40002ba9..e9aa08a5c299 100644 --- a/projects/summitdefi/index.js +++ b/projects/summitdefi/index.js @@ -1,8 +1,13 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { unwrapUniswapLPs } = require("../helper/unwrapLPs"); -const abi = require("./abi.json"); -const { BigNumber } = require("bignumber.js"); +const abi = { + "getPools": "address[]:getPools", + "tokensWithAllocation": "address[]:tokensWithAllocation", + "supply": "function supply(address _token) view returns (uint256)", + "getVault": "address:getVault", + "getPoolId": "function getPoolId() view returns (bytes32)", + "getPoolTokens": "function getPoolTokens(bytes32 poolId) view returns (address[] tokens, uint256[] balances, uint256 lastChangeBlock)" +} +const { staking } = require('../helper/staking'); +const { sumTokens2 } = require('../helper/unwrapLPs'); const summit = "0x0ddb88e14494546d07fcd94c3f0ef6d3296b1cd7"; const everest = "0xc687806cfd11b5330d7c3ae6f18b18dc71e1083e"; @@ -11,157 +16,28 @@ const cartplains = "0x1805922e7f82fc9dbad8e2435c146ba605c4a25d"; const cartmesa = "0x64f8a1dbc20f132159605ad8d7111e75ea702358"; const cartsummit = "0x93af6a3882aaf4112fc404e30277b39452f44cf6"; -const beethovenAddresses = [ - "0xcde5a11a4acb4ee4c805352cec57e236bdbc3837", - "0xd47d2791d3b46f9452709fa41855a045304d6f9d", - "0xcdf68a4d525ba2e90fe959c74330430a5a6b8226", - "0x9af1f0e9ac9c844a4a4439d446c1437807183075" -] - -async function getCarttvl(balances, block, cart) { - const chain = "fantom"; - cart = cart.toLowerCase(); - - const getPools = (await sdk.api.abi.call({ - target: cart, - abi: abi["getPools"], - block, - chain - })).output; - - const symbols = (await sdk.api.abi.multiCall({ - calls: getPools.map(p => ({ - target: p - })), - abi: "erc20:symbol", - block, - chain - })).output; - - const poolSupply = (await sdk.api.abi.multiCall({ - calls: getPools.map(p => ({ - target: cart, - params: p - })), - abi: abi["supply"], - block, - chain - })).output; - - let lps = []; - let beethovenBals = []; - - for (let i = 0; i < getPools.length; i++) { - const token = getPools[i].toLowerCase(); - const symbol = symbols[i].output; - const balance = poolSupply[i].output; - if (token === summit || token === everest) continue; - if (beethovenAddresses.includes(token)) { - beethovenBals.push(balance); - continue; - } - if (symbol.endsWith("LP")) { - lps.push({ - token, - balance - }); - continue; - } - sdk.util.sumSingleBalance(balances, `fantom:${token}`, balance); - } - - await unwrapUniswapLPs(balances, lps, block, chain, addr=>`fantom:${addr}`); - - const beetTotalSupply = (await sdk.api.abi.multiCall({ - calls: beethovenAddresses.map(p => ({ - target: p - })), - abi: "erc20:totalSupply", - block, - chain - })).output; - - const beetVaults = (await sdk.api.abi.multiCall({ - calls: beethovenAddresses.map(p => ({ - target: p - })), - abi: abi["getVault"], - block, - chain - })).output; - - const beetIds = (await sdk.api.abi.multiCall({ - calls: beethovenAddresses.map(p => ({ - target:p - })), - abi: abi["getPoolId"], - block, - chain - })).output; - - let poolTokenCall = []; - for (let i = 0; i < beetVaults.length; i++) { - poolTokenCall.push({ - target: beetVaults[i].output, - params: beetIds[i].output - }); - } - - const beetPoolTokens = (await sdk.api.abi.multiCall({ - calls: poolTokenCall, - abi: abi["getPoolTokens"], - block, - chain - })).output; - - for (let i = 0; i < beetPoolTokens.length; i++) { - const tokens = beetPoolTokens[i].output.tokens; - const bals = beetPoolTokens[i].output.balances; - const ratio = Number(beethovenBals[i]) / beetTotalSupply[i].output; - for (let j = 0; j < tokens.length; j++) { - sdk.util.sumSingleBalance(balances, `fantom:${tokens[j]}`, BigNumber(bals[j]).times(ratio).toFixed(0)); - } - } +async function getCarttvl(api, cart) { + const tokens = await api.call({ abi: abi.getPools, target: cart }) + const bals = await api.multiCall({ abi: abi.supply, calls: tokens, target: cart }) + api.add(tokens, bals) } -async function tvl(timestamp, block, chainBlocks) { - let balances = {}; - block = chainBlocks.fantom; - await getCarttvl(balances, block, cartoasis); - await getCarttvl(balances, block, cartplains); - await getCarttvl(balances, block, cartmesa); - await getCarttvl(balances, block, cartsummit); - return balances; +async function tvl(api) { + await getCarttvl(api, cartoasis) + await getCarttvl(api, cartplains) + await getCarttvl(api, cartmesa) + await getCarttvl(api, cartsummit) + await sumTokens2({ api, resolveLP: true}) + api.removeTokenBalance(summit) + api.removeTokenBalance(everest) } -async function staking(timestamp, block, chainBlocks) { - let balances = {}; - block = chainBlocks.fantom; - const chain = "fantom"; - const getPoolTokens = (await sdk.api.abi.call({ - target: "0x20dd72ed959b6147912c2e529f0a0c651c33c9ce", - params: "0x1577eb091d3933a89be62130484e090bb8bd0e5800010000000000000000020f", - abi: abi["getPoolTokens"], - block, - chain - })).output; - const valueOfSummitInUSDCInPool = (Number(getPoolTokens.balances[0]) * 3) * 1e12; - const summitValueInUSDC = valueOfSummitInUSDCInPool/ Number(getPoolTokens.balances[1]); - const summitInEverest = (await sdk.api.erc20.balanceOf({ - target: summit, - owner: everest, - block, - chain - })).output; - sdk.util.sumSingleBalance(balances, "fantom:" + ADDRESSES.fantom.DAI, BigNumber(summitInEverest).times(summitValueInUSDC).toFixed(0)); - return balances; -} module.exports = { - methodology: "TVL is from deposits into the cartographer contracts. Staking TVL is from SUMMIT deposited into EVEREST contract", - fantom: { - misrepresentedTokens: true, - tvl, - staking - } + methodology: "TVL is from deposits into the cartographer contracts. Staking TVL is from SUMMIT deposited into EVEREST contract", + fantom: { + misrepresentedTokens: true, + tvl, + staking: staking(everest, summit) + } } \ No newline at end of file diff --git a/projects/sunpump/index.js b/projects/sunpump/index.js new file mode 100644 index 000000000000..9a3f1aa536e7 --- /dev/null +++ b/projects/sunpump/index.js @@ -0,0 +1,5 @@ +const { sumTokensExport, nullAddress } = require('../helper/sumTokens') + +module.exports = { + tron: { tvl: sumTokensExport({ owner: 'TTfvyrAz86hbZk5iDpKD78pqLGgi8C7AAw', tokens: [nullAddress] }) } +} \ No newline at end of file diff --git a/projects/superform/index.js b/projects/superform/index.js index 68eb5431dfdd..ddaa4146a2aa 100644 --- a/projects/superform/index.js +++ b/projects/superform/index.js @@ -1,4 +1,4 @@ -const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base", "fantom"]; +const superform_chains = ["ethereum", "polygon", "bsc", "avax", "arbitrum", "optimism", "base", "fantom", "blast", "linea"]; const factory_contract = "0xD85ec15A9F814D6173bF1a89273bFB3964aAdaEC"; const fantom_factory_contract = "0xbc85043544CC2b3Fd095d54b6431822979BBB62A"; diff --git a/projects/superlend/index.js b/projects/superlend/index.js new file mode 100644 index 000000000000..651e67ca8979 --- /dev/null +++ b/projects/superlend/index.js @@ -0,0 +1,7 @@ +const { aaveExports } = require('../helper/aave'); +const methodologies = require('../helper/methodologies'); + +module.exports = { + methodology: methodologies.lendingMarket, + etlk: aaveExports('etlk', "0xEcbDd440C7a929d7524784Af634dF9EB0747b9e7", undefined, ["0x99e8269dDD5c7Af0F1B3973A591b47E8E001BCac"], { v3: true }), +} \ No newline at end of file diff --git a/projects/superposition/index.js b/projects/superposition/index.js index b6ecf4c48d72..f37e0a6a68fc 100644 --- a/projects/superposition/index.js +++ b/projects/superposition/index.js @@ -13,21 +13,44 @@ async function _getResources() { const brokersFilter = (i) => i.type.includes(`${spRootAddress}::broker::Broker`); -function processBrokerData(brokerDataArray, isBorrowed = false) { +const coinToFungibleAssetFilter = (i) => + i.type.includes(`${spRootAddress}::map::Map`); + +function processBrokerData(brokerDataArray, coinToFungibleAssetArray, isBorrowed = false) { + const coinToFungibleAssetMap = coinToFungibleAssetArray.reduce(function(map, item) { + map[item.type] = item.data.fa_metadata; + return map; + }, {}); + const result = {}; brokerDataArray.map((item) => { const { type, data } = item; - result[type] = !isBorrowed ? parseInt(data.available) : parseInt(data.borrowed) + + const brokerType = type; + + const coinType = brokerType.match(/<([^>]+)>/)[1]; + + let tokenMint = coinType; + { + // Superposition uses custom coin types to represent fungible assets + // Find the fungible asset address so DefiLama can find + // the correct token price + const mapType = `${spRootAddress}::map::Map<${coinType}>`; + if (mapType in coinToFungibleAssetMap) { + tokenMint = coinToFungibleAssetMap[mapType]; + } + } + + result[tokenMint] = !isBorrowed ? parseInt(data.available) : parseInt(data.borrowed) }); return result; } -function simplifyKeys(balanceData, api) { +function addBalanceData(balanceData, api) { Object.entries(balanceData).forEach(([key, value]) => { - const newKey = key.match(/<([^>]+)>/)[1]; - api.add(newKey, value); + api.add(key, value); }); } @@ -38,14 +61,20 @@ module.exports = { tvl: async (api) => { const resources = await _getResources(); const brokers = resources.filter(brokersFilter); - const balanceData = processBrokerData(brokers); - simplifyKeys(balanceData, api); + const coinToFungibleAssetArray = resources.filter( + coinToFungibleAssetFilter + ); + const balanceData = processBrokerData(brokers, coinToFungibleAssetArray); + addBalanceData(balanceData, api); }, borrowed: async (api) => { const resources = await _getResources(); const brokers = resources.filter(brokersFilter); - const balanceData = processBrokerData(brokers, true); - simplifyKeys(balanceData, api); + const coinToFungibleAssetArray = resources.filter( + coinToFungibleAssetFilter + ); + const balanceData = processBrokerData(brokers, coinToFungibleAssetArray, true); + addBalanceData(balanceData, api); }, }, }; diff --git a/projects/superstate-uscc/index.js b/projects/superstate-uscc/index.js new file mode 100644 index 000000000000..0fcfa509d607 --- /dev/null +++ b/projects/superstate-uscc/index.js @@ -0,0 +1,14 @@ +const USCC = "0x14d60e7fdc0d71d8611742720e4c50e7a974020c"; + +module.exports = { + methodology: "TVL corresponds to the total amount of USCC minted onchain, does not include Superstate book-entry AUM", + ethereum: { + tvl: async (api) => { + const totalSupplies = await api.multiCall({ + calls: [USCC], + abi: "erc20:totalSupply", + }); + api.addTokens([USCC], totalSupplies); + }, + }, +}; diff --git a/projects/superstate/index.js b/projects/superstate/index.js index d499b5b69967..d97ed45dc510 100644 --- a/projects/superstate/index.js +++ b/projects/superstate/index.js @@ -1,46 +1,14 @@ -const { get } = require("../helper/http"); +const USTB = "0x43415eb6ff9db7e26a15b704e7a3edce97d31c4e"; module.exports = { - misrepresentedTokens: true, - methodology: "Sums the total supplies of Superstate's issued tokens.", -}; - -async function USTBPrice(ts) { - const data = await get("https://api.superstate.co/v1/funds/1/nav-daily") - let date = getDate(ts) - const oneDay = 24 * 60 * 60 - let res = data.find((nav) => nav.net_asset_value_date === date) - if (!res) { - date = getDate(ts - oneDay) - res = data.find((nav) => nav.net_asset_value_date === date) - } - return res.net_asset_value -} - -const config = { + methodology: "TVL corresponds to the total amount of USTB & USCC minted onchain, does not include Superstate book-entry AUM", ethereum: { - USTB: '0x43415eb6ff9db7e26a15b704e7a3edce97d31c4e', - }, -} - -Object.keys(config).forEach((chain) => { - let fundsMap = config[chain]; - const fundAddresses = Object.values(fundsMap); - - module.exports[chain] = { tvl: async (api) => { - let supplies = await api.multiCall({ abi: 'erc20:totalSupply', calls: fundAddresses }); - const price = await USTBPrice(api.timestamp); - api.addCGToken('tether', supplies[0] * price / 1e6) - } - }; -}); - -function getDate(ts) { - const date = new Date(ts * 1000); - const day = String(date.getDate()).padStart(2, '0') - const month = String(date.getMonth() + 1).padStart(2, '0'); // January is 0! - const year = date.getFullYear(); - - return `${month}/${day}/${year}`; -} \ No newline at end of file + const totalSupplies = await api.multiCall({ + calls: [USTB], + abi: "erc20:totalSupply", + }); + api.addTokens([USTB], totalSupplies); + }, + }, +}; diff --git a/projects/superswap-v2/index.js b/projects/superswap-v2/index.js new file mode 100644 index 000000000000..eea758e2d450 --- /dev/null +++ b/projects/superswap-v2/index.js @@ -0,0 +1,13 @@ +const { getUniTVL } = require("../helper/unknownTokens") +const FACTORY = "0x22505cb4d5d10b2c848a9d75c57ea72a66066d8c" + +const dexTVL = getUniTVL({ factory: FACTORY, useDefaultCoreAssets: true, permitFailure: true }) + + +module.exports = { + misrepresentedTokens: true, + methodology: `Uses factory(${FACTORY}) address and whitelisted tokens address to find and price Liquidity Pool pairs.`, + optimism: { + tvl: dexTVL, + } +}; diff --git a/projects/superswap-v3/index.js b/projects/superswap-v3/index.js new file mode 100644 index 000000000000..b523c956f781 --- /dev/null +++ b/projects/superswap-v3/index.js @@ -0,0 +1,8 @@ +const { uniV3Export } = require("../helper/uniswapV3") + +module.exports = { + methodology: "TVL accounts for the liquidity on all AMM pools taken from the factory contract", + ...uniV3Export({ + optimism: { factory: "0xe52a36Bb76e8f40e1117db5Ff14Bd1f7b058B720", fromBlock: 124982239 }, + }) +} diff --git a/projects/supr-staking/index.js b/projects/supr-staking/index.js new file mode 100644 index 000000000000..84463e778ac8 --- /dev/null +++ b/projects/supr-staking/index.js @@ -0,0 +1,16 @@ +const SUPR = '0x3390108E913824B8eaD638444cc52B9aBdF63798' +const ROLLUX_SUPR_STAKING = '0x400aDCba906EA6E87FEC276f0E0C0857F71A85F2' +const ROLLUX_SUPR_GROUP_STAKING = '0xa9A37e4D70Fc6af8A0CC16995B9363f10dCE132E' + +async function staking(api) { + const bal = await api.call({ abi: 'erc20:totalSupply', target: ROLLUX_SUPR_STAKING }) + api.add(SUPR, bal) + return api.sumTokens({ owner: ROLLUX_SUPR_GROUP_STAKING, tokens: [SUPR] }) +} + +module.exports = { + rollux: { + tvl: () => ({}), + staking, + }, +} \ No newline at end of file diff --git a/projects/surge-trade/index.js b/projects/surge-trade/index.js new file mode 100644 index 000000000000..9257be46e313 --- /dev/null +++ b/projects/surge-trade/index.js @@ -0,0 +1,14 @@ +const { queryAddresses } = require('../helper/chain/radixdlt') + +module.exports = { + radixdlt: { tvl }, +} + +async function tvl(api) { + const [{ details: { state }, fungible_resources }] = await queryAddresses({ addresses: ['component_rdx1crezrpxw9ypg6v2panqjqwevnwplg94yeej0rhqq9k7p4kgnltrc9g'], miscQuery: { "aggregation_level": "Vault" } }) + const stateObj = {} + state.fields.map(i => stateObj[i.field_name] = +i.value) + const poolAmount = parseFloat(fungible_resources.items[0].vaults.items[0].amount) + const tvl_usd = poolAmount + stateObj.virtual_balance + stateObj.unrealized_pool_funding + stateObj.pnl_snap + api.add('resource_rdx1t4upr78guuapv5ept7d7ptekk9mqhy605zgms33mcszen8l9fac8vf', tvl_usd) +} diff --git a/projects/sushiswap-kashi/kashi-lending.js b/projects/sushiswap-kashi/kashi-lending.js index 5fce7a573002..6f047d904bff 100644 --- a/projects/sushiswap-kashi/kashi-lending.js +++ b/projects/sushiswap-kashi/kashi-lending.js @@ -43,6 +43,9 @@ const kashiQuery = ` function kashiLending(chain, borrowed) { return async (api) => { + if(borrowed === true && api.timestamp > 1672534861){ + return {} + } const graphUrl = graphUrls[chain]; // Query graphql endpoint diff --git a/projects/sushiswap-v3/index.js b/projects/sushiswap-v3/index.js index 810caad4013a..64f6fd8beb17 100644 --- a/projects/sushiswap-v3/index.js +++ b/projects/sushiswap-v3/index.js @@ -100,6 +100,7 @@ module.exports = uniV3Export({ 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' }, + zeta: { endpoint: 'https://api.goldsky.com/api/public/project_cls39ugcfyhbq01xl9tsf6g38/subgraphs/v3-zetachain/1.0.0/gn' }, } const query = `{ diff --git a/projects/suter-shield/index.js b/projects/suter-shield/index.js index f47367ef1874..dd2d0962827b 100644 --- a/projects/suter-shield/index.js +++ b/projects/suter-shield/index.js @@ -1,122 +1,28 @@ +const { sumTokensExport, } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const BigNumber = require("bignumber.js") - -// ETH -const ETH_COIN = ADDRESSES.null; -const SUTER_ETH_V1 = '0x02b4E089E96a0A672dE0a0d93E2869B899b15a44'; -const SUTER_ETH_V2 = '0x934cc5704165711296207b5AFc87933AE0685a4C'; - -const USDT_COIN = ADDRESSES.ethereum.USDT; -const SUTER_USDT_V1 = '0x29abf1a011cdfb9548dc8faa6d19b1b39808bf58'; -const SUTER_USDT_V2 = '0xB8fcF79EAd34E98e45fc21E5dB1C5C561d906371'; - -const DAI_COIN = ADDRESSES.ethereum.DAI; -const SUTER_DAI_V1 = '0x54A8e0C76Eec21DD30842FbbcA2D336669102b77'; -const SUTER_DAI_V2 = '0xbdf418486D438e44F5aAC6aF86330dA638ea70AD'; - -const SUTER_COIN = '0xAA2ce7Ae64066175E0B90497CE7d9c190c315DB4'; -const SUTER_SUTER_V1 = '0xab4e72599e2cec5dcc8249657833b3408905900e'; - -// BSC -// const BNB_COIN = ADDRESSES.null; -// WBNB -const BNB_COIN = ADDRESSES.bsc.WBNB; -const SUTER_BNB_V1 = '0x2A00d7d2de1E147a3BCAa122B4EC5D6f9F0c1147'; -const SUTER_BNB_V2 = '0x5bb6eE37a6503fe381207c3BAC0Aa6d7B33590Fa'; - -const BUSD_COIN = ADDRESSES.bsc.BUSD; -const SUTER_BUSD_V1 = '0xe557c77Ed24df7cDF21ED55a8C56Ea36CeBD5BD2'; -const SUTER_BUSD_V2 = '0x382926Ba4D92E5d7652A85Aa7085Ffb15b6b6C89'; - -const CAKE_COIN = '0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82'; -const SUTER_CAKE_V1 = '0x8cc4c8529c0D8bb9B9FA197530d656cCBcB88DeB'; -const SUTER_CAKE_V2 = '0xa19e53Af2381F34AEcA80cDcEBF6c4a3F37037a2'; - -const BAKE_COIN = '0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5'; -const SUTER_BAKE_V1 = '0x9D529c70fD8e072786b721190f6E6B30e433690a'; -const SUTER_BAKE_V2 = '0x6F3Ad49e287c2dC12aA5f0bD9e8173C57d1AdECa'; - -const BSC_SUTER_COIN = '0x4cfbbdfbd5bf0814472ff35c72717bd095ada055'; -const BSC_SUTER_SUTER_V1 = '0x617edfadeC530aE747088672831EaC5B1A6A5220'; -const BSC_SUTER_SUTER_V2 = '0x1E02013eF23C1784b3c2E2c08b1e4c253ABa2b85'; - -const XSUTER_COIN = '0x822d04d22f962d6132f53b0fa6b9409097d12550'; -const BSC_SUTER_XSUTER_V1 = '0x4de5cB2EB81A37DD768fc58fe0ca7b811C997c35'; -const BSC_SUTER_XSUTER_V2 = '0x41690D4E1E20B0cBB1fb6004CA80e67bdFa6BA02'; - -async function eth_tvl(timestamp, block) { - let balances = {}; - let total_eth_tvl = 0; - let pools = {[ETH_COIN]: [SUTER_ETH_V1, SUTER_ETH_V2], [USDT_COIN]: [SUTER_USDT_V1, SUTER_USDT_V2], [DAI_COIN]: [SUTER_DAI_V1, SUTER_DAI_V2], [SUTER_COIN]: [SUTER_SUTER_V1]}; - for(var coin in pools){ - for(var pool of pools[coin]) { - if(coin !== ETH_COIN){ - let erc20_tvl = await sdk.api.erc20.balanceOf({ - target: coin, - owner: pool, - block: block, - chain: 'ethereum' - }); - if(balances[coin] === undefined){ - balances[coin] = erc20_tvl.output; - }else{ - balances[coin] = new BigNumber(balances[coin]).plus(new BigNumber(erc20_tvl.output)); - } - } - let eth_tvl = await sdk.api.eth.getBalance({ - target: pool, - block, - chain: 'ethereum' - }); - total_eth_tvl = new BigNumber(eth_tvl.output).plus(new BigNumber(total_eth_tvl)); - } - } - - balances[ETH_COIN] = total_eth_tvl.toString(); - return balances; +const { nullAddress } = require('../helper/tokenMapping') +const config = { + ethereum: [ + [ADDRESSES.null, '0x02b4E089E96a0A672dE0a0d93E2869B899b15a44'], + [nullAddress, '0x934cc5704165711296207b5AFc87933AE0685a4C'], + [ADDRESSES.ethereum.USDT, '0x29abf1a011cdfb9548dc8faa6d19b1b39808bf58'], + [ADDRESSES.ethereum.USDT, '0xB8fcF79EAd34E98e45fc21E5dB1C5C561d906371'], + [ADDRESSES.ethereum.DAI, '0x54A8e0C76Eec21DD30842FbbcA2D336669102b77'], + [ADDRESSES.ethereum.DAI, '0xbdf418486D438e44F5aAC6aF86330dA638ea70AD'], + ], bsc: [ + [ADDRESSES.null, '0x2A00d7d2de1E147a3BCAa122B4EC5D6f9F0c1147'], + [ADDRESSES.null, '0x5bb6eE37a6503fe381207c3BAC0Aa6d7B33590Fa'], + [ADDRESSES.bsc.BUSD, '0xe557c77Ed24df7cDF21ED55a8C56Ea36CeBD5BD2'], + [ADDRESSES.bsc.BUSD, '0x382926Ba4D92E5d7652A85Aa7085Ffb15b6b6C89'], + ['0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', '0x8cc4c8529c0D8bb9B9FA197530d656cCBcB88DeB'], + ['0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82', '0xa19e53Af2381F34AEcA80cDcEBF6c4a3F37037a2'], + ['0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5', '0x9D529c70fD8e072786b721190f6E6B30e433690a'], + ['0xE02dF9e3e622DeBdD69fb838bB799E3F168902c5', '0x6F3Ad49e287c2dC12aA5f0bD9e8173C57d1AdECa'], + ] } -async function bsc_tvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks.bsc; - let balances = {}; - let total_bnb_tvl = 0; - let pools = {[BNB_COIN]: [SUTER_BNB_V1, SUTER_BNB_V2], [BUSD_COIN]: [SUTER_BUSD_V1, SUTER_BUSD_V2], [CAKE_COIN]: [SUTER_CAKE_V1, SUTER_CAKE_V2], [BAKE_COIN]: [SUTER_BAKE_V1, SUTER_BAKE_V2], [BSC_SUTER_COIN]: [BSC_SUTER_SUTER_V1, BSC_SUTER_SUTER_V2], [XSUTER_COIN]: [BSC_SUTER_XSUTER_V1, BSC_SUTER_XSUTER_V2]}; - for(var coin in pools){ - for(var pool of pools[coin]) { - if(coin !== BNB_COIN){ - let erc20_tvl = await sdk.api.erc20.balanceOf({ - target: coin, - owner: pool, - block: block, - chain: 'bsc' - }); - if(balances[`bsc:${coin}`] === undefined){ - balances[`bsc:${coin}`] = erc20_tvl.output; - }else{ - balances[`bsc:${coin}`] = new BigNumber(balances[`bsc:${coin}`]).plus(new BigNumber(erc20_tvl.output)); - } - } - let bnb_tvl = await sdk.api.eth.getBalance({ - target: pool, - //block, - chain: 'bsc' - }); - total_bnb_tvl = new BigNumber(bnb_tvl.output).plus(new BigNumber(total_bnb_tvl)); - } +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: sumTokensExport({ tokensAndOwners: config[chain], }) } - - balances[`bsc:${BNB_COIN}`] = total_bnb_tvl.toString(); - return balances; -} - - -module.exports = { - timetravel: false, - ethereum:{ - tvl: eth_tvl, - }, - bsc: { - tvl: bsc_tvl, - }, -}; \ No newline at end of file +}) diff --git a/projects/suzaku/index.js b/projects/suzaku/index.js new file mode 100644 index 000000000000..a70624952415 --- /dev/null +++ b/projects/suzaku/index.js @@ -0,0 +1,15 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +async function tvl(api) { + const logs = await getLogs2({ api, factory: '0xE5296638Aa86BD4175d802A210E158688e41A93c', 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: 1727654400, + avax: { + tvl, + }, +} diff --git a/projects/svn/index.js b/projects/svn/index.js index d0d8cf77d52a..d142ca9e76a7 100644 --- a/projects/svn/index.js +++ b/projects/svn/index.js @@ -1,107 +1,33 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const { stakingPricedLP } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const token0Abi = 'address:token0' -const token1Abi = 'address:token1' -const { default: BigNumber } = require("bignumber.js"); +const { sumTokens2 } = require("../helper/unwrapLPs"); +const { pool2 } = require('../helper/pool2') +const { staking } = require('../helper/staking') -let token = ADDRESSES.cronos.SVN; let share = "0xf8b9facB7B4410F5703Eb29093302f2933D6E1Aa"; const rewardPool = "0xA51054BDf0910E3cE9B233e6B5BdDc0931b2E2ED"; const masonry = "0x2CcbFD9598116cdF9B94fF734ece9dCaF4c9d471"; const pool2LPs = [ - "0xB6E1705BfAFcf1efEE83C135C0F0210653bAB8F0", - "0xc924da29d37f3b8C62c4c3e4e6958bF2b5ebF677", + "0xB6E1705BfAFcf1efEE83C135C0F0210653bAB8F0", + "0xc924da29d37f3b8C62c4c3e4e6958bF2b5ebF677", ] -async function pool2(timestamp, block, chainBlocks) { - block = chainBlocks.cronos; - const chain = 'cronos'; - let balances = {}; - token = token.toLowerCase(); - share = share.toLowerCase(); - block = chainBlocks[chain]; - const pool2Balances = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p, - params: rewardPool - })), - abi: "erc20:balanceOf", - block, - chain - })).output; - const supplies = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: "erc20:totalSupply", - block, - chain - })).output; - const pool2Token0 = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: token0Abi, - block, - chain - })).output; - const pool2Token1 = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: token1Abi, - block, - chain - })).output; - - for (let i = 0; i < pool2LPs.length; i++) { - let listedToken; - const token0 = pool2Token0[i].output.toLowerCase(); - const token1 = pool2Token1[i].output.toLowerCase(); - if (token0 === token || token0 === share) { - listedToken = token1; - } - else if (token1 === token || token1 === share) { - listedToken = token0; - } - const listedTokenBalance = (await sdk.api.erc20.balanceOf({ - target: listedToken, - owner: pool2LPs[i], - block, - chain - })).output; - const balance = BigNumber(pool2Balances[i].output).times(listedTokenBalance).div(supplies[i].output).times(2).toFixed(0); - sdk.util.sumSingleBalance(balances, `cronos:${listedToken}`, balance); - } - return balances -} -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - await sumTokensAndLPsSharedOwners( - balances, - [ - ["0xB6E1705BfAFcf1efEE83C135C0F0210653bAB8F0", true], - ["0xc924da29d37f3b8C62c4c3e4e6958bF2b5ebF677", true], - ["0x97749c9B61F878a880DfE312d2594AE07AEd7656", false], - ["0x50c0C5bda591bc7e89A342A3eD672FB59b3C46a7", false], - ["0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23", false], - ["0x2D03bECE6747ADC00E1a131BBA1469C15fD11e03", false], - ], - ["0x3827CAa33557304e1CA5D89c2f85919Da171C44D"], - chainBlocks.cronos, - "cronos", - (addr) => `cronos:${addr}` - ); - delete balances['cronos:' + ADDRESSES.cronos.SVN]; - - return balances; +async function tvl(api) { + await sumTokens2({ + api, tokens: [ + "0xB6E1705BfAFcf1efEE83C135C0F0210653bAB8F0", + "0xc924da29d37f3b8C62c4c3e4e6958bF2b5ebF677", + "0x97749c9B61F878a880DfE312d2594AE07AEd7656", + "0x50c0C5bda591bc7e89A342A3eD672FB59b3C46a7", + ADDRESSES.cronos.WCRO_1, + "0x2D03bECE6747ADC00E1a131BBA1469C15fD11e03", + ], owner: '0x3827CAa33557304e1CA5D89c2f85919Da171C44D', resolveLP: true + }) + api.removeTokenBalance(ADDRESSES.cronos.SVN) } module.exports = { - cronos : { - tvl, - pool2, - staking: stakingPricedLP(masonry, share, 'cronos', pool2LPs[1], 'mmfinance', true), - } + cronos: { + tvl, + pool2: pool2(rewardPool, pool2LPs), + staking: staking(masonry, share), + } }; \ No newline at end of file diff --git a/projects/swaap-v2/index.js b/projects/swaap-v2/index.js index c2a7fecc9211..3a212aa3721c 100644 --- a/projects/swaap-v2/index.js +++ b/projects/swaap-v2/index.js @@ -12,6 +12,9 @@ const config = { bsc: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 39148730,}, base: { vault: '0x03c01acae3d0173a93d819efdc832c7c4f153b06', fromBlock: 14451361,}, mode: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 7242549,}, + mantle: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 65689171,}, + scroll: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 6934854,}, + linea: { vault: '0xd315a9c38ec871068fec378e4ce78af528c76293', fromBlock: 6052579,}, } /** diff --git a/projects/swampfinance/index.js b/projects/swampfinance/index.js index 674d31402a42..9ea696dcac77 100644 --- a/projects/swampfinance/index.js +++ b/projects/swampfinance/index.js @@ -6,5 +6,5 @@ module.exports = yieldHelper({ chain: 'bsc', masterchef: '0x33AdBf5f1ec364a4ea3a5CA8f310B597B8aFDee3', nativeToken: '0xc5A49b4CBe004b6FD55B30Ba1dE6AC360FF9765d', - blacklistedTokens: [ADDRESSES.bsc.BTCB] + blacklistedTokens: [ADDRESSES.bsc.BTCB, ADDRESSES.bsc.ETH] }) \ No newline at end of file diff --git a/projects/swanswap/index.js b/projects/swanswap/index.js new file mode 100644 index 000000000000..8d455c736952 --- /dev/null +++ b/projects/swanswap/index.js @@ -0,0 +1,3 @@ +const { uniTvlExport } = require('../helper/unknownTokens') + +module.exports = uniTvlExport('shape', '0x2Be0c88CCc1d42920beAe4633CDdBbACe5e8812c') \ No newline at end of file diff --git a/projects/swap-coffee/index.js b/projects/swap-coffee/index.js new file mode 100644 index 000000000000..add69ba5f36d --- /dev/null +++ b/projects/swap-coffee/index.js @@ -0,0 +1,46 @@ +const { call, sumTokensExport, getTokenRates, getJettonBalances } = require('../helper/chain/ton') +const {sleep} = require("../helper/utils"); + +const CES_MASTER = "0:a5d12e31be87867851a28d3ce271203c8fa1a28ae826256e73c506d94d49edad" +const STAKING_CONTRACT = "0:29f90533937d696105883b981e9427d1ae411eef5b08eab83f4af89c495d27df" +const DEDUST_TON_CES_POOL = "0:123e245683bd5e93ae787764ebf22291306f4a3fcbb2dcfcf9e337186af92c83" +const STONFI_CES_TON_POOL = "0:6a839f7a9d6e5303d71f51e3c41469f2c35574179eb4bfb420dca624bb989753" + +async function getTokenSupply(addr) { + return (await call({ target: addr, abi: "get_jetton_data"}))[0] / 1e9 +} + +function calcVolume(reserve, supply, rate) { + return ((reserve / 1e9) / supply) * rate +} + +module.exports = { + methodology: "Counts swap.coffee smartcontract balance as TVL.", + timetravel: false, + ton: { + tvl: () => { }, + staking: sumTokensExport({ owners: [STAKING_CONTRACT], tokens: [CES_MASTER]}), + pool2: async (api) => { + const dedustPoolReserves = await call({ target: DEDUST_TON_CES_POOL, abi: "get_reserves" }) + const dedustLpSupply = await getTokenSupply(DEDUST_TON_CES_POOL) + + // toncenter api is rate limited + await sleep(3000) + + const stonfiPoolReserves = await call({ target: STONFI_CES_TON_POOL, abi: "get_pool_data" }) + const stonfiLpSupply = await getTokenSupply(STONFI_CES_TON_POOL) + + const rates = await getTokenRates({ tokens: ["TON", CES_MASTER] }) + + const stonLpPrice = calcVolume(stonfiPoolReserves[0], stonfiLpSupply, rates[CES_MASTER]) + + calcVolume(stonfiPoolReserves[1], stonfiLpSupply, rates["TON"]) + const dedustLpPrice = calcVolume(dedustPoolReserves[0], dedustLpSupply, rates["TON"]) + + calcVolume(dedustPoolReserves[1], dedustLpSupply, rates[CES_MASTER]) + + const balances = await getJettonBalances(STAKING_CONTRACT) + + return api.addUSDValue((stonLpPrice * balances[STONFI_CES_TON_POOL].balance / 1e9) + + (dedustLpPrice * balances[DEDUST_TON_CES_POOL].balance / 1e9)) + } + } +} \ No newline at end of file diff --git a/projects/swapline-lb-v2/index.js b/projects/swapline-lb-v2/index.js new file mode 100644 index 000000000000..7ae217039cfe --- /dev/null +++ b/projects/swapline-lb-v2/index.js @@ -0,0 +1,5 @@ +const { joeV2Export } = require('../helper/traderJoeV2') + +module.exports = joeV2Export({ + base: '0x20918F4BA70439C58d070D4746f3aA303a7595d8' +}) \ No newline at end of file diff --git a/projects/swapmode-v3/index.js b/projects/swapmode-v3/index.js new file mode 100644 index 000000000000..0d83ba821882 --- /dev/null +++ b/projects/swapmode-v3/index.js @@ -0,0 +1,6 @@ +const { uniV3Export } = require('../helper/uniswapV3') +const factory = '0x6E36FC34eA123044F278d3a9F3819027B21c9c32' + +module.exports = uniV3Export({ + mode: { factory, fromBlock: 5005167 }, +}) \ No newline at end of file diff --git a/projects/swapos/index.js b/projects/swapos/index.js new file mode 100644 index 000000000000..710642fa8e27 --- /dev/null +++ b/projects/swapos/index.js @@ -0,0 +1,6 @@ +const { uniTvlExport } = require('../helper/unknownTokens'); + +module.exports = uniTvlExport( + 'ethereum', + '0xfB1Eb9a45Feb7269f3277233AF513482Bc04Ea63' +); diff --git a/projects/swapsicle-v2/index.js b/projects/swapsicle-v2/index.js index cdac04cecf74..0d1d0bac445b 100644 --- a/projects/swapsicle-v2/index.js +++ b/projects/swapsicle-v2/index.js @@ -16,23 +16,30 @@ module.exports = uniV3Export({ fromBlock: 301362984, isAlgebra: true, }, + taiko: { + factory: "0xBa90FC740a95A6997306255853959Bb284cb748a", + fromBlock: 338445, + isAlgebra: true, + }, }); const contracts = { telos: { stakingContract_iceCreamVan: "0xA234Bb3BEb60e654601BEa72Ff3fB130f9ed2aa7", stakingContract_zombieVan: "0x67275189e0deb3ce9eb918928c0011a0a582bd0e", - stakingContract_iceCreamZombies: - "0x581b6d860aa138c46dcaf6d5c709cd070cd77eb8", + stakingContract_iceCreamZombies: "0x581b6d860aa138c46dcaf6d5c709cd070cd77eb8", slush: "0xac45ede2098bc989dfe0798b4630872006e24c3f", }, mantle: { stakingContract_iceCreamVan: "0xe0ac81c7692b9119658e01edc1d743bf4c2ec21a", stakingContract_zombieVan: "0x049a58a2aa1b15628aa0cda0433d716f6f63cbba", - stakingContract_iceCreamZombies: - "0x21b276de139ce8c75a7b4f750328dbf356195b49", + stakingContract_iceCreamZombies: "0x21b276de139ce8c75a7b4f750328dbf356195b49", slush: "0x8309bc8bb43fb54db02da7d8bf87192355532829", }, + taiko: { + stakingContract_iceCreamVan: "0x0cdde1dead51b156bd62113664d60b354b4df4ab", + slush: "0x36bfe1f1b36cfdb4fe75cc592ff5dc6200ad3e0f", + }, }; const config = { @@ -42,130 +49,75 @@ const config = { }, telos: { endpoint: - "https://telos.subgraph.swapsicle.io/subgraphs/name/cryptoalgebra/analytics", + "https://test.telos.subgraph.swapsicle.io/subgraphs/name/cryptoalgebra/analytics", + }, + taiko: { + endpoint: + "https://api.goldsky.com/api/public/project_clr6mlufzbtuy01vd012wgt5k/subgraphs/swapsicle-analytics-taiko/prod/gn", }, }; -const query = `{ - pools { - id - token0 { id } - token1 { id } - } -}`; - const slushPriceQuery = `{ token(id: "TOKENID") { derivedMatic } }`; -const WTLOS = ADDRESSES.telos.WTLOS; -const WMNT = ADDRESSES.mantle.WMNT; - -function getTLOSAddress(address) { - return `telos:${address}`; -} - -function getMantleAddress(address) { - return `mantle:${address}`; -} +const nativeTokenAddresses = { + telos: `telos:${ADDRESSES.telos.WTLOS}`, + mantle: `mantle:${ADDRESSES.mantle.WMNT}`, + taiko: `taiko:${ADDRESSES.taiko.WETH}`, +}; -async function slushToEthConvert(slushAmount, chain) { - const slushETH = await cachedGraphQuery( +async function slushToNativeConvert(slushAmount, chain) { + const slushNativePrice = await cachedGraphQuery( "swapsicle-slush-eth-price/" + chain, - chain == "telos" ? config.telos.endpoint : config.mantle.endpoint, + config[chain].endpoint, slushPriceQuery.replace( "TOKENID", - chain == "telos" ? contracts.telos.slush : contracts.mantle.slush + contracts[chain].slush ) ); - - const slushStaked = slushAmount / 10 ** 18; - return slushStaked * slushETH.token.derivedMatic; + return slushAmount / 10 ** 18 * slushNativePrice.token.derivedMatic; } -async function iceCreamVanStake({ chain, telos: block }) { - const tokenBalance = - chain == "telos" - ? await sdk.api.abi.call({ - target: contracts.telos.stakingContract_iceCreamVan, - abi: iceCreamVanABI.totalShares, - chain: "telos", - block, - }) - : await sdk.api.abi.call({ - target: contracts.mantle.stakingContract_iceCreamVan, - abi: iceCreamVanABI.totalShares, - chain: "mantle", - block, - }); - - const ETHBalance = await slushToEthConvert(tokenBalance.output, chain); - - const balances = {}; - balances[chain == "telos" ? getTLOSAddress(WTLOS) : getMantleAddress(WMNT)] = - ETHBalance * 10 ** 18; - - return balances; +/** Returns an object as follows { `chainName:nativeTokenAddress`: slushBalanceInNativeToken } */ +async function getStakeBalance(slushBalance, chain) { + const nativeBalance = await slushToNativeConvert(slushBalance, chain); + return { + [nativeTokenAddresses[chain]]: nativeBalance * 10 ** 18 + }; } -async function ZombieVanStake({ chain, telos: block }) { - const tokenBalance = - chain == "telos" - ? await sdk.api.abi.call({ - target: contracts.telos.stakingContract_zombieVan, - abi: zombieVanABI.totalStaked, - chain: "telos", - block, - }) - : await sdk.api.abi.call({ - target: contracts.mantle.stakingContract_zombieVan, - abi: zombieVanABI.totalStaked, - chain: "mantle", - block, - }); - - const ETHBalance = await slushToEthConvert(tokenBalance.output, chain); - - const balances = {}; - balances[chain == "telos" ? getTLOSAddress(WTLOS) : getMantleAddress(WMNT)] = - ETHBalance * 10 ** 18; - - return balances; +async function iceCreamVanStake(api) { + const response = await api.call({ + target: contracts[api.chain].stakingContract_iceCreamVan, + abi: iceCreamVanABI.totalShares, + }) + return getStakeBalance(response, api.chain); } -async function ICZStake({ chain, telos: block }) { - const tokenBalance = - chain == "telos" - ? await sdk.api.erc20.balanceOf({ - target: contracts.telos.slush, - owner: contracts.telos.stakingContract_iceCreamZombies, - chain: "telos", - block, - }) - : await sdk.api.erc20.balanceOf({ - target: contracts.mantle.slush, - owner: contracts.mantle.stakingContract_iceCreamZombies, - chain: "mantle", - block, - }); - - const ETHBalance = await slushToEthConvert(tokenBalance.output, chain); - - const balances = {}; - balances[chain == "telos" ? getTLOSAddress(WTLOS) : getMantleAddress(WMNT)] = - ETHBalance * 10 ** 18; +async function ZombieVanStake(api) { + const response = await api.call({ + target: contracts[api.chain].stakingContract_zombieVan, + abi: zombieVanABI.totalStaked, + }) + return getStakeBalance(response, api.chain); +} - return balances; +async function ICZStake(api) { + const response = await api.call({ + abi: 'erc20:balanceOf', + target: contracts[api.chain].slush, + params: contracts[api.chain].stakingContract_iceCreamZombies, + }) + return getStakeBalance(response, api.chain); } Object.keys(config).forEach((chain) => { - const { endpoint } = config[chain]; module.exports[chain].staking = sdk.util.sumChainTvls([ - () => iceCreamVanStake({ chain }), - () => ZombieVanStake({ chain }), - // NFT's - () => ICZStake({ chain }), - ]) + (api) => iceCreamVanStake(api), + (api) => (chain !== 'taiko' ? ZombieVanStake(api) : 0), + (api) => (chain !== 'taiko' ? ICZStake(api) : 0), + ]); }); diff --git a/projects/swaylend/index.js b/projects/swaylend/index.js new file mode 100644 index 000000000000..e4e233576090 --- /dev/null +++ b/projects/swaylend/index.js @@ -0,0 +1,32 @@ +const { sumTokens, query } = require("../helper/chain/fuel") +const { getConfig } = require('../helper/cache') +const { get } = require('../helper/http') + +const markets = [ + '0x657ab45a6eb98a4893a99fd104347179151e8b3828fd8f2a108cc09770d1ebae', // USDC market +] +async function tvl(api) { + return sumTokens({ api, owners: markets, }) +} + +async function borrowed(api) { + const abi = await getConfig('swaylend/abi', undefined,{ + fetcher: async () => { + let data = await get('https://raw.githubusercontent.com/Swaylend/swaylend-monorepo/refs/heads/develop/apps/frontend/src/contract-types/Market.ts') + data = data.split('const abi =')[1].split(';')[0] + return JSON.parse(data) // ensure that this doesnt fail + // return data + } + }) + for (const market of markets) { + const { base_token } = await query({ contractId: market, abi, method: 'get_market_configuration' }) + const { total_borrow_base }= await query({ contractId: market, abi, method: 'get_market_basics' }) + api.add(base_token.bits, +total_borrow_base ) + } +} + +module.exports = { + fuel: { tvl, borrowed, }, + timetravel: false, +} + diff --git a/projects/sweep-n-flip/index.js b/projects/sweep-n-flip/index.js index 6f4d2f25beba..5c0e0e00913f 100644 --- a/projects/sweep-n-flip/index.js +++ b/projects/sweep-n-flip/index.js @@ -1,37 +1,76 @@ +const { getLogs } = require('../helper/cache/getLogs'); +const { transformDexBalances } = require('../helper/portedTokens'); -const { getLogs } = require('../helper/cache/getLogs') -const { transformDexBalances } = require('../helper/portedTokens') - -const factory = '0x16eD649675e6Ed9F1480091123409B4b8D228dC1' module.exports = { misrepresentedTokens: true, methodology: 'TVL counts the liquidity of the pools on each chain.', -} +}; const config = { - ethereum: { fromBlock: 12965000, }, - polygon: { fromBlock: 12965000, }, - arbitrum: { fromBlock: 101851523, }, -} + ethereum: { + fromBlock: 12965000, + factory: '0x16eD649675e6Ed9F1480091123409B4b8D228dC1', + }, + polygon: { + fromBlock: 12965000, + factory: '0x16eD649675e6Ed9F1480091123409B4b8D228dC1', + }, + arbitrum: { + fromBlock: 101851523, + factory: '0x16eD649675e6Ed9F1480091123409B4b8D228dC1', + }, + mode: { + fromBlock: 6989680, + factory: '0x7962223D940E1b099AbAe8F54caBFB8a3a0887AB', + }, +}; -Object.keys(config).forEach(chain => { - const { fromBlock } = config[chain] +Object.keys(config).forEach((chain) => { + const { fromBlock, factory } = config[chain]; module.exports[chain] = { tvl: async (api) => { let logs = await getLogs({ api, target: factory, - eventAbi: "event PairCreated(address indexed token0, address indexed token1, address pair, uint256)", + eventAbi: + 'event PairCreated(address indexed token0, address indexed token1, address pair, uint256)', onlyArgs: true, fromBlock, - }) - let pairs = logs.map(log => log.pair) - const names = await api.multiCall({ abi: 'string:name', calls: pairs }) - logs = logs.filter((pair, i) => names[i] === 'SweepnFlip LPs') - pairs = logs.map(log => log.pair) - const bals0 = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map((pair, i) => ({ target: logs[i].token0, params: pair })) }) - const bals1 = await api.multiCall({ abi: 'erc20:balanceOf', calls: pairs.map((pair, i) => ({ target: logs[i].token1, params: pair })) }) - return transformDexBalances({ chain, data: logs.map((l, i) => ({ token0Bal: bals0[i], token1Bal: bals1[i], token0: l.token0, token1: l.token1 })) }) - } - } -}) \ No newline at end of file + }); + + let pairs = logs.map((log) => log.pair); + + const names = await api.multiCall({ abi: 'string:name', calls: pairs }); + + logs = logs.filter((pair, i) => names[i] === 'SweepnFlip LPs'); + + pairs = logs.map((log) => log.pair); + + const bals0 = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: pairs.map((pair, i) => ({ + target: logs[i].token0, + params: pair, + })), + }); + + const bals1 = await api.multiCall({ + abi: 'erc20:balanceOf', + calls: pairs.map((pair, i) => ({ + target: logs[i].token1, + params: pair, + })), + }); + + return transformDexBalances({ + chain, + data: logs.map((l, i) => ({ + token0Bal: bals0[i], + token1Bal: bals1[i], + token0: l.token0, + token1: l.token1, + })), + }); + }, + }; +}); diff --git a/projects/swell-earn-eth/index.js b/projects/swell-earn-eth/index.js new file mode 100644 index 000000000000..6eb2e6e2684b --- /dev/null +++ b/projects/swell-earn-eth/index.js @@ -0,0 +1,43 @@ +const { sumTokens2, PANCAKE_NFT_ADDRESS } = require('../helper/unwrapLPs') +const ADDRESSES = require('../helper/coreAssets.json') + +const earnETHVault = '0x9Ed15383940CC380fAEF0a75edacE507cC775f22'; +const pancakeswapMasterChef = '0x556B9306565093C855AEA9AE92A594704c2Cd59e' + +const ethTokens = [ + '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', // rswETH + '0xf951E335afb289353dc249e82926178EaC7DEd78', // swETH + ADDRESSES.ethereum.WSTETH, // wstETH + ADDRESSES.ethereum.WETH, // WETH +] + +const pendleLPTokens = [ + "0x7C7FbB2d11803C35Aa3e283985237aD27f64406B", //rswETH 26Dec2024 + "0x0e1C5509B503358eA1Dac119C1D413e28Cc4b303", //swETH 26December2024 +] + +const vaultTokens = [ + "0x78Fc2c2eD1A4cDb5402365934aE5648aDAd094d0", // Re7 WETH +] + +const tokens = [ + ...ethTokens, + ...pendleLPTokens, + ...vaultTokens, +] + + +const tvl = async (api) => { + return sumTokens2({ + api, + owner: earnETHVault, tokens, + uniV3nftsAndOwners: [[PANCAKE_NFT_ADDRESS, earnETHVault]], + uniV3ExtraConfig: { nftIdFetcher: pancakeswapMasterChef } + }) +} + +module.exports = { + methodology: 'TVL represents the sum of tokens deposited in the vault + LP positions', + doublecounted: true, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/swell-restaking/index.js b/projects/swell-restaking/index.js index 21d2809246fe..4e778c17f9b7 100644 --- a/projects/swell-restaking/index.js +++ b/projects/swell-restaking/index.js @@ -1,13 +1,12 @@ const { nullAddress } = require("../helper/tokenMapping") async function tvl(api) { - const tvl = await api.call({ - target: "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0", - abi: "uint256:totalETHDeposited" - }) + const totalSupply = await api.call({ target: '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', abi: 'uint256:totalSupply'}); + const rate = await api.call({ target: '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', abi: 'uint256:getRate'}); + return { - [nullAddress]: tvl - } + [nullAddress]: (totalSupply * rate)/1e18 + }; } module.exports = { diff --git a/projects/swell-swbtc/index.js b/projects/swell-swbtc/index.js new file mode 100644 index 000000000000..61f3308a3c25 --- /dev/null +++ b/projects/swell-swbtc/index.js @@ -0,0 +1,8 @@ +const { sumERC4626VaultsExport } = require('../helper/erc4626') + +module.exports = { + doublecounted: true, + ethereum: { + tvl: sumERC4626VaultsExport({ vaults: ['0x8DB2350D78aBc13f5673A411D4700BCF87864dDE'], isOG4626: true, }), + }, +} \ No newline at end of file diff --git a/projects/swirllend/index.js b/projects/swirllend/index.js index ec5925e93ec2..a9727b1352a3 100644 --- a/projects/swirllend/index.js +++ b/projects/swirllend/index.js @@ -3,19 +3,18 @@ const { compoundExports2 } = require("../helper/compound"); module.exports = { linea: compoundExports2({ comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", - fetchBalances: true, cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', }), base: compoundExports2({ comptroller: "0xcAABf6Ffb76634183254B0a4a3D5fb36180FdAE4", - fetchBalances: true, cether: '0x91067b912f89dfca50c3f5529dbeb78b63c6a2e5', }), hallmarks: [ [Math.floor(new Date('2023-08-16')/1e3), 'Project Rugged!'], ], + deadFrom: '2023-08-16' }; module.exports.base.borrowed = () => ({}) diff --git a/projects/swissborg/index.js b/projects/swissborg/index.js index 77d068e1efb4..052e2e97ac8f 100644 --- a/projects/swissborg/index.js +++ b/projects/swissborg/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const config = { ethereum: { @@ -16,17 +17,14 @@ const config = { '0x11444C6389A26C8E41d7FD5CafBfCC511303b7d3', '0x67FE3293FC4e877F3CDc3F0ed93721a600f72BdE', '0x178Fb204c1ff2Ed7d0651C522A3a5B15480Eb76d', + '0xFbA64167e4f091Ca625FA79aa6f83665856f8Bf2', + '0x8F0d8b27bF808976Fa94f03e2230b4bca95bf3C4', + '0xe2484A7Ac1b9Cb6D8E55fd00e129aB913172bea6', + '0xdbe15F6573108B6736c70779C683Ca633c18aFe2', ], }, bitcoin: { - owners: [ - '18DowXoMUQT5EU8zPTDTrq4hrwmi8ddCcc', - 'bc1qfu6su3qz4tn0et634mv7p090a0cgameq6rdvuc', - 'bc1qutkfwnuq4v0zdkenqt5vyuxlrmsezldzue5znc', - '1Mgs8zLJ7JyngcNRUscayyPHnnYJpJS5x2', - 'bc1qc8ee9860cdnkyej0ag5hf49pcx7uvz89lkwpr9', - '1JgXCkk3gjmgfgjT2vvnjpvqfvNNTFCRpM', - ] + owners: bitcoinAddressBook.swissborg }, ripple: { owners: [ @@ -49,6 +47,8 @@ const config = { 'Cet3t77x2BBVSmiEFm8ZPoDSngbpso2RuWPL79Ky7SpA', '9qoUcyhKSWMbk6tqGUYQUpeosPcdUnJszG4eQKwfe4gL', 'Fe7SEekiKygziaEGKxsDsgLVzrCfNvVBvAYsaJBwFA8s', + 'AR2ecEWY2vfsXmd4fUxc196LhbX5p8TnhvJg8t3fgYUN', + '7Sng9GTnkjjb8WTF2kYX8JWqGHHwJGk5Ke9639zREUAR', ], }, polkadot: { @@ -106,7 +106,17 @@ const config = { owners: [ 'cosmos10dfzd2wpnpeuy2lgan35ah8dg5p4l298v0n8e8', ] - } + }, + arbitrum: { + owners: [ + '0x8F0d8b27bF808976Fa94f03e2230b4bca95bf3C4', + ] + }, + // injective: { + // owners: [ + // 'inj1wvhk7xhzf9kus9a4tpa6v8vhuqvm265rz7zd6n', + // ] + // } } module.exports = cexExports(config) diff --git a/projects/swivel/index.js b/projects/swivel/index.js index ff654a4a7d4f..557bf1710ec9 100644 --- a/projects/swivel/index.js +++ b/projects/swivel/index.js @@ -5,6 +5,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-03-13') / 1e3), 'Euler was hacked'], ], + deadFrom: '2023-03-13', ethereum: { tvl: sumTokensExport({ owners: [ diff --git a/projects/swop/index.js b/projects/swop/index.js index a70e7ddf3285..f73ae827beab 100644 --- a/projects/swop/index.js +++ b/projects/swop/index.js @@ -1,32 +1,31 @@ const { sumTokens, call } = require('../helper/chain/waves'); const { getConfig } = require("../helper/cache"); -// const { get } = require("../helper/http"); -// const { toUSDTBalances } = require("../helper/balances"); - +const { getUniTVL } = require('../helper/unknownTokens') const swopfiBackendEndpoint = "https://backend.swop.fi"; const getSwopFiTVL = async (api) => { - // const poolsStats = await get(`${swopfiBackendEndpoint}/pools`); - // return toUSDTBalances(poolsStats.overall.liquidity); const { pools } = await getConfig('swop', `${swopfiBackendEndpoint}/pools`) - // const owners = pools.map(i => i.id) for (const pool of pools) { await sumTokens({ owners: [pool.id], api, includeWaves: true, blacklistedTokens: ['Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT'] }) } } - module.exports = { timetravel: false, // Waves blockchain, methodology: "Counts the tokens locked on AMM pools", + misrepresentedTokens: true, + hallmarks: [ + [1730299107, "Unit0 Protocol Lunch"] + ], waves: { tvl: getSwopFiTVL, staking: async () => { - // const stakingStats = await get(`${swopfiBackendEndpoint}/staking`); - // return toUSDTBalances(stakingStats.swop.totalSwopUsdt); const res = await call({ target: '3PLHVWCqA9DJPDbadUofTohnCULLauiDWhS', key: 'total_GSwop_amount' }) return { swop: res / 1e8 } } + }, + unit0: { + tvl: getUniTVL({ factory: '0x944Eb5ac122Ea8c764Fa80e80A7fCA2C9A13Ab0a', useDefaultCoreAssets: true}) } }; diff --git a/projects/syde/index.js b/projects/syde/index.js new file mode 100644 index 000000000000..8becae7d9a13 --- /dev/null +++ b/projects/syde/index.js @@ -0,0 +1,13 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const sydeBtcPool = "EQA2J0WCTdYdG-XeyMpPBTeu2dWB2f0oFiV4KVRfV0gewF4E" +const sydeEthPool = "EQD-7ycFO3yeh0EeT2wgXoOQmu64rdDBXqGm4nHDInPfCxJG" +const sydeEurPool = "EQDXvkuKPZahcTDRHSybwiU0E5VpiGFP2QS2iHr082JmtTT9" + +module.exports = { + methodology: 'Counts Syde smartcontract balance as TVL.', + ton: { + tvl: sumTokensExport({ owners: [sydeBtcPool, sydeEthPool, sydeEurPool], tokens: [ADDRESSES.null]}), + } +} diff --git a/projects/sygnum-bank/index.js b/projects/sygnum-bank/index.js new file mode 100644 index 000000000000..3d1318486b7e --- /dev/null +++ b/projects/sygnum-bank/index.js @@ -0,0 +1,11 @@ +const fund = "0x2AB105A3eAd22731082B790CA9A00D9A3A7627F9"; + +module.exports = { + methodology: "TVL represents the total sum of all tokens minted in Fidelity's investment fund (FIUSD)", + era: { + tvl: async (api) => { + const supply = await api.call({ target: fund, abi: "erc20:totalSupply" }); + api.add("0x2AB105A3eAd22731082B790CA9A00D9A3A7627F9", supply); + }, + }, +}; diff --git a/projects/symbiosis-finance/config.js b/projects/symbiosis-finance/config.js index bc211d0e2eef..68ec85e76d6d 100644 --- a/projects/symbiosis-finance/config.js +++ b/projects/symbiosis-finance/config.js @@ -4,10 +4,12 @@ const TOKENS = { ethereum: { pufETH: "0xD9A442856C234a39a81a089C06451EBAa4306a72", LADYS: "0x12970E6868f88f6557B76120662c1B3E50A646bf", - XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28", + G: "0x9C7BEBa8F6eF6643aBd725e45a4E8387eF260649" }, bsc: { - XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" + XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28", + G: "0x9C7BEBa8F6eF6643aBd725e45a4E8387eF260649" }, polygon: { XDAO: "0x71eebA415A523F5C952Cc2f06361D5443545Ad28" @@ -34,6 +36,16 @@ const TOKENS = { fraxtal: { WETH: ADDRESSES.fraxtal.WETH, FRAX: ADDRESSES.fraxtal.FRAX + }, + gravity: { + USDC_e: ADDRESSES.gravity.USDC_e, + wG: ADDRESSES.gravity.wG + }, + bsquared: { + WBTC: ADDRESSES.bsquared.WBTC, + }, + cronos_zkevm: { + USDC: ADDRESSES.cronos_zkevm.USDC, } } @@ -50,6 +62,7 @@ module.exports = { TOKENS.ethereum.XDAO, TOKENS.ethereum.LADYS, TOKENS.ethereum.pufETH, + TOKENS.ethereum.G, ], holders: [ '0xb80fDAA74dDA763a8A158ba85798d373A5E84d84', // portal v1 @@ -65,6 +78,7 @@ module.exports = { ADDRESSES.bsc.ETH, ADDRESSES.bsc.BTCB, TOKENS.bsc.XDAO, + TOKENS.bsc.G, ], holders: [ '0xD7F9989bE0d15319d13d6FA5d468211C89F0b147', // portal v1 @@ -385,6 +399,7 @@ module.exports = { name: 'zeta', tokens: [ TOKENS.zeta.pufETH, + ADDRESSES.zeta.USDC_1, ], holders: [ '0x8a7F930003BedD63A1ebD99C5917FD6aE7E3dedf', // portal v2 @@ -409,5 +424,33 @@ module.exports = { '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 ] }, + { + name: 'gravity', + tokens: [ + TOKENS.gravity.USDC_e, + TOKENS.gravity.wG, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'bsquared', + tokens: [ + TOKENS.bsquared.WBTC, + ], + holders: [ + '0x292fC50e4eB66C3f6514b9E402dBc25961824D62', // portal v2 + ] + }, + { + name: 'cronos_zkevm', + tokens: [ + TOKENS.cronos_zkevm.USDC, + ], + holders: [ + '0x2E818E50b913457015E1277B43E469b63AC5D3d7', // portal v2 + ] + }, ] } \ No newline at end of file diff --git a/projects/symmetric/index.js b/projects/symmetric/index.js index 126b17d6c360..dd34bfed5620 100644 --- a/projects/symmetric/index.js +++ b/projects/symmetric/index.js @@ -1,5 +1,5 @@ const sdk = require('@defillama/sdk'); -const { v1Tvl, onChainTvl } = require('../helper/balancer') +const { v1Tvl, onChainTvl, balV2GraphExport } = require('../helper/balancer') module.exports = { celo: { @@ -19,5 +19,11 @@ module.exports = { }, meter: { tvl: onChainTvl('0x913f21E596790aFC6AA45229E9ff8b7d0A473D5A', 51825430), + }, + taiko: { + tvl: onChainTvl('0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD', 371729), + }, + etlk: { + tvl: balV2GraphExport({ vault:'0xbccc4b4c6530F82FE309c5E845E50b5E9C89f2AD', graphURL: '4y4fC3k9DMrJ9XYY6Z1Qi8DXJkpRrQuQCjh7zBRhxjQr', name: 'symmetric-etlk'}) } } diff --git a/projects/synatra/index.js b/projects/synatra/index.js new file mode 100644 index 000000000000..8acc14204a04 --- /dev/null +++ b/projects/synatra/index.js @@ -0,0 +1,15 @@ +const { getTokenSupplies,} = require("../helper/solana"); + +const ySOL_MINT = 'yso11zxLbHA3wBJ9HAtVu6wnesqz9A2qxnhxanasZ4N'; +const yUSD_MINT = 'yUSDX7W89jXWn4zzDPLnhykDymSjQSmpaJ8e4fjC1fg'; +const TOKEN_MINTS = [ySOL_MINT, yUSD_MINT] + +async function tvl(api) { + await getTokenSupplies(TOKEN_MINTS, {api }) +} + +module.exports = { + doublecounted: true, + methodology: 'Tracks tvl via number of tokens currently minted for each pool.', + solana: { tvl, }, +} diff --git a/projects/synstation/index.js b/projects/synstation/index.js new file mode 100644 index 000000000000..d7c9dac062ae --- /dev/null +++ b/projects/synstation/index.js @@ -0,0 +1,20 @@ +const { sumUnknownTokens } = require("../helper/unknownTokens") + +const config = { + ethereum: "0x3BaC111A6F5ED6A554616373d5c7D858d7c10d88", + astar: "0xe9B85D6A1727d4B22595bab40018bf9B7407c677" +} + +Object.keys(config).forEach(chain => { + const prestakingAddress = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const data = await api.fetchList({ lengthAbi: 'uint256:poolLength', itemAbi: 'function poolInfo(uint256) view returns (address want, uint256 totalDeposited,uint256,uint256)', target: prestakingAddress, }) + + const tokens = data.map(i => i.want) + const bals = data.map(i => i.totalDeposited) + bals.forEach((v, i) => v && api.add(tokens[i], v)) + return sumUnknownTokens({ api, resolveLP: true, useDefaultCoreAssets: true, }) + } + } + }) \ No newline at end of file diff --git a/projects/synthetix-v3/index.js b/projects/synthetix-v3/index.js index 168346a3d0c8..6c0afca10e0b 100644 --- a/projects/synthetix-v3/index.js +++ b/projects/synthetix-v3/index.js @@ -1,11 +1,22 @@ const { sumTokensExport } = require('../helper/unwrapLPs') const ADDRESSES = require('../helper/coreAssets.json') +const CUSTOM_ADDRESSES = { + arbitrum: { + WEETH: "0x35751007a407ca6FEFfE80b3cB397736D2cf4dbe", + sUSDe: "0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2", + tBTC: "0x6c84a8f1c29108F47a79964b5Fe888D4f4D0dE40" + } +} + module.exports = { + ethereum: { + tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.ethereum.SNX] }) + }, 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] }) + tvl: sumTokensExport({ owner: '0xffffffaEff0B96Ea8e4f94b2253f31abdD875847', tokens: [ADDRESSES.arbitrum.USDC_CIRCLE, ADDRESSES.arbitrum.WETH, ADDRESSES.arbitrum.ARB, ADDRESSES.arbitrum.USDe, ADDRESSES.arbitrum.WSTETH, CUSTOM_ADDRESSES.arbitrum.WEETH, CUSTOM_ADDRESSES.arbitrum.sUSDe, CUSTOM_ADDRESSES.arbitrum.tBTC] }) } } diff --git a/projects/tachyswap/index.js b/projects/tachyswap/index.js index 582afc546df2..c6e7a20ea012 100644 --- a/projects/tachyswap/index.js +++ b/projects/tachyswap/index.js @@ -4,7 +4,6 @@ module.exports = { misrepresentedTokens: true, etlk: { tvl: getUniTVL({ - fetchBalances: true, useDefaultCoreAssets: true, factory: '0x033eff22bC5Bd30c597e1fdE8Ca6fB1C1274C688', }) diff --git a/projects/taco/index.js b/projects/taco/index.js new file mode 100644 index 000000000000..b03c24affd16 --- /dev/null +++ b/projects/taco/index.js @@ -0,0 +1,24 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +// Taco Studios +// https://swap.tacocrypto.io +async function wax() { + const accounts = ["swap.taco"]; + const tokens = [ + ["eosio.token", "WAX", "wax"], + ["token.nefty", "NEFTY", "nefty"], + ["alien.worlds", "TLM", "alien-worlds"], + ["usdt.alcor", "USDT", "alcor-ibc-bridged-usdt-wax"], + ["wombattokens", "WOMBAT", "wombat"], + ["wuffi", "WUF", "wuffi"], + ["token.fusion", "LSWAX", "waxfusion-staked-wax"], + ]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +module.exports = { + methodology: `Taco Studios TVL is achieved by querying token balances from a (v2 uniswap fork) swap contract`, + wax: { + tvl: wax + }, +} \ No newline at end of file diff --git a/projects/taffy/index.js b/projects/taffy/index.js index 30cf64f9ab3b..bcdb9ee1b27c 100644 --- a/projects/taffy/index.js +++ b/projects/taffy/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens'); -module.exports = uniTvlExport('saakuru', '0xb9FFd4f89A86a989069CAcaE90e9ce824D0c4971', { fetchBalances: true, }) \ No newline at end of file +module.exports = uniTvlExport('saakuru', '0xb9FFd4f89A86a989069CAcaE90e9ce824D0c4971') \ No newline at end of file diff --git a/projects/taidog/index.js b/projects/taidog/index.js index 8e56a5ad2de3..b7a89476a5fd 100644 --- a/projects/taidog/index.js +++ b/projects/taidog/index.js @@ -7,7 +7,7 @@ const TAIDOG_STAKING_CONTRACT = "0x9b4484D5A2665930702d09f74086CAD86d96b25E"; const TAIDOG_WETH_LP = "0x28Be5f9caBd48B712a031a901590b71f5509526D"; const LP_STAKING_CONTRACT = "0xD664c3b22c60b4927ab1e0035b99F157bc2d8F1B"; -const TAIKO_TOKEN = "0xA9d23408b9bA935c230493c40C73824Df71A0975"; +const TAIKO_TOKEN = ADDRESSES.taiko.TAIKO; const TAIKO_STAKING_CONTRACT = "0x89a95021E45AcAB4B89eb20C18691E3E0D1d2170"; async function poolsTvl(api) { diff --git a/projects/taikodrips/index.js b/projects/taikodrips/index.js new file mode 100644 index 000000000000..6a13030c3be8 --- /dev/null +++ b/projects/taikodrips/index.js @@ -0,0 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { staking } = require("../helper/staking") + +const TaikoToken = ADDRESSES.taiko.TAIKO +const FarmingContract = '0xf90209C44dBf5Fa3d40ac85a008206b5A8c24899' + +module.exports = { + methodology: 'We count the TVL on the Taiko token in the farming contract.', + taiko: { + tvl: () => ({}), + staking: staking([FarmingContract], TaikoToken) + } +} diff --git a/projects/takoTako/index.js b/projects/takoTako/index.js new file mode 100644 index 000000000000..ffe978e3438d --- /dev/null +++ b/projects/takoTako/index.js @@ -0,0 +1,14 @@ +const { aaveV2Export } = require("../helper/aave"); +const methodologies = require("../helper/methodologies"); + +const LPConfiguratorContract = "0xD07B62ee683267D4A884453eaE982A151653515E"; + +module.exports = { + taiko: { + ...aaveV2Export(LPConfiguratorContract, { + fromBlock: 381054, + }), + }, +}; + +module.exports.methodology = methodologies.lendingMarket; diff --git a/projects/tangible-ustb/index.js b/projects/tangible-ustb/index.js index b04203fbda1b..1b0d2ba68578 100644 --- a/projects/tangible-ustb/index.js +++ b/projects/tangible-ustb/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { sumTokensExport } = require('../helper/unwrapLPs') const USTB = '0x83fedbc0b85c6e29b589aa6bdefb1cc581935ecd' module.exports = { ethereum: { - tvl: sumTokensExport({ owner: USTB, tokens: ["0x59D9356E565Ab3A36dD77763Fc0d87fEaf85508C"]}), + tvl: sumTokensExport({ owner: USTB, tokens: [ADDRESSES.ethereum.USDM]}), }, } \ No newline at end of file diff --git a/projects/tanukix/index.js b/projects/tanukix/index.js new file mode 100644 index 000000000000..a257ba1488ac --- /dev/null +++ b/projects/tanukix/index.js @@ -0,0 +1,8 @@ +const { onChainTvl } = require('../helper/balancer') + +module.exports = { + methodology: "Sum of all the tokens locked in TanukiX vault", + taiko: { + tvl: onChainTvl('0x3251e99cEf4b9bA03a6434B767aa5Ad11ca6cc31', 204741) + }, +} \ No newline at end of file diff --git a/projects/taoline/index.js b/projects/taoline/index.js new file mode 100644 index 000000000000..68025d3f0850 --- /dev/null +++ b/projects/taoline/index.js @@ -0,0 +1,9 @@ +const { sumTokensExport } = require('../helper/solana'); + +module.exports = { + timetravel: false, + solana: { + tvl: () => ({}), + staking: sumTokensExport({ owner: '55UhbArZh8WBNM6dbjo93bdiUxnyznX1ivFQNgRhopJN' }), + }, +}; diff --git a/projects/tashi/index.js b/projects/tashi/index.js index e08d509c353b..b7dd8ec1e03f 100644 --- a/projects/tashi/index.js +++ b/projects/tashi/index.js @@ -1,7 +1,6 @@ const { compoundExports } = require('../helper/compound') -const ADDRESSES = require('../helper/coreAssets.json') module.exports = { methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", - evmos: compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "evmos", "0x1cd248D72248A0618932F77093Dc4ceC9757759d", ADDRESSES.null, undefined, undefined, { fetchBalances: true, }) + evmos: compoundExports("0x053841Bd1D291380726a007eA834Ecd296923260", "0x1cd248D72248A0618932F77093Dc4ceC9757759d") } diff --git a/projects/tbtc/index.js b/projects/tbtc/index.js index 0ac5ec61809c..a749ac298f21 100644 --- a/projects/tbtc/index.js +++ b/projects/tbtc/index.js @@ -1,35 +1,13 @@ -const sdk = require('@defillama/sdk'); -const { sumTokensExport } = require('../helper/sumTokens'); +const { sumTokens } = require('../helper/chain/bitcoin') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') -const owners = [ -'bc1ql6yu2xywnmslnameu6376wzut4nwnafdj483ez', -'bc1q7uf083n9rsn8zgds0eg9kyzugjcz7pe4sq2jzf', -'bc1ql54ftzuh6k76wcn7330vlwxahhth8lqjc55lkc', -'bc1qhq052tz9pvjp4x2vu6ndc4rlpxesc9dz37uqt5', -'bc1q3rtrkav9l6m0e5vxya77mtlvqh8rk0eyf74277', -'bc1qde4ggwj2jp5tetjztfml3peyvwzvpwtr9ng6we', -'bc1qrzk68h8l2kvkvky00l8xvwz45pr4mmtyfpf0j8', -'bc1qkza8dm07rr5pxedam5w5v5g627j0lrwwzncsvd', -'bc1qrw5tn47ea05seyetlywltrdk06rldpk746etc9', -'bc1qcwkzqwfyqc7frec2g0rmjlrsw3d8vdwxrksn62', -'bc1qpdrzltkxg742jk8tr0pe7hltkme5p25ezmllz6', -'bc1qpqrm609emjpl35v2fu3frq0r87d29vm8ffygkf', -'bc1qhqlyelhwffrwdz4xzfe5whqxxft8quzvdscc8g', -'bc1qpaz0dp264pakv6f6ljmg2f3x27xmsj6la33mhc', -'bc1q9alywjvrsxu024a2m25lltl6h070l6lqfya45c', -'bc1q8cwt90ck2uvzwqj7q3dwvwclnprz7rk4qzk05k', -'bc1q2xygt58u9r6hc32uxruh93ap8q9898rep04xdk', -'bc1q4rheadle4sgdgdatkeuqfm90qv3wpkd7q8yp0m', -'bc1qrflqxl5pwet9tgv4uex6a6srmh3u4cvefeq0h6', -'bc1qqu0nw5n5n6uvjw5m3hwh8zvzckd8cnth8nt80k', -'bc1q3las75huex5jjhunheqycegw2x8fvhc6y0q3nu', -] +async function tvl() { + return sumTokens({ owners: await bitcoinAddressBook.tBTC() }) +} module.exports = { + timetravel: false, methodology: "BTC on btc chain", - bitcoin: { - tvl: sdk.util.sumChainTvls([ - sumTokensExport({ owners }), - ]), - }, + ethereum: { tvl: () => ({}) }, + bitcoin: { tvl }, }; diff --git a/projects/tcv_platform/index.js b/projects/tcv_platform/index.js new file mode 100644 index 000000000000..9a2da61ba615 --- /dev/null +++ b/projects/tcv_platform/index.js @@ -0,0 +1,18 @@ + + +const { sumTokens2 } = require('../helper/unwrapLPs'); + +async function tvl(api) { + const tcvFactory = "0xCa2396933E02Fb7636126a914aE5f5512ab31077"; + const index = await api.call({ target: tcvFactory, abi: 'uint256:numVaults', }); + const vaults = await api.call({ target: tcvFactory, abi: 'function vaults(uint256,uint256) returns (address[])', params: ["0", String(index)], }); + await sumTokens2({ api, resolveUniV3: true, owners: vaults }) +} + +module.exports = { + methodology: "Calculates total liquidity from all NFT ranges in the given pools.", + start: 1717239410, + arbitrum: { + tvl, + }, +}; \ No newline at end of file diff --git a/projects/teahouse-v3/abi.js b/projects/teahouse-v3/abi.js index f286f9420cd6..798f7ec2aa79 100644 --- a/projects/teahouse-v3/abi.js +++ b/projects/teahouse-v3/abi.js @@ -1,6 +1,7 @@ module.exports = { + assetToken0: "function assetToken0() view returns (address)", assetToken1: "function assetToken1() view returns (address)", - estimatedValueIntoken1: "function estimatedValueInToken1() view returns (uint256 value1)", + vaultAllUnderlyingAssets: "function vaultAllUnderlyingAssets() view returns (uint256 amount0, uint256 amount1)", getAssets: "function getAssets() view returns (address[])", getAssetsBalance: "function getAssetsBalance() view returns (uint256[])", assetType: "function assetType(address) external returns (uint8)", @@ -13,11 +14,19 @@ module.exports = { outputs: [{ name: "address", type: "felt" }], customType: "address", }, - estimated_value_in_token0: { + asset_token1: { type: "function", state_mutability: "view", - name: "estimated_value_in_token0", + name: "asset_token1", inputs: [], - outputs: [{ name: "value", type: "Uint256" }], + outputs: [{ name: "address", type: "felt" }], + customType: "address", + }, + vault_all_underlying_assets: { + type: "function", + state_mutability: "view", + name: "vault_all_underlying_assets", + inputs: [], + outputs: [{ name: "amount", "type": "(core::integer::u256, core::integer::u256)" }], }, -}; +}; \ No newline at end of file diff --git a/projects/teahouse-v3/index.js b/projects/teahouse-v3/index.js index df331983caf0..f90a68739d48 100644 --- a/projects/teahouse-v3/index.js +++ b/projects/teahouse-v3/index.js @@ -45,19 +45,25 @@ chains.forEach((chain) => { tvl: async (api) => { const vaults = await getVaultContractsAddress(chain); - // EVM pair vault - let tokens = await api.multiCall({ + let tokens0 = await api.multiCall({ + abi: abi.assetToken0, + calls: vaults.pair, + }); + let tokens1 = await api.multiCall({ abi: abi.assetToken1, calls: vaults.pair, }); let bals = await api.multiCall({ - abi: abi.estimatedValueIntoken1, + abi: abi.vaultAllUnderlyingAssets, calls: vaults.pair, }); - api.addTokens(tokens, bals); + let bals0 = bals.map(innerArray => innerArray[0]); + let bals1 = bals.map(innerArray => innerArray[1]); + api.addTokens(tokens0, bals0); + api.addTokens(tokens1, bals1); // EVM portfolio vault - tokens = await api.multiCall({ abi: abi.getAssets, calls: vaults.port }); + let tokens = await api.multiCall({ abi: abi.getAssets, calls: vaults.port }); bals = await api.multiCall({ abi: abi.getAssetsBalance, calls: vaults.port }); let assetTypes = await Promise.all(tokens.map( async (tokenArr, index) => @@ -88,15 +94,22 @@ chains.forEach((chain) => { api.addTokens(tokens, bals); // Starknet pair vault - tokens = await starknet.multiCall({ + tokens0 = await starknet.multiCall({ abi: abi.asset_token0, calls: vaults.starknetPair, }); + tokens1 = await starknet.multiCall({ + abi: abi.asset_token1, + calls: vaults.starknetPair, + }); bals = await starknet.multiCall({ - abi: abi.estimated_value_in_token0, + abi: abi.vault_all_underlying_assets, calls: vaults.starknetPair, }); - api.addTokens(tokens, bals); + bals0 = bals.map(innerArray => innerArray.amount['0']); + bals1 = bals.map(innerArray => innerArray.amount['1']); + api.addTokens(tokens0, bals0); + api.addTokens(tokens1, bals1); return api.getBalances(); }, diff --git a/projects/teleswap/index.js b/projects/teleswap/index.js new file mode 100644 index 000000000000..f4d272436a9b --- /dev/null +++ b/projects/teleswap/index.js @@ -0,0 +1,34 @@ +const sdk = require('@defillama/sdk'); +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require('../helper/sumTokens.js'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') +const { sumTokensExport: sumBRC20TokensExport } = require('../helper/chain/brc20.js'); + +const TST = "0x0828096494ad6252F0F853abFC5b6ec9dfe9fDAd"; +const TST_DELEGATION = "0x93AD6C8B3a273E0B4aeeBd6CF03422C885217D3B"; + + +module.exports = { + methodology: 'TVL is the sum of all BTC locked by users, collateral locked by Lockers, and TST delegated to Lockers.', + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners: bitcoinAddressBook.teleswap }), + sumBRC20TokensExport({ owners: bitcoinAddressBook.teleswap }), + ]) + }, + ethereum: { staking: sumTokensExport({ owners: [TST_DELEGATION], tokens: [TST] }) }, +} + +const config = { + polygon: { owners: ['0xf5D6D369A7F4147F720AEAdd4C4f903aE8046166'], tokens: [ADDRESSES.null] }, + bsc: { owners: ['0x84F74e97ebab432CeE185d601290cE0A483987A5'], tokens: [ADDRESSES.null] }, + bsquared: { owners: ['0x20752a82fe75996a582Ae2be1b7C3D4866C5b733'], tokens: [ADDRESSES.bsquared.WBTC] }, + bob: { owners: ['0xd720996f0D8fFD9154c8271D2991f54E5d93D2A9'], tokens: [ADDRESSES.bob.WBTC] }, +} + +Object.keys(config).forEach(chain => { + const { owners, tokens, } = config[chain] + module.exports[chain] = { + tvl: sumTokensExport({ owners, tokens }) + } +}) \ No newline at end of file diff --git a/projects/tempest-finance/chains.js b/projects/tempest-finance/chains.js new file mode 100644 index 000000000000..fefbc9aee644 --- /dev/null +++ b/projects/tempest-finance/chains.js @@ -0,0 +1,10 @@ +module.exports = { + ethereum: 1, + optimism: 10, + bsc: 56, + manta: 169, + canto: 7700, + base: 8453, + arbitrum: 42161, + scroll: 534352, +} \ No newline at end of file diff --git a/projects/tempest-finance/index.js b/projects/tempest-finance/index.js new file mode 100644 index 000000000000..915b98dbf0fd --- /dev/null +++ b/projects/tempest-finance/index.js @@ -0,0 +1,20 @@ +const chains = require("./chains"); +const axios = require("axios"); + +async function tvl(api) { + const response = await axios.get(`https://protocol-service-api.tempestfinance.xyz/api/v1/vaults?chainId=${chains[api.chain]}`) + const vaults = response.data.data.vaults; + + const tokens = vaults.map(vault => vault.mainAsset); + const balances = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults.map(vault => vault.address) }); + + api.addTokens(tokens, balances) +} + +Object.keys(chains).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + return await tvl(api) + } + } +}) diff --git a/projects/tempest/index.js b/projects/tempest/index.js index a3b893ead329..29480fcbfdb6 100644 --- a/projects/tempest/index.js +++ b/projects/tempest/index.js @@ -10,3 +10,7 @@ module.exports = { cether: '0x6283829589A6A02981B425fd2e86D22F012191aC', }) }; + +module.exports.deadFrom='2023-09-08', +module.exports.optimism.borrowed = () => ({}) // bad debt +module.exports.base.borrowed = () => ({}) // bad debt diff --git a/projects/templedao/index.js b/projects/templedao/index.js index 31116013d66a..94488f4ec8f8 100644 --- a/projects/templedao/index.js +++ b/projects/templedao/index.js @@ -16,7 +16,7 @@ const auraLocker = '0x3Fa73f1E5d8A792C80F426fc8F84FBF7Ce9bBCAC'; const templeTreasuryContract = "0x5c8898f8e0f9468d4a677887bc03ee2659321012"; const FRAX = ADDRESSES.ethereum.FRAX; -const FXS = "0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0"; +const FXS = ADDRESSES.ethereum.FXS; const CVX_FXS = ADDRESSES.ethereum.cvxFXS; const AURA = '0xC0c293ce456fF0ED870ADd98a0828Dd4d2903DBF' const TEMPLE_DENDEND1 = '0x8A5058100E60e8F7C42305eb505B12785bbA3BcA'; diff --git a/projects/tender-finance/index.js b/projects/tender-finance/index.js index bc9ca2578480..d14494d520a6 100644 --- a/projects/tender-finance/index.js +++ b/projects/tender-finance/index.js @@ -3,8 +3,8 @@ const { compoundExports } = require("../helper/compound"); module.exports = { hallmarks: [ - [1678190400,"Oracle Exploit"] + [1678190400, "Oracle Exploit"] ], methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets.", - arbitrum: compoundExports('0xeed247Ba513A8D6f78BE9318399f5eD1a4808F8e', 'arbitrum', '0x0706905b2b21574DEFcF00B5fc48068995FCdCdf', ADDRESSES.arbitrum.WETH) + arbitrum: compoundExports('0xeed247Ba513A8D6f78BE9318399f5eD1a4808F8e', '0x0706905b2b21574DEFcF00B5fc48068995FCdCdf', ADDRESSES.arbitrum.WETH) }; diff --git a/projects/terraswap/factoryTvl.js b/projects/terraswap/factoryTvl.js index 553e5ea64ab1..a038c565b73c 100644 --- a/projects/terraswap/factoryTvl.js +++ b/projects/terraswap/factoryTvl.js @@ -16,14 +16,15 @@ function getAssetInfo(asset) { return [extractTokenInfo(asset), Number(asset.amount)] } -async function getAllPairs(factory, chain) { +async function getAllPairs(factory, chain, { blacklistedPairs = [] } = {}) { + const blacklist = new Set(blacklistedPairs) let allPairs = [] let currentPairs; const limit = factory === 'terra14x9fr055x5hvr48hzy2t4q7kvjvfttsvxusa4xsdcy702mnzsvuqprer8r' ? 29 : 30 // some weird native token issue at one of the pagination query do { const queryStr = `{"pairs": { "limit": ${limit} ${allPairs.length ? `,"start_after":${JSON.stringify(allPairs[allPairs.length - 1].asset_infos)}` : ""} }}` currentPairs = (await queryContract({ contract: factory, chain, data: queryStr })).pairs - allPairs.push(...currentPairs) + allPairs.push(...currentPairs.filter(pair => !blacklist.has(pair.contract_addr))) } while (currentPairs.length > 0) const dtos = [] const getPairPool = (async (pair) => { @@ -35,29 +36,39 @@ async function getAllPairs(factory, chain) { const [addr, balance] = getAssetInfo(asset) pairDto.assets.push({ addr, balance }) }) + pairDto.pair_type = pair.pair_type dtos.push(pairDto) }) - const {errors} = await PromisePool + const { errors } = await PromisePool .withConcurrency(10) .for(allPairs) .process(getPairPool) - if((errors?.length ?? 0) > 50){ + if ((errors?.length ?? 0) > 50) { throw new Error(`Too many errors: ${errors.length}/${allPairs.length} on ${chain}`) } return dtos } -function getFactoryTvl(factory) { - return async (_, _1, _2, { chain }) => { - const pairs = (await getAllPairs(factory, chain)).filter(pair => (pair.assets[0].balance && pair.assets[1].balance)) +const isNotXYK = (pair) => pair.pair_type && pair.pair_type.custom === 'concentrated' - const data = pairs.map(({ assets }) => ({ +function getFactoryTvl(factory, { blacklistedPairs = [] } = {}) { + return async (api) => { + const pairs = (await getAllPairs(factory, api.chain, { blacklistedPairs })).filter(pair => (pair.assets[0].balance && pair.assets[1].balance)) + + const otherPairs = pairs.filter(isNotXYK) + const xykPairs = pairs.filter(pair => !isNotXYK(pair)) + otherPairs.forEach(({ assets }) => { + api.add(assets[0].addr, assets[0].balance) + api.add(assets[1].addr, assets[1].balance) + }) + + const data = xykPairs.map(({ assets }) => ({ token0: assets[0].addr, token0Bal: assets[0].balance, token1: assets[1].addr, token1Bal: assets[1].balance, })) - return transformDexBalances({ chain, data }) + return transformDexBalances({ api, data }) } } diff --git a/projects/tezfin/index.js b/projects/tezfin/index.js index 956de546b306..15eefb3ea7a8 100644 --- a/projects/tezfin/index.js +++ b/projects/tezfin/index.js @@ -11,7 +11,8 @@ async function tvl() { // v2 contracts "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2 "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2 - "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2 + "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB", // ꜰUSDt v2 + "KT19gZac3vqV3ZeMJbhMX7Xy8kcocKK4Tbz1" // ꜰtzBTC v2 ], includeTezos: true, }); @@ -26,7 +27,8 @@ async function borrowed() { // v2 contracts "KT1MCXxbtS62tk4CUxv29BHnqTBtvsFFGzBm", // ꜰXTZ v2 "KT1WQM7wj64GHCndwV8REccQ6N4tqZ3uRNqs", // ꜰUSDtz v2 - "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB" // ꜰUSDt v2 + "KT1HCRJhfqmWKRJtZXzvTkY4iisfuR4w6pkB", // ꜰUSDt v2 + "KT19gZac3vqV3ZeMJbhMX7Xy8kcocKK4Tbz1" // ꜰtzBTC v2 ]; const balances = {}; diff --git a/projects/thUSD/index.js b/projects/thUSD/index.js index 368dc65b0c89..ca9b1759d5a0 100644 --- a/projects/thUSD/index.js +++ b/projects/thUSD/index.js @@ -2,7 +2,7 @@ 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]}) +const ethTvl = sumTokensExport({ owners: ['0x1f490764473eb1013461D6079F827DB95d8B4DC5', '0xE922B5591Da479a559b25261BD6Dc8f89cA1A29d'], tokens: [nullAddress]}) module.exports = { ethereum: { diff --git a/projects/thala-lsd/index.js b/projects/thala-lsd/index.js index 4846b3fd3bb2..122d11eab8de 100644 --- a/projects/thala-lsd/index.js +++ b/projects/thala-lsd/index.js @@ -1,17 +1,24 @@ -const { aQuery } = require('../helper/chain/aptos') +const { aQuery, function_view } = require('../helper/chain/aptos') // Note: thala-lsd is under the umbrella of Thala protocols const LSD_ACCOUNT = "0xfaf4e633ae9eb31366c9ca24214231760926576c7b625313b3688b5e900731f6"; +const THALA_VALIDATOR = "0xe888a0adfb4ca871bfe6aada8511f5326e877a8ce66a9980ef089eb2218d740c"; module.exports = { timetravel: false, methodology: "Aggregates thAPT backing Thala LSD's APT delegation.", aptos: { tvl: async () => { - const { data: { supply } } = await aQuery(`/v1/accounts/${LSD_ACCOUNT}/resource/0x1::coin::CoinInfo%3C${LSD_ACCOUNT}::staking::ThalaAPT%3E`) + const { data: { supply } } = await aQuery(`/v1/accounts/${LSD_ACCOUNT}/resource/0x1::coin::CoinInfo%3C${LSD_ACCOUNT}::staking::ThalaAPT%3E`); + const [active, inactive, pending_active, pending_inactive] = await function_view({ + functionStr: `0x1::delegation_pool::get_delegation_pool_stake`, + args: [THALA_VALIDATOR] + }); + const validator_apt = Number(active) + Number(inactive) + Number(pending_active) + Number(pending_inactive); + return { - aptos: supply.vec[0].integer.vec[0].value / 1e8 + aptos: (Number(supply.vec[0].integer.vec[0].value) + validator_apt) / 1e8 } } } diff --git a/projects/thala-vethl/index.js b/projects/thala-vethl/index.js index d00714ddb588..8c9c0fa07770 100644 --- a/projects/thala-vethl/index.js +++ b/projects/thala-vethl/index.js @@ -2,19 +2,19 @@ const utils = require("../helper/utils"); const sdk = require("@defillama/sdk"); const { transformBalances } = require("../helper/portedTokens"); -const THALA_API = "https://app.thala.fi/api"; +const THALA_API_VETHL = "https://app.thala.fi/api/vethl-tvl"; const thlAddress = "0x7fd500c11216f0fe3095d0c4b8aa4d64a4e2e04f83758462f2b127255643615::thl_coin::THL"; const thlDecimals = 8; module.exports = { - timetravel: true, + timetravel: false, start: 1692598825, methodology: `TVL data is pulled from the Thala's API "https://app.thala.fi/api/vethl-tvl".`, aptos: { tvl: () => ({}), - staking: async ({ timestamp }) => { - const response = await utils.fetchURL(`${THALA_API}/vethl-tvl?timestamp=${ timestamp }`); + staking: async () => { + const response = await utils.fetchURL(THALA_API_VETHL); const thlAmount = response.data.data * 10**thlDecimals; const balances = {}; @@ -24,4 +24,3 @@ module.exports = { }, }, }; - diff --git a/projects/thalaswap-v2/index.js b/projects/thalaswap-v2/index.js new file mode 100644 index 000000000000..bb57d69b9684 --- /dev/null +++ b/projects/thalaswap-v2/index.js @@ -0,0 +1,24 @@ +const { function_view } = require("../helper/chain/aptos"); + +const thalaswapLensAddress = "ff1ac437457a839f7d07212d789b85dd77b3df00f59613fcba02388464bfcacb"; + +async function getPools(lensAddress) { + return function_view({ functionStr: `${lensAddress}::lens::get_all_pools_info`}) +} + +module.exports = { + timetravel: false, + methodology: + "Aggregates TVL in all pools in Thalaswap, Thala Labs' AMM.", + aptos: { + tvl: async (api) => { + const poolInfos = await getPools(thalaswapLensAddress) + + for (const poolInfo of poolInfos) { + const assets = poolInfo.assets_metadata.map(asset => asset.inner) + const balances = poolInfo.balances + api.add(assets, balances) + } + }, + }, +}; \ No newline at end of file diff --git a/projects/thales/index.js b/projects/thales/index.js index 83f6abf46ce7..de61108e8413 100644 --- a/projects/thales/index.js +++ b/projects/thales/index.js @@ -1,7 +1,6 @@ const { sumTokens2 } = require('../helper/unwrapLPs') const { staking } = require('../helper/staking') const abi = require('./abi.json') -const { dodoPool2 } = require('../helper/pool2') const ADDRESSES = require('../helper/coreAssets.json') const ethMarketsManager = "0x5ed98Ebb66A929758C7Fe5Ac60c979aDF0F4040a" @@ -123,9 +122,31 @@ module.exports = { bsc: { tvl: async (api) => { const markets = (await Promise.all([bscMarketManager,].map(i => getMarkets(api, i)))).flat() - markets.push( bscRangedAMM, bscThalesAMM) + markets.push(bscRangedAMM, bscThalesAMM) if (speedMarkets[api.chain]) markets.push(...speedMarkets[api.chain]) return sumTokens2({ api, tokens: [ADDRESSES.bsc.BUSD], owners: markets }) }, }, } + + +function dodoPool2(stakingContract, lpToken) { + return async (api) => { + const [baseToken, quoteToken, totalSupply] = await Promise.all(["address:_BASE_TOKEN_", "address:_QUOTE_TOKEN_", "erc20:totalSupply"].map(abi => api.call({ + target: lpToken, + abi + }))) + const [baseTokenBalance, quoteTokenBalance, stakedLPBalance] = await api.multiCall({ + calls: [ + [baseToken, lpToken], [quoteToken, lpToken], [lpToken, stakingContract] + ].map(token => ({ + target: token[0], + params: [token[1]], + })), + abi: 'erc20:balanceOf' + }) + const ratio = stakedLPBalance/totalSupply + api.add(baseToken, baseTokenBalance * ratio) + api.add(quoteToken, quoteTokenBalance * ratio) + } +} diff --git a/projects/thetanuts/index.js b/projects/thetanuts/index.js index ecf12f8b4401..c1b96ac200b9 100644 --- a/projects/thetanuts/index.js +++ b/projects/thetanuts/index.js @@ -39,6 +39,19 @@ const aWETH = '0xE41645Db7C6813993eEA1cBA83912cE07d8a6d29' const PTUSDe_25JUL24 = '0xa0021EF8970104c2d008F38D92f115ad56a9B8e1' const aPTUSDe_25JUL24 = '0xCe51Ca8D61dAb1f84bD95329218b87E95054aB22' const aUSDC = '0xFB3CbdA3145Fac86040bE8501e0750cd1ddDA0Af' +const PTweeths_29AUG24 = '0xda6530efafd63a42d7b9a0a5a60a03839cdb813a' +const aPTweeths_29AUG24 = '0xb33587882dEe85B3dCcd5C82d942BB10119f8BB0' +const PTunieth_26SEP24 = '0x15fA86404BFbA8b46684552F792558128bFB6418' +const aPTunieth_26SEP24 = '0x4390a8E941b0B16a8E6B670D878a9eF6d3e11725' +const PTweeth_26DEC24 = '0x6ee2b5E19ECBa773a352E5B21415Dc419A700d1d' +const aPTweeth_26DEC24 = '0xBE8b41bDd18b0f0f47DbF338cfA837469F755d95' +const PTezeth_26DEC24 = '0xf7906F274c174A52d444175729E3fa98f9bde285' +const aPTezeth_26DEC24 = '0xD9309EA9e2336A9Fe2A15b04D9036Db15A729047' +const PTksusde_26SEP24 = '0xd351de53277c4218CC29f793263FB60E2fcFC1dC' +const aPTksusde_26SEP24 = '0x2b04E9ebeCC71BC3450C1C7B1FB8E0404E870d59' +const PTsusde_26SEP24 = '0x6c9f097e044506712B58EAC670c9a5fd4BCceF13' +const aPTsusde_26SEP24 = '0x024F400F55dc1b877695Ba4e8e53a509Fb3F0BF2' + // Avalanche Vaults const avaxCallVault = '0xd06Bd68d58eD40CC2031238A3993b99172ea37cA' @@ -104,13 +117,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' - +const PTweETH_26SEP24 = '0xb8b0a120F6A68Dd06209619F62429fB1a8e92feC' +const aPTweETH_26SEP24 = '0xF5d0866646DF182Fb9BC7FB27B26B84F96b2239d' +const PTezETH_26SEP24 = '0x2CCFce9bE49465CC6f947b5F6aC9383673733Da9' +const aPTezETH_26SEP24 = '0x3F9ca12e7D4867E45b289484a3F33bbA2A1b8723' +const PTrsETH_26SEP24 = '0x30c98c0139B62290E26aC2a2158AC341Dcaf1333' +const aPTrsETH_26SEP24 = '0x0B6Ef11254edCab4b164daa7e626Dc0d0c2Ad51f' +const PTuniETH_26DEC24 = '0x22e9ad26ea0e65a7073571d5d7172ff6336084ad' +const aPTuniETH_26DEC24 = '0x3D3a1CAA95D427b9fF63b93cB90e1a470eeBA5D7' // Polygon zkEVM vaults const stMaticCallVault = '0x7bF3c7C23501EA3E09B237D6F8AdcB7Ea3CeF41C' @@ -154,7 +168,7 @@ let boba = ADDRESSES.boba.BOBA const bobaUSDC = ADDRESSES.boba.USDC // cronos assets -const wcro = '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23' +const wcro = ADDRESSES.cronos.WCRO_1 // Arbitrum assets const arb = ADDRESSES.arbitrum.ARB @@ -209,10 +223,18 @@ const config = { [ausdc, indexUSDC_BNB_2wk_b,], [ausdc, ethPutVault,], - [PTeETH_27JUN24, aPTeETH_27JUN24,], [weth, aWETH,], - [PTUSDe_25JUL24, aPTUSDe_25JUL24,], + [PTeETH_27JUN24, aPTeETH_27JUN24,], + [PTweeths_29AUG24, aPTweeths_29AUG24,], + [PTunieth_26SEP24, aPTunieth_26SEP24,], + + [PTweeth_26DEC24, aPTweeth_26DEC24,], + [PTezeth_26DEC24, aPTezeth_26DEC24,], + [usdc, aUSDC,], + [PTUSDe_25JUL24, aPTUSDe_25JUL24,], + [PTsusde_26SEP24, aPTsusde_26SEP24,], + [PTksusde_26SEP24, aPTksusde_26SEP24,], ] }, @@ -239,6 +261,7 @@ const config = { [PTezETH_26SEP24, aPTezETH_26SEP24,], [PTrsETH_26SEP24, aPTrsETH_26SEP24,], [PTweETH_26SEP24, aPTweETH_26SEP24,], + [PTuniETH_26DEC24, aPTuniETH_26DEC24,], ], uniV3Owners: [ arbC_LLV, diff --git a/projects/thorn-protocol/index.js b/projects/thorn-protocol/index.js new file mode 100644 index 000000000000..7778a25348a3 --- /dev/null +++ b/projects/thorn-protocol/index.js @@ -0,0 +1,18 @@ +const { sumTokens2 } = require('../helper/unwrapLPs') + +async function tvl(api) { + let target = "0x888099De8EA8068D92bB04b47A743B82195c4aD2" + const pairs = await api.fetchList({ lengthAbi: 'pairLength', itemAbi: 'swapPairContract', target }) + const res = await api.fetchList({ lengthAbi: 'N_COINS', itemAbi: 'coins', targets: pairs, groupedByInput: true, }) + const ownerTokens = res.map((tokens, i) => [tokens, pairs[i]]) + return sumTokens2({ api, ownerTokens, permitFailure: true, }) +} + +module.exports = { + methodology: + "Uses factory(0x888099De8EA8068D92bB04b47A743B82195c4aD2) address and whitelisted tokens address to find and price Liquidity Pool pairs", + start: 1729159200, + sapphire: { + tvl, + }, +}; diff --git a/projects/tidalfinance/abi.json b/projects/tidalfinance/abi.json deleted file mode 100644 index 2689ba630e2b..000000000000 --- a/projects/tidalfinance/abi.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "getAssetLength": "uint256:getAssetLength", - "assetBalance": "function assetBalance(uint16) view returns (uint256)" -} \ No newline at end of file diff --git a/projects/tidalfinance/index.js b/projects/tidalfinance/index.js index a84081065a52..2a8b03890e14 100644 --- a/projects/tidalfinance/index.js +++ b/projects/tidalfinance/index.js @@ -1,69 +1,19 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); +const { staking } = require('../helper/staking'); -// Contracts -const assetManager = "0xA2b6eC586F989cf1C055B7C9D16fDdA80FDD679b"; const sellerContract = "0xc73C6C3e80C28dBc55F65bBdC895E828bb98C72d"; const stakingContract = "0x21edB57A75ee69BCe0Fe3D0EfC5674bcF1D5BF93"; -// Tokens -const USDC = ADDRESSES.polygon.USDC; const TIDAL = "0xB41EC2c036f8a42DA384DDE6ADA79884F8b84b26"; -/*** Staking of native token (TIDAL) TVL portion ***/ -const staking = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - const transformAddress = i => `polygon:${i}`; - - await sumTokensAndLPsSharedOwners( - balances, - [[TIDAL, false]], - [stakingContract], - chainBlocks["polygon"], - "polygon", - transformAddress - ); - - return balances; -}; - -/*** Polygon TVL Portions ***/ -const polygonTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - const lengthOfAssets = ( - await sdk.api.abi.call({ - abi: abi.getAssetLength, - target: assetManager, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output; - - for (let i = 0; i < lengthOfAssets; i++) { - const BalanceOfAsset = ( - await sdk.api.abi.call({ - abi: abi.assetBalance, - target: sellerContract, - params: i, - chain: "polygon", - block: chainBlocks["polygon"], - }) - ).output; - - sdk.util.sumSingleBalance(balances, `polygon:${USDC}`, BalanceOfAsset); - } - - return balances; +const polygonTvl = async (api) => { + return api.sumTokens({ owner: sellerContract, tokens: [ADDRESSES.polygon.USDC] }) }; module.exports = { - misrepresentedTokens: true, polygon: { - staking, + staking: staking(stakingContract, TIDAL,), tvl: polygonTvl, }, methodology: diff --git a/projects/timewarp/index.js b/projects/timewarp/index.js index 33eafdae0c51..53857f026a18 100644 --- a/projects/timewarp/index.js +++ b/projects/timewarp/index.js @@ -1,102 +1,22 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abi.json"); +const { staking } = require('../helper/staking') +const { pool2 } = require('../helper/pool2') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const TimeWarpPool_LP_UNISWAP_ETH = - "0x55c825983783c984890bA89F7d7C9575814D83F2"; -const TimeWarpPool_LP_PANCAKE_BSC = - "0xC48467BA55cF0B777978F19701329c87949EFD3C"; +const TimeWarpPool_LP_UNISWAP_ETH = "0x55c825983783c984890bA89F7d7C9575814D83F2"; +const TimeWarpPool_LP_PANCAKE_BSC = "0xC48467BA55cF0B777978F19701329c87949EFD3C"; const TimeWarpPool_TIME_ETH = "0xa106dd3Bc6C42B3f28616FfAB615c7d494Eb629D"; const TimeWarpPool_TIME_BSC = "0x59f2757Ae3a1BAa21e4f397a28985Ceb431c676b"; -const calcTvl = async (balances, chain, block, TimeWarpPool) => { - const erc20TokenOrLp = ( - await sdk.api.abi.call({ - abi: abi.erc20Deposit, - target: TimeWarpPool, - chain, - block, - }) - ).output; - - const transformAddress = i => `bsc:${i}`; - - await sumTokensAndLPsSharedOwners( - balances, - TimeWarpPool == TimeWarpPool_TIME_ETH || - TimeWarpPool == TimeWarpPool_TIME_BSC - ? [[erc20TokenOrLp, false]] - : [[erc20TokenOrLp, true]], - [TimeWarpPool], - block, - chain, - chain == "bsc" ? transformAddress : (addr) => addr - ); -}; - -/*** Staking of native token (TIME) on Ethereum and Binance TVL portion ***/ -const stakingETH = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - // --- Staking of native token TIME on Ethereum --- - await calcTvl( - balances, - "ethereum", - chainBlocks["ethereum"], - TimeWarpPool_TIME_ETH - ); - - return balances; -}; - -const stakingBSC = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - // --- Staking of native token TIME on Binance --- - await calcTvl(balances, "bsc", chainBlocks["bsc"], TimeWarpPool_TIME_BSC); - - return balances; -}; - -/*** Ethereum TVL Portion ***/ -const ethTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl( - balances, - "ethereum", - chainBlocks["ethereum"], - TimeWarpPool_LP_UNISWAP_ETH - ); - - return balances; -}; - -/*** Binance TVL Portion ***/ -const bscTvl = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - - await calcTvl( - balances, - "bsc", - chainBlocks["bsc"], - TimeWarpPool_LP_PANCAKE_BSC - ); - - return balances; -}; - module.exports = { - misrepresentedTokens: true, ethereum: { - tvl: ethTvl, - staking: stakingETH + tvl: () => ({}), + pool2: pool2(TimeWarpPool_LP_UNISWAP_ETH, '0x1d474d4B4A62b0Ad0C819841eB2C74d1c5050524'), + staking: staking(TimeWarpPool_TIME_ETH, '0x485d17A6f1B8780392d53D64751824253011A260'), }, bsc: { - tvl: bscTvl, - staking: stakingBSC + tvl: () => ({}), + pool2: pool2(TimeWarpPool_LP_PANCAKE_BSC, '0xa5ebD19961CF4B8aF06a9d9D2B91d73B48744867'), + staking: staking(TimeWarpPool_TIME_BSC, '0x3b198e26E473b8faB2085b37978e36c9DE5D7f68'), }, methodology: `We count as TVL the staking Lps on Ethereum (TIME-ETH Sushiswap LP) and Binance (TIME-BNB Pancake LP) networks threw their TimeWarpPool contracts; and diff --git a/projects/tivel-finance/index.js b/projects/tivel-finance/index.js index 42e2ab819d16..c1135bca9cc9 100644 --- a/projects/tivel-finance/index.js +++ b/projects/tivel-finance/index.js @@ -1,5 +1,5 @@ const config = { - era: '0x846FcA826196B3D674fd1691Bb785F3E4216bc0F', + era: '0xf7c504346b27F6073F7182e61f870531Fca1c09d', scroll: '0x30e44f48c9542533cB0b6b7dA39F6d42F26D843f', } diff --git a/projects/tokemak/index.js b/projects/tokemak/index.js index 91a870b2828a..3d516c554763 100644 --- a/projects/tokemak/index.js +++ b/projects/tokemak/index.js @@ -1,5 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') const { sumTokens2, } = require('../helper/unwrapLPs') const abi = require("../pendle/abi.json"); const positions = require('./positions.json'); @@ -15,6 +14,30 @@ const cvx_abi = { stkcvxFRAXBP_lockedStakesOf: "function lockedStakesOf(address account) view returns (tuple(bytes32 kek_id, uint256 start_timestamp, uint256 liquidity, uint256 ending_timestamp, uint256 lock_multiplier)[])", } +const AUTOPILOT_SYSTEM_REGISTRIES_BY_CHAIN = { + 1: '0x2218F90A98b0C070676f249EF44834686dAa4285', + 8453: '0x18Dc926095A7A007C01Ef836683Fdef4c4371b4e' +} + +const autopilotContracts = { + systemRegistry: { + abi: { + autoPoolRegistry: "function autoPoolRegistry() view returns (address)" + } + }, + autoPoolRegistry: { + abi: { + listVaults: "function listVaults() view returns (address[] memory)" + } + }, + autopool: { + abi: { + totalAssets: "function totalAssets() view returns (uint256)", + asset: "function asset() view returns (address)" + } + } +} + const degenesisContract = "0xc803737D3E12CC4034Dde0B2457684322100Ac38"; const wethPool = "0xD3D13a578a53685B4ac36A1Bab31912D2B2A2F36"; const usdcPool = "0x04bda0cf6ad025948af830e75228ed420b0e860d"; @@ -27,13 +50,13 @@ const gohm = "0x0ab87046fbb341d058f17cbc4c1133f25a20a52f"; const alcxPool = "0xD3B5D9a561c293Fb42b446FE7e237DaA9BF9AA84"; const alcx = "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF"; const fxsPool = "0xADF15Ec41689fc5b6DcA0db7c53c9bFE7981E655"; -const fxs = "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0"; +const fxs = ADDRESSES.ethereum.FXS; const tcrPool = "0x15A629f0665A3Eb97D7aE9A7ce7ABF73AeB79415"; const tcr = "0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050"; const toke = ADDRESSES.ethereum.TOKE; -const rtoke1 = "0xa760e26aA76747020171fCF8BdA108dFdE8Eb930"; -const rtoke2 = "0x96f98ed74639689c3a11daf38ef86e59f43417d3"; -const rtoke3 = "0xA374A62DdBd21e3d5716cB04821CB710897c0972"; +const tTokeReactor = "0xa760e26aA76747020171fCF8BdA108dFdE8Eb930"; +const stakingVestingV1 = "0x96f98ed74639689c3a11daf38ef86e59f43417d3"; +const accTokeV1 = "0xA374A62DdBd21e3d5716cB04821CB710897c0972"; const sushiPool = "0xf49764c9C5d644ece6aE2d18Ffd9F1E902629777"; const sushi = ADDRESSES.ethereum.SUSHI; const fraxPool = "0x94671A3ceE8C7A12Ea72602978D1Bb84E920eFB2"; @@ -110,7 +133,6 @@ async function tvl(api) { [cvxFRAXPool, tokeManager], [cvxalUSDPool, tokeManager], ] - const balances = {} // cvxcrvFRAX const cvxFraxUsdcPool = "0x7e880867363A7e321f5d260Cade2B0Bb2F717B02"; @@ -133,9 +155,9 @@ async function tvl(api) { target: cvxcvxFxsPool, params: [tokeTreasury], }); - sdk.util.sumSingleBalance(balances, cvxcrvFrax, cvxcrvFraxBal) - sdk.util.sumSingleBalance(balances, cvxcrvFrax, treasuryFraxBal[0]['liquidity']) - sdk.util.sumSingleBalance(balances, cvxcvxFxs, cvxcvxFxsBal) + api.add(cvxcrvFrax, cvxcrvFraxBal) + api.add(cvxcrvFrax, treasuryFraxBal[0]['liquidity']) + api.add(cvxcvxFxs, cvxcvxFxsBal) let curveHoldings = positions.exchanges.filter( pool => pool.type == 'Curve') @@ -147,10 +169,24 @@ async function tvl(api) { lpBalances(curveHoldings, toa, tokens, calls,) lpBalances(uniHoldings, toa, tokens, calls) const amountRes = await api.multiCall({ abi: abi.userInfo, calls }) - tokens.forEach((val, i) => sdk.util.sumSingleBalance(balances, val, amountRes[i].amount, api.chain)) + tokens.forEach((val, i) => api.add(val, amountRes[i].amount)) + await populateAutopilotDetails(1, api); + + return sumTokens2({ api, tokensAndOwners: toa, }) +} + +async function populateAutopilotDetails(chainId, api) { + // Get the instance of the Autopool Registry from the System Registry + const autopoolRegistry = await api.call({ abi: autopilotContracts.systemRegistry.abi.autoPoolRegistry, target: AUTOPILOT_SYSTEM_REGISTRIES_BY_CHAIN[chainId], }); + // Use the Autopool Registry to get all the Autopools in the system + const autopools = await api.call({ abi: autopilotContracts.autoPoolRegistry.abi.listVaults, target: autopoolRegistry, }); + await api.erc4626Sum2({ calls: autopools}) +} - return sumTokens2({ balances, api, tokensAndOwners: toa, }) +async function baseTvl(api) { + await populateAutopilotDetails(8453, api); + return sumTokens2({ api }) } function lpBalances(holdings, toa, tokens, calls) { @@ -175,11 +211,11 @@ function lpBalances(holdings, toa, tokens, calls) { } async function staking(api) { - let vestedToke = '57238445' + let vestedToke = '1438444' api.add(ADDRESSES.ethereum.TOKE, vestedToke * 1e18 * -1) return sumTokens2({ api, tokensAndOwners: [ - [toke, rtoke1], [toke, rtoke2], [toke, rtoke3] + [toke, tTokeReactor], [toke, stakingVestingV1], [toke, accTokeV1] ] }) } @@ -198,5 +234,8 @@ module.exports = { tvl, pool2, staking + }, + base: { + tvl: baseTvl } } diff --git a/projects/tomofinance.js b/projects/tomofinance.js index 21ed2dd93f55..76c5c65a8acc 100644 --- a/projects/tomofinance.js +++ b/projects/tomofinance.js @@ -1,21 +1,6 @@ -const sdk = require('@defillama/sdk'); - -async function taiSupply(timestamp, ethBlock, {tomochain: block}) { - const taiContract = '0x4d04315e6BABD038d15ea0E240A88B292d2Add41'; - - const supply = (await sdk.api.erc20.totalSupply({ - target: taiContract, - block: block, - chain: 'tomochain', - decimals: 18 - })).output; - - return { 'usd-coin': supply }; -} - module.exports = { - misrepresentedTokens: true, - tomochain: { - tvl: taiSupply - } -}; + tomochain: { + tvl: () => ({}), + }, + deadFrom: '2021-05-22' +} diff --git a/projects/tonco/index.js b/projects/tonco/index.js new file mode 100644 index 000000000000..6d54f1109db8 --- /dev/null +++ b/projects/tonco/index.js @@ -0,0 +1,48 @@ +const { cachedGraphQuery } = require('../helper/cache'); +const { post } = require('../helper/http') +const { transformDexBalances } = require('../helper/portedTokens') +const sdk = require('@defillama/sdk') +const { ethers } = require("ethers") + +const API_URL = 'https://indexer.tonco.io'; + +const poolsQuery = ` + { + pools { + address + jetton0 { + bounceableAddress + decimals + } + jetton1 { + bounceableAddress + decimals + } + totalValueLockedJetton0 + totalValueLockedJetton1 + } + } +` + +module.exports = { + misrepresentedTokens: true, + timetravel: false, + ton: { + tvl: async () => { + + const result = await cachedGraphQuery('tonco-swap', API_URL, poolsQuery) + + sdk.log(result) + + return transformDexBalances({ + chain: 'ton', + data: result.pools.map(pool => ({ + token0: pool.jetton0.bounceableAddress, + token1: pool.jetton1.bounceableAddress, + token0Bal: Number(ethers.parseUnits(String(pool.totalValueLockedJetton0.toFixed(pool.jetton0.decimals)), parseInt(pool.jetton0.decimals))), + token1Bal: Number(ethers.parseUnits(String(pool.totalValueLockedJetton1.toFixed(pool.jetton1.decimals)), parseInt(pool.jetton1.decimals))), + })) + }) + } + } +} diff --git a/projects/tonhedge/index.js b/projects/tonhedge/index.js new file mode 100644 index 000000000000..1035597c78c9 --- /dev/null +++ b/projects/tonhedge/index.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const addr = "EQBXZo11H4wUq3azWDphoUhlV710a-7rvUsqZUGLP9tUcf37" + +module.exports = { + methodology: 'Counts TON Hedge smartcontract balance as TVL.', + ton: { + tvl: sumTokensExport({ owner: addr, tokens: [ADDRESSES.ton.USDT] }), + } +} diff --git a/projects/tonpools/index.js b/projects/tonpools/index.js new file mode 100644 index 000000000000..65889d5c44f9 --- /dev/null +++ b/projects/tonpools/index.js @@ -0,0 +1,19 @@ +const { sumTokensExport } = require("../helper/chain/ton"); +const ADDRESSES = require("../helper/coreAssets.json"); + +const tonpoolsContractAddress = + "EQA7y9QkiP4xtX_BhOpY4xgVlLM7LPcYUA4QhBHhFZeL4fTa"; + +const tonpoolUSDTContractAddress = + "EQDrSz9W4tjwnqy1F4z-O4Vkdp8g2YP94cmh12X5RbYpejCw"; + +module.exports = { + methodology: "Ton Pools's TVL includes all deposited supported assets", + ton: { + tvl: sumTokensExport({ + owners: [tonpoolsContractAddress, tonpoolUSDTContractAddress], + tokens: [ADDRESSES.null], + }), + }, +}; + diff --git a/projects/tonstakers-token-staking/index.js b/projects/tonstakers-token-staking/index.js new file mode 100644 index 000000000000..69ffac67026d --- /dev/null +++ b/projects/tonstakers-token-staking/index.js @@ -0,0 +1,79 @@ +const { call, getTokenRates } = require("../helper/chain/ton"); +const { sleep } = require("../helper/utils"); + +const farms = [ + { + contract: "EQBh2Asg4Opnlgmkw25gpZ7IcmyNPJceLh_51o0lOGwGjvuc", + name: "GEMSTON", + token: "0:57e8af5a5d59779d720d0b23cf2fce82e0e355990f2f2b7eb4bba772905297a4", + launch: 1721817124, + decimals: 9, + }, + { + contract: "EQDjQOGq_bx9pdjQJhQRK9Lux-YOUwDu1UNM8SevvbG25dEq", + name: "$PUNK", + token: "0:9da73e90849b43b66dacf7e92b576ca0978e4fc25f8a249095d7e5eb3fe5eebb", + launch: 1722433134, + decimals: 9, + }, + { + contract: "EQA0R317P10bopg5YGnI4B9_cJc0jPbVwnLZu3JuMWdyNgly", + name: "XROCK", + token: "0:157c463688a4a91245218052c5580807792cf6347d9757e32f0ee88a179a6549", + launch: 1722515467, + decimals: 9, + }, + { + contract: "EQA5BgnWFYQuKjDMgmqsYRTA1S3qjrF1MvmjG-BDEA19j0I9", + name: "JetTon", + token: "0:105e5589bc66db15f13c177a12f2cf3b94881da2f4b8e7922c58569176625eb5", + launch: 1722940520, + decimals: 9, + }, + { + contract: "EQDw7u6CwkbIfzhfdxITAy09yqvAk59hyCdxbdQCR67ilyn-", + name: "durev", + token: "0:74d8327471d503e2240345b06fe1a606de1b5e3c70512b5b46791b429dab5eb1", + launch: 1723474591, + decimals: 9, + }, + { + contract: "EQDMMSQsmGocIRUMxXL4MamEGasiANnV6GpKstApK45lVGwc", + name: "$WEB3", + token: "0:6d70be0903e3dd3e252407cbad1dca9d69fb665124ea74bf19d4479778f2ed8b", + launch: 1723732987, + decimals: 3, + }, +]; + +const retrieveFarmTVL = async (farmContract) => { + const result = await call({ + target: farmContract, + abi: "get_farming_minter_data", + }); + return result[3]; +}; + +const getFullTVl = async (api) => { + const tokens = farms.map((farm) => farm.token); + + const prices = await getTokenRates({ tokens }); + + for (const farm of farms) { + const balanceRaw = await retrieveFarmTVL(farm.contract); + await sleep(1000); + + const decimalPow = Math.pow(10, farm.decimals); + const balance = balanceRaw / decimalPow; + api.addUSDValue(balance * (prices[farm.token] || 0)); + } +}; + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + ton: { + tvl: () => ({}), + staking: getFullTVl, + }, +}; diff --git a/projects/toobit/index.js b/projects/toobit/index.js new file mode 100644 index 000000000000..ec14f449703b --- /dev/null +++ b/projects/toobit/index.js @@ -0,0 +1,20 @@ +const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +const config = { + ethereum: { + owners: [ + '0xCAF80cfacBEF94d37De091093822f2a862adc47F' + ], + }, + bitcoin: { + owners: bitcoinAddressBook.toobit + }, + bsc: { + owners: [ + '0xCAF80cfacBEF94d37De091093822f2a862adc47F' + ] + }, +} + +module.exports = cexExports(config) \ No newline at end of file diff --git a/projects/torch/index.js b/projects/torch/index.js new file mode 100644 index 000000000000..37c7e5e30750 --- /dev/null +++ b/projects/torch/index.js @@ -0,0 +1,34 @@ +const ADDRESSES = require("../helper/coreAssets.json") +const { sumTokens } = require('../helper/chain/ton') +const { get } = require("../helper/http") + +const DEX = 'EQCaEOMOR2SRcXTVSolw--rY62ghCoCRjn4Is3bBdnqYwIVZ' +const YIELD_ROUTER = 'EQDYU6gxBxFT3arWR-N9RFTfqAoQKyWk4JMgTBNOM2KL18Dw' + +async function tvl(api) { + const tokenTvl = await get('https://yield-api.torch.finance/tvl') + + const tvl = tokenTvl.reduce((acc, data) => { + acc += Number(data.tvl) / 1e9 + return acc + }, 0) + + await sumTokens({ + api, + owners: [DEX, YIELD_ROUTER], + tokens: [ADDRESSES.ton.TON], + }); + + api.add(ADDRESSES.ton.USDT, tvl * 1e6) +} + +module.exports = { + timetravel: false, + methodology: `The TVL calculation for Torch includes both the general jettons + balance and LP jettons balance. The price of general jettons is obtained via tonApi, + while the price of LP jettons is calculated using on-chain data (reserve0, reserve1, + and total LP supply). The LP jettons price calculation is handled on the Torch API side.`.trim(), + ton: { + tvl: tvl + }, +} \ No newline at end of file diff --git a/projects/torches/index.js b/projects/torches/index.js index 96b4757da5a2..8de85bc13471 100644 --- a/projects/torches/index.js +++ b/projects/torches/index.js @@ -1,6 +1,5 @@ -const { compoundExports } = require("../helper/compound"); +const { compoundExports2 } = require("../helper/compound"); -const checkForLPTokens = i => /-LP/.test(i) module.exports = { - kcc: compoundExports("0xfbAFd34A4644DC4f7c5b2Ae150279162Eb2B0dF6", "kcc", undefined, undefined, undefined, checkForLPTokens) + kcc: compoundExports2({ comptroller: '0xfbAFd34A4644DC4f7c5b2Ae150279162Eb2B0dF6'}) } \ No newline at end of file diff --git a/projects/toreus/index.js b/projects/toreus/index.js index 9050af084a76..4ac52c64fa62 100644 --- a/projects/toreus/index.js +++ b/projects/toreus/index.js @@ -6,8 +6,11 @@ const TOREUS = "0x8549724fcC84ee9ee6c7A676F1Ba2Cc2f43AAF5B"; module.exports = { methodology, + deadFrom: '2023-07-18', kava: { ...aaveExports("kava", "0xcCe311383b0f4A41c82D8d03a1f4214A3c8E70Bd"), staking: staking(stakingContract, TOREUS), }, -}; \ No newline at end of file +}; + +module.exports.kava.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/toros/index.js b/projects/toros/index.js index b8bbb5a3629d..2b418308179a 100644 --- a/projects/toros/index.js +++ b/projects/toros/index.js @@ -11,11 +11,14 @@ async function tvl(api) { params: [torosMultisigManager], }); - const poolSummaries = await api.multiCall({ + const poolSummariesRes = await api.multiCall({ abi: TOROS_POOL_ABI, calls: pools, + permitFailure: true }); + const poolSummaries = poolSummariesRes.filter(i => i && i.totalFundValue !== null && i.totalFundValue !== undefined); + const totalValue = poolSummaries.reduce( (acc, i) => acc + +i.totalFundValue, 0 diff --git a/projects/tower-finance/index.js b/projects/tower-finance/index.js index 55db19d0cd09..42e490d44286 100644 --- a/projects/tower-finance/index.js +++ b/projects/tower-finance/index.js @@ -3,5 +3,5 @@ module.exports = { polygon: { tvl: () => ({}), }, - broken: 'website is down, discord link expired, twitter no longer active. Rugged?' + deadFrom: '2022-04-27', } \ No newline at end of file diff --git a/projects/traderjoe-lend/index.js b/projects/traderjoe-lend/index.js index aeb05ccf4332..e72efed541a2 100644 --- a/projects/traderjoe-lend/index.js +++ b/projects/traderjoe-lend/index.js @@ -1,27 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk'); -const { getCompoundV2Tvl } = require('../helper/compound'); - -const comptroller = "0xdc13687554205E5b89Ac783db14bb5bba4A1eDaC"; +const { compoundExports2 } = require('../helper/compound'); module.exports = { - methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', - avax:{ - tvl: getCompoundV2Tvl( - comptroller, - "avax", - addr => `avax:${addr}`, - "0xC22F01ddc8010Ee05574028528614634684EC29e", - ADDRESSES.avax.WAVAX, - false - ), - borrowed: getCompoundV2Tvl( - comptroller, - "avax", - addr => `avax:${addr}`, - "0xC22F01ddc8010Ee05574028528614634684EC29e", - ADDRESSES.avax.WAVAX, - true - ), - } + methodology: 'We count liquidity on the pairs and we get that information from the "traderjoe-xyz/exchange" subgraph. The staking portion of TVL includes the JoeTokens within the JoeBar contract.', + avax: compoundExports2({ comptroller: '0xdc13687554205E5b89Ac783db14bb5bba4A1eDaC', cether: '0xC22F01ddc8010Ee05574028528614634684EC29e' }), }; diff --git a/projects/trado-spot/index.js b/projects/trado-spot/index.js new file mode 100644 index 000000000000..31d1fe985203 --- /dev/null +++ b/projects/trado-spot/index.js @@ -0,0 +1,10 @@ +const { iziswapExport } = require('../helper/iziswap') + +const poolHelpers = { + 'flow': ['0x19b683A2F45012318d9B2aE1280d68d3eC54D663'], +} // 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/trado/index.js b/projects/trado/index.js new file mode 100644 index 000000000000..ddc132d3f802 --- /dev/null +++ b/projects/trado/index.js @@ -0,0 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokensExport } = require("../helper/unwrapLPs"); +// perp +const USDCe = ADDRESSES.milkomeda.BNB +const USDX = '0xAeBE92ebc1a67F810Cb35fdcdA6398f6136DCD50' + +module.exports = { + flow: { tvl: sumTokensExport({ owner: USDX, tokens: [USDCe], })}, + methodology: `The TVL for Trado Perpetual is calculated based on the value of all stablecoins locked in the USDX contract.`, +}; diff --git a/projects/tradoor/index.js b/projects/tradoor/index.js index ebe0c7c6bdc0..6c06183ac514 100644 --- a/projects/tradoor/index.js +++ b/projects/tradoor/index.js @@ -1,11 +1,15 @@ 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]}), + tvl: sumTokensExport({ + owners: [ + "EQBPAMNu5Eud9AEvplOjNlRhxI4EkuJEhEMAmxh9erxmImKs", // v1 + "EQD_EzjJ9u0fpMJkoZBSv_ZNEMitAoYo9SsuD0s1ehIifnnn", // v2 + ], + tokens: [ADDRESSES.null] + }), } } diff --git a/projects/tranquil/index.js b/projects/tranquil/index.js index 8c578c5c7c2f..8cbbef2a5c26 100644 --- a/projects/tranquil/index.js +++ b/projects/tranquil/index.js @@ -1,140 +1,36 @@ -const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); -const { BigNumber } = require("bignumber.js"); -const { getCompoundV2Tvl} = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') const { uniTvlExport } = require('../helper/calculateUniTvl.js'); +const { staking } = require('../helper/staking') -const tqOne = "0x34B9aa82D89AE04f0f546Ca5eC9C93eFE1288940"; // tqONE -const wOne = ADDRESSES.harmony.WONE; const stONEAddr = "0x22D62b19b7039333ad773b7185BB61294F3AdC19"; // stONE ERC20 contract -const tranqToken = "0xcf1709ad76a79d5a60210f23e81ce2460542a836"; +const { tvl: _tvl, borrowed } = compoundExports2({ comptroller: '0x6a82A17B48EF6be278BBC56138F35d04594587E3', cether: '0x34b9aa82d89ae04f0f546ca5ec9c93efe1288940' }) -const tranqWONESushiLP = "0x643f94fc0a804ea13adb88b9e17244bf94022a25"; -const stoneWONESushiLP = "0x6b53ca1ed597ed7ccd5664ec9e03329992c2ba87"; - -async function tranqWONE_pool2(balances, timestamp, chain, chainBlocks) { - let { output: balance } = await sdk.api.abi.multiCall({ - calls: [ - { - target: tranqToken, - params: tranqWONESushiLP, - }, - { - target: wOne, - params: tranqWONESushiLP, - }, - ], - abi: "erc20:balanceOf", - block: chainBlocks.harmony, - chain: "harmony", - }); - - let oneBalance = BigNumber(balance[1].output) - .div(10 ** 18) - .toFixed(0); - - sdk.util.sumSingleBalance( - balances, - `harmony:${tranqToken}`, - balance[0].output - ); - sdk.util.sumSingleBalance(balances, ["wrapped-one"], oneBalance); -} - -async function stoneWONE_pool2(balances, timestamp, chain, chainBlocks) { - let { output: balance } = await sdk.api.abi.multiCall({ - calls: [ - { - target: stONEAddr, - params: stoneWONESushiLP, - }, - { - target: wOne, - params: stoneWONESushiLP, - }, - ], - abi: "erc20:balanceOf", - block: chainBlocks.harmony, - chain: "harmony", - }); - - let oneBalance = BigNumber(balance[1].output) - .div(10 ** 18) - .toFixed(0); - - sdk.util.sumSingleBalance( - balances, - `harmony:${stONEAddr}`, - balance[0].output - ); - sdk.util.sumSingleBalance(balances, ["wrapped-one"], oneBalance); -} - -async function pool2(timestamp, chain, chainBlocks) { - let balances = {}; - await tranqWONE_pool2(balances, timestamp, chain, chainBlocks); - await stoneWONE_pool2(balances, timestamp, chain, chainBlocks); - - - return balances; +async function tvl(api) { + // Add ONE amount locked in Liquid Staking + // https://docs.tranquil.finance/liquid-staking-stone/tranquil-stone + const stoneBalance = await api.call({ target: stONEAddr, abi: 'erc20:totalSupply', }) + api.add(stONEAddr, stoneBalance) + return api.getBalances() } -async function tvl(timestamp, chain, chainBlocks) { - const transformAddress = addr=>`harmony:${addr}`; - const lendingMarketTvlFn = getCompoundV2Tvl("0x6a82A17B48EF6be278BBC56138F35d04594587E3", "harmony", transformAddress, tqOne, wOne, false); - let balances = await lendingMarketTvlFn(timestamp, chain, chainBlocks); - - // Add ONE amount locked in Liquid Staking - // https://docs.tranquil.finance/liquid-staking-stone/tranquil-stone - const stoneBalance = (await sdk.api.abi.call({ - block: chainBlocks.harmony, - target: stONEAddr, - abi: 'erc20:totalSupply', - chain: 'harmony' - })).output; - balances[`harmony:${stONEAddr}`]= stoneBalance; - - return balances; -} - -async function borrowed(timestamp, chain, chainBlocks) { - const transformAddress = addr=>`harmony:${addr}`; - const lendingMarketTvlFn = getCompoundV2Tvl("0x6a82A17B48EF6be278BBC56138F35d04594587E3", "harmony", transformAddress, tqOne, wOne, true); - return await lendingMarketTvlFn(timestamp, chain, chainBlocks); -} - - const xtranqToken = "0xb4aa8c8e555b3a2f1bfd04234ff803c011760e59"; const stakingContract = "0x59a4d6b2a944e8acabbd5d2571e731388918669f"; -async function staking(timestamp, chain, chainBlocks) { - let balances = {}; - - let { output: balance } = await sdk.api.erc20.balanceOf({ - target: xtranqToken, - owner: stakingContract, - block: chainBlocks.harmony, - chain: "harmony", - }); - - sdk.util.sumSingleBalance(balances, `harmony:${tranqToken}`, balance); - - return balances; -} - module.exports = { methodology: "TVL includes values locked into TqTokens. Pool2 are the liquidity in the TRANQ-WONE SUSHI LPs. Staking TVL are the xTRANQ tokens locked into the staking contract.", harmony: { tvl: sdk.util.sumChainTvls([ + _tvl, tvl, uniTvlExport('0xF166939E9130b03f721B0aE5352CCCa690a7726a', 'harmony', true), ]), - borrowed: borrowed, - pool2: pool2, - staking: staking, + borrowed: borrowed, + pool2: () => ({}), + staking: staking(stakingContract, xtranqToken), }, - hallmarks:[ + hallmarks: [ [1655991120, "Horizon bridge Hack $100m"], ], }; diff --git a/projects/trapeza-protocol/index.js b/projects/trapeza-protocol/index.js index 7e8925d94614..5bea20a417da 100644 --- a/projects/trapeza-protocol/index.js +++ b/projects/trapeza-protocol/index.js @@ -13,6 +13,7 @@ module.exports = { hallmarks: [ [1648684800, "Rug Pull"] ], + deadFrom: 1648684800, misrepresentedTokens: true, ...ohmTvl(treasury, treasuryTokens, "bsc", fidlStaking, fidl, undefined, undefined, false) } \ No newline at end of file diff --git a/projects/treasury/aavegotchi.js b/projects/treasury/aavegotchi.js index 295ca69cecd4..a175c5d5ef63 100644 --- a/projects/treasury/aavegotchi.js +++ b/projects/treasury/aavegotchi.js @@ -1,31 +1,36 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require("../helper/coreAssets.json"); const { nullAddress, treasuryExports } = require("../helper/treasury"); const aavegotchiTreasury2 = "0xFFE6280ae4E864D9aF836B562359FD828EcE8020"; -const treasury2 = "0xfb76e9be55758d0042e003c1e46e186360f0627e" +const treasury2 = "0xfb76e9be55758d0042e003c1e46e186360f0627e"; const GHST = "0x3F382DbD960E3a9bbCeaE22651E88158d2791550"; - module.exports = treasuryExports({ ethereum: { - tokens: [ - nullAddress, - ADDRESSES.ethereum.DAI//DAI - ], - owners: [aavegotchiTreasury2, treasury2, '0x53c3CA81EA03001a350166D2Cc0fcd9d4c1b7B62'], + tokens: [ + nullAddress, + ADDRESSES.ethereum.DAI, //DAI + ], + owners: [aavegotchiTreasury2, treasury2, "0x53c3CA81EA03001a350166D2Cc0fcd9d4c1b7B62"], ownTokens: [GHST], }, polygon: { - tokens: [ - nullAddress, - ADDRESSES.polygon.DAI, - ADDRESSES.polygon.USDC - ], - owners: ['0xb208f8BB431f580CC4b216826AFfB128cd1431aB', '0x27DF5C6dcd360f372e23d5e63645eC0072D0C098', '0x939b67F6F6BE63E09B0258621c5A24eecB92631c', - '0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E', '0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6', '0x48eA1d45142fC645fDcf78C133Ac082eF159Fe14', '0x6fb7e0AAFBa16396Ad6c1046027717bcA25F821f', -'0x921D8FDF089775D5AC61b2d6e8f34F1edd554D8f', -'0xa8D00712abE7af3446cdC651c159737cCFB43255', '0xed7cb3973C7bFE4bf78dA8E5f52EB04c0dF53d3B', '0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E', '0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6', -'0xAbA69f6E893B18bE066a237f723F43315BBF9D9A'], - ownTokens: ['0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7'], + tokens: [nullAddress, ADDRESSES.polygon.DAI, ADDRESSES.polygon.USDC], + owners: [ + "0xb208f8BB431f580CC4b216826AFfB128cd1431aB", + "0x27DF5C6dcd360f372e23d5e63645eC0072D0C098", + "0x939b67F6F6BE63E09B0258621c5A24eecB92631c", + "0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E", + "0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6", + "0x48eA1d45142fC645fDcf78C133Ac082eF159Fe14", + "0x6fb7e0AAFBa16396Ad6c1046027717bcA25F821f", + "0x921D8FDF089775D5AC61b2d6e8f34F1edd554D8f", + "0xa8D00712abE7af3446cdC651c159737cCFB43255", + "0xed7cb3973C7bFE4bf78dA8E5f52EB04c0dF53d3B", + "0x62DE034b1A69eF853c9d0D8a33D26DF5cF26682E", + "0x8c8E076Cd7D2A17Ba2a5e5AF7036c2b2B7F790f6", + "0xAbA69f6E893B18bE066a237f723F43315BBF9D9A", + ], + ownTokens: ["0x385eeac5cb85a38a9a07a70c73e0a3271cfb54a7"], }, -}) \ No newline at end of file +}); diff --git a/projects/treasury/alchemix.js b/projects/treasury/alchemix.js index bc0f2b8cdba6..9faea3c7b1a3 100644 --- a/projects/treasury/alchemix.js +++ b/projects/treasury/alchemix.js @@ -27,10 +27,10 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.CRV, ADDRESSES.ethereum.YFI, "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + ADDRESSES.ethereum.FXS, "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490", "0xF1bB87563A122211d40d393eBf1c633c330377F9", //xpremia - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + ADDRESSES.ethereum.FXS, "0x7f50786A0b15723D741727882ee99a0BF34e3466" ], owners: [alchemixTreasury, operations_treasury, treasury2, treasury3, treasury4, treasury5], diff --git a/projects/treasury/alienbase.js b/projects/treasury/alienbase.js new file mode 100644 index 000000000000..0b7e5f74ec2e --- /dev/null +++ b/projects/treasury/alienbase.js @@ -0,0 +1,8 @@ +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + base: { + owners: ['0x4aB9070B7680f802cBf8322e597a4409902171e5'], + ownTokens: ['0x1dd2d631c92b1aCdFCDd51A0F7145A50130050C4'], + }, +}) \ No newline at end of file diff --git a/projects/treasury/alphaX-protocol.js b/projects/treasury/alphaX-protocol.js new file mode 100644 index 000000000000..a1f9fc51c826 --- /dev/null +++ b/projects/treasury/alphaX-protocol.js @@ -0,0 +1,7 @@ +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + owners: ['0x95e2A6458419b7A38193CB853F45fD7329443A90'], + }, +}) diff --git a/projects/treasury/bankofcronos.js b/projects/treasury/bankofcronos.js index 7a3808f5f360..47bf8672d528 100644 --- a/projects/treasury/bankofcronos.js +++ b/projects/treasury/bankofcronos.js @@ -12,7 +12,7 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.cronos.USDC,//USDC '0x26043Aaa4D982BeEd7750e2D424547F5D76951d4',//CUSD - '0x5C7F8A570d578ED84E63fdFA7b1eE72dEae1AE23',//WCRO + ADDRESSES.cronos.WCRO_1,//WCRO '0xe44Fd7fCb2b1581822D0c862B68222998a0c299a',//WETH ADDRESSES.cronos.WBTC,//WBTC ], diff --git a/projects/treasury/benqi.js b/projects/treasury/benqi.js index f4f236745eda..e74e28e27264 100644 --- a/projects/treasury/benqi.js +++ b/projects/treasury/benqi.js @@ -1,4 +1,3 @@ -const { getCompoundV2Tvl } = require("../helper/compound"); const { stakings } = require("../helper/staking"); const { sumTokens } = require("../helper/sumTokens"); const { nullAddress } = require("../helper/treasury"); @@ -8,22 +7,16 @@ const treasury2 = "0x9d6ef2445fcc41b0d08865f0a7839490cc58a7b7"; const owners = [treasury, treasury2] const qi = "0x8729438EB15e2C8B576fCc6AeCdA6A148776C0F5"; -async function tvl(api){ - const balances = await getCompoundV2Tvl("0x486af39519b4dc9a7fccd318217352830e8ad9b4", "avax", undefined, undefined, undefined, false, undefined, { - abis:{ - getCash: {"constant":true,"inputs":[],"name":"totalReserves","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"} - } - })() - return sumTokens({ - balances, - api, - owners, - tokens: [nullAddress] - }) +async function tvl(api) { + const markets = await api.call({ abi: "address[]:getAllMarkets", target: '0x486af39519b4dc9a7fccd318217352830e8ad9b4'}) + const underlyings = (await api.multiCall({ abi: 'address:underlying', calls: markets, permitFailure: true })).map(i => i ?? nullAddress) + const bals = await api.multiCall({ abi: 'uint256:totalReserves', calls: markets}) + api.add(underlyings, bals) + return sumTokens({ api, owners, tokens: [nullAddress] }) } module.exports = { - avax:{ + avax: { ownTokens: stakings(owners, qi), tvl } diff --git a/projects/treasury/bitdao.js b/projects/treasury/bitdao.js index 99027682dd7e..121bb28e296c 100644 --- a/projects/treasury/bitdao.js +++ b/projects/treasury/bitdao.js @@ -1,112 +1,75 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { nullAddress,treasuryExports } = require("../helper/treasury"); -const sdk = require("@defillama/sdk"); +const sdk = require('@defillama/sdk'); +const { nullAddress } = require("../helper/treasury"); +const { getConfig } = require('../helper/cache') -//eth wallets -const mTreasuryL1 = "0x78605Df79524164911C144801f41e9811B7DB73D"; -const mTreasuryL1SC = "0xCa264A4Adf80d3c390233de135468A914f99B6a5" -const mTreasuryL1O1 = "0xf0e91a74cb053d79b39837E1cfba947D0c98dd93" -const mTreasuryL1E1 = "0x1a743BD810dde05fa897Ec41FE4D42068F7fD6b2" -const mTreasuryL1RB1 = "0x164Cf077D3004bC1f26E7A46Ad8fA54df4449E3F" -const mTreasuryL1LPE1 = "0xA5b79541548ef2D48921F63ca72e4954e50a4a74" +const API_URL = 'https://api.mantle.xyz/api/v2/treasury/tokens'; +const MNT = '0x3c3a81e81dc49a522a592e7622a7e711c06bf354'; +const USDe = '0x4c9edd5852cd905f086c759e8383e09bff1e68b3'; +const COOK = '0x9f0c013016e8656bc256f948cd4b79ab25c7b94d' +const ethenaFarm = '0x8707f238936c12c309bfc2b9959c35828acfc512'; +const SPECIFIC_TOKENS = ['eth', 'ethena-farming-usde', 'eigen-layer-eth', 'mnt']; -//mantle wallets +const abi = "function stakes(address, address) view returns (uint256 stakedAmount, uint152 coolingDownAmount, uint104 cooldownStartTimestamp)"; -const mTreasuryL2 = "0x94FEC56BBEcEaCC71c9e61623ACE9F8e1B1cf473" -const mTreasuryL2RB2 = "0x87C62C3F9BDFc09200bCF1cbb36F233A65CeF3e6" -const mTreasuryL2LPM1 = "0x992b65556d330219e7e75C43273535847fEee262" -const mTreasuryL2FF1 = "0xcD9Dab9Fa5B55EE4569EdC402d3206123B1285F4" +const isSpecificToken = token => SPECIFIC_TOKENS.includes(token); -const BIT = "0x1A4b46696b2bB4794Eb3D4c26f1c55F9170fa4C5"; -const MNT = "0x3c3a81e81dc49a522a592e7622a7e711c06bf354" +const getEthenaFarmingBalance = async (api, wallet) => { + const { stakedAmount, coolingDownAmount } = await api.call({ target: ethenaFarm, params: [wallet, USDe], abi }); + return Number(stakedAmount) + Number(coolingDownAmount); +}; -const MNTMantle = ADDRESSES.metis.Metis -const wrappedmantleonmantle = ADDRESSES.mantle.WMNT +const getTvlData = async (api, key) => { + const data = await getConfig('mantle-treasury', API_URL) + const rawDatas = data.filter(({ chain }) => key === chain); + const datas = rawDatas.map(({ id, walletAddress, amount }) => ({ id, walletAddress, amount })); -const ecspWallets = [ -'0x87c185bEFFfb36a42b741d10601A007e997a63bA', -'0x8AA6a67e96850e070B0c8E94E3a35C5f9f01809C', -'0x50f6e426fdefb3f994d3fe9fa4e1ee715f85de7f', -'0x7427b4Fd78974Ba1C3B5d69e2F1B8ACF654fEB44', -'0x7fe2bAffD481a8776A9eaD15a8eD17Fe37107903', -'0x15Bb5D31048381c84a157526cEF9513531b8BE1e', -'0xdD1c2483056fF46153249bd903401ae7bF6360D1', -'0x565F603D583F9199487923775114ae8c0D17D044', -'0x650aD9e7EfCD34B7d050c22a6A8dFFAFe3B4A22E', -'0x607105cE5bf13e70B49E949a3DdFaD694d19374F', -'0x131C7f3461A6696317ddfEdfed3BCdc10A2062B2', -'0xa1F7D91Bf121f4940d96c5C52Bc577011B95B51b', -'0x911169AA285f5D18fC3567d150616d4B0869d3a5', -'0x3f946F00A00eB2A66A4BD1AeAF137E05dB6CAEc6', -'0x9fe09b3ed1A407162876fEB1995048A620552fD0', -'0xd4338fC8Dc9d2FDcb99604d3cFc80019EBE01058', -'0x71Fb53Afc7E36C3f11BC1bdBBAB7B6FC3E552eb6', -'0x92A9e359d72F934a5d7c1251201f9855A381B23c', -'0xb118d4B94B0D4ce38F0D15d88f1dC09580a60b7A', -'0xaA42736947d1fdcc5d93F459A6D1dC0d7b9a92a4', -'0xF366eC9FA2DCE0ee7A6bdae4Aaa5c076E8391AFC', -'0x5DA939F5e2bC3C7159ac16f98BbFb23759000cd5', -'0x60F6ce1965D99EEffDF63B5303664f25fCb0347F', -'0xC784F3aEA5ce3daBA6907ee5d6Ce321a204Eb3A8', -'0xDCA65E2DFEe70991374eD47EfB4aD6B4FCD0c612', -'0x4ea7b4D10a01c93509BaA0CBb128c89344A1F578', -'0x4dF3d780Af7cbD51d9c76f236477edF417c7B554', -'0xA38e519b12D9CE133396a3E4EB92aac0934AB351', -'0x6d9755211D627fe0EA02D94C23C6110af16a8882', -'0x43c0f24E84e6d45b021d18C982beAbFA969577c8', -'0xB82C91bB7e8696a4A057192ED61aFcD1F9121722', -'0x15FFBf5730FA9eF271B2E9b4a1a6c90F2288155B', -'0xCef70f66e50CF016BB932De6425AA6f7286A3886', -'0x50165383783124232B9e4367D59815947012Ac27', -'0x97D50c7d14E68bEBC0f81B4FdCed89a1122330A6' -] + const wallets = Object.values( + datas.reduce((acc, { id, walletAddress, amount }) => { + acc[walletAddress] = acc[walletAddress] || { owner: walletAddress, tokens: [] }; + acc[walletAddress].tokens.push({ address: id, amount }); + return acc; + }, {}) + ); -const tokenTreasuries = treasuryExports({ + const uniqueOwners = new Set(); + const uniqueTokens = new Set(); + + for (const { owner, tokens } of wallets) { + const eigenLayerToken = tokens.find(token => token.address === 'eigen-layer-eth'); + if (tokens.some(token => token.address === 'eth')) api.add(nullAddress, (await sdk.api.eth.getBalance({ target: owner })).output); + if (tokens.some(token => token.address === 'mnt')) api.add(MNT, (await sdk.api.eth.getBalance({ target: owner })).output, { skipChain: true }); + if (tokens.some(token => token.address === 'ethena-farming-usde')) api.add(USDe, await getEthenaFarmingBalance(api, owner)); + if (eigenLayerToken) api.add(nullAddress, eigenLayerToken.amount * 10 ** 18); + + const nonSpecificTokens = tokens.filter(token => !isSpecificToken(token.address)); + if (nonSpecificTokens.length > 0) { + uniqueOwners.add(owner); + nonSpecificTokens.forEach(token => uniqueTokens.add(token.address)); + } + } + + return { owners: Array.from(uniqueOwners), tokens: Array.from(uniqueTokens) }; +}; + +module.exports = { ethereum: { - tokens: [ - nullAddress, - ADDRESSES.ethereum.USDC,//USDC - ADDRESSES.ethereum.DAI,//DAI - ADDRESSES.ethereum.WETH,//WETH - ADDRESSES.ethereum.USDT,//USDT - '0x50D1c9771902476076eCFc8B2A83Ad6b9355a4c9',//FTT - '0x8798249c2E607446EfB7Ad49eC89dD1865Ff4272',//xSUSHI - "0x52A8845DF664D76C69d2EEa607CD793565aF42B8", - ADDRESSES.ethereum.sUSDe, //sUSDe - ], - owners: [mTreasuryL1, mTreasuryL1SC,mTreasuryL1O1,mTreasuryL1E1, mTreasuryL1RB1, mTreasuryL1LPE1, ...ecspWallets ], - ownTokens: [BIT, MNT], - resolveLP: true, - resolveUniV3: true + tvl: sdk.util.sumChainTvls([async ({ api }) => { + const { owners, tokens } = await getTvlData(api, 'eth') + return api.sumTokens({ owners, tokens, blacklistedTokens: [MNT] }); + }]), + ownTokens: async ({ api }) => { + const { owners } = await getTvlData(api, 'eth') + return api.sumTokens({ ownerTokens: owners.map(owner => [[MNT], owner]) }); + } }, mantle: { - tokens: [ - nullAddress, - "0x5bE26527e817998A7206475496fDE1E68957c5A6", //ondo usd - "0xcda86a272531e8640cd7f1a92c01839911b90bb0", //mantle staked eth - ADDRESSES.mantle.WETH, //eth - ADDRESSES.mantle.USDC, //usdc - ADDRESSES.mantle.USDT, //tether - "0xf52b354ffdb323e0667e87a0136040e3e4d9df33", //lp meth - ], - owners: [mTreasuryL2, mTreasuryL2RB2, mTreasuryL2LPM1, mTreasuryL2FF1, ...ecspWallets], - ownTokens: [MNTMantle, wrappedmantleonmantle], - resolveLP: true, + tvl: async (api) => { + const { owners, tokens } = await getTvlData(api, 'mnt') + return api.sumTokens({ owners, tokens, blacklistedTokens: [COOK] }); + }, + ownTokens: async ({ api }) => { + const { owners } = await getTvlData(api, 'mnt') + return api.sumTokens({ ownerTokens: owners.map(owner => [[COOK], owner]) }); + } }, -}) - -async function otherTvl(_timestamp, _block, _chainBlocks, {api}){ - const shares = await api.call({ abi: 'function shares(address user) public view returns (uint256)', target: "0x298afb19a105d59e74658c4c334ff360bade6dd2", params:["0xca264a4adf80d3c390233de135468a914f99b6a5"]}) - const balances = { - "ethereum:0xd5f7838f5c461feff7fe49ea5ebaf7728bb0adfa": shares - } - return balances } - -module.exports={ - ethereum:{ - tvl: sdk.util.sumChainTvls([tokenTreasuries.ethereum.tvl, otherTvl]), - ownTokens: tokenTreasuries.ethereum.ownTokens - }, - mantle: tokenTreasuries.mantle -} \ No newline at end of file diff --git a/projects/treasury/bonsai.js b/projects/treasury/bonsai.js new file mode 100644 index 000000000000..af5e372c30af --- /dev/null +++ b/projects/treasury/bonsai.js @@ -0,0 +1,54 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const arbitrumAddresses = [ + "0xb137d135Dc8482B633265c21191F50a4bA26145d", // Main treasury + "0x8E52cA5A7a9249431F03d60D79DDA5EAB4930178", // Arbitrum DAO delegate + "0xB0B4bd94D656353a30773Ac883591DDBaBC0c0bA", // Old ARBIs multisig + "0x4e5645bee4eD80C6FEe04DCC15D14A3AC956748A" // Multisig collecting vaults fees +]; +const ethAddresses = "0x9478D820E8d38Ca96610b7FCbE377822C2F60f2c" + +const ownTokens = [ + "0x79EaD7a012D97eD8DeEcE279f9bC39e264d7Eef9", // Bonsai +]; + +module.exports = treasuryExports({ + arbitrum: { + tokens: [ + nullAddress, // ETH + ADDRESSES.arbitrum.fsGLP, + ADDRESSES.arbitrum.fGLP, + ADDRESSES.arbitrum.USDC, // USDC.e + ADDRESSES.arbitrum.USDC_CIRCLE, // USDC + ADDRESSES.arbitrum.USDT, + ADDRESSES.arbitrum.WETH, + ADDRESSES.arbitrum.GMX, + ADDRESSES.arbitrum.ARB, + ADDRESSES.arbitrum.WBTC, + "0xe4dddfe67e7164b0fe14e218d80dc4c08edc01cb", // KNC + ADDRESSES.arbitrum.LINK, // LINK + "0x56659245931cb6920e39c189d2a0e7dd0da2d57b", // IBEX + "0xfa7f8980b0f1e64a2062791cc3b0871572f1f7f0", // UNI + "0x55ff62567f09906a85183b866df84bf599a4bf70", // KROM + "0x3d9907f9a368ad0a51be60f7da3b97cf940982d8", // GRAIL + "0x3CAaE25Ee616f2C8E13C74dA0813402eae3F496b", // xGRAIL + "0x3e6648c5a70a150a88bce65f4ad4d506fe15d2af", // spell + "0x10010078a54396f62c96df8532dc2b4847d47ed3", // hnd + "0x32eb7902d4134bf98a28b963d26de779af92a212", // rpdx + "0xd4d42f0b6def4ce0383636770ef773390d85c61a", // sushi + "0x2cab3abfc1670d1a452df502e216a66883cdf079", // l2dao + "0x539bde0d7dbd336b79148aa742883198bbf60342", // magic + "0x6694340fc020c5e6b96567843da2df01b2ce1eb6", // stg + ], + owners: arbitrumAddresses, + ownTokens, + }, + ethereum: { + tokens: [ + nullAddress, + ADDRESSES.ethereum.USDC, // usdc + ], + owners: [ethAddresses] + }, +}); diff --git a/projects/treasury/commonwealth.js b/projects/treasury/commonwealth.js new file mode 100644 index 000000000000..3a99df4e7e41 --- /dev/null +++ b/projects/treasury/commonwealth.js @@ -0,0 +1,13 @@ +const { treasuryExports } = require("../helper/treasury"); + +const owners = [ + '0xdE70B8BC5215BdF03f839BB8cD0F639D4E3E2881', + '0xA205fD6A798A9Ba8b107A00b8A6a5Af742d6aCb5', + '0x990eCdf73704f9114Ee28710D171132b5Cfdc6f0', + '0xa653879692D4D0e6b6E0847ceDd58eAD2F1CC136' +] + +const WLTH = '0x99b2B1A2aDB02B38222ADcD057783D7e5D1FCC7D'; +module.exports = treasuryExports({ + base: { owners, ownTokens: [WLTH], }, +}) diff --git a/projects/treasury/croblanc.js b/projects/treasury/croblanc.js index 806a6efef581..a0d352516001 100644 --- a/projects/treasury/croblanc.js +++ b/projects/treasury/croblanc.js @@ -1,7 +1,8 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const treasury = "0xb20234c33337537111f4ab6f5EcaD400134aC143"; -const WCRO = "0x5c7f8a570d578ed84e63fdfa7b1ee72deae1ae23"; +const WCRO = ADDRESSES.cronos.WCRO_1; module.exports = { cronos: { diff --git a/projects/treasury/dexfinance.js b/projects/treasury/dexfinance.js index d336eb63cc5f..91864983c858 100644 --- a/projects/treasury/dexfinance.js +++ b/projects/treasury/dexfinance.js @@ -19,10 +19,10 @@ module.exports = treasuryExports({ '0xd56734d7f9979dd94fae3d67c7e928234e71cd4c', //tia '0x0c880f6761f1af8d9aa9c466984b80dab9a8c9e8', //pendle '0x25d887ce7a35172c62febfd67a1856f20faebb00', //pepe - '0xf97f4df75117a78c1a5a0dbb814af92458539fb4', //link - '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', //gmx - '0x912ce59144191c1204e64559fe8253a0e49e6548', //arb - '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', //wbtc + ADDRESSES.arbitrum.LINK, //link + ADDRESSES.arbitrum.GMX, //gmx + ADDRESSES.arbitrum.ARB, //arb + ADDRESSES.arbitrum.WBTC, //wbtc ] }, avax: { @@ -55,8 +55,8 @@ module.exports = treasuryExports({ // owners: [mainTreasury], // tokens: [ // ADDRESSES.pulse.WETH, - // '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', //usdc(fork) - // '0x30fcb23a906493371b1721c8feb8815804808d74', //sdai + // ADDRESSES.ethereum.USDC, //usdc(fork) + // ADDRESSES.pulse.sDAI, //sdai // '0xaa2c47a35c1298795b5271490971ec4874c8e53d', //usdex // '0x6386704cd6f7a584ea9d23ccca66af7eba5a727e', //spark // ] diff --git a/projects/treasury/frax.js b/projects/treasury/frax.js index 744f04050e09..1ceb3a51181a 100644 --- a/projects/treasury/frax.js +++ b/projects/treasury/frax.js @@ -3,7 +3,7 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x9AA7Db8E488eE3ffCC9CdFD4f2EaECC8ABeDCB48"; const fpis = "0xc2544A32872A91F4A553b404C6950e89De901fdb"; -const fxs = "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0"; +const fxs = ADDRESSES.ethereum.FXS; const treasuryarb = "0xe61d9ed1e5dc261d1e90a99304fadcef2c76fd10" module.exports = treasuryExports({ diff --git a/projects/treasury/galaxygoogle.js b/projects/treasury/galaxygoogle.js index fcc803f7d1da..b9ee1dad47ce 100644 --- a/projects/treasury/galaxygoogle.js +++ b/projects/treasury/galaxygoogle.js @@ -1,7 +1,4 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const gg = "0xF2F7CE610a091B94d41D69f4fF1129434a82E2f0" // https://app.galaxygoggle.money/#/bonds const treasury = "0xD5F922e23693e552793fE0431F9a95ba67A60A23" @@ -10,42 +7,22 @@ const mim = "0x130966628846BFd36ff31a822705796e8cb8C18D" const wavax = ADDRESSES.avax.WAVAX const joe = ADDRESSES.avax.JOE -async function tvl(timestamp, block, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [mim, false], - [wavax, false], - [joe, false], - ["0xe9E8d6b6ce6D94Fc9d724711e80784Ec096949Fc", true], // mim-gg - ], - [treasury, dao], - chainBlocks.avax, - 'avax', - addr=>`avax:${addr}` - ); - - return balances; +async function tvl(api) { + return api.sumTokens({ owners: [treasury, dao], tokens: [mim, wavax, joe, "0xe9E8d6b6ce6D94Fc9d724711e80784Ec096949Fc",] }); } const bscTreasury = "0xF76C9753507B3Df0867EB02D86d07C6fFcEecaf1"; const treasuryTokensBSC = [ - [ADDRESSES.bsc.BUSD, false], // BUSD - ["0x13Cf29b3F58f777dDeD38278F7d938401f6b260c", true] // GG-BUSD + ADDRESSES.bsc.BUSD, // BUSD + "0x13Cf29b3F58f777dDeD38278F7d938401f6b260c", // GG-BUSD ] -async function bscTvl(timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, treasuryTokensBSC, [bscTreasury], chainBlocks.bsc, "bsc", addr=>`bsc:${addr}`); - balances[`avax:${gg}`] = balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"] || 0; - delete balances["bsc:0xcaf23964ca8db16d816eb314a56789f58fe0e10e"]; - return balances; +async function bscTvl(api) { + return api.sumTokens({ owners: [bscTreasury], tokens: treasuryTokensBSC }); } module.exports = { - avax:{ + avax: { tvl, }, bsc: { diff --git a/projects/treasury/genesis-dao.js b/projects/treasury/genesis-dao.js new file mode 100644 index 000000000000..3757a56759be --- /dev/null +++ b/projects/treasury/genesis-dao.js @@ -0,0 +1,7 @@ +const { treasuryExports } = require("../helper/treasury"); + +module.exports = treasuryExports({ + ethereum: { + owners: ['0x31b6a4dca90fabf29879143ca5bb2c10e8a11e4c'], ownTokens: ['0x99999999999997fceB5549c58aB66dF52385ca4d'] + }, +}) diff --git a/projects/treasury/india-covid-relief-fund.js b/projects/treasury/india-covid-relief-fund.js index f75c213016cb..8a8c422174a1 100644 --- a/projects/treasury/india-covid-relief-fund.js +++ b/projects/treasury/india-covid-relief-fund.js @@ -1,12 +1,11 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { nullAddress,treasuryExports } = require("../helper/treasury"); +const { nullAddress, treasuryExports } = require("../helper/treasury") +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const Treasury = "0x68A99f89E475a078645f4BAC491360aFe255Dff1"; const Treasury_bsc = "0x5C9E5571B17D91e6ACcD4F0c29bBe199Af1f7B09"; -const Treasury_btc = "bc1q220k2449fau0pxu9hfn28q3w4k99ep9hwsa5fa"; const Treasury_trx = "TSZMcrQzMLdKrgiMPoe2uQMHLeEpkf2j8E" - module.exports = treasuryExports({ ethereum: { tokens: [ @@ -40,7 +39,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ], - owners: [Treasury_btc] + owners: bitcoinAddressBook.indiaCovid } //https://cryptorelief.in/transparency }) \ No newline at end of file diff --git a/projects/treasury/inverse.js b/projects/treasury/inverse.js index 078f9d88b5e5..366b64fe133f 100644 --- a/projects/treasury/inverse.js +++ b/projects/treasury/inverse.js @@ -41,6 +41,7 @@ module.exports = treasuryExports({ "0x7e05540A61b531793742fde0514e6c136b5fbAfE", // xFODL "0x0a6B1d9F920019BAbc4De3F10c94ECB822106104", "0x73E02EAAb68a41Ea63bdae9Dbd4b7678827B2352", + "0xbD1F921786e12a80F2184E4d6A5cAcB25dc673c9", // dola-inv uni ], owners: [anchorTreasury, treasurymultisig, pcmultisig, bugbountymultisig, fedchair], ownTokens: [ @@ -54,6 +55,16 @@ module.exports = treasuryExports({ blacklistedTokens: [ '0x21e83dbfd8f11d885eba9f9ba126da11ae0671b7', '0x265befe2b1a0f4f646dea96ba09c1656b74bda91', + ], + convexRewardPools: [ + "0x9a2d1b49b7c8783E37780AcE4ffA3416Eea64357",// DBR tripool CVX + "0x21E2d7f66DF6F4e8199210b9490a51831C9847C7",// inv tripool CVX + "0xE8cBdBFD4A1D776AB1146B63ABD1718b2F92a823",// dola-fraxpyusd lp CVX + "0x2ef1dA0368470B2603BAb392932E70205eEb9046",// dola-fxusd lp CVX + "0x0404d05F3992347d2f0dC3a97bdd147D77C85c1c",// dola-fraxusdc lp CVX + ], + auraPools: [ + "0xA36d3799eA28f4B75653EBF9D91DDA4519578086", // sDOLA-DOLA aura pool ] }, optimism: { diff --git a/projects/treasury/iq.js b/projects/treasury/iq.js index d7e909d3eed8..caa545cdbd24 100644 --- a/projects/treasury/iq.js +++ b/projects/treasury/iq.js @@ -13,7 +13,7 @@ module.exports = treasuryExports({ "0x9D45081706102E7aadDD0973268457527722E274", ADDRESSES.ethereum.WETH, ADDRESSES.ethereum.WBTC, - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", + ADDRESSES.ethereum.FXS, "0xEF9F994A74CB6EF21C38B13553caa2E3E15F69d0" ], owners: [treasury], diff --git a/projects/treasury/jade-protocol.js b/projects/treasury/jade-protocol.js index ca55cdf63ca8..9ea92d434bbc 100644 --- a/projects/treasury/jade-protocol.js +++ b/projects/treasury/jade-protocol.js @@ -19,7 +19,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.WBTC, ADDRESSES.ethereum.sfrxETH, - '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', // FXS + ADDRESSES.ethereum.FXS, // FXS ], owners: [treasury, treasury1], }, diff --git a/projects/treasury/k9finance.js b/projects/treasury/k9finance.js new file mode 100644 index 000000000000..2622ebfd217f --- /dev/null +++ b/projects/treasury/k9finance.js @@ -0,0 +1,18 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +const treasury = "0xDA4Df6E2121eDaB7c33Ed7FE0f109350939eDA84"; +const shibtreasury = "0x5C3d21D406226F17a06510F1CB9157BD9e751416" + +module.exports = treasuryExports({ + ethereum: { + tokens: [nullAddress], + owners: [treasury], + ownTokens: ["0x91fbb2503ac69702061f1ac6885759fc853e6eae"] + }, + shibarium: { + tokens: [nullAddress,ADDRESSES.shibarium.BONE_5], + owners: [shibtreasury], + ownTokens: ["0x91fbB2503AC69702061f1AC6885759Fc853e6EaE"] + }, +}) \ No newline at end of file diff --git a/projects/treasury/mahaxyz.js b/projects/treasury/mahaxyz.js new file mode 100644 index 000000000000..511605dca021 --- /dev/null +++ b/projects/treasury/mahaxyz.js @@ -0,0 +1,16 @@ +const { treasuryExports } = require("../helper/treasury"); + +const treasury = "0x6357EDbfE5aDA570005ceB8FAd3139eF5A8863CC"; + +module.exports = treasuryExports({ + ethereum: { + owners: [treasury], + ownTokens: [ + "0x745407c86DF8DB893011912d3aB28e68B62E49B0", // MAHA + ], + blacklistedTokens: [ + "0xB4d930279552397bbA2ee473229f89Ec245bc365", // MAHA + "0x6b7127a638eDC7Db04bEde220c7c49930fdB4160" // MAHAETH + ], + }, +}) diff --git a/projects/treasury/minswap.js b/projects/treasury/minswap.js index ee314246df9c..4b8300c6f35a 100644 --- a/projects/treasury/minswap.js +++ b/projects/treasury/minswap.js @@ -1,13 +1,15 @@ -const { get } = require('../helper/http'); +// https://minswap.org/analytics/dao-treasury +const { sumTokensExport} = require("../helper/chain/cardano"); + +const min_dao = 'addr1z9wdv59sq7zzy2l6gchq3247lz7ssfsxs45nj4njhwsp5uzj2c79gy9l76sdg0xwhd7r0c0kna0tycz4y5s6mlenh8pqzygnta' +const min_dao_hot = 'addr1q8zntywq3fldecrqk4vl593sznvj7483ejcajnavvh2qpsvftaax5f3wasl5m49rtjw5pen938vr7863w0lfz94h0lfqldx3pu' +const min_fee_dao = 'addr1qxymvaeg3306xyp6yk3mjdj7usp40x2e5cecsh75xw5tsczj2c79gy9l76sdg0xwhd7r0c0kna0tycz4y5s6mlenh8pqjx0th5' +const min_pol = 'addr1q9gxe8vx0kvv5g6gv4n5wmsxexjqsjftc599qqcp2vkmmwh7snv5yhw2qqvdev3c7wn6s3xhrnx25eg6zcqjxj9vrv2s0e38ze' +const min_ada_min_pol = 'addr1qx54hjkagnc7zanqkfjearg8nk2w303pgdyl2qm4hs2x8saxg62nrp8kp2mukmrr4pfyt4fpdyjp7dx8jxffs4gf2xcsx6uj7a' module.exports = { cardano: { tvl: () => ({}), - ownTokens: async () => { - const pol = await get("https://api-mainnet-prod.minswap.org/landing-page/pol-details"); - return { - "coingecko:cardano": parseInt(pol[0]["totalPOL"]["totalAdaWorth"]), - } - } - }, -}; + ownTokens: sumTokensExport({ owners: [min_dao, min_dao_hot, min_fee_dao, min_pol, min_ada_min_pol] }) + } +} diff --git a/projects/treasury/newland.js b/projects/treasury/newland.js index e815cd3cc7a6..0d5aeedc43ac 100644 --- a/projects/treasury/newland.js +++ b/projects/treasury/newland.js @@ -1,6 +1,3 @@ -const { getChainTransform } = require("../helper/portedTokens"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - const treasuryAddress = "0xB3FC6B9be3AD6b2917d304d4F5645a311bCFd0A8"; const erc20Tokens = [ //MDX @@ -10,11 +7,8 @@ const erc20Tokens = [ ]; /*** Treasury ***/ -const Treasury = async (timestamp, ethBlock, chainBlocks) => { - const balances = {}; - let transformAddress = await getChainTransform('heco') - await sumTokensAndLPsSharedOwners(balances, erc20Tokens.map(t => [t, false]), [treasuryAddress], chainBlocks["heco"], "heco", transformAddress); - return balances; +const Treasury = async (api) => { + return api.sumTokens({ owner: treasuryAddress, tokens: erc20Tokens }); }; module.exports = { diff --git a/projects/treasury/op-foundation.js b/projects/treasury/op-foundation.js index 8b0283756d71..908dea7ea357 100644 --- a/projects/treasury/op-foundation.js +++ b/projects/treasury/op-foundation.js @@ -2,6 +2,10 @@ const ADDRESSES = require('../helper/coreAssets.json') const { nullAddress, treasuryExports } = require("../helper/treasury"); const treasury = "0x2501c477d0a35545a387aa4a3eee4292a9a8b3f0"; +const treasury2 = "0xfedfaf1a10335448b7fa0268f56d2b44dbd357de"; +const treasury3 = "0x2a82ae142b2e62cb7d10b55e323acb1cab663a26"; +const treasury4 = "0x19793c7824be70ec58bb673ca42d2779d12581be"; + const OP = ADDRESSES.optimism.OP module.exports = treasuryExports({ @@ -10,7 +14,7 @@ module.exports = treasuryExports({ nullAddress, ADDRESSES.optimism.USDC ], - owners: [treasury], + owners: [treasury,treasury2,treasury3,treasury4], ownTokens: [OP], }, ethereum: { diff --git a/projects/treasury/perfect-pool.js b/projects/treasury/perfect-pool.js new file mode 100644 index 000000000000..d902784660b6 --- /dev/null +++ b/projects/treasury/perfect-pool.js @@ -0,0 +1,11 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") +const ADDRESSES = require('../helper/coreAssets.json') + +const TREASURY = '0xFe4559392aF0E6988F2d7A4E6447a2E702Ff215d' + +module.exports = { + start: 1725311445, + base: { + tvl: sumTokensExport({ owner: TREASURY, token: ADDRESSES.base.USDC }), + } +} \ No newline at end of file diff --git a/projects/treasury/perpetual-protocol.js b/projects/treasury/perpetual-protocol.js index 720990d2d430..6da27dbd951a 100644 --- a/projects/treasury/perpetual-protocol.js +++ b/projects/treasury/perpetual-protocol.js @@ -9,7 +9,7 @@ module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, - '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0',//FXS + ADDRESSES.ethereum.FXS,//FXS '0xca1207647Ff814039530D7d35df0e1Dd2e91Fa84',//DHT '0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F',//SDT '0x1494CA1F11D487c2bBe4543E90080AeBa4BA3C2b',//DPI diff --git a/projects/treasury/railgun.js b/projects/treasury/railgun.js index f303f476c7fd..ef4d5f5acb93 100644 --- a/projects/treasury/railgun.js +++ b/projects/treasury/railgun.js @@ -22,12 +22,12 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDC, ADDRESSES.ethereum.USDT, ADDRESSES.ethereum.DAI, - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//fxs + ADDRESSES.ethereum.FXS,//fxs ADDRESSES.ethereum.WSTETH, ADDRESSES.ethereum.CVX, "0xEB4C2781e4ebA804CE9a9803C67d0893436bB27D",//renbtc ADDRESSES.ethereum.cvxCRV, - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0",//wbtc + ADDRESSES.ethereum.FXS,//wbtc "0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3",//mim ADDRESSES.ethereum.LUSD, "0x090185f2135308BaD17527004364eBcC2D37e5F6",//spell @@ -101,7 +101,7 @@ module.exports = treasuryExports({ "0x8f006D1e1D9dC6C98996F50a4c810F17a47fBF19",//nsfw ADDRESSES.fantom.renBTC, "0x9c891326Fd8b1a713974f73bb604677E1E63396D",//islami - "0x45c32fA6DF82ead1e2EF74d17b76547EDdFaFF89",//frax + ADDRESSES.polygon.FRAX,//frax "0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B",//bob "0x580A84C73811E1839F75d86d75d88cCa0c241fF4",//qi "0x980111ae1B84E50222C8843e3A7a038F36Fecd2b",//stack diff --git a/projects/treasury/rootstock-collective.js b/projects/treasury/rootstock-collective.js new file mode 100644 index 000000000000..c8d26e8018f8 --- /dev/null +++ b/projects/treasury/rootstock-collective.js @@ -0,0 +1,19 @@ +const { nullAddress, treasuryExports } = require("../helper/treasury"); + +// Treasury +const treasuryGrants = "0x48229e5D82a186Aa89a99212D2D59f5674aa5b6C"; +const treasuryActive = "0xf016fA6B237BB56E3AEE7022C6947a6A103E3C47"; +const treasuryGrowth = "0x267a6073637408b6A1d34d685ff5720A0CbCbD9d"; +const treasuryGeneral = "0xfE3d9B7D68aE13455475F28089968336414FD358"; + + +module.exports = treasuryExports({ + rsk: { + tokens: [ + // Rootstock Assets + nullAddress, + ], + owners: [treasuryGrants, treasuryActive, treasuryGrowth, treasuryGeneral], + ownTokens: ["0x2aCc95758f8b5F583470bA265Eb685a8f45fC9D5",] // RIF + }, +}); \ No newline at end of file diff --git a/projects/treasury/saddle.js b/projects/treasury/saddle.js index 21e629170a46..8eaa74b41d59 100644 --- a/projects/treasury/saddle.js +++ b/projects/treasury/saddle.js @@ -6,7 +6,7 @@ module.exports = treasuryExports({ tokens: [ '0x5575552988a3a80504bbaeb1311674fcfd40ad4b', '0x2cab3abfc1670d1a452df502e216a66883cdf079', - '0x17fc002b466eec40dae837fc4be5c67993ddbd6f', + ADDRESSES.arbitrum.FRAX, ADDRESSES.arbitrum.USDC, ], owners: ['0x8e6e84ddab9d13a17806d34b097102605454d147'], diff --git a/projects/treasury/safe.js b/projects/treasury/safe.js index 47ddb3f1acf2..61b6a539bfaf 100644 --- a/projects/treasury/safe.js +++ b/projects/treasury/safe.js @@ -5,6 +5,7 @@ const treasury = "0x3EDf6868d7c42863E44072DaEcC16eCA2804Dea1" // const SAFE = ADDRESSES.ethereum.SAFE const safe_foundation_treasury = "0x1d4f25bc16b68c50b78e1040bc430a8097fd6f45" const safe_dao_2 = "0x0b00b3227a5f3df3484f03990a87e02ebad2f888" +const safe_gnosisdao_joint_treasury = "0xd28b432f06cb64692379758B88B5fCDFC4F56922" module.exports = treasuryExports({ @@ -19,7 +20,7 @@ module.exports = treasuryExports({ tokens: [ nullAddress, ], - owners: [safe_foundation_treasury, safe_dao_2], + owners: [safe_foundation_treasury, safe_dao_2,safe_gnosisdao_joint_treasury], ownTokens: [SAFE], }, diff --git a/projects/treasury/shibui.js b/projects/treasury/shibui.js index 851bc8f5d469..d12d8955f9b4 100644 --- a/projects/treasury/shibui.js +++ b/projects/treasury/shibui.js @@ -1,61 +1,23 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - -const CHAINS = ["boba"]; - -const Boba_SHIBUI = "0xf08ad7c3f6b1c6843ba027ad54ed8ddb6d71169b"; const Boba_BOBA = ADDRESSES.boba.BOBA; const Boba_USDT = ADDRESSES.boba.USDT; const Boba_SHIBUI_WETH = "0xcE9F38532B3d1e00a88e1f3347601dBC632E7a82"; const Boba_SHIBUI_USDT = "0x3f714fe1380ee2204ca499d1d8a171cbdfc39eaa"; -const Boba_4Koyo = "0xDAb3Fc342A242AdD09504bea790f9b026Aa1e709"; - -const CHAIN_ORGANISED_DATA = { - boba: () => { - - return [ - { - treasuryTokens: [ - [Boba_BOBA, false], - [Boba_USDT, false], - [Boba_SHIBUI_WETH, true], - [Boba_SHIBUI_USDT, true], - ], - treasuryKoyoTokens: [Boba_4Koyo], - treasuryAddresses: [ - "0x9596E01Ad72d2B0fF13fe473cfcc48D3e4BB0f70", // Hot treasury - ], - gaugeTokens: [Boba_SHIBUI_USDT], - gaugeAddresses: [ - "0x6b8f4Fa6E44e923f5A995A87e4d79B3Bb9f8aaa3", // SHIBUI-USDT<>WAGMIv3 - ], - }, - true, - ]; - }, -}; module.exports = { start: 394825, boba: { - tvl: async (timestamp, _ethBlock, chainBlocks) => { - const chain = CHAINS[0]; - const [data, koyoAssets] = CHAIN_ORGANISED_DATA[chain](); - - const balances = {}; - const block = chainBlocks[chain]; - - await sumTokensAndLPsSharedOwners( - balances, - data.treasuryTokens, - data.treasuryAddresses, - block, - chain - ); - - return balances; + tvl: async (api) => { + return api.sumTokens({ owners: [ + "0x9596E01Ad72d2B0fF13fe473cfcc48D3e4BB0f70", // Hot treasury + ], tokens: [ + Boba_BOBA, + Boba_USDT, + Boba_SHIBUI_WETH, + Boba_SHIBUI_USDT, + ] }); }, }, } diff --git a/projects/treasury/sideshift-ai.js b/projects/treasury/sideshift-ai.js index 4fb7c838ee1b..a98de007e9d6 100644 --- a/projects/treasury/sideshift-ai.js +++ b/projects/treasury/sideshift-ai.js @@ -1,11 +1,27 @@ const { nullAddress, treasuryExports } = require("../helper/treasury"); +const owners = ['0x8f456e525ed0115e22937c5c8afac061cc697f21'] + module.exports = treasuryExports({ ethereum: { tokens: [ nullAddress, ], - owners: ['0x8f456e525ed0115e22937c5c8afac061cc697f21'], + owners, + ownTokens: [], + }, + mantle: { + tokens: [ + "0xcda86a272531e8640cd7f1a92c01839911b90bb0", + "0xc96de26018a54d51c097160568752c4e3bd6c364" + ], + owners, + ownTokens: [], + }, + arbitrum: { + tokens: [ + ], + owners, ownTokens: [], }, }) \ No newline at end of file diff --git a/projects/treasury/silo-finance.js b/projects/treasury/silo-finance.js index 169f4f5fbb19..790fdb9f0fc8 100644 --- a/projects/treasury/silo-finance.js +++ b/projects/treasury/silo-finance.js @@ -38,7 +38,7 @@ module.exports = mergeExports([ ADDRESSES.ethereum.CRV, // CRV ADDRESSES.ethereum.CRVUSD, // crvUSD "0xc944E90C64B2c07662A292be6244BDf05Cda44a7", // GRT - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS + ADDRESSES.ethereum.FXS // FXS ], owners: ETHEREUM_MAINNET_TREASURIES, ownTokens: [SILO_ETHEREUM_MAINNET, XAI_ETHEREUM_MAINNET], diff --git a/projects/treasury/umamifinance.js b/projects/treasury/umamifinance.js index 31ad7cfa3803..e42dd9e6eff8 100644 --- a/projects/treasury/umamifinance.js +++ b/projects/treasury/umamifinance.js @@ -44,6 +44,11 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.USDC,//usdc ], owners: [ethowners] - }, }); + +module.exports.deadFrom = '2024-08-30' +module.exports.ethereum.tvl = () => ({}) +module.exports.ethereum.ownTokens = () => ({}) +module.exports.arbitrum.tvl = () => ({}) +module.exports.arbitrum.ownTokens = () => ({}) diff --git a/projects/treasury/venus.js b/projects/treasury/venus.js index 2098881e8064..c14df2d5e341 100644 --- a/projects/treasury/venus.js +++ b/projects/treasury/venus.js @@ -18,7 +18,7 @@ module.exports = treasuryExports({ ADDRESSES.bsc.BETH, //BETH ADDRESSES.bsc.WBNB, venusBTC, - "0x2170Ed0880ac9A755fd29B2688956BD959F933F8", //eth + ADDRESSES.bsc.ETH, //eth "0xecA88125a5ADbe82614ffC12D0DB554E2e2867C8", // venusUSDC "0xf508fCD89b8bd15579dc79A6827cB4686A3592c8", // venusETH "0xfD5840Cd36d94D7229439859C0112a4185BC0255", // venusUSDT @@ -37,10 +37,10 @@ module.exports = treasuryExports({ "0x3EE2200Efb3400fAbB9AacF31297cBdD1d435D47", //ada "0xF8A0BF9cF54Bb92F17374d9e9A321E6a111a51bD", //link "0xbA2aE424d960c26247Dd6c32edC70B295c744C43", //doge - "0x40af3827F39D0EAcBF4A168f8D4ee67c121D11c9", //tusd + ADDRESSES.bsc.TUSD, //tusd "0x0D8Ce2A99Bb6e3B7Db580eD848240e4a0F9aE153", //fil "0xCC42724C6683B7E57334c4E856f4c9965ED682bD", //matic - "0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", //busd + ADDRESSES.bsc.BUSD, //busd "0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827", //ankrbnb "0xCE7de646e7208a4Ef112cb6ed5038FA6cC6b12e3", //trx "0x352Cb5E19b12FC216548a2677bD0fce83BaE434B", //btt @@ -60,4 +60,13 @@ module.exports = treasuryExports({ owners: [venusTreasury], ownTokens: [XVS, VAI], }, + era: { + tokens: [ + ADDRESSES.era.WBTC, + ADDRESSES.era.ZK, + ADDRESSES.era.USDC, + ADDRESSES.era.WETH + ], + owners: ['0xB2e9174e23382f7744CebF7e0Be54cA001D95599'] + } }); diff --git a/projects/treasury/yamfore.js b/projects/treasury/yamfore.js new file mode 100644 index 000000000000..72c8be11ae71 --- /dev/null +++ b/projects/treasury/yamfore.js @@ -0,0 +1,40 @@ +const { sumTokens2 } = require("../helper/chain/cardano"); +const { assetsAddresses } = require('../helper/chain/cardano/blockfrost'); +const { nullAddress } = require("../helper/tokenMapping"); + +async function adaHandleToAddress(handle) { + // https://docs.adahandle.com/reference/api-reference/cardano-node + const policyID = 'f0ff48bbb7bbe9d59a40f1ce90e9e9d0ff5002ec48f232b49ca0fb9a'; + const assetName = Buffer.from(handle).toString('hex'); + const [holder] = await assetsAddresses(`${policyID}000de140${assetName}`) + return holder.address +} + +async function tvl() { + // const TREASURY_ADDRESS = await adaHandleToAddress('bigblymp') + const TREASURY_ADDRESS = 'addr1qx2m86m788l8zrcc6ecfg0yq698s2ryqpz3c52z2ratw5jh8yqevyugcr8w4ezlj3sry6798h9ynqjgce3mqfwxfma9qts79w0' + + return sumTokens2({ + owners: [TREASURY_ADDRESS,], tokens: [ + nullAddress, + 'c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d' + ], + }) +} + +async function ownTokens() { + // const TREASURY_ADDRESS = await adaHandleToAddress('bigblymp') + const TREASURY_ADDRESS = 'addr1qx2m86m788l8zrcc6ecfg0yq698s2ryqpz3c52z2ratw5jh8yqevyugcr8w4ezlj3sry6798h9ynqjgce3mqfwxfma9qts79w0' + + return sumTokens2({ + owners: [TREASURY_ADDRESS,], tokens: [ + 'ee0633e757fdd1423220f43688c74678abde1cead7ce265ba8a24fcd43424c50', + ], + }) +} + +module.exports = { + cardano: { + tvl, ownTokens, + }, +}; diff --git a/projects/treasury/zunami.js b/projects/treasury/zunami.js index fe860711528e..ed61bfd4fc15 100644 --- a/projects/treasury/zunami.js +++ b/projects/treasury/zunami.js @@ -15,7 +15,7 @@ module.exports = treasuryExports({ ADDRESSES.ethereum.CVX, ADDRESSES.ethereum.vlCVX, "0x73968b9a57c6E53d41345FD57a6E6ae27d6CDB2F", // SDT - "0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0" // FXS + ADDRESSES.ethereum.FXS // FXS ], owners: [treasury], ownTokens: [ZUN] diff --git a/projects/treehouse/index.js b/projects/treehouse/index.js new file mode 100644 index 000000000000..449f13ba0b60 --- /dev/null +++ b/projects/treehouse/index.js @@ -0,0 +1,60 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + + +async function getInFlightLidoRedemptionNav(api) { + const unStEth = '0x889edc2edab5f40e902b864ad4d7ade8e412f9b1'; + const strategy = '0x60d2D94aCB969CA54e781007eE89F04c1A2e5943'; + const navHelper = '0xf22Ca896427677507a9EF99D30B261659775ff56'; + + const requestIds = await api.call({ + abi: "function getWithdrawalRequests(address _owner) external view returns (uint256[] memory requestsIds)", + target: unStEth, + chain: 'ethereum', + params: [strategy] +}); + + +// NAV of lido in-flight redemptions in wstETH. +const nav = await api.call({ + abi: 'function getLidoRedemptionsNav(uint[], address) external view returns (uint)', + target: navHelper, + chain: 'ethereum', + params: [requestIds, strategy] +}) + +api.add(ADDRESSES.ethereum.WSTETH, nav) +} + + +async function tvl(api) { + const vault = '0x551d155760ae96050439ad24ae98a96c765d761b' + const tokens = await api.call({ abi: 'address[]:getAllowableAssets', target: vault }) + await api.sumTokens({ owner: vault, tokens }) + + await getInFlightLidoRedemptionNav(api) + + const storage = await api.call({ abi: 'address:strategyStorage', target: vault }) + const strategies = await api.fetchList({ lengthAbi: 'getStrategyCount', itemAbi: 'getStrategyAddress', target: storage }) + return sumTokens2({ + api, owners: strategies, fetchCoValentTokens: true, resolveUniV3: true, tokenConfig: { + onlyWhitelisted: false, + } + }) +} + +async function tvlMantle(api) { + return api.sumTokens({ owner: '0x5E4ACCa7a9989007cD74aE4ed1b096c000779DCC', tokens: ['0xE6829d9a7eE3040e1276Fa75293Bde931859e8fA'] }) +} + +module.exports = { + methodology: 'Token balance in vault and strategy contracts', + start: 1725926400, // Tuesday, September 10, 2024 12:00:00 AM, + hallmarks: [[1727218691, "TVL Cap Raise 1"],[1729045223, "TVL Cap Raise 2"]], + ethereum: { + tvl, + }, + mantle: { + tvl: tvlMantle + } +} \ No newline at end of file diff --git a/projects/treehousefinance/index.js b/projects/treehousefinance/index.js index 86ec1db83e5e..72790351cf08 100644 --- a/projects/treehousefinance/index.js +++ b/projects/treehousefinance/index.js @@ -8,5 +8,6 @@ module.exports = { methodology: "TVL includes all farms in MasterChef contract", hallmarks: [ [1647043200, "Rug Pull"] - ] + ], + deadFrom: '2022-03-12' } \ No newline at end of file diff --git a/projects/tron-btc/index.js b/projects/tron-btc/index.js new file mode 100644 index 000000000000..b1f938681e1e --- /dev/null +++ b/projects/tron-btc/index.js @@ -0,0 +1,69 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const sdk = require('@defillama/sdk'); +const { sumTokensExport } = require('../helper/sumTokens'); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +module.exports = { + methodology: "Collateral for BTC on tron chain", + bitcoin: { + tvl: sdk.util.sumChainTvls([ + sumTokensExport({ owners: bitcoinAddressBook.tronBTC }), + ]), + }, + ethereum: { + tvl: sumTokensExport({ + ownerTokens: [ + [[ADDRESSES.ethereum.WBTC], "0xbe6d2444a717767544a8b0ba77833aa6519d81cd",], //WBTC + [["0xc96de26018a54d51c097160568752c4e3bd6c364"], "0x38d516a43f9bab90455c16f9299866217062467e",],//FBTC +] + }), + }, + merlin: { + tvl: sumTokensExport({ + owners: ["0x06fe862f2eefe9a5e9a2cf9799941706665e833a"], + tokens: [ADDRESSES.merlin.WBTC_1, "0x93919784c523f39cacaa98ee0a9d96c3f32b593e"] // M-BTC AND UNIBTC + }), + }, + zklink: { + tvl: sumTokensExport({ + owners: ["0x3aa95613091a3a9512956c3a2a2b724dce375a2d"], + tokens: ["0xbeaf16cfd8efe0fc97c2a07e349b9411f5dc272c"] // SolvBTC.m + }), + }, + linea: { + tvl: sumTokensExport({ + owners: ["0x399c4e524cff47d9e670f9d1ca0381bbe746e97a", "0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: ["0xe4d584ae9b753e549cae66200a6475d2f00705f7", "0x5ffce65a40f6d3de5332766fff6a28bf491c868c", "0x96155858a02c410c3c814bb32fdc413b3241b62e"] // m-btc, SolvBTC.m , solvBTC.B + }), + }, + mode: { + tvl: sumTokensExport({ + owners: ["0x399c4e524cff47d9e670f9d1ca0381bbe746e97a", "0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: ["0x59889b7021243db5b1e065385f918316cd90d46c", ] // m-btc + }), + }, + core: { + tvl: sumTokensExport({ + owners: ["0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: ["0xe04d21d999faedf1e72ade6629e20a11a1ed14fa", ] // solvBTC.M + }), + }, + kroma: { + tvl: sumTokensExport({ + owners: ["0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: ["0x0f921c39efd98809fe6d20a88a4357454578987a", ] // m-BTC + }), + }, + kava: { + tvl: sumTokensExport({ + owners: ["0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: ["0x59889b7021243db5b1e065385f918316cd90d46c", ] // m-BTC + }), + }, + bsc: { + tvl: sumTokensExport({ + owners: ["0x533806b821ec94091228d7d34e697b93bb79f8f6"], + tokens: [ADDRESSES.bsc.BTCB, ] // BTCB + }), + }, +}; \ No newline at end of file diff --git a/projects/tropicalswap/index.js b/projects/tropicalswap/index.js index 04f8e986389d..317fad785082 100644 --- a/projects/tropicalswap/index.js +++ b/projects/tropicalswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens'); -module.exports = uniTvlExport('mantle', '0x5B54d3610ec3f7FB1d5B42Ccf4DF0fB4e136f249', { fetchBalances: true, }) +module.exports = uniTvlExport('mantle', '0x5B54d3610ec3f7FB1d5B42Ccf4DF0fB4e136f249') diff --git a/projects/tropykus/index.js b/projects/tropykus/index.js index f0bb4e9dbd77..10b7cf5e9663 100644 --- a/projects/tropykus/index.js +++ b/projects/tropykus/index.js @@ -1,5 +1,5 @@ -const { usdCompoundExports } = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound') module.exports = { - rsk: usdCompoundExports("0x962308fEf8edFaDD705384840e7701F8f39eD0c0", "rsk"), + rsk: compoundExports2({ comptroller: "0x962308fEf8edFaDD705384840e7701F8f39eD0c0", cether: '0x0aEaDb9d4C6a80462a47E87e76e487fa8b9A37d7', blacklistedTokens: ['0xd2ec53e8dd00d204d3d9313af5474eb9f5188ef6']}), } \ No newline at end of file diff --git a/projects/truemarkets/index.js b/projects/truemarkets/index.js new file mode 100644 index 000000000000..9d1d7047ee1b --- /dev/null +++ b/projects/truemarkets/index.js @@ -0,0 +1,17 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + base: { factory: '0x288025b60330e01d793B6e83c1a0dE22bb943459', fromBlock: 21180486 }, +} + +Object.keys(config).forEach(chain => { + const { factory, fromBlock } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event MarketCreatedWithDescription (address marketAddress, string marketQuestion, string marketSource, string additionalInfo, uint256 endOfTrading, uint256 yesNoTokenCap, address marketOwner)', fromBlock, }) + const markets = logs.map(log => log.marketAddress) + const tokens = await api.multiCall({ abi: 'address:paymentToken', calls: markets}) + return api.sumTokens({ tokensAndOwners2: [tokens, markets]}) + } + } +}) \ No newline at end of file diff --git a/projects/trufin-trustake/index.js b/projects/trufin-trustake/index.js index c9a9b38a220f..83693706c766 100644 --- a/projects/trufin-trustake/index.js +++ b/projects/trufin-trustake/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { function_view } = require('../helper/chain/aptos') +const { call: near_call } = require('../helper/chain/near') const TRUSTAKE_APT_CONTRACT_ADDR = "0x6f8ca77dd0a4c65362f475adb1c26ae921b1d75aa6b70e53d0e340efd7d8bc80" const MODULE = "staker" @@ -7,7 +8,7 @@ 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]) + api.add(ADDRESSES.aptos.APT, totalStaked) } const abi = { @@ -27,12 +28,22 @@ async function tvl(api) { api.add(MATIC_TOKEN_ADDR, (totalSupply * sharePrice) + +dust) } +const TRUSTAKE_NEAR_CONTRACT_ADDR = "staker1.msig1.trufin.near" + +async function nearTvl() { + const totalStaked = await near_call(TRUSTAKE_NEAR_CONTRACT_ADDR, 'get_total_staked', {}) + return { near: totalStaked[0] / 1e24 } +} + module.exports = { - methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, + methodology: `Counts the TVL of native tokens across all TruStake vaults.`, ethereum: { tvl }, aptos: { tvl: aptosTvl + }, + near: { + tvl: nearTvl } } diff --git a/projects/trufin/index.js b/projects/trufin/index.js index ab7a53a3abc2..c363ce56e154 100644 --- a/projects/trufin/index.js +++ b/projects/trufin/index.js @@ -13,7 +13,7 @@ async function tvl(api) { } module.exports = { - methodology: `Counts the TVL of MATIC tokens in TruFin's TruStake vault.`, + methodology: `Counts the TVL of MATIC tokens in TruFin's Legacy vaults.`, ethereum: { tvl } diff --git a/projects/tsunami-fi/index.js b/projects/tsunami-fi/index.js index e6eec999ca2e..98eac221aa57 100644 --- a/projects/tsunami-fi/index.js +++ b/projects/tsunami-fi/index.js @@ -2,7 +2,7 @@ const { gmxExports } = require("../helper/gmx"); const { function_view, hexToString } = require("../helper/chain/aptos"); async function tvl(api) { - const [data] = await function_view({ + const data = await function_view({ functionStr: "0x1786191d0ce793debfdef9890868abdcdc7053f982ccdd102a72732b3082f31d::basket::get_all_basket_coins_by_basket", type_arguments: [ @@ -13,7 +13,6 @@ async function tvl(api) { ({ coin_type_info: { account_address, module_name, struct_name }, reserve_amount, - margin_occupied_amount, }) => { const token = `${account_address}::${hexToString( module_name diff --git a/projects/typhoon.js b/projects/typhoon.js index e919f9fe1edb..6fb3199e55e6 100644 --- a/projects/typhoon.js +++ b/projects/typhoon.js @@ -1,21 +1,9 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const sdk = require('@defillama/sdk'); +const { sumTokensExport, nullAddress } = require('./helper/unwrapLPs'); const tornado = '0x9cDb933eDab885bB767658B9ED5C3800bc1d761B'; const reserve = '0xC9B4Dff1ce5384C7014579099e63EA0092e14eD5'; -const weth = ADDRESSES.ethereum.WETH; - -async function tvl(timestamp, block) { - return { [weth] : Number((await sdk.api.eth.getBalance({ - target: tornado, - block - })).output) + Number((await sdk.api.eth.getBalance({ - target: reserve, - block - })).output)}; -} module.exports = { - ethereum: { - tvl - } + ethereum: { + tvl: sumTokensExport({ tokens: [nullAddress], owners: [tornado, reserve], }) + } }; \ No newline at end of file diff --git a/projects/typus-finance/index.js b/projects/typus-finance/index.js index a0cad661225b..ba5f173d8072 100644 --- a/projects/typus-finance/index.js +++ b/projects/typus-finance/index.js @@ -6,13 +6,10 @@ const V1_SINGLE_DEPOSIT_VAULT_REGISTRY = "0x4ae62c4d67f9f5d7077626fcc6d450535c4d const V1_SINGLE_BID_VAULT_REGISTRY = "0x2c8cdd00ced47e717420cd2fc54990b3b38e115e34a9209271063a59ddeeb059"; async function tvl(api) { - const depositVaultFields = await sui.getDynamicFieldObjects({ + const depositVaults = await sui.getDynamicFieldObjects({ parent: SINGLE_DEPOSIT_VAULT_REGISTRY, }); - const depositVaultIds = depositVaultFields.map((item) => item.fields.id.id); - const depositVaults = await sui.getObjects(depositVaultIds); - depositVaults.forEach(({ fields }) => { const deposit_token = "0x" + fields.deposit_token.fields.name; const bid_token = "0x" + fields.bid_token.fields.name; diff --git a/projects/typus-safu/index.js b/projects/typus-safu/index.js new file mode 100644 index 000000000000..a6a15ac094d7 --- /dev/null +++ b/projects/typus-safu/index.js @@ -0,0 +1,23 @@ +const sui = require("../helper/chain/sui"); + +const SAFU_REGISTRY = "0xdc970d638d1489385e49ddb76889748011bac4616b95a51aa63633972b841706"; + +async function tvl(api) { + const fields = await sui.getDynamicFieldObjects({ + parent: SAFU_REGISTRY, + }); + const safuVaults = fields.filter((item) => item.type.includes("Vault")); + + safuVaults.forEach(({ fields }) => { + const deposit_token = "0x" + fields.deposit_token.fields.name; + api.add(deposit_token, fields.share_supply.slice(0, 4)); + }); +} + +module.exports = { + timetravel: false, + doublecounted: true, + sui: { + tvl, + }, +}; diff --git a/projects/ufarm-digital/index.js b/projects/ufarm-digital/index.js new file mode 100644 index 000000000000..be9f3a79ab70 --- /dev/null +++ b/projects/ufarm-digital/index.js @@ -0,0 +1,45 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { getConfig } = require('../helper/cache') + +const { getLogs2 } = require('../helper/cache/getLogs') +const { sumTokens2 } = require('../helper/unwrapLPs') +const config = { + arbitrum: { + fromBlock: 211275856, + ufarmCore: '0x46Df84E70deDB8a17eA859F1B07B00FB83b8a81F', + valueToken: ADDRESSES.arbitrum.USDT, + endpoint: 'https://api.ufarm.digital/api/v1/pool?limit=500', + blacklistedTokens: ['0xc36442b4a4522e871399cd717abdd847ab11fe88'], // uni v3 NFT + }, +} + +module.exports = { + methodology: 'Counts the AUM of all pools registered in the UFarm Protocol', +} + +Object.keys(config).forEach(chain => { + const { ufarmCore, valueToken, fromBlock, endpoint } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const { data } = await getConfig('ufarm-digital/' + api.chain, endpoint) + const ownerTokens = data.map(i => [i.assetAllocation.map(i => i.asset), i.poolAddress]) + return sumTokens2({ api, ownerTokens, resolveLP: true, resolveUniV3: true, owners: ownerTokens.map(i => i[1]) }) + + /* const logs = await getLogs2({ + api, + factory: ufarmCore, + eventAbi: 'event FundCreated(bytes32 indexed,uint256,address fund)', + fromBlock, + }) + const funds = logs.map(log => log.fund) + const pools = (await Promise.all(funds.map(fund => getLogs2({ + api, + factory: fund, + eventAbi: 'event PoolCreated(string,string,uint256,uint256,uint256,uint256,uint256,uint256,address pool,address)', + fromBlock, + })))).flat().map(i => i.pool) + const values = await api.multiCall({ abi: 'uint256:getTotalCost', calls: pools}) + api.addTokens(valueToken, values) */ + } + } +}) diff --git a/projects/ulysses/index.js b/projects/ulysses/index.js new file mode 100644 index 000000000000..9e9bf5b14d63 --- /dev/null +++ b/projects/ulysses/index.js @@ -0,0 +1,27 @@ +const { sumTokensExport } = require("../helper/unwrapLPs") +const ADDRESSES = require('../helper/coreAssets.json') + +const defaultPort = '0x0000151d008235A6cC00004F00FA2bDF9dF95400' +const ports = { + arbitrum: '0x79f4b04FFCa54BC946aa0ef8E33eE723467f0192', + ethereum: undefined, + optimism: undefined, + base: undefined, + polygon: undefined, + avax: undefined, + bsc: undefined, + // metis: undefined, +} + +Object.keys(ports).forEach(chain => module.exports[chain] = { tvl: sumTokensExport({ owner: ports[chain] ?? defaultPort, fetchCoValentTokens: true, }) }) + +const chainsWithCovalentSupport = { + metis: { tokens: Object.values(ADDRESSES.metis).concat([ + ADDRESSES.null, + ])} +} + +Object.keys(chainsWithCovalentSupport).forEach(chain => { + const { tokens, port =defaultPort } = chainsWithCovalentSupport[chain] + module.exports[chain] = { tvl: sumTokensExport({ owner: port, tokens }) +} }) \ No newline at end of file diff --git a/projects/umamifinance/abi.json b/projects/umamifinance/abi.json deleted file mode 100644 index dda88359cae8..000000000000 --- a/projects/umamifinance/abi.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "totalAssets": "uint256:totalAssets" -} \ No newline at end of file diff --git a/projects/umamifinance/index.js b/projects/umamifinance/index.js index 7efb67a8d7c9..4e1f1da2fe94 100644 --- a/projects/umamifinance/index.js +++ b/projects/umamifinance/index.js @@ -1,6 +1,5 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const abi = require("./abi.json"); +const { sumERC4626VaultsExport } = require("../helper/erc4626"); const UMAMI = "0x1622bf67e6e5747b81866fe0b85178a93c7f86e3"; // UMAMI staking for protocol revenue in WETH @@ -8,35 +7,37 @@ const mUMAMI = "0x2adabd6e8ce3e82f52d9998a7f64a90d294a92a4"; // UMAMI staking from when it was still ohm fork with rebasing mechanics. // There's still some staked tokens that are yet not unstaked and migrated. const OHM_STAKING_sUMAMI = "0xc9ecFeF2fac1E38b951B8C5f59294a8366Dfbd81"; -// glpUSDC vault is now deprecated -const glpUSDC = "0x2e2153fd13459eba1f277ab9acd624f045d676ce"; -const USDC = ADDRESSES.arbitrum.USDC; -const v2Vaults = [ +// glp vaults are now deprecated as well +const glpVaults = [ + "0x2e2153fd13459eba1f277ab9acd624f045d676ce", "0x727eD4eF04bB2a96Ec77e44C1a91dbB01B605e42", "0xbb84D79159D6bBE1DE148Dc82640CaA677e06126", "0x6a89FaF99587a12E6bB0351F2fA9006c6Cd12257", "0xe0A21a475f8DA0ee7FA5af8C1809D8AC5257607d", "0x37c0705A65948EA5e0Ae1aDd13552BCaD7711A23", +] + +const gmVaultsArbitrum = [ "0x959f3807f0Aa7921E18c78B00B2819ba91E52FeF", // gmUSDC "0x4bCA8D73561aaEee2D3a584b9F4665310de1dD69", // gmWETH "0x5f851F67D24419982EcD7b7765deFD64fBb50a97", // BTC gmUSDC "0xcd8011AaB161A75058eAb24e0965BAb0b918aF29", // gmWBTC ]; +const gmVaultsAvax = [ + "0x4f3274C3889e6cD54C9c739757Ab8EA4b246D76b", // WETH gmUSDC + "0xFCE0A462585A422Bac0ca443B102D0ac1Ff20f9e", // gmWETH +]; + module.exports = { doublecounted: true, start: 1657027865, // UMAMI deployment block ts arbitrum: { staking: stakings([mUMAMI, OHM_STAKING_sUMAMI], UMAMI), - tvl: async (api) => { - - const totalAssets = await api.call({ abi: abi.totalAssets, target: glpUSDC, }); - api.add(USDC, totalAssets); - - const assets = await api.multiCall({ abi: 'address:asset', calls: v2Vaults }); - const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: v2Vaults }); - api.add(assets, bals) - }, + tvl: sumERC4626VaultsExport({ vaults: glpVaults.concat(gmVaultsArbitrum), isOG4626: true }), }, -}; + avax: { + tvl: sumERC4626VaultsExport({ vaults:gmVaultsAvax, isOG4626: true }), + } +} diff --git a/projects/umoja/index.js b/projects/umoja/index.js new file mode 100644 index 000000000000..9d749591da38 --- /dev/null +++ b/projects/umoja/index.js @@ -0,0 +1,16 @@ +const Address = require("../helper/coreAssets.json"); +const Http = require("../helper/http"); +const token = Address.arbitrum.USDC_CIRCLE + +module.exports = { + timetravel: false, + misrepresentedTokens: true, + arbitrum: { + tvl: async function (api) { + const data = await Http.get("https://api.protocol.umoja.xyz/tokens/tvl/d-llama"); + + for (const entry of data) + if (entry.currency == "USDC") api.add(token, entry.tvl * 1e6) + } + } +}; \ No newline at end of file diff --git a/projects/unagii.js b/projects/unagii.js index 20408950cae9..5ace1a038ae4 100644 --- a/projects/unagii.js +++ b/projects/unagii.js @@ -1,9 +1,4 @@ -const sdk = require('@defillama/sdk') -const { getChainTransform } = require('./helper/portedTokens') -const chain = 'ethereum' - -async function tvl(_, block) { - const transform = await getChainTransform(chain) +async function tvl(api) { const vaults = [ '0x4aD0b81f92B16624BBcF46FC0030cFBBf8d02376', '0xBc5991cCd8cAcEba01edC44C2BB9832712c29cAB', @@ -20,38 +15,15 @@ async function tvl(_, block) { '0xDe07f45688cb6CfAaC398c1485860e186D55996D', ] - const { output: minters } = await sdk.api.abi.multiCall({ - abi: abi.minter, - calls: v2Vaults.map(i => ({ target: i })), - chain, block, - }) - - minters.forEach(({ output }) => vaults.push(output)) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abi.token, - calls: vaults.map(i => ({ target: i })), - chain, block, - }) - - const { output: totalAssets } = await sdk.api.abi.multiCall({ - abi: abi.totalAssets, - calls: vaults.map(i => ({ target: i })), - chain, block, - }) - const balances = {} - tokens.forEach(({ output }, i) => sdk.util.sumSingleBalance(balances, transform(output), totalAssets[i].output)) - return balances + const minters = await api.multiCall({ abi: "address:minter", calls: v2Vaults}) + vaults.push(...minters) + const tokens = await api.multiCall({ abi: 'address:token', calls: vaults}) + const bals = await api.multiCall({ abi: 'uint256:totalAssets', calls: vaults}) + api.add(tokens, bals) } module.exports = { ethereum: { tvl } -} - -const abi = { - minter: "address:minter", - token: "address:token", - totalAssets: "uint256:totalAssets", } \ No newline at end of file diff --git a/projects/unagiswap/index.js b/projects/unagiswap/index.js new file mode 100644 index 000000000000..3573de6dbe9f --- /dev/null +++ b/projects/unagiswap/index.js @@ -0,0 +1,38 @@ +const { getLogs } = require('../helper/cache/getLogs') +const ADDRESSES = require('../helper/coreAssets.json') + +const config = { + taiko: { dvmFactory: '0x6694eebf40924e04c952EA8F1626d19E7a656Bb7', fromBlock: 452910, dspFactory: '0xd0de7cA3298fff085E2cb82F8a861a0254256BA0', gspFactory: '0x2235bB894b7600F1a370fc595Ee5477999A30441', dppFactory: '0x297A4885a7da4AaeF340FABEd119e7a6E3f2BCe8' }, + } + +Object.keys(config).forEach(chain => { + const { dvmFactory, fromBlock, dspFactory, gspFactory, dppFactory, blacklistedTokens, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const ownerTokens = [] + const funcs = []; + const builder = (factorys, event) => { + if (Array.isArray(factorys)) { + factorys.forEach(factory => funcs.push(addLogs(factory, event))); + } else { + funcs.push(addLogs(factorys, event)); + } + } + builder(dvmFactory, 'event NewDVM (address baseToken, address quoteToken, address creator, address pool)'); + builder(dspFactory, 'event NewDSP(address baseToken, address quoteToken, address creator, address pool)'); + builder(gspFactory, 'event NewGSP(address baseToken, address quoteToken, address creator, address pool)'); + builder(dppFactory, 'event NewDPP (address baseToken, address quoteToken, address creator, address pool)'); + + await Promise.all(funcs) + + return api.sumTokens({ ownerTokens, blacklistedTokens, permitFailure: true, }) + + async function addLogs(target, eventAbi) { + if (!target) return; + const convert = i => [[i.baseToken, i.quoteToken], i.pool] + let logs = await getLogs({ api, target, eventAbi, onlyArgs: true, fromBlock, }); + ownerTokens.push(...logs.map(convert)) + } + } + } +}) \ No newline at end of file diff --git a/projects/unclesam.js b/projects/unclesam.js index 2be1b9b90fda..c6cbda488844 100644 --- a/projects/unclesam.js +++ b/projects/unclesam.js @@ -2,9 +2,7 @@ const { compoundExports } = require("./helper/compound"); const unitroller = "0x0cDD860ca594982443E737AC7A0B84f18C477E05"; module.exports = { - methodology: - "Same as Compound Finance", - base: { - ...compoundExports(unitroller, "base"), - }, + base: compoundExports(unitroller), + deadFrom: "2023-08-27" }; +module.exports.base.borrowed = () => ({}) // bad debt diff --git a/projects/unfederalreserve/index.js b/projects/unfederalreserve/index.js index baf5f92b33a4..4fce65cb1dbb 100644 --- a/projects/unfederalreserve/index.js +++ b/projects/unfederalreserve/index.js @@ -1,4 +1,6 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {fullCoumpoundExports} = require('../helper/compound') +const { compoundExports2 } = require('../helper/compound'); -module.exports=fullCoumpoundExports("0x3105D328c66d8d55092358cF595d54608178E9B5", "ethereum", "0xFaCecE87e14B50eafc85C44C01702F5f485CA460", ADDRESSES.ethereum.WETH) \ No newline at end of file +module.exports.deadFrom='2023-11-12' +module.exports.ethereum = compoundExports2({ comptroller: '0x3105D328c66d8d55092358cF595d54608178E9B5', cether: '0xFaCecE87e14B50eafc85C44C01702F5f485CA460' }) + +module.exports.ethereum.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/unibtc/index.js b/projects/unibtc/index.js new file mode 100644 index 000000000000..ad9c87b80b64 --- /dev/null +++ b/projects/unibtc/index.js @@ -0,0 +1,65 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const defaultVault = '0xF9775085d726E782E83585033B58606f7731AB18' +const extraVault = '0x84E5C854A7fF9F49c888d69DECa578D406C26800' + +const fbtc0 = '0xc96de26018a54d51c097160568752c4e3bd6c364' +const fbtc1 = '0xd681C5574b7F4E387B608ed9AF5F5Fc88662b37c' + +const config = { + ethereum: { + vault: '0x047D41F2544B7F63A8e991aF2068a363d210d6Da', + tokens: [ADDRESSES['ethereum'].WBTC, fbtc0, fbtc1] + }, + arbitrum: { + vault: extraVault, + tokens: [ADDRESSES['arbitrum'].WBTC] + }, + mode: { + vault: extraVault, + tokens: [ADDRESSES['mode'].WBTC] + }, + optimism: { + vault: defaultVault, + tokens: [ADDRESSES['optimism'].WBTC] + }, + mantle: { + vault: defaultVault, + tokens: [fbtc0, fbtc1] + }, + bob: { + vault: '0x2ac98DB41Cbd3172CB7B8FD8A8Ab3b91cFe45dCf', + tokens: [ADDRESSES['bob'].WBTC] + }, + zeta: { + vault: extraVault, + tokens: [ADDRESSES['zeta'].BTC] + }, + bsc: { + vault: extraVault, + tokens: [fbtc0, ADDRESSES['bsc'].BTCB] + }, + bsquared: { + vault: defaultVault, + tokens: [ADDRESSES.null,ADDRESSES['bsquared'].WBTC] + }, + merlin: { + vault: defaultVault, + tokens: [ADDRESSES.null,ADDRESSES['merlin'].WBTC,ADDRESSES['merlin'].WBTC_1] + }, + btr: { + vault: defaultVault, + tokens: [ADDRESSES.null, ADDRESSES['btr'].WBTC] + }, +} + +const tvl = (chainConfig) => { + return async (api) => { + return api.sumTokens({ tokens: chainConfig.tokens, owner: chainConfig.vault }) + } +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: tvl(config[chain]) + } +}) diff --git a/projects/uniswap-v1/index.js b/projects/uniswap-v1/index.js index 305756f2744e..2cabc673fe60 100644 --- a/projects/uniswap-v1/index.js +++ b/projects/uniswap-v1/index.js @@ -1,13 +1,23 @@ -const { getChainTvl } = require('../helper/getUniSubgraphTvl'); +const { nullAddress } = require('../helper/unwrapLPs') -const v1graph = getChainTvl({ - ethereum: 'ESnjgAG9NjfmHypk4Huu4PVvz55fUwpyrRqHF21thoLJ' -}, "uniswaps", "totalLiquidityUSD") +const uniFactory = '0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95' + +const abi = { + getExchange: "function getExchange(address token) view returns (address)", + getTokenWithId: "function getTokenWithId(uint256 token_id) view returns (address)", + tokenCount: "function tokenCount() view returns (uint256)", +} + +const tvl = async (api) => { + let pools = await api.fetchList({ lengthAbi: abi.tokenCount, itemAbi: abi.getTokenWithId, target: uniFactory, itemAbi2: abi.getExchange, }) + pools = pools.filter(i => i !== nullAddress) + await api.sumTokens({ owners: pools, tokens: [nullAddress] }) + const balancesV2 = api.getBalancesV2() + return balancesV2.clone(2).getBalances() // // Since Uniswap V1 only allowed swaps against ETH, it's enough to know the amount of ETH and multiply it by two to determine the pool's value without needing to know the price of the collateral in question +} module.exports = { misrepresentedTokens: true, - methodology: `Counts the tokens locked on AMM pools, pulling the data from the 'ianlapham/uniswapv2' subgraph`, - ethereum: { - tvl: v1graph("ethereum"), - } -} + methodology: `Counts the tokens in ETH value locked in AMM pools`, + ethereum: { tvl } +} \ No newline at end of file diff --git a/projects/uniswap/index.js b/projects/uniswap/index.js index 28d12b541b61..cc57513de302 100644 --- a/projects/uniswap/index.js +++ b/projects/uniswap/index.js @@ -86,7 +86,12 @@ module.exports = { avax: { factory: "0x740b1c1de25031C31FF4fC9A62f554A55cdC1baD", fromBlock: 27832972 }, taiko: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 961 }, sei: { factory: "0x75FC67473A91335B5b8F8821277262a13B38c9b3", fromBlock: 79245151 }, - mantle: { factory: "0x0d922Fb1Bc191F64970ac40376643808b4B74Df9", fromBlock: 63795918 } + mantle: { factory: "0x0d922Fb1Bc191F64970ac40376643808b4B74Df9", fromBlock: 63795918 }, + polygon_zkevm: { factory: "0xff83c3c800Fec21de45C5Ec30B69ddd5Ee60DFC2", fromBlock: 8466867 }, + xdai: { factory: "0xe32F7dD7e3f098D518ff19A22d5f028e076489B1", fromBlock: 27416614 }, + bob: { factory: "0xcb2436774C3e191c85056d248EF4260ce5f27A9D", fromBlock: 5188280 }, + lisk: { factory: "0x0d922Fb1Bc191F64970ac40376643808b4B74Df9", fromBlock: 577168 }, + wc: { factory: "0x7a5028BDa40e7B173C278C5342087826455ea25a", fromBlock: 1603366 }, }), filecoin: { tvl: filecoinTvl }, } @@ -106,4 +111,4 @@ module.exports.sei.tvl = async (api) => { 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 }) -} +} \ No newline at end of file diff --git a/projects/unore/index.js b/projects/unore/index.js index 09b5f13902ca..2e173218aacd 100644 --- a/projects/unore/index.js +++ b/projects/unore/index.js @@ -1,55 +1,66 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2, nullAddress, } = require('../helper/unwrapLPs') +const { sumTokens2, nullAddress } = require('../helper/unwrapLPs') -const ethSSIPEth = '0x29B4b8674D93b36Bf651d0b86A8e5bE3c378aCF4' -const kavaSSIPKava = '0x112a295B0fCd382E47E98E8271e45979EDf952b6' +const uno = '0x474021845c4643113458ea4414bdb7fb74a01a77' +const uno_rollux = '0x570baA32dB74279a50491E88D712C957F4C9E409' const config = { ethereum: { - uToken: '0x474021845c4643113458ea4414bdb7fb74a01a77', + uToken: uno, // UNO token for staking only tokensAndOwners: [ - [nullAddress, ethSSIPEth], - [ADDRESSES.ethereum.USDT, '0x442e9fe958202Dc29d7018c1AA47479F2159D8a0'], - [ADDRESSES.ethereum.USDC, '0xF37c0901662f39039AFBd3c2546e3141c091e014'], + [nullAddress, '0x929F524473D7B86acc0ADD87B1874Bdf63Cf0Ab1'], // ETH SSIP + [ADDRESSES.ethereum.USDT, '0x442e9fe958202Dc29d7018c1AA47479F2159D8a0'], // USDT SSIP + [ADDRESSES.ethereum.USDC, '0xF37c0901662f39039AFBd3c2546e3141c091e014'], // USDC SSIP ], pools: [ '0x076E2A501FD0DA41E5A659aB664b2B6792B80Fa2', // UNO SSRP '0x8978d08bd89B9415eB08A4D52C1bDDf070F19fA2', // UNO SSIP '0x442e9fe958202Dc29d7018c1AA47479F2159D8a0', // USDT SSIP - '0xF37c0901662f39039AFBd3c2546e3141c091e014' ,// USDC SSIP - ], + '0xF37c0901662f39039AFBd3c2546e3141c091e014', // USDC SSIP + '0x929F524473D7B86acc0ADD87B1874Bdf63Cf0Ab1' // ETH SSIP + ] }, bsc: { - uToken: '0x474021845C4643113458ea4414bdb7fB74A01A77', + uToken: uno, // UNO token for staking only tokensAndOwners: [ - [ADDRESSES.bsc.USDC, '0xEcE9f1A3e8bb72b94c4eE072D227b9c9ba4cd750'], - [ADDRESSES.bsc.USDC, '0x0b5C802ecA88161B5daed08e488C83d819a0cD02'], - [ADDRESSES.bsc.USDC, '0x2cd32dF1C436f8dE6e09d1A9851945c56bcEd32a'], - [ADDRESSES.bsc.USDC, '0xabb83630993984C54fd60650F5A592407C51e54b'], - [ADDRESSES.bsc.USDC, '0xeF21cB3eE91EcB498146c43D56C2Ef9Bae6B7d53'], + [ADDRESSES.bsc.USDC, '0xabb83630993984C54fd60650F5A592407C51e54b'], // Zeus V2 ], pools: [ - '0xabb83630993984C54fd60650F5A592407C51e54b', // Zeus V2 - '0xeF21cB3eE91EcB498146c43D56C2Ef9Bae6B7d53' // Ares V2 - ], + '0xabb83630993984C54fd60650F5A592407C51e54b', // Zeus V2 + '0xeF21cB3eE91EcB498146c43D56C2Ef9Bae6B7d53' // Ares V2 + ] }, - kava: { + rollux: { + uToken: uno_rollux, // UNO Rollux token for staking only tokensAndOwners: [ - [nullAddress, kavaSSIPKava], - [ADDRESSES.telos.ETH, '0x6cEC77829F474b56c327655f3281739De112B019'], + [ADDRESSES.optimism.WETH_1, '0x7393310FdC8ed40B35D2afD79848BC7166Ae0474'], // Plutus + ], + pools: [ + '0x8685C2b4D2024805a1FF6831Bc4cc8569457811D', // Athena + '0x7393310FdC8ed40B35D2afD79848BC7166Ae0474' // Plutus ] } } module.exports = { start: 1626100000, // Sep-20-2021 07:27:47 AM +UTC + kava: { tvl: async () => ({})}, }; Object.keys(config).forEach(chain => { - const { pools, uToken, tokensAndOwners, } = config[chain] + const { pools, uToken, tokensAndOwners } = config[chain] + + // TVL (Total Value Locked) - Excludes UNO token module.exports[chain] = { - tvl: async (api) => sumTokens2({api, tokensAndOwners}) + tvl: async (api) => sumTokens2({ api, tokensAndOwners }) + } + + // Staking - Includes only UNO token and its pools + if (uToken) { + module.exports[chain].staking = async (api) => sumTokens2({ + api, + tokens: [uToken], + owners: pools + }) } - if (uToken) - module.exports[chain].staking = async (api) => sumTokens2({api, tokens: [uToken], owners: pools}) -}) \ No newline at end of file +}) diff --git a/projects/usdfi-lending/index.js b/projects/usdfi-lending/index.js index 18a3724573f9..622c857d60d2 100644 --- a/projects/usdfi-lending/index.js +++ b/projects/usdfi-lending/index.js @@ -1,5 +1,5 @@ const { compoundExports } = require("../helper/compound"); module.exports = { - bsc: compoundExports('0x87363D74CD88A6220926Cf64bDEFd23ae63BE115', 'bsc',) + bsc: compoundExports('0x87363D74CD88A6220926Cf64bDEFd23ae63BE115') }; diff --git a/projects/usdx/index.js b/projects/usdx/index.js new file mode 100644 index 000000000000..c346cfb4f7c2 --- /dev/null +++ b/projects/usdx/index.js @@ -0,0 +1,11 @@ +const usdxAddress = "0xf3527ef8dE265eAa3716FB312c12847bFBA66Cef"; +const chains = ["ethereum", "bsc", "arbitrum"]; + +chains.forEach((chain) => { + module.exports[chain] = { + tvl: async (api) => { + const supply = await api.call({ abi: 'erc20:totalSupply', target: usdxAddress}) + api.addCGToken('usdx-money-usdx', supply/1e18) + }, + } +}) \ No newline at end of file diff --git a/projects/utonic/index.js b/projects/utonic/index.js new file mode 100644 index 000000000000..6a9cccd91f99 --- /dev/null +++ b/projects/utonic/index.js @@ -0,0 +1,11 @@ +const { call } = require("../helper/chain/ton"); + +module.exports = { + timetravel: false, + ton: { + tvl: async () => { + const result = await call({ target: "EQAfF5j3JMIpZlLmACv7Ub7RH7WmiVMuV4ivcgNYHvNnqHTz", abi: "get_minter_data"}) + return { "coingecko:the-open-network": result[0]/1e9 }; + } + } +} \ No newline at end of file diff --git a/projects/valuedefi.js b/projects/valuedefi.js index 71df0f560268..1a04ed920ad2 100644 --- a/projects/valuedefi.js +++ b/projects/valuedefi.js @@ -1,6 +1,5 @@ const { getUniTVL } = require('./helper/unknownTokens') -const { createIncrementArray } = require('./helper/utils') const sdk = require('@defillama/sdk') const { sumTokens2 } = require('./helper/unwrapLPs') const swapFactory = '0x1b8e12f839bd4e73a47addf76cf7f0097d74c14c' @@ -13,47 +12,13 @@ const abis = { getToken: "function getToken(uint8 index) view returns (address)", } -const bscDexTVL = getUniTVL({ - factory: swapFactory, - useDefaultCoreAssets: true, -}) +const bscDexTVL = getUniTVL({ factory: swapFactory, useDefaultCoreAssets: true, }) -async function bscStableSwapTvl(_, _b, { bsc: block }) { - const chain = 'bsc' - const { output: poolLength } = await sdk.api.abi.call({ - target: stableSwapFactory, - abi: abis.allPoolsLength, - chain, block, - }) - - const params = createIncrementArray(poolLength).map(i => ({ params: i })) - - const { output: pools } = await sdk.api.abi.multiCall({ - target: stableSwapFactory, - abi: abis.allPools, - calls: params, - chain, block, - }) - - const { output: tokenLength } = await sdk.api.abi.multiCall({ - abi: abis.getTokenLength, - calls: pools.map(i => ({ target: i.output })), - chain, block, - }) - - const tokenCalls = [] - tokenLength.forEach(i => { - createIncrementArray(i.output).forEach(j => tokenCalls.push({ target: i.input.target, params: j })) - }) - - const { output: tokens } = await sdk.api.abi.multiCall({ - abi: abis.getToken, - calls: tokenCalls, - chain, block, - }) - - const toa = tokens.map(i => ([i.output, i.input.target])) - return sumTokens2({ tokensAndOwners: toa, chain, block }) +async function bscStableSwapTvl(api) { + const pools = await api.fetchList({ lengthAbi: 'allPoolsLength', itemAbi: 'allPools', target: stableSwapFactory }) + const tokens = await api.fetchList({ lengthAbi: abis.getTokenLength, itemAbi: abis.getToken, targets: pools, groupedByInput: true }) + const ownerTokens = tokens.map((i, idx) => ([i, pools[idx]])) + return sumTokens2({ ownerTokens, api }) } module.exports = { diff --git a/projects/vaporwave.js b/projects/vaporwave.js index 4f801f600931..9909985a09a9 100644 --- a/projects/vaporwave.js +++ b/projects/vaporwave.js @@ -32,12 +32,13 @@ const chains = { module.exports = { timetravel: false, misrepresentedTokens: true, + // deadFrom: '2024-08-01', methodology: 'TVL data is pulled from the Vaporwave Finance API "https://api.vaporwave.farm/tvl".', doublecounted: true, ...Object.fromEntries(Object.entries(chains).map(chain => [chain[0], { - tvl: fetchChain(chain[1], false), - staking: fetchChain(chain[1], true), + tvl: () => ({}), + staking: () => ({}), }])) } diff --git a/projects/vaultWin/index.js b/projects/vaultWin/index.js new file mode 100644 index 000000000000..1012b42a5318 --- /dev/null +++ b/projects/vaultWin/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require("../helper/unwrapLPs") + +const abi = { + "poolInfo": "function poolInfo(address) view returns (address token, address lendToken, uint256 roundStart, uint256 roundEnd, uint256 version, address yieldSource)" +} + +async function tvl(api) { + const lotteries = await api.call({ target: '0xE8aa1245E18185698f2af53D3ab4aC0f822120F8', abi: "address[]:getLotteries" }) + const poolInfos = await api.multiCall({ target: '0xE8aa1245E18185698f2af53D3ab4aC0f822120F8', abi: abi.poolInfo, calls: lotteries }) + const ownerTokens = poolInfos.map((data, i) => [[data.token, data.lendToken], lotteries[i]]) + return sumTokens2({ api, ownerTokens }) +} + +module.exports = { + methodology: 'Staked tokens are counted as TVL', + ftn: { tvl }, +}; diff --git a/projects/vaultka/index.js b/projects/vaultka/index.js index b6eb22698c78..a85c0afb6dc0 100644 --- a/projects/vaultka/index.js +++ b/projects/vaultka/index.js @@ -1,6 +1,7 @@ //import utils const ADDRESSES = require("../helper/coreAssets.json"); const { staking } = require("../helper/staking"); +const { getProvider, getTokenBalance, sumTokens2 } = require("../helper/solana"); // 19/12/2023 ALP Leverage Vault // 29/11/2023 GMXV2 Leverage(Neutral) Vault // 12/11/2023 GLP Compound Vault @@ -21,6 +22,38 @@ module.exports = { [1707385004, "GLM(basket of GMs)"], ], + solana: { + tvl: async (api) => { + const lendingSol = "DMhoXyVNpCFeCEfEjEQfS6gzAEcPUUSXM8Xnd2UXJfiS"; + const jupSol = "jupSoLaHXQiZZTSfEWMTRRgpnyFm8f6sZdosWBjx93v"; + const jitoSol = "J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn"; + const jupSolProgram = "6j6Fwxf7UzfaXqQA2QraWGEAYUYzjjZP3t6ChzjzkmL9"; + const jitoSolProgram = "6MAnq2z4ww8nnvfd8sec4sRMhTEdsdZXB1FLgqaYsg4d"; + const jlpUsdtStrategy = "9vuDo8ZQsmMMe3qsiFCYoxsjhHieQVMNXLsfcfpC4SrX" + + + const lendingUsdc = "DefkwTSvkHeZASCuaVJ8AxUWS6zvBCwrLFpW2FniLSWo"; //change it to token account + const lendingUsdt = "HDNrMywo5z84uBLdbcdHpgVP3bao8bw2PDiUwtM4hvHk" + const usdc = ADDRESSES.solana.USDC; + const usdt = ADDRESSES.solana.USDT; + const jlp = "27G8MtK7VtTcCHkpASjSDdkWWYfoqT6ggEuKidVJidD4" + const strategyJlp = "5852AnvCSV2GDzgpRVG4ZQ5cNn7abR7pPty5FaBxHLzW" + + return sumTokens2({ + owner: lendingSol, + tokensAndOwners: [ + [jupSol, jupSolProgram], + [jitoSol, jitoSolProgram], + [jlp, strategyJlp], + [usdc, lendingUsdc], + [usdt, lendingUsdt], + [jlp, jlpUsdtStrategy], + ], + solOwners: [lendingSol], + }); + }, + }, + arbitrum: { tvl: async (api) => { const vaults = [ @@ -30,10 +63,12 @@ module.exports = { const bals = await api.multiCall({ abi: "int256:getVaultMarketValue", calls: vaults, + permitFailure: true }); - bals.forEach((i) => api.add(ADDRESSES.arbitrum.USDC, i)); + bals.filter((bal) => bal !== null).forEach((i) => api.add(ADDRESSES.arbitrum.USDC, i)); const addresses = { + wSol: "0x2bcC6D6CdBbDC0a4071e48bb3B969b06B3330c07", whiskey: "0x6532eFCC1d617e094957247d188Ae6d54093718A", whiskeyWater: "0xa100E02e861132C4703ae96D6868664f27Eaa431", sake: "0x45BeC5Bb0EE87181A7Aa20402C66A6dC4A923758", @@ -49,6 +84,7 @@ module.exports = { gmArb: "0xC25cEf6061Cf5dE5eb761b50E4743c1F5D7E5407", // arb/usdc.e gmBtc: "0x47c031236e19d024b42f8AE6780E44A573170703", // btc/usdc.e gmUsdc: "0x9C2433dFD71096C435Be9465220BB2B189375eA7", // usdc/usdc.e + gmSol: "0x09400D9DB990D5ed3f35D7be61DfAEB900Af03C9", gmLink: "0x7f1fa204bb700853D36994DA19F830b6Ad18455C", VLP: "0xc5b2d9fda8a82e8dcecd5e9e6e99b78a9188eb05", gDAI: "0xd85e038593d7a098614721eae955ec2022b9b91b", @@ -60,6 +96,7 @@ module.exports = { vodkaV2DN_ETH_Water: "0x8A98929750e6709Af765F976c6bddb5BfFE6C06c", vodkaV2DN_ARB_Water: "0x175995159ca4F833794C88f7873B3e7fB12Bb1b6", vodkaV2DN_BTC_Water: "0x4e9e41Bbf099fE0ef960017861d181a9aF6DDa07", + vokdaV2DN_SOL_Water: "0xdCAF7F0Cd114c96B58B70fAC98F3218312E6C28b", vodkaV1A: "0x0E8A12e59C2c528333e84a12b0fA4B817A35909A", agedVodkaV2_ETH: "0xE502474DfC23Cd11C28c379819Ea97A69aF7E10F", agedVodkaV2_BTC: "0x83C8A6B6867A3706a99573d39dc65a6805D26770", @@ -86,10 +123,12 @@ module.exports = { [addresses.gmArb, addresses.vodkaV2], [addresses.gmWeth, addresses.vodkaV2], [addresses.gmBtc, addresses.vodkaV2], + [addresses.gmSol, addresses.vodkaV2], [addresses.gmArb, addresses.vodkaV2DN], [addresses.gmWeth, addresses.vodkaV2DN], [addresses.gmBtc, addresses.vodkaV2DN], [addresses.gmUsdc, addresses.vodkaV2DN], + [addresses.gmSol, addresses.vodkaV2DN], [addresses.hlp, addresses.rum], [ADDRESSES.arbitrum.fsGLP, addresses.agedVodka], //new water vault @@ -97,6 +136,7 @@ module.exports = { [ADDRESSES.arbitrum.ARB, addresses.vodkaV2DN_ARB_Water], [ADDRESSES.arbitrum.WBTC, addresses.vodkaV2DN_BTC_Water], [ADDRESSES.arbitrum.fsGLP, addresses.vodkaV1A], + [addresses.wSol, addresses.vokdaV2DN_SOL_Water], //GmVault [addresses.gmWeth, addresses.agedVodkaV2_ETH], [addresses.gmBtc, addresses.agedVodkaV2_BTC], @@ -109,7 +149,7 @@ module.exports = { }); const contractAbis = { - stakedVlpBalance: "function getStakedVlpBalance() public view returns (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)", // diff --git a/projects/vee-finance/index.js b/projects/vee-finance/index.js index c145a9c61055..cc7de2d88eae 100644 --- a/projects/vee-finance/index.js +++ b/projects/vee-finance/index.js @@ -1,23 +1,35 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const {getCompoundV2Tvl, methodology} = require('../helper/compound') -const sdk = require('@defillama/sdk') +const sdk = require("@defillama/sdk"); +const { compoundExports2, methodology } = require('../helper/compound') -module.exports={ +module.exports = { methodology, - avax:{ - tvl: sdk.util.sumChainTvls([ - //V1&V2 on Avalanche - getCompoundV2Tvl("0xA67DFeD73025b0d61F2515c531dd8D25D4Cfd0Db", "avax", addr=>`avax:${addr}`), - getCompoundV2Tvl("0x43AAd7d8Bc661dfA70120865239529ED92Faa054", "avax", addr=>`avax:${addr}`, "0x6481490DBb6Bd0e8b7CB7E1317470f6d08aDa5A2", ADDRESSES.avax.WAVAX), - getCompoundV2Tvl("0xAF7f6F7a1295dEDF52a01F5c3f04Ad1b502CdA6a", "avax", addr=>`avax:${addr}`), - getCompoundV2Tvl("0xeEf69Cab52480D2BD2D4A3f3E8F5CcfF2923f6eF", "avax", addr=>`avax:${addr}`, "0x125605c515e3f75CAd62d3613c97A76F13d73A64", ADDRESSES.avax.WAVAX), - ]) +} + +const pools = { + avax: { + pools: [ + ['0xA67DFeD73025b0d61F2515c531dd8D25D4Cfd0Db'], + ['0xAF7f6F7a1295dEDF52a01F5c3f04Ad1b502CdA6a'], + ['0x43AAd7d8Bc661dfA70120865239529ED92Faa054', '0x6481490DBb6Bd0e8b7CB7E1317470f6d08aDa5A2'], + ['0xeEf69Cab52480D2BD2D4A3f3E8F5CcfF2923f6eF', '0x125605c515e3f75CAd62d3613c97A76F13d73A64'], + ], }, heco: { - tvl: sdk.util.sumChainTvls([ - //V1 on Heco - getCompoundV2Tvl("0x484C6e804cD4Cc27fCFbCf06748d6b4BCA47db84", "heco", addr=>`heco:${addr}`), - getCompoundV2Tvl("0x2a144ACaef8fb9258e4f2c2018945a76fE7342E2", "heco", addr=>`heco:${addr}`, "0x0F75aBfef98dAaa7A8170ddA97c8100a65ABA3cC", ADDRESSES.heco.WHT), - ]) - } + pools: [ + ['0x484C6e804cD4Cc27fCFbCf06748d6b4BCA47db84'], + ['0x2a144ACaef8fb9258e4f2c2018945a76fE7342E2', '0x0F75aBfef98dAaa7A8170ddA97c8100a65ABA3cC'], + ], + }, } + +function getTvl(chain) { + const config = pools[chain] ?? { pools: [] }; + const tvls = config.pools.map(([comptroller, cether]) => compoundExports2({ comptroller, cether })); + let tvl = sdk.util.sumChainTvls(tvls.map((t) => t.tvl)) + let borrowed = sdk.util.sumChainTvls(tvls.map((t) => t.borrowed)) + return { tvl, borrowed } +} + +Object.keys(pools).forEach(chain => module.exports[chain] = getTvl(chain)) + +module.exports.avax.borrowed = () => ({}) \ No newline at end of file diff --git a/projects/vela-exchange/index.js b/projects/vela-exchange/index.js index f1ae88d8b58c..4e70f94995a1 100644 --- a/projects/vela-exchange/index.js +++ b/projects/vela-exchange/index.js @@ -39,6 +39,7 @@ module.exports = { hallmarks: [ [Math.floor(new Date('2023-04-13') / 1e3), 'Refunded tokens to VLP holders & traders'], [1693926000, 'Launched on Base Chain'], - [1721314800, 'Implemented Aave VLP supply integration'] + [1721314800, 'Implemented Aave VLP supply integration'], + [1726596000, 'Burned 65m Vela tokens'] ], } diff --git a/projects/velhalla.js b/projects/velhalla.js index 7c4ceb9579b7..be54a03c1f3f 100644 --- a/projects/velhalla.js +++ b/projects/velhalla.js @@ -1,24 +1,8 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const sdk = require("@defillama/sdk"); -const owner = "0x7DeD7f9D3dF541190F666FB6897483e46D54e948"; -const target = ADDRESSES.velas.SCAR; - -async function staking(timestamp, block, chainBlocks) { - return { - [`bsc:${target}`]: ( - await sdk.api.erc20.balanceOf({ - target, - owner, - block: chainBlocks.velas, - chain: "velas", - }) - ).output, - }; -} +const { staking } = require('./helper/staking') module.exports = { velas: { tvl: () => ({}), - staking, + staking: staking('0x7DeD7f9D3dF541190F666FB6897483e46D54e948', '0x8d9fb713587174ee97e91866050c383b5cee6209'), }, -}; \ No newline at end of file +} \ No newline at end of file diff --git a/projects/velo/index.js b/projects/velo/index.js new file mode 100644 index 000000000000..172b47fed802 --- /dev/null +++ b/projects/velo/index.js @@ -0,0 +1,44 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +const AprFixLockedAddresses = [ + "0x5e10B2247a430f97c94205894B9185F687A32345", + "0x13c5C83cf9B9aC68FA18272B756Bce1635196132", + "0x022af5ce19720a938Ba8C9E66FdF1Da1606298eF", + "0x37cCcC19acAB91E8bC6074Cb4EaaFef1185ee1Bb", + "0x051bB49EdB865Bb4cC9277BbB132C922403B07e4", + "0x2703E5D3709782e85957E40a9c834AFD4D45caF9", + "0x5935DC3250a0d8a0aC7c2e4AB925C4FEf2F8FDf8", + "0x59098E3c6C5Bcbecb4117C6eF59b341d1F0F3083", + "0xDa000FA80C5E9cb4E24a66bFF6a56cC454422e78", + "0xEfA6EAbcb5fa35827DDB236046B3DDB6d257022B", + "0xc12A93bf62CfD50620BCfDDD903913903DF647B4", + "0xc322a2110958c1365e88D88aef65Ebdf335b6E67" +]; + +const AprFixLockWithChangeableRatioTvl = [ + "0xEF03B465A6D7baDF8727819104d29F0405d1Ce65" +] + +const OldFarmContractAddress = "0x33472144Eaa7540E7badA5a1ab7Da372e48a9252" +const CurrentFarmContractAddress = "0xDD3e2da1d017A564b8225bc8e92f2970cfa61945" + +const VELO = '0xf486ad071f3bee968384d2e39e2d8af0fcf6fd46' + +async function staking(api) { + const totalStaked = await api.multiCall({ abi: 'uint256:totalStaked', calls: AprFixLockedAddresses.concat(AprFixLockWithChangeableRatioTvl) }) + api.add(VELO, totalStaked) + const tokens = [ + "0x3c8EC1728C080f76dc83baA5d51A0cC367B4A35F", // VELO_DEPRECATED_TOKEN + "0xf486ad071f3bee968384d2e39e2d8af0fcf6fd46", // VELO_TOKEN + "0xC2d4A3709e076A7A3487816362994a78ddaeabB6", // EVRY_TOKEN + ] + return api.sumTokens({ owners: [OldFarmContractAddress, CurrentFarmContractAddress], tokens }) +} + +module.exports = { + methodology: 'Sums the total value locked of all farms and locked pools in Velo Finance.', + bsc: { + tvl: getUniTVL({ factory: '0xa328180188a30feF1d82c9FC916E627DB6E17238', blacklistedTokens: [VELO] }), + staking, + }, +}; diff --git a/projects/velocimeter-v4/index.js b/projects/velocimeter-v4/index.js new file mode 100644 index 000000000000..abdf1edba177 --- /dev/null +++ b/projects/velocimeter-v4/index.js @@ -0,0 +1,12 @@ +const { getUniTVL } = require('../helper/unknownTokens') + +module.exports = { + misrepresentedTokens: true, + iotaevm: { + tvl: getUniTVL({ + factory: '0x10A288eF87586BE54ea690998cAC82F7Cc90BC50', + useDefaultCoreAssets: true, + hasStablePools: true, + }) + }, +} diff --git a/projects/velvet-capital-v3/index.js b/projects/velvet-capital-v3/index.js new file mode 100644 index 000000000000..4e748c20821a --- /dev/null +++ b/projects/velvet-capital-v3/index.js @@ -0,0 +1,30 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { sumTokens2 } = require('../helper/unwrapLPs') + +const config = { + base: { address: '0xf93659fb357899e092813bc3a2959ceDb3282a7f', blacklistedTokens: [ADDRESSES.bsc.USDT, "0x96af5739ca66ca55ab71ac9f308720d5044995ee","0xca4f1536cd29d42bcbc8211f1b621ba9e817433f"]}, + bsc: { address: '0xA1fe1C37Bf899C7F7521082C002dFA4fEbAaA8dd', blacklistedTokens: [ADDRESSES.optimism.WETH_1] } +} + +const abi = { + getTokens: 'address[]:getTokens', + vault: 'address:vault' +} + +async function tvl(api, address, blacklistedTokens) { + const indexes = await api.fetchList({ lengthAbi: 'uint256:portfolioId', itemAbi: 'function getPortfolioList(uint256) view returns (address)', target: address }) + const [tokens, vaults] = await Promise.all([ + api.multiCall({ abi: abi.getTokens, calls: indexes }), + api.multiCall({ abi: abi.vault, calls: indexes }), + ]) + + const ownerTokens = vaults.map((vault, i) => ([tokens[i], vault])) + return sumTokens2({ api, ownerTokens, resolveLP: true, blacklistedTokens}); +} + +module.exports = { methodology: 'calculates overall value deposited across different protocol portfolios' } + +Object.keys(config).forEach(chain => { + const { address, blacklistedTokens } = config[chain] + module.exports[chain] = { tvl: (api) => tvl(api, address, blacklistedTokens) } +}) diff --git a/projects/vendor-finance/index.js b/projects/vendor-finance/index.js index f33e6c54eb08..6a649225e6dd 100644 --- a/projects/vendor-finance/index.js +++ b/projects/vendor-finance/index.js @@ -14,7 +14,7 @@ async function tvl(api) { const balances = {}; const tokensAndOwners = [] - for (const { args: { _poolAddress, _colToken, _lendToken, _expiry }} of logs) { + for (const { args: { _poolAddress, _colToken, _lendToken, _expiry } } of logs) { if (_expiry < api.timestamp) continue; tokensAndOwners.push([_colToken, _poolAddress]) tokensAndOwners.push([_lendToken, _poolAddress]) @@ -31,6 +31,7 @@ const config = { module.exports = { methodology: 'The sum of the balance of all listed collateral and lend tokens in all deployed pools.', start: 20274088, + deadFrom: '2024-08-30' }; Object.keys(config).forEach(chain => { diff --git a/projects/venofinance/index.js b/projects/venofinance/index.js index bc87e4f18184..16765dd6a71e 100644 --- a/projects/venofinance/index.js +++ b/projects/venofinance/index.js @@ -3,6 +3,12 @@ const { staking } = require("../helper/staking.js"); const fountain_contract_address = "0xb4be51216f4926ab09ddf4e64bc20f499fd6ca95"; const reservoir_contract_address = "0x21179329c1dcfd36ffe0862cca2c7e85538cca07"; const vno_contract_address = "0xdb7d0a1ec37de1de924f8e8adac6ed338d4404e9"; +const zkCRO_contract_address = "0x28Ff2E4dD1B58efEB0fC138602A28D5aE81e44e2"; +const ybETH_contract_address = "0x76bf2D1e6dFda645c0c17440B17Eccc181dfC351"; +const ybUSD_contract_address = "0xFA59075DfCE274E028b58BdDFcC3D709960F594a"; +const vETH_contract_address = "0x271602A97027ee1dd03b1E6e5dB153eB659A80b1"; +const vUSD_contract_address = "0x5b91e29Ae5A71d9052620Acb813d5aC25eC7a4A2"; + async function tvlCronos(api) { const lcro_contract_address = "0x9Fae23A2700FEeCd5b93e43fDBc03c76AA7C08A6"; @@ -24,6 +30,26 @@ async function tvlEra(api) { return api.getBalances() } +async function tvlEthereum(api) { + const cro_pooled = await api.call({ abi: "uint256:totalPooledCro", target: zkCRO_contract_address }); + api.addCGToken('crypto-com-chain', cro_pooled / 1e8); + const eth_pooled = await api.call({ abi: "uint256:totalPooledEth", target: ybETH_contract_address }); + api.addCGToken('ethereum', eth_pooled / 1e18); + const usd_pooled = await api.call({ abi: "uint256:totalUsdValue", target: ybUSD_contract_address }); + api.addCGToken('dai', usd_pooled / 1e18); + + return api.getBalances(); +} + +async function tvlCronosZkEVM(api) { + const totalVEth = await api.call({ abi: "uint256:ybEthValue", target: vETH_contract_address }); + api.addCGToken('ethereum', totalVEth / 1e18); + const totalVUsd = await api.call({ abi: "uint256:ybUsdValue", target: vUSD_contract_address }); + api.addCGToken('dai', totalVUsd / 1e18); + + return api.getBalances(); +} + module.exports = { methodology: "TVL counts tokens staked by the protocol.", cronos: { @@ -36,4 +62,10 @@ module.exports = { era: { tvl: tvlEra, }, + ethereum: { + tvl: tvlEthereum, + }, + cronos_zkevm: { + tvl: tvlCronosZkEVM, + }, }; diff --git a/projects/venus-isolated-pools/index.js b/projects/venus-isolated-pools/index.js index d4585e82f706..db1229667db6 100644 --- a/projects/venus-isolated-pools/index.js +++ b/projects/venus-isolated-pools/index.js @@ -30,13 +30,13 @@ async function getPools(api) { async function tvl(...args) { const [api] = args const pools = await getPools(api) - const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + const tvls = pools.map(i => compoundExports2({ comptroller: i})) return sdk.util.sumChainTvls(tvls.map(i => i.tvl))(...args) } async function borrowed(...args) { const [api] = args const pools = await getPools(api) - const tvls = pools.map(i => compoundExports2({ comptroller: i, fetchBalances: true, })) + const tvls = pools.map(i => compoundExports2({ comptroller: i})) return sdk.util.sumChainTvls(tvls.map(i => i.borrowed))(...args) } diff --git a/projects/venus.js b/projects/venus.js index 6f552d30a8cf..e06a2ad29700 100644 --- a/projects/venus.js +++ b/projects/venus.js @@ -1,15 +1,7 @@ -const ADDRESSES = require('./helper/coreAssets.json') -const {fullCoumpoundExports, compoundExports2} = require('./helper/compound'); - -const replace = { - [ADDRESSES.bsc.BETH]: ADDRESSES.ethereum.WETH, // beth->weth - "0xfb6115445bff7b52feb98650c87f44907e58f802": ADDRESSES.ethereum.AAVE, // aave -} - -module.exports = fullCoumpoundExports("0xfd36e2c2a6789db23113685031d7f16329158384", "bsc", "0xA07c5b74C9B40447a954e1466938b865b6BBea36", ADDRESSES.bsc.WBNB, addr=>{ - return replace[addr.toLowerCase()] || `bsc:${addr}` -}) +const { compoundExports2} = require('./helper/compound'); +module.exports.bsc = compoundExports2({ comptroller: '0xfd36e2c2a6789db23113685031d7f16329158384', cether: '0xA07c5b74C9B40447a954e1466938b865b6BBea36'}) module.exports.ethereum = compoundExports2({ comptroller: '0x67aA3eCc5831a65A5Ba7be76BED3B5dc7DB60796'}) module.exports.op_bnb = compoundExports2({ comptroller: '0xd6e3e2a1d8d95cae355d15b3b9f8e5c2511874dd'}) -module.exports.arbitrum = compoundExports2({ comptroller: '0x317c1A5739F39046E20b08ac9BeEa3f10fD43326'}) \ No newline at end of file +module.exports.arbitrum = compoundExports2({ comptroller: '0x317c1A5739F39046E20b08ac9BeEa3f10fD43326'}) +module.exports.era = compoundExports2({ comptroller: '0xddE4D098D9995B659724ae6d5E3FB9681Ac941B1'}) \ No newline at end of file diff --git a/projects/vertex/index.js b/projects/vertex/index.js index e82cca2d13ca..34acb291b6b3 100644 --- a/projects/vertex/index.js +++ b/projects/vertex/index.js @@ -21,6 +21,16 @@ const mantleConfig = { "perpEngine": "0x38080ee5fb939d045A9e533dF355e85Ff4f7e13D" } +const seiConfig = { + "querier": "0xecc3dE1cD86CB07c3763D21A45041791574964C2", + //"feeCalculator": "", + "clearinghouse": "0xaE1510367aA8d500bdF507E251147Ea50B22307F", + "clearinghouseLiq": "0xa1a457b7bba489c3434D9Cb44b88101354CCF192", + "endpoint": "0x2777268EeE0d224F99013Bc4af24ec756007f1a6", + "spotEngine": "0x3E113cde3D6309e9bd45Bf7E273ecBB8b50ca127", + "perpEngine": "0x0F54f46979C62aB73D03Da60eBE044c8D63F724f" +} + module.exports = { arbitrum: { @@ -34,5 +44,11 @@ module.exports = { owners: [mantleConfig.clearinghouse, mantleConfig.endpoint], tokens: ["0xcDA86A272531e8640cD7F1a92c01839911B90bb0", ADDRESSES.mantle.USDC, ADDRESSES.mantle.WETH, ADDRESSES.mantle.WMNT], }) + }, + sei: { + tvl: sumTokensExport({ + owners: [seiConfig.clearinghouse, seiConfig.endpoint], + tokens: [ADDRESSES.sei.USDC, ADDRESSES.sei.USDT], + }) } } \ No newline at end of file diff --git a/projects/vesper/index.js b/projects/vesper/index.js index dae3a61ab053..bb1fd9204710 100644 --- a/projects/vesper/index.js +++ b/projects/vesper/index.js @@ -1,70 +1,52 @@ -const sdk = require("@defillama/sdk") -const abi = require('./abi.json') -const { getChainTransform } = require('../helper/portedTokens') const { getConfig } = require("../helper/cache") +const { sumTokensExport } = require("../helper/unwrapLPs") const chainConfig = { ethereum: { stakingPool: '0xbA4cFE5741b357FA371b506e5db0774aBFeCf8Fc', VSP: '0x1b40183efb4dd766f11bda7a7c3ad8982e998421', - api: ['https://api.vesper.finance/pools?stages=prod', 'https://api.vesper.finance/pools?stages=orbit'], + endpoints: ['https://api.vesper.finance/pools?stages=prod', 'https://api.vesper.finance/pools?stages=orbit'], }, avax: { - api: ['https://api-avalanche.vesper.finance/pools?stages=prod'], + endpoints: ['https://api-avalanche.vesper.finance/pools?stages=prod'], }, polygon: { - api: ['https://api-polygon.vesper.finance/pools?stages=prod'], + endpoints: ['https://api-polygon.vesper.finance/pools?stages=prod'], }, optimism: { - api: ['https://api-optimism.vesper.finance/pools'] + endpoints: ['https://api-optimism.vesper.finance/pools'] + }, + base: { + endpoints: ['https://api-base.vesper.finance/pools'] }, } function getChainExports(chain) { - const { stakingPool, VSP, api } = chainConfig[chain] || {} - - async function tvl(timestamp, _block, chainBlocks) { - const block = chainBlocks[chain] - const transformAddress = await getChainTransform(chain) - const balances = {} - let network = chain === 'ethereum' ? 'mainnet' : chain - if (network === 'avax') network = 'avalanche' + const { stakingPool, VSP, endpoints } = chainConfig[chain] || {} + async function tvl(api) { const poolSet = new Set() - for (let i = 0;i< api.length;i++) { + for (let i = 0; i < endpoints.length; i++) { const key = ['vesper', chain, i].join('/') - const data = await getConfig(key, api[i]) + const data = await getConfig(key, endpoints[i]) data.forEach(pool => poolSet.add(pool.address)) // add pools from our contracts list } - if (stakingPool) poolSet.delete(stakingPool) + if (stakingPool) poolSet.delete(stakingPool) const poolList = [...poolSet] - if (!poolList.length) return balances + if (!poolList.length) return; // Get collateral token - const calls = poolList.map(target => ({ target })) - const { output: tokens } = await sdk.api.abi.multiCall({ calls, abi: abi.token, chain, block, }) - const { output: totalValue } = await sdk.api.abi.multiCall({ calls, abi: abi.totalValue, chain, block, }) - tokens.forEach((token, index) => sdk.util.sumSingleBalance(balances, transformAddress(token.output), totalValue[index].output)) - return balances + const tokens = await api.multiCall({ abi: 'address:token', calls: poolList }) + const bals = await api.multiCall({ abi: 'uint256:totalValue', calls: poolList }) + api.add(tokens, bals) } let staking - if (stakingPool) - staking = async (timestamp, _block, chainBlocks) => { - const block = chainBlocks[chain] - const transformAddress = await getChainTransform(chain) - const balances = {} - const vspBalance = (await sdk.api.erc20.balanceOf({ - block, chain, - target: VSP, - owner: stakingPool - })).output; - sdk.util.sumSingleBalance(balances, transformAddress(VSP), vspBalance) - return balances - } + if (stakingPool && VSP) + staking = sumTokensExport({ owner: stakingPool, token: VSP }) return { [chain]: { tvl, staking } @@ -73,5 +55,5 @@ function getChainExports(chain) { module.exports = { start: 1608667205, // December 22 2020 at 8:00 PM UTC - ...['ethereum', 'avax', 'polygon','optimism'].reduce((acc, chain) => ({ ...acc, ...getChainExports(chain) }), {}) + ...['ethereum', 'avax', 'polygon', 'optimism', 'base'].reduce((acc, chain) => ({ ...acc, ...getChainExports(chain) }), {}) }; diff --git a/projects/vesq/index.js b/projects/vesq/index.js index 01cf8e6b395a..78916b6cd3ff 100644 --- a/projects/vesq/index.js +++ b/projects/vesq/index.js @@ -8,7 +8,7 @@ const treasuryTokens = [ [ADDRESSES.polygon.DAI, false], //DAI ["0x2e1ad108ff1d8c782fcbbb89aad783ac49586756", false], //TUSD ["0xa3fa99a148fa48d14ed51d610c367c61876997f1", false], //MAI - ["0x45c32fa6df82ead1e2ef74d17b76547eddfaff89", false], //FRAX + [ADDRESSES.polygon.FRAX, false], //FRAX ["0x692597b009d13c4049a947cab2239b7d6517875f", false], //UST ["0x27f8d03b3a2196956ed754badc28d73be8830a6e", false], //amDAI ["0xd8cA34fd379d9ca3C6Ee3b3905678320F5b45195", false], //gOHM diff --git a/projects/vest/index.js b/projects/vest/index.js index 6a9e98895b2a..7187a502c5fa 100644 --- a/projects/vest/index.js +++ b/projects/vest/index.js @@ -5,6 +5,39 @@ module.exports = { methodology: "Total USDC locked in the Vest Exchange.", start: 1710709200, era: { - tvl: staking('0xf7483A1464DeF6b8d5A6Caca4A8ce7E5be8F1F68', ADDRESSES.era.USDC), + tvl: staking([ + "0xf7483A1464DeF6b8d5A6Caca4A8ce7E5be8F1F68", + "0x7ccF5BbeC69c790D27dA3b5398B9e0d6D6EeC9F3", + ], ADDRESSES.era.USDC), + }, + base: { + tvl: staking( + "0xE80F92077131b9890599E418AE323de71cE1C35a", + ADDRESSES.base.USDC + ), + }, + optimism: { + tvl: staking( + "0xE80F92077131b9890599E418AE323de71cE1C35a", + ADDRESSES.optimism.USDC_CIRCLE + ), + }, + ethereum: { + tvl: staking( + "0xE80F92077131b9890599E418AE323de71cE1C35a", + ADDRESSES.ethereum.USDC + ), + }, + polygon: { + tvl: staking( + "0xE80F92077131b9890599E418AE323de71cE1C35a", + ADDRESSES.polygon.USDC_CIRCLE + ), + }, + arbitrum: { + tvl: staking( + "0x80C526d1c2fddADB3Cd39810cd7A79E07b0EDa00", + ADDRESSES.arbitrum.USDC_CIRCLE + ), }, } \ No newline at end of file diff --git a/projects/vesu/index.js b/projects/vesu/index.js index 2e85366489a4..665a01f14ff8 100644 --- a/projects/vesu/index.js +++ b/projects/vesu/index.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('../helper/coreAssets.json') const { multiCall, sumTokens } = require("../helper/chain/starknet"); const { abi, allAbi } = require("./abi"); @@ -5,12 +6,12 @@ const INTERNAL_SCALE = 10 ** 18; const SINGLETON = "0x02545b2e5d519fc230e9cd781046d3a64e092114f07e44771e0d719d148725ef"; const POOL_ID = "0x4dc4f0ca6ea4961e4c8373265bfd5317678f4fe374d76f3fd7135f57763bf28"; const ASSETS = [ - "0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7", - "0x03fe2b97c1fd336e750087d68b9b867997fd64a2661ff3ca5a7c771641e8e7ac", - "0x053c91253bc9682c04929ca02ed00b3e423f6710d2ee7e0d5ebb06f3ecf368a8", - "0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8", - "0x042b8f0484674ca266ac5d08e4ac6a3fe65bd3129795def2dca5c34ecc5f96d2", - "0x04718f5a0fc34cc1af16a1cdee98ffb20c31f5cd61d6ab07201858f4287c938d", + ADDRESSES.starknet.ETH, + ADDRESSES.starknet.WBTC, + ADDRESSES.starknet.USDC, + ADDRESSES.starknet.USDT, + ADDRESSES.starknet.WSTETH, + ADDRESSES.starknet.STRK, ]; async function tvl(api) { diff --git a/projects/vett/index.js b/projects/vett/index.js index 5abf1b50a29e..bbd1df6d3e9a 100644 --- a/projects/vett/index.js +++ b/projects/vett/index.js @@ -1,8 +1,9 @@ +const ADDRESSES = require('../helper/coreAssets.json') const sdk = require("@defillama/sdk"); const chain = "thundercore"; -const posStaking = "0xC3C857a9E5Be042C8acF4F2827Aa053e93b5d039" +const posStaking = ADDRESSES.thundercore.veTT const posABI = { getTTPoolAbi: "uint256:getTTPool" } diff --git a/projects/vexchange/index.js b/projects/vexchange/index.js index eeb0bf360bfe..47bccf246155 100644 --- a/projects/vexchange/index.js +++ b/projects/vexchange/index.js @@ -1,25 +1,33 @@ -const { get } = require('../helper/http') +const { get } = require('../helper/http'); const { toUSDTBalances } = require('../helper/balances'); +const blacklist = ['0xb008022F676a8918299E046c91Af65Fc06b52B1C','0xca907dD0044D673e878E08Af32E2Dc2AdC731369']; + async function tvl() { - const data = await get('https://api.vexchange.io/v1/pairs') - let balance = 0 - Object.values(data).forEach(pair => { + const data = await get('https://api.vexchange.io/v1/pairs'); + let balance = 0; + + Object.entries(data).forEach(([pairAddress, pair]) => { + // Skip the blacklisted pair + if (blacklist.includes(pairAddress)) return; + if (pair.token0.usdPrice && pair.token1.usdPrice) { - balance += +pair.token0Reserve * pair.token0.usdPrice - balance += +pair.token1Reserve * pair.token1.usdPrice + balance += +pair.token0Reserve * pair.token0.usdPrice; + balance += +pair.token1Reserve * pair.token1.usdPrice; } else if (pair.token0.usdPrice) { - balance += +pair.token0Reserve * pair.token0.usdPrice * 2 - }else if (pair.token1.usdPrice) { - balance += +pair.token1Reserve * pair.token1.usdPrice * 2 + balance += +pair.token0Reserve * pair.token0.usdPrice * 2; + } else if (pair.token1.usdPrice) { + balance += +pair.token1Reserve * pair.token1.usdPrice * 2; } - }) - return toUSDTBalances(balance) + }); + + return toUSDTBalances(balance); } + module.exports = { timetravel: false, misrepresentedTokens: true, vechain: { - tvl - } -}; \ No newline at end of file + tvl, + }, +}; diff --git a/projects/vfat/index.js b/projects/vfat/index.js index 5fcc39dd58d1..6865d2b68beb 100644 --- a/projects/vfat/index.js +++ b/projects/vfat/index.js @@ -1,8 +1,9 @@ const { getLogs } = require('../helper/cache/getLogs'); +const { get } = require('../helper/http'); const { sumTokens2, addUniV3LikePosition } = require('../helper/unwrapLPs'); const config = require('./config'); -const { sumLPBalances } = require('./utils'); +const { sumLPBalances, filteredV3LPTokens } = require('./utils'); // Helper function to fetch sickles async function fetchSickles(api, factory, fromBlockSickle) { @@ -175,9 +176,11 @@ async function tvlBaseOptimism(api) { await sumLPBalances(api, deployedAeroGauges.lp, sickles, stakingTokens); const pools = await api.multiCall({ abi: 'address:pool', calls: deployedAeroGauges.nft }); + const whitelistedPoolList = new Set(await filteredV3LPTokens({ api, lpTokens: pools, minLPValue: 50e3 })); 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) => { + if (!whitelistedPoolList.has(pools[i])) return; 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, }); @@ -209,6 +212,7 @@ async function tvlArbitrumLinea(api) { await fetchSickleNftPositions(api, sickles, config[api.chain].NonfungiblePositionManager); await fetchSickleNftPositions(api, sickles, config[api.chain].masterchefV3, true); + api.removeTokenBalance('0xe80772eaf6e2e18b651f160bc9158b2a5cafca65') return sumTokens2({ api, resolveLP: true }); } @@ -319,5 +323,20 @@ Object.keys(config).forEach(chain => { tvl = genericTvl } - module.exports[chain] = { tvl } + module.exports[chain] = { tvl: tvl2 } }) + +// module.exports.isHeavyProtocol = true +module.exports.misrepresentedTokens = true +let _get + +async function tvl2(api) { + if (!_get) + _get = get(`https://api.vfat.io/v1/sickle-stats`) + + const { chainStats } = await _get + chainStats.filter(chain => chain.chainId === api.chainId).forEach(chain => { + api.addUSDValue(chain.tvl) + }) + +} \ No newline at end of file diff --git a/projects/vfat/utils.js b/projects/vfat/utils.js index 0339c2e58325..df8cbf5d8cd0 100644 --- a/projects/vfat/utils.js +++ b/projects/vfat/utils.js @@ -6,7 +6,7 @@ async function sumLPBalances(api, gauges, sickles, lpTokens) { lpTokens.forEach((lpToken, index) => lpTokens[index] = lpToken.toLowerCase()) let minLPValue = 4e3 if (lpTokens.length > 200) minLPValue = 15e3 - if (lpTokens.length > 400) minLPValue = 25e3 + if (lpTokens.length > 400) minLPValue = 40e3 const filteredLPSet = new Set(await filteredLPTokens({ api, lpTokens, minLPValue, })) @@ -24,7 +24,7 @@ async function sumLPBalances(api, gauges, sickles, lpTokens) { token = token.toLowerCase() return `${api.chain}:${gaugeTokenMapping[token] ?? token}` } - await sumTokens2({ api, transformAddress, tokens, owners: sickles }) + await sumTokens2({ api, transformAddress, tokens, owners: sickles, sumChunkSize: 10000, }) } // 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 @@ -67,6 +67,35 @@ async function filteredLPTokens({ api, lpTokens, minLPValue = 10e3 }) { } +// 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 filteredV3LPTokens({ 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 tok1n0Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: lpTokens.map((i, idx) => ({ target: token0s[idx], params: i})), permitFailure: true, }) + const tok1n1Bals = await api.multiCall({ abi: 'erc20:balanceOf', calls: lpTokens.map((i, idx) => ({ target: token1s[idx], params: i})), permitFailure: true, }) + const allTokens = [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 lpBalance = new Balances({ chain: api.chain, }) + lpBalance.add(token0s[i], tok1n0Bals[i] ?? 0) + lpBalance.add(token1s[i], tok1n1Bals[i] ?? 0) + 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, + filteredV3LPTokens, } \ No newline at end of file diff --git a/projects/visor/config.js b/projects/visor/config.js index 69ab6e93011e..4b8d6af40f6e 100644 --- a/projects/visor/config.js +++ b/projects/visor/config.js @@ -34,6 +34,8 @@ const HYPE_REGISTRY = { ], optimism: [ ["0xF5BFA20F4A77933fEE0C7bB7F39E7642A070d599", 6538026], // Uniswap + ["0x617BA5fcB4e74758795DceBecA420116e50bD289", 126667774], // Sushiswap + ["0xF802D5c44dC4E3bB0eCcf680a6bA82Cbd24B9F33", 125319599], // Velodrome ], arbitrum: [ ["0x66CD859053c458688044d816117D5Bdf42A56813", 10617223], // Uniswap @@ -87,6 +89,7 @@ const HYPE_REGISTRY = { ["0x8118C33513feC13f8cf488CCb4509190650F0e92", 7310111], // Baseswap ["0xf1DF4F17e34Ba710DfFC487F73f1e19476E815a6", 8743213], // Thick ["0xe1cd1c2d2e4B44dE211D554649BC7dc49eF07784", 15063294], // Kinetix + ["0x6809f4881707459Ad0287C6467365E3C910e9373", 19631061], // Aerodrome ], kava: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 6384272], // Kinetix @@ -104,6 +107,7 @@ const HYPE_REGISTRY = { ["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 9080358], // Hercules ], xdai: [ + ["0xc0766FF871c6C8e72C110100d0120829dc017d38", 36307837], // Uniswap ["0x683292172E2175bd08e3927a5e72FC301b161300", 31760496], // Swapr ], astrzk: [ @@ -114,6 +118,7 @@ const HYPE_REGISTRY = { ], scroll: [ ["0x683292172E2175bd08e3927a5e72FC301b161300", 4651930], // Uniswap + ["0x0B79d5117dd22eDC1e5F2649aC32746aF7Ca3445", 8111003], // Scribe ], blast: [ ["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 1727054], // Uniswap @@ -135,6 +140,24 @@ const HYPE_REGISTRY = { ["0x683292172E2175bd08e3927a5e72FC301b161300", 6414342], // Uniswap ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 6414350], // Sushiswap ], + iotaevm: [ + ["0xF44cECB1CF40ee12303E85Eb8651263c01812EaD", 223591], // wagmi + ], + core: [ + ["0x32e27fF479454e32868ff67Ee9F06BAFDC1E908F", 17268275], // Glyph + ["0xFc13Ebe7FEB9595D70195E9168aA7F3acE153621", 17164390], // CoreX + ], + zircuit: [ + ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 1216191], // Gmeow + ["0x683292172E2175bd08e3927a5e72FC301b161300", 1216165], // Circuit + ["0x17307DaC1384719d263556aAcC3e62c0053FE25D", 4826564], // Ocelex + ], + wc: [ + ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 4799965], // Uniswap + ], + apechain: [ + ["0xC27DDd78FC49875Fe6F844B72bbf31DFBB099881", 476343], // Camelot + ], }; Object.keys(HYPE_REGISTRY).forEach(chain => { diff --git a/projects/visor/index.js b/projects/visor/index.js index 595add42c602..e2e8bfe84638 100644 --- a/projects/visor/index.js +++ b/projects/visor/index.js @@ -5,6 +5,7 @@ const getTotalAmounts = "function getTotalAmounts() view returns (uint256 total0, uint256 total1)"; const { getUniqueAddresses } = require("../helper/utils"); const config = require("./config"); +const { sumTokens2 } = require('../helper/unwrapLPs') module.exports = { doublecounted: true, @@ -53,7 +54,7 @@ Object.keys(config).forEach(chain => { api.add(token0s[i], total0); api.add(token1s[i], total1); }); - return api.getBalances() + return sumTokens2({ api }) } } }) diff --git a/projects/vivacity/index.js b/projects/vivacity/index.js index 8c250221add1..4f7630e462e2 100644 --- a/projects/vivacity/index.js +++ b/projects/vivacity/index.js @@ -1,6 +1,6 @@ const { compoundExports } = require('../helper/compound') -const compoundData = compoundExports("0xe49627059Dd2A0fba4A81528207231C508d276CB", "canto") +const compoundData = compoundExports("0xe49627059Dd2A0fba4A81528207231C508d276CB") module.exports = { canto: compoundData diff --git a/projects/vnx-rwa/index.js b/projects/vnx-rwa/index.js index 11f015f84518..5dc8b3d7620f 100644 --- a/projects/vnx-rwa/index.js +++ b/projects/vnx-rwa/index.js @@ -1,4 +1,4 @@ -const { getTokenSupply } = require("../helper/solana"); +const { getTokenSupplies } = require("../helper/solana"); const fetch = require('node-fetch'); const ASSETS = { @@ -58,9 +58,8 @@ const fetchStellarSupply = async (asset) => { }; 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 supplies = await getTokenSupplies(assets) + api.addTokens(Object.keys(supplies), Object.values(supplies)); }; const stellarTvl = async (api, assets) => { diff --git a/projects/volta-dao/index.js b/projects/volta-dao/index.js index 07edfae28eac..273288ddf1d1 100644 --- a/projects/volta-dao/index.js +++ b/projects/volta-dao/index.js @@ -1,60 +1,29 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakingUnknownPricedLP } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); -const sdk = require("@defillama/sdk"); -const { BigNumber } = require("bignumber.js"); +const { sumTokens2 } = require('../helper/unwrapLPs'); const ftmToken = "0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"; const ftmStaking = "0xc6a54adddf7463f73a4c5a8e3e480bc798cf8a09"; const ftmTreasury = "0x05ab17e4dfa87ef4ac487ed20cfcc2ae75c2a792"; const ftmTokens = [ - [ADDRESSES.fantom.DAI, false], - ["0x78b51a1fd7524186982c2cb8982df312b1e896a8", true] + ADDRESSES.fantom.DAI, + "0x78b51a1fd7524186982c2cb8982df312b1e896a8" ]; const avaxToken = "0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"; const avaxStaking = "0xfae672012b90cfb6bf245ac072a3aca374604b17"; const avaxTreasury = "0x05ab17e4dfa87ef4ac487ed20cfcc2ae75c2a792"; const avaxTokens = [ - [ADDRESSES.avax.DAI, false], - ["0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8", true] + ADDRESSES.avax.DAI, + "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8" ] -async function tokenPrice(block, chain, lp, unlisted, listed) { - const tokensInLP = (await sdk.api.abi.multiCall({ - calls: [ - { - target: unlisted, - params: lp - }, - { - target: listed, - params: lp - } - ], - abi: "erc20:balanceOf", - block, - chain - })).output; - return Number(tokensInLP[1].output) / Number(tokensInLP[0].output); +async function ftmTvl(api) { + return sumTokens2({ api, owner: ftmTreasury, tokens: ftmTokens, resolveLP: true }) } -async function ftmTvl (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, ftmTokens, [ftmTreasury], chainBlocks.fantom, "fantom", addr=>`fantom:${addr}`); - const ratio = await tokenPrice(chainBlocks.fantom, "fantom", "0x78b51a1fd7524186982c2cb8982df312b1e896a8", ftmToken, ADDRESSES.fantom.DAI); - sdk.util.sumSingleBalance(balances, "fantom:" + ADDRESSES.fantom.DAI, BigNumber(balances["fantom:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); - delete balances["fantom:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]; - return balances; -} - -async function avaxTvl (timestamp, block, chainBlocks) { - let balances = {}; - await sumTokensAndLPsSharedOwners(balances, avaxTokens, [avaxTreasury], chainBlocks.avax, "avax", addr=>`avax:${addr}`); - const ratio = await tokenPrice(chainBlocks.avax,"avax", "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8", avaxToken, ADDRESSES.avax.DAI); - sdk.util.sumSingleBalance(balances, "avax:" + ADDRESSES.avax.DAI, BigNumber(balances["avax:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]).times(ratio).toFixed(0)); - delete balances["avax:0x4c9993c7107495020c2ce9a13d11839f48ecd2e6"]; - return balances; +async function avaxTvl(api) { + return sumTokens2({ api, owner: avaxTreasury, tokens: avaxTokens, resolveLP: true }) } module.exports = { @@ -63,7 +32,7 @@ module.exports = { tvl: ftmTvl, staking: stakingUnknownPricedLP(ftmStaking, ftmToken, "fantom", "0x78b51a1fd7524186982c2cb8982df312b1e896a8") }, - avax:{ + avax: { tvl: avaxTvl, staking: stakingUnknownPricedLP(avaxStaking, avaxToken, "avax", "0x26e7c9b2890440866d7d3f8f84b1ccaff443b9d8") } diff --git a/projects/vortexdao/index.js b/projects/vortexdao/index.js index 716c8d401505..875588d419c6 100644 --- a/projects/vortexdao/index.js +++ b/projects/vortexdao/index.js @@ -1,17 +1,6 @@ -const sdk = require("@defillama/sdk"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); - const space = "0x353af195c0d82820c59427BFbD318A49971AAe1a"; const stakingV1 = "0x910F038C9E74dF8baEd886a22f75C69FaE8a6792"; const stakingV2 = "0x073d3F4Ed6cb32Bd7f6F7B6da4C25672ee76c95B"; -const treasury = "0xE05CEc7Ed93C2d3E106Df88B8d7B963Ce3618f46"; -const mim = "0x130966628846bfd36ff31a822705796e8cb8c18d"; -const avai = "0x346a59146b9b4a77100d369a3d18e8007a9f46a6"; -const spaceMimJLP = "0x5087706DD31962938c57a0fB3A3107ed3794c996"; - -async function tvl(api) { - return api.sumTokens({ owners: [treasury], tokens: [spaceMimJLP, avai, mim, ] }) -} async function staking(api) { return api.sumTokens({ tokens: [space], owners: [stakingV1, stakingV2, ] }) diff --git a/projects/vsol/index.js b/projects/vsol/index.js new file mode 100644 index 000000000000..8099c9524b0f --- /dev/null +++ b/projects/vsol/index.js @@ -0,0 +1,12 @@ +const { getSolBalanceFromStakePool } = require('../helper/solana') + +async function tvl(api) { + await getSolBalanceFromStakePool('Fu9BYC6tWBo1KMKaP3CFoKfRhqv9akmy3DuYwnCyWiyC', api) +} + +module.exports = { + timetravel: false, + solana: { + tvl + } +} \ No newline at end of file diff --git a/projects/w3bank/index.js b/projects/w3bank/index.js index 90589db8218a..dc623b8d9869 100644 --- a/projects/w3bank/index.js +++ b/projects/w3bank/index.js @@ -6,3 +6,6 @@ module.exports = { pg: compoundExports2({ comptroller: '0x697bc9fd98ddafd1979c3e079033698ca93af451'}), methodology: `${lendingMarket}`, }; + +module.exports.deadFrom='2024-06-21', +module.exports.pg.borrowed = () => ({}) // bad debt diff --git a/projects/wagmi-com/index.js b/projects/wagmi-com/index.js index 5840df0b8489..ab0bfb6f1cd4 100644 --- a/projects/wagmi-com/index.js +++ b/projects/wagmi-com/index.js @@ -9,9 +9,10 @@ module.exports = uniV3Export({ metis: { factory: '0x8112E18a34b63964388a3B2984037d6a2EFE5B8A', fromBlock: 9740222, }, zklink: { factory: '0x6175b648473F1d4c1549aAC3c2d007e7720585e6', fromBlock: 1339353, }, iotaevm: { factory: '0x01Bd510B2eA106917e711f9a05a42fC162bee2Ac', fromBlock: 143828, }, + base: { factory: '0x576A1301B42942537d38FB147895fE83fB418fD4', fromBlock: 14250787, }, }) -module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3', minTVLUSD: 0 }) } +module.exports.kava = { tvl: uniV3GraphExport({ name: 'wagmi-kava', graphURL: 'https://kava.graph.wagmi.com/subgraphs/name/v3' }) } const stakingConfig = { metis: { swagmi: '0x5fb3983adc4dcc82a610a91d2e329f6401352558', wagmi: '0xaf20f5f19698f1d19351028cd7103b63d30de7d7', }, diff --git a/projects/wanbridge.js b/projects/wanbridge.js index 7e116b62204c..893855b6eb04 100644 --- a/projects/wanbridge.js +++ b/projects/wanbridge.js @@ -1,3 +1,4 @@ +const ADDRESSES = require('./helper/coreAssets.json') const { get } = require("./helper/http"); let ret; async function getTvl() { @@ -28,7 +29,7 @@ const chainsMap = { tron: "tron", wan: "wanchain", xdc: "xdc", - ripple: "xrp", + ripple: ADDRESSES.ripple.XRP, // clover: "clover", // telos: "telos", }; @@ -37,7 +38,7 @@ Object.keys(chainsMap).map((chain) => { module.exports[chain] = { tvl: async () => { let ret = await getTvl(); - return { tether: ret[chainsMap[chain]] } + return { tether: ret[chainsMap[chain]] ?? 0 } }, }; }); diff --git a/projects/waterfall-wtf-finance/index.js b/projects/waterfall-wtf-finance/index.js index 991debacfe6f..3457756166ae 100644 --- a/projects/waterfall-wtf-finance/index.js +++ b/projects/waterfall-wtf-finance/index.js @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -const {pool2Exports} = require("../helper/pool2"); +const {pool2} = require("../helper/pool2"); const { staking } = require("../helper/staking"); const token = "0x1811b7eD3B613805A9a4B4b1B80C99d58Af32576"; @@ -16,6 +16,6 @@ module.exports = { bsc: { tvl: async () => ({}), staking: staking(masonry, shares), - pool2: pool2Exports(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) + pool2: pool2(shareRewardPool, pancakeLPs, "bsc", addr=>`bsc:${addr}`) } } \ No newline at end of file diff --git a/projects/waterloan/index.js b/projects/waterloan/index.js index 256fb11dcc97..4db8fbd980f8 100644 --- a/projects/waterloan/index.js +++ b/projects/waterloan/index.js @@ -78,13 +78,14 @@ function waterloan(chain, borrowed) { } module.exports = { + deadFrom: '2022-10-23', methodology: `Counts all tokens locked in the contracts to be used as collateral in lending pool. Borrowed coins are not counted towards the TVL, only the coins actually locked in the contracts are counted.`, csc: { tvl: waterloan("csc", false), - borrowed: waterloan("csc", true), + borrowed: () => ({}) // bad debt waterloan("csc", true), }, smartbch: { tvl: waterloan("smartbch", false), - borrowed: waterloan("smartbch", true), + borrowed: () => ({}) // bad debt waterloan("smartbch", true), }, }; diff --git a/projects/waxdao/index.js b/projects/waxdao/index.js new file mode 100644 index 000000000000..ed2f776ee96a --- /dev/null +++ b/projects/waxdao/index.js @@ -0,0 +1,30 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +const staking_accounts = ["waxdaofarmer", "farms.waxdao", "tf.waxdao"]; + +const tokens = [ + ["eosio.token", "WAX", "wax"], + ["wuffi", "WUF", "wuffi"], + ["alien.worlds", "TLM", "alien-worlds"], +]; + + +// WaxDAO +// https://waxdao.io +async function wax() { + const accounts = ["waxdaolocker", "waxdaomarket", "waxdaobacker", "waxdaoescrow", "waxdaosynths"]; + + return await get_account_tvl(accounts, tokens, "wax"); +} + +async function staking() { + return await get_account_tvl(staking_accounts, tokens, "wax"); +} + +module.exports = { + methodology: `WaxDAO TVL is achieved by querying token balances from vesting, farming, and market contract(s)`, + wax: { + tvl: wax, + staking + }, +} \ No newline at end of file diff --git a/projects/waxfusion/index.js b/projects/waxfusion/index.js new file mode 100644 index 000000000000..4dba2e750e40 --- /dev/null +++ b/projects/waxfusion/index.js @@ -0,0 +1,18 @@ +const { get_account_tvl } = require("../helper/chain/eos"); + +// WaxFusion +// https://waxfusion.io +async function wax() { + const accounts = ["dapp.fusion", "pol.fusion", "cpu1.fusion", "cpu2.fusion", "cpu3.fusion"]; + const tokens = [ + ["eosio.token", "WAX", "wax"] + ]; + return await get_account_tvl(accounts, tokens, "wax"); +} + +module.exports = { + methodology: `WaxFusion TVL is achieved by querying token balances from liquid staking contracts`, + wax: { + tvl: wax + }, +} \ No newline at end of file diff --git a/projects/wbtc.js b/projects/wbtc.js index 84b706887f6f..e823eea80f89 100644 --- a/projects/wbtc.js +++ b/projects/wbtc.js @@ -1,20 +1,20 @@ +const { sumTokens } = require("./helper/sumTokens"); const ADDRESSES = require('./helper/coreAssets.json') -const sdk = require('@defillama/sdk') +const bitcoinAddressBook = require('./helper/bitcoin-book/index.js') -async function tvl(ts, block) { - return { - [ADDRESSES.ethereum.WBTC]: (await sdk.api.erc20.totalSupply({ target: ADDRESSES.ethereum.WBTC, block })).output - } -} -async function tvlTron(api) { - return { - [ADDRESSES.ethereum.WBTC]: (await api.call({ target: 'TXpw8XeWYeTUd4quDskoUqeQPowRh4jY65', abi: 'erc20:totalSupply' })), - ['ethereum:'+ADDRESSES.null]: (await api.call({ target: 'TXWkP3jLBqRGojUih1ShzNyDaN5Csnebok', abi: 'erc20:totalSupply' })), +// WALLETS FROM HERE https://wbtc.network/dashboard/audit +const owners = bitcoinAddressBook.wbtc + +async function tvl(api){ + if(api.timestamp > Date.now()/1e3 - 3600){ + return sumTokens({ owners, api }) + } else { + const supply = await api.call({ target: ADDRESSES.ethereum.WBTC, abi: 'erc20:totalSupply', }) + api.add(ADDRESSES.ethereum.WBTC, supply) } } module.exports = { - ethereum: { tvl }, - tron: { tvl: tvlTron }, - methodology: `TVL for WBTC consists of the BTC deposits in custody that were used to mint WBTC` -} + bitcoin: { tvl }, + methodology: `TVL for WBTC consists of the BTC deposits in custody that were used to mint WBTC`, +}; diff --git a/projects/weft-finance-v2/index.js b/projects/weft-finance-v2/index.js new file mode 100644 index 000000000000..7c338cbab63a --- /dev/null +++ b/projects/weft-finance-v2/index.js @@ -0,0 +1,37 @@ +const ADDRESSES = require('../helper/coreAssets.json') +const { post } = require('../helper/http') + +const { sumTokens } = require('../helper/chain/radixdlt'); + +const KEY_VALUE_STORE_URL = `https://mainnet.radixdlt.com/state/key-value-store/` + +const lendingPool = 'component_rdx1czmr02yl4da709ceftnm9dnmag7rthu0tu78wmtsn5us9j02d9d0xn' + +const lendingMarket = 'component_rdx1cpy6putj5p7937clqgcgutza7k53zpha039n9u5hkk0ahh4stdmq4w' + +const resourcePoolsKVS = 'internal_keyvaluestore_rdx1kzjr763caq96j0kv883vy8gnf3jvrrp7dfm9zr5n0akryvzsxvyujc' + +async function tvl(api) { + return sumTokens({ owners: [lendingPool, lendingMarket], api }); +} + +async function borrowed(api) { + + let keys = (await post(`${KEY_VALUE_STORE_URL}/keys`, { "key_value_store_address": resourcePoolsKVS })).items.map(i => ({ key_hex: i.key.raw_hex })) + + let data = (await post(`${KEY_VALUE_STORE_URL}/data`, { "key_value_store_address": resourcePoolsKVS, "keys": keys })).entries.map(i => ([i.key.programmatic_json.value, i.value.programmatic_json.fields])) + + data.forEach(([key, fields]) => { + + let totalLoan = fields[6].fields[1].value + + api.add(key, +totalLoan) + + }); + +} + +module.exports = { + radixdlt: { tvl, borrowed }, + timetravel: false, +}; diff --git a/projects/welnance/index.js b/projects/welnance/index.js index 4dd3ede56f82..b5fd2926282d 100644 --- a/projects/welnance/index.js +++ b/projects/welnance/index.js @@ -1,16 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') const { compoundExports } = require("../helper/compound"); const comptroller = "0xdc21c1dAF3277f07fFA6EB09fCD3E07EDc36DC0A"; module.exports = { - bsc: { - ...compoundExports( comptroller, - "bsc", - "0x38e22c429e62530cbB59B90bF14a71346C727752", - ADDRESSES.bsc.WBNB - ), - }, + bsc: compoundExports(comptroller, + "0x38e22c429e62530cbB59B90bF14a71346C727752", + ), methodology: "Same as compound, we just get all the collateral (not borrowed money) on the lending markets", }; diff --git a/projects/wemix-lend/index.js b/projects/wemix-lend/index.js index 94298ddd35aa..ea92a8e39005 100644 --- a/projects/wemix-lend/index.js +++ b/projects/wemix-lend/index.js @@ -1,10 +1,8 @@ const {compoundExports} = require('../helper/compound'); -const { nullAddress } = require('../helper/tokenMapping'); const compound = "0x929620a759a564e3C273e8a4efCDa5806da168F2"; const cETH = "0x34b9B18fDBE2aBC6DfB41A7f6d39B5E511ce3e23"; -const chain = "wemix"; module.exports = { - wemix: compoundExports(compound, chain, cETH, nullAddress), + wemix: compoundExports(compound,cETH), }; \ No newline at end of file diff --git a/projects/whitewhale-dex/index.js b/projects/whitewhale-dex/index.js index 3089d9a942cf..5762a195c3c2 100644 --- a/projects/whitewhale-dex/index.js +++ b/projects/whitewhale-dex/index.js @@ -21,8 +21,11 @@ module.exports = { ] } - Object.keys(factory).forEach(chain => { const contract = factory[chain] - module.exports[chain] = { tvl: getFactoryTvl(contract) } + if (chain === 'comdex') { + module.exports[chain] = { tvl: () => ({}) } + } else { + module.exports[chain] = { tvl: getFactoryTvl(contract) } + } }) \ No newline at end of file diff --git a/projects/wing.js b/projects/wing.js index b68791d482dd..0d8e4c5aa2e6 100644 --- a/projects/wing.js +++ b/projects/wing.js @@ -69,7 +69,7 @@ module.exports = mergeExports([ ADDRESSES.ethereum.WETH, '0x5d3a536E4D6DbD6114cc1Ead35777bAB948E3643', '0x39AA39c021dfbaE8faC545936693aC917d5E7563', - '0xdAC17F958D2ee523a2206206994597C13D831ec7', + ADDRESSES.ethereum.USDT, '0x70e36f6BF80a52b3B46b3aF8e106CC0ed743E8e4', '0xc00e94Cb662C3520282E6f5717214004A7f26888', '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5', diff --git a/projects/wise-lending-v2/index.js b/projects/wise-lending-v2/index.js index bb9c6732625c..9d6c1503e4e4 100644 --- a/projects/wise-lending-v2/index.js +++ b/projects/wise-lending-v2/index.js @@ -1,4 +1,4 @@ -const ADDRESSES = require('../helper/coreAssets.json') +const ADDRESSES = require('../helper/coreAssets.json'); async function tvl(api) { const { lending: lendingContract, tvlAddresses } = config[api.chain]; @@ -12,9 +12,9 @@ async function borrowed(api) { abi: 'function getPseudoTotalBorrowAmount(address) view returns (uint256)', target: lendingContract, calls: borrowAddresses - }) + }); - api.add(borrowAddresses, borrowAmounts) + api.add(borrowAddresses, borrowAmounts); } const aavePools = [ @@ -25,6 +25,16 @@ const aavePools = [ "0x6ab707Aca953eDAeFBc4fD23bA73294241490620", ]; +const wisePools = [ + ADDRESSES.ethereum.WETH, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.USDC, + ADDRESSES.ethereum.DAI, + ADDRESSES.ethereum.WBTC, + ADDRESSES.ethereum.WSTETH, +]; + + const config = { arbitrum: { lending: '0x9034a49587bD2c1Af27598E0f04F30Db66C87Ebf', @@ -32,6 +42,12 @@ const config = { tvlAddresses: aavePools, borrowAddresses: aavePools }, + ethereum: { + lending: '0x78190e4c7C7B2c2C3b0562F1f155a1FC2F5160CA', + feeManager: '0x0bc24e61daad6293a1b3b53a7d01086bff0ea6e5', + tvlAddresses: wisePools, + borrowAddresses: wisePools + }, }; Object.keys(config).forEach(chain => { diff --git a/projects/wonderland/index.js b/projects/wonderland/index.js index 10028e4ccf44..47173b354fb8 100644 --- a/projects/wonderland/index.js +++ b/projects/wonderland/index.js @@ -1,6 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') const { stakings } = require("../helper/staking"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const TimeStaking = "0x4456B87Af11e87E329AB7d7C7A246ed1aC2168B9"; const RevenueSharingFarm = "0xC172c84587bEa6d593269bFE08632bf2Da2Bc0f6"; @@ -10,67 +9,45 @@ const wMEMO = "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b"; const Treasury_Eth = "0x355D72Fb52AD4591B2066E43e89A7A38CF5cb341"; const Treasury_Avax = "0x88bbE6dE858B179841c8f49a56b99fb0522a263a"; -async function avaxTvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - const transform = (addr) => - addr.toLowerCase() === ADDRESSES.avax.USDt - ? [ADDRESSES.ethereum.USDT]: `avax:${addr}`; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [ADDRESSES.avax.USDt, false], - [ADDRESSES.avax.USDC_e, false], - ["0x39fC9e94Caeacb435842FADeDeCB783589F50f5f", false], // KNC - ["0x63682bDC5f875e9bF69E201550658492C9763F89", false], // BSGG - ["0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", false], //wMEMO - ], - [Treasury_Avax], - chainBlocks.avax, - "avax", - transform - ); - - const wmemoAddress = transform(wMEMO); - delete balances[wmemoAddress]; - - return balances; +async function avaxTvl(api) { + await api.sumTokens({ + owner: Treasury_Avax, tokens: [ADDRESSES.avax.USDt, + ADDRESSES.avax.USDC_e, + "0x39fC9e94Caeacb435842FADeDeCB783589F50f5f", // KNC + "0x63682bDC5f875e9bF69E201550658492C9763F89", // BSGG + "0x0da67235dd5787d67955420c84ca1cecd4e5bb3b", //wMEMO + ] + }) + api.removeTokenBalance(wMEMO) } -async function ethTvl(timestamp, ethBlock, chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [ADDRESSES.ethereum.LUSD, false], - ["0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0", false], // FRAX - [ADDRESSES.ethereum.CVX, false], - [ADDRESSES.ethereum.cvxCRV, false], - ["0x55C08ca52497e2f1534B59E2917BF524D4765257", false], // UwU - ["0x69570f3E84f51Ea70b7B68055c8d667e77735a25", false], // BSGG - ["0x04906695D6D12CF5459975d7C3C03356E4Ccd460", false], // sOHM - ["0x29127fE04ffa4c32AcAC0fFe17280ABD74eAC313", false], // sifu - [ADDRESSES.ethereum.TUSD, false], - ["0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5", false], // CPOOL - ["0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", false], // ALCX - ["0xdB25f211AB05b1c97D595516F45794528a807ad8", false], // EURS - [ADDRESSES.ethereum.GNO, false], // GNO - ["0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68", false], // INV - ["0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", false], // JPEG - ["0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", false], // USDD - ["0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", false], // STG - ["0x6243d8CEA23066d098a15582d81a598b4e8391F4", false], // FLX - [ADDRESSES.ethereum.SNX, false], - [ADDRESSES.ethereum.USDT, false], - [ADDRESSES.ethereum.DAI, false], - ], - [Treasury_Eth], - ethBlock, - "ethereum" - ); - - return balances; +async function ethTvl(api) { + return api.sumTokens({ + owner: Treasury_Eth, tokens: [ + ADDRESSES.ethereum.LUSD, + ADDRESSES.ethereum.FXS, // FRAX + ADDRESSES.ethereum.CVX, + ADDRESSES.ethereum.cvxCRV, + "0x55C08ca52497e2f1534B59E2917BF524D4765257", // UwU + "0x69570f3E84f51Ea70b7B68055c8d667e77735a25", // BSGG + "0x04906695D6D12CF5459975d7C3C03356E4Ccd460", // sOHM + "0x29127fE04ffa4c32AcAC0fFe17280ABD74eAC313", // sifu + ADDRESSES.ethereum.TUSD, + "0x66761Fa41377003622aEE3c7675Fc7b5c1C2FaC5", // CPOOL + "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", // ALCX + "0xdB25f211AB05b1c97D595516F45794528a807ad8", // EURS + ADDRESSES.ethereum.GNO, // GNO + "0x41D5D79431A913C4aE7d69a668ecdfE5fF9DFB68", // INV + "0xE80C0cd204D654CEbe8dd64A4857cAb6Be8345a3", // JPEG + "0x0C10bF8FcB7Bf5412187A595ab97a3609160b5c6", // USDD + "0xAf5191B0De278C7286d6C7CC6ab6BB8A73bA2Cd6", // STG + "0x6243d8CEA23066d098a15582d81a598b4e8391F4", // FLX + ADDRESSES.ethereum.SNX, + ADDRESSES.ethereum.USDT, + ADDRESSES.ethereum.DAI, + + ] + }) } module.exports = { diff --git a/projects/woo-cex/index.js b/projects/woo-cex/index.js index d905a62a6049..48edcacf0e4c 100644 --- a/projects/woo-cex/index.js +++ b/projects/woo-cex/index.js @@ -1,4 +1,5 @@ const { cexExports } = require('../helper/cex') +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') const owners = [ '0x0d83f81bc9f1e8252f87a4109bbf0d90171c81df', @@ -8,12 +9,7 @@ const owners = [ ] const config = { - bitcoin: { - owners: [ - 'bc1qh78w4qq9v2dqntjtxne97kp9u2485jdqrfsghh', - 'bc1qm4hycszv0v0qel3swxqyp57nkpnnrda4rc55lm' - ], - }, + bitcoin: { owners: bitcoinAddressBook.wooCEX }, ethereum: { owners }, fantom: { owners }, avax: { owners }, diff --git a/projects/woofi-earn/index.js b/projects/woofi-earn/index.js index fdb802a815d1..76132e08a6a3 100644 --- a/projects/woofi-earn/index.js +++ b/projects/woofi-earn/index.js @@ -6,10 +6,14 @@ module.exports = { misrepresentedTokens: true, }; -(['fantom', 'bsc', 'avax', 'polygon', 'arbitrum', 'optimism', ]).forEach(chain => { +(['fantom', 'bsc', 'avax', 'polygon', 'arbitrum', 'optimism', 'era', 'base', 'mantle']).forEach(chain => { module.exports[chain] = { tvl: async () => { - let data = await get('https://fi-api.woo.org/yield?network=' + chain) + let network = chain + if (chain == 'era') { + network = 'zksync' + } + let data = await get('https://fi-api.woo.org/yield?network=' + network) const tvl = data.data.total_deposit / 1e18 return toUSDTBalances(tvl) } diff --git a/projects/woofi.js b/projects/woofi.js index 1dcba24a856b..1293b021b856 100644 --- a/projects/woofi.js +++ b/projects/woofi.js @@ -57,6 +57,7 @@ const wooPPConfig = { ethereum: [], era: [ ADDRESSES.era.WETH, // WETH + ADDRESSES.era.ZK, // ZK ADDRESSES.era.USDC, // USDC.e '0x1d17CBcF0D6D143135aE902365D2E5e2A16538D4', // native USDC ], @@ -66,16 +67,20 @@ const wooPPConfig = { ], linea: [ ADDRESSES.linea.WETH, // WETH + '0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4', // WBTC ADDRESSES.linea.USDC, // native USDC + ADDRESSES.linea.USDT, // USDT ], base: [ ADDRESSES.base.WETH, // WETH + '0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf', // cbBTC ADDRESSES.base.USDbC, // USDbC ADDRESSES.base.USDC, // native USDC ], mantle: [ ADDRESSES.mantle.WMNT, // WMNT ADDRESSES.mantle.WETH, // WETH + '0xcDA86A272531e8640cD7F1a92c01839911B90bb0', // mETH ADDRESSES.mantle.USDT, // USDT ADDRESSES.mantle.USDC, // USDC ], diff --git a/projects/worldes/index.js b/projects/worldes/index.js new file mode 100644 index 000000000000..f3a4353fc92b --- /dev/null +++ b/projects/worldes/index.js @@ -0,0 +1,36 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +const config = { + arbitrum: { dvmFactory: '0x3bA0388E64900e274f2C6fCfaE34Eed65c01282A', fromBlock: 228710000, dspFactory: '0xf3AadDd00C2E263d760BE52BB7142276B74E8b47', WorldesRWATokenFactory: '0x4Ef31B45919aE1874840B9563D46FCD57E2Ae0b7', WorldesDvmProxy: '0x7e93ED796aFD3D9a6e9a24c668153fBb981bE60E', WorldesDspProxy: '0xE6933Fb2dc110a43fdeC6bB83d6ae99aC557c452', WorldesMineProxy: '0x2eFda50249176e3ee1A26964Ad6496DC5aA2aCE7', WES: '0xcEab5Af10D5376016c8C352ea77F8Bc6a88bDa11' }, +} + +Object.keys(config).forEach(chain => { + const { dvmFactory, fromBlock, dspFactory, blacklistedTokens, WES, } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const ownerTokens = [] + if (WES) { + const supply = await api.call({ abi: 'uint256:totalSupply', target: WES }) + api.add(WES, supply) + } + + await builder(dvmFactory, 'event NewDVM(address baseToken, address quoteToken, address creator, address pool)'); + await builder(dspFactory, 'event NewDSP(address baseToken, address quoteToken, address creator, address pool)'); + + return api.sumTokens({ ownerTokens, blacklistedTokens, permitFailure: true, }) + + async function builder(factorys, event) { + if (!Array.isArray(factorys)) + factorys = [factorys]; + const res = factorys.map(factory => addLogs(factory, event)); + await Promise.all(res) + } + + async function addLogs(target, eventAbi) { + const convert = i => [[i.baseToken, i.quoteToken], i.pool] + let logs = await getLogs2({ api, target, eventAbi, fromBlock }) + ownerTokens.push(...logs.map(convert)) + } + } + } +}) \ No newline at end of file diff --git a/projects/wrappedfi.js b/projects/wrappedfi.js index 8e9ca0d4b31a..dbfb35f467ed 100644 --- a/projects/wrappedfi.js +++ b/projects/wrappedfi.js @@ -1,122 +1,21 @@ -const sdk = require("@defillama/sdk"); - -const ethContracts = [ - /** - * WCELO - * - * coingecko: wrapped-celo - * coinmarketcap: wrapped-celo - */ - '0xE452E6Ea2dDeB012e20dB73bf5d3863A3Ac8d77a', - - /** - * WCUSD - * - * coingecko: wrapped-celo-dollar - * coinmarketcap: wrapped-celo-dollar - */ - '0xad3E3Fc59dff318BecEaAb7D00EB4F68b1EcF195', - - /** - * WFIL - * - * coingecko: wrapped-filecoin - * coinmarketcap: wrapped-filecoin - */ - '0x6e1A19F235bE7ED8E3369eF73b196C07257494DE', - - /** - * WFLOW - * - * coingecko: wrapped-flow - */ - '0x5c147e74d63b1d31aa3fd78eb229b65161983b2b', - - /** - * WKDA - * - * coingecko: wrapped-kadena - */ - '0x85d7bdfc9c3426b33a684241eeee70385bc42820', - - /** - * WLTC - * - * no price available - */ - '0x53c4871322Bb47e7A24136fce291a6dcC832a294', - - /** - * WXRP - * - * coingecko: wrapped-xrp - */ - '0x39fBBABf11738317a448031930706cd3e612e1B9', - - /** - * WZEC - * - * coingecko: wrapped-zcash - * coinmarketcap: wrapped-zec - */ - '0x4A64515E5E1d1073e83f30cB97BEd20400b66E10' -]; - -const celoContracts = [ - /** - * CBTC or WBTC - * - * no identifiers for coingecko or coinmarketcap - */ - '0xD629eb00dEced2a080B7EC630eF6aC117e614f1b', - - /** - * CETH - * - * no identifiers for coingecko or coinmarketcap - */ - '0x2def4285787d58a2f811af24755a8150622f4361', // ceth -]; - -const ethTvls = ethContracts.map((contractAddress) => { - return async (timestamp, block) => { - if (contractAddress == '0x53c4871322Bb47e7A24136fce291a6dcC832a294') { - return { - litecoin: ( - await sdk.api.erc20.totalSupply({ - block, - target: contractAddress, - }) - ).output / 10 ** 18, - } - } - return { - [contractAddress]: ( - await sdk.api.erc20.totalSupply({ - block, - target: contractAddress, - }) - ).output, - }; - }; -}); - -const celoTvls = celoContracts.map((contractAddress) => { - return async (timestamp, ethBlock, { celo: block }) => { - return { - [`celo:${contractAddress}`]: ( - await sdk.api.erc20.totalSupply({ - block, - target: contractAddress, - chain: "celo", - }) - ).output, - }; - }; -}); +const { cexExports } = require('./helper/cex') +const ADDRESSES = require('./helper/coreAssets.json') module.exports = { - ethereum: { tvl: sdk.util.sumChainTvls(ethTvls), }, - celo: { tvl: sdk.util.sumChainTvls(celoTvls), }, + ...cexExports({ + ripple: { + owners: ['r4Pr9aBnqN84hbkmJo4HwUtLj63E5vGFyE'] + }, + celo: { + tokensAndOwners: [ + [ADDRESSES.null, '0x84d9dcAc2f00F2Cd903E340b5241EB6e5c198572'] + ] + }, + ethereum: { + tokensAndOwners: [ + [ADDRESSES.null, '0xD6873b9592AB601E6cE6a6A781799d54961942F3'] + ] + }, + }), methodology: 'The TVL consists of the underlying capital held in custody.' }; \ No newline at end of file diff --git a/projects/xWeowns/index.js b/projects/xWeowns/index.js index fe07eb3c8464..006f1e1b8c9d 100644 --- a/projects/xWeowns/index.js +++ b/projects/xWeowns/index.js @@ -1,25 +1,3 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); - -const contracts = { - "xWeowns": "0xaBA0Bb586335B938a7a817A900017D891268d32c", - "USDT": "0x32D2b9bBCf25525b8D7E92CBAB14Ca1a5f347B14", - "USDTethereum": ADDRESSES.ethereum.USDT -}; - -async function tvl(timestamp, block, chainBlocks) { - return { - [ contracts.USDTethereum ]: - (await sdk.api.abi.call({ - target: contracts.USDT, - params: contracts.xWeowns, - abi: 'erc20:balanceOf', - block: chainBlocks.lachain, - chain: 'lachain' - })).output - }; -} - module.exports = { lachain: { tvl: () => 0, diff --git a/projects/xbank/index.js b/projects/xbank/index.js index c9e3f5ef7844..7ce5b8aedd73 100644 --- a/projects/xbank/index.js +++ b/projects/xbank/index.js @@ -1,8 +1,11 @@ const { compoundExports2 } = require('../helper/compound'); module.exports = { + deadFrom: '2024-04-28', era: compoundExports2({ comptroller: '0xC6d329a2C3f8cFDECAe7FeEc387fa633C6520991', cether: '0xE4622A57Ab8F4168b80015BBA28fA70fb64fa246', }) -}; \ No newline at end of file +}; + +module.exports.era.borrowed = () => ({}) // bad debt \ No newline at end of file diff --git a/projects/xlink-btc-lst/index.js b/projects/xlink-btc-lst/index.js new file mode 100644 index 000000000000..2092d3811a04 --- /dev/null +++ b/projects/xlink-btc-lst/index.js @@ -0,0 +1,9 @@ +const sdk = require("@defillama/sdk"); +const { sumTokensExport } = require("../helper/sumTokens"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') + +module.exports = { + methodology: "Staking tokens via Babylon counts as TVL", + doublecounted:true, + bitcoin: { tvl: sdk.util.sumChainTvls([sumTokensExport({ owners: bitcoinAddressBook.xlinkLST })]) } +} \ No newline at end of file diff --git a/projects/xlink/index.js b/projects/xlink/index.js index ad6c513dc300..e309a6e27223 100644 --- a/projects/xlink/index.js +++ b/projects/xlink/index.js @@ -1,67 +1,54 @@ -const { sumTokensExport } = require('../helper/sumTokens'); -const ADDRESSES = require('../helper/coreAssets.json'); +const ADDRESSES = require("../helper/coreAssets.json"); +const sdk = require("@defillama/sdk"); +const { sumTokensExport } = require("../helper/sumTokens"); +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') 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', + methodology: "Staking tokens via AlexLab counts as TVL", + bitcoin: { tvl: sdk.util.sumChainTvls([sumTokensExport({ owners: bitcoinAddressBook.xlink })]) }, + ethereum: { + tvl: sumTokensExport({ + owners: [ + "0x7ceC01355aC0791dE5b887e80fd20e391BCB103a", + "0xcD0cb6AA811E1c8cD9A55EcB9Cc83f6a50Bed311", + "0x13b72A19e221275D3d18ed4D9235F8F859626673", ], + tokens: [ADDRESSES.ethereum.WBTC, ADDRESSES.null], + }), }, - bsc: { - owners: - [ - '0xFFda60ed91039Dd4dE20492934bC163e0F61e7f5', - // '0x5caeb9d58325044a1ad9d4abff2e0d525928812d' // is EOA - ], - tokens: - [ + bsc: { + tvl: sumTokensExport({ + owners: [ + "0x7ceC01355aC0791dE5b887e80fd20e391BCB103a", + "0xcD0cb6AA811E1c8cD9A55EcB9Cc83f6a50Bed311", + "0xFFda60ed91039Dd4dE20492934bC163e0F61e7f5", + ], + tokens: [ ADDRESSES.bsc.USDT, - ADDRESSES.bsc.BTCB - ] + ADDRESSES.bsc.BTCB, + ], + }), }, - ethereum: { - owners: - [ - '0x13b72A19e221275D3d18ed4D9235F8F859626673', - // '0x1bf78679b001c5efa20d80600e085ae52d25abc1' // is EOA - ], - tokens: - [ - ADDRESSES.ethereum.USDT, - ADDRESSES.ethereum.WBTC - ] + stacks: { + tvl: sumTokensExport({ + owners: [ + "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.cross-bridge-registry-v2-01", + "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.btc-peg-out-endpoint-v2-01", + ], + blacklistedTokens: [ + "SP2XD7417HGPRTREMKF748VNEQPDRR0RMANB7X1NK.token-abtc::bridged-btc", + "SP102V8P0F7JX67ARQ77WEA3D3CFB5XW39REDT0AM.token-alex::alex", + ], + }), }, - 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 + bsquared: { + tvl: sumTokensExport({ + owners: [ + '0x10eeCCc43172458F0ff9Cc3E9730aB256fAEE32e' + ], + tokens: [ + ADDRESSES.bsquared.UBTC + ] + }), + } +}; diff --git a/projects/xrgb/index.js b/projects/xrgb/index.js index d1070836a296..91c3e3046d70 100644 --- a/projects/xrgb/index.js +++ b/projects/xrgb/index.js @@ -1,9 +1,7 @@ const { sumTokensExport } = require("../helper/chain/brc20"); -const owner = 'bc1ptm05s4f6f8j78zhx62lzx0dep07f2597nlgeltmm4sjn5stdu6gq4sxg2w' +const bitcoinAddressBook = require('../helper/bitcoin-book/index.js') module.exports = { methodology: "XRGB as bridge,Unlock ERC404 on all chains", - bitcoin: { - tvl: sumTokensExport({ owner, blacklistedTokens: ['XRGB'] }), - } + bitcoin: { tvl: sumTokensExport({ owners: bitcoinAddressBook.xrgb, blacklistedTokens: ['XRGB'] }) } }; \ No newline at end of file diff --git a/projects/xrpl-dex/app.js b/projects/xrpl-dex/app.js index 4faf69b22a00..c802dd38fb2f 100644 --- a/projects/xrpl-dex/app.js +++ b/projects/xrpl-dex/app.js @@ -1,9 +1,13 @@ +const ADDRESSES = require('../helper/coreAssets.json') const rippleCodec = require("ripple-binary-codec"); const { PromisePool } = require("@supercharge/promise-pool"); const { getCache, setCache } = require("../helper/cache"); const { transformDexBalances } = require("../helper/portedTokens"); +const xrpl = require("xrpl"); + const NODE_URL = "https://xrplcluster.com"; +// const xrpTBILL = 'rJNE2NNz83GJYtWVLwMvchDWEon3huWnFn' const fetchLedgerData = async (binary, marker, atLedgerIndex) => { const xrplResponse = await fetch(NODE_URL, { @@ -43,8 +47,8 @@ const fetchPoolReserves = async (pool, atLedgerIndex) => { }); const xrplResponseJson = await xrplResponse.json(); return { - token0: parseReserve(xrplResponseJson.result.amm.amount), - token1: parseReserve(xrplResponseJson.result.amm.amount2), + token0: parseReserve(xrplResponseJson.result.amm?.amount), + token1: parseReserve(xrplResponseJson.result.amm?.amount2), }; }; @@ -89,9 +93,10 @@ const discoverPools = async (nextMarker, isBinary, atLedgerIndex, poolsFound = [ }; const parseReserve = (reserveData) => { + if (!reserveData) return null; const reserveIsXrp = typeof reserveData === "string"; return { - currency: reserveIsXrp ? "XRP" : reserveData.currency, + currency: reserveIsXrp ? [ADDRESSES.ripple.XRP]: reserveData.currency, issuer: reserveIsXrp ? null : reserveData.issuer, amount: reserveIsXrp ? reserveData : reserveData.value, }; @@ -111,7 +116,7 @@ const getAllPoolsReserves = async (poolAddresses, atLedgerIndex) => { }); }); if (errors.length > 0) - throw new Error(errors) + throw new Error(errors[0]) return poolsWithReserves } @@ -124,22 +129,22 @@ function getTimeNow() { return Math.floor(Date.now() / 1000); } -async function main() { +async function xrplDex () { 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) - } + // 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 @@ -149,17 +154,50 @@ async function main() { 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, - })), + data: poolsWithReserves + .filter(i => i.token0Reserve && i.token1Reserve) + .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'], - } + allPools, lastPoolUpdate, lastDataUpdate: getTimeNow(), tvl, }) +} + +async function openedenRippleTvl() { + const timeNow = getTimeNow() + const aDayInSeconds = 60 * 60 * 24; + const projectKey = 'openeden-tbill' + const cacheKey = 'cache' + let { lastDataUpdate, tvl } = await getCache(projectKey, cacheKey) + if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds) { + lastDataUpdate = getTimeNow() + + const client = new xrpl.Client('wss://xrplcluster.com/'); + await client.connect(); + + const issuerAddress = "rJNE2NNz83GJYtWVLwMvchDWEon3huWnFn"; + const subscriptionOperatorAddress = "rB56JZWRKvpWNeyqM3QYfZwW4fS9YEyPWM"; + + const issuerAccountInfo = await client.request({ + command: 'gateway_balances', + account: issuerAddress, + hotwallet: [subscriptionOperatorAddress], + }); + + tvl = Math.round(Number(issuerAccountInfo.result.obligations?.TBL)) || 0; + await setCache(projectKey, cacheKey, { lastDataUpdate, tvl }) + client.disconnect(); + } +} + +async function main() { + return Promise.allSettled([ + // openedenRippleTvl(), + xrplDex() + ]) } \ No newline at end of file diff --git a/projects/xrpl-dex/index.js b/projects/xrpl-dex/index.js index 0de17de24ce5..2d20b6ce86ab 100644 --- a/projects/xrpl-dex/index.js +++ b/projects/xrpl-dex/index.js @@ -1,12 +1,10 @@ +const ADDRESSES = require('../helper/coreAssets.json') 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, - }, + 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, }; @@ -14,13 +12,14 @@ function getTimeNow() { return Math.floor(Date.now() / 1000); } -async function tvl() { +async function tvl(api) { 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) + const val = tvl?.XRP + if (!lastDataUpdate || timeNow - lastDataUpdate > aDayInSeconds || !val) throw new Error("stale/missing tvl data"); - return tvl + api.addCGToken('ripple', val/1e6) } \ No newline at end of file diff --git a/projects/xrpl-dex/package-lock.json b/projects/xrpl-dex/package-lock.json index f79d19f7835a..f55185a85706 100644 --- a/projects/xrpl-dex/package-lock.json +++ b/projects/xrpl-dex/package-lock.json @@ -7,26 +7,71 @@ "": { "name": "xrpl-dex", "version": "1.0.0", - "license": "ISC", + "license": "MIT", + "dependencies": { + "ripple-binary-codec": "^2.1.0", + "xrpl": "^4.0.0" + } + }, + "node_modules/@noble/curves": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.6.0.tgz", + "integrity": "sha512-TlaHRXDehJuRNR9TfZDNQ45mMEd5dwUwmicsafcIX4SsNiqnCHKjE/1alYPd/lDRVhxdhUAlv8uEhMCI5zjIJQ==", + "license": "MIT", "dependencies": { - "ripple-binary-codec": "^2.1.0" + "@noble/hashes": "1.5.0" + }, + "engines": { + "node": "^14.21.3 || >=16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" } }, "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==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.5.0.tgz", + "integrity": "sha512-1j6kQFb7QRru7eKN3ZDvRcP13rugwdxZqCjbiAVZfIJwgj2A65UmT4TgARXGlXgnRkORLTDTrO19ZErt7+QXgA==", + "license": "MIT", "engines": { - "node": ">= 16" + "node": "^14.21.3 || >=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==", + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.9.tgz", + "integrity": "sha512-8YKhl8GHiNI/pU2VMaofa2Tor7PJRAjwQLBBuilkJ9L5+13yVbC7JO/wS7piioAvPSwR3JKM1IJ/u4xQzbcXKg==", + "license": "MIT", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.5.0.tgz", + "integrity": "sha512-8EnFYkqEQdnkuGBVpCzKxyIwDCBLDVj3oiX0EKUFre/tOjL/Hqba1D6n/8RcmaQy4f95qQFrO2A8Sr6ybh4NRw==", + "license": "MIT", + "dependencies": { + "@noble/curves": "~1.6.0", + "@noble/hashes": "~1.5.0", + "@scure/base": "~1.1.7" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.4.0.tgz", + "integrity": "sha512-BEEm6p8IueV/ZTfQLp/0vhw4NPnT9oWf5+28nvmeUICjP99f4vr2d+qc7AVGDDtwRep6ifR43Yed9ERVmiITzw==", + "license": "MIT", + "dependencies": { + "@noble/hashes": "~1.5.0", + "@scure/base": "~1.1.8" + }, "funding": { "url": "https://paulmillr.com/funding/" } @@ -44,6 +89,16 @@ "node": ">=16.0.0" } }, + "node_modules/@xrplf/secret-numbers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@xrplf/secret-numbers/-/secret-numbers-1.0.0.tgz", + "integrity": "sha512-qsCLGyqe1zaq9j7PZJopK+iGTGRbk6akkg6iZXJJgxKwck0C5x5Gnwlb1HKYGOwPKyrXWpV6a2YmcpNpUFctGg==", + "license": "ISC", + "dependencies": { + "@xrplf/isomorphic": "^1.0.0", + "ripple-keypairs": "^2.0.0" + } + }, "node_modules/bignumber.js": { "version": "9.1.2", "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.1.2.tgz", @@ -82,6 +137,20 @@ "node": ">= 16" } }, + "node_modules/ripple-keypairs": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ripple-keypairs/-/ripple-keypairs-2.0.0.tgz", + "integrity": "sha512-b5rfL2EZiffmklqZk1W+dvSy97v3V/C7936WxCCgDynaGPp7GE6R2XO7EU9O2LlM/z95rj870IylYnOQs+1Rag==", + "license": "ISC", + "dependencies": { + "@noble/curves": "^1.0.0", + "@xrplf/isomorphic": "^1.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", @@ -101,6 +170,26 @@ "optional": true } } + }, + "node_modules/xrpl": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xrpl/-/xrpl-4.0.0.tgz", + "integrity": "sha512-VZm1lQWHQ6PheAAFGdH+ISXKvqB2hZDQ0w4ZcdAEtmqZQXtSIVQHOKPz95rEgGANbos7+XClxJ73++joPhA8Cw==", + "license": "ISC", + "dependencies": { + "@scure/bip32": "^1.3.1", + "@scure/bip39": "^1.2.1", + "@xrplf/isomorphic": "^1.0.1", + "@xrplf/secret-numbers": "^1.0.0", + "bignumber.js": "^9.0.0", + "eventemitter3": "^5.0.1", + "ripple-address-codec": "^5.0.0", + "ripple-binary-codec": "^2.1.0", + "ripple-keypairs": "^2.0.0" + }, + "engines": { + "node": ">=18.0.0" + } } } } diff --git a/projects/xrpl-dex/package.json b/projects/xrpl-dex/package.json index a7e910c8e369..ea7ef196a400 100644 --- a/projects/xrpl-dex/package.json +++ b/projects/xrpl-dex/package.json @@ -9,6 +9,7 @@ "license": "MIT", "description": "", "dependencies": { - "ripple-binary-codec": "^2.1.0" + "ripple-binary-codec": "^2.1.0", + "xrpl": "^4.0.0" } } diff --git a/projects/xrune/abi.json b/projects/xrune/abi.json deleted file mode 100644 index 7e755d4472c9..000000000000 --- a/projects/xrune/abi.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "getPrice": "function getPrice(address asset) view returns (uint256)", - "getTotal": "uint256:getTotal", - "getPoolAddress": "address:getPoolAddress" -} \ No newline at end of file diff --git a/projects/xrune/index.js b/projects/xrune/index.js index 679dcf6af8a2..2851dc77b5f7 100644 --- a/projects/xrune/index.js +++ b/projects/xrune/index.js @@ -1,26 +1,5 @@ -const sdk = require("@defillama/sdk"); -const { stakings } = require("../helper/staking.js"); -const abi = require("./abi.json"); -const BN = require("bignumber.js"); +const { staking } = require("../helper/staking.js"); -async function getTotal(pools, chain, block) { - const balances = {}; - await Promise.all( - pools.map((pool) => - sdk.api.erc20 - .balanceOf({ - target: pool[1], - owner: pool[0], - chain, - block, - }) - .then((result) => - sdk.util.sumSingleBalance(balances, pool[2], result.output) - ) - ) - ); - return balances; -} const token = "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c"; const ethStaking = [ @@ -29,32 +8,11 @@ const ethStaking = [ "0xc20434f595c32B5297A737Cb173382Dd2485C2cC", //4-Month Vault "0x8ba0C510Da4507D1F5f73ff9E1FcD14Edc819EB2", //6-Month Vault ]; -const ethPools = [ - [ - "0x817ba0ecafD58460bC215316a7831220BFF11C80", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //Tiers - [ - "0xebcd3922a199cd1358277c6458439c13a93531ed", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //DAO - [ - "0x5b1b8bdbcc534b17e9f8e03a3308172c7657f4a3", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - "0x69fa0feE221AD11012BAb0FdB45d444D3D2Ce71c", - ], //DAO -]; - -async function eth(_timestamp, block, chainBlocks) { - return getTotal(ethPools, "ethereum", block); -} module.exports = { methodology: `TVL comes from the Staking Vaults and Launchpad Tiers`, ethereum: { - tvl: eth, - staking: stakings(ethStaking, token), + tvl: () => ({}), + staking: staking([...ethStaking, '0x817ba0ecafD58460bC215316a7831220BFF11C80'], token), }, }; diff --git a/projects/xsigma/index.js b/projects/xsigma/index.js index 03f70664281b..349a39da1901 100644 --- a/projects/xsigma/index.js +++ b/projects/xsigma/index.js @@ -1,8 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); const { staking } = require("../helper/staking"); const { pool2 } = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const SigThreePoolContract = "0x3333333ACdEdBbC9Ad7bda0876e60714195681c5"; const USDC = ADDRESSES.ethereum.USDC; @@ -13,20 +11,8 @@ const sigMasterchefContract = "0x98C32b59a0AC00Cd33750427b1A317eBcf84D0F7"; const SIG = "0x7777777777697cfeecf846a76326da79cc606517"; const SIG_ETH_UNIV2 = "0x23b7e6932cb873b8696afba077c4a2486b1c862e"; -async function ethTvl() { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [USDC, false], - [DAI, false], - [USDT, false], - ], - [SigThreePoolContract] - ); - - return balances; +async function ethTvl(api) { + return api.sumTokens({ owner: SigThreePoolContract, tokens: [USDC, DAI, USDT] }); } module.exports = { diff --git a/projects/xspswap-v3/index.js b/projects/xspswap-v3/index.js index 9b74be6cddd8..b1d5865bf13f 100644 --- a/projects/xspswap-v3/index.js +++ b/projects/xspswap-v3/index.js @@ -2,5 +2,5 @@ const { uniV3Export } = require('../helper/uniswapV3') const factory = '0x30F317A9EC0f0D06d5de0f8D248Ec3506b7E4a8A' module.exports = uniV3Export({ - xdc: { factory, fromBlock: 59782067, methodology: 'TVL accounts for the liquidity on all AMM pools taken from the factory contract', }, + xdc: { factory, fromBlock: 59782067, methodology: 'TVL accounts for the liquidity on all AMM pools taken from the factory contract', permitFailure: true }, }) \ No newline at end of file diff --git a/projects/xtrade/index.js b/projects/xtrade/index.js new file mode 100644 index 000000000000..e0e2a717dff5 --- /dev/null +++ b/projects/xtrade/index.js @@ -0,0 +1,9 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + xlayer: { + factory: '0x612D9EA08be59479B112D8d400C7F0A2E4aD4172', + fromBlock: 813172, + isAlgebra: true, + }, +}) diff --git a/projects/xusdmoney/index.js b/projects/xusdmoney/index.js index 9a08db546eb0..cce6aed0469d 100644 --- a/projects/xusdmoney/index.js +++ b/projects/xusdmoney/index.js @@ -1,7 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); -const { sumTokensAndLPsSharedOwners } = require("../helper/unwrapLPs"); const collateralPoolContracts = [ // WETH Pool @@ -43,20 +42,8 @@ const lpPairAddresses = [ "0x88d9bE8D3DFe82eF3b09641284467f1Ee5E98343", ]; -async function ethTvl(chainBlocks) { - const balances = {}; - - await sumTokensAndLPsSharedOwners( - balances, - [ - [WETH, false], - [DAI, false], - [USDC, false], - ], - collateralPoolContracts - ); - - return balances; +async function ethTvl(api) { + return api.sumTokens({ owners: collateralPoolContracts, tokens: [WETH, DAI, USDC] }); } module.exports = { diff --git a/projects/xy-finance/index.js b/projects/xy-finance/index.js index 307d67cbecb6..49ce033273df 100644 --- a/projects/xy-finance/index.js +++ b/projects/xy-finance/index.js @@ -73,6 +73,9 @@ const config = { }, ox_chain: { chainId: '6699' + }, + cronos_zkevm: { + chainId: '388' } } @@ -145,14 +148,16 @@ const yPoolDepositContract = { "contractAddress": "0xEC8476DCC72b4AB6Cbc3C2bD7f50A15891485fDB", "tokenAddress": "0xA2ae6273Dd65F9fA76C3d383eDe9c1261e025DAC" }, - "DBX": { - "contractAddress": "0x812e9eE2437a3e4FE0A4A4A7f195536844301f07", - "tokenAddress": "0x061E31e7768b39a4282822b65569F8d814dC15f6" - }, - "DBC": { - "contractAddress": "0xD99995b63F44fc500B702251262B7d9f35adA0BC", - "tokenAddress": "0x730B05d100EeFb92f04016C6c0cF6f2bBB2C3A57" - }, + // DBX is already counted from DBX tvl on Arbitrum since its just a mint on Cronos + // "DBX": { + // "contractAddress": "0x812e9eE2437a3e4FE0A4A4A7f195536844301f07", + // "tokenAddress": "0x061E31e7768b39a4282822b65569F8d814dC15f6" + // }, + // DBC is already counted from DBC tvl on Arbitrum since its just a mint on Cronos + // "DBC": { + // "contractAddress": "0xD99995b63F44fc500B702251262B7d9f35adA0BC", + // "tokenAddress": "0x730B05d100EeFb92f04016C6c0cF6f2bBB2C3A57" + // }, "SINGLE": { "contractAddress": "0x9A4cC214782Fea5880394eFDE60187797a2FEF01", "tokenAddress": "0x0804702a4E749d39A35FDe73d1DF0B1f1D6b8347" @@ -161,14 +166,20 @@ const yPoolDepositContract = { "contractAddress": "0x58F29F7d759aef5B8e34C8e4152d6117893017aB", "tokenAddress": "0xae620DC4B9b6e44FBeb4a949F63AC957Cc43b5dD" }, - "LLT": { - "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", - "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" - }, + // LLT is already counted from LLT tvl on Polygon since its just a mint on Cronos + // "LLT": { + // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" + // }, "RIP": { "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8" + }, + "STUCK": { + "contractAddress": "0xc1Ae654b7D9C6a2Cfb0f97254AB5246AAbd2Ce7b", + "tokenAddress": "0xa0D445dC147f598d63518b5783CA97Cd8Bd9f5Bc" } + }, "56": { "ETH": { @@ -211,10 +222,11 @@ const yPoolDepositContract = { "contractAddress": "0xf4137e5D07b476e5A30f907C3e31F9FAAB00716b", "tokenAddress": ADDRESSES.polygon.USDC }, - "BLU": { - "contractAddress": "0x7C1C974367Ee28D3d7aBb088f5FCd748B3759EA4", - "tokenAddress": "0x759d34685468604c695De301ad11A9418e2f1038", - }, + // BLU is already counted from BLU tvl on Cronos since its just a mint on Polygon + // "BLU": { + // "contractAddress": "0x7C1C974367Ee28D3d7aBb088f5FCd748B3759EA4", + // "tokenAddress": "0x759d34685468604c695De301ad11A9418e2f1038", + // }, "CANDY": { "contractAddress": "0x5Bd40e579Cb7D37784689044E6C7c333E2E300e6", "tokenAddress": "0x54E53ed24C12c1d3Df7D653587E2f27d3FbaE3d2", @@ -269,10 +281,11 @@ const yPoolDepositContract = { "contractAddress": "0x680ab543ACd0e52035E9d409014dd57861FA1eDf", "tokenAddress": ADDRESSES.arbitrum.USDC }, - "DBF": { - "contractAddress": "0xa1fB1F1E5382844Ee2D1BD69Ef07D5A6Abcbd388", - "tokenAddress": "0x38A896c29Eb54c566A3fD593f559174520Dc6F75" - }, + // DBF is already counted from DBF tvl on Cronos since its just a mint on Arbitrum + // "DBF": { + // "contractAddress": "0xa1fB1F1E5382844Ee2D1BD69Ef07D5A6Abcbd388", + // "tokenAddress": "0x38A896c29Eb54c566A3fD593f559174520Dc6F75" + // }, "DBX": { "contractAddress": "0x156C04ca75f11817DdbF887692990F3E46e8982B", "tokenAddress": "0x0b257fe969d8782fAcb4ec790682C1d4d3dF1551" @@ -389,14 +402,21 @@ const yPoolDepositContract = { "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", "tokenAddress": ADDRESSES.base.USDbC }, - "LOOT": { - "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", - "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" - }, - "RIP": { - "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", - "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8" - } + // LOOT is already counted from LOOT tvl on Ethereum since its just a mint on Base + // "LOOT": { + // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + // "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" + // }, + // RIP is already counted from RIP tvl on Cronos since its just a mint on Base + // "RIP": { + // "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", + // "tokenAddress": "0x34aceA6Cc02578aF041a5E976b7289ca23cCB7A8" + // }, + // STUCK is already counted from STUCK tvl on Cronos since its just a mint on Base + // "STUCK": { + // "contractAddress": "0xc1Ae654b7D9C6a2Cfb0f97254AB5246AAbd2Ce7b", + // "tokenAddress": "0xa0D445dC147f598d63518b5783CA97Cd8Bd9f5Bc" + // } }, "5000": { "ETH": { @@ -411,10 +431,11 @@ const yPoolDepositContract = { "contractAddress": "0x0241fb446d6793866245b936F2C3418F818bDcD3", "tokenAddress": ADDRESSES.mantle.USDT }, - "LOOT": { - "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", - "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" - } + // LOOT is already counted from LOOT tvl on Ethereum since its just a mint on Mantle + // "LOOT": { + // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + // "tokenAddress": "0x94a42083948d86432246eAD625B30d49014A4BFF" + // } }, "534352": { "ETH": { @@ -431,10 +452,11 @@ const yPoolDepositContract = { "contractAddress": "0xFa77c2DecCB21ACb9Bf196408Bf6aD5973D07762", "tokenAddress": ethAddress }, - "LOOT": { - "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", - "tokenAddress": "0x1C559a960aE5293eA56C40EFC3c0169B413DDcF3" - } + // LOOT is already counted from LOOT tvl on Ethereum since its just a mint on Blast + // "LOOT": { + // "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", + // "tokenAddress": "0x1C559a960aE5293eA56C40EFC3c0169B413DDcF3" + // } }, "196": { "ETH": { @@ -457,26 +479,36 @@ const yPoolDepositContract = { } }, "6699": { - "USDC": { - "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", - "tokenAddress": "0xcE8f4E26e2532A78DAcD7A497A1827692b14b31D" - }, - "ETH": { - "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC", - "tokenAddress": "0x7e6ecF974310d75325Ab1209253250aC7fCCe09b" - }, - "PEPE": { - "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", - "tokenAddress": "0x4aE774bF3dEfF2eaD31D5D51Aa636EE216fBE274" - }, - "MOG": { - "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", - "tokenAddress": "0xfaffa4b4D8538A2ba63bEa39ACbF709E3A972714" - }, + // USDC is already counted from USDC tvl on Base since its just a mint on OxChain + // "USDC": { + // "contractAddress": "0xd15f36e89e08A67AEe910629fCe9aBA7D2e8Ac80", + // "tokenAddress": "0xcE8f4E26e2532A78DAcD7A497A1827692b14b31D" + // }, + // ETH is already counted from ETH tvl on Base since its just a mint on OxChain + // "ETH": { + // "contractAddress": "0x4F19699cb57543B76167b7d38040f34db4d11fEC", + // "tokenAddress": "0x7e6ecF974310d75325Ab1209253250aC7fCCe09b" + // }, + // PEPE is already counted from PEPE tvl on Ethereum since its just a mint on OxChain + // "PEPE": { + // "contractAddress": "0x0790eF241DC85Adf32998aae5E5738579c417701", + // "tokenAddress": "0x4aE774bF3dEfF2eaD31D5D51Aa636EE216fBE274" + // }, + // MOG is already counted from MOG tvl on Ethereum since its just a mint on OxChain + // "MOG": { + // "contractAddress": "0x141E379505C3b89C5BBE4Bd2353f12CA4681e3D2", + // "tokenAddress": "0xfaffa4b4D8538A2ba63bEa39ACbF709E3A972714" + // }, // "BITCOIN": { // "contractAddress": "0xD95841e7eC6b61f708829B57a3433C3Fd24B2A8c", // "tokenAddress": "0x92073dE2706eB8f0265998bCf7B8F751e1349b8F" // } + }, + "388": { + "ETH": { + "contractAddress": "0xAa0b0654E79E17332d983E2351bD926cE336B9BD", + "tokenAddress": "0x271602A97027ee1dd03b1E6e5dB153eB659A80b1" + }, } } diff --git a/projects/y2b-finance/index.js b/projects/y2b-finance/index.js index d61e36d21ec8..786327413251 100644 --- a/projects/y2b-finance/index.js +++ b/projects/y2b-finance/index.js @@ -1,32 +1,9 @@ -const { sumTokens2, sumTokensExport } = require('../helper/unwrapLPs') -const { getLogs } = require('../helper/cache/getLogs') - -async function tvl(api) { - const logs = await getLogs({ - api, - fromBlock: 16310967, - eventAbi: 'event MarketCreated(uint256 indexed mIndex, address hedge, address risk, address token, string name, int256 strikePrice)', - topics: ['0xf38f00404415af51ddd0dd57ce975d015de2f40ba8a087ac48cd7552b7580f32'], - target: '0xF33C13DA4425629C3F10635E4f935D8020F97D1f', - }) - - const vaults = logs.map(({ args }) => ([args.hedge, args.risk])).flat() - const tokens = await api.multiCall({ - abi: 'address:asset', - calls: vaults, - }) - const tokensAndOwners = tokens.map((token, i) => ([token, vaults[i]])) - - return sumTokens2({ api, tokensAndOwners }) -} - - module.exports = { hallmarks: [ [1673913600, "Rug Pull"] ], - ethereum: { - tvl, - // staking: sumTokensExport({ owners: [], tokens: ['0xF9C12B27cE5058ab98ce11BD53900f84E18C0650']}) + deadFrom: 1673913600, + ethereum: { + tvl: () => ({}), } } diff --git a/projects/yamfore/index.js b/projects/yamfore/index.js new file mode 100644 index 000000000000..9a5e32faa3c1 --- /dev/null +++ b/projects/yamfore/index.js @@ -0,0 +1,24 @@ +const { sumTokens2 } = require("../helper/chain/cardano"); +const { nullAddress } = require("../helper/tokenMapping"); + +const V1_PROTOCOL_SCRIPT_ADDRESS = "addr1xywgm3cqq35eh8p83x7gymkgqs8r9zzeg9sgq74d59apepgu3hrsqprfnwwz0zdusfhvspqwx2y9jstqspa2mgt6rjzs2v0fp9" + +async function tvl() { + return sumTokens2({ + owners: [ + V1_PROTOCOL_SCRIPT_ADDRESS, + ], + tokens: [ + nullAddress, + 'c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d' + ], + }) +} + +module.exports = { + cardano: { + tvl + }, + start: 1728878400, + methodology: "TVL is equal to all ADA, CBLP and USDM (USDM by Moneta) held in the treasury and unlent funds, collected fees and loan collateral held by the V1 script.", +}; diff --git a/projects/yay-staking/index.js b/projects/yay-staking/index.js new file mode 100644 index 000000000000..c228def2f68d --- /dev/null +++ b/projects/yay-staking/index.js @@ -0,0 +1,16 @@ +const yayStoneAddress = '0xe86142af1321eaac4270422081c1EdA31eEcFf0c' +const yayAgETHAddress = '0x0341d2c2CE65B62aF8887E905245B8CfEA2a3b97' + +const tvl = async (api) => { + return api.sumTokens({ + tokensAndOwners: [ + ['0x7122985656e38bdc0302db86685bb972b145bd3c', yayStoneAddress], + ['0xe1b4d34e8754600962cd944b535180bd758e6c2e', yayAgETHAddress], + ] + }) +} + +module.exports = { + start: 1722488340, + ethereum: { tvl }, +} \ No newline at end of file diff --git a/projects/yel/index.js b/projects/yel/index.js index 2b470a01b09d..0087bc801a10 100644 --- a/projects/yel/index.js +++ b/projects/yel/index.js @@ -1,5 +1,9 @@ -const { sumUnknownTokens } = require('../helper/unknownTokens') +const { sumUnknownTokens, getTokenPrices } = require('../helper/unknownTokens') const { sumTokens2 } = require('../helper/unwrapLPs') +const { + normalizeAddress, +} = require('../helper/tokenMapping') + const ADDRESSES = require('../helper/coreAssets.json') const config = { @@ -16,14 +20,69 @@ const config = { farms: ['0x954b15065e4FA1243Cd45a020766511b68Ea9b6E', '0x0379C1BbE394f835366D2EFDBf2AF09fBa0689A4'], lps: ['0x8bAb87ECF28Bf45507Bd745bc70532e968b5c2De'], ownTokens: ['0xd3b71117e6c1558c1553305b44988cd944e97300'] }, blast: { - ownTokensAndOwners: [['0x949185D3BE66775Ea648F4a306740EA9eFF9C567', '0x7d2f5881F0C4B840fcFA2c49F4052d1A004eAf0d']], + ownTokensAndOwners: [ + // Token Potion(lToken) slToken + ['0x949185D3BE66775Ea648F4a306740EA9eFF9C567', '0x7d2f5881F0C4B840fcFA2c49F4052d1A004eAf0d', '0xD451E3443Fc9e12d37F64EC0FeD100cE2c10D22A'] + ], tokensAndOwners: [ - [ADDRESSES.blast.WETH, '0x795a85CD543D0E2d29F7e11e33a20a38A4b5121e'], - [ADDRESSES.blast.BLAST, '0x7D8490333315EaAa5e93F3C6983d1e8128D7f50f'], + // Token Potion(lToken) slToken + [ADDRESSES.blast.WETH, '0x795a85CD543D0E2d29F7e11e33a20a38A4b5121e', '0x7D8490333315EaAa5e93F3C6983d1e8128D7f50f' ], + [ADDRESSES.blast.BLAST, '0x07BF0Bc908Ef4badF8ec0fB1f77A8dBFe33c33c0', '0x73681f24a4a099E71e0Ddd084f2310bA1E0b3a36' ], + ], + }, + base: { + ownTokensAndOwners: [ + // Token Potion(lToken) slToken + ['0x949185D3BE66775Ea648F4a306740EA9eFF9C567', '0x516712404013200B499Cd8fAE4575E5d48F6Ba65', '0x38b8b2B4b063e71047474018707Fab2E9a2bB971'] + ], + tokensAndOwners: [ + // Token Potion(lToken) slToken + [ADDRESSES.optimism.WETH_1, '0x0540f15374eCF13aAB3c0a76b643333CE0D00579', '0x0E7De1d6A1aA4178CBfce3dE4EAaD0427034f924'], + [ADDRESSES.base.USDC, '0xE7349C94BDE0D13599Ed496342857bb231FeF02B', '0xabb4D7866e1059bD21581FC5FC6D49388D30a323'], + ['0x1509706a6c66CA549ff0cB464de88231DDBe213B', '0x8a27CE3A836C8A9D962D86C099f229f3baF3EB4a', '0xFfeC8bAAa8cf32Bc7F85ea6a7C44Ad541309FD1F'] ], } } +async function tvl( api, coveredAssets){ + for(const assets of coveredAssets){ + const originalToken = normalizeAddress(assets[0]) + const potion = normalizeAddress(assets[1]) + const slToken = normalizeAddress(assets[2]) + + let totalTokenBalance = 0 + const balances = await api.multiCall({ + abi : 'erc20:balanceOf', + calls : [ + { + target : originalToken, + params : potion + }, + { + target : potion, + params : slToken + } + ] + }) + + let potionSupply = Number( + await api.call({ + abi : 'erc20:totalSupply', + target : potion, + }) + ) + + const tokenBalanceOnPotion = Number(balances[0]) + const ltokenBalanceOnSLToken = Number(balances[1]) + + const cbr = tokenBalanceOnPotion / potionSupply + + totalTokenBalance = tokenBalanceOnPotion + (ltokenBalanceOnSLToken * cbr) + + api.add(originalToken, totalTokenBalance) + } +} + Object.keys(config).forEach(chain => { const { farms = [], lps = [], ownTokens = [], ownTokensAndOwners, tokensAndOwners, } = config[chain] module.exports[chain] = { @@ -41,7 +100,10 @@ Object.keys(config).forEach(chain => { await sumTokens2({ api, ownerTokens, blacklistedTokens: [...lps, ...ownTokens], resolveLP: true, }) } - if (tokensAndOwners) return api.sumTokens({ tokensAndOwners }) + if (tokensAndOwners){ + await tvl(api, tokensAndOwners) + } + }, pool2: async (api) => { if (farms.length && lps.length) @@ -52,7 +114,9 @@ Object.keys(config).forEach(chain => { if (farms.length && ownTokens.length) await sumUnknownTokens({ api, owners: farms, tokens: ownTokens, useDefaultCoreAssets: true, lps, }) - if (ownTokensAndOwners) return api.sumTokens({ tokensAndOwners: ownTokensAndOwners }) + if (ownTokensAndOwners){ + await tvl(api, ownTokensAndOwners) + } }, } }) \ No newline at end of file diff --git a/projects/yellow/index.js b/projects/yellow/index.js new file mode 100644 index 000000000000..fdf8a8b52280 --- /dev/null +++ b/projects/yellow/index.js @@ -0,0 +1,21 @@ +const { sumTokensExport } = require('../helper/unwrapLPs') + +const vaultAddress = '0xb5F3a9dD92270f55e55B7Ac7247639953538A261' + +const vaults = { + ethereum: {}, + linea: {}, + polygon: {}, +} + +module.exports = { + methodology: 'The total amount of assets locked in the Yellow Wallet.', +} + +Object.keys(vaults).forEach((chain) => { + const { vault = vaultAddress, tokens = [] } = vaults[chain] + + module.exports[chain] = { + tvl: sumTokensExport({ owner: vault, tokens, fetchCoValentTokens: true }), + } +}) diff --git a/projects/yetiFinance/index.js b/projects/yetiFinance/index.js index 19dd25367650..cae094cbd648 100644 --- a/projects/yetiFinance/index.js +++ b/projects/yetiFinance/index.js @@ -1,197 +1,14 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require("@defillama/sdk"); - -const getAllCollateralAbi = 'function getAllCollateral() view returns (address[], uint256[])' -const fetchPrice_vAbi = "uint256:fetchPrice_v" -const farmPoolTotalSupplyAbi = "uint256:totalSupply" -const curve_get_virtual_priceAbi = "uint256:get_virtual_price" -const getPriceAbi = 'function getPrice(address _collateral) view returns (uint256)' -const getReservesAbi = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)' - -// YetiController knows the price of the collateral -const YETI_CONTROLLER_ADDRESS = "0xcCCCcCccCCCc053fD8D1fF275Da4183c2954dBe3"; - -// All system collaterals are stored across activepool and defaultpool -const ACTIVE_POOL_ADDRESS = "0xAAAaaAaaAaDd4AA719f0CF8889298D13dC819A15"; -const DEFAULT_POOL_ADDRESS = "0xdDDDDDdDDD3AD7297B3D13E17414fBED370cd425"; - -const FARM_ADDRESS = "0xfffFffFFfFe8aA117FE603a37188E666aF110F39"; -const BOOST_CURVE_LP_FARM_ADDRESS = "0xD8A4AA01D54C8Fdd104EAC28B9C975f0663E75D8" - -const YUSDCURVE_POOL_ADDRESS = "0x1da20ac34187b2d9c74f729b85acb225d3341b25" - -const YETIAVAX_POOL2_ADDRESS = "0xbdc7EF37283BC67D50886c4afb64877E3e83f869" - -const YETI_PRICEFEED = "0x8a98709077E8A98ECAf89056838a99b484686863" - -const AVAX_PRICEFEED = "0x45F7260f7Cc47b15eB5cB6ac0dAaBd8Efb2A0edB" - -const YETI_TOKEN_ADDRESS = "0x77777777777d4554c39223C354A05825b2E8Faa3" - -const VEYETI_ADDRESS = "0x88888888847DF39Cf1dfe1a05c904b4E603C9416" -const chain = 'avax' -/** - * Get TVL of YETI FInance - */ -async function tvl(_, _block, chainBlocks) { - const block = chainBlocks[chain] - const activePoolCollaterals = ( - await sdk.api.abi.call({ - target: ACTIVE_POOL_ADDRESS, - abi: getAllCollateralAbi, - block, - chain: "avax" - }) - ).output - - const defaultPoolCollaterals = ( - await sdk.api.abi.call({ - target: DEFAULT_POOL_ADDRESS, - abi: getAllCollateralAbi, - block, - chain: "avax" - }) - ).output - - // require(activePoolCollaterals[0].length === defaultPoolCollaterals[0].length, "active pool collaterals and default pool collaterals have different length") - - // in USD - let systemCollateralTvl = 0 - // iterate through all the collateral types and sum up amount * price to get TVL in USD - for (let i = 0; i < activePoolCollaterals[0].length; i++) { - - const tokenAddress = activePoolCollaterals[0][i] - const amount = +activePoolCollaterals[1][i] + +defaultPoolCollaterals[1][i] - const decimals = ( - await sdk.api.erc20.decimals(tokenAddress, "avax") - ).output; - - const price = ( - await sdk.api.abi.call({ - target: YETI_CONTROLLER_ADDRESS, - abi: getPriceAbi, - block, - chain: "avax", - params: tokenAddress - }) - ).output - - - // some collaterals have decimals that is < 18 so need to normalize decimals - systemCollateralTvl += amount * (10 ** (18 - +decimals)) * +price / (10 ** 18) - } - - - const curveFarmAmount = ( - await sdk.api.abi.call({ - target: FARM_ADDRESS, - abi: farmPoolTotalSupplyAbi, - block, - chain: "avax" - }) - ).output - - const curveBoostFarmAmount = ( - await sdk.api.abi.call({ - target: BOOST_CURVE_LP_FARM_ADDRESS, - abi: farmPoolTotalSupplyAbi, - block, - chain: "avax" - }) - ).output - - const YUSDCurvPrice = ( - await sdk.api.abi.call({ - target: YUSDCURVE_POOL_ADDRESS, - abi: curve_get_virtual_priceAbi, - block, - chain: "avax" - }) - ).output - - const farmTvl = (+curveFarmAmount + +curveBoostFarmAmount) * +YUSDCurvPrice / (10 ** 18) - - const total = systemCollateralTvl + farmTvl - - return { - // In USDC, USDC has decimal of 6 - ["avax:" + ADDRESSES.avax.USDC]: total / (10 ** 12) - } -} - -async function pool2(_, _block, chainBlocks) { - const block = chainBlocks[chain] - const reserves = ( - await sdk.api.abi.call({ - target: YETIAVAX_POOL2_ADDRESS, - abi: getReservesAbi, - block, - chain: "avax" - }) - ).output - const YETIReserve = reserves[0] - const AVAXReserve = reserves[1] - - const YETIPrice = ( - await sdk.api.abi.call({ - target: YETI_PRICEFEED, - abi: fetchPrice_vAbi, - block, - chain: "avax" - }) - ).output - - const AVAXPrice = ( - await sdk.api.abi.call({ - target: AVAX_PRICEFEED, - abi: fetchPrice_vAbi, - block, - chain: "avax" - }) - ).output - - const pool2ValueUSD = (YETIReserve * YETIPrice + AVAXReserve * AVAXPrice) / 10 ** 18 - return { - // In USDC, USDC has decimal of 6 - ["avax:" + ADDRESSES.avax.USDC]: pool2ValueUSD / (10 ** 12) - } -} - -async function staking(_, _block, chainBlocks) { - const block = chainBlocks[chain] - const veYETIBalance = ( - await sdk.api.erc20.balanceOf({ - target: YETI_TOKEN_ADDRESS, - owner: VEYETI_ADDRESS, - block, - chain:"avax" - }) - ).output; - - const YETIPrice = ( - await sdk.api.abi.call({ - target: YETI_PRICEFEED, - abi: fetchPrice_vAbi, - block, - chain: "avax" - }) - ).output - - const stakingUSD = veYETIBalance * YETIPrice / (10 ** 18) - return { - // In USDC, USDC has decimal of 6 - ["avax:" + ADDRESSES.avax.USDC]: stakingUSD / (10 ** 12) - } -} - +// https://yetifinance.medium.com/yeti-finance-wind-down-55913bbf6aed module.exports = { misrepresentedTokens: true, - methodology: true, - // first trove opened start: 1650027587, + deadFrom: '2324-02-10', + hallmarks: [ + [Math.floor(new Date('2023-12-28')/1e3), 'Protocol decides to wind down'], + ], avax:{ - tvl, - pool2, - staking + tvl: () => ({}), + pool2: () => ({}), + staking: () => ({}), }, }; diff --git a/projects/yfdai/index.js b/projects/yfdai/index.js index 839ffc7445c4..52133f95d9c5 100644 --- a/projects/yfdai/index.js +++ b/projects/yfdai/index.js @@ -1,6 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const sdk = require('@defillama/sdk') -const {sumTokens} = require('../helper/unwrapLPs') +const { sumTokensExport } = require('../helper/unwrapLPs') +const { staking } = require('../helper/staking') const yfdaiTokenAddress = "0xf4CD3d3Fda8d7Fd6C5a500203e38640A70Bf9577"; const YfDaiStakingAdddress = "0x44d771D0C998f524ff39aB6Df64B72bce1d09566"; @@ -15,33 +15,13 @@ const YfDaiETHLP60DayVault = "0x26572bf2620108cb5006987e6348c07dc4e14a0f"; const YfDaiETHLP90DayVault = "0x175d6cbaeff93734ada4c5430815f2208a6b040c"; const impulsevenStakingAddress = "0xc0c135D29ba6BB1Ca5F88571A0c45807C3015c64"; -async function eth(_timestamp, ethBlock, chainBlocks) { - const balances = {} - await sumTokens(balances, [ - [yfdaiTokenAddress, YfDaiSafetradeStakingAddress], - [weth, wethVault], - [dai, daiVault], - ], ethBlock) - return balances -} - -async function staking(_timestamp, ethBlock, chainBlocks) { - const balances = {} - await sumTokens(balances, [ - [yfdaiTokenAddress, YfDaiETHLP72HRSVault], - [yfdaiTokenAddress, YfDaiETHLP30DayVault], - [yfdaiTokenAddress, YfDaiETHLP60DayVault], - [yfdaiTokenAddress, YfDaiETHLP90DayVault], - [yfdaiTokenAddress, impulsevenStakingAddress], - [yfdaiTokenAddress, YfDaiStakingAdddress] - ], ethBlock) - return balances -} - - module.exports = { - ethereum:{ - tvl: eth, - staking - }, + ethereum: { + tvl: sumTokensExport({ tokensAndOwners: [ + [yfdaiTokenAddress, YfDaiSafetradeStakingAddress], + [weth, wethVault], + [dai, daiVault], + ]}), + staking: staking([YfDaiStakingAdddress, YfDaiETHLP72HRSVault, YfDaiETHLP30DayVault, YfDaiETHLP60DayVault, YfDaiETHLP90DayVault, impulsevenStakingAddress,], yfdaiTokenAddress) + }, } diff --git a/projects/yieldflow/index.js b/projects/yieldflow/index.js index 867f5af47660..4f6f7dc694a3 100644 --- a/projects/yieldflow/index.js +++ b/projects/yieldflow/index.js @@ -1,3 +1,5 @@ +const ADDRESSES = require('../helper/coreAssets.json') + const abi = { "getCurrentTokenId": "function currentTokenId() view returns (uint)", "getPositions": "function positions(uint256 tokenId) view returns (uint96 nonce,address operator,address token0,address token1,uint24 fee,int24 tickLower,int24 tickUpper,uint128 liquidity,uint256 feeGrowthInside0LastX128,uint256 feeGrowthInside1LastX128,uint128 tokensOwed0,uint128 tokensOwed1)", @@ -64,6 +66,26 @@ const managers = [ '0xD4c68a094De7e1336E261c6EDD595F64cd70A064', '0x88609B69feDc0EEF4326c3390a8ae1b2073DcF03', '0xdcC4391042d462158C847f73F4232ce47A8F999c', + + '0xB67EFF6590D8457c870f84b5eA3B2CeEb7dbCD50', + '0xE7cC8F17295cb9975e3D9aB3798C4fe0AA378c5F', + '0xfb35BeDFB647c0445B9177aFFd6e7b81Bb8Ab9Bc', + + '0x590905F3adC1a16Af6A144Eaca57ba65760e93Cf', + '0x4568936B2846debb1Ed65122841A500B639f49A7', + '0x17263600ABccf294C6D0Ec02bCc23A240e883c7D', + + '0x1F73AbC7e254980AB26974C9A13c8493143F97Bc', + '0x599Dd6b1205E51fbcb2879105051C0EBbfa76b03', + '0xcC125F83BFe2A30F1BEfdf6E06043dB5a7a02A61', + + '0xd7F287266D0E057D0e64C126687154CB1db9610A', + '0x56E81D09b31572982019fDa2e284cFAe48BD5aAc', + '0xAf0ddFa27EcccF9f0358cAC2d18E4800b53063f4', + + '0x3Bd5B4422685F9321F0e5a8333067A4A049fC664', + '0x1AC1d8911BBb2Fed8fD736e3649FC363001C8e07', + '0x5ABf77610fabaD2DeF07A43eF6f66C1D2438dE7e', ] async function tvl(api) { @@ -73,11 +95,12 @@ async function tvl(api) { 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 ownerTokens = liquidities.map((v, i) => [[v.token0, v.token1, ADDRESSES.null], managers[i]]) liquidities.forEach((v, i) => { api.add(v.token0, tokenAmounts[i][0]) api.add(v.token1, tokenAmounts[i][1]) }) - return api.getBalances() + return api.sumTokens({ ownerTokens }) } module.exports = { @@ -93,11 +116,14 @@ const config = { '0x47Dd57DFe9e01616e4Adc28015243Ea6A2C09cEC', '0x0a4a169a6b2ac75c86e2F0e42822fdEA13fB1CC8', '0xafFA16b152232dAd8BF3AaDF6bb6F895A836F917', - '0xFB04d48e4CE9C042188Ef933ff4cf58921Ab59B8' + '0xFB04d48e4CE9C042188Ef933ff4cf58921Ab59B8', + '0x36232356758c746A50AD5078815F09e39E34628d', + '0xA0FDf5DC858ea552d51B4fa304e72cEB34e736fb', + '0xaC36A41da8f069C4874Dda60e073B5DcF889B56E' ] } } Object.keys(config).forEach(chain => { module.exports[chain] = { tvl } -}) \ No newline at end of file +}) diff --git a/projects/yieldnest/index.js b/projects/yieldnest/index.js index 353c76b42070..b0658cbde4c6 100644 --- a/projects/yieldnest/index.js +++ b/projects/yieldnest/index.js @@ -1,14 +1,24 @@ const ADDRESSES = require('../helper/coreAssets.json') -const token = '0x09db87a538bd693e9d08544577d5ccfaa6373a48' +const YN_ETH = '0x09db87a538bd693e9d08544577d5ccfaa6373a48' module.exports = { ethereum: { tvl: async (api) => { - const ethBalance = await api.call({ abi: 'uint256:totalAssets', target: token }) - api.add(ADDRESSES.null, ethBalance) - return api.getBalances() + const ynethBalance = await api.call({ abi: 'uint256:totalAssets', target: YN_ETH }) + api.add(ADDRESSES.null, ynethBalance) + const lsdRegistry = '0x323C933df2523D5b0C756210446eeE0fB84270fd' + const lsds = await api.call({ abi: 'address[]:getAssets', target: lsdRegistry }) + const bals = await api.call({ abi: 'function getAllAssetBalances() view returns (uint256[])', target: lsdRegistry }) + api.add(lsds, bals) + } + }, + bsc: { + tvl: async (api) => { + const ynBNB = '0x304B5845b9114182ECb4495Be4C91a273b74B509' + const ynBnbBalance = await api.call({ abi: 'uint256:totalAssets', target: ynBNB }) + api.add(ADDRESSES.null, ynBnbBalance) } }, } \ No newline at end of file diff --git a/projects/yieldwolf/index.js b/projects/yieldwolf/index.js index 22782306ded6..856cc19b95b2 100644 --- a/projects/yieldwolf/index.js +++ b/projects/yieldwolf/index.js @@ -1,105 +1,33 @@ -const sdk = require("@defillama/sdk"); const abi = require("./abi.json"); -const { unwrapLPsAuto } = require("../helper/unwrapLPs"); -const { - getChainTransform, -} = require("../helper/portedTokens"); +const { sumTokens2 } = require("../helper/unwrapLPs"); -const vaultsContractPolygon = "0xBF65023BcF48Ad0ab5537Ea39C9242de499386c9"; -const ignoreAddresses_polygon = ["0x0B048D6e01a6b9002C291060bF2179938fd8264c"]; - -const vaultsContractFantom = "0x876F890135091381c23Be437fA1cec2251B7c117"; -const vaultsContractCelo = "0xd54AA6fEeCc289DeceD6cd0fDC54f78079495E79"; -const vaultsContractAvax = "0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9"; -const vaultsContractCronos = "0x8fEc7A778Cba11a98f783Ebe9826bEc3b5E67F95"; -const vaultsContractHarmony = "0x8fec7a778cba11a98f783ebe9826bec3b5e67f95"; -const vaultsContractBsc = "0xD3aB90CE1eEcf9ab3cBAE16A00acfbace30EbD75"; - -const calcTvl = async (chain, block, masterchef, ignoreAddresses = []) => { - const balances = {} - const transformAddress = await getChainTransform(chain) - const poolLength = ( - await sdk.api.abi.call({ abi: abi.poolLength, target: masterchef, chain, block, }) - ).output; - const calls = [] - for (let index = 0; index < poolLength; index++) - calls.push({ params: index }) - - const { output: res } = await sdk.api.abi.multiCall({ - target: masterchef, - abi: abi.poolInfo, - calls: calls, - chain, block, - }); - - const stratCalls = res.map(i => ({ target: i.output.strategy })) - - const { output: stratResponse } = await sdk.api.abi.multiCall({ - abi: abi.totalStakeTokens, - calls: stratCalls, - chain, block, - }); - - res.forEach(({ output }, i) => { - const token = output.stakeToken - if (ignoreAddresses.some((addr) => addr.toLowerCase() === token.toLowerCase())) return; - sdk.util.sumSingleBalance(balances, transformAddress(token), stratResponse[i].output) - }) - - await unwrapLPsAuto({ balances, block, chain, transformAddress }) - return balances -}; - -const polygonTvl = async (ts, _, chainBlocks) => { - return calcTvl("polygon", chainBlocks["polygon"], vaultsContractPolygon, ignoreAddresses_polygon); -}; - -const fantomTvl = async (ts, _, chainBlocks) => { - return calcTvl("fantom", chainBlocks["fantom"], vaultsContractFantom,); -}; - -const celoTvl = async (ts, _, chainBlocks) => { - return calcTvl("celo", chainBlocks["celo"], vaultsContractCelo,); -}; - -const avaxTvl = async (ts, _, chainBlocks) => { - return calcTvl("avax", chainBlocks["avax"], vaultsContractAvax,); -}; - -const cronosTvl = async (ts, _, chainBlocks) => { - return calcTvl("cronos", chainBlocks["cronos"], vaultsContractCronos,); -}; - -const harmonyTvl = async (ts, _, chainBlocks) => { - return calcTvl("harmony", chainBlocks["harmony"], vaultsContractHarmony,); -}; - -const bscTvl = async (ts, _, chainBlocks) => { - return calcTvl("bsc", chainBlocks["bsc"], vaultsContractBsc,); -}; +const blacklistedTokens = ["0x0B048D6e01a6b9002C291060bF2179938fd8264c"]; module.exports = { misrepresentedTokens: true, - polygon: { - tvl: polygonTvl, - }, - fantom: { - tvl: fantomTvl, - }, - celo: { - tvl: celoTvl, - }, - avax: { - tvl: avaxTvl, - }, - cronos: { - tvl: cronosTvl, - }, - harmony: { - tvl: harmonyTvl, - }, - bsc: { - tvl: bscTvl, - }, methodology: "We count liquidity on all the Vaults through YieldWolf Contracts", -}; +} + +const config = { + polygon: '0xBF65023BcF48Ad0ab5537Ea39C9242de499386c9', + fantom: '0x876F890135091381c23Be437fA1cec2251B7c117', + celo: '0xd54AA6fEeCc289DeceD6cd0fDC54f78079495E79', + avax: '0xc9070B3EFE0aacC5AfB4B31C5DbDCA7C6B4bAAA9', + cronos: '0x8fEc7A778Cba11a98f783Ebe9826bEc3b5E67F95', + harmony: '0x8fec7a778cba11a98f783ebe9826bec3b5e67f95', + bsc: '0xD3aB90CE1eEcf9ab3cBAE16A00acfbace30EbD75', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = { + tvl: async (api) => { + const poolInfos = await api.fetchList({ lengthAbi: abi.poolLength, itemAbi: abi.poolInfo, target: config[chain]}) + const strategies = poolInfos.map(i => i.strategy) + const tokens = poolInfos.map(i => i.stakeToken) + const bals = await api.multiCall({ abi: abi.totalStakeTokens, calls: strategies}) + api.add(tokens, bals) + blacklistedTokens.forEach(token => api.removeTokenBalance(token)) + return sumTokens2({ api, resolveLP: true }) + } + } +}) \ No newline at end of file diff --git a/projects/zencha/index.js b/projects/zencha/index.js index ba465503945b..4561a451f61e 100644 --- a/projects/zencha/index.js +++ b/projects/zencha/index.js @@ -1,55 +1,10 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens } = require("../helper/unwrapLPs"); +const { sumTokensExport } = require("../helper/unwrapLPs"); const swapFlashLoan = '0x2D027B49B8960810F84D5fE172d07FFf62311852'; -const tokens = { - DAI: { - boba: ADDRESSES.boba.DAI, - eth: ADDRESSES.ethereum.DAI - }, - USDT: { - boba: ADDRESSES.boba.USDT, - eth: ADDRESSES.ethereum.USDT - }, - USDC: { - boba: ADDRESSES.boba.USDC, - eth: ADDRESSES.ethereum.USDC - } -}; - -function transform(address) { - for (let token of Object.keys(tokens)) { - if (tokens[token].boba == address) { - return tokens[token].eth; - } - } - - return address; -} - -async function tvl(timestamp, block, chainBlocks) { - block = chainBlocks.boba; - const balances = {}; - - await sumTokens( - balances, - [ - [tokens.DAI.boba, swapFlashLoan], - [tokens.USDT.boba , swapFlashLoan], - [tokens.USDC.boba , swapFlashLoan], - ], - block, - "boba", - transform - ); - - return balances; -} - module.exports = { boba: { - tvl + tvl: sumTokensExport({ owner: swapFlashLoan, tokens: [ADDRESSES.boba.USDC, ADDRESSES.boba.USDT, ADDRESSES.boba.DAI] }), } -}; -// node test.js projects/zencha/index.js \ No newline at end of file +} \ No newline at end of file diff --git a/projects/zenolend/index.js b/projects/zenolend/index.js new file mode 100644 index 000000000000..995ab153320f --- /dev/null +++ b/projects/zenolend/index.js @@ -0,0 +1,10 @@ + +const { compoundExports2 } = require('../helper/compound') + +const config = { + apechain: '0xc2C583093Af9241E17B2Ec51844154468D21bF6F', +} + +Object.keys(config).forEach(chain => { + module.exports[chain] = compoundExports2({ comptroller: config[chain] }) +}); \ No newline at end of file diff --git a/projects/zero1-labs/index.js b/projects/zero1-labs/index.js index 488fb7619e69..de777e952ea9 100644 --- a/projects/zero1-labs/index.js +++ b/projects/zero1-labs/index.js @@ -8,6 +8,7 @@ module.exports = { "0x7AabE771aCcAa3F54a1B7c05d65c6E55d0Cd0Af6", "0x88062FE2751f3D5cEC18F6113A532A611632ae79", "0x8DBA1f564458dd46283ca3a4CDf6CA019963aB42", + "0x68605AA964F25aC8c7C159331F9dF050321FDcc6", ], "0x1495bc9e44Af1F8BCB62278D2bEC4540cF0C05ea"), }, } diff --git a/projects/zerolend/index.js b/projects/zerolend/index.js index 6f56ea6d819e..09c30da8273f 100644 --- a/projects/zerolend/index.js +++ b/projects/zerolend/index.js @@ -1,14 +1,25 @@ +const sdk = require('@defillama/sdk') const { aaveExports } = require("../helper/aave"); const { staking } = require("../helper/staking"); const { pool2s } = require("../helper/pool2"); const config = { - era: "0xB73550bC1393207960A385fC8b34790e5133175E", - manta: "0x67f93d36792c49a4493652B91ad4bD59f428AD15", - blast: "0xc6DF4ddDBFaCb866e78Dcc01b813A41C15A08C10", - linea: "0x67f93d36792c49a4493652B91ad4bD59f428AD15", - xlayer: "0x97e59722318F1324008484ACA9C343863792cBf6", - ethereum: "0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf", + era: ["0xB73550bC1393207960A385fC8b34790e5133175E"], + manta: ["0x67f93d36792c49a4493652B91ad4bD59f428AD15"], + blast: ["0xc6DF4ddDBFaCb866e78Dcc01b813A41C15A08C10"], + base: ["0xA754b2f1535287957933db6e2AEE2b2FE6f38588"], + linea: [ + "0x67f93d36792c49a4493652B91ad4bD59f428AD15", // main linea market + '0x9aFB91a3cfB9aBc8Cbc8429aB57b6593FE36E173', // croak linea market + '0xEe9ec60657B714E3FAC5255a5443AC5EC7Ba5bB0', // foxy linea market + ], + xlayer: ["0x97e59722318F1324008484ACA9C343863792cBf6"], + zircuit: ["0xA754b2f1535287957933db6e2AEE2b2FE6f38588"], + ethereum: [ + "0x47223D4eA966a93b2cC96FFB4D42c22651FADFcf", // ethereum lrt market + '0x31063F7CA8ef4089Db0dEdf8D6e35690B468A611', // bitcoin lrt market + '0x298ECDcb0369Aef75cBbdA3e46a224Cfe622E287' // stablecoin rwa market + ], }; const linea = { @@ -23,7 +34,11 @@ const linea = { const data = {}; Object.keys(config).forEach((chain) => { - data[chain] = aaveExports(chain, undefined, undefined, [config[chain]]); + const chainExports = config[chain].map((address) => aaveExports(chain, undefined, undefined, [address])) + data[chain] = { + tvl: sdk.util.sumChainTvls(chainExports.map(i => i.tvl)), + borrowed: sdk.util.sumChainTvls(chainExports.map(i => i.borrowed)) + } }); data.linea.staking = staking(linea.zeroLocker, linea.zero, "linea"); diff --git a/projects/zest-protocol/index.js b/projects/zest-protocol/index.js index dee057d6a7f5..7f134eb7cf9d 100644 --- a/projects/zest-protocol/index.js +++ b/projects/zest-protocol/index.js @@ -1,176 +1,10 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const Abis = require("./abi.json"); -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); - -const Contracts = { - fantom: { - wftm: ADDRESSES.fantom.WFTM, - wethBank: "0xB717b014BC34fc904396585CbF4FC1B0BBe603B4", - weth: "0x74b23882a30290451A17c44f4F05243b6b58C76d", - zsp: "0x2C26617034C840C9412CD67aE0Fc68A6755D00BF", - ftmz: "0x9e219b51891e2c62ea8a2ea438d331eae7c68484", - usdc: ADDRESSES.fantom.USDC, - bank: "0x9fc3E5259Ba18BD13366D0728a256E703869F21D", - multiFeeDistribution: "0x1b6deD5c603d66800B0DDf566Ec316a344C7BcaD", - chef: "0xFdAa392FCF8946e8e658B9f36ffbE6659cB40edf", - wftmLps: [ - { - address: "0xcAa542473912a727C7F6715458db8C5f9b0291FC", // ZSP-WFTM - isToken0: true, - }, - { - address: "0xd02cc84b296ef3332Ca9371fC633bB7D7a51ad32", // FTMz-WFTM - isToken0: true, - }, - ], - wethLps: [ - { - address: "0x4f9b08C06A19EBee8871C3b563C38326927Ac945", // ETHz-WETH - isToken0: true, - }, - ], - usdcLps: [ - { - address: "0x2ABDC15324a38093e07b9EBF7c15bD8e672E212e", // ZSP-USDC - isToken0: true, - }, - ], - }, -}; - -async function calcTvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks.fantom; - const chain = "fantom"; - - const bankBalance = await sdk.api.abi.call({ - target: Contracts.fantom.bank, - abi: Abis.bank.usableCollateralBalance, - chain: chain, - block, - }); - - const bankBalanceWeth = await sdk.api.abi.call({ - target: Contracts.fantom.wethBank, - abi: Abis.bank.usableCollateralBalance, - chain: chain, - block, - }); - - return { - [`fantom:${Contracts.fantom.wftm}`]: +bankBalance.output, - [`fantom:${Contracts.fantom.weth}`]: +bankBalanceWeth.output, - }; -} - -async function calcStakingTvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks.fantom; - const chain = "fantom"; - - const stakingData = await sdk.api.abi.call({ - target: Contracts.fantom.multiFeeDistribution, - abi: Abis.multiFeeDistribution.totalSupply, - chain: chain, - block, - }); - - return { - [`fantom:${Contracts.fantom.zsp}`]: stakingData.output, - }; -} - -async function calcLp(lps, block, chain, baseToken) { - const reserves = ( - await sdk.api.abi.multiCall({ - calls: lps.map((lp) => ({ - target: lp.address, - params: [], - })), - abi: Abis.pair.getReserves, - block, - chain, - }) - ).output; - const totalSupplies = ( - await sdk.api.abi.multiCall({ - calls: lps.map((lp) => ({ - target: lp.address, - params: [], - })), - abi: "erc20:totalSupply", - block, - chain, - }) - ).output; - const balances = ( - await sdk.api.abi.multiCall({ - calls: lps.map((lp) => ({ - target: lp.address, - params: [Contracts.fantom.chef], - })), - abi: "erc20:balanceOf", - block, - chain, - }) - ).output; - - const results = lps.map((lp, index) => - new BigNumber( - reserves[index].output[lp.isToken0 ? "_reserve0" : "_reserve1"] - ) - .times(2) - .times(new BigNumber(balances[index].output)) - .idiv(new BigNumber(totalSupplies[index].output)) - ); - - const total = results.reduce( - (total, num) => total.plus(num), - new BigNumber(0) - ); - - return { - [`fantom:${baseToken}`]: total.toString(10), - }; -} - -async function ftmPool2(timestamp, block, chainBlocks) { - const zsp = await calcLp( - Contracts.fantom.wftmLps, - chainBlocks.fantom, - "fantom", - Contracts.fantom.zsp - ); - - const ftmz = await calcLp( - Contracts.fantom.wftmLps, - chainBlocks.fantom, - "fantom", - Contracts.fantom.wftm - ); - - const weth = await calcLp( - Contracts.fantom.wethLps, - chainBlocks.fantom, - "fantom", - Contracts.fantom.weth - ); - - const usdc = await calcLp( - Contracts.fantom.usdcLps, - chainBlocks.fantom, - "fantom", - Contracts.fantom.usdc - ); - - return { ...zsp, ...ftmz, ...weth, ...usdc }; -} - module.exports = { methodology: "TVL of collateral added to Zest Protocol in order to mint Synthetic Assets.", + deadFrom: '2022-08-10', fantom: { - tvl: calcTvl, - pool2: ftmPool2, - staking: calcStakingTvl, + tvl: () => ({}), + pool2: () => ({}), + staking: () => ({}), }, }; diff --git a/projects/zetaEarn/index.js b/projects/zetaEarn/index.js index 4411f0b53d2d..937c715b1829 100644 --- a/projects/zetaEarn/index.js +++ b/projects/zetaEarn/index.js @@ -1,6 +1,18 @@ -async function tvl(api) { +async function zetaTvl(api) { api.addGasToken(await api.call({target: '0x45334a5b0a01ce6c260f2b570ec941c680ea62c0', abi: 'uint256:getTotalPooledZETA'})) - } -module.exports = { zeta: { tvl } } \ No newline at end of file +const btrZTokens = [ + '0xd53E6f1d37f430d84eFad8060F9Fec558B36F6fa', // zbtc + '0xdc842A54dB9E6136c7972eA863Efd6CE0d45602c', // zordi + '0xb86e3Cc68d9C56E1b87DEddF49c4A6fdaaF04A82' // zsats +]; + +async function btrTvl(api) { + for (const token of btrZTokens) { + const supply = await api.call({ abi: 'uint256:totalSupply', target: token }); + api.add(token, supply); + } +} + +module.exports = { zeta: { tvl: zetaTvl }, btr: { tvl: btrTvl } } diff --git a/projects/zigzag/index.js b/projects/zigzag/index.js index 1e5c7905e50c..af400ea6a802 100644 --- a/projects/zigzag/index.js +++ b/projects/zigzag/index.js @@ -1,20 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { get } = require('../helper/http') -const { toUSDTBalances } = require('../helper/balances') const { sumTokensExport } = require('../helper/unwrapLPs') -async function offers() { - const markets = await get('https://zigzag-exchange.herokuapp.com/api/v1/markets') - const marketInfos = await get('https://zigzag-exchange.herokuapp.com/api/v1/marketinfos?chain_id=1&market=' + Object.keys(markets).join(',')) - let total = 0 - Object.keys(markets).forEach(market => { - const info = marketInfos[market] - const { baseVolume, quoteVolume } = markets[market] - if (!info) return; - total += baseVolume * info.baseAsset.usdPrice + quoteVolume * info.quoteAsset.usdPrice - }) - return toUSDTBalances(total) -} module.exports = { timetravel: false, diff --git a/projects/zilswap.js b/projects/zilswap.js index bdf561a99c3d..a517f2c1a72a 100644 --- a/projects/zilswap.js +++ b/projects/zilswap.js @@ -14,5 +14,4 @@ module.exports = { methodology: `ZilSwap TVL is achieved by making a call to its API: https://stats.zilswap.org/liquidity`, misrepresentedTokens: true, timetravel: false, - incentivized: true, } diff --git a/projects/zircuit-chain/index.js b/projects/zircuit-chain/index.js new file mode 100644 index 000000000000..ee2044a19d62 --- /dev/null +++ b/projects/zircuit-chain/index.js @@ -0,0 +1,17 @@ +const { sumTokens2 } = require("../helper/unwrapLPs"); + +module.exports = { + ethereum: { + tvl: (api) => + sumTokens2({ + api, + owners: ['0x17bfAfA932d2e23Bd9B909Fd5B4D2e2a27043fb1', '0x386B76D9cA5F5Fb150B6BFB35CF5379B22B26dd8'], + fetchCoValentTokens: true, + permitFailure: true, + blacklistedTokens: ['0xfd418e42783382e86ae91e445406600ba144d162'] + }), + staking: (api) => sumTokens2({ + api, owner: '0x386B76D9cA5F5Fb150B6BFB35CF5379B22B26dd8', token: '0xfd418e42783382e86ae91e445406600ba144d162', + }) + }, +}; diff --git a/projects/zircuit/index.js b/projects/zircuit/index.js index dc8ef0a2ae08..8f06809941bf 100644 --- a/projects/zircuit/index.js +++ b/projects/zircuit/index.js @@ -1,39 +1,23 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokensExport } = require("../helper/unwrapLPs"); +const { getLogs2 } = require('../helper/cache/getLogs'); +const { sumTokens2 } = require('../helper/unwrapLPs'); -const ZIRCUIT_STAKING_CONTRACT = '0xf047ab4c75cebf0eb9ed34ae2c186f3611aeafa6'; +const config = { + ethereum: { + factory: '0xf047ab4c75cebf0eb9ed34ae2c186f3611aeafa6', fromBlock: 19237243, missing: [ + '0xa1290d69c65a6fe4df752f95823fae25cb99e5a7', + '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110', + ] + }, + zircuit: { factory: '0x7d8311839eB44Dd5194abd2dd3998722455A24E0', fromBlock: 2427557, }, +} -const TOKEN_CONTRACTS = [ - '0xa1290d69c65a6fe4df752f95823fae25cb99e5a7', // rsETH - '0xbf5495Efe5DB9ce00f80364C8B423567e58d2110', // ezETH - '0x8c1BEd5b9a0928467c9B1341Da1D7BD5e10b6549', // lsETH - ADDRESSES.ethereum.WETH, // ETH - '0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0', // rswETH - '0x49446A0874197839D15395B908328a74ccc96Bc0', // mstETH - '0xE46a5E19B19711332e33F33c2DB3eA143e86Bc10', // mwBETH - '0x32bd822d615A3658A68b6fDD30c2fcb2C996D678', // mswETH - ADDRESSES.ethereum.WSTETH, // wstETH - '0xCd5fE23C85820F7B72D0926FC9b05b43E359b7ee', // weETH - '0xf951E335afb289353dc249e82926178EaC7DEd78', // swETH - ADDRESSES.ethereum.USDe, // USDe - ADDRESSES.ethereum.STONE, // cSTONE - '0xd5F7838F5C461fefF7FE49ea5ebaF7728bB0ADfa', // mETH - '0xD9A442856C234a39a81a089C06451EBAa4306a72', // pufETH - '0x18f313Fc6Afc9b5FD6f0908c1b3D476E3feA1DD9', // egETH - '0x5fD13359Ba15A84B76f7F87568309040176167cd', // amphrETH - '0x7a4EffD87C2f3C55CA251080b1343b605f327E3a', // rstETH - '0xBEEF69Ac7870777598A04B2bd4771c71212E6aBc', // steakLRT - '0x84631c0d0081FDe56DeB72F6DE77abBbF6A9f93a', // Re7LRT - '0x8c9532a60E0E7C6BbD2B2c1303F63aCE1c3E9811', // pzETH - '0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e', // pumpBTC - '0x917ceE801a67f933F2e6b33fC0cD1ED2d5909D88' // weETHs -]; - -module.exports = { - ethereum: { - tvl: sumTokensExport({ - owner: ZIRCUIT_STAKING_CONTRACT, - tokens: TOKEN_CONTRACTS, - }), +Object.keys(config).forEach(chain => { + const { factory, fromBlock, missing = [] } = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const logs = await getLogs2({ api, factory, eventAbi: 'event TokenStakabilityChanged(address token, bool enabled)', fromBlock, }) + const tokens = logs.map(i => i.token).concat(missing) + return sumTokens2({ api, owner: factory, tokens, permitFailure: true, }) } -}; \ No newline at end of file + } +}) \ No newline at end of file diff --git a/projects/zkLink/index.js b/projects/zkLink/index.js index 3c3ec06b6055..b567f98bf22a 100644 --- a/projects/zkLink/index.js +++ b/projects/zkLink/index.js @@ -1,5 +1,6 @@ const { sumTokens2 } = require("../helper/unwrapLPs"); const ADDRESSES = require("../helper/coreAssets.json"); +const { staking } = require("../helper/staking.js"); const config = { ethereum: { @@ -134,3 +135,7 @@ async function tvl(api) { Object.keys(config).forEach(async chain => { module.exports[chain] = { tvl } }) +module.exports.ethereum.staking = staking( + '0xAd16eDCF7DEB7e90096A259c81269d811544B6B6', + '0xfC385A1dF85660a7e041423DB512f779070FCede' +); \ No newline at end of file diff --git a/projects/zkSwap-finance-stableswap/index.js b/projects/zkSwap-finance-stableswap/index.js new file mode 100644 index 000000000000..92ea9e093dec --- /dev/null +++ b/projects/zkSwap-finance-stableswap/index.js @@ -0,0 +1,35 @@ +const { getLogs2 } = require('../helper/cache/getLogs') + +module.exports = { + methodology: + "TVL accounts for the liquidity on all StableSwap pools.", +} + +const config = { + era: [{ target: '0xc93397F26886daB0d752C86612C78dbd2C1d5a59', fromBlock: 48190039, token3: true, },], +} + +Object.keys(config).forEach(chain => { + const factories = config[chain] + module.exports[chain] = { + tvl: async (api) => { + const configs = await Promise.all(factories.map(getTvlConfig)) + return api.sumTokens({ ownerTokens: configs.flat() }) + + async function getTvlConfig({ target, fromBlock, token3 }) { + let topic = '0xa9551fb056fc743efe2a0a34e39f9769ad10166520df7843c09a66f82e148b97' + let eventAbi = 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)' + let getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB], i.swapContract])) + + if (token3) { + topic = '0x48dc7a1b156fe3e70ed5ed0afcb307661905edf536f15bb5786e327ea1933532' + eventAbi = 'event NewStableSwapPair(address indexed swapContract, address tokenA, address tokenB, address tokenC, address LP)' + getOwnTokens = logs => logs.map(i => ([[i.tokenA, i.tokenB, i.tokenC], i.swapContract])) + } + + const logs = await getLogs2({ api, target, fromBlock, eventAbi }) + return getOwnTokens(logs) + } + } + } +}) \ No newline at end of file diff --git a/projects/zkSwap-finance-v3/index.js b/projects/zkSwap-finance-v3/index.js new file mode 100644 index 000000000000..bdcfdbc69eb8 --- /dev/null +++ b/projects/zkSwap-finance-v3/index.js @@ -0,0 +1,5 @@ +const { uniV3Export } = require('../helper/uniswapV3') + +module.exports = uniV3Export({ + era: { factory: '0x88ADD6a7e3C221e02f978B388a092c9FD8cd7850', fromBlock: 49205949 }, +}) diff --git a/projects/zkfairswap/index.js b/projects/zkfairswap/index.js index c9145bae5382..856b5a40565f 100644 --- a/projects/zkfairswap/index.js +++ b/projects/zkfairswap/index.js @@ -1,3 +1,3 @@ const { uniTvlExport } = require('../helper/unknownTokens') -module.exports = uniTvlExport( "zkfair", "0xeA70460a5B0E3A94EC05b1AaFCe9e6Eb11C334A0", { fetchBalances: true } ); +module.exports = uniTvlExport( "zkfair", "0xeA70460a5B0E3A94EC05b1AaFCe9e6Eb11C334A0" ); diff --git a/projects/zkfinance/index.js b/projects/zkfinance/index.js index 1ba6e29c4e40..a5f3d04b8a0e 100644 --- a/projects/zkfinance/index.js +++ b/projects/zkfinance/index.js @@ -6,6 +6,5 @@ module.exports = { era: compoundExports2({ comptroller: zksyncComptroller, cether: zkEther, - fetchBalances: true, }), }; diff --git a/projects/zklend/abi.js b/projects/zklend/abi.js index 586b6da1cb47..be9c79fd6b33 100644 --- a/projects/zklend/abi.js +++ b/projects/zklend/abi.js @@ -20,7 +20,37 @@ const market = [ ] const marketAbi = {} market.forEach(i => marketAbi[i.name] = i) +const staking = [ + { + name: "core::integer::u256", + type: "struct", + members: [ + { + name: "low", + type: "core::integer::u128", + }, + { + name: "high", + type: "core::integer::u128", + }, + ], + }, + { + "type": "function", + "name": "get_total_staked_amount", + "inputs": [], + "outputs": [ + { + "type": "core::integer::u256" + } + ], + "state_mutability": "view" + }, +] +const stakingAbi = {} +staking.forEach(i => stakingAbi[i.name] = i) module.exports = { - marketAbi + marketAbi, + stakingAbi, } \ No newline at end of file diff --git a/projects/zklend/index.js b/projects/zklend/index.js index 61e5138e09bd..721c7b96a298 100644 --- a/projects/zklend/index.js +++ b/projects/zklend/index.js @@ -1,44 +1,42 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { multiCall, sumTokens } = require('../helper/chain/starknet') -const { marketAbi } = require('./abi'); +const { multiCall, sumTokens, call } = require('../helper/chain/starknet') +const { marketAbi, stakingAbi, } = require('./abi'); const market = '0x4c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05' +const stakingContract = '0x0212c219a68c8fe38f37951123d1ec877570dfa891de270aa4f8634c5e60bc23' const assets = [ - ADDRESSES.starknet.WBTC, - ADDRESSES.starknet.ETH, - ADDRESSES.starknet.USDC, - ADDRESSES.starknet.DAI, - ADDRESSES.starknet.USDT, - ADDRESSES.starknet.WSTETH, - ADDRESSES.starknet.STRK + ADDRESSES.starknet.WBTC, + ADDRESSES.starknet.ETH, + ADDRESSES.starknet.USDC, + ADDRESSES.starknet.DAI, + ADDRESSES.starknet.DAI_1, + ADDRESSES.starknet.USDT, + ADDRESSES.starknet.WSTETH, + ADDRESSES.starknet.STRK ] async function tvl(api) { - return sumTokens({ api, owner: market, tokens: assets }) + return sumTokens({ api, owner: market, tokens: assets }) } async function staking(api) { - return sumTokens({ - api, - owner: market, - tokens: [ - ADDRESSES.starknet.ZEND - ] - }) + const amountStakedAtStakingContract = await call({ target: stakingContract, abi: stakingAbi.get_total_staked_amount }) + api.add(ADDRESSES.starknet.ZEND, amountStakedAtStakingContract) + return sumTokens({ api, owner: market, tokens: [ADDRESSES.starknet.ZEND] }) } async function borrowed(api) { - let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); - data = data.map(i => +i) - api.addTokens(assets, data) + let data = await multiCall({ calls: assets, target: market, abi: marketAbi.get_total_debt_for_token }); + data = data.map(i => +i) + api.addTokens(assets, data) } module.exports = { - methodology: 'Value of user supplied asset on zkLend is considered as TVL', - starknet: { - tvl, - borrowed, - staking, - }, + methodology: 'Value of user supplied asset on zkLend is considered as TVL', + starknet: { + tvl, + borrowed, + staking, + }, } diff --git a/projects/zks-miner/index.js b/projects/zks-miner/index.js index 9591eaf13e12..8677befd7bdc 100644 --- a/projects/zks-miner/index.js +++ b/projects/zks-miner/index.js @@ -13,4 +13,5 @@ module.exports = { era: { tvl: sumTokensExport({ owners: [SILVER_MINER, DIAMOND_MINER, GOLD_MINER,], tokens: [nullAddress] }) }, + deadFrom: 1682726400 } diff --git a/projects/zomb2/index.js b/projects/zomb2/index.js index 54cd40a12a18..0c3df29c1164 100644 --- a/projects/zomb2/index.js +++ b/projects/zomb2/index.js @@ -1,5 +1,5 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { zombiTvl } = require("../zombi/zombi"); +const { zombiTvl } = require("../zomb2/zombi"); const token = "0xA87bcE04d4a396DF40cC1be3a21CF04592C08290"; const share = "0x9E594379bC7e2034fCc8607Fb8C57F149Fb68284"; diff --git a/projects/zombi/zombi.js b/projects/zomb2/zombi.js similarity index 100% rename from projects/zombi/zombi.js rename to projects/zomb2/zombi.js diff --git a/projects/zombi/index.js b/projects/zombi/index.js index c8f7f81b8f32..cfd01c10d007 100644 --- a/projects/zombi/index.js +++ b/projects/zombi/index.js @@ -1,26 +1,11 @@ -const ADDRESSES = require('../helper/coreAssets.json') -const { zombiTvl } = require("./zombi"); - -const token = "0xda5db6c2a2fd53a2d3fc4246bbd8acce5f93bae1"; -const share = "0xb3584d821109e49a068a8c3a05f367bc54061252"; -const rewardPool = "0x3E6a10C75d33D4fF95A33342d33A73176Bcd0629"; -const rewardPoolGeneris = "0xDa0cB4684b02D8bB253Af60a942625D1BC9Ba53d"; -const masonry = "0x4E2950365024D27956538AB27C97083634DDBE90"; - -const pool2LPs = [ - "0xe577DF94b4Ea94399B7438e27EA1Ba81717464A0", - "0x5db45a30732cf98fda72b9b91a0c554dc1f2e83b" -]; -const listedTokenGeneris = [ - ADDRESSES.fantom.WFTM,//wftm - '0x74b23882a30290451A17c44f4F05243b6b58C76d',//weth - '0x841FAD6EAe12c286d1Fd18d1d525DFfA75C7EFFE',//boo - '0xaD996A45fd2373ed0B10Efa4A8eCB9de445A4302'//alpaca -] - module.exports = { hallmarks: [ [1646870400, "Rug Pull"] ], - ...zombiTvl(token, share, rewardPool, rewardPoolGeneris, masonry, pool2LPs, listedTokenGeneris, "fantom", undefined, false, "0xe577DF94b4Ea94399B7438e27EA1Ba81717464A0") + deadFrom: 1646870400, + fantom: { + tvl: () => ({}), + pool2: () => ({}), + staking: () => ({}), + }, } diff --git a/projects/zombie-network/index.js b/projects/zombie-network/index.js index 1a34a8c9edb4..2cc2b3a6154d 100644 --- a/projects/zombie-network/index.js +++ b/projects/zombie-network/index.js @@ -1,45 +1,28 @@ const sdk = require("@defillama/sdk"); -const { getChainTransform } = require("../helper/portedTokens"); const BLOOD_TOKEN_ADDR = "0x07709260f6C431bc2CB1480F523F4F7c639a5155"; const FOUNTAIN_ADDR = "0x028c7738353a939E654bBDf5Bd57EbB17755cfa0"; const VAULT_ADDR = "0xD7656b90263f6ceaB35370d37f08fD1aEc19A421"; -const chain = 'klaytn' -let balanceResolve +async function staking(api) { -function getTvlPromise(key) { - return async (ts, _block, chainBlocks) => { - if (!balanceResolve) - balanceResolve = getTvl(ts, _block, chainBlocks) - return (await balanceResolve)[key] - } -} -async function getTvl(timestamp, ethBlock, chainBlocks) { - const block = chainBlocks[chain] - const transform = await getChainTransform(chain); - - const balances = { - staking: {}, - pool2: {}, - tvl: {} - } + const { output: klayBalance } = await sdk.api2.eth.getBalance({ target: FOUNTAIN_ADDR, ...api }) + const [bldBalance, stakingBalance] = await api.multiCall({ abi: 'erc20:balanceOf', calls: [FOUNTAIN_ADDR, VAULT_ADDR], target: BLOOD_TOKEN_ADDR }) - const { output: klayBalance } = await sdk.api.eth.getBalance({ target: FOUNTAIN_ADDR, block, chain}) - const { output: bldBalance } = await sdk.api.erc20.balanceOf({ target: BLOOD_TOKEN_ADDR, owner: FOUNTAIN_ADDR, block, chain}) - const { output: stakingBalance } = await sdk.api.erc20.balanceOf({ target: BLOOD_TOKEN_ADDR, owner: VAULT_ADDR, block, chain}) - - const pool2Balance = klayBalance * 2 / 10 ** 18 const bloodPrice = klayBalance / bldBalance - const staking = stakingBalance * bloodPrice / 10 ** 18 - sdk.util.sumSingleBalance(balances.pool2, 'klay-token', pool2Balance ) - sdk.util.sumSingleBalance(balances.staking, 'klay-token', staking ) + const staking = stakingBalance * bloodPrice / 1e18 + console.log('staking', staking, klayBalance, bldBalance, stakingBalance, bloodPrice) + api.addCGToken('klay-token', staking) +} - return balances +async function pool2(api) { + const { output: klayBalance } = await sdk.api2.eth.getBalance({ target: FOUNTAIN_ADDR, ...api }) + const pool2Balance = klayBalance * 2 / 1e18 + api.addCGToken('klay-token', pool2Balance) } module.exports = { - klaytn: - ['tvl', 'staking', 'pool2'] - .reduce((acc, key) => ({ ...acc, [key]: getTvlPromise(key) }), {}), + klaytn: { + tvl: () => ({}), staking, pool2, + } }; diff --git a/projects/zomma/index.js b/projects/zomma/index.js index 2c3ef3a96d6f..949b4741d296 100644 --- a/projects/zomma/index.js +++ b/projects/zomma/index.js @@ -5,11 +5,25 @@ const ZOMMA_CONTRACT_ALPHA = "0x709051774c60c0527dbaf880f41425eae036efaf"; const ZOMMA_CONTRACT_BETA = "0x7bf1f1c2d8caa200b068747487cb9bf109e529f1"; const ZOMMA_CONTRACT_ETH_AUDIT = "0xdd5ae451a75a654146747235fdb515f06a55d018"; const ZOMMA_CONTRACT_BTC_AUDIT = "0x1f14544aea89046e068e98c8672d2fbc3ab45bab"; -const USDC_CONTRACT = ADDRESSES.era.USDC; +const ZK_USDC_CONTRACT = ADDRESSES.era.USDC; + +const ZOMMA_ARB_VAULT = "0x452610BB258c143B5f26687286AE5e59EC69c267"; +const ZOMMA_ARB_VAULT2 = "0xF55DF159c030b2804269742853079c9FD6B8cf64" +const ZOMMA_ARB_CONTRACT_ETH = "0xa9DEb981b735EC0525c8D4C959267429FdD82347"; +const ZOMMA_ARB_CONTRACT_BTC = "0x275376e25e068c894d0df5cc9a3d1893d94e9f4a"; +const ARB_USDC_CONTRACT = ADDRESSES.arbitrum.USDC_CIRCLE; +const ARB_AAVE_USDC_CONTRACT = "0x724dc807b04555b71ed48a6896b6F41593b8C637"; +const ARB_AAVE_GHO_CONTRACT = "0xeBe517846d0F36eCEd99C735cbF6131e1fEB775D"; module.exports = { methodology: "TVL is calculated as the sum of USDC deposited by traders and the liquidity in the Pools.", + arbitrum: { + tvl: sumTokensExport({ + owners: [ZOMMA_ARB_VAULT, ZOMMA_ARB_VAULT2, ZOMMA_ARB_CONTRACT_ETH, ZOMMA_ARB_CONTRACT_BTC], + tokens: [ARB_USDC_CONTRACT, ARB_AAVE_USDC_CONTRACT, ARB_AAVE_GHO_CONTRACT], + }), + }, era: { tvl: sumTokensExport({ owners: [ @@ -18,7 +32,7 @@ module.exports = { ZOMMA_CONTRACT_ETH_AUDIT, ZOMMA_CONTRACT_BTC_AUDIT, ], - tokens: [USDC_CONTRACT], + tokens: [ZK_USDC_CONTRACT], }), }, }; \ No newline at end of file diff --git a/projects/zootopia-finance/index.js b/projects/zootopia-finance/index.js index 19ae5d288494..56d56b92bec7 100644 --- a/projects/zootopia-finance/index.js +++ b/projects/zootopia-finance/index.js @@ -1,5 +1,6 @@ const ADDRESSES = require('../helper/coreAssets.json') -const { sumTokens2 } = require('../helper/unwrapLPs') +const { sumTokens2 } = require('../helper/unwrapLPs'); +const { deadFrom } = require('../mosquitos-finance'); // ztp swap address const SWAP_ADDR = "0xCdD4396527b6681775173839002E6af201885CB8"; @@ -18,6 +19,7 @@ module.exports = { hallmarks: [ [1667174400, "Rug Pull"] ], + deadFrom: 1667174400, bsc: { tvl, }, diff --git a/projects/zprotocol-dex/index.js b/projects/zprotocol-dex/index.js new file mode 100644 index 000000000000..6f6cd62b5d4a --- /dev/null +++ b/projects/zprotocol-dex/index.js @@ -0,0 +1,4 @@ +const { uniTvlExports } = require('../helper/unknownTokens') +module.exports = uniTvlExports({ + 'scroll': '0xED93e976d43AF67Cc05aa9f6Ab3D2234358F0C81' +}) \ No newline at end of file diff --git a/projects/zprotocol-masterchef/index.js b/projects/zprotocol-masterchef/index.js new file mode 100644 index 000000000000..82c3eae4869c --- /dev/null +++ b/projects/zprotocol-masterchef/index.js @@ -0,0 +1,28 @@ +// const {zProtocolScrollFarmingExports} = require("./scroll"); +const { staking, } = require('../helper/unknownTokens'); +const { sumTokens2 } = require('../helper/unwrapLPs'); + +const FACTORY = "0xED93e976d43AF67Cc05aa9f6Ab3D2234358F0C81"; +const FARM_MASTER = "0x7a757614fEFA05f40456016Af74262Fe53546DBa"; +const ZP_TOKEN = "0x2147a89fb4608752807216D5070471c09A0DcE32"; +// const export1 = zProtocolScrollFarmingExports(FARM_MASTER, FACTORY, 'scroll', ZP_TOKEN); +const farmAbi = { + poolInfo: "function poolInfo(uint256) view returns (address token, uint256 catId, uint256 allocPoint, uint256 lastRewardTime, uint256 accZPPerShare, uint256 depositFeeBP, uint256 harvestInterval)", +} + +module.exports = { + methodology: "count value of staked tokens except of z-dex LP tokens", + misrepresentedTokens: true, + scroll: { + tvl, + staking: staking({ tokens: [ZP_TOKEN], owner: FARM_MASTER, useDefaultCoreAssets: true, lps: ['0xb74806780Ac59D0d7567bE66Ff23511400bD9cf8']}) + } +} + +async function tvl(api) { + let blacklistedTokens = await api.fetchList({ lengthAbi: 'allPairsLength', itemAbi: 'allPairs', target: FACTORY }) + blacklistedTokens.push(ZP_TOKEN) + const poolInfo = await api.fetchList({ lengthAbi: 'poolsLength', itemAbi: farmAbi.poolInfo, target: FARM_MASTER }) + await sumTokens2({ api, owner: FARM_MASTER, tokens: poolInfo.map(pool => pool.token), resolveLP: true, blacklistedTokens, }) + api.removeTokenBalance(ZP_TOKEN) +} \ No newline at end of file diff --git a/test.js b/test.js index 5846caef1098..686d68c1fd9d 100644 --- a/test.js +++ b/test.js @@ -10,7 +10,7 @@ const path = require("path"); require("dotenv").config(); const { ENV_KEYS } = require("./projects/helper/env"); const { util: { - blocks: { getCurrentBlocks }, + blocks: { getBlocks }, humanizeNumber: { humanizeNumber }, } } = require("@defillama/sdk"); const { util } = require("@defillama/sdk"); @@ -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', 'GRAPH_API_KEY', ...ENV_KEYS].includes(key) || key.includes('SDK')) return; + if (['TVL_LOCAL_CACHE_ROOT_FOLDER', 'LLAMA_DEBUG_MODE', 'GRAPH_API_KEY', 'LLAMA_DEBUG_LEVEL2', ...ENV_KEYS].includes(key) || key.includes('SDK')) return; delete process.env[key] }) process.env.SKIP_RPC_CHECK = 'true' @@ -103,25 +103,55 @@ sdk.api.abi.call = async (...args) => { } } +function validateHallmarks(hallmark) { + if (!Array.isArray(hallmark)) { + throw new Error("Hallmarks should be an array of [unixTimestamp, eventText] but got " + JSON.stringify(hallmark)) + } + const [timestamp, text] = hallmark + if (typeof timestamp !== 'number' && isNaN(+new Date(timestamp))) { + throw new Error("Hallmark timestamp should be a number/dateString") + } + const year = new Date(timestamp * 1000).getFullYear() + const currentYear = new Date().getFullYear() + if (year < 2010 || year > currentYear) { + throw new Error("Hallmark timestamp should be between 2010 and " + currentYear + " but got " + year) + } + + if (typeof text !== 'string') { + throw new Error("Hallmark text should be a string") + } +} + (async () => { let module = {}; - try { - module = require(passedFile) - } catch (e) { - console.log(e) + module = require(passedFile) + if (module.hallmarks) { + if (!Array.isArray(module.hallmarks)) { + throw new Error("Hallmarks should be an array of arrays") + } + if (module.hallmarks.length > 6) { + console.error("WARNING: Hallmarks should only be set for events that led to a big change in TVL, please reduce hallmarks to only those that meet this condition") + } + + module.hallmarks.forEach(validateHallmarks) } // await initCache() const chains = Object.keys(module).filter(item => typeof module[item] === 'object' && !Array.isArray(module[item])); checkExportKeys(module, passedFile, chains) - const unixTimestamp = Math.round(Date.now() / 1000) - 60; - // const { chainBlocks } = await getCurrentBlocks([]); // fetch only ethereum block for local test - const chainBlocks = {} + + let unixTimestamp = Math.round(Date.now() / 1000) - 60; + let chainBlocks = {} + const passedTimestamp = process.argv[3] + if (passedTimestamp !== undefined) { + unixTimestamp = Number(passedTimestamp) + const res = await getBlocks(unixTimestamp, chains) + chainBlocks = res.chainBlocks + } const ethBlock = chainBlocks.ethereum; const usdTvls = {}; const tokensBalances = {}; const usdTokenBalances = {}; const chainTvlsToAdd = {}; - const knownTokenPrices = {}; let tvlPromises = Object.entries(module).map(async ([chain, value]) => { if (typeof value !== "object" || value === null) { @@ -202,11 +232,16 @@ sdk.api.abi.call = async (...args) => { Object.entries(usdTokenBalances).forEach(([chain, balances]) => { console.log(`--- ${chain} ---`); - Object.entries(balances) - .sort((a, b) => b[1] - a[1]) - .forEach(([symbol, balance]) => { - console.log(symbol.padEnd(25, " "), humanizeNumber(balance)); - }); + let entries = Object.entries(balances) + entries.sort((a, b) => b[1] - a[1]) + + if (entries.length > 30) { + console.log("Showing top 30 tokens, total tokens:", entries.length) + entries = entries.slice(0, 30) + } + entries.forEach(([symbol, balance]) => { + console.log(symbol.padEnd(25, " "), humanizeNumber(balance)); + }); console.log("Total:", humanizeNumber(usdTvls[chain]), "\n"); }); console.log(`------ TVL ------`); @@ -233,6 +268,7 @@ function checkExportKeys(module, filePath, chains) { || (filePath.length === 2 && !(['api.js', 'index.js', 'apiCache.js',].includes(filePath[1]) // matches .../projects/projectXYZ/index.js || ['treasury', 'entities'].includes(filePath[0]) // matches .../projects/treasury/project.js + || /v\d+\.js$/.test(filePath[1]) // matches .../projects/projectXYZ/v1.js ))) process.exit(0) diff --git a/tsconfig.json b/tsconfig.json index 97ad9508cb44..682d025ac436 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -18,4 +18,4 @@ "strictNullChecks": false, "typeRoots": ["./typings/", "./node_modules/@types/"] } -} +} \ No newline at end of file diff --git a/utils/formatIdl.js b/utils/formatIdl.js new file mode 100644 index 000000000000..7f799098f3da --- /dev/null +++ b/utils/formatIdl.js @@ -0,0 +1,151 @@ +// const jsonString = require('json-stringify-pretty-compact') +const fs = require('fs') + +const stringOrChar = /("(?:[^\\"]|\\.)*")|[:,]/g; +let idl = require('../projects/test/idl.json') + +idl.instructions = [] +idl.events = [] +idl.errors = [] + +const whitelistedTypes = new Set() +const typeMap = {} +idl.types.forEach(t => typeMap[t.name] = t) +const whitelistedTypeMap = {} +const accountMap = {} +idl.accounts.forEach(a => accountMap[a.name] = a) + +idl.accounts.forEach(checkType) + +function checkType(typeObj) { + let isAccountObjInTypeMap = false + if (whitelistedTypes.has(typeObj.name)) return; + whitelistedTypes.add(typeObj.name) + if (!typeObj.type && accountMap[typeObj.name]) { // it could be account whose type is present in the typeMap + if (typeMap[typeObj.name]) { + typeObj = typeMap[typeObj.name] + isAccountObjInTypeMap = true + } + else return; + } + + if (isAccountObjInTypeMap || !accountMap[typeObj.name]) + whitelistedTypeMap[typeObj.name] = typeObj + + if (typeObj.type.kind !== 'struct') return; + typeObj.type.fields.forEach(f => { + if (typeof f.type === 'object') { + const tName = f.type.defined?.name + if (tName && typeMap[tName]) checkType(typeMap[tName]) + if (f.type.array) + f.type.array.forEach(a => { + if (a.defined && typeMap[a.defined.name]) checkType(typeMap[a.defined.name]) + }) + } + }) +} + +console.log(JSON.stringify({whitelistedTypeMap: Object.keys(whitelistedTypeMap), accountMap: Object.keys(accountMap), whitelistedTypes: Array.from(whitelistedTypes)}, null, 2)) +idl.types = Object.values(whitelistedTypeMap) + + + + +const res = stringify(idl, { maxLength: 153 }) +fs.writeFileSync(__dirname + '/../projects/test/idl.json', res) + + +// from json-stringify-pretty-compact + +function stringify(passedObj, options = {}) { + const indent = JSON.stringify( + [1], + undefined, + options.indent === undefined ? 2 : options.indent + ).slice(2, -3); + + const maxLength = + indent === "" + ? Infinity + : options.maxLength === undefined + ? 80 + : options.maxLength; + + let { replacer } = options; + + return (function _stringify(obj, currentIndent, reserved) { + if (obj && typeof obj.toJSON === "function") { + obj = obj.toJSON(); + } + + const string = JSON.stringify(obj, replacer); + + if (string === undefined) { + return string; + } + + const length = maxLength - currentIndent.length - reserved; + + if (string.length <= length) { + const prettified = string.replace( + stringOrChar, + (match, stringLiteral) => { + return stringLiteral || `${match} `; + } + ); + if (prettified.length <= length) { + return prettified; + } + } + + if (replacer != null) { + obj = JSON.parse(string); + replacer = undefined; + } + + if (typeof obj === "object" && obj !== null) { + const nextIndent = currentIndent + indent; + const items = []; + let index = 0; + let start; + let end; + + if (Array.isArray(obj)) { + start = "["; + end = "]"; + const { length } = obj; + for (; index < length; index++) { + items.push( + _stringify(obj[index], nextIndent, index === length - 1 ? 0 : 1) || + "null" + ); + } + } else { + start = "{"; + end = "}"; + const keys = Object.keys(obj); + const { length } = keys; + for (; index < length; index++) { + const key = keys[index]; + const keyPart = `${JSON.stringify(key)}: `; + const value = _stringify( + obj[key], + nextIndent, + keyPart.length + (index === length - 1 ? 0 : 1) + ); + if (value !== undefined) { + items.push(keyPart + value); + } + } + } + + if (items.length > 0) { + return [start, indent + items.join(`,\n${nextIndent}`), end].join( + `\n${currentIndent}` + ); + } + } + + return string; + })(passedObj, "", 0); +} diff --git a/utils/scripts/checkBTCDups.js b/utils/scripts/checkBTCDups.js new file mode 100644 index 000000000000..45e7d49dd9c0 --- /dev/null +++ b/utils/scripts/checkBTCDups.js @@ -0,0 +1,83 @@ +const fs = require('fs'); +const path = require('path'); + +// Regular expression to match Bitcoin addresses +// const btcAddressRegex = /\b(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}\b/g; + + +// Regular expression to match alphanumeric strings between single or double quotes +const addressRegex = /['"]([a-zA-Z0-9]{25,99})['"]/g; + +// Function to read all files in a directory recursively +const readFilesInDirectory = (dir) => { + let files = []; + const items = fs.readdirSync(dir); + for (const item of items) { + const fullPath = path.join(dir, item); + if (fs.statSync(fullPath).isDirectory()) { + files = files.concat(readFilesInDirectory(fullPath)); + } else { + files.push(fullPath); + } + } + return files; +}; + +// Function to extract Bitcoin addresses from a file +const extractBtcAddresses = (filePath) => { + let content = fs.readFileSync(filePath, 'utf8'); + if (['solana', 'tezos'].some(i => content.includes(i)) && !content.includes('bitcoin')) return [] + content = content.replaceAll('modifyEndpoint("', '') + content = content.replaceAll('modifyEndpoint(\'', '') + return content.match(addressRegex) || []; +}; + +// Function to find duplicates between files +const findDuplicates = (folderPath) => { + console.log(folderPath) + const files = readFilesInDirectory(folderPath+'/'); + const addressMap = new Map(); + + for (let file of files) { + const addresses = extractBtcAddresses(file); + file = file.replace(folderPath, '') + for (let address of addresses) { + address = address.replace(/'/g, '').replace(/"/g, '') + if (address.startsWith('0x') || !/\d/.test(address)) continue; + if (addressMap.has(address)) { + const arry = addressMap.get(address) + if (!arry.includes(file)) + arry.push(file); + } else { + addressMap.set(address, [file]); + } + } + } + + // Find duplicates + const duplicates = []; + for (const [address, fileList] of addressMap.entries()) { + if (fileList.length > 1) { + duplicates.push({ address, files: fileList }); + } + } + + return duplicates; +}; + +// Main function +const main = (folderPath) => { + const duplicates = findDuplicates(folderPath); + if (duplicates.length > 0) { + console.log('Duplicate Bitcoin addresses found:'); + for (const { address, files } of duplicates) { + console.log(`Address: ${address}`); + console.log(`Files: ${files.join(', ')}`); + console.log('---'); + } + } else { + console.log('No duplicate Bitcoin addresses found.'); + } +}; + +main(path.join(__dirname, '../../projects')); \ No newline at end of file diff --git a/utils/scripts/checkBTCDupsv2.js b/utils/scripts/checkBTCDupsv2.js new file mode 100644 index 000000000000..2dcec07b6a30 --- /dev/null +++ b/utils/scripts/checkBTCDupsv2.js @@ -0,0 +1,30 @@ +const addressBook = require('../../projects/helper/bitcoin-book/index'); + +console.log('project count: ', Object.keys(addressBook).length); +const addressProjectMap = {} + +async function run() { + + await Promise.all(Object.keys(addressBook).map(async project => { + let addresses = addressBook[project]; + if (!Array.isArray(addresses)) addresses = await addresses() + for (let address of addresses) { + if (addressProjectMap[address]) { + addressProjectMap[address].push(project); + } else { + addressProjectMap[address] = [project]; + } + } + })) + + const duplicates = {} + for (const [address, projects] of Object.entries(addressProjectMap)) { + if (projects.length > 1) { + duplicates[address] = projects.join(', '); + } + } + + console.table(Object.entries(duplicates)); +} + +run().catch(console.error).then(() => process.exit(0)); \ No newline at end of file diff --git a/utils/scripts/checkFixTokensPriced.js b/utils/scripts/checkFixTokensPriced.js new file mode 100644 index 000000000000..da8b955b9051 --- /dev/null +++ b/utils/scripts/checkFixTokensPriced.js @@ -0,0 +1,34 @@ +const { fixBalancesTokens } = require("../../projects/helper/tokenMapping") +const axios = require('axios') + + +async function run() { + let allTokens = [] + const tokensMissingPrice = [] + const tokensWithPrice = [] + const tokenSet = new Set() + Object.entries(fixBalancesTokens).forEach(([chain, tokens]) => { + Object.keys(tokens).forEach(token => { + const key = chain+':'+token + if (!tokenSet.has(key.toLowerCase())) { // ignore duplicates + tokenSet.add(key.toLowerCase()) + allTokens.push(key) + } + }) + }) + const burl = 'https://coins.llama.fi/prices/current/'+allTokens.join(',') + const prices = (await axios.get(burl)).data.coins + + allTokens.forEach(token => { + if (!prices[token]) { + tokensMissingPrice.push(token) + } else { + tokensWithPrice.push(token) + } + }) + + console.log('Tokens with price:', tokensWithPrice, tokensWithPrice.length) + console.log('Tokens missing price:', tokensMissingPrice, tokensMissingPrice.length) +} + +run().catch(console.error).then(() => process.exit(0)) \ No newline at end of file diff --git a/utils/scripts/coingeckoApi.js b/utils/scripts/coingeckoApi.js index c91a9360bb06..eead4b226d13 100644 --- a/utils/scripts/coingeckoApi.js +++ b/utils/scripts/coingeckoApi.js @@ -14,7 +14,6 @@ const ONE_WEEK = 7 * ONE_DAY run() - function writeToCache() { fs.writeFileSync(cacheFile, JSON.stringify(geckoCache)) }