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

difftreelog

Fix allowlistCross tests

Max Andreev2022-12-01parent: #09a417b.patch.diff
in: master

1 file changed

modifiedtests/src/eth/allowlist.test.tsdiffbeforeafterboth
106 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;106 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;
107 await collectionEvm.methods.addToCollectionAllowListCross(userCrossSub).send({from: owner});107 await collectionEvm.methods.addToCollectionAllowListCross(userCrossSub).send({from: owner});
108 await collectionEvm.methods.addToCollectionAllowListCross(userCrossEth).send({from: owner});108 await collectionEvm.methods.addToCollectionAllowListCross(userCrossEth).send({from: owner});
109 await collectionEvm.methods.addToCollectionAllowListCross(ownerCrossEth).send({from: owner});
109 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.true;110 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.true;
110 expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.true;111 expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.true;
111 expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.true;112 expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.true;
112 expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.true;113 expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.true;
113114
114 // allowlisted account can transfer tokens:
115 await collectionEvm.methods.mint(userEth).send();115 await collectionEvm.methods.mint(userEth).send(); // token #1
116 await collectionEvm.methods.mint(userEth).send(); // token #2
116 await collectionEvm.methods.setCollectionAccess(1).send();117 await collectionEvm.methods.setCollectionAccess(1).send();
118
119 // allowlisted account can transfer and transferCross:
117 await collectionEvm.methods.transfer(owner, 1).send({from: userEth}); // FIXME: why not?120 await collectionEvm.methods.transfer(owner, 1).send({from: userEth});
118 // await collectionEvm.methods.transferCross(ownerCrossEth, 1).send({from: userEth}); // FIXME: why not?121 await collectionEvm.methods.transferCross(userCrossSub, 2).send({from: userEth});
119 expect(await helper.nft.getTokenOwner(collectionId, 1)).to.eq({Ethereum: owner});122 expect(await helper.nft.getTokenOwner(collectionId, 1)).to.deep.eq({Ethereum: owner});
120 123 expect(await helper.nft.getTokenOwner(collectionId, 2)).to.deep.eq({Substrate: userSub.address});
124
121 // can removeFromCollectionAllowListCross125 // can removeFromCollectionAllowListCross:
122 await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossSub).send({from: owner});126 await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossSub).send({from: owner});
123 await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossEth).send({from: owner});127 await collectionEvm.methods.removeFromCollectionAllowListCross(userCrossEth).send({from: owner});
124 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;128 expect(await helper.collection.allowed(collectionId, {Substrate: userSub.address})).to.be.false;
125 expect(await helper.collection.allowed(collectionId, {Substrate: userEth})).to.be.false;129 expect(await helper.collection.allowed(collectionId, {Ethereum: userEth})).to.be.false;
130 expect(await collectionEvm.methods.allowlistedCross(userCrossSub).call({from: owner})).to.be.false;
126 expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.false;131 expect(await collectionEvm.methods.allowlistedCross(userCrossEth).call({from: owner})).to.be.false;
127132
128 // cannot transfer anymore133 // cannot transfer anymore
129 await collectionEvm.methods.mint(userEth).send();134 await collectionEvm.methods.mint(userEth).send();
130 await expect(collectionEvm.methods.transfer(owner, 2).send({from: userEth})).to.be.rejected;135 await expect(collectionEvm.methods.transfer(owner, 2).send({from: userEth})).to.be.rejectedWith(/Transaction has been reverted/);
131 });136 });
132137
133 // Soft-deprecated138 // Soft-deprecated