Skip to content

Commit

Permalink
Merge branch 'DefiLlama:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
senamakel authored Aug 12, 2024
2 parents 0977c51 + 8324be8 commit 8b5f388
Show file tree
Hide file tree
Showing 18 changed files with 216 additions and 103 deletions.
20 changes: 7 additions & 13 deletions projects/akronswap/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
const { getUniTVL } = require('../helper/unknownTokens');


const tvl = getUniTVL({ factory: '0xAf39606bec181887951Ab6912Ac7EA216Bd6E4B4', useDefaultCoreAssets: true, fetchBalances: 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, },
}
26 changes: 26 additions & 0 deletions projects/alienworlds/index.js
Original file line number Diff line number Diff line change
@@ -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,
},
}
29 changes: 29 additions & 0 deletions projects/alphaX-protocol/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
const ADDRESSES = require('../helper/coreAssets.json');
const { sumTokensExport } = require('../helper/unwrapLPs');

const tokens = [
ADDRESSES.ethereum.USDT,
];

const walletAddresses = {
ethereum: ['0xA61a6E696B7C566DA42B80dA27d96e7104bcec99'],
arbitrum: ['0x552E7A55802f3350C707a243E402aa50Eda9D286']

};

const tokenAddress = {
ethereum: [ADDRESSES.ethereum.USDT],
arbitrum: [ADDRESSES.arbitrum.USDT],


}

module.exports = {
ethereum: {
tvl: sumTokensExport({ owners: walletAddresses.ethereum, tokens: tokenAddress.ethereum }),
},
arbitrum: {
tvl: sumTokensExport({ owners: walletAddresses.arbitrum, tokens: tokenAddress.arbitrum }),
},

};
16 changes: 16 additions & 0 deletions projects/avalance-btc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const sdk = require('@defillama/sdk');
const { sumTokensExport } = require('../helper/sumTokens');

//https://support.avax.network/en/articles/6349640-how-does-the-avalanche-bridge-work
const owners = [
'bc1q2f0tczgrukdxjrhhadpft2fehzpcrwrz549u90', // https://prnt.sc/unrBvLvw3z1t
]

module.exports = {
methodology: 'BTC wallets on bc1q2f0tczgrukdxjrhhadpft2fehzpcrwrz549u90',
bitcoin: {
tvl: sdk.util.sumChainTvls([
sumTokensExport({ owners }),
]),
},
};
2 changes: 0 additions & 2 deletions projects/dyad/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ const vaults = [

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] })
}

