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.
- 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.
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.
This repository requires yarn and yarn workspaces.
The following command show how to setup the dev environment.
- Install all dependencies
yarn install
- To compile contract examples to wasm, change to example dir and run:
yarn build
- To run tests in the subscript/core:
cd ./core
yarn test
subscript
is distributed under the terms of the Apache License (Version 2.0).
See LICENSE-APACHE for details.