Skip to content
Verified contractExactMIT

CSTToken

Address0xa57ec495c8233410b561c40c52a3250e20a2947d
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.20

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.20+commit.a1b79de6
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,442,221
Creation transaction
0x914c4295ac…c597a3adf3

CSTToken.sol

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

contract CSTToken {
    string public constant NAME = "CryptoServices Token";
    string public constant SYMBOL = "CST";
    uint8 public constant DECIMALS = 18;
    uint256 public constant MAX_SUPPLY = 100_000_000_000 * 10**18;

    mapping(address => uint256) private _balances;
    mapping(address => mapping(address => uint256)) private _allowances;
    mapping(address => bool) private _frozenAccounts;

    uint256 private _totalSupply;
    address private _owner;

    event Transfer(address indexed from, address indexed to, uint256 value);
    event Approval(address indexed owner, address indexed spender, uint256 value);
    event Freeze();
    event Unfreeze();
    event FrozenFunds(address indexed target, bool frozen);
    event RefundTokens(address indexed token, address indexed refund, uint256 value);

    constructor() {
        _owner = msg.sender;
        _mint(msg.sender, MAX_SUPPLY);
    }

    modifier onlyOwner() {
        require(msg.sender == _owner, "Not owner");
        _;
    }

    modifier notFrozen(address _account) {
        require(!_frozenAccounts[_account], "Account is frozen");
        _;
    }

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

    function balanceOf(address account) public view returns (uint256) {
        return _balances[account];
    }

    function transfer(address to, uint256 amount) public notFrozen(msg.sender) returns (bool) {
        require(to != address(0), "Invalid recipient");
        require(_balances[msg.sender] >= amount, "Insufficient balance");

        _balances[msg.sender] -= amount;
        _balances[to] += amount;
        emit Transfer(msg.sender, to, amount);
        return true;
    }

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

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

    function transferFrom(address from, address to, uint256 amount) public notFrozen(from) returns (bool) {
        require(to != address(0), "Invalid recipient");
        require(_balances[from] >= amount, "Insufficient balance");
        require(_allowances[from][msg.sender] >= amount, "Insufficient allowance");

        _balances[from] -= amount;
        _balances[to] += amount;
        _allowances[from][msg.sender] -= amount;
        emit Transfer(from, to, amount);
        return true;
    }

    function freezeAccount(address target) external onlyOwner {
        require(target != _owner, "Cannot freeze owner");
        _frozenAccounts[target] = true;
        emit FrozenFunds(target, true);
    }

    function unfreezeAccount(address target) external onlyOwner {
        _frozenAccounts[target] = false;
        emit FrozenFunds(target, false);
    }

    function mint(address to, uint256 amount) external onlyOwner {
        require(_totalSupply + amount <= MAX_SUPPLY, "Exceeds max supply");
        _mint(to, amount);
    }

    function burn(uint256 amount) external {
        require(_balances[msg.sender] >= amount, "Insufficient balance");
        _balances[msg.sender] -= amount;
        _totalSupply -= amount;
        emit Transfer(msg.sender, address(0), amount);
    }

    function _mint(address to, uint256 amount) private {
        _balances[to] += amount;
        _totalSupply += amount;
        emit Transfer(address(0), to, amount);
    }
}


Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.