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

Function insert_invalidation

crates/database/src/events.rs:93–110  ·  view source on GitHub ↗
(
    ex: &mut PgConnection,
    index: &EventIndex,
    event: &Invalidation,
)

Source from the content-addressed store, hash-verified

91
92#[instrument(skip_all)]
93async fn insert_invalidation(
94 ex: &mut PgConnection,
95 index: &EventIndex,
96 event: &Invalidation,
97) -> Result<(), sqlx::Error> {
98 // We use ON CONFLICT so that multiple updates running at the same do not error
99 // because of events already existing. This can happen when multiple
100 // orderbook apis run in HPA. See #444 .
101 const QUERY: &str = "INSERT INTO invalidations (block_number, log_index, order_uid) VALUES \
102 ($1, $2, $3) ON CONFLICT DO NOTHING;";
103 sqlx::query(QUERY)
104 .bind(index.block_number)
105 .bind(index.log_index)
106 .bind(event.order_uid)
107 .execute(ex)
108 .await?;
109 Ok(())
110}
111
112#[instrument(skip_all)]
113pub async fn insert_trade(

Callers 1

appendFunction · 0.85

Calls 2

queryFunction · 0.85
executeMethod · 0.45

Tested by

no test coverage detected