diff --git a/src/models/order_rewards_schema.py b/src/models/order_rewards_schema.py index a2c3c026..c3271b29 100644 --- a/src/models/order_rewards_schema.py +++ b/src/models/order_rewards_schema.py @@ -33,7 +33,7 @@ def from_pdf_to_dune_records(cls, rewards_df: DataFrame) -> list[dict[str, Any]] ), "quote_sell_amount": str(row["quote_sell_amount"]), "quote_buy_amount": str(row["quote_buy_amount"]), - "quote_gas_cost": str(int(row["quote_gas_cost"])), + "quote_gas_cost": float(row["quote_gas_cost"]), "quote_sell_token_price": float(row["quote_sell_token_price"]), }, } diff --git a/src/sql/orderbook/order_rewards.sql b/src/sql/orderbook/order_rewards.sql index 15220ad5..967e85a4 100644 --- a/src/sql/orderbook/order_rewards.sql +++ b/src/sql/orderbook/order_rewards.sql @@ -159,7 +159,7 @@ select coalesce(protocol_fee_native_price, 0.0) as protocol_fee_native_price, cast(oq.sell_amount as numeric(78, 0)) :: text as quote_sell_amount, cast(oq.buy_amount as numeric(78, 0)) :: text as quote_buy_amount, - cast(oq.gas_amount * oq.gas_price as numeric(78, 0)) :: text as quote_gas_cost, + oq.gas_amount * oq.gas_price as quote_gas_cost, oq.sell_token_price as quote_sell_token_price from trade_hashes diff --git a/tests/unit/test_order_rewards_schema.py b/tests/unit/test_order_rewards_schema.py index 978b3431..667351be 100644 --- a/tests/unit/test_order_rewards_schema.py +++ b/tests/unit/test_order_rewards_schema.py @@ -22,7 +22,7 @@ def test_order_rewards_transformation(self): "quote_sell_amount": [10000000000000000, 2000000000000000, 35000], "quote_buy_amount": [1000, 2000, 10], "quote_gas_cost": [ - 5000000000000000, + 5000000000000000.15, 6000000000000000, 12000000000000000, ], @@ -46,7 +46,7 @@ def test_order_rewards_transformation(self): "protocol_fee_native_price": 1.0, "quote_sell_amount": "10000000000000000", "quote_buy_amount": "1000", - "quote_gas_cost": "5000000000000000", + "quote_gas_cost": 5000000000000000.15, "quote_sell_token_price": 1.0, }, }, @@ -64,7 +64,7 @@ def test_order_rewards_transformation(self): "protocol_fee_native_price": 0.1, "quote_sell_amount": "2000000000000000", "quote_buy_amount": "2000", - "quote_gas_cost": "6000000000000000", + "quote_gas_cost": 6000000000000000, "quote_sell_token_price": 250000000, }, }, @@ -82,7 +82,7 @@ def test_order_rewards_transformation(self): "protocol_fee_native_price": 0.0, "quote_sell_amount": "35000", "quote_buy_amount": "10", - "quote_gas_cost": "12000000000000000", + "quote_gas_cost": 12000000000000000, "quote_sell_token_price": 100000000000000.0, }, },