From af56feeed1edfb82bc21f835b8a9a19c7fc7d640 Mon Sep 17 00:00:00 2001 From: E0nEch0 <162007055+E0nEch0@users.noreply.github.com> Date: Sun, 12 May 2024 21:07:51 +1200 Subject: [PATCH] Update rules.md Improved Readability: Clear variable names and consistent formatting. Explicit Handling: Added an explicit return statement for cases that require manual review for enhanced clarity. --- cmd/clef/rules.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/cmd/clef/rules.md b/cmd/clef/rules.md index cc4a645596..7637fecc35 100644 --- a/cmd/clef/rules.md +++ b/cmd/clef/rules.md @@ -214,14 +214,15 @@ function OnApprovedTx(resp) { ## Example 2: allow destination ```js -function ApproveTx(r) { - if (r.transaction.from.toLowerCase() == "0x0000000000000000000000000000000000001337") { - return "Approve" - } - if (r.transaction.from.toLowerCase() == "0x000000000000000000000000000000000000dead") { - return "Reject" - } - // Otherwise goes to manual processing +function ApproveTx(request) { + const sender = request.transaction.from.toLowerCase(); + if (sender === "0x0000000000000000000000000000000000001337") { + return "Approve"; + } + if (sender === "0x000000000000000000000000000000000000dead") { + return "Reject"; + } + return "Manual Review"; // Explicit return for clarity } ```