- Contract name:
- TidexToken
- Optimization enabled
- true
- Compiler version
- v0.8.0+commit.c7dfd78e
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2022-05-09T12:24:42.564683Z
Contract source code
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } } abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); constructor() { _transferOwnership(_msgSender()); } function owner() public view virtual returns (address) { return _owner; } modifier onlyOwner() { require(owner() == _msgSender(), "Ownable: caller is not the owner"); _; } function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } interface IERC20 { function totalSupply() external view returns (uint256); function balanceOf(address account) external view returns (uint256); function transfer(address recipient, uint256 amount) external returns (bool); function allowance(address owner, address spender) external view returns (uint256); function approve(address spender, uint256 amount) external returns (bool); function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); event Transfer(address indexed from, address indexed to, uint256 value); event Approval(address indexed owner, address indexed spender, uint256 value); } contract TidexToken is Ownable, IERC20 { mapping (address => uint256) private _balances; mapping (address => mapping (address => uint256)) private _allowances; uint256 private _totalSupply; uint8 private _decimals; string private _symbol; string private _name; constructor() { _name = "Tidex Token"; _symbol = "TDX"; _decimals = 18; _totalSupply = 150_000_000 * 10 ** 18; _balances[_msgSender()] = _totalSupply; emit Transfer(address(0), _msgSender(), _totalSupply); } function decimals() external view returns (uint8) { return _decimals; } function symbol() external view returns (string memory) { return _symbol; } function name() external view returns (string memory) { return _name; } function totalSupply() external view override returns (uint256) { return _totalSupply; } function balanceOf(address account) external view override returns (uint256) { return _balances[account]; } function transfer(address recipient, uint256 amount) public override returns (bool) { _transfer(_msgSender(), recipient, amount); return true; } function allowance(address owner, address spender) external view override returns (uint256) { return _allowances[owner][spender]; } function approve(address spender, uint256 amount) public override returns (bool) { _approve(_msgSender(), spender, amount); return true; } function transferFrom( address sender, address recipient, uint256 amount ) public override returns (bool) { _transfer(sender, recipient, amount); _approve( sender, _msgSender(), _allowances[sender][_msgSender()] - amount ); return true; } function increaseAllowance(address spender, uint256 addedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] + addedValue ); return true; } function decreaseAllowance(address spender, uint256 subtractedValue) public returns (bool) { _approve( _msgSender(), spender, _allowances[_msgSender()][spender] - subtractedValue ); return true; } function _transfer(address sender, address recipient, uint256 amount) internal { require(sender != address(0), "ERC20: transfer from the zero address"); require(recipient != address(0), "ERC20: transfer to the zero address"); _balances[sender] = _balances[sender] - amount; _balances[recipient] = _balances[recipient] + amount; emit Transfer(sender, recipient, amount); } function withdrawToken(address _tokenContract, uint256 _amount) external onlyOwner { IERC20 token = IERC20(_tokenContract); token.transfer(msg.sender, _amount); } function _approve(address owner, address spender, uint256 amount) internal { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } function burn(uint256 amount) public { _burn(msg.sender, amount); } function _burn(address from, uint value) internal { _balances[from] = _balances[from] - value; _totalSupply = _totalSupply - value; emit Transfer(from, address(0), value); } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"Approval","inputs":[{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"spender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allowance","inputs":[{"type":"address","name":"owner","internalType":"address"},{"type":"address","name":"spender","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"approve","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"uint8"}],"name":"decimals","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"decreaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"subtractedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"increaseAllowance","inputs":[{"type":"address","name":"spender","internalType":"address"},{"type":"uint256","name":"addedValue","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalSupply","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transfer","inputs":[{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"transferFrom","inputs":[{"type":"address","name":"sender","internalType":"address"},{"type":"address","name":"recipient","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"_tokenContract","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c8063715018a611610097578063a457c2d711610066578063a457c2d7146101f3578063a9059cbb14610206578063dd62ed3e14610219578063f2fde38b1461022c57610100565b8063715018a6146101bb5780638da5cb5b146101c357806395d89b41146101d85780639e281a98146101e057610100565b8063313ce567116100d3578063313ce5671461016b578063395093511461018057806342966c681461019357806370a08231146101a857610100565b806306fdde0314610105578063095ea7b31461012357806318160ddd1461014357806323b872dd14610158575b600080fd5b61010d61023f565b60405161011a91906109f2565b60405180910390f35b610136610131366004610959565b6102d1565b60405161011a91906109e7565b61014b6102ee565b60405161011a9190610bce565b61013661016636600461091e565b6102f4565b610173610369565b60405161011a9190610bd7565b61013661018e366004610959565b610372565b6101a66101a13660046109a2565b6103c1565b005b61014b6101b63660046108cb565b6103ce565b6101a66103ed565b6101cb610441565b60405161011a91906109ba565b61010d610450565b6101a66101ee366004610959565b61045f565b610136610201366004610959565b610526565b610136610214366004610959565b610575565b61014b6102273660046108ec565b610589565b6101a661023a3660046108cb565b6105b4565b60606006805461024e90610c14565b80601f016020809104026020016040519081016040528092919081815260200182805461027a90610c14565b80156102c75780601f1061029c576101008083540402835291602001916102c7565b820191906000526020600020905b8154815290600101906020018083116102aa57829003601f168201915b5050505050905090565b60006102e56102de610622565b8484610626565b50600192915050565b60035490565b60006103018484846106da565b61035f8461030d610622565b6001600160a01b0387166000908152600260205260408120869161032f610622565b6001600160a01b03166001600160a01b031681526020019081526020016000205461035a9190610bfd565b610626565b5060019392505050565b60045460ff1690565b60006102e561037f610622565b84846002600061038d610622565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461035a9190610be5565b6103cb33826107cc565b50565b6001600160a01b0381166000908152600160205260409020545b919050565b6103f5610622565b6001600160a01b0316610406610441565b6001600160a01b0316146104355760405162461bcd60e51b815260040161042c90610b10565b60405180910390fd5b61043f6000610864565b565b6000546001600160a01b031690565b60606005805461024e90610c14565b610467610622565b6001600160a01b0316610478610441565b6001600160a01b03161461049e5760405162461bcd60e51b815260040161042c90610b10565b60405163a9059cbb60e01b815282906001600160a01b0382169063a9059cbb906104ce90339086906004016109ce565b602060405180830381600087803b1580156104e857600080fd5b505af11580156104fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105209190610982565b50505050565b60006102e5610533610622565b848460026000610541610622565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461035a9190610bfd565b60006102e5610582610622565b84846106da565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6105bc610622565b6001600160a01b03166105cd610441565b6001600160a01b0316146105f35760405162461bcd60e51b815260040161042c90610b10565b6001600160a01b0381166106195760405162461bcd60e51b815260040161042c90610a88565b6103cb81610864565b3390565b6001600160a01b03831661064c5760405162461bcd60e51b815260040161042c90610b8a565b6001600160a01b0382166106725760405162461bcd60e51b815260040161042c90610ace565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906106cd908590610bce565b60405180910390a3505050565b6001600160a01b0383166107005760405162461bcd60e51b815260040161042c90610b45565b6001600160a01b0382166107265760405162461bcd60e51b815260040161042c90610a45565b6001600160a01b03831660009081526001602052604090205461074a908290610bfd565b6001600160a01b03808516600090815260016020526040808220939093559084168152205461077a908290610be5565b6001600160a01b0380841660008181526001602052604090819020939093559151908516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906106cd908590610bce565b6001600160a01b0382166000908152600160205260409020546107f0908290610bfd565b6001600160a01b038316600090815260016020526040902055600354610817908290610bfd565b6003556040516000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610858908590610bce565b60405180910390a35050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b03811681146103e857600080fd5b6000602082840312156108dc578081fd5b6108e5826108b4565b9392505050565b600080604083850312156108fe578081fd5b610907836108b4565b9150610915602084016108b4565b90509250929050565b600080600060608486031215610932578081fd5b61093b846108b4565b9250610949602085016108b4565b9150604084013590509250925092565b6000806040838503121561096b578182fd5b610974836108b4565b946020939093013593505050565b600060208284031215610993578081fd5b815180151581146108e5578182fd5b6000602082840312156109b3578081fd5b5035919050565b6001600160a01b0391909116815260200190565b6001600160a01b03929092168252602082015260400190565b901515815260200190565b6000602080835283518082850152825b81811015610a1e57858101830151858201604001528201610a02565b81811115610a2f5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b90815260200190565b60ff91909116815260200190565b60008219821115610bf857610bf8610c4f565b500190565b600082821015610c0f57610c0f610c4f565b500390565b600281046001821680610c2857607f821691505b60208210811415610c4957634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220c4f063f3047c48b4a9e10a5922e622aec4d9a6b1c0c0f46c142f2dac6a2e963064736f6c63430008000033