Skip to content

Commit 32f38c3

Browse files
committed
Deleting test file from PR
1 parent 71cec25 commit 32f38c3

File tree

3 files changed

+40
-13
lines changed

3 files changed

+40
-13
lines changed

src/lib.cairo

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ mod systems {
55
mod spawn;
66
mod world_setup;
77
mod bag;
8+
mod tournament;
89
}
910

1011
mod models {
@@ -26,9 +27,11 @@ mod models {
2627
mod achievement_rarity;
2728
mod achievement_type;
2829
mod achievements;
30+
mod tournament;
2931
}
3032

3133
mod tests {
3234
mod test_battle;
3335
mod test_bag;
36+
mod test_tournament;
3437
}

src/models/tournament.cairo

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub enum TournamentStatus {
88
}
99

1010

11-
#[derive(Copy, Drop, Serde)]
11+
#[derive(Drop, Serde)]
1212
#[dojo::model]
1313
pub struct Tournament {
1414
#[key]

src/systems/tournament.cairo

+36-12
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,59 @@
11
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait};
2-
use bytebeasts::{
3-
models::{player::Player, tournament::Tournament, tournament::TournamentStatus},
4-
};
2+
use bytebeasts::{models::{player::Player, tournament::Tournament, tournament::TournamentStatus},};
53

64
#[dojo::interface]
75
trait ITournamentAction {
8-
fn create_tournament(ref world: IWorldDispatcher, tournament_id: u32, name: felt252,
6+
fn create_tournament(
7+
ref world: IWorldDispatcher,
8+
tournament_id: u32,
9+
name: felt252,
910
status: TournamentStatus,
1011
entry_fee: u32,
1112
max_participants: u32,
1213
current_participants: Array<Player>,
13-
prize_pool: u32) -> Tournament;
14-
fn register_player(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
15-
fn start_tournament(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
16-
fn complete_torunament(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
17-
fn get_tournament(ref world: IWorldDispatcher, tournament_id: u32) -> Tournament;
14+
prize_pool: u32
15+
);
16+
// fn register_player(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
17+
// fn start_tournament(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
18+
// fn complete_torunament(ref world: IWorldDispatcher, tournament_id: u32, player_id: u32);
19+
fn get_tournament(world: @IWorldDispatcher, tournament_id: u32) -> Tournament;
1820
}
1921

2022

2123
#[dojo::contract]
22-
mod spawn_action {
24+
mod tournament_system {
2325
use super::ITournamentAction;
2426
use bytebeasts::{
25-
models::{player::Player, tournament::Tournament},
27+
models::{player::Player, tournament::Tournament, tournament::TournamentStatus},
2628
};
2729

2830
#[abi(embed_v0)]
2931
impl TournamentActionImpl of ITournamentAction<ContractState> {
32+
fn create_tournament(
33+
ref world: IWorldDispatcher,
34+
tournament_id: u32,
35+
name: felt252,
36+
status: TournamentStatus,
37+
entry_fee: u32,
38+
max_participants: u32,
39+
current_participants: Array<Player>,
40+
prize_pool: u32
41+
) {
42+
let tournament = Tournament {
43+
tournament_id: tournament_id,
44+
name: name,
45+
status: status,
46+
entry_fee: entry_fee,
47+
max_participants: max_participants,
48+
current_participants: current_participants,
49+
prize_pool: prize_pool
50+
};
51+
set!(world, (tournament))
52+
}
53+
3054
fn get_tournament(world: @IWorldDispatcher, tournament_id: u32) -> Tournament {
3155
let tournament_from_world = get!(world, tournament_id, (Tournament));
3256
tournament_from_world
3357
}
3458
}
35-
}
59+
}

0 commit comments

Comments
 (0)