git.delta.rocks / unique-network / refs/commits / 72c7cbd1ea21

difftreelog

test fix sponsoring for updated logic

Yaroslav Bolyukin2021-07-28parent: #d5c4f58.patch.diff
in: master

3 files changed

modifiedtests/src/eth/sponsoring.test.tsdiffbeforeafterboth
17 await waitNewBlocks(api, 1);17 await waitNewBlocks(api, 1);
18 18
19 const helpers = contractHelpers(web3Http, owner);19 const helpers = contractHelpers(web3Http, owner);
20 await helpers.methods.toggleAllowlist(flipper.options.address, true).send({ from: owner });
21 await waitNewBlocks(api, 1);
22 await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({ from: owner });
23 await waitNewBlocks(api, 1);
24
20 expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;25 expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;
21 await helpers.methods.toggleSponsoring(flipper.options.address, true).send({from: owner});26 await helpers.methods.toggleSponsoring(flipper.options.address, true).send({from: owner});
27 await waitNewBlocks(api, 1);
28 await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});
22 await waitNewBlocks(api, 1);29 await waitNewBlocks(api, 1);
23 expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;30 expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;
2431
51 await waitNewBlocks(api, 1);58 await waitNewBlocks(api, 1);
52 59
53 const helpers = contractHelpers(web3Http, owner);60 const helpers = contractHelpers(web3Http, owner);
61 await helpers.methods.toggleAllowlist(collector.options.address, true).send({ from: owner });
62 await waitNewBlocks(api, 1);
63 await helpers.methods.toggleAllowed(collector.options.address, caller, true).send({ from: owner });
64 await waitNewBlocks(api, 1);
65
54 expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.false;66 expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.false;
55 await helpers.methods.toggleSponsoring(collector.options.address, true).send({from: owner});67 await helpers.methods.toggleSponsoring(collector.options.address, true).send({ from: owner });
68 await waitNewBlocks(api, 1);
69 await helpers.methods.setSponsoringRateLimit(collector.options.address, 0).send({ from: owner });
56 await waitNewBlocks(api, 1);70 await waitNewBlocks(api, 1);
57 expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.true;71 expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.true;
5872
modifiedtests/src/eth/util/contractHelpersAbi.jsondiffbeforeafterboth
--- a/tests/src/eth/util/contractHelpersAbi.json
+++ b/tests/src/eth/util/contractHelpersAbi.json
@@ -138,5 +138,23 @@
         "outputs": [],
         "stateMutability": "nonpayable",
         "type": "function"
+    },
+    {
+        "inputs": [
+            {
+                "internalType": "address",
+                "name": "target",
+                "type": "address"
+            },
+            {
+                "internalType": "uint32",
+                "name": "limit",
+                "type": "uint32"
+            }
+        ],
+        "name": "setSponsoringRateLimit",
+        "outputs": [],
+        "stateMutability": "nonpayable",
+        "type": "function"
     }
 ]
\ No newline at end of file
modifiedtests/src/eth/util/helpers.tsdiffbeforeafterboth
--- a/tests/src/eth/util/helpers.ts
+++ b/tests/src/eth/util/helpers.ts
@@ -18,7 +18,7 @@
 import privateKey from '../../substrate/privateKey';
 import contractHelpersAbi from './contractHelpersAbi.json';
 
-export const GAS_ARGS = { gas: 0x10000000, gasPrice: '0x01' };
+export const GAS_ARGS = { gas: 0x1000000, gasPrice: '0x01' };
 
 let web3Connected = false;
 export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {