Skip to content

Commit

Permalink
disable place bid
Browse files Browse the repository at this point in the history
  • Loading branch information
Gauthamastro committed Apr 18, 2024
1 parent ca9bda6 commit 8a078a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
44 changes: 22 additions & 22 deletions pallets/ocex/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,28 +1023,28 @@ pub mod pallet {
Ok(())
}

/// Place Bid
#[pallet::call_index(22)]
#[pallet::weight(< T as Config >::WeightInfo::place_bid())]
pub fn place_bid(origin: OriginFor<T>, bid_amount: BalanceOf<T>) -> DispatchResult {
let bidder = ensure_signed(origin)?;
let mut auction_info = <Auction<T>>::get().ok_or(Error::<T>::AuctionNotFound)?;
ensure!(bid_amount > Zero::zero(), Error::<T>::InvalidBidAmount);
ensure!(bid_amount > auction_info.highest_bid, Error::<T>::InvalidBidAmount);
ensure!(
T::NativeCurrency::can_reserve(&bidder, bid_amount),
Error::<T>::InsufficientBalance
);
T::NativeCurrency::reserve(&bidder, bid_amount)?;
if let Some(old_bidder) = auction_info.highest_bidder {
// Un-reserve the old bidder
T::NativeCurrency::unreserve(&old_bidder, auction_info.highest_bid);
}
auction_info.highest_bid = bid_amount;
auction_info.highest_bidder = Some(bidder);
<Auction<T>>::put(auction_info);
Ok(())
}
// /// Place Bid TODO: Enable it after frontend is ready.
// #[pallet::call_index(22)]
// #[pallet::weight(< T as Config >::WeightInfo::place_bid())]
// pub fn place_bid(origin: OriginFor<T>, bid_amount: BalanceOf<T>) -> DispatchResult {
// let bidder = ensure_signed(origin)?;
// let mut auction_info = <Auction<T>>::get().ok_or(Error::<T>::AuctionNotFound)?;
// ensure!(bid_amount > Zero::zero(), Error::<T>::InvalidBidAmount);
// ensure!(bid_amount > auction_info.highest_bid, Error::<T>::InvalidBidAmount);
// ensure!(
// T::NativeCurrency::can_reserve(&bidder, bid_amount),
// Error::<T>::InsufficientBalance
// );
// T::NativeCurrency::reserve(&bidder, bid_amount)?;
// if let Some(old_bidder) = auction_info.highest_bidder {
// // Un-reserve the old bidder
// T::NativeCurrency::unreserve(&old_bidder, auction_info.highest_bid);
// }
// auction_info.highest_bid = bid_amount;
// auction_info.highest_bidder = Some(bidder);
// <Auction<T>>::put(auction_info);
// Ok(())
// }

/// Starts a new liquidity mining epoch
#[pallet::call_index(23)]
Expand Down
2 changes: 1 addition & 1 deletion runtimes/mainnet/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// and set impl_version to 0. If only runtime
// implementation changes and behavior does not, then leave spec_version as
// is and increment impl_version.
spec_version: 347,
spec_version: 348,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 2,
Expand Down

0 comments on commit 8a078a8

Please sign in to comment.