DISCLAIMER: NONE OF THESE CONTRACTS HAVE BEEN AUDITED, USE AT YOUR OWN RISK
Link to the Koinos AssemblyScript SDK documentation: https://roaminroe.github.io/koinos-as-sdk/
# clone this repo
git clone https://github.com/koinos/koinos-contracts-as
# with npm
npm install
# or
# with yarn
yarn install
assembly
folder of your project. (i.e.: ./calculator/assembly/Calculator.ts
)proto
files live in the assembly/proto/
folder of your project. (i.e.: ./calculator/assembly/proto/calculator.proto
)To build a Smart Contract you can use the CLI koinos-sdk-as-cli
from within the contract directory. It will help you generate all the files required to build your smart contract.
# see the cli help
yarn exec koinos-sdk-as-cli help
# example for building the calculator contract
# build the debug version (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli build-all debug calculator.proto
# build the release version (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli build-all release calculator.proto
This will result in the generation of:
calculator.abi
file in the folder calculator/abi/
calculator-abi.json
file in the folder calculator/abi/
contract.wasm
file in the folder calculator/build/release
and calculator/build/debug
index.ts
file in the folder calculator/assembly/
Calculator.boilerplate.ts
file in the folder calculator/assembly/
# example for the calculator contract (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli generate-contract-proto
# example for the calculator contract (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli generate-abi calculator.proto
This will generate a calculator.abi file in the folder calculator/abi/
# example for the calculator contract (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli generate-contract-as calculator.proto
This will generate a Calculator.boilerplate.ts
file and index.ts
file in the folder calculator/assembly/
# example for the calculator contract (execute command in the "calculator" folder)
yarn exec koinos-sdk-as-cli run-tests