Hi Team,
Is there any way to test the contract modifiers in the hardhat development env.
Please guide.
Thanks.
Hi Team,
Is there any way to test the contract modifiers in the hardhat development env.
Please guide.
Thanks.
You need to define an auxiliary contract that uses the modifiers, and then test against this contract.
For example in order to test the modifier onlyOwner
you could define a contract like:
contract TestOwnable {
function withOnlyOwner() public onlyOwner {}
}
And then in your tests you can create an instance of this contract and invoke the function.
Not sure if I understand the question.