Why I am getting the error in the modifier function its showing red underline under the _amount variable name.
I also want to ask about whether the require function works inside the modifier because when I wrote my statement "require(_checkOwner() || allowance[msg.sender] >_amount,"You are not allowed!");" inside the modifier it showed me error. So now I am trying with defining the above require statement inside a function and then calling it in modifier. Is this the correct way?? Also please answer about why I am getting error for _amount in the statement which is being called inside modifier function "requiredCondition(uint _amount);".
pragma solidity ^0.8.16;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/access/Ownable.sol";
contract SharedWallet is Ownable{
mapping(address => uint) public allowance;
fallback () external payable{
}
receive () external payable {
}
modifier ownerOrAllowed(uint _amount) {
requiredCondition(uint _amount);
_;
}
function requiredCondition(uint _amount) public {
require(_checkOwner() || allowance[msg.sender] >_amount,"You are not allowed!");
}
function addAllowance(address _who, uint _amount) public onlyOwner{
allowance[_who] = _amount;
}
function withdrawMoney(address payable _to, uint _amount) public ownerOrAllowed(_amount){
_to.transfer(_amount);
}
}