Skip to content

Commit

Permalink
Bitflow (DefiLlama#8977)
Browse files Browse the repository at this point in the history
* feat: add BitFlow adapter

* code refactor

---------

Co-authored-by: Rodrigo Eduardo <[email protected]>
  • Loading branch information
g1nt0ki and rodrigoeduardo authored Feb 15, 2024
1 parent 462636c commit 6f930b6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
17 changes: 17 additions & 0 deletions projects/bitflow/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { sumTokensExport } = require("../helper/sumTokens");

const BITFLOW_ADDRESS = "SPQC38PW542EQJ5M11CR25P7BS1CA6QT4TBXGB3M";

const PAIRS = [
`${BITFLOW_ADDRESS}.stableswap-stx-ststx-v-1-1`,
`${BITFLOW_ADDRESS}.stableswap-stx-ststx-v-1-2`,
`${BITFLOW_ADDRESS}.stableswap-usda-susdt-v-1-2`,
`${BITFLOW_ADDRESS}.stableswap-abtc-xbtc-v-1-2`,
]

module.exports = {
stacks: {
tvl: sumTokensExport({ owners: PAIRS }),
},
methodology: "Total Liquidity Added to DEX Trading Pools",
};
4 changes: 3 additions & 1 deletion projects/helper/chain/stacks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const { get, } = require('../http')
const { nullAddress } = require('../tokenMapping')
const { getFixBalancesSync } = require('../portedTokens')
const sdk = require('@defillama/sdk')
const chain = 'stacks'

Expand Down Expand Up @@ -41,7 +42,8 @@ async function sumTokens({ owner, owners = [], tokens = [], balances = {}, black
if (owner) owners = [owner]

await Promise.all(owners.map(i => addTokens(i, { balances, tokens, blacklistedTokens, })))
return balances
const transform = getFixBalancesSync(chain)
return transform(balances)
}

module.exports = {
Expand Down
5 changes: 5 additions & 0 deletions projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ const fixBalancesTokens = {
moonbeam: {
'0xffffffff99dabe1a8de0ea22baa6fd48fde96f6c': { coingeckoId: 'voucher-glmr', decimals: 18 },
'0xffffffffcd0ad0ea6576b7b285295c85e94cf4c1': { coingeckoId: 'filecoin', decimals: 18 },
},
stacks: {
'SP4SZE494VC2YC5JYG7AYFQ44F5Q4PYV7DVMDPBG.ststx-token::ststx': { coingeckoId: 'blockstack', decimals: 6 },
'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-susdt::bridged-usdt': { coingeckoId: 'tether', decimals: 8 },
'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.token-abtc::bridged-btc': { coingeckoId: 'bitcoin', decimals: 8 },
}
}

Expand Down

0 comments on commit 6f930b6

Please sign in to comment.