Topics Decimal Precision
The Challenge
LegacyVault interacts with two different precision standards:
USDC (Asset): 6 Decimals (e.g.,
1.000000)Rust Math (Logic): strict
U256integers
Normalization Strategy
When funds enter the Lending Pool, we maintain the raw U256 value but treat the interest calculation as a Ratio.
Code Implementation:
// Order of operations is critical for precision
current_value = (current_value * hundred_one) / hundred;