MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / validateDistributions

Function validateDistributions

model/transaction.go:225–231  ·  view source on GitHub ↗

validateDistributions checks that total distributions don't exceed limits

(state *distributionState)

Source from the content-addressed store, hash-verified

223
224// validateDistributions checks that total distributions don't exceed limits
225func validateDistributions(state *distributionState) error {
226 hundredDec := decimal.NewFromInt(100)
227 if state.totalPercentage.Cmp(hundredDec) > 0 || state.fixedTotalDec.Cmp(state.totalAmountDec) > 0 {
228 return errors.New("total distributions exceed 100% or total amount")
229 }
230 return nil
231}
232
233// adjustPercentageAmounts adjusts percentage amounts to maintain the correct total
234func adjustPercentageAmounts(state *distributionState) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected