> For the complete documentation index, see [llms.txt](https://yappr.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://yappr.gitbook.io/docs/developers/contracts-and-code.md).

# Contracts & Code

Verify everything yourself - trust through transparency

## Smart Contracts

### Overview

Yappr runs on two main programs deployed on Solana. Everything is immutable, verifiable, and has no admin keys. Sleep well.

### Core Programs

#### Main Program

**Address**: `[PROGRAM_ADDRESS]` **Devnet**: `[DEVNET_ADDRESS]`

**What it does:**

* Creates tokens (1B supply, always)
* Runs the bonding curve
* Manages phases (Dev → KOL → Public)
* Verifies Yapp scores
* Handles all the money stuff

**Key functions:**

* `create_token()` - Birth a new token
* `buy_tokens()` - Ape in
* `sell_tokens()` - Paper hand out
* `progress_phase()` - Move to next phase
* `verify_kol()` - Check Yapp score

#### Migration Program

**Address**: `[MIGRATION_ADDRESS]` **Devnet**: `[DEVNET_MIGRATION]`

**What it does:**

* Watches for $100k market cap
* Creates Meteora DLMM pool
* Transfers all liquidity
* Burns LP tokens forever
* Makes everything permanent

**Key functions:**

* `check_threshold()` - Is it time?
* `migrate_to_amm()` - Do the thing
* `burn_lp_tokens()` - No rugs possible
* `finalize()` - Point of no return

### Account Structure

#### Factory Config (PDA)

rust

```rust
pub struct FactoryConfig {
    pub authority: Pubkey,           // Who deployed (can't change anything)
    pub platform_wallet: Pubkey,     // Where fees go
    pub total_tokens_created: u64,   // Counter go brrr
}
```

#### Sale Config (PDA)

rust

```rust
pub struct SaleConfig {
    pub token_mint: Pubkey,          // The token address
    pub creator: Pubkey,             // Who made it
    pub phase: Phase,                // Dev/KOL/Public
    pub total_sold: u64,             // How much sold
    pub total_raised: u64,           // SOL raised
    pub migrated: bool,              // Has it graduated?
}
```

#### KOL Data (PDA)

rust

```rust
pub struct KolData {
    pub wallet: Pubkey,              // KOL's wallet
    pub yapp_score: u32,             // Their score
    pub allocation: u64,             // How much they can buy
    pub purchased: u64,              // How much they bought
}
```

### Security Features

#### No Upgrade Authority

Once deployed, that's it. We can't change it. You can't change it. Nobody can change it.

#### No Mint Authority

1 billion tokens created. That's all. Forever. No "oops we need more tokens."

#### Forced Migration

Hit $100k? Migration happens. No manual control. No "let's wait for better conditions."

#### LP Burning

LP tokens burned = liquidity locked forever. Actually forever, not "trust me bro" forever.

### How to Verify

#### Check the Code

1. Go to [Solana Explorer](https://explorer.solana.com)
2. Search our program addresses
3. Click "Verified" badge
4. Read the actual code

#### Verify Deployment

bash

```bash
# Check program owner (should be BPFLoader)
solana program show [PROGRAM_ADDRESS]

# Verify no upgrade authority
solana program show [PROGRAM_ADDRESS] --lamports
```

#### Test Transactions

All functions can be simulated before execution. Your wallet will show you exactly what happens.

### Integration Guide

#### Reading Data

javascript

```javascript
// Get token info
const saleConfig = await program.account.saleConfig.fetch(salePDA);

// Check price
const currentPrice = calculatePrice(saleConfig.totalSold);

// Get KOL allocation
const kolData = await program.account.kolData.fetch(kolPDA);
```

#### Buying Tokens

javascript

```javascript
// Build instruction
const ix = await program.methods
  .buyTokens(amount)
  .accounts({
    buyer: wallet.publicKey,
    saleConfig: salePDA,
    tokenMint: mintAddress,
  })
  .instruction();

// Send transaction
await sendTransaction([ix]);
```

### Audits & Security

**Internal Review**: ✅ Complete **External Audit**: 🔄 In progress **Bug Bounty**: Coming Soon

Found something? <security@yappr.fun>

### Common Questions

**"Can you change the contracts?"** No. Immutable means immutable.

**"What if there's a bug?"** We test extensively. If critical bug found, we'd deploy new version and migrate users.

**"How do I know it's safe?"** Read the code. It's all public. Get it audited yourself if you want.

**"Can you mint more tokens?"** No. 1 billion. That's it.

### For Developers

Full SDK coming soon. For now:

* Use `@coral-xyz/anchor` for interactions
* IDL available at \[yappr.fun/idl.json]
* Example code in our GitHub

***

**Remember**: If you don't trust, verify. All code is public, all transactions are visible, all PDAs are deterministic. That's the beauty of blockchain - you don't have to trust us.
