Skip to content
Verified contractExactMIT

CULT

Address0x23c07620f848841dcff106fe451c9fc29d6afce7
Balance

0 ETH

 

Transactions

92

 

Compiler

solc 0.8.34

 

Same code

Only this contract

 

Details

Compiler
solc 0.8.34+commit.80d5c536
Language
solidity
Optimization
Yes, 200 runs
License
MIT
Match
Exactcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
24,709,462
Creation transaction
0x0c9be9130c…dc096af5e4

CULT.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

//this one is for the culture.

// https://memeculture.io
// https://t.me/memecultureETH
// https://x.com/MemeCultureETH

import "./base/ERC20Extended.sol";
import "./base/Ownable2Step.sol";
import "./base/ReentrancyGuard.sol";
import "./interfaces/IUniswapV2Router02.sol";
import "./interfaces/IUniswapV2Factory.sol";
import "./interfaces/IUniswapV2Pair.sol";
import "./fees/FeeManager.sol";
import "./antibot/AntiBotGuard.sol";
import "./limits/LimitManager.sol";
import "./liquidity/LiquidityHandler.sol";
import "./trading/TradingEngine.sol";
import "./utils/SellCounter.sol";
import "./libraries/SafeERC20.sol";

contract CULT is
    ERC20Extended,
    Ownable2Step,
    ReentrancyGuard,
    FeeManager,
    LimitManager,
    LiquidityHandler,
    TradingEngine
{
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    uint256 public constant TOTAL_SUPPLY = 999_999_999 * 10**18;

    address public treasuryWallet;
    bool private _internalTransfer;

    event Unclogged(uint256 amount);
    event TreasuryWalletUpdated(address indexed oldWallet, address indexed newWallet);

    constructor(address _router, address _treasury)
        ERC20Extended("Meme Culture", "CULT")
        FeeManager(23, 33)
        LimitManager(TOTAL_SUPPLY / 1000, TOTAL_SUPPLY / 100)
    {
        require(_router != address(0), "CULT: router cannot be zero address");
        require(_treasury != address(0), "CULT: treasury cannot be zero address");

        treasuryWallet = _treasury;

        uniswapRouter = IUniswapV2Router02(_router);
        uniswapPair = IUniswapV2Factory(uniswapRouter.factory()).createPair(
            address(this),
            uniswapRouter.WETH()
        );

        swapThreshold = TOTAL_SUPPLY / 1000;

        isExemptFromLimits[msg.sender] = true;
        isExemptFromLimits[address(this)] = true;
        isExemptFromLimits[address(0)] = true;

        isWhitelisted[msg.sender] = true;
        isWhitelisted[address(this)] = true;

        _mint(msg.sender, TOTAL_SUPPLY);
    }

    // ─── Overrides required by compiler ──────────────────────────────────────

    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal override(ERC20Base, LiquidityHandler) {
        ERC20Base._approve(owner, spender, amount);
    }

    function _getBalance(address account) internal view override returns (uint256) {
        return balanceOf(account);
    }

    function _isAMMPair(address account) internal view override returns (bool) {
        return account == uniswapPair;
    }

    function transferOwnership(address newOwner)
        public
        override(Ownable, Ownable2Step)
        onlyOwner
    {
        Ownable2Step.transferOwnership(newOwner);
    }

    function renounceOwnership() public override onlyOwner {
        super.renounceOwnership();
    }

    // ─── Core transfer logic ──────────────────────────────────────────────────

    function _transfer(
        address from,
        address to,
        uint256 amount
    ) internal override {
        require(from != address(0), "CULT: transfer from zero address");
        require(to != address(0), "CULT: transfer to zero address");

        if (amount == 0) {
            super._transfer(from, to, 0);
            return;
        }

        require(_isTradingOpen(from, to), "CULT: trading not enabled");
        require(!isBlacklisted[from] && !isBlacklisted[to], "CULT: blacklisted address");

        bool isBuy = from == uniswapPair;
        bool isSell = to == uniswapPair;

        bool isExempt = isExemptFromLimits[from] || isExemptFromLimits[to];

        if (!isExempt) {
            _checkLimits(from, to, amount);
        }

        // Only enforce sell counter during normal trading (not dead block or anti-bot period)
        if (isSell && !_swapping && !isExempt && !_isDeadBlock() && !_isAntiBotBlock()) {
            _checkAndIncrementSells();
        }

        uint256 contractTokenBalance = balanceOf(address(this));
        bool canSwap = _shouldSwap(contractTokenBalance) && !isBuy;

        if (canSwap && !_swapping) {
            _swapTokensForEth(contractTokenBalance, treasuryWallet);
        }

        uint256 fee = 0;
        bool takeFee = (isBuy || isSell) &&
            !isWhitelisted[from] &&
            !isWhitelisted[to] &&
            !_swapping;

        if (takeFee) {
            if (_isDeadBlock()) {
                fee = _calculateDeadBlockFee(amount);
            } else if (_isAntiBotBlock()) {
                fee = _calculateAntiBotFee(amount);
            } else if (isBuy) {
                fee = _calculateBuyFee(amount);
            } else if (isSell) {
                fee = _calculateSellFee(amount);
            }
        }

        if (fee > 0) {
            super._transfer(from, address(this), fee);
            super._transfer(from, to, amount.sub(fee));
        } else {
            super._transfer(from, to, amount);
        }
    }

    // ─── Owner functions ──────────────────────────────────────────────────────

    function unclog() external onlyOwner nonReentrant {
        uint256 balance = balanceOf(address(this));
        require(balance > 0, "CULT: nothing to unclog");
        _swapTokensForEth(balance, treasuryWallet);
        emit Unclogged(balance);
    }

    function setTreasuryWallet(address _treasury) external onlyOwner {
        require(_treasury != address(0), "CULT: treasury cannot be zero address");
        emit TreasuryWalletUpdated(treasuryWallet, _treasury);
        treasuryWallet = _treasury;
    }

    function removeLimits() external onlyOwner {
        _removeLimits();
        _removeSellLimit();
    }

    receive() external payable {}
}

