Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x0908078Da2935A14BC7a17770292818C85b580dd
Balance 0 ETH
Nonce 1
Code Size 3991 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

3991 bytes
0x6080604052600436106100f35760003560e01c80637f4ec4c31161008a57806395d89b411161005957806395d89b41146102b5578063a9059cbb146102ca578063be45fd62146102dd578063dd62ed3e146102f057600080fd5b80637f4ec4c31461021d57806385952454146102555780638cd4426d146102755780638da5cb5b1461029557600080fd5b8063313ce567116100c6578063313ce567146101925780634e71e0c8146101b45780635a3b7e42146101cb57806370a08231146101e757600080fd5b806306fdde03146100f8578063095ea7b31461012357806318160ddd1461015357806323b872dd14610172575b600080fd5b34801561010457600080fd5b5061010d610336565b60405161011a9190610bff565b60405180910390f35b34801561012f57600080fd5b5061014361013e366004610c35565b6103c8565b604051901515815260200161011a565b34801561015f57600080fd5b506003545b60405190815260200161011a565b34801561017e57600080fd5b5061014361018d366004610c5f565b6104a4565b34801561019e57600080fd5b5060025460405160ff909116815260200161011a565b3480156101c057600080fd5b506101c961061c565b005b3480156101d757600080fd5b5060405160df815260200161011a565b3480156101f357600080fd5b50610164610202366004610c9b565b6001600160a01b031660009081526007602052604090205490565b34801561022957600080fd5b5060055461023d906001600160a01b031681565b6040516001600160a01b03909116815260200161011a565b34801561026157600080fd5b506101c9610270366004610c9b565b61066f565b34801561028157600080fd5b506101c9610290366004610c35565b6106c0565b3480156102a157600080fd5b5060045461023d906001600160a01b031681565b3480156102c157600080fd5b5061010d610835565b6101436102d8366004610c35565b610844565b6101436102eb366004610cb6565b6109d6565b3480156102fc57600080fd5b5061016461030b366004610d3d565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205490565b60606000805461034590610d70565b80601f016020809104026020016040519081016040528092919081815260200182805461037190610d70565b80156103be5780601f10610393576101008083540402835291602001916103be565b820191906000526020600020905b8154815290600101906020018083116103a157829003601f168201915b5050505050905090565b60006001600160a01b03831661043f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601760248201527f4552432d3232333a205370656e646572206572726f722e00000000000000000060448201526064015b60405180910390fd5b3360008181526006602090815260408083206001600160a01b03881680855290835292819020869055518581529192917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a35060015b92915050565b6001600160a01b0383166000908152600660209081526040808320338452909152812054821115610531576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4552432d3232333a20496e73756666696369656e7420616c6c6f77616e63652e6044820152606401610436565b6001600160a01b03841660009081526007602052604081208054849290610559908490610df2565b90915550506001600160a01b038416600090815260066020908152604080832033845290915281208054849290610591908490610df2565b90915550506001600160a01b038316600090815260076020526040812080548492906105be908490610e05565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161060a91815260200190565b60405180910390a35060019392505050565b6005546001600160a01b0316331461063357600080fd5b600554600480547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b03909216919091179055565b6004546001600160a01b0316331461068657600080fd5b600580547fffffffffffffffffffffffff0000000000000000000000000000000000000000166001600160a01b0392909216919091179055565b6004546001600160a01b031633146106d757600080fd5b60408051336024820152604480820184905282518083039091018152606490910182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052905160009182916001600160a01b0386169161075d91610e18565b6000604051808303816000865af19150503d806000811461079a576040519150601f19603f3d011682016040523d82523d6000602084013e61079f565b606091505b50915091508180156107c95750805115806107c95750808060200190518101906107c99190610e34565b61082f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610436565b50505050565b60606001805461034590610d70565b60003415610883576040516001600160a01b038416903480156108fc02916000818181858888f19350505050158015610881573d6000803e3d6000fd5b505b60408051808201825260048152600060208083018290523382526007905291909120546108b1908490610df2565b33600090815260076020526040808220929092556001600160a01b038616815220546108de908490610e05565b6001600160a01b038516600090815260076020526040902055833b1561098c576040517f8943ec020000000000000000000000000000000000000000000000000000000081526001600160a01b03851690638943ec029061094790339087908690600401610e56565b6020604051808303816000875af1158015610966573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061098a9190610e87565b505b6040518381526001600160a01b0385169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35060019392505050565b60003415610a15576040516001600160a01b038616903480156108fc02916000818181858888f19350505050158015610a13573d6000803e3d6000fd5b505b33600090815260076020526040902054610a30908590610df2565b33600090815260076020526040808220929092556001600160a01b03871681522054610a5d908590610e05565b6001600160a01b038616600090815260076020526040902055843b15610b0d576040517f8943ec020000000000000000000000000000000000000000000000000000000081526001600160a01b03861690638943ec0290610ac8903390889088908890600401610f12565b6020604051808303816000875af1158015610ae7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0b9190610e87565b505b6040518481526001600160a01b0386169033907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a37f3ba9136826ac751de05d770d8d34fa4440ada49a5fb0e9aa1678aece66dad9768383604051610b7e929190610f45565b60405180910390a1506001949350505050565b60005b83811015610bac578181015183820152602001610b94565b50506000910152565b60008151808452610bcd816020860160208601610b91565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b602081526000610c126020830184610bb5565b9392505050565b80356001600160a01b0381168114610c3057600080fd5b919050565b60008060408385031215610c4857600080fd5b610c5183610c19565b946020939093013593505050565b600080600060608486031215610c7457600080fd5b610c7d84610c19565b9250610c8b60208501610c19565b9150604084013590509250925092565b600060208284031215610cad57600080fd5b610c1282610c19565b60008060008060608587031215610ccc57600080fd5b610cd585610c19565b935060208501359250604085013567ffffffffffffffff80821115610cf957600080fd5b818701915087601f830112610d0d57600080fd5b813581811115610d1c57600080fd5b886020828501011115610d2e57600080fd5b95989497505060200194505050565b60008060408385031215610d5057600080fd5b610d5983610c19565b9150610d6760208401610c19565b90509250929050565b600181811c90821680610d8457607f821691505b602082108103610dbd577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561049e5761049e610dc3565b8082018082111561049e5761049e610dc3565b60008251610e2a818460208701610b91565b9190910192915050565b600060208284031215610e4657600080fd5b81518015158114610c1257600080fd5b6001600160a01b0384168152826020820152606060408201526000610e7e6060830184610bb5565b95945050505050565b600060208284031215610e9957600080fd5b81517fffffffff0000000000000000000000000000000000000000000000000000000081168114610c1257600080fd5b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6001600160a01b0385168152836020820152606060408201526000610f3b606083018486610ec9565b9695505050505050565b602081526000610f59602083018486610ec9565b94935050505056fea2646970667358221220c0d2e12b0617b3d2b47238c3b68bf1d68ea84b1a2a21d357504ea1c90948c31c64736f6c63430008130033

