Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamline counter, wCCD and voting smart contract tutorials #1043

Merged
merged 13 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/mainnet/net/guides/tokens.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ You can add, inspect, and send tokens in the |bw| and |mw-gen2|.

Once the tokens are added you can see them on the relevant tab.

An easy way to see how this works is to use the `wCCD example dApp hosted by Concordium <https://wccd.testnet.concordium.com/>`_. Connect it to your |bw| and convert some CCD to wrapped CCD. When you do this, you get the a smart contract index. You can then use this smart contract index to search for tokens on the contract and add them to your |bw|.
An easy way to see how this works is to use the `wCCD example dApp hosted by Concordium <https://wccd.testnet.concordium.com/>`_. Connect it to your |bw| and convert some CCD to wrapped CCD. When you do this, you get a smart contract index. You can then use this smart contract index to search for tokens on the contract and add them to your |bw|.

.. dropdown:: Inspect tokens

Expand Down Expand Up @@ -108,7 +108,7 @@ You can add, inspect, and send tokens in the |bw| and |mw-gen2|.

Once the tokens are added you can see them on the relevant tab.

An easy way to see how this works is to use the `wCCD example dApp hosted by Concordium <https://wccd.testnet.concordium.com/>`_. Connect it to your |mw-gen2| and convert some CCD to wrapped CCD. When you do this, you get the a smart contract index. You can then use this smart contract index to search for tokens on the contract and add them to your |mw-gen2|.
An easy way to see how this works is to use the `wCCD example dApp hosted by Concordium <https://wccd.testnet.concordium.com/>`_. Connect it to your |mw-gen2| and convert some CCD to wrapped CCD. When you do this, you get a smart contract index. You can then use this smart contract index to search for tokens on the contract and add them to your |mw-gen2|.

.. dropdown:: Inspect tokens

Expand Down
3 changes: 3 additions & 0 deletions source/mainnet/net/installation/verification-instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ Linux

.. include:: client-verification-instructions/client-linux.rst

Cargo Concordium
================

.. _verification-cargo-linux:

Linux
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ Preparation
Before you start, make sure to have the necessary tooling to build Rust
contracts.
The guide :ref:`setup-tools` shows you how to do this.
Also, make sure to have a text editor setup to write Rust.

Additionally, to run the tests you need to:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ Preparation
Before you start, make sure to have the necessary tooling to build Rust
contracts.
The guide :ref:`setup-tools` shows you how to do this.
Also, make sure to have a text editor for writing Rust.

You also need to set up a new smart contract project.
Follow the guide :ref:`setup-contract` and return to this point afterwards.
Expand Down
6 changes: 1 addition & 5 deletions source/mainnet/smart-contracts/guides/setup-contract.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,9 @@ The *from a template* option is available for ``cargo-concordium`` version 2.2.0
smart contract templates. Choose the template that best fits your project scope.
The *from scratch* option guides you through the process when you want to start a new project without any boilerplate code.

.. note::

Concordium recommends that newcomers choose the *from a template* option.

.. tabs::

.. tab:: From a template
.. tab:: From a template (recommended)

Concordium maintains several smart contract
`templates <https://github.com/Concordium/concordium-rust-smart-contracts/tree/main/templates>`_ (currently a ``default`` template and a ``cis2-nft`` template).
Expand Down
248 changes: 121 additions & 127 deletions source/mainnet/smart-contracts/tutorials/counter/counter-contract.rst

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@ So far you have written and tested a piggy bank smart contract in the Rust_ prog

This part focuses on how you can deploy your developed piggy bank smart contract to the Concordium testnet and interact with it.

.. warning::

The reader is assumed to have basic knowledge of what a blockchain and smart
contract is, and some experience with Rust_.


Preparation
===========

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Finally, the :ref:`fourth part<piggy-bank-frontend>` explains how to set up a we
.. warning::

The reader is assumed to have basic knowledge of what a blockchain and smart
contracts are, and to have some experience with Rust_.
contracts are, and to have some experience with Rust_. Consider reading the
simpler :ref:`Counter smart contract tutorial <counter-sc>` first.

