avatar
Untitled

Guest 185 6th Aug, 2024

MARKUP 2.26 KB
                                           
                         // SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.19;

import "./libraries/Events.sol";
import "./libraries/Modifiers.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol";

contract CanDaoFollow is
    Initializable,
    AccessControlUpgradeable,
    UUPSUpgradeable
{
    using AddressUpgradeable for address;
    bytes32 public constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE");

    function initialize() public initializer {
        __AccessControl_init();
        __UUPSUpgradeable_init();

        _grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
        _grantRole(UPGRADER_ROLE, msg.sender);
    }

    /// @custom:oz-upgrades-unsafe-allow constructor
    constructor() {
        _disableInitializers();
    }

    /**
     * @dev Following oneself is explicitly allowed.
     *  Following more than once is explicitly allowed.
     */
    function follow(address _address) external {
        emit Events.Follow(_address);
    }

    /**
     * @dev Request sender should be extracted from the function call arguments.
     */
    function operatorFollow(
        address _sender,
        address _address
    ) external {
        Modifiers.onlyAccountingSystem();

        emit Events.Follow(_address);
    }

    /**
     * @dev Unfollowing oneself is explicitly allowed.
     *  Unfollowing more than once is explicitly allowed.
     */
    function unfollow(address _address) external {
        emit Events.Unfollow(_address);
    }

    /**
     * @dev Request sender should be extracted from the function call arguments.
     */
    function operatorUnfollow(
        address _sender,
        address _address
    ) external {
        Modifiers.onlyAccountingSystem();

        emit Events.Unfollow(_address);
    }

    function _authorizeUpgrade(
        address newImplementation
    ) internal override onlyRole(UPGRADER_ROLE) {}
}
                      
                                       
To share this paste please copy this url and send to your friends
RAW Paste Data
Recent Pastes
Ta strona używa plików cookie w celu usprawnienia i ułatwienia dostępu do serwisu oraz prowadzenia danych statystycznych. Dalsze korzystanie z tej witryny oznacza akceptację tego stanu rzeczy.
Wykorzystywanie plików Cookie
Jak wyłączyć cookies?
ROZUMIEM