ustaxs/quest-contract

โ˜… 0Forks 0RustGitHub โ†—Compare

README

Quest Service - Smart Contracts

Soroban smart contracts powering Quest Service, a logic puzzle game on the Stellar blockchain.

๐Ÿ” Contracts Overview

Achievement NFT Contract

Mints and manages NFT achievements for puzzle completion milestones.

Reward Token Contract

Manages custom token rewards and puzzle unlocks.

Puzzle Verification Contract

Verifies puzzle solutions and triggers rewards.

Guild Contract

Manages guild membership, treasury, voting, and inter-guild competitions.

Referral Contract

Tracks referral relationships and distributes rewards to both referrers and referees. Features include:

  • Unique referral code generation
  • Dual reward distribution (referrer + referee)
  • Referral limits per user
  • Anti-gaming mechanisms (prevents self-referrals, duplicate registrations)
  • Comprehensive statistics tracking
  • Event emissions for all referral activities

Insurance Contract

Protects player assets (NFTs, tokens) against loss through premium-based insurance. Features include:

  • Multiple coverage types (NFT, Token, Combined)
  • Dynamic premium calculation
  • Policy purchase, renewal, and cancellation
  • Claim submission and review system
  • Admin-reviewed payout processing
  • Fraud detection with cooldowns and frequency limits
  • Premium pool management
  • Prorated refunds on cancellation

๐Ÿ› ๏ธ Tech Stack

  • Language: Rust
  • Framework: Soroban SDK
  • Network: Stellar (Testnet/Mainnet)
  • Testing: Soroban CLI, Rust tests

๐Ÿ“ฆ Prerequisites

# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Add wasm target
rustup target add wasm32-unknown-unknown

# Install Soroban CLI
cargo install --locked soroban-cli --version 21.0.0

๐Ÿš€ Quick Start

# Build all contracts
soroban contract build

# Run tests
cargo test

# Build optimized contracts
soroban contract optimize --wasm target/wasm32-unknown-unknown/release/*.wasm

๐Ÿงช Testing

# Run all tests
cargo test

# Run specific contract tests
cargo test --package achievement-nft
cargo test --package insurance

# Run with output
cargo test -- --nocapture

๐Ÿ“ Project Structure

quest-service-contracts/
โ”œโ”€โ”€ contracts/
โ”‚   โ”œโ”€โ”€ achievement_nft/     # NFT achievement contract
โ”‚   โ”œโ”€โ”€ reward_token/        # Token reward contract
โ”‚   โ”œโ”€โ”€ puzzle_verification/ # Puzzle verification contract
โ”‚   โ”œโ”€โ”€ guild/               # Guild management contract
โ”‚   โ”œโ”€โ”€ referral/            # Referral tracking and rewards contract
โ”‚   โ””โ”€โ”€ insurance/           # Asset insurance and protection contract
โ”œโ”€โ”€ tests/                   # Integration tests
โ”œโ”€โ”€ scripts/                 # Deployment scripts
โ”œโ”€โ”€ Cargo.toml              # Workspace configuration
โ””โ”€โ”€ README.md

๐Ÿšข Deployment

Deploy to Testnet

# Configure network
soroban network add testnet \
  --rpc-url https://soroban-testnet.stellar.org \
  --network-passphrase "Test SDF Network ; September 2015"

# Generate identity
soroban keys generate deployer --network testnet

# Fund account
soroban keys fund deployer --network testnet

# Deploy contract
soroban contract deploy \
  --wasm target/wasm32-unknown-unknown/release/achievement_nft.wasm \
  --source deployer \
  --network testnet

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ”— Related Repositories

Contributors

MkalbaniLynndabelaji70nafsonigrainwaters11Mosas2000Samuel1505NemenwqAkinbola247nafiuishaaqMrwicks00millicentogalanya0xOlivanodeBrayanMQyusuftomilolaFrancis6-gitykargeee-bitdevJajaabbakargarbamijinummiikemHoodSharifIbrahimDevemmanuelistProperprogress1nnennaokoyeDaddyGachiayshadogoaguilar1xLex-StudiosNanle-code

Issues