dojo.network

Network manages everything related to blockchain forking and connection.

This includes the retrieval of contract objects from the blockchain network. And anything related to brownie

class ForkedBackend(dojo.network.base_backend.BaseBackend):

The ForkedBackend class handles comms with a forked network.

ForkedBackend(chain: dojo.common.Chain, port: Optional[int] = None)

Initialize the class.

Parameters
  • port: Port to use for the forked chain. If None, a free port will be found.
def connect(self, block_range: tuple[int, int], backend: str = 'anvil') -> None:

Instantiate and connect to the dojo network.

Parameters
  • block_range: simulation block range.
  • backend: Type of backend to use. Can be one of 'hardhat' or 'anvil'.
Raises
  • ValueError: if requested backend is not supported.
class LocalBackend(dojo.network.base_backend.BaseBackend):

The LocalBackend class handles comms with a local network.

LocalBackend(*, chain: dojo.common.Chain, port: Optional[int] = None)

Initialize the class.

Parameters
  • port: Port to use for the forked chain. If None, a free port will be found.
def connect(self, block_range: tuple[int, int], backend: str = 'anvil') -> None:

Instantiate and connect to the dojo network.

Parameters
  • block_range: simulation block range.
  • backend: Type of backend to use. Can be one of 'hardhat'.
Raises
  • ValueError: if requested backend is not supported.