package helpers import ( "ripple/state" ) func CleanupOut(payment state.Payment) uint64 { return payment.Amount - payment.SealPenalty(payment.Amount) + payment.FeeOut } func FinalizeOut(payment state.Payment) uint64 { penaltyTicker := payment.PenaltyTicker() return payment.Amount - payment.SealPenalty(penaltyTicker) + payment.FeeOut * penaltyTicker/payment.Amount } func CancelOut(payment state.Payment) uint64 { penaltyTicker := payment.PenaltyTicker() total := payment.Amount+payment.FeeOut if penaltyTicker >= payment.Amount { return total } else { return total * penaltyTicker / payment.Amount } }