From abf591a770d046733a91f6ca6aff2ccc6a60ed26 Mon Sep 17 00:00:00 2001 From: MedovTimur <62596970+MedovTimur@users.noreply.github.com> Date: Fri, 1 Nov 2024 16:33:52 +0300 Subject: [PATCH] Updating README.md and Renaming (#496) --- contracts/Cargo.lock | 2 +- contracts/README.md | 12 +++--------- contracts/car-races/README.md | 19 +++++++++++++++++++ contracts/car-races/app/tests/test.rs | 2 +- contracts/car-races/wasm/Cargo.toml | 4 ++-- contracts/syndote/README.md | 19 +++++++++++++++++++ contracts/syndote/player/README.md | 10 ++++++++++ contracts/tic-tac-toe/README.md | 9 +++++---- contracts/tic-tac-toe/app/Cargo.toml | 2 +- contracts/tic-tac-toe/app/tests/test.rs | 8 ++++---- contracts/tic-tac-toe/wasm/Cargo.toml | 4 ++-- contracts/vara-man/README.md | 9 +++++---- contracts/vara-man/app/Cargo.toml | 2 +- contracts/vara-man/app/tests/test.rs | 8 ++++---- contracts/vara-man/wasm/Cargo.toml | 2 +- contracts/zk-battleship/README.md | 19 +++++++++++++++++++ contracts/zk-battleship/app/Cargo.toml | 2 +- contracts/zk-battleship/wasm/Cargo.toml | 6 +++--- contracts/zk-battleship/wasm/build.rs | 2 +- contracts/zk-battleship/wasm/src/lib.rs | 2 +- 20 files changed, 103 insertions(+), 40 deletions(-) create mode 100644 contracts/car-races/README.md create mode 100644 contracts/syndote/README.md create mode 100644 contracts/syndote/player/README.md create mode 100644 contracts/zk-battleship/README.md diff --git a/contracts/Cargo.lock b/contracts/Cargo.lock index e544d8113..7459fb5c3 100644 --- a/contracts/Cargo.lock +++ b/contracts/Cargo.lock @@ -9185,4 +9185,4 @@ dependencies = [ "gear-wasm-builder", "sails-idl-gen", "zk-battleship", -] +] \ No newline at end of file diff --git a/contracts/README.md b/contracts/README.md index eda6f15be..3b68cd9cf 100644 --- a/contracts/README.md +++ b/contracts/README.md @@ -29,26 +29,20 @@ Note that it's built from the latest commit on the `master` branch. Therefore, w ### 🏗️ Build all contract & states ```sh -cargo b +cargo b -r ``` ### ✅ Build & run tests Run all tests, except `gclient` ones: ```sh -cargo t -- --skip gclient +cargo t -r -- --skip gclient ``` Run all tests: ```sh # Download the node binary. -cargo xtask node -cargo t -``` - -### 🚀 Run CI locally (should be done before a commit) -```sh -cargo xtask ci +cargo t -r ``` ## Versioning & backwards compatibility diff --git a/contracts/car-races/README.md b/contracts/car-races/README.md new file mode 100644 index 000000000..aa0787c22 --- /dev/null +++ b/contracts/car-races/README.md @@ -0,0 +1,19 @@ +# Car Races + +This project is a competitive environment where strategy-based programs race against each other, aiming to optimize speed, tactics, and resource management on the track. Each program operates autonomously, employing unique strategies to outmaneuver opponents and complete the race as efficiently as possible. + +A detailed description of the project can be found on the [wiki](https://wiki.vara.network/docs/examples/Gaming/racingcars). + +⚙️ **Note**: The project code is developed using the [Sails](https://github.com/gear-tech/sails) framework. + +### 🏗️ Building + +```sh +cargo b -r -p "car-races" +``` + +### ✅ Testing + +```sh +cargo t -r -p "car-races-app" +``` diff --git a/contracts/car-races/app/tests/test.rs b/contracts/car-races/app/tests/test.rs index 10613862b..2bae2c91d 100644 --- a/contracts/car-races/app/tests/test.rs +++ b/contracts/car-races/app/tests/test.rs @@ -11,7 +11,7 @@ const PATH_TO_STRATEGIES: [&str; 2] = [ ]; const PATH_TO_CAR_RACES: &str = - "../../target/wasm32-unknown-unknown/release/car_races_wasm.opt.wasm"; + "../../target/wasm32-unknown-unknown/release/car_races.opt.wasm"; #[test] fn test_car_races_without_session() { diff --git a/contracts/car-races/wasm/Cargo.toml b/contracts/car-races/wasm/Cargo.toml index 40fcce70b..f9565196d 100644 --- a/contracts/car-races/wasm/Cargo.toml +++ b/contracts/car-races/wasm/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "car-races-wasm" +name = "car-races" version.workspace = true edition.workspace = true license.workspace = true @@ -16,4 +16,4 @@ car-races-app = { path = "../app" } [lib] crate-type = ["rlib"] -name = "car_races_wasm" \ No newline at end of file +name = "car_races" diff --git a/contracts/syndote/README.md b/contracts/syndote/README.md new file mode 100644 index 000000000..cfb18e55d --- /dev/null +++ b/contracts/syndote/README.md @@ -0,0 +1,19 @@ +# Sails Syndote + +Sails Syndote is a Monopoly-inspired game where the players are automated programs that compete and strategize to dominate the game board. Each player represents a program, creating a unique experience as they navigate the game autonomously. A sample player program is available at this [link](https://github.com/gear-foundation/dapps/tree/master/contracts/syndote/player). + +A detailed description of the project can be found on the [wiki](https://wiki.vara.network/docs/examples/Gaming/monopoly). + +⚙️ **Note**: The project code is developed using the [Sails](https://github.com/gear-tech/sails) framework. + +### 🏗️ Building + +```sh +cargo b -r -p "syndote" +``` + +### ✅ Testing + +```sh +cargo t -r -p "syndote-app" +``` diff --git a/contracts/syndote/player/README.md b/contracts/syndote/player/README.md new file mode 100644 index 000000000..d3b38750d --- /dev/null +++ b/contracts/syndote/player/README.md @@ -0,0 +1,10 @@ +# Syndote player + +This repository contains the code for a player program in the Syndote game. The player program includes strategies and logic for navigating the game autonomously and making decisions to gain an advantage on the board. + +### 🏗️ Building + +```sh +cargo b -r -p "syndote" +``` + diff --git a/contracts/tic-tac-toe/README.md b/contracts/tic-tac-toe/README.md index 9f41fd0b0..38b07e81c 100644 --- a/contracts/tic-tac-toe/README.md +++ b/contracts/tic-tac-toe/README.md @@ -1,12 +1,13 @@ -[![Open in Gitpod](https://img.shields.io/badge/Open_in-Gitpod-white?logo=gitpod)](https://gitpod.io/#FOLDER=vara-man/https://github.com/gear-foundation/dapps) -[![Docs](https://img.shields.io/github/actions/workflow/status/gear-foundation/dapps/contracts.yml?logo=rust&label=docs)](https://dapps.gear.rs/vara_man_io) - # Sails Tic-Tac-Toe +A detailed description of the project can be found on the [wiki](https://wiki.vara.network/docs/examples/Gaming/tictactoe). + +⚙️ **Note**: The project code is developed using the [Sails](https://github.com/gear-tech/sails) framework. + ### 🏗️ Building ```sh -cargo b -r -p "tic-tac-toe-wasm" +cargo b -r -p "tic-tac-toe" ``` ### ✅ Testing diff --git a/contracts/tic-tac-toe/app/Cargo.toml b/contracts/tic-tac-toe/app/Cargo.toml index 167849b04..19678eba7 100644 --- a/contracts/tic-tac-toe/app/Cargo.toml +++ b/contracts/tic-tac-toe/app/Cargo.toml @@ -11,5 +11,5 @@ schnorrkel.workspace = true [dev-dependencies] gclient.workspace = true -tic-tac-toe-wasm = { path = "../wasm" } +tic-tac-toe = { path = "../wasm" } tokio = "1" diff --git a/contracts/tic-tac-toe/app/tests/test.rs b/contracts/tic-tac-toe/app/tests/test.rs index 5041aba99..ef9e45656 100644 --- a/contracts/tic-tac-toe/app/tests/test.rs +++ b/contracts/tic-tac-toe/app/tests/test.rs @@ -1,6 +1,6 @@ use sails_rs::calls::*; use sails_rs::gtest::{calls::*, System}; -use tic_tac_toe_wasm::{ +use tic_tac_toe::{ traits::{TicTacToe, TicTacToeFactory}, Config, GameResult, TicTacToe as TicTacToeClient, TicTacToeFactory as Factory, }; @@ -17,7 +17,7 @@ async fn test_play_game() { let program_space = GTestRemoting::new(system, ADMIN_ID.into()); let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe.opt.wasm"); let tic_tac_toe_factory = Factory::new(program_space.clone()); let config = Config { @@ -89,7 +89,7 @@ async fn add_and_remove_admin() { let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe.opt.wasm"); let tic_tac_toe_factory = Factory::new(program_space.clone()); let config = Config { @@ -138,7 +138,7 @@ async fn allow_messages() { let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/tic_tac_toe.opt.wasm"); let tic_tac_toe_factory = Factory::new(program_space.clone()); let config = Config { diff --git a/contracts/tic-tac-toe/wasm/Cargo.toml b/contracts/tic-tac-toe/wasm/Cargo.toml index ecc8e3518..ed27e3420 100644 --- a/contracts/tic-tac-toe/wasm/Cargo.toml +++ b/contracts/tic-tac-toe/wasm/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "tic-tac-toe-wasm" +name = "tic-tac-toe" version.workspace = true edition.workspace = true license.workspace = true @@ -16,4 +16,4 @@ tic-tac-toe-app = { path = "../app" } [lib] crate-type = ["rlib"] -name = "tic_tac_toe_wasm" +name = "tic_tac_toe" diff --git a/contracts/vara-man/README.md b/contracts/vara-man/README.md index 9b9a44331..0c32f05ac 100644 --- a/contracts/vara-man/README.md +++ b/contracts/vara-man/README.md @@ -1,12 +1,13 @@ -[![Open in Gitpod](https://img.shields.io/badge/Open_in-Gitpod-white?logo=gitpod)](https://gitpod.io/#FOLDER=vara-man/https://github.com/gear-foundation/dapps) -[![Docs](https://img.shields.io/github/actions/workflow/status/gear-foundation/dapps/contracts.yml?logo=rust&label=docs)](https://dapps.gear.rs/vara_man_io) - # Vara Man +A detailed description of the project can be found on the [wiki](https://wiki.vara.network/docs/examples/Gaming/varaman). + +⚙️ **Note**: The project code is developed using the [Sails](https://github.com/gear-tech/sails) framework. + ### 🏗️ Building ```sh -cargo b -r -p "vara-man-wasm" +cargo b -r -p "vara-man" ``` ### ✅ Testing diff --git a/contracts/vara-man/app/Cargo.toml b/contracts/vara-man/app/Cargo.toml index 61e439e97..e67c57576 100644 --- a/contracts/vara-man/app/Cargo.toml +++ b/contracts/vara-man/app/Cargo.toml @@ -12,6 +12,6 @@ schnorrkel.workspace = true [dev-dependencies] gtest.workspace = true gclient.workspace = true -vara-man-wasm = { path = "../wasm" } +vara-man = { path = "../wasm" } tokio = "1" extended_vft_wasm = { git = "https://github.com/gear-foundation/standards/"} diff --git a/contracts/vara-man/app/tests/test.rs b/contracts/vara-man/app/tests/test.rs index c51e7b356..1d0421eaf 100644 --- a/contracts/vara-man/app/tests/test.rs +++ b/contracts/vara-man/app/tests/test.rs @@ -2,7 +2,7 @@ use gtest::{Log, Program}; use sails_rs::calls::*; use sails_rs::gtest::{calls::*, System}; use sails_rs::{ActorId, Encode, U256}; -use vara_man_wasm::{ +use vara_man::{ traits::{VaraMan, VaraManFactory}, Config, Level, Status, VaraMan as VaraManClient, VaraManFactory as Factory, }; @@ -54,7 +54,7 @@ async fn test_play_game() { let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man.opt.wasm"); let vara_man_factory = Factory::new(program_space.clone()); let config = Config { @@ -122,7 +122,7 @@ async fn test_play_game_with_fungible_token() { let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man.opt.wasm"); let vara_man_factory = Factory::new(program_space.clone()); let config = Config { @@ -184,7 +184,7 @@ async fn test_play_tournament() { let code_id = program_space .system() - .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man_wasm.opt.wasm"); + .submit_code_file("../../target/wasm32-unknown-unknown/release/vara_man.opt.wasm"); let vara_man_factory = Factory::new(program_space.clone()); let config = Config { diff --git a/contracts/vara-man/wasm/Cargo.toml b/contracts/vara-man/wasm/Cargo.toml index c5d6e3e3e..eb86e2304 100644 --- a/contracts/vara-man/wasm/Cargo.toml +++ b/contracts/vara-man/wasm/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "vara-man-wasm" +name = "vara-man" version.workspace = true edition.workspace = true license.workspace = true diff --git a/contracts/zk-battleship/README.md b/contracts/zk-battleship/README.md new file mode 100644 index 000000000..d546aaed9 --- /dev/null +++ b/contracts/zk-battleship/README.md @@ -0,0 +1,19 @@ +# Zero-knowledge battleship + +This project is a battleship game that leverages zero-knowledge (zk) cryptography, enabling players to verify each other's moves without revealing any hidden information about their boards. The game preserves privacy through zk proofs, allowing players to prove the validity of their actions while keeping their board configurations confidential.In the repository, there is also a circom directory containing circuits essential for generating the zk proofs required in the game. + +For a more in-depth explanation of the game mechanics, design, and zk proof integration, please visit the project [wiki](https://wiki.vara.network/docs/examples/Gaming/Battleship/zk-battleship). + +⚙️ **Note**: The project code is developed using the [Sails](https://github.com/gear-tech/sails) framework. + +### 🏗️ Building + +```sh +cargo b -r -p "zk-battleship" +``` + +### ✅ Testing + +```sh +cargo t -r -p "zk-battleship-app" +``` diff --git a/contracts/zk-battleship/app/Cargo.toml b/contracts/zk-battleship/app/Cargo.toml index 4a312e522..6520a37d2 100644 --- a/contracts/zk-battleship/app/Cargo.toml +++ b/contracts/zk-battleship/app/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "zk-battleship" +name = "zk-battleship-app" version.workspace = true edition.workspace = true license.workspace = true diff --git a/contracts/zk-battleship/wasm/Cargo.toml b/contracts/zk-battleship/wasm/Cargo.toml index 845409660..873899f3d 100644 --- a/contracts/zk-battleship/wasm/Cargo.toml +++ b/contracts/zk-battleship/wasm/Cargo.toml @@ -1,13 +1,13 @@ [package] -name = "zk-battleship-wasm" +name = "zk-battleship" version.workspace = true edition.workspace = true license.workspace = true [dependencies] -zk-battleship = { path = "../app" } +zk-battleship-app = { path = "../app" } [build-dependencies] gear-wasm-builder.workspace = true sails-idl-gen.workspace = true -zk-battleship = { path = "../app" } +zk-battleship-app = { path = "../app" } diff --git a/contracts/zk-battleship/wasm/build.rs b/contracts/zk-battleship/wasm/build.rs index e9687eeb6..7781eb01a 100644 --- a/contracts/zk-battleship/wasm/build.rs +++ b/contracts/zk-battleship/wasm/build.rs @@ -1,6 +1,6 @@ use sails_idl_gen::program; use std::{env, fs::File, path::PathBuf}; -use zk_battleship::Program; +use zk_battleship_app::Program; fn main() { gear_wasm_builder::build(); diff --git a/contracts/zk-battleship/wasm/src/lib.rs b/contracts/zk-battleship/wasm/src/lib.rs index 807ef0223..92b0e8335 100644 --- a/contracts/zk-battleship/wasm/src/lib.rs +++ b/contracts/zk-battleship/wasm/src/lib.rs @@ -1,4 +1,4 @@ #![no_std] #[cfg(target_arch = "wasm32")] -pub use zk_battleship::wasm::*; +pub use zk_battleship_app::wasm::*;