# ๐ ScriptChain Smart Contracts
This repository contains the smart contracts powering **ScriptChain**, a blockchain-based literature platform that rewards reader engagement, manages book ownership, enables interactive games, and integrates tokenized incentives.
Built on **Starknet** using **Cairo 1.0**, these contracts are designed for secure, transparent, and scalable interactions between users and the platform.
---
## ๐ Core Contracts
| Contract Name | Description |
|-----------------------|-------------|
| `RewardToken.cairo` | ERC20-style token contract to reward user engagement. |
| `EngagementRewarder.cairo` | Tracks reading activity and distributes tokens to readers. |
| `QuizGame.cairo` | Quiz/prediction game logic with on-chain rewards. |
| `BookNFT.cairo` | Optional ERC721 contract for tokenized book ownership. |
| `Marketplace.cairo` | Book marketplace accepting crypto payments. |
| `AccessControl.cairo` | Role-based permissions (admin, reader, oracle, etc.). |
---
## ๐งฐ Tools & Requirements
- [Starknet/Cairo 1.0](https://book.cairo-lang.org/)
- [Protostar](https://docs.swmansion.com/protostar/)
- [Starkli](https://github.com/xJonathanLEI/starkli) (optional CLI)
- Python โฅ 3.8 for local scripts/tests
---
## ๐ ๏ธ Setup & Compilation
### Clone the Repo
```bash
git clone https://github.com/yourusername/scriptchain-contracts.git
cd scriptchain-contractscurl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash
source ~/.bashrcprotostar buildUpdate your protostar.toml or CLI args with your Starknet RPC and wallet details.
protostar deploy ./build/RewardToken.json
protostar deploy ./build/EngagementRewarder.jsonFor testnet (e.g., Sepolia or Starknet Testnet):
protostar deploy ./build/RewardToken.json --network testnetAll tests are written in Cairo using protostar.
protostar test ./testscontracts/
โโโ RewardToken.cairo
โโโ EngagementRewarder.cairo
โโโ QuizGame.cairo
โโโ BookNFT.cairo
โโโ AccessControl.cairo
โโโ Marketplace.cairo
tests/
โโโ test_reward_token.cairo
โโโ test_engagement_rewarder.cairo
โโโ ...
- Follows Starknet best practices for access control, upgradability, and gas efficiency.
- Includes pause mechanisms and role checks for critical functions.
- Formal audits will be conducted prior to mainnet deployment.
- Deploy testnet
RewardToken - Build & test
EngagementRewarder - Integrate quiz logic into
QuizGame - Implement book purchase logic in
Marketplace - Add DAO-style voting for community proposals
MIT License ยฉ 2025 ScriptChain Contributors
PRs and suggestions are welcome! See CONTRIBUTING.md for coding standards and review process.