diff --git a/Cargo.lock b/Cargo.lock index 182fbf4488..875355c15b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4269,6 +4269,7 @@ dependencies = [ "regex", "salsa", "scarb", + "scarb-ui", "semver 1.0.23", "serde", "serde_json", diff --git a/bin/sozo/src/commands/build.rs b/bin/sozo/src/commands/build.rs index b5b8537cc7..e7b1fe0b37 100644 --- a/bin/sozo/src/commands/build.rs +++ b/bin/sozo/src/commands/build.rs @@ -3,12 +3,11 @@ use clap::{Args, Parser}; use dojo_bindgen::{BuiltinPlugins, PluginManager}; use dojo_lang::scarb_internal::compile_workspace; use dojo_world::manifest::MANIFESTS_DIR; -use dojo_world::metadata::dojo_metadata_from_workspace; use prettytable::format::consts::FORMAT_NO_LINESEP_WITH_TITLE; use prettytable::{format, Cell, Row, Table}; -use scarb::core::{Config, TargetKind}; +use scarb::core::{Config, Package, TargetKind}; use scarb::ops::CompileOpts; -use scarb_ui::args::FeaturesSpec; +use scarb_ui::args::{FeaturesSpec, PackagesFilter}; use sozo_ops::statistics::{get_contract_statistics_for_dir, ContractStatistics}; use tracing::trace; @@ -43,39 +42,32 @@ pub struct BuildArgs { /// Specify the features to activate. #[command(flatten)] pub features: FeaturesSpec, + + /// Specify packages to build. + #[command(flatten)] + pub packages: Option, } impl BuildArgs { pub fn run(self, config: &Config) -> Result<()> { let ws = scarb::ops::read_workspace(config.manifest_path(), config)?; - if let Ok(current_package) = ws.current_package() { - if current_package.target(&TargetKind::new("dojo")).is_none() { - return Err(anyhow::anyhow!( - "No Dojo target found in the {} package. Add [[target.dojo]] to the {} \ - manifest to enable Dojo features and compile with sozo.", - current_package.id.to_string(), - current_package.manifest_path() - )); - } - } - - // Namespaces are required to compute contracts/models data. Hence, we can't continue - // if no metadata are found. - // Once sozo will support package option, users will be able to do `-p` to select - // the package directly from the workspace instead of using `--manifest-path`. - let dojo_metadata = dojo_metadata_from_workspace(&ws)?; + let packages: Vec = if let Some(filter) = self.packages { + filter.match_many(&ws)?.into_iter().collect() + } else { + ws.members().collect() + }; let profile_name = ws.current_profile().expect("Scarb profile is expected at this point.").to_string(); - // Manifest path is always a file, we can unwrap safely to get the - // parent folder. + // Manifest path is always a file, we can unwrap safely to get the parent folder. let manifest_dir = ws.manifest_path().parent().unwrap().to_path_buf(); let profile_dir = manifest_dir.join(MANIFESTS_DIR).join(profile_name); CleanArgs::clean_manifests(&profile_dir)?; - let packages: Vec = ws.members().map(|p| p.id).collect(); + + trace!(?packages); let compile_info = compile_workspace( config, @@ -85,7 +77,7 @@ impl BuildArgs { exclude_target_kinds: vec![TargetKind::TEST], features: self.features.try_into()?, }, - packages, + packages.iter().map(|p| p.id).collect(), )?; trace!(?compile_info, "Compiled workspace."); @@ -146,9 +138,11 @@ impl BuildArgs { }; trace!(pluginManager=?bindgen, "Generating bindings."); + // TODO: check about the skip migration as now we process the metadata + // directly during the compilation to get the data we need from it. tokio::runtime::Runtime::new() .unwrap() - .block_on(bindgen.generate(dojo_metadata.skip_migration)) + .block_on(bindgen.generate(None)) .expect("Error generating bindings"); Ok(()) @@ -167,6 +161,7 @@ impl Default for BuildArgs { unity: false, bindings_output: "bindings".to_string(), stats: false, + packages: None, } } } diff --git a/bin/sozo/src/commands/test.rs b/bin/sozo/src/commands/test.rs index 637a8daa9e..faf722d5e7 100644 --- a/bin/sozo/src/commands/test.rs +++ b/bin/sozo/src/commands/test.rs @@ -14,9 +14,9 @@ use dojo_lang::plugin::dojo_plugin_suite; use dojo_lang::scarb_internal::crates_config_for_compilation_unit; use scarb::compiler::helpers::collect_main_crate_ids; use scarb::compiler::{CairoCompilationUnit, CompilationUnit, CompilationUnitAttributes}; -use scarb::core::{Config, TargetKind}; +use scarb::core::{Config, Package, PackageId, TargetKind}; use scarb::ops::{self, CompileOpts}; -use scarb_ui::args::FeaturesSpec; +use scarb_ui::args::{FeaturesSpec, PackagesFilter}; use tracing::trace; pub(crate) const LOG_TARGET: &str = "sozo::cli::commands::test"; @@ -62,6 +62,9 @@ pub struct TestArgs { /// Specify the features to activate. #[command(flatten)] features: FeaturesSpec, + /// Specify packages to test. + #[command(flatten)] + pub packages: Option, } impl TestArgs { @@ -71,6 +74,14 @@ impl TestArgs { std::process::exit(1); }); + let packages: Vec = if let Some(filter) = self.packages { + filter.match_many(&ws)?.into_iter().collect() + } else { + ws.members().collect() + }; + + let package_ids = packages.iter().map(|p| p.id).collect::>(); + let resolve = ops::resolve_workspace(&ws)?; let opts = CompileOpts { @@ -87,6 +98,7 @@ impl TestArgs { opts.include_target_kinds.is_empty() || opts.include_target_kinds.contains(&cu.main_component().target_kind()) }) + .filter(|cu| package_ids.contains(&cu.main_package_id())) .collect::>(); for unit in compilation_units { @@ -96,6 +108,11 @@ impl TestArgs { continue; }; + config.ui().print(format!("testing {}", unit.name())); + + // Injecting the cfg_set for the unit makes compiler panics. + // We rely then on the default namespace for testing...? + let props: Props = unit.main_component().target_props()?; let db = build_root_database(&unit)?; @@ -155,10 +172,10 @@ fn build_project_config(unit: &CairoCompilationUnit) -> Result { let crate_roots = unit .components .iter() - .filter(|model| !model.package.id.is_core()) + .filter(|c| !c.package.id.is_core()) // NOTE: We're taking the first target of each compilation unit, which should always be the // main package source root due to the order maintained by scarb. - .map(|model| (model.cairo_package_name(), model.targets[0].source_root().into())) + .map(|c| (c.cairo_package_name(), c.targets[0].source_root().into())) .collect(); let corelib = diff --git a/crates/dojo-core/Scarb.lock b/crates/dojo-core/Scarb.lock index ecaaf70855..8300b4910d 100644 --- a/crates/dojo-core/Scarb.lock +++ b/crates/dojo-core/Scarb.lock @@ -11,4 +11,4 @@ dependencies = [ [[package]] name = "dojo_plugin" version = "0.7.3" -source = "git+https://github.com/dojoengine/dojo?rev=d90b52b#d90b52b89749ac8af82f352dc08aa0b1378cfae6" +source = "git+https://github.com/dojoengine/dojo?rev=71b1f1a4#71b1f1a467534cbeeb901356f41e612ed4187bd1" diff --git a/crates/dojo-core/Scarb.toml b/crates/dojo-core/Scarb.toml index 8f45ab937f..562a957280 100644 --- a/crates/dojo-core/Scarb.toml +++ b/crates/dojo-core/Scarb.toml @@ -8,9 +8,11 @@ version = "0.7.3" [dependencies] # Rev points to support for Cairo 2.7.0-rc.3 without any tag yet. Should be # updated once a release is cut with `2.7.0-rc.3` support in it. -dojo_plugin = { git = "https://github.com/dojoengine/dojo", rev = "d90b52b" } +dojo_plugin = { git = "https://github.com/dojoengine/dojo", rev = "71b1f1a4" } starknet = "=2.7.0-rc.3" +[lib] + # Dojo core is tested with sozo, hence we need a namespace for the test # command to work. [tool.dojo.world] diff --git a/crates/dojo-lang/Cargo.toml b/crates/dojo-lang/Cargo.toml index 08a3510c21..114dfca48a 100644 --- a/crates/dojo-lang/Cargo.toml +++ b/crates/dojo-lang/Cargo.toml @@ -42,6 +42,7 @@ once_cell.workspace = true regex.workspace = true salsa.workspace = true scarb.workspace = true +scarb-ui.workspace = true semver.workspace = true serde.workspace = true serde_json.workspace = true diff --git a/crates/dojo-lang/src/compiler.rs b/crates/dojo-lang/src/compiler.rs index aa443cb3b0..e5c0378290 100644 --- a/crates/dojo-lang/src/compiler.rs +++ b/crates/dojo-lang/src/compiler.rs @@ -98,8 +98,15 @@ impl Compiler for DojoCompiler { let props: Props = unit.main_component().target_props()?; let target_dir = unit.target_dir(ws); + // TODO: if we want to output the manifests at the package level, + // we must iterate on the ws members, to find the location of the + // sole package with the `dojo` target. + // In this case, we can use this path to output the manifests. + let compiler_config = build_compiler_config(&unit, ws); + trace!(target: LOG_TARGET, unit = %unit.name(), ?props, "Compiling unit dojo compiler."); + let mut main_crate_ids = collect_main_crate_ids(&unit, db); let core_crate_ids: Vec = collect_core_crate_ids(db); main_crate_ids.extend(core_crate_ids); @@ -347,10 +354,21 @@ fn update_files( fs::create_dir_all(contracts_dir.path_unchecked())?; } + // Ensure `contracts` dir exist event if no contracts are compiled + // to avoid errors when loading manifests. + let base_contracts_dir = base_manifests_dir.join(CONTRACTS_DIR); + let base_contracts_abis_dir = base_abis_dir.join(CONTRACTS_DIR); + if !base_contracts_dir.exists() { + std::fs::create_dir_all(&base_contracts_dir)?; + } + if !base_contracts_abis_dir.exists() { + std::fs::create_dir_all(&base_contracts_abis_dir)?; + } + for (_, (manifest, class, module_id)) in contracts.iter_mut() { write_manifest_and_abi( - &base_manifests_dir.join(CONTRACTS_DIR), - &base_abis_dir.join(CONTRACTS_DIR), + &base_contracts_dir, + &base_contracts_abis_dir, &manifest_dir, manifest, &class.abi, @@ -373,10 +391,21 @@ fn update_files( fs::create_dir_all(models_dir.path_unchecked())?; } + // Ensure `models` dir exist event if no models are compiled + // to avoid errors when loading manifests. + let base_models_dir = base_manifests_dir.join(MODELS_DIR); + let base_models_abis_dir = base_abis_dir.join(MODELS_DIR); + if !base_models_dir.exists() { + std::fs::create_dir_all(&base_models_dir)?; + } + if !base_models_abis_dir.exists() { + std::fs::create_dir_all(&base_models_abis_dir)?; + } + for (_, (manifest, class, module_id)) in models.iter_mut() { write_manifest_and_abi( - &base_manifests_dir.join(MODELS_DIR), - &base_abis_dir.join(MODELS_DIR), + &base_models_dir, + &base_models_abis_dir, &manifest_dir, manifest, &class.abi, diff --git a/crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.lock b/crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.lock index 5e10eee472..d4194cb946 100644 --- a/crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.lock +++ b/crates/dojo-lang/src/manifest_test_data/compiler_cairo/Scarb.lock @@ -18,4 +18,4 @@ dependencies = [ [[package]] name = "dojo_plugin" version = "0.7.3" -source = "git+https://github.com/dojoengine/dojo?rev=d90b52b#d90b52b89749ac8af82f352dc08aa0b1378cfae6" +source = "git+https://github.com/dojoengine/dojo?rev=71b1f1a4#71b1f1a467534cbeeb901356f41e612ed4187bd1" diff --git a/crates/dojo-lang/src/plugin.rs b/crates/dojo-lang/src/plugin.rs index b607c25e7f..7503a43a49 100644 --- a/crates/dojo-lang/src/plugin.rs +++ b/crates/dojo-lang/src/plugin.rs @@ -7,6 +7,7 @@ use cairo_lang_defs::plugin::{ PluginDiagnostic, PluginGeneratedFile, PluginResult, }; use cairo_lang_diagnostics::Severity; +use cairo_lang_filesystem::cfg::Cfg; use cairo_lang_semantic::plugin::PluginSuite; use cairo_lang_starknet::plugin::aux_data::StarkNetEventAuxData; use cairo_lang_syntax::attribute::structured::{AttributeArgVariant, AttributeStructurize}; @@ -37,7 +38,7 @@ use crate::interface::DojoInterface; use crate::introspect::{handle_introspect_enum, handle_introspect_struct}; use crate::model::handle_model_struct; use crate::print::{handle_print_enum, handle_print_struct}; -use crate::utils::get_namespace_config; +use crate::utils; pub const DOJO_CONTRACT_ATTR: &str = "dojo::contract"; pub const DOJO_INTERFACE_ATTR: &str = "dojo::interface"; @@ -339,27 +340,49 @@ fn get_additional_derive_attrs_for_model(derive_attr_names: &[String]) -> Vec, ) -> PluginResult { - let namespace_config = match get_namespace_config(db) { - Ok(config) => config, - Err(e) => { - return PluginResult { - code: Option::None, - diagnostics: vec![PluginDiagnostic { - stable_ptr: item_ast.stable_ptr().0, - message: format!("{e}"), - severity: Severity::Error, - }], - remove_original_item: false, - }; + let namespace_config: NamespaceConfig = if db.cfg_set().contains(&Cfg::kv("target", "test")) + { + // In test mode, we can't inject namespace information into the `CfgSet` + // as the compiler panics. We then extract the info from the main component + // of the compilation unit. + match utils::get_namespace_config(db) { + Ok(config) => config, + Err(e) => { + return PluginResult { + code: Option::None, + diagnostics: vec![PluginDiagnostic { + stable_ptr: item_ast.stable_ptr().0, + message: format!("{e}"), + severity: Severity::Error, + }], + remove_original_item: false, + }; + } } + } else { + // Metadata gives information from the crates from where `item_ast` was parsed. + // During the compilation phase, we inject namespace information into the `CfgSet` + // so that it can be used here. + metadata.cfg_set.into() }; + // Avoid the whole plugin checks if there is no default namespace. + // The compiler already checked for invalid package configuration, + // so empty default namespace can be skipped. + // if namespace_config.default.is_empty() { + // return PluginResult::default(); + // } + match item_ast { ast::ModuleItem::Module(module_ast) => { self.handle_mod(db, module_ast, &namespace_config, metadata) diff --git a/crates/dojo-lang/src/plugin_test_data/model b/crates/dojo-lang/src/plugin_test_data/model index 57f658b38c..d07da90fc7 100644 --- a/crates/dojo-lang/src/plugin_test_data/model +++ b/crates/dojo-lang/src/plugin_test_data/model @@ -396,776 +396,90 @@ dojo::model::introspect::Member { ) } } - -#[derive(Drop, Serde)] -pub struct BadModelMultipleVersionsEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl BadModelMultipleVersionsEntityStoreImpl of BadModelMultipleVersionsEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelMultipleVersionsEntity { - BadModelMultipleVersionsModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelMultipleVersions::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelMultipleVersionsEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl BadModelMultipleVersionsStoreImpl of BadModelMultipleVersionsStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelMultipleVersions { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelMultipleVersions`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelMultipleVersions { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelMultipleVersions::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelMultipleVersions, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl BadModelMultipleVersionsModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelMultipleVersionsEntity) -> felt252 { - *self.__id - } - - fn values(self: @BadModelMultipleVersionsEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> BadModelMultipleVersionsEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelMultipleVersionsEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelMultipleVersionsEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @BadModelMultipleVersionsEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @BadModelMultipleVersionsEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelMultipleVersionsEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl BadModelMultipleVersionsModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelMultipleVersions { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelMultipleVersionsStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelMultipleVersions, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @BadModelMultipleVersions, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelMultipleVersions, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "BadModelMultipleVersions" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelMultipleVersions" - } - - #[inline(always)] - fn version() -> u8 { - 0 - } - - #[inline(always)] - fn selector() -> felt252 { - "BadModelMultipleVersions" - } - - #[inline(always)] - fn instance_selector(self: @BadModelMultipleVersions) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 3538888628466873673221842373412072042558277047191927145880480325050722136660 - } +impl BadModelBadVersionTypeIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - #[inline(always)] - fn entity_id(self: @BadModelMultipleVersions) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } #[inline(always)] - fn keys(self: @BadModelMultipleVersions) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'BadModelBadVersionType', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - core::array::ArrayTrait::span(@serialized) + ].span() + } + ) } +} +impl BadModelNoVersionValueIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn values(self: @BadModelMultipleVersions) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - #[inline(always)] fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @BadModelMultipleVersions) -> dojo::model::Layout { - Self::layout() + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_multiple_versions { - fn ensure_abi(self: @T, model: BadModelMultipleVersions); -} - -#[starknet::contract] -pub mod bad_model_multiple_versions { - use super::BadModelMultipleVersions; - use super::Ibad_model_multiple_versions; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl bad_model_multiple_versionsImpl of Ibad_model_multiple_versions{ - fn ensure_abi(self: @ContractState, model: BadModelMultipleVersions) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'BadModelNoVersionValue', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_multiple_versionsImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_multiple_versionsImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_multiple_versionsImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None + ].span() + } + ) } } -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} -impl BadModelBadVersionTypeIntrospect<> of dojo::model::introspect::Introspect> { +impl BadModelUnexpectedArgWithValueIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] fn size() -> Option { dojo::model::introspect::Introspect::::size() @@ -1186,7 +500,7 @@ impl BadModelBadVersionTypeIntrospect<> of dojo::model::introspect::Introspect dojo::model::introspect::Ty { dojo::model::introspect::Ty::Struct( dojo::model::introspect::Struct { - name: 'BadModelBadVersionType', + name: 'BadModelUnexpectedArgWithValue', attrs: array![].span(), children: array![ dojo::model::introspect::Member { @@ -1205,776 +519,90 @@ dojo::model::introspect::Member { ) } } - -#[derive(Drop, Serde)] -pub struct BadModelBadVersionTypeEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl BadModelBadVersionTypeEntityStoreImpl of BadModelBadVersionTypeEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelBadVersionTypeEntity { - BadModelBadVersionTypeModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelBadVersionType::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelBadVersionTypeEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl BadModelBadVersionTypeStoreImpl of BadModelBadVersionTypeStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelBadVersionType { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelBadVersionType`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelBadVersionType { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelBadVersionType::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelBadVersionType, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl BadModelBadVersionTypeModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelBadVersionTypeEntity) -> felt252 { - *self.__id - } - - fn values(self: @BadModelBadVersionTypeEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> BadModelBadVersionTypeEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelBadVersionTypeEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelBadVersionTypeEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @BadModelBadVersionTypeEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @BadModelBadVersionTypeEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelBadVersionTypeEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl BadModelBadVersionTypeModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelBadVersionType { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelBadVersionTypeStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelBadVersionType, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @BadModelBadVersionType, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelBadVersionType, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "BadModelBadVersionType" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelBadVersionType" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3424346430891629531332762252537876298286978002978132542474104837759156545171 - } - - #[inline(always)] - fn instance_selector(self: @BadModelBadVersionType) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 760683829940564015458541272487101565210915690045377810379189532484191344547 - } +impl BadModelUnexpectedArgIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - #[inline(always)] - fn entity_id(self: @BadModelBadVersionType) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } #[inline(always)] - fn keys(self: @BadModelBadVersionType) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'BadModelUnexpectedArg', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - core::array::ArrayTrait::span(@serialized) + ].span() + } + ) } +} +impl BadModelNotSupportedVersionIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn values(self: @BadModelBadVersionType) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - #[inline(always)] fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @BadModelBadVersionType) -> dojo::model::Layout { - Self::layout() + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_bad_version_type { - fn ensure_abi(self: @T, model: BadModelBadVersionType); -} - -#[starknet::contract] -pub mod bad_model_bad_version_type { - use super::BadModelBadVersionType; - use super::Ibad_model_bad_version_type; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl bad_model_bad_version_typeImpl of Ibad_model_bad_version_type{ - fn ensure_abi(self: @ContractState, model: BadModelBadVersionType) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'BadModelNotSupportedVersion', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_bad_version_typeImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_bad_version_typeImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_bad_version_typeImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None + ].span() + } + ) } } -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} -impl BadModelNoVersionValueIntrospect<> of dojo::model::introspect::Introspect> { +impl Modelv0Introspect<> of dojo::model::introspect::Introspect> { #[inline(always)] fn size() -> Option { dojo::model::introspect::Introspect::::size() @@ -1995,7 +623,7 @@ impl BadModelNoVersionValueIntrospect<> of dojo::model::introspect::Introspect dojo::model::introspect::Ty { dojo::model::introspect::Ty::Struct( dojo::model::introspect::Struct { - name: 'BadModelNoVersionValue', + name: 'Modelv0', attrs: array![].span(), children: array![ dojo::model::introspect::Member { @@ -2014,787 +642,447 @@ dojo::model::introspect::Member { ) } } - -#[derive(Drop, Serde)] -pub struct BadModelNoVersionValueEntity { - __id: felt252, // private field - pub v: Vec3, -} - -#[generate_trait] -pub impl BadModelNoVersionValueEntityStoreImpl of BadModelNoVersionValueEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNoVersionValueEntity { - BadModelNoVersionValueModelEntityImpl::get(world, entity_id) +impl ModelWithBadNamespaceFormatIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelNoVersionValue::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } - fn set_v(self: @BadModelNoVersionValueEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithBadNamespaceFormat', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); + ].span() + } + ) } - } -#[generate_trait] -pub impl BadModelNoVersionValueStoreImpl of BadModelNoVersionValueStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelNoVersionValue { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelNoVersionValue`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) +impl ModelWithShortStringNamespaceIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelNoVersionValue { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelNoVersionValue::v`: deserialization failed." - ); + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithShortStringNamespace', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() } - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelNoVersionValue, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); + ].span() + } + ) } - } -pub impl BadModelNoVersionValueModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelNoVersionValueEntity) -> felt252 { - *self.__id +impl ModelWithStringNamespaceIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - fn values(self: @BadModelNoVersionValueEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } - fn from_values(entity_id: felt252, ref values: Span) -> BadModelNoVersionValueEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelNoVersionValueEntity`: deserialization failed." - ); + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithStringNamespace', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() } - core::option::OptionTrait::::unwrap(entity_values) - } - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNoVersionValueEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) + ].span() + } + ) } +} - fn update(self: @BadModelNoVersionValueEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); +impl PositionIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + dojo::model::introspect::Introspect::::size() } - fn delete(self: @BadModelNoVersionValueEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'Position', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'v', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() } - } - fn set_member( - self: @BadModelNoVersionValueEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } + ].span() + } + ) } } -pub impl BadModelNoVersionValueModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelNoVersionValue { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelNoVersionValueStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelNoVersionValue, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); +impl RolesIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + Option::None } - fn delete( - self: @BadModelNoVersionValue, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 387776731289756409274549987067854286905927440612427426920343953432870065647, + layout: dojo::model::introspect::Introspect:: +>::layout() + } + ].span() + ) } - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'Roles', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'role_ids', + attrs: array![].span(), + ty: dojo::model::introspect::Ty::Array( + array![ + dojo::model::introspect::Introspect::::ty() + ].span() + ) } - } - fn set_member( - self: @BadModelNoVersionValue, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } + ].span() + } + ) } +} +impl OnlyKeyModelIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn name() -> ByteArray { - "BadModelNoVersionValue" + fn size() -> Option { + Option::None } - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + + ].span() + ) } #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelNoVersionValue" - } + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'OnlyKeyModel', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - #[inline(always)] - fn version() -> u8 { - 1 + ].span() + } + ) } +} +impl U256KeyModelIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn selector() -> felt252 { - 3137507464979648719446085887369604472442296862296217793557428940425307809922 + fn size() -> Option { + Option::None } - #[inline(always)] - fn instance_selector(self: @BadModelNoVersionValue) -> felt252 { - Self::selector() + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + + ].span() + ) } #[inline(always)] - fn name_hash() -> felt252 { - 2459365230136118590954025890011480023818926626380754992635699340900694864996 - } + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'U256KeyModel', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'id', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 + ].span() + } + ) } +} +impl PlayerIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn entity_id(self: @BadModelNoVersionValue) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) + fn size() -> Option { + Option::Some(1) } - #[inline(always)] - fn keys(self: @BadModelNoVersionValue) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 1528802474226268325865027367859591458315299653151958663884057507666229546336, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } #[inline(always)] - fn values(self: @BadModelNoVersionValue) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'Player', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'game', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'player', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'name', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + } - core::array::ArrayTrait::span(@serialized) + ].span() + } + ) } +} +impl ModelWithSimpleArrayIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() + fn size() -> Option { + Option::None } - #[inline(always)] - fn instance_layout(self: @BadModelNoVersionValue) -> dojo::model::Layout { - Self::layout() + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, + layout: dojo::model::introspect::Introspect::::layout() + }, +dojo::model::FieldLayout { + selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, + layout: dojo::model::introspect::Introspect:: +>::layout() + } + ].span() + ) } #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_no_version_value { - fn ensure_abi(self: @T, model: BadModelNoVersionValue); -} - -#[starknet::contract] -pub mod bad_model_no_version_value { - use super::BadModelNoVersionValue; - use super::Ibad_model_no_version_value; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithSimpleArray', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'player', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'x', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'y', + attrs: array![].span(), + ty: dojo::model::introspect::Ty::Array( + array![ + dojo::model::introspect::Introspect::::ty() + ].span() + ) } - } - #[abi(embed_v0)] - impl bad_model_no_version_valueImpl of Ibad_model_no_version_value{ - fn ensure_abi(self: @ContractState, model: BadModelNoVersionValue) { - } + ].span() + } + ) } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { } -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } +impl ModelWithByteArrayIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + Option::None } -} -pub struct ContractState { -} -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, + layout: dojo::model::introspect::Introspect::::layout() + }, +dojo::model::FieldLayout { + selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, + layout: dojo::model::introspect::Introspect::::layout() + } + ].span() + ) } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_no_version_valueImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_no_version_valueImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_no_version_valueImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { + #[inline(always)] + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithByteArray', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'player', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'x', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'y', + attrs: array![].span(), + ty: dojo::model::introspect::Ty::ByteArray } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None + + ].span() + } + ) } } -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} -impl BadModelUnexpectedArgWithValueIntrospect<> of dojo::model::introspect::Introspect> { +impl ModelWithComplexArrayIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] fn size() -> Option { - dojo::model::introspect::Introspect::::size() + Option::None } fn layout() -> dojo::model::Layout { dojo::model::Layout::Struct( array![ dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() + selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, + layout: dojo::model::introspect::Introspect::::layout() + }, +dojo::model::FieldLayout { + selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, + layout: dojo::model::introspect::Introspect:: +>::layout() } ].span() ) @@ -2804,18 +1092,27 @@ impl BadModelUnexpectedArgWithValueIntrospect<> of dojo::model::introspect::Intr fn ty() -> dojo::model::introspect::Ty { dojo::model::introspect::Ty::Struct( dojo::model::introspect::Struct { - name: 'BadModelUnexpectedArgWithValue', + name: 'ModelWithComplexArray', attrs: array![].span(), children: array![ dojo::model::introspect::Member { - name: 'id', + name: 'player', attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() + ty: dojo::model::introspect::Introspect::::ty() }, dojo::model::introspect::Member { - name: 'v', + name: 'x', attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'y', + attrs: array![].span(), + ty: dojo::model::introspect::Ty::Array( + array![ + dojo::model::introspect::Introspect::::ty() + ].span() + ) } ].span() @@ -2823,23298 +1120,139 @@ dojo::model::introspect::Member { ) } } - -#[derive(Drop, Serde)] -pub struct BadModelUnexpectedArgWithValueEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl BadModelUnexpectedArgWithValueEntityStoreImpl of BadModelUnexpectedArgWithValueEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgWithValueEntity { - BadModelUnexpectedArgWithValueModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelUnexpectedArgWithValue::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) +impl ModelWithTupleIntrospect<> of dojo::model::introspect::Introspect> { + #[inline(always)] + fn size() -> Option { + Option::Some(4) } - fn set_v(self: @BadModelUnexpectedArgWithValueEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl BadModelUnexpectedArgWithValueStoreImpl of BadModelUnexpectedArgWithValueStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelUnexpectedArgWithValue { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelUnexpectedArgWithValue`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelUnexpectedArgWithValue { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelUnexpectedArgWithValue::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelUnexpectedArgWithValue, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl BadModelUnexpectedArgWithValueModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelUnexpectedArgWithValueEntity) -> felt252 { - *self.__id - } - - fn values(self: @BadModelUnexpectedArgWithValueEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> BadModelUnexpectedArgWithValueEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelUnexpectedArgWithValueEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgWithValueEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @BadModelUnexpectedArgWithValueEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @BadModelUnexpectedArgWithValueEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelUnexpectedArgWithValueEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl BadModelUnexpectedArgWithValueModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelUnexpectedArgWithValue { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelUnexpectedArgWithValueStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelUnexpectedArgWithValue, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @BadModelUnexpectedArgWithValue, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelUnexpectedArgWithValue, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "BadModelUnexpectedArgWithValue" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelUnexpectedArgWithValue" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3162902274274075293574414479899149167035238805798288683939511839395372839584 - } - - #[inline(always)] - fn instance_selector(self: @BadModelUnexpectedArgWithValue) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 3586339245084542986020591057627093254376225984628310828088084183494435682971 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @BadModelUnexpectedArgWithValue) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @BadModelUnexpectedArgWithValue) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @BadModelUnexpectedArgWithValue) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @BadModelUnexpectedArgWithValue) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_unexpected_arg_with_value { - fn ensure_abi(self: @T, model: BadModelUnexpectedArgWithValue); -} - -#[starknet::contract] -pub mod bad_model_unexpected_arg_with_value { - use super::BadModelUnexpectedArgWithValue; - use super::Ibad_model_unexpected_arg_with_value; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl bad_model_unexpected_arg_with_valueImpl of Ibad_model_unexpected_arg_with_value{ - fn ensure_abi(self: @ContractState, model: BadModelUnexpectedArgWithValue) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_unexpected_arg_with_valueImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_unexpected_arg_with_valueImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_unexpected_arg_with_valueImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl BadModelUnexpectedArgIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, + layout: dojo::model::introspect::Introspect::::layout() + }, +dojo::model::FieldLayout { + selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, + layout: dojo::model::Layout::Tuple( + array![ + dojo::model::introspect::Introspect::::layout(), +dojo::model::introspect::Introspect::::layout(), +dojo::model::introspect::Introspect::::layout() + ].span() + ) + } + ].span() + ) } #[inline(always)] fn ty() -> dojo::model::introspect::Ty { dojo::model::introspect::Ty::Struct( dojo::model::introspect::Struct { - name: 'BadModelUnexpectedArg', + name: 'ModelWithTuple', attrs: array![].span(), children: array![ dojo::model::introspect::Member { - name: 'id', + name: 'player', attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() + ty: dojo::model::introspect::Introspect::::ty() }, dojo::model::introspect::Member { - name: 'v', + name: 'x', attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct BadModelUnexpectedArgEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl BadModelUnexpectedArgEntityStoreImpl of BadModelUnexpectedArgEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgEntity { - BadModelUnexpectedArgModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelUnexpectedArg::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelUnexpectedArgEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl BadModelUnexpectedArgStoreImpl of BadModelUnexpectedArgStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelUnexpectedArg { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelUnexpectedArg`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelUnexpectedArg { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelUnexpectedArg::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelUnexpectedArg, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl BadModelUnexpectedArgModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelUnexpectedArgEntity) -> felt252 { - *self.__id - } - - fn values(self: @BadModelUnexpectedArgEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> BadModelUnexpectedArgEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelUnexpectedArgEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @BadModelUnexpectedArgEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @BadModelUnexpectedArgEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelUnexpectedArgEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl BadModelUnexpectedArgModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelUnexpectedArg { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelUnexpectedArgStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelUnexpectedArg, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @BadModelUnexpectedArg, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelUnexpectedArg, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "BadModelUnexpectedArg" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelUnexpectedArg" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2062327100205703339988289387876316143748074129748784084948535166252334131324 - } - - #[inline(always)] - fn instance_selector(self: @BadModelUnexpectedArg) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 246403407829267991441535935236143476032296881039254363860883767387993960270 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @BadModelUnexpectedArg) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @BadModelUnexpectedArg) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @BadModelUnexpectedArg) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @BadModelUnexpectedArg) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_unexpected_arg { - fn ensure_abi(self: @T, model: BadModelUnexpectedArg); -} - -#[starknet::contract] -pub mod bad_model_unexpected_arg { - use super::BadModelUnexpectedArg; - use super::Ibad_model_unexpected_arg; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl bad_model_unexpected_argImpl of Ibad_model_unexpected_arg{ - fn ensure_abi(self: @ContractState, model: BadModelUnexpectedArg) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_unexpected_argImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_unexpected_argImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_unexpected_argImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl BadModelNotSupportedVersionIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'BadModelNotSupportedVersion', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() + ty: dojo::model::introspect::Introspect::::ty() }, dojo::model::introspect::Member { - name: 'v', + name: 'y', attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct BadModelNotSupportedVersionEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl BadModelNotSupportedVersionEntityStoreImpl of BadModelNotSupportedVersionEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNotSupportedVersionEntity { - BadModelNotSupportedVersionModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelNotSupportedVersion::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelNotSupportedVersionEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl BadModelNotSupportedVersionStoreImpl of BadModelNotSupportedVersionStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> BadModelNotSupportedVersion { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `BadModelNotSupportedVersion`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelNotSupportedVersion { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `BadModelNotSupportedVersion::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @BadModelNotSupportedVersion, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl BadModelNotSupportedVersionModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @BadModelNotSupportedVersionEntity) -> felt252 { - *self.__id - } - - fn values(self: @BadModelNotSupportedVersionEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> BadModelNotSupportedVersionEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `BadModelNotSupportedVersionEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNotSupportedVersionEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @BadModelNotSupportedVersionEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @BadModelNotSupportedVersionEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelNotSupportedVersionEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl BadModelNotSupportedVersionModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> BadModelNotSupportedVersion { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - BadModelNotSupportedVersionStore::from_values(ref _keys, ref values) - } - - fn set( - self: @BadModelNotSupportedVersion, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @BadModelNotSupportedVersion, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @BadModelNotSupportedVersion, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "BadModelNotSupportedVersion" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-BadModelNotSupportedVersion" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2399868061331388591523307843619168972583102717296603562171130686072940081207 - } - - #[inline(always)] - fn instance_selector(self: @BadModelNotSupportedVersion) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 1812257929012908024237871796629728977392496349235879470060252299886369485820 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @BadModelNotSupportedVersion) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @BadModelNotSupportedVersion) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @BadModelNotSupportedVersion) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @BadModelNotSupportedVersion) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ibad_model_not_supported_version { - fn ensure_abi(self: @T, model: BadModelNotSupportedVersion); -} - -#[starknet::contract] -pub mod bad_model_not_supported_version { - use super::BadModelNotSupportedVersion; - use super::Ibad_model_not_supported_version; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl bad_model_not_supported_versionImpl of Ibad_model_not_supported_version{ - fn ensure_abi(self: @ContractState, model: BadModelNotSupportedVersion) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__bad_model_not_supported_versionImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - bad_model_not_supported_versionImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__bad_model_not_supported_versionImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl Modelv0Introspect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( + ty: dojo::model::introspect::Ty::Tuple( array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'Modelv0', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'v', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct Modelv0Entity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl Modelv0EntityStoreImpl of Modelv0EntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Modelv0Entity { - Modelv0ModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Modelv0::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @Modelv0Entity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl Modelv0StoreImpl of Modelv0Store { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> Modelv0 { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `Modelv0`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> Modelv0 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Modelv0::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @Modelv0, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl Modelv0ModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @Modelv0Entity) -> felt252 { - *self.__id - } - - fn values(self: @Modelv0Entity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> Modelv0Entity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `Modelv0Entity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Modelv0Entity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @Modelv0Entity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @Modelv0Entity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @Modelv0Entity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl Modelv0ModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> Modelv0 { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - Modelv0Store::from_values(ref _keys, ref values) - } - - fn set( - self: @Modelv0, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @Modelv0, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @Modelv0, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "Modelv0" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-Modelv0" - } - - #[inline(always)] - fn version() -> u8 { - 0 - } - - #[inline(always)] - fn selector() -> felt252 { - "Modelv0" - } - - #[inline(always)] - fn instance_selector(self: @Modelv0) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 2212879130471315306779111820244908968466545702031328551192231795237740448313 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @Modelv0) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @Modelv0) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @Modelv0) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @Modelv0) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodelv_0 { - fn ensure_abi(self: @T, model: Modelv0); -} - -#[starknet::contract] -pub mod modelv_0 { - use super::Modelv0; - use super::Imodelv_0; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl modelv_0Impl of Imodelv_0{ - fn ensure_abi(self: @ContractState, model: Modelv0) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__modelv_0Impl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - modelv_0Impl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__modelv_0Impl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithBadNamespaceFormatIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithBadNamespaceFormat', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'v', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithBadNamespaceFormatEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl ModelWithBadNamespaceFormatEntityStoreImpl of ModelWithBadNamespaceFormatEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithBadNamespaceFormatEntity { - ModelWithBadNamespaceFormatModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithBadNamespaceFormat::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithBadNamespaceFormatEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithBadNamespaceFormatStoreImpl of ModelWithBadNamespaceFormatStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithBadNamespaceFormat { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithBadNamespaceFormat`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithBadNamespaceFormat { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithBadNamespaceFormat::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithBadNamespaceFormat, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl ModelWithBadNamespaceFormatModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithBadNamespaceFormatEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithBadNamespaceFormatEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithBadNamespaceFormatEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithBadNamespaceFormatEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithBadNamespaceFormatEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithBadNamespaceFormatEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithBadNamespaceFormatEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithBadNamespaceFormatEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithBadNamespaceFormatModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithBadNamespaceFormat { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithBadNamespaceFormatStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithBadNamespaceFormat, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithBadNamespaceFormat, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithBadNamespaceFormat, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithBadNamespaceFormat" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithBadNamespaceFormat" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3059539413433693207383279334860020534329215374860715071558931541261069058621 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithBadNamespaceFormat) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 513559242384681567568052881519197161166285694153303371154270254637843894159 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithBadNamespaceFormat) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithBadNamespaceFormat) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithBadNamespaceFormat) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithBadNamespaceFormat) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_bad_namespace_format { - fn ensure_abi(self: @T, model: ModelWithBadNamespaceFormat); -} - -#[starknet::contract] -pub mod model_with_bad_namespace_format { - use super::ModelWithBadNamespaceFormat; - use super::Imodel_with_bad_namespace_format; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_bad_namespace_formatImpl of Imodel_with_bad_namespace_format{ - fn ensure_abi(self: @ContractState, model: ModelWithBadNamespaceFormat) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_bad_namespace_formatImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_bad_namespace_formatImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_bad_namespace_formatImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithShortStringNamespaceIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithShortStringNamespace', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'v', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithShortStringNamespaceEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl ModelWithShortStringNamespaceEntityStoreImpl of ModelWithShortStringNamespaceEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithShortStringNamespaceEntity { - ModelWithShortStringNamespaceModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithShortStringNamespace::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithShortStringNamespaceEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithShortStringNamespaceStoreImpl of ModelWithShortStringNamespaceStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithShortStringNamespace { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithShortStringNamespace`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithShortStringNamespace { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithShortStringNamespace::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithShortStringNamespace, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl ModelWithShortStringNamespaceModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithShortStringNamespaceEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithShortStringNamespaceEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithShortStringNamespaceEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithShortStringNamespaceEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithShortStringNamespaceEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithShortStringNamespaceEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithShortStringNamespaceEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithShortStringNamespaceEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithShortStringNamespaceModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithShortStringNamespace { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithShortStringNamespaceStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithShortStringNamespace, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithShortStringNamespace, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithShortStringNamespace, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithShortStringNamespace" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithShortStringNamespace" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 516169310422367104631924468147010406642920381144711483043394373786075028578 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithShortStringNamespace) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 4646597166239297873853881466258165424425132957303541470648153031188639878 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithShortStringNamespace) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithShortStringNamespace) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithShortStringNamespace) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithShortStringNamespace) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_short_string_namespace { - fn ensure_abi(self: @T, model: ModelWithShortStringNamespace); -} - -#[starknet::contract] -pub mod model_with_short_string_namespace { - use super::ModelWithShortStringNamespace; - use super::Imodel_with_short_string_namespace; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_short_string_namespaceImpl of Imodel_with_short_string_namespace{ - fn ensure_abi(self: @ContractState, model: ModelWithShortStringNamespace) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_short_string_namespaceImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_short_string_namespaceImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_short_string_namespaceImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithStringNamespaceIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithStringNamespace', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'v', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithStringNamespaceEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl ModelWithStringNamespaceEntityStoreImpl of ModelWithStringNamespaceEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithStringNamespaceEntity { - ModelWithStringNamespaceModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithStringNamespace::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithStringNamespaceEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithStringNamespaceStoreImpl of ModelWithStringNamespaceStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithStringNamespace { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithStringNamespace`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithStringNamespace { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithStringNamespace::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @ModelWithStringNamespace, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl ModelWithStringNamespaceModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithStringNamespaceEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithStringNamespaceEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithStringNamespaceEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithStringNamespaceEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithStringNamespaceEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithStringNamespaceEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithStringNamespaceEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithStringNamespaceEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithStringNamespaceModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithStringNamespace { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithStringNamespaceStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithStringNamespace, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithStringNamespace, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithStringNamespace, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithStringNamespace" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithStringNamespace" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2244952983831849087562617629161882602941157493177409459461888999685738447838 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithStringNamespace) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 36187013840655350498900857372670392628596870210415176261336407419317644423 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithStringNamespace) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithStringNamespace) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithStringNamespace) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithStringNamespace) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_string_namespace { - fn ensure_abi(self: @T, model: ModelWithStringNamespace); -} - -#[starknet::contract] -pub mod model_with_string_namespace { - use super::ModelWithStringNamespace; - use super::Imodel_with_string_namespace; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_string_namespaceImpl of Imodel_with_string_namespace{ - fn ensure_abi(self: @ContractState, model: ModelWithStringNamespace) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_string_namespaceImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_string_namespaceImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_string_namespaceImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl PositionIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 578691550836206188651404750433984985630363913126316857592149308417275000080, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'Position', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'v', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct PositionEntity { - __id: felt252, // private field - pub v: Vec3, - -} - -#[generate_trait] -pub impl PositionEntityStoreImpl of PositionEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PositionEntity { - PositionModelEntityImpl::get(world, entity_id) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Position::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @PositionEntity, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl PositionStoreImpl of PositionStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> Position { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `Position`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> Position { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 578691550836206188651404750433984985630363913126316857592149308417275000080 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Position::v`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_v(self: @Position, world: dojo::world::IWorldDispatcher, value: Vec3) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 578691550836206188651404750433984985630363913126316857592149308417275000080, - serialized.span() - ); - } - -} - -pub impl PositionModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @PositionEntity) -> felt252 { - *self.__id - } - - fn values(self: @PositionEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> PositionEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `PositionEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PositionEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @PositionEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @PositionEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @PositionEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl PositionModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> Position { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - PositionStore::from_values(ref _keys, ref values) - } - - fn set( - self: @Position, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @Position, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @Position, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "Position" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-Position" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2583140722357655302813194934296353271867745884944715988664292532004552033294 - } - - #[inline(always)] - fn instance_selector(self: @Position) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 2899920299641094436341712346886623904698864491830316325765258522168980161362 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @Position) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @Position) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @Position) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.v, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @Position) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Iposition { - fn ensure_abi(self: @T, model: Position); -} - -#[starknet::contract] -pub mod position { - use super::Position; - use super::Iposition; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl positionImpl of Iposition{ - fn ensure_abi(self: @ContractState, model: Position) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__positionImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - positionImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__positionImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl RolesIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 387776731289756409274549987067854286905927440612427426920343953432870065647, - layout: dojo::model::introspect::Introspect:: ->::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'Roles', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'role_ids', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::Array( - array![ - dojo::model::introspect::Introspect::::ty() - ].span() - ) - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct RolesEntity { - __id: felt252, // private field - pub role_ids: Array, - -} - -#[generate_trait] -pub impl RolesEntityStoreImpl of RolesEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> RolesEntity { - RolesModelEntityImpl::get(world, entity_id) - } - - - fn get_role_ids(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 387776731289756409274549987067854286905927440612427426920343953432870065647 - ); - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `Roles::role_ids`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_role_ids(self: @RolesEntity, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 387776731289756409274549987067854286905927440612427426920343953432870065647, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl RolesStoreImpl of RolesStore { - fn entity_id_from_keys() -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> Roles { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `Roles`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, ) -> Roles { - let mut serialized = core::array::ArrayTrait::new(); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_role_ids(world: dojo::world::IWorldDispatcher, ) -> Array { - let mut serialized = core::array::ArrayTrait::new(); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 387776731289756409274549987067854286905927440612427426920343953432870065647 - ); - - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `Roles::role_ids`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_role_ids(self: @Roles, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 387776731289756409274549987067854286905927440612427426920343953432870065647, - serialized.span() - ); - } - -} - -pub impl RolesModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @RolesEntity) -> felt252 { - *self.__id - } - - fn values(self: @RolesEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.role_ids, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> RolesEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `RolesEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> RolesEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @RolesEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @RolesEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @RolesEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl RolesModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> Roles { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - RolesStore::from_values(ref _keys, ref values) - } - - fn set( - self: @Roles, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @Roles, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @Roles, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "Roles" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-Roles" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2381319068167303801085530774544728044506110381004500761927797648058170896946 - } - - #[inline(always)] - fn instance_selector(self: @Roles) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 2030971736961612564423689930729061756599290850089001157163423482274886199516 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @Roles) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @Roles) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @Roles) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.role_ids, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @Roles) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Iroles { - fn ensure_abi(self: @T, model: Roles); -} - -#[starknet::contract] -pub mod roles { - use super::Roles; - use super::Iroles; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl rolesImpl of Iroles{ - fn ensure_abi(self: @ContractState, model: Roles) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__rolesImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - rolesImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__rolesImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl OnlyKeyModelIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'OnlyKeyModel', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct OnlyKeyModelEntity { - __id: felt252, // private field - -} - -#[generate_trait] -pub impl OnlyKeyModelEntityStoreImpl of OnlyKeyModelEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> OnlyKeyModelEntity { - OnlyKeyModelModelEntityImpl::get(world, entity_id) - } - - -} - -#[generate_trait] -pub impl OnlyKeyModelStoreImpl of OnlyKeyModelStore { - fn entity_id_from_keys(id: felt252) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> OnlyKeyModel { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `OnlyKeyModel`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> OnlyKeyModel { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, id); - - - dojo::model::Model::::get(world, serialized.span()) - } - - -} - -pub impl OnlyKeyModelModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @OnlyKeyModelEntity) -> felt252 { - *self.__id - } - - fn values(self: @OnlyKeyModelEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> OnlyKeyModelEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `OnlyKeyModelEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> OnlyKeyModelEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @OnlyKeyModelEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @OnlyKeyModelEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @OnlyKeyModelEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl OnlyKeyModelModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> OnlyKeyModel { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - OnlyKeyModelStore::from_values(ref _keys, ref values) - } - - fn set( - self: @OnlyKeyModel, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @OnlyKeyModel, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @OnlyKeyModel, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "OnlyKeyModel" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-OnlyKeyModel" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 399971050958024375507922651483187108363916132710819632852036528607645634778 - } - - #[inline(always)] - fn instance_selector(self: @OnlyKeyModel) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 1001826121797570811408809643478760373535949956555931325019299477987282578617 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @OnlyKeyModel) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @OnlyKeyModel) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.id); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @OnlyKeyModel) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @OnlyKeyModel) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Ionly_key_model { - fn ensure_abi(self: @T, model: OnlyKeyModel); -} - -#[starknet::contract] -pub mod only_key_model { - use super::OnlyKeyModel; - use super::Ionly_key_model; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl only_key_modelImpl of Ionly_key_model{ - fn ensure_abi(self: @ContractState, model: OnlyKeyModel) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__only_key_modelImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - only_key_modelImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__only_key_modelImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl U256KeyModelIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'U256KeyModel', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'id', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct U256KeyModelEntity { - __id: felt252, // private field - -} - -#[generate_trait] -pub impl U256KeyModelEntityStoreImpl of U256KeyModelEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> U256KeyModelEntity { - U256KeyModelModelEntityImpl::get(world, entity_id) - } - - -} - -#[generate_trait] -pub impl U256KeyModelStoreImpl of U256KeyModelStore { - fn entity_id_from_keys(id: u256) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@id, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> U256KeyModel { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `U256KeyModel`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, id: u256) -> U256KeyModel { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@id, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - -} - -pub impl U256KeyModelModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @U256KeyModelEntity) -> felt252 { - *self.__id - } - - fn values(self: @U256KeyModelEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> U256KeyModelEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `U256KeyModelEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> U256KeyModelEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @U256KeyModelEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @U256KeyModelEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @U256KeyModelEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl U256KeyModelModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> U256KeyModel { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - U256KeyModelStore::from_values(ref _keys, ref values) - } - - fn set( - self: @U256KeyModel, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @U256KeyModel, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @U256KeyModel, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "U256KeyModel" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-U256KeyModel" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3403346971723769227042162502675592040860576799654783499419654467804113799823 - } - - #[inline(always)] - fn instance_selector(self: @U256KeyModel) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 1848733002266458148515852001373055968326209639346734967305014900020806934517 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @U256KeyModel) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @U256KeyModel) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.id, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @U256KeyModel) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @U256KeyModel) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Iu_256_key_model { - fn ensure_abi(self: @T, model: U256KeyModel); -} - -#[starknet::contract] -pub mod u_256_key_model { - use super::U256KeyModel; - use super::Iu_256_key_model; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl u_256_key_modelImpl of Iu_256_key_model{ - fn ensure_abi(self: @ContractState, model: U256KeyModel) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__u_256_key_modelImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - u_256_key_modelImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__u_256_key_modelImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl PlayerIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::Some(1) - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 1528802474226268325865027367859591458315299653151958663884057507666229546336, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'Player', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'game', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'name', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct PlayerEntity { - __id: felt252, // private field - pub name: felt252, - -} - -#[generate_trait] -pub impl PlayerEntityStoreImpl of PlayerEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PlayerEntity { - PlayerModelEntityImpl::get(world, entity_id) - } - - - fn get_name(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> felt252 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1528802474226268325865027367859591458315299653151958663884057507666229546336 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Player::name`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_name(self: @PlayerEntity, world: dojo::world::IWorldDispatcher, value: felt252) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1528802474226268325865027367859591458315299653151958663884057507666229546336, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl PlayerStoreImpl of PlayerStore { - fn entity_id_from_keys(game: felt252, player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, game); -core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> Player { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `Player`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, game: felt252, player: ContractAddress) -> Player { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, game); -core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_name(world: dojo::world::IWorldDispatcher, game: felt252, player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, game); -core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1528802474226268325865027367859591458315299653151958663884057507666229546336 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `Player::name`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_name(self: @Player, world: dojo::world::IWorldDispatcher, value: felt252) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1528802474226268325865027367859591458315299653151958663884057507666229546336, - serialized.span() - ); - } - -} - -pub impl PlayerModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @PlayerEntity) -> felt252 { - *self.__id - } - - fn values(self: @PlayerEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.name); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> PlayerEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `PlayerEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PlayerEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @PlayerEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @PlayerEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @PlayerEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl PlayerModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> Player { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - PlayerStore::from_values(ref _keys, ref values) - } - - fn set( - self: @Player, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @Player, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @Player, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "Player" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-Player" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3068209845672224878774101526910835120619854456556690065951127565061014675679 - } - - #[inline(always)] - fn instance_selector(self: @Player) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 1073075359926275415180704315933677548333097210683379121732618306925003101845 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @Player) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @Player) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.game); -core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @Player) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::array::ArrayTrait::append(ref serialized, *self.name); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @Player) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Iplayer { - fn ensure_abi(self: @T, model: Player); -} - -#[starknet::contract] -pub mod player { - use super::Player; - use super::Iplayer; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl playerImpl of Iplayer{ - fn ensure_abi(self: @ContractState, model: Player) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__playerImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - playerImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__playerImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithSimpleArrayIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, - layout: dojo::model::introspect::Introspect::::layout() - }, -dojo::model::FieldLayout { - selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, - layout: dojo::model::introspect::Introspect:: ->::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithSimpleArray', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'x', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'y', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::Array( - array![ - dojo::model::introspect::Introspect::::ty() - ].span() - ) - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithSimpleArrayEntity { - __id: felt252, // private field - pub x: u16, -pub y: Array, - -} - -#[generate_trait] -pub impl ModelWithSimpleArrayEntityStoreImpl of ModelWithSimpleArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithSimpleArrayEntity { - ModelWithSimpleArrayModelEntityImpl::get(world, entity_id) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithSimpleArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `ModelWithSimpleArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_y(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithSimpleArrayStoreImpl of ModelWithSimpleArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithSimpleArray { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithSimpleArray`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithSimpleArray { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithSimpleArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithSimpleArray, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> Array { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `ModelWithSimpleArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_y(self: @ModelWithSimpleArray, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -pub impl ModelWithSimpleArrayModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithSimpleArrayEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithSimpleArrayEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithSimpleArrayEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithSimpleArrayEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithSimpleArrayEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithSimpleArrayEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithSimpleArrayModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithSimpleArray { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithSimpleArrayStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithSimpleArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithSimpleArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithSimpleArray, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithSimpleArray" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithSimpleArray" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 516248842335934132822768408262411488579427278776919857986291389606250466377 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithSimpleArray) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 173141902001925402715103859951360389436088950156916962046507357841237663931 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithSimpleArray) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithSimpleArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithSimpleArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithSimpleArray) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_simple_array { - fn ensure_abi(self: @T, model: ModelWithSimpleArray); -} - -#[starknet::contract] -pub mod model_with_simple_array { - use super::ModelWithSimpleArray; - use super::Imodel_with_simple_array; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_simple_arrayImpl of Imodel_with_simple_array{ - fn ensure_abi(self: @ContractState, model: ModelWithSimpleArray) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_simple_arrayImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_simple_arrayImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_simple_arrayImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithByteArrayIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, - layout: dojo::model::introspect::Introspect::::layout() - }, -dojo::model::FieldLayout { - selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, - layout: dojo::model::introspect::Introspect::::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithByteArray', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'x', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'y', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::ByteArray - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithByteArrayEntity { - __id: felt252, // private field - pub x: u16, -pub y: ByteArray, - -} - -#[generate_trait] -pub impl ModelWithByteArrayEntityStoreImpl of ModelWithByteArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithByteArrayEntity { - ModelWithByteArrayModelEntityImpl::get(world, entity_id) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithByteArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ByteArray { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithByteArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_y(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher, value: ByteArray) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithByteArrayStoreImpl of ModelWithByteArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithByteArray { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithByteArray`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithByteArray { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithByteArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithByteArray, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ByteArray { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithByteArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_y(self: @ModelWithByteArray, world: dojo::world::IWorldDispatcher, value: ByteArray) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -pub impl ModelWithByteArrayModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithByteArrayEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithByteArrayEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithByteArrayEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithByteArrayEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithByteArrayEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithByteArrayEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithByteArrayModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithByteArray { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithByteArrayStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithByteArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithByteArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithByteArray, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithByteArray" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithByteArray" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 858867864009207556499907034628308336720989886132468668210801974294049151990 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithByteArray) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 2176409715042145900636260236501596599545103472111273072320531220776338338674 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithByteArray) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithByteArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithByteArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithByteArray) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_byte_array { - fn ensure_abi(self: @T, model: ModelWithByteArray); -} - -#[starknet::contract] -pub mod model_with_byte_array { - use super::ModelWithByteArray; - use super::Imodel_with_byte_array; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_byte_arrayImpl of Imodel_with_byte_array{ - fn ensure_abi(self: @ContractState, model: ModelWithByteArray) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_byte_arrayImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_byte_arrayImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_byte_arrayImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithComplexArrayIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::None - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, - layout: dojo::model::introspect::Introspect::::layout() - }, -dojo::model::FieldLayout { - selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, - layout: dojo::model::introspect::Introspect:: ->::layout() - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithComplexArray', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'x', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'y', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::Array( - array![ - dojo::model::introspect::Introspect::::ty() - ].span() - ) - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithComplexArrayEntity { - __id: felt252, // private field - pub x: u16, -pub y: Array, - -} - -#[generate_trait] -pub impl ModelWithComplexArrayEntityStoreImpl of ModelWithComplexArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithComplexArrayEntity { - ModelWithComplexArrayModelEntityImpl::get(world, entity_id) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithComplexArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `ModelWithComplexArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_y(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithComplexArrayStoreImpl of ModelWithComplexArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithComplexArray { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithComplexArray`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithComplexArray { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithComplexArray::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithComplexArray, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> Array { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - - let field_value = core::serde::Serde::>::deserialize(ref values); - - if core::option::OptionTrait::>::is_none(@field_value) { - panic!( - "Field `ModelWithComplexArray::y`: deserialization failed." - ); - } - - core::option::OptionTrait::>::unwrap(field_value) - } - - fn set_y(self: @ModelWithComplexArray, world: dojo::world::IWorldDispatcher, value: Array) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -pub impl ModelWithComplexArrayModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithComplexArrayEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithComplexArrayEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithComplexArrayEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithComplexArrayEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithComplexArrayEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithComplexArrayEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithComplexArrayModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithComplexArray { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithComplexArrayStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithComplexArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithComplexArray, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithComplexArray, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithComplexArray" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithComplexArray" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 298653312264896693167501639402458085580783343254117966446641652721994965516 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithComplexArray) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 2866472224509756243720005045848892642397514372569303051745174230372637769655 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithComplexArray) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithComplexArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithComplexArray) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithComplexArray) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_complex_array { - fn ensure_abi(self: @T, model: ModelWithComplexArray); -} - -#[starknet::contract] -pub mod model_with_complex_array { - use super::ModelWithComplexArray; - use super::Imodel_with_complex_array; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_complex_arrayImpl of Imodel_with_complex_array{ - fn ensure_abi(self: @ContractState, model: ModelWithComplexArray) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_complex_arrayImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_complex_arrayImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_complex_arrayImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithTupleIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - Option::Some(4) - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, - layout: dojo::model::introspect::Introspect::::layout() - }, -dojo::model::FieldLayout { - selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, - layout: dojo::model::Layout::Tuple( - array![ - dojo::model::introspect::Introspect::::layout(), -dojo::model::introspect::Introspect::::layout(), -dojo::model::introspect::Introspect::::layout() - ].span() - ) - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithTuple', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'x', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'y', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::Tuple( - array![ - dojo::model::introspect::Introspect::::ty(), -dojo::model::introspect::Introspect::::ty(), -dojo::model::introspect::Introspect::::ty() - ].span() - ) - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithTupleEntity { - __id: felt252, // private field - pub x: u16, -pub y: (u8, u16, u32), - -} - -#[generate_trait] -pub impl ModelWithTupleEntityStoreImpl of ModelWithTupleEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleEntity { - ModelWithTupleModelEntityImpl::get(world, entity_id) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithTuple::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> (u8, u16, u32) { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - let field_value = core::serde::Serde::<(u8, u16, u32)>::deserialize(ref values); - - if core::option::OptionTrait::<(u8, u16, u32)>::is_none(@field_value) { - panic!( - "Field `ModelWithTuple::y`: deserialization failed." - ); - } - - core::option::OptionTrait::<(u8, u16, u32)>::unwrap(field_value) - } - - fn set_y(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher, value: (u8, u16, u32)) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithTupleStoreImpl of ModelWithTupleStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithTuple { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithTuple`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithTuple { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithTuple::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithTuple, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> (u8, u16, u32) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - - let field_value = core::serde::Serde::<(u8, u16, u32)>::deserialize(ref values); - - if core::option::OptionTrait::<(u8, u16, u32)>::is_none(@field_value) { - panic!( - "Field `ModelWithTuple::y`: deserialization failed." - ); - } - - core::option::OptionTrait::<(u8, u16, u32)>::unwrap(field_value) - } - - fn set_y(self: @ModelWithTuple, world: dojo::world::IWorldDispatcher, value: (u8, u16, u32)) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -pub impl ModelWithTupleModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithTupleEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithTupleEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithTupleEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithTupleEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithTupleEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithTupleModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithTuple { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithTupleStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithTuple, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithTuple, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithTuple, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithTuple" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithTuple" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 3520389162382437315776520663535583701836688108885454850509972628400715241 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithTuple) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 3222351670132870101782632958288197874250493316621507272653773018669253981260 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithTuple) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithTuple) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithTuple) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithTuple) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_tuple { - fn ensure_abi(self: @T, model: ModelWithTuple); -} - -#[starknet::contract] -pub mod model_with_tuple { - use super::ModelWithTuple; - use super::Imodel_with_tuple; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_tupleImpl of Imodel_with_tuple{ - fn ensure_abi(self: @ContractState, model: ModelWithTuple) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_tupleImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_tupleImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_tupleImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} - -impl ModelWithTupleNoPrimitivesIntrospect<> of dojo::model::introspect::Introspect> { - #[inline(always)] - fn size() -> Option { - let sizes : Array> = array![ - dojo::model::introspect::Introspect::::size(), -Option::Some(3) - ]; - - if dojo::utils::any_none(@sizes) { - return Option::None; - } - Option::Some(dojo::utils::sum(sizes)) - - } - - fn layout() -> dojo::model::Layout { - dojo::model::Layout::Struct( - array![ - dojo::model::FieldLayout { - selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, - layout: dojo::model::introspect::Introspect::::layout() - }, -dojo::model::FieldLayout { - selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, - layout: dojo::model::Layout::Tuple( - array![ - dojo::model::introspect::Introspect::::layout(), -dojo::model::introspect::Introspect::::layout(), -dojo::model::introspect::Introspect::::layout() - ].span() - ) - } - ].span() - ) - } - - #[inline(always)] - fn ty() -> dojo::model::introspect::Ty { - dojo::model::introspect::Ty::Struct( - dojo::model::introspect::Struct { - name: 'ModelWithTupleNoPrimitives', - attrs: array![].span(), - children: array![ - dojo::model::introspect::Member { - name: 'player', - attrs: array!['key'].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'x', - attrs: array![].span(), - ty: dojo::model::introspect::Introspect::::ty() - }, -dojo::model::introspect::Member { - name: 'y', - attrs: array![].span(), - ty: dojo::model::introspect::Ty::Tuple( - array![ - dojo::model::introspect::Introspect::::ty(), -dojo::model::introspect::Introspect::::ty(), -dojo::model::introspect::Introspect::::ty() - ].span() - ) - } - - ].span() - } - ) - } -} - -#[derive(Drop, Serde)] -pub struct ModelWithTupleNoPrimitivesEntity { - __id: felt252, // private field - pub x: u16, -pub y: (u8, Vec3, u32), - -} - -#[generate_trait] -pub impl ModelWithTupleNoPrimitivesEntityStoreImpl of ModelWithTupleNoPrimitivesEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleNoPrimitivesEntity { - ModelWithTupleNoPrimitivesModelEntityImpl::get(world, entity_id) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16 { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithTupleNoPrimitives::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> (u8, Vec3, u32) { - let mut values = dojo::model::ModelEntity::::get_member( - world, - entity_id, - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - let field_value = core::serde::Serde::<(u8, Vec3, u32)>::deserialize(ref values); - - if core::option::OptionTrait::<(u8, Vec3, u32)>::is_none(@field_value) { - panic!( - "Field `ModelWithTupleNoPrimitives::y`: deserialization failed." - ); - } - - core::option::OptionTrait::<(u8, Vec3, u32)>::unwrap(field_value) - } - - fn set_y(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher, value: (u8, Vec3, u32)) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -#[generate_trait] -pub impl ModelWithTupleNoPrimitivesStoreImpl of ModelWithTupleNoPrimitivesStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - core::poseidon::poseidon_hash_span(serialized.span()) - } - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithTupleNoPrimitives { - let mut serialized = core::array::ArrayTrait::new(); - serialized.append_span(keys); - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity = core::serde::Serde::::deserialize(ref serialized); - - if core::option::OptionTrait::::is_none(@entity) { - panic!( - "Model `ModelWithTupleNoPrimitives`: deserialization failed. Ensure the length of the keys tuple is matching the number of #[key] fields in the model struct." - ); - } - - core::option::OptionTrait::::unwrap(entity) - } - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithTupleNoPrimitives { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - dojo::model::Model::::get(world, serialized.span()) - } - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16 { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 512066735765477566404754172672287371265995314501343422459174036873487219331 - ); - - let field_value = core::serde::Serde::::deserialize(ref values); - - if core::option::OptionTrait::::is_none(@field_value) { - panic!( - "Field `ModelWithTupleNoPrimitives::x`: deserialization failed." - ); - } - - core::option::OptionTrait::::unwrap(field_value) - } - - fn set_x(self: @ModelWithTupleNoPrimitives, world: dojo::world::IWorldDispatcher, value: u16) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 512066735765477566404754172672287371265995314501343422459174036873487219331, - serialized.span() - ); - } - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> (u8, Vec3, u32) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@player, ref serialized); - - - let mut values = dojo::model::Model::::get_member( - world, - serialized.span(), - 1591024729085637502504777720563487898377940395575083379770417352976841400819 - ); - - let field_value = core::serde::Serde::<(u8, Vec3, u32)>::deserialize(ref values); - - if core::option::OptionTrait::<(u8, Vec3, u32)>::is_none(@field_value) { - panic!( - "Field `ModelWithTupleNoPrimitives::y`: deserialization failed." - ); - } - - core::option::OptionTrait::<(u8, Vec3, u32)>::unwrap(field_value) - } - - fn set_y(self: @ModelWithTupleNoPrimitives, world: dojo::world::IWorldDispatcher, value: (u8, Vec3, u32)) { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(@value, ref serialized); - - self.set_member( - world, - 1591024729085637502504777720563487898377940395575083379770417352976841400819, - serialized.span() - ); - } - -} - -pub impl ModelWithTupleNoPrimitivesModelEntityImpl of dojo::model::ModelEntity { - fn id(self: @ModelWithTupleNoPrimitivesEntity) -> felt252 { - *self.__id - } - - fn values(self: @ModelWithTupleNoPrimitivesEntity) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - fn from_values(entity_id: felt252, ref values: Span) -> ModelWithTupleNoPrimitivesEntity { - let mut serialized = array![entity_id]; - serialized.append_span(values); - let mut serialized = core::array::ArrayTrait::span(@serialized); - - let entity_values = core::serde::Serde::::deserialize(ref serialized); - if core::option::OptionTrait::::is_none(@entity_values) { - panic!( - "ModelEntity `ModelWithTupleNoPrimitivesEntity`: deserialization failed." - ); - } - core::option::OptionTrait::::unwrap(entity_values) - } - - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleNoPrimitivesEntity { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(entity_id), - dojo::model::Model::::layout() - ); - Self::from_values(entity_id, ref values) - } - - fn update(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - self.values(), - dojo::model::Model::::layout() - ); - } - - fn delete(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::Id(self.id()), - dojo::model::Model::::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - entity_id: felt252, - member_id: felt252, - ) -> Span { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithTupleNoPrimitivesEntity, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span, - ) { - match dojo::utils::find_model_field_layout(dojo::model::Model::::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - dojo::model::Model::::selector(), - dojo::model::ModelIndex::MemberId((self.id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } -} - -pub impl ModelWithTupleNoPrimitivesModelImpl of dojo::model::Model { - fn get(world: dojo::world::IWorldDispatcher, keys: Span) -> ModelWithTupleNoPrimitives { - let mut values = dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(keys), - Self::layout() - ); - let mut _keys = keys; - - ModelWithTupleNoPrimitivesStore::from_values(ref _keys, ref values) - } - - fn set( - self: @ModelWithTupleNoPrimitives, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::values(self), - Self::layout() - ); - } - - fn delete( - self: @ModelWithTupleNoPrimitives, - world: dojo::world::IWorldDispatcher - ) { - dojo::world::IWorldDispatcherTrait::delete_entity( - world, - Self::selector(), - dojo::model::ModelIndex::Keys(Self::keys(self)), - Self::layout() - ); - } - - fn get_member( - world: dojo::world::IWorldDispatcher, - keys: Span, - member_id: felt252 - ) -> Span { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - let entity_id = dojo::utils::entity_id_from_keys(keys); - dojo::world::IWorldDispatcherTrait::entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((entity_id, member_id)), - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - fn set_member( - self: @ModelWithTupleNoPrimitives, - world: dojo::world::IWorldDispatcher, - member_id: felt252, - values: Span - ) { - match dojo::utils::find_model_field_layout(Self::layout(), member_id) { - Option::Some(field_layout) => { - dojo::world::IWorldDispatcherTrait::set_entity( - world, - Self::selector(), - dojo::model::ModelIndex::MemberId((self.entity_id(), member_id)), - values, - field_layout - ) - }, - Option::None => core::panic_with_felt252('bad member id') - } - } - - #[inline(always)] - fn name() -> ByteArray { - "ModelWithTupleNoPrimitives" - } - - #[inline(always)] - fn namespace() -> ByteArray { - "test_package" - } - - #[inline(always)] - fn tag() -> ByteArray { - "test_package-ModelWithTupleNoPrimitives" - } - - #[inline(always)] - fn version() -> u8 { - 1 - } - - #[inline(always)] - fn selector() -> felt252 { - 2133652848391750418502705747419625263797079439106286994977255727801602328040 - } - - #[inline(always)] - fn instance_selector(self: @ModelWithTupleNoPrimitives) -> felt252 { - Self::selector() - } - - #[inline(always)] - fn name_hash() -> felt252 { - 157059227407493660591195028728750607977045261142495925435047270200565107096 - } - - #[inline(always)] - fn namespace_hash() -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - #[inline(always)] - fn entity_id(self: @ModelWithTupleNoPrimitives) -> felt252 { - core::poseidon::poseidon_hash_span(self.keys()) - } - - #[inline(always)] - fn keys(self: @ModelWithTupleNoPrimitives) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.player, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn values(self: @ModelWithTupleNoPrimitives) -> Span { - let mut serialized = core::array::ArrayTrait::new(); - core::serde::Serde::serialize(self.x, ref serialized); -core::serde::Serde::serialize(self.y, ref serialized); - - core::array::ArrayTrait::span(@serialized) - } - - #[inline(always)] - fn layout() -> dojo::model::Layout { - dojo::model::introspect::Introspect::::layout() - } - - #[inline(always)] - fn instance_layout(self: @ModelWithTupleNoPrimitives) -> dojo::model::Layout { - Self::layout() - } - - #[inline(always)] - fn packed_size() -> Option { - dojo::model::layout::compute_packed_size(Self::layout()) - } -} - -#[starknet::interface] -pub trait Imodel_with_tuple_no_primitives { - fn ensure_abi(self: @T, model: ModelWithTupleNoPrimitives); -} - -#[starknet::contract] -pub mod model_with_tuple_no_primitives { - use super::ModelWithTupleNoPrimitives; - use super::Imodel_with_tuple_no_primitives; - - #[abi(embed_v0)] - impl DojoModelImpl of dojo::model::IModel{ - fn name(self: @ContractState) -> ByteArray { - dojo::model::Model::::name() - } - - fn namespace(self: @ContractState) -> ByteArray { - dojo::model::Model::::namespace() - } - - fn tag(self: @ContractState) -> ByteArray { - dojo::model::Model::::tag() - } - - fn version(self: @ContractState) -> u8 { - dojo::model::Model::::version() - } - - fn selector(self: @ContractState) -> felt252 { - dojo::model::Model::::selector() - } - - fn name_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::name_hash() - } - - fn namespace_hash(self: @ContractState) -> felt252 { - dojo::model::Model::::namespace_hash() - } - - fn unpacked_size(self: @ContractState) -> Option { - dojo::model::introspect::Introspect::::size() - } - - fn packed_size(self: @ContractState) -> Option { - dojo::model::Model::::packed_size() - } - - fn layout(self: @ContractState) -> dojo::model::Layout { - dojo::model::Model::::layout() - } - - fn schema(self: @ContractState) -> dojo::model::introspect::Ty { - dojo::model::introspect::Introspect::::ty() - } - } - - #[abi(embed_v0)] - impl model_with_tuple_no_primitivesImpl of Imodel_with_tuple_no_primitives{ - fn ensure_abi(self: @ContractState, model: ModelWithTupleNoPrimitives) { - } - } -#[event] -#[derive(Drop, starknet::Event)] -pub enum Event {} - - -#[phantom] -pub struct Storage { -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - } - } -} -pub struct ContractState { -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__version(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::version(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__unpacked_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::unpacked_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__packed_size(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::packed_size(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::>::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__layout(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::layout(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__DojoModelImpl__schema(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = DojoModelImpl::schema(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__model_with_tuple_no_primitivesImpl__ensure_abi(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_model = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - model_with_tuple_no_primitivesImpl::ensure_abi(@contract_state, __arg_model); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__DojoModelImpl__name as name; - pub use super::__wrapper__DojoModelImpl__namespace as namespace; - pub use super::__wrapper__DojoModelImpl__tag as tag; - pub use super::__wrapper__DojoModelImpl__version as version; - pub use super::__wrapper__DojoModelImpl__selector as selector; - pub use super::__wrapper__DojoModelImpl__name_hash as name_hash; - pub use super::__wrapper__DojoModelImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__DojoModelImpl__unpacked_size as unpacked_size; - pub use super::__wrapper__DojoModelImpl__packed_size as packed_size; - pub use super::__wrapper__DojoModelImpl__layout as layout; - pub use super::__wrapper__DojoModelImpl__schema as schema; - pub use super::__wrapper__model_with_tuple_no_primitivesImpl__ensure_abi as ensure_abi; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - Option::None - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -} -impl BadModelMultipleVersionsEntityDrop of core::traits::Drop::; -impl BadModelMultipleVersionsEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelMultipleVersionsEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelMultipleVersionsEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelMultipleVersionsEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelMultipleVersionsEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelMultipleVersionsEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelMultipleVersionsStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelMultipleVersions; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelMultipleVersions; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelMultipleVersions, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_multiple_versionsDispatcherTrait { - fn ensure_abi(self: T, model: BadModelMultipleVersions); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_multiple_versionsDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_multiple_versionsDispatcherImpl of Ibad_model_multiple_versionsDispatcherTrait { - fn ensure_abi(self: Ibad_model_multiple_versionsDispatcher, model: BadModelMultipleVersions) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_multiple_versionsLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_multiple_versionsLibraryDispatcherImpl of Ibad_model_multiple_versionsDispatcherTrait { - fn ensure_abi(self: Ibad_model_multiple_versionsLibraryDispatcher, model: BadModelMultipleVersions) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_multiple_versionsSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelMultipleVersions) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_multiple_versionsSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_multiple_versionsSafeLibraryDispatcherImpl of Ibad_model_multiple_versionsSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_multiple_versionsSafeLibraryDispatcher, model: BadModelMultipleVersions) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_multiple_versionsSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_multiple_versionsSafeDispatcherImpl of Ibad_model_multiple_versionsSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_multiple_versionsSafeDispatcher, model: BadModelMultipleVersions) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl BadModelBadVersionTypeEntityDrop of core::traits::Drop::; -impl BadModelBadVersionTypeEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelBadVersionTypeEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelBadVersionTypeEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelBadVersionTypeEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelBadVersionTypeEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelBadVersionTypeEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelBadVersionTypeStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelBadVersionType; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelBadVersionType; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelBadVersionType, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_bad_version_typeDispatcherTrait { - fn ensure_abi(self: T, model: BadModelBadVersionType); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_bad_version_typeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_bad_version_typeDispatcherImpl of Ibad_model_bad_version_typeDispatcherTrait { - fn ensure_abi(self: Ibad_model_bad_version_typeDispatcher, model: BadModelBadVersionType) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_bad_version_typeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_bad_version_typeLibraryDispatcherImpl of Ibad_model_bad_version_typeDispatcherTrait { - fn ensure_abi(self: Ibad_model_bad_version_typeLibraryDispatcher, model: BadModelBadVersionType) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_bad_version_typeSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelBadVersionType) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_bad_version_typeSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_bad_version_typeSafeLibraryDispatcherImpl of Ibad_model_bad_version_typeSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_bad_version_typeSafeLibraryDispatcher, model: BadModelBadVersionType) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_bad_version_typeSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_bad_version_typeSafeDispatcherImpl of Ibad_model_bad_version_typeSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_bad_version_typeSafeDispatcher, model: BadModelBadVersionType) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl BadModelNoVersionValueEntityDrop of core::traits::Drop::; -impl BadModelNoVersionValueEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelNoVersionValueEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelNoVersionValueEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelNoVersionValueEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNoVersionValueEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelNoVersionValueEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelNoVersionValueStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelNoVersionValue; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelNoVersionValue; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelNoVersionValue, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_no_version_valueDispatcherTrait { - fn ensure_abi(self: T, model: BadModelNoVersionValue); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_no_version_valueDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_no_version_valueDispatcherImpl of Ibad_model_no_version_valueDispatcherTrait { - fn ensure_abi(self: Ibad_model_no_version_valueDispatcher, model: BadModelNoVersionValue) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_no_version_valueLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_no_version_valueLibraryDispatcherImpl of Ibad_model_no_version_valueDispatcherTrait { - fn ensure_abi(self: Ibad_model_no_version_valueLibraryDispatcher, model: BadModelNoVersionValue) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_no_version_valueSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelNoVersionValue) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_no_version_valueSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_no_version_valueSafeLibraryDispatcherImpl of Ibad_model_no_version_valueSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_no_version_valueSafeLibraryDispatcher, model: BadModelNoVersionValue) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_no_version_valueSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_no_version_valueSafeDispatcherImpl of Ibad_model_no_version_valueSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_no_version_valueSafeDispatcher, model: BadModelNoVersionValue) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl BadModelUnexpectedArgWithValueEntityDrop of core::traits::Drop::; -impl BadModelUnexpectedArgWithValueEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelUnexpectedArgWithValueEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelUnexpectedArgWithValueEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelUnexpectedArgWithValueEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgWithValueEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelUnexpectedArgWithValueEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelUnexpectedArgWithValueStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelUnexpectedArgWithValue; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelUnexpectedArgWithValue; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelUnexpectedArgWithValue, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_unexpected_arg_with_valueDispatcherTrait { - fn ensure_abi(self: T, model: BadModelUnexpectedArgWithValue); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_arg_with_valueDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_unexpected_arg_with_valueDispatcherImpl of Ibad_model_unexpected_arg_with_valueDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_arg_with_valueDispatcher, model: BadModelUnexpectedArgWithValue) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_arg_with_valueLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherImpl of Ibad_model_unexpected_arg_with_valueDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_arg_with_valueLibraryDispatcher, model: BadModelUnexpectedArgWithValue) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_unexpected_arg_with_valueSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelUnexpectedArgWithValue) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherImpl of Ibad_model_unexpected_arg_with_valueSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher, model: BadModelUnexpectedArgWithValue) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_arg_with_valueSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherImpl of Ibad_model_unexpected_arg_with_valueSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_arg_with_valueSafeDispatcher, model: BadModelUnexpectedArgWithValue) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl BadModelUnexpectedArgEntityDrop of core::traits::Drop::; -impl BadModelUnexpectedArgEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelUnexpectedArgEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelUnexpectedArgEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelUnexpectedArgEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelUnexpectedArgEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelUnexpectedArgEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelUnexpectedArgStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelUnexpectedArg; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelUnexpectedArg; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelUnexpectedArg, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_unexpected_argDispatcherTrait { - fn ensure_abi(self: T, model: BadModelUnexpectedArg); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_argDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_unexpected_argDispatcherImpl of Ibad_model_unexpected_argDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_argDispatcher, model: BadModelUnexpectedArg) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_argLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_unexpected_argLibraryDispatcherImpl of Ibad_model_unexpected_argDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_argLibraryDispatcher, model: BadModelUnexpectedArg) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_unexpected_argSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelUnexpectedArg) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_argSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_unexpected_argSafeLibraryDispatcherImpl of Ibad_model_unexpected_argSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_argSafeLibraryDispatcher, model: BadModelUnexpectedArg) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_unexpected_argSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_unexpected_argSafeDispatcherImpl of Ibad_model_unexpected_argSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_unexpected_argSafeDispatcher, model: BadModelUnexpectedArg) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl BadModelNotSupportedVersionEntityDrop of core::traits::Drop::; -impl BadModelNotSupportedVersionEntitySerde of core::serde::Serde:: { - fn serialize(self: @BadModelNotSupportedVersionEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(BadModelNotSupportedVersionEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait BadModelNotSupportedVersionEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> BadModelNotSupportedVersionEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @BadModelNotSupportedVersionEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait BadModelNotSupportedVersionStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> BadModelNotSupportedVersion; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> BadModelNotSupportedVersion; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @BadModelNotSupportedVersion, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Ibad_model_not_supported_versionDispatcherTrait { - fn ensure_abi(self: T, model: BadModelNotSupportedVersion); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_not_supported_versionDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_not_supported_versionDispatcherImpl of Ibad_model_not_supported_versionDispatcherTrait { - fn ensure_abi(self: Ibad_model_not_supported_versionDispatcher, model: BadModelNotSupportedVersion) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_not_supported_versionLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_not_supported_versionLibraryDispatcherImpl of Ibad_model_not_supported_versionDispatcherTrait { - fn ensure_abi(self: Ibad_model_not_supported_versionLibraryDispatcher, model: BadModelNotSupportedVersion) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ibad_model_not_supported_versionSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: BadModelNotSupportedVersion) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_not_supported_versionSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ibad_model_not_supported_versionSafeLibraryDispatcherImpl of Ibad_model_not_supported_versionSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_not_supported_versionSafeLibraryDispatcher, model: BadModelNotSupportedVersion) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ibad_model_not_supported_versionSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ibad_model_not_supported_versionSafeDispatcherImpl of Ibad_model_not_supported_versionSafeDispatcherTrait { - fn ensure_abi(self: Ibad_model_not_supported_versionSafeDispatcher, model: BadModelNotSupportedVersion) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl Modelv0EntityDrop of core::traits::Drop::; -impl Modelv0EntitySerde of core::serde::Serde:: { - fn serialize(self: @Modelv0Entity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Modelv0Entity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait Modelv0EntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Modelv0Entity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @Modelv0Entity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Modelv0Store { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> Modelv0; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> Modelv0; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @Modelv0, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Imodelv_0DispatcherTrait { - fn ensure_abi(self: T, model: Modelv0); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodelv_0Dispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodelv_0DispatcherImpl of Imodelv_0DispatcherTrait { - fn ensure_abi(self: Imodelv_0Dispatcher, model: Modelv0) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodelv_0LibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodelv_0LibraryDispatcherImpl of Imodelv_0DispatcherTrait { - fn ensure_abi(self: Imodelv_0LibraryDispatcher, model: Modelv0) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodelv_0SafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: Modelv0) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodelv_0SafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodelv_0SafeLibraryDispatcherImpl of Imodelv_0SafeDispatcherTrait { - fn ensure_abi(self: Imodelv_0SafeLibraryDispatcher, model: Modelv0) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodelv_0SafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodelv_0SafeDispatcherImpl of Imodelv_0SafeDispatcherTrait { - fn ensure_abi(self: Imodelv_0SafeDispatcher, model: Modelv0) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithBadNamespaceFormatEntityDrop of core::traits::Drop::; -impl ModelWithBadNamespaceFormatEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithBadNamespaceFormatEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithBadNamespaceFormatEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithBadNamespaceFormatEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithBadNamespaceFormatEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @ModelWithBadNamespaceFormatEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait ModelWithBadNamespaceFormatStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithBadNamespaceFormat; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithBadNamespaceFormat; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @ModelWithBadNamespaceFormat, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Imodel_with_bad_namespace_formatDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithBadNamespaceFormat); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_bad_namespace_formatDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_bad_namespace_formatDispatcherImpl of Imodel_with_bad_namespace_formatDispatcherTrait { - fn ensure_abi(self: Imodel_with_bad_namespace_formatDispatcher, model: ModelWithBadNamespaceFormat) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_bad_namespace_formatLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_bad_namespace_formatLibraryDispatcherImpl of Imodel_with_bad_namespace_formatDispatcherTrait { - fn ensure_abi(self: Imodel_with_bad_namespace_formatLibraryDispatcher, model: ModelWithBadNamespaceFormat) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_bad_namespace_formatSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithBadNamespaceFormat) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_bad_namespace_formatSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherImpl of Imodel_with_bad_namespace_formatSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_bad_namespace_formatSafeLibraryDispatcher, model: ModelWithBadNamespaceFormat) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_bad_namespace_formatSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_bad_namespace_formatSafeDispatcherImpl of Imodel_with_bad_namespace_formatSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_bad_namespace_formatSafeDispatcher, model: ModelWithBadNamespaceFormat) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithShortStringNamespaceEntityDrop of core::traits::Drop::; -impl ModelWithShortStringNamespaceEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithShortStringNamespaceEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithShortStringNamespaceEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithShortStringNamespaceEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithShortStringNamespaceEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @ModelWithShortStringNamespaceEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait ModelWithShortStringNamespaceStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithShortStringNamespace; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithShortStringNamespace; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @ModelWithShortStringNamespace, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Imodel_with_short_string_namespaceDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithShortStringNamespace); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_short_string_namespaceDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_short_string_namespaceDispatcherImpl of Imodel_with_short_string_namespaceDispatcherTrait { - fn ensure_abi(self: Imodel_with_short_string_namespaceDispatcher, model: ModelWithShortStringNamespace) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_short_string_namespaceLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_short_string_namespaceLibraryDispatcherImpl of Imodel_with_short_string_namespaceDispatcherTrait { - fn ensure_abi(self: Imodel_with_short_string_namespaceLibraryDispatcher, model: ModelWithShortStringNamespace) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_short_string_namespaceSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithShortStringNamespace) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_short_string_namespaceSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherImpl of Imodel_with_short_string_namespaceSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_short_string_namespaceSafeLibraryDispatcher, model: ModelWithShortStringNamespace) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_short_string_namespaceSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_short_string_namespaceSafeDispatcherImpl of Imodel_with_short_string_namespaceSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_short_string_namespaceSafeDispatcher, model: ModelWithShortStringNamespace) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithStringNamespaceEntityDrop of core::traits::Drop::; -impl ModelWithStringNamespaceEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithStringNamespaceEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithStringNamespaceEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithStringNamespaceEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithStringNamespaceEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @ModelWithStringNamespaceEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait ModelWithStringNamespaceStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithStringNamespace; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> ModelWithStringNamespace; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @ModelWithStringNamespace, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait Imodel_with_string_namespaceDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithStringNamespace); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_string_namespaceDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_string_namespaceDispatcherImpl of Imodel_with_string_namespaceDispatcherTrait { - fn ensure_abi(self: Imodel_with_string_namespaceDispatcher, model: ModelWithStringNamespace) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_string_namespaceLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_string_namespaceLibraryDispatcherImpl of Imodel_with_string_namespaceDispatcherTrait { - fn ensure_abi(self: Imodel_with_string_namespaceLibraryDispatcher, model: ModelWithStringNamespace) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_string_namespaceSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithStringNamespace) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_string_namespaceSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_string_namespaceSafeLibraryDispatcherImpl of Imodel_with_string_namespaceSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_string_namespaceSafeLibraryDispatcher, model: ModelWithStringNamespace) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_string_namespaceSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_string_namespaceSafeDispatcherImpl of Imodel_with_string_namespaceSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_string_namespaceSafeDispatcher, model: ModelWithStringNamespace) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl PositionEntityDrop of core::traits::Drop::; -impl PositionEntitySerde of core::serde::Serde:: { - fn serialize(self: @PositionEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.v, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(PositionEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - v: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait PositionEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PositionEntity; - - - fn get_v(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Vec3; - - fn set_v(self: @PositionEntity, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait PositionStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> Position; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> Position; - - - fn get_v(world: dojo::world::IWorldDispatcher, id: felt252) -> Vec3; - - fn set_v(self: @Position, world: dojo::world::IWorldDispatcher, value: Vec3); - -} -pub trait IpositionDispatcherTrait { - fn ensure_abi(self: T, model: Position); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IpositionDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IpositionDispatcherImpl of IpositionDispatcherTrait { - fn ensure_abi(self: IpositionDispatcher, model: Position) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IpositionLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IpositionLibraryDispatcherImpl of IpositionDispatcherTrait { - fn ensure_abi(self: IpositionLibraryDispatcher, model: Position) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait IpositionSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: Position) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IpositionSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IpositionSafeLibraryDispatcherImpl of IpositionSafeDispatcherTrait { - fn ensure_abi(self: IpositionSafeLibraryDispatcher, model: Position) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IpositionSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IpositionSafeDispatcherImpl of IpositionSafeDispatcherTrait { - fn ensure_abi(self: IpositionSafeDispatcher, model: Position) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl RolesEntityDrop of core::traits::Drop::; -impl RolesEntitySerde of core::serde::Serde:: { - fn serialize(self: @RolesEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.role_ids, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(RolesEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - role_ids: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait RolesEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> RolesEntity; - - - fn get_role_ids(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array; - - fn set_role_ids(self: @RolesEntity, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait RolesStore { - fn entity_id_from_keys() -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> Roles; - - fn get(world: dojo::world::IWorldDispatcher, ) -> Roles; - - - fn get_role_ids(world: dojo::world::IWorldDispatcher, ) -> Array; - - fn set_role_ids(self: @Roles, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait IrolesDispatcherTrait { - fn ensure_abi(self: T, model: Roles); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IrolesDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IrolesDispatcherImpl of IrolesDispatcherTrait { - fn ensure_abi(self: IrolesDispatcher, model: Roles) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IrolesLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IrolesLibraryDispatcherImpl of IrolesDispatcherTrait { - fn ensure_abi(self: IrolesLibraryDispatcher, model: Roles) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait IrolesSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: Roles) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IrolesSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IrolesSafeLibraryDispatcherImpl of IrolesSafeDispatcherTrait { - fn ensure_abi(self: IrolesSafeLibraryDispatcher, model: Roles) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IrolesSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IrolesSafeDispatcherImpl of IrolesSafeDispatcherTrait { - fn ensure_abi(self: IrolesSafeDispatcher, model: Roles) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl OnlyKeyModelEntityDrop of core::traits::Drop::; -impl OnlyKeyModelEntitySerde of core::serde::Serde:: { - fn serialize(self: @OnlyKeyModelEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(OnlyKeyModelEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait OnlyKeyModelEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> OnlyKeyModelEntity; - - -} -pub trait OnlyKeyModelStore { - fn entity_id_from_keys(id: felt252) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> OnlyKeyModel; - - fn get(world: dojo::world::IWorldDispatcher, id: felt252) -> OnlyKeyModel; - - -} -pub trait Ionly_key_modelDispatcherTrait { - fn ensure_abi(self: T, model: OnlyKeyModel); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ionly_key_modelDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ionly_key_modelDispatcherImpl of Ionly_key_modelDispatcherTrait { - fn ensure_abi(self: Ionly_key_modelDispatcher, model: OnlyKeyModel) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ionly_key_modelLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ionly_key_modelLibraryDispatcherImpl of Ionly_key_modelDispatcherTrait { - fn ensure_abi(self: Ionly_key_modelLibraryDispatcher, model: OnlyKeyModel) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Ionly_key_modelSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: OnlyKeyModel) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ionly_key_modelSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Ionly_key_modelSafeLibraryDispatcherImpl of Ionly_key_modelSafeDispatcherTrait { - fn ensure_abi(self: Ionly_key_modelSafeLibraryDispatcher, model: OnlyKeyModel) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Ionly_key_modelSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Ionly_key_modelSafeDispatcherImpl of Ionly_key_modelSafeDispatcherTrait { - fn ensure_abi(self: Ionly_key_modelSafeDispatcher, model: OnlyKeyModel) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl U256KeyModelEntityDrop of core::traits::Drop::; -impl U256KeyModelEntitySerde of core::serde::Serde:: { - fn serialize(self: @U256KeyModelEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(U256KeyModelEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait U256KeyModelEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> U256KeyModelEntity; - - -} -pub trait U256KeyModelStore { - fn entity_id_from_keys(id: u256) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> U256KeyModel; - - fn get(world: dojo::world::IWorldDispatcher, id: u256) -> U256KeyModel; - - -} -pub trait Iu_256_key_modelDispatcherTrait { - fn ensure_abi(self: T, model: U256KeyModel); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Iu_256_key_modelDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Iu_256_key_modelDispatcherImpl of Iu_256_key_modelDispatcherTrait { - fn ensure_abi(self: Iu_256_key_modelDispatcher, model: U256KeyModel) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Iu_256_key_modelLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Iu_256_key_modelLibraryDispatcherImpl of Iu_256_key_modelDispatcherTrait { - fn ensure_abi(self: Iu_256_key_modelLibraryDispatcher, model: U256KeyModel) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Iu_256_key_modelSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: U256KeyModel) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Iu_256_key_modelSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Iu_256_key_modelSafeLibraryDispatcherImpl of Iu_256_key_modelSafeDispatcherTrait { - fn ensure_abi(self: Iu_256_key_modelSafeLibraryDispatcher, model: U256KeyModel) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Iu_256_key_modelSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Iu_256_key_modelSafeDispatcherImpl of Iu_256_key_modelSafeDispatcherTrait { - fn ensure_abi(self: Iu_256_key_modelSafeDispatcher, model: U256KeyModel) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl PlayerEntityDrop of core::traits::Drop::; -impl PlayerEntitySerde of core::serde::Serde:: { - fn serialize(self: @PlayerEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.name, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(PlayerEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - name: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait PlayerEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> PlayerEntity; - - - fn get_name(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> felt252; - - fn set_name(self: @PlayerEntity, world: dojo::world::IWorldDispatcher, value: felt252); - -} -pub trait PlayerStore { - fn entity_id_from_keys(game: felt252, player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> Player; - - fn get(world: dojo::world::IWorldDispatcher, game: felt252, player: ContractAddress) -> Player; - - - fn get_name(world: dojo::world::IWorldDispatcher, game: felt252, player: ContractAddress) -> felt252; - - fn set_name(self: @Player, world: dojo::world::IWorldDispatcher, value: felt252); - -} -pub trait IplayerDispatcherTrait { - fn ensure_abi(self: T, model: Player); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IplayerDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IplayerDispatcherImpl of IplayerDispatcherTrait { - fn ensure_abi(self: IplayerDispatcher, model: Player) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IplayerLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IplayerLibraryDispatcherImpl of IplayerDispatcherTrait { - fn ensure_abi(self: IplayerLibraryDispatcher, model: Player) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait IplayerSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: Player) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IplayerSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IplayerSafeLibraryDispatcherImpl of IplayerSafeDispatcherTrait { - fn ensure_abi(self: IplayerSafeLibraryDispatcher, model: Player) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct IplayerSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IplayerSafeDispatcherImpl of IplayerSafeDispatcherTrait { - fn ensure_abi(self: IplayerSafeDispatcher, model: Player) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithSimpleArrayEntityDrop of core::traits::Drop::; -impl ModelWithSimpleArrayEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithSimpleArrayEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.x, ref output); - core::serde::Serde::serialize(self.y, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithSimpleArrayEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - x: core::serde::Serde::deserialize(ref serialized)?, - y: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithSimpleArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithSimpleArrayEntity; - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16; - - fn set_x(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array; - - fn set_y(self: @ModelWithSimpleArrayEntity, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait ModelWithSimpleArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithSimpleArray; - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithSimpleArray; - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16; - - fn set_x(self: @ModelWithSimpleArray, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> Array; - - fn set_y(self: @ModelWithSimpleArray, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait Imodel_with_simple_arrayDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithSimpleArray); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_simple_arrayDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_simple_arrayDispatcherImpl of Imodel_with_simple_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_simple_arrayDispatcher, model: ModelWithSimpleArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_simple_arrayLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_simple_arrayLibraryDispatcherImpl of Imodel_with_simple_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_simple_arrayLibraryDispatcher, model: ModelWithSimpleArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_simple_arraySafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithSimpleArray) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_simple_arraySafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_simple_arraySafeLibraryDispatcherImpl of Imodel_with_simple_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_simple_arraySafeLibraryDispatcher, model: ModelWithSimpleArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_simple_arraySafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_simple_arraySafeDispatcherImpl of Imodel_with_simple_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_simple_arraySafeDispatcher, model: ModelWithSimpleArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithByteArrayEntityDrop of core::traits::Drop::; -impl ModelWithByteArrayEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithByteArrayEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.x, ref output); - core::serde::Serde::serialize(self.y, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithByteArrayEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - x: core::serde::Serde::deserialize(ref serialized)?, - y: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithByteArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithByteArrayEntity; - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16; - - fn set_x(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ByteArray; - - fn set_y(self: @ModelWithByteArrayEntity, world: dojo::world::IWorldDispatcher, value: ByteArray); - -} -pub trait ModelWithByteArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithByteArray; - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithByteArray; - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16; - - fn set_x(self: @ModelWithByteArray, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ByteArray; - - fn set_y(self: @ModelWithByteArray, world: dojo::world::IWorldDispatcher, value: ByteArray); - -} -pub trait Imodel_with_byte_arrayDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithByteArray); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_byte_arrayDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_byte_arrayDispatcherImpl of Imodel_with_byte_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_byte_arrayDispatcher, model: ModelWithByteArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_byte_arrayLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_byte_arrayLibraryDispatcherImpl of Imodel_with_byte_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_byte_arrayLibraryDispatcher, model: ModelWithByteArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_byte_arraySafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithByteArray) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_byte_arraySafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_byte_arraySafeLibraryDispatcherImpl of Imodel_with_byte_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_byte_arraySafeLibraryDispatcher, model: ModelWithByteArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_byte_arraySafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_byte_arraySafeDispatcherImpl of Imodel_with_byte_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_byte_arraySafeDispatcher, model: ModelWithByteArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithComplexArrayEntityDrop of core::traits::Drop::; -impl ModelWithComplexArrayEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithComplexArrayEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.x, ref output); - core::serde::Serde::serialize(self.y, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithComplexArrayEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - x: core::serde::Serde::deserialize(ref serialized)?, - y: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithComplexArrayEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithComplexArrayEntity; - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16; - - fn set_x(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> Array; - - fn set_y(self: @ModelWithComplexArrayEntity, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait ModelWithComplexArrayStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithComplexArray; - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithComplexArray; - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16; - - fn set_x(self: @ModelWithComplexArray, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> Array; - - fn set_y(self: @ModelWithComplexArray, world: dojo::world::IWorldDispatcher, value: Array); - -} -pub trait Imodel_with_complex_arrayDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithComplexArray); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_complex_arrayDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_complex_arrayDispatcherImpl of Imodel_with_complex_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_complex_arrayDispatcher, model: ModelWithComplexArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_complex_arrayLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_complex_arrayLibraryDispatcherImpl of Imodel_with_complex_arrayDispatcherTrait { - fn ensure_abi(self: Imodel_with_complex_arrayLibraryDispatcher, model: ModelWithComplexArray) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_complex_arraySafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithComplexArray) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_complex_arraySafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_complex_arraySafeLibraryDispatcherImpl of Imodel_with_complex_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_complex_arraySafeLibraryDispatcher, model: ModelWithComplexArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_complex_arraySafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_complex_arraySafeDispatcherImpl of Imodel_with_complex_arraySafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_complex_arraySafeDispatcher, model: ModelWithComplexArray) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithTupleEntityDrop of core::traits::Drop::; -impl ModelWithTupleEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithTupleEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.x, ref output); - core::serde::Serde::serialize(self.y, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithTupleEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - x: core::serde::Serde::deserialize(ref serialized)?, - y: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithTupleEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleEntity; - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16; - - fn set_x(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> (u8, u16, u32); - - fn set_y(self: @ModelWithTupleEntity, world: dojo::world::IWorldDispatcher, value: (u8, u16, u32)); - -} -pub trait ModelWithTupleStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithTuple; - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithTuple; - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16; - - fn set_x(self: @ModelWithTuple, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> (u8, u16, u32); - - fn set_y(self: @ModelWithTuple, world: dojo::world::IWorldDispatcher, value: (u8, u16, u32)); - -} -pub trait Imodel_with_tupleDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithTuple); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tupleDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_tupleDispatcherImpl of Imodel_with_tupleDispatcherTrait { - fn ensure_abi(self: Imodel_with_tupleDispatcher, model: ModelWithTuple) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tupleLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_tupleLibraryDispatcherImpl of Imodel_with_tupleDispatcherTrait { - fn ensure_abi(self: Imodel_with_tupleLibraryDispatcher, model: ModelWithTuple) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_tupleSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithTuple) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tupleSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_tupleSafeLibraryDispatcherImpl of Imodel_with_tupleSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_tupleSafeLibraryDispatcher, model: ModelWithTuple) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tupleSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_tupleSafeDispatcherImpl of Imodel_with_tupleSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_tupleSafeDispatcher, model: ModelWithTuple) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ModelWithTupleNoPrimitivesEntityDrop of core::traits::Drop::; -impl ModelWithTupleNoPrimitivesEntitySerde of core::serde::Serde:: { - fn serialize(self: @ModelWithTupleNoPrimitivesEntity, ref output: core::array::Array) { - core::serde::Serde::serialize(self.__id, ref output); - core::serde::Serde::serialize(self.x, ref output); - core::serde::Serde::serialize(self.y, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(ModelWithTupleNoPrimitivesEntity { - __id: core::serde::Serde::deserialize(ref serialized)?, - x: core::serde::Serde::deserialize(ref serialized)?, - y: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -pub trait ModelWithTupleNoPrimitivesEntityStore { - fn get(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> ModelWithTupleNoPrimitivesEntity; - - - fn get_x(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> u16; - - fn set_x(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, entity_id: felt252) -> (u8, Vec3, u32); - - fn set_y(self: @ModelWithTupleNoPrimitivesEntity, world: dojo::world::IWorldDispatcher, value: (u8, Vec3, u32)); - -} -pub trait ModelWithTupleNoPrimitivesStore { - fn entity_id_from_keys(player: ContractAddress) -> felt252; - - fn from_values(ref keys: Span, ref values: Span) -> ModelWithTupleNoPrimitives; - - fn get(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> ModelWithTupleNoPrimitives; - - - fn get_x(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> u16; - - fn set_x(self: @ModelWithTupleNoPrimitives, world: dojo::world::IWorldDispatcher, value: u16); - - fn get_y(world: dojo::world::IWorldDispatcher, player: ContractAddress) -> (u8, Vec3, u32); - - fn set_y(self: @ModelWithTupleNoPrimitives, world: dojo::world::IWorldDispatcher, value: (u8, Vec3, u32)); - -} -pub trait Imodel_with_tuple_no_primitivesDispatcherTrait { - fn ensure_abi(self: T, model: ModelWithTupleNoPrimitives); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tuple_no_primitivesDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_tuple_no_primitivesDispatcherImpl of Imodel_with_tuple_no_primitivesDispatcherTrait { - fn ensure_abi(self: Imodel_with_tuple_no_primitivesDispatcher, model: ModelWithTupleNoPrimitives) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tuple_no_primitivesLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_tuple_no_primitivesLibraryDispatcherImpl of Imodel_with_tuple_no_primitivesDispatcherTrait { - fn ensure_abi(self: Imodel_with_tuple_no_primitivesLibraryDispatcher, model: ModelWithTupleNoPrimitives) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -pub trait Imodel_with_tuple_no_primitivesSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn ensure_abi(self: T, model: ModelWithTupleNoPrimitives) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tuple_no_primitivesSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherImpl of Imodel_with_tuple_no_primitivesSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_tuple_no_primitivesSafeLibraryDispatcher, model: ModelWithTupleNoPrimitives) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -pub struct Imodel_with_tuple_no_primitivesSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl Imodel_with_tuple_no_primitivesSafeDispatcherImpl of Imodel_with_tuple_no_primitivesSafeDispatcherTrait { - fn ensure_abi(self: Imodel_with_tuple_no_primitivesSafeDispatcher, model: ModelWithTupleNoPrimitives) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@model, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("ensure_abi"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl Ibad_model_multiple_versionsDispatcherCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsDispatcherDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_multiple_versionsDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_multiple_versionsDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_multiple_versionsDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_multiple_versionsDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_multiple_versionsDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_multiple_versionsDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_multiple_versionsDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_multiple_versionsDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_multiple_versionsDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_multiple_versionsDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_multiple_versionsDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_multiple_versionsDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_multiple_versionsDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_multiple_versionsDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_multiple_versionsDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_multiple_versionsLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_multiple_versionsLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_multiple_versionsLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_multiple_versionsLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_multiple_versionsLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_multiple_versionsLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_multiple_versionsLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_multiple_versionsLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_multiple_versionsLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_multiple_versionsLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_multiple_versionsLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_multiple_versionsLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_multiple_versionsLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_multiple_versionsLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_multiple_versionsLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_multiple_versionsLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_multiple_versionsSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_multiple_versionsSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_multiple_versionsSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_multiple_versionsSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_multiple_versionsSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_multiple_versionsSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_multiple_versionsSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_multiple_versionsSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_multiple_versionsSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_multiple_versionsSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_multiple_versionsSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_multiple_versionsSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_multiple_versionsSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_multiple_versionsSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_multiple_versionsSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_multiple_versionsSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_multiple_versionsSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_multiple_versionsSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_multiple_versionsSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_multiple_versionsSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_multiple_versionsSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_multiple_versionsSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_multiple_versionsSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_bad_version_typeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_bad_version_typeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_bad_version_typeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_bad_version_typeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_bad_version_typeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_bad_version_typeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_bad_version_typeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_bad_version_typeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_bad_version_typeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_bad_version_typeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_bad_version_typeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_bad_version_typeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_bad_version_typeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_bad_version_typeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_bad_version_typeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_bad_version_typeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_bad_version_typeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_bad_version_typeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_bad_version_typeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_bad_version_typeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_bad_version_typeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_bad_version_typeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_bad_version_typeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_bad_version_typeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_bad_version_typeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_bad_version_typeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_bad_version_typeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_bad_version_typeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_bad_version_typeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_bad_version_typeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_bad_version_typeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_bad_version_typeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_bad_version_typeSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_bad_version_typeSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_bad_version_typeSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_bad_version_typeSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_bad_version_typeSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_bad_version_typeSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_bad_version_typeSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_bad_version_typeSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_bad_version_typeSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_bad_version_typeSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_bad_version_typeSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_bad_version_typeSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_bad_version_typeSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_bad_version_typeSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_bad_version_typeSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_bad_version_typeSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_bad_version_typeSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_bad_version_typeSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_bad_version_typeSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_bad_version_typeSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_bad_version_typeSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_bad_version_typeSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_bad_version_typeSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_no_version_valueDispatcherCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueDispatcherDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_no_version_valueDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_no_version_valueDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_no_version_valueDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_no_version_valueDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_no_version_valueDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_no_version_valueDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_no_version_valueDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_no_version_valueDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_no_version_valueDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_no_version_valueDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_no_version_valueDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_no_version_valueDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_no_version_valueDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_no_version_valueDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_no_version_valueDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_no_version_valueLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_no_version_valueLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_no_version_valueLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_no_version_valueLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_no_version_valueLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_no_version_valueLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_no_version_valueLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_no_version_valueLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_no_version_valueLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_no_version_valueLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_no_version_valueLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_no_version_valueLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_no_version_valueLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_no_version_valueLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_no_version_valueLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_no_version_valueLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_no_version_valueSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_no_version_valueSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_no_version_valueSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_no_version_valueSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_no_version_valueSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_no_version_valueSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_no_version_valueSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_no_version_valueSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_no_version_valueSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_no_version_valueSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_no_version_valueSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_no_version_valueSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_no_version_valueSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_no_version_valueSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_no_version_valueSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_no_version_valueSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_no_version_valueSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_no_version_valueSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_no_version_valueSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_no_version_valueSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_no_version_valueSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_no_version_valueSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_no_version_valueSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_no_version_valueSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_no_version_valueSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_no_version_valueSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_no_version_valueSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_no_version_valueSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_unexpected_arg_with_valueDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_arg_with_valueDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_arg_with_valueDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_arg_with_valueDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_arg_with_valueDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_arg_with_valueDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_arg_with_valueDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_arg_with_valueDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_arg_with_valueDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_arg_with_valueDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_arg_with_valueDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_arg_with_valueLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_arg_with_valueLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_arg_with_valueLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_arg_with_valueLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_arg_with_valueLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_arg_with_valueSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_arg_with_valueSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_arg_with_valueSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_arg_with_valueSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_arg_with_valueSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_arg_with_valueSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_arg_with_valueSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_unexpected_argDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_argDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_argDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_argDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_argDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_argDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_argDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_argDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_argDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_argDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_argDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_argDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_argDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_argDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_argDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_argDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_unexpected_argLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_argLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_argLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_argLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_argLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_argLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_argLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_argLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_argLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_argLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_argLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_argLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_argLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_argLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_argLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_argLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_unexpected_argSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_argSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_argSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_argSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_argSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_argSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_argSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_argSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_argSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_argSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_argSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_unexpected_argSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_unexpected_argSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_unexpected_argSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_unexpected_argSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_unexpected_argSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_unexpected_argSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_unexpected_argSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_unexpected_argSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_unexpected_argSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_unexpected_argSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_unexpected_argSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_unexpected_argSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_unexpected_argSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_unexpected_argSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_unexpected_argSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_unexpected_argSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_unexpected_argSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_not_supported_versionDispatcherCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionDispatcherDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_not_supported_versionDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_not_supported_versionDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_not_supported_versionDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_not_supported_versionDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_not_supported_versionDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_not_supported_versionDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_not_supported_versionDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_not_supported_versionDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_not_supported_versionDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_not_supported_versionDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_not_supported_versionDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_not_supported_versionDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_not_supported_versionDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_not_supported_versionDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_not_supported_versionDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_not_supported_versionLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_not_supported_versionLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_not_supported_versionLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_not_supported_versionLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_not_supported_versionLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_not_supported_versionLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_not_supported_versionLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_not_supported_versionLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_not_supported_versionLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_not_supported_versionLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_not_supported_versionLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_not_supported_versionLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_not_supported_versionLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_not_supported_versionLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_not_supported_versionLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_not_supported_versionLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_not_supported_versionSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_not_supported_versionSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_not_supported_versionSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_not_supported_versionSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_not_supported_versionSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_not_supported_versionSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ibad_model_not_supported_versionSafeDispatcherCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionSafeDispatcherDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ibad_model_not_supported_versionSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ibad_model_not_supported_versionSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIbad_model_not_supported_versionSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ibad_model_not_supported_versionSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ibad_model_not_supported_versionSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ibad_model_not_supported_versionSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ibad_model_not_supported_versionSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ibad_model_not_supported_versionSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ibad_model_not_supported_versionSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ibad_model_not_supported_versionSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ibad_model_not_supported_versionSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIbad_model_not_supported_versionSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIbad_model_not_supported_versionSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIbad_model_not_supported_versionSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIbad_model_not_supported_versionSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIbad_model_not_supported_versionSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodelv_0DispatcherCopy of core::traits::Copy::; -impl Imodelv_0DispatcherDrop of core::traits::Drop::; -impl Imodelv_0DispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodelv_0Dispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodelv_0Dispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodelv_0Dispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodelv_0Dispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodelv_0Dispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodelv_0Dispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodelv_0Dispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodelv_0DispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodelv_0DispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodelv_0DispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodelv_0DispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodelv_0DispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodelv_0DispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodelv_0DispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodelv_0DispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodelv_0DispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodelv_0DispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodelv_0LibraryDispatcherCopy of core::traits::Copy::; -impl Imodelv_0LibraryDispatcherDrop of core::traits::Drop::; -impl Imodelv_0LibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodelv_0LibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodelv_0LibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodelv_0LibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodelv_0LibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodelv_0LibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodelv_0LibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodelv_0LibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodelv_0LibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodelv_0LibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodelv_0LibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodelv_0LibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodelv_0LibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodelv_0LibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodelv_0LibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodelv_0LibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodelv_0LibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodelv_0LibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodelv_0SafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodelv_0SafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodelv_0SafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodelv_0SafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodelv_0SafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodelv_0SafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodelv_0SafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodelv_0SafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodelv_0SafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodelv_0SafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodelv_0SafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodelv_0SafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodelv_0SafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodelv_0SafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodelv_0SafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodelv_0SafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodelv_0SafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodelv_0SafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodelv_0SafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodelv_0SafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodelv_0SafeDispatcherCopy of core::traits::Copy::; -impl Imodelv_0SafeDispatcherDrop of core::traits::Drop::; -impl Imodelv_0SafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodelv_0SafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodelv_0SafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodelv_0SafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodelv_0SafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodelv_0SafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodelv_0SafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodelv_0SafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodelv_0SafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodelv_0SafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodelv_0SafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodelv_0SafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodelv_0SafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodelv_0SafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodelv_0SafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodelv_0SafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodelv_0SafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodelv_0SafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_bad_namespace_formatDispatcherCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatDispatcherDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_bad_namespace_formatDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_bad_namespace_formatDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_bad_namespace_formatDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_bad_namespace_formatDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_bad_namespace_formatDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_bad_namespace_formatDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_bad_namespace_formatDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_bad_namespace_formatDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_bad_namespace_formatDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_bad_namespace_formatDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_bad_namespace_formatDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_bad_namespace_formatDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_bad_namespace_formatDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_bad_namespace_formatDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_bad_namespace_formatDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_bad_namespace_formatLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_bad_namespace_formatLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_bad_namespace_formatLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_bad_namespace_formatLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_bad_namespace_formatLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_bad_namespace_formatLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_bad_namespace_formatLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_bad_namespace_formatLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_bad_namespace_formatSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_bad_namespace_formatSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_bad_namespace_formatSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_bad_namespace_formatSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_bad_namespace_formatSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_bad_namespace_formatSafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatSafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_bad_namespace_formatSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_bad_namespace_formatSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_bad_namespace_formatSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_bad_namespace_formatSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_bad_namespace_formatSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_bad_namespace_formatSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_bad_namespace_formatSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_bad_namespace_formatSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_bad_namespace_formatSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_bad_namespace_formatSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_bad_namespace_formatSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_short_string_namespaceDispatcherCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceDispatcherDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_short_string_namespaceDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_short_string_namespaceDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_short_string_namespaceDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_short_string_namespaceDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_short_string_namespaceDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_short_string_namespaceDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_short_string_namespaceDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_short_string_namespaceDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_short_string_namespaceDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_short_string_namespaceDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_short_string_namespaceDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_short_string_namespaceDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_short_string_namespaceDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_short_string_namespaceDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_short_string_namespaceDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_short_string_namespaceLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_short_string_namespaceLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_short_string_namespaceLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_short_string_namespaceLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_short_string_namespaceLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_short_string_namespaceLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_short_string_namespaceLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_short_string_namespaceLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_short_string_namespaceLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_short_string_namespaceLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_short_string_namespaceLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_short_string_namespaceSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_short_string_namespaceSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_short_string_namespaceSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_short_string_namespaceSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_short_string_namespaceSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_short_string_namespaceSafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceSafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_short_string_namespaceSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_short_string_namespaceSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_short_string_namespaceSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_short_string_namespaceSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_short_string_namespaceSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_short_string_namespaceSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_short_string_namespaceSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_short_string_namespaceSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_short_string_namespaceSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_short_string_namespaceSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_short_string_namespaceSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_short_string_namespaceSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_short_string_namespaceSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_short_string_namespaceSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_short_string_namespaceSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_short_string_namespaceSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_string_namespaceDispatcherCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceDispatcherDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_string_namespaceDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_string_namespaceDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_string_namespaceDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_string_namespaceDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_string_namespaceDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_string_namespaceDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_string_namespaceDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_string_namespaceDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_string_namespaceDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_string_namespaceDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_string_namespaceDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_string_namespaceDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_string_namespaceDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_string_namespaceDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_string_namespaceDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_string_namespaceLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_string_namespaceLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_string_namespaceLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_string_namespaceLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_string_namespaceLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_string_namespaceLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_string_namespaceLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_string_namespaceLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_string_namespaceLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_string_namespaceLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_string_namespaceLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_string_namespaceLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_string_namespaceLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_string_namespaceLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_string_namespaceLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_string_namespaceLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_string_namespaceSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_string_namespaceSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_string_namespaceSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_string_namespaceSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_string_namespaceSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_string_namespaceSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_string_namespaceSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_string_namespaceSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_string_namespaceSafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceSafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_string_namespaceSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_string_namespaceSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_string_namespaceSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_string_namespaceSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_string_namespaceSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_string_namespaceSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_string_namespaceSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_string_namespaceSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_string_namespaceSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_string_namespaceSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_string_namespaceSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_string_namespaceSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_string_namespaceSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_string_namespaceSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_string_namespaceSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_string_namespaceSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IpositionDispatcherCopy of core::traits::Copy::; -impl IpositionDispatcherDrop of core::traits::Drop::; -impl IpositionDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IpositionDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IpositionDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIpositionDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IpositionDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IpositionDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IpositionDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IpositionDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IpositionDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IpositionDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IpositionDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IpositionDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IpositionDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIpositionDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIpositionDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIpositionDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIpositionDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIpositionDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IpositionLibraryDispatcherCopy of core::traits::Copy::; -impl IpositionLibraryDispatcherDrop of core::traits::Drop::; -impl IpositionLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IpositionLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IpositionLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIpositionLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IpositionLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IpositionLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IpositionLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IpositionLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IpositionLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IpositionLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IpositionLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IpositionLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IpositionLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIpositionLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIpositionLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIpositionLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIpositionLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIpositionLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IpositionSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IpositionSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IpositionSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IpositionSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IpositionSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIpositionSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IpositionSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IpositionSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IpositionSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IpositionSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IpositionSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IpositionSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IpositionSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IpositionSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IpositionSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIpositionSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIpositionSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIpositionSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIpositionSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIpositionSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IpositionSafeDispatcherCopy of core::traits::Copy::; -impl IpositionSafeDispatcherDrop of core::traits::Drop::; -impl IpositionSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IpositionSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IpositionSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIpositionSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IpositionSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IpositionSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IpositionSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IpositionSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IpositionSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IpositionSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IpositionSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IpositionSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IpositionSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIpositionSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIpositionSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIpositionSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIpositionSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIpositionSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IrolesDispatcherCopy of core::traits::Copy::; -impl IrolesDispatcherDrop of core::traits::Drop::; -impl IrolesDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IrolesDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IrolesDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIrolesDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IrolesDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IrolesDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IrolesDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IrolesDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IrolesDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IrolesDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IrolesDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IrolesDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IrolesDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIrolesDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIrolesDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIrolesDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIrolesDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIrolesDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IrolesLibraryDispatcherCopy of core::traits::Copy::; -impl IrolesLibraryDispatcherDrop of core::traits::Drop::; -impl IrolesLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IrolesLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IrolesLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIrolesLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IrolesLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IrolesLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IrolesLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IrolesLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IrolesLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IrolesLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IrolesLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IrolesLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IrolesLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIrolesLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIrolesLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIrolesLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIrolesLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIrolesLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IrolesSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IrolesSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IrolesSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IrolesSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IrolesSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIrolesSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IrolesSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IrolesSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IrolesSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IrolesSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IrolesSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IrolesSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IrolesSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IrolesSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IrolesSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIrolesSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIrolesSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIrolesSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIrolesSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIrolesSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IrolesSafeDispatcherCopy of core::traits::Copy::; -impl IrolesSafeDispatcherDrop of core::traits::Drop::; -impl IrolesSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IrolesSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IrolesSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIrolesSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IrolesSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IrolesSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IrolesSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IrolesSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IrolesSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IrolesSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IrolesSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IrolesSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IrolesSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIrolesSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIrolesSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIrolesSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIrolesSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIrolesSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ionly_key_modelDispatcherCopy of core::traits::Copy::; -impl Ionly_key_modelDispatcherDrop of core::traits::Drop::; -impl Ionly_key_modelDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ionly_key_modelDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ionly_key_modelDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIonly_key_modelDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ionly_key_modelDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ionly_key_modelDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ionly_key_modelDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ionly_key_modelDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ionly_key_modelDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ionly_key_modelDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ionly_key_modelDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ionly_key_modelDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ionly_key_modelDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIonly_key_modelDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIonly_key_modelDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIonly_key_modelDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIonly_key_modelDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIonly_key_modelDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ionly_key_modelLibraryDispatcherCopy of core::traits::Copy::; -impl Ionly_key_modelLibraryDispatcherDrop of core::traits::Drop::; -impl Ionly_key_modelLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ionly_key_modelLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ionly_key_modelLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIonly_key_modelLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ionly_key_modelLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ionly_key_modelLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ionly_key_modelLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ionly_key_modelLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ionly_key_modelLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ionly_key_modelLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ionly_key_modelLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ionly_key_modelLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ionly_key_modelLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIonly_key_modelLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIonly_key_modelLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIonly_key_modelLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIonly_key_modelLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIonly_key_modelLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ionly_key_modelSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Ionly_key_modelSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Ionly_key_modelSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ionly_key_modelSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ionly_key_modelSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIonly_key_modelSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ionly_key_modelSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ionly_key_modelSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ionly_key_modelSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ionly_key_modelSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ionly_key_modelSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Ionly_key_modelSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ionly_key_modelSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ionly_key_modelSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ionly_key_modelSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIonly_key_modelSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIonly_key_modelSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIonly_key_modelSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIonly_key_modelSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIonly_key_modelSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Ionly_key_modelSafeDispatcherCopy of core::traits::Copy::; -impl Ionly_key_modelSafeDispatcherDrop of core::traits::Drop::; -impl Ionly_key_modelSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Ionly_key_modelSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Ionly_key_modelSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIonly_key_modelSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Ionly_key_modelSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Ionly_key_modelSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Ionly_key_modelSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Ionly_key_modelSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Ionly_key_modelSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Ionly_key_modelSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Ionly_key_modelSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Ionly_key_modelSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Ionly_key_modelSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIonly_key_modelSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIonly_key_modelSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIonly_key_modelSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIonly_key_modelSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIonly_key_modelSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Iu_256_key_modelDispatcherCopy of core::traits::Copy::; -impl Iu_256_key_modelDispatcherDrop of core::traits::Drop::; -impl Iu_256_key_modelDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Iu_256_key_modelDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Iu_256_key_modelDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIu_256_key_modelDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Iu_256_key_modelDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Iu_256_key_modelDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Iu_256_key_modelDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Iu_256_key_modelDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Iu_256_key_modelDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Iu_256_key_modelDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Iu_256_key_modelDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIu_256_key_modelDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIu_256_key_modelDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIu_256_key_modelDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIu_256_key_modelDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIu_256_key_modelDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Iu_256_key_modelLibraryDispatcherCopy of core::traits::Copy::; -impl Iu_256_key_modelLibraryDispatcherDrop of core::traits::Drop::; -impl Iu_256_key_modelLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Iu_256_key_modelLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Iu_256_key_modelLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIu_256_key_modelLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Iu_256_key_modelLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Iu_256_key_modelLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Iu_256_key_modelLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Iu_256_key_modelLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Iu_256_key_modelLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Iu_256_key_modelLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Iu_256_key_modelLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIu_256_key_modelLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIu_256_key_modelLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIu_256_key_modelLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIu_256_key_modelLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIu_256_key_modelLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Iu_256_key_modelSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Iu_256_key_modelSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Iu_256_key_modelSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Iu_256_key_modelSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Iu_256_key_modelSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIu_256_key_modelSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Iu_256_key_modelSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Iu_256_key_modelSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Iu_256_key_modelSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Iu_256_key_modelSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Iu_256_key_modelSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Iu_256_key_modelSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Iu_256_key_modelSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIu_256_key_modelSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIu_256_key_modelSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIu_256_key_modelSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIu_256_key_modelSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIu_256_key_modelSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Iu_256_key_modelSafeDispatcherCopy of core::traits::Copy::; -impl Iu_256_key_modelSafeDispatcherDrop of core::traits::Drop::; -impl Iu_256_key_modelSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Iu_256_key_modelSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Iu_256_key_modelSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIu_256_key_modelSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Iu_256_key_modelSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Iu_256_key_modelSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Iu_256_key_modelSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Iu_256_key_modelSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Iu_256_key_modelSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Iu_256_key_modelSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Iu_256_key_modelSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Iu_256_key_modelSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIu_256_key_modelSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIu_256_key_modelSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIu_256_key_modelSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIu_256_key_modelSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIu_256_key_modelSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IplayerDispatcherCopy of core::traits::Copy::; -impl IplayerDispatcherDrop of core::traits::Drop::; -impl IplayerDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IplayerDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IplayerDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIplayerDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IplayerDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IplayerDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IplayerDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IplayerDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IplayerDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IplayerDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IplayerDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IplayerDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IplayerDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIplayerDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIplayerDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIplayerDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIplayerDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIplayerDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IplayerLibraryDispatcherCopy of core::traits::Copy::; -impl IplayerLibraryDispatcherDrop of core::traits::Drop::; -impl IplayerLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IplayerLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IplayerLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIplayerLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IplayerLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IplayerLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IplayerLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IplayerLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IplayerLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IplayerLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IplayerLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IplayerLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IplayerLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIplayerLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIplayerLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIplayerLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIplayerLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIplayerLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IplayerSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IplayerSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IplayerSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IplayerSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IplayerSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIplayerSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IplayerSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IplayerSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IplayerSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IplayerSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IplayerSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IplayerSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IplayerSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IplayerSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IplayerSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIplayerSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIplayerSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIplayerSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIplayerSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIplayerSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IplayerSafeDispatcherCopy of core::traits::Copy::; -impl IplayerSafeDispatcherDrop of core::traits::Drop::; -impl IplayerSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IplayerSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IplayerSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIplayerSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IplayerSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IplayerSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IplayerSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IplayerSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IplayerSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IplayerSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IplayerSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IplayerSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IplayerSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIplayerSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIplayerSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIplayerSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIplayerSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIplayerSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_simple_arrayDispatcherCopy of core::traits::Copy::; -impl Imodel_with_simple_arrayDispatcherDrop of core::traits::Drop::; -impl Imodel_with_simple_arrayDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_simple_arrayDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_simple_arrayDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_simple_arrayDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arrayDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_simple_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arrayDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_simple_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_simple_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_simple_arrayDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_simple_arrayDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_simple_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_simple_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_simple_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_simple_arrayDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_simple_arrayDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_simple_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_simple_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_simple_arrayLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_simple_arrayLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_simple_arrayLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_simple_arrayLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_simple_arrayLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_simple_arrayLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arrayLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_simple_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arrayLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_simple_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_simple_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_simple_arrayLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_simple_arrayLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_simple_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_simple_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_simple_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_simple_arrayLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_simple_arrayLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_simple_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_simple_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_simple_arraySafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_simple_arraySafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_simple_arraySafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_simple_arraySafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_simple_arraySafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_simple_arraySafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_simple_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_simple_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_simple_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_simple_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_simple_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_simple_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_simple_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_simple_arraySafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_simple_arraySafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_simple_arraySafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_simple_arraySafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_simple_arraySafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_simple_arraySafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arraySafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_simple_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_simple_arraySafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_simple_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_simple_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_simple_arraySafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_simple_arraySafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_simple_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_simple_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_simple_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_simple_arraySafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_simple_arraySafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_simple_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_simple_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_byte_arrayDispatcherCopy of core::traits::Copy::; -impl Imodel_with_byte_arrayDispatcherDrop of core::traits::Drop::; -impl Imodel_with_byte_arrayDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_byte_arrayDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_byte_arrayDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_byte_arrayDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arrayDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_byte_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arrayDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_byte_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_byte_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_byte_arrayDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_byte_arrayDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_byte_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_byte_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_byte_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_byte_arrayDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_byte_arrayDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_byte_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_byte_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_byte_arrayLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_byte_arrayLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_byte_arrayLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_byte_arrayLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_byte_arrayLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_byte_arrayLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arrayLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_byte_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arrayLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_byte_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_byte_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_byte_arrayLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_byte_arrayLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_byte_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_byte_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_byte_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_byte_arrayLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_byte_arrayLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_byte_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_byte_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_byte_arraySafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_byte_arraySafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_byte_arraySafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_byte_arraySafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_byte_arraySafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_byte_arraySafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_byte_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_byte_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_byte_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_byte_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_byte_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_byte_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_byte_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_byte_arraySafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_byte_arraySafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_byte_arraySafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_byte_arraySafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_byte_arraySafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_byte_arraySafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arraySafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_byte_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_byte_arraySafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_byte_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_byte_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_byte_arraySafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_byte_arraySafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_byte_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_byte_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_byte_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_byte_arraySafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_byte_arraySafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_byte_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_byte_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_complex_arrayDispatcherCopy of core::traits::Copy::; -impl Imodel_with_complex_arrayDispatcherDrop of core::traits::Drop::; -impl Imodel_with_complex_arrayDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_complex_arrayDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_complex_arrayDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_complex_arrayDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arrayDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_complex_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arrayDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_complex_arrayDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_complex_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_complex_arrayDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_complex_arrayDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_complex_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_complex_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_complex_arrayDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_complex_arrayDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_complex_arrayDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_complex_arrayDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_complex_arrayDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_complex_arrayLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_complex_arrayLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_complex_arrayLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_complex_arrayLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_complex_arrayLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_complex_arrayLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arrayLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_complex_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arrayLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_complex_arrayLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_complex_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_complex_arrayLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_complex_arrayLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_complex_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_complex_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_complex_arrayLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_complex_arrayLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_complex_arrayLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_complex_arrayLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_complex_arrayLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_complex_arraySafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_complex_arraySafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_complex_arraySafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_complex_arraySafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_complex_arraySafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_complex_arraySafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_complex_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arraySafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_complex_arraySafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_complex_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_complex_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_complex_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_complex_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_complex_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_complex_arraySafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_complex_arraySafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_complex_arraySafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_complex_arraySafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_complex_arraySafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_complex_arraySafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arraySafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_complex_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_complex_arraySafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_complex_arraySafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_complex_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_complex_arraySafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_complex_arraySafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_complex_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_complex_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_complex_arraySafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_complex_arraySafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_complex_arraySafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_complex_arraySafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_complex_arraySafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_tupleDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tupleDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tupleDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tupleDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tupleDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tupleDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tupleDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleDispatcher { - contract_address, - } + dojo::model::introspect::Introspect::::ty(), +dojo::model::introspect::Introspect::::ty(), +dojo::model::introspect::Introspect::::ty() + ].span() ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tupleDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_tupleDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_tupleDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tupleDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tupleDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tupleDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tupleDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tupleDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tupleDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tupleDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tupleDispatcherSubPointers { - contract_address: contract_address_value, } - } -} -impl Imodel_with_tupleLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tupleLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tupleLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tupleLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tupleLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tupleLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tupleLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tupleLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} -#[derive(Drop, Copy)] -struct Imodel_with_tupleLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_tupleLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tupleLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tupleLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tupleLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tupleLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tupleLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tupleLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tupleLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tupleLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_tupleSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tupleSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tupleSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tupleSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tupleSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tupleSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tupleSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleSafeLibraryDispatcher { - class_hash, + ].span() } ) } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tupleSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } } -#[derive(Drop, Copy)] -struct Imodel_with_tupleSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_tupleSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tupleSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tupleSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tupleSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tupleSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tupleSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tupleSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tupleSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tupleSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_tupleSafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tupleSafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tupleSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tupleSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tupleSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tupleSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tupleSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tupleSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tupleSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } +impl ModelWithTupleNoPrimitivesIntrospect<> of dojo::model::introspect::Introspect> { #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} + fn size() -> Option { + let sizes : Array> = array![ + dojo::model::introspect::Introspect::::size(), +Option::Some(3) + ]; -#[derive(Drop, Copy)] -struct Imodel_with_tupleSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_tupleSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tupleSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tupleSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tupleSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tupleSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tupleSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tupleSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tupleSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tupleSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_tuple_no_primitivesDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tuple_no_primitivesDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tuple_no_primitivesDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tuple_no_primitivesDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tuple_no_primitivesDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tuple_no_primitivesDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() + if dojo::utils::any_none(@sizes) { + return Option::None; + } + Option::Some(dojo::utils::sum(sizes)) + } -} -#[derive(Drop, Copy)] -struct Imodel_with_tuple_no_primitivesDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_tuple_no_primitivesDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tuple_no_primitivesDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tuple_no_primitivesDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tuple_no_primitivesDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tuple_no_primitivesDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tuple_no_primitivesDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tuple_no_primitivesDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tuple_no_primitivesDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tuple_no_primitivesDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Imodel_with_tuple_no_primitivesLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tuple_no_primitivesLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tuple_no_primitivesLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tuple_no_primitivesLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesLibraryDispatcher { - class_hash, - } + fn layout() -> dojo::model::Layout { + dojo::model::Layout::Struct( + array![ + dojo::model::FieldLayout { + selector: 512066735765477566404754172672287371265995314501343422459174036873487219331, + layout: dojo::model::introspect::Introspect::::layout() + }, +dojo::model::FieldLayout { + selector: 1591024729085637502504777720563487898377940395575083379770417352976841400819, + layout: dojo::model::Layout::Tuple( + array![ + dojo::model::introspect::Introspect::::layout(), +dojo::model::introspect::Introspect::::layout(), +dojo::model::introspect::Introspect::::layout() + ].span() ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tuple_no_primitivesLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesLibraryDispatcher { - class_hash, - } + } + ].span() ) } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tuple_no_primitivesLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} -#[derive(Drop, Copy)] -struct Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tuple_no_primitivesSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tuple_no_primitivesSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tuple_no_primitivesSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tuple_no_primitivesSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesSafeLibraryDispatcher { - class_hash, - } - ) - } #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tuple_no_primitivesSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl Imodel_with_tuple_no_primitivesSafeDispatcherCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesSafeDispatcherDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @Imodel_with_tuple_no_primitivesSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(Imodel_with_tuple_no_primitivesSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreImodel_with_tuple_no_primitivesSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesSafeDispatcher { - contract_address, - } + fn ty() -> dojo::model::introspect::Ty { + dojo::model::introspect::Ty::Struct( + dojo::model::introspect::Struct { + name: 'ModelWithTupleNoPrimitives', + attrs: array![].span(), + children: array![ + dojo::model::introspect::Member { + name: 'player', + attrs: array!['key'].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'x', + attrs: array![].span(), + ty: dojo::model::introspect::Introspect::::ty() + }, +dojo::model::introspect::Member { + name: 'y', + attrs: array![].span(), + ty: dojo::model::introspect::Ty::Tuple( + array![ + dojo::model::introspect::Introspect::::ty(), +dojo::model::introspect::Introspect::::ty(), +dojo::model::introspect::Introspect::::ty() + ].span() ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: Imodel_with_tuple_no_primitivesSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - Imodel_with_tuple_no_primitivesSafeDispatcher { - contract_address, + } + + ].span() } ) } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: Imodel_with_tuple_no_primitivesSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct Imodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl Imodel_with_tuple_no_primitivesSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = Imodel_with_tuple_no_primitivesSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> Imodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - Imodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } } -#[derive(Drop, Copy)] -struct MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl Ibad_model_multiple_versionsDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_multiple_versionsDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_multiple_versionsDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_multiple_versionsLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_multiple_versionsLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_multiple_versionsSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_multiple_versionsSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_multiple_versionsSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_multiple_versionsSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_multiple_versionsSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_bad_version_typeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_bad_version_typeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_bad_version_typeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_bad_version_typeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_bad_version_typeSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_bad_version_typeSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_bad_version_typeSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_bad_version_typeSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_bad_version_typeSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_no_version_valueDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_no_version_valueDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_no_version_valueLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_no_version_valueLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_no_version_valueSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_no_version_valueSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_no_version_valueSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_no_version_valueSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_no_version_valueSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_arg_with_valueDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_arg_with_valueLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_arg_with_valueSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_arg_with_valueSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_arg_with_valueSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_argDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_argDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_argLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_argLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_argSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_unexpected_argSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_unexpected_argSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_unexpected_argSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_unexpected_argSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_not_supported_versionDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_not_supported_versionDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_not_supported_versionLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_not_supported_versionLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_not_supported_versionSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ibad_model_not_supported_versionSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ibad_model_not_supported_versionSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIbad_model_not_supported_versionSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIbad_model_not_supported_versionSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodelv_0DispatcherSubPointersDrop of core::traits::Drop::; -impl Imodelv_0DispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodelv_0DispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodelv_0DispatcherSubPointersCopy of core::traits::Copy::; -impl Imodelv_0LibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodelv_0LibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodelv_0LibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodelv_0LibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodelv_0SafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodelv_0SafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodelv_0SafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodelv_0SafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodelv_0SafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodelv_0SafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodelv_0SafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodelv_0SafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_bad_namespace_formatDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_bad_namespace_formatDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_bad_namespace_formatLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_bad_namespace_formatSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_bad_namespace_formatSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_bad_namespace_formatSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_bad_namespace_formatSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_short_string_namespaceDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_short_string_namespaceDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_short_string_namespaceLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_short_string_namespaceSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_short_string_namespaceSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_short_string_namespaceSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_short_string_namespaceSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_short_string_namespaceSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_string_namespaceDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_string_namespaceDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_string_namespaceLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_string_namespaceLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_string_namespaceSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_string_namespaceSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_string_namespaceSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_string_namespaceSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_string_namespaceSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl IpositionDispatcherSubPointersDrop of core::traits::Drop::; -impl IpositionDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIpositionDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIpositionDispatcherSubPointersCopy of core::traits::Copy::; -impl IpositionLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IpositionLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIpositionLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIpositionLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IpositionSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IpositionSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIpositionSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIpositionSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IpositionSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IpositionSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIpositionSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIpositionSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl IrolesDispatcherSubPointersDrop of core::traits::Drop::; -impl IrolesDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIrolesDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIrolesDispatcherSubPointersCopy of core::traits::Copy::; -impl IrolesLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IrolesLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIrolesLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIrolesLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IrolesSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IrolesSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIrolesSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIrolesSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IrolesSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IrolesSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIrolesSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIrolesSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Ionly_key_modelDispatcherSubPointersDrop of core::traits::Drop::; -impl Ionly_key_modelDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIonly_key_modelDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIonly_key_modelDispatcherSubPointersCopy of core::traits::Copy::; -impl Ionly_key_modelLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ionly_key_modelLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIonly_key_modelLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIonly_key_modelLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ionly_key_modelSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Ionly_key_modelSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIonly_key_modelSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIonly_key_modelSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Ionly_key_modelSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Ionly_key_modelSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIonly_key_modelSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIonly_key_modelSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Iu_256_key_modelDispatcherSubPointersDrop of core::traits::Drop::; -impl Iu_256_key_modelDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIu_256_key_modelDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIu_256_key_modelDispatcherSubPointersCopy of core::traits::Copy::; -impl Iu_256_key_modelLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Iu_256_key_modelLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIu_256_key_modelLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIu_256_key_modelLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Iu_256_key_modelSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Iu_256_key_modelSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIu_256_key_modelSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIu_256_key_modelSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Iu_256_key_modelSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Iu_256_key_modelSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIu_256_key_modelSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIu_256_key_modelSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl IplayerDispatcherSubPointersDrop of core::traits::Drop::; -impl IplayerDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIplayerDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIplayerDispatcherSubPointersCopy of core::traits::Copy::; -impl IplayerLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IplayerLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIplayerLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIplayerLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IplayerSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IplayerSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIplayerSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIplayerSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IplayerSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IplayerSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIplayerSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIplayerSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_simple_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_simple_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_simple_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_simple_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_simple_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_simple_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_simple_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_simple_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_simple_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_simple_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_simple_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_simple_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_simple_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_simple_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_simple_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_byte_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_byte_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_byte_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_byte_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_byte_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_byte_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_byte_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_byte_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_byte_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_byte_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_byte_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_byte_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_byte_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_byte_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_byte_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_complex_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_complex_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_complex_arrayDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_complex_arrayDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_complex_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_complex_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_complex_arrayLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_complex_arrayLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_complex_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_complex_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_complex_arraySafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_complex_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_complex_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_complex_arraySafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_complex_arraySafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tupleDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tupleDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tupleDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tupleDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tupleLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tupleLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tupleLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tupleLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tupleSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tupleSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tupleSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tupleSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tupleSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tupleSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tupleSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tupleSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tuple_no_primitivesDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tuple_no_primitivesDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tuple_no_primitivesLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tuple_no_primitivesSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl Imodel_with_tuple_no_primitivesSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl Imodel_with_tuple_no_primitivesSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableImodel_with_tuple_no_primitivesSafeDispatcherSubPointersCopy of core::traits::Copy::; //! > expected_diagnostics error: A Dojo model must have zero or one dojo::model attribute. @@ -26122,52 +1260,102 @@ error: A Dojo model must have zero or one dojo::model attribute. #[dojo::model(version: 0)] ^************************^ -error: Too many 'version' attributes for dojo::model - --> /tmp/plugin_test/model/src/lib.cairo:9:1 -#[dojo::model(version: 0, version: 0)] -^************************************^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:10:8 +struct BadModelMultipleVersions { + ^**********************^ -error: The argument 'version' of dojo::model must be an integer - --> /tmp/plugin_test/model/src/lib.cairo:16:24 -#[dojo::model(version: hello)] - ^***^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:17:8 +struct BadModelBadVersionType { + ^********************^ -error: Unexpected argument 'version' for dojo::model - --> /tmp/plugin_test/model/src/lib.cairo:23:15 -#[dojo::model(version)] - ^*****^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:24:8 +struct BadModelNoVersionValue { + ^********************^ -error: Unexpected argument 'my_arg' for dojo::model - --> /tmp/plugin_test/model/src/lib.cairo:30:15 -#[dojo::model(my_arg: 1)] - ^*******^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:31:8 +struct BadModelUnexpectedArgWithValue { + ^****************************^ -error: Unexpected argument 'my_arg' for dojo::model - --> /tmp/plugin_test/model/src/lib.cairo:37:15 -#[dojo::model(my_arg)] - ^****^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:38:8 +struct BadModelUnexpectedArg { + ^*******************^ -error: dojo::model version 2 not supported - --> /tmp/plugin_test/model/src/lib.cairo:44:24 -#[dojo::model(version: 2)] - ^ +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:45:8 +struct BadModelNotSupportedVersion { + ^*************************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:52:8 +struct Modelv0 { + ^*****^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:59:8 +struct ModelWithBadNamespaceFormat { + ^*************************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:66:8 +struct ModelWithShortStringNamespace { + ^***************************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:73:8 +struct ModelWithStringNamespace { + ^**********************^ -error: Model must define at least one #[key] attribute +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:80:8 +struct Position { + ^******^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). --> /tmp/plugin_test/model/src/lib.cairo:87:8 struct Roles { ^***^ -error: Model must define at least one member that is not a key +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). --> /tmp/plugin_test/model/src/lib.cairo:92:8 struct OnlyKeyModel { ^**********^ -error: Key is only supported for core types that are 1 felt long once serialized. `u256` is a struct of 2 u128, hence not supported. - --> /tmp/plugin_test/model/src/lib.cairo:100:5 - id: u256 - ^^ - -error: Model must define at least one member that is not a key +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). --> /tmp/plugin_test/model/src/lib.cairo:98:8 struct U256KeyModel { ^**********^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:104:8 +struct Player { + ^****^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:116:8 +struct ModelWithSimpleArray { + ^******************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:124:8 +struct ModelWithByteArray { + ^****************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:132:8 +struct ModelWithComplexArray { + ^*******************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:140:8 +struct ModelWithTuple { + ^************^ + +error: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/model/src/lib.cairo:148:8 +struct ModelWithTupleNoPrimitives { + ^************************^ diff --git a/crates/dojo-lang/src/plugin_test_data/system b/crates/dojo-lang/src/plugin_test_data/system index 0c6d2034b0..94e8878240 100644 --- a/crates/dojo-lang/src/plugin_test_data/system +++ b/crates/dojo-lang/src/plugin_test_data/system @@ -358,6 +358,36 @@ mod ctxnamed { } //! > expected_diagnostics +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:1:1 +#[dojo::contract(namespace: "My@Namespace")] +^******************************************^ + +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:11:1 +#[dojo::contract(namespace: 'my_namespace')] +^******************************************^ + +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:21:1 +#[dojo::contract(namespace: "my_namespace")] +^******************************************^ + +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:28:1 +#[dojo::contract] +^***************^ + +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:38:1 +#[dojo::contract] +^***************^ + +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:64:1 +#[dojo::contract] +^***************^ + error: Anything other than functions is not supported in a dojo::interface --> /tmp/plugin_test/system/src/lib.cairo:90:5 const ONE: u8; @@ -388,40 +418,25 @@ error: World parameter must be the first parameter. fn do_with_world_not_first(vec: Vec2, ref world: IWorldDispatcher) -> felt252; ^****************************************************************************^ -error: World parameter must be the first parameter. - --> /tmp/plugin_test/system/src/lib.cairo:128:9 - fn do_with_self_and_world(self: @ContractState, world: @IWorldDispatcher) -> felt252 { - ^************************************************************************************^ - -error: World parameter must be the first parameter. - --> /tmp/plugin_test/system/src/lib.cairo:132:9 - fn do_with_ref_self_and_world( - ^****************************^ - -error: You cannot use `self` and `world` parameters together. - --> /tmp/plugin_test/system/src/lib.cairo:138:9 - fn do_with_self_and_world_inv(world: @IWorldDispatcher, self: @ContractState) -> felt252 { - ^****************************************************************************************^ - -error: You cannot use `self` and `world` parameters together. - --> /tmp/plugin_test/system/src/lib.cairo:142:9 - fn do_with_ref_self_and_world_inv( - ^********************************^ +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:124:1 +#[dojo::contract] +^***************^ -error: World parameter must be the first parameter. - --> /tmp/plugin_test/system/src/lib.cairo:158:9 - fn do_with_world_not_first(vec: Vec2, ref world: IWorldDispatcher) -> felt252 { - ^*****************************************************************************^ +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:171:1 +#[dojo::contract] +^***************^ -error: You cannot use `world` and `#[generate_trait]` together. Use `self` instead. - --> /tmp/plugin_test/system/src/lib.cairo:165:9 - fn bad_func_using_generate(world: @IWorldDispatcher) -> felt252 { - ^***************************************************************^ +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:222:1 +#[dojo::contract] +^***************^ -error: World parameter must be a snapshot if `ref` is not used. - --> /tmp/plugin_test/system/src/lib.cairo:224:5 - fn dojo_init( - ^***********^ +error: The contract namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> /tmp/plugin_test/system/src/lib.cairo:239:1 +#[dojo::contract] +^***************^ error: `starknet::interface` function first parameter must be a reference to the trait's generic parameter or a snapshot of it. --> /tmp/plugin_test/system/src/lib.cairo:105:5 @@ -463,12 +478,120 @@ error: `starknet::interface` functions don't support `ref` parameters other than fn do_with_world_not_first(vec: Vec2, ref world: IWorldDispatcher) -> felt252; ^***************************************************************************^ +error: Unknown inline item macro: 'component'. + --> /tmp/plugin_test/system/src/lib.cairo:66:5 + component!(path: testcomponent1, storage: testcomponent1_storage, event: testcomponent1_event); + ^*********************************************************************************************^ + +error: Unknown inline item macro: 'component'. + --> /tmp/plugin_test/system/src/lib.cairo:67:5 + component!(path: testcomponent2, storage: testcomponent2_storage, event: testcomponent2_event); + ^*********************************************************************************************^ + error: Generated trait must have generic args matching the impl's generic params. - --> /tmp/plugin_test/system/src/lib.cairo:163:5 - #[generate_trait] - ^***************^ + --> /tmp/plugin_test/system/src/lib.cairo:164:29 + impl InternalImplBad of InternalUtils { + ^**************************^ //! > expanded_cairo_code +#[dojo::contract(namespace: "My@Namespace")] +mod bad_namespace_format { + use traits::Into; + use dojo::world::Context; + + fn execute(ctx: Context, name: felt252) { + return (); + } +} + +#[dojo::contract(namespace: 'my_namespace')] +mod spawn { + use traits::Into; + use dojo::world::Context; + + fn execute(ctx: Context, name: felt252) { + return (); + } +} + +#[dojo::contract(namespace: "my_namespace")] +mod proxy { + fn execute(value: felt252) -> felt252 { + value + } +} + +#[dojo::contract] +mod ctxnamed { + use traits::Into; + use dojo::world::Context; + + fn execute(ctx2: Context, name: felt252) { + return (); + } +} + +#[dojo::contract] +mod withevent { + #[event] + #[derive(Drop, starknet::Event)] + enum Event { + TestEvent: TestEvent, + } + + #[derive(Drop, starknet::Event)] + struct TestEvent { + address: ContractAddress, + } +impl EventDrop of core::traits::Drop::; +impl EventIsEvent of starknet::Event { + fn append_keys_and_data( + self: @Event, ref keys: Array, ref data: Array + ) { + match self { + Event::TestEvent(val) => { + core::array::ArrayTrait::append(ref keys, selector!("TestEvent")); + starknet::Event::append_keys_and_data( + val, ref keys, ref data + ); + }, + } + } + fn deserialize( + ref keys: Span, ref data: Span, + ) -> Option { + let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; + if __selector__ == selector!("TestEvent") { + let val = starknet::Event::deserialize( + ref keys, ref data + )?; + return Option::Some(Event::TestEvent(val)); + } + Option::None + } +} +impl EventTestEventIntoEvent of Into { + fn into(self: TestEvent) -> Event { + Event::TestEvent(self) + } +} +impl TestEventDrop of core::traits::Drop::; +impl TestEventIsEvent of starknet::Event { + fn append_keys_and_data( + self: @TestEvent, ref keys: Array, ref data: Array + ) { + core::serde::Serde::serialize(self.address, ref data); + } + fn deserialize( + ref keys: Span, ref data: Span, + ) -> Option { + let address = core::serde::Serde::deserialize( + ref data + )?; + Option::Some(TestEvent {address, }) + } +} +} #[starknet::component] mod testcomponent1 { @@ -642,175 +765,37 @@ impl ComponentStorageBaseMutDrop of core::traits::Drop::; } - #[starknet::contract] - mod bad_namespace_format { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "bad_namespace_format" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-bad_namespace_format" - } - - fn name_hash(self: @ContractState) -> felt252 { - 2014299465256018364248618312205774234949844604916563661777686628154176783488 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 2931670046498875274448874829231097042977275875153600823491451406128208153107 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - use traits::Into; - use dojo::world::Context; - - fn execute(ctx: Context, name: felt252) { - return (); - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); +#[dojo::contract] +mod withcomponent { - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) + #[storage] + struct Storage { + #[substorage(v0)] + testcomponent1_storage: testcomponent1::Storage, + #[substorage(v0)] + testcomponent2_storage: testcomponent2::Storage, } -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) + #[event] + #[derive(Drop, starknet::Event)] + enum Event { + #[flat] + testcomponent1_event: testcomponent1::Event, + testcomponent2_event: testcomponent2::Event, } - -} impl EventDrop of core::traits::Drop::; impl EventIsEvent of starknet::Event { fn append_keys_and_data( self: @Event, ref keys: Array, ref data: Array ) { match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); + Event::testcomponent1_event(val) => { + starknet::Event::append_keys_and_data( + val, ref keys, ref data + ); + }, + Event::testcomponent2_event(val) => { + core::array::ArrayTrait::append(ref keys, selector!("testcomponent2_event")); starknet::Event::append_keys_and_data( val, ref keys, ref data ); @@ -820,8459 +805,180 @@ impl EventIsEvent of starknet::Event { fn deserialize( ref keys: Span, ref data: Span, ) -> Option { + { + let mut keys = keys; + let mut data = data; + match starknet::Event::deserialize(ref keys, ref data) { + Option::Some(val) => { + return Option::Some(Event::testcomponent1_event(val)); + }, + Option::None => {}, + }; + } let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { + if __selector__ == selector!("testcomponent2_event") { let val = starknet::Event::deserialize( ref keys, ref data )?; - return Option::Some(Event::UpgradeableEvent(val)); + return Option::Some(Event::testcomponent2_event(val)); } Option::None } } -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) +impl Eventtestcomponent1_eventIntoEvent of Into { + fn into(self: testcomponent1::Event) -> Event { + Event::testcomponent1_event(self) } } - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } +impl Eventtestcomponent2_eventIntoEvent of Into { + fn into(self: testcomponent2::Event) -> Event { + Event::testcomponent2_event(self) } } -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, } -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} +#[dojo::contract] +mod MyFaultyContract { + #[abi(embed_v0)] + impl TestFaultyImpl of IFaultyTrait { + fn do_with_self_and_world(self: @ContractState, world: @IWorldDispatcher) -> felt252 { + 'land' + } -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; + fn do_with_ref_self_and_world( + ref self: ContractState, ref world: IWorldDispatcher + ) -> felt252 { + 'land' + } -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) + fn do_with_self_and_world_inv(world: @IWorldDispatcher, self: @ContractState) -> felt252 { + 'land' } - } -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} + fn do_with_ref_self_and_world_inv( + ref world: IWorldDispatcher, ref self: ContractState + ) -> felt252 { + 'land' + } -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, + fn do_with_several_world_dispatchers( + world: @IWorldDispatcher, vec: Vec2, ref another_world: IWorldDispatcher + ) -> felt252 { + 'land' } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, + + fn do_with_world_not_named_world(another_world: @IWorldDispatcher) -> felt252 { + 'land' + } + + fn do_with_world_not_first(vec: Vec2, ref world: IWorldDispatcher) -> felt252 { + 'land' } } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) + + #[generate_trait] + impl InternalImplBad of InternalUtils { + fn bad_func_using_generate(world: @IWorldDispatcher) -> felt252 { + 'land' + } } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) + trait InternalUtils{ + fn bad_func_using_generate(world: @IWorldDispatcher) -> felt252; } } -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() + +#[dojo::contract] +mod MyNominalContract { + #[derive(Drop)] + struct Action { + damage: u8 } -} -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, + #[abi(embed_v0)] + impl TestNominalImpl of INominalTrait { + fn do_no_param() -> felt252 { + 'land' } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, + + fn do_no_param_but_world(world: @IWorldDispatcher) -> felt252 { + 'land' + } + + fn do_no_param_but_world_ref(ref world: IWorldDispatcher) -> felt252 { + 'land' + } + + fn do_params_no_world(p1: felt252, p2: u8) -> felt252 { + 'land' + } + + fn do_params_and_world(world: @IWorldDispatcher, p2: u8) -> felt252 { + 'land' + } + + fn do_params_and_world_ref(ref world: IWorldDispatcher, p2: u8) -> felt252 { + 'land' + } + + fn do_with_self(self: @ContractState) -> felt252 { + 'land' + } + + fn do_with_ref_self(ref self: ContractState) -> felt252 { + 'land' } } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) + + #[generate_trait] + impl ImplInternalNoContractState of InternalNoContractState { + fn func1(world: IWorldDispatcher) -> felt252 { + let _w = world; + 42 + } } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) +impl ActionDrop of core::traits::Drop::; + trait InternalNoContractState { + fn func1(world: IWorldDispatcher) -> felt252; } } -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, + +#[dojo::contract] +mod init_test { + fn dojo_init( + world: IWorldDispatcher, + actions_address: ContractAddress, + actions_class: ClassHash, + value: u8 + ) { + emit!( + world, + ContractInitialized { + contract_address: actions_address, contract_class: actions_class, value } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() + ); } } -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} +#[dojo::contract] +mod no_init_test {} + #[starknet::interface] + pub trait IEmptyTrait {} -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - + #[starknet::interface] + pub trait IFaultyTrait { + fn do_with_attrs(self: @TContractState, p1: u8) -> u16; } - #[starknet::contract] - mod spawn { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "spawn" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-spawn" - } - - fn name_hash(self: @ContractState) -> felt252 { - 2776321589048333240377325502911505147617911439383944762363370901236132332849 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 2472087249524108479557800499207886557849609293388925195637428170796835731505 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - use traits::Into; - use dojo::world::Context; - - fn execute(ctx: Context, name: felt252) { - return (); - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} + #[starknet::interface] + pub trait INominalTrait { + fn do_no_param(self: @TContractState) -> felt252;fn do_no_param_but_world(self: @TContractState) -> felt252;fn do_no_param_but_world_ref(ref self: TContractState) -> felt252;fn do_params_no_world(self: @TContractState, p1: felt252, p2: u8) -> felt252;fn do_params_and_world(self: @TContractState, p2: u8) -> felt252;fn do_params_and_world_ref(ref self: TContractState, p2: u8) -> felt252;fn do_with_self(self: @ContractState) -> felt252;fn do_with_ref_self(ref self: ContractState) -> felt252; + } -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod proxy { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "proxy" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-proxy" - } - - fn name_hash(self: @ContractState) -> felt252 { - 379211399603323842291430789821178524592027629543381998047225121027704003915 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 3522586352349720867166847576673128733430338006217587257445073829693434546448 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - fn execute(value: felt252) -> felt252 { - value - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod ctxnamed { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "ctxnamed" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-ctxnamed" - } - - fn name_hash(self: @ContractState) -> felt252 { - 1120614286815912604239420768209466007446460277061516527925636408561239543041 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 882574079468045629402181499911470715863025356910172410020020548741739455774 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - use traits::Into; - use dojo::world::Context; - - fn execute(ctx2: Context, name: felt252) { - return (); - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod withevent { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "withevent" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-withevent" - } - - fn name_hash(self: @ContractState) -> felt252 { - 2196275886623691942883456540767114081898043897719876113518403014973431884540 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 2302995054894169641868030754357260737170491794196617685355614288827933407674 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - TestEvent: TestEvent - } - - #[derive(Drop, starknet::Event)] - struct TestEvent { - address: ContractAddress, - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - Event::TestEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("TestEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - if __selector__ == selector!("TestEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::TestEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} -impl EventTestEventIntoEvent of Into { - fn into(self: TestEvent) -> Event { - Event::TestEvent(self) - } -} -impl TestEventDrop of core::traits::Drop::; -impl TestEventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @TestEvent, ref keys: Array, ref data: Array - ) { - core::serde::Serde::serialize(self.address, ref data); - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let address = core::serde::Serde::deserialize( - ref data - )?; - Option::Some(TestEvent {address, }) - } -} -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod withcomponent { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "withcomponent" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-withcomponent" - } - - fn name_hash(self: @ContractState) -> felt252 { - 999850881662666048155666650426666132968026605763740651763663703103974774091 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 795804664978713707757807985251114311939501109833092725925763852713460388378 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - #[flat] - testcomponent1_event: testcomponent1::Event, - testcomponent2_event: testcomponent2::Event - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, - pub testcomponent1_storage: testcomponent1::Storage, - pub testcomponent2_storage: testcomponent2::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, - pub testcomponent1_storage: starknet::storage::StorageBase, - pub testcomponent2_storage: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, - pub testcomponent1_storage: starknet::storage::StorageBase>, - pub testcomponent2_storage: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - testcomponent1_storage: starknet::storage::StorageBase{ address: selector!("testcomponent1_storage") }, - testcomponent2_storage: starknet::storage::StorageBase{ address: selector!("testcomponent2_storage") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - testcomponent1_storage: starknet::storage::StorageBase{ address: selector!("testcomponent1_storage") }, - testcomponent2_storage: starknet::storage::StorageBase{ address: selector!("testcomponent2_storage") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, - pub testcomponent1_storage: testcomponent1::ComponentState, - pub testcomponent2_storage: testcomponent2::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - testcomponent1_storage: testcomponent1::unsafe_new_component_state::(), - testcomponent2_storage: testcomponent2::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl HasComponentImpl_testcomponent1 of testcomponent1::HasComponent { - fn get_component(self: @ContractState) -> @testcomponent1::ComponentState { - @testcomponent1::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> testcomponent1::ComponentState { - testcomponent1::unsafe_new_component_state::() - } - fn get_contract(self: @testcomponent1::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: testcomponent1::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: testcomponent1::ComponentState, event: S) { - let event: testcomponent1::Event = core::traits::Into::into(event); - let mut contract = testcomponent1::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::testcomponent1_event(event)); - } -} -impl HasComponentImpl_testcomponent2 of testcomponent2::HasComponent { - fn get_component(self: @ContractState) -> @testcomponent2::ComponentState { - @testcomponent2::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> testcomponent2::ComponentState { - testcomponent2::unsafe_new_component_state::() - } - fn get_contract(self: @testcomponent2::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: testcomponent2::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: testcomponent2::ComponentState, event: S) { - let event: testcomponent2::Event = core::traits::Into::into(event); - let mut contract = testcomponent2::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::testcomponent2_event(event)); - } -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - Event::testcomponent1_event(val) => { - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - Event::testcomponent2_event(val) => { - core::array::ArrayTrait::append(ref keys, selector!("testcomponent2_event")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - { - let mut keys = keys; - let mut data = data; - match starknet::Event::deserialize(ref keys, ref data) { - Option::Some(val) => { - return Option::Some(Event::testcomponent1_event(val)); - }, - Option::None => {}, - }; - } - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - if __selector__ == selector!("testcomponent2_event") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::testcomponent2_event(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} -impl Eventtestcomponent1_eventIntoEvent of Into { - fn into(self: testcomponent1::Event) -> Event { - Event::testcomponent1_event(self) - } -} -impl Eventtestcomponent2_eventIntoEvent of Into { - fn into(self: testcomponent2::Event) -> Event { - Event::testcomponent2_event(self) - } -} -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::interface] - pub trait IEmptyTrait {} - - #[starknet::interface] - pub trait IFaultyTrait { - fn do_with_attrs(self: @TContractState, p1: u8) -> u16; - } - - #[starknet::interface] - pub trait INominalTrait { - fn do_no_param(self: @TContractState) -> felt252;fn do_no_param_but_world(self: @TContractState) -> felt252;fn do_no_param_but_world_ref(ref self: TContractState) -> felt252;fn do_params_no_world(self: @TContractState, p1: felt252, p2: u8) -> felt252;fn do_params_and_world(self: @TContractState, p2: u8) -> felt252;fn do_params_and_world_ref(ref self: TContractState, p2: u8) -> felt252;fn do_with_self(self: @ContractState) -> felt252;fn do_with_ref_self(ref self: ContractState) -> felt252; - } - - #[starknet::interface] - pub trait IFaultyTrait { - fn do_with_self_and_world(self: @ContractState, world: @IWorldDispatcher) -> felt252;fn do_with_ref_self_and_world(ref self: ContractState, ref world: IWorldDispatcher) -> felt252;fn do_with_self_and_world_inv(self: @TContractState, self: @ContractState) -> felt252;fn do_with_ref_self_and_world_inv(ref self: TContractState, ref self: ContractState -) -> felt252;fn do_with_several_world_dispatchers(self: @TContractState, vec: Vec2, ref another_world: IWorldDispatcher -) -> felt252;fn do_with_world_not_named_world(self: @TContractState, another_world: @IWorldDispatcher) -> felt252;fn do_with_world_not_first(self: @TContractState, vec: Vec2, ref world: IWorldDispatcher) -> felt252; - } - - #[starknet::contract] - mod MyFaultyContract { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "MyFaultyContract" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-MyFaultyContract" - } - - fn name_hash(self: @ContractState) -> felt252 { - 3439743807865759203015037013733809315384408083697880336790137144257764256358 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 1862046669446530718410691364259438011386499031689246339557998041337203828246 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - #[abi(embed_v0)] - impl TestFaultyImpl of IFaultyTrait {fn do_with_self_and_world(self: @ContractState) -> felt252 { 'land' -}fn do_with_ref_self_and_world( ref self: ContractState) -> felt252 { 'land' -}fn do_with_self_and_world_inv(self: @ContractState, self: @ContractState) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_with_ref_self_and_world_inv(ref self: ContractState, ref self: ContractState -) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_with_several_world_dispatchers(self: @ContractState, vec: Vec2, ref another_world: IWorldDispatcher -) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_with_world_not_named_world(self: @ContractState, another_world: @IWorldDispatcher) -> felt252 { 'land' -}fn do_with_world_not_first(self: @ContractState, vec: Vec2) -> felt252 { 'land' -}} - #[generate_trait] - impl InternalImplBad of InternalUtils {fn bad_func_using_generate(self: @ContractState) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}} - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } - trait InternalUtils{fn bad_func_using_generate(self: @ContractState) -> felt252; -} -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_self_and_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_self_and_world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_ref_self_and_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_ref_self_and_world(ref contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_self_and_world_inv(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_self = core::option::OptionTraitImpl::expect( - core::serde::Serde::<@ContractState>::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_self_and_world_inv(@contract_state, __arg_self); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_ref_self_and_world_inv(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let mut __arg_self = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_ref_self_and_world_inv(ref contract_state, ref __arg_self); - let mut arr = ArrayTrait::new(); - // References. - core::serde::Serde::::serialize(@__arg_self, ref arr); - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_several_world_dispatchers(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_vec = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - let mut __arg_another_world = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #2' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_several_world_dispatchers(@contract_state, __arg_vec, ref __arg_another_world); - let mut arr = ArrayTrait::new(); - // References. - core::serde::Serde::::serialize(@__arg_another_world, ref arr); - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_world_not_named_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_another_world = core::option::OptionTraitImpl::expect( - core::serde::Serde::<@IWorldDispatcher>::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_world_not_named_world(@contract_state, __arg_another_world); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestFaultyImpl__do_with_world_not_first(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_vec = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestFaultyImpl::do_with_world_not_first(@contract_state, __arg_vec); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__TestFaultyImpl__do_with_self_and_world as do_with_self_and_world; - pub use super::__wrapper__TestFaultyImpl__do_with_ref_self_and_world as do_with_ref_self_and_world; - pub use super::__wrapper__TestFaultyImpl__do_with_self_and_world_inv as do_with_self_and_world_inv; - pub use super::__wrapper__TestFaultyImpl__do_with_ref_self_and_world_inv as do_with_ref_self_and_world_inv; - pub use super::__wrapper__TestFaultyImpl__do_with_several_world_dispatchers as do_with_several_world_dispatchers; - pub use super::__wrapper__TestFaultyImpl__do_with_world_not_named_world as do_with_world_not_named_world; - pub use super::__wrapper__TestFaultyImpl__do_with_world_not_first as do_with_world_not_first; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod MyNominalContract { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "MyNominalContract" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-MyNominalContract" - } - - fn name_hash(self: @ContractState) -> felt252 { - 1172628497499445169993220559087829230676589931723677494032285307738203070578 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 2020162355936884646880401248118384176803981589166410970216209297939905305278 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - #[derive(Drop)] - struct Action { - damage: u8 - } - - #[abi(embed_v0)] - impl TestNominalImpl of INominalTrait {fn do_no_param(self: @ContractState) -> felt252 { 'land' -}fn do_no_param_but_world(self: @ContractState) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_no_param_but_world_ref(ref self: ContractState) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_params_no_world(self: @ContractState, p1: felt252, p2: u8) -> felt252 { 'land' -}fn do_params_and_world(self: @ContractState, p2: u8) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_params_and_world_ref(ref self: ContractState, p2: u8) -> felt252 {let world = self.world_dispatcher.read(); 'land' -}fn do_with_self(self: @ContractState) -> felt252 { 'land' -}fn do_with_ref_self(ref self: ContractState) -> felt252 { 'land' -}} - #[generate_trait] - impl ImplInternalNoContractState of InternalNoContractState { - fn func1(world: IWorldDispatcher) -> felt252 { - let _w = world; - 42 - } - } - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -impl ActionDrop of core::traits::Drop::; - trait InternalNoContractState { - fn func1(world: IWorldDispatcher) -> felt252; - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_no_param(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_no_param(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_no_param_but_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_no_param_but_world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_no_param_but_world_ref(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_no_param_but_world_ref(ref contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_params_no_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_p1 = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - let __arg_p2 = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #2' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_params_no_world(@contract_state, __arg_p1, __arg_p2); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_params_and_world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_p2 = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_params_and_world(@contract_state, __arg_p2); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_params_and_world_ref(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_p2 = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_params_and_world_ref(ref contract_state, __arg_p2); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_with_self(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_with_self(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__TestNominalImpl__do_with_ref_self(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = TestNominalImpl::do_with_ref_self(ref contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__TestNominalImpl__do_no_param as do_no_param; - pub use super::__wrapper__TestNominalImpl__do_no_param_but_world as do_no_param_but_world; - pub use super::__wrapper__TestNominalImpl__do_no_param_but_world_ref as do_no_param_but_world_ref; - pub use super::__wrapper__TestNominalImpl__do_params_no_world as do_params_no_world; - pub use super::__wrapper__TestNominalImpl__do_params_and_world as do_params_and_world; - pub use super::__wrapper__TestNominalImpl__do_params_and_world_ref as do_params_and_world_ref; - pub use super::__wrapper__TestNominalImpl__do_with_self as do_with_self; - pub use super::__wrapper__TestNominalImpl__do_with_ref_self as do_with_ref_self; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod init_test { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "init_test" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-init_test" - } - - fn name_hash(self: @ContractState) -> felt252 { - 1673722391095039242574232979635399085098867563460816803458086922970092209409 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 799876284284394866912776672431802324689156187217902437477103298743064217162 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) {let world = self.world_dispatcher.read();assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); emit!( - world, - ContractInitialized { - contract_address: actions_address, contract_class: actions_class, value - } - ); -} -} - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@actions_address, ref __calldata__); - core::serde::Serde::::serialize(@actions_class, ref __calldata__); - core::serde::Serde::::serialize(@value, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@actions_address, ref __calldata__); - core::serde::Serde::::serialize(@actions_class, ref __calldata__); - core::serde::Serde::::serialize(@value, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@actions_address, ref __calldata__); - core::serde::Serde::::serialize(@actions_class, ref __calldata__); - core::serde::Serde::::serialize(@value, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher, actions_address: ContractAddress, actions_class: ClassHash, value: u8 -) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - core::serde::Serde::::serialize(@actions_address, ref __calldata__); - core::serde::Serde::::serialize(@actions_class, ref __calldata__); - core::serde::Serde::::serialize(@value, ref __calldata__); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - let __arg_actions_address = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #1' - ); - let __arg_actions_class = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #2' - ); - let __arg_value = core::option::OptionTraitImpl::expect( - core::serde::Serde::::deserialize(ref data), - 'Failed to deserialize param #3' - ); - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, __arg_actions_address, __arg_actions_class, __arg_value); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - - } - - #[starknet::contract] - mod no_init_test { - use dojo::world; - use dojo::world::IWorldDispatcher; - use dojo::world::IWorldDispatcherTrait; - use dojo::world::IWorldProvider; - use dojo::contract::IContract; - use starknet::storage::{ - StorageMapReadAccess, StorageMapWriteAccess, StoragePointerReadAccess, StoragePointerWriteAccess - }; - - #[abi(embed_v0)] - pub impl ContractImpl of IContract { - fn contract_name(self: @ContractState) -> ByteArray { - "no_init_test" - } - - fn namespace(self: @ContractState) -> ByteArray { - "test_package" - } - - fn tag(self: @ContractState) -> ByteArray { - "test_package-no_init_test" - } - - fn name_hash(self: @ContractState) -> felt252 { - 2188407785440294979090510634648735461326850740369373015349552249835679156474 - } - - fn namespace_hash(self: @ContractState) -> felt252 { - 3061092720893075933752785490401950953836105364709575990296000909161416686979 - } - - fn selector(self: @ContractState) -> felt252 { - 3269287263937103915837903451864388946886384011514094502724942119672327217364 - } - } - - #[abi(embed_v0)] - impl WorldProviderImpl of IWorldProvider { - fn world(self: @ContractState) -> IWorldDispatcher { - self.world_dispatcher.read() - } - } - - #[abi(embed_v0)] - impl UpgradableImpl = dojo::contract::upgradeable::upgradeable::UpgradableImpl; - - - #[starknet::interface] - trait IDojoInit { - fn dojo_init(self: @ContractState); - } - - #[abi(embed_v0)] - impl IDojoInitImpl of IDojoInit { - fn dojo_init(self: @ContractState) { - assert(starknet::get_caller_address() == self.world().contract_address, 'Only world can init'); - } - } - - #[event] - #[derive(Drop, starknet::Event)] - enum Event { - UpgradeableEvent: dojo::contract::upgradeable::upgradeable::Event, - } -trait IDojoInitDispatcherTrait { - fn dojo_init(self: T); -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitLibraryDispatcherImpl of IDojoInitDispatcherTrait { - fn dojo_init(self: IDojoInitLibraryDispatcher) { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = starknet::SyscallResultTrait::unwrap_syscall(__dispatcher_return_data__); - () - } - -} - -trait IDojoInitSafeDispatcherTrait { - #[unstable(feature: "safe_dispatcher")] - fn dojo_init(self: T) -> starknet::SyscallResult<()>; -} - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeLibraryDispatcher { - pub class_hash: starknet::ClassHash, -} - -impl IDojoInitSafeLibraryDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::library_call_syscall( - self.class_hash, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} - - -#[derive(Copy, Drop, starknet::Store, Serde)] -struct IDojoInitSafeDispatcher { - pub contract_address: starknet::ContractAddress, -} - -impl IDojoInitSafeDispatcherImpl of IDojoInitSafeDispatcherTrait { - fn dojo_init(self: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - let mut __calldata__ = core::traits::Default::default(); - - let mut __dispatcher_return_data__ = starknet::syscalls::call_contract_syscall( - self.contract_address, - selector!("dojo_init"), - core::array::ArrayTrait::span(@__calldata__), - ); - let mut __dispatcher_return_data__ = __dispatcher_return_data__?; - Result::Ok(()) - } - -} -impl EventDrop of core::traits::Drop::; -impl EventIsEvent of starknet::Event { - fn append_keys_and_data( - self: @Event, ref keys: Array, ref data: Array - ) { - match self { - Event::UpgradeableEvent(val) => { - core::array::ArrayTrait::append(ref keys, selector!("UpgradeableEvent")); - starknet::Event::append_keys_and_data( - val, ref keys, ref data - ); - }, - } - } - fn deserialize( - ref keys: Span, ref data: Span, - ) -> Option { - let __selector__ = *core::array::SpanTrait::pop_front(ref keys)?; - if __selector__ == selector!("UpgradeableEvent") { - let val = starknet::Event::deserialize( - ref keys, ref data - )?; - return Option::Some(Event::UpgradeableEvent(val)); - } - Option::None - } -} -impl EventUpgradeableEventIntoEvent of Into { - fn into(self: dojo::contract::upgradeable::upgradeable::Event) -> Event { - Event::UpgradeableEvent(self) - } -} - - -#[phantom] -pub struct Storage { - pub world_dispatcher: IWorldDispatcher, - pub upgradeable: dojo::contract::upgradeable::upgradeable::Storage, -} - -#[derive(Drop, Copy)] -pub struct ContractStorageBase { - pub world_dispatcher: starknet::storage::StorageBase, - pub upgradeable: starknet::storage::StorageBase, -} -#[derive(Drop, Copy)] -pub struct ContractStorageBaseMut { - pub world_dispatcher: starknet::storage::StorageBase>, - pub upgradeable: starknet::storage::StorageBase>, -} -impl StorageBaseImpl of starknet::storage::StorageBaseTrait { - type BaseType = ContractStorageBase; - type BaseMutType = ContractStorageBaseMut; - fn storage_base(self: @ContractState) -> ContractStorageBase { - ContractStorageBase { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } - fn storage_base_mut(ref self: ContractState) -> ContractStorageBaseMut { - ContractStorageBaseMut { - world_dispatcher: starknet::storage::StorageBase{ address: selector!("world_dispatcher") }, - upgradeable: starknet::storage::StorageBase{ address: selector!("upgradeable") }, - } - } -} -pub struct ContractState { - pub upgradeable: dojo::contract::upgradeable::upgradeable::ComponentState, -} - -impl ContractStateDrop of Drop {} - -impl ContractStateDeref of core::ops::SnapshotDeref { - type Target = ContractStorageBase; - fn snapshot_deref(self: @ContractState) -> ContractStorageBase { - self.storage_base() - } -} -impl ContractStateDerefMut of core::ops::DerefMut { - type Target = ContractStorageBaseMut; - fn deref_mut(ref self: ContractState) -> ContractStorageBaseMut { - self.storage_base_mut() - } -} -pub fn unsafe_new_contract_state() -> ContractState { - ContractState { - upgradeable: dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::(), - } -} - -// TODO(Gil): This generates duplicate diagnostics because of the plugin system, squash the duplicates into one. -#[deprecated( - feature: "deprecated_legacy_map", - note: "Use `starknet::storage::Map` instead." -)] -use starknet::storage::Map as LegacyMap; - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__contract_name(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::contract_name(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__tag(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::tag(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__name_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::name_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__namespace_hash(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::namespace_hash(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__ContractImpl__selector(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = ContractImpl::selector(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__WorldProviderImpl__world(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - let res = WorldProviderImpl::world(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::serde::Serde::::serialize(@res, ref arr); - core::array::ArrayTrait::span(@arr) -} - -impl ContractStateUpgradableImpl of - dojo::contract::upgradeable::upgradeable::UnsafeNewContractStateTraitForUpgradableImpl { - fn unsafe_new_contract_state() -> ContractState { - unsafe_new_contract_state() - } -} -#[implicit_precedence(core::pedersen::Pedersen, core::RangeCheck, core::integer::Bitwise, core::ec::EcOp, core::poseidon::Poseidon, core::SegmentArena, core::circuit::RangeCheck96, core::circuit::AddMod, core::circuit::MulMod, core::gas::GasBuiltin, System)] -fn __wrapper__IDojoInitImpl__dojo_init(mut data: Span::) -> Span:: { - core::internal::require_implicit::(); - core::internal::revoke_ap_tracking(); - core::option::OptionTraitImpl::expect(core::gas::withdraw_gas(), 'Out of gas'); - - assert(core::array::SpanTrait::is_empty(data), 'Input too long for arguments'); - core::option::OptionTraitImpl::expect( - core::gas::withdraw_gas_all(core::gas::get_builtin_costs()), 'Out of gas', - ); - let mut contract_state = unsafe_new_contract_state(); - IDojoInitImpl::dojo_init(@contract_state, ); - let mut arr = ArrayTrait::new(); - // References. - // Result. - core::array::ArrayTrait::span(@arr) -} - - -pub mod __external { - pub use super::__wrapper__ContractImpl__contract_name as contract_name; - pub use super::__wrapper__ContractImpl__namespace as namespace; - pub use super::__wrapper__ContractImpl__tag as tag; - pub use super::__wrapper__ContractImpl__name_hash as name_hash; - pub use super::__wrapper__ContractImpl__namespace_hash as namespace_hash; - pub use super::__wrapper__ContractImpl__selector as selector; - pub use super::__wrapper__WorldProviderImpl__world as world; - pub use super::__wrapper__IDojoInitImpl__dojo_init as dojo_init; -} -pub mod __l1_handler { -} -pub mod __constructor { -} - impl ContractStateEventEmitter of starknet::event::EventEmitter< - ContractState, Event - > { - fn emit>( - ref self: ContractState, event: S - ) { - let event: Event = core::traits::Into::into(event); - let mut keys = Default::::default(); - let mut data = Default::::default(); - starknet::Event::append_keys_and_data(@event, ref keys, ref data); - starknet::SyscallResultTrait::unwrap_syscall( - starknet::syscalls::emit_event_syscall( - core::array::ArrayTrait::span(@keys), - core::array::ArrayTrait::span(@data), - ) - ) - } - } - -impl HasComponentImpl_upgradeable of dojo::contract::upgradeable::upgradeable::HasComponent { - fn get_component(self: @ContractState) -> @dojo::contract::upgradeable::upgradeable::ComponentState { - @dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_component_mut(ref self: ContractState) -> dojo::contract::upgradeable::upgradeable::ComponentState { - dojo::contract::upgradeable::upgradeable::unsafe_new_component_state::() - } - fn get_contract(self: @dojo::contract::upgradeable::upgradeable::ComponentState) -> @ContractState { - @unsafe_new_contract_state() - } - fn get_contract_mut(ref self: dojo::contract::upgradeable::upgradeable::ComponentState) -> ContractState { - unsafe_new_contract_state() - } - fn emit>(ref self: dojo::contract::upgradeable::upgradeable::ComponentState, event: S) { - let event: dojo::contract::upgradeable::upgradeable::Event = core::traits::Into::into(event); - let mut contract = dojo::contract::upgradeable::upgradeable::HasComponent::get_contract_mut(ref self); - ContractStateEventEmitter::emit(ref contract, Event::UpgradeableEvent(event)); - } -} -impl IDojoInitDispatcherCopy of core::traits::Copy::; -impl IDojoInitDispatcherDrop of core::traits::Drop::; -impl IDojoInitDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl IDojoInitLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeLibraryDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeLibraryDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.class_hash, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeLibraryDispatcher { - class_hash: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeLibraryDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let class_hash = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeLibraryDispatcher { - class_hash, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeLibraryDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.class_hash)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer, -} -impl IDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeLibraryDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeLibraryDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeLibraryDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let class_hash_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeLibraryDispatcherSubPointers { - class_hash: class_hash_value, - } - } -} -impl IDojoInitSafeDispatcherCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSerde of core::serde::Serde:: { - fn serialize(self: @IDojoInitSafeDispatcher, ref output: core::array::Array) { - core::serde::Serde::serialize(self.contract_address, ref output) - } - fn deserialize(ref serialized: core::array::Span) -> core::option::Option { - core::option::Option::Some(IDojoInitSafeDispatcher { - contract_address: core::serde::Serde::deserialize(ref serialized)?, - }) - } -} -impl StoreIDojoInitSafeDispatcher of starknet::Store:: { - fn read(address_domain: u32, base: starknet::storage_access::StorageBaseAddress) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read(address_domain, base)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - fn write(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write(address_domain, base, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - fn read_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8) -> starknet::SyscallResult { - let contract_address = starknet::Store::::read_at_offset(address_domain, base, offset)?; - starknet::SyscallResult::Ok( - IDojoInitSafeDispatcher { - contract_address, - } - ) - } - #[inline(always)] - fn write_at_offset(address_domain: u32, base: starknet::storage_access::StorageBaseAddress, offset: u8, value: IDojoInitSafeDispatcher) -> starknet::SyscallResult<()> { - starknet::Store::::write_at_offset(address_domain, base, offset, value.contract_address)?; - starknet::SyscallResult::Ok(()) - } - #[inline(always)] - fn size() -> u8 { - starknet::Store::::size() - } -} - -#[derive(Drop, Copy)] -struct IDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer, -} -impl IDojoInitSafeDispatcherSubPointersImpl of starknet::storage::SubPointers { -type SubPointersType = IDojoInitSafeDispatcherSubPointers; - fn sub_pointers(self: starknet::storage::StoragePointer) -> IDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - IDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -#[derive(Drop, Copy)] -struct MutableIDojoInitSafeDispatcherSubPointers { - contract_address: starknet::storage::StoragePointer>, -} -impl MutableIDojoInitSafeDispatcherSubPointersImpl of starknet::storage::MutableSubPointers { -type SubPointersType = MutableIDojoInitSafeDispatcherSubPointers; - fn sub_pointers_mut(self: starknet::storage::StoragePointer>) -> MutableIDojoInitSafeDispatcherSubPointers { - let base_address = self.address; - let mut current_offset = self.offset; - let contract_address_value = starknet::storage::StoragePointer { - address: base_address, - offset: current_offset, - }; - MutableIDojoInitSafeDispatcherSubPointers { - contract_address: contract_address_value, - } - } -} -impl ContractStorageBaseDrop of core::traits::Drop::; -impl ContractStorageBaseCopy of core::traits::Copy::; -impl ContractStorageBaseMutDrop of core::traits::Drop::; -impl ContractStorageBaseMutCopy of core::traits::Copy::; -impl IDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeLibraryDispatcherSubPointersCopy of core::traits::Copy::; -impl IDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl IDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; -impl MutableIDojoInitSafeDispatcherSubPointersDrop of core::traits::Drop::; -impl MutableIDojoInitSafeDispatcherSubPointersCopy of core::traits::Copy::; - + #[starknet::interface] + pub trait IFaultyTrait { + fn do_with_self_and_world(self: @ContractState, world: @IWorldDispatcher) -> felt252;fn do_with_ref_self_and_world(ref self: ContractState, ref world: IWorldDispatcher) -> felt252;fn do_with_self_and_world_inv(self: @TContractState, self: @ContractState) -> felt252;fn do_with_ref_self_and_world_inv(ref self: TContractState, ref self: ContractState +) -> felt252;fn do_with_several_world_dispatchers(self: @TContractState, vec: Vec2, ref another_world: IWorldDispatcher +) -> felt252;fn do_with_world_not_named_world(self: @TContractState, another_world: @IWorldDispatcher) -> felt252;fn do_with_world_not_first(self: @TContractState, vec: Vec2, ref world: IWorldDispatcher) -> felt252; } pub trait IEmptyTraitDispatcherTrait { } diff --git a/crates/dojo-lang/src/scarb_internal/mod.rs b/crates/dojo-lang/src/scarb_internal/mod.rs index 93526f77f3..9e72d835e7 100644 --- a/crates/dojo-lang/src/scarb_internal/mod.rs +++ b/crates/dojo-lang/src/scarb_internal/mod.rs @@ -1,3 +1,5 @@ +use std::fs; + // I have copied source code from https://github.com/software-mansion/scarb/blob/main/scarb/src/compiler/db.rs // since build_scarb_root_database is not public. // @@ -7,17 +9,24 @@ use anyhow::Result; use cairo_lang_compiler::db::RootDatabase; use cairo_lang_compiler::project::{ProjectConfig, ProjectConfigContent}; +use cairo_lang_filesystem::cfg::{Cfg, CfgSet}; use cairo_lang_filesystem::db::{CrateSettings, ExperimentalFeaturesConfig}; use cairo_lang_filesystem::ids::Directory; use cairo_lang_project::AllCratesConfig; use cairo_lang_starknet::starknet_plugin_suite; use cairo_lang_test_plugin::test_plugin_suite; use cairo_lang_utils::ordered_hash_map::OrderedHashMap; -use camino::Utf8PathBuf; -use scarb::compiler::{CairoCompilationUnit, CompilationUnit, CompilationUnitAttributes}; -use scarb::core::{Config, PackageId}; +use camino::{Utf8Path, Utf8PathBuf}; +use dojo_world::metadata::{NamespaceConfig, DEFAULT_NAMESPACE_CFG_KEY, NAMESPACE_CFG_PREFIX}; +use regex::Regex; +use scarb::compiler::{ + CairoCompilationUnit, CompilationUnit, CompilationUnitAttributes, CompilationUnitComponent, +}; +use scarb::core::{Config, Package, PackageId, TargetKind}; use scarb::ops::CompileOpts; +use scarb_ui::Ui; use smol_str::SmolStr; +use toml::Table; use tracing::trace; use crate::plugin::dojo_plugin_suite; @@ -90,6 +99,7 @@ pub fn compile_workspace( ) -> Result { let ws = scarb::ops::read_workspace(config.manifest_path(), config)?; let resolve = scarb::ops::resolve_workspace(&ws)?; + let ui = config.ui(); let compilation_units = scarb::ops::generate_compilation_units(&resolve, &opts.features, &ws)? .into_iter() @@ -103,15 +113,38 @@ pub fn compile_workspace( let mut compile_error_units = vec![]; for unit in compilation_units { - if let CompilationUnit::Cairo(unit) = unit { - let mut db = build_scarb_root_database(&unit).unwrap(); + trace!(target: LOG_TARGET, unit_name = %unit.name(), target_kind = %unit.main_component().target_kind(), "Compiling unit."); + + // Proc macro are not supported yet on Dojo, hence we only consider processing Cairo + // compilation units. + if let CompilationUnit::Cairo(mut unit) = unit { + let unit_name = unit.name(); + let re = Regex::new(r"\s*\([^()]*\)$").unwrap(); + let unit_name_no_path = re.replace(&unit_name, ""); + + ui.print(format!("compiling {}", unit_name_no_path)); + ui.verbose(format!("target kind: {}", unit.main_component().target_kind())); + + let root_package_data = PackageData::from_scarb_package(&unit.components[0].package)?; + + if let Some(nm_config) = &root_package_data.namespace_config { + ui.verbose(nm_config.display_mappings()); + } + // For each component in the compilation unit (namely, the dependencies being + // compiled) we inject into the `CfgSet` the component name and + // namespace configuration. Doing this here ensures the parsing of + // of the manifest is done once at compile time, and not everytime + // the plugin is called. + for c in unit.components.iter_mut() { + c.cfg_set = Some(cfg_set_from_component(c, &root_package_data, &ui)?); + } + + let mut db = build_scarb_root_database(&unit).unwrap(); if let Err(err) = ws.config().compilers().compile(unit.clone(), &mut (db), &ws) { ws.config().ui().anyhow(&err); compile_error_units.push(unit.name()); } - } else { - tracing::warn!(target: LOG_TARGET, name = unit.name(), "Skipping compilation unit."); } } @@ -166,3 +199,135 @@ fn build_project_config(unit: &CairoCompilationUnit) -> Result { Ok(project_config) } + +#[derive(Debug)] +pub struct PackageData { + pub namespace_config: Option, +} + +impl PackageData { + pub fn from_scarb_package(package: &Package) -> Result { + let manifest_path = package.manifest_path(); + let is_lib = package.is_lib(); + let is_dojo_target = package.target(&TargetKind::new(SmolStr::from("dojo"))).is_some(); + + if is_lib && is_dojo_target { + return Err(anyhow::anyhow!( + "A library package [lib] cannot have dojo target [[target.dojo]] ({}).", + manifest_path + )); + } + + let mut is_dojo_dependent = false; + + // Read the manifest path to inspect package dependencies. + let manifest_content = match fs::read_to_string(manifest_path) { + Ok(x) => x, + Err(e) => return Err(anyhow::anyhow!("Failed to read Scarb.toml file: {e}.")), + }; + + let config = match manifest_content.parse::() { + Ok(x) => x, + Err(e) => return Err(anyhow::anyhow!("Failed to parse Scarb.toml file: {e}.")), + }; + + if let Some(dependencies) = config.get("dependencies").and_then(|t| t.as_table()) { + for (dep_name, _) in dependencies.iter() { + if dep_name == "dojo" { + is_dojo_dependent = true; + break; + } + } + } + + let namespace_config = namespace_config_from_toml(manifest_path, &config)?; + + if is_dojo_dependent && namespace_config.is_none() { + return Err(anyhow::anyhow!( + "A package with dojo as a dependency must at least define a default namespace \ + inside [tool.dojo.world.namespace] ({}).", + manifest_path + )); + } + + Ok(Self { namespace_config }) + } +} + +fn namespace_config_from_toml( + config_path: &Utf8Path, + config: &Table, +) -> Result> { + if let Some(tool) = config.get("tool").and_then(|t| t.as_table()) { + if let Some(dojo) = tool.get("dojo").and_then(|d| d.as_table()) { + if let Some(world) = dojo.get("world").and_then(|w| w.as_table()) { + if let Some(namespace_config) = world.get("namespace").and_then(|n| n.as_table()) { + match toml::from_str::(&namespace_config.to_string()) { + Ok(config) => return Ok(Some(config.validate()?)), + Err(e) => { + return Err(anyhow::anyhow!( + "Failed to parse namespace configuration of {}: {}", + config_path.to_string(), + e + )); + } + } + } + } + } + } + + Ok(None) +} + +pub fn cfg_set_from_component( + c: &CompilationUnitComponent, + root_package_data: &PackageData, + ui: &Ui, +) -> Result { + let cname = c.cairo_package_name().clone(); + let package_data = PackageData::from_scarb_package(&c.package)?; + + ui.verbose(format!("component: {} ({})", cname, c.package.manifest_path())); + + tracing::debug!(target: LOG_TARGET, ?c, ?package_data); + + let component_cfg = Cfg { key: "component_name".into(), value: Some(cname) }; + + let mut cfg_set = CfgSet::new(); + + // Keep orinigal cfg set of the component. + if let Some(component_cfg_set) = c.cfg_set.clone() { + for cfg in component_cfg_set.into_iter() { + cfg_set.insert(cfg); + } + } + + // Add it's name for debugging on the plugin side. + cfg_set.insert(component_cfg); + + if let Some(namespace_config) = package_data.namespace_config { + cfg_set.insert(Cfg { + key: DEFAULT_NAMESPACE_CFG_KEY.into(), + value: Some(namespace_config.default.into()), + }); + + // We ignore mappings for dependencies as the [[target.dojo]] package is + // defining them. + } + + // Inject the mapping from the root package with [[target.dojo]] to + // all dependencies to ensure correct namespace mappings. + if let Some(config) = &root_package_data.namespace_config { + if let Some(mappings) = &config.mappings { + for (k, v) in mappings.iter() { + cfg_set.insert(Cfg { + key: format!("{}{}", NAMESPACE_CFG_PREFIX, k).into(), + value: Some(v.into()), + }); + } + } + } + + Ok(cfg_set) +} diff --git a/crates/dojo-lang/src/semantics/test_data/set b/crates/dojo-lang/src/semantics/test_data/set index d07054bc86..2a9249f47c 100644 --- a/crates/dojo-lang/src/semantics/test_data/set +++ b/crates/dojo-lang/src/semantics/test_data/set @@ -120,7 +120,7 @@ Block( StatementExpr { expr: FunctionCall( ExprFunctionCall { - function: test::HealthModelImpl::set, + function: ?6::set, args: [ Value( Snapshot( @@ -151,7 +151,17 @@ Block( ) //! > semantic_diagnostics +error: Plugin diagnostic: The namespace '' can only contain characters (a-z/A-Z), digits (0-9) and underscore (_). + --> lib.cairo:5:8 +struct Health { + ^****^ + warning[E0001]: Unused variable. Consider ignoring by prefixing with `_`. --> lib.cairo:10:22 fn test_func() { let key: felt252 = 0xb0b; ^*^ + +error: Trait has no implementation in context: dojo::model::model::Model::. + --> lib.cairo:12:1 +set!(world, (Health{id: 0xb0b, health: 79})) +^******************************************^ diff --git a/crates/dojo-lang/src/utils.rs b/crates/dojo-lang/src/utils.rs index 4398c2677f..1f3c8f20e6 100644 --- a/crates/dojo-lang/src/utils.rs +++ b/crates/dojo-lang/src/utils.rs @@ -15,6 +15,10 @@ pub fn is_name_valid(name: &str) -> bool { /// Get the namespace configuration from the workspace. // TODO: Ask to Scarb team to expose this information with the new macro system. pub fn get_namespace_config(db: &dyn SyntaxGroup) -> Result { + // Super verbose print, but useful to get the CfgSet. + // debug!(cfg_set = ?db.cfg_set(), crates = ?db.crates(), "Retrieving namespace + // configuration."); + let crates = db.crates(); if crates.is_empty() { @@ -26,13 +30,20 @@ pub fn get_namespace_config(db: &dyn SyntaxGroup) -> Result { // Crates[0] is always the root crate that triggered the build origin. // In case of a library, crates[0] refers to the lib itself if compiled directly, // or the crate using the library otherwise. - let configuration = match db.crate_config(crates[0]) { + let configuration = match db + .crate_config(*crates.first().expect("No root crate found in the workspace.")) + { Option::Some(cfg) => cfg, Option::None => return Err(anyhow::anyhow!("No configuration found for the root crate.")), }; if let Directory::Real(ref path) = configuration.root { let config_path = path.parent().unwrap().join("Scarb.toml"); + + // Very verbose. + // tracing::debug!(config_path = %config_path.to_string_lossy(), "Reading Scarb.toml file + // for namespace config."); + let config_content = match fs::read_to_string(&config_path) { Ok(x) => x, Err(e) => return Err(anyhow::anyhow!("Failed to read Scarb.toml file: {e}.")), @@ -64,10 +75,27 @@ pub fn get_namespace_config(db: &dyn SyntaxGroup) -> Result { } } - // For debugging, adding the configuration.root can help to inspect the - // crate path and it's content. But it must not be used otherwise, as it - // can be a different path due to tmp dirs being used. - Err(anyhow::anyhow!( - "Namespace configuration expected at tool.dojo.world.namespace, but not found or invalid.", - )) + // If no namespace is found, we return a default one as it's surely a crate that doesn't + // need it. This only concern the tests. + Ok(NamespaceConfig { default: "__NO_NAMESPACE__".into(), mappings: None }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_is_name_valid() { + assert!(is_name_valid("valid_name")); + assert!(is_name_valid("ValidName")); + assert!(is_name_valid("valid123")); + assert!(is_name_valid("_valid")); + assert!(is_name_valid("valid_")); + + assert!(!is_name_valid("")); + assert!(!is_name_valid("invalid-name")); + assert!(!is_name_valid("invalid name")); + assert!(!is_name_valid("invalid!name")); + assert!(!is_name_valid("invalid.name")); + } } diff --git a/crates/dojo-world/src/metadata.rs b/crates/dojo-world/src/metadata.rs index b489258dea..8a76395eda 100644 --- a/crates/dojo-world/src/metadata.rs +++ b/crates/dojo-world/src/metadata.rs @@ -2,11 +2,12 @@ use std::collections::HashMap; use std::io::Cursor; use std::path::PathBuf; -use anyhow::{anyhow, Context, Result}; +use anyhow::{Context, Result}; +use cairo_lang_filesystem::cfg::CfgSet; use camino::Utf8PathBuf; use ipfs_api_backend_hyper::{IpfsApi, IpfsClient, TryFromUri}; use regex::Regex; -use scarb::core::{ManifestMetadata, Workspace}; +use scarb::core::{ManifestMetadata, Package, TargetKind, Workspace}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use serde_json::json; use url::Url; @@ -14,6 +15,8 @@ use url::Url; use crate::contracts::naming; use crate::manifest::{BaseManifest, CONTRACTS_DIR, MODELS_DIR, WORLD_CONTRACT_TAG}; +const LOG_TARGET: &str = "dojo_world::metadata"; + #[cfg(test)] #[path = "metadata_test.rs"] mod test; @@ -26,24 +29,8 @@ pub const IPFS_PASSWORD: &str = "12290b883db9138a8ae3363b6739d220"; pub const MANIFESTS_DIR: &str = "manifests"; pub const ABIS_DIR: &str = "abis"; pub const BASE_DIR: &str = "base"; - -fn build_artifact_from_filename( - abi_dir: &Utf8PathBuf, - source_dir: &Utf8PathBuf, - filename: &str, -) -> ArtifactMetadata { - let abi_file = abi_dir.join(format!("{filename}.json")); - let src_file = source_dir.join(format!("{filename}.cairo")); - - ArtifactMetadata { - abi: if abi_file.exists() { Some(Uri::File(abi_file.into_std_path_buf())) } else { None }, - source: if src_file.exists() { - Some(Uri::File(src_file.into_std_path_buf())) - } else { - None - }, - } -} +pub const NAMESPACE_CFG_PREFIX: &str = "nm|"; +pub const DEFAULT_NAMESPACE_CFG_KEY: &str = "namespace_default"; /// Get the default namespace from the workspace. /// @@ -96,52 +83,96 @@ pub fn project_to_world_metadata(m: ProjectWorldMetadata) -> WorldMetadata { } } -/// Collect metadata from the project configuration and from the workspace. -/// -/// # Arguments -/// `ws`: the workspace. -/// -/// # Returns -/// A [`DojoMetadata`] object containing all Dojo metadata. -pub fn dojo_metadata_from_workspace(ws: &Workspace<'_>) -> Result { - let profile = ws.config().profile(); +pub fn dojo_metadata_from_package(package: &Package, ws: &Workspace<'_>) -> Result { + tracing::debug!(target: LOG_TARGET, package_id = package.id.to_string(), "Collecting Dojo metadata from package."); - let manifest_dir = ws.manifest_path().parent().unwrap().to_path_buf(); - let manifest_dir = manifest_dir.join(MANIFESTS_DIR).join(profile.as_str()); - let abi_dir = manifest_dir.join(BASE_DIR).join(ABIS_DIR); - let source_dir = ws.target_dir().path_existent().unwrap(); - let source_dir = source_dir.join(profile.as_str()); + // If it's a lib, we can try to extract dojo data. If failed -> then we can return default. + // But like so, if some metadata are here, we get them. + // [[target.dojo]] shouldn't be used with [lib] as no files will be deployed. + let is_lib = package.target(&TargetKind::new("lib")).is_some(); + let is_dojo = package.target(&TargetKind::new("dojo")).is_some(); - let project_metadata = if let Ok(current_package) = ws.current_package() { - current_package - .manifest - .metadata - .dojo() - .with_context(|| format!("Error parsing manifest file `{}`", ws.manifest_path()))? - } else { - // On workspaces, dojo metadata are not accessible because if no current package is defined - // (being the only package or using --package). - return Err(anyhow!( - "No current package with dojo metadata found, virtual manifest in workspace are not \ - supported. Until package compilation is supported, you will have to provide the path \ - to the Scarb.toml file using the --manifest-path option." - )); - }; + if is_lib && is_dojo { + return Err(anyhow::anyhow!("[lib] package cannot have [[target.dojo]].")); + } + + let project_metadata = match package.manifest.metadata.dojo() { + Ok(m) => Ok(m), + Err(e) => { + if is_lib || !is_dojo { + Ok(ProjectMetadata::default()) + } else { + Err(anyhow::anyhow!( + "In manifest {} [dojo] package must have [[target.dojo]]: {}.", + ws.manifest_path(), + e + )) + } + } + }?; let mut dojo_metadata = DojoMetadata { env: project_metadata.env.clone(), skip_migration: project_metadata.skip_migration.clone(), + world: project_to_world_metadata(project_metadata.world), ..Default::default() }; + metadata_artifacts_load(&mut dojo_metadata, ws)?; + + tracing::trace!(target: LOG_TARGET, ?dojo_metadata); + + Ok(dojo_metadata) +} + +pub fn dojo_metadata_from_workspace(ws: &Workspace<'_>) -> Result { + let dojo_packages: Vec = ws + .members() + .filter(|package| { + package.target(&TargetKind::new("dojo")).is_some() + && package.target(&TargetKind::new("lib")).is_none() + }) + .collect(); + + match dojo_packages.len() { + 0 => { + ws.config().ui().warn( + "No package with dojo target found in workspace. If your package is a [lib] with \ + [[target.dojo]], you can ignore this warning.", + ); + Ok(DojoMetadata::default()) + } + 1 => { + let dojo_package = + dojo_packages.into_iter().next().expect("Package must exist as len is 1."); + Ok(dojo_metadata_from_package(&dojo_package, ws)?) + } + _ => Err(anyhow::anyhow!( + "Multiple packages with dojo target found in workspace. Please specify a package \ + using --package option or maybe one of them must be declared as a [lib]." + )), + } +} + +/// Loads the artifacts metadata for the world. +/// TODO: if the compiler supports to output the data to the package level, +/// we should also pass the package to use it's path instead of the WS root. +fn metadata_artifacts_load(dojo_metadata: &mut DojoMetadata, ws: &Workspace<'_>) -> Result<()> { + let profile = ws.config().profile(); + + // Use package.manifest_path() if supported by the compiler. + let manifest_dir = ws.manifest_path().parent().unwrap().to_path_buf(); + let manifest_dir = manifest_dir.join(MANIFESTS_DIR).join(profile.as_str()); + let abi_dir = manifest_dir.join(BASE_DIR).join(ABIS_DIR); + let source_dir = ws.target_dir().path_existent().unwrap(); + let source_dir = source_dir.join(profile.as_str()); + let world_artifact = build_artifact_from_filename( &abi_dir, &source_dir, &naming::get_filename_from_tag(WORLD_CONTRACT_TAG), ); - // inialize Dojo world metadata with world metadata coming from project configuration - dojo_metadata.world = project_to_world_metadata(project_metadata.world); dojo_metadata.world.artifacts = world_artifact; // load models and contracts metadata @@ -183,7 +214,25 @@ pub fn dojo_metadata_from_workspace(ws: &Workspace<'_>) -> Result } } - Ok(dojo_metadata) + Ok(()) +} + +fn build_artifact_from_filename( + abi_dir: &Utf8PathBuf, + source_dir: &Utf8PathBuf, + filename: &str, +) -> ArtifactMetadata { + let abi_file = abi_dir.join(format!("{filename}.json")); + let src_file = source_dir.join(format!("{filename}.cairo")); + + ArtifactMetadata { + abi: if abi_file.exists() { Some(Uri::File(abi_file.into_std_path_buf())) } else { None }, + source: if src_file.exists() { + Some(Uri::File(src_file.into_std_path_buf())) + } else { + None + }, + } } /// Metadata coming from project configuration (Scarb.toml) @@ -276,18 +325,31 @@ pub struct NamespaceConfig { } impl NamespaceConfig { - /// Create a new namespace configuration with a default namespace. + /// Creates a new namespace configuration with a default namespace. pub fn new(default: &str) -> Self { NamespaceConfig { default: default.to_string(), mappings: None } } - /// Add mappings to the namespace configuration. + /// Adds mappings to the namespace configuration. pub fn with_mappings(mut self, mappings: HashMap) -> Self { self.mappings = Some(mappings); self } - /// Get the namespace for a given tag or namespace, or return the default + /// Displays the namespace mappings as a string. + pub fn display_mappings(&self) -> String { + if let Some(mappings) = &self.mappings { + let mut result = String::from("\n-- Mappings --\n"); + for (k, v) in mappings.iter() { + result += &format!("{} -> {}\n", k, v); + } + result + } else { + "No mapping to apply".to_string() + } + } + + /// Gets the namespace for a given tag or namespace, or return the default /// namespace if no mapping was found. /// /// If the input is a tag, a first perfect match is checked. If no match @@ -354,6 +416,30 @@ impl NamespaceConfig { } } +impl From<&CfgSet> for NamespaceConfig { + fn from(cfg_set: &CfgSet) -> Self { + let mut default = "".to_string(); + let mut mappings = HashMap::new(); + + for cfg in cfg_set.into_iter() { + if cfg.key == DEFAULT_NAMESPACE_CFG_KEY { + if let Some(v) = &cfg.value { + default = v.to_string(); + } + } else if cfg.key.starts_with(NAMESPACE_CFG_PREFIX) { + let key = cfg.key.replace(NAMESPACE_CFG_PREFIX, ""); + if let Some(v) = &cfg.value { + mappings.insert(key, v.to_string()); + } + } + } + + let mappings = if mappings.is_empty() { None } else { Some(mappings) }; + + NamespaceConfig { default: default.to_string(), mappings } + } +} + /// World metadata coming from the project configuration (Scarb.toml) #[derive(Default, Serialize, Deserialize, Debug, Clone)] pub struct ProjectWorldMetadata { @@ -563,6 +649,9 @@ impl MetadataExt for ManifestMetadata { #[cfg(test)] mod tests { + use cairo_lang_filesystem::cfg::Cfg; + use smol_str::SmolStr; + use super::*; #[test] @@ -647,4 +736,32 @@ mod tests { assert!(!is_name_valid("invalid!name")); assert!(!is_name_valid("")); } + + #[test] + fn test_namespace_config_from_cfg_set() { + let mut cfg_set = CfgSet::new(); + cfg_set.insert(Cfg::kv(DEFAULT_NAMESPACE_CFG_KEY, SmolStr::from("default_namespace"))); + cfg_set + .insert(Cfg::kv(format!("{}tag1", NAMESPACE_CFG_PREFIX), SmolStr::from("namespace1"))); + cfg_set + .insert(Cfg::kv(format!("{}tag2", NAMESPACE_CFG_PREFIX), SmolStr::from("namespace2"))); + + let namespace_config = NamespaceConfig::from(&cfg_set); + + assert_eq!(namespace_config.default, "default_namespace"); + assert_eq!( + namespace_config.mappings, + Some(HashMap::from([ + ("tag1".to_string(), "namespace1".to_string()), + ("tag2".to_string(), "namespace2".to_string()), + ])) + ); + + // Test with empty CfgSet + let empty_cfg_set = CfgSet::new(); + let empty_namespace_config = NamespaceConfig::from(&empty_cfg_set); + + assert_eq!(empty_namespace_config.default, ""); + assert_eq!(empty_namespace_config.mappings, None); + } } diff --git a/crates/torii/types-test/Scarb.lock b/crates/torii/types-test/Scarb.lock index edb8f3c6fe..ba40a5e915 100644 --- a/crates/torii/types-test/Scarb.lock +++ b/crates/torii/types-test/Scarb.lock @@ -11,7 +11,7 @@ dependencies = [ [[package]] name = "dojo_plugin" version = "0.7.3" -source = "git+https://github.com/dojoengine/dojo?rev=d90b52b#d90b52b89749ac8af82f352dc08aa0b1378cfae6" +source = "git+https://github.com/dojoengine/dojo?rev=71b1f1a4#71b1f1a467534cbeeb901356f41e612ed4187bd1" [[package]] name = "types_test" diff --git a/examples/game-lib/armory/Scarb.toml b/examples/game-lib/armory/Scarb.toml index fdab38f9eb..cd7deccd3b 100644 --- a/examples/game-lib/armory/Scarb.toml +++ b/examples/game-lib/armory/Scarb.toml @@ -8,9 +8,5 @@ dojo.workspace = true [lib] -[[target.dojo]] - [tool.dojo.world] -name = "armory" -seed = "armory" namespace = { default = "armory" } diff --git a/examples/game-lib/armory/src/lib.cairo b/examples/game-lib/armory/src/lib.cairo index a62c9b300c..b182078d8a 100644 --- a/examples/game-lib/armory/src/lib.cairo +++ b/examples/game-lib/armory/src/lib.cairo @@ -1,5 +1,5 @@ #[derive(Drop, Serde)] -#[dojo::model(namespace: "armory")] +#[dojo::model] pub struct Flatbow { #[key] pub id: u32, diff --git a/examples/game-lib/bestiary/Scarb.toml b/examples/game-lib/bestiary/Scarb.toml index 0ed5683c30..dbd6dd7ae8 100644 --- a/examples/game-lib/bestiary/Scarb.toml +++ b/examples/game-lib/bestiary/Scarb.toml @@ -8,9 +8,5 @@ dojo.workspace = true [lib] -[[target.dojo]] - [tool.dojo.world] -name = "bestiary" -seed = "bestiary" namespace = { default = "bestiary" } diff --git a/examples/game-lib/bestiary/src/lib.cairo b/examples/game-lib/bestiary/src/lib.cairo index d193ab7dbc..77f4ac831c 100644 --- a/examples/game-lib/bestiary/src/lib.cairo +++ b/examples/game-lib/bestiary/src/lib.cairo @@ -1,5 +1,5 @@ #[derive(Drop, Serde)] -#[dojo::model(namespace: "bestiary")] +#[dojo::model] pub struct RiverSkale { #[key] pub id: u32, diff --git a/examples/spawn-and-move/Scarb.lock b/examples/spawn-and-move/Scarb.lock index 68f04294c2..5b6d7916bc 100644 --- a/examples/spawn-and-move/Scarb.lock +++ b/examples/spawn-and-move/Scarb.lock @@ -34,4 +34,4 @@ dependencies = [ [[package]] name = "dojo_plugin" version = "0.7.3" -source = "git+https://github.com/dojoengine/dojo?rev=d90b52b#d90b52b89749ac8af82f352dc08aa0b1378cfae6" +source = "git+https://github.com/dojoengine/dojo?rev=71b1f1a4#71b1f1a467534cbeeb901356f41e612ed4187bd1"