Address Contract Partially Verified
Address
0xAC313b5f3EA704f7Aa806C2605D12c87EaB4cAa7
Balance
0 ETH
Nonce
1
Code Size
4517 bytes
Creator
0xf5A0EDe4...588D at tx 0x3451e520...1a8f29
Indexed Transactions
0
Contract Bytecode
4517 bytes
0x608060405234801561001057600080fd5b50600436106101425760003560e01c806349bd5a5e116100b85780638da5cb5b1161007c5780638da5cb5b1461026b57806395d89b4114610273578063a457c2d71461027b578063a9059cbb1461028e578063dd62ed3e146102a1578063f2fde38b146102b457610142565b806349bd5a5e1461022b57806370a0823114610240578063715018a614610253578063860a32ec1461025b57806389f9a1d31461026357610142565b806323b872dd1161010a57806323b872dd146101b5578063313ce567146101c857806339509351146101dd5780633aa633aa146101f0578063404e51291461020557806342966c681461021857610142565b806306fdde0314610147578063095ea7b31461016557806316c021291461018557806318160ddd146101985780631ab99e12146101ad575b600080fd5b61014f6102c7565b60405161015c9190610d31565b60405180910390f35b610178610173366004610c90565b610359565b60405161015c9190610d26565b610178610193366004610bd9565b610376565b6101a061038b565b60405161015c91906110d8565b6101a0610391565b6101786101c3366004610c2c565b610397565b6101d0610430565b60405161015c91906110e1565b6101786101eb366004610c90565b610435565b6102036101fe366004610cb9565b610489565b005b610203610213366004610c67565b610503565b610203610226366004610cfa565b61056d565b61023361057a565b60405161015c9190610d12565b6101a061024e366004610bd9565b610589565b6102036105a8565b6101786105f3565b6101a06105fc565b610233610602565b61014f610611565b610178610289366004610c90565b610620565b61017861029c366004610c90565b610699565b6101a06102af366004610bfa565b6106ad565b6102036102c2366004610bd9565b6106d8565b6060600480546102d69061111e565b80601f01602080910402602001604051908101604052809291908181526020018280546103029061111e565b801561034f5780601f106103245761010080835404028352916020019161034f565b820191906000526020600020905b81548152906001019060200180831161033257829003601f168201915b5050505050905090565b600061036d610366610746565b848461074a565b50600192915050565b600a6020526000908152604090205460ff1681565b60035490565b60085481565b60006103a48484846107fe565b6001600160a01b0384166000908152600260205260408120816103c5610746565b6001600160a01b03166001600160a01b03168152602001908152602001600020549050828110156104115760405162461bcd60e51b815260040161040890610ef7565b60405180910390fd5b6104258561041d610746565b85840361074a565b506001949350505050565b601290565b600061036d610442610746565b848460026000610450610746565b6001600160a01b03908116825260208083019390935260409182016000908120918b168152925290205461048491906110ef565b61074a565b610491610746565b6001600160a01b03166104a2610602565b6001600160a01b0316146104c85760405162461bcd60e51b815260040161040890610f3f565b6006805460ff191694151594909417909355600980546001600160a01b0319166001600160a01b039390931692909217909155600755600855565b61050b610746565b6001600160a01b031661051c610602565b6001600160a01b0316146105425760405162461bcd60e51b815260040161040890610f3f565b6001600160a01b03919091166000908152600a60205260409020805460ff1916911515919091179055565b6105773382610928565b50565b6009546001600160a01b031681565b6001600160a01b0381166000908152600160205260409020545b919050565b6105b0610746565b6001600160a01b03166105c1610602565b6001600160a01b0316146105e75760405162461bcd60e51b815260040161040890610f3f565b6105f16000610a1a565b565b60065460ff1681565b60075481565b6000546001600160a01b031690565b6060600580546102d69061111e565b6000806002600061062f610746565b6001600160a01b039081168252602080830193909352604091820160009081209188168152925290205490508281101561067b5760405162461bcd60e51b81526004016104089061106e565b61068f610686610746565b8585840361074a565b5060019392505050565b600061036d6106a6610746565b84846107fe565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b6106e0610746565b6001600160a01b03166106f1610602565b6001600160a01b0316146107175760405162461bcd60e51b815260040161040890610f3f565b6001600160a01b03811661073d5760405162461bcd60e51b815260040161040890610e09565b61057781610a1a565b3390565b6001600160a01b0383166107705760405162461bcd60e51b81526004016104089061102a565b6001600160a01b0382166107965760405162461bcd60e51b815260040161040890610e4f565b6001600160a01b0380841660008181526002602090815260408083209487168084529490915290819020849055517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925906107f19085906110d8565b60405180910390a3505050565b6001600160a01b0383166108245760405162461bcd60e51b815260040161040890610fe5565b6001600160a01b03821661084a5760405162461bcd60e51b815260040161040890610d84565b610855838383610a6a565b6001600160a01b0383166000908152600160205260409020548181101561088e5760405162461bcd60e51b815260040161040890610e91565b6001600160a01b038085166000908152600160205260408082208585039055918516815290812080548492906108c59084906110ef565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161090f91906110d8565b60405180910390a3610922848484610a15565b50505050565b6001600160a01b03821661094e5760405162461bcd60e51b815260040161040890610f74565b61095a82600083610a6a565b6001600160a01b038216600090815260016020526040902054818110156109935760405162461bcd60e51b815260040161040890610dc7565b6001600160a01b03831660009081526001602052604081208383039055600380548492906109c2908490611107565b90915550506040516000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a059086906110d8565b60405180910390a3610a15836000845b505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0382166000908152600a602052604090205460ff16158015610aac57506001600160a01b0383166000908152600a602052604090205460ff16155b610ac85760405162461bcd60e51b8152600401610408906110b3565b6009546001600160a01b0316610b3857610ae0610602565b6001600160a01b0316836001600160a01b03161480610b175750610b02610602565b6001600160a01b0316826001600160a01b0316145b610b335760405162461bcd60e51b815260040161040890610fb5565b610a15565b60065460ff168015610b5757506009546001600160a01b038481169116145b15610a155760075481610b6984610589565b610b7391906110ef565b11158015610b96575060085481610b8984610589565b610b9391906110ef565b10155b610a155760405162461bcd60e51b815260040161040890610ed7565b80356001600160a01b03811681146105a357600080fd5b803580151581146105a357600080fd5b600060208284031215610bea578081fd5b610bf382610bb2565b9392505050565b60008060408385031215610c0c578081fd5b610c1583610bb2565b9150610c2360208401610bb2565b90509250929050565b600080600060608486031215610c40578081fd5b610c4984610bb2565b9250610c5760208501610bb2565b9150604084013590509250925092565b60008060408385031215610c79578182fd5b610c8283610bb2565b9150610c2360208401610bc9565b60008060408385031215610ca2578182fd5b610cab83610bb2565b946020939093013593505050565b60008060008060808587031215610cce578081fd5b610cd785610bc9565b9350610ce560208601610bb2565b93969395505050506040820135916060013590565b600060208284031215610d0b578081fd5b5035919050565b6001600160a01b0391909116815260200190565b901515815260200190565b6000602080835283518082850152825b81811015610d5d57858101830151858201604001528201610d41565b81811115610d6e5783604083870101525b50601f01601f1916929092016040019392505050565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b60208082526022908201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604082015261636560f01b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526022908201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604082015261737360f01b606082015260800190565b60208082526026908201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604082015265616c616e636560d01b606082015260800190565b602080825260069082015265119bdc989a5960d21b604082015260600190565b60208082526028908201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616040820152676c6c6f77616e636560c01b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526021908201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6020808252601690820152751d1c98591a5b99c81a5cc81b9bdd081cdd185c9d195960521b604082015260600190565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526024908201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646040820152637265737360e01b606082015260800190565b60208082526025908201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604082015264207a65726f60d81b606082015260800190565b6020808252600b908201526a109b1858dadb1a5cdd195960aa1b604082015260600190565b90815260200190565b60ff91909116815260200190565b6000821982111561110257611102611159565b500190565b60008282101561111957611119611159565b500390565b60028104600182168061113257607f821691505b6020821081141561115357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fdfea2646970667358221220e2cdac7170564c4d2017cc8746dd3f0df600294552f0ca2c425bf3b0e1ed8a5864736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
DadToken.sol 628 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.0 (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/[email protected]
// OpenZeppelin Contracts v4.4.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 Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
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/[email protected]
// OpenZeppelin Contracts v4.4.0 (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @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 `recipient`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address recipient, 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 `sender` to `recipient` 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 sender,
address recipient,
uint256 amount
) external returns (bool);
/**
* @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);
}
// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]
// OpenZeppelin Contracts v4.4.0 (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/[email protected]
// OpenZeppelin Contracts v4.4.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.zeppelin.solutions/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:
*
* - `recipient` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address recipient, uint256 amount) public virtual override returns (bool) {
_transfer(_msgSender(), recipient, 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}.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
_approve(_msgSender(), 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}.
*
* Requirements:
*
* - `sender` and `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
* - the caller must have allowance for ``sender``'s tokens of at least
* `amount`.
*/
function transferFrom(
address sender,
address recipient,
uint256 amount
) public virtual override returns (bool) {
_transfer(sender, recipient, amount);
uint256 currentAllowance = _allowances[sender][_msgSender()];
require(currentAllowance >= amount, "ERC20: transfer amount exceeds allowance");
unchecked {
_approve(sender, _msgSender(), currentAllowance - 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) {
_approve(_msgSender(), spender, _allowances[_msgSender()][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) {
uint256 currentAllowance = _allowances[_msgSender()][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(_msgSender(), spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* 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:
*
* - `sender` cannot be the zero address.
* - `recipient` cannot be the zero address.
* - `sender` must have a balance of at least `amount`.
*/
function _transfer(
address sender,
address recipient,
uint256 amount
) internal virtual {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(sender, recipient, amount);
uint256 senderBalance = _balances[sender];
require(senderBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[sender] = senderBalance - amount;
}
_balances[recipient] += amount;
emit Transfer(sender, recipient, amount);
_afterTokenTransfer(sender, recipient, 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;
_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;
}
_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 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 contracts/DadToken.sol
pragma solidity ^0.8.0;
contract DadToken is Ownable, ERC20 {
bool public limited;
uint256 public maxHoldingAmount;
uint256 public minHoldingAmount;
address public uniswapV2Pair;
mapping(address => bool) public blacklists;
constructor(uint256 _totalSupply) ERC20("Dad", "DAD") {
_mint(msg.sender, _totalSupply);
}
function blacklist(address _address, bool _isBlacklisting) external onlyOwner {
blacklists[_address] = _isBlacklisting;
}
function setRule(bool _limited, address _uniswapV2Pair, uint256 _maxHoldingAmount, uint256 _minHoldingAmount) external onlyOwner {
limited = _limited;
uniswapV2Pair = _uniswapV2Pair;
maxHoldingAmount = _maxHoldingAmount;
minHoldingAmount = _minHoldingAmount;
}
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) override internal virtual {
require(!blacklists[to] && !blacklists[from], "Blacklisted");
if (uniswapV2Pair == address(0)) {
require(from == owner() || to == owner(), "trading is not started");
return;
}
if (limited && from == uniswapV2Pair) {
require(super.balanceOf(to) + amount <= maxHoldingAmount && super.balanceOf(to) + amount >= minHoldingAmount, "Forbid");
}
}
function burn(uint256 value) external {
_burn(msg.sender, value);
}
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
blacklists 0x16c02129 → bool
decimals 0x313ce567 → uint8
limited 0x860a32ec → bool
maxHoldingAmount 0x89f9a1d3 → uint256
minHoldingAmount 0x1ab99e12 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniswapV2Pair 0x49bd5a5e → address
Write Contract 10 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
blacklist 0x404e5129
address _address
bool _isBlacklisting
burn 0x42966c68
uint256 value
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
renounceOwnership 0x715018a6
No parameters
setRule 0x3aa633aa
bool _limited
address _uniswapV2Pair
uint256 _maxHoldingAmount
uint256 _minHoldingAmount
transfer 0xa9059cbb
address recipient
uint256 amount
returns: bool
transferFrom 0x23b872dd
address sender
address recipient
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address