Extended precision wrapper for x/bank enabling 18 decimal support
x/precisebank
module from cosmos/evm extends the standard x/bank
module from 6 to 18 decimal precision for EVM compatibility.
x/bank
, providing:
Object | Key | Value | Description |
---|---|---|---|
FractionalBalance | 0x01 + address | math.Int | Account fractional balance (0 to 10^12-1) |
Remainder | 0x02 | math.Int | Uncirculated fractional amount |
uatom_balance
: Stored in x/bank (6 decimals)fractional_balance
: Stored in x/precisebank (0 to 10^12-1)aatom_balance
: Full 18-decimal precisionEvent | Attributes | Description |
---|---|---|
transfer | sender , recipient , amount | Full aatom amount |
coin_spent | spender , amount | Extended precision |
coin_received | receiver , amount | Extended precision |
Event | Attributes | Description |
---|---|---|
coinbase | minter , amount | Minted with 18 decimals |
burn | burner , amount | Burned with 18 decimals |
Invariant | Formula | Description |
---|---|---|
Supply | Total_aatom = Total_uatom × 10^12 - remainder | Total supply consistency |
Fractional Range | 0 ≤ f(n) < 10^12 | Valid fractional bounds |
Reserve Backing | Reserve × 10^12 = Σf(n) + r | Full backing guarantee |
Conservation | Δ(Total_aatom) = Δ(Total_uatom × 10^12) | No creation/destruction |
Issue | Cause | Solution |
---|---|---|
”fractional overflow” | Fractional > 10^12 | Check calculation logic |
”insufficient balance” | Including fractional | Verify full aatom balance |
”invariant violation” | Supply mismatch | Audit reserve and remainder |