Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/database/src/solver_competition_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ pub struct Auction {
pub price_values: Vec<BigDecimal>,
pub block: i64,
pub id: i64,
pub deadline: i64,
}

#[derive(sqlx::FromRow)]
Expand Down Expand Up @@ -115,7 +116,7 @@ pub async fn load_by_id(
id: AuctionId,
) -> Result<Option<SolverCompetition>, sqlx::Error> {
const FETCH_AUCTION: &str = r#"
SELECT id, order_uids, price_tokens, price_values, block
SELECT id, order_uids, price_tokens, price_values, block, deadline
FROM competition_auctions
WHERE id = $1;
"#;
Expand Down Expand Up @@ -1228,6 +1229,7 @@ mod tests {
tx_hash
);
assert_eq!(solver_competition.auction.id, 1);
assert_eq!(solver_competition.auction.deadline, 2);
assert_eq!(solver_competition.trades.len(), 1);
assert_eq!(solver_competition.trades.first().unwrap().solution_uid, 0);
assert_eq!(solver_competition.reference_scores.len(), 1);
Expand Down
3 changes: 3 additions & 0 deletions crates/model/src/solver_competition_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use {
pub struct Response {
pub auction_id: AuctionId,
pub auction_start_block: i64,
pub auction_deadline_block: i64,
pub transaction_hashes: Vec<B256>,
#[serde_as(as = "BTreeMap<_, HexOrDecimalU256>")]
pub reference_scores: BTreeMap<Address, U256>,
Expand Down Expand Up @@ -73,6 +74,7 @@ mod tests {
let correct = serde_json::json!({
"auctionId": 0,
"auctionStartBlock": 13u64,
"auctionDeadlineBlock": 100,
"transactionHashes": ["0x3333333333333333333333333333333333333333333333333333333333333333"],
"referenceScores": {
"0x2222222222222222222222222222222222222222": "0",
Expand Down Expand Up @@ -118,6 +120,7 @@ mod tests {
let orig = Response {
auction_id: 0,
auction_start_block: 13,
auction_deadline_block: 100,
transaction_hashes: vec![tx],
reference_scores: btreemap! {
solver => U256::ZERO
Expand Down
3 changes: 3 additions & 0 deletions crates/orderbook/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,9 @@ components:
auctionStartBlock:
type: integer
description: Block that the auction started on.
auctionDeadlineBlock:
type: integer
description: Block deadline by which the auction must be settled.
transactionHashes:
type: array
description: |
Expand Down
1 change: 1 addition & 0 deletions crates/orderbook/src/database/solver_competition_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ fn try_into_dto(value: DbResponse) -> Result<ApiResponse, LoadSolverCompetitionE
Ok(ApiResponse {
auction_id: value.auction.id,
auction_start_block: value.auction.block,
auction_deadline_block: value.auction.deadline,
transaction_hashes: settlements.values().cloned().collect(),
reference_scores,
auction: Auction {
Expand Down
Loading