watcher-ts/packages/uniswap
Ashwin Phatak da758aceaa
Script to deploy uniswap contracts locally for testing (#118)
* Initial setup with hardhat.

* Deploy Factory contract.

* Deploy tokens and create pool using factory contract.

* Deploy contract to private network.

* Implement separate scripts for deploying Factory, Token and Pool.

Co-authored-by: nikugogoi <95nikass@gmail.com>
2021-07-05 11:05:45 +05:30
..
contracts Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
queries Aggregation in entities (#109) 2021-06-30 17:16:50 +05:30
schema uniswap-info-watcher package with frontend schema (#114) 2021-07-02 16:26:32 +05:30
tasks Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
.env.example Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
.gitignore Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
aggregation.md Aggregation in entities (#109) 2021-06-30 17:16:50 +05:30
contract.md Aggregation in entities (#109) 2021-06-30 17:16:50 +05:30
design-notes.md Aggregation in entities (#109) 2021-06-30 17:16:50 +05:30
hardhat.config.ts Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
package.json Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
README.md Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30
tsconfig.json Script to deploy uniswap contracts locally for testing (#118) 2021-07-05 11:05:45 +05:30

Uniswap

Instructions

Deploy contracts

# Create .env.
$ cp .env.example .env
# Set ETH_RPC_URL variable to target chain network.

# Deploy contracts to private network specified by ETH_RPC_URL
$ yarn deploy:factory
# Factory deployed to: 0x5FbDB2315678afecb367f032d93F642f64180aa3

$ yarn deploy:token --name Token0 --symbol TK0
# token TK0 deployed to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512

$ yarn deploy:token --name Token1 --symbol TK1
# token TK1 deployed to: 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0

$ yarn create:pool --factory 0x5FbDB2315678afecb367f032d93F642f64180aa3 --token0 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512 --token1 0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 --fee 500
# Pool deployed to: 0x315244f2680ABa32F27004B67d83E53c8c88F5FE


# For local development.
# Start hardhat local network.
$ yarn hardhat node

# Deploy contracts to local network.
# Deploy contracts to private network specified by ETH_RPC_URL
$ yarn deploy:factory --network localhost
$ yarn deploy:token --network localhost --name Token0 --symbol TK0

Scripts

  • generate:schema

    Generate schema for uniswap subgraph in graphql format. The get-graphql-schema tool is used to generate the schema (https://github.com/prisma-labs/get-graphql-schema). The uniswap subgraph graphql endpoint is provided in the script to generate the schema.

  • lint:schema

    Lint schema graphql files.

    $ yarn lint:schema schema/frontend.graphql
    
  • deploy:factory

    Deploy Factory contract.

    $ yarn deploy:factory
    
    # Deploy to hardhat local network.
    $ yarn deploy --network localhost
    
  • deploy:token

    Deploy Token contract.

    $ yarn deploy:token --name TokenName --symbol TKS
    
  • create:pool

    Create pool with factory contract and tokens.

    $ yarn create:pool --factory 0xFactoryAddress --token0 0xToken0Address --token1 0xToken1Address --fee 500
    

References