git.delta.rocks / unique-network / refs/commits / 52d04b4c4f04

difftreelog

Fix fee sanity test

Greg Zaitsev2021-03-20parent: #6f9cded.patch.diff
in: master

2 files changed

modifiedpallets/nft/src/lib.rsdiffbeforeafterboth
665 // Anyone can create a collection665 // Anyone can create a collection
666 let who = ensure_signed(origin)?;666 let who = ensure_signed(origin)?;
667667
668 // Take a (non-refundable) deposit of collection creation
668 let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();669 let mut imbalance = <<<T as Config>::Currency as Currency<T::AccountId>>::PositiveImbalance>::zero();
669 imbalance.subsume(<<T as Config>::Currency as Currency<T::AccountId>>::deposit_creating(670 imbalance.subsume(<<T as Config>::Currency as Currency<T::AccountId>>::deposit_creating(
670 &T::TreasuryAccountId::get(),671 &T::TreasuryAccountId::get(),
modifiedtests/src/creditFeesToTreasury.test.tsdiffbeforeafterboth
--- a/tests/src/creditFeesToTreasury.test.ts
+++ b/tests/src/creditFeesToTreasury.test.ts
@@ -25,6 +25,7 @@
 const Treasury = "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z";
 const saneMinimumFee = 0.05;
 const saneMaximumFee = 0.5;
+const createCollectionDeposit = 100;
 
 let alice: IKeyringPair;
 let bob: IKeyringPair;
@@ -127,8 +128,8 @@
       const aliceBalanceAfter = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());
       const fee = aliceBalanceBefore.minus(aliceBalanceAfter);
 
-      expect(fee.dividedBy(1e15).toNumber()).to.be.lessThan(saneMaximumFee);
-      expect(fee.dividedBy(1e15).toNumber()).to.be.greaterThan(saneMinimumFee);
+      expect(fee.dividedBy(1e15).toNumber()).to.be.lessThan(saneMaximumFee + createCollectionDeposit);
+      expect(fee.dividedBy(1e15).toNumber()).to.be.greaterThan(saneMinimumFee  + createCollectionDeposit);
     });
   });