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

[Bug]: claimRewards() is always sending 0 DIP rewards and resets user's rewardsBalance when called before unstake() #2

Open
1 task done
rapidddenis opened this issue Apr 1, 2023 · 2 comments
Assignees

Comments

@rapidddenis
Copy link

What happened?

Steps to reproduce:

  1. Create fresh risk bundle and stake some USDT.
    https://mumbai.polygonscan.com/tx/0xe0535fb6ec7782dceb8a488675425b40a97901a5bbd7eeed23eb5f4c5b2f48c0
  2. Stake some DIP into this bundle.
    https://mumbai.polygonscan.com/tx/0x036d950af16481c409ba7a3b168df5a3623d66ee072df4b9c7e9fd89dac721af
  3. Wait while some DIP rewards are accumulated.
  4. Claim rewards
    Expected behaviour: DIP transferred >= "Accumulated Rewards" value in staking UI
    Actual behaviour: DIP transferred = 0, "Accumulated Rewards" resets to 0.
    First claim:

Screenshot 2023-04-01 at 9 53 58

https://mumbai.polygonscan.com/tx/0x3626d3b0f1c9aeba6f724259a9fbd9a8d69cfc9d91f869957f9164e86e765af3

Second claim:
Screenshot 2023-04-01 at 10 05 36

https://mumbai.polygonscan.com/tx/0xff684a1b10c60e4e3ec3a9335598314b4e50cd186cc47973fb46b92e29f88402

  1. Close risk bundle
    https://mumbai.polygonscan.com/tx/0x2160d9fc129a9f40f0b9ab94bd33e02c889873a440d8227c6cbdb2b4172f5d05

  2. Unstake DIP without claiming rewards.
    https://mumbai.polygonscan.com/tx/0xd6633cce0acf2c401ea9fd14db999750dd307de9453c7575c69e313481ae4be6

  3. Claim rewards. This time DIP transferred > 0 but value is smaller than first and second claims combined.
    https://mumbai.polygonscan.com/tx/0x0763820d43e80609555ea51643a5e1b5a80b7f5c235d8f1485e652a55651da67

What operating system are you seeing the problem on?

Mac OS

What browsers are you seeing the problem on?

Safari

What wallet extension are you using?

Metamask

Rules

  • I agree to follow this project's rules
@rapidddenis rapidddenis added the bug Something isn't working label Apr 1, 2023
@rapidddenis rapidddenis changed the title [Bug]: claimRewards() rewards is always sending 0 DIP rewards and resets user's rewardsBalance when called before unstake() [Bug]: claimRewards() is always sending 0 DIP rewards and resets user's rewardsBalance when called before unstake() Apr 1, 2023
@rapidddenis
Copy link
Author

Missing call to _updateRewards() during claimRewards(), thus info[].rewardBalance stays 0 and no DIP is transferred. While _decreaseRewards() updating info[].updatedAt to current block which resets rewards calculations

@matthiaszimmermann matthiaszimmermann self-assigned this Apr 3, 2023
@matthiaszimmermann matthiaszimmermann transferred this issue from etherisc/depeg-contracts Apr 3, 2023
@susanneetherisc
Copy link

This is more than low but less than medium so 5,000 DIP will be rewarded

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

No branches or pull requests

4 participants