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

difftreelog

Code style update

str-mv2021-07-29parent: #1e0a302.patch.diff
in: master

58 files changed

addedpallets/contracts/CHANGELOG.mddiffbeforeafterboth

no changes

addedpallets/contracts/COMPLEXITY.mddiffbeforeafterboth

no changes

addedpallets/contracts/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/contracts/README.mddiffbeforeafterboth

no changes

addedpallets/contracts/common/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/contracts/common/README.mddiffbeforeafterboth

no changes

addedpallets/contracts/common/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/call_return_code.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/caller_contract.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/chain_extension.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/check_default_rent_allowance.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/crypto_hashes.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/destroy_and_transfer.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/drain.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/event_size.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/instantiate_return_code.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/ok_trap_revert.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/restoration.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/return_from_start_fn.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/return_with_data.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/run_out_of_gas.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/self_destruct.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/self_destructing_constructor.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/set_empty_storage.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/set_rent.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/storage_size.watdiffbeforeafterboth

no changes

addedpallets/contracts/fixtures/transfer_return_code.watdiffbeforeafterboth

no changes

addedpallets/contracts/proc-macro/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/contracts/proc-macro/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/contracts/rpc/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/contracts/rpc/README.mddiffbeforeafterboth

no changes

addedpallets/contracts/rpc/runtime-api/Cargo.tomldiffbeforeafterboth

no changes

addedpallets/contracts/rpc/runtime-api/README.mddiffbeforeafterboth

no changes

addedpallets/contracts/rpc/runtime-api/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/contracts/rpc/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/benchmarking/code.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/benchmarking/mod.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/benchmarking/sandbox.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/chain_extension.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/exec.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/gas.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/lib.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/migration.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/rent.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/schedule.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/storage.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/tests.rsdiffbeforeafterboth

no changes

addedpallets/contracts/src/weights.rsdiffbeforeafterboth

no changes

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
175 BadCreateRefungibleCall,175 BadCreateRefungibleCall,
176 /// Gas limit exceeded176 /// Gas limit exceeded
177 OutOfGas,177 OutOfGas,
178 /// Metadata update denied by collection settings 178 /// Metadata update denied by collection settings
179 MetadataUpdateDenied,179 MetadataUpdateDenied,
180 /// Metadata update flag become unmutable with None option180 /// Metadata update flag become unmutable with None option
181 MetadataFlagFrozen,181 MetadataFlagFrozen,
1542 Self::is_item_owner(sender, collection, item_id), 1542 Self::is_item_owner(sender, collection, item_id),
1543 Error::<T>::NoPermission1543 Error::<T>::NoPermission
1544 );1544 );
1545 },1545 }
1546 MetaUpdatePermission::Admin => {1546 MetaUpdatePermission::Admin => {
1547 ensure!(1547 ensure!(
1548 Self::is_owner_or_admin_permissions(collection, sender), 1548 Self::is_owner_or_admin_permissions(collection, sender),
1549 Error::<T>::NoPermission1549 Error::<T>::NoPermission
1550 );1550 );
1551 },1551 }
1552 MetaUpdatePermission::None => {1552 MetaUpdatePermission::None => {
1553 fail!(Error::<T>::MetadataUpdateDenied);1553 fail!(Error::<T>::MetadataUpdateDenied);
1554 },1554 }
1555 }1555 }
15561556
1557 Ok(())1557 Ok(())
modifiedpallets/nft/src/tests.rsdiffbeforeafterboth

no syntactic changes

modifiedprimitives/nft/src/lib.rsdiffbeforeafterboth

no syntactic changes

