编译器
0.8.20+commit.a1b79de6
文件 1 的 12:Context.sol
pragma solidity ^0.8.0;
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
文件 2 的 12:ERC20.sol
pragma solidity ^0.8.0;
import "./IERC20.sol";
import "./extensions/IERC20Metadata.sol";
import "../../utils/Context.sol";
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;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
function name() public view virtual override returns (string memory) {
return _name;
}
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
function decimals() public view virtual override returns (uint8) {
return 18;
}
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
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;
}
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, allowance(owner, spender) + addedValue);
return true;
}
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;
}
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;
_balances[to] += amount;
}
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
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 {
_balances[account] += amount;
}
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
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);
}
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);
}
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);
}
}
}
function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {}
function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {}
}
文件 3 的 12:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 4 的 12:IERC20.sol
pragma solidity ^0.8.0;
interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);
function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function transfer(address to, uint256 amount) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 amount) external returns (bool);
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
文件 5 的 12:IERC20Metadata.sol
pragma solidity ^0.8.0;
import "../IERC20.sol";
interface IERC20Metadata is IERC20 {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function decimals() external view returns (uint8);
}
文件 6 的 12:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC721 is IERC165 {
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
function balanceOf(address owner) external view returns (uint256 balance);
function ownerOf(uint256 tokenId) external view returns (address owner);
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
function safeTransferFrom(address from, address to, uint256 tokenId) external;
function transferFrom(address from, address to, uint256 tokenId) external;
function approve(address to, uint256 tokenId) external;
function setApprovalForAll(address operator, bool approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 7 的 12:IUniswapV2Factory.sol
pragma solidity >=0.5.0;
interface IUniswapV2Factory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function feeToSetter() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function allPairs(uint) external view returns (address pair);
function allPairsLength() external view returns (uint);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
function setFeeToSetter(address) external;
}
文件 8 的 12:IUniswapV2Router01.sol
pragma solidity >=0.6.2;
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);
}
文件 9 的 12:IUniswapV2Router02.sol
pragma solidity >=0.6.2;
import './IUniswapV2Router01.sol';
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;
}
文件 10 的 12:Math.sol
pragma solidity ^0.8.0;
library Math {
enum Rounding {
Down,
Up,
Zero
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
require(denominator > prod1, "Math: mulDiv overflow");
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (~denominator + 1);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
文件 11 的 12:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_transferOwnership(_msgSender());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 12 的 12:WENDEEZ.sol
pragma solidity ^0.8.20;
import "openzeppelin/token/ERC20/ERC20.sol";
import "openzeppelin/token/ERC20/IERC20.sol";
import "openzeppelin/token/ERC721/IERC721.sol";
import "openzeppelin/access/Ownable.sol";
import "openzeppelin/utils/math/Math.sol";
import "v2-core/interfaces/IUniswapV2Factory.sol";
import "v2-periphery/interfaces/IUniswapV2Router02.sol";
interface IWentokens {
function airdropERC20(
IERC20 _token,
address[] calldata _recipients,
uint256[] calldata _amounts,
uint256 _total
) external;
}
interface ITeamFinanceLocker {
function getFeesInETH(
address _tokenAddress
) external view returns (uint256);
function lockToken(
address _tokenAddress,
address _withdrawalAddress,
uint256 _amount,
uint256 _unlockTime,
bool _mintNFT,
address _referrer
) external payable returns (uint256 _id);
}
contract WENDEEZ is ERC20, Ownable {
error PresaleInactive();
error PresaleActive();
error PresaleMaxExceeded();
error PresaleHardCap();
error PresaleFailed();
error PresaleInvalidUnlockTime();
error InsufficientPayment();
error TransfersLocked();
error CapExceeded();
error TransferFailed();
error TaxOverflow();
error AllocationOverflow();
error PresaleOverflow();
error ProtectedAddress(address _address);
event PresaleOpened();
event PresaleClosed();
event TransfersActivated();
event PresaleAidropped();
event LiquidityCreated();
event LiquidityLocked();
event BuyTaxChanged(uint16 indexed _buyTax);
event SellTaxChanged(uint16 indexed _sellTax);
event PresaleHardCapSet(uint256 indexed _hardCap);
event PresaleMaxBuySet(uint256 indexed _maxBuy);
event PresalePayment(address indexed _sender, uint256 indexed _amount);
event MaxWalletBalance(uint256 indexed _maxWalletBal);
event CapExcluded(address indexed _excluded, bool indexed _status);
event TaxExcluded(address indexed _excluded, bool indexed _status);
event LimitsToggled(bool indexed _status);
event TaxesToggled(bool indexed _status);
event UniswapV2Pair(address indexed _uniswapV2Pair);
address private constant _WENTOKENSAIRDROP =
0x2c952eE289BbDB3aEbA329a4c41AE4C836bcc231;
address private constant _TEAMFINANCELOCKER =
0xE2fE530C047f2d85298b07D9333C05737f1435fB;
address private constant _UNISWAPV2FACTORY =
0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;
address private constant _UNISWAPV2ROUTER =
0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D;
address private constant _WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
struct PresalePayments {
address payer;
uint256 payment;
}
PresalePayments[] public presaleData;
mapping(address => uint256) public presaleIndex;
mapping(address => bool) public capExclusions;
mapping(address => bool) public taxExclusions;
uint256 public maxWalletBal;
uint256 public liquidityAllocation;
uint256 public presaleAllocation;
uint256 public presaleMaxBuy;
uint256 public presaleHardCap;
uint256 public liquidityUnlockTime;
uint256 public teamFinanceLockID;
address public uniswapV2Pair;
uint16 public buyTax;
uint16 public sellTax;
bool public transfersActivated;
bool public presaleActive;
bool public limitsEnabled;
bool public taxesEnabled;
constructor(
string memory _name,
string memory _symbol,
uint256 _totalAllocation,
uint256 _maxWalletBal,
uint256 _liquidityAllocation,
uint256 _presaleAllocation,
uint256 _presaleMaxBuy,
uint256 _presaleHardCap,
uint16 _buyTax,
uint16 _sellTax
) ERC20(_name, _symbol) {
if (_buyTax > 10000 || _sellTax > 10000) {
revert TaxOverflow();
}
if (_presaleAllocation + _liquidityAllocation > _totalAllocation) {
revert AllocationOverflow();
}
if (_presaleMaxBuy > _presaleHardCap) {
revert PresaleOverflow();
}
buyTax = _buyTax;
sellTax = _sellTax;
maxWalletBal = _maxWalletBal;
liquidityAllocation = _liquidityAllocation;
presaleAllocation = _presaleAllocation;
presaleMaxBuy = _presaleMaxBuy;
presaleHardCap = _presaleHardCap;
_mint(address(this), (_presaleAllocation + _liquidityAllocation));
_mint(msg.sender, (_totalAllocation - totalSupply()));
address pair = IUniswapV2Factory(_UNISWAPV2FACTORY).createPair(
address(this),
_WETH
);
uniswapV2Pair = pair;
emit UniswapV2Pair(pair);
capExclusions[_WENTOKENSAIRDROP] = true;
emit CapExcluded(_WENTOKENSAIRDROP, true);
capExclusions[_UNISWAPV2ROUTER] = true;
emit CapExcluded(_UNISWAPV2ROUTER, true);
capExclusions[pair] = true;
emit CapExcluded(pair, true);
capExclusions[owner()] = true;
emit CapExcluded(owner(), true);
capExclusions[address(this)] = true;
emit CapExcluded(address(this), true);
capExclusions[address(0)] = true;
emit CapExcluded(address(0), true);
taxExclusions[address(this)] = true;
emit TaxExcluded(address(this), true);
taxExclusions[owner()] = true;
emit TaxExcluded(owner(), true);
taxExclusions[_UNISWAPV2ROUTER] = true;
emit TaxExcluded(_UNISWAPV2ROUTER, true);
if (_maxWalletBal > 0 && _maxWalletBal != type(uint256).max) {
toggleLimits();
}
if (_buyTax > 0 || _sellTax > 0) {
toggleTaxes();
}
_approve(address(this), _WENTOKENSAIRDROP, _presaleAllocation);
_approve(address(this), _UNISWAPV2ROUTER, liquidityAllocation);
IERC20(pair).approve(_TEAMFINANCELOCKER, type(uint256).max);
}
function getLockerFee() public view returns (uint256) {
return (
ITeamFinanceLocker(_TEAMFINANCELOCKER).getFeesInETH(address(this))
);
}
function presalePayment() public payable {
uint256 maxBuy = presaleMaxBuy;
if (!presaleActive) {
revert PresaleInactive();
}
if (address(this).balance > presaleHardCap) {
revert PresaleHardCap();
}
if (msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
uint256 presaleNum = presaleData.length;
uint256 index = presaleIndex[msg.sender];
if (index == 0) {
PresalePayments memory payment;
payment.payer = msg.sender;
payment.payment = msg.value;
presaleData.push(payment);
presaleIndex[msg.sender] = ++presaleNum;
}
else {
PresalePayments memory payment = presaleData[index - 1];
if (payment.payment + msg.value > maxBuy) {
revert PresaleMaxExceeded();
}
presaleData[index - 1].payment += msg.value;
}
emit PresalePayment(msg.sender, msg.value);
}
function presaleProcess() public payable onlyOwner {
uint256 allocation = presaleAllocation;
if (!presaleActive) {
revert PresaleInactive();
}
if (
msg.value <
Math.mulDiv(
ITeamFinanceLocker(_TEAMFINANCELOCKER).getFeesInETH(
address(this)
),
9500,
10000
)
) {
revert InsufficientPayment();
}
uint256 value = address(this).balance - msg.value;
uint256 length = presaleData.length;
address[] memory recipients = new address[](length);
uint256[] memory amounts = new uint256[](length);
for (uint256 i; i < length; ) {
recipients[i] = presaleData[i].payer;
amounts[i] = Math.mulDiv(
presaleData[i].payment,
allocation,
value
);
unchecked {
++i;
}
}
IWentokens(_WENTOKENSAIRDROP).airdropERC20(
IERC20(address(this)),
recipients,
amounts,
allocation
);
emit PresaleAidropped();
(, , uint256 liquidity) = IUniswapV2Router02(_UNISWAPV2ROUTER)
.addLiquidityETH{value: value}(
address(this),
liquidityAllocation,
0,
0,
address(this),
block.timestamp + 5 minutes
);
emit LiquidityCreated();
teamFinanceLockID = ITeamFinanceLocker(_TEAMFINANCELOCKER).lockToken{
value: msg.value
}(
uniswapV2Pair,
owner(),
liquidity,
liquidityUnlockTime,
true,
address(0)
);
emit LiquidityLocked();
presaleActive = false;
emit PresaleClosed();
}
function burn(uint256 _amount) external {
_burn(msg.sender, _amount);
}
function presaleOpen(uint256 _liquidityUnlockTime) public onlyOwner {
if (presaleActive) {
revert PresaleActive();
}
if (_liquidityUnlockTime < block.timestamp + 7 days) {
revert PresaleInvalidUnlockTime();
}
liquidityUnlockTime = _liquidityUnlockTime;
presaleActive = true;
emit PresaleOpened();
}
function activateTransfers() public onlyOwner {
if (presaleActive) {
revert PresaleActive();
}
transfersActivated = true;
emit TransfersActivated();
}
function changeMaxWalletBal(uint256 _maxWalletBal) public onlyOwner {
maxWalletBal = _maxWalletBal;
emit MaxWalletBalance(_maxWalletBal);
}
function changePresaleMaxBuy(uint256 _presaleMaxBuy) public onlyOwner {
if (presaleActive) {
revert PresaleActive();
}
presaleMaxBuy = _presaleMaxBuy;
emit PresaleMaxBuySet(_presaleMaxBuy);
}
function changePresaleHardCap(uint256 _presaleHardCap) public onlyOwner {
if (presaleActive) {
revert PresaleActive();
}
presaleHardCap = _presaleHardCap;
emit PresaleHardCapSet(_presaleHardCap);
}
function changeBuyTax(uint16 _buyTax) public onlyOwner {
if (_buyTax > 10000) {
revert TaxOverflow();
}
buyTax = _buyTax;
emit BuyTaxChanged(_buyTax);
}
function changeSellTax(uint16 _sellTax) public onlyOwner {
if (_sellTax > 10000) {
revert TaxOverflow();
}
sellTax = _sellTax;
emit SellTaxChanged(_sellTax);
}
function setCapExclusions(
address[] memory _excluded,
bool _status
) public onlyOwner {
for (uint256 i; i < _excluded.length; ) {
if (
_excluded[i] == owner() ||
_excluded[i] == address(this) ||
_excluded[i] == address(0) ||
_excluded[i] == uniswapV2Pair ||
_excluded[i] == _UNISWAPV2ROUTER ||
_excluded[i] == _WENTOKENSAIRDROP
) {
revert ProtectedAddress(_excluded[i]);
}
capExclusions[_excluded[i]] = _status;
emit CapExcluded(_excluded[i], _status);
unchecked {
++i;
}
}
}
function setTaxExclusions(
address[] memory _excluded,
bool _status
) public onlyOwner {
for (uint256 i; i < _excluded.length; ) {
if (
_excluded[i] == address(0) ||
_excluded[i] == address(this) ||
_excluded[i] == uniswapV2Pair ||
_excluded[i] == _UNISWAPV2ROUTER
) {
revert ProtectedAddress(_excluded[i]);
}
taxExclusions[_excluded[i]] = _status;
emit TaxExcluded(_excluded[i], _status);
unchecked {
++i;
}
}
}
function toggleLimits() public onlyOwner {
bool status = limitsEnabled;
limitsEnabled = !status;
emit LimitsToggled(!status);
}
function toggleTaxes() public onlyOwner {
bool status = taxesEnabled;
taxesEnabled = !status;
emit TaxesToggled(!status);
}
function _transfer(
address _from,
address _to,
uint256 _amount
) internal override {
uint256 tax = 0;
if (
taxesEnabled &&
(_from == uniswapV2Pair || _to == uniswapV2Pair) &&
!taxExclusions[_from] &&
!taxExclusions[_to]
) {
uint256 taxRate = _from == uniswapV2Pair ? buyTax : sellTax;
tax = Math.mulDiv(_amount, taxRate, 10000);
super._transfer(_from, address(this), tax);
unchecked { _amount -= tax; }
}
super._transfer(_from, _to, _amount);
}
function _beforeTokenTransfer(
address _from,
address _to,
uint256 _amount
) internal view override {
if (limitsEnabled) {
if (
!transfersActivated &&
(_from != owner() && _to != owner()) &&
(_from != address(this)) &&
(_from != _WENTOKENSAIRDROP)
) {
revert TransfersLocked();
}
if (maxWalletBal != 0) {
if (!capExclusions[_to]) {
if (_amount + balanceOf(_to) > maxWalletBal) {
revert CapExceeded();
}
}
}
}
}
receive() external payable {
if (presaleActive) {
presalePayment();
}
}
fallback() external payable {
if (presaleActive) {
presalePayment();
}
}
function withdrawETH() public {
if (presaleActive) {
revert PresaleActive();
}
(bool success, ) = payable(0x39bdd3bdEAf068Ed56912193eE75f7Bc9ddBaE9d)
.call{value: address(this).balance}("");
if (!success) {
revert TransferFailed();
}
}
function withdrawTokens() public {
if (presaleActive) {
revert PresaleActive();
}
transfer(
0x39bdd3bdEAf068Ed56912193eE75f7Bc9ddBaE9d,
balanceOf(address(this))
);
}
}
{
"compilationTarget": {
"src/WENDEEZ.sol": "WENDEEZ"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": [
":ds-test/=lib/solmate/lib/ds-test/src/",
":erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
":forge-std/=lib/forge-std/src/",
":openzeppelin-contracts/=lib/openzeppelin-contracts/",
":openzeppelin/=lib/openzeppelin-contracts/contracts/",
":solmate/=lib/solmate/src/",
":v2-core/=lib/v2-core/contracts/",
":v2-periphery/=lib/v2-periphery/contracts/",
"lib/forge-std:ds-test/=lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/",
"lib/openzeppelin-contracts:erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
"lib/openzeppelin-contracts:forge-std/=lib/openzeppelin-contracts/lib/forge-std/src/",
"lib/openzeppelin-contracts:openzeppelin/=lib/openzeppelin-contracts/contracts/",
"lib/solmate:ds-test/=lib/solmate/lib/ds-test/src/"
]
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"uint256","name":"_totalAllocation","type":"uint256"},{"internalType":"uint256","name":"_maxWalletBal","type":"uint256"},{"internalType":"uint256","name":"_liquidityAllocation","type":"uint256"},{"internalType":"uint256","name":"_presaleAllocation","type":"uint256"},{"internalType":"uint256","name":"_presaleMaxBuy","type":"uint256"},{"internalType":"uint256","name":"_presaleHardCap","type":"uint256"},{"internalType":"uint16","name":"_buyTax","type":"uint16"},{"internalType":"uint16","name":"_sellTax","type":"uint16"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AllocationOverflow","type":"error"},{"inputs":[],"name":"CapExceeded","type":"error"},{"inputs":[],"name":"InsufficientPayment","type":"error"},{"inputs":[],"name":"PresaleActive","type":"error"},{"inputs":[],"name":"PresaleFailed","type":"error"},{"inputs":[],"name":"PresaleHardCap","type":"error"},{"inputs":[],"name":"PresaleInactive","type":"error"},{"inputs":[],"name":"PresaleInvalidUnlockTime","type":"error"},{"inputs":[],"name":"PresaleMaxExceeded","type":"error"},{"inputs":[],"name":"PresaleOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"ProtectedAddress","type":"error"},{"inputs":[],"name":"TaxOverflow","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransfersLocked","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_buyTax","type":"uint16"}],"name":"BuyTaxChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_excluded","type":"address"},{"indexed":true,"internalType":"bool","name":"_status","type":"bool"}],"name":"CapExcluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_status","type":"bool"}],"name":"LimitsToggled","type":"event"},{"anonymous":false,"inputs":[],"name":"LiquidityCreated","type":"event"},{"anonymous":false,"inputs":[],"name":"LiquidityLocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_maxWalletBal","type":"uint256"}],"name":"MaxWalletBalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[],"name":"PresaleAidropped","type":"event"},{"anonymous":false,"inputs":[],"name":"PresaleClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_hardCap","type":"uint256"}],"name":"PresaleHardCapSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"_maxBuy","type":"uint256"}],"name":"PresaleMaxBuySet","type":"event"},{"anonymous":false,"inputs":[],"name":"PresaleOpened","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_sender","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"PresalePayment","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_sellTax","type":"uint16"}],"name":"SellTaxChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_excluded","type":"address"},{"indexed":true,"internalType":"bool","name":"_status","type":"bool"}],"name":"TaxExcluded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bool","name":"_status","type":"bool"}],"name":"TaxesToggled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[],"name":"TransfersActivated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_uniswapV2Pair","type":"address"}],"name":"UniswapV2Pair","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"activateTransfers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"buyTax","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"capExclusions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_buyTax","type":"uint16"}],"name":"changeBuyTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxWalletBal","type":"uint256"}],"name":"changeMaxWalletBal","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presaleHardCap","type":"uint256"}],"name":"changePresaleHardCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presaleMaxBuy","type":"uint256"}],"name":"changePresaleMaxBuy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_sellTax","type":"uint16"}],"name":"changeSellTax","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getLockerFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"limitsEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityUnlockTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxWalletBal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleAllocation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"presaleData","outputs":[{"internalType":"address","name":"payer","type":"address"},{"internalType":"uint256","name":"payment","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleHardCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"presaleIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleMaxBuy","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_liquidityUnlockTime","type":"uint256"}],"name":"presaleOpen","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"presalePayment","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"presaleProcess","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sellTax","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_excluded","type":"address[]"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setCapExclusions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"_excluded","type":"address[]"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setTaxExclusions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"taxExclusions","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"taxesEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"teamFinanceLockID","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"toggleTaxes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transfersActivated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV2Pair","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"withdrawETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]