difftreelog
Merge branch 'develop' into feature/polkadot-js-7
in: master
6 files changed
pallets/common/src/lib.rsdiffbeforeafterboth163163164 type Currency: Currency<Self::AccountId>;164 type Currency: Currency<Self::AccountId>;165166 #[pallet::constant]165 type CollectionCreationPrice: Get<167 type CollectionCreationPrice: Get<166 <<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,168 <<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,167 >;169 >;primitives/data-structs/src/lib.rsdiffbeforeafterboth64// Schema limits64// Schema limits65pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;65pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;66pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;66pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;67pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1048576;67pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;686869pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;69pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;70pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;70pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;runtime/src/lib.rsdiffbeforeafterboth250 pub const SS58Prefix: u8 = 42;250 pub const SS58Prefix: u8 = 42;251}251}252252253/*2548880 - Unique2558881 - Quartz2568882 - Opal257*/253parameter_types! {258parameter_types! {254 pub const ChainId: u64 = 8888;259 pub const ChainId: u64 = 8882;255}260}256261257pub struct FixedFee;262pub struct FixedFee;874879875parameter_types! {880parameter_types! {876 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();881 pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();877 pub const CollectionCreationPrice: Balance = 100 * UNIQUE;882 pub const CollectionCreationPrice: Balance = 2 * UNIQUE;878}883}879884880impl pallet_common::Config for Runtime {885impl pallet_common::Config for Runtime {tests/src/confirmSponsorship.test.tsdiffbeforeafterboth374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');375 });375 });376377 it('(!negative test!) Transfer fees are not paid by the sponsor if the transfer failed', async () => {378 const collectionId = await createCollectionExpectSuccess();379 await setCollectionSponsorExpectSuccess(collectionId, bob.address);380 await confirmSponsorshipExpectSuccess(collectionId, '//Bob');381382 await usingApi(async (api) => {383 // Find unused address384 const ownerZeroBalance = await findUnusedAddress(api);385386 // Find another unused address387 const senderZeroBalance = await findUnusedAddress(api);388389 // Mint token for an unused address390 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', ownerZeroBalance.address);391392 const sponsorBalanceBeforeTx = (await api.query.system.account(bob.address)).data.free.toBigInt();393394 // Try to transfer this token from an unsponsored unused adress to Alice395 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);396 await expect(submitTransactionExpectFailAsync(senderZeroBalance, zeroToAlice)).to.be.rejected;397398 const sponsorBalanceAfterTx = (await api.query.system.account(bob.address)).data.free.toBigInt();399400 expect(sponsorBalanceAfterTx).to.equal(sponsorBalanceBeforeTx);401 });402 });376});403});377404tests/src/eth/allowlist.test.tsdiffbeforeafterboth1import {expect} from 'chai';1import {expect} from 'chai';2import {contractHelpers, createEthAccount, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';2import {contractHelpers, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';334describe('EVM allowlist', () => {4describe('EVM allowlist', () => {5 itWeb3('Contract allowlist can be toggled', async ({api, web3}) => {5 itWeb3('Contract allowlist can be toggled', async ({api, web3}) => {6 const owner = await createEthAccountWithBalance(api, web3);6 const owner = await createEthAccountWithBalance(api, web3);7 const flipper = await deployFlipper(web3, owner);7 const flipper = await deployFlipper(web3, owner);8 const randomUser = createEthAccount(web3);9810 const helpers = contractHelpers(web3, owner);9 const helpers = contractHelpers(web3, owner);111012 // Any user is allowed by default11 // Any user is allowed by default13 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;12 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;14 expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;151316 // Enable14 // Enable17 await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});15 await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});18 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;16 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;19 expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.false;201721 // Disable18 // Disable22 await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});19 await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});23 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;20 expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;24 expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;25 });21 });262227 itWeb3('Non-allowlisted user can\'t call contract with allowlist enabled', async ({api, web3}) => {23 itWeb3('Non-allowlisted user can\'t call contract with allowlist enabled', async ({api, web3}) => {tests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth113 const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);113 const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);114 expect(originalFlipperBalance).to.be.not.equal('0');114 expect(originalFlipperBalance).to.be.not.equal('0');115115116 await flipper.methods.flip().send({from: caller});116 await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);117 expect(await flipper.methods.getValue().call()).to.be.true;117 expect(await flipper.methods.getValue().call()).to.be.false;118118119 // Balance should be taken from flipper instead of caller119 // Balance should be taken from flipper instead of caller120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);