antibot/AntiBotGuard.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../base/Ownable.sol";
import "../utils/BlockTracker.sol";
import "../libraries/SafeMath.sol";
import "../base/Context.sol";

abstract contract AntiBotGuard is Ownable, BlockTracker {
    using SafeMath for uint256;

    mapping(address => bool) public isBlacklisted;
    mapping(address => bool) public isWhitelisted;

    event Blacklisted(address indexed account);
    event Unblacklisted(address indexed account);
    event Whitelisted(address indexed account);

    modifier notBlacklisted(address account) {
        require(!isBlacklisted[account], "AntiBotGuard: account is blacklisted");
        _;
    }

    function blacklist(address account) external onlyOwner {
        require(!isWhitelisted[account], "AntiBotGuard: cannot blacklist whitelisted address");
        require(!isBlacklisted[account], "AntiBotGuard: already blacklisted");
        isBlacklisted[account] = true;
        emit Blacklisted(account);
    }

    function unblacklist(address account) external onlyOwner {
        require(isBlacklisted[account], "AntiBotGuard: not blacklisted");
        isBlacklisted[account] = false;
        emit Unblacklisted(account);
    }

    function whitelist(address account) external onlyOwner {
        isWhitelisted[account] = true;
        if (isBlacklisted[account]) {
            isBlacklisted[account] = false;
            emit Unblacklisted(account);
        }
        emit Whitelisted(account);
    }

    function _isExemptFromAntiBot(address account) internal view returns (bool) {
        return isWhitelisted[account];
    }
}

base/Context.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

base/ERC20Base.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../interfaces/IERC20.sol";
import "../libraries/SafeMath.sol";
import "./Context.sol";

abstract contract ERC20Base is Context, IERC20 {
    using SafeMath for uint256;

    mapping(address => uint256) internal _balances;
    mapping(address => mapping(address => uint256)) internal _allowances;
    uint256 internal _totalSupply;

    function totalSupply() public view virtual override returns (uint256) {
        return _totalSupply;
    }

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

    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 _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");

        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);
    }

    function _mint(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: mint to the zero address");
        _totalSupply = _totalSupply.add(amount);
        unchecked {
            _balances[account] += amount;
        }
        emit Transfer(address(0), account, amount);
    }

    function _burn(address account, uint256 amount) internal virtual {
        require(account != address(0), "ERC20: burn from the zero address");
        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);
    }

    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);
            }
        }
    }
}

base/ERC20Extended.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "./ERC20Base.sol";
import "../interfaces/IERC20Metadata.sol";
import "../interfaces/IERC20.sol";
import "../libraries/SafeMath.sol";
import "./Context.sol";

abstract contract ERC20Extended is ERC20Base, IERC20Metadata {
    using SafeMath for uint256;

    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 transfer(address to, uint256 amount) public virtual override returns (bool) {
        address owner = _msgSender();
        _transfer(owner, to, amount);
        return true;
    }

    function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
        address owner = _msgSender();
        _approve(owner, spender, allowance(owner, spender).add(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;
    }
}

base/Ownable.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "./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);
    }
}

