-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
solana: deprecate auction history #207
Merged
a5-pickle
merged 3 commits into
wormhole-foundation:main
from
wormholelabs-xyz:me/deprecate-history
Feb 4, 2025
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
use anchor_lang::prelude::*; | ||
|
||
use crate::state::Auction; | ||
|
||
#[event] | ||
#[derive(Debug)] | ||
pub struct AuctionClosed { | ||
pub auction: Auction, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
mod auction_closed; | ||
pub use auction_closed::*; | ||
|
||
mod auction_settled; | ||
pub use auction_settled::*; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
solana/programs/matching-engine/src/processor/auction/close.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
use std::ops::Deref; | ||
|
||
use crate::{ | ||
error::MatchingEngineError, | ||
state::{Auction, AuctionStatus}, | ||
}; | ||
use anchor_lang::prelude::*; | ||
|
||
#[derive(Accounts)] | ||
#[event_cpi] | ||
pub struct CloseAuction<'info> { | ||
#[account( | ||
mut, | ||
close = beneficiary, | ||
constraint = { | ||
require!( | ||
matches!(auction.status, AuctionStatus::Settled {..}), | ||
MatchingEngineError::AuctionNotSettled, | ||
); | ||
|
||
let expiration = | ||
i64::from(auction.vaa_timestamp).saturating_add(crate::VAA_AUCTION_EXPIRATION_TIME); | ||
require!( | ||
Clock::get().unwrap().unix_timestamp >= expiration, | ||
MatchingEngineError::CannotCloseAuctionYet, | ||
); | ||
|
||
true | ||
} | ||
)] | ||
auction: Account<'info, Auction>, | ||
|
||
/// CHECK: This account is whoever originally created the auction account (see | ||
/// [Auction::prepared_by]. | ||
#[account( | ||
mut, | ||
address = auction.prepared_by, | ||
)] | ||
beneficiary: UncheckedAccount<'info>, | ||
} | ||
|
||
pub fn close_auction(ctx: Context<CloseAuction>) -> Result<()> { | ||
emit_cpi!(crate::events::AuctionClosed { | ||
auction: ctx.accounts.auction.deref().clone(), | ||
}); | ||
|
||
Ok(()) | ||
} |
156 changes: 0 additions & 156 deletions
156
solana/programs/matching-engine/src/processor/auction/history/add_entry.rs
This file was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
solana/programs/matching-engine/src/processor/auction/history/create_first.rs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to wait 2 hours before we're able to close the auction account? Isn't the fact that it has been
Settled
sufficient?It would be nice if we were able to close auctions in the same transaction where we settle them. In order to do that with the current implementation, we would need to wait for almost two hours which we cannot afford to do as we want to get our funds back as soon as possible to optimize their utilization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This window exists so an auction cannot start using the same VAA within that arbitrarily long window. This duration can be tightened up in the future with a matching engine upgrade, though.
Reference:
example-liquidity-layer/solana/programs/matching-engine/src/processor/auction/offer/place_initial/cctp.rs
Lines 63 to 70 in fe2dcd1