Use ints in calculations #9

Closed
opened 2024-08-29 16:34:48 +02:00 by lash · 3 comments
Owner

for example https://git.grassecon.net/urdt/ussd/src/branch/wip-account-creation/internal/handlers/ussd/menuhandler.go#L611

do not use float to calculate amounts. please make into int and use given number of decimals as unit.

for example https://git.grassecon.net/urdt/ussd/src/branch/wip-account-creation/internal/handlers/ussd/menuhandler.go#L611 do not use float to calculate amounts. please make into int and use given number of decimals as unit.
lash added the
Kind/Enhancement
Kind/Security
Priority
Medium
labels 2024-08-29 16:35:07 +02:00

For transfer values, the API will expect the number in string represented (big)int. And because it is possible for the USSD wallet to hold any token, you will need to know the decimals beforehand. API access for this can be provided. However, for now, the decimals getter can be hardcoded to 6 until when such data is available.

For transfer values, the API will expect the number in string represented (big)int. And because it is possible for the USSD wallet to hold any token, you will need to know the decimals beforehand. API access for this can be provided. However, for now, the decimals getter can be hardcoded to **6** until when such data is available.
Author
Owner

hardcoded to 6

let's conceal this behind a dedicated function though.

> hardcoded to 6 let's conceal this behind a dedicated function though.
Author
Owner

not helpful issue.

not helpful issue.
lash closed this issue 2024-10-28 16:44:15 +01:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: urdt/ussd#9
No description provided.