Decimal Precision

The Decimal Challenge

Aureo interacts with two different standards:

  1. USDC (Input): 6 Decimals (e.g., 1.000000 is $1).

  2. 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.

GoldAmount=USDC×1012×1018Price18dec\text{GoldAmount} = \frac{\text{USDC} \times 10^{12} \times 10^{18}}{\text{Price}_{18dec}}

Code Implementation:

AureoRWAPool.sol
uint256 usdcValue18 = _usdcAmount * 1e12; // Scale 6 -> 18
uint256 goldAmount = (usdcValue18 * 1e18) / currentPrice;