Address Contract Partially Verified
Address
0x1165EcEbFa6693CF64Ac5EF49f1b32E8aCBFFE01
Balance
0 ETH
Nonce
1
Code Size
4886 bytes
Creator
0x10169a9E...83B4 at tx 0xa5b1905a...a160bc
Indexed Transactions
0
Contract Bytecode
4886 bytes
0x608060405234801561001057600080fd5b506004361061018e5760003560e01c806370a08231116100de57806393ee15ca11610097578063a9059cbb11610071578063a9059cbb14610308578063b1d17c981461031b578063dd62ed3e1461032e578063f2fde38b146103415761018e565b806393ee15ca146102e557806395d89b41146102ed578063a457c2d7146102f55761018e565b806370a0823114610287578063715018a61461029a57806376ee241d146102a257806379cc6790146102aa5780637a9d7c14146102bd5780638da5cb5b146102d05761018e565b8063313ce5671161014b57806342966c681161012557806342966c68146102515780634ada218b1461026457806356cf37b71461026c578063676c84581461027f5761018e565b8063313ce56714610216578063379ba1d91461022b578063395093511461023e5761018e565b806306fdde0314610193578063095ea7b3146101b157806318160ddd146101d157806323b872dd146101e657806325b61703146101f95780633049b58014610201575b600080fd5b61019b610354565b6040516101a89190610d9c565b60405180910390f35b6101c46101bf366004610d1c565b6103e6565b6040516101a89190610d91565b6101d9610408565b6040516101a8919061126a565b6101c46101f4366004610ce1565b61040e565b6101d961043c565b61021461020f366004610d65565b610442565b005b61021e61048a565b6040516101a89190611273565b610214610239366004610d45565b61048f565b6101c461024c366004610d1c565b610535565b61021461025f366004610d65565b610561565b6101c4610575565b6101d961027a366004610c8e565b61057e565b6101d9610590565b6101d9610295366004610c8e565b610596565b6102146105b5565b6101d96105c9565b6102146102b8366004610d1c565b6105cf565b6102146102cb366004610d65565b6105ef565b6102d8610681565b6040516101a89190610d7d565b6101d9610690565b61019b610696565b6101c4610303366004610d1c565b6106a5565b6101c4610316366004610d1c565b6106ed565b610214610329366004610c8e565b610705565b6101d961033c366004610caf565b610776565b61021461034f366004610c8e565b6107a1565b606060038054610363906112a5565b80601f016020809104026020016040519081016040528092919081815260200182805461038f906112a5565b80156103dc5780601f106103b1576101008083540402835291602001916103dc565b820191906000526020600020905b8154815290600101906020018083116103bf57829003601f168201915b5050505050905090565b6000806103f16107dd565b90506103fe8185856107e1565b5060019392505050565b60025490565b6000806104196107dd565b9050610426858285610895565b6104318585856108df565b506001949350505050565b60095481565b61044a6109e0565b60078190556040517ff221348c99c95366e69a11aaaa1801f74c5008d8a5bed062cd05b03718e9bca39061047f90839061126a565b60405180910390a150565b601290565b6104976109e0565b80156104f6576008805460ff191660011790556104b661012c42611281565b60098190556040517f9312395a4f7df2e78261a7b9f2b566aa0615fd564215350ee0865d73f989059d916104e99161126a565b60405180910390a1610506565b6008805460ff1916905560006009555b7f44025b4c6266facf728a25ba1ed858c89e2215e03094486152577b87636ea7ab8160405161047f9190610d91565b6000806105406107dd565b90506103fe8185856105528589610776565b61055c9190611281565b6107e1565b61057261056c6107dd565b82610a1f565b50565b60085460ff1681565b600a6020526000908152604090205481565b60065481565b6001600160a01b0381166000908152602081905260409020545b919050565b6105bd6109e0565b6105c76000610af6565b565b61012c81565b6105e1826105db6107dd565b83610895565b6105eb8282610a1f565b5050565b6105f76109e0565b600081116106205760405162461bcd60e51b815260040161061790610fd1565b60405180910390fd5b6b033b2e3c9fd0803ce800000081111561064c5760405162461bcd60e51b815260040161061790611085565b60068190556040517f61a9d76f1023cf14660a9917af7526f9a626983e3f0cdd80e1b319af249adaf99061047f90839061126a565b6005546001600160a01b031690565b60075481565b606060048054610363906112a5565b6000806106b06107dd565b905060006106be8286610776565b9050838110156106e05760405162461bcd60e51b815260040161061790611225565b61043182868684036107e1565b6000806106f86107dd565b90506103fe8185856108df565b61070d6109e0565b6001600160a01b0381166107335760405162461bcd60e51b815260040161061790610e32565b600061073e33610596565b90506b033b2e3c9fd0803ce8000000811461076b5760405162461bcd60e51b815260040161061790611008565b6105eb3383836108df565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6107a96109e0565b6001600160a01b0381166107cf5760405162461bcd60e51b815260040161061790610eab565b61057281610af6565b505050565b3390565b6001600160a01b0383166108075760405162461bcd60e51b8152600401610617906111ac565b6001600160a01b03821661082d5760405162461bcd60e51b815260040161061790610ef1565b6001600160a01b0380841660008181526001602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259061088890859061126a565b60405180910390a3505050565b60006108a18484610776565b905060001981146108d957818110156108cc5760405162461bcd60e51b815260040161061790610f9a565b6108d984848484036107e1565b50505050565b6001600160a01b0383166109055760405162461bcd60e51b815260040161061790611167565b6001600160a01b03821661092b5760405162461bcd60e51b815260040161061790610def565b610936838383610b48565b6001600160a01b0383166000908152602081905260409020548181101561096f5760405162461bcd60e51b81526004016106179061103f565b6001600160a01b0380851660008181526020819052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906109cd90869061126a565b60405180910390a36108d98484846107d8565b6109e86107dd565b6001600160a01b03166109f9610681565b6001600160a01b0316146105c75760405162461bcd60e51b8152600401610617906110f1565b6001600160a01b038216610a455760405162461bcd60e51b815260040161061790611126565b610a5182600083610b48565b6001600160a01b03821660009081526020819052604090205481811015610a8a5760405162461bcd60e51b815260040161061790610e69565b6001600160a01b0383166000818152602081905260408082208585039055600280548690039055519091907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610ae290869061126a565b60405180910390a36107d8836000846107d8565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b610b538383836107d8565b6001600160a01b0383161580610b7057506001600160a01b038216155b15610b7a576107d8565b610b82610681565b6001600160a01b0316836001600160a01b03161415610ba0576107d8565b60085460ff16610bc25760405162461bcd60e51b815260040161061790610f6a565b6000600954118015610bd657506009544210155b610bf25760405162461bcd60e51b8152600401610617906110ba565b600654811115610c145760405162461bcd60e51b8152600401610617906111f0565b6007546001600160a01b0384166000908152600a6020526040902054610c3a9190611281565b421015610c595760405162461bcd60e51b815260040161061790610f33565b50506001600160a01b03166000908152600a60205260409020429055565b80356001600160a01b03811681146105b057600080fd5b600060208284031215610c9f578081fd5b610ca882610c77565b9392505050565b60008060408385031215610cc1578081fd5b610cca83610c77565b9150610cd860208401610c77565b90509250929050565b600080600060608486031215610cf5578081fd5b610cfe84610c77565b9250610d0c60208501610c77565b9150604084013590509250925092565b60008060408385031215610d2e578182fd5b610d3783610c77565b946020939093013593505050565b600060208284031215610d56578081fd5b81358015158114610ca8578182fd5b600060208284031215610d76578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015610dc857858101830151858201604001528201610dac565b81811115610dd95783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b6020808252601c908201527f496e76616c696420646973747269627574696f6e206164647265737300000000604082015260600190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b6020808252601f908201527f506c65617365207761697420666f7220636f6f6c646f776e20706572696f6400604082015260600190565b602080825260169082015275151c98591a5b99c81a5cc81b9bdd08195b98589b195960521b604082015260600190565b6020808252601d908201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604082015260600190565b6020808252601c908201527f4c696d6974206d7573742062652067726561746572207468616e203000000000604082015260600190565b6020808252601a908201527f546f6b656e7320616c7265616479206469737472696275746564000000000000604082015260600190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b6020808252818101527f4c696d69742063616e6e6f742065786365656420746f74616c20737570706c79604082015260600190565b60208082526019908201527f54726164696e67206973206e6f74207965742061637469766500000000000000604082015260600190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b6020808252818101527f416d6f756e742065786365656473207472616e73616374696f6e206c696d6974604082015260600190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b90815260200190565b60ff91909116815260200190565b600082198211156112a057634e487b7160e01b81526011600452602481fd5b500190565b6002810460018216806112b957607f821691505b602082108114156112da57634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220a0168297be0497bb7136944fa7ef7425bba60ed7f0888c332810f62b0b2a3ea464736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
CourageTheDogToken.sol 781 lines
// SPDX-License-Identifier: MIT
// Telegram-https://t.me/ccdog_courage
// X-https://x.com/courage_ccdog
// Telegram announcement-https://t.me/courage_ccdog
// File: @openzeppelin/contracts/utils/Context.sol
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File: @openzeppelin/contracts/access/Ownable.sol
// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File: @openzeppelin/contracts/token/ERC20/IERC20.sol
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
}
// File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File: @openzeppelin/contracts/token/ERC20/ERC20.sol
// OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override 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 {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_totalSupply -= amount;
}
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
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);
}
/**
* @dev Updates `owner` s allowance for `spender` based on spent `amount`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)
pragma solidity ^0.8.0;
/**
* @dev Extension of {ERC20} that allows token holders to destroy both their own
* tokens and those that they have an allowance for, in a way that can be
* recognized off-chain (via event analysis).
*/
abstract contract ERC20Burnable is Context, ERC20 {
/**
* @dev Destroys `amount` tokens from the caller.
*
* See {ERC20-_burn}.
*/
function burn(uint256 amount) public virtual {
_burn(_msgSender(), amount);
}
/**
* @dev Destroys `amount` tokens from `account`, deducting from the caller's
* allowance.
*
* See {ERC20-_burn} and {ERC20-allowance}.
*
* Requirements:
*
* - the caller must have allowance for ``accounts``'s tokens of at least
* `amount`.
*/
function burnFrom(address account, uint256 amount) public virtual {
_spendAllowance(account, _msgSender(), amount);
_burn(account, amount);
}
}
pragma solidity ^0.8.0;
contract CourageTheDogToken is ERC20, ERC20Burnable, Ownable {
// Token supply and decimals configuration
uint256 private constant INITIAL_SUPPLY = 1000000000 * 10**18;
// Core security feature state variables
uint256 public maxTransactionLimit;
uint256 public tradeCooldown;
bool public tradingEnabled;
// Trading delay mechanism state variables
uint256 public tradingEnabledTimestamp;
uint256 public constant TRADING_DELAY = 5 minutes;
// Mapping to track last transaction timestamp for each address
mapping(address => uint256) public lastTransactionTimestamp;
// Events for tracking security parameter changes
event MaxTransactionLimitUpdated(uint256 newLimit);
event TradeCooldownUpdated(uint256 newCooldown);
event TradingStatusUpdated(bool enabled);
event TradingScheduled(uint256 enableTime);
constructor() ERC20("Courage The Dog", "CCDOG") {
// Initial token minting to contract deployer
_mint(msg.sender, INITIAL_SUPPLY);
// Initialize security parameters
maxTransactionLimit = INITIAL_SUPPLY / 400;
tradeCooldown = 60 seconds;
tradingEnabled = false;
tradingEnabledTimestamp = 0;
}
// Owner function to update maximum transaction limit
function setMaxTransactionLimit(uint256 newLimit) external onlyOwner {
require(newLimit > 0, "Limit must be greater than 0");
require(newLimit <= INITIAL_SUPPLY, "Limit cannot exceed total supply");
maxTransactionLimit = newLimit;
emit MaxTransactionLimitUpdated(newLimit);
}
// Owner function to update trade cooldown period
function setTradeCooldown(uint256 newCooldown) external onlyOwner {
tradeCooldown = newCooldown;
emit TradeCooldownUpdated(newCooldown);
}
// Owner function to enable/disable trading with delay mechanism
function setTradingStatus(bool _enabled) external onlyOwner {
if (_enabled) {
tradingEnabled = true; // Set trading enabled flag
tradingEnabledTimestamp = block.timestamp + TRADING_DELAY;
emit TradingScheduled(tradingEnabledTimestamp);
} else {
tradingEnabled = false;
tradingEnabledTimestamp = 0;
}
emit TradingStatusUpdated(_enabled);
}
// Internal function to enforce security measures on transfers
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual override {
super._beforeTokenTransfer(from, to, amount);
// Skip checks for minting and burning operations
if (from == address(0) || to == address(0)) return;
// Skip checks if sender is contract owner
if (from == owner()) return;
// First check if trading is enabled
require(tradingEnabled, "Trading is not enabled");
// Then check if trading delay has passed
require(
tradingEnabledTimestamp > 0 &&
block.timestamp >= tradingEnabledTimestamp,
"Trading is not yet active"
);
// Enforce maximum transaction limit
require(amount <= maxTransactionLimit, "Amount exceeds transaction limit");
// Enforce cooldown period between transactions
require(
block.timestamp >= lastTransactionTimestamp[from] + tradeCooldown,
"Please wait for cooldown period"
);
// Update last transaction timestamp for sender
lastTransactionTimestamp[from] = block.timestamp;
}
// Function for initial token distribution
function distributeTokens(address distributionWallet) external onlyOwner {
require(distributionWallet != address(0), "Invalid distribution address");
uint256 supply = balanceOf(msg.sender);
require(supply == INITIAL_SUPPLY, "Tokens already distributed");
_transfer(msg.sender, distributionWallet, supply);
}
}
Read Contract
TRADING_DELAY 0x76ee241d → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
lastTransactionTimestamp 0x56cf37b7 → uint256
maxTransactionLimit 0x676c8458 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
tradeCooldown 0x93ee15ca → uint256
tradingEnabled 0x4ada218b → bool
tradingEnabledTimestamp 0x25b61703 → uint256
Write Contract 13 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
burn 0x42966c68
uint256 amount
burnFrom 0x79cc6790
address account
uint256 amount
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
distributeTokens 0xb1d17c98
address distributionWallet
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
setMaxTransactionLimit 0x7a9d7c14
uint256 newLimit
setTradeCooldown 0x3049b580
uint256 newCooldown
setTradingStatus 0x379ba1d9
bool _enabled
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address