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
25const Treasury = "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z";25const Treasury = "5EYCAe5ijiYfyeZ2JJCGq56LmPyNRAKzpG4QkoQkkQNB5e6Z";
26const saneMinimumFee = 0.05;26const saneMinimumFee = 0.05;
27const saneMaximumFee = 0.5;27const saneMaximumFee = 0.5;
28const createCollectionDeposit = 100;
2829
29let alice: IKeyringPair;30let alice: IKeyringPair;
30let bob: IKeyringPair;31let bob: IKeyringPair;
127 const aliceBalanceAfter = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());128 const aliceBalanceAfter = new BigNumber((await api.query.system.account(alicesPublicKey)).data.free.toString());
128 const fee = aliceBalanceBefore.minus(aliceBalanceAfter);129 const fee = aliceBalanceBefore.minus(aliceBalanceAfter);
129130
130 expect(fee.dividedBy(1e15).toNumber()).to.be.lessThan(saneMaximumFee);131 expect(fee.dividedBy(1e15).toNumber()).to.be.lessThan(saneMaximumFee + createCollectionDeposit);
131 expect(fee.dividedBy(1e15).toNumber()).to.be.greaterThan(saneMinimumFee);132 expect(fee.dividedBy(1e15).toNumber()).to.be.greaterThan(saneMinimumFee + createCollectionDeposit);
132 });133 });
133 });134 });
134135