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

feat/add chain values converters #202

Merged
merged 3 commits into from
Jan 17, 2024
Merged

Conversation

aarmoa
Copy link
Collaborator

@aarmoa aarmoa commented Jan 15, 2024

  • Added new functions in all Market classes to convert values from extended chain format (the ones provided by chain streams) into human-readable format
  • Updated proto definitions for Indexer node using version v1.12.79.1
  • Updated market and tokens INI configuration files

…ded chain format into human readable format. Updated Indexer proto definitions pointing to 1.12.79.1
Copy link

codecov bot commented Jan 15, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (d10fa53) 29.46% compared to head (a6f2d0c) 29.71%.
Report is 4 commits behind head on master.

Files Patch % Lines
client/common/util.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #202      +/-   ##
==========================================
+ Coverage   29.46%   29.71%   +0.25%     
==========================================
  Files          17       17              
  Lines        2552     2564      +12     
==========================================
+ Hits          752      762      +10     
- Misses       1764     1766       +2     
  Partials       36       36              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

}

func (spotMarket SpotMarket) fromExtendedChainformat(chainValue decimal.Decimal) decimal.Decimal {
return chainValue.Div(decimal.New(1, AdditionalChainFormatDecimals))
Copy link
Contributor

Choose a reason for hiding this comment

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

Better to do this in utils file, this one doesn't depend on spotMarket or derivativeMarket

fromExtendedChainformat(chainValue decimal.Decimal) decimal.Decimal

But why chainValue has decimal.Decimal type?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, will move it (unfortunately moving it to utils makes it less OOP, something that I don't really like)

Regarding the chainValue, it was not originally decimal.Decimal. But the function that calls this one first translates the value according to market tokens decimals, making it a decimal.Decimal

Copy link
Contributor

Choose a reason for hiding this comment

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

unfortunately moving it to utils makes it less OOP, something that I don't really like

Yeah it's a tool and we need flexibility to choose which to use

Regarding the chainValue, it was not originally decimal.Decimal. But the function that calls this one first translates the value according to market tokens decimals, making it a decimal.Decimal

Oh I thought using sdk.Dec is enough when chain streamed the value

Copy link
Contributor

@vinhphuctadang vinhphuctadang left a comment

Choose a reason for hiding this comment

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

please fix lint issue

@aarmoa aarmoa merged commit 02cb6ed into master Jan 17, 2024
4 checks passed
@aarmoa aarmoa deleted the feat/add_chain_values_converters branch January 17, 2024 13:40
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