56 lines
1.3 KiB
Rust
56 lines
1.3 KiB
Rust
pub mod constants;
|
|
pub mod error;
|
|
pub mod instructions;
|
|
pub mod state;
|
|
|
|
use anchor_lang::prelude::*;
|
|
|
|
pub use constants::*;
|
|
pub use instructions::*;
|
|
pub use state::*;
|
|
|
|
declare_id!("Haj94DF925qNRgcoRwQfNsVLKgSmFhG4bjgtvusMkkpD");
|
|
|
|
#[program]
|
|
pub mod bets {
|
|
use super::*;
|
|
|
|
pub fn initialize(ctx: Context<InitializeBetsList>) -> Result<()> {
|
|
initialize_bets_list::init(ctx)
|
|
}
|
|
|
|
pub fn create_bet(
|
|
ctx: Context<CreateBet>,
|
|
wager: u64,
|
|
user_id: String,
|
|
game_id: String,
|
|
nonce: u64,
|
|
is_native_sol: bool,
|
|
token_mint: Option<Pubkey>,
|
|
token_decimals: u8,
|
|
) -> Result<()> {
|
|
create_bet::create(
|
|
ctx,
|
|
wager,
|
|
user_id,
|
|
game_id,
|
|
nonce,
|
|
is_native_sol,
|
|
token_mint,
|
|
token_decimals
|
|
)
|
|
}
|
|
|
|
pub fn join_bet(ctx: Context<JoinBet>, user_id: String, game_id: String) -> Result<()> {
|
|
join_bet::join(ctx, user_id, game_id)
|
|
}
|
|
|
|
pub fn close_bet(ctx: Context<CloseBet>, winner: Pubkey, userid: String) -> Result<()> {
|
|
close_bet::close(ctx, winner, userid)
|
|
}
|
|
|
|
pub fn refund_bet(ctx: Context<RefundBet>, owner: Pubkey) -> Result<()> {
|
|
refund_bet::refund(ctx, owner)
|
|
}
|
|
}
|