@@ -152,8 +152,7 @@ impl<T: Config> Pallet<T> {
152152 }
153153
154154 pub fn do_enlist_sell_offer ( authority : T :: AccountId , marketplace_id : [ u8 ; 32 ] , collection_id : T :: CollectionId , item_id : T :: ItemId , price : BalanceOf < T > , ) -> DispatchResult {
155- //TODO: ensure the user is a Marketparticipant
156-
155+ //This function is only called by the owner of the marketplace
157156 //ensure the marketplace exists
158157 ensure ! ( <Marketplaces <T >>:: contains_key( marketplace_id) , Error :: <T >:: MarketplaceNotFound ) ;
159158
@@ -428,10 +427,13 @@ impl<T: Config> Pallet<T> {
428427 pub fn do_remove_offer ( authority : T :: AccountId , offer_id : [ u8 ; 32 ] , marketplace_id : [ u8 ; 32 ] , collection_id : T :: CollectionId , item_id : T :: ItemId , ) -> DispatchResult {
429428 //ensure marketplace_id exits
430429 ensure ! ( <Marketplaces <T >>:: contains_key( marketplace_id) , Error :: <T >:: MarketplaceNotFound ) ;
431-
430+
432431 //ensure the offer_id exists
433432 ensure ! ( <OffersInfo <T >>:: contains_key( offer_id) , Error :: <T >:: OfferNotFound ) ;
434433
434+ //ensure the offer status is Open
435+ ensure ! ( Self :: is_offer_status( offer_id, OfferStatus :: Open ) , Error :: <T >:: CannotDeleteOffer ) ;
436+
435437
436438 // ensure the owner is the same as the authority
437439 let offer_creator = Self :: get_offer_creator ( offer_id) . map_err ( |_| Error :: < T > :: OfferNotFound ) ?;
@@ -440,9 +442,6 @@ impl<T: Config> Pallet<T> {
440442 //ensure the offer_id exists in OffersByItem
441443 Self :: does_exist_offer_id_for_this_item ( collection_id, item_id, offer_id) ?;
442444
443- //ensure the offer status is Open
444- ensure ! ( Self :: is_offer_status( offer_id, OfferStatus :: Open ) , Error :: <T >:: CannotDeleteOffer ) ;
445-
446445
447446 //remove the offer from OfferInfo
448447 <OffersInfo < T > >:: remove ( offer_id) ;
0 commit comments