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

Function insert_order_execute_sqlx

crates/database/src/orders.rs:176–208  ·  view source on GitHub ↗
(
    query_str: &str,
    ex: &mut PgConnection,
    order: &Order,
)

Source from the content-addressed store, hash-verified

174}
175
176async fn insert_order_execute_sqlx(
177 query_str: &str,
178 ex: &mut PgConnection,
179 order: &Order,
180) -> Result<bool, sqlx::Error> {
181 sqlx::query(query_str)
182 .bind(order.uid)
183 .bind(order.owner)
184 .bind(order.creation_timestamp)
185 .bind(order.sell_token)
186 .bind(order.buy_token)
187 .bind(order.receiver)
188 .bind(&order.sell_amount)
189 .bind(&order.buy_amount)
190 .bind(order.valid_to)
191 .bind(order.app_data)
192 .bind(&order.fee_amount)
193 .bind(order.kind)
194 .bind(order.partially_fillable)
195 .bind(order.signature.as_slice())
196 .bind(order.signing_scheme)
197 .bind(order.settlement_contract)
198 .bind(order.sell_token_balance)
199 .bind(order.buy_token_balance)
200 .bind(order.cancellation_timestamp)
201 // true_valid_to takes the same value as valid_to when inserting an order
202 .bind(order.valid_to)
203 .bind(order.valid_from)
204 .bind(order.fast_path)
205 .execute(ex)
206 .await
207 .map(|result| result.rows_affected() > 0)
208}
209
210#[instrument(skip_all)]
211pub async fn insert_order(ex: &mut PgConnection, order: &Order) -> Result<(), sqlx::Error> {

Callers 2

insert_orderFunction · 0.85

Calls 4

as_sliceMethod · 0.80
queryFunction · 0.50
executeMethod · 0.45
bindMethod · 0.45

Tested by

no test coverage detected