DeFi Llama
  • List your project
    • DefiLlama and our methodology
    • How to list a DeFi project
    • How to add a new Blockchain
    • How to write an SDK adapter
    • Functions we've written so you don't have to
      • Staking and Pool2
      • Fork helpers
      • General EVM contract calls
    • What to include as TVL?
    • How to update a project
    • How to write dimensions adapters
    • Emissions dashboard
      • Protocol Files
      • Emission Sections
      • Testing
    • Oracles TVS
  • analysts
    • Data Definitions
    • Custom columns
  • Chainlist
    • How to change Ethereum's RPC
    • Add a new RPC endpoint
  • FAQs
    • Frequently Asked Questions
  • Coin Prices API
  • Pricing
Powered by GitBook
On this page
  • Uniswap V2
  • Uniswap V3
  • GMX
  • Aave
  • Compound
  • Liquity
  • Balancer V2

Was this helpful?

  1. List your project
  2. Functions we've written so you don't have to

Fork helpers

PreviousStaking and Pool2NextGeneral EVM contract calls

Last updated 1 year ago

Was this helpful?

Uniswap V2

There are a few different helpers for Uni V2 forks but we recommend using uniTvlExport.

const { uniTvlExport } = require('../helper/unknownTokens')
const chain = 'yourChain'
const factory = '0x...' // v2 factory address

module.exports = uniTvlExport(chain, factory)

Uniswap V3

There are a few different helpers for Uni V3 forks but we recommend using uniTvlExport.

const { uniV3Export } = require('../helper/uniswapV3')

module.exports = uniV3Export({
  chainX: { factory: '0x...', fromBlock: 'block when factory contract was deployed' },
  chainY: { factory: '0x...', fromBlock: 'block when factory contract was deployed' },
})

GMX

const { gmxExports } = require('../helper/gmx')

module.exports = {
  bsc: {
    tvl: gmxExports({ vault: '0x...', })
  }
}

Aave

const { aaveExports } = require("../helper/aave")

Compound

const { compoundExports2 } = require("../helper/compound");
module.exports = {
  polygon: compoundExports2({ 
    comptroller: '0x...',
    cether: '0x...', // optional, needed if gas token is used
  }),
};

Liquity

const { getLiquityTvl } = require("../helper/liquity.js")

module.exports = {
  chainX: {
    tvl: getLiquityTvl('0x...'),
  }
}

Balancer V2


const { onChainTvl } = require('../helper/balancer')

module.exports = {
  metis: {
    tvl: onChainTvl('0x...', <startBlock>),
  }
}
DefiLlama-Adapters/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Uni V2 Adapter
DefiLlama-Adapters/projects/beamswap-v3/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Uni V3 Adapter
DefiLlama-Adapters/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example GMX Adapter
DefiLlama-Adapters/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Aave Fork Adapter
DefiLlama-Adapters/projects/basilisk/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Compound Fork Adapter
Logo
DefiLlama-Adapters/projects/liquidloans-io/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Liquity Fork Adapter
DefiLlama-Adapters/projects/hummus-weighted/index.js at main · DefiLlama/DefiLlama-AdaptersGitHub
Example Balancer V2 Fork Adapter
Logo
Logo
Logo
Logo
Logo
Logo