Before starting the tutorial, make sure that you have all of the necessary tools installed and running as described in :ref:`Setup the development environment<setup-env>`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,18 +95,11 @@ This part will focus on how you can write integration-tests for your piggy bank
contract using the |concordium-smart-contract-testing|_ library.
The library simulates part of a blockchain *locally* to allow you to create one or more contracts and interact with them in the tests.

.. warning::

The reader is assumed to have basic knowledge of what a blockchain and smart
contract is, and some experience with Rust_.


Preparation
===========

Before you start, make sure to have the necessary tooling to build Rust
contracts. The guide :ref:`setup-env` shows you how to do this.
Also, make sure to have a text editor setup to write Rust.

Since you are going to extend the smart contract code written in the :ref:`previous
part<piggy-bank-writing>`, either follow the previous part or copy the complete
Expand Down
22 changes: 5 additions & 17 deletions source/mainnet/smart-contracts/tutorials/piggy-bank/writing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,34 +31,22 @@ This is the first :ref:`part of a tutorial<piggy-bank>` on smart contract
development. In this part you will focus on how to write a smart contract in the
Rust_ programming language using the |concordium-std| library.

.. warning::

The reader is assumed to have basic knowledge of what a blockchain and smart
contract is, and some experience with Rust_.


Preparation
===========

Before you start, make sure to have the necessary tooling to build Rust
contracts. The guide :ref:`setup-env` shows you how to do this.
Also, make sure to have a text editor for writing Rust.

You also need to set up a new smart contract project.
Follow the guide :ref:`setup-contract` and return to this point afterwards.

You are now ready to write a smart contract for the Concordium blockchain!
Set up a new smart contract project by following the guide :ref:`setup-contract` and return to this point afterwards.

Bring in the standard library
=============================

The source code of your smart contract is going to be in the ``src`` directory,
which already contains the file ``lib.rs``, assuming you follow the above guide
which already contains a ``lib.rs`` file, assuming you follow the above guide
to set up your project.
Open ``src/lib.rs`` in your editor and you'll see some code for :ref:`writing tests<piggy-bank-testing>`,

The smart contract template also includes some example tests under the ``tests`` directory,
which you can delete for now. You will come back to tests later in this tutorial.

First, bring everything from the |concordium-std|_ library into scope
In ``lib.rs``, start by bringing everything from the |concordium-std|_ library into scope
by adding the line:

.. code-block:: rust
Expand Down
11 changes: 6 additions & 5 deletions source/mainnet/smart-contracts/tutorials/voting/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The Voting dApp
===============

In this tutorial, you are going to get familiar with the deployed voting dApp on testnet. The voting dApp example is intended to show how you can use Concordium to conduct an election using the |bw| to enable users to cast their vote in your election.
You are going to write a basic web front-end example that can read from and write to the deployed smart contract on testnet.
You are going to write a basic web frontend example that can read from and write to the deployed smart contract on testnet.

If you want to try this example before starting the tutorial:

Expand All @@ -22,15 +22,16 @@ If you want to try this example before starting the tutorial:

#. Click **Vote now**. You can vote and send the link to any other voters. When you click **Cast vote** you must click **Sign & submit** in the |bw|.

#. Click **Results** to see the election results.
#. Click **Results** to see the election results. Note that your vote may not appear instantaneously after voting, as the vote transaction waits for confirmation. Give it a few seconds and the vote should appear.

In the :ref:`first part<voting-sc>`, you will learn about the voting smart contract.

In the :ref:`second part<voting-frontend>`, you will download the |bw| and set up a basic web front-end locally.
In the :ref:`second part<voting-frontend>`, you will download the |bw| and set up a basic web frontend locally.

.. warning::

This tutorial assumes the reader has basic knowledge of what a blockchain and a smart contract is, and some experience with Rust_ and web front-end development.
This tutorial assumes the reader has basic knowledge of what a blockchain and a smart contract is, and some experience with Rust_ and web frontend development.
Consider reading the simpler :ref:`Counter smart contract tutorial <counter-sc>` first.

To start the tutorial click :ref:`here<voting-sc>`.

Expand All @@ -39,4 +40,4 @@ To start the tutorial click :ref:`here<voting-sc>`.
:maxdepth: 1

Writing a voting smart contract <./voting-sc>
Setting up the front-end <./voting-dapp>
Setting up the frontend <./voting-dapp>
Loading
Loading