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

Function ApplyPrecision

model/model.go:235–240  ·  view source on GitHub ↗

ApplyPrecision handles both operations involving precision: 1. If PreciseAmount exists: converts it to a decimal Amount 2. If Amount exists: converts it to a PreciseAmount This function is now a wrapper that sets default precision if needed and calls applyPrecisionLogic.

(transaction *Transaction)

Source from the content-addressed store, hash-verified

233// 2. If Amount exists: converts it to a PreciseAmount
234// This function is now a wrapper that sets default precision if needed and calls applyPrecisionLogic.
235func ApplyPrecision(transaction *Transaction) *big.Int {
236 if transaction.Precision == 0 {
237 transaction.Precision = 1
238 }
239 return applyPrecisionLogic(transaction)
240}
241
242// applyPrecisionLogic contains the core logic for converting amounts based on precision.
243// It assumes transaction.Precision has been set appropriately before this call.

Calls 1

applyPrecisionLogicFunction · 0.85