Skip to content

Commit

Permalink
multiple match ask with taker bid
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian committed Mar 21, 2024
1 parent 1ef02b5 commit b556b44
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/marketplace/marketplace.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ trait IMarketPlace<TState> {
maker_ask_signature: Array<felt252>,
custom_non_fungible_token_recipient: ContractAddress
);
fn multiple_match_ask_with_taker_bid(
ref self: TState,
taker_bids: Span::<TakerOrder>,
maker_askes: Span::<MakerOrder>,
maker_ask_signatures: Span::<Array<felt252>>,
custom_non_fungible_token_recipient: Span::<ContractAddress>
);
fn match_bid_with_taker_ask(
ref self: TState,
taker_ask: TakerOrder,
Expand Down Expand Up @@ -83,6 +90,7 @@ trait IAuctionStrategy<TState> {

#[starknet::contract]
mod MarketPlace {
use core::array::SpanTrait;
use flex::marketplace::marketplace::IMarketPlace;
use super::{
IExecutionStrategyDispatcher, IExecutionStrategyDispatcherTrait, IAuctionStrategyDispatcher,
Expand Down Expand Up @@ -451,6 +459,37 @@ mod MarketPlace {
self.reentrancyguard.end();
}

fn multiple_match_ask_with_taker_bid(
ref self: ContractState,
taker_bids: Span::<TakerOrder>,
maker_askes: Span::<MakerOrder>,
maker_ask_signatures: Span::<Array<felt252>>,
custom_non_fungible_token_recipient: Span::<ContractAddress>
) {
assert(taker_bids.len() == maker_askes.len(), 'Miss match param');
assert(maker_askes.len() == maker_ask_signatures.len(), 'Miss match param');
assert(
taker_bids.len() == custom_non_fungible_token_recipient.len(), 'Miss match param'
);

let maker_ask_length = maker_askes.len();
let mut index: u32 = 0;
loop {
if index == maker_ask_length {
break;
}
self
.match_ask_with_taker_bid(
*taker_bids.at(index),
*maker_askes.at(index),
(maker_ask_signatures.at(index)).clone(),
*custom_non_fungible_token_recipient.at(index),
);

index += 1;
}
}

fn match_bid_with_taker_ask(
ref self: ContractState,
taker_ask: TakerOrder,
Expand Down

0 comments on commit b556b44

Please sign in to comment.