git.delta.rocks / unique-network / refs/commits / 7aa4c5840673

difftreelog

misk: chage uint256 to U256

Trubnikov Sergey2023-01-17parent: #1107c89.patch.diff
in: master

2 files changed

modifiedcrates/evm-coder/src/events.rsdiffbeforeafterboth
before · crates/evm-coder/src/events.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use ethereum::Log;18use primitive_types::{H160, H256};1920use crate::types::*;2122/// Implementation of this trait should not be written manually,23/// instead use [`crate::ToLog`] proc macros.24///25/// See also [`evm_coder_procedural::ToLog`], [solidity docs on events](https://docs.soliditylang.org/en/develop/contracts.html#events)26pub trait ToLog {27	/// Convert event to [`ethereum::Log`].28	/// Because event by itself doesn't contains current contract29	/// address, it should be specified manually.30	fn to_log(&self, contract: H160) -> Log;31}3233/// Only items implementing `ToTopic` may be used as `#[indexed]` field34/// in [`crate::ToLog`] macro usage.35///36/// See also (solidity docs on events)[<https://docs.soliditylang.org/en/develop/contracts.html#events>]37pub trait ToTopic {38	/// Convert value to topic to be used in [`ethereum::Log`]39	fn to_topic(&self) -> H256;40}4142impl ToTopic for H256 {43	fn to_topic(&self) -> H256 {44		*self45	}46}4748impl ToTopic for uint256 {49	fn to_topic(&self) -> H256 {50		let mut out = [0u8; 32];51		self.to_big_endian(&mut out);52		H256(out)53	}54}5556impl ToTopic for address {57	fn to_topic(&self) -> H256 {58		let mut out = [0u8; 32];59		out[12..32].copy_from_slice(&self.0);60		H256(out)61	}62}6364impl ToTopic for u32 {65	fn to_topic(&self) -> H256 {66		let mut out = [0u8; 32];67		out[28..32].copy_from_slice(&self.to_be_bytes());68		H256(out)69	}70}
after · crates/evm-coder/src/events.rs
1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617use ethereum::Log;18use primitive_types::{H160, H256, U256};1920use crate::types::*;2122/// Implementation of this trait should not be written manually,23/// instead use [`crate::ToLog`] proc macros.24///25/// See also [`evm_coder_procedural::ToLog`], [solidity docs on events](https://docs.soliditylang.org/en/develop/contracts.html#events)26pub trait ToLog {27	/// Convert event to [`ethereum::Log`].28	/// Because event by itself doesn't contains current contract29	/// address, it should be specified manually.30	fn to_log(&self, contract: H160) -> Log;31}3233/// Only items implementing `ToTopic` may be used as `#[indexed]` field34/// in [`crate::ToLog`] macro usage.35///36/// See also (solidity docs on events)[<https://docs.soliditylang.org/en/develop/contracts.html#events>]37pub trait ToTopic {38	/// Convert value to topic to be used in [`ethereum::Log`]39	fn to_topic(&self) -> H256;40}4142impl ToTopic for H256 {43	fn to_topic(&self) -> H256 {44		*self45	}46}4748impl ToTopic for U256 {49	fn to_topic(&self) -> H256 {50		let mut out = [0u8; 32];51		self.to_big_endian(&mut out);52		H256(out)53	}54}5556impl ToTopic for address {57	fn to_topic(&self) -> H256 {58		let mut out = [0u8; 32];59		out[12..32].copy_from_slice(&self.0);60		H256(out)61	}62}6364impl ToTopic for u32 {65	fn to_topic(&self) -> H256 {66		let mut out = [0u8; 32];67		out[28..32].copy_from_slice(&self.to_be_bytes());68		H256(out)69	}70}
modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -26,6 +26,7 @@
 };
 use pallet_evm_coder_substrate::dispatch_to_evm;
 use sp_std::{vec, vec::Vec};
+use sp_core::U256;
 use up_data_structs::{
 	AccessMode, CollectionMode, CollectionPermissions, OwnerRestrictedSet, Property,
 	SponsoringRateLimit, SponsorshipState,
@@ -67,7 +68,7 @@
 		#[indexed]
 		collection_id: address,
 		/// Token ID.
-		token_id: uint256,
+		token_id: U256,
 	},
 }