Skip to content

Commit

Permalink
rename marketplace action and more specific action names
Browse files Browse the repository at this point in the history
  • Loading branch information
jhernandezb committed Dec 12, 2024
1 parent d26f1df commit 994cb93
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions contracts/stargaze-marketplace-v2/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ pub fn execute_set_ask(
&config,
&matching_bid,
false,
"set-ask",
"set-ask-match",
response,
)?;
} else if sell_now {
Expand Down Expand Up @@ -522,21 +522,27 @@ pub fn execute_set_bid(

let mut response = Response::new();

// bid could have a match with an existing ask without the need of buy_now
if let Some(ask) = matching_ask {
// If a matching ask is found perform the sale
funds = funds
.sub(ask.details.price.clone())
.map_err(|_| ContractError::InsufficientFunds)?;

let config: Config<Addr> = CONFIG.load(deps.storage)?;

let mut action = "set-bid-match";
if buy_now {
action = "buy-now";
}
response = finalize_sale(
deps,
&env,
&ask,
&config,
&MatchingBid::Bid(bid),
true,
"set-bid",
action,
response,
)?;
} else if buy_now {
Expand Down
2 changes: 1 addition & 1 deletion contracts/stargaze-marketplace-v2/src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ pub fn finalize_sale(
.add_attribute("seller_recipient", seller_recipient.to_string())
.add_attribute("nft_recipient", nft_recipient.to_string())
.add_attribute("ask", ask.id.to_string())
.add_attribute("action", action.to_string());
.add_attribute("marketplace_action", action.to_string());

match &matching_bid {
MatchingBid::Bid(bid) => {
Expand Down

0 comments on commit 994cb93

Please sign in to comment.