-
Notifications
You must be signed in to change notification settings - Fork 54
Expand file tree
/
Copy pathyour_readme.txt
More file actions
134 lines (99 loc) · 3.53 KB
/
your_readme.txt
File metadata and controls
134 lines (99 loc) · 3.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# 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
```bash
# 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
```bash
# Build all contracts
soroban contract build
# Run tests
cargo test
# Build optimized contracts
soroban contract optimize --wasm target/wasm32-unknown-unknown/release/*.wasm
```
## 🧪 Testing
```bash
# 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
```bash
# 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
* [Quest Service Backend](https://github.com/MindFlowInteractive/quest-service)
* [Quest Service Frontend](https://github.com/yourusername/quest-service-frontend)