{
 "address": "poo1DMTgPn2FzaroASiECkTQsVh8jqvcP93rFFtc4ox",
 "metadata": {
  "name": "abyss_pool",
  "version": "0.1.0",
  "spec": "0.1.0",
  "description": "Abyss AMM for graduated tokens (constant product x*y=k, Pinocchio). No LP tokens: liquidity permanently locked in PDA vaults (= LP burn). Migration = one tx [initialize_pool, curve.migrate]."
 },
 "instructions": [
  {
   "name": "initialize_pool",
   "discriminator": [
    0
   ],
   "docs": [
    "Permissionless. Requires curve launch graduated (real_sol >= 75 SOL, state=TRADING). treasury/fee_bps are copied from the curve config (config and launch are validated as PDAs under the launch owner program)."
   ],
   "accounts": [
    {
     "name": "payer",
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "docs": [
      "curve config; PDA ['config'] under launch.owner"
     ]
    },
    {
     "name": "launch",
     "docs": [
      "curve launch; PDA ['launch', mint] under launch.owner"
     ]
    },
    {
     "name": "mint"
    },
    {
     "name": "pool",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": "pool"
       },
       {
        "kind": "account",
        "path": "mint"
       },
       {
        "kind": "accountData",
        "path": "launch.owner"
       }
      ]
     },
     "docs": [
      "3rd seed = launch.owner (the curve program id)"
     ]
    },
    {
     "name": "pool_sol_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": "pool_sol_vault"
       },
       {
        "kind": "account",
        "path": "mint"
       },
       {
        "kind": "accountData",
        "path": "launch.owner"
       }
      ]
     },
     "docs": [
      "3rd seed = launch.owner (the curve program id)"
     ]
    },
    {
     "name": "pool_token_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": "pool_token_vault"
       },
       {
        "kind": "account",
        "path": "mint"
       },
       {
        "kind": "accountData",
        "path": "launch.owner"
       }
      ]
     },
     "docs": [
      "Token-2022 account, token-owner = pool PDA",
      "3rd seed = launch.owner (the curve program id)"
     ]
    },
    {
     "name": "token_program",
     "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    }
   ],
   "args": []
  },
  {
   "name": "buy",
   "discriminator": [
    1
   ],
   "accounts": [
    {
     "name": "user",
     "writable": true,
     "signer": true
    },
    {
     "name": "pool",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": "pool"
       },
       {
        "kind": "account",
        "path": "mint"
       },
       {
        "kind": "account",
        "path": "curve_program"
       }
      ]
     }
    },
    {
     "name": "curve_program",
     "docs": [
      "curve program id that created the launch; namespaces pool PDAs"
     ]
    },
    {
     "name": "mint"
    },
    {
     "name": "pool_sol_vault",
     "writable": true
    },
    {
     "name": "pool_token_vault",
     "writable": true
    },
    {
     "name": "user_ata",
     "writable": true
    },
    {
     "name": "treasury",
     "writable": true,
     "docs": [
      "must equal pool.treasury"
     ]
    },
    {
     "name": "token_program",
     "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    }
   ],
   "args": [
    {
     "name": "sol_in",
     "type": "u64",
     "docs": [
      "gross lamports; fee_bps taken first"
     ]
    },
    {
     "name": "min_tokens_out",
     "type": "u64",
     "docs": [
      "slippage guard"
     ]
    }
   ],
   "remaining_accounts": "Mints with the transfer hook: append 4 remaining accounts [sender_taint (writable), recipient_taint (writable), hook_program, extra_metas]. taint = hook PDA ['taint', token_account] of the source / destination token account; extra_metas = hook PDA ['extra-account-metas', mint]."
  },
  {
   "name": "sell",
   "discriminator": [
    2
   ],
   "accounts": [
    {
     "name": "user",
     "writable": true,
     "signer": true
    },
    {
     "name": "pool"
    },
    {
     "name": "curve_program",
     "docs": [
      "curve program id that created the launch; namespaces pool PDAs"
     ]
    },
    {
     "name": "mint"
    },
    {
     "name": "pool_sol_vault",
     "writable": true
    },
    {
     "name": "pool_token_vault",
     "writable": true
    },
    {
     "name": "user_ata",
     "writable": true,
     "docs": [
      "Must be the user's canonical Token-2022 ATA for mint (ATA program PDA [user, token_program, mint]); anything else fails with 105"
     ]
    },
    {
     "name": "treasury",
     "writable": true
    },
    {
     "name": "throttle",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": "throttle"
       },
       {
        "kind": "account",
        "path": "pool"
       },
       {
        "kind": "account",
        "path": "user"
       }
      ]
     },
     "docs": [
      "Sell throttle bucket of this wallet on this pool. Created on the first sell, rent paid by user."
     ]
    },
    {
     "name": "token_program",
     "address": "TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    }
   ],
   "args": [
    {
     "name": "tok_in",
     "type": "u64"
    },
    {
     "name": "min_sol_out",
     "type": "u64",
     "docs": [
      "slippage guard, net of fee"
     ]
    }
   ],
   "docs": [
    "Same progressive throttle as the curve (fresh bucket after migration). Every sell is recorded; the launch dev stays on the 25% tier forever. A seller whose token account is tainted or flagged by the hook is on the 25% tier too."
   ],
   "remaining_accounts": "Mints with the transfer hook: append 4 remaining accounts [sender_taint (writable), recipient_taint (writable), hook_program, extra_metas]. taint = hook PDA ['taint', token_account] of the source / destination token account; extra_metas = hook PDA ['extra-account-metas', mint]."
  }
 ],
 "accounts": [
  {
   "name": "Pool"
  },
  {
   "name": "Throttle"
  }
 ],
 "types": [
  {
   "name": "Pool",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "mint",
      "type": "pubkey"
     },
     {
      "name": "curve_program",
      "type": "pubkey"
     },
     {
      "name": "treasury",
      "type": "pubkey"
     },
     {
      "name": "fee_bps",
      "type": "u64"
     },
     {
      "name": "bump",
      "type": "u8"
     },
     {
      "name": "_pad",
      "type": {
       "array": [
        "u8",
        7
       ]
      }
     },
     {
      "name": "dev",
      "type": "pubkey",
      "docs": [
       "launch dev, copied at initialize_pool"
      ]
     }
    ]
   }
  },
  {
   "name": "Throttle",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "sold",
      "type": "u64",
      "docs": [
       "bucket level at last_sell_ts; drains linearly to 0 over 86400 s"
      ]
     },
     {
      "name": "last_sell_ts",
      "type": "i64"
     },
     {
      "name": "bump",
      "type": "u8"
     }
    ]
   }
  }
 ],
 "errors": [
  {
   "code": 100,
   "name": "Slippage",
   "msg": "output below the minimum (or zero)"
  },
  {
   "code": 101,
   "name": "Throttled",
   "msg": "sell exceeds the wallet's rolling 24h limit"
  },
  {
   "code": 103,
   "name": "NotGraduated",
   "msg": "curve has not reached 75 SOL"
  },
  {
   "code": 104,
   "name": "NotTrading",
   "msg": "launch is not in TRADING state"
  },
  {
   "code": 105,
   "name": "BadAta",
   "msg": "user_ata is not the user's canonical Token-2022 ATA"
  }
 ]
}
