difftreelog
misc: Use PascalCase in OptionGeneric name
in: master
17 files changed
crates/evm-coder/src/solidity/impls.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity/impls.rs
+++ b/crates/evm-coder/src/solidity/impls.rs
@@ -141,12 +141,29 @@
impl<T: SolidityTypeName> super::SolidityStructTy for Option<T> {
fn generate_solidity_interface(tc: &TypeCollector) -> String {
- let mut solidity_name = "Option_".to_string();
+ const option_name: &str = "Option";
+ const option_name_len: usize = option_name.len();
+
+ let to_upper_case_generic_type_name = |s: &mut String| {
+ let c = s
+ .chars()
+ .skip(option_name_len)
+ .next()
+ .expect("Ethereum name must be presented");
+ if c.is_ascii_uppercase() {
+ return;
+ }
+ let uc = String::from(c.to_ascii_uppercase());
+ s.replace_range(option_name_len..option_name_len + 1, uc.as_str());
+ };
+
+ let mut solidity_name = option_name.to_string();
T::solidity_name(&mut solidity_name, tc);
- let solidity_name_str = solidity_name.as_str();
+ to_upper_case_generic_type_name(&mut solidity_name);
+
let interface = super::SolidityStruct {
docs: &[" Optional value"],
- name: solidity_name_str,
+ name: solidity_name.as_str(),
fields: (
super::SolidityStructField::<bool> {
docs: &[" Shows the status of accessibility of value"],
pallets/evm-contract-helpers/src/stubs/ContractHelpers.rawdiffbeforeafterbothbinary blob (application/octet-stream) — download
pallets/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 (Option_CrossAddress memory) {
+ function sponsor(address contractAddress) public view returns (OptionCrossAddress memory) {
require(false, stub_error);
contractAddress;
dummy;
- return Option_CrossAddress(false, CrossAddress(0x0000000000000000000000000000000000000000, 0));
+ return OptionCrossAddress(false, CrossAddress(0x0000000000000000000000000000000000000000, 0));
}
/// Check tat contract has confirmed sponsor.
@@ -282,7 +282,7 @@
}
/// Optional value
-struct Option_CrossAddress {
+struct OptionCrossAddress {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
pallets/fungible/src/stubs/UniqueFungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/fungible/src/stubs/UniqueFungible.soldiffbeforeafterboth--- a/pallets/fungible/src/stubs/UniqueFungible.sol
+++ b/pallets/fungible/src/stubs/UniqueFungible.sol
@@ -466,11 +466,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
pallets/nonfungible/src/stubs/UniqueNFT.rawdiffbeforeafterbothbinary blob — no preview
pallets/nonfungible/src/stubs/UniqueNFT.soldiffbeforeafterboth--- a/pallets/nonfungible/src/stubs/UniqueNFT.sol
+++ b/pallets/nonfungible/src/stubs/UniqueNFT.sol
@@ -608,11 +608,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
pallets/refungible/src/stubs/UniqueRefungible.rawdiffbeforeafterbothbinary blob — no preview
pallets/refungible/src/stubs/UniqueRefungible.soldiffbeforeafterboth--- a/pallets/refungible/src/stubs/UniqueRefungible.sol
+++ b/pallets/refungible/src/stubs/UniqueRefungible.sol
@@ -608,11 +608,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
tests/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 Option_CrossAddress",
+ "internalType": "struct OptionCrossAddress",
"name": "",
"type": "tuple"
}
tests/src/eth/abi/fungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/fungible.json
+++ b/tests/src/eth/abi/fungible.json
@@ -222,7 +222,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
@@ -508,7 +508,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
tests/src/eth/abi/nonFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/nonFungible.json
+++ b/tests/src/eth/abi/nonFungible.json
@@ -252,7 +252,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
@@ -670,7 +670,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
tests/src/eth/abi/reFungible.jsondiffbeforeafterboth--- a/tests/src/eth/abi/reFungible.json
+++ b/tests/src/eth/abi/reFungible.json
@@ -234,7 +234,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
@@ -652,7 +652,7 @@
{ "internalType": "bool", "name": "status", "type": "bool" },
{ "internalType": "uint256", "name": "value", "type": "uint256" }
],
- "internalType": "struct Option_uint256",
+ "internalType": "struct OptionUint256",
"name": "value",
"type": "tuple"
}
tests/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 (Option_CrossAddress memory);
+ function sponsor(address contractAddress) external view returns (OptionCrossAddress memory);
/// Check tat contract has confirmed sponsor.
///
@@ -182,7 +182,7 @@
}
/// Optional value
-struct Option_CrossAddress {
+struct OptionCrossAddress {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
tests/src/eth/api/UniqueFungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueFungible.sol
+++ b/tests/src/eth/api/UniqueFungible.sol
@@ -308,11 +308,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
tests/src/eth/api/UniqueNFT.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueNFT.sol
+++ b/tests/src/eth/api/UniqueNFT.sol
@@ -408,11 +408,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true
tests/src/eth/api/UniqueRefungible.soldiffbeforeafterboth--- a/tests/src/eth/api/UniqueRefungible.sol
+++ b/tests/src/eth/api/UniqueRefungible.sol
@@ -408,11 +408,11 @@
/// [`CollectionLimits`](up_data_structs::CollectionLimits) field representation for EVM.
struct CollectionLimit {
CollectionLimitField field;
- Option_uint256 value;
+ OptionUint256 value;
}
/// Optional value
-struct Option_uint256 {
+struct OptionUint256 {
/// Shows the status of accessibility of value
bool status;
/// Actual value if `status` is true