I have a function in a base contract that could have the state mutability modifier "pure" because it always returns true:
BaseContract {
function x(bytes memory)
public
view
returns(bool)
{
return true
}
}
However, this function is usually overridden in derived contracts, like so:
DerivedContract is Base {
function x (bytes memory payload)
public
view
returns(bool)
{
// do some non-pure stuff
// return true OR false
}
}
My question regarding how to silence this compiler warning is rooted in deeper questions:
- Does function overriding in Solidity still work, even if the to-be-overidden function has a non-identical state mutability modifier?
- Therefore, can I change the state-mutability modifier of the base function to pure, and still have this function overridden, or will the two dissimilar state mutabilities (view vs. pure), all else being identical, result in some sort of function overloading?
- If overriding a function with a dissimilar state mutability does not work, how can I silence the aforementioned compiler warning?
Thanks for your help!