difftreelog
Code style update
in: master
58 files changed
pallets/contracts/CHANGELOG.mddiffbeforeafterbothno changes
pallets/contracts/COMPLEXITY.mddiffbeforeafterbothno changes
pallets/contracts/Cargo.tomldiffbeforeafterbothno changes
pallets/contracts/README.mddiffbeforeafterbothno changes
pallets/contracts/common/Cargo.tomldiffbeforeafterbothno changes
pallets/contracts/common/README.mddiffbeforeafterbothno changes
pallets/contracts/common/src/lib.rsdiffbeforeafterbothno changes
pallets/contracts/fixtures/call_return_code.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/caller_contract.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/chain_extension.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/check_default_rent_allowance.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/crypto_hashes.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/destroy_and_transfer.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/drain.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/event_size.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/instantiate_return_code.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/ok_trap_revert.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/restoration.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/return_from_start_fn.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/return_with_data.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/run_out_of_gas.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/self_destruct.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/self_destructing_constructor.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/set_empty_storage.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/set_rent.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/storage_size.watdiffbeforeafterbothno changes
pallets/contracts/fixtures/transfer_return_code.watdiffbeforeafterbothno changes
pallets/contracts/proc-macro/Cargo.tomldiffbeforeafterbothno changes
pallets/contracts/proc-macro/src/lib.rsdiffbeforeafterbothno changes
pallets/contracts/rpc/Cargo.tomldiffbeforeafterbothno changes
pallets/contracts/rpc/README.mddiffbeforeafterbothno changes
pallets/contracts/rpc/runtime-api/Cargo.tomldiffbeforeafterbothno changes
pallets/contracts/rpc/runtime-api/README.mddiffbeforeafterbothno changes
pallets/contracts/rpc/runtime-api/src/lib.rsdiffbeforeafterbothno changes
pallets/contracts/rpc/src/lib.rsdiffbeforeafterbothno changes
pallets/contracts/src/benchmarking/code.rsdiffbeforeafterbothno changes
pallets/contracts/src/benchmarking/mod.rsdiffbeforeafterbothno changes
pallets/contracts/src/benchmarking/sandbox.rsdiffbeforeafterbothno changes
pallets/contracts/src/chain_extension.rsdiffbeforeafterbothno changes
pallets/contracts/src/exec.rsdiffbeforeafterbothno changes
pallets/contracts/src/gas.rsdiffbeforeafterbothno changes
pallets/contracts/src/lib.rsdiffbeforeafterbothno changes
pallets/contracts/src/migration.rsdiffbeforeafterbothno changes
pallets/contracts/src/rent.rsdiffbeforeafterbothno changes
pallets/contracts/src/schedule.rsdiffbeforeafterbothno changes
pallets/contracts/src/storage.rsdiffbeforeafterbothno changes
pallets/contracts/src/tests.rsdiffbeforeafterbothno changes
pallets/contracts/src/weights.rsdiffbeforeafterbothno changes
pallets/nft/src/lib.rsdiffbeforeafterboth175 BadCreateRefungibleCall,175 BadCreateRefungibleCall,176 /// Gas limit exceeded176 /// Gas limit exceeded177 OutOfGas,177 OutOfGas,178 /// Metadata update denied by collection settings 178 /// Metadata update denied by collection settings179 MetadataUpdateDenied,179 MetadataUpdateDenied,180 /// Metadata update flag become unmutable with None option180 /// Metadata update flag become unmutable with None option181 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>::NoPermission1544 );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>::NoPermission1550 );1550 );1551 },1551 }1552 MetaUpdatePermission::None => {1552 MetaUpdatePermission::None => {1553 fail!(Error::<T>::MetadataUpdateDenied);1553 fail!(Error::<T>::MetadataUpdateDenied);1554 },1554 }1555 }1555 }155615561557 Ok(())1557 Ok(())pallets/nft/src/tests.rsdiffbeforeafterbothno syntactic changes
primitives/nft/src/lib.rsdiffbeforeafterbothno syntactic changes
tests/src/change-collection-owner.test.tsdiffbeforeafterboth7import 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';111112chai.use(chaiAsPromised);12chai.use(chaiAsPromised);13const expect = chai.expect;13const expect = chai.expect;tests/src/metadataUpdate.test.tsdiffbeforeafterboth17 addToWhiteListExpectSuccess,17 addToWhiteListExpectSuccess,18 addCollectionAdminExpectSuccess,18 addCollectionAdminExpectSuccess,19 setVariableMetaDataExpectFailure,19 setVariableMetaDataExpectFailure,20 setMetadataUpdatePermissionFlagExpectFailure20 setMetadataUpdatePermissionFlagExpectFailure,21} from './util/helpers';21} from './util/helpers';222223chai.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');302931 const data = [1, 2, 254, 255];30 const data = [1, 2, 254, 255];323133 // nft32 // nft34 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');373638 await setVariableMetaDataExpectSuccess(Alice, nftCollectionId, newNftTokenId, data);37 await setVariableMetaDataExpectSuccess(Alice, nftCollectionId, newNftTokenId, data);39 });38 });49 // nft48 // nft50 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');535254 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 // nft70 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');737274 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 // nft90 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 // nft106 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 });tests/src/pallet-presence.test.tsdiffbeforeafterbothno syntactic changes
tests/src/setConstOnChainSchema.test.tsdiffbeforeafterboth11import {11import {12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,13 destroyCollectionExpectSuccess,13 destroyCollectionExpectSuccess,14 normalizeAccountId,15} from './util/helpers';14} from './util/helpers';161517chai.use(chaiAsPromised);16chai.use(chaiAsPromised);tests/src/setVariableOnChainSchema.test.tsdiffbeforeafterboth11import {11import {12 createCollectionExpectSuccess,12 createCollectionExpectSuccess,13 destroyCollectionExpectSuccess,13 destroyCollectionExpectSuccess,14 normalizeAccountId,15} from './util/helpers';14} from './util/helpers';161517chai.use(chaiAsPromised);16chai.use(chaiAsPromised);tests/src/substrate/substrate-api.tsdiffbeforeafterbothno syntactic changes
tests/src/util/helpers.tsdiffbeforeafterboth565 });565 });566}566}567567568export 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);