Verified Source Code Partial Match

Compiler: v0.8.19+commit.7dd6d404 EVM: paris Optimization: Yes (5000 runs)
D223Token.sol 308 lines
// SPDX-License-Identifier: GPL-3.0

// Contracts are written by @Dexaran (twitter.com/Dexaran github.com/Dexaran)
// Read more about ERC-223 standard here: dexaran.github.io/erc223
// ERC-223: https://eips.ethereum.org/EIPS/eip-223 & https://github.com/ethereum/eips/issues/223

// D223 is a token of Dex223.io exchange.

pragma solidity >=0.8.2;

abstract contract IERC223Recipient {


 struct ERC223TransferInfo
    {
        address token_contract;
        address sender;
        uint256 value;
        bytes   data;
    }
    
    ERC223TransferInfo private tkn;
    
/**
 * @dev Standard ERC223 function that will handle incoming token transfers.
 *
 * @param _from  Token sender address.
 * @param _value Amount of tokens.
 * @param _data  Transaction metadata.
 */
    function tokenReceived(address _from, uint _value, bytes memory _data) public virtual returns (bytes4)
    {
        /**
         * @dev Note that inside of the token transaction handler the actual sender of token transfer is accessible via the tkn.sender variable
         * (analogue of msg.sender for Ether transfers)
         * 
         * tkn.value - is the amount of transferred tokens
         * tkn.data  - is the "metadata" of token transfer
         * tkn.token_contract is most likely equal to msg.sender because the token contract typically invokes this function
        */
        tkn.token_contract = msg.sender;
        tkn.sender         = _from;
        tkn.value          = _value;
        tkn.data           = _data;
        
        // ACTUAL CODE

        return 0x8943ec02;
    }
}

library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * This test is non-exhaustive, and there may be false-negatives: during the
     * execution of a contract's constructor, its address will be reported as
     * not containing a contract.
     *
     * > It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies in extcodesize, which returns 0 for contracts in
        // construction, since the code is only stored at the end of the
        // constructor execution.

        uint256 size;
        // solhint-disable-next-line no-inline-assembly
        assembly { size := extcodesize(account) }
        return size > 0;
    }
}

/**
 * @title Reference implementation of the ERC223 standard token.
 */
contract D223Token {

     /**
     * @dev Event that is fired on successful transfer.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);
    event TransferData(bytes);
    event Approval(address indexed owner, address indexed spender, uint256 amount);

    string  private _name;
    string  private _symbol;
    uint8   private _decimals;
    uint256 private _totalSupply;
    address public  owner = msg.sender;
    address public  pending_owner;
    mapping(address account => mapping(address spender => uint256)) private allowances;
    
    mapping(address => uint256) private balances; // List of user balances.

    /**
     * @dev Sets the values for {name} and {symbol}, initializes {decimals} with
     * a default value of 18.
     *
     * To select a different value for {decimals}, use {_setupDecimals}.
     *
     * All three of these values are immutable: they can only be set once during
     * construction.
     */
     
    constructor()
    {
        _name     = "Dex223 token";
        _symbol   = "D223";
        _decimals = 18;
        balances[msg.sender] = 8000000000 * 1e18;
        emit Transfer(address(0), msg.sender, balances[msg.sender]);
        emit TransferData(hex"000000");
        _totalSupply = balances[msg.sender];
    }

    /**
     * @dev Returns the name of the token.
     */
    function name() public view returns (string memory)
    {
        return _name;
    }

    /**
     * @dev Returns the symbol of the token, usually a shorter version of the
     * name.
     */
    function symbol() public view returns (string memory)
    {
        return _symbol;
    }

    /**
     * @dev Returns the number of decimals used to get its user representation.
     * For example, if `decimals` equals `2`, a balance of `505` tokens should
     * be displayed to a user as `5,05` (`505 / 10 ** 2`).
     *
     * Tokens usually opt for a value of 18, imitating the relationship between
     * Ether and Wei. This is the value {ERC223} uses, unless {_setupDecimals} is
     * called.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC223-balanceOf} and {IERC223-transfer}.
     */
    function decimals() public view returns (uint8)
    {
        return _decimals;
    }

    /**
     * @dev See {IERC223-totalSupply}.
     */
    function totalSupply() public view returns (uint256)
    {
        return _totalSupply;
    }

    /**
     * @dev See {IERC223-standard}.
     */
    function standard() public pure returns (uint32)
    {
        return 223;
    }

    
    /**
     * @dev Returns balance of the `_owner`.
     *
     * @param _owner   The address whose balance will be returned.
     * @return balance Balance of the `_owner`.
     */
    function balanceOf(address _owner) public view returns (uint256)
    {
        return balances[_owner];
    }
    
    /**
     * @dev Transfer the specified amount of tokens to the specified address.
     *      Invokes the `tokenFallback` function if the recipient is a contract.
     *      The token transfer fails if the recipient is a contract
     *      but does not implement the `tokenFallback` function
     *      or the fallback function to receive funds.
     *
     * @param _to    Receiver address.
     * @param _value Amount of tokens that will be transferred.
     * @param _data  Transaction metadata.
     */
    function transfer(address _to, uint _value, bytes calldata _data) public payable returns (bool success)
    {
        // Standard function transfer similar to ERC20 transfer with no _data .
        // Added due to backwards compatibility reasons.
        if(msg.value > 0) payable(_to).transfer(msg.value);
        balances[msg.sender] = balances[msg.sender] - _value;
        balances[_to] = balances[_to] + _value;
        if(Address.isContract(_to)) {
            IERC223Recipient(_to).tokenReceived(msg.sender, _value, _data);
        }
        emit Transfer(msg.sender, _to, _value);
        emit TransferData(_data);
        return true;
    }
    
    /**
     * @dev Transfer the specified amount of tokens to the specified address.
     *      This function works the same with the previous one
     *      but doesn't contain `_data` param.
     *      Added due to backwards compatibility reasons.
     *
     * @param _to    Receiver address.
     * @param _value Amount of tokens that will be transferred.
     */
    function transfer(address _to, uint _value) public payable returns (bool success)
    {
        if(msg.value > 0) payable(_to).transfer(msg.value);
        bytes memory _empty = hex"00000000";
        balances[msg.sender] = balances[msg.sender] - _value;
        balances[_to] = balances[_to] + _value;
        if(Address.isContract(_to)) {
            IERC223Recipient(_to).tokenReceived(msg.sender, _value, _empty);
        }
        emit Transfer(msg.sender, _to, _value);
        return true;
    }

    // ERC-20 functions for backwards compatibility.

    // Security warning!

    // ERC-20 transferFrom function does not invoke a `tokenReceived` function in the
    // recipient smart-contract. Therefore error handling is not possible
    // and a user can directly deposit tokens to any contract bypassing safety checks
    // or token reception handlers which can result in a loss of funds.
    // This functions are only supported for backwards compatibility reasons
    // and as a last resort when it may be necessary to forcefully transfer tokens
    // to some smart-contract which is not explicitly compatible with the ERC-223 standard.
    //
    // This is not a default method of depsoiting tokens to smart-contracts.
    // `trasnfer` function must be used to deposit tokens to smart-contracts
    // if the recipient supports ERC-223 depositing pattern.
    //
    // `approve` & `transferFrom` pattern must be avoided whenever possible.

    function allowance(address _owner, address spender) public view virtual returns (uint256) {
        return allowances[_owner][spender];
    }

    function approve(address _spender, uint _value) public returns (bool) {

        // Safety checks.
        require(_spender != address(0), "ERC-223: Spender error.");

        allowances[msg.sender][_spender] = _value;
        emit Approval(msg.sender, _spender, _value);
        
        return true;
    }

    function transferFrom(address _from, address _to, uint _value) public returns (bool) {
        
        require(allowances[_from][msg.sender] >= _value, "ERC-223: Insufficient allowance.");
        
        balances[_from] -= _value;
        allowances[_from][msg.sender] -= _value;
        balances[_to] += _value;
        
        emit Transfer(_from, _to, _value);
        
        return true;
    }

    // ERC-20 standard contains a security flaw described here: https://medium.com/dex223/known-problems-of-erc20-token-standard-e98887b9532c
    // ERC-20 tokens do not invoke any callback function upon being deposited to a smart-contract via `transfer` function,
    // therefore it's impossible to handle errors and prevent users from sending tokens to smart-contracts which are not designed to receive them.
    // As of 2024 $83,000,000 worth of ERC-20 tokens were lost due to this flaw: https://dexaran.github.io/erc20-losses/
    // In order to mitigate this issue we are allowing the owner to extract the tokens.
    // You can contact the owner of the contract [email protected] / [email protected] 
    // if you have accidentally deposited tokens to this contract.

    function rescueERC20(address _token, uint256 _value) external
    {
        require(msg.sender == owner);
        (bool success, bytes memory data) = _token.call(abi.encodeWithSelector(0xa9059cbb, msg.sender, _value));
        require(success && (data.length == 0 || abi.decode(data, (bool))), "Transfer failed");
    }

    // In this contract the `owner` can only extract stuck ERC-20 tokens.
    // ERC-20 tokens contain a security flaw that can result in a loss of funds
    // as it's `transfer` function does not implement error handling
    // and therefore tokens can be transferred directly to smart-contract address
    // which is not designed to receive them and instead of resulting in an error
    // it would result in a loss of tokens for the sender.

    function newOwner(address _owner) external
    {
        require(msg.sender == owner);
        pending_owner = _owner;
    }

    function claimOwnership() external
    {
        require(msg.sender == pending_owner);
        owner = pending_owner;
    }
}

Read Contract

allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pending_owner 0x7f4ec4c3 → address
standard 0x5a3b7e42 → uint32
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256

Write Contract 7 functions

These functions modify contract state and require a wallet transaction to execute.

approve 0x095ea7b3
address _spender
uint256 _value
returns: bool
claimOwnership 0x4e71e0c8
No parameters
newOwner 0x85952454
address _owner
rescueERC20 0x8cd4426d
address _token
uint256 _value
transfer 0xa9059cbb
address _to
uint256 _value
returns: bool
transfer 0xbe45fd62
address _to
uint256 _value
bytes _data
returns: bool
transferFrom 0x23b872dd
address _from
address _to
uint256 _value
returns: bool

Recent Transactions

No transactions found for this address