base/Ownable2Step.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "./Ownable.sol";
import "./Context.sol";

abstract contract Ownable2Step is Ownable {
    address private _pendingOwner;

    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);

    function pendingOwner() public view virtual returns (address) {
        return _pendingOwner;
    }

    function transferOwnership(address newOwner) public virtual override onlyOwner {
        _pendingOwner = newOwner;
        emit OwnershipTransferStarted(owner(), newOwner);
    }

    function acceptOwnership() public virtual {
        address sender = _msgSender();
        require(pendingOwner() == sender, "Ownable2Step: caller is not the new owner");
        _acceptOwnership();
    }

    function _acceptOwnership() internal virtual {
        address sender = _msgSender();
        delete _pendingOwner;
        _transferOwnership(sender);
    }
}

base/ReentrancyGuard.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

abstract contract ReentrancyGuard {
    uint256 private constant _NOT_ENTERED = 1;
    uint256 private constant _ENTERED = 2;

    uint256 private _status;

    constructor() {
        _status = _NOT_ENTERED;
    }

    modifier nonReentrant() {
        require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
        _status = _ENTERED;
        _;
        _status = _NOT_ENTERED;
    }
}

fees/FeeManager.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../base/Ownable.sol";
import "../libraries/SafeMath.sol";
import "../base/Context.sol";

abstract contract FeeManager is Ownable {
    using SafeMath for uint256;

    uint256 public buyFee;
    uint256 public sellFee;

    uint256 public constant MAX_FEE = 40;
    uint256 public constant FEE_DENOMINATOR = 100;
    uint256 public constant DEAD_BLOCK_FEE = 99;
    uint256 public constant ANTI_BOT_FEE = 80;

    event BuyFeeUpdated(uint256 oldFee, uint256 newFee);
    event SellFeeUpdated(uint256 oldFee, uint256 newFee);

    constructor(uint256 _buyFee, uint256 _sellFee) {
        require(_buyFee <= MAX_FEE, "FeeManager: buy fee exceeds max");
        require(_sellFee <= MAX_FEE, "FeeManager: sell fee exceeds max");
        buyFee = _buyFee;
        sellFee = _sellFee;
    }

    function setBuyFee(uint256 _buyFee) external onlyOwner {
        require(_buyFee <= MAX_FEE, "FeeManager: buy fee exceeds max");
        emit BuyFeeUpdated(buyFee, _buyFee);
        buyFee = _buyFee;
    }

    function setSellFee(uint256 _sellFee) external onlyOwner {
        require(_sellFee <= MAX_FEE, "FeeManager: sell fee exceeds max");
        emit SellFeeUpdated(sellFee, _sellFee);
        sellFee = _sellFee;
    }

    function _calculateBuyFee(uint256 amount) internal view returns (uint256) {
        return amount.mul(buyFee).div(FEE_DENOMINATOR);
    }

    function _calculateSellFee(uint256 amount) internal view returns (uint256) {
        return amount.mul(sellFee).div(FEE_DENOMINATOR);
    }

    function _calculateAntiBotFee(uint256 amount) internal pure returns (uint256) {
        return amount.mul(ANTI_BOT_FEE).div(FEE_DENOMINATOR);
    }

    function _calculateDeadBlockFee(uint256 amount) internal pure returns (uint256) {
        return amount.mul(DEAD_BLOCK_FEE).div(FEE_DENOMINATOR);
    }
}

interfaces/IERC20.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

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);
}

interfaces/IERC20Metadata.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

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);
}

interfaces/IUniswapV2Factory.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IUniswapV2Factory {
    function createPair(address tokenA, address tokenB) external returns (address pair);
    function getPair(address tokenA, address tokenB) external view returns (address pair);
}

interfaces/IUniswapV2Pair.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IUniswapV2Pair {
    function token0() external view returns (address);
    function token1() external view returns (address);
    function getReserves()
        external
        view
        returns (
            uint112 reserve0,
            uint112 reserve1,
            uint32 blockTimestampLast
        );
    function totalSupply() external view returns (uint256);
    function balanceOf(address owner) external view returns (uint256);
    function approve(address spender, uint256 value) external returns (bool);
    function transfer(address to, uint256 value) external returns (bool);
    function transferFrom(
        address from,
        address to,
        uint256 value
    ) external returns (bool);
}

interfaces/IUniswapV2Router02.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

