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

[SERVICES-1902] fix token derived EGLD price #1216

Merged
merged 5 commits into from
Nov 7, 2023

Conversation

claudiulataretu
Copy link
Collaborator

@claudiulataretu claudiulataretu commented Nov 2, 2023

Reasoning

  • for a specific token there are two ways: paired directly with EGLD or paired with another token
  • tokens that are paired with EGLD and with other tokens which don't have a pair with other token can't get the derived EGLD price

Proposed Changes

  • for a specific token it will filter out those pairs that the paired token doesn’t have a pair with other tokens

How to test

query Tokens {
	tokens {
		identifier
		decimals
		price
                derivedEGLD
		type
	}
}
  • query should return price for all tokens

- remove from token pairs those pairs for which paired tokens do not have
  direct connection to EGLD

Signed-off-by: Claudiu Lataretu <[email protected]>
- add two new tokens to the mock data: TOK5 and TOK6
- add two new pairs to the mock data: WEGLD/TOK5 and TOK6/TOK5

Signed-off-by: Claudiu Lataretu <[email protected]>
Copy link

codecov bot commented Nov 2, 2023

Codecov Report

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

Comparison is base (42cedea) 56.14% compared to head (e01d7b4) 56.21%.

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #1216      +/-   ##
===============================================
+ Coverage        56.14%   56.21%   +0.06%     
===============================================
  Files              235      235              
  Lines             7826     7838      +12     
  Branches           519      519              
===============================================
+ Hits              4394     4406      +12     
+ Misses            2990     2989       -1     
- Partials           442      443       +1     
Flag Coverage Δ
unittests 56.21% <92.30%> (+0.06%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
src/modules/pair/mocks/pair.constants.ts 70.27% <100.00%> (+8.20%) ⬆️
...c/modules/tokens/services/token.compute.service.ts 81.25% <80.00%> (+9.58%) ⬆️

... and 2 files with indirect coverage changes

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

@claudiulataretu claudiulataretu merged commit 262e394 into development Nov 7, 2023
3 checks passed
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.

3 participants