A decentralized role-playing game built on Ethereum that combines traditional RPG mechanics with DeFi elements. Players can create characters, collect equipment, complete quests, and participate in various DeFi activities, all while enjoying a classic RPG experience powered by blockchain technology.
- Mint unique character NFTs (ERC-721)
- Customize character attributes (strength, agility, magic)
- Equip items to enhance stats
- Character progression through quests and activities
- Multi-token equipment system (ERC-1155)
- Various item types with unique stats and bonuses
- Special abilities and effects
- Equipment enhancement and modification
- Various quests with different difficulty levels
- Stat requirements for quest participation
- Token rewards for completion
- Cooldown periods to balance gameplay
- Chainlink VRF-powered random drops
- Configurable drop tables and probabilities
- Fair and verifiable randomness
- Automatic item minting on successful drops
- Dedicated wallet for each character
- Secure asset management
- Simplified inventory system
- Character-specific transactions
For detailed information about all smart contract functions, parameters, and data structures, please refer to our API Documentation. The API docs include:
- Complete function signatures and descriptions
- Parameter details and return values
- Access control specifications
- Data structure definitions
- Event documentation
- Error handling information
- Native ERC-20 token for the game ecosystem
- Used for rewards, transactions, and DeFi activities
- Earned through quests and gameplay
- Utility in marketplace and AMM
- Trade characters, equipment, and items
- Set prices and create listings
- Auction system for rare items
- Fee structure for sustainability
- Decentralized token exchange
- Liquidity provision opportunities
- Token swapping functionality
- Yield farming potential
- Node.js v14+
- Foundry
- MetaMask or compatible Web3 wallet
- Clone the repository:
git clone https://github.com/lcanady/dnd.git
cd dnd
- Install dependencies:
forge install
- Set up environment variables:
cp .env.example .env
# Edit .env with your values:
# - PRIVATE_KEY: Your deployment wallet private key
# - VRF_KEY_HASH: Chainlink VRF key hash
# - VRF_COORDINATOR: Chainlink VRF coordinator address
# - VRF_SUBSCRIPTION_ID: Your Chainlink VRF subscription ID
- Run tests:
forge test
Deploy all contracts:
forge script script/Deploy.s.sol --rpc-url $RPC_URL --private-key $PRIVATE_KEY
# Run all tests
forge test
# Run specific test file
forge test --match-path test/Character.t.sol
# Run with verbosity for debugging
forge test -vv
After deployment, verify contracts on Etherscan:
forge verify-contract [CONTRACT_ADDRESS] [CONTRACT_NAME] --chain-id [CHAIN_ID] --api-key [ETHERSCAN_API_KEY]
- OpenZeppelin's battle-tested contract implementations
- Chainlink VRF for verifiable randomness
- Access control and role-based permissions
- Reentrancy protection
- Integer overflow/underflow protection
- Emergency pause functionality
- Comprehensive test coverage
- Core game mechanics
- Basic DeFi integration
- Character and equipment systems
- Quest system
- Advanced character progression
- Guild system
- PvP battles
- Enhanced marketplace features
- Cross-chain functionality
- Advanced DeFi mechanics
- Governance system
- Mobile interface
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow Solidity style guide
- Add comprehensive tests for new features
- Document all public functions
- Maintain gas efficiency
- Consider security implications
MIT License - see LICENSE.md
- OpenZeppelin for secure contract implementations
- Chainlink for VRF functionality
- Foundry for development framework
- The Ethereum community for inspiration and support