The Flip Smart Contract part 3 : Setting up the project
Time to code !
Cloning the contract template
For the moment there is no CLI allowing to create new AssemblyScript smart contracts projects, so you'll need to clone the empty contract template :
git clone https://github.com/gfusee/mx-sdk-as-empty.git flip
cd flip
rm -rf .git
Initializing the code and dependancies
Open the folder inside your favorite code editor and replace the content of the `assembly/index.ts` by the following code :
//@ts-nocheck
import {
ContractBase
} from "@gfusee/mx-sdk-as";
@contract
abstract class FlipContract extends ContractBase {
}
Here we have the simplest contract ever : a contract that does nothing (for now!). More information about each line can be found inside the previous tutorial.
As any node project we need to install npm packages with the following command:
npm install
Building the contract
Run the next command to build your contract :
npm run build
If everything went well you should have a new folder named build
with two files inside : release.wasm
and release.wat
. The first one is the deployable code and the second one is a "human readable" version of the first one.
Next up
At the moment the contract is empty. We will write the flip code in next parts of this tutorial, starting by the contract storage 📚
Last updated