rename the data keys to store ordered voucher lists

This commit is contained in:
Alfred Kamanda 2026-02-12 10:24:54 +03:00
parent 5ed7cbd40a
commit ea71c08143
Signed by: Alfred-mk
GPG Key ID: E60B2165A97F4D41
3 changed files with 20 additions and 20 deletions

View File

@ -27,9 +27,9 @@ func (h *MenuHandlers) GetPoolDepositVouchers(ctx context.Context, sym string, i
userStore := h.userdataStore
// Read stable vouchers from the store
voucherData, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_STABLE_VOUCHER_SYMBOLS)
voucherData, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ORDERED_VOUCHER_SYMBOLS)
if err != nil {
logg.ErrorCtxf(ctx, "failed to read stable voucherData entires with", "key", storedb.DATA_STABLE_VOUCHER_SYMBOLS, "error", err)
logg.ErrorCtxf(ctx, "failed to read stable voucherData entires with", "key", storedb.DATA_ORDERED_VOUCHER_SYMBOLS, "error", err)
return res, err
}
@ -37,9 +37,9 @@ func (h *MenuHandlers) GetPoolDepositVouchers(ctx context.Context, sym string, i
return res, nil
}
voucherBalances, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_STABLE_VOUCHER_BALANCES)
voucherBalances, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ORDERED_VOUCHER_BALANCES)
if err != nil {
logg.ErrorCtxf(ctx, "failed to read stable voucherData entires with", "key", storedb.DATA_STABLE_VOUCHER_BALANCES, "error", err)
logg.ErrorCtxf(ctx, "failed to read stable voucherData entires with", "key", storedb.DATA_ORDERED_VOUCHER_BALANCES, "error", err)
return res, err
}

View File

@ -104,14 +104,14 @@ const (
DATA_VOUCHER_DECIMALS
// List of voucher EVM addresses for vouchers valid in the user context.
DATA_VOUCHER_ADDRESSES
// List of stable voucher symbols in the user context.
DATA_STABLE_VOUCHER_SYMBOLS
// List of stable voucher decimal counts for vouchers valid in the user context.
DATA_STABLE_VOUCHER_BALANCES
// List of stable voucher decimal counts for vouchers valid in the user context.
DATA_STABLE_VOUCHER_DECIMALS
// List of stable voucher EVM addresses for vouchers valid in the user context.
DATA_STABLE_VOUCHER_ADDRESSES
// List of ordered voucher symbols in the user context.
DATA_ORDERED_VOUCHER_SYMBOLS
// List of ordered voucher balances in the user context.
DATA_ORDERED_VOUCHER_BALANCES
// List of ordered voucher decimals in the user context.
DATA_ORDERED_VOUCHER_DECIMALS
// List of ordered voucher EVM addresses in the user context.
DATA_ORDERED_VOUCHER_ADDRESSES
)
const (

View File

@ -123,10 +123,10 @@ func GetVoucherData(ctx context.Context, store DataStore, sessionId string, inpu
// GetStableVoucherData retrieves and matches stable voucher data
func GetStableVoucherData(ctx context.Context, store DataStore, sessionId string, input string) (*dataserviceapi.TokenHoldings, error) {
keys := []storedb.DataTyp{
storedb.DATA_STABLE_VOUCHER_SYMBOLS,
storedb.DATA_STABLE_VOUCHER_BALANCES,
storedb.DATA_STABLE_VOUCHER_DECIMALS,
storedb.DATA_STABLE_VOUCHER_ADDRESSES,
storedb.DATA_ORDERED_VOUCHER_SYMBOLS,
storedb.DATA_ORDERED_VOUCHER_BALANCES,
storedb.DATA_ORDERED_VOUCHER_DECIMALS,
storedb.DATA_ORDERED_VOUCHER_ADDRESSES,
}
data := make(map[storedb.DataTyp]string)
@ -139,10 +139,10 @@ func GetStableVoucherData(ctx context.Context, store DataStore, sessionId string
}
symbol, balance, decimal, address := MatchVoucher(input,
data[storedb.DATA_STABLE_VOUCHER_SYMBOLS],
data[storedb.DATA_STABLE_VOUCHER_BALANCES],
data[storedb.DATA_STABLE_VOUCHER_DECIMALS],
data[storedb.DATA_STABLE_VOUCHER_ADDRESSES],
data[storedb.DATA_ORDERED_VOUCHER_SYMBOLS],
data[storedb.DATA_ORDERED_VOUCHER_BALANCES],
data[storedb.DATA_ORDERED_VOUCHER_DECIMALS],
data[storedb.DATA_ORDERED_VOUCHER_ADDRESSES],
)
if symbol == "" {