Skip to content

Admin Modifier#

Informational

Both Governor.sol and PVFDGovernor.sol frequently gate admin functions with the same block of repeated code, always at the beginning of the function:

require(
    msg.sender == admin,
    "Contract::function: admin only"
);

This is a good candidate for a solidity modifier to improve cleanliness and readability of code.

Recommendation#

Instead of repeating the same block, consider implementing a modifier to use across functions.

modifier onlyAdmin() {
    require(
        msg.sender == admin,
        "Admin only"
    );
    _;
}