mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 14:48:15 -05:00
28 lines
634 B
Solidity
28 lines
634 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, 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;
|
|
}
|
|
}
|