modifiedtests/src/change-collection-owner.test.tsdiffbeforeafterboth
7import chaiAsPromised from 'chai-as-promised';7import chaiAsPromised from 'chai-as-promised';
8import privateKey from './substrate/privateKey';8import privateKey from './substrate/privateKey';
9import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';9import { default as usingApi, submitTransactionAsync, submitTransactionExpectFailAsync } from './substrate/substrate-api';
10import { createCollectionExpectSuccess, normalizeAccountId } from './util/helpers';10import { createCollectionExpectSuccess } from './util/helpers';
1111
12chai.use(chaiAsPromised);12chai.use(chaiAsPromised);
13const expect = chai.expect;13const expect = chai.expect;
modifiedtests/src/metadataUpdate.test.tsdiffbeforeafterboth
17 addToWhiteListExpectSuccess,17 addToWhiteListExpectSuccess,
18 addCollectionAdminExpectSuccess,18 addCollectionAdminExpectSuccess,
19 setVariableMetaDataExpectFailure,19 setVariableMetaDataExpectFailure,
20 setMetadataUpdatePermissionFlagExpectFailure20 setMetadataUpdatePermissionFlagExpectFailure,
21} from './util/helpers';21} from './util/helpers';
2222
23chai.use(chaiAsPromised);23chai.use(chaiAsPromised);
26 it('Set variable metadata with ItemOwner permission flag', async () => {26 it('Set variable metadata with ItemOwner permission flag', async () => {
27 await usingApi(async () => {27 await usingApi(async () => {
28 const Alice = privateKey('//Alice');28 const Alice = privateKey('//Alice');
29 const Bob = privateKey('//Bob');
3029
31 const data = [1, 2, 254, 255];30 const data = [1, 2, 254, 255];
3231
33 // nft32 // nft
34 const nftCollectionId = await createCollectionExpectSuccess();33 const nftCollectionId = await createCollectionExpectSuccess();
35 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');34 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
36 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, "ItemOwner");35 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, 'ItemOwner');
3736
38 await setVariableMetaDataExpectSuccess(Alice, nftCollectionId, newNftTokenId, data);37 await setVariableMetaDataExpectSuccess(Alice, nftCollectionId, newNftTokenId, data);
39 });38 });
49 // nft48 // nft
50 const nftCollectionId = await createCollectionExpectSuccess();49 const nftCollectionId = await createCollectionExpectSuccess();
51 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');50 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
52 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, "ItemOwner");51 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, 'ItemOwner');
5352
54 await setMintPermissionExpectSuccess(Alice, nftCollectionId, true);53 await setMintPermissionExpectSuccess(Alice, nftCollectionId, true);
55 await addToWhiteListExpectSuccess(Alice, nftCollectionId, Bob.address);54 await addToWhiteListExpectSuccess(Alice, nftCollectionId, Bob.address);
69 // nft68 // nft
70 const nftCollectionId = await createCollectionExpectSuccess();69 const nftCollectionId = await createCollectionExpectSuccess();
71 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');70 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
72 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, "Admin");71 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, 'Admin');
7372
74 await setMintPermissionExpectSuccess(Alice, nftCollectionId, true);73 await setMintPermissionExpectSuccess(Alice, nftCollectionId, true);
75 await addToWhiteListExpectSuccess(Alice, nftCollectionId, Bob.address);74 await addToWhiteListExpectSuccess(Alice, nftCollectionId, Bob.address);
82 it('Nobody can set variable metadata with None flag', async () => {81 it('Nobody can set variable metadata with None flag', async () => {
83 await usingApi(async () => {82 await usingApi(async () => {
84 const Alice = privateKey('//Alice');83 const Alice = privateKey('//Alice');
85 const Bob = privateKey('//Bob');84
86
87 const data = [1, 2, 254, 255];85 const data = [1, 2, 254, 255];
88 86
89 // nft87 // nft
90 const nftCollectionId = await createCollectionExpectSuccess();88 const nftCollectionId = await createCollectionExpectSuccess();
91 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');89 const newNftTokenId = await createItemExpectSuccess(Alice, nftCollectionId, 'NFT');
92 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, "None");90 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, 'None');
93 91
94 await setVariableMetaDataExpectFailure(Alice, nftCollectionId, newNftTokenId, data);92 await setVariableMetaDataExpectFailure(Alice, nftCollectionId, newNftTokenId, data);
95 });93 });
98 it('Nobody can set variable metadata flag after freeze', async () => {96 it('Nobody can set variable metadata flag after freeze', async () => {
99 await usingApi(async () => {97 await usingApi(async () => {
100 const Alice = privateKey('//Alice');98 const Alice = privateKey('//Alice');
101 const Bob = privateKey('//Bob');99
102
103 const data = [1, 2, 254, 255];
104
105 // nft100 // nft
106 const nftCollectionId = await createCollectionExpectSuccess();101 const nftCollectionId = await createCollectionExpectSuccess();
107 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, "None");102 await setMetadataUpdatePermissionFlagExpectSuccess(Alice, nftCollectionId, 'None');
108 await setMetadataUpdatePermissionFlagExpectFailure(Alice, nftCollectionId, "Admin");103 await setMetadataUpdatePermissionFlagExpectFailure(Alice, nftCollectionId, 'Admin');
109 104
110 });105 });
111 });106 });
modifiedtests/src/pallet-presence.test.tsdiffbeforeafterboth

no syntactic changes

modifiedtests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth
11import {11import {
12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,
13 destroyCollectionExpectSuccess,13 destroyCollectionExpectSuccess,
14 normalizeAccountId,
15} from './util/helpers';14} from './util/helpers';
1615
17chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
modifiedtests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth
11import {11import {
12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,
13 destroyCollectionExpectSuccess,13 destroyCollectionExpectSuccess,
14 normalizeAccountId,
15} from './util/helpers';14} from './util/helpers';
1615
17chai.use(chaiAsPromised);16chai.use(chaiAsPromised);
modifiedtests/src/substrate/substrate-api.tsdiffbeforeafterboth

no syntactic changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
565 });565 });
566}566}
567567
568export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value: boolean = true) {568export async function toggleContractWhitelistExpectSuccess(sender: IKeyringPair, contractAddress: AccountId | string, value = true) {
569 await usingApi(async (api) => {569 await usingApi(async (api) => {
570 const tx = api.tx.nft.toggleContractWhiteList(contractAddress, value);570 const tx = api.tx.nft.toggleContractWhiteList(contractAddress, value);
571 const events = await submitTransactionAsync(sender, tx);571 const events = await submitTransactionAsync(sender, tx);