voucher-data #138
Merged
lash
merged 18 commits from 2024-10-31 13:44:19 +01:00
voucher-data into master
Labels
Clear labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
cleanup
devops
documentation
easypeasy
exchange
i18n
legacy
meta
migration
optimization
privilege
refactor
smell
support
tooling
ux
Breaking change that won't be backward compatible
Something is not working
Documentation changes
Improve existing functionality
New functionality
This is security issue
Issue or pull request related to testing
Priority
Critical
The priority is critical
Priority
High
The priority is high
Priority
Low
The priority is low
Priority
Medium
The priority is medium
Reviewed
Confirmed
Issue has been confirmed
Reviewed
Duplicate
This issue or pull request already exists
Reviewed
Invalid
Invalid issue
Reviewed
Won't Fix
This issue won't be fixed
Status
Abandoned
Somebody has started to work on this but abandoned work
Status
Blocked
Something is blocking this issue or pull request
Status
Need More Info
Feedback is required to reproduce issue or to continue work
Activity
Doing
An item actively being worked on currently
Activity
Hold
Not being actively worked on
Activity
Proposal
A proposal for a new feature or enhancement
Activity
QA
Ready for QA testing
Activity
Validate
Dev team validating changes
Runner
AT
Runner
CLI
Runner
HTTP
Runner
SSH
A task that can be completed with little effort
relating to swapping of assets and offramps
Languages and translations
Legacy features from the old ussd system to be ported
container for other issues
features that have to do with special, privileged axx
Code smell
transparency and help with exception states
No labels
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: urdt/ussd#138
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
@@ -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?
@@ -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?