123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146 |
- // This file is autogenerated with https://github.com/acheroncrypto/native-to-anchor
- use anchor_lang::prelude::*;
- declare_id!("11111111111111111111111111111111");
- #[program]
- pub mod spl_binary_option {
- use super::*;
- pub fn initialize_binary_option(
- ctx: Context<InitializeBinaryOption>,
- decimals: u8,
- ) -> Result<()> {
- Ok(())
- }
- pub fn trade(ctx: Context<Trade>, size: u64, buy_price: u64, sell_price: u64) -> Result<()> {
- Ok(())
- }
- pub fn settle(ctx: Context<Settle>) -> Result<()> {
- Ok(())
- }
- pub fn collect(ctx: Context<Collect>) -> Result<()> {
- Ok(())
- }
- }
- #[derive(Accounts)]
- pub struct InitializeBinaryOption<'info> {
- #[account(mut)]
- pool_account: Signer<'info>,
- escrow_mint: AccountInfo<'info>,
- #[account(mut)]
- escrow_account: Signer<'info>,
- #[account(mut)]
- long_token_mint: Signer<'info>,
- #[account(mut)]
- short_token_mint: Signer<'info>,
- mint_authority: Signer<'info>,
- update_authority: Signer<'info>,
- token_program: Program<'info, Token>,
- system_program: Program<'info, System>,
- rent: Sysvar<'info, Rent>,
- }
- #[derive(Accounts)]
- pub struct Trade<'info> {
- #[account(mut)]
- pool_account: AccountInfo<'info>,
- #[account(mut)]
- escrow_account: AccountInfo<'info>,
- #[account(mut)]
- long_token_mint: AccountInfo<'info>,
- #[account(mut)]
- short_token_mint: AccountInfo<'info>,
- buyer: Signer<'info>,
- seller: Signer<'info>,
- #[account(mut)]
- buyer_account: AccountInfo<'info>,
- #[account(mut)]
- seller_account: AccountInfo<'info>,
- #[account(mut)]
- buyer_long_token_account: AccountInfo<'info>,
- #[account(mut)]
- buyer_short_token_account: AccountInfo<'info>,
- #[account(mut)]
- seller_long_token_account: AccountInfo<'info>,
- #[account(mut)]
- seller_short_token_account: AccountInfo<'info>,
- escrow_authority: AccountInfo<'info>,
- token_program: Program<'info, Token>,
- }
- #[derive(Accounts)]
- pub struct Settle<'info> {
- #[account(mut)]
- pool_account: AccountInfo<'info>,
- winning_mint: AccountInfo<'info>,
- pool_authority: Signer<'info>,
- }
- #[derive(Accounts)]
- pub struct Collect<'info> {
- #[account(mut)]
- pool_account: AccountInfo<'info>,
- collector_account: AccountInfo<'info>,
- #[account(mut)]
- collector_long_token_account: AccountInfo<'info>,
- #[account(mut)]
- collector_short_token_account: AccountInfo<'info>,
- #[account(mut)]
- collector_collateral_account: AccountInfo<'info>,
- #[account(mut)]
- long_token_mint_account: AccountInfo<'info>,
- #[account(mut)]
- short_token_mint_account: AccountInfo<'info>,
- #[account(mut)]
- escrow_account: AccountInfo<'info>,
- #[account(mut)]
- escrow_authority_account: AccountInfo<'info>,
- token_program: Program<'info, Token>,
- }
- #[account]
- pub struct BinaryOption {
- pub decimals: u8,
- pub circulation: u64,
- pub settled: bool,
- pub escrow_mint_account_pubkey: Pubkey,
- pub escrow_account_pubkey: Pubkey,
- pub long_mint_account_pubkey: Pubkey,
- pub short_mint_account_pubkey: Pubkey,
- pub owner: Pubkey,
- pub winning_side_pubkey: Pubkey,
- }
- #[error_code]
- pub enum BinaryOptionError {
- #[msg("PublicKeyMismatch")]
- PublicKeyMismatch,
- #[msg("InvalidMintAuthority")]
- InvalidMintAuthority,
- #[msg("NotMintAuthority")]
- NotMintAuthority,
- #[msg("InvalidSupply")]
- InvalidSupply,
- #[msg("InvalidWinner")]
- InvalidWinner,
- #[msg("UninitializedAccount")]
- UninitializedAccount,
- #[msg("IncorrectOwner")]
- IncorrectOwner,
- #[msg("AlreadySettled")]
- AlreadySettled,
- #[msg("BetNotSettled")]
- BetNotSettled,
- #[msg("TokenNotFoundInPool")]
- TokenNotFoundInPool,
- #[msg("PublicKeysShouldBeUnique")]
- PublicKeysShouldBeUnique,
- #[msg("TradePricesIncorrect")]
- TradePricesIncorrect,
- }
|