The following project is to make it simple to build table defenitions for ETL on multiple chains.
Currently it supports:
- Ethereum
- Polygon
- Binance Smart Chain
The project is broken into two-parts
This is a simple react app.
- Lets user input addresses or ABI.
- This is then sent to the backend to get the table defentions.
- Once table defenitions are fetched, they are displayed allowing you to rename the dataset name and contract name.
- Once the names have been set, you can simply download the created table defenitions for events or function calls.
This is a simple python flask app.
Has multiple endpoints that returns either abi or table defenitions.
Currently it works by connecting to Etherscan based explorer api's to grab the ABI from contract address.
It currently supports grabbing data from etherscan, polygonscan and bscscan
Move into the contract-parser-api directory
-
Install backend dependencies using pipenv, poetry or any of your chooses python virutal environments, by running
pip install -r requirements.txt -
Copy .env.example to .env and set-up env vars
-
Simply run
python3 app.py -
Move to the
frontenddirectory -
``yarn install`
-
yarn start -
If everything worked as expected you should have a working local version of contract-parser fronted deployed that will use the api that you just started
To run tests:
- Install dev dependencies:
$ pip install -r requirements-dev.txt
- Run tests:
$ pytest
Read below to understand how the project is deployed
This is hosted on firebase. Currently there are two version of this.
| Version | Firebase Project Name | URL |
|---|---|---|
| Development | nansen-contract-parser-dev | https://nansen-contract-parser-dev.web.app/ |
| Production | nansen-contract-parser-prod | https://nansen-contract-parser-prod.web.app/ |
There are two important files that tell firebase how to host this, .firebaserc and firebase.json
the build commands are specified in package.json
It is important for you to have firebase-tools installed. You can install this by running
npm install -g firebase-tools
Once installed you will need to login to firebase, this can be done using the command below
firebase login
Once logged in you should be able to deploy the frontend
To deploy to dev:
firebase use dev
yarn build:dev
yarn deploy:devTo deploy to prod:
firebase use prod
yarn build:prod
yarn deploy:prod### Backend
This is currenty run on cloud-run under the following proejcts
| Version | GCP Project Name | URL |
|---|---|---|
| Development | nansen-contract-parser-dev | https://contract-parser-api-s27o6wzppa-uc.a.run.app/api/ |
| Production | nansen-contract-parser-prod | https://contract-parser-api-7s4aptchzq-uc.a.run.app/api/ |
There are a few important files that tell cloudrun how to run this properlly. Dockerfile tells google how to run the containerized version of the project. iam.sh is a helper script to create the necessary service workers and set the correct roles. deploy.sh is used to deploy the project in production and development environments.
It is important that you have installed and intialized gcloud sdk
You can run the following command to login with your nansen email
gcloud auth login
- If this is the first time deploying run
bash iam.sh dev, orbash iam.sh prod - Next you can run
bash deploy.sh devorbash deploy.sh prodto deploy the backend to dev or prod set-up
To make things simple you can run the following script deployAll.sh
dev: bash deployAll.sh dev
prod: bash deployAll.sh prod
- Identify the etherscan built explorer for this chain. (ie: polygonscan, bscscan, ftmscan, ..)
- Create an account and make an API Key
- Note down the api URL
- Follow the steps in this PR
- Done, you have now added a new chain to contract-parser!