Cyrus (CYS)

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

/// Cyrus (CYS) - ERC20 minimal, burnable, ownable (no mint)
contract CyrusCYS {
    string public name = "Cyrus";
    string public symbol = "CYS";
    uint8  public decimals = 18;
    uint256 public totalSupply;

    address public owner;

    mapping(address => uint256) public balanceOf;
    mapping(address => mapping(address => uint256)) public allowance;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner_, address indexed spender, uint256 value);
    event Burn(address indexed burner, uint256 value);
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    modifier onlyOwner() {
        require(msg.sender == owner, "Cyrus: caller is not the owner");
        _;
    }

    constructor(uint256 initialSupply) {
        owner = msg.sender;
        totalSupply = initialSupply;
        balanceOf[msg.sender] = initialSupply;
        emit Transfer(address(0), msg.sender, initialSupply);
    }

    // ownership
    function transferOwnership(address newOwner) public onlyOwner {
        require(newOwner != address(0), "Cyrus: new owner is zero");
        emit OwnershipTransferred(owner, newOwner);
        owner = newOwner;
    }

    // internal transfer
    function _transfer(address from, address to, uint256 value) internal {
        require(to != address(0), "Cyrus: transfer to zero");
        require(balanceOf[from] >= value, "Cyrus: balance too low");
        unchecked { balanceOf[from] -= value; }
        balanceOf[to] += value;
        emit Transfer(from, to, value);
    }

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

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

    function transferFrom(address from, address to, uint256 value) public returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        require(allowed >= value, "Cyrus: allowance too low");
        allowance[from][msg.sender] = allowed - value;
        _transfer(from, to, value);
        return true;
    }

    /// Burn tokens from caller balance — reduces totalSupply
    function burn(uint256 value) public returns (bool) {
        require(balanceOf[msg.sender] >= value, "Cyrus: balance too low");
        unchecked { balanceOf[msg.sender] -= value; }
        totalSupply -= value;
        emit Burn(msg.sender, value);
        emit Transfer(msg.sender, address(0), value);
        return true;
    }

    /// Burn tokens from `from` using allowance
    function burnFrom(address from, uint256 value) public returns (bool) {
        uint256 allowed = allowance[from][msg.sender];
        require(allowed >= value, "Cyrus: allowance too low");
        allowance[from][msg.sender] = allowed - value;
        require(balanceOf[from] >= value, "Cyrus: balance too low");
        unchecked { balanceOf[from] -= value; }
        totalSupply -= value;
        emit Burn(from, value);
        emit Transfer(from, address(0), value);
        return true;
    }
}

Tags:
addr:0xa2c12592db519e9fb6b226a65003e62688a3b7d6|verified:true|block:23456636|tx:0x4c7796263ae1f4566989818683a72a1e7d7b570688b3a52075ba2c2128101f57|first_check:1759047135

Submitted on: 2025-09-28 10:12:15

Comments

Log in to comment.

No comments yet.