From dec8fbc3f0f9b72ddb8ed72c19b4db03ba8f4d4d Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 19 Feb 2026 09:04:52 +0300 Subject: [PATCH] use the pool symbol in place of the pool name --- handlers/application/paydebt.go | 8 ++++---- handlers/application/pool_deposit.go | 8 ++++---- handlers/application/send.go | 20 ++++++++++---------- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/handlers/application/paydebt.go b/handlers/application/paydebt.go index 8172b3d..f628c3e 100644 --- a/handlers/application/paydebt.go +++ b/handlers/application/paydebt.go @@ -43,7 +43,7 @@ func (h *MenuHandlers) CalculateMaxPayDebt(ctx context.Context, sym string, inpu } // Resolve active pool - activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId) + activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId) if err != nil { res.FlagReset = append(res.FlagReset, flag_low_swap_amount, flag_api_call_error) return res, err @@ -129,7 +129,7 @@ func (h *MenuHandlers) CalculateMaxPayDebt(ctx context.Context, sym string, inpu "You can remove a max of %s %s from '%s'\nEnter amount of %s:(Max: %s)", quoteStr, string(activeSym), - string(activePoolName), + string(activePoolSymbol), metadata.TokenSymbol, maxStr, ) @@ -268,7 +268,7 @@ func (h *MenuHandlers) InitiatePayDebt(ctx context.Context, sym string, input [] } // Resolve active pool - activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId) + activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId) if err != nil { return res, err } @@ -310,7 +310,7 @@ func (h *MenuHandlers) InitiatePayDebt(ctx context.Context, sym string, input [] "Your request has been sent. You will receive an SMS when your debt of %s %s has been removed from %s.", string(debtQuotedAmount), string(activeSym), - activePoolName, + activePoolSymbol, ) res.FlagReset = append(res.FlagReset, flag_account_authorized) diff --git a/handlers/application/pool_deposit.go b/handlers/application/pool_deposit.go index 16336b8..39e0262 100644 --- a/handlers/application/pool_deposit.go +++ b/handlers/application/pool_deposit.go @@ -145,14 +145,14 @@ func (h *MenuHandlers) ConfirmPoolDeposit(ctx context.Context, sym string, input } // Resolve active pool - _, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId) + _, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId) if err != nil { return res, err } res.Content = l.Get( "You will deposit %s %s into %s\n", - inputStr, poolDepositVoucher.TokenSymbol, activePoolName, + inputStr, poolDepositVoucher.TokenSymbol, activePoolSymbol, ) return res, nil @@ -174,7 +174,7 @@ func (h *MenuHandlers) InitiatePoolDeposit(ctx context.Context, sym string, inpu l.AddDomain("default") // Resolve active pool - activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId) + activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId) if err != nil { return res, err } @@ -212,7 +212,7 @@ func (h *MenuHandlers) InitiatePoolDeposit(ctx context.Context, sym string, inpu "Your request has been sent. You will receive an SMS when %s %s has been deposited into %s.", poolDepositdata.Amount, poolDepositVoucher.TokenSymbol, - activePoolName, + activePoolSymbol, ) res.FlagReset = append(res.FlagReset, flag_account_authorized) diff --git a/handlers/application/send.go b/handlers/application/send.go index b080329..50886fe 100644 --- a/handlers/application/send.go +++ b/handlers/application/send.go @@ -530,7 +530,7 @@ func (h *MenuHandlers) getRecipientData(ctx context.Context, sessionId string) ( return } -func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId string) (defaultPoolAddress, defaultPoolName []byte, err error) { +func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId string) (defaultPoolAddress, defaultPoolSymbol []byte, err error) { store := h.userdataStore // Try read address @@ -540,21 +540,21 @@ func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId s return nil, nil, err } - // Try read name - defaultPoolName, err = store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_POOL_NAME) + // Try read symbol + defaultPoolSymbol, err = store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_POOL_SYM) if err != nil && !db.IsNotFound(err) { logg.ErrorCtxf(ctx, "failed to read active pool name", "error", err) return nil, nil, err } // If both exist, return them - if defaultPoolAddress != nil && defaultPoolName != nil { - return defaultPoolAddress, defaultPoolName, nil + if defaultPoolAddress != nil && defaultPoolSymbol != nil { + return defaultPoolAddress, defaultPoolSymbol, nil } // Fallback to config defaults defaultPoolAddress = []byte(config.DefaultPoolAddress()) - defaultPoolName = []byte(config.DefaultPoolName()) + defaultPoolSymbol = []byte(config.DefaultPoolSymbol()) if err := store.WriteEntry( ctx, @@ -569,14 +569,14 @@ func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId s if err := store.WriteEntry( ctx, sessionId, - storedb.DATA_ACTIVE_POOL_NAME, - defaultPoolName, + storedb.DATA_ACTIVE_POOL_SYM, + defaultPoolSymbol, ); err != nil { - logg.ErrorCtxf(ctx, "failed to write default pool name", "error", err) + logg.ErrorCtxf(ctx, "failed to write default pool symbol", "error", err) return nil, nil, err } - return defaultPoolAddress, defaultPoolName, nil + return defaultPoolAddress, defaultPoolSymbol, nil } func (h *MenuHandlers) calculateSendCreditLimits(ctx context.Context, poolAddress, fromAddress, toAddress, publicKey, fromDecimal, toDecimal []byte) (string, string, error) {