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
- Host: GitHub
- URL: https://github.com/gsscoder/chainquery
- Owner: gsscoder
- Created: 2022-07-17T12:15:15.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-10-15T04:50:41.000Z (over 2 years ago)
- Last Synced: 2024-12-28T15:34:09.852Z (6 months ago)
- Topics: blockchain
- Language: JavaScript
- Homepage:
- Size: 212 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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.