diff --git a/crates/sol-types/src/types/data_type.rs b/crates/sol-types/src/types/data_type.rs index 2d7fb39ec..b5a692261 100644 --- a/crates/sol-types/src/types/data_type.rs +++ b/crates/sol-types/src/types/data_type.rs @@ -291,25 +291,25 @@ impl SolType for Bytes { /// Array - `T[]` pub struct Array(PhantomData); -impl Encodable> for [U] +impl Encodable> for [T] where - T: SolType, - U: Encodable, + T: Encodable, + U: SolType, { #[inline] - fn to_tokens(&self) -> DynSeqToken> { + fn to_tokens(&self) -> DynSeqToken> { DynSeqToken(self.iter().map(|r| r.to_tokens()).collect()) } } -impl Encodable> for Vec +impl Encodable> for Vec where - T: SolType, - U: Encodable, + T: Encodable, + U: SolType, { #[inline] - fn to_tokens(&self) -> DynSeqToken> { - <[U] as Encodable>>::to_tokens(self) + fn to_tokens(&self) -> DynSeqToken> { + <[T] as Encodable>>::to_tokens(self) } } @@ -463,15 +463,15 @@ where /// FixedArray - `T[M]` pub struct FixedArray(PhantomData); -impl Encodable> for [U; N] +impl Encodable> for [T; N] where - T: SolType, - U: Borrow, + T: Encodable, + U: SolType, { #[inline] - fn to_tokens(&self) -> as SolType>::TokenType<'_> { + fn to_tokens(&self) -> as SolType>::TokenType<'_> { FixedSeqToken::<_, N>(core::array::from_fn(|i| { - Encodable::::to_tokens(self[i].borrow()) + Encodable::::to_tokens(&self[i]) })) } } diff --git a/crates/sol-types/src/types/event/topic.rs b/crates/sol-types/src/types/event/topic.rs index 28eddc3ad..1b5f0abf4 100644 --- a/crates/sol-types/src/types/event/topic.rs +++ b/crates/sol-types/src/types/event/topic.rs @@ -122,17 +122,17 @@ impl EventTopic for Bytes { // Complex types - preimage encoding and hash: iter each element macro_rules! array_impl { - ($T:ident) => { + ($ty:ident) => { #[inline] fn topic_preimage_length(rust: &Self::RustType) -> usize { - rust.iter().map($T::topic_preimage_length).sum() + rust.iter().map($ty::topic_preimage_length).sum() } #[inline] fn encode_topic_preimage(rust: &Self::RustType, out: &mut Vec) { out.reserve(Self::topic_preimage_length(rust)); for t in rust { - $T::encode_topic_preimage(t, out); + $ty::encode_topic_preimage(t, out); } } @@ -154,21 +154,21 @@ impl EventTopic for FixedArray { } macro_rules! tuple_impls { - ($count:literal $($t:ident),+) => { + ($count:literal $($ty:ident),+) => { #[allow(non_snake_case)] - impl<$($t: EventTopic,)+> EventTopic for ($($t,)+) { + impl<$($ty: EventTopic,)+> EventTopic for ($($ty,)+) { #[inline] fn topic_preimage_length(rust: &Self::RustType) -> usize { - let ($($t,)+) = rust; - 0usize $( + <$t>::topic_preimage_length($t) )+ + let ($($ty,)+) = rust; + 0usize $( + <$ty>::topic_preimage_length($ty) )+ } #[inline] fn encode_topic_preimage(rust: &Self::RustType, out: &mut Vec) { - let b @ ($($t,)+) = rust; + let b @ ($($ty,)+) = rust; out.reserve(Self::topic_preimage_length(b)); $( - <$t>::encode_topic_preimage($t, out); + <$ty>::encode_topic_preimage($ty, out); )+ }