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