Their seems to be a delay write key and transferring asset which means the deposit function could be manipulated what if someone deposits then immediately withdraws the money from the invoke account the dApp will still write a record with the amount specified?
ScriptResult(WriteSet(), TransferSet())
is a total inseparable result of transaction. All transactions are processed strictly one after another. So such problem will never happen.