git.delta.rocks / unique-network / refs/commits / 32023b145527

difftreelog

Merge remote-tracking branch 'origin/develop' into feature/evm-coder-weights

Yaroslav Bolyukin2021-11-19parents: #ec4bf05 #51e104f.patch.diff
in: master

18 files changed

modifiedlaunch-config.jsondiffbeforeafterboth
9 "rpcPort": 9843,9 "rpcPort": 9843,
10 "port": 30444,10 "port": 30444,
11 "flags": [11 "flags": [
12 "--rpc-port=9843",
13 "-lparachain::candidate_validation=debug"12 "-lparachain::candidate_validation=debug"
14 ]13 ]
15 },14 },
19 "rpcPort": 9854,18 "rpcPort": 9854,
20 "port": 30555,19 "port": 30555,
21 "flags": [20 "flags": [
22 "--rpc-port=9854",
23 "-lparachain::candidate_validation=debug"21 "-lparachain::candidate_validation=debug"
24 ]22 ]
25 },23 },
29 "rpcPort": 9865,27 "rpcPort": 9865,
30 "port": 30666,28 "port": 30666,
31 "flags": [29 "flags": [
32 "--rpc-port=9865",
33 "-lparachain::candidate_validation=debug"30 "-lparachain::candidate_validation=debug"
34 ]31 ]
35 },32 },
39 "rpcPort": 9876,36 "rpcPort": 9876,
40 "port": 30777,37 "port": 30777,
41 "flags": [38 "flags": [
42 "--rpc-port=9876",
43 "-lparachain::candidate_validation=debug"39 "-lparachain::candidate_validation=debug"
44 ]40 ]
45 }41 }
70 "name": "alice",66 "name": "alice",
71 "flags": [67 "flags": [
72 "--rpc-cors=all",68 "--rpc-cors=all",
73 "--rpc-port=9933",
74 "--unsafe-rpc-external",69 "--unsafe-rpc-external",
75 "--unsafe-ws-external"70 "--unsafe-ws-external"
76 ]71 ]
82 "name": "bob",77 "name": "bob",
83 "flags": [78 "flags": [
84 "--rpc-cors=all",79 "--rpc-cors=all",
85 "--rpc-port=9934",
86 "--unsafe-rpc-external",80 "--unsafe-rpc-external",
87 "--unsafe-ws-external"81 "--unsafe-ws-external"
88 ]82 ]
modifiedpallets/nonfungible/src/lib.rsdiffbeforeafterboth
323 .checked_add(data.len() as u32)323 .checked_add(data.len() as u32)
324 .ok_or(ArithmeticError::Overflow)?;324 .ok_or(ArithmeticError::Overflow)?;
325 ensure!(325 ensure!(
326 tokens_minted < collection.limits.token_limit(),326 tokens_minted <= collection.limits.token_limit(),
327 <CommonError<T>>::CollectionTokenLimitExceeded327 <CommonError<T>>::CollectionTokenLimitExceeded
328 );328 );
329329
modifiedruntime/Cargo.tomldiffbeforeafterboth
62 'pallet-transaction-payment/std',62 'pallet-transaction-payment/std',
63 'pallet-transaction-payment-rpc-runtime-api/std',63 'pallet-transaction-payment-rpc-runtime-api/std',
64 'pallet-treasury/std',64 'pallet-treasury/std',
65 'pallet-vesting/std',65 # 'pallet-vesting/std',
66 'pallet-evm/std',66 'pallet-evm/std',
67 'pallet-evm-migration/std',67 'pallet-evm-migration/std',
68 'pallet-evm-contract-helpers/std',68 'pallet-evm-contract-helpers/std',
100 'xcm-builder/std',100 'xcm-builder/std',
101 'xcm-executor/std',101 'xcm-executor/std',
102
103 "orml-vesting/std",
102]104]
103limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']105limit-testing = ['pallet-nft/limit-testing', 'nft-data-structs/limit-testing']
104106
212git = 'https://github.com/paritytech/substrate.git'214git = 'https://github.com/paritytech/substrate.git'
213branch = 'polkadot-v0.9.12'215branch = 'polkadot-v0.9.12'
214216
215[dependencies.pallet-vesting]217# [dependencies.pallet-vesting]
216default-features = false218# default-features = false
217git = 'https://github.com/paritytech/substrate.git'219# git = 'https://github.com/paritytech/substrate.git'
218branch = 'polkadot-v0.9.12'220# branch = 'polkadot-v0.9.12'
219221
220[dependencies.sp-arithmetic]222[dependencies.sp-arithmetic]
221default-features = false223default-features = false
361branch = 'release-v0.9.12'363branch = 'release-v0.9.12'
362default-features = false364default-features = false
363365
366[dependencies.orml-vesting]
367git = "https://github.com/open-web3-stack/open-runtime-module-library"
368version = "0.4.1-dev"
369default-features = false
364370
365################################################################################371################################################################################
366# local dependencies372# local dependencies
modifiedruntime/src/lib.rsdiffbeforeafterboth
22use sp_runtime::{22use sp_runtime::{
23 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,23 Permill, Perbill, Percent, create_runtime_str, generic, impl_opaque_keys,
24 traits::{24 traits::{
25 AccountIdLookup, ConvertInto, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify,25 AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify, AccountIdConversion,
26 AccountIdConversion,
27 },26 },
28 transaction_validity::{TransactionSource, TransactionValidity},27 transaction_validity::{TransactionSource, TransactionValidity},
70use fp_rpc::TransactionStatus;69use fp_rpc::TransactionStatus;
71use sp_core::crypto::Public;70use sp_core::crypto::Public;
72use sp_runtime::{71use sp_runtime::{
73 traits::{Dispatchable, PostDispatchInfoOf},72 traits::{BlockNumberProvider, Dispatchable, PostDispatchInfoOf},
74 transaction_validity::TransactionValidityError,73 transaction_validity::TransactionValidityError,
75};74};
7675
538 type Call = Call;537 type Call = Call;
539}538}
539
540pub struct RelayChainBlockNumberProvider<T>(sp_std::marker::PhantomData<T>);
541
542impl<T: cumulus_pallet_parachain_system::Config> BlockNumberProvider
543 for RelayChainBlockNumberProvider<T>
544{
545 type BlockNumber = BlockNumber;
546
547 fn current_block_number() -> Self::BlockNumber {
548 cumulus_pallet_parachain_system::Pallet::<T>::validation_data()
549 .map(|d| d.relay_parent_number)
550 .unwrap_or_default()
551 }
552}
540553
541parameter_types! {554parameter_types! {
542 pub const MinVestedTransfer: Balance = 10 * UNIQUE;555 pub const MinVestedTransfer: Balance = 10 * UNIQUE;
556 pub const MaxVestingSchedules: u32 = 28;
543}557}
544558
545impl pallet_vesting::Config for Runtime {559impl orml_vesting::Config for Runtime {
546 type Event = Event;560 type Event = Event;
547 type Currency = Balances;561 type Currency = pallet_balances::Pallet<Runtime>;
548 type BlockNumberToBalance = ConvertInto;562 type MinVestedTransfer = MinVestedTransfer;
549 type MinVestedTransfer = MinVestedTransfer;563 type VestedTransferOrigin = EnsureSigned<AccountId>;
550 type WeightInfo = ();564 type WeightInfo = ();
551 const MAX_VESTING_SCHEDULES: u32 = 28;565 type MaxVestingSchedules = MaxVestingSchedules;
566 type BlockNumberProvider = RelayChainBlockNumberProvider<Runtime>;
552}567}
553568
554parameter_types! {569parameter_types! {
865 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,880 Treasury: pallet_treasury::{Pallet, Call, Storage, Config, Event<T>} = 34,
866 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,881 Sudo: pallet_sudo::{Pallet, Call, Storage, Config<T>, Event<T>} = 35,
867 System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,882 System: system::{Pallet, Call, Storage, Config, Event<T>} = 36,
868 Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,883 Vesting: orml_vesting::{Pallet, Storage, Call, Event<T>, Config<T>} = 37,
884 // Vesting: pallet_vesting::{Pallet, Call, Config<T>, Storage, Event<T>} = 37,
869 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,885 // Contracts: pallet_contracts::{Pallet, Call, Storage, Event<T>} = 38,
870886
871 // XCM helpers.887 // XCM helpers.
addedtests/src/eth/marketplace/MarketPlace.abidiffbeforeafterboth

no changes

addedtests/src/eth/marketplace/MarketPlace.bindiffbeforeafterboth

no changes

addedtests/src/eth/marketplace/MarketPlace.soldiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceKSM.abidiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceKSM.bindiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceKSM.soldiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceUNQ.abidiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceUNQ.bindiffbeforeafterboth

no changes

deletedtests/src/eth/marketplace/MarketPlaceUNQ.soldiffbeforeafterboth

no changes

modifiedtests/src/eth/marketplace/marketplace.test.tsdiffbeforeafterboth
1import {readFile} from 'fs/promises';1import {readFile} from 'fs/promises';
2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';2import {getBalanceSingle, transferBalanceExpectSuccess} from '../../substrate/get-balance';
3import privateKey from '../../substrate/privateKey';3import privateKey from '../../substrate/privateKey';
4import {createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';4import {addToAllowListExpectSuccess, confirmSponsorshipExpectSuccess, createCollectionExpectSuccess, createFungibleItemExpectSuccess, createItemExpectSuccess, getTokenOwner, setCollectionSponsorExpectSuccess, transferExpectSuccess, transferFromExpectSuccess} from '../../util/helpers';
5import {collectionIdToAddress, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase} from '../util/helpers';5import {collectionIdToAddress, contractHelpers, createEthAccountWithBalance, executeEthTxOnSub, GAS_ARGS, itWeb3, subToEth, subToEthLowercase} from '../util/helpers';
6import {evmToAddress} from '@polkadot/util-crypto';6import {evmToAddress} from '@polkadot/util-crypto';
7import nonFungibleAbi from '../nonFungibleAbi.json';7import nonFungibleAbi from '../nonFungibleAbi.json';
8import fungibleAbi from '../fungibleAbi.json';8import fungibleAbi from '../fungibleAbi.json';
13describe('Matcher contract usage', () => {13describe('Matcher contract usage', () => {
14 itWeb3('With UNQ', async ({api, web3}) => {14 itWeb3('With UNQ', async ({api, web3}) => {
15 const matcherOwner = await createEthAccountWithBalance(api, web3);15 const matcherOwner = await createEthAccountWithBalance(api, web3);
16 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceUNQ.abi`)).toString()), undefined, {16 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
17 from: matcherOwner,17 from: matcherOwner,
18 ...GAS_ARGS,18 ...GAS_ARGS,
19 });19 });
20 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceUNQ.bin`)).toString()}).send({from: matcherOwner});20 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments:[matcherOwner]}).send({from: matcherOwner});
21 const helpers = contractHelpers(web3, matcherOwner);
22 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
23 await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
2124
22 const alice = privateKey('//Alice');25 const alice = privateKey('//Alice');
23 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});26 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
24 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});27 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
28 await setCollectionSponsorExpectSuccess(collectionId, alice.address);
29 await confirmSponsorshipExpectSuccess(collectionId);
30
31 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
32 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
2533
26 const seller = privateKey('//Bob');34 const seller = privateKey('//Bob');
27
28 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);35 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
29
30 // To transfer item to matcher it first needs to be transfered to EVM account of bob
31 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});36 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
32 // Fees will be paid from EVM account, so we should have some balance here37
33 await transferBalanceExpectSuccess(api, seller, evmToAddress(subToEth(seller.address)), 10n ** 18n);38 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
39
40 // To transfer item to matcher it first needs to be transfered to EVM account of bob
34 await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), 10n ** 18n);41 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
3542
36 // Token is owned by seller initially43 // Token is owned by seller initially
37 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});44 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
3845
39 // Ask46 // Ask
40 {47 {
41 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));48 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
42 await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000000', evmCollection.options.address, tokenId, 1));49 await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
43 }50 }
4451
45 // Token is transferred to matcher52 // Token is transferred to matcher
48 // Buy55 // Buy
49 {56 {
50 const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);57 const sellerBalanceBeforePurchase = await getBalanceSingle(api, seller.address);
51 // There is two functions named 'buy', so we should provide full signature
52 await executeEthTxOnSub(web3, api, alice, matcher, m => m['buy(address,uint256)'](evmCollection.options.address, tokenId), {value: PRICE});58 await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId), {value: PRICE});
53 expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);59 expect(await getBalanceSingle(api, seller.address) - sellerBalanceBeforePurchase === PRICE);
54 }60 }
5561
64 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Substrate: alice.address});70 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Substrate: alice.address});
65 });71 });
6672
73 // selling for custom tokens excluded from release
67 itWeb3('With custom ERC20', async ({api, web3}) => {74 itWeb3.skip('With custom ERC20', async ({api, web3}) => {
68 const matcherOwner = await createEthAccountWithBalance(api, web3);75 const matcherOwner = await createEthAccountWithBalance(api, web3);
69 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceUNQ.abi`)).toString()), undefined, {76 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
70 from: matcherOwner,77 from: matcherOwner,
71 ...GAS_ARGS,78 ...GAS_ARGS,
72 });79 });
73 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceUNQ.bin`)).toString()}).send({from: matcherOwner});80 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
7481
75 const alice = privateKey('//Alice');82 const alice = privateKey('//Alice');
76 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});83 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
131 itWeb3('With escrow', async ({api, web3}) => {138 itWeb3('With escrow', async ({api, web3}) => {
132 const matcherOwner = await createEthAccountWithBalance(api, web3);139 const matcherOwner = await createEthAccountWithBalance(api, web3);
133 const escrow = await createEthAccountWithBalance(api, web3);140 const escrow = await createEthAccountWithBalance(api, web3);
134 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlaceKSM.abi`)).toString()), undefined, {141 const matcherContract = new web3.eth.Contract(JSON.parse((await readFile(`${__dirname}/MarketPlace.abi`)).toString()), undefined, {
135 from: matcherOwner,142 from: matcherOwner,
136 ...GAS_ARGS,143 ...GAS_ARGS,
137 });144 });
138 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlaceKSM.bin`)).toString(), arguments: [escrow]}).send({from: matcherOwner});145 const matcher = await matcherContract.deploy({data: (await readFile(`${__dirname}/MarketPlace.bin`)).toString(), arguments: [matcherOwner]}).send({from: matcherOwner});
139146 await matcher.methods.setEscrow(escrow).send({from: matcherOwner});
140 const ksmToken = 11;147 const helpers = contractHelpers(web3, matcherOwner);
148 await helpers.methods.toggleSponsoring(matcher.options.address, true).send({from: matcherOwner});
149 await helpers.methods.setSponsoringRateLimit(matcher.options.address, 1).send({from: matcherOwner});
141150
142 const alice = privateKey('//Alice');151 const alice = privateKey('//Alice');
143 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});152 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
144 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});153 const evmCollection = new web3.eth.Contract(nonFungibleAbi as any, collectionIdToAddress(collectionId), {from: matcherOwner});
154 await setCollectionSponsorExpectSuccess(collectionId, alice.address);
155 await confirmSponsorshipExpectSuccess(collectionId);
156
157 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(alice.address), true).send({from: matcherOwner});
158 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(alice.address)));
145159
146 const seller = privateKey('//Bob');160 const seller = privateKey('//Bob');
147
148 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);161 await helpers.methods.toggleAllowed(matcher.options.address, subToEth(seller.address), true).send({from: matcherOwner});
149
150 // To transfer item to matcher it first needs to be transfered to EVM account of bob
151 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});162 await addToAllowListExpectSuccess(alice, collectionId, evmToAddress(subToEth(seller.address)));
152 // Fees will be paid from EVM account, so we should have some balance here163
153 await transferBalanceExpectSuccess(api, seller, evmToAddress(subToEth(seller.address)), 10n ** 18n);164 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT', seller.address);
165
166 // To transfer item to matcher it first needs to be transfered to EVM account of bob
154 await transferBalanceExpectSuccess(api, alice, evmToAddress(subToEth(alice.address)), 10n ** 18n);167 await transferExpectSuccess(collectionId, tokenId, seller, {Ethereum: subToEth(seller.address)});
155168
156 // Token is owned by seller initially169 // Token is owned by seller initially
157 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});170 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: subToEthLowercase(seller.address)});
158171
159 // Ask172 // Ask
160 {173 {
161 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));174 await executeEthTxOnSub(web3, api, seller, evmCollection, m => m.approve(matcher.options.address, tokenId));
162 await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, ksmToken, evmCollection.options.address, tokenId, 1));175 await executeEthTxOnSub(web3, api, seller, matcher, m => m.setAsk(PRICE, '0x0000000000000000000000000000000000000001', evmCollection.options.address, tokenId));
163 }176 }
164177
165 // Token is transferred to matcher178 // Token is transferred to matcher
166 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: matcher.options.address.toLowerCase()});179 expect(await getTokenOwner(api, collectionId, tokenId)).to.be.deep.equal({Ethereum: matcher.options.address.toLowerCase()});
167180
168 // Give buyer KSM181 // Give buyer KSM
169 await matcher.methods.deposit(PRICE, ksmToken, subToEth(alice.address)).send({from: escrow});182 await matcher.methods.depositKSM(PRICE, subToEth(alice.address)).send({from: escrow});
170183
171 // Buy184 // Buy
172 {185 {
173 expect(await matcher.methods.escrowBalance(ksmToken, subToEth(seller.address)).call()).to.be.equal('0');186 expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal('0');
174 expect(await matcher.methods.escrowBalance(ksmToken, subToEth(alice.address)).call()).to.be.equal(PRICE.toString());187 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal(PRICE.toString());
175188
176 await executeEthTxOnSub(web3, api, alice, matcher, m => m.buy(evmCollection.options.address, tokenId));189 await executeEthTxOnSub(web3, api, alice, matcher, m => m.buyKSM(evmCollection.options.address, tokenId, subToEth(alice.address), subToEth(alice.address)));
177190
178 // Price is removed from buyer balance, and added to seller191 // Price is removed from buyer balance, and added to seller
179 expect(await matcher.methods.escrowBalance(ksmToken, subToEth(alice.address)).call()).to.be.equal('0');192 expect(await matcher.methods.balanceKSM(subToEth(alice.address)).call()).to.be.equal('0');
180 expect(await matcher.methods.escrowBalance(ksmToken, subToEth(seller.address)).call()).to.be.equal(PRICE.toString());193 expect(await matcher.methods.balanceKSM(subToEth(seller.address)).call()).to.be.equal(PRICE.toString());
181 }194 }
182195
183 // Token is transferred to evm account of alice196 // Token is transferred to evm account of alice
modifiedtests/src/limits.test.tsdiffbeforeafterboth
78 });78 });
79});79});
8080
81describe('Sponsor timeout (NFT)', () => {81describe.skip('Sponsor timeout (NFT) (only for special chain limits test)', () => {
82 let alice: IKeyringPair;82 let alice: IKeyringPair;
83 let bob: IKeyringPair;83 let bob: IKeyringPair;
84 let charlie: IKeyringPair;84 let charlie: IKeyringPair;
91 });91 });
92 });92 });
9393
94 it('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {94 it.skip('Collection limits have greater timeout value than chain limits, collection limits are enforced', async () => {
95 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});95 const collectionId = await createCollectionExpectSuccess({mode: {type: 'NFT'}});
96 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});96 await setCollectionLimitsExpectSuccess(alice, collectionId, {sponsorTransferTimeout: 7});
97 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');97 const tokenId = await createItemExpectSuccess(alice, collectionId, 'NFT');
141 });141 });
142});142});
143143
144describe('Sponsor timeout (Fungible)', () => {144describe.skip('Sponsor timeout (Fungible) (only for special chain limits test)', () => {
145 let alice: IKeyringPair;145 let alice: IKeyringPair;
146 let bob: IKeyringPair;146 let bob: IKeyringPair;
147 let charlie: IKeyringPair;147 let charlie: IKeyringPair;
208 });208 });
209});209});
210210
211describe('Sponsor timeout (ReFungible)', () => {211describe.skip('Sponsor timeout (ReFungible) (only for special chain limits test)', () => {
212 let alice: IKeyringPair;212 let alice: IKeyringPair;
213 let bob: IKeyringPair;213 let bob: IKeyringPair;
214 let charlie: IKeyringPair;214 let charlie: IKeyringPair;
modifiedtests/src/overflow.test.tsdiffbeforeafterboth
13chai.use(chaiAsPromised);13chai.use(chaiAsPromised);
14const expect = chai.expect;14const expect = chai.expect;
1515
16describe('Integration Test fungible overflows', () => {16describe.skip('Integration Test fungible overflows', () => {
17 let alice: IKeyringPair;17 let alice: IKeyringPair;
18 let bob: IKeyringPair;18 let bob: IKeyringPair;
19 let charlie: IKeyringPair;19 let charlie: IKeyringPair;
modifiedtests/src/setOffchainSchema.test.tsdiffbeforeafterboth
40 await setOffchainSchemaExpectSuccess(alice, collectionId, DATA);40 await setOffchainSchemaExpectSuccess(alice, collectionId, DATA);
41 const collection = await queryCollectionExpectSuccess(api, collectionId);41 const collection = await queryCollectionExpectSuccess(api, collectionId);
4242
43 expect(collection.offchainSchema).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));43 expect('0x' + Buffer.from(collection.offchainSchema).toString('hex')).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
44 });44 });
45 });45 });
4646
51 await setOffchainSchemaExpectSuccess(bob, collectionId, DATA);51 await setOffchainSchemaExpectSuccess(bob, collectionId, DATA);
52 const collection = await queryCollectionExpectSuccess(api, collectionId);52 const collection = await queryCollectionExpectSuccess(api, collectionId);
5353
54 expect(collection.offchainSchema).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));54 expect('0x' + Buffer.from(collection.offchainSchema).toString('hex')).to.be.equal('0x' + Buffer.from(DATA).toString('hex'));
55 });55 });
56 });56 });
57});57});
modifiedtests/src/util/helpers.tsdiffbeforeafterboth
905 await usingApi(async (api: ApiPromise) => {905 await usingApi(async (api: ApiPromise) => {
906 const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);906 const transferTx = api.tx.nft.transfer(normalizeAccountId(recipient.address), collectionId, tokenId, value);
907 const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;907 const events = await expect(submitTransactionExpectFailAsync(sender, transferTx)).to.be.rejected;
908 if (events && Array.isArray(events)) {
909 const result = getCreateCollectionResult(events);908 const result = getGenericResult(events);
909 // if (events && Array.isArray(events)) {
910 // const result = getCreateCollectionResult(events);
910 // tslint:disable-next-line:no-unused-expression911 // tslint:disable-next-line:no-unused-expression
911 expect(result.success).to.be.false;912 expect(result.success).to.be.false;
912 }913 //}
913 });914 });
914}915}
915916