SonicPact is a decentralized platform that facilitates deal-making between gaming studios and celebrities using smart contracts on the Solana blockchain.
SonicPact enables gaming studios to collaborate with celebrities for NFT projects by providing:
- Secure wallet connection using Solana wallet adapters
- User profiles for both gaming studios and celebrities
- Deal creation and negotiation
- Real-time messaging and chat requests
- Smart contract integration for secure transactions
- Commemorative NFT minting upon deal completion
- Frontend: Next.js, React, TypeScript, TailwindCSS
- Backend: Supabase (PostgreSQL)
- Blockchain: Solana (Rust smart contracts)
- Authentication: Solana wallet authentication
- Real-time: Supabase Realtime for chat and notifications
- NFT Standards: SPL Token and Metaplex Token Metadata
- Node.js (v18+)
- npm or yarn
- Rust (for Solana smart contract development)
- Solana CLI tools & Anchor framework (for smart contract development)
- Supabase account (for database)
-
Clone the repository:
git clone https://github.com/yourusername/sonicpact.git cd sonicpact
-
Install dependencies for web app:
cd app npm install
-
Set up environment variables: Create a
.env.local
file in theapp
directory with the following variables:NEXT_PUBLIC_SUPABASE_URL=your_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser.
-
Install Anchor framework if you haven't already:
cargo install --git https://github.com/coral-xyz/anchor avm --locked avm install latest avm use latest
-
Build the smart contract:
anchor build
-
Update the IDL for the frontend:
npm run update-idl
-
Run tests:
anchor test
-
Deploy to a Solana cluster (localnet, devnet, or mainnet):
anchor deploy
The project includes several utility scripts to help with development:
-
Update IDL:
npm run update-idl # JavaScript version npm run update-idl:ts # TypeScript version
-
NFT Metadata:
npm run generate-nft-metadata # Generate sample NFT metadata npm run upload-nft-metadata # Mock upload to Arweave
See the scripts README for more details.
-
/app
- Next.js application/src
- Source code/app
- Next.js app router pages/actions
- Server actions for API endpoints/chat
- Chat pages and components
/components
- React components/services
- Service layer for data access and business logic/shared
- Shared utilities and components/utils
- Utility functions including Supabase clients
/styles
- Global styles
/public
- Static assets/supabase
- Supabase migrations and configuration
-
/programs
- Solana smart contracts (Anchor framework)/sonicpact
- Main contract/src
- Contract source code/lib.rs
- Main contract implementation
-
/tests
- Contract integration tests -
/scripts
- Utility scriptsupdate-idl.js
- Updates IDL TypeScript filesgenerate-nft-metadata.ts
- Generates NFT metadataupload-nft-metadata.ts
- Mock script for Arweave uploads
SonicPact follows a layered architecture pattern:
- UI Layer: React components and pages that handle user interactions
- Server Actions Layer: Next.js server actions that provide API endpoints
- Service Layer: Business logic and data access services
- Data Layer: Supabase database and Solana blockchain
This separation of concerns makes the codebase more maintainable and testable.
- Connect Solana wallet
- Create profile as either a gaming studio or celebrity
- Upload profile images and verification documents
- Browse verified celebrities
- Filter by category
- Search by name or description
- Create deal proposals with customizable terms
- Set payment amount and royalty percentages
- Define usage rights and exclusivity
- View all deals and their statuses
- Manage messages
- Update profile information
- Chat Requests: Send and manage chat requests to initiate conversations
- Real-time Chat: Instant messaging with real-time updates
- Notifications: Get notified of new messages and chat requests
- Message Status: Track read/unread status of messages
- User Presence: See when users are online or offline
The SonicPact smart contract handles the complete deal lifecycle between gaming studios and celebrities:
- Initialize Platform: Set up the SonicPact platform with configurable fees
- Create Deal: Studios can create deals with specific terms, payment amounts, and rights
- Accept Deal: Celebrities can accept proposed deals
- Fund Deal: Studios can fund accepted deals (funds held in escrow)
- Complete Deal:
- Releases funds to celebrity (minus platform fee)
- Mints commemorative NFT to acknowledge the collaboration
- NFT includes both parties as creators with equal attribution
- Cancel Deal:
- Deals can be cancelled before completion
- Return funds to studio if already funded
- Different authorization rules based on deal status
- Platform Management: Update platform fees (capped at 10%)
- Commemorative NFTs: Automatic minting of a certificate NFT when a deal completes
- On-chain Proof: Permanent record of collaboration between studios and celebrities
- Customized Metadata: NFT containing deal details, collaborators, and terms
- Joint Creators: Both parties recognized as creators in the NFT metadata
- Collectible Asset: Tradable NFT that can be displayed or sold on marketplaces
SonicPact uses Solana wallet-based authentication with cryptographic signature verification:
- Wallet Connection: Users connect their Solana wallet (Phantom, Solflare, etc.)
- Challenge Message: The server generates a unique challenge message
- Signature: The user signs the challenge message with their wallet's private key
- Verification: The server verifies the signature using the wallet's public key
- Session: Upon successful verification, a JWT session is created with Supabase
This approach ensures that users actually own the wallet they're connecting with, providing a secure and seamless authentication experience without requiring passwords.
The main tables in the database include:
users
- User profiles for both studios and celebritiesdeals
- Deal information and termschat_requests
- Requests to initiate conversations between userschats
- Chat conversations between userschat_participants
- Users participating in each chatmessages
- Messages sent in chatsnft_certificates
- Records of NFTs minted upon deal completion
SonicPact leverages Supabase's real-time capabilities to provide:
- Instant message delivery
- Live updates for chat requests
- Real-time notifications
- Message read status updates
This is implemented using Supabase's Postgres Changes feature, which uses PostgreSQL's built-in replication to stream database changes to connected clients.
This project is licensed under the MIT License - see the LICENSE file for details.
- Solana Foundation
- Supabase
- Next.js team