-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'DefiLlama:main' into main
- Loading branch information
Showing
65 changed files
with
1,542 additions
and
237 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]}), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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]), | ||
}); | ||
}, | ||
}, | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
const { sumTokensExport } = require("../helper/sumTokens"); | ||
const { bitlayerBridge } = require("../helper/bitcoin-book"); | ||
|
||
module.exports = { | ||
bitcoin: { | ||
tvl: sumTokensExport({ owners: bitlayerBridge }) | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.