-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1c306ac
Showing
32 changed files
with
14,044 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
node_modules | ||
.pnp | ||
.pnp.js | ||
|
||
# testing | ||
coverage | ||
|
||
# production | ||
build | ||
|
||
# misc | ||
.DS_Store | ||
.env* | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# subgraph | ||
packages/subgraph/build/ | ||
packages/subgraph/src/types/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
This project was bootstrapped with [Create Eth App](https://github.com/paulrberg/create-eth-app). | ||
|
||
## Project Structure | ||
|
||
The default template is a monorepo created with [Yarn Workspaces](https://classic.yarnpkg.com/en/docs/workspaces/). | ||
|
||
Workspaces makes it possible to setup multiple packages in such a way that we only need to run `yarn install` once to install all of them in | ||
a single pass. Dependencies are hoisted at the root. | ||
|
||
``` | ||
my-eth-app | ||
├── README.md | ||
├── node_modules | ||
├── package.json | ||
├── .gitignore | ||
└── packages | ||
├── contracts | ||
│ ├── README.json | ||
│ ├── package.json | ||
│ └── src | ||
│ ├── abis | ||
│ │ ├── erc20.json | ||
│ │ └── ownable.json | ||
│ ├── addresses.js | ||
│ └── index.js | ||
├── react-app | ||
│ ├── README.md | ||
│ ├── node_modules | ||
│ ├── package.json | ||
│ ├── public | ||
│ │ ├── favicon.ico | ||
│ │ ├── index.html | ||
│ │ ├── logo192.png | ||
│ │ ├── logo512.png | ||
│ │ ├── manifest.json | ||
│ │ └── robots.txt | ||
│ └── src | ||
│ ├── App.css | ||
│ ├── App.js | ||
│ ├── App.test.js | ||
│ ├── ethereumLogo.svg | ||
│ ├── index.css | ||
│ ├── index.js | ||
│ ├── serviceWorker.js | ||
│ └── setupTests.js | ||
└── subgraph | ||
├── README.md | ||
├── abis | ||
│ └── erc20.json | ||
├── package.json | ||
├── schema.graphql | ||
├── src | ||
│ └── mappings | ||
│ ├── tokens.ts | ||
│ └── transfers.ts | ||
└── subgraph.yaml | ||
``` | ||
|
||
Owing to this dependency on Yarn Workspaces, Create Eth App can't be used with npm. | ||
|
||
## Available Scripts | ||
|
||
In the project directory, you can run: | ||
|
||
### React App | ||
|
||
#### `yarn react-app:start` | ||
|
||
Runs the React app in development mode.<br> | ||
Open [http://localhost:3000](http://localhost:3000) to view it in the browser. | ||
|
||
The page will automatically reload if you make changes to the code.<br> | ||
You will see the build errors and lint warnings in the console. | ||
|
||
#### `yarn react-app:test` | ||
|
||
Runs the React test watcher in an interactive mode.<br> | ||
By default, runs tests related to files changed since the last commit. | ||
|
||
[Read more about testing React.](https://facebook.github.io/create-react-app/docs/running-tests) | ||
|
||
#### `yarn react-app:build` | ||
|
||
Builds the React app for production to the `build` folder.<br /> | ||
It correctly bundles React in production mode and optimizes the build for the best performance. | ||
|
||
The build is minified and the filenames include the hashes.<br /> | ||
Your app is ready to be deployed! | ||
|
||
See the React documentation on [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. | ||
|
||
#### `yarn react-app:eject` | ||
|
||
**Note: this is a one-way operation. Once you `react-app:eject`, you can’t go back!** | ||
|
||
If you aren’t satisfied with the build tool and configuration choices, you can `eject` the React app at any time. This command will | ||
remove the single build dependency from your React package. | ||
|
||
Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right | ||
into the `react-app` package so you have full control over them. All of the commands except `react-app:eject` will still work, | ||
but they will point to the copied scripts so you can tweak them. At this point you’re on your own. | ||
|
||
You don’t have to ever use `react-app:eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. | ||
|
||
### Subgraph | ||
|
||
The Graph is a tool for for indexing events emitted on the Ethereum blockchain. It provides you with an easy-to-use GraphQL API. <br/> | ||
|
||
To learn more, check out the [The Graph documentation](https://thegraph.com/docs). | ||
|
||
#### `yarn subgraph:codegen` | ||
|
||
Generates AssemblyScript types for smart contract ABIs and the subgraph schema. | ||
|
||
#### `yarn subgraph:build` | ||
|
||
Compiles the subgraph to WebAssembly. | ||
|
||
#### `yarn subgraph:auth` | ||
|
||
Before deploying your subgraph, you need to sign up on the | ||
[Graph Explorer](https://thegraph.com/explorer/). There, you will be given an access token. Drop it in the command | ||
below: | ||
|
||
```sh | ||
GRAPH_ACCESS_TOKEN=your-access-token-here yarn subgraph:auth | ||
``` | ||
|
||
#### `yarn subgraph:deploy` | ||
|
||
Deploys the subgraph to the official Graph Node.<br/> | ||
|
||
Replace `paulrberg/create-eth-app` in the package.json script with your subgraph's name. | ||
|
||
You may also want to [read more about the hosted service](https://thegraph.com/docs/quick-start#hosted-service). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
{ | ||
"name": "@project/monorepo", | ||
"version": "1.0.0", | ||
"keywords": [ | ||
"ethereum", | ||
"react", | ||
"workspaces", | ||
"yarn" | ||
], | ||
"private": true, | ||
"scripts": { | ||
"subgraph:auth": "yarn workspace @project/subgraph auth", | ||
"subgraph:codegen": "yarn workspace @project/subgraph codegen", | ||
"subgraph:build": "yarn workspace @project/subgraph build", | ||
"subgraph:deploy": "yarn workspace @project/subgraph deploy", | ||
"react-app:build": "yarn workspace @project/react-app build", | ||
"react-app:eject": "yarn workspace @project/react-app eject", | ||
"react-app:start": "yarn workspace @project/react-app start", | ||
"react-app:test": "yarn workspace @project/react-app test" | ||
}, | ||
"workspaces": { | ||
"nohoist": [ | ||
"**/@graphprotocol/graph-ts", | ||
"**/@graphprotocol/graph-ts/**" | ||
], | ||
"packages": [ | ||
"packages/*" | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
## @project/contracts | ||
|
||
A minimalist, opinionated structure for managing smart contract ABIs and addresses. | ||
|
||
[Read more about Application Binary Interfaces (ABIs) here](https://ethereum.stackexchange.com/questions/234/what-is-an-abi-and-why-is-it-needed-to-interact-with-contracts). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@project/contracts", | ||
"version": "1.0.0", | ||
"main": "./src/index.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import erc20Abi from "./abis/erc20.json"; | ||
import ownableAbi from "./abis/ownable.json"; | ||
|
||
const abis = { | ||
erc20: erc20Abi, | ||
ownable: ownableAbi, | ||
}; | ||
|
||
export default abis; |
Oops, something went wrong.