Skip to content
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
9 changes: 4 additions & 5 deletions .github/workflows/rust-tutorial-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ jobs:
name: Rust tutorial code test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
- uses: actions/checkout@v5
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
default: true
toolchain: nightly
toolchain: 1.92
- name: Run rust tests
run: ./scripts/rust-tutorial-ci.sh
run: ./testing/rust-tutorial-ci.sh
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
[workspace]
resolver = "3"

members = [
"testing/extract-tutorial-code",
]

exclude = [
"testing/crowdfunding-esdt",
"testing/crowdfunding",
]
2 changes: 1 addition & 1 deletion docs/developers/developer-reference/sc-payments.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ The following methods are available for backwards compatibility but may be depre
- `self.call_value().single_fungible_esdt()` further restricts `single_esdt` to only fungible tokens, so those with their nonce zero. Returns the token identifier and amount, as pair.
- `self.call_value().egld_or_single_esdt()` retrieves an object of type `EgldOrEsdtTokenPayment`. Will halt execution in case of ESDT multi-transfer.
- `self.call_value().egld_or_single_fungible_esdt()` further restricts `egld_or_single_esdt` to fungible ESDT tokens. It will return a pair of `EgldOrEsdtTokenIdentifier` and an amount.
- `self.call_value().any_payment()` is the most general payment retriever. Never stops execution. Returns an object of type `EgldOrMultiEsdtPayment`. *(Deprecated since 0.64.0 - use `all()` instead)*
- `self.call_value().any_payment()` is the most general payment retriever. Never stops execution. Returns an object of type `EgldOrMultiEsdtPayment`. *(Deprecated since 0.64.1 - use `all()` instead)*

---

Expand Down
6 changes: 4 additions & 2 deletions docs/developers/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ Below is a list of tutorials for building on MultiversX:
| [Build your first dApp in 15 minutes](/developers/tutorials/your-first-dapp) | Video + written tutorial on how to create your first dApp. |
| [Cryptozombies Tutorials](https://cryptozombies.io/en/multiversx) | Interactive way of learning how to write MultiversX Smart Contracts. |
| [Build a microservice for your dApp](/developers/tutorials/your-first-microservice) | Video + written tutorial on how to create your microservice. |
| [Building a Crowdfunding Smart Contract](/docs/developers/tutorials/crowdfunding-p1.md) | Write, build and test a simple smart contract. |
| [Enhancing the Crowdfunding Smart Contract](/docs/developers/tutorials/crowdfunding-p2.md) | Expand and refine the functionality of an existing contract.|
| [Crowdfunding Tutorial - Part 1: Setup & Basics](/docs/developers/tutorials/crowdfunding/crowdfunding-p1.md) | Write, build and test your first smart contract. |
| [Crowdfunding Tutorial - Part 2: Core Logic](/docs/developers/tutorials/crowdfunding/crowdfunding-p2.md) | Add endpoints, payments, validation and comprehensive testing.|
| [Crowdfunding Tutorial - Part 3: Extend to Any Token](/docs/developers/tutorials/crowdfunding/crowdfunding-p3.md) | Generalize the contract to accept any fungible token.|
| [Crowdfunding Tutorial - Final Code](/docs/developers/tutorials/crowdfunding/final-code.md) | Complete reference implementation with full source code.|
| [Staking contract Tutorial](/developers/tutorials/staking-contract) | Step by step tutorial on how to create a Staking Smart Contract. |
| [Energy DAO Tutorial](/developers/tutorials/energy-dao) | In depth analysis of the Energy DAO SC template. |
| [DEX Walkthrough](/developers/tutorials/dex-walkthrough) | In depth walkthrough of all the main DEX contracts. |
Expand Down
12 changes: 6 additions & 6 deletions docs/developers/testing/rust/whitebox-legacy.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ num-traits = "0.2"
hex = "0.4"
```

For this tutorial, we're going to use the crowdfunding SC, so it might be handy to have it open or clone the repository: https://github.com/multiversx/mx-sdk-rs/tree/master/contracts/examples/crowdfunding-esdt
For this tutorial, we're going to use the crowdfunding SC, so it might be handy to have it open or clone the repository: https://github.com/multiversx/mx-sdk-rs/tree/master/contracts/examples/crowdfunding

You need a `tests` and a `scenarios` folder in your contract. Create a `.rs` file in your `tests` folder.

In your newly created test file, add the following code (adapt the `crowdfunding_esdt` namespace, the struct/variable names, and the contract wasm path according to your contract):
In your newly created test file, add the following code (adapt the `crowdfunding` namespace, the struct/variable names, and the contract wasm path according to your contract):

```rust
use crowdfunding_esdt::*;
use crowdfunding::*;
use multiversx_sc::{
sc_error,
types::{Address, SCResult},
Expand All @@ -56,19 +56,19 @@ use multiversx_sc_scenario::{
DebugApi,
};

const WASM_PATH: &'static str = "crowdfunding-esdt/output/crowdfunding-esdt.wasm";
const WASM_PATH: &'static str = "crowdfunding/output/crowdfunding.wasm";

struct CrowdfundingSetup<CrowdfundingObjBuilder>
where
CrowdfundingObjBuilder:
'static + Copy + Fn() -> crowdfunding_esdt::ContractObj<DebugApi>,
'static + Copy + Fn() -> crowdfunding::ContractObj<DebugApi>,
{
pub blockchain_wrapper: BlockchainStateWrapper,
pub owner_address: Address,
pub first_user_address: Address,
pub second_user_address: Address,
pub cf_wrapper:
ContractObjWrapper<crowdfunding_esdt::ContractObj<DebugApi>, CrowdfundingObjBuilder>,
ContractObjWrapper<crowdfunding::ContractObj<DebugApi>, CrowdfundingObjBuilder>,
}
```

Expand Down
2 changes: 1 addition & 1 deletion docs/developers/testing/sc-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ For this tutorial, you will need:
- the [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) extension.
- A [Rust test](rust/sc-blackbox-example)

If you want to follow along, you can clone the [mx-sdk-rs](https://github.com/multiversx/mx-sdk-rs) repository and use the [crowdfunding-esdt](https://github.com/multiversx/mx-sdk-rs/tree/master/contracts/examples/crowdfunding-esdt) example.
If you want to follow along, you can clone the [mx-sdk-rs](https://github.com/multiversx/mx-sdk-rs) repository and use the [crowdfunding](https://github.com/multiversx/mx-sdk-rs/tree/master/contracts/examples/crowdfunding) example.

[comment]: # (mx-context-auto)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
---
id: crowdfunding-p1
title: Building a Crowdfunding Smart Contract
title: Setup & Basics
---

[comment]: # (mx-abstract)
Write, build and deploy a simple smart contract written in Rust.

Expand Down Expand Up @@ -81,20 +82,17 @@ You may choose any location you want for your smart contract. Either way, now th
name = "crowdfunding"
version = "0.0.0"
publish = false
edition = "2021"
edition = "2024"
authors = ["you"]

[lib]
path = "src/crowdfunding.rs"

[dependencies.multiversx-sc]
version = "0.57.0"

[dev-dependencies]
num-bigint = "0.4"
version = "0.64.1"

[dev-dependencies.multiversx-sc-scenario]
version = "0.57.0"
version = "0.64.1"

[workspace]
members = [
Expand Down
Loading