Mirroring https://github.com/hyperledger-solang/solang

Gregory Hill 14409bbf6c experimental vyper support преди 5 години
.github c8b6abe695 Move tests to rust 1.40 преди 5 години
docs 95a27bc92b Improve wording преди 5 години
examples 14409bbf6c experimental vyper support преди 5 години
src 14409bbf6c experimental vyper support преди 5 години
stdlib 71797a460a Add Sawtooth Sabre support преди 5 години
tests f2e1978c8b Improve type deref functions преди 5 години
.gitignore 148d75d738 Add initial docs преди 6 години
CODEOWNERS 3d8f6ba7af Add standard repo files преди 5 години
CODE_OF_CONDUCT.md 3d8f6ba7af Add standard repo files преди 5 години
CONTRIBUTING.md 3d8f6ba7af Add standard repo files преди 5 години
Cargo.toml 3676a61d74 Update our dependencies преди 5 години
Dockerfile 8b70126721 Solang Docker image does not run преди 5 години
LICENSE-APACHE ea60c0116d First commit преди 6 години
LICENSE-MIT ea60c0116d First commit преди 6 години
MAINTAINERS.md 14409bbf6c experimental vyper support преди 5 години
README.md 14409bbf6c experimental vyper support преди 5 години
SECURITY.md 3d8f6ba7af Add standard repo files преди 5 години
build.rs f6bc976edc Partial support for fixed arrays преди 5 години
clippy.toml 76b1e7c30a Reduce clipping overrides преди 5 години

README.md

solang - A Solidity to wasm compiler written in rust

CI Documentation Status

Funded by the web3 foundation

Welcome to Solang, a new Solidity compiler written in rust which uses llvm as the compiler backend. As a result, only the compiler front end needs to be written in rust.

Solang targets Substrate and ewasm.

Solang is under active development right now, and should be documented at the same time as the implementation. Please have a look at our documentation.

What works today

First build solang or use the docker image, then write the following to flipper.sol:

contract flipper {
	bool private value;

	constructor(bool initvalue) public {
		value = initvalue;
	}

	function flip() public {
		value = !value;
	}

	function get() public view returns (bool) {
		return value;
	}
}

Now run:

solang flipper.sol

Alternatively if you want to use the solang docker image, run:

docker run --rm -it -v $(pwd):/sources hyperledgerlabs/solang -v -o /sources /sources/flipper.sol

You will have a flipper.wasm and flipper.json. You can use these directly in the Polkadot UI, as if your smart contract was written using ink!.

(WIP) Vyper

This is the experimental WIP Vyper branch, fully valid syntax is not currently supported.

You may compile the following contract:

value: bool

@public
def __init__(initvalue: bool):
    value = initvalue

@public
def flip():
    value = not value

@public
def get() -> (bool):
    return value

Note: global contract variables in Vyper are currently referenced as in Solidity (i.e. without self.), this is not valid syntax and will be fixed in a future release.