{
  "address": "Heist46B2L5u4oDxcGwTRSRgy7dvoVDhTSmgLGvtSAjC",
  "metadata": {
    "name": "heist",
    "version": "0.1.0",
    "spec": "0.1.0",
    "description": "Heistpad: every coin has a keep; holders escrow tokens to raid another coin's keep or to defend their own"
  },
  "instructions": [
    {
      "name": "accept_admin",
      "discriminator": [
        112,
        42,
        45,
        90,
        116,
        181,
        13,
        170
      ],
      "accounts": [
        {
          "name": "proposed",
          "signer": true
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        }
      ],
      "args": []
    },
    {
      "name": "buyback",
      "docs": [
        "The only way Keep SOL is spent: buys the coin with buyback_bps of the Keep (at most once per",
        "buyback_interval, never while the coin is the target of an active raid) and burns every token bought in",
        "the same instruction. min_out comes from the median: the buy fails with PriceAboveMedian when the current",
        "price is more than buyback_slippage_bps above what the median promises, so pumping the coin right before a",
        "buyback to sell into it does not work. `max_spend` (0 = none) lets the caller take a smaller bite.",
        "Audit M-3: the spend is also capped at BUYBACK_DEPTH_BPS (0.5%) of the venue's SOL reserves, and the buyback",
        "is refused (PricesDisagree) when its 7 observations spread by more than 2 x buyback_slippage_bps (max / min).",
        "The Keep itself never signs a pump / PumpSwap instruction (audit V-5): it moves exactly spend + a rent",
        "headroom into the Buyer PDA [\"buyer\", mint], which buys, burns and sends every unused lamport back, ending",
        "at its rent floor. Audit L-1: lamports someone sent to the Buyer PDA (or parked in its WSOL account) are",
        "first swept into the Keep and booked as `donated`, so they cannot make `spent` underflow.",
        "Invariant: buyer.lamports == floor between buybacks; spent = keep before + stray WSOL lamports - keep after.",
        "Must be alone in its transaction. On the curve: remaining = pump buy accounts (16+, user = Buyer,",
        "associated_user = Buyer ATA). After migration: remaining = PumpSwap buy accounts (23+, user = Buyer,",
        "user_base = Buyer ATA, user_quote = the Buyer's WSOL ATA); the Buyer wraps the spend into WSOL, buys with",
        "`buy_exact_quote_in`, burns, and closes the WSOL account back into itself."
      ],
      "discriminator": [
        106,
        117,
        64,
        30,
        56,
        69,
        7,
        45
      ],
      "accounts": [
        {
          "name": "caller",
          "signer": true
        },
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "obs",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  111,
                  98,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "buyer",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  98,
                  117,
                  121,
                  101,
                  114
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "mint",
          "writable": true
        },
        {
          "name": "buyer_ata",
          "writable": true
        },
        {
          "name": "curve",
          "writable": true
        },
        {
          "name": "token_program"
        },
        {
          "name": "ata_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "instructions",
          "address": "Sysvar1nstructions1111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "max_spend",
          "type": "u64"
        }
      ]
    },
    {
      "name": "claim_dev",
      "docs": [
        "Pays the dev's booked share to coin.dev. Anyone can push it; it can only go to the dev. A share below the",
        "rent floor of an empty wallet fails with BelowRentFloor and stays pending (L-4)."
      ],
      "discriminator": [
        67,
        144,
        21,
        238,
        28,
        66,
        170,
        208
      ],
      "accounts": [
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "dev",
          "writable": true,
          "relations": [
            "coin"
          ]
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "collect_fees",
      "docs": [
        "pump.fun collect_creator_fee into the coin's Fees PDA. Anyone can send it. After migration the keeper first",
        "moves PumpSwap's creator fees to pump with PumpSwap `transfer_creator_fees_to_pump` (permissionless).",
        "remaining = [fees, creator_vault, system, event_authority, pump]."
      ],
      "discriminator": [
        164,
        152,
        207,
        99,
        30,
        186,
        19,
        182
      ],
      "accounts": [
        {
          "name": "coin",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        }
      ],
      "args": []
    },
    {
      "name": "collect_treasury",
      "docs": [
        "Pays the treasury's booked share to config.treasury. Anyone can push it."
      ],
      "discriminator": [
        48,
        255,
        226,
        214,
        221,
        81,
        222,
        65
      ],
      "accounts": [
        {
          "name": "config",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        },
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "treasury",
          "writable": true
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "commit",
      "docs": [
        "Commits `amount` tokens of the side's coin (side 0 = attack = attacker coin, 1 = defense = target coin)",
        "into the raid escrow during the battle. Power = pricing::power on the side's stacked liquidation (as if the",
        "side's tokens already in escrow were sold first) with the coin's raid median, fixed now; audit M-2: also",
        "capped by the same stacked liquidation on the live reserves moved to the median price (same k), and the",
        "raid median needs >= 7 observations of the last 30 min spanning >= 15 min (see `commit_power`). A commit in the",
        "last soft_window_secs pushes the end by extension_secs (never past hard_end). `min_power` guards the",
        "committer against a price move between signing and landing. Must be alone in its transaction.",
        "remaining_accounts after migration: [pool, pool_base_token_account, pool_quote_token_account]."
      ],
      "discriminator": [
        223,
        140,
        142,
        165,
        229,
        208,
        156,
        74
      ],
      "accounts": [
        {
          "name": "wallet",
          "writable": true,
          "signer": true
        },
        {
          "name": "raid",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  97,
                  105,
                  100
                ]
              },
              {
                "kind": "account",
                "path": "raid.id",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "crew",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  114,
                  101,
                  119
                ]
              },
              {
                "kind": "account",
                "path": "raid"
              },
              {
                "kind": "arg",
                "path": "side"
              },
              {
                "kind": "account",
                "path": "wallet"
              }
            ]
          }
        },
        {
          "name": "mint"
        },
        {
          "name": "obs",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  111,
                  98,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "curve"
        },
        {
          "name": "wallet_tokens",
          "writable": true
        },
        {
          "name": "escrow",
          "writable": true
        },
        {
          "name": "token_program"
        },
        {
          "name": "ata_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "instructions",
          "address": "Sysvar1nstructions1111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "side",
          "type": "u8"
        },
        {
          "name": "amount",
          "type": "u64"
        },
        {
          "name": "min_power",
          "type": "u64"
        }
      ]
    },
    {
      "name": "declare",
      "docs": [
        "Declares a raid of `attacker_coin` on `target_coin`. The declarer posts the bond (it rides in the Raid",
        "account), must hold >= min_declare_holding_bps of the attacker coin's supply, and the target's Keep must",
        "hold >= min_target_keep. Prep starts now, the battle opens after prep_secs and lasts battle_secs (+ soft",
        "close extensions up to max_extension_secs). One active raid per target and per attacker; the target must be",
        "out of its shield, the attacker out of its cooldown. `max_bond` = the bond the client showed.",
        "Audit M-1: the bond is declare_bond << min(repels, MAX_BOND_SHIFT), repels = the target's raids that ended",
        "without an attack win, each within REPEL_WINDOW of the previous one (0 once REPEL_WINDOW passed since the",
        "last). Chained raids that only keep a target busy get exponentially dearer (a fizzle forfeits the bond).",
        "Must be alone in its transaction (the holding check cannot be flash-bought)."
      ],
      "discriminator": [
        255,
        117,
        104,
        245,
        147,
        158,
        160,
        131
      ],
      "accounts": [
        {
          "name": "declarer",
          "writable": true,
          "signer": true
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        },
        {
          "name": "attacker_coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "attacker_coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "target_coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "target_coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "target_keep",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "target_coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "attacker_mint"
        },
        {
          "name": "declarer_tokens"
        },
        {
          "name": "raid",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  97,
                  105,
                  100
                ]
              },
              {
                "kind": "account",
                "path": "config.raids",
                "account": "Config"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "instructions",
          "address": "Sysvar1nstructions1111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "max_bond",
          "type": "u64"
        }
      ]
    },
    {
      "name": "donate",
      "docs": [
        "Anyone can add SOL to a coin's Keep (booked as `donated`, shown on the site)."
      ],
      "discriminator": [
        121,
        186,
        218,
        211,
        73,
        70,
        196,
        180
      ],
      "accounts": [
        {
          "name": "donor",
          "writable": true,
          "signer": true
        },
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "init_config",
      "discriminator": [
        23,
        235,
        115,
        232,
        168,
        96,
        1,
        231
      ],
      "accounts": [
        {
          "name": "admin",
          "writable": true,
          "signer": true
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "treasury",
          "type": "pubkey"
        },
        {
          "name": "params",
          "type": {
            "defined": {
              "name": "Params"
            }
          }
        }
      ]
    },
    {
      "name": "launch",
      "docs": [
        "Launches a coin: pump create_v2 with the Fees PDA as creator (the dev pays pump's rents and the floors of",
        "the Fees and Keep PDAs), plus an optional dev buy in the same instruction (buyer = dev). Launch fee =",
        "floor(dev_buy * launch_fee_bps / 10000), on top of the buy, dev -> config.treasury. The first price",
        "observation is written from the curve right after the buy.",
        "Must be alone in its transaction (no snipe behind the create, no fee skip with dev_buy = 0 + an own buy).",
        "`expected_*` = the values the client showed; a config change in between fails with ParamsChanged.",
        "remaining_accounts = pump create_v2 accounts (16) [+ pump buy accounts (16+), user = dev, if dev_buy > 0]."
      ],
      "discriminator": [
        153,
        241,
        93,
        225,
        22,
        69,
        74,
        61
      ],
      "accounts": [
        {
          "name": "dev",
          "writable": true,
          "signer": true
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        },
        {
          "name": "mint",
          "docs": [
            "Fresh mint keypair; pump create_v2 creates it (checked there against this key)."
          ],
          "writable": true,
          "signer": true
        },
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "obs",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  111,
                  98,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "treasury",
          "writable": true
        },
        {
          "name": "dev_ata",
          "writable": true
        },
        {
          "name": "token_program"
        },
        {
          "name": "ata_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "instructions",
          "address": "Sysvar1nstructions1111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "name",
          "type": "string"
        },
        {
          "name": "symbol",
          "type": "string"
        },
        {
          "name": "uri",
          "type": "string"
        },
        {
          "name": "dev_buy",
          "type": "u64"
        },
        {
          "name": "expected_launch_fee_bps",
          "type": "u16"
        },
        {
          "name": "expected_keep_bps",
          "type": "u16"
        }
      ]
    },
    {
      "name": "observe",
      "docs": [
        "Appends the coin's current price (curve, or its canonical PumpSwap pool after migration) to its observation",
        "ring, at most one per OBS_MIN_GAP seconds. Anyone can send it; it may share its transaction only with other",
        "`observe` instructions (and ComputeBudget / System), so a pump trade can never sit next to it.",
        "Audit M-2: the price is stored truncated to +-OBS_CLAMP_BPS (10%) of the median of the newest OBS_K stored",
        "observations (`raw_q9` in the event is what the venue showed, `price_q9` what was stored).",
        "remaining_accounts after migration: [pool, pool_base_token_account, pool_quote_token_account]."
      ],
      "discriminator": [
        204,
        78,
        178,
        115,
        194,
        147,
        65,
        74
      ],
      "accounts": [
        {
          "name": "obs",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  111,
                  98,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "obs.mint",
                "account": "PriceObs"
              }
            ]
          }
        },
        {
          "name": "curve"
        },
        {
          "name": "instructions",
          "address": "Sysvar1nstructions1111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "propose_admin",
      "docs": [
        "Two-step admin handover: the admin proposes (Pubkey::default() cancels), the proposed key accepts."
      ],
      "discriminator": [
        121,
        214,
        199,
        212,
        87,
        39,
        117,
        234
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true,
          "relations": [
            "config"
          ]
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "proposed",
          "type": "pubkey"
        }
      ]
    },
    {
      "name": "set_paused",
      "docs": [
        "Pause blocks new coins and new raids only. Commits, settles, withdrawals, fees and buybacks keep working."
      ],
      "discriminator": [
        91,
        60,
        125,
        192,
        176,
        225,
        166,
        218
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true,
          "relations": [
            "config"
          ]
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "paused",
          "type": "bool"
        }
      ]
    },
    {
      "name": "set_treasury",
      "discriminator": [
        57,
        97,
        196,
        95,
        195,
        206,
        106,
        136
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true,
          "relations": [
            "config"
          ]
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "treasury",
          "type": "pubkey"
        }
      ]
    },
    {
      "name": "settle",
      "docs": [
        "Anyone, once the battle is over. Outcome: attack power < min_atk_power -> FIZZLED (the bond goes to the",
        "target's Keep); attack >= defense x defender_bonus -> ATTACK WON: loot = keep_B x loot_bps x atk / (atk + def),",
        "never taking keep_B under min_keep, moves Keep B -> Keep A; else DEFENSE WON. The bond goes back to the",
        "declarer unless fizzled. Burns: the losing side loser_burn_bps of its escrow, the winning side winner_burn_bps",
        "(a fizzle is a defense win). Audit M-1: only an ATTACK WON shields the target (the shield exists to stop",
        "repeated looting; a defense that held needs none, and a cheap lost self-raid can no longer buy 24 h of",
        "protection); every outcome, fizzles included, puts the attacker on cooldown; a raid that did not end in an",
        "attack win raises the target's `repels` (the bond escalation of `declare`), a win resets it. Shield and",
        "cooldown run from the raid's end."
      ],
      "discriminator": [
        175,
        42,
        185,
        87,
        144,
        131,
        102,
        212
      ],
      "accounts": [
        {
          "name": "caller",
          "signer": true
        },
        {
          "name": "raid",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  97,
                  105,
                  100
                ]
              },
              {
                "kind": "account",
                "path": "raid.id",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "attacker_coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "raid.attacker",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "target_coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "raid.target",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "attacker_keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "raid.attacker",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "target_keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "raid.target",
                "account": "Raid"
              }
            ]
          }
        },
        {
          "name": "declarer",
          "writable": true
        },
        {
          "name": "attacker_mint",
          "writable": true
        },
        {
          "name": "target_mint",
          "writable": true
        },
        {
          "name": "atk_escrow",
          "writable": true
        },
        {
          "name": "def_escrow",
          "writable": true
        },
        {
          "name": "token_program"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "sync_fees",
      "docs": [
        "Books every new Fees lamport: keep_bps straight to the Keep, dev_bps to the dev, the rest (with the",
        "rounding dust) to the treasury. Anyone can send it.",
        "Invariant after it: fees.lamports == floor + dev_pending + treasury_pending."
      ],
      "discriminator": [
        183,
        105,
        177,
        124,
        93,
        59,
        163,
        216
      ],
      "accounts": [
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "keep",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  107,
                  101,
                  101,
                  112
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "tighten_buyback",
      "docs": [
        "Audit L-2: the admin can only TIGHTEN an existing coin's buyback: a smaller slippage allowance over the",
        "median and / or a smaller share of the Keep per buyback (never below the global floors of 100 bps).",
        "Loosening either one is refused (OnlyTighten), so this knob never lets the Keep buy worse or more."
      ],
      "discriminator": [
        210,
        20,
        242,
        184,
        230,
        66,
        3,
        6
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true,
          "relations": [
            "config"
          ]
        },
        {
          "name": "config",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        },
        {
          "name": "coin",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "buyback_slippage_bps",
          "type": "u16"
        },
        {
          "name": "buyback_bps",
          "type": "u16"
        }
      ]
    },
    {
      "name": "unwrap_fees",
      "docs": [
        "Closes a WSOL account owned by the Fees PDA (PumpSwap creator fees someone collected as WSOL to it, audit",
        "M-2) so its lamports land in the Fees PDA, where `sync_fees` books them."
      ],
      "discriminator": [
        202,
        112,
        56,
        154,
        193,
        85,
        127,
        150
      ],
      "accounts": [
        {
          "name": "coin",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  105,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "fees",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  115
                ]
              },
              {
                "kind": "account",
                "path": "coin.mint",
                "account": "Coin"
              }
            ]
          }
        },
        {
          "name": "wsol_ata",
          "writable": true
        },
        {
          "name": "token_program",
          "address": "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
        }
      ],
      "args": []
    },
    {
      "name": "update_config",
      "docs": [
        "New params apply to coins launched and raids declared from now on; existing ones keep their copy."
      ],
      "discriminator": [
        29,
        158,
        252,
        191,
        10,
        83,
        219,
        99
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true,
          "relations": [
            "config"
          ]
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  99,
                  111,
                  110,
                  102,
                  105,
                  103
                ]
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "params",
          "type": {
            "defined": {
              "name": "Params"
            }
          }
        }
      ]
    },
    {
      "name": "withdraw",
      "docs": [
        "After settle: pays a crew back floor(amount * side.keep_bps / 10000) of its committed tokens (the rest was",
        "burned at settle). Anyone can push it; the tokens only go to the crew wallet's ATA (created by the payer)."
      ],
      "discriminator": [
        183,
        18,
        70,
        156,
        148,
        109,
        161,
        34
      ],
      "accounts": [
        {
          "name": "payer",
          "writable": true,
          "signer": true
        },
        {
          "name": "raid",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  97,
                  105,
                  100
                ]
              },
              {
                "kind": "account",
                "path": "raid.id",
                "account": "Raid"
              }
            ]
          },
          "relations": [
            "crew"
          ]
        },
        {
          "name": "crew",
          "writable": true
        },
        {
          "name": "wallet",
          "relations": [
            "crew"
          ]
        },
        {
          "name": "mint"
        },
        {
          "name": "escrow",
          "writable": true
        },
        {
          "name": "wallet_ata",
          "writable": true
        },
        {
          "name": "token_program"
        },
        {
          "name": "ata_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    }
  ],
  "accounts": [
    {
      "name": "Coin",
      "discriminator": [
        215,
        195,
        53,
        238,
        217,
        196,
        213,
        51
      ]
    },
    {
      "name": "Config",
      "discriminator": [
        155,
        12,
        170,
        224,
        30,
        250,
        204,
        130
      ]
    },
    {
      "name": "Crew",
      "discriminator": [
        61,
        122,
        32,
        216,
        23,
        193,
        251,
        83
      ]
    },
    {
      "name": "PriceObs",
      "discriminator": [
        213,
        57,
        9,
        43,
        33,
        19,
        56,
        221
      ]
    },
    {
      "name": "Raid",
      "discriminator": [
        247,
        50,
        237,
        152,
        225,
        69,
        138,
        211
      ]
    }
  ],
  "events": [
    {
      "name": "AdminProposed",
      "discriminator": [
        129,
        249,
        226,
        227,
        199,
        82,
        110,
        243
      ]
    },
    {
      "name": "AdminSet",
      "discriminator": [
        157,
        245,
        205,
        226,
        118,
        125,
        183,
        97
      ]
    },
    {
      "name": "BuybackDone",
      "discriminator": [
        126,
        206,
        27,
        99,
        107,
        29,
        67,
        175
      ]
    },
    {
      "name": "BuybackTightened",
      "discriminator": [
        157,
        39,
        199,
        137,
        166,
        103,
        218,
        98
      ]
    },
    {
      "name": "Committed",
      "discriminator": [
        70,
        158,
        162,
        86,
        29,
        111,
        143,
        226
      ]
    },
    {
      "name": "ConfigInitialized",
      "discriminator": [
        181,
        49,
        200,
        156,
        19,
        167,
        178,
        91
      ]
    },
    {
      "name": "ConfigUpdated",
      "discriminator": [
        40,
        241,
        230,
        122,
        11,
        19,
        198,
        194
      ]
    },
    {
      "name": "Declared",
      "discriminator": [
        35,
        118,
        63,
        240,
        242,
        167,
        0,
        99
      ]
    },
    {
      "name": "DevPaid",
      "discriminator": [
        108,
        221,
        137,
        38,
        39,
        247,
        120,
        194
      ]
    },
    {
      "name": "Donated",
      "discriminator": [
        12,
        83,
        251,
        183,
        39,
        211,
        125,
        44
      ]
    },
    {
      "name": "Extended",
      "discriminator": [
        5,
        76,
        91,
        44,
        187,
        214,
        114,
        165
      ]
    },
    {
      "name": "FeesCollected",
      "discriminator": [
        233,
        23,
        117,
        225,
        107,
        178,
        254,
        8
      ]
    },
    {
      "name": "FeesSynced",
      "discriminator": [
        41,
        98,
        204,
        192,
        243,
        3,
        53,
        218
      ]
    },
    {
      "name": "FeesUnwrapped",
      "discriminator": [
        146,
        111,
        114,
        101,
        19,
        203,
        134,
        142
      ]
    },
    {
      "name": "Launched",
      "discriminator": [
        209,
        127,
        29,
        152,
        129,
        212,
        189,
        183
      ]
    },
    {
      "name": "Observed",
      "discriminator": [
        154,
        65,
        198,
        52,
        238,
        11,
        193,
        59
      ]
    },
    {
      "name": "PausedSet",
      "discriminator": [
        171,
        125,
        127,
        156,
        233,
        81,
        68,
        66
      ]
    },
    {
      "name": "Settled",
      "discriminator": [
        232,
        210,
        40,
        17,
        142,
        124,
        145,
        238
      ]
    },
    {
      "name": "TreasuryPaid",
      "discriminator": [
        203,
        141,
        198,
        183,
        132,
        74,
        239,
        248
      ]
    },
    {
      "name": "TreasurySet",
      "discriminator": [
        69,
        231,
        163,
        135,
        254,
        194,
        109,
        166
      ]
    },
    {
      "name": "Withdrawn",
      "discriminator": [
        20,
        89,
        223,
        198,
        194,
        124,
        219,
        13
      ]
    }
  ],
  "errors": [
    {
      "code": 6000,
      "name": "Unauthorized",
      "msg": "Only the admin can do this"
    },
    {
      "code": 6001,
      "name": "Paused",
      "msg": "Heistpad is paused: no new coins or raids right now (running raids, withdrawals and fees still work)"
    },
    {
      "code": 6002,
      "name": "BadConfig",
      "msg": "Config value out of its allowed range"
    },
    {
      "code": 6003,
      "name": "ParamsChanged",
      "msg": "The platform settings changed since you looked: reload and check the fee / bond"
    },
    {
      "code": 6004,
      "name": "BadName",
      "msg": "Name must be 1-32 bytes, no control or invisible characters, no leading/trailing spaces"
    },
    {
      "code": 6005,
      "name": "BadSymbol",
      "msg": "Ticker must be 1-10 characters, no spaces, control or invisible characters"
    },
    {
      "code": 6006,
      "name": "BadUri",
      "msg": "Metadata uri must be ipfs://<cid> or https://ipfs.io/ipfs/<cid>"
    },
    {
      "code": 6007,
      "name": "NotAlone",
      "msg": "This instruction must be alone in its transaction (only compute-budget and SOL transfers may join it)"
    },
    {
      "code": 6008,
      "name": "BadAccounts",
      "msg": "Wrong accounts"
    },
    {
      "code": 6009,
      "name": "Math",
      "msg": "Math overflow"
    },
    {
      "code": 6010,
      "name": "NothingBought",
      "msg": "The buy returned no tokens"
    },
    {
      "code": 6011,
      "name": "ObserveTooSoon",
      "msg": "Price was observed less than a minute ago: try again shortly"
    },
    {
      "code": 6012,
      "name": "StaleMedian",
      "msg": "No fresh price for this coin yet: it needs 7 observations in the last 30 minutes (the keeper adds one per minute)"
    },
    {
      "code": 6013,
      "name": "SelfRaid",
      "msg": "A coin cannot raid itself"
    },
    {
      "code": 6014,
      "name": "AttackerBusy",
      "msg": "This coin is already on a raid: wait until it is settled"
    },
    {
      "code": 6015,
      "name": "AttackerCooldown",
      "msg": "This coin raided recently: its crew is resting (attacker cooldown)"
    },
    {
      "code": 6016,
      "name": "TargetBusy",
      "msg": "This coin is already under attack: one raid per target at a time"
    },
    {
      "code": 6017,
      "name": "TargetShielded",
      "msg": "This coin is shielded after its last raid"
    },
    {
      "code": 6018,
      "name": "TargetKeepTooSmall",
      "msg": "The target's keep is too small to be worth a raid"
    },
    {
      "code": 6019,
      "name": "NotEnoughHolding",
      "msg": "You must hold at least the minimum share of the attacking coin to declare a raid"
    },
    {
      "code": 6020,
      "name": "WrongMint",
      "msg": "Wrong coin for this side of the raid"
    },
    {
      "code": 6021,
      "name": "WrongSide",
      "msg": "Side must be 0 (attack) or 1 (defense)"
    },
    {
      "code": 6022,
      "name": "NotInBattle",
      "msg": "The battle has not started yet: commits open after the prep time"
    },
    {
      "code": 6023,
      "name": "BattleOver",
      "msg": "The battle is over: commits are closed"
    },
    {
      "code": 6024,
      "name": "DustCommit",
      "msg": "Commit too small: it is worth less than the minimum raid power"
    },
    {
      "code": 6025,
      "name": "PowerBelowMin",
      "msg": "The price moved: this commit would be worth less than the minimum power you accepted"
    },
    {
      "code": 6026,
      "name": "BattleNotOver",
      "msg": "The battle is still running"
    },
    {
      "code": 6027,
      "name": "AlreadySettled",
      "msg": "This raid is already settled"
    },
    {
      "code": 6028,
      "name": "NotSettled",
      "msg": "This raid is not settled yet: tokens come back after settle"
    },
    {
      "code": 6029,
      "name": "AlreadyWithdrawn",
      "msg": "Already withdrawn"
    },
    {
      "code": 6030,
      "name": "NothingToClaim",
      "msg": "Nothing to claim"
    },
    {
      "code": 6031,
      "name": "BelowRentFloor",
      "msg": "Payout is below the rent floor of an empty wallet: it stays claimable, fund the wallet or wait"
    },
    {
      "code": 6032,
      "name": "BuybackTooSoon",
      "msg": "The keep bought back less than an hour ago"
    },
    {
      "code": 6033,
      "name": "KeepFrozen",
      "msg": "The keep is locked while the coin is under attack"
    },
    {
      "code": 6034,
      "name": "NothingToBuyBack",
      "msg": "The keep is too small for a buyback"
    },
    {
      "code": 6035,
      "name": "PriceAboveMedian",
      "msg": "The price is pumped above its recent median: the keep will not buy into it"
    },
    {
      "code": 6036,
      "name": "BadAmount",
      "msg": "Amount must be above zero"
    },
    {
      "code": 6037,
      "name": "UnsafeMint",
      "msg": "The new coin's mint has an authority or extension that could move escrowed tokens: launch refused"
    },
    {
      "code": 6038,
      "name": "ShortPriceHistory",
      "msg": "Not enough price history for raid power yet: the coin's observations must cover at least 15 minutes"
    },
    {
      "code": 6039,
      "name": "PricesDisagree",
      "msg": "The recent prices disagree too much (the price is moving): the keep waits for a calmer market to buy back"
    },
    {
      "code": 6040,
      "name": "OnlyTighten",
      "msg": "The admin can only tighten an existing coin's buyback (lower slippage, smaller share), never loosen it"
    }
  ],
  "types": [
    {
      "name": "AdminProposed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "current",
            "type": "pubkey"
          },
          {
            "name": "proposed",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "AdminSet",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "old",
            "type": "pubkey"
          },
          {
            "name": "admin",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "BuybackDone",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "venue",
            "type": "u8"
          },
          {
            "name": "spend",
            "type": "u64"
          },
          {
            "name": "spent",
            "type": "u64"
          },
          {
            "name": "tokens_burned",
            "type": "u64"
          },
          {
            "name": "median_q9",
            "type": "u64"
          },
          {
            "name": "depth_cap",
            "type": "u64"
          },
          {
            "name": "keep_after",
            "type": "u64"
          },
          {
            "name": "burned_total",
            "type": "u64"
          },
          {
            "name": "ts",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "BuybackTightened",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "old_slippage_bps",
            "type": "u16"
          },
          {
            "name": "slippage_bps",
            "type": "u16"
          },
          {
            "name": "old_buyback_bps",
            "type": "u16"
          },
          {
            "name": "buyback_bps",
            "type": "u16"
          }
        ]
      }
    },
    {
      "name": "Coin",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "dev",
            "type": "pubkey"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "symbol",
            "type": "string"
          },
          {
            "name": "uri",
            "type": "string"
          },
          {
            "name": "launched_at",
            "type": "i64"
          },
          {
            "name": "params",
            "type": {
              "defined": {
                "name": "Params"
              }
            }
          },
          {
            "name": "active_attack",
            "docs": [
              "The raid this coin is attacking with / defending against now (default = none)."
            ],
            "type": "pubkey"
          },
          {
            "name": "active_defense",
            "type": "pubkey"
          },
          {
            "name": "attack_cooldown_until",
            "type": "i64"
          },
          {
            "name": "shield_until",
            "type": "i64"
          },
          {
            "name": "raids_attacked",
            "type": "u32"
          },
          {
            "name": "raids_won",
            "type": "u32"
          },
          {
            "name": "raids_defended",
            "type": "u32"
          },
          {
            "name": "raids_lost",
            "type": "u32"
          },
          {
            "name": "burned_raid",
            "docs": [
              "Leaderboard: tokens of this coin burned by raids (escrow losses) and by buybacks."
            ],
            "type": "u64"
          },
          {
            "name": "burned_buyback",
            "type": "u64"
          },
          {
            "name": "keep_from_fees",
            "docs": [
              "Keep ledger (see the invariant at the top)."
            ],
            "type": "u64"
          },
          {
            "name": "loot_in",
            "type": "u64"
          },
          {
            "name": "loot_out",
            "type": "u64"
          },
          {
            "name": "bonds_in",
            "type": "u64"
          },
          {
            "name": "donated",
            "type": "u64"
          },
          {
            "name": "buyback_spent",
            "type": "u64"
          },
          {
            "name": "buybacks",
            "type": "u32"
          },
          {
            "name": "last_buyback_at",
            "type": "i64"
          },
          {
            "name": "dev_pending",
            "docs": [
              "Fees PDA ledger."
            ],
            "type": "u64"
          },
          {
            "name": "dev_paid",
            "type": "u64"
          },
          {
            "name": "treasury_pending",
            "type": "u64"
          },
          {
            "name": "treasury_paid",
            "type": "u64"
          },
          {
            "name": "fees_total",
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          },
          {
            "name": "fees_bump",
            "type": "u8"
          },
          {
            "name": "keep_bump",
            "type": "u8"
          },
          {
            "name": "repels",
            "docs": [
              "Audit M-1: raids on this coin that ended without an attack win, each within REPEL_WINDOW of the previous",
              "(reset by an attack win), and the end of the last one. The next raid on it pays declare_bond << repels."
            ],
            "type": "u8"
          },
          {
            "name": "last_repel_at",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "Committed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "side",
            "type": "u8"
          },
          {
            "name": "wallet",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "power",
            "type": "u64"
          },
          {
            "name": "crew_amount",
            "type": "u64"
          },
          {
            "name": "crew_power",
            "type": "u128"
          },
          {
            "name": "side_tokens",
            "type": "u64"
          },
          {
            "name": "atk_power",
            "type": "u128"
          },
          {
            "name": "def_power",
            "type": "u128"
          },
          {
            "name": "median_q9",
            "type": "u64"
          },
          {
            "name": "on_curve",
            "type": "bool"
          },
          {
            "name": "end",
            "type": "i64"
          },
          {
            "name": "ts",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "Config",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "admin",
            "type": "pubkey"
          },
          {
            "name": "pending_admin",
            "type": "pubkey"
          },
          {
            "name": "treasury",
            "type": "pubkey"
          },
          {
            "name": "paused",
            "type": "bool"
          },
          {
            "name": "params",
            "type": {
              "defined": {
                "name": "Params"
              }
            }
          },
          {
            "name": "coins",
            "type": "u64"
          },
          {
            "name": "raids",
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "ConfigInitialized",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "admin",
            "type": "pubkey"
          },
          {
            "name": "treasury",
            "type": "pubkey"
          },
          {
            "name": "params",
            "type": {
              "defined": {
                "name": "Params"
              }
            }
          }
        ]
      }
    },
    {
      "name": "ConfigUpdated",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "params",
            "type": {
              "defined": {
                "name": "Params"
              }
            }
          }
        ]
      }
    },
    {
      "name": "Crew",
      "docs": [
        "[\"crew\", raid, side, wallet]: one wallet's commits on one side of one raid."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "wallet",
            "type": "pubkey"
          },
          {
            "name": "side",
            "type": "u8"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "power",
            "type": "u128"
          },
          {
            "name": "commits",
            "type": "u32"
          },
          {
            "name": "withdrawn",
            "type": "bool"
          },
          {
            "name": "returned",
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "Declared",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "id",
            "type": "u64"
          },
          {
            "name": "attacker",
            "type": "pubkey"
          },
          {
            "name": "target",
            "type": "pubkey"
          },
          {
            "name": "declarer",
            "type": "pubkey"
          },
          {
            "name": "bond",
            "type": "u64"
          },
          {
            "name": "bond_shift",
            "type": "u8"
          },
          {
            "name": "declared_at",
            "type": "i64"
          },
          {
            "name": "battle_start",
            "type": "i64"
          },
          {
            "name": "end",
            "type": "i64"
          },
          {
            "name": "hard_end",
            "type": "i64"
          },
          {
            "name": "target_keep",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "DevPaid",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "dev",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Donated",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "donor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "keep_after",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Extended",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "end",
            "type": "i64"
          },
          {
            "name": "extensions",
            "type": "u16"
          },
          {
            "name": "hard_end",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "FeesCollected",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "FeesSynced",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "incoming",
            "type": "u64"
          },
          {
            "name": "keep",
            "type": "u64"
          },
          {
            "name": "dev",
            "type": "u64"
          },
          {
            "name": "treasury",
            "type": "u64"
          },
          {
            "name": "total",
            "type": "u64"
          },
          {
            "name": "keep_after",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "FeesUnwrapped",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Launched",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "dev",
            "type": "pubkey"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "symbol",
            "type": "string"
          },
          {
            "name": "uri",
            "type": "string"
          },
          {
            "name": "dev_buy",
            "type": "u64"
          },
          {
            "name": "dev_tokens",
            "type": "u64"
          },
          {
            "name": "launch_fee",
            "type": "u64"
          },
          {
            "name": "price_q9",
            "type": "u64"
          },
          {
            "name": "ts",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "ObsSlot",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "ts",
            "type": "i64"
          },
          {
            "name": "price_q9",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Observed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "price_q9",
            "type": "u64"
          },
          {
            "name": "raw_q9",
            "type": "u64"
          },
          {
            "name": "median_q9",
            "type": "u64"
          },
          {
            "name": "on_curve",
            "type": "bool"
          },
          {
            "name": "count",
            "type": "u8"
          },
          {
            "name": "ts",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "Params",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "launch_fee_bps",
            "docs": [
              "Launch fee in bps of the dev buy, paid on top of it to the treasury. 0..=500."
            ],
            "type": "u16"
          },
          {
            "name": "keep_bps",
            "docs": [
              "Creator fee split, sum 10000: keep >= 5000, treasury <= 2000. Default 7000 / 2000 / 1000."
            ],
            "type": "u16"
          },
          {
            "name": "dev_bps",
            "type": "u16"
          },
          {
            "name": "treasury_bps",
            "type": "u16"
          },
          {
            "name": "buyback_interval_secs",
            "docs": [
              "Buyback: at most once per interval (>= 10 min mainnet, <= 7 d), buyback_bps of the Keep (100..=2500),",
              "slippage vs the median (100..=1000, audit L-2; default 300), smallest spend (0.001..=1 SOL)."
            ],
            "type": "i64"
          },
          {
            "name": "buyback_bps",
            "type": "u16"
          },
          {
            "name": "buyback_slippage_bps",
            "type": "u16"
          },
          {
            "name": "min_buyback",
            "type": "u64"
          },
          {
            "name": "declare_bond",
            "docs": [
              "Declarer's bond, 0.05..=5 SOL."
            ],
            "type": "u64"
          },
          {
            "name": "min_declare_holding_bps",
            "docs": [
              "The declarer must hold this share of the attacker coin's supply, 0..=100 bps."
            ],
            "type": "u16"
          },
          {
            "name": "prep_secs",
            "docs": [
              "Prep (declare -> battle) 10 min..6 h; battle 30 min..6 h (mainnet floors)."
            ],
            "type": "i64"
          },
          {
            "name": "battle_secs",
            "type": "i64"
          },
          {
            "name": "soft_window_secs",
            "docs": [
              "Soft close: a commit in the last soft_window_secs (30 s..10 min, < battle) pushes the end by",
              "extension_secs (30 s..10 min), never past end + max_extension_secs (0..2 h)."
            ],
            "type": "i64"
          },
          {
            "name": "extension_secs",
            "type": "i64"
          },
          {
            "name": "max_extension_secs",
            "type": "i64"
          },
          {
            "name": "min_atk_power",
            "docs": [
              "Attack power under this fizzles (bond -> target Keep). 0.01..=100 SOL."
            ],
            "type": "u64"
          },
          {
            "name": "min_commit_power",
            "docs": [
              "Smallest power of one commit (dust guard). 0.001..=1 SOL, <= min_atk_power."
            ],
            "type": "u64"
          },
          {
            "name": "defender_bonus_bps",
            "docs": [
              "Attack wins iff atk * 10000 >= def * defender_bonus_bps. 10000..=20000."
            ],
            "type": "u16"
          },
          {
            "name": "loot_bps",
            "docs": [
              "Loot = keep_B * loot_bps * atk / (atk + def) / 10000. 100..=2500."
            ],
            "type": "u16"
          },
          {
            "name": "min_keep",
            "docs": [
              "A raid never takes a Keep below this (0..=10 SOL); a target needs at least min_target_keep (> min_keep,",
              "0.01..=100 SOL) to be raided."
            ],
            "type": "u64"
          },
          {
            "name": "min_target_keep",
            "type": "u64"
          },
          {
            "name": "loser_burn_bps",
            "docs": [
              "Share of the escrow burned: losing side 0..=5000, winning side 0..=loser."
            ],
            "type": "u16"
          },
          {
            "name": "winner_burn_bps",
            "type": "u16"
          },
          {
            "name": "shield_secs",
            "docs": [
              "Target shield after a raid (1 h..7 d), attacker cooldown after a raid (10 min..7 d), from the raid's end."
            ],
            "type": "i64"
          },
          {
            "name": "attacker_cooldown_secs",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "PausedSet",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "paused",
            "type": "bool"
          }
        ]
      }
    },
    {
      "name": "PriceObs",
      "docs": [
        "[\"obs\", mint]: pricing's observation ring (16 slots, newest at head - 1)."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "ring",
            "type": {
              "array": [
                {
                  "defined": {
                    "name": "ObsSlot"
                  }
                },
                16
              ]
            }
          },
          {
            "name": "head",
            "type": "u8"
          },
          {
            "name": "count",
            "type": "u8"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "Raid",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "id",
            "type": "u64"
          },
          {
            "name": "attacker",
            "docs": [
              "Mints of the attacking and the target coin."
            ],
            "type": "pubkey"
          },
          {
            "name": "target",
            "type": "pubkey"
          },
          {
            "name": "declarer",
            "type": "pubkey"
          },
          {
            "name": "bond",
            "type": "u64"
          },
          {
            "name": "declared_at",
            "type": "i64"
          },
          {
            "name": "battle_start",
            "type": "i64"
          },
          {
            "name": "end",
            "type": "i64"
          },
          {
            "name": "hard_end",
            "type": "i64"
          },
          {
            "name": "extensions",
            "type": "u16"
          },
          {
            "name": "params",
            "type": {
              "defined": {
                "name": "Params"
              }
            }
          },
          {
            "name": "atk",
            "type": {
              "defined": {
                "name": "Side"
              }
            }
          },
          {
            "name": "def",
            "type": {
              "defined": {
                "name": "Side"
              }
            }
          },
          {
            "name": "state",
            "type": "u8"
          },
          {
            "name": "outcome",
            "type": "u8"
          },
          {
            "name": "loot",
            "type": "u64"
          },
          {
            "name": "settled_at",
            "type": "i64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "Settled",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "attacker",
            "type": "pubkey"
          },
          {
            "name": "target",
            "type": "pubkey"
          },
          {
            "name": "outcome",
            "type": "u8"
          },
          {
            "name": "atk_power",
            "type": "u128"
          },
          {
            "name": "def_power",
            "type": "u128"
          },
          {
            "name": "loot",
            "type": "u64"
          },
          {
            "name": "atk_burned",
            "type": "u64"
          },
          {
            "name": "def_burned",
            "type": "u64"
          },
          {
            "name": "atk_burned_power",
            "type": "u64"
          },
          {
            "name": "def_burned_power",
            "type": "u64"
          },
          {
            "name": "bond",
            "type": "u64"
          },
          {
            "name": "bond_to_target",
            "type": "bool"
          },
          {
            "name": "attacker_keep",
            "type": "u64"
          },
          {
            "name": "target_keep",
            "type": "u64"
          },
          {
            "name": "shield_until",
            "type": "i64"
          },
          {
            "name": "attacker_cooldown_until",
            "type": "i64"
          },
          {
            "name": "target_repels",
            "type": "u8"
          },
          {
            "name": "attacker_burned_total",
            "type": "u64"
          },
          {
            "name": "target_burned_total",
            "type": "u64"
          },
          {
            "name": "ts",
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "Side",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "tokens",
            "docs": [
              "Tokens in this side's escrow (as received)."
            ],
            "type": "u64"
          },
          {
            "name": "power",
            "docs": [
              "Sum of the commits' power (lamports)."
            ],
            "type": "u128"
          },
          {
            "name": "crews",
            "type": "u32"
          },
          {
            "name": "ret_win",
            "docs": [
              "Sum over crews of floor(amount * (10000 - winner_burn_bps) / 10000), resp. loser."
            ],
            "type": "u64"
          },
          {
            "name": "ret_lose",
            "type": "u64"
          },
          {
            "name": "burned",
            "docs": [
              "Set at settle: tokens burned, and the bps each crew gets back."
            ],
            "type": "u64"
          },
          {
            "name": "keep_bps",
            "type": "u16"
          },
          {
            "name": "returned",
            "docs": [
              "Tokens paid back by `withdraw` so far."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "TreasuryPaid",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "treasury",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "TreasurySet",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "treasury",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "Withdrawn",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "raid",
            "type": "pubkey"
          },
          {
            "name": "side",
            "type": "u8"
          },
          {
            "name": "wallet",
            "type": "pubkey"
          },
          {
            "name": "returned",
            "type": "u64"
          },
          {
            "name": "burned",
            "type": "u64"
          }
        ]
      }
    }
  ]
}