Parrot DeFi
  • Introduction to Parrot Defi
  • Contracts
    • iPEGG (IoTeX)
    • BPEGG (IoTeX)
    • Masterchef (IoTeX)
    • Timelock (IoTeX)
    • PPEGG (Arbitrum)
    • BPEGG (Arbitrum)
    • Masterchef (Arbitrum)
    • Timelock (Arbitrum)
  • Networks
    • IoTeX
    • Arbitrum
  • General Info
    • Roadmap
    • Tokenomics
    • Security
      • Goose V2 Fork (READ ME)
      • KYC
      • Audit
      • Timelock
      • Anti-bot
      • Flash-loan attacks
      • RugDoc Review
      • MCN Review
  • Support
    • Faucet for IoTeX
    • Bridge to IoTeX
    • Add IoTeX to Metamask
    • Bridge to Arbitrum
    • Add Arbitrum to Metamask
    • Emergency Withdraw
  • Products
    • Yield Farming LP Pools ☑️
    • Staking Pools ☑️
    • Incubator Arbitrum ☑️
    • Incubator IoTeX
    • Auto-Compound Vaults🛠
    • Dividends Vaults🛠
    • ICO/IFO🛠
    • Exchange (AMM)🛠
  • Resources
    • How to start farming
    • Farming Strategies
  • Social
    • Web (IoTeX)
    • Web (Arbitrum)
    • Telegram
    • Twitter
    • Medium
Powered by GitBook
On this page

Was this helpful?

  1. General Info
  2. Security

Anti-bot

PreviousTimelockNextFlash-loan attacks

Last updated 3 years ago

Was this helpful?

Our tokens features an anti-bot. Is based on Max transaction size, but notice that can only be set higher, never lower. That prevents us from blocking sells, a common rugpull technique.

You can find the anti-bot at PPEGG contract from lines 912 to 976

    /**
     * @dev Sets the maxTransactionSize
     * 
     * This prevents users to buy and transfer before the dev allows it.
     * Can also prevent masive buys from bots.
     * The maxTransactionSize can only increase, so the dev can't block transaction.
     *
     * Requirements
     *
     * - `msg.sender` must be the token owner
     * - `maxTransactionSize` value must be higher than current value
     * - `msg.sender` must be the maxTransactionSizeOwner
     */
    function setMaxTransactionSize(uint256 _maxTransactionSize) public  {
        require(msg.sender == maxTransactionSizeOwner);
        require(_maxTransactionSize > maxTransactionSize, "New maxTransactionSize value must be higher than current value");
        maxTransactionSize = _maxTransactionSize;
    }
    
    
    /**
     * @dev renounces the maxTransactionSizeOwner
     * 
     * This sends the ownership of the maxTransactionSizeOwner to the zero address
     *
     * Requirements
     *
     * - `msg.sender` must be maxTransactionSizeOwner
     */
    function renounceMaxTransactionSizeOwner() public {
        require (msg.sender == maxTransactionSizeOwner);
        maxTransactionSizeOwner = address(0);
    }

    /**
     * @dev Moves tokens `amount` from `sender` to `recipient`.
     *
     * This is internal function is equivalent to {transfer}, and can be used to
     * e.g. implement automatic token fees, slashing mechanisms, etc.
     *
     * Emits a {Transfer} event.
     *
     * Requirements:
     *
     * - `sender` cannot be the zero address.
     * - `recipient` cannot be the zero address.
     * - `sender` must have a balance of at least `amount`.
     * - `amount` must be lower than maxTransactionSize
     */
    function _transfer(
        address sender,
        address recipient,
        uint256 amount
    ) internal virtual {
        require(sender != address(0), "BEP20: transfer from the zero address");
        require(recipient != address(0), "BEP20: transfer to the zero address");
        require(amount <= maxTransactionSize || sender == owner(), "BEP20: transfer amount over maxTransactionSize");

        _balances[sender] = _balances[sender].sub(
            amount,
            "BEP20: transfer amount exceeds balance"
        );
        _balances[recipient] = _balances[recipient].add(amount);
        emit Transfer(sender, recipient, amount);
    }

The function has an owner, we did it this way to avoid conflicts with transferring ownership to masterchef.

https://arbiscan.io/address/0x78055daa07035aa5ebc3e5139c281ce6312e1b22#code