Using Redspot by Patract Lab

What is Redspot?

Redspot is a contract integration builder that allows developers to simplify the process of testing and interacting with contracts by projecting the development of contracts such as ink! This tool is developed by Patract Labs. Kudos!
Checkout their tutorial here.

Installation

First of all, let's install Node.js. The version has to be version >= 12.0. You can check your version by using the following command. $ node --version
Second, ink! contract requires a WASM compile environment. Let's install toolchain.
1
rustup install nightly
2
rustup component add rust-src --toolchain nightly
3
rustup target add wasm32-unknown-unknown --toolchain nightly
4
rustup component add rust-src --toolchain nightly
Copied!
And let's install cargo-contract provided by Patract and wasm-opt
1
cargo install cargo-contract --git https://github.com/patractlabs/cargo-contract --branch=v0.10.0 --force
2
npm i wasm-opt
Copied!

Create a Redspot Project

Redspot provides a sample contract like Truffle that accelerates secure smart contract developments.
Currently, only ERC20 contract is supported but more templates will be provided by Patract Labs.
1
npx redspot-new erc20
Copied!

Compile the Contract

Before compiling, install yarn dependencies first (you can do npm install instead but yarn is recommended).
1
yarn
Copied!
Then running the command npx redspot compile . in the erc20 root directory will compile the contract.
After the compilation is complete, you can find the compiled product in the artifacts directory.

Run the plasm node

To use a local development environment, a Plasm node is necessary. Please install the latest Plasm node from here.
Then, run the local node via plasm in your terminal of choice

Deploy

Now you can run the deploy.ts file, adding -no-compile to prevent duplicate compilation:
1
npx redspot run ./scripts/deploy.ts --no-compile
Copied!
After a successful contract deployment, you will get a message like this.
1
Deploy successfully. the contract address: 5CqB5Mh9UdVbTE1Gt5PJfWSiCHydJaJsA31HjKGti1Z2fn78
Copied!
If you are having issues, clone the repo here and follow the directions there to deploy. Currently the contracts deployed via Redspot is not intractable on the main net. Read here for more on this issue.
Last modified 2mo ago