debt-menu #115
@ -176,6 +176,19 @@ func (h *MenuHandlers) CalculateCreditAndDebt(ctx context.Context, sym string, i
|
|||||||
return res, nil
|
return res, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter out the active voucher from swappableVouchers
|
||||||
|
filteredSwappableVouchers := make([]dataserviceapi.TokenHoldings, 0, len(swappableVouchers))
|
||||||
|
for _, s := range swappableVouchers {
|
||||||
|
if s.TokenSymbol != string(activeSym) {
|
||||||
|
filteredSwappableVouchers = append(filteredSwappableVouchers, s)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Store as filtered swap to list data (excluding the current active voucher) for future reference
|
||||||
|
data := store.ProcessVouchers(filteredSwappableVouchers)
|
||||||
|
|
||||||
|
logg.InfoCtxf(ctx, "ProcessVouchers", "data", data)
|
||||||
|
|
||||||
// Find the matching voucher data
|
// Find the matching voucher data
|
||||||
activeSymStr := string(activeSym)
|
activeSymStr := string(activeSym)
|
||||||
var activeData *dataserviceapi.TokenHoldings
|
var activeData *dataserviceapi.TokenHoldings
|
||||||
@ -228,6 +241,10 @@ func (h *MenuHandlers) CalculateCreditAndDebt(ctx context.Context, sym string, i
|
|||||||
kshFormattedDebt, _ := store.TruncateDecimalString(debtksh, 0)
|
kshFormattedDebt, _ := store.TruncateDecimalString(debtksh, 0)
|
||||||
|
|
||||||
dataMap := map[storedb.DataTyp]string{
|
dataMap := map[storedb.DataTyp]string{
|
||||||
|
storedb.DATA_POOL_TO_SYMBOLS: data.Symbols,
|
||||||
|
storedb.DATA_POOL_TO_BALANCES: data.Balances,
|
||||||
|
storedb.DATA_POOL_TO_DECIMALS: data.Decimals,
|
||||||
|
storedb.DATA_POOL_TO_ADDRESSES: data.Addresses,
|
||||||
storedb.DATA_CURRENT_CREDIT: kshFormattedCredit,
|
storedb.DATA_CURRENT_CREDIT: kshFormattedCredit,
|
||||||
storedb.DATA_CURRENT_DEBT: kshFormattedDebt,
|
storedb.DATA_CURRENT_DEBT: kshFormattedDebt,
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user