Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

♻️ Change Currency to class #3888

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

greymistcube
Copy link
Contributor

@greymistcube greymistcube commented Jul 19, 2024

  • Currency structure is too complicated to be used as a struct.
  • Moreover, the size of Currency as a struct stands at 72 bytes, which is too large.
  • The default for Currency is an invalid value where it can break things down the line.

Also I've cleaned up most constructors to have consistent validation logic for creating a new Currency by funneling them to a single private constructor. However, there still is a loophole where an invalid currency can be created through JSON deserialization. This is due to the JSON format of Currency having a yet another scheme that is different from the one for IValue or for Hash. 🙄

@greymistcube greymistcube changed the title Refactor/currency to class ♻️ Change Currency to class Jul 19, 2024
@greymistcube greymistcube self-assigned this Jul 19, 2024
@greymistcube greymistcube marked this pull request as ready for review July 19, 2024 15:03
@greymistcube greymistcube force-pushed the refactor/currency-to-class branch from ca8dc5d to 14f9a9d Compare August 12, 2024 05:40
@greymistcube greymistcube requested a review from s2quake August 12, 2024 05:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants