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
11 changes: 11 additions & 0 deletions .github/workflows/circuit_examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,25 @@ jobs:

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32v1-none

- name: Cache dependencies
uses: Swatinem/rust-cache@v2
with:
workspaces: examples/${{ matrix.example }}

- name: Test ${{ matrix.example }}
working-directory: examples/${{ matrix.example }}
run: cargo test

- name: Install Stellar CLI
uses: stellar/stellar-cli@v25.1.0

- name: Stellar contract build
working-directory: examples/${{ matrix.example }}
run: stellar contract build

circuits-lib:
name: Circuits Module
runs-on: ubuntu-latest
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/session_arena.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Session Arena Example CI

on:
push:
branches: [main, develop]
paths:
- 'examples/session_arena/**'
- '!examples/session_arena/**/*.md'
- '.github/workflows/example_reusable.yml'
- '.github/workflows/session_arena.yml'
pull_request:
branches: [main, develop]
paths:
- 'examples/session_arena/**'
- '!examples/session_arena/**/*.md'
- '.github/workflows/example_reusable.yml'
- '.github/workflows/session_arena.yml'

concurrency:
group: session-arena-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
uses: ./.github/workflows/example_reusable.yml
with:
job_name: Session Arena Example CI
working_directory: examples/session_arena
28 changes: 28 additions & 0 deletions .github/workflows/spawn_and_move.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Spawn And Move Example CI

on:
push:
branches: [main, develop]
paths:
- 'examples/spawn_and_move/**'
- '!examples/spawn_and_move/**/*.md'
- '.github/workflows/example_reusable.yml'
- '.github/workflows/spawn_and_move.yml'
pull_request:
branches: [main, develop]
paths:
- 'examples/spawn_and_move/**'
- '!examples/spawn_and_move/**/*.md'
- '.github/workflows/example_reusable.yml'
- '.github/workflows/spawn_and_move.yml'

concurrency:
group: spawn-and-move-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
uses: ./.github/workflows/example_reusable.yml
with:
job_name: Spawn And Move Example CI
working_directory: examples/spawn_and_move
10 changes: 8 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,17 @@ them as the default onboarding path.

The maintained reference architectures for Cougr should be read in this order:

- `spawn_and_move`: **start here** — canonical onboarding example showing the full modern Cougr pattern
- `tic_tac_toe`: turn-based game with rich components (`impl_rich_component!`) for `Address` and `Vec` fields
- `spawn_and_move`: **start here** — canonical onboarding example showing the full modern Cougr pattern (`SorobanGame`, `impl_component_observed!`, typed ECS)
- `tic_tac_toe`: turn-based game showing rich components (`impl_rich_component!`, `impl_soroban_game!`) for `Address` and `Vec` fields
- `session_arena`: session lifecycle, authorization scopes, and fallback direct-auth flows (`SessionManager`)
- `snake`: canonical arcade loop and `GameApp` tick model
- `battleship`: canonical hidden-information / commit-reveal flow using `privacy::stable` Merkle primitives
- `guild_arena`: canonical account recovery and multi-device authorization flow
- **ZK Circuit Reference Examples**:
- `hidden_hand`: private card deals via `circuits::hidden_cards`
- `fog_explorer`: private line-of-sight map verification via `circuits::fog_of_war`
- `dice_duel`: verifiable on-chain dice rolling via `circuits::fair_dice`
- `blind_auction`: sealed-bid auction reveals via `circuits::sealed_bid`

## Conventions

Expand Down
17 changes: 17 additions & 0 deletions examples/ai_dungeon_master_arena/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build artifacts
target/
*.wasm

# Soroban
.soroban/
test_snapshots/

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
17 changes: 17 additions & 0 deletions examples/angry_birds/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build artifacts
target/
*.wasm

# Soroban
.soroban/
test_snapshots/

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
2 changes: 1 addition & 1 deletion examples/angry_birds/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "angry_birds"
version = "0.1.0"
edition = "2021"
publish = false
description = "Angry Birds turn-based physics puzzle using Cougr-Core ECS framework on Stellar Soroban"
description = "Angry Birds turn-based physics puzzle using Cougr-Core ECS on Stellar Soroban"
license = "MIT OR Apache-2.0"

[lib]
Expand Down
8 changes: 4 additions & 4 deletions examples/angry_birds/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ stellar network testnet
stellar contract deploy \
--wasm target/wasm32v1-none/release/angry_birds.wasm \
--source <your-account> \
--network testnet
--network <NETWORK>

