[Report] Tutorial Repository for developing Near Contracts in Rust (april 01-> april 08 2022)

Project Title: New Full Tutorial for Near in Rust.

One-liner: Tutorial Repository for developing Near Contracts in Rust

Project Summary: : There are many great tutorials about creating NEAR contracts in Rust. This project isn’t intended to be a replacement to any of those. Instead, it will be detailed examples about the features of Rust using NEAR contracts. Several times when the compiler gives an error, a new developer may feel compelled to just try making changes until the error go away.

This tutorial will show all possible implementations for all kinds of features in rust. Including ownership, modules, traits, generics, enums and so on. That way it can work as reference for aspiring rustaceans.

Project Members: Lucas Lemos, Matias Wald

Period: April 01 → April 08

Extra : Project has the main branch in Brazilian Portuguese. Translations to English and Spanish are also being made by Matias Wald.

The following list are the results obtained by me:

Week 09

  • Lesson 6-2 is being replaced by a more practical example. It’s a contract for storing data from thermal sensors, or thermometers. Still unfinished. Link: https://github.com/On0n0k1/Tutorial_NEAR_Rust/commit/288c87a51e54b274a7024ed0a22a02d817ee5cc1
  • The purpose of the contract is to show how we can use enums to control how data input/output/storage works. Some examples of use are described below:
    • We can use it to make some arguments of a function optional.
    • We can make a function receive more than one type as argument.
    • We can make an enum be treated as a primitive type. E.g. something like This::Value(String) could be displayed/returned as just String. Therefore we can make the return type of a function be several different types simultaneously.
  • Someone could use the contract to store the data from several different sensors simultaneously. Only to later collect them into a local storage. It’s a cheap way to synchronize several different devices without paying for expensive cloud services.
  • A real application project could be more interesting to readers. So, as long as it is well structured and explained, this example will be worthwhile.
1 Like