Address Contract Verified
Address
0x0A6D51535E6A2b19Aa52c73cCea719CFF19400dF
Balance
0.079442 ETH
Nonce
1
Code Size
5772 bytes
Creator
0x15c49bce...4fE5 at tx 0xae1d5980...515986
Indexed Transactions
0
Contract Bytecode
5772 bytes
0x6080604052600436106101de575f3560e01c8063a457c2d7116100fd578063cc1776d311610092578063e01af92c11610062578063e01af92c1461056d578063e545fd6d1461058c578063f2fde38b146105ab578063f887ea40146105ca575f80fd5b8063cc1776d3146104ec578063d333555314610501578063dbe66ca014610520578063dd62ed3e1461054e575f80fd5b8063b70143c9116100cd578063b70143c914610470578063b9d0f1af1461048f578063c2e5ec04146104ae578063c647b20e146104cd575f80fd5b8063a457c2d7146103f4578063a8aa1b3114610413578063a9059cbb14610432578063aacebbe314610451575f80fd5b80634f7041a51161017357806375f0a8741161014357806375f0a874146103685780638980f11f146103a55780638da5cb5b146103c457806395d89b41146103e0575f80fd5b80634f7041a5146102eb5780636ddd17131461030057806370a082311461031e578063715018a614610352575f80fd5b806323b872dd116101ae57806323b872dd14610279578063313ce5671461029857806339509351146102b35780634ada218b146102d2575f80fd5b806306fdde03146101e9578063095ea7b3146102135780630faee56f1461024257806318160ddd14610265575f80fd5b366101e557005b5f80fd5b3480156101f4575f80fd5b506101fd6105e9565b60405161020a91906112de565b60405180910390f35b34801561021e575f80fd5b5061023261022d366004611327565b610679565b604051901515815260200161020a565b34801561024d575f80fd5b5061025760095481565b60405190815260200161020a565b348015610270575f80fd5b50600354610257565b348015610284575f80fd5b50610232610293366004611351565b610692565b3480156102a3575f80fd5b506040516012815260200161020a565b3480156102be575f80fd5b506102326102cd366004611327565b6106b5565b3480156102dd575f80fd5b50600a546102329060ff1681565b3480156102f6575f80fd5b5061025760085481565b34801561030b575f80fd5b5060065461023290610100900460ff1681565b348015610329575f80fd5b5061025761033836600461138f565b6001600160a01b03165f9081526001602052604090205490565b34801561035d575f80fd5b506103666106d6565b005b348015610373575f80fd5b5060065461038d906201000090046001600160a01b031681565b6040516001600160a01b03909116815260200161020a565b3480156103b0575f80fd5b506103666103bf366004611327565b6106e9565b3480156103cf575f80fd5b505f546001600160a01b031661038d565b3480156103eb575f80fd5b506101fd610784565b3480156103ff575f80fd5b5061023261040e366004611327565b610793565b34801561041e575f80fd5b50600d5461038d906001600160a01b031681565b34801561043d575f80fd5b5061023261044c366004611327565b610812565b34801561045c575f80fd5b5061036661046b36600461138f565b61081f565b34801561047b575f80fd5b5061036661048a3660046113aa565b610851565b34801561049a575f80fd5b506103666104a93660046113aa565b6108a4565b3480156104b9575f80fd5b506103666104c83660046113ce565b6108b1565b3480156104d8575f80fd5b506103666104e73660046113e9565b6108cc565b3480156104f7575f80fd5b5061025760075481565b34801561050c575f80fd5b5061036661051b3660046113aa565b61095c565b34801561052b575f80fd5b5061023261053a36600461138f565b600b6020525f908152604090205460ff1681565b348015610559575f80fd5b50610257610568366004611409565b610a14565b348015610578575f80fd5b506103666105873660046113ce565b610a3e565b348015610597575f80fd5b506103666105a6366004611440565b610a60565b3480156105b6575f80fd5b506103666105c536600461138f565b610a92565b3480156105d5575f80fd5b50600c5461038d906001600160a01b031681565b6060600480546105f89061146c565b80601f01602080910402602001604051908101604052809291908181526020018280546106249061146c565b801561066f5780601f106106465761010080835404028352916020019161066f565b820191905f5260205f20905b81548152906001019060200180831161065257829003601f168201915b5050505050905090565b5f33610686818585610b0b565b60019150505b92915050565b5f3361069f858285610c2e565b6106aa858585610ca6565b506001949350505050565b5f336106868185856106c78383610a14565b6106d191906114b8565b610b0b565b6106de610f37565b6106e75f610f90565b565b6106f1610f37565b816001600160a01b031663a9059cbb6107115f546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b039091166004820152602481018490526044016020604051808303815f875af115801561075b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061077f91906114cb565b505050565b6060600580546105f89061146c565b5f33816107a08286610a14565b9050838110156108055760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b6106aa8286868403610b0b565b5f33610686818585610ca6565b610827610f37565b600680546001600160a01b03909216620100000262010000600160b01b0319909216919091179055565b610859610f37565b61086281610fdf565b6006546040516001600160a01b036201000090920491909116904780156108fc02915f818181858888f193505050501580156108a0573d5f803e3d5ffd5b5050565b6108ac610f37565b600955565b6108b9610f37565b600a805460ff1916911515919091179055565b6108d4610f37565b61012c8211156109125760405162461bcd60e51b8152602060048201526009602482015268427579203e2033302560b81b60448201526064016107fc565b61012c8111156109515760405162461bcd60e51b815260206004820152600a60248201526953656c6c203e2033302560b01b60448201526064016107fc565b600891909155600755565b610964610f37565b5f80546040516001600160a01b039091169083908381818185875af1925050503d805f81146109ae576040519150601f19603f3d011682016040523d82523d5f602084013e6109b3565b606091505b50509050806108a05760405162461bcd60e51b815260206004820152602760248201527f4552433230546f6b656e5265636f7665723a2053454e44494e475f455448455260448201526617d1905253115160ca1b60648201526084016107fc565b6001600160a01b039182165f90815260026020908152604080832093909416825291909152205490565b610a46610f37565b600680549115156101000261ff0019909216919091179055565b610a68610f37565b6001600160a01b03919091165f908152600b60205260409020805460ff1916911515919091179055565b610a9a610f37565b6001600160a01b038116610aff5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016107fc565b610b0881610f90565b50565b6001600160a01b038316610b6d5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016107fc565b6001600160a01b038216610bce5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016107fc565b6001600160a01b038381165f8181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f610c398484610a14565b90505f198114610ca05781811015610c935760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016107fc565b610ca08484848403610b0b565b50505050565b6001600160a01b038316610ccc5760405162461bcd60e51b81526004016107fc906114e6565b6001600160a01b038216610cf25760405162461bcd60e51b81526004016107fc9061152b565b5f8111610d535760405162461bcd60e51b815260206004820152602960248201527f5472616e7366657220616d6f756e74206d7573742062652067726561746572206044820152687468616e207a65726f60b81b60648201526084016107fc565b6001600160a01b0383165f908152600b602052604081205460ff16158015610d9357506001600160a01b0383165f908152600b602052604090205460ff16155b8015610da2575060065460ff16155b15610df257600a5460ff16610df25760405162461bcd60e51b8152602060048201526016602482015275151c98591a5b99c81b9bdd081858dd1a5d99481e595d60521b60448201526064016107fc565b60065460ff1680610e1a57506001600160a01b0384165f908152600b602052604090205460ff165b80610e3c57506001600160a01b0383165f908152600b602052604090205460ff165b15610e4857505f610e9e565b600d546001600160a01b0390811690841603610e80576103e860075483610e6f919061156e565b610e799190611585565b9050610e9e565b6103e860085483610e91919061156e565b610e9b9190611585565b90505b600654610100900460ff168015610eb8575060065460ff16155b8015610ed25750600d546001600160a01b03858116911614155b8015610edd57505f81115b15610f1257305f908152600160205260408120549050610f10610f0b84610f0684600954611198565b611198565b610fdf565b505b610f268484610f2184866115a4565b6111af565b8015610ca057610ca08430836111af565b5f546001600160a01b031633146106e75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016107fc565b5f80546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60065460ff16610b08576006805460ff191660011790556040805160028082526060820183525f9260208301908036833701905050905030815f81518110611029576110296115b7565b6001600160a01b03928316602091820292909201810191909152600c54604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015611080573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110a491906115cb565b816001815181106110b7576110b76115b7565b6001600160a01b039283166020918202929092010152600c546110dd9130911684610b0b565b600c5460405163791ac94760e01b81526001600160a01b039091169063791ac947906111159085905f908690309042906004016115e6565b5f604051808303815f87803b15801561112c575f80fd5b505af115801561113e573d5f803e3d5ffd5b50479250508115905061118957600654604051620100009091046001600160a01b0316906108fc8315029083905f818181858888f19350505050158015611187573d5f803e3d5ffd5b505b50506006805460ff1916905550565b5f8183116111a657826111a8565b815b9392505050565b6001600160a01b0383166111d55760405162461bcd60e51b81526004016107fc906114e6565b6001600160a01b0382166111fb5760405162461bcd60e51b81526004016107fc9061152b565b6001600160a01b0383165f90815260016020526040902054818110156112725760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016107fc565b6001600160a01b038085165f8181526001602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906112d19086815260200190565b60405180910390a3610ca0565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b6001600160a01b0381168114610b08575f80fd5b5f8060408385031215611338575f80fd5b823561134381611313565b946020939093013593505050565b5f805f60608486031215611363575f80fd5b833561136e81611313565b9250602084013561137e81611313565b929592945050506040919091013590565b5f6020828403121561139f575f80fd5b81356111a881611313565b5f602082840312156113ba575f80fd5b5035919050565b8015158114610b08575f80fd5b5f602082840312156113de575f80fd5b81356111a8816113c1565b5f80604083850312156113fa575f80fd5b50508035926020909101359150565b5f806040838503121561141a575f80fd5b823561142581611313565b9150602083013561143581611313565b809150509250929050565b5f8060408385031215611451575f80fd5b823561145c81611313565b91506020830135611435816113c1565b600181811c9082168061148057607f821691505b60208210810361149e57634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52601160045260245ffd5b8082018082111561068c5761068c6114a4565b5f602082840312156114db575f80fd5b81516111a8816113c1565b60208082526025908201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526023908201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260408201526265737360e81b606082015260800190565b808202811582820484141761068c5761068c6114a4565b5f8261159f57634e487b7160e01b5f52601260045260245ffd5b500490565b8181038181111561068c5761068c6114a4565b634e487b7160e01b5f52603260045260245ffd5b5f602082840312156115db575f80fd5b81516111a881611313565b5f60a0820187835286602084015260a0604084015280865180835260c0850191506020880192505f5b818110156116365783516001600160a01b031683526020938401939092019160010161160f565b50506001600160a01b03959095166060840152505060800152939250505056fea26469706673582212201562ed026f4692aed854794f74137dde2463d0b9e2c8824c9e69d9b83881f9af64736f6c634300081a0033
Verified Source Code Full Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: cancun
Optimization: Yes (200 runs)
Ownable.sol 83 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @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. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
}
ERC20.sol 365 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
/**
* @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].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* 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}.
*
* 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 default value returned by this function, unless
* it's 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 {}
}
IERC20.sol 78 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}
IERC20Metadata.sol 28 lines
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @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);
}
Context.sol 24 lines
// SPDX-License-Identifier: MIT
// 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;
}
}
Chartik.sol 216 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
import { ERC20 } from "@openzeppelin/[email protected]/token/ERC20/ERC20.sol";
import { Ownable } from "@openzeppelin/[email protected]/access/Ownable.sol";
import { IERC20 } from "@openzeppelin/[email protected]/token/ERC20/IERC20.sol";
interface IFactory {
function createPair(
address tokenA,
address tokenB
) external returns (address pair);
}
interface IRouter {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
)
external
payable
returns (uint amountToken, uint amountETH, uint liquidity);
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
}
contract Chartik is Ownable, ERC20 {
bool private swapping;
bool public swapEnabled;
address public marketingWallet = 0xe90707B8411005ade9995e7BaBb53D353660e933;
uint256 public sellTax = 300;
uint256 public buyTax = 300;
uint256 public _maxTaxSwap = 1_000_000 * 10 ** 18;
bool public tradingEnabled;
address private constant DEAD = address(0xdead);
mapping(address => bool) public excludedFromFees;
IRouter public router;
address public pair;
constructor() ERC20("Chartik", "CTK") {
_mint(msg.sender, 1000000000 * 10 ** decimals());
address routerAddress = 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
excludedFromFees[tx.origin] = true;
excludedFromFees[msg.sender] = true;
excludedFromFees[DEAD] = true;
excludedFromFees[routerAddress] = true;
excludedFromFees[address(this)] = true;
excludedFromFees[marketingWallet] = true;
router = IRouter(routerAddress);
pair = IFactory(router.factory()).createPair(
address(this),
router.WETH()
);
swapEnabled = true;
}
function updateExcludedFromFees(
address _address,
bool state
) external onlyOwner {
excludedFromFees[_address] = state;
}
function setTradingEnabled(bool state) external onlyOwner {
tradingEnabled = state;
}
function min(uint256 a, uint256 b) private pure returns (uint256) {
return (a > b) ? b : a;
}
modifier inSwap() {
if (!swapping) {
swapping = true;
_;
swapping = false;
}
}
function _transfer(
address sender,
address recipient,
uint256 amount
) override internal {
require(sender != address(0), "ERC20: transfer from the zero address");
require(recipient != address(0), "ERC20: transfer to the zero address");
require(amount > 0, "Transfer amount must be greater than zero");
uint256 fee;
if (
!excludedFromFees[sender] &&
!excludedFromFees[recipient] &&
!swapping
) {
require(tradingEnabled, "Trading not active yet");
}
// set fee to zero if fees in contract are handled or exempted
if (swapping || excludedFromFees[sender] || excludedFromFees[recipient])
fee = 0;
//calculate fee
else {
if (recipient == pair) {
fee = (amount * sellTax) / 1000;
} else {
fee = (amount * buyTax) / 1000;
}
}
//send fees if threshold has been reached
//don't do this on buys, breaks swap
if (swapEnabled && !swapping && sender != pair && fee > 0) {
uint256 contractTokenBalance = balanceOf(address(this));
swapTokensForETH(
min(amount, min(contractTokenBalance, _maxTaxSwap))
);
}
super._transfer(sender, recipient, amount - fee);
if (fee > 0) super._transfer(sender, address(this), fee);
}
function swapTokensForETH(uint256 tokenAmount) private inSwap {
address[] memory path = new address[](2);
path[0] = address(this);
path[1] = router.WETH();
_approve(address(this), address(router), tokenAmount);
// make the swap
router.swapExactTokensForETHSupportingFeeOnTransferTokens(
tokenAmount,
0,
path,
address(this),
block.timestamp
);
uint256 marketingAmt = address(this).balance;
if (marketingAmt > 0) {
payable(marketingWallet).transfer(marketingAmt);
}
}
function setSwapEnabled(bool state) external onlyOwner {
swapEnabled = state;
}
function setMaxTaxSwap(uint256 new_amount) external onlyOwner {
_maxTaxSwap = new_amount;
}
function setTaxes(uint256 _buy, uint256 _sell) external onlyOwner {
require(_buy <= 300, "Buy > 30%");
require(_sell <= 300, "Sell > 30%");
buyTax = _buy;
sellTax = _sell;
}
function updateMarketingWallet(address newWallet) external onlyOwner {
marketingWallet = newWallet;
}
function manualSwap(uint256 amount) external onlyOwner {
swapTokensForETH(amount);
payable(marketingWallet).transfer(address(this).balance);
}
function recoverERC20(
address tokenAddress,
uint256 tokenAmount
) public virtual onlyOwner {
IERC20(tokenAddress).transfer(owner(), tokenAmount);
}
function recoverETH(uint256 amount) public virtual onlyOwner {
(bool sent, ) = owner().call{ value: amount }("");
require(sent, "ERC20TokenRecover: SENDING_ETHER_FAILED");
}
receive() external payable {}
}
Read Contract
_maxTaxSwap 0x0faee56f → uint256
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
buyTax 0x4f7041a5 → uint256
decimals 0x313ce567 → uint8
excludedFromFees 0xdbe66ca0 → bool
marketingWallet 0x75f0a874 → address
name 0x06fdde03 → string
owner 0x8da5cb5b → address
pair 0xa8aa1b31 → address
router 0xf887ea40 → address
sellTax 0xcc1776d3 → uint256
swapEnabled 0x6ddd1713 → bool
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
tradingEnabled 0x4ada218b → bool
Write Contract 16 functions
These functions modify contract state and require a wallet transaction to execute.
approve 0x095ea7b3
address spender
uint256 amount
returns: bool
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
manualSwap 0xb70143c9
uint256 amount
recoverERC20 0x8980f11f
address tokenAddress
uint256 tokenAmount
recoverETH 0xd3335553
uint256 amount
renounceOwnership 0x715018a6
No parameters
setMaxTaxSwap 0xb9d0f1af
uint256 new_amount
setSwapEnabled 0xe01af92c
bool state
setTaxes 0xc647b20e
uint256 _buy
uint256 _sell
setTradingEnabled 0xc2e5ec04
bool state
transfer 0xa9059cbb
address to
uint256 amount
returns: bool
transferFrom 0x23b872dd
address from
address to
uint256 amount
returns: bool
transferOwnership 0xf2fde38b
address newOwner
updateExcludedFromFees 0xe545fd6d
address _address
bool state
updateMarketingWallet 0xaacebbe3
address newWallet
Recent Transactions
No transactions found for this address