An open API service indexing awesome lists of open source software.

https://github.com/gsscoder/chainquery

Queries pairs and tokens data directly on chain
https://github.com/gsscoder/chainquery

blockchain

Last synced: 4 months ago
JSON representation

Queries pairs and tokens data directly on chain

Awesome Lists containing this project

README

        

# chainquery

Utilities to get data directly on chain using [UniswapV2Query](contracts/UniswapV2Query.sol) contract.

## Configuration

Choose a consistent network name across the two configuration files.

### .env

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

### appconfigs.json

```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](scripts/query/querypairs.js) to get token pairs data from the configured DEX.

- Use [querytokens](scripts/query/querytokens.js) to get tokens data using querypairs output.

- Use [jointokensfiles](scripts/postproc/jointokensfiles.js) to join querytokens output into a single file.

- Use [addtokenstopairs](scripts/postproc/addtokenstopairs.js) to add token data to pairs file and normalize reserves.

- Use [refinepairs](scripts/refine/refinepairsjs) to remove not meaningful pairs.