rubi.network package

Submodules

rubi.network.network module

class rubi.network.network.ContractRepr(path: str, w3: web3.Web3, name: str, address: str)

Bases: object

This class represents a contract on a specific network.

class rubi.network.network.Network(path: str, w3: web3.Web3, subgrounds: subgrounds.Subgrounds, name: str, chain_id: int, currency: str, rpc_url: str, explorer_url: str, market_data_url: str, market_data_fallback_url: str, rubicon: dict, token_addresses: dict, custom_token_addresses_file: str | None = None)

Bases: object

This class represents a network and can be used to instantiate contracts using the from_network method. It provides and easy way to configure a client or contracts.

classmethod from_config(http_node_url: str, custom_token_addresses_file: str | None = None) Network

Create a Network instance based on the node url provided. A call is then made to this node to get the chain_id which links to network_config/{network_name}/ using the NetworkId Enum.

Parameters:
  • http_node_url (str) – The URL of the HTTP node for the network.

  • custom_token_addresses_file (Optional[str]) – The name of a yaml file (relative to the current working directory) with custom token addresses. Overwrites the token config found in network_config/{chain}/network.yaml. (optional, default is None).

Returns:

A Network instance based on the network configuration.

Return type:

Network

Raises:

Exception – If no network configuration file is found for the specified network name.

class rubi.network.network.NetworkId(value)

Bases: Enum

An enumeration.

ARBITRUM_GOERLI = 421613
ARBITRUM_ONE = 42161
BASE = 8453
OPTIMISM = 10
OPTIMISM_GOERLI = 420
POLYGON_MUMBAI = 80001
class rubi.network.network.RubiconContracts(path: str, w3: web3.Web3, market: dict, router: dict)

Bases: object

This class is a simple wrapper for all the Rubicon contracts on a network. Right now it only contains the market and router contracts.