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
138 "outputs": [],138 "outputs": [],
139 "stateMutability": "nonpayable",139 "stateMutability": "nonpayable",
140 "type": "function"140 "type": "function"
141 }141 },
142 {
143 "inputs": [
144 {
145 "internalType": "address",
146 "name": "target",
147 "type": "address"
148 },
149 {
150 "internalType": "uint32",
151 "name": "limit",
152 "type": "uint32"
153 }
154 ],
155 "name": "setSponsoringRateLimit",
156 "outputs": [],
157 "stateMutability": "nonpayable",
158 "type": "function"
159 }
142]160]
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> {