mirror of
https://github.com/alexgo-io/DefiLlama-Adapters.git
synced 2026-04-30 22:02:28 +08:00
double
This commit is contained in:
77
projects/double/abis.json
Normal file
77
projects/double/abis.json
Normal file
@@ -0,0 +1,77 @@
|
||||
{
|
||||
"locked": {
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "locked",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "int128",
|
||||
"name": "amount",
|
||||
"type": "int128"
|
||||
},
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "end",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
"totalBalances": {
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"name": "totalBalances",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
"allPairsLength": {
|
||||
"inputs": [],
|
||||
"name": "allPairsLength",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
},
|
||||
"allPairs": {
|
||||
"inputs": [
|
||||
{
|
||||
"internalType": "uint256",
|
||||
"name": "",
|
||||
"type": "uint256"
|
||||
}
|
||||
],
|
||||
"name": "allPairs",
|
||||
"outputs": [
|
||||
{
|
||||
"internalType": "address",
|
||||
"name": "",
|
||||
"type": "address"
|
||||
}
|
||||
],
|
||||
"stateMutability": "view",
|
||||
"type": "function"
|
||||
}
|
||||
}
|
||||
80
projects/double/index.js
Normal file
80
projects/double/index.js
Normal file
@@ -0,0 +1,80 @@
|
||||
const sdk = require("@defillama/sdk");
|
||||
const { transformBscAddress } = require('../helper/portedTokens');
|
||||
const { unwrapUniswapLPs } = require('../helper/unwrapLPs');
|
||||
const abis = require("./abis.json");
|
||||
|
||||
const DDDX = '0x4B6ee8188d6Df169E1071a7c96929640D61f144f';
|
||||
const excludedTokens = [
|
||||
|
||||
];
|
||||
|
||||
async function bscTvl(timestamp, block, chainBlocks) {
|
||||
const balances = {};
|
||||
const transform = await transformBscAddress();
|
||||
balances[`bsc:${DDDX}`] = (await sdk.api.abi.call({
|
||||
target: '0xFe9e21e78089094E1443169c4c74bBBBcBb13DE0', //ve
|
||||
abi: abis.locked,
|
||||
params: [8],
|
||||
block: chainBlocks.bsc,
|
||||
chain: 'bsc'
|
||||
})).output.amount;
|
||||
|
||||
const noPairs = (await sdk.api.abi.call({
|
||||
target: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', // BaseV1Factory
|
||||
abi: abis.allPairsLength,
|
||||
block: chainBlocks.bsc,
|
||||
chain: 'bsc'
|
||||
})).output;
|
||||
|
||||
const pairAddresses = (await sdk.api.abi.multiCall({
|
||||
target: '0xb5737A06c330c22056C77a4205D16fFD1436c81b', // BaseV1Factory
|
||||
calls: Array.from({ length: Number(noPairs) }, (_, k) => ({
|
||||
params: k,
|
||||
})),
|
||||
abi: abis.allPairs,
|
||||
block: chainBlocks.bsc,
|
||||
chain: 'bsc'
|
||||
})).output;
|
||||
|
||||
let pairBalances = (await sdk.api.abi.multiCall({
|
||||
target: '0x89BEda6E5331CdDEe6c9a5Ad1B789ce6dFEBe6c7', // LpDepositor
|
||||
calls: pairAddresses.map(a => ({
|
||||
params: a.output
|
||||
})),
|
||||
abi: abis.totalBalances,
|
||||
block: chainBlocks.bsc,
|
||||
chain: 'bsc'
|
||||
})).output;
|
||||
|
||||
let lpPositions = [];
|
||||
for (let i = 0; i < pairBalances.length; i++) {
|
||||
if (
|
||||
pairAddresses[i].output &&
|
||||
excludedTokens.includes(pairAddresses[i].output.toLowerCase())
|
||||
) {
|
||||
continue;
|
||||
};
|
||||
lpPositions.push({
|
||||
balance: pairBalances[i].output,
|
||||
token: pairAddresses[i].output
|
||||
});
|
||||
};
|
||||
|
||||
await unwrapUniswapLPs(
|
||||
balances,
|
||||
lpPositions,
|
||||
chainBlocks.bsc,
|
||||
'bsc',
|
||||
transform
|
||||
);
|
||||
|
||||
return balances;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
doublecounted:true,
|
||||
|
||||
bsc: {
|
||||
tvl:bscTvl,
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user