use the pool symbol in place of the pool name
This commit is contained in:
parent
29863d385d
commit
dec8fbc3f0
@ -43,7 +43,7 @@ func (h *MenuHandlers) CalculateMaxPayDebt(ctx context.Context, sym string, inpu
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve active pool
|
// Resolve active pool
|
||||||
activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId)
|
activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
res.FlagReset = append(res.FlagReset, flag_low_swap_amount, flag_api_call_error)
|
res.FlagReset = append(res.FlagReset, flag_low_swap_amount, flag_api_call_error)
|
||||||
return res, err
|
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)",
|
"You can remove a max of %s %s from '%s'\nEnter amount of %s:(Max: %s)",
|
||||||
quoteStr,
|
quoteStr,
|
||||||
string(activeSym),
|
string(activeSym),
|
||||||
string(activePoolName),
|
string(activePoolSymbol),
|
||||||
metadata.TokenSymbol,
|
metadata.TokenSymbol,
|
||||||
maxStr,
|
maxStr,
|
||||||
)
|
)
|
||||||
@ -268,7 +268,7 @@ func (h *MenuHandlers) InitiatePayDebt(ctx context.Context, sym string, input []
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve active pool
|
// Resolve active pool
|
||||||
activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId)
|
activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
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.",
|
"Your request has been sent. You will receive an SMS when your debt of %s %s has been removed from %s.",
|
||||||
string(debtQuotedAmount),
|
string(debtQuotedAmount),
|
||||||
string(activeSym),
|
string(activeSym),
|
||||||
activePoolName,
|
activePoolSymbol,
|
||||||
)
|
)
|
||||||
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_account_authorized)
|
res.FlagReset = append(res.FlagReset, flag_account_authorized)
|
||||||
|
|||||||
@ -145,14 +145,14 @@ func (h *MenuHandlers) ConfirmPoolDeposit(ctx context.Context, sym string, input
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Resolve active pool
|
// Resolve active pool
|
||||||
_, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId)
|
_, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
return res, err
|
||||||
}
|
}
|
||||||
|
|
||||||
res.Content = l.Get(
|
res.Content = l.Get(
|
||||||
"You will deposit %s %s into %s\n",
|
"You will deposit %s %s into %s\n",
|
||||||
inputStr, poolDepositVoucher.TokenSymbol, activePoolName,
|
inputStr, poolDepositVoucher.TokenSymbol, activePoolSymbol,
|
||||||
)
|
)
|
||||||
|
|
||||||
return res, nil
|
return res, nil
|
||||||
@ -174,7 +174,7 @@ func (h *MenuHandlers) InitiatePoolDeposit(ctx context.Context, sym string, inpu
|
|||||||
l.AddDomain("default")
|
l.AddDomain("default")
|
||||||
|
|
||||||
// Resolve active pool
|
// Resolve active pool
|
||||||
activePoolAddress, activePoolName, err := h.resolveActivePoolDetails(ctx, sessionId)
|
activePoolAddress, activePoolSymbol, err := h.resolveActivePoolDetails(ctx, sessionId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return res, err
|
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.",
|
"Your request has been sent. You will receive an SMS when %s %s has been deposited into %s.",
|
||||||
poolDepositdata.Amount,
|
poolDepositdata.Amount,
|
||||||
poolDepositVoucher.TokenSymbol,
|
poolDepositVoucher.TokenSymbol,
|
||||||
activePoolName,
|
activePoolSymbol,
|
||||||
)
|
)
|
||||||
|
|
||||||
res.FlagReset = append(res.FlagReset, flag_account_authorized)
|
res.FlagReset = append(res.FlagReset, flag_account_authorized)
|
||||||
|
|||||||
@ -530,7 +530,7 @@ func (h *MenuHandlers) getRecipientData(ctx context.Context, sessionId string) (
|
|||||||
return
|
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
|
store := h.userdataStore
|
||||||
|
|
||||||
// Try read address
|
// Try read address
|
||||||
@ -540,21 +540,21 @@ func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId s
|
|||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try read name
|
// Try read symbol
|
||||||
defaultPoolName, err = store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_POOL_NAME)
|
defaultPoolSymbol, err = store.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_POOL_SYM)
|
||||||
if err != nil && !db.IsNotFound(err) {
|
if err != nil && !db.IsNotFound(err) {
|
||||||
logg.ErrorCtxf(ctx, "failed to read active pool name", "error", err)
|
logg.ErrorCtxf(ctx, "failed to read active pool name", "error", err)
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// If both exist, return them
|
// If both exist, return them
|
||||||
if defaultPoolAddress != nil && defaultPoolName != nil {
|
if defaultPoolAddress != nil && defaultPoolSymbol != nil {
|
||||||
return defaultPoolAddress, defaultPoolName, nil
|
return defaultPoolAddress, defaultPoolSymbol, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fallback to config defaults
|
// Fallback to config defaults
|
||||||
defaultPoolAddress = []byte(config.DefaultPoolAddress())
|
defaultPoolAddress = []byte(config.DefaultPoolAddress())
|
||||||
defaultPoolName = []byte(config.DefaultPoolName())
|
defaultPoolSymbol = []byte(config.DefaultPoolSymbol())
|
||||||
|
|
||||||
if err := store.WriteEntry(
|
if err := store.WriteEntry(
|
||||||
ctx,
|
ctx,
|
||||||
@ -569,14 +569,14 @@ func (h *MenuHandlers) resolveActivePoolDetails(ctx context.Context, sessionId s
|
|||||||
if err := store.WriteEntry(
|
if err := store.WriteEntry(
|
||||||
ctx,
|
ctx,
|
||||||
sessionId,
|
sessionId,
|
||||||
storedb.DATA_ACTIVE_POOL_NAME,
|
storedb.DATA_ACTIVE_POOL_SYM,
|
||||||
defaultPoolName,
|
defaultPoolSymbol,
|
||||||
); err != nil {
|
); 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 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) {
|
func (h *MenuHandlers) calculateSendCreditLimits(ctx context.Context, poolAddress, fromAddress, toAddress, publicKey, fromDecimal, toDecimal []byte) (string, string, error) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user