hats-finance / illuminex-0x0bb4aa1f58719707405c231fcdf0b405714799cf

0 stars 1 forks source link

Owner remains unset in `Ownable` inherited contracts #21

Open hats-bug-reporter[bot] opened 3 months ago

hats-bug-reporter[bot] commented 3 months ago

Github username: -- Twitter username: -- Submission hash (on-chain): 0xd50e370ac6d50f8514a0cd033d2e76daf1ddd0bae30644a5e6cda37b8c8ca7bf Severity: medium

Description: Description\ The problem is that the contracts that make use of Ownable do not set the initial owner which will make onlyOwner restricted functions permanently inaccessible, along with potential future transfers of ownership.


AllowedRelayers.sol - no functionality that sets the owner

abstract contract AllowedRelayers is Ownable {
    mapping(address => bool) public relayers;
    bool public relayersWhitelistEnabled;

    modifier onlyRelayer() {
        if (relayersWhitelistEnabled && !relayers[msg.sender]) {
            revert("NRL");
        }

        _;
    }

    constructor() {
        relayersWhitelistEnabled = true;
        _toggleRelayer(msg.sender);
    }

    function _toggleRelayer(address _relayer) internal {
        relayers[_relayer] = !relayers[_relayer];
    }

    function toggleRelayersWhitelistEnabled() public onlyOwner {
        relayersWhitelistEnabled = !relayersWhitelistEnabled;
    }

    function toggleRelayer(address _relayer) public onlyOwner {
        _toggleRelayer(_relayer);
    }
}

Recommendations

Consider to set the constructor of Ownable therefore setting the initial owner in the constructor of the above mentioned contracts.

rotcivegaf commented 3 months ago

AllowedRelayers is an abstract contract so the contracts inherited from it should set the initial owner