alfred/pool-swap #33
| @ -2422,48 +2422,19 @@ func (h *MenuHandlers) GetPools(ctx context.Context, sym string, input []byte) ( | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	userStore := h.userdataStore | 	userStore := h.userdataStore | ||||||
| 	_, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY) | 	publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY) | ||||||
| 	if err != nil { | 	if err != nil { | ||||||
| 		logg.ErrorCtxf(ctx, "failed to read publicKey entry with", "key", storedb.DATA_PUBLIC_KEY, "error", err) | 		logg.ErrorCtxf(ctx, "failed to read publicKey entry with", "key", storedb.DATA_PUBLIC_KEY, "error", err) | ||||||
| 		return res, err | 		return res, err | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	topPools := []dataserviceapi.PoolDetails{ | 	flag_api_error, _ := h.flagManager.GetFlag("flag_api_error") | ||||||
| 		{ | 
 | ||||||
| 			PoolName:            "Kenya ROLA Pool", | 	topPools, err := h.accountService.FetchTopPools(ctx, string(publicKey)) | ||||||
| 			PoolSymbol:          "ROLA", | 	if err != nil { | ||||||
| 			PoolContractAdrress: "0x48a953cA5cf5298bc6f6Af3C608351f537AAcb9e", | 		res.FlagSet = append(res.FlagSet, flag_api_error) | ||||||
| 			LimiterAddress:      "", | 		logg.ErrorCtxf(ctx, "failed on FetchTransactions", "error", err) | ||||||
| 			VoucherRegistry:     "", | 		return res, err | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			PoolName:            "Nairobi ROLA Pool", |  | ||||||
| 			PoolSymbol:          "NAIROBI", |  | ||||||
| 			PoolContractAdrress: "0xB0660Ac1Ee3d32ea35bc728D7CA1705Fa5A37528", |  | ||||||
| 			LimiterAddress:      "", |  | ||||||
| 			VoucherRegistry:     "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			PoolName:            "Friends of Kiriba Ecosystem", |  | ||||||
| 			PoolSymbol:          "FRIENDS", |  | ||||||
| 			PoolContractAdrress: "0xC4848263821FA02baB2181910A2eFb9CECb2c21C", |  | ||||||
| 			LimiterAddress:      "", |  | ||||||
| 			VoucherRegistry:     "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			PoolName:            "Resilient Community Waqfs", |  | ||||||
| 			PoolSymbol:          "REZILIENS", |  | ||||||
| 			PoolContractAdrress: "0x1e40951d7a28147D8B4A554C60c42766C92e2Fc6", |  | ||||||
| 			LimiterAddress:      "", |  | ||||||
| 			VoucherRegistry:     "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			PoolName:            "GrE Tech", |  | ||||||
| 			PoolSymbol:          "GRET", |  | ||||||
| 			PoolContractAdrress: "0xb7B9d0A264eD1a8E2418571B7AC5933C79C9c2B8", |  | ||||||
| 			LimiterAddress:      "", |  | ||||||
| 			VoucherRegistry:     "", |  | ||||||
| 		}, |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Return if there are no pools
 | 	// Return if there are no pools
 | ||||||
| @ -2500,8 +2471,8 @@ func (h *MenuHandlers) LoadSwapFromList(ctx context.Context, sym string, input [ | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	userStore := h.userdataStore | 	userStore := h.userdataStore | ||||||
| 
 |  | ||||||
| 	flag_incorrect_pool, _ := h.flagManager.GetFlag("flag_incorrect_pool") | 	flag_incorrect_pool, _ := h.flagManager.GetFlag("flag_incorrect_pool") | ||||||
|  | 	flag_api_error, _ := h.flagManager.GetFlag("flag_api_error") | ||||||
| 
 | 
 | ||||||
| 	inputStr := string(input) | 	inputStr := string(input) | ||||||
| 	if inputStr == "0" { | 	if inputStr == "0" { | ||||||
| @ -2545,31 +2516,11 @@ func (h *MenuHandlers) LoadSwapFromList(ctx context.Context, sym string, input [ | |||||||
| 	res.FlagReset = append(res.FlagReset, flag_incorrect_pool) | 	res.FlagReset = append(res.FlagReset, flag_incorrect_pool) | ||||||
| 
 | 
 | ||||||
| 	// call the api using the pool symbol to get a list of SwapfromSymbolsData
 | 	// call the api using the pool symbol to get a list of SwapfromSymbolsData
 | ||||||
| 	swapFromList := []dataserviceapi.TokenHoldings{ | 	swapFromList, err := h.accountService.GetPoolSwappableFromVouchers(ctx, activePoolAddress) | ||||||
| 		{ | 	if err != nil { | ||||||
| 			ContractAddress: "0xc7B78Ac9ACB9E025C8234621FC515bC58179dEAe", | 		res.FlagSet = append(res.FlagSet, flag_api_error) | ||||||
| 			TokenSymbol:     "AMANI", | 		logg.ErrorCtxf(ctx, "failed on FetchTransactions", "error", err) | ||||||
| 			TokenDecimals:   "6", | 		return res, err | ||||||
| 			Balance:         "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			ContractAddress: "0xF0C3C7581b8b96B59a97daEc8Bd48247cE078674", |  | ||||||
| 			TokenSymbol:     "AMUA", |  | ||||||
| 			TokenDecimals:   "6", |  | ||||||
| 			Balance:         "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			ContractAddress: "0x371455a30fc62736145Bd8429Fcc6481186f235F", |  | ||||||
| 			TokenSymbol:     "BAHARI", |  | ||||||
| 			TokenDecimals:   "6", |  | ||||||
| 			Balance:         "", |  | ||||||
| 		}, |  | ||||||
| 		{ |  | ||||||
| 			ContractAddress: "0x7cA6113b59c24a880F382C7E12d609a6Eb05246b", |  | ||||||
| 			TokenSymbol:     "BANGLA", |  | ||||||
| 			TokenDecimals:   "6", |  | ||||||
| 			Balance:         "", |  | ||||||
| 		}, |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Return if there are no vouchers
 | 	// Return if there are no vouchers
 | ||||||
| @ -2607,9 +2558,15 @@ func (h *MenuHandlers) LoadSwapToList(ctx context.Context, sym string, input []b | |||||||
| 		return res, fmt.Errorf("missing session") | 		return res, fmt.Errorf("missing session") | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// get the public key
 | 	userStore := h.userdataStore | ||||||
|  | 	publicKey, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_PUBLIC_KEY) | ||||||
|  | 	if err != nil { | ||||||
|  | 		logg.ErrorCtxf(ctx, "failed to read publicKey entry with", "key", storedb.DATA_PUBLIC_KEY, "error", err) | ||||||
|  | 		return res, err | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	flag_incorrect_voucher, _ := h.flagManager.GetFlag("flag_incorrect_voucher") | 	flag_incorrect_voucher, _ := h.flagManager.GetFlag("flag_incorrect_voucher") | ||||||
|  | 	flag_api_error, _ := h.flagManager.GetFlag("flag_api_error") | ||||||
| 
 | 
 | ||||||
| 	inputStr := string(input) | 	inputStr := string(input) | ||||||
| 	if inputStr == "0" { | 	if inputStr == "0" { | ||||||
| @ -2627,7 +2584,7 @@ func (h *MenuHandlers) LoadSwapToList(ctx context.Context, sym string, input []b | |||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Store the active swap from data
 | 	// Store the active swap from data
 | ||||||
| 	if err := store.UpdateSwapFromVoucherData(ctx, h.userdataStore, sessionId, metadata); err != nil { | 	if err := store.UpdateSwapFromVoucherData(ctx, userStore, sessionId, metadata); err != nil { | ||||||
| 		logg.ErrorCtxf(ctx, "failed on UpdateSwapFromVoucherData", "error", err) | 		logg.ErrorCtxf(ctx, "failed on UpdateSwapFromVoucherData", "error", err) | ||||||
| 		return res, err | 		return res, err | ||||||
| 	} | 	} | ||||||
| @ -2635,13 +2592,11 @@ func (h *MenuHandlers) LoadSwapToList(ctx context.Context, sym string, input []b | |||||||
| 	res.FlagReset = append(res.FlagReset, flag_incorrect_voucher) | 	res.FlagReset = append(res.FlagReset, flag_incorrect_voucher) | ||||||
| 
 | 
 | ||||||
| 	// call the api using the public key to get a list of SwapToSymbolsData
 | 	// call the api using the public key to get a list of SwapToSymbolsData
 | ||||||
| 	swapToList := []dataserviceapi.TokenHoldings{ | 	swapToList, err := h.accountService.GetPoolSwappableVouchers(ctx, string(publicKey)) | ||||||
| 		{ | 	if err != nil { | ||||||
| 			ContractAddress: "0x765DE816845861e75A25fCA122bb6898B8B1282a", | 		res.FlagSet = append(res.FlagSet, flag_api_error) | ||||||
| 			TokenSymbol:     "cUSD", | 		logg.ErrorCtxf(ctx, "failed on FetchTransactions", "error", err) | ||||||
| 			TokenDecimals:   "18", | 		return res, err | ||||||
| 			Balance:         "", |  | ||||||
| 		}, |  | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	// Return if there are no vouchers
 | 	// Return if there are no vouchers
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user