Function: unstake()
User fully withdraws all their stakes if called before the end of the collection cycle. All issue indexes that are connected to the caller are fetched from memory, and then each issue is fetched from storage. All stores that have the isStaking
flag set are summed up, and the flag is set to false
.
The summed-up amount is transferred to the caller and also removed from the global pendingLiquidation
counter.
Branches and code coverage
Intended branches
User can stake and unstake.
Unstaking multiple times has no effect.
Negative behavior
American users cannot unstake.
Stakes older than
indexStar
cannot be unstaked.