Adrift
Your goal is simple, stay afloat longer than anyone else. Built by Syndicate
Install / Use
/learn @SyndicateProtocol/AdriftREADME
Adrift
Adrift is a decentralized game built on Syndicate's sequencing infrastructure. The project consists of two main categories of contracts deployed across different chains, along with a complete full-stack application.
Architecture Overview
Adrift uses a cross-chain architecture to separate game logic from transaction sequencing, enabling high throughput and efficient gas usage.
🎮 Game Chain Contracts (Pacifica)
These contracts handle the core game logic and player interactions:
- Adrift.sol - Main game contract with winner determination
- AdriftForever.sol - Perpetual game version without end conditions
- AdriftFactory.sol - Factory for deploying game instances
- CheckInOutcomes.sol - Manages random outcomes for player check-ins
- CheckInOutcomesFactory.sol - Factory for deploying outcome contracts
- Random.sol - Provides verifiable randomness for the game
⚡ Sequencing Chain Contracts (Risa)
These contracts handle transaction sequencing and compression:
- AdriftBundler.sol - Bundles and sequences game transactions
- Decompressor.sol - Decompresses zlib-compressed RLP transaction data
- RLPTxBreakdown.sol - Utilities for decoding RLP transaction data
- RLPReader.sol - RLP decoding utilities
Game Mechanics
Core Game Loop
- Players register by calling
register()on the game contract - Players must check in every 24 hours to remain active
- Check-ins have random outcomes that can buff/debuff next check-in times
- Players who miss check-ins or get negative outcomes are disqualified
- Last player standing wins (in Adrift.sol) or game continues indefinitely (in AdriftForever.sol)
Check-in System
- Grace Period: 1 hour window before next check-in where players can check in safely
- Risk/Reward: Early check-ins increase both risk of disqualification and potential rewards
- Random Outcomes: Each check-in has a random outcome affecting the next check-in time
System Architecture
Cross-Chain Design
The application uses a sophisticated cross-chain architecture to optimize performance and cost:
Game Chain (Pacifica):
- Handles core game logic and state management
- Processes player registrations and check-ins
- Manages game outcomes and disqualifications
- Provides verifiable randomness integration
Sequencing Chain (Risa):
- Bundles multiple transactions into single sequencing transactions
- Compresses transaction data for gas efficiency
- Processes transactions in order with randomness integration
- Handles high-throughput transaction processing
Application Components
Frontend (Next.js):
- Modern web interface built with React and Tailwind CSS
- Integrates with Para wallet for seamless user experience
- Real-time game state updates via indexer
- Responsive design for mobile and desktop
Indexer (Ponder):
- Monitors blockchain events across both chains
- Stores indexed data in PostgreSQL database
- Provides GraphQL API for frontend consumption
- Handles real-time data synchronization
Database (PostgreSQL):
- Stores game state, player data, and transaction history
- Optimized for read-heavy workloads
- Supports complex queries for leaderboards and analytics
Cron Jobs:
- Automated maintenance and monitoring tasks
- Health checks and system monitoring
- Periodic data cleanup and optimization
External Integrations
Syndicate Transaction Cloud:
- Handles automated transaction processing
- Manages player disqualification automation
- Provides reliable transaction sequencing
Para Wallet:
- Seamless wallet integration for users
- Supports multiple wallet types
- Handles transaction signing and submission
Lit Protocol:
- Programmable Key Pair (PKP) authentication
- Secure key management for automated processes
- Enhanced security for critical operations
Project Structure
adrift/
├── apps/
│ ├── indexer/ # Ponder indexer
│ ├── site/ # Next.js frontend application
│ └── cron/ # Automated tasks
├── contracts/
│ ├── foundry/ # Solidity smart contracts
│ └── stylus-decompressor/ # Rust Stylus contracts
└── package.json # Monorepo configuration
Deployed Contracts
Pacifica (Appchain): For Docs
| Contract Name | Address | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | AdriftFactory | 0x00aE9e627E3601928cc793De95923346564aC62C | | CheckInOutcomesFactory | 0x49436F4956E80D9e27826ec6e43f06b9a4E54C69 | | Random | 0x6a0f0b429ceb4289d1C0694b1C11542A70148EBE | | CheckInOutcomes | 0x3C162e84a57eC98730D6c96d9D268Eb323Ba7338 | | AdriftForever | 0xE5d5BDa485239317ebf2788B849f53cE9B63a64B |
Pacifica (Appchain): Production
| Contract Name | Address | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | CheckInOutcomesFactory | 0xC57E25881fda73f017C3D7c1308d00B1a358409e | | Random | 0xc75954B9B4Bb4B80883Cf645744612138b7e4870 | | CheckInOutcomes | 0xB102580A9eb72f4Ec5fA12C85CCFB30D5C016Ff0 | | Adrift | 0xcd15C8A1aBD28d46E7B6184A848DA9f9cFCda628 | | AdriftFactory | 0x3e3bfe9a911E7742fd65da7807773b4CD2e2B4Fd | | Adrift (Hotfixed) | 0x5F77E9be64D1DdA9d2c0FcB8a1E0d8c1E867ECa2 | | AdriftFactory (Hotfixed) | 0xf5c324Cd9fbA1cD5D35F131C2eA7808A55942DE1 |
Risa (Sequencing Chain)
| Contract Name | Address | | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | | AdriftBundler | 0xC9d942f8706A94B0A0c0bDC0b6e09E1D66bb18E8 | | Decompressor | 0x5d3f5fc4129290b11ac6ed9bbc99cf11a79a5ef0 |
License
MIT License - see LICENSE file for details
