swap-swear-and-swindle
swap-swear-and-swindle copied to clipboard
decreaseHardDeposit
If there is a cash-out in between the prepareDecreaseHardDeposit and decreaseHardDeposit, the line
hardDeposit.amount = hardDeposit.amount.sub(hardDeposit.decreaseAmount);
in decreaseHardDeposit might throw and decreasing the hardDeposit can be effectively blocked temporarily.
Proposed solution: if decreaseAmount is more than amount, set the hardDeposits to 0.
As an extra benefit: this makes the require(decreaseAmount <= hardDeposit.amount) in prepareDecreaseHardDeposit redundant.
@ralph-pichler