Skip to content

Latest commit

 

History

History
57 lines (38 loc) · 2.3 KB

README.md

File metadata and controls

57 lines (38 loc) · 2.3 KB

subscript lang to write wasm based smart contract

License

subscript is a smart contract language written in AssemblyScript for wasm based chain. We will provide essential substrate api and builtin tools to support contract development.

subscript is built on top of AssemblyScript and follow all AssemblyScript syntax. subscript is more like a development kit with some builtin module and tools. As assemblyscript is easy to interact with TypeScript and JavaScript, subscript is much more friendly for DApp developers.

How subscript Works

  • Substrate's Framework for Runtime Aggregation of Modularised Entities (FRAME) contains the contracts pallet, which implements an API for typical functions smart contracts need (storage, querying information about account, …).
  • The contracts pallet requires smart contracts to be uploaded to the blockchain as a Wasm blob.
  • subscript is a smart contract language which targets the API exposed by contracts. subscript smart contracts are compiled to Wasm.

Collection of the subscript library

subscript/core includes contract library with essential core compoments implemented. Developers can use the subscript/core to interact with the host environment. It privide basic basic types, storage acceess and contract interface. for more detail, see the subscript/core doc.

the example directory provide some examples to demonstrate how to use the subscript library. The Flipper contract imports low-level api to interact with the contract node and The ERC20 contract demonstrate more complex feature.

Get started with subscript library

This repository requires yarn and yarn workspaces.

The following command show how to setup the dev environment.

  1. Install all dependencies
yarn install
  1. To compile contract examples to wasm, change to example dir and run:
yarn build
  1. To run tests in the subscript/core:
cd ./core
yarn test

License

subscript is distributed under the terms of the Apache License (Version 2.0).

See LICENSE-APACHE for details.