> ## Documentation Index
> Fetch the complete documentation index at: https://docs.kas.fun/llms.txt
> Use this file to discover all available pages before exploring further.

# Quick Start

> Connect to Kasplex and interact with KasFun contracts

Before you start, make sure you have the network and contract addresses configured. See [Addresses](/contracts/addresses) for details.

## Quick Example: Read Token Info

<CodeGroup>
  ```javascript ethers.js theme={null}
  import { ethers } from "ethers";

  const provider = new ethers.JsonRpcProvider("https://evmrpc.kasplex.org");

  const FACTORY = "0x..."; // MemeFactory Contract Address
  const FACTORY_ABI = [
    "function getTokenInfo(address token) view returns (tuple(uint256 tokenId, address creator, address pool, uint256 tokenReserves, uint256 kasReserves, uint256 createdAt, bool fulfilled, bool graduated, string metadataUri, uint256 paramVersion))",
    "function getCurrentPrice(address token) view returns (uint256)",
    "function getBondingCurveProgress(address token) view returns (uint256)",
  ];

  const factory = new ethers.Contract(FACTORY, FACTORY_ABI, provider);

  const TOKEN = "0x..."; // token address

  const info = await factory.getTokenInfo(TOKEN);
  const price = await factory.getCurrentPrice(TOKEN);
  const progress = await factory.getBondingCurveProgress(TOKEN);

  console.log("Token ID:", info.tokenId.toString());
  console.log("Reserves:", ethers.formatEther(info.kasReserves), "KAS");
  console.log("Price:", ethers.formatEther(price), "KAS");
  console.log("Progress:", Number(progress) / 100, "%");
  console.log("Graduated:", info.graduated);
  ```

  ```python web3.py theme={null}
  from web3 import Web3

  w3 = Web3(Web3.HTTPProvider("https://evmrpc.kasplex.org"))

  FACTORY = "0x..."  # MemeFactory Contract Address
  # Use full ABI from the Contract Reference section
  factory = w3.eth.contract(address=FACTORY, abi=FACTORY_ABI)

  TOKEN = "0x..."  # token address

  info = factory.functions.getTokenInfo(TOKEN).call()
  price = factory.functions.getCurrentPrice(TOKEN).call()
  progress = factory.functions.getBondingCurveProgress(TOKEN).call()

  print(f"Reserves: {w3.from_wei(info[4], 'ether')} KAS")
  print(f"Price: {w3.from_wei(price, 'ether')} KAS")
  print(f"Progress: {progress / 100}%")
  print(f"Graduated: {info[7]}")
  ```
</CodeGroup>

## Quick Example: Buy a Token

<CodeGroup>
  ```javascript ethers.js theme={null}
  import { ethers } from "ethers";

  const provider = new ethers.BrowserProvider(window.ethereum);
  const signer = await provider.getSigner();

  const FACTORY = "0x..."; // MemeFactory Contract Address
  const FACTORY_ABI = [
    "function buy(address token, uint256 minTokensOut) payable",
  ];

  const factory = new ethers.Contract(FACTORY, FACTORY_ABI, signer);

  const TOKEN = "0x...";
  const kasAmount = ethers.parseEther("100"); // 100 KAS
  const minTokensOut = 0n; // set proper slippage in production!

  const tx = await factory.buy(TOKEN, minTokensOut, { value: kasAmount });
  await tx.wait();
  console.log("Buy tx:", tx.hash);
  ```
</CodeGroup>

<Warning>
  Always set a proper `minTokensOut` for slippage protection. Using `0` means no slippage protection and is only safe for testing.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Contract Overview" icon="file-contract" href="/contracts/overview">
    Understand the contract architecture
  </Card>

  <Card title="Buy & Sell" icon="arrow-right-arrow-left" href="/contracts/buy-and-sell">
    Learn how to trade tokens with slippage protection
  </Card>

  <Card title="Price Calculation" icon="calculator" href="/contracts/price-calculation">
    Understand the bonding curve math
  </Card>

  <Card title="ABI Reference" icon="code" href="/reference/meme-factory">
    Full contract ABI reference
  </Card>
</CardGroup>
