Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions projects/defidash/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@

const sdk = require('@defillama/sdk');
const DEFI_DASH_CONTRACT = '0x59B88318d239da34188C42B9e76aAC6D50265974';
const DEFI_DASH_TOKEN = '0xd6df108d516a5dc83f39020a349085c79d4edf0d';

async function tvl(api) {
// Get ETH balance using sdk
const ethBalance = (await sdk.api.eth.getBalance({
target: DEFI_DASH_CONTRACT,
chain: api.chain,
block: api.block,
})).output;
api.add('0x0000000000000000000000000000000000000000', ethBalance);

// Get ERC20 token balance using standard ABI call
const tokenBalance = await api.call({
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any DEFI_DASH_TOKEN balance should be excluded from tvl and exported as staking. This function may ne useful: const { staking } = require('./helper/staking')

abi: 'erc20:balanceOf',
target: DEFI_DASH_TOKEN,
params: [DEFI_DASH_CONTRACT],
});
api.add(DEFI_DASH_TOKEN, tokenBalance);
}

module.exports = {
methodology: 'Counts the ETH and/or ERC20 tokens held in the DefiDash contract as TVL.',
start: 33669807, // TODO: Replace with the actual block number when contract deployed on Base
base: {
tvl,
},
timetravel: true,
misrepresentedTokens: false,
};
Loading