Skip to content
Verified contractPartialMIT

ERC223Token

Address0x77f4ee06f9be8bbd6cbc10f1579eb4c18873d5d8
Balance

0 ETH

 

Transactions

2

 

Compiler

solc 0.8.30

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.30+commit.73712a01
Language
solidity
Optimization
No
License
MIT
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,076,675
Creation transaction
0xd41e52b3ab…d009425189

ERC223Token.sol

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


interface IERC223Recipient {
    function tokenReceived(address from, uint value, bytes calldata data) external;
}


contract ERC223Token {
    string public name = "DemoDegen"; // ? Change to your token name
    string public symbol = "DDEGEN"; // ? Change to your token symbol/ticker name
    uint8 public decimals = 18;
    uint256 public totalSupply = 1000000000 * (10 ** 18); // 1 Billion Tokens (18 decimals) ? Change to the amount of total tokens you want


    mapping(address => uint256) public balanceOf;


    // Standard ERC-20 compatible event
    event Transfer(address indexed from, address indexed to, uint256 value);


    // ERC-223 data payload event
    event TransferData(bytes data);


    constructor() {
        balanceOf[msg.sender] = totalSupply;
    }


    // ERC-223 transfer with data
    function transfer(address to, uint256 value, bytes calldata data) public returns (bool) {
        return _transfer(msg.sender, to, value, data);
    }


    // ERC-20-compatible transfer without data
    function transfer(address to, uint256 value) public returns (bool) {
        return _transfer(msg.sender, to, value, "");
    }


    //Internal transfer logic
    function _transfer(address from, address to, uint256 value, bytes memory data) internal returns (bool) {
        require(balanceOf[from] >= value, "Insufficient balance");


        balanceOf[from] -= value;
        balanceOf[to] += value;


        if (isContract(to)) {
            IERC223Recipient(to).tokenReceived(from, value, data);
        }


        emit Transfer(from, to, value);   // Etherscan-compatible event
        emit TransferData(data);          // ERC-223 metadata


        return true;
    }


    // Check if an address is a contract
    function isContract(address _addr) internal view returns (bool) {
        uint size;
        assembly {
            size := extcodesize(_addr)
        }
        return size > 0;
    }


    // Required by TokenConverter to identify token standard
    function standard() public pure returns (uint32) {
        return 223;
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.