Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Monetary Amount Support #187

Open
dselman opened this issue May 25, 2018 · 3 comments
Open

Monetary Amount Support #187

dselman opened this issue May 25, 2018 · 3 comments
Labels
Difficulty: Challenging Help Wanted 🆘 Extra attention is needed Type: Feature Request 🛍️ New feature or request Type: Question ❓ Further information is requested

Comments

@dselman
Copy link
Contributor

dselman commented May 25, 2018

Define how monetary amounts/currencies should be modeled in CML and executed in Ergo. Do we need arbitrary precision math or fixed-point math for example? How many bits?

Existing CTO Model
https://github.com/accordproject/models/blob/master/money.cto

JS Libraries
https://scurker.github.io/currency.js/
https://github.com/MikeMcl/bignumber.js/

Java Libraries
JavaMoney_Specification_1.0-final.pdf
http://javadox.com/javax.money/money-api/1.0/javax/money/MonetaryAmount.html
https://github.com/JavaMoney/jsr354-api/blob/master/src/main/java/javax/money/MonetaryAmount.java

Solidity
ethereum/EIPs#724
https://rangeshsripathi.com/2017/12/13/4-dealing-with-fractions-in-solidity-smart-contract/

@dselman dselman added Type: Feature Request 🛍️ New feature or request Help Wanted 🆘 Extra attention is needed Type: Question ❓ Further information is requested labels May 25, 2018
@dselman dselman changed the title Currency Support Monetary Amount Support May 25, 2018
@jeromesimeon
Copy link
Member

Adding Corda's financial model to the list: https://docs.corda.net/financial-model.html

@jeromesimeon
Copy link
Member

@jeromesimeon
Copy link
Member

Another useful bit of info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

So, assuming we want to keep a precision on monetary amounts based on cents, in theory we could stick to doubles between -(2^51 - 1) and (2^51 - 1) -- those are already quite large numbers!

@jeromesimeon jeromesimeon added the Hacktoberfest by DigitalOcean and DEV label Sep 17, 2019
@mttrbrts mttrbrts removed the Hacktoberfest by DigitalOcean and DEV label Nov 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Difficulty: Challenging Help Wanted 🆘 Extra attention is needed Type: Feature Request 🛍️ New feature or request Type: Question ❓ Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants