Verified
Ethereum
Verified, Token
Solidity
Verified
Ethereum

Contract Information

The following smart contract is a basic ERC20 token contract named DODOToken. It includes functions for transferring tokens, checking balances, approving token transfers, and checking allowances. The contract uses the SafeMath library to prevent integer overflow/underflow. The total supply of tokens is set to 1 billion with 18 decimal places.
More Info

DODOToken Source Code

/* Copyright 2020 DODO ZOO. SPDX-License-Identifier: Apache-2.0 */ pragma solidity 0.6.9; pragma experimental ABIEncoderV2; /** * @title SafeMath * @author DODO Breeder * * @notice Math operations with safety checks that revert on error */ library SafeMath { function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) { return 0; } uint256 c = a * b; require(c / a == b, "MUL_ERROR"); return c; } function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "DIVIDING_ERROR"); return a / b; } function divCeil(uint256 a, uint256 b) internal pure returns (uint256) { uint256 quotient = div(a, b); uint256 remainder = a - quotient * b; if (remainder > 0) { return quotient + 1; } else { return quotient; } } function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SUB_ERROR"); return a - b; } function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "ADD_ERROR"); return c; } function sqrt(uint256 x) internal pure returns (uint256 y) { uint256 z = x / 2 + 1; y = x; while (z < y) { y = z; z = (x / z + z) / 2; } } } // File: contracts/token/DODOToken.sol /* Copyright 2020 DODO ZOO. */ /** * @title DODO Token * @author DODO Breeder */ contract DODOToken { using SafeMath for uint256; string public symbol = "DODO"; string public name = "DODO bird"; uint256 public decimals = 18; uint256 public totalSupply = 1000000000 * 10**18; // 1 Billion mapping(address => uint256) internal balances; mapping(address => mapping(address => uint256)) internal allowed; // ============ Events ============ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); // ============ Functions ============ constructor() public { balances[msg.sender] = totalSupply; } /** * @dev transfer token for a specified address * @param to The address to transfer to. * @param amount The amount to be transferred. */ function transfer(address to, uint256 amount) public returns (bool) { require(amount <= balances[msg.sender], "BALANCE_NOT_ENOUGH"); balances[msg.sender] = balances[msg.sender].sub(amount); balances[to] = balances[to].add(amount); emit Transfer(msg.sender, to, amount); return true; } /** * @dev Gets the balance of the specified address. * @param owner The address to query the the balance of. * @return balance An uint256 representing the amount owned by the passed address. */ function balanceOf(address owner) external view returns (uint256 balance) { return balances[owner]; } /** * @dev Transfer tokens from one address to another * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param amount uint256 the amount of tokens to be transferred */ function transferFrom( address from, address to, uint256 amount ) public returns (bool) { require(amount <= balances[from], "BALANCE_NOT_ENOUGH"); require(amount <= allowed[from][msg.sender], "ALLOWANCE_NOT_ENOUGH"); balances[from] = balances[from].sub(amount); balances[to] = balances[to].add(amount); allowed[from][msg.sender] = allowed[from][msg.sender].sub(amount); emit Transfer(from, to, amount); return true; } /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender. * @param spender The address which will spend the funds. * @param amount The amount of tokens to be spent. */ function approve(address spender, uint256 amount) public returns (bool) { allowed[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } /** * @dev Function to check the amount of tokens that an owner allowed to a spender. * @param owner address The address which owns the funds. * @param spender address The address which will spend the funds. * @return A uint256 specifying the amount of tokens still available for the spender. */ function allowance(address owner, address spender) public view returns (uint256) { return allowed[owner][spender]; } }
< /*

    Copyright 2020 DODO ZOO.
    SPDX-License-Identifier: Apache-2.0

*/

pragma solidity 0.6.9;
pragma experimental ABIEncoderV2;


/**
 * @title SafeMath
 * @author DODO Breeder
 *
 * @notice Math operations with safety checks that revert on error
 */
library SafeMath {
    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "MUL_ERROR");

        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "DIVIDING_ERROR");
        return a / b;
    }

    function divCeil(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 quotient = div(a, b);
        uint256 remainder = a - quotient * b;
        if (remainder > 0) {
            return quotient + 1;
        } else {
            return quotient;
        }
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SUB_ERROR");
        return a - b;
    }

    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "ADD_ERROR");
        return c;
    }

    function sqrt(uint256 x) internal pure returns (uint256 y) {
        uint256 z = x / 2 + 1;
        y = x;
        while (z < y) {
            y = z;
            z = (x / z + z) / 2;
        }
    }
}


// File: contracts/token/DODOToken.sol

/*

    Copyright 2020 DODO ZOO.

*/

/**
 * @title DODO Token
 * @author DODO Breeder
 */
contract DODOToken {
    using SafeMath for uint256;

    string public symbol = "DODO";
    string public name = "DODO bird";

    uint256 public decimals = 18;
    uint256 public totalSupply = 1000000000 * 10**18; // 1 Billion

    mapping(address => uint256) internal balances;
    mapping(address => mapping(address => uint256)) internal allowed;

    // ============ Events ============

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

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

    // ============ Functions ============

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

    /**
     * @dev transfer token for a specified address
     * @param to The address to transfer to.
     * @param amount The amount to be transferred.
     */
    function transfer(address to, uint256 amount) public returns (bool) {
        require(amount <= balances[msg.sender], "BALANCE_NOT_ENOUGH");

        balances[msg.sender] = balances[msg.sender].sub(amount);
        balances[to] = balances[to].add(amount);
        emit Transfer(msg.sender, to, amount);
        return true;
    }

    /**
     * @dev Gets the balance of the specified address.
     * @param owner The address to query the the balance of.
     * @return balance An uint256 representing the amount owned by the passed address.
     */
    function balanceOf(address owner) external view returns (uint256 balance) {
        return balances[owner];
    }

    /**
     * @dev Transfer tokens from one address to another
     * @param from address The address which you want to send tokens from
     * @param to address The address which you want to transfer to
     * @param amount uint256 the amount of tokens to be transferred
     */
    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public returns (bool) {
        require(amount <= balances[from], "BALANCE_NOT_ENOUGH");
        require(amount <= allowed[from][msg.sender], "ALLOWANCE_NOT_ENOUGH");

        balances[from] = balances[from].sub(amount);
        balances[to] = balances[to].add(amount);
        allowed[from][msg.sender] = allowed[from][msg.sender].sub(amount);
        emit Transfer(from, to, amount);
        return true;
    }

    /**
     * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender.
     * @param spender The address which will spend the funds.
     * @param amount The amount of tokens to be spent.
     */
    function approve(address spender, uint256 amount) public returns (bool) {
        allowed[msg.sender][spender] = amount;
        emit Approval(msg.sender, spender, amount);
        return true;
    }

    /**
     * @dev Function to check the amount of tokens that an owner allowed to a spender.
     * @param owner address The address which owns the funds.
     * @param spender address The address which will spend the funds.
     * @return A uint256 specifying the amount of tokens still available for the spender.
     */
    function allowance(address owner, address spender) public view returns (uint256) {
        return allowed[owner][spender];
    }
} < 

DODOToken ABI

