You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Turns out FA1.2 tokens (and FA2 onwards) do have decimal places even though the specification doesn't require a definition for it. They will follow exactly the same pattern as Tez. They will only be represented by 1 natural number, with a piece of metadata indicating how many decimal places exist. The tokens will have variable decimal places however.
It would be great to have a Tez subclass, or alias that has a configurable decimal place. It should follow all the same logic (e.g. passing in a string will be the rpc representation, passing in a double would be the higher order representation).
Other requirements:
Being able to multiply Tez and NativeToken if they are separate objects) by a double or Decimal. Giving the ability to be able to display the local currency value of the token without having to cast to other objects.
Being able to add Tez and NativeToken together (if they are separate objects). To have the ability to multiply all of the Tez and Tokens by their local currency amount, and then add all of them together to get a wallet/account total. Again without having to cast to intermediate objects. Leading rounding/truncation issues.
The text was updated successfully, but these errors were encountered:
Thinking about all this again. Given how tightly integrated the Decimal object is, being able to use currency formatters and all inbuilt iOS functions. It might make more sense to scrap Tez and simply add extensions to Decimal such as
Tez is limited to Int64, so there isn't any advantage to using BigInt there. The only question comes for FA Tokens which are arbitrary length natural numbers. Although I think Decimal may be sufficiently large, for any reasonable usecases
Turns out FA1.2 tokens (and FA2 onwards) do have decimal places even though the specification doesn't require a definition for it. They will follow exactly the same pattern as Tez. They will only be represented by 1 natural number, with a piece of metadata indicating how many decimal places exist. The tokens will have variable decimal places however.
It would be great to have a Tez subclass, or alias that has a configurable decimal place. It should follow all the same logic (e.g. passing in a string will be the rpc representation, passing in a double would be the higher order representation).
Other requirements:
Being able to multiply Tez and NativeToken if they are separate objects) by a
double
orDecimal
. Giving the ability to be able to display the local currency value of the token without having to cast to other objects.Being able to add Tez and NativeToken together (if they are separate objects). To have the ability to multiply all of the Tez and Tokens by their local currency amount, and then add all of them together to get a wallet/account total. Again without having to cast to intermediate objects. Leading rounding/truncation issues.
The text was updated successfully, but these errors were encountered: