ikemHood/ScriptChain-contract

โ˜… 0Forks 0CairoGitHub โ†—Compare

README

# ๐Ÿ“œ 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-contracts

Install Protostar

curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash
source ~/.bashrc

Build Contracts

protostar build

๐Ÿš€ Deployment

Update your protostar.toml or CLI args with your Starknet RPC and wallet details.

protostar deploy ./build/RewardToken.json
protostar deploy ./build/EngagementRewarder.json

For testnet (e.g., Sepolia or Starknet Testnet):

protostar deploy ./build/RewardToken.json --network testnet

๐Ÿงช Testing

All tests are written in Cairo using protostar.

protostar test ./tests

๐Ÿ“ Folder Structure

contracts/
โ”œโ”€โ”€ RewardToken.cairo
โ”œโ”€โ”€ EngagementRewarder.cairo
โ”œโ”€โ”€ QuizGame.cairo
โ”œโ”€โ”€ BookNFT.cairo
โ”œโ”€โ”€ AccessControl.cairo
โ””โ”€โ”€ Marketplace.cairo

tests/
โ”œโ”€โ”€ test_reward_token.cairo
โ”œโ”€โ”€ test_engagement_rewarder.cairo
โ””โ”€โ”€ ...

๐Ÿ” Security Notes

  • 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.

๐Ÿงญ Roadmap

  • Deploy testnet RewardToken
  • Build & test EngagementRewarder
  • Integrate quiz logic into QuizGame
  • Implement book purchase logic in Marketplace
  • Add DAO-style voting for community proposals

๐Ÿ“œ License

MIT License ยฉ 2025 ScriptChain Contributors


๐Ÿค Contributing

PRs and suggestions are welcome! See CONTRIBUTING.md for coding standards and review process.



Contributors

ikemHoodlynaDev2LaGodxy

Issues