interface IUniswapV2Router02 {
    function factory() external pure returns (address);
    function WETH() external pure returns (address);

    function addLiquidityETH(
        address token,
        uint256 amountTokenDesired,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    )
        external
        payable
        returns (
            uint256 amountToken,
            uint256 amountETH,
            uint256 liquidity
        );

    function removeLiquidityETH(
        address token,
        uint256 liquidity,
        uint256 amountTokenMin,
        uint256 amountETHMin,
        address to,
        uint256 deadline
    ) external returns (uint256 amountToken, uint256 amountETH);

    function swapExactTokensForETHSupportingFeeOnTransferTokens(
        uint256 amountIn,
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external;

    function swapExactETHForTokensSupportingFeeOnTransferTokens(
        uint256 amountOutMin,
        address[] calldata path,
        address to,
        uint256 deadline
    ) external payable;

    function getAmountsOut(uint256 amountIn, address[] calldata path)
        external
        view
        returns (uint256[] memory amounts);
}

libraries/Address.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

library Address {
    function isContract(address account) internal view returns (bool) {
        return account.code.length > 0;
    }

    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");
        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, "Address: low-level call failed");
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata, errorMessage);
    }

    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        if (success) {
            if (returndata.length == 0) {
                require(isContract(target), "Address: call to non-contract");
            }
            return returndata;
        } else {
            _revert(returndata, errorMessage);
        }
    }

    function _revert(bytes memory returndata, string memory errorMessage) private pure {
        if (returndata.length > 0) {
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert(errorMessage);
        }
    }
}

libraries/SafeERC20.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../interfaces/IERC20.sol";
import "./Address.sol";

library SafeERC20 {
    using Address for address;

    function safeTransfer(
        IERC20 token,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
    }

    function safeTransferFrom(
        IERC20 token,
        address from,
        address to,
        uint256 value
    ) internal {
        _callOptionalReturn(
            token,
            abi.encodeWithSelector(token.transferFrom.selector, from, to, value)
        );
    }

    function safeApprove(
        IERC20 token,
        address spender,
        uint256 value
    ) internal {
        require(
            (value == 0) || (token.allowance(address(this), spender) == 0),
            "SafeERC20: approve from non-zero to non-zero allowance"
        );
        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
    }

    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
        if (returndata.length > 0) {
            require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
        }
    }
}

libraries/SafeMath.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

library SafeMath {
    function add(uint256 a, uint256 b) internal pure returns (uint256) {
        uint256 c = a + b;
        require(c >= a, "SafeMath: addition overflow");
        return c;
    }

    function sub(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b <= a, "SafeMath: subtraction overflow");
        return a - b;
    }

    function sub(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b <= a, errorMessage);
        return a - b;
    }

    function mul(uint256 a, uint256 b) internal pure returns (uint256) {
        if (a == 0) return 0;
        uint256 c = a * b;
        require(c / a == b, "SafeMath: multiplication overflow");
        return c;
    }

    function div(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: division by zero");
        return a / b;
    }

    function div(
        uint256 a,
        uint256 b,
        string memory errorMessage
    ) internal pure returns (uint256) {
        require(b > 0, errorMessage);
        return a / b;
    }

    function mod(uint256 a, uint256 b) internal pure returns (uint256) {
        require(b > 0, "SafeMath: modulo by zero");
        return a % b;
    }
}

limits/LimitManager.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../base/Ownable.sol";
import "../libraries/SafeMath.sol";
import "../base/Context.sol";

abstract contract LimitManager is Ownable {
    using SafeMath for uint256;

    uint256 public maxTransactionAmount;
    uint256 public maxWalletAmount;
    bool public limitsActive;
    mapping(address => bool) public isExemptFromLimits;

    event LimitsRemoved();

    constructor(uint256 _maxTx, uint256 _maxWallet) {
        maxTransactionAmount = _maxTx;
        maxWalletAmount = _maxWallet;
        limitsActive = true;
    }

    function setExemptFromLimits(address account, bool exempt) external onlyOwner {
        isExemptFromLimits[account] = exempt;
    }

    function _getBalance(address account) internal view virtual returns (uint256);

    function _isAMMPair(address account) internal view virtual returns (bool);

    function _checkLimits(
        address from,
        address to,
        uint256 amount
    ) internal view {
        if (!limitsActive) return;
        if (isExemptFromLimits[from] || isExemptFromLimits[to]) return;
        require(amount <= maxTransactionAmount, "LimitManager: amount exceeds max transaction");
        if (!_isAMMPair(to)) {
            require(
                _getBalance(to).add(amount) <= maxWalletAmount,
                "LimitManager: recipient wallet exceeds max"
            );
        }
    }

    function _removeLimits() internal {
        limitsActive = false;
        emit LimitsRemoved();
    }
}

