Skip to content

Commit

Permalink
fix bug in sql query
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Apr 2, 2024
1 parent e52493e commit 604f9e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/sql/orderbook/barn_order_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ select
concat('0x', encode(trade_hashes.order_uid, 'hex')) as order_uid,
concat('0x', encode(trade_hashes.solver, 'hex')) as solver,
quote_solver,
concat('0x', encode(tx_hash, 'hex')) as tx_hash,
concat('0x', encode(trade_hashes.tx_hash, 'hex')) as tx_hash,
coalesce(surplus_fee, 0) :: text as surplus_fee,
coalesce(reward, 0.0) as amount,
coalesce(cast(protocol_fee as numeric(78, 0)), 0) :: text as protocol_fee,
CASE
WHEN protocol_fee_token is not NULL THEN concat('0x', encode(protocol_fee_token, 'hex'))
END as protocol_fee_token,
coalesce(protocol_fee_token_price, 0.0) as protocol_fee_native_price,
coalesce(protocol_fee_token_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,
oq.gas_amount * oq.gas_price as quote_gas_cost,
Expand Down
4 changes: 2 additions & 2 deletions src/sql/orderbook/prod_order_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@ select
concat('0x', encode(trade_hashes.order_uid, 'hex')) as order_uid,
concat('0x', encode(trade_hashes.solver, 'hex')) as solver,
quote_solver,
concat('0x', encode(tx_hash, 'hex')) as tx_hash,
concat('0x', encode(trade_hashes.tx_hash, 'hex')) as tx_hash,
coalesce(surplus_fee, 0) :: text as surplus_fee,
coalesce(reward, 0.0) as amount,
coalesce(cast(protocol_fee as numeric(78, 0)), 0) :: text as protocol_fee,
CASE
WHEN protocol_fee_token is not NULL THEN concat('0x', encode(protocol_fee_token, 'hex'))
END as protocol_fee_token,
coalesce(protocol_fee_token_price, 0.0) as protocol_fee_native_price,
coalesce(protocol_fee_token_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,
oq.gas_amount * oq.gas_price as quote_gas_cost,
Expand Down

0 comments on commit 604f9e9

Please sign in to comment.