Use Waffle
There are multiple tools you can use to develop and compile Solidity contracts, we'd present two here as options
online web app Remix
Solidity development and testing framework Waffle
Compile Solidity Contract using Waffle Comment
Note: you can skip this section if you compiled the smart contract with Remix.
This guide walks through the process of deploying a Solidity-based smart contract to Acala using Waffle. Waffle is one of the most commonly used smart contract development frameworks for Ethereum.
1. Check Prerequisites
First, we need to install Node.js (we use v15.x in this example) and the npm package manager. For installation follow guides in the official documentation for your operating system: install NodeJS
We can verify that everything installed correctly by querying the version for each package:
Install yarn package manager:
Check if it's installed correctly:
2. Using Waffle With Our Examples
We've made it easy by collecting all required dependencies in the AcalaNetwork/evm-examples repo.
Simply clone the repository and install the dependencies.
3. Using Waffle from Scratch (optional)
Alternatively, you can install each library separately as the following:
Create a project folder smart-contract-waffle
Initiate package manager
Install all following dependencies
Note: it's recommended to install dependencies with exact versions as specified to avoid breaking changes.
Then create a waffle settings file
Paste the following in the waffle.json
file
This sets up the solidity compiler with version 0.6.2
, compiles contracts from the ./contracts
folder, and saves the bytecode output and ABI files to ./build
folder.
Now create the ./contracts
folder, and add the BasicToken.sol
contract.
Paste the following content into the BasicToken.sol
file and save.
4. Compile the Smart Contract
Now compile the contract into ABI and bytecode. Run the following in the terminal
5. Get the ABI file
Waffle will then generate the output file ./build/BasicToken.json
into the ./build
folder.
Note: this file should be the same as the one created with Remix.
Waffle also provides a full suite of testing utilities, check out their documentation and code samples here.
Last updated