MathUtils
Git Source Author: @oscarsernarosero @mpetersoCode55 @cirsteveState Variables
WAD
Functions
uncheckedMultiply
This function expects the parameters to not have been multiplied by WAD, and the result will be a WAD number. This function provides an abstraction layer for division between liquidity-altbc and the underlying math library| Name | Type | Description |
|---|---|---|
x | uint256 | represents the first factor |
y | uint256 | represents the second factor |
| Name | Type | Description |
|---|---|---|
result | uint256 | of the division operation |
convertToWAD
This function converts a raw number to a WAD number| Name | Type | Description |
|---|---|---|
value | uint256 | The number to be converted |
| Name | Type | Description |
|---|---|---|
result | uint256 | resulting WAD number |
convertToRaw
This function converts a WAD number to a raw number| Name | Type | Description |
|---|---|---|
value | uint256 | The number to be converted |
| Name | Type | Description |
|---|---|---|
result | uint256 | resulting raw number |
findWADsToSlashTo0
this function tells how many WADs a number needs to be divided by to get to 0| Name | Type | Description |
|---|---|---|
x | uint256 | the number to be divided |
| Name | Type | Description |
|---|---|---|
precisionSlashingFactor | uint256 | the number of WADs needed to be divided to get to 0 |
convertToRaw512
this function requires a0 to be greater than 0 and less or equal than 2**254 Divides a 512 bit unsigned integer by WAD where the result can be a 512 bit unsigned integer.| Name | Type | Description |
|---|---|---|
a0 | uint256 | A uint256 representing the low bits of the numerator |
a1 | uint256 | A uint256 representing the high bits of the numerator |
| Name | Type | Description |
|---|---|---|
r0 | uint256 | The lower bits of the result |
r1 | uint256 | The highre bits of the result |