Skip to content

Commit 9f9618c

Browse files
committed
Initial commit
0 parents  commit 9f9618c

12 files changed

+1917
-0
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2018 commitground
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# Commitground Contracts
2+
3+
This repository is used to develop & test the smart contracts for commitground using the truffle framework.
4+
5+
# Repository Structure
6+
7+
```.bash
8+
.
9+
├── .git
10+
├── contracts
11+
│   ├── .git
12+
│   ...
13+
│ └── Contracts.sol
14+
├── build
15+
├── migrations
16+
│   ├── 1_initial_migration.js
17+
│   └── 2_deploy_contracts.js
18+
├── package.json
19+
├── package-lock.json
20+
├── test
21+
│   ├── ...
22+
│   └── testcase.js
23+
└── truffle.js
24+
```
25+
26+
- `contracts`:
27+
Smart contracts written in Solidity are here.
28+
29+
- `test`:
30+
This is a directory for test cases. Keep in mind that writing test cases is dependent on the *contract* submodule.
31+
32+
- Etc
33+
- `build`: Build artifacts are stored in this directory.
34+
- `migtrations`: Script to test or deploy the contracts
35+
36+
# Prerequisites
37+
38+
1. Install truffle
39+
40+
```.bash
41+
npm install -g truffle
42+
```
43+
You can read truffle install doc [here](https://truffleframework.com/docs/getting_started/installation)
44+
45+
1. Ganache(One click ethereum private net).
46+
47+
Two options exist. When you run this repository on your local environment, desktop app will help you know what's happening on the blockchain. But for the CI/CD environment, 'ganache-cli' will be a better option.
48+
- [ganache-cli](https://github.com/trufflesuite/ganache-cli)
49+
- [ganache desktop app](https://truffleframework.com/ganache)
50+
51+
# Run test
52+
53+
- Running test with ganache-cli.
54+
```.bash
55+
./run-test.sh
56+
```
57+
- Running test with ganache desktop app
58+
- First, launch the ganache app
59+
- Run the following command
60+
```
61+
truffle test
62+
```
63+
64+
# Contributing
65+
66+
1. Fork this project.
67+
68+
- commitground-contracts: [![Fork](https://img.shields.io/github/forks/commitground/commitground-contracts.svg?style=social&label=Fork)](https://github.com/commitground/commitground-contracts/fork)
69+
70+
1. Clone your forked *commitground-contract* repository first.
71+
72+
```.bash
73+
$ git clone https://github.com/commitground/commitground-contracts
74+
```
75+
76+
1. Make branches following the convention. Please check [this](https://github.com/commitground/guide)
77+
78+
```.bash
79+
$ git checkout -b $BRANCH_NAME #e.g. feature/create-project
80+
```
81+
82+
1. Write test cases for a new contract. Read [this](https://truffleframework.com/docs/getting_started/javascript-tests) to know how to write a test case.
83+
84+
```.bash
85+
$ touch test/testCreateProject.js # write test cases here
86+
```
87+
88+
1. Write a new contract & implement.
89+
90+
```.bash
91+
$ touch contracts/createProject.sol # write contracts here
92+
```
93+
94+
1. Write a migration script. Read [this](https://truffleframework.com/docs/getting_started/migrations).
95+
96+
```.bash
97+
$ touch migrations/n_script_title.js # write contracts here
98+
```
99+
100+
1. If it passes your test cases, push & make pull request.
101+
102+
```.bash
103+
$ ./run-test.sh
104+
$ git add contracts test
105+
$ git commit -m "Add 'createProject' contract"
106+
$ git push origin $BRANCH_NAME # forked repository on your github account
107+
```

0 commit comments

Comments
 (0)