Skip to content

Commit

Permalink
Merge pull request #282 from chexware/audit-fix
Browse files Browse the repository at this point in the history
Audit Issues Fix
  • Loading branch information
justinphamnz authored Aug 10, 2023
2 parents b2d0ea7 + 063073c commit 8c58979
Show file tree
Hide file tree
Showing 70 changed files with 1,482 additions and 1,010 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
jobs:
check:
# The type of runner that the job will run on
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
40 changes: 0 additions & 40 deletions .github/workflows/rust-build-benchmarking.yml

This file was deleted.

19 changes: 19 additions & 0 deletions pallets/auction/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@ pub mod pallet {
/// Anti-snipe duration
#[pallet::constant]
type AntiSnipeDuration: Get<Self::BlockNumber>;

/// Storage deposit free charged when saving data into the blockchain.
/// The fee will be unreserved after the storage is freed.
#[pallet::constant]
type StorageDepositFee: Get<BalanceOf<Self>>;
}

#[pallet::storage]
Expand Down Expand Up @@ -388,6 +393,13 @@ pub mod pallet {
Error::<T>::AuctionTypeIsNotSupported
);

T::Currency::transfer(
&from,
&T::MetaverseInfoSource::get_network_treasury(),
T::StorageDepositFee::get(),
ExistenceRequirement::KeepAlive,
)?;

Self::auction_bid_handler(from, id, value)?;

Ok(().into())
Expand Down Expand Up @@ -522,6 +534,13 @@ pub mod pallet {
listing_fee = T::MetaverseInfoSource::get_metaverse_marketplace_listing_fee(metaverse_id)?;
}

T::Currency::transfer(
&from,
&T::MetaverseInfoSource::get_network_treasury(),
T::StorageDepositFee::get(),
ExistenceRequirement::KeepAlive,
)?;

Self::create_auction(
AuctionType::BuyNow,
item_id,
Expand Down
3 changes: 3 additions & 0 deletions pallets/auction/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ impl Config for Runtime {
type OfferDuration = OfferDuration;
type MinimumListingPrice = MinimumListingPrice;
type AntiSnipeDuration = AntiSnipeDuration;
type StorageDepositFee = StorageDepositFee;
}

pub type AdaptedBasicCurrency = currencies::BasicCurrencyAdapter<Runtime, Balances, Amount, BlockNumber>;
Expand Down Expand Up @@ -365,6 +366,7 @@ parameter_types! {
pub MaxBatchTransfer: u32 = 3;
pub MaxBatchMinting: u32 = 2000;
pub MaxMetadata: u32 = 10;
pub StorageDepositFee: Balance = 1;
}

impl pallet_nft::Config for Runtime {
Expand All @@ -381,6 +383,7 @@ impl pallet_nft::Config for Runtime {
type MiningResourceId = MiningCurrencyId;
type AssetMintingFee = AssetMintingFee;
type ClassMintingFee = ClassMintingFee;
type StorageDepositFee = StorageDepositFee;
}

parameter_types! {
Expand Down
Loading

0 comments on commit 8c58979

Please sign in to comment.