A collection of resources to develop proof of concept projects for Substrate in AssemblyScript. AssemblyScript compiles a strict subset of TypeScript to WebAssembly using Binaryen.
At the moment, this repository is mainly home for a collection of smart contract examples and a small smart contract library to write contracts for Substrates contracts pallet, but it might be extended with more examples in the future.
This repository is using yarn and yarn workspaces. You also need a fairly up-to-date version of node.
The packages folder contains the PoC libraries and projects.
The contracts folder contains a number of example contracts that make use of the as-contracts
package.
The compiled example contracts in the contracts folder can be deployed and executed on any Substrate chain that includes the contracts pallet.
- Clone the whole
as-substrate
repository.
$ git clone https://github.com/paritytech/as-substrate.git
- Install all dependencies
$ yarn
- Compile all packages, projects and contract examples to wasm
$ yarn build
To clean up all workspaces in the repository, run:
$ yarn clean
The @substrate/as-contracts
and @substrate/as-utils
packages are not being published to the npmjs registry. That's why you need to add the complete as-substrate
repository as a dependency directly from git.
$ yarn add https://github.com/paritytech/as-substrate.git
// or
$ npm install https://github.com/paritytech/as-substrate.git
In your projects, you can then import the as-contracts functions directly from the node_modules
folder
The recommended way of writing smart contracts is using the Rust Smart Contract Language ink!
.
Another way of writing Smart Contracts for Substrate is using the Solidity to Wasm compiler Solang.
Everything in this repository is highly experimental and should not be used for any professional or financial purposes.
The entire code within this repository is licensed under the GNU GENERAL PUBLIC LICENSE 3.0. Please contact us if you have questions about the licensing of our products.