From 601c94278db517321aaf964309602d0aacf7eb23 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Sat, 7 Oct 2023 21:44:15 -0700 Subject: [PATCH 1/2] fix: json deals with anonymous properly --- crates/json-abi/src/to_sol.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/json-abi/src/to_sol.rs b/crates/json-abi/src/to_sol.rs index 5af7430277..4f5d7d907b 100644 --- a/crates/json-abi/src/to_sol.rs +++ b/crates/json-abi/src/to_sol.rs @@ -209,6 +209,7 @@ impl ToSol for Event { inputs: &self.inputs, visibility: None, state_mutability: None, + anonymous: self.anonymous, outputs: &[], } .to_sol(out); @@ -223,6 +224,7 @@ impl ToSol for Error { inputs: &self.inputs, visibility: None, state_mutability: None, + anonymous: false, outputs: &[], } .to_sol(out); @@ -237,6 +239,7 @@ impl ToSol for Fallback { inputs: &[], visibility: Some("external"), state_mutability: Some(self.state_mutability), + anonymous: false, outputs: &[], } .to_sol(out); @@ -251,6 +254,7 @@ impl ToSol for Receive { inputs: &[], visibility: Some("external"), state_mutability: Some(self.state_mutability), + anonymous: false, outputs: &[], } .to_sol(out); @@ -265,6 +269,7 @@ impl ToSol for Function { inputs: &self.inputs, visibility: Some("external"), state_mutability: Some(self.state_mutability), + anonymous: false, outputs: &self.outputs, } .to_sol(out); @@ -277,6 +282,7 @@ struct AbiFunction<'a, IN> { inputs: &'a [IN], visibility: Option<&'static str>, state_mutability: Option, + anonymous: bool, outputs: &'a [Param], } @@ -320,6 +326,10 @@ impl ToSol for AbiFunction<'_, IN> { out.push(')'); } + if self.anonymous { + out.push_str("anonymous"); + } + out.push(';'); } } From 6416953f317af59c3ec10856c047e21a76ff1bb9 Mon Sep 17 00:00:00 2001 From: Will Smith <44074786+Will-Smith11@users.noreply.github.com> Date: Sat, 7 Oct 2023 22:34:12 -0700 Subject: [PATCH 2/2] Update crates/json-abi/src/to_sol.rs Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com> --- crates/json-abi/src/to_sol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/json-abi/src/to_sol.rs b/crates/json-abi/src/to_sol.rs index 4f5d7d907b..daa363df06 100644 --- a/crates/json-abi/src/to_sol.rs +++ b/crates/json-abi/src/to_sol.rs @@ -327,7 +327,7 @@ impl ToSol for AbiFunction<'_, IN> { } if self.anonymous { - out.push_str("anonymous"); + out.push_str(" anonymous"); } out.push(';');