Move generation of repayment event to scripts