An open API service indexing awesome lists of open source software.

https://github.com/jeninsutradhar/azorion

Solana-based smart contract that enables users to complete tasks and earn SOL rewards dynamically based on demand-supply logic
https://github.com/jeninsutradhar/azorion

anchor anticheat blockchain decentralized decentralized-applications demand-supply-management play-to-earn smart-contracts solana solana-program

Last synced: 9 days ago
JSON representation

Solana-based smart contract that enables users to complete tasks and earn SOL rewards dynamically based on demand-supply logic

Awesome Lists containing this project

README

        

# Azorion - Dynamic Task-Based Reward System on Solana

[![Project Status](https://img.shields.io/badge/Status-Under_Development-yellow)](https://www.repostatus.org/#wip) [![Rust](https://img.shields.io/badge/Rust-orange?logo=rust)](https://www.rust-lang.org/) [![Anchor](https://img.shields.io/badge/Anchor-red?logo=anchor)](https://www.anchor-lang.com/) [![Solana](https://img.shields.io/badge/Solana-blue?logo=solana)](https://solana.com/) [![License](https://img.shields.io/badge/License-MIT-green)](https://opensource.org/licenses/MIT) [![Tests Passing](https://img.shields.io/badge/Tests-Passing-brightgreen)](https://your-test-results-url-here.com) [![Documentation](https://img.shields.io/badge/Documentation-Available-blue)](https://azorion.netlify.com) ![Website](https://img.shields.io/website?url=https%3A%2F%2Fazorion.netlify.app)

Azorion is a **Solana smart contract** that powers a **task-driven reward system**, enabling users to earn **SOL dynamically** based on task availability and engagement levels. The system uses **real-time demand-supply mechanics** to adjust rewards, **prevent farming exploits**, and encourage **sustainable participation**.


Azorion Logo

## **πŸ”Ή Key Features**

| | |
|--------------------------------|--------------------------------------------------------------------------------|
| **Task-Based Rewards** | Users earn **SOL** by completing on-chain tasks. |
| **Dynamic Reward Adjustment** | Rewards **increase or decrease** (Β±20%/Β±10%) based on task availability. |
| **Secure PDA Storage** | Uses **Program Derived Addresses (PDA)** for tamper-proof tracking. |
| **Anti-Farming Protection** | **Reduces rewards** for repeated task claims; resets when switching tasks. |
| **Cooldown System** | **5-second delay** enforced between task completions to prevent spam. |
| **RNG Task Availability** | **Randomized task enable/disable** every **10 seconds** to enhance engagement. |

At its core, Azorion establishes a demand-responsive incentive structure. Rewards are algorithmically increased during periods of high task availability and low user engagement, effectively incentivizing participation. Conversely, rewards are moderated when user activity exceeds available tasks, promoting system sustainability and preventing inflationary pressures.

## πŸ› οΈ Program Architecture

![Architecture](https://github.com/user-attachments/assets/5299c3b2-620d-4ebe-9638-ece6eb9e29c8)

## **πŸ”Ή Use Cases**
Azorion's dynamic reward system supports:

βœ” **Play-to-Earn Games** – Task-based in-game incentives.
βœ” **Educational Platforms** – Milestone-based rewards for learners.
βœ” **Decentralized Work** – Demand-based compensation for freelancers.
βœ” **Community Governance** – Rewarding proposal participation.
βœ” **Loyalty Programs** – Engagement-driven incentives.

## βœ… Implementation Status
| Feature | Status |
| -------------------------------------------- | ----------- |
| **Task-Based Reward System** | βœ… Completed |
| **Dynamic Reward Adjustment** | βœ… Completed |
| **Program Derived Address (PDA) Storage** | βœ… Completed |
| **Anti-Farming Mechanism** | βœ… Completed |
| **Cooldown System** | βœ… Completed |
| **RNG-Based Task Availability** | βœ… Completed |
| **Security & Optimization** | ❌ Completed |
| **Leaderboard (Top 5 Earners)** | ❌ To be Implemented |
| **Automated Tests** | ❌ Completed |

## **πŸ”Ή Security Measures**

| **Security Aspect** | **Implementation** |
|--------------------------|------------------------------------------------------------------------------------|
| **Access Control** | **Authority-restricted program initialization** and **parameter management**. |
| **Anti-Farming** | Implements **progressive reward penalties** for repeated task farming. |
| **Data Integrity** | Utilizes **Solana PDAs** to ensure **on-chain secure storage**. |
| **Memory Safety** | Built with **Rust**, ensuring **safe and secure memory management**. |
| **Security Audits** | 🚧 **Planned periodic third-party audits** *(Required before production use).* |

πŸ’‘ **Note:** *Azorion is currently under development. Deployment in production environments is not recommended until a formal audit is completed.*

---

## **πŸ”Ή Program API**

| **Instruction** | **Purpose** | **Arguments** |
|------------------|---------------------------------------------------------------|------------------------------------------------------------|
| `initialize` | Sets up **program state** (authority, SOL supply, task limits). | `initial_supply: u64`, `min_available_tasks: u8`, `max_available_tasks: u8` |
| `claim_reward` | Allows users to **claim SOL rewards** for completing tasks. | `activity_type: String` |
| `randomize_tasks`| Refreshes **task availability** based on randomization logic. | *(No Arguments)* |

---

## **πŸ”Ή Deployment Instructions**

### **πŸ“Œ Local Validator Deployment**
1️⃣ Start the local validator:
```sh
solana-test-validator
```
2️⃣ Deploy the program:
```sh
anchor deploy
```

### **πŸ“Œ Devnet Deployment**
1️⃣ Configure Solana to **Devnet**:
```sh
solana config set --url devnet
```
2️⃣ Get **free test SOL**:
```sh
solana airdrop 5
```
3️⃣ Deploy the program:
```sh
anchor deploy --provider.cluster devnet
```

### **πŸ“Œ Testnet/Mainnet Deployment**
1️⃣ Switch to **Testnet/Mainnet**:
```sh
solana config set --url testnet # For Testnet
solana config set --url mainnet-beta # For Mainnet
```
2️⃣ Ensure sufficient **SOL balance** for deployment.
3️⃣ Deploy the program:
```sh
anchor deploy --provider.cluster testnet # Use mainnet-beta for production
```

---

## **πŸ”Ή Testing Overview**

Azorion undergoes **extensive testing** using **Mocha + Chai** for assertion-based validation.

| **Test Case** | **Coverage** |
|----------------------|-----------------------------------------------------------------------------|
| **Initialization** | Ensures correct **program setup, authority verification**. |
| **Reward Dynamics** | Simulates **demand-based reward increases/decreases**. |
| **Anti-Farming** | Tests **progressive penalties for repeated task claims**. |
| **Cooldowns** | Verifies **5-second delay enforcement between claims**. |
| **Security Checks** | **Rejects unauthorized transactions, overflow, and invalid inputs.** |

---

## πŸ”Ή **Technology Stack:**
- **Blockchain:** Solana (Rust + Anchor)
- **Smart Contracts:** Rust, Anchor Framework
- **Testing & Deployment:** Solana Devnet, Anchor CLI, TypeScript (for tests)

## ⬆️ CHANGELOG
- **Numerical Task Identifiers (Enums):** Replaced string task names with ActivityType enums, significantly improving efficiency in storage and processing. Tasks are now represented and handled internally using numerical IDs, which are faster to compare and less error-prone than strings.
- **Improved RNG for Task Availability:** Modified the randomize_available_tasks function to use the block slot number from clock::Clock::get()?.slot as the source of randomness, making task availability less predictable and more resistant to potential manipulation compared to timestamp-based RNG.
- **Error Handling:** Incorporated custom error codes using the ErrorCode enum to provide more informative and specific error messages, aiding in debugging and user feedback.
- **Account Size Management:** Defined MAX_SIZE constants for ProgramState and User accounts and utilized them in #[account(space = ...)] to ensure rent exemption and prevent potential buffer overflow vulnerabilities.

## πŸ—ΊοΈ Roadmap and Future Work


brand-page-laptop-on-desk

* **Leaderboard Integration**
* **Frontend UI & SDK**
* **Regular Security Audits**