Skip to content

Commit

Permalink
fix: format
Browse files Browse the repository at this point in the history
  • Loading branch information
posaune0423 committed Sep 16, 2024
1 parent 834843a commit db35d20
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 27 deletions.
25 changes: 12 additions & 13 deletions contracts/src/apps/paint/app.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,19 @@ mod paint_actions {
let core_actions = pixelaw::core::utils::get_core_actions(world);

core_actions.new_app(contract_address_const::<0>(), APP_KEY, APP_ICON);

// // TODO: Replace this with proper granting of permission
// core_actions
// .update_permission(
// 'snake',
// Permission {
// app: true,
// color: true,
// owner: false,
// text: true,
// timestamp: false,
// action: false,
// },
// );
// core_actions
// .update_permission(
// 'snake',
// Permission {
// app: true,
// color: true,
// owner: false,
// text: true,
// timestamp: false,
// action: false,
// },
// );
}

/// Interacts with a pixel based on default parameters.
Expand Down
10 changes: 2 additions & 8 deletions contracts/src/core/actions.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ pub trait IActions<TContractState> {
///
/// * `App` - Struct containing the contract address and name fields.
fn new_app(
ref world: IWorldDispatcher,
system: ContractAddress,
name: felt252,
icon: felt252,
ref world: IWorldDispatcher, system: ContractAddress, name: felt252, icon: felt252,
) -> App;

/// Retrieves the system address.
Expand Down Expand Up @@ -571,10 +568,7 @@ pub mod actions {
///
/// * `App` - Struct containing the contract address and name fields.
fn new_app(
ref world: IWorldDispatcher,
system: ContractAddress,
name: felt252,
icon: felt252,
ref world: IWorldDispatcher, system: ContractAddress, name: felt252, icon: felt252,
) -> App {
let mut app_system = system;
// If the system is not given, use the caller for this.
Expand Down
14 changes: 10 additions & 4 deletions contracts/src/core/tests/helpers.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ use dojo::{

use pixelaw::core::{
models::{
registry::{App, app, app_name, core_actions_address, CoreActionsAddress, Instruction, instruction},
registry::{
App, app, app_name, core_actions_address, CoreActionsAddress, Instruction, instruction
},
pixel::{Pixel, PixelUpdate, pixel}, permissions::{permissions, Permission, Permissions}
},
actions::{actions, IActionsDispatcher, IActionsDispatcherTrait, CORE_ACTIONS_KEY},
Expand Down Expand Up @@ -53,8 +55,10 @@ pub fn ZERO_ADDRESS() -> ContractAddress {
contract_address_const::<0x0>()
}

pub fn setup_core_initialized() -> (IWorldDispatcher, IActionsDispatcher, ContractAddress, ContractAddress) {
let (world, core_actions, player_1, player_2) = setup_core();
pub fn setup_core_initialized() -> (
IWorldDispatcher, IActionsDispatcher, ContractAddress, ContractAddress
) {
let (world, core_actions, player_1, player_2) = setup_core();

core_actions.init();

Expand Down Expand Up @@ -92,7 +96,9 @@ pub fn setup_core() -> (IWorldDispatcher, IActionsDispatcher, ContractAddress, C
}


pub fn setup_apps_initialized(world: IWorldDispatcher) -> (IPaintActionsDispatcher, ISnakeActionsDispatcher) {
pub fn setup_apps_initialized(
world: IWorldDispatcher
) -> (IPaintActionsDispatcher, ISnakeActionsDispatcher) {
let (paint_actions, snake_actions) = setup_apps(world);

paint_actions.init();
Expand Down
1 change: 1 addition & 0 deletions contracts/src/core/tests/interop.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

6 changes: 4 additions & 2 deletions contracts/src/core/tests/queue.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ use pixelaw::core::{
permissions::{permissions}
},
actions::{actions, IActionsDispatcher, IActionsDispatcherTrait},
utils::{get_core_actions, Direction, Position, DefaultParameters}, tests::helpers::setup_core_initialized
utils::{get_core_actions, Direction, Position, DefaultParameters},
tests::helpers::setup_core_initialized
};


Expand All @@ -26,7 +27,8 @@ const SPAWN_PIXEL_ENTRYPOINT: felt252 =
#[test]
#[available_gas(30000000)]
fn test_process_queue() {
let (world, core_actions, _player_1, _player_2) = pixelaw::core::tests::helpers::setup_core_initialized();
let (world, core_actions, _player_1, _player_2) =
pixelaw::core::tests::helpers::setup_core_initialized();
let position = Position { x: 0, y: 0 };

let mut calldata: Array<felt252> = ArrayTrait::new();
Expand Down

0 comments on commit db35d20

Please sign in to comment.