Skip to content
Verified contractExactMIT

BlockManager

Address0x081df95ef89e364ef356b8f053fd134db7cfdbad
Balance

0 ETH

 

Transactions

14

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
Yes, 200 runs
EVM version
shanghai
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,849,041
Creation transaction
0x3fcba3aed9…3e2c0fa830

project/contracts/BlockManager.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import "openzeppelin/access/Ownable.sol";
import "openzeppelin/token/ERC20/IERC20.sol";
import "./NODERewardManagement.sol";

contract BlockManager is Ownable {
    IERC20 public eggsToken;
    NODERewardManagementV2 public nodeRewardManager;

    address public distributionPool;
    address public immutable deadAddress = 0x000000000000000000000000000000000000dEaD;

    uint256 public nodeL1Limit = 5;
    uint256 public nodeL2Limit = 5;
    uint256 public nodeL3Limit = 5;

    event CreateL1(address indexed owner);
    event CreateL2(address indexed owner);
    event CreateL3(address indexed owner);
    event Cashout(address indexed owner);
    event TokenUpdated(address indexed token);
    event DistributionPoolUpdated(address indexed pool);

    constructor(address distribution) Ownable(msg.sender) {
        distributionPool = distribution;
    }

    function setTokenAddress(address tokenAddress) external onlyOwner {
        require(tokenAddress != address(0), "BLOCK: token is zero address");
        eggsToken = IERC20(tokenAddress);
        emit TokenUpdated(tokenAddress);
    }

    function setNodeManagement(address nodeManagement) external onlyOwner {
        nodeRewardManager = NODERewardManagementV2(nodeManagement);
    }

    function updateRewardsWall(address payable wall) external onlyOwner {
        distributionPool = wall;
        emit DistributionPoolUpdated(wall);
    }

    function changeNodePriceL1(uint256 newNodePrice) public onlyOwner {
        nodeRewardManager._changeNodePriceL1(newNodePrice);
    }

    function changeNodePriceL2(uint256 newNodePrice) public onlyOwner {
        nodeRewardManager._changeNodePriceL2(newNodePrice);
    }

    function changeNodePriceL3(uint256 newNodePrice) public onlyOwner {
        nodeRewardManager._changeNodePriceL3(newNodePrice);
    }

    function changeRewardPerNodeL1(uint256 newPrice) public onlyOwner {
        nodeRewardManager._changeRewardPerNodeL1(newPrice);
    }

    function changeRewardPerNodeL2(uint256 newPrice) public onlyOwner {
        nodeRewardManager._changeRewardPerNodeL2(newPrice);
    }

    function changeRewardPerNodeL3(uint256 newPrice) public onlyOwner {
        nodeRewardManager._changeRewardPerNodeL3(newPrice);
    }

    function changeClaimTime(uint256 newTime) public onlyOwner {
        nodeRewardManager._changeClaimTime(newTime);
    }

    function changeL1Limit(uint256 newLimit) public onlyOwner {
        nodeL1Limit = newLimit;
    }

    function changeL2Limit(uint256 newLimit) public onlyOwner {
        nodeL2Limit = newLimit;
    }

    function changeL3Limit(uint256 newLimit) public onlyOwner {
        nodeL3Limit = newLimit;
    }

    // ─────────────────────────────────────────────────────────────────────────────
    // Blocks are no longer minted by hand. They are minted automatically by the
    // Uniswap V4 swap hook (BlockNodeHook) on buy and burned on sell. This manager
    // now only handles reward *claims*, owner airdrops, admin params, and views.
    //
    // The hook and this manager must both be authorized writers on the node manager:
    //   nodeRewardManager.setAuthorized(hook, true)
    //   nodeRewardManager.setAuthorized(manager, true)
    // ─────────────────────────────────────────────────────────────────────────────

    /// @notice Convenience wrapper so the owner can authorize the swap hook (or any writer).
    function setNodeAuthorized(address account, bool allowed) external onlyOwner {
        nodeRewardManager.setAuthorized(account, allowed);
    }

    function airdropNode(address user, uint256 tier, uint256 cnt) public onlyOwner {
        nodeRewardManager.createNodeV2(user, tier, cnt);
    }

    function cashoutAll() public {
        address sender = _msgSender();
        require(sender != address(0), "BLOCK CASHOUT: sender is zero address");
        require(sender != distributionPool, "BLOCK CASHOUT: pool cannot cashout");
        uint256 rewardAmount = nodeRewardManager._getRewardAmountOf(sender);
        require(rewardAmount > 0, "BLOCK CASHOUT: no reward to cash out");

        eggsToken.transferFrom(distributionPool, sender, rewardAmount);
        nodeRewardManager._cashoutAllNodesReward(sender);
        emit Cashout(sender);
    }

    function distributeRewards() public onlyOwner returns (bool) {
        return nodeRewardManager._distributeRewards();
    }

    function publiDistriRewards() public {
        nodeRewardManager._distributeRewards();
    }

    function publiDistriRewardsIDX(uint256 idx1, uint256 idx2) public {
        nodeRewardManager._distributeRewardsIDX(idx1, idx2);
    }

    function getNodeNumberOf(address account) public view returns (uint256) {
        require(nodeRewardManager._isNodeOwner(account), "NO NODE OWNER");
        return
            nodeRewardManager._getL1Counter(account) +
            nodeRewardManager._getL2Counter(account) +
            nodeRewardManager._getL3Counter(account);
    }

    function getNodeNumberOfL1(address account) public view returns (uint256) {
        return nodeRewardManager._getL1Counter(account);
    }

    function getNodeNumberOfL2(address account) public view returns (uint256) {
        return nodeRewardManager._getL2Counter(account);
    }

    function getNodeNumberOfL3(address account) public view returns (uint256) {
        return nodeRewardManager._getL3Counter(account);
    }

    function getRewardAmountOf(address account) public view onlyOwner returns (uint256) {
        return nodeRewardManager._getRewardAmountOf(account);
    }

    function getRewardAmount() public view returns (uint256) {
        require(_msgSender() != address(0), "SENDER CAN'T BE ZERO");
        require(nodeRewardManager._isNodeOwner(_msgSender()), "NO NODE OWNER");
        return nodeRewardManager._getRewardAmountOf(_msgSender());
    }

    function getNodePriceL1() public view returns (uint256) {
        return nodeRewardManager.nodePrice();
    }

    function getNodePriceL2() public view returns (uint256) {
        return nodeRewardManager.nodePriceL2();
    }

    function getNodePriceL3() public view returns (uint256) {
        return nodeRewardManager.nodePriceL3();
    }

    function getRewardPerNodeL1() public view returns (uint256) {
        return nodeRewardManager.rewardPerNode();
    }

    function getRewardPerNodeL2() public view returns (uint256) {
        return nodeRewardManager.rewardPerNodeL2();
    }

    function getRewardPerNodeL3() public view returns (uint256) {
        return nodeRewardManager.rewardPerNodeL3();
    }

    function getL1Limit() public view returns (uint256) {
        return nodeL1Limit;
    }

    function getL2Limit() public view returns (uint256) {
        return nodeL2Limit;
    }

    function getL3Limit() public view returns (uint256) {
        return nodeL3Limit;
    }

    function getClaimTime() public view returns (uint256) {
        return nodeRewardManager.claimTime();
    }

    function getTotalStakedReward() public view returns (uint256) {
        return nodeRewardManager.totalRewardStaked();
    }

    function getTotalCreatedNodes() public view returns (uint256) {
        return nodeRewardManager.totalNodesCreated();
    }

    function getNextRebase() public view returns (uint256) {
        return nodeRewardManager.lastRebase();
    }

    function getNodeHolders() public view returns (uint256) {
        return nodeRewardManager._getNodeHolders();
    }
}

