Skip to content

Commit

Permalink
Marketplace v2 rename offers to bid, add collection and token id attr…
Browse files Browse the repository at this point in the history
… to remove and update events
  • Loading branch information
tasiov committed Jul 13, 2024
1 parent 83270a1 commit a760b30
Show file tree
Hide file tree
Showing 14 changed files with 673 additions and 660 deletions.
2 changes: 1 addition & 1 deletion contracts/stargaze-marketplace-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The Stargaze NFT auction happens as a perpetual auction. Asks and bids have time limits set by governance.

Anyone can call the `SetBid` method and make an offer on any listed NFT. The funds are sent to the marketplace contract which serves as an escrow.
Anyone can call the `SetBid` method and make an bid on any listed NFT. The funds are sent to the marketplace contract which serves as an escrow.

Bidders can remove their bids and reclaim their funds with `RemoveBid`. When a bid is removed, its deposit is refunded. New bids automatically remove and refund previous bids.

Expand Down
22 changes: 11 additions & 11 deletions contracts/stargaze-marketplace-v2/src/events.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::{
orders::{Ask, CollectionOffer, Offer},
orders::{Ask, CollectionBid, Bid},
state::{AllowDenoms, Config},
};

Expand Down Expand Up @@ -71,27 +71,27 @@ impl<'a> From<AskEvent<'a>> for Event {
}
}

pub struct OfferEvent<'a> {
pub struct BidEvent<'a> {
pub ty: &'a str,
pub offer: &'a Offer,
pub bid: &'a Bid,
pub attr_keys: Vec<&'a str>,
}

impl<'a> From<OfferEvent<'a>> for Event {
fn from(oe: OfferEvent) -> Self {
Event::new(oe.ty.to_string()).add_attributes(oe.offer.get_event_attrs(oe.attr_keys))
impl<'a> From<BidEvent<'a>> for Event {
fn from(oe: BidEvent) -> Self {
Event::new(oe.ty.to_string()).add_attributes(oe.bid.get_event_attrs(oe.attr_keys))
}
}

pub struct CollectionOfferEvent<'a> {
pub struct CollectionBidEvent<'a> {
pub ty: &'a str,
pub collection_offer: &'a CollectionOffer,
pub collection_bid: &'a CollectionBid,
pub attr_keys: Vec<&'a str>,
}

impl<'a> From<CollectionOfferEvent<'a>> for Event {
fn from(coe: CollectionOfferEvent) -> Self {
impl<'a> From<CollectionBidEvent<'a>> for Event {
fn from(coe: CollectionBidEvent) -> Self {
Event::new(coe.ty.to_string())
.add_attributes(coe.collection_offer.get_event_attrs(coe.attr_keys))
.add_attributes(coe.collection_bid.get_event_attrs(coe.attr_keys))
}
}
Loading

0 comments on commit a760b30

Please sign in to comment.