difftreelog
Tests fixed
in: master
2 files changed
pallets/nonfungible/src/lib.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/lib.rs
+++ b/pallets/nonfungible/src/lib.rs
@@ -177,18 +177,18 @@
.checked_add(1)
.ok_or(ArithmeticError::Overflow)?;
- let balance = <AccountBalance<T>>::get((collection.id, sender))
+ let balance = <AccountBalance<T>>::get((collection.id, token_data.owner.clone()))
.checked_sub(1)
.ok_or(ArithmeticError::Overflow)?;
if balance == 0 {
- <AccountBalance<T>>::remove((collection.id, sender));
+ <AccountBalance<T>>::remove((collection.id, token_data.owner.clone()));
} else {
- <AccountBalance<T>>::insert((collection.id, sender), balance);
+ <AccountBalance<T>>::insert((collection.id, token_data.owner.clone()), balance);
}
// =========
- <Owned<T>>::remove((collection.id, &token_data.owner, token));
+ <Owned<T>>::remove((collection.id, &token_data.owner.clone(), token));
<TokensBurnt<T>>::insert(collection.id, burnt);
<TokenData<T>>::remove((collection.id, token));
let old_spender = <Allowance<T>>::take((collection.id, token));
tests/src/inflation.test.tsdiffbeforeafterboth1//2// This file is subject to the terms and conditions defined in3// file 'LICENSE', which is part of this source code package.4//56import chai from 'chai';7import chaiAsPromised from 'chai-as-promised';8import {default as usingApi} from './substrate/substrate-api';910chai.use(chaiAsPromised);11const expect = chai.expect;1213describe('integration test: Inflation', () => {14 it('First year inflation is 10%', async () => {15 await usingApi(async (api) => {1617 const blockInterval = (api.consts.inflation.inflationBlockInterval).toBigInt();18 const totalIssuanceStart = (await api.query.inflation.startingYearTotalIssuance()).toBigInt();19 const blockInflation = (await api.query.inflation.blockInflation()).toBigInt();2021 const YEAR = 5259600n; // Blocks in one year22 const totalExpectedInflation = totalIssuanceStart / 10n;23 const totalActualInflation = blockInflation * YEAR / blockInterval;2425 const tolerance = 0.00001; // Relative difference per year between theoretical and actual inflation26 let abs = totalExpectedInflation / totalActualInflation - 1n;27 if (abs < 0n) {28 abs = -abs;29 }30 expect(abs <= tolerance).to.be.true;31 });32 });3334});