Address Contract Partially Verified
Address
0x9949A3DD09Bf2426fD9b871f6EFbfE03663A6Ac6
Balance
0 ETH
Nonce
1
Code Size
4304 bytes
Creator
0x22Cc20D1...c452 at tx 0x1b17cbe5...ac8a5f
Indexed Transactions
0
Contract Bytecode
4304 bytes
0x60806040526004361061011f5760003560e01c806389f9a1d3116100a0578063b98de7c711610064578063b98de7c714610313578063bdd3d8251461031b578063d21079e61461033b578063dd62ed3e1461035b578063f2fde38b1461037b57600080fd5b806389f9a1d3146102765780638da5cb5b1461028c57806395d89b41146102be578063a457c2d7146102d3578063a9059cbb146102f357600080fd5b806339509351116100e757806339509351146101da57806370a08231146101fa578063715018a614610230578063751039fc14610247578063860a32ec1461025c57600080fd5b806306fdde0314610124578063095ea7b31461014f57806318160ddd1461017f57806323b872dd1461019e578063313ce567146101be575b600080fd5b34801561013057600080fd5b5061013961039b565b6040516101469190610ea4565b60405180910390f35b34801561015b57600080fd5b5061016f61016a366004610f07565b61042d565b6040519015158152602001610146565b34801561018b57600080fd5b506003545b604051908152602001610146565b3480156101aa57600080fd5b5061016f6101b9366004610f33565b610447565b3480156101ca57600080fd5b5060405160128152602001610146565b3480156101e657600080fd5b5061016f6101f5366004610f07565b61046b565b34801561020657600080fd5b50610190610215366004610f74565b6001600160a01b031660009081526001602052604090205490565b34801561023c57600080fd5b5061024561048d565b005b34801561025357600080fd5b506102456104a1565b34801561026857600080fd5b5060065461016f9060ff1681565b34801561028257600080fd5b5061019060075481565b34801561029857600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610146565b3480156102ca57600080fd5b506101396104b5565b3480156102df57600080fd5b5061016f6102ee366004610f07565b6104c4565b3480156102ff57600080fd5b5061016f61030e366004610f07565b610544565b610245610552565b34801561032757600080fd5b506008546102a6906001600160a01b031681565b34801561034757600080fd5b50610245610356366004610f98565b610749565b34801561036757600080fd5b50610190610376366004610fbb565b610768565b34801561038757600080fd5b50610245610396366004610f74565b610793565b6060600480546103aa90610ff4565b80601f01602080910402602001604051908101604052809291908181526020018280546103d690610ff4565b80156104235780601f106103f857610100808354040283529160200191610423565b820191906000526020600020905b81548152906001019060200180831161040657829003601f168201915b5050505050905090565b60003361043b81858561080c565b60019150505b92915050565b600033610455858285610930565b6104608585856109aa565b506001949350505050565b60003361043b81858561047e8383610768565b610488919061102e565b61080c565b610495610b60565b61049f6000610bba565b565b6104a9610b60565b6006805460ff19169055565b6060600580546103aa90610ff4565b600033816104d28286610768565b9050838110156105375760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084015b60405180910390fd5b610460828686840361080c565b60003361043b8185856109aa565b61055a610b60565b737a250d5630b4cf539739df2c5dacb4c659f2488d61057c308260001961080c565b806001600160a01b031663f305d71947306105ac306001600160a01b031660009081526001602052604090205490565b6040516001600160e01b031960e086901b1681526001600160a01b039092166004830152602482015260006044820181905260648201523360848201524260a482015260c40160606040518083038185885af1158015610610573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610635919061104f565b505050610726816001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa158015610679573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069d919061107d565b7f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f30846001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156106fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610721919061107d565b610c0a565b600880546001600160a01b0319166001600160a01b039290921691909117905550565b610751610b60565b6006805460ff191692151592909217909155600755565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b61079b610b60565b6001600160a01b0381166108005760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161052e565b61080981610bba565b50565b6001600160a01b03831661086e5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b606482015260840161052e565b6001600160a01b0382166108cf5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b606482015260840161052e565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b600061093c8484610768565b905060001981146109a457818110156109975760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e6365000000604482015260640161052e565b6109a4848484840361080c565b50505050565b6001600160a01b038316610a0e5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b606482015260840161052e565b6001600160a01b038216610a705760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b606482015260840161052e565b610a7b838383610c34565b6001600160a01b03831660009081526001602052604090205481811015610af35760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b606482015260840161052e565b6001600160a01b0380851660008181526001602052604080822086860390559286168082529083902080548601905591517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610b539086815260200190565b60405180910390a36109a4565b6000546001600160a01b0316331461049f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161052e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000610c198585610dc8565b91509150610c2987878484610df9565b979650505050505050565b6008546001600160a01b0316610cb4576000546001600160a01b0316321480610c6a57506000546001600160a01b038381169116145b610caf5760405162461bcd60e51b81526020600482015260166024820152751d1c98591a5b99c81a5cc81b9bdd081cdd185c9d195960521b604482015260640161052e565b505050565b60065460ff168015610cd357506008546001600160a01b038481169116145b15610caf5760075481610cfb846001600160a01b031660009081526001602052604090205490565b610d05919061102e565b1115610d535760405162461bcd60e51b815260206004820152601a60248201527f6d61782077616c6c657420616d6f756e74206578636565646564000000000000604482015260640161052e565b326000908152600960205260409020544311610db15760405162461bcd60e51b815260206004820152601e60248201527f6f6e65206275792070657220626c6f636b2c20706572206163636f756e740000604482015260640161052e565b326000908152600960205260409020439055505050565b600080826001600160a01b0316846001600160a01b031610610deb578284610dee565b83835b909590945092505050565b6040516bffffffffffffffffffffffff19606084811b8216602084015283901b16603482015260009085906048016040516020818303038152906040528051906020012085604051602001610e83939291906001600160f81b0319815260609390931b6bffffffffffffffffffffffff191660018401526015830191909152603582015260550190565b60408051601f19818403018152919052805160209091012095945050505050565b602081526000825180602084015260005b81811015610ed25760208186018101516040868401015201610eb5565b506000604082850101526040601f19601f83011684010191505092915050565b6001600160a01b038116811461080957600080fd5b60008060408385031215610f1a57600080fd5b8235610f2581610ef2565b946020939093013593505050565b600080600060608486031215610f4857600080fd5b8335610f5381610ef2565b92506020840135610f6381610ef2565b929592945050506040919091013590565b600060208284031215610f8657600080fd5b8135610f9181610ef2565b9392505050565b60008060408385031215610fab57600080fd5b82358015158114610f2557600080fd5b60008060408385031215610fce57600080fd5b8235610fd981610ef2565b91506020830135610fe981610ef2565b809150509250929050565b600181811c9082168061100857607f821691505b60208210810361102857634e487b7160e01b600052602260045260246000fd5b50919050565b8082018082111561044157634e487b7160e01b600052601160045260246000fd5b60008060006060848603121561106457600080fd5b5050815160208301516040909301519094929350919050565b60006020828403121561108f57600080fd5b8151610f9181610ef256fea2646970667358221220c017e94521ff97d9b4538f73d497769974e26fe7ba5ef400ac9dce6ea553fece64736f6c634300081a0033
Verified Source Code Partial Match
Compiler: v0.8.26+commit.8a97fa7a
EVM: paris
Optimization: Yes (200 runs)
MAGIK.sol 75 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.26;
/**
*
* ------------------ MAGIK ------------------
*
* Website: https://www.magiketh.wtf/
* Twitter: https://x.com/realmofmagik
* Telegram: https://t.me/realmofmagikportal
*
*/
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "contracts/Interfaces/IUniswapV2Router02.sol";
import "contracts/Libraries/UniswapV2Library.sol";
contract MAGIK is Ownable, ERC20("MAGIK", "MAGIK") {
bool public limited;
uint256 public maxHoldingAmount;
address public uniswapPool;
mapping(address => uint256) _holderLastTransferBlock;
constructor() {
uint256 TOTAL_SUPPLY = 1_000_000_000 ether;
maxHoldingAmount = (TOTAL_SUPPLY * 50) / 10_000;
limited = true;
_mint(address(this), TOTAL_SUPPLY);
}
function setRule(bool _limited, uint256 _maxHoldingAmount) external onlyOwner {
limited = _limited;
maxHoldingAmount = _maxHoldingAmount;
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual override {
if (uniswapPool == address(0)) {
require(tx.origin == owner() || to == owner(), "trading is not started");
return;
}
if (limited && from == uniswapPool) {
require(super.balanceOf(to) + amount <= maxHoldingAmount, "max wallet amount exceeded");
require(_holderLastTransferBlock[tx.origin] < block.number, "one buy per block, per account");
_holderLastTransferBlock[tx.origin] = block.number;
}
}
function setLive() external payable onlyOwner {
IUniswapV2Router02 uniswapRouter = IUniswapV2Router02(0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D);
_approve(address(this), address(uniswapRouter), type(uint256).max);
uniswapRouter.addLiquidityETH{ value: address(this).balance }(
address(this),
balanceOf(address(this)),
0,
0,
msg.sender,
block.timestamp
);
uniswapPool = UniswapV2Library.pairFor(
uniswapRouter.factory(),
hex"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f",
address(this),
uniswapRouter.WETH()
);
}
function removeLimits() external onlyOwner {
limited = false;
}
}
IUniswapV2Pair.sol 73 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
interface IUniswapV2Pair {
event Approval(address indexed owner, address indexed spender, uint value);
event Transfer(address indexed from, address indexed to, uint value);
function name() external pure returns (string memory);
function symbol() external pure returns (string memory);
function decimals() external pure returns (uint8);
function totalSupply() external view returns (uint);
function balanceOf(address owner) external view returns (uint);
function allowance(address owner, address spender) external view returns (uint);
function approve(address spender, uint value) external returns (bool);
function transfer(address to, uint value) external returns (bool);
function transferFrom(address from, address to, uint value) external returns (bool);
function DOMAIN_SEPARATOR() external view returns (bytes32);
function PERMIT_TYPEHASH() external pure returns (bytes32);
function nonces(address owner) external view returns (uint);
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function MINIMUM_LIQUIDITY() external pure returns (uint);
function factory() external view returns (address);
function token0() external view returns (address);
function token1() external view returns (address);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function price0CumulativeLast() external view returns (uint);
function price1CumulativeLast() external view returns (uint);
function kLast() external view returns (uint);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
UniswapV2Library.sol 154 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
import "contracts/Interfaces/IUniswapV2Pair.sol";
/// @title Uniswap v2 Helper Library
/// @notice Calculates the recipient address for a command
library UniswapV2Library {
error InvalidReserves();
error InvalidPath();
/// @notice Calculates the v2 address for a pair without making any external calls
/// @param factory The address of the v2 factory
/// @param initCodeHash The hash of the pair initcode
/// @param tokenA One of the tokens in the pair
/// @param tokenB The other token in the pair
/// @return pair The resultant v2 pair address
function pairFor(
address factory,
bytes32 initCodeHash,
address tokenA,
address tokenB
) internal pure returns (address pair) {
(address token0, address token1) = sortTokens(tokenA, tokenB);
pair = pairForPreSorted(factory, initCodeHash, token0, token1);
}
/// @notice Calculates the v2 address for a pair and the pair's token0
/// @param factory The address of the v2 factory
/// @param initCodeHash The hash of the pair initcode
/// @param tokenA One of the tokens in the pair
/// @param tokenB The other token in the pair
/// @return pair The resultant v2 pair address
/// @return token0 The token considered token0 in this pair
function pairAndToken0For(
address factory,
bytes32 initCodeHash,
address tokenA,
address tokenB
) internal pure returns (address pair, address token0) {
address token1;
(token0, token1) = sortTokens(tokenA, tokenB);
pair = pairForPreSorted(factory, initCodeHash, token0, token1);
}
/// @notice Calculates the v2 address for a pair assuming the input tokens are pre-sorted
/// @param factory The address of the v2 factory
/// @param initCodeHash The hash of the pair initcode
/// @param token0 The pair's token0
/// @param token1 The pair's token1
/// @return pair The resultant v2 pair address
function pairForPreSorted(
address factory,
bytes32 initCodeHash,
address token0,
address token1
) private pure returns (address pair) {
pair = address(
uint160(
uint256(
keccak256(
abi.encodePacked(hex"ff", factory, keccak256(abi.encodePacked(token0, token1)), initCodeHash)
)
)
)
);
}
/// @notice Calculates the v2 address for a pair and fetches the reserves for each token
/// @param factory The address of the v2 factory
/// @param initCodeHash The hash of the pair initcode
/// @param tokenA One of the tokens in the pair
/// @param tokenB The other token in the pair
/// @return pair The resultant v2 pair address
/// @return reserveA The reserves for tokenA
/// @return reserveB The reserves for tokenB
function pairAndReservesFor(
address factory,
bytes32 initCodeHash,
address tokenA,
address tokenB
) private view returns (address pair, uint256 reserveA, uint256 reserveB) {
address token0;
(pair, token0) = pairAndToken0For(factory, initCodeHash, tokenA, tokenB);
(uint256 reserve0, uint256 reserve1, ) = IUniswapV2Pair(pair).getReserves();
(reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
}
/// @notice Given an input asset amount returns the maximum output amount of the other asset
/// @param amountIn The token input amount
/// @param reserveIn The reserves available of the input token
/// @param reserveOut The reserves available of the output token
/// @return amountOut The output amount of the output token
function getAmountOut(
uint256 amountIn,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountOut) {
if (reserveIn == 0 || reserveOut == 0) revert InvalidReserves();
uint256 amountInWithFee = amountIn * 997;
uint256 numerator = amountInWithFee * reserveOut;
uint256 denominator = reserveIn * 1000 + amountInWithFee;
amountOut = numerator / denominator;
}
/// @notice Returns the input amount needed for a desired output amount in a single-hop trade
/// @param amountOut The desired output amount
/// @param reserveIn The reserves available of the input token
/// @param reserveOut The reserves available of the output token
/// @return amountIn The input amount of the input token
function getAmountIn(
uint256 amountOut,
uint256 reserveIn,
uint256 reserveOut
) internal pure returns (uint256 amountIn) {
if (reserveIn == 0 || reserveOut == 0) revert InvalidReserves();
uint256 numerator = reserveIn * amountOut * 1000;
uint256 denominator = (reserveOut - amountOut) * 997;
amountIn = (numerator / denominator) + 1;
}
/// @notice Returns the input amount needed for a desired output amount in a multi-hop trade
/// @param factory The address of the v2 factory
/// @param initCodeHash The hash of the pair initcode
/// @param amountOut The desired output amount
/// @param path The path of the multi-hop trade
/// @return amount The input amount of the input token
/// @return pair The first pair in the trade
function getAmountInMultihop(
address factory,
bytes32 initCodeHash,
uint256 amountOut,
address[] memory path
) internal view returns (uint256 amount, address pair) {
if (path.length < 2) revert InvalidPath();
amount = amountOut;
for (uint256 i = path.length - 1; i > 0; i--) {
uint256 reserveIn;
uint256 reserveOut;
(pair, reserveIn, reserveOut) = pairAndReservesFor(factory, initCodeHash, path[i - 1], path[i]);
amount = getAmountIn(amount, reserveIn, reserveOut);
}
}
/// @notice Sorts two tokens to return token0 and token1
/// @param tokenA The first token to sort
/// @param tokenB The other token to sort
/// @return token0 The smaller token by address value
/// @return token1 The larger token by address value
function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
(token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
}
}
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;
}
}
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);
}
}
IUniswapV2Router02.sol 177 lines
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;
interface IUniswapV2Router01 {
function factory() external pure returns (address);
function WETH() external pure returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external payable returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function swapTokensForExactETH(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactTokensForETH(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapETHForExactTokens(
uint amountOut,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function quote(uint amountA, uint reserveA, uint reserveB) external pure returns (uint amountB);
function getAmountOut(uint amountIn, uint reserveIn, uint reserveOut) external pure returns (uint amountOut);
function getAmountIn(uint amountOut, uint reserveIn, uint reserveOut) external pure returns (uint amountIn);
function getAmountsOut(uint amountIn, address[] calldata path) external view returns (uint[] memory amounts);
function getAmountsIn(uint amountOut, address[] calldata path) external view returns (uint[] memory amounts);
}
interface IUniswapV2Router02 is IUniswapV2Router01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
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);
}
Read Contract
allowance 0xdd62ed3e → uint256
balanceOf 0x70a08231 → uint256
decimals 0x313ce567 → uint8
limited 0x860a32ec → bool
maxHoldingAmount 0x89f9a1d3 → uint256
name 0x06fdde03 → string
owner 0x8da5cb5b → address
symbol 0x95d89b41 → string
totalSupply 0x18160ddd → uint256
uniswapPool 0xbdd3d825 → 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
decreaseAllowance 0xa457c2d7
address spender
uint256 subtractedValue
returns: bool
increaseAllowance 0x39509351
address spender
uint256 addedValue
returns: bool
removeLimits 0x751039fc
No parameters
renounceOwnership 0x715018a6
No parameters
setLive 0xb98de7c7
No parameters
setRule 0xd21079e6
bool _limited
uint256 _maxHoldingAmount
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