watcher-ts/packages/test
Nabarun Gogoi 9e53b1a498
Upgrade dependency versions to remove vulnerabilities from dependabot (#343)
* Dependency patch updates

* Minor update @apollo/client 3.3.19 -> 3.7.10

* Minor update @nomiclabs/hardhat-ethers 2.0.2 -> 2.2.2

* Minor update @openzeppelin/contracts 4.3.2 -> 4.8.2

* Minor update @types/chai 4.2.19 -> 4.3.4

* Minor update decimal 10.3.1 -> 10.4.3

* Minor update @graphql-tools/utils 9.1.1 -> 9.2.1

* Minor update @graphql, graphql-ws, graphql-request

* Minor update yargs

* Minor update @types/node

* Minor update graph-ts

* Minor updates graphql-tools, multiaddr

* Update dependencies with minor updates

* Minor updates to eslint and related dependencies

* Update solidity compiler version for erc721-watcher

* Fix ESLint indent rule

---------

Co-authored-by: Dhruv Srivastava <dhruvdhs.ds@gmail.com>
2023-03-28 13:17:53 +05:30
..
abis Add test package (#164) 2022-08-19 11:06:11 +05:30
environments Add test package (#164) 2022-08-19 11:06:11 +05:30
src Add a CLI in eden-watcher to fill state for a given range (#176) 2022-09-09 16:23:41 +05:30
.eslintignore Add test package (#164) 2022-08-19 11:06:11 +05:30
.eslintrc.json Upgrade dependency versions to remove vulnerabilities from dependabot (#343) 2023-03-28 13:17:53 +05:30
.mocharc.yml Add test package (#164) 2022-08-19 11:06:11 +05:30
package.json Upgrade Typescript and ESLint (#337) (#342) 2023-03-24 10:31:33 +04:00
README.md Add test package (#164) 2022-08-19 11:06:11 +05:30
tsconfig.json Add test package (#164) 2022-08-19 11:06:11 +05:30

test

Setup

  • Run the following command to install required packages:

    yarn
    

Test Snapshot

  • The snapshot test suite compares results for eth-calls and getStorageAt calls to the provided endpoints.

  • Contracts considered:

    • UniswapV2 Factory
    • UniswapV2 Pair
    • USDC
    • Compound
    • Dai / Maker
  • Edit the config file:

    Eg:

    blockTag = "0xB5FFFF" # block tag to perform eth-call and getStorageAt call with (eg. block number in hex)
    
    [endpoints]
      endpoint1 = "http://127.0.0.1:8545" # endpoint1 URL
      endpoint2 = "http://127.0.0.1:8082" # endpoint2 URL
    
  • Run the following command to run the snapshot test suite:

    yarn test:snapshot
    

Individual Calls

  • Run the following to make an eth-call:

    yarn eth-call -e <endpoint> -c <contract> -a <abi> -m <method-name> --method-args [method-args] -b [block-tag]
    
    • endpoint (e): Endpoint to perform eth-call against

    • contract (c): Contract address

    • abi (a): Contract ABI path

    • method-name (m): Contract method to call

    • method-args: Contract method arguments

    • block-tag (b): Block tag to make eth-call with (block number (hex) / block hash)

      Eg.

      yarn eth-call -e http://127.0.0.1:8545 -c 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f -a abis/UniswapV2Factory.json -m allPairs --method-args 100 -b 0xB5FFFF
      
  • Run the following to make a getStorageAt call:

    yarn get-storage-at -e <endpoint> -c <contract> -s <slot> -b [block-tag]
    
    • endpoint (e): Endpoint to perform getStorageAt call against

    • contract (c): Contract address

    • slot (s): Storge slot

    • block-tag (b): Block tag to make getStorageAt call with (block number (hex) / block hash)

      Eg.

      yarn get-storage-at -e http://127.0.0.1:8545 -c 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f -s 0x1 -b 0xB5FFFF