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

Issue #249 divisibility arbitrary percision #251

Closed
wants to merge 7 commits into from

Conversation

elpiel
Copy link
Member

@elpiel elpiel commented Feb 13, 2020

Resolves #249

@elpiel elpiel linked an issue Feb 13, 2020 that may be closed by this pull request
3 tasks
}
}

impl From<BigNum> for PrecisionU64 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use From with default of 0 or should we impl TryFrom and fail if this conversion cannot be done?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TryFrom would be better as 0 may be magic :( I think error should be handled properly

/// DAI has precision of 18 decimals
/// For CPM we have 3 decimals precision, but that's for 1000 (3 decimals more)
/// This in terms means we need 18 - (3 + 3) = 12 decimals precision
pub const GLOBAL_MULTIPLIER: Multiplier = Multiplier(12);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this not 10**12 rather than 12? it would save you from having to do a pow operation

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! I will impl it.

@elpiel
Copy link
Member Author

elpiel commented Mar 22, 2021

Closing this in favor of the v5 Unified Precision of (8) #384

@elpiel elpiel closed this Mar 22, 2021
@elpiel elpiel deleted the issue-249-divisibility-arbitrary-percision branch June 20, 2022 12:11
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.

payment spec: divisibility / arbitrary precision
3 participants