git.delta.rocks / unique-network / refs/commits / 8900b85b9a67

difftreelog

misk: Change OptionCrossAddress to Option<CrossAddress>

Trubnikov Sergey2023-01-10parent: #72d7965.patch.diff
in: master

6 files changed

modifiedpallets/common/src/eth.rsdiffbeforeafterboth
66 T::CrossAccountId::from_sub(account_id)66 T::CrossAccountId::from_sub(account_id)
67}67}
68
69/// Ethereum representation of Optional value with CrossAddress.
70#[derive(Debug, Default, AbiCoder)]
71pub struct OptionCrossAddress {
72 /// Whether or not this CrossAdress is valid and has meaning.
73 pub status: bool,
74 /// The underlying CrossAddress value. If the status is false, can be set to whatever.
75 pub value: CrossAddress,
76}
7768
78/// Cross account struct69/// Cross account struct
79#[derive(Debug, Default, AbiCoder)]70#[derive(Debug, Default, AbiCoder)]
modifiedpallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -175,16 +175,10 @@
 	///
 	/// @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<eth::OptionCrossAddress> {
+	fn sponsor(&self, contract_address: address) -> Result<Option<eth::CrossAddress>> {
 		Ok(match Pallet::<T>::get_sponsor(contract_address) {
-			Some(ref value) => eth::OptionCrossAddress {
-				status: true,
-				value: eth::CrossAddress::from_sub_cross_account::<T>(value),
-			},
-			None => eth::OptionCrossAddress {
-				status: false,
-				value: Default::default(),
-			},
+			Some(ref value) => Some(eth::CrossAddress::from_sub_cross_account::<T>(value)),
+			None => None,
 		})
 	}
 
modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterboth

binary blob — no preview

modifiedpallets/evm-contract-helpers/src/stubs/ContractHelpers.soldiffbeforeafterboth
--- a/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
+++ b/pallets/evm-contract-helpers/src/stubs/ContractHelpers.sol
@@ -96,11 +96,11 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x766c4f37,
 	///  or in textual repr: sponsor(address)
-	function sponsor(address contractAddress) public view returns (OptionCrossAddress memory) {
+	function sponsor(address contractAddress) public view returns (Option_CrossAddress memory) {
 		require(false, stub_error);
 		contractAddress;
 		dummy;
-		return OptionCrossAddress(false, CrossAddress(0x0000000000000000000000000000000000000000, 0));
+		return Option_CrossAddress(false, CrossAddress(0x0000000000000000000000000000000000000000, 0));
 	}
 
 	/// Check tat contract has confirmed sponsor.
@@ -281,10 +281,10 @@
 	uint256 sub;
 }
 
-/// Ethereum representation of Optional value with CrossAddress.
-struct OptionCrossAddress {
-	/// Whether or not this CrossAdress is valid and has meaning.
+/// Optional value
+struct Option_CrossAddress {
+	/// Shows the status of accessibility of value
 	bool status;
-	/// The underlying CrossAddress value. If the status is false, can be set to whatever.
+	/// Actual value if `status` is true
 	CrossAddress value;
 }
modifiedtests/src/eth/abi/contractHelpers.jsondiffbeforeafterboth
--- a/tests/src/eth/abi/contractHelpers.json
+++ b/tests/src/eth/abi/contractHelpers.json
@@ -238,7 +238,7 @@
             "type": "tuple"
           }
         ],
-        "internalType": "struct OptionCrossAddress",
+        "internalType": "struct Option_CrossAddress",
         "name": "",
         "type": "tuple"
       }
modifiedtests/src/eth/api/ContractHelpers.soldiffbeforeafterboth
--- a/tests/src/eth/api/ContractHelpers.sol
+++ b/tests/src/eth/api/ContractHelpers.sol
@@ -69,7 +69,7 @@
 	/// @return Tuble with sponsor address and his substrate mirror. If there is no confirmed sponsor error "Contract has no sponsor" throw.
 	/// @dev EVM selector for this function is: 0x766c4f37,
 	///  or in textual repr: sponsor(address)
-	function sponsor(address contractAddress) external view returns (OptionCrossAddress memory);
+	function sponsor(address contractAddress) external view returns (Option_CrossAddress memory);
 
 	/// Check tat contract has confirmed sponsor.
 	///
@@ -181,11 +181,11 @@
 	Generous
 }
 
-/// Ethereum representation of Optional value with CrossAddress.
-struct OptionCrossAddress {
-	/// Whether or not this CrossAdress is valid and has meaning.
+/// Optional value
+struct Option_CrossAddress {
+	/// Shows the status of accessibility of value
 	bool status;
-	/// The underlying CrossAddress value. If the status is false, can be set to whatever.
+	/// Actual value if `status` is true
 	CrossAddress value;
 }