compare compares two *big.Int values based on the provided condition (e.g., >, <, ==). Returns true if the condition holds, otherwise false.
(value *big.Int, condition string, compareTo *big.Int)
| 50 | // compare compares two *big.Int values based on the provided condition (e.g., >, <, ==). |
| 51 | // Returns true if the condition holds, otherwise false. |
| 52 | func compare(value *big.Int, condition string, compareTo *big.Int) bool { |
| 53 | cmp := value.Cmp(compareTo) // Compare value and compareTo. |
| 54 | switch condition { |
| 55 | case ">": |
| 56 | return cmp > 0 |
| 57 | case "<": |
| 58 | return cmp < 0 |
| 59 | case ">=": |
| 60 | return cmp >= 0 |
| 61 | case "<=": |
| 62 | return cmp <= 0 |
| 63 | case "!=": |
| 64 | return cmp != 0 |
| 65 | case "==": |
| 66 | return cmp == 0 |
| 67 | } |
| 68 | return false |
| 69 | } |
| 70 | |
| 71 | // InitializeBalanceFields initializes all the fields of the Balance struct that might be nil. |
| 72 | // This ensures that all balance-related fields have valid *big.Int values for further operations. |
no outgoing calls