codeSmart Contract

SHIM Token Smart Contract Analysis

Contract Overview

The SHIM token is an ERC-20 token with additional features like fee mechanisms, trading limits, and liquidity functions. It's designed to work with Uniswap V2 and includes anti-whale measures.

Core Functions

1. Constructor

Copy

constructor () ERC20("ShimaNest", "SHIM")
  • Initializes the token with name "ShimaNest" and symbol "SHIM"

  • Sets up router addresses for different chains (BSC mainnet/testnet, ETH mainnet/testnet)

  • Transfers ownership to 0x4F69F9cEDC6Cf0db1AF4DdCE364DcD9EEB1408dF

  • Creates Uniswap V2 pair

  • Sets initial fees (3% liquidity, 2% marketing on both buy/sell)

  • Configures wallet/transaction limits

  • Mints 20 billion tokens to owner

  • Disables trading initially

2. Fee Management Functions

updateBuyFees()

Copy

  • Allows owner to update buy fees

  • Ensures total fees don't exceed 10%

  • Emits UpdateBuyFees event

updateSellFees()

Copy

  • Similar to updateBuyFees but for sell transactions

  • Also caps total fees at 10%

updateWalletToWalletTransferFee()

Copy

  • Sets fee for wallet-to-wallet transfers (non-dex transactions)

  • Maximum fee capped at 5%

3. Wallet Management Functions

changeMarketingWallet()

Copy

  • Allows owner to change marketing wallet address

  • Prevents setting to zero address

  • Emits MarketingWalletChanged event

excludeFromFees()

Copy

  • Excludes/includes account from fees

  • Only callable by owner

  • Emits ExcludeFromFees event

4. Trading Functions

enableTrading()

Copy

  • Activates trading (initially disabled)

  • Also enables swapping functionality

  • Can only be called once

_transfer() (Internal)

Copy

  • Main transfer function with all fee logic

  • Checks trading status and limits

  • Handles fee collection and redistribution

  • Implements anti-whale measures

  • Processes swaps when thresholds are met

5. Liquidity Functions

swapAndLiquify()

Copy

  • Internal function that:

    1. Swaps half of tokens for ETH

    2. Adds liquidity with other half of tokens and received ETH

    3. Sends LP tokens to dead address

  • Emits SwapAndLiquify event

swapAndSendMarketing()

Copy

  • Swaps tokens for ETH

  • Sends ETH to marketing wallet

  • Emits SwapAndSendMarketing event

6. Limit Management Functions

Max Wallet Limits:

Copy

  • Enable/disable wallet limit

  • Set max wallet amount (min 1% of supply)

  • Exclude addresses from limit

Max Transaction Limits:

Copy

  • Similar to wallet limits but for transactions

  • Minimum 0.1% of supply for both buy/sell limits

7. Utility Functions

claimStuckTokens()

Copy

  • Allows owner to recover accidentally sent tokens

  • Cannot recover the token itself

setSwapTokensAtAmount()

Copy

  • Sets threshold for auto-swapping accumulated fees

  • Must be > 0.0001% of total supply

setSwapEnabled()

Copy

  • Toggles whether fee auto-swapping is active

Key Features

  1. Fee Mechanism:

    • Different fees for buying/selling (default 5% total)

    • Separate wallet-to-wallet transfer fee

    • Fees are split between liquidity and marketing

  2. Anti-Whale Protection:

    • Max wallet limit (default 2%)

    • Max transaction limits (default 1% buy/sell)

  3. Liquidity Management:

    • Automatic LP creation from fees

    • Marketing fees converted to ETH

  4. Security Measures:

    • Trading initially disabled

    • Owner can exclude addresses from limits/fees

    • Prevents setting dangerous limits (<0.1%)

  5. Multi-Chain Support:

    • Detects chain ID to use correct router addresses

    • Supports BSC and Ethereum mainnets/testnets

Events

The contract emits several events for important state changes:

  • Fee updates

  • Wallet/limit changes

  • Swap activities

  • Exclusions from limits/fees

  • Ownership transfers (from Ownable)

This comprehensive token contract includes robust features for DeFi trading while implementing protections against common issues like whale manipulation and providing flexibility for fee adjustments.

Last updated