--- a/pallets/common/src/erc.rs +++ b/pallets/common/src/erc.rs @@ -660,16 +660,6 @@ pub mod key { use super::*; - /// Key "schemaName". - pub fn schema_name() -> up_data_structs::PropertyKey { - property_key_from_bytes(b"schemaName").expect(EXPECT_CONVERT_ERROR) - } - - /// Key "schemaVersion". - pub fn schema_version() -> up_data_structs::PropertyKey { - property_key_from_bytes(b"schemaVersion").expect(EXPECT_CONVERT_ERROR) - } - /// Key "baseURI". pub fn base_uri() -> up_data_structs::PropertyKey { property_key_from_bytes(b"baseURI").expect(EXPECT_CONVERT_ERROR) @@ -688,32 +678,6 @@ /// Key "parentNft". pub fn parent_nft() -> up_data_structs::PropertyKey { property_key_from_bytes(b"parentNft").expect(EXPECT_CONVERT_ERROR) - } - - /// Key "ERC721Metadata". - pub fn erc721_metadata() -> up_data_structs::PropertyKey { - property_key_from_bytes(b"ERC721Metadata").expect(EXPECT_CONVERT_ERROR) - } - } - - /// Values. - pub mod value { - use super::*; - - /// Value "Schema version". - pub const SCHEMA_VERSION: &[u8] = b"1.0.0"; - - /// Value "ERC721Metadata". - pub const ERC721_METADATA: &[u8] = b"ERC721Metadata"; - - /// Value for [`ERC721_METADATA`]. - pub fn erc721() -> up_data_structs::PropertyValue { - property_value_from_bytes(ERC721_METADATA).expect(EXPECT_CONVERT_ERROR) - } - - /// Value for [`SCHEMA_VERSION`]. - pub fn schema_version() -> up_data_structs::PropertyValue { - property_value_from_bytes(SCHEMA_VERSION).expect(EXPECT_CONVERT_ERROR) } } --- a/pallets/nonfungible/src/erc.rs +++ b/pallets/nonfungible/src/erc.rs @@ -33,10 +33,7 @@ use pallet_evm_coder_substrate::dispatch_to_evm; use sp_std::vec::Vec; use pallet_common::{ - erc::{ - CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key, - static_property::value, - }, + erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key}, CollectionHandle, CollectionPropertyPermissions, }; use pallet_evm::{account::CrossAccountId, PrecompileHandle}; --- a/pallets/refungible/src/erc.rs +++ b/pallets/refungible/src/erc.rs @@ -29,7 +29,7 @@ use frame_support::{BoundedBTreeMap, BoundedVec}; use pallet_common::{ CollectionHandle, CollectionPropertyPermissions, - erc::{CommonEvmHandler, CollectionCall, static_property::key, static_property::value}, + erc::{CommonEvmHandler, CollectionCall, static_property::key}, }; use pallet_evm::{account::CrossAccountId, PrecompileHandle}; use pallet_evm_coder_substrate::{call, dispatch_to_evm}; --- a/pallets/unique/src/eth/mod.rs +++ b/pallets/unique/src/eth/mod.rs @@ -25,7 +25,7 @@ dispatch::CollectionDispatch, erc::{ CollectionHelpersEvents, - static_property::{key, value as property_value}, + static_property::{key}, }, Pallet as PalletCommon, }; @@ -125,26 +125,13 @@ } else { up_data_structs::CollectionPropertiesPermissionsVec::default() }; - let properties = if add_properties { - let mut properties = vec![ - up_data_structs::Property { - key: key::schema_name(), - value: property_value::erc721(), - }, - up_data_structs::Property { - key: key::schema_version(), - value: property_value::schema_version(), - }, - ]; - if !base_uri_value.is_empty() { - properties.push(up_data_structs::Property { - key: key::base_uri(), - value: base_uri_value, - }) - } - properties - .try_into() - .map_err(|e| Error::Revert(format!("{:?}", e)))? + let properties = if add_properties && !base_uri_value.is_empty() { + vec![up_data_structs::Property { + key: key::base_uri(), + value: base_uri_value, + }] + .try_into() + .expect("limit >= 1") } else { up_data_structs::CollectionPropertiesVec::default() }; @@ -404,32 +391,20 @@ } let all_properties = >::get(collection.id); - let mut new_properties = vec![]; - if all_properties.get(&key::schema_name()).is_none() { - self.recorder().consume_sstore()?; - new_properties.push(up_data_structs::Property { - key: key::schema_name(), - value: property_value::erc721(), - }); - new_properties.push(up_data_structs::Property { - key: key::schema_version(), - value: property_value::schema_version(), - }); - } if all_properties.get(&key::base_uri()).is_none() && !base_uri.is_empty() { - new_properties.push(up_data_structs::Property { - key: key::base_uri(), - value: base_uri - .into_bytes() - .try_into() - .map_err(|_| "base uri is too large")?, - }); - } - - if !new_properties.is_empty() { self.recorder().consume_sstore()?; - >::set_collection_properties(&collection, &caller, new_properties) - .map_err(dispatch_to_evm::)?; + >::set_collection_properties( + &collection, + &caller, + vec![up_data_structs::Property { + key: key::base_uri(), + value: base_uri + .into_bytes() + .try_into() + .map_err(|_| "base uri is too large")?, + }], + ) + .map_err(dispatch_to_evm::)?; } self.recorder().consume_sstore()?;