fn orders(
    settlement_block: i64,
    connection: &mut PgConnection,
) -> BoxStream<'_, Result<OrderRow, sqlx::Error>> {
    let query = "
SELECT
    t.uid, t.sum_fee as earned_fee,
    o.sell_token, o.fee_amount as signed_fee, o.full_fee_amount as unsubsidized_fee,
    f.gas_amount, f.gas_price, f.sell_token_price
FROM (
    SELECT order_uid as uid, SUM(fee_amount) as sum_fee
    FROM trades t
    WHERE block_number = $1
    GROUP BY uid
) AS t
LEFT OUTER JOIN orders o ON o.uid = t.uid
LEFT OUTER JOIN order_fee_parameters f ON f.order_uid = t.uid
;";
    sqlx::query_as(query)
        .bind(settlement_block)
        .fetch(connection)
}
// For simplicity nod handling multiple settlements in same block properly.
For simplicity nod handling multiple settlements in same block properly.
For simplicity nod handling multiple settlements in same block properly .
fn orders(
    settlement_block: i64,
    connection: &mut PgConnection,
) -> BoxStream<'_, Result<OrderRow, sqlx::Error>> {
    let query = "
SELECT
    t.uid, t.sum_fee as earned_fee,
    o.sell_token, o.fee_amount as signed_fee, o.full_fee_amount as unsubsidized_fee,
    f.gas_amount, f.gas_price, f.sell_token_price
FROM (
    SELECT order_uid as uid, SUM(fee_amount) as sum_fee
    FROM trades t
    WHERE block_number = $1
    GROUP BY uid
) AS t
LEFT OUTER JOIN orders o ON o.uid = t.uid
LEFT OUTER JOIN order_fee_parameters f ON f.order_uid = t.uid
;";
    sqlx::query_as(query)
        .bind(settlement_block)
        .fetch(connection)
}
fn orders ( settlement_block : i64 , connection : & mut PgConnection , ) -> BoxStream < ' _ , Result < OrderRow , sqlx :: Error > > { let query = " " ; sqlx :: query_as ( query ) . bind ( settlement_block ) . fetch ( connection ) }
For simplicity nod handling multiple settlements in same block properly.
For simplicity nod handling multiple settlements in same block properly .
settlement_block
i64
connection
&mut PgConnection
settlement_block
i64
connection
&mut PgConnection