Files
core/contracts/base/HubRestricted.sol
donosonaumczuk 353dd03c7e misc: Unused imports removed
Co-authored-by: Victor Naumik <vicnaum@gmail.com>
2023-03-23 21:45:11 +00:00

28 lines
664 B
Solidity

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import {Errors} from 'contracts/libraries/constants/Errors.sol';
/**
* @title HubRestricted
* @author Lens Protocol
*
* @notice This abstract contract adds a public `HUB` immutable field, validations when setting it, as well
* as an `onlyHub` modifier, to inherit from 'contracts that have functions restricted to be only called by the Lens hub.
*/
abstract contract HubRestricted {
address public immutable HUB;
modifier onlyHub() {
if (msg.sender != HUB) {
revert Errors.NotHub();
}
_;
}
constructor(address hub) {
HUB = hub;
}
}