Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit an event on toggle function pause #297

Open
tjcloa opened this issue Jun 30, 2021 · 5 comments · Fixed by #357
Open

Emit an event on toggle function pause #297

tjcloa opened this issue Jun 30, 2021 · 5 comments · Fixed by #357

Comments

@tjcloa
Copy link
Contributor

tjcloa commented Jun 30, 2021

No description provided.

@computerphysicslab
Copy link
Contributor

Sovryn-smart-contracts/contracts/connectors/loantoken/LoanTokenSettingsLowerAdmin.sol
175,9: function toggleFunctionPause(

Sovryn-smart-contracts/contracts/mockup/previousLoanToken/PreviousLoanTokenSettingsLowerAdmin.sol
114,9: function toggleFunctionPause(

@computerphysicslab
Copy link
Contributor

Adding test to check event is really emitted.

Sovryn-smart-contracts/tests-js/loan-token/Administration.test.js
127,25: await localLoanToken.toggleFunctionPause(functionSignature, true);
137,25: await localLoanToken.toggleFunctionPause(functionSignature, false);
147,38: await expectRevert(localLoanToken.toggleFunctionPause("mint(address,uint256)", true, { from: accounts[1] }), "onlyPauser");

@computerphysicslab
Copy link
Contributor

Hardhat testing what events were emitted with what arguments:

According to https://ethereum-waffle.readthedocs.io/en/latest/matchers.html?highlight=events#emitting-events this code should work:

await expect(localLoanToken.toggleFunctionPause(functionSignature, true))
    .to.emit(localLoanToken, 'ToggleFunctionPause')
    .withArgs(functionSignature, true);

But it is not! So I had to use this one:

let tx = await localLoanToken.toggleFunctionPause(functionSignature, true);
// Check event is properly emitted
await expectEvent.inTransaction(tx.receipt.rawLogs[0].transactionHash, LoanTokenLogicStandard, "ToggleFunctionPause", {
    funcId: functionSignature,
    isPaused: true,
});

@computerphysicslab
Copy link
Contributor

After adding event, tests are not passing:

Error: Transaction reverted: trying to deploy a contract whose code is too large

@computerphysicslab
Copy link
Contributor

Added event ToggleFunctionPause:
6dec0cf

Added event check on test:
b7bcb05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment