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

[MEX-407] compute boosted rewards #1215

Merged

Conversation

claudiulataretu
Copy link
Collaborator

Reasoning

  • add support for boosted rewards into staking module

Proposed Changes

  • added new fields into staking model for boosted rewards information
  • added compute method for user's boosted rewards from staking contract
  • added outdated energy compute for staking contract

How to test

query StakingRewards {
	getStakingRewardsForPosition(
		computeBoosted: true,
		stakingPositions: {
			farmsPositions: [
				{
					farmAddress: <staking_address>,
					user: <user_address>,
					liquidity: ,
					attributes: ,
					identifier: 
				}
			]
		}
	) {
		rewards
		accumulatedRewards
		claimProgress {
			week
			energy {
				amount
				lastUpdateEpoch
				totalLockedTokens
			}
		}
		boostedRewardsWeeklyInfo {
			scAddress
			userAddress
			week
			positionAmount
			apr
			energyForWeek {
				amount
				lastUpdateEpoch
				totalLockedTokens
			}
			rewardsDistributionForWeek {
				tokenId
				percentage
			}
			rewardsForWeek {
				tokenID
				amount
			}
		}
	}
}
  • query should return base staking rewards and boosted staking rewards
query UserOutdatedContracts {
	userOutdatedContracts {
		address
		type
		claimProgressOutdated
	}
}
  • query result should contain staking address if the energy is outdated

- add methods to compute boosted rewards
- add new fileds for staking rewards model

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

codecov bot commented Nov 1, 2023

Codecov Report

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

Comparison is base (ea7769a) 55.92% compared to head (1e60988) 55.71%.
Report is 25 commits behind head on feat/boosted-metastaking.

Additional details and impacted files
@@                     Coverage Diff                      @@
##           feat/boosted-metastaking    #1215      +/-   ##
============================================================
- Coverage                     55.92%   55.71%   -0.22%     
============================================================
  Files                           235      237       +2     
  Lines                          7861     8169     +308     
  Branches                        524      561      +37     
============================================================
+ Hits                           4396     4551     +155     
- Misses                         3018     3137     +119     
- Partials                        447      481      +34     
Flag Coverage Δ
unittests 55.71% <38.05%> (-0.22%) ⬇️

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

Files Coverage Δ
src/modules/farm/mocks/farm.constants.ts 100.00% <ø> (ø)
src/modules/farm/v2/services/farm.v2.service.ts 43.10% <ø> (ø)
src/modules/staking/models/staking.model.ts 100.00% <100.00%> (ø)
src/modules/user/models/user.model.ts 70.53% <100.00%> (+0.26%) ⬆️
...vices/context/mocks/context.getter.service.mock.ts 100.00% <100.00%> (ø)
...es/multiversx-communication/mx.api.service.mock.ts 83.33% <100.00%> (+1.51%) ⬆️
src/modules/farm/mocks/farm.v2.abi.service.mock.ts 56.25% <83.33%> (+27.67%) ⬆️
src/modules/proxy/mocks/proxy.abi.service.mock.ts 78.57% <66.66%> (+7.14%) ⬆️
...ervices/multiversx-communication/mx.api.service.ts 25.26% <50.00%> (ø)
...odules/farm/v2/services/farm.v2.compute.service.ts 45.45% <40.00%> (+17.84%) ⬆️
... and 7 more

... and 6 files with indirect coverage changes

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

@claudiulataretu claudiulataretu merged commit e664986 into feat/boosted-metastaking Nov 3, 2023
1 of 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