difftreelog
refactor custom_signature.rs
in: master
13 files changed
crates/evm-coder/procedural/src/solidity_interface.rsdiffbeforeafterboth--- a/crates/evm-coder/procedural/src/solidity_interface.rs
+++ b/crates/evm-coder/procedural/src/solidity_interface.rs
@@ -20,7 +20,7 @@
// about Procedural Macros in Rust book:
// https://doc.rust-lang.org/reference/procedural-macros.html
-use proc_macro2::{TokenStream, Group};
+use proc_macro2::TokenStream;
use quote::{quote, ToTokens, format_ident};
use inflector::cases;
use std::fmt::Write;
@@ -735,7 +735,7 @@
#[doc = #selector_str]
const #screaming_name: ::evm_coder::types::bytes4 = {
let a = ::evm_coder::sha3_const::Keccak256::new()
- .update_with_size(&Self::#screaming_name_signature.signature, Self::#screaming_name_signature.signature_len)
+ .update_with_size(&Self::#screaming_name_signature.data, Self::#screaming_name_signature.len)
.finalize();
[a[0], a[1], a[2], a[3]]
};
@@ -841,35 +841,54 @@
}
}
+ fn expand_type(ty: &AbiType, token_stream: &mut proc_macro2::TokenStream) {
+ match ty {
+ AbiType::Plain(ref ident) => {
+ token_stream.extend(quote! {
+ (<#ident>::SIGNATURE),
+ });
+ }
+
+ AbiType::Tuple(ref tuple_type) => {
+ let mut tuple_types = proc_macro2::TokenStream::new();
+ for ty in tuple_type {
+ Self::expand_type(ty, &mut tuple_types);
+ }
+ let group =
+ proc_macro2::Group::new(proc_macro2::Delimiter::Parenthesis, tuple_types);
+ token_stream.extend(group.stream());
+ }
+
+ AbiType::Vec(ref _vec_type) => {}
+
+ AbiType::Array(_, _) => todo!("Array eth signature"),
+ };
+ }
+
fn expand_custom_signature(&self) -> proc_macro2::TokenStream {
- let mut custom_signature = TokenStream::new();
+ let mut token_stream = TokenStream::new();
- self.args
- .iter()
- .filter_map(|a| {
- if a.is_special() {
- return None;
- };
+ for arg in &self.args {
+ if arg.is_special() {
+ continue;
+ }
- match a.ty {
- AbiType::Plain(ref ident) => Some(ident),
- _ => None,
- }
- })
- .for_each(|ident| {
- custom_signature.extend(quote! {
- (<#ident>::SIGNATURE, <#ident>::SIGNATURE_LEN)
- });
- });
+ Self::expand_type(&arg.ty, &mut token_stream);
+ }
let func_name = self.camel_name.clone();
- let func_name = quote!(FunctionName::new(#func_name));
- custom_signature =
- quote!({ ::evm_coder::make_signature!(new fn(& #func_name),#custom_signature) });
+ let func_name = quote!(SignaturePreferences {
+ open_name: Some(SignatureUnit::new(#func_name)),
+ open_delimiter: Some(SignatureUnit::new("(")),
+ param_delimiter: Some(SignatureUnit::new(",")),
+ close_delimiter: Some(SignatureUnit::new(")")),
+ close_name: None,
+ });
+ token_stream = quote!({ ::evm_coder::make_signature!(new fn(#func_name),#token_stream) });
// println!("!!!!! {}", custom_signature);
- custom_signature
+ token_stream
}
fn expand_solidity_function(&self) -> proc_macro2::TokenStream {
crates/evm-coder/src/abi.rsdiffbeforeafterboth--- a/crates/evm-coder/src/abi.rs
+++ b/crates/evm-coder/src/abi.rs
@@ -26,6 +26,8 @@
use crate::{
execution::{Error, ResultWithPostInfo, WithPostDispatchInfo},
types::*,
+ make_signature,
+ custom_signature::{SignatureUnit, SIGNATURE_SIZE_LIMIT},
};
use crate::execution::Result;
@@ -378,7 +380,6 @@
impl_abi_readable!(bytes4, bytes4, false);
impl_abi_readable!(address, address, false);
impl_abi_readable!(string, string, true);
-// impl_abi_readable!(bytes, bytes, true);
impl TypeHelper for bytes {
fn is_dynamic() -> bool {
@@ -420,6 +421,10 @@
}
}
+impl<R: Signature> Signature for Vec<R> {
+ make_signature!(new nameof(R) fixed("[]"));
+}
+
impl TypeHelper for EthCrossAccount {
fn is_dynamic() -> bool {
address::is_dynamic() || uint256::is_dynamic()
@@ -471,7 +476,9 @@
0 $(+ <$ident>::size())+
}
}
+
impl<$($ident),+> sealed::CanBePlacedInVec for ($($ident,)+) {}
+
impl<$($ident),+> AbiRead<($($ident,)+)> for AbiReader<'_>
where
$(
@@ -487,6 +494,7 @@
))
}
}
+
#[allow(non_snake_case)]
impl<$($ident),+> AbiWrite for ($($ident,)+)
where
@@ -503,6 +511,18 @@
}
}
}
+
+ impl<$($ident),+> Signature for ($($ident,)+)
+ where
+ $($ident: Signature,)+
+ {
+ make_signature!(
+ new fixed("(")
+ $(nameof($ident) fixed(","))+
+ shift_left(1)
+ fixed(")")
+ );
+ }
};
}
crates/evm-coder/src/custom_signature.rsdiffbeforeafterboth--- a/crates/evm-coder/src/custom_signature.rs
+++ b/crates/evm-coder/src/custom_signature.rs
@@ -2,100 +2,94 @@
pub const SIGNATURE_SIZE_LIMIT: usize = 256;
-pub trait Name {
- const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
- const SIGNATURE_LEN: usize;
-
- fn name() -> &'static str {
- from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
- }
+#[derive(Debug)]
+pub struct SignaturePreferences {
+ pub open_name: Option<SignatureUnit>,
+ pub open_delimiter: Option<SignatureUnit>,
+ pub param_delimiter: Option<SignatureUnit>,
+ pub close_delimiter: Option<SignatureUnit>,
+ pub close_name: Option<SignatureUnit>,
}
#[derive(Debug)]
pub struct FunctionSignature {
- pub signature: [u8; SIGNATURE_SIZE_LIMIT],
- pub signature_len: usize,
+ pub data: [u8; SIGNATURE_SIZE_LIMIT],
+ pub len: usize,
+
+ preferences: SignaturePreferences,
}
impl FunctionSignature {
- pub const fn new(name: &'static FunctionName) -> FunctionSignature {
- let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
- let name_len = name.signature_len;
- let name = name.signature;
+ pub const fn new(preferences: SignaturePreferences) -> FunctionSignature {
+ let mut dst = [0_u8; SIGNATURE_SIZE_LIMIT];
let mut dst_offset = 0;
- let bracket_open = {
- let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
- b[0] = b"("[0];
- b
- };
- crate::make_signature!(@copy(name, signature, name_len, dst_offset));
- crate::make_signature!(@copy(bracket_open, signature, 1, dst_offset));
+ if let Some(ref name) = preferences.open_name {
+ crate::make_signature!(@copy(name.data, dst, name.len, dst_offset));
+ }
+ if let Some(ref delimiter) = preferences.open_delimiter {
+ crate::make_signature!(@copy(delimiter.data, dst, delimiter.len, dst_offset));
+ }
FunctionSignature {
- signature,
- signature_len: dst_offset,
+ data: dst,
+ len: dst_offset,
+ preferences,
}
}
pub const fn add_param(
signature: FunctionSignature,
- param: ([u8; SIGNATURE_SIZE_LIMIT], usize),
+ param: SignatureUnit,
) -> FunctionSignature {
- let mut dst = signature.signature;
- let mut dst_offset = signature.signature_len;
- let (param_name, param_len) = param;
- let comma = {
- let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
- b[0] = b","[0];
- b
- };
+ let mut dst = signature.data;
+ let mut dst_offset = signature.len;
+ crate::make_signature!(@copy(param.data, dst, param.len, dst_offset));
+ if let Some(ref delimiter) = signature.preferences.param_delimiter {
+ crate::make_signature!(@copy(delimiter.data, dst, delimiter.len, dst_offset));
+ }
FunctionSignature {
- signature: {
- crate::make_signature!(@copy(param_name, dst, param_len, dst_offset));
- crate::make_signature!(@copy(comma, dst, 1, dst_offset));
- dst
- },
- signature_len: dst_offset,
+ data: dst,
+ len: dst_offset,
+ ..signature
}
}
pub const fn done(signature: FunctionSignature, owerride: bool) -> FunctionSignature {
- let mut dst = signature.signature;
- let mut dst_offset = signature.signature_len - if owerride { 1 } else { 0 };
- let bracket_close = {
- let mut b = [0_u8; SIGNATURE_SIZE_LIMIT];
- b[0] = b")"[0];
- b
- };
+ let mut dst = signature.data;
+ let mut dst_offset = signature.len - if owerride { 1 } else { 0 };
+ if let Some(ref delimiter) = signature.preferences.close_delimiter {
+ crate::make_signature!(@copy(delimiter.data, dst, delimiter.len, dst_offset));
+ }
+ if let Some(ref name) = signature.preferences.close_name {
+ crate::make_signature!(@copy(name.data, dst, name.len, dst_offset));
+ }
FunctionSignature {
- signature: {
- crate::make_signature!(@copy(bracket_close, dst, 1, dst_offset));
- dst
- },
- signature_len: dst_offset,
+ data: dst,
+ len: dst_offset,
+ ..signature
}
}
- // fn as_str(&self) -> &'static str {
- // from_utf8(&self.signature[..self.signature_len]).expect("bad utf-8")
- // }
+ pub fn as_str(&self) -> &str {
+ from_utf8(&self.data[..self.len]).expect("bad utf-8")
+ }
}
#[derive(Debug)]
-pub struct FunctionName {
- signature: [u8; SIGNATURE_SIZE_LIMIT],
- signature_len: usize,
+pub struct SignatureUnit {
+ pub data: [u8; SIGNATURE_SIZE_LIMIT],
+ pub len: usize,
}
-impl FunctionName {
- pub const fn new(name: &'static str) -> FunctionName {
+impl SignatureUnit {
+ pub const fn new(name: &'static str) -> SignatureUnit {
let mut signature = [0_u8; SIGNATURE_SIZE_LIMIT];
let name = name.as_bytes();
let name_len = name.len();
let mut dst_offset = 0;
crate::make_signature!(@copy(name, signature, name_len, dst_offset));
- FunctionName {
- signature,
- signature_len: name_len,
+ SignatureUnit {
+ data: signature,
+ len: name_len,
}
}
}
@@ -105,14 +99,14 @@
macro_rules! make_signature { // May be "define_signature"?
(new fn($func:expr)$(,)+) => {
{
- let fs = FunctionSignature::new(& $func);
+ let fs = FunctionSignature::new($func);
let fs = FunctionSignature::done(fs, false);
fs
}
};
- (new fn($func:expr), $($tt:tt)*) => {
+ (new fn($func:expr), $($tt:tt,)*) => {
{
- let fs = FunctionSignature::new(& $func);
+ let fs = FunctionSignature::new($func);
let fs = make_signature!(@param; fs, $($tt),*);
fs
}
@@ -129,16 +123,16 @@
};
(new $($tt:tt)*) => {
- const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = {
- let mut out = [0u8; SIGNATURE_SIZE_LIMIT];
- let mut dst_offset = 0;
- make_signature!(@data(out, dst_offset); $($tt)*);
- out
+ const SIGNATURE: SignatureUnit = SignatureUnit {
+ data: {
+ let mut out = [0u8; SIGNATURE_SIZE_LIMIT];
+ let mut dst_offset = 0;
+ make_signature!(@data(out, dst_offset); $($tt)*);
+ out
+ },
+ len: {0 + make_signature!(@size; $($tt)*)},
};
- const SIGNATURE_LEN: usize = 0 + make_signature!(@size; $($tt)*);
};
-
- // (@bytes)
(@size;) => {
0
@@ -147,8 +141,11 @@
$expr.len() + make_signature!(@size; $($tt)*)
};
(@size; nameof($expr:ty) $($tt:tt)*) => {
- <$expr>::SIGNATURE_LEN + make_signature!(@size; $($tt)*)
+ <$expr>::SIGNATURE.len + make_signature!(@size; $($tt)*)
};
+ (@size; shift_left($expr:expr) $($tt:tt)*) => {
+ make_signature!(@size; $($tt)*) - $expr
+ };
(@data($dst:ident, $dst_offset:ident);) => {};
(@data($dst:ident, $dst_offset:ident); fixed($expr:expr) $($tt:tt)*) => {
@@ -161,14 +158,16 @@
};
(@data($dst:ident, $dst_offset:ident); nameof($expr:ty) $($tt:tt)*) => {
{
- let data = &<$expr>::SIGNATURE;
- let data_len = <$expr>::SIGNATURE_LEN;
- make_signature!(@copy(data, $dst, data_len, $dst_offset));
+ make_signature!(@copy(&<$expr>::SIGNATURE.data, $dst, <$expr>::SIGNATURE.len, $dst_offset));
}
make_signature!(@data($dst, $dst_offset); $($tt)*)
};
+ (@data($dst:ident, $dst_offset:ident); shift_left($expr:expr) $($tt:tt)*) => {
+ $dst_offset -= $expr;
+ make_signature!(@data($dst, $dst_offset); $($tt)*)
+ };
- (@copy($src:ident, $dst:ident, $src_len:expr, $dst_offset:ident)) => {
+ (@copy($src:expr, $dst:expr, $src_len:expr, $dst_offset:ident)) => {
{
let mut src_offset = 0;
let src_len: usize = $src_len;
@@ -185,10 +184,16 @@
mod test {
use core::str::from_utf8;
- use frame_support::sp_runtime::app_crypto::sp_core::hexdisplay::AsBytesRef;
+ use super::{SIGNATURE_SIZE_LIMIT, SignatureUnit, FunctionSignature, SignaturePreferences};
- use super::{Name, SIGNATURE_SIZE_LIMIT, FunctionName, FunctionSignature};
+ trait Name {
+ const SIGNATURE: SignatureUnit;
+ fn name() -> &'static str {
+ from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
+ }
+ }
+
impl Name for u8 {
make_signature!(new fixed("uint8"));
}
@@ -201,13 +206,26 @@
impl<A: Name, B: Name> Name for (A, B) {
make_signature!(new fixed("(") nameof(A) fixed(",") nameof(B) fixed(")"));
}
+ impl<A: Name> Name for (A,) {
+ make_signature!(new fixed("(") nameof(A) fixed(",") shift_left(1) fixed(")"));
+ }
struct MaxSize();
impl Name for MaxSize {
- const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT] = [b'!'; SIGNATURE_SIZE_LIMIT];
- const SIGNATURE_LEN: usize = SIGNATURE_SIZE_LIMIT;
+ const SIGNATURE: SignatureUnit = SignatureUnit {
+ data: [b'!'; SIGNATURE_SIZE_LIMIT],
+ len: SIGNATURE_SIZE_LIMIT,
+ };
}
+ const SIGNATURE_PREFERENCES: SignaturePreferences = SignaturePreferences {
+ open_name: Some(SignatureUnit::new("some_funk")),
+ open_delimiter: Some(SignatureUnit::new("(")),
+ param_delimiter: Some(SignatureUnit::new(",")),
+ close_delimiter: Some(SignatureUnit::new(")")),
+ close_name: None,
+ };
+
#[test]
fn simple() {
assert_eq!(u8::name(), "uint8");
@@ -269,68 +287,68 @@
#[test]
fn make_func_without_args() {
- const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
const SIG: FunctionSignature = make_signature!(
- new fn(&SOME_FUNK_NAME),
+ new fn(SIGNATURE_PREFERENCES),
);
- let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
- assert_eq!(name, "some_funk()");
+ let name = SIG.as_str();
+ similar_asserts::assert_eq!(name, "some_funk()");
}
#[test]
fn make_func_with_1_args() {
- const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
const SIG: FunctionSignature = make_signature!(
- new fn(&SOME_FUNK_NAME),
- (u8::SIGNATURE, u8::SIGNATURE_LEN)
+ new fn(SIGNATURE_PREFERENCES),
+ (<u8>::SIGNATURE),
);
- let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
- assert_eq!(name, "some_funk(uint8)");
+ let name = SIG.as_str();
+ similar_asserts::assert_eq!(name, "some_funk(uint8)");
}
#[test]
fn make_func_with_2_args() {
- const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
const SIG: FunctionSignature = make_signature!(
- new fn(&SOME_FUNK_NAME),
- (u8::SIGNATURE, u8::SIGNATURE_LEN)
- (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ new fn(SIGNATURE_PREFERENCES),
+ (u8::SIGNATURE),
+ (<Vec<u32>>::SIGNATURE),
);
- let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
- assert_eq!(name, "some_funk(uint8,uint32[])");
+ let name = SIG.as_str();
+ similar_asserts::assert_eq!(name, "some_funk(uint8,uint32[])");
}
#[test]
fn make_func_with_3_args() {
- const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
const SIG: FunctionSignature = make_signature!(
- new fn(&SOME_FUNK_NAME),
- (u8::SIGNATURE, u8::SIGNATURE_LEN)
- (u32::SIGNATURE, u32::SIGNATURE_LEN)
- (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ new fn(SIGNATURE_PREFERENCES),
+ (<u8>::SIGNATURE),
+ (<u32>::SIGNATURE),
+ (<Vec<u32>>::SIGNATURE),
);
- let name = from_utf8(&SIG.signature[..SIG.signature_len]).unwrap();
- assert_eq!(name, "some_funk(uint8,uint32,uint32[])");
+ let name = SIG.as_str();
+ similar_asserts::assert_eq!(name, "some_funk(uint8,uint32,uint32[])");
}
#[test]
fn make_slice_from_signature() {
- const SOME_FUNK_NAME: FunctionName = FunctionName::new("some_funk");
const SIG: FunctionSignature = make_signature!(
- new fn(&SOME_FUNK_NAME),
- (u8::SIGNATURE, u8::SIGNATURE_LEN)
- (u32::SIGNATURE, u32::SIGNATURE_LEN)
- (<Vec<u32>>::SIGNATURE, <Vec<u32>>::SIGNATURE_LEN)
+ new fn(SIGNATURE_PREFERENCES),
+ (<u8>::SIGNATURE),
+ (<u32>::SIGNATURE),
+ (<Vec<u32>>::SIGNATURE),
);
- const NAME: [u8; SIG.signature_len] = {
- let mut name: [u8; SIG.signature_len] = [0; SIG.signature_len];
+ const NAME: [u8; SIG.len] = {
+ let mut name: [u8; SIG.len] = [0; SIG.len];
let mut i = 0;
- while i < SIG.signature_len {
- name[i] = SIG.signature[i];
+ while i < SIG.len {
+ name[i] = SIG.data[i];
i += 1;
}
name
};
- assert_eq!(&NAME, b"some_funk(uint8,uint32,uint32[])");
+ similar_asserts::assert_eq!(&NAME, b"some_funk(uint8,uint32,uint32[])");
+ }
+
+ #[test]
+ fn shift() {
+ assert_eq!(<(u32,)>::name(), "(uint32)");
}
}
crates/evm-coder/src/lib.rsdiffbeforeafterboth--- a/crates/evm-coder/src/lib.rs
+++ b/crates/evm-coder/src/lib.rs
@@ -124,14 +124,13 @@
use primitive_types::{U256, H160, H256};
use core::str::from_utf8;
- use crate::custom_signature::SIGNATURE_SIZE_LIMIT;
+ use crate::custom_signature::{SignatureUnit, SIGNATURE_SIZE_LIMIT};
pub trait Signature {
- const SIGNATURE: [u8; SIGNATURE_SIZE_LIMIT];
- const SIGNATURE_LEN: usize;
+ const SIGNATURE: SignatureUnit;
fn as_str() -> &'static str {
- from_utf8(&Self::SIGNATURE[..Self::SIGNATURE_LEN]).expect("bad utf-8")
+ from_utf8(&Self::SIGNATURE.data[..Self::SIGNATURE.len]).expect("bad utf-8")
}
}
crates/evm-coder/src/solidity.rsdiffbeforeafterboth--- a/crates/evm-coder/src/solidity.rs
+++ b/crates/evm-coder/src/solidity.rs
@@ -30,7 +30,6 @@
marker::PhantomData,
cell::{Cell, RefCell},
cmp::Reverse,
- str::from_utf8,
};
use impl_trait_for_tuples::impl_for_tuples;
use crate::{types::*, custom_signature::FunctionSignature};
@@ -514,10 +513,16 @@
writeln!(
writer,
"\t{hide_comment}/// or in textual repr: {}",
- // from_utf8(self.custom_signature.as_str()).expect("bad utf8")
self.selector_str
)?;
- write!(writer, "\t{hide_comment}function {}(", self.name)?;
+ if self.selector_str != self.custom_signature.as_str() {
+ writeln!(
+ writer,
+ "\t{hide_comment}/// or in the expanded repr: {}",
+ self.custom_signature.as_str()
+ )?;
+ }
+ write!(writer, "\tfunction {}(", self.name)?;
self.args.solidity_name(writer, tc)?;
write!(writer, ")")?;
if is_impl {
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -21,7 +21,7 @@
types::*,
execution::{Result, Error},
weight,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
pub use pallet_evm::{PrecompileOutput, PrecompileResult, PrecompileHandle, account::CrossAccountId};
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -17,7 +17,7 @@
//! Implementation of magic contract
extern crate alloc;
-use alloc::{format, string::ToString};
+use alloc::string::ToString;
use core::marker::PhantomData;
use evm_coder::{
abi::AbiWriter,
@@ -25,7 +25,7 @@
generate_stubgen, solidity_interface,
types::*,
ToLog,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
use pallet_evm::{
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -17,7 +17,6 @@
//! ERC-20 standart support implementation.
extern crate alloc;
-use alloc::{format, string::ToString};
use core::char::{REPLACEMENT_CHARACTER, decode_utf16};
use core::convert::TryInto;
use evm_coder::{
@@ -26,7 +25,7 @@
generate_stubgen, solidity_interface,
types::*,
weight,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
use pallet_common::eth::convert_tuple_to_cross_account;
pallets/nonfungible/expand.rsdiffbeforeafterbothno changes
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -20,7 +20,7 @@
//! Method implementations are mostly doing parameter conversion and calling Nonfungible Pallet methods.
extern crate alloc;
-use alloc::{format, string::ToString};
+use alloc::string::ToString;
use core::{
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
@@ -31,7 +31,7 @@
generate_stubgen, solidity, solidity_interface,
types::*,
weight,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
use frame_support::BoundedVec;
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -21,7 +21,7 @@
extern crate alloc;
-use alloc::{format, string::ToString};
+use alloc::string::ToString;
use core::{
char::{REPLACEMENT_CHARACTER, decode_utf16},
convert::TryInto,
@@ -32,7 +32,7 @@
generate_stubgen, solidity, solidity_interface,
types::*,
weight,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
use frame_support::{BoundedBTreeMap, BoundedVec};
pallets/refungible/src/erc_token.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc_token.rs
+++ b/pallets/refungible/src/erc_token.rs
@@ -35,7 +35,7 @@
generate_stubgen, solidity_interface,
types::*,
weight,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
};
use pallet_common::{
pallets/unique/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/unique/src/eth/mod.rs
+++ b/pallets/unique/src/eth/mod.rs
@@ -22,7 +22,7 @@
execution::*,
generate_stubgen, solidity, solidity_interface,
types::*,
- custom_signature::{FunctionName, FunctionSignature},
+ custom_signature::{SignatureUnit, FunctionSignature, SignaturePreferences},
make_signature,
, weight};
use frame_support::{traits::Get, storage::StorageNMap};