Reflex is a Solana protocol developed with Pinocchio, designed to create incentive vaults for existing Kalshi prediction markets using dFlow infrastructure. It empowers market participants to earn additional rewards by staking outcome tokens (YES/NO) from Kalshi markets, while ensuring robust security and performance through Pinocchio's optimized Solana program architecture.
Reflex bridges prediction market liquidity with incentive mechanisms, providing:
- Incentivized vaults for Kalshi prediction market outcomes
- Rewards for stakers who deposit YES or NO outcome tokens into vaults
- Proportional incentive distribution to stakers upon market settlement
- Support for bribers to incentivize specific market outcomes
- Briber: Initiates market vaults and deposits incentive tokens to reward stakers.
- Farmer: Stakes outcome tokens (YES/NO) to earn a share of the incentive pool.
- Authority: Administrative role managing protocol configuration and market settlement.
- Market Vault: Secure container for a specific Kalshi market's outcome tokens and incentives.
- Farmer Position: Tracks individual staker positions and rewards in a market vault.
- Config: Global protocol configuration managing fees and settings.
The protocol is built with Pinocchio for optimized Solana program development, ensuring minimal runtime overhead, high security, and maintainability.
src/
├── instructions/
│ ├── authority/ # Administrative operations (initialize, settle, update config)
│ ├── briber/ # Market vault creation, cancellation, incentive management
│ └── farmer/ # Staking and unstaking outcome tokens
├── states/ # On-chain account structures
│ ├── config.rs
│ ├── market_vault.rs
│ └── farmer_position.rs
└── lib.rs # Program entrypoint
Initialize: Set up protocol configuration and parameters.SettleMarket: Finalize market resolution and enable reward claims.UpdateConfig: Modify protocol parameters and settings.WithdrawTreasury: Withdraw protocol fees.
CreateMarketVault: Create a new incentive vault for a Kalshi market.AddIncentives: Add additional incentive tokens to an existing vault.CancelMarket: Cancel a market vault before settlement.
StakeOutcomeToken: Deposit YES or NO outcome tokens into a vault.UnstakeOutcomeToken: Withdraw outcome tokens and claim rewards.
Stores global protocol settings:
- Authority address
- Market counter
- Protocol fee (basis points)
- Briber fee (basis points)
Tracks a specific market's vault state:
- Briber address
- Outcome mint addresses (YES/NO)
- Incentive mint address
- Total staked amounts (YES/NO)
- Total incentives
- Fee accumulation
- Market status and resolution
Tracks an individual farmer's position:
- Farmer address
- YES tokens staked
- NO tokens staked
The protocol implements a two-tier fee system:
-
Staking Fees: Applied when farmers stake outcome tokens.
- Calculated as
amount × fee_bps / 10000. - Reduces staked amount but does not affect farmer's share of incentives.
- Calculated as
-
Briber Fees: Applied to bribers for vault creation and management.
- Rust 1.70 or higher
- Solana CLI tools
cargo build-sbfcargo test-sbfThis project is developed with Pinocchio, ensuring lightweight, secure, and efficient Solana program development. Testing is performed using Mollusk.
Built with:
- Pinocchio: Lightweight Solana program
- Solana SDK: Core blockchain functionality
- SPL Token: Token program integration
- Mollusk: Testing and benchmarking
coming soon
- All arithmetic operations use checked math to prevent overflows.
- PDA derivations are validated on every instruction.
- Account ownership and signer checks are strictly enforced.
- Custom error types provide precise error handling.
See LICENSE file for details.
Contributions are welcome! Please open an issue or pull request.