hoprnet / hopr-stake

Smart contract for staking incentives with NFTs
GNU General Public License v3.0
11 stars 2 forks source link

Cannot unlock season 1 funds when claimed rewards before #42

Closed tolbrino closed 2 years ago

tolbrino commented 2 years ago

When a user has claimed rewards before, the unlock produces an error and doesn't complete. The UI doesn't show any indication of an error occuring.

nionis commented 2 years ago

Currently, we have disabled claim and sync to minimize the issue.

tolbrino commented 2 years ago

Ref https://github.com/hoprnet/hopr-devrel/pull/158

QYuQianchen commented 2 years ago

On the SC level, when calling unlock, it first _sync (L. 1223) the account stake/reward and then _claim (L.1227) the reward, before transferring back the staked xHOPR token and HoprBoost NFTs.

_claim forbids accounts with 0 increment in rewards (L.1319) to be further executed. This creates issue when a staker manually calls claim() after PROGRAM_END (1642424400). If a staker did call claimRewards() after PROGRAM_END and before calling unlock(), it's not possible to release their stake, or NFT.

Luckily, NFTs can be recovered through reclaimErc721Tokens().

SCBuergel commented 2 years ago

A PR for this issue is pending. Next steps are

  1. [ ] Review from at least @robertkiel & @tolbrino
  2. [ ] Identify user with small amount of locked tokens for testing purposes --> Initiated via TG
  3. [ ] deploy contract, carry out MS transactions as outlined in the Checklist in HoprWhithat.sol --> TODO @QYuQianchen to support that process with the signers
  4. [ ] Test the process with two users bilaterally --> TODO Sebastian or Andrius
  5. [ ] Identify further tasks for unlocking everyone, even without going through the whitehat process once >= 90% of the funds are recovered --> TODO @QYuQianchen
tolbrino commented 2 years ago

Since the rewards were drained nobody can run into the situation anymore. Further steps are handled in #46 . Thus I am closing this issue.