SOLL 是一个用于从 Solidity 和 Yul 生成 Ewasm 的新编译器。请参阅演示:https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
SOLL 是一个用于从 Solidity 和 Yul 生成 Ewasm 的新编译器。请参阅演示:https://asciinema.org/a/ezJqNLicn5fya02zwu4VXIo8a
SOLL is a new compiler for generating Ewasm (Ethereum flavored WebAssembly) files from Solidity and Yul.
To support developers as many as possible, we design projects to not only support more smart contract programming languages, such as Rust and C++ but also support various VMs, such as Ewasm VM and evm. To achieve this goal, in the very first step, we develop SOLL, a compiler for Solidity-based smart contracts running on Ewasm VM.
For application users, please refer to this document. You will know how to use SOLL to generate Ewasm bytecode from your Solidity smart contract or Yul language, and then deploy the Ewasm bytecode to Ethereum Ewasm TestNet.
For developers, we provide another document for explaining the design of SOLL and how to develop and test the functionality of SOLL, please refer to the Developer Guide for more details.
SOLL is still in an early stage, and we’ve not fully supported Solidity and Yul. Please check the features we’ve done and limitations in the following documents.
And SOLL integrates Solidity and Yul test contracts from ethereum/solidity.
Here is the pass rate of both language:
The solidity test suite (Total 80 tests from compilation tests):
Expected Passes : 27 # Solidity has 80 testing contract, and SOLL can pass 27.
Unsupported Tests : 53 # Unimplemented by SOLL
Pass Rate: 34%Yul test suite (Total 499 tests from libyul):
Expected Passes : 393 # libyul has 499 testing contracts, and SOLL can pass 393.
Unsupported Tests : 106 # Unimplemented by SOLL
Pass Rate: 79%To get started with our demonstration, you will need to prepare two components at first.
We provide an image include build and execute environment (recommend). If you don't want to use docker directly you will need below tools (cmake, llvm, binaryen, xxd, wabt, node.js).
If you want to set up the working environment by yourself, please install the following dependencies:
After SOLL 0.1.1, we use llvm-10 instead of llvm-8, if you want to build the older version of SOLL, please use this docker image: secondstate/soll:0.1.0.
> docker pull secondstate/soll> git clone --recursive https://github.com/second-state/soll.git
> cd soll
> git checkout 0.1.1Attach shell to container and bind volume with repositories' path.
> docker run -it --rm \
-v $(pwd)/soll:/root/soll \
secondstate/sollBuild SOLL(we use cmake with llvm library)
(docker) $ cd ~/soll && mkdir -p build && cd build
(docker) $ cmake .. && makeOur original tutorial will deploy Ewasm bytecode on the official TestNet. Unfortunately, the Ewasm TestNet is unavailable now. We’ve moved the original tutorial into Deploy an ERC20 smart contract to Ewasm official TestNet.
For demonstration propose, we provide another Ewasm TestNet which is launched by our DevChain.
DevChain The Second State DevChain features a powerful and easy-to-use virtual machine that can quickly get you started with smart contracts and DApp development. Our devchain supports Ewasm by hera through EVMC interface.
SOLL supports two frontend languages including Solidity and Yul. You can use SOLL to generate Ewasm bytecode(.wasm) directly.
Create your smart contract files by copying from our demonstration contract "0-0-3.sol". And execute SOLL to generate Ewasm bytecode(.wasm) and contract ABI.
…We will use "0-0-3.wasm" in the next section to deploy it to Ewasm TestNet.
Create your smart contract files by copying from our demonstration contract "0-0-6.yul". And execute SOLL to generate Ewasm bytecode(.wasm) and contract ABI.
…We will use "0-0-6.wasm" in the next section to deploy it to Ewasm TestNet.
(soll docker) $ xxd -p ~/soll/docs/examples/0-0-3.wasm | tr -d $'\n'The result should be the same as the following content. (This will be used later)
…(soll docker) $ xxd -p ~/soll/docs/examples/0-0-6.wasm | tr -d $'\n'The result should be the same as the following content. (This will be used later)
…Then exit SOLL container goto next step.
> docker pull secondstate/devchain:devchain> docker run -it secondstate/devchain:devchain attach https://rpc.parastate.io:8545
Welcome to the Travis JavaScript console!
instance: vm/v1.9.2/linux-amd64/go1.10.3
coinbase: 0x7eff122b94897ea5b0e2a9abf47b86337fafebdc
at block: 1115129 (Tue, 07 Apr 2020 06:51:46 UTC)
modules: cmt:1.0 eth:1.0 net:1.0 personal:1.0 rpc:1.0 web3:1.0> personal.unlockAccount(cmt.accounts[0], '1234', 9999999)Please note: You can obtain network tokens (STATE tokens) for the aforementioned ParaState Testnet by visiting the testnet's faucet at https://testnet.faucet.parastate.io:8001/faucet.
There is also a YouTube Video which demonstrates how to use the faucet.
……> cmt.getCode(contractAddress)
// The result should similar to the following content.
"0x0061736d01000000..." (omitted, runtime Ewasm bytecode)Send the transaction to execute a contract function transfer. In this example, we want to transfer 123 tokens from account A to account B
Setup transaction parameters:
// Get contract instance via contract address
> var contractInstance = contract.at(contractAddress);
// Setup transaction parameters
> var txnObject = {
from: fromAccount,
gas: 5000000
};
// Set second account as token receiver
> var toAccount = personal.listAccounts[1];
// Set send 123 tokens
> var sendValue = 123// Get original balance of fromAccount and toAccount
> contractInstance.balanceOf.call(fromAccount);
100000000
> contractInstance.balanceOf.call(toAccount);
0> contractInstance.transfer.sendTransaction(toAccount, sendValue, txnObject,
function(error, result){
if(error){
console.log("Error: " + error);
} else {
txhash = result;
console.log("txhash: " + txhash);
}
});
// The result should similar to the following content.
txhash: 0x566211fa5850ad759c001941eec060f48e0108eac06bbbeb17ad08684cf6c9d9// Get after balance of fromAccount and toAccount
> contractInstance.balanceOf.call(fromAccount);
99999877
> contractInstance.balanceOf.call(toAccount);
123transfer by getTransactionReceipt.…All steps are the same with 3.4.4-1. You only need to replace the Ewasm bytecode with 0-0-6.wasm.
(Omitted)
暂无开放 Issues,或尚未同步最近议题。