Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenquangthang1997 committed Dec 20, 2024
2 parents d0a692e + 98aaadc commit 47320af
Show file tree
Hide file tree
Showing 1,177 changed files with 18,557 additions and 6,484 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ module.exports = {
"no-unused-vars": "off",
"no-useless-escape": "warn",
"no-prototype-builtins": "off",
"no-unreachable": "off",
}
}
14 changes: 8 additions & 6 deletions .github/workflows/commentResult.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { readFileSync } = require('fs');
const axios = require('axios');
const junk = 'VPTOH1X0B7rf8od7BGNsQ1z0BJk8iMNLxqrD';
const junk = 'rmicl\x1Eefn]JsfjoHoGRpWOt3_u@L_LpTUc_BLf0T/i/mXC';

async function main() {
const [, , log, author, repo, pr, path ] = process.argv;
Expand All @@ -25,12 +25,14 @@ async function main() {
`https://api.github.com/repos/${author}/${repo}/issues/${pr}/comments`,
{ body }, {
headers: {
Authorization: `token ghp_${translate(junk)}`,
Authorization: scramble(junk),
Accept: 'application/vnd.github.v3+json'
}
});
};
function translate(input) {
return input ? translate(input.substring(1)) + input[0] : input;
};
main();
function scramble(str) {
return str.split('').reduce((a, b) => {
return a + String.fromCharCode(b.charCodeAt(0) + 2);
}, '');
}
main();
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,6 @@ jobs:
done
- name: Run ESLint
uses: eslint/github-action@v0
run: |
npm ci
npm run lint
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added bun.lockb
Binary file not shown.
66 changes: 52 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
"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/checkBTCDups.js",
"check-bitcoin-duplicates": "node utils/scripts/checkBTCDupsv2.js",
"string-timestamp": "node utils/scripts/stringTimestamp.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",
Expand Down
2 changes: 1 addition & 1 deletion projects/0x0dex/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ const { sumTokensExport, nullAddress } = require('../helper/unwrapLPs');
const ETH_POOL_ADDRESS = "0x3d18AD735f949fEbD59BBfcB5864ee0157607616";

module.exports = {
start: 1685386800, // 19/05/2023 @ 07:00pm UTC
start: '2023-05-29', // 19/05/2023 @ 07:00pm UTC
ethereum: { tvl: sumTokensExport({ owner: ETH_POOL_ADDRESS, tokens: [nullAddress]}) },
};
2 changes: 1 addition & 1 deletion projects/0x_nodes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ module.exports = {
],
methodology: ` Counts the number of wrapped native tokens in all yield strategies across all the chains the protocol is deployed on
+ staking counts the number of BIOS tokens staked in the kernels across all the chains (PFA: Protocol Fee Accruals by staking assets)`,
start: 1633046400, // Friday 1. October 2021 00:00:00 GMT
start: '2021-10-01', // Friday 1. October 2021 00:00:00 GMT
...tvlExports,
deadFrom: 1659527340,
}
Expand Down
2 changes: 1 addition & 1 deletion projects/0xacid/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const ACID_STAKING = "0x00a842038a674616f6a97e62f80111a536778282";
const ACID_TOKEN = "0x29C1EA5ED7af53094b1a79eF60d20641987c867e";

