Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

feat(module.api): add lp rewardpct #869

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ivan-zynesis
Copy link
Contributor

What kind of PR is this?:

/kind feature

What this PR does / why we need it:

Include reward split % for DUSD pairs

Which issue(s) does this PR fixes?:

Fixes BirthdayResearch/jellyfishsdk#1482

Additional comments?:

@codeclimate
Copy link

codeclimate bot commented Mar 21, 2022

Code Climate has analyzed commit f53154c and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Duplication 2

View more on Code Climate.

@codecov
Copy link

codecov bot commented Mar 21, 2022

Codecov Report

Merging #869 (f53154c) into main (e45f91f) will increase coverage by 0.27%.
The diff coverage is 90.32%.

@@            Coverage Diff             @@
##             main     #869      +/-   ##
==========================================
+ Coverage   92.46%   92.74%   +0.27%     
==========================================
  Files         127      127              
  Lines        3678     3737      +59     
  Branches      461      476      +15     
==========================================
+ Hits         3401     3466      +65     
+ Misses        267      263       -4     
+ Partials       10        8       -2     
Impacted Files Coverage Δ
src/module.api/poolpair.service.ts 89.04% <81.81%> (+3.56%) ⬆️
src/module.api/cache/defid.cache.ts 93.87% <92.85%> (-0.41%) ⬇️
src/module.api/cache/global.cache.ts 100.00% <100.00%> (ø)
src/module.api/poolpair.controller.ts 97.61% <100.00%> (+0.11%) ⬆️
packages/whale-api-client/src/api/poolpairs.ts 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e45f91f...f53154c. Read the comment docs.

@canonbrother canonbrother changed the title add test cases feat(module.api): add lp rewardpct Mar 21, 2022
@ivan-zynesis
Copy link
Contributor Author

@fuxingloh this is merge ready and should be quite minimal impact to any downstream

Comment on lines +63 to 64
} catch (err: any) {
if (err?.payload?.message !== 'Pool not found') {
Copy link

Choose a reason for hiding this comment

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

Suggested change
} catch (err: any) {
if (err?.payload?.message !== 'Pool not found') {
} catch (err) {
if (err instanceof RpcApiError && err?.payload?.message !== 'Pool not found') {

We can potentially use instanceof here to avoid casting errors to any

Copy link

Choose a reason for hiding this comment

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

Note that this requires RpcApiError to be imported so will need manual commits I think 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quite reluctant to make changes here, since it is a generic issue and all over the codebase. I think we should open an issue to clean it up if we have to.

Copy link

@kodemon kodemon Mar 31, 2022

Choose a reason for hiding this comment

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

I am wondering if we want to set the typescript rules to disable the useUnknownInCatchVariables until we formally address this so we don't have to cast back to any for our try/catch.

But that could also be part of a separate PR.

Copy link
Contributor Author

@ivan-zynesis ivan-zynesis Mar 31, 2022

Choose a reason for hiding this comment

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

Omg, I didn't actually look deep into this. JS 😅
Agreed, we should have the rule to have consistent linter for every dev.

image

@fuxingloh
Copy link
Contributor

We don't need to manually calculate it anymore since listpoolpairs exposes it via rewardLoanPct and we can just expose that now.

@fuxingloh
Copy link
Contributor

We don't need to manually calculate it anymore since listpoolpairs exposes it via rewardLoanPct and we can just expose that now.

I guess this means we can also simplify the code and remove the manual calculation all together and just get the data from listPoolPair directly.

@fuxingloh fuxingloh marked this pull request as draft May 23, 2022 09:44
@fuxingloh fuxingloh marked this pull request as ready for review May 30, 2022 08:37
@fuxingloh
Copy link
Contributor

We're finishing up BirthdayResearch/jellyfishsdk#580

This PR needs to be migrated to https://github.com/JellyfishSDK/jellyfish/tree/main/apps/whale-api

Since you're busy currently, I will re-assign this to someone else.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Populate rewardPct for stock LPs
5 participants