liquidity/LiquidityHandler.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../interfaces/IUniswapV2Router02.sol";
import "../interfaces/IUniswapV2Factory.sol";
import "../interfaces/IUniswapV2Pair.sol";
import "../interfaces/IERC20.sol";
import "../libraries/SafeMath.sol";
import "../libraries/SafeERC20.sol";
import "../base/Ownable.sol";
import "../base/ReentrancyGuard.sol";

abstract contract LiquidityHandler is Ownable, ReentrancyGuard {
    using SafeMath for uint256;
    using SafeERC20 for IERC20;

    IUniswapV2Router02 public uniswapRouter;
    address public uniswapPair;
    uint256 public swapThreshold;
    bool internal _swapping;

    event SwapThresholdUpdated(uint256 oldThreshold, uint256 newThreshold);

    modifier lockSwap() {
        _swapping = true;
        _;
        _swapping = false;
    }

    function setSwapThreshold(uint256 _threshold) external onlyOwner {
        emit SwapThresholdUpdated(swapThreshold, _threshold);
        swapThreshold = _threshold;
    }

    function _approve(
        address owner,
        address spender,
        uint256 amount
    ) internal virtual;

    function _swapTokensForEth(uint256 tokenAmount, address recipient) internal lockSwap {
        address[] memory path = new address[](2);
        path[0] = address(this);
        path[1] = uniswapRouter.WETH();

        _approve(address(this), address(uniswapRouter), tokenAmount);

        uniswapRouter.swapExactTokensForETHSupportingFeeOnTransferTokens(
            tokenAmount,
            0,
            path,
            recipient,
            block.timestamp
        );
    }

    function _shouldSwap(uint256 contractTokenBalance) internal view returns (bool) {
        return !_swapping && contractTokenBalance >= swapThreshold;
    }
}

trading/TradingEngine.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../base/Ownable.sol";
import "../utils/BlockTracker.sol";
import "../utils/SellCounter.sol";
import "../libraries/SafeMath.sol";
import "../antibot/AntiBotGuard.sol";

abstract contract TradingEngine is Ownable, BlockTracker, SellCounter, AntiBotGuard {
    using SafeMath for uint256;

    event TradingEnabled(uint256 blockNumber);

    function _enableTrading() internal {
        require(!tradingEnabled, "TradingEngine: trading already enabled");
        tradingEnabled = true;
        tradingEnabledBlock = block.number;
        emit TradingEnabled(block.number);
    }

    function enableTrading() public onlyOwner {
        _enableTrading();
    }

    function _isTradingOpen(address from, address to) internal view returns (bool) {
        return tradingEnabled || isWhitelisted[from] || isWhitelisted[to];
    }
}

utils/BlockTracker.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../base/Context.sol";

abstract contract BlockTracker is Context {
    uint256 public tradingEnabledBlock;
    bool public tradingEnabled;

    function _getCurrentBlock() internal view returns (uint256) {
        return block.number;
    }

    function _blocksSinceTrading() internal view returns (uint256) {
        if (!tradingEnabled) return 0;
        return block.number - tradingEnabledBlock;
    }

    function _isDeadBlock() internal view returns (bool) {
        return tradingEnabled && block.number == tradingEnabledBlock;
    }

    function _isAntiBotBlock() internal view returns (bool) {
        uint256 blocksSince = _blocksSinceTrading();
        return tradingEnabled && blocksSince >= 1 && blocksSince <= 3;
    }
}

utils/SellCounter.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../libraries/SafeMath.sol";
import "../base/Context.sol";

abstract contract SellCounter is Context {
    using SafeMath for uint256;

    mapping(uint256 => uint256) internal sellsInBlock;
    uint256 public maxSellsPerBlock;
    bool public sellLimitActive;

    constructor() {
        maxSellsPerBlock = 2;
        sellLimitActive = true;
    }

    function _checkAndIncrementSells() internal {
        if (!sellLimitActive) return;
        require(
            sellsInBlock[block.number] < maxSellsPerBlock,
            "CULT: max sells per block reached"
        );
        sellsInBlock[block.number] = sellsInBlock[block.number].add(1);
    }

    function _removeSellLimit() internal {
        sellLimitActive = false;
        maxSellsPerBlock = type(uint256).max;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": true
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.