module.exports = {
start: 1678417200,
start: '2023-03-10',
arbitrum: {
tvl: () => ({}),
staking: stakingUnknownPricedLP(ACID_STAKING, ACID_TOKEN, "arbitrum", "0x73474183a94956cd304c6c5a504923d8150bd9ce")
Expand Down
1 change: 0 additions & 1 deletion projects/1155Tech/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const MARKET_1155TECH_CONTRACT = '0x33b77fAf955Ed3eDAf939ae66C4D7a2D78bc30C6';

module.exports = {
methodology: 'Value of all Keys across all art markets is TVL in the protocol',
start: 7280880,
canto: {
tvl: sumTokensExport({ owner: MARKET_1155TECH_CONTRACT, tokens: [ADDRESSES.canto.NOTE] })
}
Expand Down
10 changes: 3 additions & 7 deletions projects/21-co/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
const { cexExports } = require('../helper/cex')
const bitcoinAddressBook = require('../helper/bitcoin-book/index.js')

const config = {
bitcoin: {
owners: [
'1HTGi4tfXSEtcXD4pk6S3vBs3s64hWY1pW',
'12WZhMFFLHQ4rCMSkeBfbJXRk7aGWyBh1M',
],
owners: bitcoinAddressBook.twentyOneCo
},
solana: {
owners: [
Expand Down Expand Up @@ -38,9 +36,7 @@ const config = {
],
},
bep2: {
owners: [
'bnb1k3ulpgw4wzl0e8qx80u87aq9w7ekfygruzs4dg'
],
// owners: ['bnb1k3ulpgw4wzl0e8qx80u87aq9w7ekfygruzs4dg'],
},
/* bitcoin_cash: {
owners: [
Expand Down
1 change: 0 additions & 1 deletion projects/2pi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ const tvl = async (api) => {
tokens.push(res[i][j].want)
}
}
console.log(res, api.chain)
const bals = await api.multiCall({ abi: archimedesAbi.balance, calls})
api.add(tokens, bals)
}
Expand Down
2 changes: 1 addition & 1 deletion projects/3xcalibur/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { uniTvlExport } = require("../helper/calculateUniTvl.js");

module.exports = {
misrepresentedTokens: true,
start: 1667689200,
start: '2022-11-06',
arbitrum: {
tvl: uniTvlExport("0xD158bd9E8b6efd3ca76830B66715Aa2b7Bad2218", "arbitrum", undefined, undefined, { hasStablePools: true, useDefaultCoreAssets: true, }),
},
Expand Down
2 changes: 1 addition & 1 deletion projects/88mph/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,6 @@ tvlExports.ethereum.staking = staking("0x1702F18c1173b791900F81EbaE59B908Da8F689

module.exports = {
methodology: `Using the addresses for the fixed interest rate bonds we are able to find the underlying tokens held in each address. Once we have the underlying token we then get the balances of each of the tokens. For the CRV tokens used "CRV:STETH" for example, the address is replaced with the address of one of the tokens. In the example at hand the address is replaced with the "WETH" address so that the price can be calculated.`,
start: 1606109629, // Monday, November 23, 2020 5:33:49 AM GMT
start: '2020-11-23', // Monday, November 23, 2020 5:33:49 AM GMT
...tvlExports
}
11 changes: 11 additions & 0 deletions projects/BagelFinance/index.js
Original file line number Diff line number Diff line change
@@ -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]}),
}
}
9 changes: 0 additions & 9 deletions projects/BankOfCronos/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
const ADDRESSES = require('../helper/coreAssets.json')
const { sumTokensExport } = require("../helper/unwrapLPs");

const BOC_TREASURY_ADDRESS = "0xBacF28BF21B374459C738289559EF89978D08102";
const CUSD_ADDRESS = "0x26043Aaa4D982BeEd7750e2D424547F5D76951d4";
const USDC_ADDRESS = ADDRESSES.cronos.USDC;

module.exports = {
start: 6949784,
cronos: {
// tvl: sumTokensExport({ owner: BOC_TREASURY_ADDRESS, tokens: [CUSD_ADDRESS, USDC_ADDRESS]}),
tvl: () => 0
},
methodology:
Expand Down
1 change: 0 additions & 1 deletion projects/BankofCronos-Loans/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ async function tvl(api) {
}

module.exports = {
start: 6949784,
cronos: {
tvl,
},
Expand Down
73 changes: 73 additions & 0 deletions projects/BeetrootFinance/index.js
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
}
}
2 changes: 1 addition & 1 deletion projects/DeNet/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const owners = [
]

module.exports = {
start: 1691761595, // Friday, 11-Aug-23 13:46:35 UTC
start: '2023-08-11', // Friday, 11-Aug-23 13:46:35 UTC
methodology: "Total amount of DE tokens used for DeNet storage payments",

polygon: {
Expand Down
Loading

0 comments on commit 47320af

Please sign in to comment.