Skip to content

Fork helpers ​

Uniswap V2 ​

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

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

module.exports = uniTvlExport(chain, factory)

Example Uni V2 Adapter

Uniswap V3 ​

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

javascript
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' },
})

Example Uni V3 Adapter

GMX ​

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

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

Example GMX Adapter

Aave ​

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

Example Aave Fork Adapter

Compound ​

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

Example Compound Fork Adapter

Liquity ​

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

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

Example Liquity Fork Adapter

Balancer V2 ​

javascript

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

module.exports = {
  metis: {
    tvl: onChainTvl('0x...', <startBlock>),
  }
}

Example Balancer V2 Fork Adapter