Redspot by Patract Labs

Patract Labs is building a tool called Redspot, "Truffle" for Polkadot ecosystem. In this section, we will walk you through how to use Redspot on Plasm Network.

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.

rustup install nightly
rustup component add rust-src --toolchain nightly
rustup target add wasm32-unknown-unknown --toolchain nightly
rustup component add rust-src --toolchain nightly

And let's install cargo-contract provided by Patract and wasm-opt

cargo install cargo-contract --git https://github.com/patractlabs/cargo-contract --branch=v0.10.0 --force
npm i wasm-opt

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.

npx redspot-new erc20

Compile the Contract

Before compiling, install yarn dependencies first (you can do npm install instead but yarn is recommended).

yarn

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:

npx redspot run ./scripts/deploy.ts --no-compile

After a successful contract deployment, you will get a message like this.

Deploy successfully. the contract address: 5CqB5Mh9UdVbTE1Gt5PJfWSiCHydJaJsA31HjKGti1Z2fn78

​