Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f8db6fe
Merge pull request #1 from blockchain-etl/master
askeluv Feb 8, 2020
4baf08e
Merge pull request #4 from blockchain-etl/master
askeluv May 15, 2020
2e1785a
Allow changing contract names
araa47 Jan 18, 2021
079550e
fix api endpoint
araa47 Jan 18, 2021
b1f55c0
remove unecessary space
araa47 Jan 18, 2021
43a822a
Merge pull request #14 from araa47/feat/allow-contract-name-change
askeluv Jan 21, 2021
415c6aa
WIP: move secrets to .env + add method to read abi from polygonscan
araa47 Aug 10, 2021
f7185b3
Add chain selection dropdown to UI
araa47 Aug 10, 2021
3272745
build multichain support into api
araa47 Aug 10, 2021
1b008d7
Add multichain support to UI
araa47 Aug 10, 2021
ff5cf86
Add code handling for dev vs prod api links for frontend
araa47 Aug 10, 2021
057c4c3
Add binance smart chain support
araa47 Aug 10, 2021
9d230dd
update dependencies
araa47 Aug 10, 2021
1a2e43e
Upgrade to use vercel instead of now for vercel builds
araa47 Aug 11, 2021
139f8c5
Merge pull request #27 from nansen-ai/feat/upgrade_deps
araa47 Aug 11, 2021
584aa9e
Merge pull request #26 from nansen-ai/feat/binance-support
araa47 Aug 11, 2021
7b59f35
Merge pull request #25 from nansen-ai/feat/polygon-support
araa47 Aug 11, 2021
52a0388
Cleanup + upgrade deps
araa47 Aug 11, 2021
1a21caa
First attempt to deploy backend to cloudrun
araa47 Aug 11, 2021
7aadbc3
fix port + add gunicorn to requirements.txt
araa47 Aug 11, 2021
4e59eef
Set-up firebase hosting for frontend -> dev
araa47 Aug 11, 2021
34953fd
Add docs explaining how to deploy
araa47 Aug 11, 2021
3ca3195
improve docs
araa47 Aug 11, 2021
69d7d04
Hack to solve merge conflict
araa47 Aug 11, 2021
2e4678a
Try solve merge conflicts
araa47 Aug 11, 2021
7ba1892
Merge pull request #30 from nansen-ai/feat/switch-to-google-hosting
araa47 Aug 11, 2021
80cc556
Bump python requirements
araa47 Aug 11, 2021
5fce2fd
Clean up uncessary package.json and gitignore
araa47 Aug 11, 2021
98b2ec9
Merge pull request #33 from nansen-ai/feat/bump-python-deps
araa47 Aug 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ETHERSCAN_API_KEY=
POLYGONSCAN_API_KEY=
BSCSCAN_API_KEY=
32 changes: 31 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
.now/
.vscode/
api/__pycache__/
api/__pycache__/
.env
.DS_Store
build
.fiebase
node_modules
# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# firebase
firebaseConfig.js
.firebase
123 changes: 123 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
# Contract Parser / ABI Parser

## Introduction

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

## Architecture

The project is broken into two-parts

### Frontend

This is a simple react app.

1. Lets user input addresses or ABI.
2. This is then sent to the backend to get the table defentions.
3. Once table defenitions are fetched, they are displayed allowing you to rename the dataset name and contract name.
4. Once the names have been set, you can simply download the created table defenitions for events or function calls.

## Backend

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

## Testing Locally while developing

Move into the `contract-parser-api` directory

1. Install backend dependencies using pipenv, poetry or any of your chooses python virutal environments, by running `pip install -r requirements.txt`

2. Simply run `python3 app.py`

3. Move to the `frontend` directory

4. ``yarn install`

5. `yarn start`

6. 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

## Hosting

Read below to understand how the project is deployed

### Frontend

This is hosted on firebase. Currently there are two version of this.

| Version | Firebase Project Name |
| ----------- | --------------------------- |
| Development | nansen-contract-parser-dev |
| Production | nansen-contract-parser-prod |

There are two important files that tell firebase how to host this, [.firebaserc](frontend/.firebaserc) and [firebase.json](frontend/firebase.json)

the build commands are specified in [package.json](frontend/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

### _Deployment_

To deploy to dev:

```bash
firebase use dev
yarn build:dev
yarn deploy:dev
```

To deploy to prod:

```bash
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 |
| ----------- | --------------------------- |
| Development | nansen-contract-parser-dev |
| Production | nansen-contract-parser-prod |

There are a few important files that tell cloudrun how to run this properlly. [Dockerfile](contract-parser-api/Dockerfile) tells google how to run the containerized version of the project. [iam.sh](iam.sh) is a helper script to create the necessary service workers and set the correct roles. [deploy.sh](deploy.sh) is used to deploy the project in production and development environments.

It is important that you have installed and intialized [gcloud sdk](https://cloud.google.com/sdk/docs/install)

You can run the following command to login with your nansen email

```
gcloud auth login
```

### _Deployment_

1. If this is the first time deploying run `bash iam.sh dev`, or `bash iam.sh prod`
2. Next you can run `bash deploy.sh dev` or `bash deploy.sh prod` to deploy the backend to dev or prod set-up
Loading