Unverified Commit 7ecf8a36 authored by Michael Müller's avatar Michael Müller Committed by GitHub

Polish readme (#264)

* Polish readme

* Remove superfluous line

* Implement comments

* Improve text
parent 2d73e267
Pipeline #135349 passed with stages
in 5 minutes and 22 seconds
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="1068"
height="460"
viewBox="0 0 1068 460"
fill="none"
version="1.1"
id="svg20"
sodipodi:docname="cargo-contract-color-clipped.svg"
inkscape:version="1.0.2 (e86c870879, 2021-01-15, custom)">
<metadata
id="metadata26">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs24" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1918"
inkscape:window-height="1055"
id="namedview22"
showgrid="false"
inkscape:zoom="0.51484375"
inkscape:cx="640"
inkscape:cy="320"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="svg20" />
<g
id="g59"
transform="translate(-106,-89.794188)">
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 876.672,403.202 c -14.819,5.364 -23.068,21.05 -18.409,35.007 4.659,13.958 20.473,20.935 35.292,15.572 14.819,-5.364 23.068,-21.05 18.409,-35.007 -4.659,-13.957 -20.473,-20.935 -35.292,-15.572 z M 393.035,261.378 c 3.869,0 5.803,1.935 5.803,5.804 v 181.839 c 0,3.868 -1.934,5.803 -5.803,5.803 h -38.303 c -3.869,0 -5.803,-1.935 -5.803,-5.803 V 267.182 c 0,-3.869 1.934,-5.804 5.803,-5.804 z m 157.464,-1.547 c 42.172,0 56.873,28.63 56.873,68.093 v 121.097 c 0,3.868 -1.934,5.803 -5.803,5.803 h -38.302 c -3.869,0 -5.804,-1.935 -5.804,-5.803 V 322.12 c 0,-13.154 -9.672,-17.797 -20.892,-17.797 h -4.642 c -16.637,0 -28.63,6.964 -32.886,13.928 v 130.77 c 0,3.868 -1.935,5.803 -5.804,5.803 h -38.302 c -3.869,0 -5.803,-1.935 -5.803,-5.803 V 267.182 c 0,-3.869 1.934,-5.804 5.803,-5.804 h 38.302 c 3.869,0 5.804,1.935 5.804,5.804 v 17.023 c 5.803,-9.672 20.505,-24.374 49.135,-24.374 z M 697.905,184 c 3.869,0 5.803,1.935 5.803,5.803 v 134.252 l 54.939,-58.034 c 2.321,-2.708 5.803,-4.643 8.899,-4.643 h 39.849 c 5.03,0 9.672,5.804 2.708,13.155 l -57.646,61.902 67.319,107.943 c 2.321,4.256 1.934,10.446 -4.643,10.446 h -36.368 c -5.029,0 -9.672,-1.548 -12.767,-6.964 l -47.201,-78.152 -15.089,15.089 v 64.224 c 0,3.868 -1.934,5.803 -5.803,5.803 h -38.302 c -3.869,0 -5.804,-1.935 -5.804,-5.803 V 189.803 c 0,-3.868 1.935,-5.803 5.804,-5.803 z m -331.528,9.192 c -14.524,4.391 -23.263,19.045 -19.505,32.704 3.759,13.658 18.601,21.182 33.125,16.791 14.523,-4.391 23.263,-19.046 19.504,-32.704 -3.758,-13.658 -18.601,-21.182 -33.124,-16.791 z"
fill="#d8b6ff"
id="path2" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 871.936,358.164 -8.431,-0.063 c -3.869,0 -5.803,-1.934 -5.803,-5.803 V 189.803 c 0,-3.868 1.934,-5.803 5.803,-5.803 h 39.463 c 3.869,0 5.804,1.935 5.804,5.803 l -0.024,5.484 c -15.008,3.656 -26.694,18.949 -27.629,38.018 -0.751,15.316 5.624,29.19 15.701,37.04 -7.507,5.108 -13.025,13.734 -14.408,24.065 -1.506,11.248 2.24,21.904 9.186,28.949 -7.011,3.078 -13.397,9.368 -17.031,17.662 -2.569,5.864 -3.371,11.836 -2.631,17.143 z"
fill="#d8b6ff"
id="path4" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="m 884.126,345.023 c -2.877,6.566 -0.676,13.499 4.911,15.473 5.587,1.974 12.458,-1.755 15.335,-8.321 2.877,-6.567 0.676,-13.5 -4.911,-15.473 -5.587,-1.974 -12.458,1.755 -15.335,8.321 z m 10.419,-48.072 c -1.92,10.165 3.44,19.709 11.964,21.298 8.523,1.59 17.002,-5.374 18.923,-15.539 1.921,-10.166 -3.44,-19.71 -11.963,-21.299 -8.524,-1.589 -17.003,5.374 -18.924,15.54 z m -2.141,-59.916 c -0.682,13.91 8.254,25.874 19.942,26.7 11.688,0.827 21.731,-9.795 22.413,-23.705 0.682,-13.91 -8.254,-25.874 -19.942,-26.7 -11.688,-0.826 -21.731,9.796 -22.413,23.705 z"
fill="#d8b6ff"
id="path6" />
<rect
width="144"
height="36"
rx="8"
transform="matrix(1,0,0,-1,960,455)"
fill="#5a007e"
id="rect8"
x="0"
y="0" />
<path
d="m 176,263 c 0,-4.418 3.582,-8 8,-8 h 24 c 4.418,0 8,3.582 8,8 v 24 c 0,4.418 -3.582,8 -8,8 h -24 c -4.418,0 -8,-3.582 -8,-8 z"
fill="#5a007e"
id="path10" />
<path
d="m 176,447 c 0,4.418 3.582,8 8,8 h 24 c 4.418,0 8,-3.582 8,-8 v -24 c 0,-4.418 -3.582,-8 -8,-8 h -24 c -4.418,0 -8,3.582 -8,8 z"
fill="#5a007e"
id="path12" />
<path
d="m 216,303 c 0,-4.418 3.582,-8 8,-8 h 24 c 4.418,0 8,3.582 8,8 v 24 c 0,4.418 -3.582,8 -8,8 h -24 c -4.418,0 -8,-3.582 -8,-8 z"
fill="#5a007e"
id="path14" />
<path
d="m 216,407 c 0,4.418 3.582,8 8,8 h 24 c 4.418,0 8,-3.582 8,-8 v -24 c 0,-4.418 -3.582,-8 -8,-8 h -24 c -4.418,0 -8,3.582 -8,8 z"
fill="#5a007e"
id="path16" />
<path
d="m 256,343 c 0,-4.418 3.582,-8 8,-8 h 24 c 4.418,0 8,3.582 8,8 v 24 c 0,4.418 -3.582,8 -8,8 h -24 c -4.418,0 -8,-3.582 -8,-8 z"
fill="#5a007e"
id="path18" />
</g>
</svg>
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg width="100%" height="100%" viewBox="0 0 585 1776" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:1.5;"><g id="ink-_just-squid" serif:id="ink!_just-squid"><g id="head"><path d="M61.588,492.612c0,0 -7.787,-35.339 -17.042,-77.338c-15.38,-69.798 16.47,-141.479 78.578,-176.847c40.366,-23.045 83.92,-59.209 115.553,-115.363" style="fill:#bc83fb;stroke:#000;stroke-width:38.83px;"/><path d="M544.14,492.612c0,0 4.848,-21.725 11.014,-49.353c12.986,-58.202 -14.727,-117.872 -67.575,-145.499c-52.995,-27.815 -109.76,-79.723 -114.748,-174.696l-0.854,319.551l172.163,49.997Z" style="fill:#bc83fb;stroke:#000;stroke-width:38.83px;"/><path d="M271.404,61.098c0.001,-0.002 8.026,-36.942 49.417,-37.199c22.92,-0.142 43.073,15.169 49.416,37.194c0.001,0.001 18.468,136.346 28.237,208.471c3.615,26.687 15.518,51.566 34.03,71.125c64.995,68.641 209.497,254.328 67.775,427.883c0,0 -11.16,-146.803 -188.333,-146.803c-31.161,0 25.086,0 -6.074,0c-177.173,0 -200.355,146.803 -200.355,146.803c-178.127,-218.137 111.546,-582.703 165.887,-707.474Z" style="fill:#bc83fb;stroke:#000;stroke-width:47.8px;"/></g><path id="body_bg" d="M485.165,826.25c59.883,25.856 80.376,99.619 64.177,160.974c-0.006,0.022 -0.011,0.044 -0.015,0.066c-76.121,391.969 -273.048,737.581 -353.108,764.548c0,0 14.566,-96.568 21.806,-144.572c3.182,-21.093 2.061,-42.611 -3.296,-63.259c-21.189,-80.793 -71.186,-148.893 -91.258,-226.697c-30.168,-116.941 -38.327,-243.9 -77.662,-386.562c-11.653,-41.965 7.464,-86.386 45.952,-106.773c-0.039,-0.076 -0.039,-0.076 -0.039,-0.076c54.691,-10.513 8.172,-71.692 5.561,-116.782c42.402,-127.461 76.691,-171.199 189.145,-172.715c121.934,-11.058 190.547,83.668 222.079,170.506c-10.38,109.706 -29.437,100.192 -23.342,121.342Z" style="fill:#bc83fb;"/><g id="flippers"><path d="M505.519,1167.22c-111.845,446.167 -51.515,489.313 -51.515,489.313l-80.526,-75.666" style="fill:#5a007e;stroke:#000;stroke-width:47.8px;"/><path d="M114.632,1280.12c7.085,192.97 44.58,303.81 -22.91,337.857c0,0 71.031,-2.088 107.259,-60.746" style="fill:#5a007e;stroke:#000;stroke-width:47.8px;"/></g><g id="light"><path d="M455.392,845.552l53.236,32.453c15.547,9.478 23.268,27.853 19.155,45.59c-23.426,100.128 -101.538,423.999 -152.836,516.733l-1.498,5.541l-5.115,19.169c-4.31,20.485 -9.004,45.187 -8.722,32.685l8.722,-32.685c2.245,-10.959 4.41,-20.72 5.615,-22.841l0.998,-1.869c67.527,-250.121 123.383,-436.843 -7.457,-539.047c45.508,-7.88 74.756,-25.832 87.902,-55.729Z" style="fill:#d8b6ff;"/><path d="M298.366,80.959c0.859,-19.666 -33.441,70.938 -35.595,77.779c-60.307,191.603 -222.861,305.457 -155.678,529.851c0.599,2.001 7.039,-11.202 19.882,-33.997c36.458,-64.714 135.245,-82.878 135.245,-82.878c-187.957,-146.439 29.662,-342.272 36.146,-490.755Z" style="fill:#5a007e;"/><path d="M334.482,92.912c4.751,-19.103 13.025,40.858 11.696,47.906c-34.982,185.571 247.214,345.882 149.704,559.724c-0.425,0.933 -7.418,-32.56 -26.602,-57.787c-19.908,-26.181 -52.026,-44.151 -52.026,-44.151c104.517,-117.24 -144.544,-257.319 -82.772,-505.692Z" style="fill:#d8b6ff;"/><path d="M213.77,895.126c-125.926,104.11 17.82,544.184 32.353,724.18c0.159,1.97 -0.512,3.869 -0.819,5.72c-3.224,19.418 -3.006,-33.561 -3.849,-40.684c-7.219,-60.975 -39.367,-151.175 -74.873,-226.186c-36.848,-77.846 -42.666,-198.965 -51.182,-282.213c-13.834,-135.245 -60.477,-169.659 27.876,-237.628c0.248,-0.191 2.731,0.897 6.684,2.883c9.77,26.173 30.992,43.776 63.81,53.928Z" style="fill:#5a007e;"/><path d="M221.199,897.32l3.017,0.727c-27.171,39.278 -62.221,177.976 1.925,557.989c-15.66,-92.769 -101.049,-443.859 -6.891,-559.278l1.949,0.562Z" style="fill:#d8b6ff;"/><path d="M229.538,899.33c19.853,4.357 43.194,6.542 70.031,6.689c-73.29,35.322 -111.4,86.451 -42.925,437.052c19.978,102.293 -11.207,202.261 -10.521,276.235c0.019,1.977 -0.512,3.869 -0.819,5.72c-3.224,19.418 -3.006,-33.561 -3.849,-40.684c-23.438,-278.138 -61.397,-522.872 -11.917,-685.012Z" style="fill:#5a007e;"/></g><path id="body_line" d="M485.165,826.25c59.883,25.856 80.376,99.619 64.177,160.974c-0.006,0.022 -0.011,0.044 -0.015,0.066c-76.121,391.969 -273.048,737.581 -353.108,764.548c0,0 14.566,-96.568 21.806,-144.572c3.182,-21.093 2.061,-42.611 -3.296,-63.259c-21.189,-80.793 -71.186,-148.893 -91.258,-226.697c-28.861,-111.876 -37.579,-232.92 -72.722,-368.112c-13.613,-52.308 12.668,-106.778 62.085,-128.675c-0.039,-0.089 -0.039,-0.089 -0.039,-0.089" style="fill:none;stroke:#000;stroke-width:47.8px;"/><g id="tenticles"><path d="M330.94,1487.71c-7.247,28.951 4.705,57.396 26.674,63.481c21.969,6.085 45.689,-12.478 52.936,-41.429c7.247,-28.951 -4.706,-57.395 -26.675,-63.481c-21.969,-6.085 -45.688,12.479 -52.935,41.429Z" style="fill:#d8b6ff;stroke:#000;stroke-width:47.8px;"/><path d="M375.149,1349.05c-9.986,36.514 4.39,72.917 32.083,81.243c27.693,8.325 58.284,-14.56 68.27,-51.074c9.986,-36.514 -4.39,-72.918 -32.083,-81.243c-27.693,-8.326 -58.284,14.56 -68.27,51.074Z" style="fill:#d8b6ff;stroke:#000;stroke-width:47.8px;"/><path d="M294.861,1587.31c-13.531,22.432 -10.45,48.869 6.875,58.999c17.326,10.13 42.378,0.142 55.909,-22.29c13.531,-22.433 10.451,-48.869 -6.875,-58.999c-17.326,-10.13 -42.377,-0.142 -55.909,22.29Z" style="fill:#d8b6ff;stroke:#000;stroke-width:47.8px;"/><path d="M236.999,1669.42c-17.263,15.764 -21.137,38.383 -8.646,50.48c12.491,12.097 36.648,9.12 53.91,-6.644c17.263,-15.764 21.137,-38.383 8.646,-50.48c-12.491,-12.097 -36.648,-9.12 -53.91,6.644Z" style="fill:#d8b6ff;stroke:#000;stroke-width:47.8px;"/></g><g id="face"><path d="M289.677,785.548c0,0 0,0.002 0.001,0.004c3.201,8.634 11.431,14.367 20.638,14.376c9.208,0.01 17.45,-5.706 20.668,-14.333c0.063,-0.168 0.095,-0.255 0.095,-0.255" style="fill:none;stroke:#000;stroke-width:17.41px;"/><path d="M369.563,730.226c0,0 1.993,-1.381 5.108,-3.539c20.62,-14.29 48.782,-10.196 64.48,9.374c1.325,1.652 2.116,2.638 2.116,2.638" style="fill:none;stroke:#000;stroke-width:29.87px;"/><path d="M253.404,731.668c0,0 -6.294,-3.257 -14.187,-7.343c-18.502,-9.576 -41.076,-6.06 -55.789,8.691c-4.511,4.523 -7.824,7.845 -7.824,7.845" style="fill:none;stroke:#000;stroke-width:29.87px;"/></g></g></svg>
\ No newline at end of file
# Cargo plugin for [`ink!`](https://github.com/paritytech/ink) contracts
<div align="center">
<img src="./.images/cargo-contract.svg" alt="cargo-contract" height="170" />
[![GitHub license](https://img.shields.io/github/license/paritytech/cargo-contract)](LICENSE)
[![GitLab Status](https://gitlab.parity.io/parity/cargo-contract/badges/master/pipeline.svg)](https://gitlab.parity.io/parity/cargo-contract/pipelines)
[![Latest Version](https://img.shields.io/crates/v/cargo-contract.svg)](https://crates.io/crates/cargo-contract)
[![CI Status][a1]][a2]
[![Matrix Chat][b1]][b2]
[![Discord Chat][c1]][c2]
[![Latest Release][d1]][d2]
A CLI tool for helping setting up and managing WebAssembly smart contracts written with ink!.
[a1]: https://gitlab.parity.io/parity/cargo-contract/badges/master/pipeline.svg
[a2]: https://gitlab.parity.io/parity/cargo-contract/pipelines
[b1]: https://img.shields.io/badge/matrix-chat-brightgreen.svg?style=flat
[b2]: https://riot.im/app/#/room/#ink:matrix.parity.io
[c1]: https://img.shields.io/discord/722223075629727774?style=flat-square&label=discord
[c2]: https://discord.gg/ztCASQE
[d1]: https://img.shields.io/crates/v/cargo-contract.svg
[d2]: https://crates.io/crates/cargo-contract
## Installation
<p align="center">
> <img src="./.images/ink-squid.svg" alt="squink, the ink! mascot" style="vertical-align: middle" align="left" height="60" />`cargo-contract` is a CLI tool which helps you develop smart contracts in Parity's <a href="https://github.com/paritytech/ink">ink!</a>.<br/>ink! is a Rust [eDSL](https://wiki.haskell.org/Embedded_domain_specific_language) which allows you to write smart contracts for blockchains built on the [Substrate](https://github.com/paritytech/substrate) framework.
</p>
<br/>
`rust-src` is a prerequisite: `rustup component add rust-src`.
[Guided Tutorial for Beginners](https://substrate.dev/substrate-contracts-workshop/#/0/building-your-contract)&nbsp;&nbsp;&nbsp;&nbsp;
[ink! Documentation Portal](https://paritytech.github.io/ink-docs)
`binaryen` is a prerequisite as well, we use it for optimizing the contract Wasm.
<br/>
</div>
Install [`binaryen`](https://github.com/WebAssembly/binaryen#tools) with a version >= 99.
Many package managers have it available nowadays:
More relevant links:
* Talk to us on [Element][b2] or [Discord][c2]
* [`ink!`](https://github.com/paritytech/ink) ‒ The main ink! repository with smart contract examples
* [Canvas UI](https://paritytech.github.io/canvas-ui/#/upload) ‒ Frontend for contract deployment and interaction
* [Canvas Node](https://github.com/paritytech/canvas-node) ‒ Simple Substrate blockchain which includes smart contract functionality
## Installation
* [Debian/Ubuntu](https://tracker.debian.org/pkg/binaryen): `apt-get install binaryen`
* [Homebrew](https://formulae.brew.sh/formula/binaryen): `brew install binaryen`
* [Arch Linux](https://archlinux.org/packages/community/x86_64/binaryen/): `pacman -S binaryen`
* Windows: [binary releases are available](https://github.com/WebAssembly/binaryen/releases)
* Step 1: `rustup component add rust-src`.
* Step 2: Install `binaryen` in a version >= 99:
* [Debian/Ubuntu](https://tracker.debian.org/pkg/binaryen): `apt-get install binaryen`
* [Homebrew](https://formulae.brew.sh/formula/binaryen): `brew install binaryen`
* [Arch Linux](https://archlinux.org/packages/community/x86_64/binaryen/): `pacman -S binaryen`
* Windows: [binary releases are available](https://github.com/WebAssembly/binaryen/releases)
There's only an old version in your distributions package manager? Just use a
[binary release](https://github.com/WebAssembly/binaryen/releases).
After you've installed the package execute `cargo install --force cargo-contract`.
* Step 3: `cargo install --force cargo-contract`
## Usage
```
cargo-contract 0.11.0
Utilities to develop Wasm smart contracts
## Usage
USAGE:
cargo contract <SUBCOMMAND>
You can always use `cargo contract help` to print information on available
commands and their usage.
OPTIONS:
-h, --help Prints help information
-V, --version Prints version information
For each command there is also a `--help` flag with info on additional parameters,
e.g. `cargo contract new --help`.
SUBCOMMANDS:
new Setup and create a new smart contract project
build Compiles the contract, generates metadata, bundles
both together in a `<name>.contract` file
check Check that the code builds as Wasm; does not output any
`<name>.contract` artifact to the `target/` directory
test Test the smart contract off-chain
deploy Upload the smart contract code to the chain
instantiate Instantiate a deployed smart contract
help Prints this message or the help of the given subcommand(s)
```
##### `cargo contract new my_contract`
## `build` requires the `nightly` toolchain
Creates an initial smart contract with some scaffolding code into a new
folder `my_contract` .
`cargo contract build` must be run using the `nightly` toolchain. If you have
[`rustup`](https://github.com/rust-lang/rustup) installed, the simplest way to do so is `cargo +nightly contract build`.
To avoid having to add `+nightly` you can also create a `rust-toolchain` file in your local directory containing
`nightly`. Read more about how to [specify the rustup toolchain](https://github.com/rust-lang/rustup#override-precedence).
The contract contains the source code for the [`Flipper`](https://github.com/paritytech/ink/blob/master/examples/flipper/lib.rs)
contract, which is about the simplest "smart" contract you can build ‒ a `bool` which gets flipped
from `true` to `false` through the `flip()` function.
### Note
##### `cargo +nightly contract build`
The latest version of `cargo-contract` supports all nightlies after `2020-07-30`, because of a change in the directory
structure of the `rust-src` component.
Compiles the contract into optimized WebAssembly bytecode, generates metadata for it,
and bundles both together in a `<name>.contract` file, which you can use for
deploying the contract on-chain.
## Features
`cargo contract build` must be run using the `nightly` toolchain. If you have
[`rustup`](https://github.com/rust-lang/rustup) installed, the simplest way to
do so is `cargo +nightly contract build`.
The `deploy` and `instantiate` subcommands are **disabled by default**, since they are not fully stable yet and increase the build time.
To avoid having to always add `+nightly` you can also set `nightly` as the default
toolchain of a directory by executing `rustup override set nightly` in it.
If you want to try them, you need to enable the `extrinsics` feature:
##### `cargo contract check`
`cargo install --git https://github.com/paritytech/cargo-contract cargo-contract --features extrinsics --force`
Checks that the code builds as WebAssembly. This command does not output any `<name>.contract`
artifact to the `target/` directory.
Once they are stable and the compilation time is acceptable, we will consider removing the `extrinsics` feature.
## License
The entire code within this repository is licensed under the [GPLv3](LICENSE). Please [contact us](https://www.parity.io/contact/) if you have questions about the licensing of our products.
The entire code within this repository is licensed under the [GPLv3](LICENSE).
Please [contact us](https://www.parity.io/contact/) if you have questions about
the licensing of our products.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment