Skip to content

Commit

Permalink
add edition to Scarb.toml of Torii tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remybar committed Jul 17, 2024
1 parent de1a1de commit 3424011
Show file tree
Hide file tree
Showing 10 changed files with 80 additions and 76 deletions.
5 changes: 3 additions & 2 deletions crates/dojo-core/src/world.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -318,11 +318,12 @@ pub mod world {
/// `resource_id` - The resource id.
fn metadata(self: @ContractState, resource_id: felt252) -> ResourceMetadata {
let mut values = self
.entity(
._read_model_entity(
dojo::model::Model::<ResourceMetadata>::selector(),
ModelIndex::Keys(array![resource_id].span()),
entity_id_from_keys(array![resource_id].span()),
dojo::model::Model::<ResourceMetadata>::layout()
);

ResourceMetadataTrait::from_values(resource_id, ref values)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind = "Class"
class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
original_class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
original_class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
abi = "manifests/dev/base/abis/dojo-world.json"
tag = "dojo-world"
manifest_name = "dojo-world"
1 change: 1 addition & 0 deletions crates/torii/types-test/Scarb.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[package]
cairo-version = "=2.6.4"
edition = "2023_11"
name = "types_test"
version = "0.7.3"

Expand Down
7 changes: 4 additions & 3 deletions crates/torii/types-test/src/contracts.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ trait IRecords {
mod records {
use starknet::{ContractAddress, get_caller_address};
use types_test::models::{
Record, RecordTrait, RecordSibling, RecordSiblingTrait, Subrecord, SubrecordTrait, Nested, NestedMore, NestedMost, Depth
Record, RecordTrait, RecordSibling, RecordSiblingTrait, Subrecord, SubrecordTrait, Nested,
NestedMore, NestedMost, Depth
};
use types_test::{seed, random};
use super::IRecords;
Expand Down Expand Up @@ -42,11 +43,11 @@ mod records {
}

let type_felt: felt252 = record_idx.into();
let random_u8 = random(pedersen::pedersen(seed(), record_idx.into()), 0, 100)
let random_u8 = random(core::pedersen::pedersen(seed(), record_idx.into()), 0, 100)
.try_into()
.unwrap();
let random_u128 = random(
pedersen::pedersen(seed(), record_idx.into()),
core::pedersen::pedersen(seed(), record_idx.into()),
0,
0xffffffffffffffffffffffffffffffff_u128
);
Expand Down
97 changes: 49 additions & 48 deletions crates/torii/types-test/src/models.cairo
Original file line number Diff line number Diff line change
@@ -1,79 +1,79 @@
use array::ArrayTrait;
use core::array::ArrayTrait;
use starknet::{ContractAddress, ClassHash};

#[derive(Introspect, Drop, Serde)]
#[dojo::model]
struct Record {
pub struct Record {
#[key]
record_id: u32,
depth: Depth,
type_i8: i8,
type_i16: i16,
type_i32: i32,
type_i64: i64,
type_i128: i128,
type_u8: u8,
type_u16: u16,
type_u32: u32,
type_u64: u64,
type_u128: u128,
type_u256: u256,
type_bool: bool,
type_felt: felt252,
type_class_hash: ClassHash,
type_contract_address: ContractAddress,
type_deeply_nested: Nested,
type_nested_one: NestedMost,
type_nested_two: NestedMost,
random_u8: u8,
random_u128: u128,
composite_u256: u256,
pub record_id: u32,
pub depth: Depth,
pub type_i8: i8,
pub type_i16: i16,
pub type_i32: i32,
pub type_i64: i64,
pub type_i128: i128,
pub type_u8: u8,
pub type_u16: u16,
pub type_u32: u32,
pub type_u64: u64,
pub type_u128: u128,
pub type_u256: u256,
pub type_bool: bool,
pub type_felt: felt252,
pub type_class_hash: ClassHash,
pub type_contract_address: ContractAddress,
pub type_deeply_nested: Nested,
pub type_nested_one: NestedMost,
pub type_nested_two: NestedMost,
pub random_u8: u8,
pub random_u128: u128,
pub composite_u256: u256,
}

#[derive(Introspect, Copy, Drop, Serde)]
#[dojo::model]
struct RecordSibling {
pub struct RecordSibling {
#[key]
record_id: u32,
random_u8: u8
pub record_id: u32,
pub random_u8: u8
}

#[derive(Copy, Drop, Serde, Introspect)]
struct Nested {
depth: Depth,
type_number: u8,
type_string: felt252,
type_nested_more: NestedMore,
pub struct Nested {
pub depth: Depth,
pub type_number: u8,
pub type_string: felt252,
pub type_nested_more: NestedMore,
}

#[derive(Copy, Drop, Serde, Introspect)]
struct NestedMore {
depth: Depth,
type_number: u8,
type_string: felt252,
type_nested_most: NestedMost,
pub struct NestedMore {
pub depth: Depth,
pub type_number: u8,
pub type_string: felt252,
pub type_nested_most: NestedMost,
}

#[derive(Copy, Drop, Serde, Introspect)]
struct NestedMost {
depth: Depth,
type_number: u8,
type_string: felt252,
pub struct NestedMost {
pub depth: Depth,
pub type_number: u8,
pub type_string: felt252,
}

#[derive(Introspect, Copy, Drop, Serde)]
#[dojo::model]
struct Subrecord {
pub struct Subrecord {
#[key]
record_id: u32,
pub record_id: u32,
#[key]
subrecord_id: u32,
type_u8: u8,
random_u8: u8,
pub subrecord_id: u32,
pub type_u8: u8,
pub random_u8: u8,
}

#[derive(Serde, Copy, Drop, Introspect)]
enum Depth {
pub enum Depth {
Zero: (),
One: (),
Two: (),
Expand Down Expand Up @@ -354,3 +354,4 @@ impl DepthIntoFelt252 of Into<Depth, felt252> {
// a255: u256,
// }


2 changes: 1 addition & 1 deletion examples/spawn-and-move/Scarb.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ rpc_url = "http://localhost:5050/"
# Default account for katana with seed = 0
account_address = "0x6162896d1d7ab204c7ccac6dd5f8e9e7c25ecd5ae4fcb4ad32e57786bb46e03"
private_key = "0x1800000000300000180000000000030000000000003006001800006600"
world_address = "0x2bab2a15d4c71bd8e45c84ac3b1518aeca39d3818e8e556c4a56202c1679ba6"
world_address = "0x62c5e1e2ceab297dfaca3ef17ca6549635272f363bd5373c888bbacdc3d8548"

[profile.release.tool.dojo]
# for more info on how `merge-strategy` works see:
Expand Down
4 changes: 2 additions & 2 deletions examples/spawn-and-move/manifests/dev/base/dojo-world.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind = "Class"
class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
original_class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
original_class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
abi = "manifests/dev/base/abis/dojo-world.json"
tag = "dojo-world"
manifest_name = "dojo-world"
16 changes: 8 additions & 8 deletions examples/spawn-and-move/manifests/dev/deployment/manifest.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"world": {
"kind": "WorldContract",
"class_hash": "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb",
"original_class_hash": "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb",
"class_hash": "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd",
"original_class_hash": "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd",
"abi": [
{
"type": "impl",
Expand Down Expand Up @@ -1189,8 +1189,8 @@
]
}
],
"address": "0x2bab2a15d4c71bd8e45c84ac3b1518aeca39d3818e8e556c4a56202c1679ba6",
"transaction_hash": "0x1e4e0d098436df78bfd2f61cfd24273bd2f9de70b1ad372aa5d122f2ad7cc75",
"address": "0x62c5e1e2ceab297dfaca3ef17ca6549635272f363bd5373c888bbacdc3d8548",
"transaction_hash": "0x30d768fa29fd2ba80734946a339118c1adfea82629458b054a4d4a35103db47",
"block_number": 3,
"seed": "dojo_examples",
"metadata": {
Expand All @@ -1210,7 +1210,7 @@
"contracts": [
{
"kind": "DojoContract",
"address": "0x5718df0ef4ac58def63459069d160887ad637f979cf425d0ddb6fd77f3cd121",
"address": "0x604bd94012befb403ad70472bcbae1504211b17c804373ea835aec77eb1ee1",
"class_hash": "0xb3f81618df8f1170864da1c68f565aafe192c30f9b73436af4823b293a7ea5",
"original_class_hash": "0xb3f81618df8f1170864da1c68f565aafe192c30f9b73436af4823b293a7ea5",
"base_class_hash": "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4",
Expand Down Expand Up @@ -1641,7 +1641,7 @@
},
{
"kind": "DojoContract",
"address": "0x3e629315ea75d37711b4146af01efa2f0218e8aefda2ceb42bb0fd310cb2840",
"address": "0x7e7462000391d3084e3eabd1c28f027c06ad683c787cd8173ca33d906e9a082",
"class_hash": "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674",
"original_class_hash": "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674",
"base_class_hash": "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4",
Expand Down Expand Up @@ -1878,7 +1878,7 @@
},
{
"kind": "DojoContract",
"address": "0x22edd1c0f399a12c2f9789b1a36bb02e22c3300aabfeac4bfe6b7dc2a95b70d",
"address": "0xcc6decf700ca5870865e95307c74cb531728f6d50670449fa33518e4a9c3c8",
"class_hash": "0x761d18a3557d98b3962ebb2c9ddae89ad586ce81de7e86c5fd1e1b4f9d0028",
"original_class_hash": "0x761d18a3557d98b3962ebb2c9ddae89ad586ce81de7e86c5fd1e1b4f9d0028",
"base_class_hash": "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4",
Expand Down Expand Up @@ -2097,7 +2097,7 @@
},
{
"kind": "DojoContract",
"address": "0x7d38ad1bf17abfd26749f4780b95c525cc562c8ffba994bbe8e09de36b25404",
"address": "0x6cf6ece03c80fcddd4107270a52eab493534b8ccf8346ff17d451362a4e99d0",
"class_hash": "0x479bfb12dcba5398d77303e7a665fc3fedb16f2d7f9cb1f5d7e2beb3b7e2ba7",
"original_class_hash": "0x479bfb12dcba5398d77303e7a665fc3fedb16f2d7f9cb1f5d7e2beb3b7e2ba7",
"base_class_hash": "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4",
Expand Down
16 changes: 8 additions & 8 deletions examples/spawn-and-move/manifests/dev/deployment/manifest.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[world]
kind = "WorldContract"
class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
original_class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
original_class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
abi = "manifests/dev/deployment/abis/dojo-world.json"
address = "0x2bab2a15d4c71bd8e45c84ac3b1518aeca39d3818e8e556c4a56202c1679ba6"
transaction_hash = "0x1e4e0d098436df78bfd2f61cfd24273bd2f9de70b1ad372aa5d122f2ad7cc75"
address = "0x62c5e1e2ceab297dfaca3ef17ca6549635272f363bd5373c888bbacdc3d8548"
transaction_hash = "0x30d768fa29fd2ba80734946a339118c1adfea82629458b054a4d4a35103db47"
block_number = 3
seed = "dojo_examples"
manifest_name = "dojo-world"
Expand All @@ -23,7 +23,7 @@ manifest_name = "dojo-base"

[[contracts]]
kind = "DojoContract"
address = "0x5718df0ef4ac58def63459069d160887ad637f979cf425d0ddb6fd77f3cd121"
address = "0x604bd94012befb403ad70472bcbae1504211b17c804373ea835aec77eb1ee1"
class_hash = "0xb3f81618df8f1170864da1c68f565aafe192c30f9b73436af4823b293a7ea5"
original_class_hash = "0xb3f81618df8f1170864da1c68f565aafe192c30f9b73436af4823b293a7ea5"
base_class_hash = "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4"
Expand All @@ -40,7 +40,7 @@ manifest_name = "dojo_examples-actions-40b6994c"

[[contracts]]
kind = "DojoContract"
address = "0x3e629315ea75d37711b4146af01efa2f0218e8aefda2ceb42bb0fd310cb2840"
address = "0x7e7462000391d3084e3eabd1c28f027c06ad683c787cd8173ca33d906e9a082"
class_hash = "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674"
original_class_hash = "0x14b3096b82a761f63dd47277c2b5ac18925dea43586418483939a2f1f57f674"
base_class_hash = "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4"
Expand All @@ -54,7 +54,7 @@ manifest_name = "dojo_examples-dungeon-6620e0e6"

[[contracts]]
kind = "DojoContract"
address = "0x22edd1c0f399a12c2f9789b1a36bb02e22c3300aabfeac4bfe6b7dc2a95b70d"
address = "0xcc6decf700ca5870865e95307c74cb531728f6d50670449fa33518e4a9c3c8"
class_hash = "0x761d18a3557d98b3962ebb2c9ddae89ad586ce81de7e86c5fd1e1b4f9d0028"
original_class_hash = "0x761d18a3557d98b3962ebb2c9ddae89ad586ce81de7e86c5fd1e1b4f9d0028"
base_class_hash = "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4"
Expand All @@ -68,7 +68,7 @@ manifest_name = "dojo_examples-mock_token-31599eb2"

[[contracts]]
kind = "DojoContract"
address = "0x7d38ad1bf17abfd26749f4780b95c525cc562c8ffba994bbe8e09de36b25404"
address = "0x6cf6ece03c80fcddd4107270a52eab493534b8ccf8346ff17d451362a4e99d0"
class_hash = "0x479bfb12dcba5398d77303e7a665fc3fedb16f2d7f9cb1f5d7e2beb3b7e2ba7"
original_class_hash = "0x479bfb12dcba5398d77303e7a665fc3fedb16f2d7f9cb1f5d7e2beb3b7e2ba7"
base_class_hash = "0x26a4f5d2d9638877a2648297339275df5eaab0adb3cdf0010887c2dbf2be4"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kind = "Class"
class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
original_class_hash = "0x6990b621c2db6fbffa4cbbe5c0d91103721c7246adc83a4b27715e2dba79eb"
class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
original_class_hash = "0x71819175fb1971b65368cdbc486b7044ea1a15fe499296181c574e90d91adcd"
abi = "manifests/release/base/abis/dojo-world.json"
tag = "dojo-world"
manifest_name = "dojo-world"

0 comments on commit 3424011

Please sign in to comment.