add(decimalValueA, decimalValueB)
takes 2 decimal values as an argument and returns their sum.decimalValueA: {value: int256, decimals: int256}
; the first decimal valuedecimalValueB: {value: int256, decimals: int256}
; the second decimal value{value: int256,decimals: int256}
; the resulting decimal valueresult
would be equal to {value: 62, decimals: 1}
which represents 6.2
compare(decimalValueA, decimalValueB)
takes 2 decimal values as an argument and returns 1
if decimalValueA
is strictly greater than decimalValueB
0
if decimalValueA
is equal to decimalValueB
-1
if decimalValueA
is strictly less than decimalValueB
decimalValueA: {value: int256, decimals: int256}
; the first decimal valuedecimalValueB: {value: int256, decimals: int256}
; the second decimal valueinteger
; the resulting decimal value that can be either 1
, 0
or -1
result
would be equal to 1
, since 5
is greater than 1.2
.