34 lines
798 B
Rust
34 lines
798 B
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!("HxsDuhD7wcPxcMsrYdteMYxkffuwff8HoxhZ7NuFtM37");
|
|
|
|
#[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, game_id:String)-> Result<()>{
|
|
let clock = Clock::get().unwrap();
|
|
let seed = clock.unix_timestamp as u64;
|
|
let nonce = seed % 100000;
|
|
|
|
create_bet::create(ctx, wager,game_id,nonce)
|
|
}
|
|
|
|
pub fn join_bet(ctx: Context<JoinBet>, game_id:String) -> Result<()>{
|
|
join_bet::join(ctx, game_id)
|
|
}
|
|
}
|