This repository contains contract source code for the Onkas Ouji game.
The Onkas Ouji game is an on-chain battle game where players pit their NFT characters against each other in dice-based combat. This repository contains the core smart contracts powering the game's mechanics, including:
- Game logic and battle resolution
- Randomness generation (using multiple sources)
- Betting and payout systems
- NFT integration
The main game contract handling:
- Game creation and management
- Player vs player battles
- Betting mechanics
- Payout calculations
The randomness provider contract featuring:
- Multi-source randomness aggregation (Pyth Entropy, RandomizerAI, Self-Attested VRF)
- Fault-tolerant design
- Cryptographic security guarantees
- Solidity v0.8.26
- Foundry for development and testing
- Solady for optimized utility functions
- Pyth Entropy for verifiable randomness
- RandomizerAI for additional randomness source
- Foundry (https://getfoundry.sh)
- Node.js (for optional tooling)
- Access to Ethereum RPC endpoint
git clone
cd <repository_name>
forge install
make
Run the comprehensive test suite:
make test
forge script script/Deploy.s.sol:DeployScript \
--rpc-url ${TESTNET_RPC_URL} \
--broadcast \
-vvvv
forge script script/Deploy.s.sol:DeployScript \
--rpc-url ${MAINNET_RPC_URL} \
--broadcast \
-vvvv
- 5-round battles with best-of-3 wins
- Dice-based combat resolution
- NFT character statistics tracking
- Player vs player wagering
- Multi-source aggregation for security
- Configurable randomness providers
- Cryptographic guarantees
- Fault tolerance
- Reentrancy protection
- Input validation
- Role-based access control
- Comprehensive error handling
graph TD
A[OnkasOujiGame] -->|Uses| B[Wyrd]
B --> C[Pyth Entropy]
B --> D[RandomizerAI]
B --> E[Self-Attested VRF]
A --> F[NFT Contract]
A --> G[Token Contract]
- Make changes to contracts
- Run tests:
forge test
- Check gas usage:
forge snapshot
- Format code:
forge fmt
- Deploy to testnet for verification
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Submit a pull request
AGPL-3.0-only
These contracts are unaudited. Use at your own risk. The developers assume no liability for any losses incurred while interacting with these smart contracts.