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
Input Parameters
fetchFarms accepts 4 Input Parameters as shown below
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
imeplementationid - Currently we have 3 implementations supported in Dappfactory for Farms as below Accepted Values - 0/2/3/null
ImplementationImplementation IdFarms with DL/WL
0
Quickswap Farms
2
Fixed APR Farms
3
Farm Filters {}
account - wallet address of the user
Expected Output
The Output format will be like this
farmObject
id
Farm Contract Address
string
totalInputTokensStaked
Total LP tokens Staked in farm
String
implementationId
Implementation Type of Farm
String
inputToken
LP Token Address
string
inputTokenURL
token0 and token1 url
string
owner
Owner Address of Farm
string
token0Address
Token 0 Address in LP
String
token0Decimals
Token 0 Decimals in LP
String
token0Name
Token 0 Name in LP
String
token0Symbol
Token 0 Symbol in LP
String
token1Address
Token 1 Address in LP
String
token1Decimals
Token 1 Decimals in LP
String
token1Name
Token 1 Name in LP
String
token1Symbol
Token 1 Symbol in LP
String
routerAddress
Router Address for LP
totalSupply
String
stakedBalance
User Staked Balance
String
earnings
User’s Rewards Earned
String
balance
User’s LP Token Balance
There are some fields that are Implementation specific as follows
For Implementation 0 - Farms with DL/WL
endTimestamp
End Timestamp for Farm
String
harvestInterval
Harvest Interval
String
nextHarvest
Next Harvest Timestamp
String
withdrawalFee
Withdrawal fee for farm
String
tokenAmount
String
quoteTokenAmount
String
multiplier
String
rewardPools
[{ rewardToken: token Address rewardTokenDecimals: Token Decimals rewardTokenName: Token Name rewardTokenURL: Token Image Url blockRewardPerSec: Rewards Per Block rewardTokenSymbol: Token Symbol endTimestamp: Reward End Timestamp startTimestamp: Reward Start Timestamp }]
Array of Objects
For Implementation 2 - Quickswap Farms
periodFinish
End Timestamp for Farm
String
rewardPools
[{ rewardToken: token Address rewardTokenDecimals: Token Decimals rewardTokenName: Token Name rewardTokenURL: Token Image Url rewardRate: Rewards Per Block rewardTokenSymbol: Token Symbol rewardsAmount: Reward Amount set }]
Array of Objects
For Implementation 3 - Fixed APR Farms
endTimestamp
End Timestamp for Farm
String
harvestInterval
Harvest Interval
String
nextHarvest
Next Harvest Timestamp
String
withdrawalFee
Withdrawal fee for farm
String
tokenAmount
String
quoteTokenAmount
String
multiplier
String
rewardPools
[{ rewardToken: token Address actualAPR: APR for Fixed Farm rewardTokenDecimals: Token Decimals rewardTokenName: Token Name rewardTokenURL: Token Image Url blockRewardPerSec: Rewards Per Block rewardTokenSymbol: Token Symbol endTimestamp: Reward End Timestamp startTimestamp: Reward Start Timestamp }]
Array of Objects
Last updated