dojo.common package

Common contains types for users to use in their own code.

class dojo.common.Chain(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: StrEnum

Tracked chains.

This is not meant to track any other chain nomenclatures like: chain id, networks, testnets, etc. It’s only meant to be a high-level indicator of specific chain logic.

ARBITRUM = 'arbitrum'
ETHEREUM = 'ethereum'

Submodules

Various type definitions used throughout the dojo package.

Generic utility functions such as datetime and search functions.

dojo.common.utils.div_round_up(numerator: int, denominator: int) int

Divide two integers and round up.

Parameters:
  • numerator – numerator

  • denominator – denominator

Returns:

rounded up quotient

dojo.common.utils.integerdiv(a: int, b: int, roundup: bool) int

Integerdiv with roundup as in UniswapV3Pool.

dojo.common.utils.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