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
--- a/tests/src/eth/sponsoring.test.ts
+++ b/tests/src/eth/sponsoring.test.ts
@@ -17,9 +17,16 @@
       await waitNewBlocks(api, 1);
       
       const helpers = contractHelpers(web3Http, owner);
+      await helpers.methods.toggleAllowlist(flipper.options.address, true).send({ from: owner });
+      await waitNewBlocks(api, 1);
+      await helpers.methods.toggleAllowed(flipper.options.address, caller, true).send({ from: owner });
+      await waitNewBlocks(api, 1);
+
       expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.false;
       await helpers.methods.toggleSponsoring(flipper.options.address, true).send({from: owner});
       await waitNewBlocks(api, 1);
+      await helpers.methods.setSponsoringRateLimit(flipper.options.address, 0).send({from: owner});
+      await waitNewBlocks(api, 1);
       expect(await helpers.methods.sponsoringEnabled(flipper.options.address).call()).to.be.true;
 
       await transferBalanceToEth(api, alice, flipper.options.address);
@@ -49,10 +56,17 @@
 
       const collector = await deployCollector(web3Http, owner);
       await waitNewBlocks(api, 1);
-      
+     
       const helpers = contractHelpers(web3Http, owner);
+      await helpers.methods.toggleAllowlist(collector.options.address, true).send({ from: owner });
+      await waitNewBlocks(api, 1);
+      await helpers.methods.toggleAllowed(collector.options.address, caller, true).send({ from: owner });
+      await waitNewBlocks(api, 1);
+
       expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.false;
-      await helpers.methods.toggleSponsoring(collector.options.address, true).send({from: owner});
+      await helpers.methods.toggleSponsoring(collector.options.address, true).send({ from: owner });
+      await waitNewBlocks(api, 1);
+      await helpers.methods.setSponsoringRateLimit(collector.options.address, 0).send({ from: owner });
       await waitNewBlocks(api, 1);
       expect(await helpers.methods.sponsoringEnabled(collector.options.address).call()).to.be.true;
 
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
18import privateKey from '../../substrate/privateKey';18import privateKey from '../../substrate/privateKey';
19import contractHelpersAbi from './contractHelpersAbi.json';19import contractHelpersAbi from './contractHelpersAbi.json';
2020
21export const GAS_ARGS = { gas: 0x10000000, gasPrice: '0x01' };21export const GAS_ARGS = { gas: 0x1000000, gasPrice: '0x01' };
2222
23let web3Connected = false;23let web3Connected = false;
24export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {24export async function usingWeb3<T>(cb: (web3: Web3) => Promise<T> | T): Promise<T> {