GithubHelp home page GithubHelp logo

mashinokatsumi / cobra Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cobraframework/cobra

3.0 0.0 0.0 727 KB

A fast, flexible and simple development environment framework for Ethereum smart contract, testing and deployment on EVM.

Home Page: https://pypi.org/project/eth-cobra

License: Other

Python 100.00%

cobra's Introduction

Build Status PyPI Python Version PyPI License PyPI Version Coverage Status


A fast, flexible and simple development environment framework for Ethereum smart contract, testing and deployment on Ethereum virtual machine(EVM).

With cobra you can get built-in smart contract compilation, linking, deployment, binary management, automated contract testing with Unittest and PyTest frameworks, scriptable deployment & migrations framework and network management for deploying to many public & private networks like INFURA or Ganache CLI.

Dependency

This library requires the solc executable to be present.

Only versions >=0.4.2 are supported and tested though this library may work with other versions.

  • solc: Ethereum solidity compiler.
  • ganache-cli: A command-line version of Ethereum blockchain server.
  • pip: To install packages from the Python Package Index and other indexes.
  • python3: version 3.6 or greater.

Installation

PIP to install cobra globally. For Linux sudo may be required.

$ pip install eth-cobra

Development

We welcome pull requests. To get started, just fork this repo, clone it locally, and run:

$ pip install -e . -r requirements.txt

Quick Usage

Initialize project structure

A default set of contract and tests, run the following command:

$ cobra init

Get help:

$ cobra --help

From there, you can run cobra compile, cobra deploy/migrate and cobra test --unittest/--pytest to compile your contracts, deploy those contracts to the network, and run their associated unit tests.

advanced cobra.yaml
compile:
  solidity_path: "./contracts" # global
  artifact_path: "./build/contracts"
  contracts: [
    contract: {
        solidity: "Contract.sol",
        solidity_path: "./contracts/libs", # detail
        import_remappings: [
          "=/path/folder/contracts/"
       ],
        allow_paths: [
          "/path/folder/contracts/"
        ]
    }
  ]

deploy:
  artifact_path: "./build/contracts/"
  contracts: [
    contract: {
        artifact: "Contract.json",
        links: ["Contract.json"]
    }
  ]

test:
  artifact_path: "./build/contracts/"
  test_paths: ["./tests"]
  contracts: [
    contract: {
        artifact: "Contract.json",
        links: ["Contract.json"]
    }
  ]

network:
  development: {
    url: "https://ropsten.infura.io/...",
#    host: "localhost",
#    port: 8545,
    hdwallet: {
        mnemonic: "decide adjust legend nation type same task aim rigid lucky guilt close", # or
        seed: "decide adjust legend nation type same task aim rigid lucky guilt close",
        password: "meherett",
        private: "5f8935bb3b61b312ba1114cbf6f1ea30102383f2b043a1b213aa482132d25049",
        gas: 3000000,
        gas_price: 1000000
    },
    protocol: "HTTPS", # HTTP, HTTPS, WS(WebSocket) and ICP
#    account: {
#      address: "0x6a373a75c388ac2d160f1d2b6d9ada34f29831cd",
#      gas: 3000000,
#      gas_price: 1000000
#    }
  }

Testing

Tests are still under development.

You can run the tests with:

$ pytest tests

Or use tox to run the complete suite against the full set of build targets, or pytest to run specific tests against a specific version of Python.

Contributing

Feel free to open an issue if you find a problem, or a pull request if you've solved an issue.

Meta

Meheret Tesfaye – @meherett[email protected]

Distributed under the MIT license. See LICENSE for more information.

https://github.com/meherett

License

This project is licensed under the MIT License - see the LICENSE file for details

cobra's People

Contributors

meherett avatar

Stargazers

Predrag Markovic avatar Chubby Wink avatar Mashino Katsumi (ましの かつみ) avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.