Submitted by 0xRajeev, also found by gpersoon and paulius.eth
The balancedBooks modifier is used to check that funds havent gone missing during this function call and is applied to deposit, withdrawDeposit, payRent, payout and sponsor Treasury functions which move funds in and out of the Treasury or adjust its market/user balances.
However, this modifier is missing in the refundUser() and topupMarketBalance() functions which also perform similar actions. The impact is that any miscalculations in these functions will lead to the system becoming insolvent.
Recommend adding modifier to the two functions above where it is missing.
Splidge (Reality Cards) confirmed and resolved in a duplicate issue:
Note: Additional conversation regarding this vulnerability can be found here
