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

difftreelog

sending fees to treasury + integration test

Greg Zaitsev2020-12-21parent: #feee462.patch.diff
in: master

5 files changed

modifiedruntime/src/lib.rsdiffbeforeafterboth
--- a/runtime/src/lib.rs
+++ b/runtime/src/lib.rs
@@ -315,7 +315,7 @@
 	type Balance = Balance;
 	/// The ubiquitous event type.
 	type Event = Event;
-	type DustRemoval = ();
+	type DustRemoval = Treasury;
 	type ExistentialDeposit = ExistentialDeposit;
 	type AccountStore = System;
 	type WeightInfo = ();
@@ -357,7 +357,7 @@
 
 impl pallet_transaction_payment::Trait for Runtime {
     type Currency = pallet_balances::Module<Runtime>;
-    type OnTransactionPayment = ();
+    type OnTransactionPayment = Treasury;
     type TransactionByteFee = TransactionByteFee;
     type WeightToFee = IdentityFee<Balance>;
     type FeeMultiplierUpdate =  ();
modifiedtests/package-lock.jsondiffbeforeafterboth
--- a/tests/package-lock.json
+++ b/tests/package-lock.json
@@ -13,13 +13,12 @@
         "@polkadot/api-contract": "^2.3.1",
         "@polkadot/types": "^2.3.1",
         "@polkadot/util": "^3.4.1",
-        "@types/bn.js": "^4.11.6",
+        "bignumber.js": "^9.0.0",
         "chai-as-promised": "^7.1.1"
       },
       "devDependencies": {
         "@polkadot/dev": "^0.52.11",
         "@polkadot/ts": "^0.3.41",
-        "@types/bn.js": "^4.11.6",
         "@types/chai": "^4.2.12",
         "@types/chai-as-promised": "^7.1.3",
         "@types/mocha": "^8.0.3",
@@ -7114,6 +7113,14 @@
         "node": "*"
       }
     },
+    "node_modules/bignumber.js": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
+      "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA==",
+      "engines": {
+        "node": "*"
+      }
+    },
     "node_modules/binary-extensions": {
       "version": "1.13.1",
       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
@@ -34960,6 +34967,11 @@
       "integrity": "sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ==",
       "dev": true
     },
+    "bignumber.js": {
+      "version": "9.0.1",
+      "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-9.0.1.tgz",
+      "integrity": "sha512-IdZR9mh6ahOBv/hYGiXyVuyCetmGJhtYkqLBpTStdhEGjegpPlUawydyaF3pbIOFynJTpllEs+NP+CS9jKFLjA=="
+    },
     "binary-extensions": {
       "version": "1.13.1",
       "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz",
modifiedtests/package.jsondiffbeforeafterboth
--- a/tests/package.json
+++ b/tests/package.json
@@ -6,7 +6,6 @@
   "devDependencies": {
     "@polkadot/dev": "^0.52.11",
     "@polkadot/ts": "^0.3.41",
-    "@types/bn.js": "^4.11.6",
     "@types/chai": "^4.2.12",
     "@types/chai-as-promised": "^7.1.3",
     "@types/mocha": "^8.0.3",
@@ -27,7 +26,7 @@
     "@polkadot/api-contract": "^2.3.1",
     "@polkadot/types": "^2.3.1",
     "@polkadot/util": "^3.4.1",
-    "@types/bn.js": "^4.11.6",
+    "bignumber.js": "^9.0.0",
     "chai-as-promised": "^7.1.1"
   },
   "standard": {
addedtests/src/crefitFeesToTreasury.test.tsdiffbeforeafterboth

no changes

modifiedtests/src/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/util/helpers.ts
+++ b/tests/src/util/helpers.ts
@@ -9,11 +9,28 @@
 chai.use(chaiAsPromised);
 const expect = chai.expect;
 
+type GenericResult = {
+  success: boolean,
+};
+
 type CreateCollectionResult = {
   success: boolean,
   collectionId: number
 };
 
+export function getGenericResult(events: EventRecord[]): GenericResult {
+  let result: GenericResult = {
+    success: false
+  }
+  events.forEach(({ phase, event: { data, method, section } }) => {
+    // console.log(`    ${phase}: ${section}.${method}:: ${data}`);
+    if (method == 'ExtrinsicSuccess') {
+      result.success = true;
+    }
+  });
+  return result;
+}
+
 function getCreateCollectionResult(events: EventRecord[]): CreateCollectionResult {
   let success = false;
   let collectionId: number = 0;