Documentation
¶
Overview ¶
Package finance provides shared financial types and utilities for USDC operations. It is a leaf package with no internal dependencies, designed to break the coupling between wallet (key management) and packages that only need monetary parsing/formatting.
Index ¶
Constants ¶
const CurrencyUSDC = "USDC"
CurrencyUSDC is the ticker symbol for the USDC stablecoin.
const DefaultQuoteExpiry = 5 * time.Minute
DefaultQuoteExpiry is the default validity window for a price quote.
const USDCDecimals = 6
USDCDecimals is the number of decimal places for USDC (6).
Variables ¶
This section is empty.
Functions ¶
func FloatToMicroUSDC ¶
FloatToMicroUSDC converts a float64 dollar amount to the smallest USDC unit (6 decimals). Uses shopspring/decimal for exact conversion — no floating-point rounding hacks needed.
func FormatUSDC ¶
FormatUSDC converts smallest USDC units back to a decimal string. Trailing zeros are trimmed but at least 2 decimal places are kept. e.g., 1500000 -> "1.50", 0 -> "0.00", 50 -> "0.00005"
Types ¶
This section is empty.