Skip to content

Queries pairs and tokens data directly on chain

Notifications You must be signed in to change notification settings

gsscoder/chainquery

Repository files navigation

chainquery

Utilities to get data directly on chain using UniswapV2Query contract.

Configuration

Choose a consistent network name across the two configuration files.

.env

PROVIDER_URL_POLYGON="https://polygon-mainnet.g.alchemy.com/v2/..."
ACCOUNT_KEY="5fa...9f39"
UV2QUERY_ADDRESS_POLYGON="0x460...7e67"

appconfigs.json

{
  "network": "polygon",
  "dex": "quickswap",
  "pairsChunkSize": 500,
  "cooldownMs": 2000,
  "cooldownAfterFailSec": 3,
  "tokensChunkSize": 10,
  "quickswapFactoryPolygon": "0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32",
  "outputPath": "./output"
}

Usage

  • Deploy the contract: npx hardhat run .\scripts\deploy.js --network polygon.

  • Set all needed configuration values.

  • Use querypairs to get token pairs data from the configured DEX.

  • Use querytokens to get tokens data using querypairs output.

  • Use jointokensfiles to join querytokens output into a single file.

  • Use addtokenstopairs to add token data to pairs file and normalize reserves.

  • Use refinepairs to remove not meaningful pairs.

About

Queries pairs and tokens data directly on chain

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published