difftreelog
test fix sponsoring for updated logic
in: master
3 files changed
tests/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;
tests/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
tests/src/eth/util/helpers.tsdiffbeforeafterboth18import privateKey from '../../substrate/privateKey';18import privateKey from '../../substrate/privateKey';19import contractHelpersAbi from './contractHelpersAbi.json';19import contractHelpersAbi from './contractHelpersAbi.json';202021export const GAS_ARGS = { gas: 0x10000000, gasPrice: '0x01' };21export const GAS_ARGS = { gas: 0x1000000, gasPrice: '0x01' };222223let 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> {