Fetch Farms Data

How to Use

Import the fetchfarms function npm package '@cryption/dapp-factory-sdk’ as shown below

Note: fetchFarms is an async function so it can be used with promised or async await

 import { fetchFarms } from '@cryption/dapp-factory-sdk’ 

const getFarms = async () => {
      const farms = await fetchFarms(
        137,
        null,
        [],
        "0x000000000000000"
      );
      if (farms.success) {
        // get data farms data farms.data
      }
 }

Input Parameters

fetchFarms accepts 4 Input Parameters as shown below

  1. chainId - Currently we Support the Following Networks on Dappfactory Accepted Values - 137/56/1/80001

    • MAINNET

      • Polygon - 137

      • Binance - 56

      • Ethereum - 1

    • TESTNET

      • Polygon Testnet - 80001

  2. imeplementationid - Currently we have 3 implementations supported in Dappfactory for Farms as below Accepted Values - 0/2/3/null

  3. Farm Filters {}

  4. account - wallet address of the user

Expected Output

The Output format will be like this

{
	success: true/false
	error: //error object
	data: [farmObject]
}

farmObject

There are some fields that are Implementation specific as follows

For Implementation 0 - Farms with DL/WL

For Implementation 2 - Quickswap Farms

For Implementation 3 - Fixed APR Farms

Last updated