dojo.common.utils

Generic utility functions such as datetime and search functions.

def round_to_nearest_n(x: float, n: int) -> int:

Round a number to the nearest multiple of n.

Parameters
  • x: number to round
  • n: multiple
Returns

rounded number

def div_round_up(numerator: int, denominator: int) -> int:

Divide two integers and round up.

Parameters
  • numerator: numerator
  • denominator: denominator
Returns

rounded up quotient

def integerdiv(a: int, b: int, roundup: bool) -> int:

Integerdiv with roundup as in UniswapV3Pool.