Skip to content

Commit

Permalink
update: dojo version to alpha-12
Browse files Browse the repository at this point in the history
  • Loading branch information
posaune0423 committed Sep 26, 2024
1 parent 802cbbc commit 26012e5
Show file tree
Hide file tree
Showing 12 changed files with 40 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
- uses: asdf-vm/actions/setup@v3
- run: |
asdf plugin add dojo https://github.com/dojoengine/asdf-dojo
asdf install dojo 1.0.0-alpha.11
asdf global dojo 1.0.0-alpha.11
asdf install dojo 1.0.0-alpha.12
asdf global dojo 1.0.0-alpha.12
sozo test
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
dojo 1.0.0-alpha.11
dojo 1.0.0-alpha.12
scarb 2.7.0
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"cairo1.enableLanguageServer": true,
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.11/bin/dojo-language-server",
"cairo1.languageServerPath": "${userHome}/.asdf/installs/dojo/1.0.0-alpha.12/bin/dojo-language-server",
"cairo1.enableScarb": true,
"cairo1.scarbPath": "${userHome}/.asdf/installs/scarb/2.7.0/bin/scarb",
"cairo1.preferScarbLanguageServer": false
Expand Down
4 changes: 2 additions & 2 deletions Scarb.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = 1
[[package]]
name = "dojo"
version = "1.0.0-alpha.4"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.11#fbff45b249e2b931f5007edf2d526beef7dc553f"
source = "git+https://github.com/dojoengine/dojo?tag=v1.0.0-alpha.12#b391948911356cbf8a91daa93314809c87411098"
dependencies = [
"dojo_plugin",
]
Expand All @@ -25,7 +25,7 @@ dependencies = [
[[package]]
name = "pixelaw"
version = "0.3.50"
source = "git+https://github.com/pixelaw/core?tag=v0.3.50#78abcff1835740411f785b65e84941c3f7ee59b6"
source = "git+https://github.com/pixelaw/core?branch=feat%2Fup-v12#8b6e7bba1ec04c7ef9e6a33ff131256d60e6b493"
dependencies = [
"dojo",
]
9 changes: 4 additions & 5 deletions Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@ version = "0.0.0"
sierra-replace-ids = true

[dependencies]
pixelaw = { git = "https://github.com/pixelaw/core", tag = "v0.3.50" }
# pixelaw = { git = "https://github.com/pixelaw/core", branch = "main" }
pixelaw = { git = "https://github.com/pixelaw/core", branch = "feat/up-v12" }
# Added explicitly for https://github.com/dojoengine/dojo/issues/2430
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.11" }
dojo = { git = "https://github.com/dojoengine/dojo", tag = "v1.0.0-alpha.12" }

[[target.dojo]]
build-external-contracts = [
"pixelaw::apps::snake::app::snake",
"pixelaw::apps::snake::app::snake_segment",
"pixelaw::core::models::pixel::pixel",
"pixelaw::core::models::pixel::Pixel",
"pixelaw::core::models::pixel::PixelUpdate",
Expand All @@ -40,4 +39,4 @@ sort-module-level-items = true


[scripts]
init_auth = "./scripts/init_auth.sh"
init = "./scripts/init.sh"
2 changes: 0 additions & 2 deletions dojo_release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,3 @@ mappings = {}

[env]
rpc_url = "https://api.cartridge.gg/x/pixelaw-dev/katana/"
account_address = "0x5233cfca86bfa18af0bdef2fd09ac4c1d7c8da71303eb7fc9997fc6d0914d0d"
private_key = "0xf0e37335d0c020789dd02c0460d99637ac23bd2df3d1d25002fd15621542d"
10 changes: 10 additions & 0 deletions overlays/dev/core_actions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
tag = "pixelaw-actions"
writes = [
"pixelaw-App",
"pixelaw-AppName",
"pixelaw-CoreActionsAddress",
"pixelaw-Pixel",
"pixelaw-Permissions",
"pixelaw-QueueItem",
"pixelaw-Instruction",
]
7 changes: 7 additions & 0 deletions scripts/init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
pushd $(dirname "$0")/..

sozo execute --profile $SCARB_PROFILE pixelaw-actions init --wait
sozo execute --profile $SCARB_PROFILE pixelaw-snake_actions init --wait
sozo execute --profile $SCARB_PROFILE pixelaw-paint_actions init --wait
52 changes: 0 additions & 52 deletions scripts/init_auth.sh

This file was deleted.

22 changes: 6 additions & 16 deletions src/app.cairo
Original file line number Diff line number Diff line change
@@ -1,23 +1,13 @@
use dojo::world::{IWorldDispatcher, IWorldDispatcherTrait};
use pixelaw::core::models::pixel::{Pixel, PixelUpdate};
use pixelaw::core::utils::{get_core_actions, Direction, Position, DefaultParameters};
use starknet::{get_caller_address, get_contract_address, get_execution_info, ContractAddress};
use pixelaw::core::utils::{DefaultParameters};


#[dojo::interface]
pub trait IMyAppActions<TContractState> {
fn init(ref world: IWorldDispatcher);
fn interact(ref world: IWorldDispatcher, default_params: DefaultParameters);
}

/// APP_KEY must be unique across the entire platform
const APP_KEY: felt252 = 'myapp';

/// Core only supports unicode icons for now
const APP_ICON: felt252 = 'U+263A';

/// prefixing with BASE means using the server's default manifest.json handler
const APP_MANIFEST: felt252 = 'BASE/manifests/myapp';

/// contracts must be named as such (APP_KEY + underscore + "actions")
#[dojo::contract(namespace: "pixelaw", nomapping: true)]
pub mod myapp_actions {
Expand All @@ -31,20 +21,20 @@ pub mod myapp_actions {
use pixelaw::core::models::pixel::{Pixel, PixelUpdate};
use pixelaw::core::utils::{get_core_actions, Direction, Position, DefaultParameters};
use starknet::{
get_tx_info, get_caller_address, get_contract_address, get_execution_info, ContractAddress
get_tx_info, get_caller_address, get_contract_address, get_execution_info,
contract_address_const, ContractAddress
};
use myapp::constants::{APP_KEY, APP_ICON};

use super::IMyAppActions;
use super::{APP_KEY, APP_ICON, APP_MANIFEST};

// impl: implement functions specified in trait
#[abi(embed_v0)]
impl ActionsImpl of IMyAppActions<ContractState> {
/// Initialize the MyApp App (TODO I think, do we need this??)
fn init(ref world: IWorldDispatcher) {
let core_actions = pixelaw::core::utils::get_core_actions(world);

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

/// Put color on a certain position
Expand Down
5 changes: 5 additions & 0 deletions src/constants.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// APP_KEY must be unique across the entire platform
pub const APP_KEY: felt252 = 'myapp';

/// Core only supports unicode icons for now
pub const APP_ICON: felt252 = 'U+263A';
3 changes: 2 additions & 1 deletion src/lib.cairo
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pub mod constants;
pub mod app;
mod tests;
mod tests;

0 comments on commit 26012e5

Please sign in to comment.