git.delta.rocks / unique-network / refs/commits / 7125f4f84099

difftreelog

refactor method `set_collection_properties` , fix comments

PraetorP2022-10-24parent: #5131df7.patch.diff
in: master

1 file changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
107 properties: Vec<(string, bytes)>,107 properties: Vec<(string, bytes)>,
108 ) -> Result<void> {108 ) -> Result<void> {
109
110 let caller = T::CrossAccountId::from_eth(caller);
111
109 for (key, value) in properties.into_iter() {112 let properties = properties
113 .into_iter()
114 .map(|(key, value)| {
115 let key = <Vec<u8>>::from(key)
116 .try_into()
110 self.set_collection_property(caller, key, value)?;117 .map_err(|_| "key too large")?;
118
119 let value = value.0.try_into().map_err(|_| "value too large")?;
120
121 Ok(Property { key, value })
111 }122 })
123 .collect::<Result<Vec<_>>>()?;
124
125 <Pallet<T>>::set_collection_properties(self, &caller, properties)
112 Ok(())126 .map_err(dispatch_to_evm::<T>)
113 }127 }
114128
115 /// Delete collection property.129 /// Delete collection property.
643657
644 /// Get collection owner.658 /// Get collection owner.
645 ///659 ///
646 /// @return Tuble with sponsor address and his substrate mirror.660 /// @return Tuple with sponsor address and his substrate mirror.
647 /// If address is canonical then substrate mirror is zero and vice versa.661 /// If address is canonical then substrate mirror is zero and vice versa.
648 fn collection_owner(&self) -> Result<(address, uint256)> {662 fn collection_owner(&self) -> Result<(address, uint256)> {
649 Ok(convert_cross_account_to_tuple::<T>(663 Ok(convert_cross_account_to_tuple::<T>(