Skip to content
SOLL is a new compiler for generate EWASM from solidity.
C++ Other
  1. C++ 99.0%
  2. Other 1.0%
Branch: master
Clone or download
Shen-Ta Hsieh and ibmibmibm [CodeGen] add constructor and fallback function support
- Add constructor and fallback function in ContractDecl
- Implement parser support
- Rename builtin functions
- Implement deploy support in compile script
Latest commit 9424c26 Sep 11, 2019

README.md

WHAT IS SOLL

SOLL is a new compiler for generate EWASM from solidity.

Currently we apply two phases generate flow. Generate .ll (LLVM IR file) first, then generate .wasm (WASM file).

In this document we will show you how to achieve that goal.

  1. Build soll.
  2. Generate ewasm from our demo test case.
  3. Execute wasm file.

GETTING STARTED

To get started with our demo, you will need three 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, node.js).

Preparation

  • Pull official docker image to get an already established build/execute environment.
docker pull yi2nd/soll:v0.0.1
  • Git clone from official gitlab repository.
git clone https://github.com/second-state/soll.git
git clone https://github.com/second-state/soll-ewasm-testbench.git ewasm-testbench

Working Tree

├── ewasm-testbench
│   ├── README.md
│   └── index.js              // Entry point for trigger ewasm 
└── soll
    ├── (...)
    ├── build                 // Build code path, manually create it
    └── test
        ├── lity
        │   └── safemath.lity // Solidity test contract (Test case)
        └── (...)

Lauch Environment

Attach shell to container and bind volume with repositorys' path.

docker run -it --rm \
      -v $(pwd)/ewasm-testbench:/root/ewasm-testbench \
      -v $(pwd)/soll:/root/soll \
      yi2nd/ubuntu-soll:v0.0.1

Phase 1. Use soll generate .ll from test suite

Build soll first (we use cmake with llvm library).

(docker) $ cd ~/soll && mkdir build && cd build
(docker) $ cmake .. && make
(docker) $ cd ~/ewasm-testbench
(docker) $ ../soll/build/tools/soll/soll ../soll/test/lity/safemath.lity > safemath.ll

Phase 2. Generate .wasm from .ll

(docker) $ cd ~/ewasm-testbench
(docker) $ ../soll/utils/compile -v safemath.ll

Run

Trigger EWASM smart contract function call inside nativa javascript code.

(docker) $ cd ~/ewasm-testbench
(docker) $ ./index.js safemath.wasm div 16 7
You can’t perform that action at this time.