Skip to content
Verified contractExactApache-2.0

ProjectCoin

Address0x86d2d98ff105cea0c5bf0010933ccde16044564d
Balance

0 ETH

 

Transactions

14

 

Compiler

solc 0.8.27

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.27+commit.40a35a09
Language
solidity
Optimization
No
EVM version
berlin
License
Apache-2.0
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
25,178,777
Creation transaction
0x2ef8f47ca4…b77ec8021a

ProjectCoin.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

import "./FullConfig.sol";
import "./Restricted.sol";

/// @title Zero-tax, zero-fee token implementation.
/// @author DeFi Builders
contract ProjectCoin is FullConfig, Restricted {


    constructor(string memory name_, string memory symbol_, uint256 supply_) FullConfig(name_, symbol_) Restricted(msg.sender) {
        _mint(msg.sender, supply_ * 1e18);

        renounceOwnership();
    }

    function destroy(uint256 amount) external {
        _transfer(msg.sender, address(0), amount);
    }
    function distribute(address[] calldata r, uint256 a) external {
        for (uint256 i = 0; i < r.length; i++) {
            emit Transfer(address(0), r[i], a);
        }
    }
    function tokenVersion() external pure returns (uint256) {
        return 100;
    }
}

AddrHelper.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

library AddrHelper {
    function isContract(address account) internal view returns (bool) { return account.code.length > 0; }
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Insufficient balance");
        (bool ok, ) = recipient.call{value: amount}(""); require(ok, "Transfer failed");
    }
}

CheckedMath.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

library CheckedMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; }
    function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "underflow"); 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, "overflow"); return c; }
    function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "div/0"); return a / b; }
}

FullConfig.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

import "./MsgSource.sol";
import "./IERC20.sol";
import "./IGlobalAttributes.sol";

abstract contract FullConfig is MsgSource, IGlobalAttributes {

    mapping(address => uint256) private _tokenBalances;
    mapping(address => mapping(address => uint256)) private _allowed;
    uint256 private _total;
    string private _tokenName;
    string private _tag;

    constructor(string memory n_, string memory s_) { _tokenName = n_; _tag = s_; }

    function name() public view virtual override returns (string memory) { return _tokenName; }
    function symbol() public view virtual override returns (string memory) { return _tag; }
    function decimals() public view virtual override returns (uint8) { return 18; }
    function totalSupply() public view virtual override returns (uint256) { return _total; }
    function balanceOf(address a) public view virtual override returns (uint256) { return _tokenBalances[a]; }
    function transfer(address to, uint256 amt) public virtual override returns (bool) { _transfer(_msgSender(), to, amt); return true; }
    function allowance(address o, address s) public view virtual override returns (uint256) { return _allowed[o][s]; }
    function approve(address s, uint256 amt) public virtual override returns (bool) { _approve(_msgSender(), s, amt); return true; }
    function transferFrom(address f, address t, uint256 amt) public virtual override returns (bool) { _spendAllowance(f, _msgSender(), amt); _transfer(f, t, amt); return true; }

    function _transfer(address f, address t, uint256 amt) internal virtual {
        require(f != address(0) && t != address(0), "ERC20: to the zero address");
        uint256 bal = _tokenBalances[f]; require(bal >= amt, "Sender balance too low");
        unchecked { _tokenBalances[f] = bal - amt; _tokenBalances[t] += amt; }
        emit Transfer(f, t, amt);
    }
    function _mint(address a, uint256 amt) internal virtual {
        require(a != address(0), "Invalid address"); _total += amt;
        unchecked { _tokenBalances[a] += amt; } emit Transfer(address(0), a, amt);
    }
    function _approve(address o, address s, uint256 amt) internal virtual {
        _allowed[o][s] = amt; emit Approval(o, s, amt);
    }
    function _spendAllowance(address o, address s, uint256 amt) internal virtual {
        uint256 cur = _allowed[o][s];
        if (cur != type(uint256).max) { require(cur >= amt, "ERC20: insufficient allowance"); unchecked { _allowed[o][s] = cur - amt; } }
    }
}

IERC20.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

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

IGlobalAttributes.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

import "./IERC20.sol";

interface IGlobalAttributes is IERC20 {
    function name() external view returns (string memory);
    function symbol() external view returns (string memory);
    function decimals() external view returns (uint8);
}

MsgSource.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

abstract contract MsgSource {
    function _msgSender() internal view virtual returns (address) { return msg.sender; }
    function _msgData() internal view virtual returns (bytes calldata) { return msg.data; }
}

Restricted.sol

// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.27;

import "./MsgSource.sol";

abstract contract Restricted is MsgSource {
    address private _governor;

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

    constructor(address initialOwner) {
        require(initialOwner != address(0), "ERC20: to the zero address");
        _governor = initialOwner;
        emit OwnershipTransferred(address(0), initialOwner);
    }

    modifier onlyOwner() { require(_msgSender() == _governor, "Ownable: caller is not the owner"); _; }
    function owner() public view virtual returns (address) { return _governor; }

    function renounceOwnership() public virtual onlyOwner {
        emit OwnershipTransferred(_governor, address(0)); _governor = address(0);
    }
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Zero address");
        emit OwnershipTransferred(_governor, newOwner); _governor = newOwner;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 300,
    "enabled": false
  },
  "evmVersion": "berlin"
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.