remove lowercase conversion of voucher addresses
This commit is contained in:
parent
43b963995f
commit
f6ecbcc79d
@ -111,7 +111,6 @@ func MinMpesaWithdrawAmount() float64 {
|
|||||||
return f
|
return f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func MaxMpesaSendAmount() float64 {
|
func MaxMpesaSendAmount() float64 {
|
||||||
v := env.GetEnv("MAX_MPESA_SEND_AMOUNT", "250000")
|
v := env.GetEnv("MAX_MPESA_SEND_AMOUNT", "250000")
|
||||||
f, err := strconv.ParseFloat(v, 64)
|
f, err := strconv.ParseFloat(v, 64)
|
||||||
@ -135,7 +134,7 @@ func StableVoucherAddresses() []string {
|
|||||||
|
|
||||||
list := strings.Split(raw, ",")
|
list := strings.Split(raw, ",")
|
||||||
for _, addr := range list {
|
for _, addr := range list {
|
||||||
clean := strings.ToLower(strings.TrimSpace(addr))
|
clean := strings.TrimSpace(addr)
|
||||||
if clean != "" {
|
if clean != "" {
|
||||||
parsed = append(parsed, clean)
|
parsed = append(parsed, clean)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -310,7 +310,7 @@ func (h *MenuHandlers) InitiatePayDebt(ctx context.Context, sym string, input []
|
|||||||
}
|
}
|
||||||
|
|
||||||
func isStableVoucher(tokenAddress string) bool {
|
func isStableVoucher(tokenAddress string) bool {
|
||||||
addr := strings.ToLower(strings.TrimSpace(tokenAddress))
|
addr := strings.TrimSpace(tokenAddress)
|
||||||
for _, stable := range config.StableVoucherAddresses() {
|
for _, stable := range config.StableVoucherAddresses() {
|
||||||
if addr == stable {
|
if addr == stable {
|
||||||
return true
|
return true
|
||||||
|
|||||||
@ -152,7 +152,7 @@ func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []b
|
|||||||
stablePriority := make(map[string]int)
|
stablePriority := make(map[string]int)
|
||||||
stableAddresses := config.StableVoucherAddresses()
|
stableAddresses := config.StableVoucherAddresses()
|
||||||
for i, addr := range stableAddresses {
|
for i, addr := range stableAddresses {
|
||||||
stablePriority[strings.ToLower(addr)] = i
|
stablePriority[addr] = i
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper: order vouchers (stable first, priority-based)
|
// Helper: order vouchers (stable first, priority-based)
|
||||||
@ -169,8 +169,8 @@ func (h *MenuHandlers) ManageVouchers(ctx context.Context, sym string, input []b
|
|||||||
}
|
}
|
||||||
|
|
||||||
sort.SliceStable(stable, func(i, j int) bool {
|
sort.SliceStable(stable, func(i, j int) bool {
|
||||||
ai := stablePriority[strings.ToLower(stable[i].TokenAddress)]
|
ai := stablePriority[stable[i].TokenAddress]
|
||||||
aj := stablePriority[strings.ToLower(stable[j].TokenAddress)]
|
aj := stablePriority[stable[j].TokenAddress]
|
||||||
return ai < aj
|
return ai < aj
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user