Expand Down
30 changes: 30 additions & 0 deletions projects/firoza-finance/index.js
Original file line number Diff line number Diff line change
@@ -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"]
],
};
25 changes: 21 additions & 4 deletions projects/helper/coreAssets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1421,7 +1421,8 @@
"USDC": "0x15D38573d2feeb82e7ad5187aB8c1D52810B1f07",
"USDT": "0x0Cb6F5a34ad42ec934882A05265A7d5F59b51A2f",
"HEX": "0x2b591e99afe9f32eaa6214f7b7629768c40eeb39",
"DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305"
"DAI": "0xefd766ccb38eaf1dfd701853bfce31359239f305",
"sDAI": "0x30fcb23a906493371b1721c8feb8815804808d74"
},
"onus": {
"WONUS": "0x4c761e48d1e735af551cc38abcbdce1d7faac6e4",
Expand Down Expand Up @@ -1471,7 +1472,8 @@
"WETH": "0x4200000000000000000000000000000000000006",
"USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",
"USDC": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb"
"DAI": "0x50c5725949a6f0c72e6c4a641f24049a917db0cb",
"USDT": "0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2"
},
"sei": {
"SEI": "usei",
Expand Down Expand Up @@ -1576,7 +1578,8 @@
"BIFI": "0x047938C3aD13c1eB821C8e310B2B6F889b6d0003",
"WBTC": "0x7b8FAC5F29E101BaaB33c5f9c39d4F85ba2cc7C1",
"BTCB": "0xd267F821F1b8344B5A63626c8c824697194A173E",
"BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555"
"BitcoinUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555",
"BtcUSD": "0x6906Ccda405926FC3f04240187dd4fAd5DF6d555"
},
"scroll": {
"WETH": "0x5300000000000000000000000000000000000004",
Expand Down Expand Up @@ -1813,7 +1816,6 @@
"btr": {
"ETH": "0xef63d4e178b3180beec9b0e143e0f37f4c93f4c2",
"WBTC": "0xff204e2681a6fa0e2c3fade68a1b28fb90e4fc5f"

},
"taiko": {
"USDC": "0x07d83526730c7438048D55A4fc0b850e2aaB6f0b",
Expand Down Expand Up @@ -1863,5 +1865,20 @@
"rari": {
"WETH": "0xf037540e51d71b2d2b1120e8432ba49f29edfbd0",
"USDC.e": "0xfbda5f676cb37624f28265a144a48b0d6e87d3b6"
},
"real": {
"RWA": "0x4644066f535ead0cde82d209df78d94572fcbf14"
},
"saakuru": {
"WOAS": "0x557a526472372f1F222EcC6af8818C1e6e78A85f",
"USDC.e": "0x739222D8A9179fE05129C77a8fa354049c088CaA"
},
"bouncebit": {
"wstBBTC": "0x8f083eafcbba2e126ad9757639c3a1e25a061a08"
},
"reya": {
"WETH": "0x6b48c2e6a32077ec17e8ba0d98ffc676dfab1a30",
"USDC": "0x3B860c0b53f2e8bd5264AA7c3451d41263C933F2",
"RUSD": "0xa9f32a851b1800742e47725da54a09a7ef2556a3"
}
}
55 changes: 3 additions & 52 deletions projects/helper/tokenMapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,58 +40,9 @@ 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 },
},
airdao: {
[ADDRESSES.null]: { coingeckoId: 'amber', decimals: 18 },
[ADDRESSES.airdao.USDC]: { coingeckoId: 'usd-coin', decimals: 18 },
},
lukso: {
[ADDRESSES.null]: { coingeckoId: "lukso-token-2", decimals: 18 },
[ADDRESSES.lukso.WLYX]: { coingeckoId: 'lukso-token-2', decimals: 18 },
},
bfc: {
[ADDRESSES.bfc.BitcoinUSD]: { coingeckoId: "bitcoin-usd-btcfi", decimals: 18, },
},
pulse: {
'0x30fcb23a906493371b1721c8feb8815804808d74': { coingeckoId: 'savings-dai', decimals: 18 },
},
saakuru: {
'0x557a526472372f1F222EcC6af8818C1e6e78A85f': { coingeckoId: 'oasys', decimals: 18 },
'0x739222D8A9179fE05129C77a8fa354049c088CaA': { coingeckoId: 'usd-coin', decimals: 6 }
},
bouncebit: {
'0x8f083eafcbba2e126ad9757639c3a1e25a061a08': { coingeckoId: 'bouncebit-btc', decimals: 18 }
},
ripple: {
"XRP": { coingeckoId: "ripple", decimals: 6 },
},
moonriver: {
'0x8b29344f368b5fa35595325903fe0eaab70c8e1f': { coingeckoId: 'polkamarkets', decimals: 18 },
},
moonbeam: {
'0x8b29344f368b5fa35595325903fe0eaab70c8e1f': { coingeckoId: 'polkamarkets', decimals: 18 },
},
xdai: {
'0x9a2a80c38abb1fdc3cb0fbf94fefe88bef828e00': { coingeckoId: 'polkamarkets', decimals: 18 },
},
celo: {
'0xb4d8a602fff7790eec3f2c0c1a51a475ee399b2d': { coingeckoId: 'polkamarkets', decimals: 18 },
},
reya: {
"0x6b48c2e6a32077ec17e8ba0d98ffc676dfab1a30": { coingeckoId: "ethereum", decimals: 18 },
"0xa9f32a851b1800742e47725da54a09a7ef2556a3": { coingeckoId: "usd-coin", decimals: 6 },
},
base: {
"0xfde4C96c8593536E31F229EA8f37b2ADa2699bb2": { coingeckoId: "tether", decimals: 6 },
},
islm: {
'0x0ce35b0d42608ca54eb7bcc8044f7087c18e7717': { coingeckoId: 'usd-coin', decimals: 6 },
}
}

