git.delta.rocks / unique-network / refs/commits / ea076cb37bde

difftreelog

Merge branch 'develop' into feature/polkadot-js-7

Igor Kozyrev2022-02-18parents: #798055c #a6f62bd.patch.diff
in: master

6 files changed

modifiedpallets/common/src/lib.rsdiffbeforeafterboth
--- a/pallets/common/src/lib.rs
+++ b/pallets/common/src/lib.rs
@@ -162,9 +162,12 @@
 		type EvmBackwardsAddressMapping: up_evm_mapping::EvmBackwardsAddressMapping<Self::AccountId>;
 
 		type Currency: Currency<Self::AccountId>;
+
+		#[pallet::constant]
 		type CollectionCreationPrice: Get<
 			<<Self as Config>::Currency as Currency<Self::AccountId>>::Balance,
 		>;
+
 		type TreasuryAccountId: Get<Self::AccountId>;
 	}
 
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
--- a/primitives/data-structs/src/lib.rs
+++ b/primitives/data-structs/src/lib.rs
@@ -64,7 +64,7 @@
 // Schema limits
 pub const OFFCHAIN_SCHEMA_LIMIT: u32 = 8192;
 pub const VARIABLE_ON_CHAIN_SCHEMA_LIMIT: u32 = 8192;
-pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 1048576;
+pub const CONST_ON_CHAIN_SCHEMA_LIMIT: u32 = 32768;
 
 pub const MAX_COLLECTION_NAME_LENGTH: u32 = 64;
 pub const MAX_COLLECTION_DESCRIPTION_LENGTH: u32 = 256;
modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -250,8 +250,13 @@
 	pub const SS58Prefix: u8 = 42;
 }
 
+/*
+8880 - Unique
+8881 - Quartz
+8882 - Opal
+*/
 parameter_types! {
-	pub const ChainId: u64 = 8888;
+	pub const ChainId: u64 = 8882;
 }
 
 pub struct FixedFee;
@@ -874,7 +879,7 @@
 
 parameter_types! {
 	pub TreasuryAccountId: AccountId = TreasuryModuleId::get().into_account();
-	pub const CollectionCreationPrice: Balance = 100 * UNIQUE;
+	pub const CollectionCreationPrice: Balance = 2 * UNIQUE;
 }
 
 impl pallet_common::Config for Runtime {
modifiedtests/src/confirmSponsorship.test.tsdiffbeforeafterboth
374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');374 await confirmSponsorshipExpectFailure(collectionId, '//Bob');
375 });375 });
376
377 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');
381
382 await usingApi(async (api) => {
383 // Find unused address
384 const ownerZeroBalance = await findUnusedAddress(api);
385
386 // Find another unused address
387 const senderZeroBalance = await findUnusedAddress(api);
388
389 // Mint token for an unused address
390 const itemId = await createItemExpectSuccess(alice, collectionId, 'NFT', ownerZeroBalance.address);
391
392 const sponsorBalanceBeforeTx = (await api.query.system.account(bob.address)).data.free.toBigInt();
393
394 // Try to transfer this token from an unsponsored unused adress to Alice
395 const zeroToAlice = api.tx.unique.transfer(normalizeAccountId(alice.address), collectionId, itemId, 0);
396 await expect(submitTransactionExpectFailAsync(senderZeroBalance, zeroToAlice)).to.be.rejected;
397
398 const sponsorBalanceAfterTx = (await api.query.system.account(bob.address)).data.free.toBigInt();
399
400 expect(sponsorBalanceAfterTx).to.equal(sponsorBalanceBeforeTx);
401 });
402 });
376});403});
377404
modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
--- a/tests/src/eth/allowlist.test.ts
+++ b/tests/src/eth/allowlist.test.ts
@@ -1,27 +1,23 @@
 import {expect} from 'chai';
-import {contractHelpers, createEthAccount, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';
+import {contractHelpers, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';
 
 describe('EVM allowlist', () => {
   itWeb3('Contract allowlist can be toggled', async ({api, web3}) => {
     const owner = await createEthAccountWithBalance(api, web3);
     const flipper = await deployFlipper(web3, owner);
-    const randomUser = createEthAccount(web3);
 
     const helpers = contractHelpers(web3, owner);
 
     // Any user is allowed by default
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;
 
     // Enable
     await helpers.methods.toggleAllowlist(flipper.options.address, true).send({from: owner});
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.true;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.false;
 
     // Disable
     await helpers.methods.toggleAllowlist(flipper.options.address, false).send({from: owner});
     expect(await helpers.methods.allowlistEnabled(flipper.options.address).call()).to.be.false;
-    expect(await helpers.methods.allowed(flipper.options.address, randomUser).call()).to.be.true;
   });
 
   itWeb3('Non-allowlisted user can\'t call contract with allowlist enabled', async ({api, web3}) => {
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
--- a/tests/src/eth/contractSponsoring.test.ts
+++ b/tests/src/eth/contractSponsoring.test.ts
@@ -113,8 +113,8 @@
     const originalFlipperBalance = await web3.eth.getBalance(flipper.options.address);
     expect(originalFlipperBalance).to.be.not.equal('0');
 
-    await flipper.methods.flip().send({from: caller});
-    expect(await flipper.methods.getValue().call()).to.be.true;
+    await expect(flipper.methods.flip().send({from: caller})).to.be.rejectedWith(/InvalidTransaction::Payment/);
+    expect(await flipper.methods.getValue().call()).to.be.false;
 
     // Balance should be taken from flipper instead of caller
     const balanceAfter = await web3.eth.getBalance(flipper.options.address);