-
Notifications
You must be signed in to change notification settings - Fork 316
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
auction: define and record events (#4353)
## Describe your changes This PR adds three messages to the `v1alpha1` auction interface: - `EventDutchAuctionScheduled` - `EventDutchAuctionUpdated` - `EventDutchAuctionEnded` ## Issue ticket number and link Fixes #4303. ## Checklist before requesting a review - [x] If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: > this only makes additive changes, recording events in the auction component.
- Loading branch information
Showing
9 changed files
with
662 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
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
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
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,5 +1,61 @@ | ||
use tendermint::abci::{Event, EventAttributeIndexExt}; | ||
use crate::auction::dutch::{DutchAuctionDescription, DutchAuctionState}; | ||
use crate::auction::AuctionId; | ||
use penumbra_proto::penumbra::core::component::auction::v1alpha1 as pb; | ||
|
||
pub fn stub_event(delegate: &Delegate) -> Event { | ||
Event::new("stub_event", []) | ||
/// Event for a Dutch auction that has been scheduled. | ||
pub fn dutch_auction_schedule_event( | ||
id: AuctionId, | ||
description: DutchAuctionDescription, | ||
) -> pb::EventDutchAuctionScheduled { | ||
pb::EventDutchAuctionScheduled { | ||
auction_id: Some(id.into()), | ||
description: Some(description.into()), | ||
} | ||
} | ||
|
||
/// Event for an execution round of a Dutch auction. | ||
pub fn dutch_auction_updated( | ||
id: AuctionId, | ||
state: DutchAuctionState, | ||
) -> pb::EventDutchAuctionUpdated { | ||
pb::EventDutchAuctionUpdated { | ||
auction_id: Some(id.into()), | ||
state: Some(state.into()), | ||
} | ||
} | ||
|
||
/// Event for a Dutch auction that is ending because it has been closed by its owner. | ||
pub fn dutch_auction_closed_by_user( | ||
id: AuctionId, | ||
state: DutchAuctionState, | ||
) -> pb::EventDutchAuctionEnded { | ||
pb::EventDutchAuctionEnded { | ||
auction_id: Some(id.into()), | ||
state: Some(state.into()), | ||
reason: pb::event_dutch_auction_ended::Reason::ClosedByOwner as i32, | ||
} | ||
} | ||
|
||
/// Event for a Dutch auction that is ending because it has expired. | ||
pub fn dutch_auction_expired( | ||
id: AuctionId, | ||
state: DutchAuctionState, | ||
) -> pb::EventDutchAuctionEnded { | ||
pb::EventDutchAuctionEnded { | ||
auction_id: Some(id.into()), | ||
state: Some(state.into()), | ||
reason: pb::event_dutch_auction_ended::Reason::Expired as i32, | ||
} | ||
} | ||
|
||
/// Event for a Dutch auction that is ending because it has been completely filled. | ||
pub fn dutch_auction_exhausted( | ||
id: AuctionId, | ||
state: DutchAuctionState, | ||
) -> pb::EventDutchAuctionEnded { | ||
pb::EventDutchAuctionEnded { | ||
auction_id: Some(id.into()), | ||
state: Some(state.into()), | ||
reason: pb::event_dutch_auction_ended::Reason::Filled as i32, | ||
} | ||
} |
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
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
Oops, something went wrong.