MCPcopy Create free account
hub / github.com/cowprotocol/services / insert_refund_tx_hash

Function insert_refund_tx_hash

crates/database/src/ethflow_orders.rs:110–127  ·  view source on GitHub ↗
(
    ex: &mut PgTransaction<'_>,
    refund: &Refund,
)

Source from the content-addressed store, hash-verified

108
109#[instrument(skip_all)]
110pub async fn insert_refund_tx_hash(
111 ex: &mut PgTransaction<'_>,
112 refund: &Refund,
113) -> Result<(), sqlx::Error> {
114 const QUERY: &str = r#"
115 INSERT INTO ethflow_refunds (order_uid, block_number, tx_hash) VALUES($1, $2, $3)
116 ON CONFLICT (order_uid) DO UPDATE SET block_number = $2, tx_hash = $3
117 "#;
118
119 ex.execute(
120 sqlx::query(QUERY)
121 .bind(refund.order_uid)
122 .bind(i64::try_from(refund.block_number).unwrap_or(i64::MAX))
123 .bind(refund.tx_hash),
124 )
125 .await?;
126 Ok(())
127}
128
129#[instrument(skip_all)]
130pub async fn refundable_orders(

Calls 2

queryFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected