-
Notifications
You must be signed in to change notification settings - Fork 180
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
1 parent
525bc95
commit c0e0c72
Showing
32 changed files
with
14,634 additions
and
1 deletion.
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 @@ | ||
node_modules |
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,19 @@ | ||
# ropsten or development | ||
network=development | ||
|
||
# if ropsten, infura project id | ||
project_id=534e1d5559454d7c8cabd5e110de9813 | ||
|
||
# deploys core and whitelist contracts | ||
deployer_mnemonic=change typical hire slam amateur loan grid fix drama electric seed label | ||
|
||
# can perform admin functions like pause/unpause on core contract | ||
core_controller_mnemonic=change typical hire slam amateur loan grid fix drama electric seed label | ||
|
||
# can add and remove players from whitelist | ||
whitelist_controller_mnemonic=change typical hire slam amateur loan grid fix drama electric seed label | ||
|
||
# can upgrade core contract with oz upgradeability | ||
oz_admin_mnemonic=change typical hire slam amateur loan grid fix drama electric seed label | ||
|
||
DISABLE_ZK_CHECKS=false |
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 @@ | ||
node_modules/* | ||
build/* | ||
yarn-error.log | ||
.gitkeep | ||
*.env | ||
.env.prod | ||
|
||
.openzeppelin | ||
.openzeppelin/.session |
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,14 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
"options": { | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"bracketSpacing": false, | ||
"explicitTypes": "always" | ||
} | ||
} | ||
] | ||
} |
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,8 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"plugins": [], | ||
"rules": { | ||
"avoid-suicide": "error", | ||
"avoid-sha3": "warn" | ||
} | ||
} |
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,10 @@ | ||
FROM node:12-alpine | ||
RUN apk add --no-cache make gcc g++ python git | ||
COPY package.json package.json | ||
COPY yarn.lock yarn.lock | ||
RUN yarn add scrypt | ||
RUN yarn | ||
#RUN yarn global add @openzeppelin/cli | ||
COPY . . | ||
RUN npx oz compile --no-interactive | ||
RUN ./deploy |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Dark Forest | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,63 @@ | ||
# Dark Forest Smart Contracts | ||
|
||
## Development Guide | ||
|
||
### Installing Core Dependencies | ||
|
||
- Node (v12.18.0) | ||
- Yarn (Javascript Package Manager) | ||
- Ganache CLI | ||
|
||
#### Installing The Correct Node Version Using NVM | ||
|
||
Dark Forest is built and tested using Node.js v12.18.0 and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine. | ||
|
||
``` | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash | ||
nvm install | ||
``` | ||
|
||
After the installation is finished, you can run `node --version` to verify that you are running v12.18.0 | ||
|
||
#### Installing Yarn & Other Dev Dependencies | ||
|
||
Refer to [Yarn's official documentation](https://classic.yarnpkg.com/en/docs/install) for the installation guide. | ||
|
||
After you have Yarn installed, run the following commands in the root director install the remaining dev depencies: | ||
|
||
``` | ||
yarn global add ganache-cli | ||
yarn install | ||
``` | ||
|
||
### Smart Contract Development Setup | ||
|
||
All of our smartcontract related code are located in the `/eth` directory. | ||
|
||
- `/eth/contracts` contains the smartcontract code written in solidity | ||
- `/eth/test` contains the test for the smartcontract written in Javascript | ||
|
||
#### Installing Dependenciees | ||
|
||
**Navigate to the `/eth` folder and run the following commands:** | ||
|
||
``` | ||
yarn add scrypt | ||
yarn install | ||
``` | ||
|
||
Note: We run `yarn add scrypt` as a hack too solve a node-gyp error that a lot of our developers have encountered. | ||
|
||
#### Running Tests | ||
|
||
``` | ||
yarn test | ||
``` | ||
|
||
#### Deploying Contracts Locally | ||
|
||
First, run `oz init` in the `eth` directory (press `ENTER` to accept defaults - typechain support is irrelevant). | ||
|
||
Next, open a separate terminal and run a local blockchain with `ganache-cli`. | ||
|
||
Finally, in your original terminal, run `yarn run deploy:dev`. |
Oops, something went wrong.