From 641ab3f15fe120f0c58964a62f4094e43146c4de Mon Sep 17 00:00:00 2001 From: Sergey R Date: Thu, 15 Aug 2024 15:29:36 +0200 Subject: [PATCH] added drop protocol (#11313) --- projects/drop/index.js | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 projects/drop/index.js diff --git a/projects/drop/index.js b/projects/drop/index.js new file mode 100644 index 000000000000..b8ddb5bef11e --- /dev/null +++ b/projects/drop/index.js @@ -0,0 +1,43 @@ +const sdk = require("@defillama/sdk"); +const { queryContract } = require('../helper/chain/cosmos') + +const chains = { + cosmos: { + chainId: "cosmoshub-4", + denom: "uatom", + coinGeckoId: "cosmos", + dropContract: "neutron16m3hjh7l04kap086jgwthduma0r5l0wh8kc6kaqk92ge9n5aqvys9q6lxr" + }, +}; + +function makeTvlFn(chain) { + return async () => { + const balances = {}; + const data = await queryContract({ + contract: chain.dropContract, + chain: "neutron", + data: { + "total_bonded": {} + } + }); + const assetBalance = parseInt(data, 10) / 1e6; + const amount = assetBalance; + + sdk.util.sumSingleBalance( + balances, + chain.coinGeckoId, + amount + ); + + return balances; + }; +} + +module.exports = { + timetravel: false, + methodology: "Sum of all the tokens that are liquid staked on DROP", +}; + +for (const chainName of Object.keys(chains)) { + module.exports[chainName] = { tvl: makeTvlFn(chains[chainName]) }; +}