Casper Uniswap is a decentralized protocol for automated token exchange on Casper.
This graphql dynamically tracks any pair created by the casper uniswap factory. It tracks of the current state of casper Uniswap contracts, and contains derived stats for things like historical data and USD prices.
- aggregated data across pairs and tokens,
- data on individual pairs and tokens,
- data on transactions
- data on liquidity providers
- historical data on Uniswap, pairs or tokens, aggregated by day
npm install to install the require packages npm start to start the server
Below are a few ways to show how to query the casper-uniswap-graphql for data. The queries show most of the information that is queryable, but there are many other filtering options that can be used, just check out the querying api. These queries can be used locally or in The Graph Explorer playground.
Contains data across all of Casper Uniswap V2. This entity tracks important things like total liquidity (in CSPR and USD, see below), all time volume, transaction count, number of pairs and more.
Contains data on a specific token. This token specific data is aggregated across all pairs, and is updated whenever there is a transaction involving that token.
Contains data on a specific pair.
Every transaction on Uniswap is stored. Each transaction contains an array of mints, burns, and swaps that occured within it.
These contain specifc information about a transaction. Things like which pair triggered the transaction, amounts, sender, recipient, and more. Each is linked to a parent Transaction entity.
This query fetches aggredated data from all Casper uniswap pairs and tokens, to give a view into how much activity is happening within the whole protocol.
{
uniswapFactories(first: 1) {
pairCount
totalVolumeUSD
totalLiquidityUSD
}
}
Paste this command on the ubuntu terminal, that will create a keys folder for you containing public key , public key hex and secret key.
casper-client keygen keys
Paste the keys folder created by the above command to Scripts/ERC20, Scripts/FACTORY, Scripts/PAIR and Scripts/ROUTER folders.
We can fund the keys from casper live website faucet page on testnet.
Use the script file in package.json to perform the deployments
"scripts": {
"deploy:erc20": "ts-node Scripts/ERC20/deploy/erc20Contract.ts",
"deploy:erc20Functions": "ts-node Scripts/ERC20/deploy/erc20ContractFunctions.ts",
"deploy:factory": "ts-node Scripts/FACTORY/deploy/factoryContract.ts",
"deploy:factoryFunctions": "ts-node Scripts/FACTORY/deploy/factoryContractFunctions.ts",
"deploy:pair": "ts-node Scripts/PAIR/deploy/pairContract.ts",
"deploy:pairFunctions": "ts-node Scripts/PAIR/deploy/pairContractFunctions.ts",
"deploy:router": "ts-node Scripts/ROUTER/deploy/routerContract.ts",
"deploy:routerFunctions": "ts-node Scripts/ROUTER/deploy/routerContractFunctions.ts"
},
Use the following commands to perform deployments
npm run deploy:erc20
npm run deploy:erc20Functions
npm run deploy:factory
npm run deploy:factoryFunctions
npm run deploy:pair
npm run deploy:pairFunctions
npm run deploy:router
npm run deploy:routerFunctions
- CONFIGURE .env BEFORE and during DEPLOYMENT