Git Product home page Git Product logo

lein-solc's Introduction

lein-solc

Build Status

A Leiningen plugin for compiling Solidity smart contracts.

Installation

lein-solc is available from Clojars. The latest released version is:
Clojars Project
Add it to the :plugins vector of your project.clj.

Plugin assumes solc compiler is installed and on your $PATH.

Usage

You can specify the contracts to compile by adding an :solc map to your project.clj. It takes the following key value pairs:

  • :src-path string with the path where the .sol source files are residing, relative to the projects root path.
  • :build-path string with the path where the compiled output is written to, relative to the projects root directory.
  • :abi? (optional) boolean, if true (default) output includes contract's abi interfaces.
  • :bin? (optional) boolean, if true (default) output includes contract's bytecode.
  • :truffle-artifacts? (optional) boolean, if true contracts are compiled into truffle artifacts, that can be required and deployed with truffle.
  • :contracts vector of files with the Solidity contracts source code, relative to the src-path directory (you can also specify sub-directories), or :all to compile all of the contracts in the root of the src-path.
  • :solc-err-only (optional) boolean, if true (default value) only compilation errors will be reported to the STDOUT.
  • :verbose (optional) boolean, if false (default value) the STDOUT output is limited to the most important information.
  • :byte-count boolean, if true after succesfull compilation the number of bytes in the compiled .bin file will be printed to the STDOUT. Only valid if :bin? is set to true.
  • :optimize-runs (optional) map of contract filenames and parameter n values, where 0 <= n < inf is an estimated number of contract runs for optimizer tuning. It represents a trade-off between a smaller bytecode (low values) and cheaper transaction costs (high values).

Example:

:solc {:src-path "resources/contracts/src"
       :build-path "resources/contracts/build/"
       :contracts ["MyContract.sol" "sub/MySecondContract.sol"]
       :byte-count true
       :optimize-runs {"MyContract.sol" 1}}

The contracts in :contracts will be compiled when you do:

$ lein solc once

which is equivalent to lein solc. You can also watch the :contracts files and re-compile them on changes if you do:

$ lein solc auto

lein-solc's People

Contributors

fbielejec avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lein-solc's Issues

remove `require` messages

Add a pre-processor :production true | false key which removes messages strings from contracts i.e.:

require(isOriginalValueCurrentValue(), "ParamChange: current value is not original value");

becomes :

require(isOriginalValueCurrentValue());

Ignoring changes in some files

When editing RegistryEntry.sol on MemeFactory, the plugin outputs: Ignoring changes in resources/public/contracts/src/RegistryEntry.sol.
Which shouldn't be.

Less verbose output

image

Would it be possible to make output less verbose and just display: 16840 RegistryToken.bin

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.