From d02f6470d56632e4f1f1fd7e7af6ced3e2379c09 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Tue, 6 May 2025 15:46:53 +0300 Subject: [PATCH] checksum the address from the user's input --- handlers/application/menuhandler.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 7178188..eb9754f 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -33,6 +33,7 @@ import ( "git.grassecon.net/grassrootseconomics/sarafu-vise/profile" "git.grassecon.net/grassrootseconomics/sarafu-vise/store" storedb "git.grassecon.net/grassrootseconomics/sarafu-vise/store/db" + "github.com/grassrootseconomics/ethutils" dataserviceapi "github.com/grassrootseconomics/ussd-data-service/pkg/api" ) @@ -1672,8 +1673,11 @@ func (h *MenuHandlers) ValidateRecipient(ctx context.Context, sym string, input } case "address": + // checksum the address + address := ethutils.ChecksumAddress(recipient) + // Save the valid Ethereum address as the recipient - err = store.WriteEntry(ctx, sessionId, storedb.DATA_RECIPIENT, []byte(recipient)) + err = store.WriteEntry(ctx, sessionId, storedb.DATA_RECIPIENT, []byte(address)) if err != nil { logg.ErrorCtxf(ctx, "failed to write recipient entry with", "key", storedb.DATA_RECIPIENT, "value", recipient, "error", err) return res, err