Skip to content

Commit

Permalink
update contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 11, 2020
1 parent 525bc95 commit c0e0c72
Show file tree
Hide file tree
Showing 32 changed files with 14,634 additions and 1 deletion.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
19 changes: 19 additions & 0 deletions .env.example
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
9 changes: 9 additions & 0 deletions .gitignore
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
14 changes: 14 additions & 0 deletions .prettierrc
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"
}
}
]
}
8 changes: 8 additions & 0 deletions .solhint.json
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"
}
}
10 changes: 10 additions & 0 deletions Dockerfile
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
21 changes: 21 additions & 0 deletions LICENSE
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.
63 changes: 63 additions & 0 deletions README.md
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`.
Loading

0 comments on commit c0e0c72

Please sign in to comment.