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

# Contract Reference

> Contract ABIs, addresses, and function documentation for Alloca

# Contract Reference

Complete reference for all Alloca contracts deployed on Monad Mainnet.

## Core Contracts

### AllocaFactoryMemes

**Address:** `0x6bf9598B0838FB2d59c51D33fF839EEF6d79E923`

Factory contract for deploying meme tokens with bonding curves.

**Key Functions:**

| Function                     | Description                                           |
| ---------------------------- | ----------------------------------------------------- |
| `deployAllocaToken()`        | Deploy a new meme token with wMON (requires wrapping) |
| `deployAllocaTokenWithMon()` | Deploy with native MON (no wrapping required)         |

**Key Events:**

```solidity theme={null}
event AllocaDeployed(address indexed allocaPool, address indexed implementation)
```

***

### AllocaToken

**Address:** `0x33E0E10D089544D232ba7C0c27B4A3A5e139255e` (implementation template, cloned for each token)

Individual meme token contract with bonding curve and graduation logic.

**Key Functions:**

| Function                                                   | Description           |
| ---------------------------------------------------------- | --------------------- |
| `buyTokens(uint256 amountIn, uint256 minOut, address to)`  | Buy tokens            |
| `buyTokensWithMon(uint256 minOut, address to)`             | Buy with native MON   |
| `sellTokens(uint256 amountIn, uint256 minOut, address to)` | Sell tokens           |
| `getAmountInBuy(uint256 amountOut)`                        | Get quote for buying  |
| `getAmountOutSell(uint256 amountIn)`                       | Get quote for selling |

**Key Events:**

```solidity theme={null}
event TokensBought(
    address indexed buyer,
    uint256 amountIn,
    uint256 amountOut,
    uint256 fee
)

event TokensSold(
    address indexed seller,
    uint256 amountIn,
    uint256 amountOut,
    uint256 fee
)

event PoolGraduated(
    address indexed token,
    address indexed dexPair,
    uint256 liquidityTokens,
    uint256 liquidityBase,
    uint256 lpTokensMinted
)
```

***

### AllocaDexFactory

**Address:** `0xB88A4dD389c31b225e0ce6017c5AAa66eA894b79`

**INIT\_CODE\_HASH:** `0x4bf06597830d8ed18e40206b43000520aac99eb664c255297f0e44985f21b008`

Uniswap V2-style factory for creating trading pairs.

**Key Functions:**

| Function                                     | Description       |
| -------------------------------------------- | ----------------- |
| `createPair(address tokenA, address tokenB)` | Create a new pair |
| `getPair(address tokenA, address tokenB)`    | Get pair address  |
| `allPairs(uint256)`                          | Get pair by index |

**Key Events:**

```solidity theme={null}
event PairCreated(
    address indexed token0,
    address indexed token1,
    address pair,
    uint256
)
```

***

### AllocaDexRouter02

**Address:** `0x2a32C0457a84F1e50A035ffE1ecC4F104ed25eC3`

Uniswap V2-style router for swapping tokens and managing liquidity.

**Key Functions:**

| Function                     | Description             |
| ---------------------------- | ----------------------- |
| `swapExactTokensForTokens()` | Swap exact input        |
| `swapTokensForExactTokens()` | Swap for exact output   |
| `addLiquidity()`             | Add liquidity to a pair |
| `removeLiquidity()`          | Remove liquidity        |
| `getAmountsOut()`            | Get quote for swap      |

***

### AllocaDexPair

**Address:** Created automatically by factory

Uniswap V2-style pair contract for token swaps.

**Key Functions:**

| Function        | Description          |
| --------------- | -------------------- |
| `getReserves()` | Get current reserves |
| `swap()`        | Execute a swap       |
| `mint()`        | Mint LP tokens       |
| `burn()`        | Burn LP tokens       |

**Key Events:**

```solidity theme={null}
event Swap(
    address indexed sender,
    uint256 amount0In,
    uint256 amount1In,
    uint256 amount0Out,
    uint256 amount1Out,
    address indexed to
)

event Mint(address indexed sender, uint256 amount0, uint256 amount1)

event Burn(
    address indexed sender,
    uint256 amount0,
    uint256 amount1,
    address indexed to
)
```

***

## Loading ABIs

### Via IPFS (Recommended)

```javascript theme={null}
const ABIS = {
  AllocaFactoryMemes: "https://bafybeigd7v65ctexuz4kojry66mgehcltj7hh6rcml3idpidafuhz44owu.ipfs.w3s.link/AllocaFactoryMemes.json",
  AllocaToken: "https://bafybeidh6uoeotkkvxoaewjzdug3jbu3lk4m2xn7x7dvtwrfmria3qlyau.ipfs.w3s.link/AllocaToken.json",
  AllocaDexFactory: "https://bafybeiectiihv3npvnk5lkplghs3qk577532ibim4ruuayrfxjedx7jcb4.ipfs.w3s.link/AllocaDexFactory.json",
  AllocaDexRouter02: "https://bafybeicgh25dubwqfaqqxijnmrxyxmigg7swvrfwoyyiifwh4z3y7jv3c4.ipfs.w3s.link/AllocaDexRouter02.json",
};

// Load ABI
const factoryABI = await fetch(ABIS.AllocaFactoryMemes).then(r => r.json());
```

**Last Updated:** 2025-12-05
