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

difftreelog

refac code

PraetorP2022-12-12parent: #78c3cae.patch.diff
in: master

3 files changed

modifiedpallets/common/src/erc.rsdiffbeforeafterboth
--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -295,7 +295,7 @@
 			None => return Ok(Default::default()),
 		};
 
-		Ok(EthCrossAccount::from_substrate::<T>(&sponsor))
+		Ok(EthCrossAccount::from_sub::<T>(&sponsor))
 	}
 
 	/// Get current collection limits.
modifiedpallets/common/src/eth.rsdiffbeforeafterboth
140 }140 }
141 }141 }
142 /// Creates `EthCrossAccount` from substrate account142 /// Creates `EthCrossAccount` from substrate account
143 pub fn from_substrate<T>(account_id: &T::AccountId) -> Self143 pub fn from_sub<T>(account_id: &T::AccountId) -> Self
144 where144 where
145 T: pallet_evm::Config,145 T: pallet_evm::Config,
146 T::AccountId: AsRef<[u8; 32]>,146 T::AccountId: AsRef<[u8; 32]>,
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -25,6 +25,7 @@
 	types::*,
 	ToLog,
 };
+use pallet_common::eth::EthCrossAccount;
 use pallet_evm::{
 	ExitRevert, OnCreate, OnMethodCall, PrecompileResult, PrecompileFailure, PrecompileHandle,
 	account::CrossAccountId,
@@ -174,11 +175,9 @@
 	///
 	/// @param contractAddress The contract for which a sponsor is requested.
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
-	fn sponsor(&self, contract_address: address) -> Result<(address, uint256)> {
-		let sponsor =
-			Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?;
-		Ok(pallet_common::eth::convert_cross_account_to_tuple::<T>(
-			&sponsor,
+	fn sponsor(&self, contract_address: address) -> Result<EthCrossAccount> {
+		Ok(EthCrossAccount::from_sub_cross_account::<T>(
+			&Pallet::<T>::get_sponsor(contract_address).ok_or("Contract has no sponsor")?,
 		))
 	}