This Solana program showcases the tools and techniques used to create Binary Options on the Solana blockchain.
The program is structured around three key instructions:
- initialize: The instruction for the market maker to initialize the Binary Option.
- do_bet: The instruction to place a bet.
- resolve: The final step, where the program distributes prizes and closes the accounts.
-
Install solana development suit.
-
Install the dependencies:
anchor build
-
Build:
anchor test
- Scheduling instruction execution on the Solana chain proved to be challenging. The main approach involved using the
clockwork-sdk, which is now deprecated and incompatible with the latest versions of Anchor. Considering this, the most efficient solution is to schedule theresolveinstruction execution off-chain. - Pyth Oracle does not exist on Solana Localnet, forcing developer to mocked prices for tests. Other Oracles were not explored due to time constraints.