voucher-data #138
			No reviewers
			
		
		
		
	
	
	
		Labels
		
	
	
	
	
		No Label
		
			
	
	
	Compat/Breaking
		
			Kind/Bug
		
			Kind/Documentation
		
			Kind/Enhancement
		
			Kind/Feature
		
			Kind/Security
		
			Kind/Testing
		
			Priority
Critical
		
			Priority
High
		
			Priority
Low
		
			Priority
Medium
		
			Reviewed
Confirmed
		
			Reviewed
Duplicate
		
			Reviewed
Invalid
		
			Reviewed
Won't Fix
		
			Status
Abandoned
		
			Status
Blocked
		
			Status
Need More Info
		
		
			Activity
Doing
		
			Activity
Hold
		
			Activity
Proposal
		
			Activity
QA
		
			Activity
Validate
		
			Runner
AT
		
			Runner
CLI
		
			Runner
HTTP
		
			Runner
SSH
		
			cleanup
		
			devops
		
			documentation
		
			easypeasy
		
			exchange
		
			i18n
		
			legacy
		
			meta
		
			migration
		
			optimization
		
			privilege
		
			refactor
		
			smell
		
			support
		
			tooling
		
			ux
		
	
		No Milestone
		
			
		
	
	
		
		
		
			No project
			
				
			
		
	
	
	
	
	
		No Assignees
		
			
		
	
	
	
		2 Participants
		
	
	
		
		
			Notifications
			
				
			
		
	
	
		
		
	
	
	Due Date
	No due date set.
			
				Dependencies
				
				
		
	
	
	No dependencies set.
			Reference: urdt/ussd#138
			
		
	
		Loading…
	
		Reference in New Issue
	
	Block a user
	
	No description provided.
		
		Delete Branch "voucher-data"
	
	Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
WIP: voucher-datato voucher-datavoucher-datato WIP: voucher-dataWIP: voucher-datato voucher-data@ -59,2 +59,4 @@}// VoucherMetadata helps organize voucher data fieldstype VoucherMetadata struct {Should we use ussd-data-service/pkg/api/api.go TokenHoldings instead?
This is actually a struct for the strings that are returned as formatted values, to be stored in the subPrefixDb
For example
data := VoucherMetadata{
Symbols: "1:SRF\n2:MILO",
Balances: "1:100\n2:200",
Decimals: "1:6\n2:4",
Addresses: "1:0xd4c288865Ce\n2:0x41c188d63Qa",
}
@ -1126,2 +1140,3 @@func ProcessVouchers(holdings []struct {// processVouchers converts holdings into formatted stringsfunc processVouchers(holdings []struct {ContractAddress string `json:"contractAddress"`this is now the same struct as
VoucherMetadatacan we consolidate please?@ -1222,2 +1217,2 @@symbols := strings.Split(voucherSymbols, "\n")balances := strings.Split(voucherBalances, "\n")// getVoucherData retrieves and matches voucher datafunc getVoucherData(ctx context.Context, db storage.PrefixDb, input string) (*VoucherMetadata, error) {This file is getting long. SHould we extract the voucher related methods to a separate file?
voucher-datato WIP: voucher-dataWIP: voucher-datato voucher-data@ -0,0 +77,4 @@for i, sym := range symList {parts := strings.SplitN(sym, ":", 2)if len(parts) != 2 {When will this condition occur?
It will only occur if the string is not well formatted in the "1:SRF" format, such as it being "1SRF" or "1 SRF"
Ideally, this will not be encountered but I added this as an edge case in the unlikely event that it does
but shouldnt that raise an error, as it should never happen?
On further assessment, I see it best to remove the code as the condition would never occur.
The data being matched comes from the db, and for this condition to occur means an issue lies with the functions that process and store the data
@ -0,0 +154,4 @@}// Clear temporary voucher data entriestempEntries := map[DataTyp][]byte{Do we need to clear them here? Can't we just overwrite later?
They can be left and overwritten with any new temporary data
I wanted to work on this functionality on a different PR, where we'll make use of a single temporary data row
ok just drop the lines then?