Wad Ray Math


WadRayMath is a custom math library to support the rounding styles and scaling needs of the Ion core contracts.

Design Decisions

Rounding Up and Down

Most division operations in a lending protocol will not divide perfectly. As such, rounding must be performed. Ion core contracts will round the division in whichever direction is most favorable to the protocol in order to ensure protocol solvency.

Wrapping FullMath

All math operations use the OpenZeppelin FullMath library. This allows handling of phantom overflow operations.

Last updated