Skip to content

Conversation

@nangs6610
Copy link

@nangs6610 nangs6610 commented Oct 25, 2025

This commit adds CaseRush, a decentralized CS:GO case opening application built on BSC featuring:

  • Provably fair randomness using cryptographic commitment scheme
  • On-chain inventory management
  • Automated BNB payouts when selling items
  • Verified smart contract on BscScan
  • Next.js frontend with Privy wallet integration

Live demo: https://www.caserush.fun
Contract: 0x22F1e50762E8D069E18f223CDd114Ec7F586cCAD

Generated with Claude Code

Description

This PR adds CaseRush, a provably fair CS:GO case opening dApp built on BNB Smart Chain. The project
demonstrates several important blockchain development concepts for the BSC ecosystem:

  • 🎲 Provably Fair System: Implements cryptographic commitment scheme for verifiable randomness
  • 🔗 On-Chain Inventory: Full on-chain storage and management of player inventory
  • 💰 Automated Payments: Instant BNB payouts when selling items without manual intervention
  • Verified Contract: Fully verified and transparent smart contract on BscScan
  • 🚀 Production Ready: Live on BSC Mainnet with real users

Live Demo

What's Included

Smart Contract (contracts/CaseRush.sol)

  • Solidity 0.8.20 with optimizer enabled
  • 7 unique items with weighted probabilities
  • ReentrancyGuard for security
  • Pausable emergency controls
  • Gas-optimized storage patterns

Documentation

  • Comprehensive README with setup instructions
  • Smart contract deployment guide
  • Economics breakdown (62.7% RTP, house edge calculation)
  • Security features documentation

Tech Stack

  • Backend: Solidity, Hardhat
  • Frontend: Next.js 16.0, TypeScript, Tailwind CSS
  • Wallet: Privy integration
  • Blockchain: BSC Mainnet

Why This Example is Valuable

  1. Gaming + DeFi: Shows how to combine gaming mechanics with DeFi concepts
  2. Provable Fairness: Educational resource for implementing cryptographic fairness
  3. On-Chain State: Demonstrates proper on-chain inventory management
  4. Production Example: Not just a tutorial - this is live on mainnet with real users
  5. Full Stack: Complete dApp from smart contract to UI

Developer Learning Outcomes

Developers can learn:

  • How to implement provably fair randomness
  • On-chain inventory and state management
  • Automated cryptocurrency payouts
  • Contract verification best practices
  • Full-stack dApp architecture on BSC
  • Wallet integration with Privy
  • Gas optimization techniques

Test Plan

  • ✅ Smart contract deployed and verified on BSC Mainnet
  • ✅ Website live and functional at www.caserush.fun
  • ✅ README documentation complete
  • ✅ Contract code included in typescript/caserush/
  • ✅ web/list.json updated with metadata
  • ✅ Main README.md updated with example entry

Fixes # (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Live Production Testing

Smart Contract Testing

  1. Deployment: Contract successfully deployed to BSC Mainnet (Chain ID: 56)
  2. Case Opening: Tested opening cases with real BNB transactions
  3. Inventory Management: Verified on-chain inventory tracking works correctly
  4. Sell Functionality: Confirmed automated BNB payouts work (see internal transactions on BscScan)
  5. Gas Optimization: Contract optimized with 200 runs, functioning efficiently

Frontend Testing

  1. Wallet Integration: Tested with Privy wallet connection (MetaMask, WalletConnect)
  2. Case Opening Flow: Full user flow from wallet connection → case opening → receiving items
  3. Inventory Display: Items correctly displayed from on-chain data
  4. Sell Items: Sell functionality tested with real transactions
  5. Responsive Design: Tested on desktop and mobile devices

To test this example:

  1. Clone the example:
    git clone https://github.com/nangs6610/example-hub.git
    cd example-hub/typescript/caserush
    
  2. Install dependencies:
    npm install
  3. Set up environment (create .env.local):
    NEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id
    NEXT_PUBLIC_CHAIN_ID=56
    NEXT_PUBLIC_RPC_URL=https://bsc-dataseed.binance.org/
    NEXT_PUBLIC_CONTRACT_ADDRESS=0x22F1e50762E8D069E18f223CDd114Ec7F586cCAD
  4. Run development server:
    npm run dev
  5. Test the live contract:
    - Visit http://localhost:3000
    - Connect your BSC wallet with testnet BNB
    - Open a case (costs 0.002 BNB)
    - View inventory and test sell functionality

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

This commit adds CaseRush, a decentralized CS:GO case opening application built on BSC featuring:

- Provably fair randomness using cryptographic commitment scheme
- On-chain inventory management
- Automated BNB payouts when selling items
- Verified smart contract on BscScan
- Next.js frontend with Privy wallet integration

Live demo: https://www.caserush.fun
Contract: 0x22F1e50762E8D069E18f223CDd114Ec7F586cCAD

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Contributor

@0xlucasliao 0xlucasliao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey there thank you for submission we noticed that this solidity contract belongs to one of your existing projects I thought it was amazing the entire project that you were building was pretty incredible. However for the cookbook challenge we want to ensure that it is a very clear single use case of a certain example. Instead of pasting your entire solidity contract maybe you could illustrate a specific path that you want to demonstrate in your example and remove all unrelated functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants