-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
19 additions
and
76 deletions.
There are no files selected for viewing
This file was deleted.
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 |
---|---|---|
@@ -1,23 +1,23 @@ | ||
const {tvl} = require('../helper/kayakPoolTvl'); // 确保路径正确 | ||
const { getLogs2 } = require('../helper/cache/getLogs') | ||
const { sumTokens2 } = require('../helper/unwrapLPs') | ||
|
||
const PoolAddress = { | ||
avax_savax: "0x9173398180C86eB4A313F4e6EcdE24aDCaD9df34", | ||
usdt_usdc: "0x385a1b97b5f887B3987992ad959698915D5519E4", | ||
}; | ||
|
||
async function displayTVL() { | ||
try { | ||
const tvl1 = await tvl(); | ||
console.log("tvl1:",tvl1) | ||
return {'USD': tvl1}; | ||
} catch (error) { | ||
console.error('Error fetching TVL:', error); | ||
} | ||
const config = { | ||
avax: { factory: '0x4df3038C2C7e13F46F0d63eC3AF5728F75Be3775', fromBlock: 46950081, } | ||
} | ||
|
||
module.exports = { | ||
methodology: "Summary of the value of most locked assets denominated in USD. These assets are counted based on the number of tokens on the chain. For more details, please visit our official website: https://kayakfinance.io/.", | ||
avax: { | ||
tvl: displayTVL | ||
Object.keys(config).forEach(chain => { | ||
const { factory, fromBlock, } = config[chain] | ||
module.exports[chain] = { | ||
tvl: async (api) => { | ||
const logs = await getLogs2({ | ||
api, | ||
factory, | ||
eventAbi: 'event NewStableSwapPair(address indexed swapContract, address indexed tokenA, address indexed tokenB)', | ||
fromBlock, | ||
}) | ||
|
||
const ownerTokens = logs.map(i => [[i.tokenA, i.tokenB], i.swapContract]) | ||
return sumTokens2({ api, ownerTokens }) | ||
} | ||
}; | ||
} | ||
}) |