project/contracts/NODERewardManagement.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

library SafeMathNR {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }
}

library IterableMappingV2 {
    struct Map {
        address[] keys;
        mapping(address => uint256) values;
        mapping(address => uint256) indexOf;
        mapping(address => bool) inserted;
        mapping(address => uint256) l1cnt;
        mapping(address => uint256) l2cnt;
        mapping(address => uint256) l3cnt;
    }

    function get(Map storage map, address key) public view returns (uint256) {
        return map.values[key];
    }

    function getKeyAtIndex(Map storage map, uint256 index) public view returns (address) {
        return map.keys[index];
    }

    function size(Map storage map) public view returns (uint256) {
        return map.keys.length;
    }

    function set(Map storage map, address key, uint256 val, uint256 l1cnt, uint256 l2cnt, uint256 l3cnt) public {
        if (map.inserted[key]) {
            map.values[key] = val;
        } else {
            map.inserted[key] = true;
            map.values[key] = val;
            map.indexOf[key] = map.keys.length;
            map.l1cnt[key] = l1cnt;
            map.l2cnt[key] = l2cnt;
            map.l3cnt[key] = l3cnt;
            map.keys.push(key);
        }
    }

    function remove(Map storage map, address key) public {
        if (!map.inserted[key]) return;
        delete map.inserted[key];
        delete map.values[key];
        uint256 index = map.indexOf[key];
        uint256 lastIndex = map.keys.length - 1;
        address lastKey = map.keys[lastIndex];
        map.indexOf[lastKey] = index;
        delete map.indexOf[key];
        map.keys[index] = lastKey;
        map.keys.pop();
    }

    function getL1Counter(Map storage map, address user) public view returns (uint256) {
        return map.l1cnt[user];
    }

    function getL2Counter(Map storage map, address user) public view returns (uint256) {
        return map.l2cnt[user];
    }

    function getL3Counter(Map storage map, address user) public view returns (uint256) {
        return map.l3cnt[user];
    }

    function updateL1Counter(Map storage map, address user, uint256 cntnew) public {
        map.l1cnt[user] = cntnew;
    }

    function updateL2Counter(Map storage map, address user, uint256 cntnew) public {
        map.l2cnt[user] = cntnew;
    }

    function updateL3Counter(Map storage map, address user, uint256 cntnew) public {
        map.l3cnt[user] = cntnew;
    }
}