[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"balance","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]

DODOToken Bytecode

60c06040526004608081905263444f444f60e01b60a09081526100259160009190610091565b50604080518082019091526009808252681113d113c8189a5c9960ba1b602090920191825261005691600191610091565b5060126002556b033b2e3c9fd0803ce800000060035534801561007857600080fd5b506003543360009081526004602052604090205561012c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100d257805160ff19168380011785556100ff565b828001600101855582156100ff579182015b828111156100ff5782518255916020019190600101906100e4565b5061010b92915061010f565b5090565b61012991905b8082111561010b5760008155600101610115565b90565b6107cb8061013b6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010657806395d89b4114610119578063a9059cbb14610121578063dd62ed3e1461013457610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d657806323b872dd146100eb575b600080fd5b6100a0610147565b6040516100ad9190610681565b60405180910390f35b6100c96100c436600461064c565b6101d4565b6040516100ad9190610676565b6100de61023f565b6040516100ad9190610774565b6100c96100f936600461060c565b610245565b6100de6103db565b6100de6101143660046105bd565b6103e1565b6100a06103fc565b6100c961012f36600461064c565b610457565b6100de6101423660046105d8565b610527565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101cc5780601f106101a1576101008083540402835291602001916101cc565b820191906000526020600020905b8154815290600101906020018083116101af57829003601f168201915b505050505081565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061022d908690610774565b60405180910390a35060015b92915050565b60035481565b6001600160a01b0383166000908152600460205260408120548211156102865760405162461bcd60e51b815260040161027d90610725565b60405180910390fd5b6001600160a01b03841660009081526005602090815260408083203384529091529020548211156102c95760405162461bcd60e51b815260040161027d906106d4565b6001600160a01b0384166000908152600460205260409020546102f2908363ffffffff61055216565b6001600160a01b038086166000908152600460205260408082209390935590851681522054610327908363ffffffff61057a16565b6001600160a01b03808516600090815260046020908152604080832094909455918716815260058252828120338252909152205461036b908363ffffffff61055216565b6001600160a01b0380861660008181526005602090815260408083203384529091529081902093909355915190851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103c9908690610774565b60405180910390a35060019392505050565b60025481565b6001600160a01b031660009081526004602052604090205490565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101cc5780601f106101a1576101008083540402835291602001916101cc565b336000908152600460205260408120548211156104865760405162461bcd60e51b815260040161027d90610725565b336000908152600460205260409020546104a6908363ffffffff61055216565b33600090815260046020526040808220929092556001600160a01b038516815220546104d8908363ffffffff61057a16565b6001600160a01b0384166000818152600460205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061022d908690610774565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6000828211156105745760405162461bcd60e51b815260040161027d90610702565b50900390565b60008282018381101561059f5760405162461bcd60e51b815260040161027d90610751565b9392505050565b80356001600160a01b038116811461023957600080fd5b6000602082840312156105ce578081fd5b61059f83836105a6565b600080604083850312156105ea578081fd5b6105f484846105a6565b915061060384602085016105a6565b90509250929050565b600080600060608486031215610620578081fd5b833561062b8161077d565b9250602084013561063b8161077d565b929592945050506040919091013590565b6000806040838503121561065e578182fd5b61066884846105a6565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156106ad57858101830151858201604001528201610691565b818111156106be5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526014908201527308298989eae829c868abe9c9ea8be8a9c9eaa8e960631b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b6020808252601290820152710848298829c868abe9c9ea8be8a9c9eaa8e960731b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b90815260200190565b6001600160a01b038116811461079257600080fd5b5056fea2646970667358221220b235e2a2bee21589404e1443ef00ec2dca9830877357b2d52c3f9e23e3f8876f64736f6c63430006090033
60c06040526004608081905263444f444f60e01b60a09081526100259160009190610091565b50604080518082019091526009808252681113d113c8189a5c9960ba1b602090920191825261005691600191610091565b5060126002556b033b2e3c9fd0803ce800000060035534801561007857600080fd5b506003543360009081526004602052604090205561012c565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100d257805160ff19168380011785556100ff565b828001600101855582156100ff579182015b828111156100ff5782518255916020019190600101906100e4565b5061010b92915061010f565b5090565b61012991905b8082111561010b5760008155600101610115565b90565b6107cb8061013b6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c8063313ce56711610066578063313ce567146100fe57806370a082311461010657806395d89b4114610119578063a9059cbb14610121578063dd62ed3e1461013457610093565b806306fdde0314610098578063095ea7b3146100b657806318160ddd146100d657806323b872dd146100eb575b600080fd5b6100a0610147565b6040516100ad9190610681565b60405180910390f35b6100c96100c436600461064c565b6101d4565b6040516100ad9190610676565b6100de61023f565b6040516100ad9190610774565b6100c96100f936600461060c565b610245565b6100de6103db565b6100de6101143660046105bd565b6103e1565b6100a06103fc565b6100c961012f36600461064c565b610457565b6100de6101423660046105d8565b610527565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101cc5780601f106101a1576101008083540402835291602001916101cc565b820191906000526020600020905b8154815290600101906020018083116101af57829003601f168201915b505050505081565b3360008181526005602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061022d908690610774565b60405180910390a35060015b92915050565b60035481565b6001600160a01b0383166000908152600460205260408120548211156102865760405162461bcd60e51b815260040161027d90610725565b60405180910390fd5b6001600160a01b03841660009081526005602090815260408083203384529091529020548211156102c95760405162461bcd60e51b815260040161027d906106d4565b6001600160a01b0384166000908152600460205260409020546102f2908363ffffffff61055216565b6001600160a01b038086166000908152600460205260408082209390935590851681522054610327908363ffffffff61057a16565b6001600160a01b03808516600090815260046020908152604080832094909455918716815260058252828120338252909152205461036b908363ffffffff61055216565b6001600160a01b0380861660008181526005602090815260408083203384529091529081902093909355915190851691907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906103c9908690610774565b60405180910390a35060019392505050565b60025481565b6001600160a01b031660009081526004602052604090205490565b6000805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156101cc5780601f106101a1576101008083540402835291602001916101cc565b336000908152600460205260408120548211156104865760405162461bcd60e51b815260040161027d90610725565b336000908152600460205260409020546104a6908363ffffffff61055216565b33600090815260046020526040808220929092556001600160a01b038516815220546104d8908363ffffffff61057a16565b6001600160a01b0384166000818152600460205260409081902092909255905133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061022d908690610774565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205490565b6000828211156105745760405162461bcd60e51b815260040161027d90610702565b50900390565b60008282018381101561059f5760405162461bcd60e51b815260040161027d90610751565b9392505050565b80356001600160a01b038116811461023957600080fd5b6000602082840312156105ce578081fd5b61059f83836105a6565b600080604083850312156105ea578081fd5b6105f484846105a6565b915061060384602085016105a6565b90509250929050565b600080600060608486031215610620578081fd5b833561062b8161077d565b9250602084013561063b8161077d565b929592945050506040919091013590565b6000806040838503121561065e578182fd5b61066884846105a6565b946020939093013593505050565b901515815260200190565b6000602080835283518082850152825b818110156106ad57858101830151858201604001528201610691565b818111156106be5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526014908201527308298989eae829c868abe9c9ea8be8a9c9eaa8e960631b604082015260600190565b60208082526009908201526829aaa12fa2a92927a960b91b604082015260600190565b6020808252601290820152710848298829c868abe9c9ea8be8a9c9eaa8e960731b604082015260600190565b60208082526009908201526820a2222fa2a92927a960b91b604082015260600190565b90815260200190565b6001600160a01b038116811461079257600080fd5b5056fea2646970667358221220b235e2a2bee21589404e1443ef00ec2dca9830877357b2d52c3f9e23e3f8876f64736f6c63430006090033

Check out more smart contracts

Build blockchain magic with Alchemy

Alchemy combines the most powerful web3 developer products and tools with resources, community and legendary support.