Пример #1
0
 def start(self):
     self._load_gas_price_settings(
         self.config["relay"]["gas_price_computation"])
     self.contracts = load_packaged_contracts()
     if self.config["exchange"]["enable"]:
         self._load_orderbook()
     if self.config["push_notification"]["enable"]:
         self._start_push_service()
     self._make_w3()
     self._install_w3_middleware()
     self.node = Node(self._web3, fixed_gas_price=self.fixed_gas_price)
     self._log_listener = LogFilterListener(self._web3)
     if self.config["delegate"]["enable"]:
         self._start_delegate()
     self._load_addresses()
Пример #2
0
def do_importabi(conn, addresses, contracts=None):
    if contracts is None:
        compiled_contracts_dict = load_packaged_merged_abis()
        compiled_contracts_dict.update(load_packaged_contracts())
    else:
        compiled_contracts_dict = json.load(open(contracts))
    a2abi = logdecode.build_address_to_abi_dict(json.load(open(addresses)),
                                                compiled_contracts_dict)
    logger.info("importing %s abis", len(a2abi))
    with conn:
        with conn.cursor() as cur:
            for contract_address, abi in a2abi.items():
                cur.execute(
                    """INSERT INTO abis (contract_address, abi)
                       VALUES (%s, %s)
                       ON CONFLICT(contract_address) DO UPDATE SET abi = EXCLUDED.abi
                    """,
                    (contract_address, json.dumps(abi)),
                )
Пример #3
0
def contracts():
    return load_packaged_contracts()
Пример #4
0
 def __getitem__(self, *args):
     if not self.data:
         self.data = load_packaged_contracts()
     return super().__getitem__(*args)