Decimal Precision
The Decimal Challenge
Aureo interacts with two different standards:
USDC (Input): 6 Decimals (e.g.,
1.000000is $1).mGOLD (Output): 18 Decimals (Standard ERC20).
Direct multiplication would cause massive calculation errors. We handle this using Scale Factors.
Minting Formula (Buy)
When a user buys Gold with USDC, we scale up the input to match the 18-decimal precision of the Gold token.
Code Implementation:
uint256 usdcValue18 = _usdcAmount * 1e12; // Scale 6 -> 18
uint256 goldAmount = (usdcValue18 * 1e18) / currentPrice;