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

Add asset decimals field #601

Merged
merged 12 commits into from
Dec 5, 2019

Conversation

justicz
Copy link
Contributor

@justicz justicz commented Dec 3, 2019

Prerequisite PR: #576

  • Added a new field Decimals to AssetParams. I made it a uint32 because I know we've had weird byte-alignment issues on certain builds, but if we don't need to worry about that we can make it a uint8.
  • Added checks to WellFormed to ensure this field is only nonzero after the protocol upgrade.
  • When displaying asset balances in goal, respect the Decimals field if it can fetch the asset params (it can't do that on offline machines, for example).
  • Note that when sending assets, goal still takes the base unit of the asset (you cannot pass -a 1.234 of an asset with Decimals = 3). This is because we will sometimes fail to get an asset's parameters, for example if the machine is generating txns offline, and it would be bad to have changing semantics for the amount argument.
  • Added Decimals to the API model of AssetParams

protocol/consensus.go Outdated Show resolved Hide resolved
cmd/goal/asset.go Show resolved Hide resolved
data/basics/userBalance.go Show resolved Hide resolved
Copy link
Contributor

@tsachiherman tsachiherman left a comment

Choose a reason for hiding this comment

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

thanks for the changes.

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.

None yet

5 participants