difftreelog
Merge branch 'develop' into feature/CORE-37
in: master
4 files changed
pallets/nft/src/lib.rsdiffbeforeafterboth--- a/pallets/nft/src/lib.rs
+++ b/pallets/nft/src/lib.rs
@@ -255,6 +255,11 @@
.max(Self::create_item_fungible())
.max(Self::create_item_refungible(data))
}
+ fn create_multiple_items(amount: u32) -> Weight {
+ Self::create_multiple_items_nft(amount)
+ .max(Self::create_multiple_items_fungible(amount))
+ .max(Self::create_multiple_items_refungible(amount))
+ }
fn burn_item() -> Weight {
// TODO: refungible, fungible
Self::burn_item_nft()
@@ -901,9 +906,7 @@
/// * itemsData: Array items properties. Each property is an array of bytes itself, see [create_item].
///
/// * owner: Address, initial owner of the NFT.
- #[weight = <SelfWeightOf<T>>::create_item(items_data.iter()
- .map(|data| { data.data_size() as u32 })
- .sum())]
+ #[weight = <SelfWeightOf<T>>::create_multiple_items(items_data.len() as u32)]
#[transactional]
pub fn create_multiple_items(origin, collection_id: CollectionId, owner: T::CrossAccountId, items_data: Vec<CreateItemData>) -> DispatchResult {
@@ -929,7 +932,7 @@
/// * collection_id: ID of the collection.
///
/// * value: New flag value.
- #[weight = <SelfWeightOf<T>>::burn_item()]
+ #[weight = <SelfWeightOf<T>>::set_transfers_enabled_flag()]
#[transactional]
pub fn set_transfers_enabled_flag(origin, collection_id: CollectionId, value: bool) -> DispatchResult {
tests/src/pallet-presence.test.tsdiffbeforeafterboth--- a/tests/src/pallet-presence.test.ts
+++ b/tests/src/pallet-presence.test.ts
@@ -25,6 +25,7 @@
'evm',
'evmcodersubstrate',
'evmcontracthelpers',
+ 'evmmigration',
'evmtransactionpayment',
'ethereum',
'xcmpqueue',
tests/src/setChainLimits.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { IKeyringPair } from '@polkadot/types/types';7import privateKey from './substrate/privateKey';8import usingApi from './substrate/substrate-api';9import {10 createCollectionExpectSuccess,11 addCollectionAdminExpectSuccess,12 setChainLimitsExpectFailure,13 IChainLimits,14} from './util/helpers';1516describe('Negative Integration Test setChainLimits', () => {17 let alice: IKeyringPair;18 let bob: IKeyringPair;19 let dave: IKeyringPair;20 let limits: IChainLimits;2122 before(async () => {23 await usingApi(async () => {24 alice = privateKey('//Alice');25 bob = privateKey('//Bob');26 dave = privateKey('//Dave');27 limits = {28 CollectionNumbersLimit : 1,29 AccountTokenOwnershipLimit: 1,30 CollectionsAdminsLimit: 1,31 CustomDataLimit: 1,32 NftSponsorTransferTimeout: 1,33 FungibleSponsorTransferTimeout: 1,34 RefungibleSponsorTransferTimeout: 1,35 OffchainSchemaLimit: 1,36 VariableOnChainSchemaLimit: 1,37 ConstOnChainSchemaLimit: 1,38 };39 });40 });4142 it('Collection owner cannot set chain limits', async () => {43 await createCollectionExpectSuccess({ mode: { type: 'NFT' } });44 await setChainLimitsExpectFailure(alice, limits);45 });4647 it('Collection admin cannot set chain limits', async () => {48 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });49 await addCollectionAdminExpectSuccess(alice, collectionId, bob);50 await setChainLimitsExpectFailure(bob, limits);51 });52 53 it('Regular user cannot set chain limits', async () => {54 await setChainLimitsExpectFailure(dave, limits);55 });56});1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import { IKeyringPair } from '@polkadot/types/types';7import privateKey from './substrate/privateKey';8import usingApi from './substrate/substrate-api';9import {10 createCollectionExpectSuccess,11 addCollectionAdminExpectSuccess,12 setChainLimitsExpectFailure,13 IChainLimits,14} from './util/helpers';1516describe.skip('Negative Integration Test setChainLimits', () => {17 let alice: IKeyringPair;18 let bob: IKeyringPair;19 let dave: IKeyringPair;20 let limits: IChainLimits;2122 before(async () => {23 await usingApi(async () => {24 alice = privateKey('//Alice');25 bob = privateKey('//Bob');26 dave = privateKey('//Dave');27 limits = {28 CollectionNumbersLimit : 1,29 AccountTokenOwnershipLimit: 1,30 CollectionsAdminsLimit: 1,31 CustomDataLimit: 1,32 NftSponsorTransferTimeout: 1,33 FungibleSponsorTransferTimeout: 1,34 RefungibleSponsorTransferTimeout: 1,35 OffchainSchemaLimit: 1,36 VariableOnChainSchemaLimit: 1,37 ConstOnChainSchemaLimit: 1,38 };39 });40 });4142 it('Collection owner cannot set chain limits', async () => {43 await createCollectionExpectSuccess({ mode: { type: 'NFT' } });44 await setChainLimitsExpectFailure(alice, limits);45 });4647 it('Collection admin cannot set chain limits', async () => {48 const collectionId = await createCollectionExpectSuccess({ mode: { type: 'NFT' } });49 await addCollectionAdminExpectSuccess(alice, collectionId, bob);50 await setChainLimitsExpectFailure(bob, limits);51 });52 53 it('Regular user cannot set chain limits', async () => {54 await setChainLimitsExpectFailure(dave, limits);55 });56});tests/src/transfer.test.tsdiffbeforeafterboth--- a/tests/src/transfer.test.ts
+++ b/tests/src/transfer.test.ts
@@ -60,7 +60,7 @@
// tslint:disable-next-line:no-unused-expression
expect(result.success).to.be.false;
};
- expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');
+ await expect(badTransaction()).to.be.rejectedWith('Inability to pay some fees , e.g. account balance too low');
});
});