git.delta.rocks / unique-network / refs/commits / e6b665a657b2

difftreelog

fix PR

Trubnikov Sergey2022-12-22parent: #a22e53f.patch.diff
in: master

10 files changed

modifiedcrates/evm-coder/procedural/src/abi_derive/derive_enum.rsdiffbeforeafterboth
47 )47 )
48}48}
4949
50pub fn impl_enum_abi_type(name: &syn::Ident, option_count: usize) -> proc_macro2::TokenStream {50pub fn impl_enum_abi_type(name: &syn::Ident) -> proc_macro2::TokenStream {
51 quote! {51 quote! {
52 impl ::evm_coder::abi::AbiType for #name {52 impl ::evm_coder::abi::AbiType for #name {
53 const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <u8 as ::evm_coder::abi::AbiType>::SIGNATURE;53 const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <u8 as ::evm_coder::abi::AbiType>::SIGNATURE;
54 const FIELDS_COUNT: usize = #option_count;
5554
56 fn is_dynamic() -> bool {55 fn is_dynamic() -> bool {
57 <u8 as ::evm_coder::abi::AbiType>::is_dynamic()56 <u8 as ::evm_coder::abi::AbiType>::is_dynamic()
modifiedcrates/evm-coder/procedural/src/abi_derive/derive_struct.rsdiffbeforeafterboth
100pub fn impl_struct_abi_type(100pub fn impl_struct_abi_type(
101 name: &syn::Ident,101 name: &syn::Ident,
102 tuple_type: proc_macro2::TokenStream,102 tuple_type: proc_macro2::TokenStream,
103 fields_count: usize,
104) -> proc_macro2::TokenStream {103) -> proc_macro2::TokenStream {
105 quote! {104 quote! {
106 impl ::evm_coder::abi::AbiType for #name {105 impl ::evm_coder::abi::AbiType for #name {
107 const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;106 const SIGNATURE: ::evm_coder::custom_signature::SignatureUnit = <#tuple_type as ::evm_coder::abi::AbiType>::SIGNATURE;
108 const FIELDS_COUNT: usize = #fields_count;
109 fn is_dynamic() -> bool {107 fn is_dynamic() -> bool {
110 <#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()108 <#tuple_type as ::evm_coder::abi::AbiType>::is_dynamic()
111 }109 }
modifiedcrates/evm-coder/procedural/src/abi_derive/mod.rsdiffbeforeafterboth
49 let struct_from_tuple = struct_from_tuple(name, is_named_fields, field_names.clone());49 let struct_from_tuple = struct_from_tuple(name, is_named_fields, field_names.clone());
5050
51 let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);51 let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);
52 let abi_type = impl_struct_abi_type(name, tuple_type.clone(), params_count);52 let abi_type = impl_struct_abi_type(name, tuple_type.clone());
53 let abi_read = impl_struct_abi_read(name, tuple_type, tuple_names, struct_from_tuple);53 let abi_read = impl_struct_abi_read(name, tuple_type, tuple_names, struct_from_tuple);
54 let abi_write = impl_struct_abi_write(name, is_named_fields, tuple_ref_type, tuple_data);54 let abi_write = impl_struct_abi_write(name, is_named_fields, tuple_ref_type, tuple_data);
55 let solidity_type = impl_struct_solidity_type(name, field_types.clone(), params_count);55 let solidity_type = impl_struct_solidity_type(name, field_types.clone(), params_count);
83 let from = impl_enum_from_u8(name, enum_options.clone());83 let from = impl_enum_from_u8(name, enum_options.clone());
84 let solidity_option = impl_solidity_option(name, enum_options.clone());84 let solidity_option = impl_solidity_option(name, enum_options.clone());
85 let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);85 let can_be_plcaed_in_vec = impl_can_be_placed_in_vec(name);
86 let abi_type = impl_enum_abi_type(name, option_count);86 let abi_type = impl_enum_abi_type(name);
87 let abi_read = impl_enum_abi_read(name);87 let abi_read = impl_enum_abi_read(name);
88 let abi_write = impl_enum_abi_write(name);88 let abi_write = impl_enum_abi_write(name);
89 let solidity_type = impl_enum_solidity_type(name);89 let solidity_type = impl_enum_solidity_type(name);
modifiedcrates/evm-coder/src/abi/impls.rsdiffbeforeafterboth
1616
17 impl AbiType for $ty {17 impl AbiType for $ty {
18 const SIGNATURE: SignatureUnit = make_signature!(new fixed(stringify!($name)));18 const SIGNATURE: SignatureUnit = make_signature!(new fixed(stringify!($name)));
19 const FIELDS_COUNT: usize = 1;
2019
21 fn is_dynamic() -> bool {20 fn is_dynamic() -> bool {
22 $dynamic21 $dynamic
9796
98impl<T: AbiType> AbiType for &T {97impl<T: AbiType> AbiType for &T {
99 const SIGNATURE: SignatureUnit = T::SIGNATURE;98 const SIGNATURE: SignatureUnit = T::SIGNATURE;
100 const FIELDS_COUNT: usize = T::FIELDS_COUNT;
10199
102 fn is_dynamic() -> bool {100 fn is_dynamic() -> bool {
103 T::is_dynamic()101 T::is_dynamic()
127125
128impl<T: AbiType> AbiType for Vec<T> {126impl<T: AbiType> AbiType for Vec<T> {
129 const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));127 const SIGNATURE: SignatureUnit = make_signature!(new nameof(T::SIGNATURE) fixed("[]"));
130 const FIELDS_COUNT: usize = 1;
131128
132 fn is_dynamic() -> bool {129 fn is_dynamic() -> bool {
133 true130 true
203 shift_left(1)200 shift_left(1)
204 fixed(")")201 fixed(")")
205 );202 );
206 const FIELDS_COUNT: usize = count!($($ident)*);
207203
208 fn is_dynamic() -> bool {204 fn is_dynamic() -> bool {
209 false205 false
modifiedcrates/evm-coder/src/abi/traits.rsdiffbeforeafterboth
10 /// Signature for Etherium ABI.10 /// Signature for Etherium ABI.
11 const SIGNATURE: SignatureUnit;11 const SIGNATURE: SignatureUnit;
12
13 /// Count of enum variants or struct fields.
14 const FIELDS_COUNT: usize;
1512
16 /// Signature as str.13 /// Signature as str.
17 fn as_str() -> &'static str {14 fn as_str() -> &'static str {
modifiedcrates/evm-coder/tests/abi_derive_generation.rsdiffbeforeafterboth
172 );172 );
173 }173 }
174
175 #[test]
176 fn impl_abi_type_fields_count() {
177 assert_eq!(
178 <TypeStruct1SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
179 1
180 );
181 assert_eq!(
182 <TypeStruct1DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
183 1
184 );
185 assert_eq!(
186 <TypeStruct2SimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
187 2
188 );
189 assert_eq!(
190 <TypeStruct2DynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
191 2
192 );
193 assert_eq!(
194 <TypeStruct2MixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
195 2
196 );
197 assert_eq!(
198 <TypeStruct1DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
199 1
200 );
201 assert_eq!(
202 <TypeStruct2DerivedSimpleParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
203 2
204 );
205 assert_eq!(
206 <TypeStruct1DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
207 1
208 );
209 assert_eq!(
210 <TypeStruct2DerivedDynamicParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
211 2
212 );
213 assert_eq!(
214 <TypeStruct3DerivedMixedParam as evm_coder::abi::AbiType>::FIELDS_COUNT,
215 3
216 );
217 }
218174
219 #[test]175 #[test]
220 fn impl_abi_type_is_dynamic() {176 fn impl_abi_type_is_dynamic() {
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
347 ) -> Result<void> {347 ) -> Result<void> {
348 self.consume_store_reads_and_writes(1, 1)?;348 self.consume_store_reads_and_writes(1, 1)?;
349
350 if !limit.has_value() {
351 return Err(Error::Revert("user can't disable limits".into()));
352 }
349353
350 let caller = T::CrossAccountId::from_eth(caller);354 let caller = T::CrossAccountId::from_eth(caller);
351 <Pallet<T>>::update_limits(&caller, self, limit.try_into()?).map_err(dispatch_to_evm::<T>)355 <Pallet<T>>::update_limits(&caller, self, limit.try_into()?).map_err(dispatch_to_evm::<T>)
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
265 }265 }
266 }266 }
267
268 /// Whether the field contains a value.
269 pub fn has_value(&self) -> bool {
270 self.value.status
271 }
267}272}
268273
269impl TryInto<up_data_structs::CollectionLimits> for CollectionLimit {274impl TryInto<up_data_structs::CollectionLimits> for CollectionLimit {
270 type Error = evm_coder::execution::Error;275 type Error = evm_coder::execution::Error;
271276
272 fn try_into(self) -> Result<up_data_structs::CollectionLimits, Self::Error> {277 fn try_into(self) -> Result<up_data_structs::CollectionLimits, Self::Error> {
273 if !self.value.status {
274 return Err(Self::Error::Revert("user can't disable limits".into()));
275 }
276
277 let value = self.value.value.try_into().map_err(|error| {278 let value = self.value.value.try_into().map_err(|error| {
278 Self::Error::Revert(format!(279 Self::Error::Revert(format!(
433 let mut perms = Vec::new();434 let mut perms = Vec::new();
434435
435 for TokenPropertyPermission { key, permissions } in permissions {436 for TokenPropertyPermission { key, permissions } in permissions {
436 if permissions.len() > <TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT {
437 return Err(alloc::format!(
438 "Actual number of fields {} for {}, which exceeds the maximum value of {}",
439 permissions.len(),
440 stringify!(EthTokenPermissions),
441 <TokenPermissionField as evm_coder::abi::AbiType>::FIELDS_COUNT
442 )
443 .as_str()
444 .into());
445 }
446
447 let token_permission = PropertyPermission::from_vec(permissions);437 let token_permission = PropertyPermission::from_vec(permissions);
448438
modifiedpallets/nonfungible/src/erc.rsdiffbeforeafterboth
38use pallet_common::{38use pallet_common::{
39 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,39 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
40 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},40 erc::{CommonEvmHandler, PrecompileResult, CollectionCall, static_property::key},
41 eth,
41};42};
42use pallet_evm::{account::CrossAccountId, PrecompileHandle};43use pallet_evm::{account::CrossAccountId, PrecompileHandle};
43use pallet_evm_coder_substrate::call;44use pallet_evm_coder_substrate::call;
93 fn set_token_property_permissions(94 fn set_token_property_permissions(
94 &mut self,95 &mut self,
95 caller: caller,96 caller: caller,
96 permissions: Vec<pallet_common::eth::TokenPropertyPermission>,97 permissions: Vec<eth::TokenPropertyPermission>,
97 ) -> Result<()> {98 ) -> Result<()> {
98 let caller = T::CrossAccountId::from_eth(caller);99 let caller = T::CrossAccountId::from_eth(caller);
99 let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(100 let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
100 permissions,
101 )?;
102101
107 /// @notice Get permissions for token properties.106 /// @notice Get permissions for token properties.
108 fn token_property_permissions(107 fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
109 &self,
110 ) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
111 let perms = <Pallet<T>>::token_property_permission(self.id);108 let perms = <Pallet<T>>::token_property_permission(self.id);
112 Ok(perms109 Ok(perms
113 .into_iter()110 .into_iter()
114 .map(pallet_common::eth::TokenPropertyPermission::from)111 .map(eth::TokenPropertyPermission::from)
115 .collect())112 .collect())
116 }113 }
117114
159 &mut self,156 &mut self,
160 caller: caller,157 caller: caller,
161 token_id: uint256,158 token_id: uint256,
162 properties: Vec<pallet_common::eth::Property>,159 properties: Vec<eth::Property>,
163 ) -> Result<()> {160 ) -> Result<()> {
164 let caller = T::CrossAccountId::from_eth(caller);161 let caller = T::CrossAccountId::from_eth(caller);
165 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;162 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
170167
171 let properties = properties168 let properties = properties
172 .into_iter()169 .into_iter()
173 .map(pallet_common::eth::Property::try_into)170 .map(eth::Property::try_into)
174 .collect::<Result<Vec<_>>>()?;171 .collect::<Result<Vec<_>>>()?;
175172
176 <Pallet<T>>::set_token_properties(173 <Pallet<T>>::set_token_properties(
753 /// Returns the owner (in cross format) of the token.750 /// Returns the owner (in cross format) of the token.
754 ///751 ///
755 /// @param tokenId Id for the token.752 /// @param tokenId Id for the token.
756 fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {753 fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
757 Self::token_owner(&self, token_id.try_into()?)754 Self::token_owner(&self, token_id.try_into()?)
758 .map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))755 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
759 .ok_or(Error::Revert("key too large".into()))756 .ok_or(Error::Revert("key too large".into()))
760 }757 }
761758
768 &self,
769 token_id: uint256,
770 keys: Vec<string>,
771 ) -> Result<Vec<pallet_common::eth::Property>> {
772 let keys = keys765 let keys = keys
773 .into_iter()766 .into_iter()
774 .map(|key| {767 .map(|key| {
784 if keys.is_empty() { None } else { Some(keys) },777 if keys.is_empty() { None } else { Some(keys) },
785 )778 )
786 .into_iter()779 .into_iter()
787 .map(pallet_common::eth::Property::try_from)780 .map(eth::Property::try_from)
788 .collect::<Result<Vec<_>>>()781 .collect::<Result<Vec<_>>>()
789 }782 }
790783
798 fn approve_cross(791 fn approve_cross(
799 &mut self,792 &mut self,
800 caller: caller,793 caller: caller,
801 approved: pallet_common::eth::CrossAddress,794 approved: eth::CrossAddress,
802 token_id: uint256,795 token_id: uint256,
803 ) -> Result<void> {796 ) -> Result<void> {
804 let caller = T::CrossAccountId::from_eth(caller);797 let caller = T::CrossAccountId::from_eth(caller);
837 fn transfer_cross(830 fn transfer_cross(
838 &mut self,831 &mut self,
839 caller: caller,832 caller: caller,
840 to: pallet_common::eth::CrossAddress,833 to: eth::CrossAddress,
841 token_id: uint256,834 token_id: uint256,
842 ) -> Result<void> {835 ) -> Result<void> {
843 let caller = T::CrossAccountId::from_eth(caller);836 let caller = T::CrossAccountId::from_eth(caller);
861 fn transfer_from_cross(854 fn transfer_from_cross(
862 &mut self,855 &mut self,
863 caller: caller,856 caller: caller,
864 from: pallet_common::eth::CrossAddress,857 from: eth::CrossAddress,
865 to: pallet_common::eth::CrossAddress,858 to: eth::CrossAddress,
866 token_id: uint256,859 token_id: uint256,
867 ) -> Result<void> {860 ) -> Result<void> {
868 let caller = T::CrossAccountId::from_eth(caller);861 let caller = T::CrossAccountId::from_eth(caller);
908 fn burn_from_cross(901 fn burn_from_cross(
909 &mut self,902 &mut self,
910 caller: caller,903 caller: caller,
911 from: pallet_common::eth::CrossAddress,904 from: eth::CrossAddress,
912 token_id: uint256,905 token_id: uint256,
913 ) -> Result<void> {906 ) -> Result<void> {
914 let caller = T::CrossAccountId::from_eth(caller);907 let caller = T::CrossAccountId::from_eth(caller);
1030 fn mint_cross(1023 fn mint_cross(
1031 &mut self,1024 &mut self,
1032 caller: caller,1025 caller: caller,
1033 to: pallet_common::eth::CrossAddress,1026 to: eth::CrossAddress,
1034 properties: Vec<pallet_common::eth::Property>,1027 properties: Vec<eth::Property>,
1035 ) -> Result<uint256> {1028 ) -> Result<uint256> {
1036 let token_id = <TokensMinted<T>>::get(self.id)1029 let token_id = <TokensMinted<T>>::get(self.id)
1037 .checked_add(1)1030 .checked_add(1)
10411034
1042 let properties = properties1035 let properties = properties
1043 .into_iter()1036 .into_iter()
1044 .map(pallet_common::eth::Property::try_into)1037 .map(eth::Property::try_into)
1045 .collect::<Result<Vec<_>>>()?1038 .collect::<Result<Vec<_>>>()?
1046 .try_into()1039 .try_into()
1047 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;1040 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;
modifiedpallets/refungible/src/erc.rsdiffbeforeafterboth
32use frame_support::{BoundedBTreeMap, BoundedVec};32use frame_support::{BoundedBTreeMap, BoundedVec};
33use pallet_common::{33use pallet_common::{
34 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,34 CollectionHandle, CollectionPropertyPermissions, CommonCollectionOperations,
35 Error as CommonError,
35 erc::{CommonEvmHandler, CollectionCall, static_property::key},36 erc::{CommonEvmHandler, CollectionCall, static_property::key},
36 Error as CommonError,37 eth,
37};38};
38use pallet_evm::{account::CrossAccountId, PrecompileHandle};39use pallet_evm::{account::CrossAccountId, PrecompileHandle};
39use pallet_evm_coder_substrate::{call, dispatch_to_evm};40use pallet_evm_coder_substrate::{call, dispatch_to_evm};
96 fn set_token_property_permissions(97 fn set_token_property_permissions(
97 &mut self,98 &mut self,
98 caller: caller,99 caller: caller,
99 permissions: Vec<pallet_common::eth::TokenPropertyPermission>,100 permissions: Vec<eth::TokenPropertyPermission>,
100 ) -> Result<()> {101 ) -> Result<()> {
101 let caller = T::CrossAccountId::from_eth(caller);102 let caller = T::CrossAccountId::from_eth(caller);
102 let perms = pallet_common::eth::TokenPropertyPermission::into_property_key_permissions(103 let perms = eth::TokenPropertyPermission::into_property_key_permissions(permissions)?;
103 permissions,
104 )?;
105104
110 /// @notice Get permissions for token properties.109 /// @notice Get permissions for token properties.
111 fn token_property_permissions(110 fn token_property_permissions(&self) -> Result<Vec<eth::TokenPropertyPermission>> {
112 &self,
113 ) -> Result<Vec<pallet_common::eth::TokenPropertyPermission>> {
114 let perms = <Pallet<T>>::token_property_permission(self.id);111 let perms = <Pallet<T>>::token_property_permission(self.id);
115 Ok(perms112 Ok(perms
116 .into_iter()113 .into_iter()
117 .map(pallet_common::eth::TokenPropertyPermission::from)114 .map(eth::TokenPropertyPermission::from)
118 .collect())115 .collect())
119 }116 }
120117
162 &mut self,159 &mut self,
163 caller: caller,160 caller: caller,
164 token_id: uint256,161 token_id: uint256,
165 properties: Vec<pallet_common::eth::Property>,162 properties: Vec<eth::Property>,
166 ) -> Result<()> {163 ) -> Result<()> {
167 let caller = T::CrossAccountId::from_eth(caller);164 let caller = T::CrossAccountId::from_eth(caller);
168 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;165 let token_id: u32 = token_id.try_into().map_err(|_| "token id overflow")?;
173170
174 let properties = properties171 let properties = properties
175 .into_iter()172 .into_iter()
176 .map(pallet_common::eth::Property::try_into)173 .map(eth::Property::try_into)
177 .collect::<Result<Vec<_>>>()?;174 .collect::<Result<Vec<_>>>()?;
178175
179 <Pallet<T>>::set_token_properties(176 <Pallet<T>>::set_token_properties(
788 /// Returns the owner (in cross format) of the token.785 /// Returns the owner (in cross format) of the token.
789 ///786 ///
790 /// @param tokenId Id for the token.787 /// @param tokenId Id for the token.
791 fn cross_owner_of(&self, token_id: uint256) -> Result<pallet_common::eth::CrossAddress> {788 fn cross_owner_of(&self, token_id: uint256) -> Result<eth::CrossAddress> {
792 Self::token_owner(&self, token_id.try_into()?)789 Self::token_owner(&self, token_id.try_into()?)
793 .map(|o| pallet_common::eth::CrossAddress::from_sub_cross_account::<T>(&o))790 .map(|o| eth::CrossAddress::from_sub_cross_account::<T>(&o))
794 .ok_or(Error::Revert("key too large".into()))791 .ok_or(Error::Revert("key too large".into()))
795 }792 }
796793
803 &self,
804 token_id: uint256,
805 keys: Vec<string>,
806 ) -> Result<Vec<pallet_common::eth::Property>> {
807 let keys = keys800 let keys = keys
808 .into_iter()801 .into_iter()
809 .map(|key| {802 .map(|key| {
819 if keys.is_empty() { None } else { Some(keys) },812 if keys.is_empty() { None } else { Some(keys) },
820 )813 )
821 .into_iter()814 .into_iter()
822 .map(pallet_common::eth::Property::try_from)815 .map(eth::Property::try_from)
823 .collect::<Result<Vec<_>>>()816 .collect::<Result<Vec<_>>>()
824 }817 }
825 /// @notice Transfer ownership of an RFT818 /// @notice Transfer ownership of an RFT
855 fn transfer_cross(848 fn transfer_cross(
856 &mut self,849 &mut self,
857 caller: caller,850 caller: caller,
858 to: pallet_common::eth::CrossAddress,851 to: eth::CrossAddress,
859 token_id: uint256,852 token_id: uint256,
860 ) -> Result<void> {853 ) -> Result<void> {
861 let caller = T::CrossAccountId::from_eth(caller);854 let caller = T::CrossAccountId::from_eth(caller);
883 fn transfer_from_cross(876 fn transfer_from_cross(
884 &mut self,877 &mut self,
885 caller: caller,878 caller: caller,
886 from: pallet_common::eth::CrossAddress,879 from: eth::CrossAddress,
887 to: pallet_common::eth::CrossAddress,880 to: eth::CrossAddress,
888 token_id: uint256,881 token_id: uint256,
889 ) -> Result<void> {882 ) -> Result<void> {
890 let caller = T::CrossAccountId::from_eth(caller);883 let caller = T::CrossAccountId::from_eth(caller);
939 fn burn_from_cross(932 fn burn_from_cross(
940 &mut self,933 &mut self,
941 caller: caller,934 caller: caller,
942 from: pallet_common::eth::CrossAddress,935 from: eth::CrossAddress,
943 token_id: uint256,936 token_id: uint256,
944 ) -> Result<void> {937 ) -> Result<void> {
945 let caller = T::CrossAccountId::from_eth(caller);938 let caller = T::CrossAccountId::from_eth(caller);
1076 fn mint_cross(1069 fn mint_cross(
1077 &mut self,1070 &mut self,
1078 caller: caller,1071 caller: caller,
1079 to: pallet_common::eth::CrossAddress,1072 to: eth::CrossAddress,
1080 properties: Vec<pallet_common::eth::Property>,1073 properties: Vec<eth::Property>,
1081 ) -> Result<uint256> {1074 ) -> Result<uint256> {
1082 let token_id = <TokensMinted<T>>::get(self.id)1075 let token_id = <TokensMinted<T>>::get(self.id)
1083 .checked_add(1)1076 .checked_add(1)
10871080
1088 let properties = properties1081 let properties = properties
1089 .into_iter()1082 .into_iter()
1090 .map(pallet_common::eth::Property::try_into)1083 .map(eth::Property::try_into)
1091 .collect::<Result<Vec<_>>>()?1084 .collect::<Result<Vec<_>>>()?
1092 .try_into()1085 .try_into()
1093 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;1086 .map_err(|_| Error::Revert(alloc::format!("too many properties")))?;