# Note the contract ID for subsequent interactions
```
Expand All @@ -158,7 +158,7 @@ stellar contract deploy \
stellar contract invoke \
--id <contract-id> \
--source <player-account> \
--network testnet \
--network <NETWORK> \
-- init_level \
--player <player-address> \
--level_id 1
Expand All @@ -167,7 +167,7 @@ stellar contract invoke \
stellar contract invoke \
--id <contract-id> \
--source <player-account> \
--network testnet \
--network <NETWORK> \
-- shoot \
--player <player-address> \
--angle 45000 \
Expand All @@ -177,7 +177,7 @@ stellar contract invoke \
stellar contract invoke \
--id <contract-id> \
--source <any-account> \
--network testnet \
--network <NETWORK> \
-- get_state
```

Expand Down
17 changes: 17 additions & 0 deletions examples/arkanoid/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Build artifacts
target/
*.wasm

# Soroban
.soroban/
test_snapshots/

# IDE
.idea/
.vscode/
*.swp
*.swo

# OS
.DS_Store
Thumbs.db
20 changes: 10 additions & 10 deletions examples/arkanoid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ Get test XLM from Friendbot:

```bash
# Generate a new keypair
stellar keys generate alice --network testnet
stellar keys generate alice --network <NETWORK>

# Fund the account
stellar keys fund alice --network testnet
stellar keys fund alice --network <NETWORK>
```

Or use the web faucet: https://faucet-stellar.acachete.xyz
Expand All @@ -131,10 +131,10 @@ stellar contract build
stellar contract deploy \
--wasm target/wasm32v1-none/release/arkanoid.wasm \
--source alice \
--network testnet
--network <NETWORK>
```

Save the contract ID returned (e.g., `CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX`).
Save the contract ID returned (e.g., `<CONTRACT_ID>XXX`).

### 3. Invoke Contract Functions

Expand All @@ -144,7 +144,7 @@ Save the contract ID returned (e.g., `CXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- init_game
```

Expand All @@ -170,14 +170,14 @@ stellar contract invoke \
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- move_paddle --direction 1

# Move left (direction = -1)
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- move_paddle --direction -1
```

Expand All @@ -187,7 +187,7 @@ stellar contract invoke \
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- update_tick
```

Expand All @@ -203,7 +203,7 @@ This advances the game by one frame:
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- get_game_state
```

Expand All @@ -213,7 +213,7 @@ stellar contract invoke \
stellar contract invoke \
--id <CONTRACT_ID> \
--source alice \
--network testnet \
--network <NETWORK> \
-- check_game_over
```

Expand Down
4 changes: 3 additions & 1 deletion examples/asteroids/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ target
.soroban
.stellar

/test_snapshots/
/test_snapshots/
target/
*.wasm
1 change: 1 addition & 0 deletions examples/asteroids/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[package]
description = "Arcade asteroid shooter with entity movement and collision systems"
name = "asteroids"
version = "0.0.0"
edition = "2021"
Expand Down
18 changes: 9 additions & 9 deletions examples/asteroids/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ stellar network add testnet \
--rpc-url https://soroban-testnet.stellar.org \
--network-passphrase "Test SDF Network ; September 2015"

stellar keys generate testnet --network testnet
stellar keys fund testnet --network testnet
stellar keys generate testnet --network <NETWORK>
stellar keys fund testnet --network <NETWORK>

stellar contract deploy \
--wasm target/wasm32v1-none/release/asteroids.wasm \
--source testnet \
--network testnet
--network <NETWORK>
```

Invoke contract methods:
Expand All @@ -110,45 +110,45 @@ Invoke contract methods:
stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
init_game

# Control ship
stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
rotate_ship --delta_steps 1

stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
thrust_ship

stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
shoot

# Update game state
stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
update_tick

# Query state
stellar contract invoke \
--id <CONTRACT_ID> \
--source testnet \
--network testnet \
--network <NETWORK> \
-- \
get_game_state
```
Expand Down
1 change: 0 additions & 1 deletion examples/battleship/.gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Rust
target/
Cargo.lock
**/*.rs.bk
*.pdb

Expand Down
3 changes: 2 additions & 1 deletion examples/battleship/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ crate-type = ["cdylib", "rlib"]

[dependencies]
soroban-sdk = "25.1.0"
cougr-core = "1.0.0"
cougr-core = "1.1.0"

[dev-dependencies]
soroban-sdk = { version = "25.1.0", features = ["testutils"] }
cougr-core = { version = "1.1.0", features = ["testutils"] }

[profile.release]
opt-level = "z"
Expand Down
Loading
Loading