All pages
Powered by GitBook
1 of 1

Smart 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

  • 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()

  • Allows owner to update buy fees

  • Ensures total fees don't exceed 10%

  • Emits UpdateBuyFees event

updateSellFees()

  • Similar to updateBuyFees but for sell transactions

  • Also caps total fees at 10%

updateWalletToWalletTransferFee()

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

  • Maximum fee capped at 5%

3. Wallet Management Functions

changeMarketingWallet()

  • Allows owner to change marketing wallet address

  • Prevents setting to zero address

  • Emits MarketingWalletChanged event

excludeFromFees()

  • Excludes/includes account from fees

  • Only callable by owner

  • Emits ExcludeFromFees event

4. Trading Functions

enableTrading()

function enableTrading()
  • Activates trading (initially disabled)

  • Also enables swapping functionality

  • Can only be called once

_transfer() (Internal)

function _transfer(address from, address to, uint256 amount)
  • 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()

function swapAndLiquify(uint256 tokens)
  • 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()

function swapAndSendMarketing(uint256 tokenAmount)
  • Swaps tokens for ETH

  • Sends ETH to marketing wallet

  • Emits SwapAndSendMarketing event

6. Limit Management Functions

Max Wallet Limits:

function setEnableMaxWalletLimit(bool enable)
function setMaxWalletAmount(uint256 _maxWalletAmount)
function excludeFromMaxWallet(address account, bool exclude)
  • Enable/disable wallet limit

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

  • Exclude addresses from limit

Max Transaction Limits:

function setEnableMaxTransactionLimit(bool enable)
function setMaxTransactionAmounts(uint256 _maxTransactionAmountBuy, uint256 _maxTransactionAmountSell)
function excludeFromMaxTransactionLimit(address account, bool exclude)
  • Similar to wallet limits but for transactions

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

7. Utility Functions

claimStuckTokens()

function claimStuckTokens(address token)
  • Allows owner to recover accidentally sent tokens

  • Cannot recover the token itself

setSwapTokensAtAmount()

function setSwapTokensAtAmount(uint256 newAmount)
  • Sets threshold for auto-swapping accumulated fees

  • Must be > 0.0001% of total supply

setSwapEnabled()

function setSwapEnabled(bool _enabled)
  • 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.