Skip to content

Commit

Permalink
hex bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Aug 23, 2024
1 parent 15cf06d commit a30472f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/fees/compute_fees.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_all_data(self, tx_hash: HexBytes) -> SettlementData:
for address, price in winning_sol["clearingPrices"].items()
}
native_prices = {
address: int(endpoint_data["auction"]["prices"][address.hex()])
address: int(endpoint_data["auction"]["prices"][address.to_0x_hex()])
for address, _ in clearing_prices.items()
}
trades = []
Expand Down Expand Up @@ -364,16 +364,18 @@ def get_auction_data(self, tx_hash: HexBytes):
for environment, url in self.orderbook_urls.items():
try:
response = requests.get(
url + f"solver_competition/by_tx_hash/{tx_hash.hex()}",
url + f"solver_competition/by_tx_hash/{tx_hash.to_0x_hex()}",
timeout=REQUEST_TIMEOUT,
)
response.raise_for_status()
if not response.ok:
continue
auction_data = response.json()
return auction_data, environment
except requests.exceptions.HTTPError as err:
if err.response.status_code == 404:
pass
raise ConnectionError(f"Error fetching off-chain data for tx {tx_hash.hex()}")
raise ConnectionError(f"Error fetching off-chain data for tx {tx_hash.to_0x_hex()}")

def get_order_data(self, uid: HexBytes, environment: str):
prefix = self.orderbook_urls[environment]
Expand All @@ -390,7 +392,7 @@ def get_order_data(self, uid: HexBytes, environment: str):

def get_trade_data(self, uid: HexBytes, tx_hash: HexBytes, environment: str):
prefix = self.orderbook_urls[environment]
url = prefix + f"trades?orderUid={uid.hex()}"
url = prefix + f"trades?orderUid={uid.to_0x_hex()}"
response = requests.get(url)
trade_data_temp = response.json()
for t in trade_data_temp:
Expand Down

0 comments on commit a30472f

Please sign in to comment.