contract NODERewardManagementV2 {
    using SafeMathNR for uint256;
    using IterableMappingV2 for IterableMappingV2.Map;

    IterableMappingV2.Map private nodeOwners;

    /// @dev Prices/rewards scaled to the BlockV4 (BLOCK) ERC-20 (6 decimals).
    uint256 public nodePrice = 100 * 10 ** 6;
    uint256 public nodePriceL2 = 500 * 10 ** 6;
    uint256 public nodePriceL3 = 1000 * 10 ** 6;

    uint256 public rewardPerNode = 125 * 10 ** 4;
    uint256 public rewardPerNodeL2 = 75 * 10 ** 5;
    uint256 public rewardPerNodeL3 = 1875 * 10 ** 4;

    uint256 public claimTime = 6 hours;

    address public gateKeeper;
    address public token;

    /// @notice Extra contracts allowed to mutate node state (e.g. the V4 swap hook + the manager).
    /// @dev The single `token` slot is not enough once both the manager (claims) and the hook
    ///      (auto buy/sell nodes) must write. Authorized callers are managed by the gateKeeper.
    mapping(address => bool) public authorized;

    bool public distribution;

    uint256 public totalNodesCreated;
    uint256 public totalRewardStaked;
    uint256 public lastRebase;

    event AuthorizedUpdated(address indexed account, bool allowed);

    constructor() {
        gateKeeper = msg.sender;
        lastRebase = block.timestamp;
    }

    modifier onlySentry() {
        require(
            msg.sender == token || msg.sender == gateKeeper || authorized[msg.sender],
            "BLOCK: unauthorized"
        );
        _;
    }

    function setManager(address token_) external onlySentry {
        token = token_;
    }

    /// @notice Grant/revoke a writer (the manager for claims, the hook for auto nodes).
    function setAuthorized(address account, bool allowed) external onlySentry {
        authorized[account] = allowed;
        emit AuthorizedUpdated(account, allowed);
    }

    function distributeRewards() private returns (bool) {
        distribution = true;
        uint256 numberOfnodeOwners = nodeOwners.keys.length;
        address user;
        uint256 l1;
        uint256 l2;
        uint256 l3;
        uint256 staked;
        uint256 totalstaked;
        require(numberOfnodeOwners > 0, "DISTRI REWARDS: NO NODE OWNERS");
        require((lastRebase - 30 minutes) < block.timestamp, "No time passed to rebase");

        for (uint256 i = 0; i < numberOfnodeOwners; i++) {
            user = nodeOwners.getKeyAtIndex(i);
            l1 = nodeOwners.getL1Counter(user);
            l2 = nodeOwners.getL2Counter(user);
            l3 = nodeOwners.getL3Counter(user);
            staked = nodeOwners.get(user);
            staked += l1 * rewardPerNode + l2 * rewardPerNodeL2 + l3 * rewardPerNodeL3;
            nodeOwners.set(user, staked, l1, l2, l3);
            totalstaked += staked;
        }
        distribution = false;
        totalRewardStaked = totalstaked;
        lastRebase = block.timestamp + claimTime;
        return true;
    }

    function distributeRewardsIDX(uint256 idx1, uint256 idx2) private returns (bool) {
        distribution = true;
        uint256 numberOfnodeOwners = nodeOwners.keys.length;
        address user;
        uint256 l1;
        uint256 l2;
        uint256 l3;
        uint256 staked;
        uint256 totalstaked;

        if (idx1 == 0) {
            totalstaked = 0;
        } else {
            totalstaked = totalRewardStaked;
        }

        require(numberOfnodeOwners > 0, "DISTRI REWARDS: NO NODE OWNERS");
        require((lastRebase - 30 minutes) < block.timestamp);

        for (uint256 i = idx1; i < idx2; i++) {
            user = nodeOwners.getKeyAtIndex(i);
            l1 = nodeOwners.getL1Counter(user);
            l2 = nodeOwners.getL2Counter(user);
            l3 = nodeOwners.getL3Counter(user);
            staked = nodeOwners.get(user);
            staked += l1 * rewardPerNode + l2 * rewardPerNodeL2 + l3 * rewardPerNodeL3;
            nodeOwners.set(user, staked, l1, l2, l3);
            totalstaked += staked;
        }
        distribution = false;
        totalRewardStaked = totalstaked;
        lastRebase = block.timestamp + claimTime;
        return true;
    }

    function createNodeV2(address account, uint256 l, uint256 cnt) external onlySentry {
        uint256 aux;
        if (!nodeOwners.inserted[account]) {
            nodeOwners.set(account, 0, 0, 0, 0);
        }
        if (l == 1) {
            aux = nodeOwners.getL1Counter(account) + cnt;
            nodeOwners.updateL1Counter(account, aux);
        } else if (l == 2) {
            aux = nodeOwners.getL2Counter(account) + cnt;
            nodeOwners.updateL2Counter(account, aux);
        } else {
            aux = nodeOwners.getL3Counter(account) + cnt;
            nodeOwners.updateL3Counter(account, aux);
        }
        totalNodesCreated += cnt;
    }

    function _burn(address account, uint256 l) public onlySentry {
        uint256 cnt;
        if (l == 1) {
            cnt = nodeOwners.getL1Counter(account) - 1;
            nodeOwners.updateL1Counter(account, cnt);
        } else if (l == 2) {
            cnt = nodeOwners.getL2Counter(account) - 1;
            nodeOwners.updateL2Counter(account, cnt);
        } else {
            cnt = nodeOwners.getL3Counter(account) - 1;
            nodeOwners.updateL3Counter(account, cnt);
        }
        totalNodesCreated--;
    }

    /// @notice Burn up to `cnt` nodes of tier `l` from `account`, capped at what they hold.
    /// @dev Safe for the swap hook: never underflows and never reverts on a normal sell.
    /// @return burned The number of nodes actually removed.
    function _burnMany(address account, uint256 l, uint256 cnt) external onlySentry returns (uint256 burned) {
        uint256 have;
        if (l == 1) have = nodeOwners.getL1Counter(account);
        else if (l == 2) have = nodeOwners.getL2Counter(account);
        else have = nodeOwners.getL3Counter(account);

        burned = cnt > have ? have : cnt;
        if (burned == 0) return 0;

        if (l == 1) nodeOwners.updateL1Counter(account, have - burned);
        else if (l == 2) nodeOwners.updateL2Counter(account, have - burned);
        else nodeOwners.updateL3Counter(account, have - burned);

        totalNodesCreated -= burned;
    }

    function _cashoutAllNodesReward(address account) external onlySentry {
        uint256 l1 = nodeOwners.getL1Counter(account);
        uint256 l2 = nodeOwners.getL2Counter(account);
        uint256 l3 = nodeOwners.getL3Counter(account);
        nodeOwners.set(account, 0, l1, l2, l3);
    }

    function _getRewardAmountOf(address account) external view returns (uint256) {
        return nodeOwners.get(account);
    }

    function _getL1Counter(address account) external view returns (uint256) {
        return nodeOwners.getL1Counter(account);
    }

    function _getL2Counter(address account) external view returns (uint256) {
        return nodeOwners.getL2Counter(account);
    }

    function _getL3Counter(address account) external view returns (uint256) {
        return nodeOwners.getL3Counter(account);
    }

    function _getNodeHolders() external view returns (uint256) {
        return nodeOwners.keys.length;
    }

    function _changeNodePriceL1(uint256 newNodePrice) external onlySentry {
        nodePrice = newNodePrice;
    }

    function _changeNodePriceL2(uint256 newNodePrice) external onlySentry {
        nodePriceL2 = newNodePrice;
    }

    function _changeNodePriceL3(uint256 newNodePrice) external onlySentry {
        nodePriceL3 = newNodePrice;
    }

    function _changeRewardPerNodeL1(uint256 newPrice) external onlySentry {
        rewardPerNode = newPrice;
    }

    function _changeRewardPerNodeL2(uint256 newPrice) external onlySentry {
        rewardPerNodeL2 = newPrice;
    }

    function _changeRewardPerNodeL3(uint256 newPrice) external onlySentry {
        rewardPerNodeL3 = newPrice;
    }

    function _changeClaimTime(uint256 newTime) external onlySentry {
        claimTime = newTime;
    }

    function isNodeOwner(address account) private view returns (bool) {
        return nodeOwners.getL1Counter(account) > 0 || nodeOwners.getL2Counter(account) > 0 || nodeOwners.getL3Counter(account) > 0;
    }

    function _isNodeOwner(address account) external view returns (bool) {
        return isNodeOwner(account);
    }

    function _distributeRewards() external onlySentry returns (bool) {
        return distributeRewards();
    }

    function _distributeRewardsIDX(uint256 idx1, uint256 idx2) external onlySentry returns (bool) {
        return distributeRewardsIDX(idx1, idx2);
    }
}

project/lib/openzeppelin/access/Ownable.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

project/lib/openzeppelin/token/ERC20/IERC20.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

project/lib/openzeppelin/utils/Context.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  },
  "evmVersion": "shanghai",
  "remappings": [
    "project/:openzeppelin/=project/lib/openzeppelin/"
  ]
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.