diff --git a/src/fetch/prices.py b/src/fetch/prices.py index ddd03c6d..603ae2d7 100644 --- a/src/fetch/prices.py +++ b/src/fetch/prices.py @@ -84,4 +84,6 @@ def usd_price(token: TokenId, day: datetime) -> float: item = response_list[0] price_time = datetime.strptime(item["timestamp"], "%Y-%m-%dT00:00:00Z") assert price_time == day - return float(item["price"]) + result = float(item["price"]) + log.info(f"got price {result}") + return result diff --git a/tests/unit/test_split_transfer.py b/tests/unit/test_split_transfer.py index 52395b1a..5e1ce909 100644 --- a/tests/unit/test_split_transfer.py +++ b/tests/unit/test_split_transfer.py @@ -14,6 +14,10 @@ ONE_ETH = 10**18 +# TODO - these tests aren't entirely deterministic because they make requests to CoinPaprika API for COW and ETH prices. +# We should be able to mock the return values of price fetching: +# cf https://github.com/cowprotocol/solver-rewards/pull/179 + class TestSplitTransfers(unittest.TestCase): def setUp(self) -> None: @@ -241,7 +245,7 @@ def test_process_with_overdraft_exceeding_eth_not_cow(self): receiver=self.redirect_map[self.solver].reward_target, # This is the amount of COW deducted based on a "deterministic" price # on the date of the fixed accounting period. - amount_wei=cow_reward - 11549056229718590750720, + amount_wei=cow_reward - 11528681622554420445184, ) ], ) @@ -271,7 +275,7 @@ def test_process_with_overdraft_exceeding_both_eth_and_cow(self): period=self.period, account=self.solver, name=self.solver_name, - wei=1913412838234630144, + wei=1913259812982984448, ) }, )