ibcChains.forEach(chain => fixBalancesTokens[chain] = { ...ibcMappings, ...(fixBalancesTokens[chain] || {}) })
Expand Down
5 changes: 5 additions & 0 deletions projects/lore/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const { aaveExports } = require('../helper/aave')

module.exports = {
scroll: aaveExports("scroll", "0xBc6DE4458b7D6fbf82240ce8cC0CA6a2f4986eb5"),
}
11 changes: 11 additions & 0 deletions projects/pstake-btc/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { sumTokensExport } = require("../helper/sumTokens");
const sdk = require("@defillama/sdk");

const owner = "bc1qajcp935tuvqakut95f0sc9qm09hxjj6egexl9d";

module.exports = {
methodology: `Total amount of BTC in ${owner}.`,
bitcoin: {
tvl: sdk.util.sumChainTvls([sumTokensExport({ owner })]),
},
};
5 changes: 0 additions & 5 deletions projects/pstake/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,8 @@ function cosmostvl() {
};
}

const owner = "bc1qajcp935tuvqakut95f0sc9qm09hxjj6egexl9d";

module.exports = {
methodology: `Total amount of liquid staked tokens on Persistence.`,
bsc: { tvl: bsctvl },
persistence: { tvl: cosmostvl() },
bitcoin: {
tvl: sdk.util.sumChainTvls([sumTokensExport({ owner })]),
},
};
9 changes: 9 additions & 0 deletions projects/satori/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,13 @@ module.exports = {
tokens: [ADDRESSES.xlayer.USDC],
}),
},
arbitrum:{
tvl: sumTokensExport({
owners: [
"0x5aCCEb99De5cc07168C193396C1fdC3E3abEEED7",
"0xAE9a83510cbB26c58595BA671f131e0A03Fe9A03",
],
tokens: [ADDRESSES.arbitrum.USDC_CIRCLE],
}),
},
};
4 changes: 4 additions & 0 deletions projects/satoshi-protocol/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ module.exports = {
'0xf1A7b474440702BC32F622291B3A01B80247835E', // BITLAYER WBTC Collateral
'0xe9897fe6C8bf96D5ef8B0ECC7cBfEdef9818232c', // BITLAYER stBTC Collateral
],
nymInformation: {
address: '0xC562321a494290bE5FeDF9092cee35DE6f884D50',
fromBlock: 3442163,
}
}),
bob: createExports({
troveList: [
Expand Down
2 changes: 1 addition & 1 deletion projects/stride/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const chains = {
juno: {
chainId: "juno-1",
denom: "ujuno",
coinGeckoId: "juno-network",
coinGeckoId: "juno-network",
},

osmosis: {
Expand Down
11 changes: 5 additions & 6 deletions projects/swell-restaking/index.js
Original file line number Diff line number Diff line change
@@ -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 = {
Expand Down
23 changes: 23 additions & 0 deletions projects/taco/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
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"]
];
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
},
}
1 change: 1 addition & 0 deletions projects/tbtc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const owners = [

module.exports = {
methodology: "BTC on btc chain",
ethereum: {tvl: () => ({}) },
bitcoin: {
tvl: sdk.util.sumChainTvls([
sumTokensExport({ owners }),
Expand Down
Loading

0 comments on commit 8b5f388

Please sign in to comment.