@@ -4,8 +4,8 @@ use frame_support::{pallet_prelude::*};
44use frame_support:: sp_io:: hashing:: blake2_256;
55use sp_runtime:: sp_std:: vec:: Vec ;
66use crate :: types:: * ;
7- use frame_support:: traits:: { Currency } ;
8- use frame_support:: traits:: ExistenceRequirement :: KeepAlive ;
7+ // use frame_support::traits::{Currency};
8+ // use frame_support::traits::ExistenceRequirement::KeepAlive;
99
1010impl < T : Config > Pallet < T > {
1111
@@ -151,7 +151,7 @@ impl<T: Config> Pallet<T> {
151151 Ok ( ( ) )
152152 }
153153
154- 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 {
154+ pub fn do_enlist_sell_offer ( authority : T :: AccountId , marketplace_id : [ u8 ; 32 ] , collection_id : T :: CollectionId , item_id : T :: ItemId , price : u128 , ) -> DispatchResult {
155155 //This function is only called by the owner of the marketplace
156156 //ensure the marketplace exists
157157 ensure ! ( <Marketplaces <T >>:: contains_key( marketplace_id) , Error :: <T >:: MarketplaceNotFound ) ;
@@ -164,7 +164,7 @@ impl<T: Config> Pallet<T> {
164164 }
165165
166166 //ensure the price is valid
167- Self :: is_the_price_valid ( price) ?;
167+ // Self::is_the_price_valid(price)?;
168168
169169 //Add timestamp to the offer
170170 let ( timestamp, timestamp2) = Self :: get_timestamp_in_milliseconds ( ) . ok_or ( Error :: < T > :: TimestampError ) ?;
@@ -214,7 +214,7 @@ impl<T: Config> Pallet<T> {
214214 Ok ( ( ) )
215215 }
216216
217- pub fn do_enlist_buy_offer ( authority : T :: AccountId , marketplace_id : [ u8 ; 32 ] , collection_id : T :: CollectionId , item_id : T :: ItemId , price : BalanceOf < T > , ) -> DispatchResult {
217+ pub fn do_enlist_buy_offer ( authority : T :: AccountId , marketplace_id : [ u8 ; 32 ] , collection_id : T :: CollectionId , item_id : T :: ItemId , price : u128 , ) -> DispatchResult {
218218 //ensure the item is for sale, if not, return error
219219 Self :: can_this_item_receive_buy_orders ( collection_id, item_id, marketplace_id) ?;
220220
@@ -231,11 +231,11 @@ impl<T: Config> Pallet<T> {
231231 }
232232
233233 //ensure user has enough balance to create the offer
234- let total_user_balance = T :: LocalCurrency :: total_balance ( & authority) ;
235- ensure ! ( total_user_balance >= price, Error :: <T >:: NotEnoughBalance ) ;
234+ // let total_user_balance = T::LocalCurrency::total_balance(&authority);
235+ // ensure!(total_user_balance >= price, Error::<T>::NotEnoughBalance);
236236
237237 //ensure the price is valid
238- Self :: is_the_price_valid ( price) ?;
238+ // Self::is_the_price_valid(price)?;
239239
240240 //Add timestamp to the offer
241241 let ( timestamp, timestamp2) = Self :: get_timestamp_in_milliseconds ( ) . ok_or ( Error :: < T > :: TimestampError ) ?;
@@ -310,11 +310,11 @@ impl<T: Config> Pallet<T> {
310310
311311 //TODO: Use free_balance instead of total_balance
312312 //Get the buyer's balance
313- let total_amount_buyer = T :: LocalCurrency :: total_balance ( & buyer) ;
313+ // let total_amount_buyer = T::LocalCurrency::total_balance(&buyer);
314314 //ensure the buyer has enough balance to buy the item
315- ensure ! ( total_amount_buyer > offer_data. price, Error :: <T >:: NotEnoughBalance ) ;
315+ // ensure!(total_amount_buyer > offer_data.price, Error::<T>::NotEnoughBalance);
316316 //Transfer the balance
317- T :: LocalCurrency :: transfer ( & buyer, & owner_item, offer_data. price , KeepAlive ) ?;
317+ // T::LocalCurrency::transfer(&buyer, &owner_item, offer_data.price, KeepAlive)?;
318318
319319 //Use uniques transfer function to transfer the item to the buyer
320320 pallet_uniques:: Pallet :: < T > :: do_transfer ( offer_data. collection_id , offer_data. item_id , buyer. clone ( ) , |_, _|{
@@ -362,11 +362,11 @@ impl<T: Config> Pallet<T> {
362362
363363 //TODO: Use free_balance instead of total_balance
364364 //Get the buyer's balance
365- let total_amount_buyer = T :: LocalCurrency :: total_balance ( & offer_data. creator ) ;
365+ // let total_amount_buyer = T::LocalCurrency::total_balance(&offer_data.creator);
366366 //ensure the buy_offer_creator has enough balance to buy the item
367- ensure ! ( total_amount_buyer > offer_data. price, Error :: <T >:: NotEnoughBalance ) ;
367+ // ensure!(total_amount_buyer > offer_data.price, Error::<T>::NotEnoughBalance);
368368 //Transfer the balance to the owner of the item
369- T :: LocalCurrency :: transfer ( & offer_data. creator , & owner_item, offer_data. price , KeepAlive ) ?;
369+ // T::LocalCurrency::transfer(&offer_data.creator, &owner_item, offer_data.price, KeepAlive)?;
370370
371371 //Use uniques transfer function to transfer the item to the market_participant
372372 pallet_uniques:: Pallet :: < T > :: do_transfer ( offer_data. collection_id , offer_data. item_id , offer_data. creator . clone ( ) , |_, _|{
@@ -743,14 +743,14 @@ impl<T: Config> Pallet<T> {
743743 }
744744 }
745745
746- fn _get_offer_price ( offer_id : [ u8 ; 32 ] , ) -> Result < BalanceOf < T > , DispatchError > {
747- //we already know that the offer exists, so we don't need to check it here.
748- if let Some ( offer) = <OffersInfo < T > >:: get ( offer_id) {
749- return Ok ( offer. price ) ;
750- } else {
751- return Err ( Error :: < T > :: OfferNotFound ) ?;
752- }
753- }
746+ // fn _get_offer_price(offer_id: [u8;32],) -> Result<BalanceOf<T>, DispatchError> {
747+ // //we already know that the offer exists, so we don't need to check it here.
748+ // if let Some(offer) = <OffersInfo<T>>::get(offer_id) {
749+ // return Ok(offer.price);
750+ // } else {
751+ // return Err(Error::<T>::OfferNotFound)?;
752+ // }
753+ // }
754754
755755 fn does_exist_offer_id_for_this_item ( collection_id : T :: CollectionId , item_id : T :: ItemId , offer_id : [ u8 ; 32 ] ) -> DispatchResult {
756756 let offers = <OffersByItem < T > >:: try_get ( collection_id, item_id) . map_err ( |_| Error :: < T > :: OfferNotFound ) ?;
@@ -759,14 +759,14 @@ impl<T: Config> Pallet<T> {
759759 Ok ( ( ) )
760760 }
761761
762- fn is_the_price_valid ( price : BalanceOf < T > , ) -> DispatchResult {
763- let minimun_amount: BalanceOf < T > = 1000u32 . into ( ) ;
764- if price > minimun_amount {
765- return Ok ( ( ) ) ;
766- } else {
767- return Err ( Error :: < T > :: PriceMustBeGreaterThanZero ) ?;
768- }
769- }
762+ // fn is_the_price_valid(price: BalanceOf<T>,) -> DispatchResult {
763+ // let minimun_amount: BalanceOf<T> = 1000u32.into();
764+ // if price > minimun_amount {
765+ // return Ok(());
766+ // } else {
767+ // return Err(Error::<T>::PriceMustBeGreaterThanZero)?;
768+ // }
769+ // }
770770
771771 fn _get_offer_creator ( offer_id : [ u8 ; 32 ] , ) -> Result < T :: AccountId , DispatchError > {
772772 //we already know that the offer exists, so we don't need to check it here.
0 commit comments