diff --git a/benchmark/rust-toolchain b/benchmark/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/benchmark/rust-toolchain +++ b/benchmark/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/core/src/address.rs b/core/src/address.rs index 6214601b..bfd331c2 100644 --- a/core/src/address.rs +++ b/core/src/address.rs @@ -203,6 +203,7 @@ impl FromStr for Address { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for Address { fn to_string(&self) -> String { Key::from(*self).to_formatted_string() diff --git a/examples/ourcoin/rust-toolchain b/examples/ourcoin/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/examples/ourcoin/rust-toolchain +++ b/examples/ourcoin/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/justfile b/justfile index e0065dad..11833e25 100644 --- a/justfile +++ b/justfile @@ -1,5 +1,5 @@ CARGO_ODRA_GIT_REPO := "https://github.com/odradev/cargo-odra" -CARGO_ODRA_BRANCH := "release/0.1.2" +CARGO_ODRA_BRANCH := "release/0.1.3" BINARYEN_VERSION := "version_116" BINARYEN_CHECKSUM := "c55b74f3109cdae97490faf089b0286d3bba926bb6ea5ed00c8c784fc53718fd" @@ -36,7 +36,7 @@ install-cargo-odra: prepare-test-env: install-cargo-odra rustup target add wasm32-unknown-unknown rustup component add llvm-tools-preview - cargo install grcov + cargo +stable install grcov sudo apt install wabt wget https://github.com/WebAssembly/binaryen/releases/download/{{BINARYEN_VERSION}}/binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz || { echo "Download failed"; exit 1; } sha256sum binaryen-{{BINARYEN_VERSION}}-x86_64-linux.tar.gz | grep {{BINARYEN_CHECKSUM}} || { echo "Checksum verification failed"; exit 1; } diff --git a/modules/resources/casper_contract_schemas/cep18_client_contract_schema.json b/modules/resources/casper_contract_schemas/cep18_client_contract_schema.json index 0204f7a9..9d050ac1 100644 --- a/modules/resources/casper_contract_schemas/cep18_client_contract_schema.json +++ b/modules/resources/casper_contract_schemas/cep18_client_contract_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Cep18ClientContract", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [], "errors": [], "entry_points": [ diff --git a/modules/resources/casper_contract_schemas/cep18_schema.json b/modules/resources/casper_contract_schemas/cep18_schema.json index 86cb0648..d7d51b8c 100644 --- a/modules/resources/casper_contract_schemas/cep18_schema.json +++ b/modules/resources/casper_contract_schemas/cep18_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Cep18", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { @@ -199,6 +199,52 @@ } ] } + }, + { + "enum": { + "name": "Cep18Modality", + "description": null, + "variants": [ + { + "name": "None", + "description": null, + "discriminant": 0, + "ty": "Unit" + }, + { + "name": "MintAndBurn", + "description": null, + "discriminant": 1, + "ty": "Unit" + } + ] + } + }, + { + "enum": { + "name": "SecurityBadge", + "description": null, + "variants": [ + { + "name": "Admin", + "description": null, + "discriminant": 0, + "ty": "Unit" + }, + { + "name": "Minter", + "description": null, + "discriminant": 1, + "ty": "Unit" + }, + { + "name": "None", + "description": null, + "discriminant": 2, + "ty": "Unit" + } + ] + } } ], "errors": [ diff --git a/modules/resources/casper_contract_schemas/erc1155_receiver_schema.json b/modules/resources/casper_contract_schemas/erc1155_receiver_schema.json index 64eba34c..a288f11b 100644 --- a/modules/resources/casper_contract_schemas/erc1155_receiver_schema.json +++ b/modules/resources/casper_contract_schemas/erc1155_receiver_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Erc1155Receiver", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/erc1155_token_schema.json b/modules/resources/casper_contract_schemas/erc1155_token_schema.json index ee9746d7..dcd7794b 100644 --- a/modules/resources/casper_contract_schemas/erc1155_token_schema.json +++ b/modules/resources/casper_contract_schemas/erc1155_token_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Erc1155Token", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/erc721_receiver_schema.json b/modules/resources/casper_contract_schemas/erc721_receiver_schema.json index ee96b96c..cd0a7edc 100644 --- a/modules/resources/casper_contract_schemas/erc721_receiver_schema.json +++ b/modules/resources/casper_contract_schemas/erc721_receiver_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Erc721Receiver", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [], "errors": [], "entry_points": [ diff --git a/modules/resources/casper_contract_schemas/erc721_token_schema.json b/modules/resources/casper_contract_schemas/erc721_token_schema.json index f4d0965a..a0ef9cda 100644 --- a/modules/resources/casper_contract_schemas/erc721_token_schema.json +++ b/modules/resources/casper_contract_schemas/erc721_token_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Erc721Token", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/mock_cep78_operator_schema.json b/modules/resources/casper_contract_schemas/mock_cep78_operator_schema.json new file mode 100644 index 00000000..b818be18 --- /dev/null +++ b/modules/resources/casper_contract_schemas/mock_cep78_operator_schema.json @@ -0,0 +1,228 @@ +{ + "casper_contract_schema_version": 1, + "toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)", + "authors": [ + "Jakub Płaskonka ", + "Krzysztof Pobiarżyn ", + "Maciej Zieliński " + ], + "repository": "https://github.com/odradev/odra", + "homepage": null, + "contract_name": "MockCep78Operator", + "contract_version": "1.1.0", + "types": [], + "errors": [], + "entry_points": [ + { + "name": "set_address", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "nft_contract", + "description": null, + "ty": "Key", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "mint", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_metadata", + "description": null, + "ty": "String", + "optional": false + }, + { + "name": "is_reverse_lookup_enabled", + "description": null, + "ty": "Bool", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "mint_with_hash", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_metadata", + "description": null, + "ty": "String", + "optional": false + }, + { + "name": "token_hash", + "description": null, + "ty": "String", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "burn", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_id", + "description": null, + "ty": "U64", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "mint_for", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_owner", + "description": null, + "ty": "Key", + "optional": false + }, + { + "name": "token_metadata", + "description": null, + "ty": "String", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "transfer", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_id", + "description": null, + "ty": "U64", + "optional": false + }, + { + "name": "target", + "description": null, + "ty": "Key", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "transfer_from", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_id", + "description": null, + "ty": "U64", + "optional": false + }, + { + "name": "source", + "description": null, + "ty": "Key", + "optional": false + }, + { + "name": "target", + "description": null, + "ty": "Key", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "approve", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "spender", + "description": null, + "ty": "Key", + "optional": false + }, + { + "name": "token_id", + "description": null, + "ty": "U64", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "revoke", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "token_id", + "description": null, + "ty": "U64", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + } + ], + "events": [], + "call": { + "wasm_file_name": "MockCep78Operator.wasm", + "description": null, + "arguments": [ + { + "name": "odra_cfg_package_hash_key_name", + "description": "The arg name for the package hash key name.", + "ty": "String", + "optional": false + }, + { + "name": "odra_cfg_allow_key_override", + "description": "The arg name for the allow key override.", + "ty": "Bool", + "optional": false + }, + { + "name": "odra_cfg_is_upgradable", + "description": "The arg name for the contract upgradeability setting.", + "ty": "Bool", + "optional": false + } + ] + } +} \ No newline at end of file diff --git a/modules/resources/casper_contract_schemas/mock_cep78_transfer_filter_schema.json b/modules/resources/casper_contract_schemas/mock_cep78_transfer_filter_schema.json new file mode 100644 index 00000000..134a765b --- /dev/null +++ b/modules/resources/casper_contract_schemas/mock_cep78_transfer_filter_schema.json @@ -0,0 +1,67 @@ +{ + "casper_contract_schema_version": 1, + "toolchain": "rustc 1.78.0-nightly (98aa3624b 2024-02-08)", + "authors": [ + "Jakub Płaskonka ", + "Krzysztof Pobiarżyn ", + "Maciej Zieliński " + ], + "repository": "https://github.com/odradev/odra", + "homepage": null, + "contract_name": "MockCep78TransferFilter", + "contract_version": "1.1.0", + "types": [], + "errors": [], + "entry_points": [ + { + "name": "set_return_value", + "description": "", + "is_mutable": true, + "arguments": [ + { + "name": "return_value", + "description": null, + "ty": "U8", + "optional": false + } + ], + "return_ty": "Unit", + "is_contract_context": true, + "access": "public" + }, + { + "name": "can_transfer", + "description": "", + "is_mutable": false, + "arguments": [], + "return_ty": "U8", + "is_contract_context": true, + "access": "public" + } + ], + "events": [], + "call": { + "wasm_file_name": "MockCep78TransferFilter.wasm", + "description": null, + "arguments": [ + { + "name": "odra_cfg_package_hash_key_name", + "description": "The arg name for the package hash key name.", + "ty": "String", + "optional": false + }, + { + "name": "odra_cfg_allow_key_override", + "description": "The arg name for the allow key override.", + "ty": "Bool", + "optional": false + }, + { + "name": "odra_cfg_is_upgradable", + "description": "The arg name for the contract upgradeability setting.", + "ty": "Bool", + "optional": false + } + ] + } +} \ No newline at end of file diff --git a/modules/resources/casper_contract_schemas/mock_dummy_contract_schema.json b/modules/resources/casper_contract_schemas/mock_dummy_contract_schema.json index d25439e5..83b10e48 100644 --- a/modules/resources/casper_contract_schemas/mock_dummy_contract_schema.json +++ b/modules/resources/casper_contract_schemas/mock_dummy_contract_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "MockDummyContract", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [], "errors": [], "entry_points": [], diff --git a/modules/resources/casper_contract_schemas/ownable2_step_schema.json b/modules/resources/casper_contract_schemas/ownable2_step_schema.json index 9c668e98..452df4f7 100644 --- a/modules/resources/casper_contract_schemas/ownable2_step_schema.json +++ b/modules/resources/casper_contract_schemas/ownable2_step_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Ownable2Step", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/ownable_schema.json b/modules/resources/casper_contract_schemas/ownable_schema.json index 84c419fc..366171d9 100644 --- a/modules/resources/casper_contract_schemas/ownable_schema.json +++ b/modules/resources/casper_contract_schemas/ownable_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "Ownable", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/test_cep78_schema.json b/modules/resources/casper_contract_schemas/test_cep78_schema.json index 521fb72c..23c700fb 100644 --- a/modules/resources/casper_contract_schemas/test_cep78_schema.json +++ b/modules/resources/casper_contract_schemas/test_cep78_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "TestCep78", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/casper_contract_schemas/wrapped_native_token_schema.json b/modules/resources/casper_contract_schemas/wrapped_native_token_schema.json index 836c00a6..48de3d02 100644 --- a/modules/resources/casper_contract_schemas/wrapped_native_token_schema.json +++ b/modules/resources/casper_contract_schemas/wrapped_native_token_schema.json @@ -9,7 +9,7 @@ "repository": "https://github.com/odradev/odra", "homepage": null, "contract_name": "WrappedNativeToken", - "contract_version": "1.0.0", + "contract_version": "1.1.0", "types": [ { "struct": { diff --git a/modules/resources/legacy/mock_cep78_operator_schema.json b/modules/resources/legacy/mock_cep78_operator_schema.json new file mode 100644 index 00000000..7b64a240 --- /dev/null +++ b/modules/resources/legacy/mock_cep78_operator_schema.json @@ -0,0 +1,199 @@ +{ + "name": "MockCep78Operator", + "events": [], + "entrypoints": [ + { + "name": "set_address", + "args": [ + { + "name": "nft_contract", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "mint", + "args": [ + { + "name": "token_metadata", + "ty": "String", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "is_reverse_lookup_enabled", + "ty": "Bool", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "mint_with_hash", + "args": [ + { + "name": "token_metadata", + "ty": "String", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "token_hash", + "ty": "String", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "burn", + "args": [ + { + "name": "token_id", + "ty": "U64", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "mint_for", + "args": [ + { + "name": "token_owner", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "token_metadata", + "ty": "String", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "transfer", + "args": [ + { + "name": "token_id", + "ty": "U64", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "target", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "transfer_from", + "args": [ + { + "name": "token_id", + "ty": "U64", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "source", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "target", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "approve", + "args": [ + { + "name": "spender", + "ty": "Key", + "is_ref": false, + "is_slice": false, + "is_required": true + }, + { + "name": "token_id", + "ty": "U64", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "revoke", + "args": [ + { + "name": "token_id", + "ty": "U64", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + } + ] +} \ No newline at end of file diff --git a/modules/resources/legacy/mock_cep78_transfer_filter_schema.json b/modules/resources/legacy/mock_cep78_transfer_filter_schema.json new file mode 100644 index 00000000..9fdb22e8 --- /dev/null +++ b/modules/resources/legacy/mock_cep78_transfer_filter_schema.json @@ -0,0 +1,30 @@ +{ + "name": "MockCep78TransferFilter", + "events": [], + "entrypoints": [ + { + "name": "set_return_value", + "args": [ + { + "name": "return_value", + "ty": "U8", + "is_ref": false, + "is_slice": false, + "is_required": true + } + ], + "is_mutable": true, + "return_ty": "Unit", + "ty": "Public", + "attributes": [] + }, + { + "name": "can_transfer", + "args": [], + "is_mutable": false, + "return_ty": "U8", + "ty": "Public", + "attributes": [] + } + ] +} \ No newline at end of file diff --git a/modules/src/cep78/metadata.rs b/modules/src/cep78/metadata.rs index 83f3fecd..a1242595 100644 --- a/modules/src/cep78/metadata.rs +++ b/modules/src/cep78/metadata.rs @@ -226,7 +226,7 @@ impl Metadata { for (property_name, property_type) in token_schema.properties.iter() { if property_type.required - && custom_metadata.attributes.get(property_name).is_none() + && !custom_metadata.attributes.contains_key(property_name) { self.env().revert(CEP78Error::InvalidCustomMetadata) } diff --git a/modules/src/cep78/modalities.rs b/modules/src/cep78/modalities.rs index f8761eee..ba94de4e 100644 --- a/modules/src/cep78/modalities.rs +++ b/modules/src/cep78/modalities.rs @@ -315,6 +315,7 @@ impl TokenIdentifier { } } +#[allow(clippy::to_string_trait_impl)] impl ToString for TokenIdentifier { fn to_string(&self) -> String { match self { diff --git a/modules/src/lib.rs b/modules/src/lib.rs index 986146f5..48555704 100644 --- a/modules/src/lib.rs +++ b/modules/src/lib.rs @@ -1,7 +1,6 @@ #![doc = "Odra's library of plug and play modules"] #![cfg_attr(not(test), no_std)] #![cfg_attr(not(test), no_main)] -#![recursion_limit = "256"] extern crate alloc; diff --git a/odra-macros/src/ast/event/mod.rs b/odra-macros/src/ast/event/mod.rs index 233ec847..27e462a3 100644 --- a/odra-macros/src/ast/event/mod.rs +++ b/odra-macros/src/ast/event/mod.rs @@ -1,3 +1,4 @@ +use std::collections::HashSet; use quote::ToTokens; use syn::{punctuated::Punctuated, token::Comma}; @@ -21,13 +22,19 @@ impl ToTokens for OdraEventItem { let comment = format!("Creates a new instance of the {} event.", ident); let doc_attr = quote::quote!(#[doc = #comment]); - let chain = item.fields + let mut tmp = HashSet::::new(); + let mut chain = vec![]; + + item.fields .iter() - .map(|f| { + .for_each(|f| { let ty = &f.ty; - quote::quote!(.chain(<#ty as odra::schema::SchemaEvents>::custom_types())) - }) - .collect::>(); + let v = quote::quote!(.chain(<#ty as odra::schema::SchemaEvents>::custom_types())); + if tmp.insert(v.to_string()) { + chain.push(v); + } + }); + let self_item = custom_struct(&name, &item.fields); diff --git a/odra-macros/src/ast/schema/custom_types.rs b/odra-macros/src/ast/schema/custom_types.rs index 6cf9b607..534db6e7 100644 --- a/odra-macros/src/ast/schema/custom_types.rs +++ b/odra-macros/src/ast/schema/custom_types.rs @@ -1,3 +1,5 @@ +use std::collections::HashSet; + use quote::ToTokens; use crate::{ @@ -29,10 +31,16 @@ impl ToTokens for SchemaCustomTypesItem { }) .collect::>(); - let chain = types + let mut tmp = HashSet::::new(); + let mut chain = vec![]; + types .iter() - .map(|t| quote::quote!(.chain(<#t as odra::schema::SchemaCustomTypes>::schema_types()))) - .collect::>(); + .for_each(|t| { + let v = quote::quote!(.chain(<#t as odra::schema::SchemaCustomTypes>::schema_types())); + if tmp.insert(v.to_string()) { + chain.push(v); + } + }); let item = quote::quote! { #[automatically_derived] @@ -82,10 +90,8 @@ mod test { .chain( as odra::schema::SchemaCustomTypes>::schema_types()) .chain(::schema_types()) .chain(
::schema_types()) - .chain(::schema_types()) .chain( as odra::schema::SchemaCustomTypes>::schema_types()) .chain( as odra::schema::SchemaCustomTypes>::schema_types()) - .chain(::schema_types()) .chain(::custom_types()) .collect() } diff --git a/odra-schema/src/custom_type.rs b/odra-schema/src/custom_type.rs index fd123fe4..fa3b3b7b 100644 --- a/odra-schema/src/custom_type.rs +++ b/odra-schema/src/custom_type.rs @@ -55,19 +55,62 @@ impl_schema_custom_types!( URef ); -impl SchemaCustomTypes for Option {} +impl SchemaCustomTypes for Option { + fn schema_types() -> Vec> { + T::schema_types() + } +} -impl SchemaCustomTypes for Vec {} +impl SchemaCustomTypes for Vec { + fn schema_types() -> Vec> { + T::schema_types() + } +} -impl SchemaCustomTypes for Result {} +impl SchemaCustomTypes for Result { + fn schema_types() -> Vec> { + let mut types = vec![]; + types.extend(T::schema_types()); + types.extend(E::schema_types()); + types + } +} -impl SchemaCustomTypes for BTreeMap {} +impl SchemaCustomTypes for BTreeMap { + fn schema_types() -> Vec> { + let mut types = vec![]; + types.extend(T::schema_types()); + types.extend(E::schema_types()); + types + } +} -impl SchemaCustomTypes for (T1,) {} +impl SchemaCustomTypes for (T1,) { + fn schema_types() -> Vec> { + T1::schema_types() + } +} -impl SchemaCustomTypes for (T1, T2) {} +impl SchemaCustomTypes for (T1, T2) { + fn schema_types() -> Vec> { + let mut types = vec![]; + types.extend(T1::schema_types()); + types.extend(T2::schema_types()); + types + } +} -impl SchemaCustomTypes for (T1, T2, T3) {} +impl SchemaCustomTypes + for (T1, T2, T3) +{ + fn schema_types() -> Vec> { + let mut types = vec![]; + types.extend(T1::schema_types()); + types.extend(T2::schema_types()); + types.extend(T3::schema_types()); + types + } +} impl SchemaCustomTypes for Key {} @@ -137,19 +180,62 @@ impl_schema_events!( Bytes ); -impl SchemaEvents for Option {} +impl SchemaEvents for Option { + fn custom_types() -> Vec> { + T::schema_types() + } +} -impl SchemaEvents for Vec {} +impl SchemaEvents for Vec { + fn custom_types() -> Vec> { + T::schema_types() + } +} -impl SchemaEvents for Result {} +impl SchemaEvents for Result { + fn custom_types() -> Vec> { + let mut types = vec![]; + types.extend(T::schema_types()); + types.extend(E::schema_types()); + types + } +} -impl SchemaEvents for BTreeMap {} +impl SchemaEvents for BTreeMap { + fn custom_types() -> Vec> { + let mut types = vec![]; + types.extend(T::schema_types()); + types.extend(E::schema_types()); + types + } +} -impl SchemaEvents for (T1,) {} +impl SchemaEvents for (T1,) { + fn custom_types() -> Vec> { + T1::schema_types() + } +} -impl SchemaEvents for (T1, T2) {} +impl SchemaEvents for (T1, T2) { + fn custom_types() -> Vec> { + let mut types = vec![]; + types.extend(T1::schema_types()); + types.extend(T2::schema_types()); + types + } +} -impl SchemaEvents for (T1, T2, T3) {} +impl SchemaEvents + for (T1, T2, T3) +{ + fn custom_types() -> Vec> { + let mut types = vec![]; + types.extend(T1::schema_types()); + types.extend(T2::schema_types()); + types.extend(T3::schema_types()); + types + } +} impl SchemaEvents for [u8; COUNT] {} diff --git a/rust-toolchain b/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/templates/blank/rust-toolchain b/templates/blank/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/templates/blank/rust-toolchain +++ b/templates/blank/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/templates/cep18/rust-toolchain b/templates/cep18/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/templates/cep18/rust-toolchain +++ b/templates/cep18/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/templates/cep78/rust-toolchain b/templates/cep78/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/templates/cep78/rust-toolchain +++ b/templates/cep78/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/templates/full/rust-toolchain b/templates/full/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/templates/full/rust-toolchain +++ b/templates/full/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file diff --git a/templates/workspace/rust-toolchain b/templates/workspace/rust-toolchain index 73a401ca..e02da0b2 100644 --- a/templates/workspace/rust-toolchain +++ b/templates/workspace/rust-toolchain @@ -1 +1 @@ -nightly-2024-02-09 \ No newline at end of file +nightly-2024-04-26 \ No newline at end of file