Introduction

In this part, we will go over the basics, from setting up to providing an overview of the contract architecture.

Getting Started

As you may know, Cudos supports the Rust-based CosmWasm smart contract. However, before proceeding, you must first . Once you’ve done this, you can proceed to the next step.

Setup a Boilerplate

After completing the setup of the CosmWasm environment, you’ll need to set up the architecture for the CosmWasm contract. To do this, please take a pull of  and checkout to v0.8.0, which is equivalent to Openzeppellin in solidity smart contract development terms.

NOTE: Currently, CosmWasm does not offer any standalone boilerplate for contract development.

Next, go inside the contract folder. Here you’ll find an implementation of standard contracts like CW-20(ERC-20), CW-721(ERC-721), and many more. It will be beneficial for you to go through these contracts to develop a sense of familiarity.

Contract Architecture

Let’s take a look at the structure of a contract folder and why it’s created that way. So, go to the CW1-subkey folder. For writing CosmWasm smart contracts, you can use any code editor of your choice. For this demo, you’ll be using Visual Studio Code (VSC). So you’ll be looking into the following folders:

  • .cargo: This document explains how Cargo’s configuration system works, as well as available keys or configuration. ()
  • examples: In Cargo’s terminology, an example is nothing else but a Rust source code of a standalone executable that typically resides in a single .rs file. All such files should be placed in the examples/directory, at the same level as src/ and the Cargo.toml manifest itself. ()
  • schema: It contains all the JSON-Schema of all messages and responses. Just like abi present in Solidity smart contracts.
  • src: Like any other project, the src folder contains actual code. So here, you’ll also divide your code into at least five files.
  1. contract.rs: It contains instantiation, business, and query logic. This is the heart of the contract.
  2. error.rs: Here, you’ll define all the error messages you might encounter
  3. It is the template’s main source file. The name lib.rs commonly implies that this Rust project will be compiled as a library.
  4. msg.rs: Here, you’ll define all the messages users send to the contract and the response you need.
  5. state.rs: Here, you’ll define all the state variables like map, items, struct, and trait, which the contract uses to store the data.
  • Cargo.toml: In simple terms, cargo.toml is equivalent to package.json for Rust where you can define the name of the project, dependency, and dev-dependency, etc. ()

In the next part, we will delve further into your smart contract development process by explaining how you can set up a project.

What can you do right now?

You can get involved right away by joining our  by following the links below:

Notably, you’ll  based on the tasks you complete as part of the testnet.

P.S. If you’ve already , you can make the most of them by  to secure the network and, in return, receive rewards.

About Cudos

The Cudos Network is a layer-one blockchain and layer-two computation and oracle network designed to ensure decentralised, permissionless access to high-performance computing at scale and enables scaling of computing resources to hundreds of thousands of nodes. Once bridged onto Ethereum, Algorand, Polkadot, and Cosmos, Cudos will enable scalable computational and layer-two oracles on all of the bridged blockchains.

For more, please visit: