From 72c7cbd1ea21484ccee7971e04600858bc6865e2 Mon Sep 17 00:00:00 2001 From: Yaroslav Bolyukin Date: Wed, 28 Jul 2021 10:34:42 +0000 Subject: [PATCH] test: fix sponsoring for updated logic --- --- 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; --- 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 --- 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(cb: (web3: Web3) => Promise | T): Promise { -- gitstuff