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

Mulenga Bowa 0df1e74985 Enchancement(vscode ext): Download the latest binary and setup ext. 4 gadi atpakaļ
.github 0df1e74985 Enchancement(vscode ext): Download the latest binary and setup ext. 4 gadi atpakaļ
docs a90610ead0 Start documenting optimizer passes 4 gadi atpakaļ
examples 19f2c08d7a Add new target generic which produces object file for linking 5 gadi atpakaļ
integration 4304504341 Check that the account data is large enough 4 gadi atpakaļ
scripts 3c13bdbb9e rust 1.48.0 required 4 gadi atpakaļ
src e0289d6366 Allow null pointer for empty string 4 gadi atpakaļ
stdlib 3c13bdbb9e rust 1.48.0 required 4 gadi atpakaļ
tests cee73beb26 Fix for loop without condition or next 4 gadi atpakaļ
vscode 0df1e74985 Enchancement(vscode ext): Download the latest binary and setup ext. 4 gadi atpakaļ
.dockerignore 120c6d7ee9 Use .dockerignore to selectively copy files into build container 5 gadi atpakaļ
.gitignore ba431af1f0 Add solana test case 5 gadi atpakaļ
CHANGELOG.md f9e38bbc6d Introduce strength reduce pass 4 gadi atpakaļ
CODEOWNERS 3d8f6ba7af Add standard repo files 5 gadi atpakaļ
CODE_OF_CONDUCT.md 3d8f6ba7af Add standard repo files 5 gadi atpakaļ
CONTRIBUTING.md 3d8f6ba7af Add standard repo files 5 gadi atpakaļ
Cargo.toml 73ce66d995 Fix build issue with bitvec/funty 4 gadi atpakaļ
Dockerfile 3c13bdbb9e rust 1.48.0 required 4 gadi atpakaļ
LICENSE-APACHE ea60c0116d First commit 6 gadi atpakaļ
LICENSE-MIT ea60c0116d First commit 6 gadi atpakaļ
MAINTAINERS.md 3d8f6ba7af Add standard repo files 5 gadi atpakaļ
README.md 66ab8d013f Generate combined .contract file for Substrate 4 gadi atpakaļ
SECURITY.md 3d8f6ba7af Add standard repo files 5 gadi atpakaļ
build.rs f6baf16306 Rust 2018 edition 5 gadi atpakaļ
clippy.toml 3e1748edba Split resolver into sema and codegen 5 gadi atpakaļ

README.md

solang - A Solidity to wasm compiler written in rust

Rocket.Chat CI Documentation Status LoC

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, Solana, ewasm, and Sawtooth. Solang is source compatible with Solidity 0.7, with some caveats due to differences in the underlying blockchain.

Solang is under active development right now, and has extensive documentation.

Simple example

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 --target substrate 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  --target substrate /sources/flipper.sol

You will have a file called flipper.contact. You can use this directly in the Polkadot UI, as if your smart contract was written using ink!.