Skip to content

commitground/commitground-contracts

Repository files navigation

Commitground Contracts

This repository is used to develop & test the smart contracts for commitground using the truffle framework.

Repository Structure

.
├── .git
├── contracts
│   ├── .git
│   ...
│   └── Contracts.sol
├── build
├── migrations
│   ├── 1_initial_migration.js
│   └── 2_deploy_contracts.js
├── package.json
├── package-lock.json
├── test
│   ├── ...
│   └── testcase.js
└── truffle.js
  • contracts: Smart contracts written in Solidity are here.

  • test: This is a directory for test cases. Keep in mind that writing test cases is dependent on the contract submodule.

  • Etc

    • build: Build artifacts are stored in this directory.
    • migtrations: Script to test or deploy the contracts

Prerequisites

  1. Install truffle

    npm install -g truffle

    You can read truffle install doc here

  2. Ganache(One click ethereum private net).

    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.

Run test

  • Running test with ganache-cli.
    ./run-test.sh
  • Running test with ganache desktop app
    • First, launch the ganache app
    • Run the following command
      truffle test
      

Contributing

  1. Fork this project.

    • commitground-contracts: Fork
  2. Clone your forked commitground-contract repository first.

    $ git clone https://github.com/commitground/commitground-contracts
  3. Make branches following the convention. Please check this

    $ git checkout -b $BRANCH_NAME #e.g. feature/create-project
  4. Write test cases for a new contract. Read this to know how to write a test case.

    $ touch test/testCreateProject.js # write test cases here
  5. Write a new contract & implement.

    $ touch contracts/createProject.sol # write contracts here
  6. Write a migration script. Read this.

    $ touch migrations/n_script_title.js # write contracts here
  7. If it passes your test cases, push & make pull request.

    $ ./run-test.sh
    $ git add contracts test
    $ git commit -m "Add 'createProject' contract"
    $ git push origin $BRANCH_NAME # forked repository on your github account

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published