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
163163
164 type Currency: Currency<Self::AccountId>;164 type Currency: Currency<Self::AccountId>;
165
166 #[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 >;
modifiedprimitives/data-structs/src/lib.rsdiffbeforeafterboth
64// Schema limits64// Schema limits
65pub 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;
6868
69pub 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;
modifiedruntime/src/lib.rsdiffbeforeafterboth
250 pub const SS58Prefix: u8 = 42;250 pub const SS58Prefix: u8 = 42;
251}251}
252252
253/*
2548880 - Unique
2558881 - Quartz
2568882 - Opal
257*/
253parameter_types! {258parameter_types! {
254 pub const ChainId: u64 = 8888;259 pub const ChainId: u64 = 8882;
255}260}
256261
257pub struct FixedFee;262pub struct FixedFee;
874879
875parameter_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}
879884
880impl pallet_common::Config for Runtime {885impl 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
1import {expect} from 'chai';1import {expect} from 'chai';
2import {contractHelpers, createEthAccount, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';2import {contractHelpers, createEthAccountWithBalance, deployFlipper, itWeb3} from './util/helpers';
33
4describe('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);
98
10 const helpers = contractHelpers(web3, owner);9 const helpers = contractHelpers(web3, owner);
1110
12 // Any user is allowed by default11 // Any user is allowed by default
13 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;
1513
16 // Enable14 // Enable
17 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;
2017
21 // Disable18 // Disable
22 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 });
2622
27 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}) => {
modifiedtests/src/eth/contractSponsoring.test.tsdiffbeforeafterboth
113 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');
115115
116 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;
118118
119 // Balance should be taken from flipper instead of caller119 // Balance should be taken from flipper instead of caller
120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);120 const balanceAfter = await web3.eth.getBalance(flipper.options.address);