{
  "address": "FxmpWaFwkyqWug7hmPTaHWWqZTqevSunr3q9WJp5MYvD",
  "metadata": {
    "name": "anvora",
    "version": "2.0.0",
    "spec": "0.1.0",
    "description": "Anchor program for prelaunch-only bonding-curve fundraising on Solana"
  },
  "instructions": [
    {
      "name": "accept_protocol_authority",
      "discriminator": [
        237,
        122,
        6,
        39,
        53,
        202,
        141,
        113
      ],
      "accounts": [
        {
          "name": "new_authority",
          "docs": [
            "Must equal the staged `pending_authority` and sign it. Without this",
            "co-signature the rotation stays staged and never takes effect."
          ],
          "signer": true
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "buy",
      "discriminator": [
        102,
        6,
        61,
        18,
        1,
        218,
        235,
        234
      ],
      "accounts": [
        {
          "name": "buyer",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "mint",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "buyer_market_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "buyer"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "associated_token_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "token_amount",
          "type": "u64"
        },
        {
          "name": "max_sol_cost",
          "type": "u64"
        }
      ]
    },
    {
      "name": "claim_referral_rewards",
      "discriminator": [
        23,
        112,
        76,
        162,
        157,
        106,
        203,
        246
      ],
      "accounts": [
        {
          "name": "referrer",
          "docs": [
            "Must own the vault and sign. The `seeds` derivation below already binds",
            "the vault to this key; the stored `referrer` is checked too so the two can",
            "never drift apart."
          ],
          "signer": true
        },
        {
          "name": "referral_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  102,
                  101,
                  114,
                  114,
                  97,
                  108,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "referrer"
              }
            ]
          }
        },
        {
          "name": "destination",
          "docs": [
            "constrained to differ from the vault itself: aliasing the two would net to",
            "a no-op while still emitting a claim event for lamports that never moved."
          ],
          "writable": true
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "claim_rewards",
      "discriminator": [
        4,
        144,
        132,
        71,
        116,
        23,
        151,
        80
      ],
      "accounts": [
        {
          "name": "user",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "stake_position",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  112,
                  111,
                  115,
                  105,
                  116,
                  105,
                  111,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "user"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "close_reward_commitment",
      "discriminator": [
        92,
        111,
        92,
        147,
        18,
        127,
        109,
        40
      ],
      "accounts": [
        {
          "name": "depositor",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "commitment",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  95,
                  99,
                  111,
                  109,
                  109,
                  105,
                  116,
                  109,
                  101,
                  110,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "depositor"
              }
            ]
          }
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "close_stake_position",
      "discriminator": [
        8,
        63,
        74,
        143,
        105,
        42,
        28,
        64
      ],
      "accounts": [
        {
          "name": "staker",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "stake_position",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  112,
                  111,
                  115,
                  105,
                  116,
                  105,
                  111,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "staker"
              }
            ]
          }
        }
      ],
      "args": []
    },
    {
      "name": "commit_rewards",
      "discriminator": [
        230,
        240,
        251,
        224,
        134,
        38,
        190,
        64
      ],
      "accounts": [
        {
          "name": "depositor",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "commitment",
          "docs": [
            "`init_if_needed` because a depositor may commit more than once; later",
            "commitments add to the same record. It cannot be re-created after being",
            "closed: closing requires a settled market, and committing refuses one."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  95,
                  99,
                  111,
                  109,
                  109,
                  105,
                  116,
                  109,
                  101,
                  110,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "depositor"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "configure_fee_split",
      "discriminator": [
        208,
        244,
        233,
        247,
        137,
        222,
        171,
        176
      ],
      "accounts": [
        {
          "name": "authority",
          "writable": true,
          "signer": true
        },
        {
          "name": "protocol_treasury",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "fee_split",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  95,
                  115,
                  112,
                  108,
                  105,
                  116
                ]
              }
            ]
          }
        },
        {
          "name": "market",
          "docs": [
            "The market to pay. Typed, so only a real market can be named."
          ],
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "create_market",
      "discriminator": [
        103,
        226,
        97,
        235,
        200,
        188,
        251,
        254
      ],
      "accounts": [
        {
          "name": "creator",
          "writable": true,
          "signer": true
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "creator"
              },
              {
                "kind": "arg",
                "path": "args.slug"
              }
            ]
          }
        },
        {
          "name": "mint",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  105,
                  110,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "stake_vault",
          "docs": [
            "Per-market stake vault, created up front so the first staker pays no",
            "account-creation cost (the creator funds it at launch — this removes the",
            "\"wait for someone else to stake first\" disincentive). PDA owned by the",
            "market so `stake`/`unstake` move tokens in and out. Custodies the sum",
            "of every staker's tokens."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "docs": [
            "RewardsVault PDA, created up front so revenue can flow from the first",
            "sell onwards. It receives the holder share of every sell and every",
            "`deposit_rewards`, and pays claims in either phase."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "referral_vault",
          "docs": [
            "Escrow for the creator's referrer, created here so the cut at settle never",
            "has to touch an address the creator did not author. Required exactly when",
            "`args.referral` is set, and forbidden otherwise — the handler enforces both",
            "directions.",
            "",
            "`init_if_needed` because the vault is global per referrer, not per market:",
            "a referrer working with several creators keeps a single vault, and only the",
            "first market naming them pays its rent. The handler detects that first",
            "creation with the zeroed-`referrer` sentinel and charges the rent only then."
          ],
          "writable": true,
          "optional": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  102,
                  101,
                  114,
                  114,
                  97,
                  108,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "arg",
                "path": "args.referral"
              }
            ]
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "associated_token_program",
          "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "args",
          "type": {
            "defined": {
              "name": "CreateMarketArgs"
            }
          }
        }
      ]
    },
    {
      "name": "deposit_rewards",
      "discriminator": [
        52,
        249,
        112,
        72,
        206,
        161,
        196,
        1
      ],
      "accounts": [
        {
          "name": "depositor",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "initialize_protocol_treasury",
      "discriminator": [
        125,
        148,
        53,
        197,
        136,
        81,
        65,
        58
      ],
      "accounts": [
        {
          "name": "payer",
          "writable": true,
          "signer": true
        },
        {
          "name": "program",
          "address": "FxmpWaFwkyqWug7hmPTaHWWqZTqevSunr3q9WJp5MYvD"
        },
        {
          "name": "program_data"
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "rotate_protocol_authority",
      "discriminator": [
        102,
        188,
        108,
        203,
        228,
        162,
        128,
        196
      ],
      "accounts": [
        {
          "name": "current_authority",
          "signer": true
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "new_authority",
          "type": "pubkey"
        }
      ]
    },
    {
      "name": "sell",
      "discriminator": [
        51,
        230,
        133,
        164,
        1,
        127,
        131,
        173
      ],
      "accounts": [
        {
          "name": "seller",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "mint",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "seller_market_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "seller"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "rewards_vault",
          "docs": [
            "Receives the holder cut as it is earned. Per-market, so naming it here",
            "costs nothing in contention — unlike the protocol treasury, which is",
            "global and is deliberately not in this list."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "token_amount",
          "type": "u64"
        },
        {
          "name": "min_sol_output",
          "type": "u64"
        }
      ]
    },
    {
      "name": "settle_market",
      "discriminator": [
        193,
        153,
        95,
        216,
        166,
        6,
        144,
        217
      ],
      "accounts": [
        {
          "name": "caller",
          "docs": [
            "The wallet signing the TX and paying for it. Always receives the bounty,",
            "including when it is the market's creator."
          ],
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "creator",
          "docs": [
            "`address` constraint forces it to match the on-chain stored creator,",
            "so a malicious caller cannot redirect the creator's share elsewhere."
          ],
          "writable": true
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "mint",
          "writable": true
        },
        {
          "name": "vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "rewards_vault",
          "docs": [
            "RewardsVault PDA, already created at `create_market`. Settle moves no",
            "lamports in or out of it. It advances the accumulator over the committed",
            "rewards, whose lamports arrived at `commit_rewards`, and bumps the vault's",
            "`total_deposited` with them; every other entitlement was fixed when its",
            "money arrived."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "referral_vault",
          "docs": [
            "Escrow for the creator's referrer, created at `create_market`. Required",
            "exactly when `market.creator_referrer` is set, and forbidden otherwise.",
            "",
            "This is a program-derived address, not the referrer's wallet, and that is",
            "the point. Settle is permissionless, so a caller must not be able to skip",
            "the payout by omitting an account; and settle is the only instruction that",
            "can close a market, so no address the creator did not author may sit in",
            "its critical path — a referral link carrying a poisoned address would",
            "otherwise freeze a market whose creator did nothing wrong. Deriving the",
            "vault from `market.creator_referrer` closes both directions at once."
          ],
          "writable": true,
          "optional": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  102,
                  101,
                  114,
                  114,
                  97,
                  108,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator_referrer",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    },
    {
      "name": "stake",
      "discriminator": [
        206,
        176,
        202,
        18,
        200,
        209,
        179,
        108
      ],
      "accounts": [
        {
          "name": "staker",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "mint"
        },
        {
          "name": "staker_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "staker"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "stake_vault",
          "docs": [
            "Single per-market vault custodying every staker's tokens. Created up",
            "front at `create_market` (funded by the creator, so the first staker",
            "pays nothing extra); authority is the market PDA so `unstake` can pay",
            "back out."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "stake_position",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  112,
                  111,
                  115,
                  105,
                  116,
                  105,
                  111,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "staker"
              }
            ]
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "unstake",
      "discriminator": [
        90,
        95,
        107,
        42,
        205,
        124,
        50,
        225
      ],
      "accounts": [
        {
          "name": "staker",
          "writable": true,
          "signer": true
        },
        {
          "name": "market",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "mint"
        },
        {
          "name": "staker_ata",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "account",
                "path": "staker"
              },
              {
                "kind": "account",
                "path": "token_program"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ],
            "program": {
              "kind": "const",
              "value": [
                140,
                151,
                37,
                143,
                78,
                36,
                137,
                241,
                187,
                61,
                16,
                41,
                20,
                142,
                13,
                131,
                11,
                90,
                19,
                153,
                218,
                255,
                16,
                132,
                4,
                142,
                123,
                216,
                219,
                233,
                248,
                89
              ]
            }
          }
        },
        {
          "name": "stake_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "stake_position",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  115,
                  116,
                  97,
                  107,
                  101,
                  95,
                  112,
                  111,
                  115,
                  105,
                  116,
                  105,
                  111,
                  110
                ]
              },
              {
                "kind": "account",
                "path": "market"
              },
              {
                "kind": "account",
                "path": "staker"
              }
            ]
          }
        },
        {
          "name": "token_program"
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "withdraw_protocol_fees",
      "discriminator": [
        11,
        68,
        165,
        98,
        18,
        208,
        134,
        73
      ],
      "accounts": [
        {
          "name": "authority",
          "signer": true
        },
        {
          "name": "protocol_treasury",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  112,
                  114,
                  111,
                  116,
                  111,
                  99,
                  111,
                  108,
                  95,
                  116,
                  114,
                  101,
                  97,
                  115,
                  117,
                  114,
                  121
                ]
              }
            ]
          }
        },
        {
          "name": "fee_split",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  102,
                  101,
                  101,
                  95,
                  115,
                  112,
                  108,
                  105,
                  116
                ]
              }
            ]
          }
        },
        {
          "name": "market",
          "docs": [
            "Not chosen here. Pinned to the market `fee_split` names, so the",
            "authority supplies the account but cannot pick which one."
          ],
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  109,
                  97,
                  114,
                  107,
                  101,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market.creator",
                "account": "Market"
              },
              {
                "kind": "account",
                "path": "market.slug",
                "account": "Market"
              }
            ]
          }
        },
        {
          "name": "rewards_vault",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  114,
                  101,
                  119,
                  97,
                  114,
                  100,
                  115,
                  95,
                  118,
                  97,
                  117,
                  108,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "market"
              }
            ]
          }
        },
        {
          "name": "destination",
          "docs": [
            "",
            "The four exclusions are the four program-owned accounts this instruction",
            "already holds, and they are excluded because each one silently swallows",
            "the share. Crediting the rewards vault raises a balance the accumulator",
            "never accounted for, so no staker can claim it; crediting the market",
            "adds lamports `settle_market` never reads, since every payout there is computed",
            "from `real_sol_reserves`; nothing in the program ever debits `fee_split`.",
            "In all three the money is stuck until an upgrade adds an instruction to",
            "go and get it.",
            "",
            "It is a fence, not a boundary: `destination` stays an arbitrary account,",
            "so the share can still be sent to some other PDA or to an address nobody",
            "holds a key for. What it covers is the four pubkeys a caller of this",
            "instruction already has in hand, which is where a mix-up comes from."
          ],
          "writable": true
        },
        {
          "name": "event_authority"
        },
        {
          "name": "program"
        }
      ],
      "args": []
    }
  ],
  "accounts": [
    {
      "name": "FeeSplit",
      "discriminator": [
        86,
        16,
        21,
        61,
        101,
        156,
        140,
        9
      ]
    },
    {
      "name": "Market",
      "discriminator": [
        219,
        190,
        213,
        55,
        0,
        227,
        198,
        154
      ]
    },
    {
      "name": "ProtocolTreasury",
      "discriminator": [
        162,
        26,
        123,
        61,
        102,
        146,
        47,
        73
      ]
    },
    {
      "name": "ReferralVault",
      "discriminator": [
        220,
        195,
        105,
        198,
        64,
        73,
        75,
        240
      ]
    },
    {
      "name": "RewardCommitment",
      "discriminator": [
        108,
        208,
        127,
        252,
        215,
        11,
        228,
        96
      ]
    },
    {
      "name": "RewardsVault",
      "discriminator": [
        142,
        77,
        8,
        180,
        80,
        179,
        230,
        43
      ]
    },
    {
      "name": "StakePosition",
      "discriminator": [
        78,
        165,
        30,
        111,
        171,
        125,
        11,
        220
      ]
    }
  ],
  "events": [
    {
      "name": "FeeSplitConfigured",
      "discriminator": [
        254,
        150,
        159,
        127,
        215,
        242,
        14,
        210
      ]
    },
    {
      "name": "MarketBuy",
      "discriminator": [
        89,
        88,
        153,
        196,
        159,
        242,
        180,
        211
      ]
    },
    {
      "name": "MarketCreated",
      "discriminator": [
        88,
        184,
        130,
        231,
        226,
        84,
        6,
        58
      ]
    },
    {
      "name": "MarketSell",
      "discriminator": [
        231,
        55,
        193,
        181,
        34,
        253,
        91,
        40
      ]
    },
    {
      "name": "MarketSettled",
      "discriminator": [
        237,
        212,
        22,
        175,
        201,
        117,
        215,
        99
      ]
    },
    {
      "name": "ProtocolAuthorityRotated",
      "discriminator": [
        128,
        149,
        152,
        210,
        32,
        222,
        155,
        139
      ]
    },
    {
      "name": "ProtocolAuthorityRotationProposed",
      "discriminator": [
        40,
        207,
        114,
        45,
        147,
        59,
        135,
        77
      ]
    },
    {
      "name": "ProtocolFeesWithdrawn",
      "discriminator": [
        202,
        213,
        134,
        216,
        108,
        14,
        84,
        99
      ]
    },
    {
      "name": "ReferralRewardsClaimed",
      "discriminator": [
        178,
        107,
        76,
        169,
        252,
        154,
        45,
        235
      ]
    },
    {
      "name": "RewardCommitmentClosed",
      "discriminator": [
        213,
        196,
        85,
        25,
        107,
        159,
        21,
        135
      ]
    },
    {
      "name": "RewardsClaimed",
      "discriminator": [
        75,
        98,
        88,
        18,
        219,
        112,
        88,
        121
      ]
    },
    {
      "name": "RewardsCommitted",
      "discriminator": [
        163,
        142,
        1,
        101,
        116,
        80,
        170,
        147
      ]
    },
    {
      "name": "RewardsDeposited",
      "discriminator": [
        120,
        19,
        149,
        33,
        111,
        163,
        248,
        156
      ]
    },
    {
      "name": "Staked",
      "discriminator": [
        11,
        146,
        45,
        205,
        230,
        58,
        213,
        240
      ]
    },
    {
      "name": "Unstaked",
      "discriminator": [
        27,
        179,
        156,
        215,
        47,
        71,
        195,
        7
      ]
    }
  ],
  "errors": [
    {
      "code": 6000,
      "name": "InvalidSlug",
      "msg": "Slug must be 1-32 characters of lowercase letters, digits and hyphens, and cannot start or end with a hyphen."
    },
    {
      "code": 6001,
      "name": "InvalidMetadataUri",
      "msg": "Metadata URI must start with https:// or ipfs://, be at most 128 bytes, and contain only printable ASCII."
    },
    {
      "code": 6002,
      "name": "InvalidMarketEnd",
      "msg": "The market end timestamp must be after the trading start."
    },
    {
      "code": 6003,
      "name": "MarketDurationTooShort",
      "msg": "The market duration is shorter than the minimum allowed."
    },
    {
      "code": 6004,
      "name": "MarketDurationTooLong",
      "msg": "The market duration is longer than the maximum allowed."
    },
    {
      "code": 6005,
      "name": "InvalidQuantity",
      "msg": "The quantity must be greater than zero."
    },
    {
      "code": 6006,
      "name": "MathOverflow",
      "msg": "Arithmetic overflow."
    },
    {
      "code": 6007,
      "name": "MarketClosed",
      "msg": "The market trading window has not started or is already closed."
    },
    {
      "code": 6008,
      "name": "MarketExpired",
      "msg": "The market trading window has expired; only settlement is allowed now."
    },
    {
      "code": 6009,
      "name": "MarketAlreadySettled",
      "msg": "The market is already settled."
    },
    {
      "code": 6010,
      "name": "MarketSettledRequired",
      "msg": "The market is not settled yet."
    },
    {
      "code": 6011,
      "name": "MarketNotEnded",
      "msg": "The market cannot be settled before the end timestamp."
    },
    {
      "code": 6012,
      "name": "InsufficientCurveLiquidity",
      "msg": "Not enough liquidity remains in the curve."
    },
    {
      "code": 6013,
      "name": "SlippageExceeded",
      "msg": "The slippage limit was exceeded."
    },
    {
      "code": 6014,
      "name": "InvalidRewardsVault",
      "msg": "The provided rewards vault does not match the market."
    },
    {
      "code": 6015,
      "name": "NoFundsAvailable",
      "msg": "No funds are currently withdrawable."
    },
    {
      "code": 6016,
      "name": "NoClaimAvailable",
      "msg": "No revenue is currently claimable."
    },
    {
      "code": 6017,
      "name": "NoStakersToReward",
      "msg": "No tokens are staked, so a deposit has no one to distribute to."
    },
    {
      "code": 6018,
      "name": "VaultBalanceMismatch",
      "msg": "The vault balance is inconsistent with the recorded reserves."
    },
    {
      "code": 6019,
      "name": "InvalidStakePositionOwner",
      "msg": "The provided stake position owner does not match the signer."
    },
    {
      "code": 6020,
      "name": "InvalidStakePositionMarket",
      "msg": "The provided stake position market does not match the market."
    },
    {
      "code": 6021,
      "name": "Unauthorized",
      "msg": "Signer is not authorized to perform this action."
    },
    {
      "code": 6022,
      "name": "ProtocolUpgradeAuthorityRequired",
      "msg": "Only the program upgrade authority can initialize the protocol treasury."
    },
    {
      "code": 6023,
      "name": "RewardAccountingError",
      "msg": "Reward accounting invariant violated."
    },
    {
      "code": 6024,
      "name": "InsufficientStake",
      "msg": "Cannot unstake more than the staked amount."
    },
    {
      "code": 6025,
      "name": "StakeStillActive",
      "msg": "Cannot close a stake position that still has staked tokens."
    },
    {
      "code": 6026,
      "name": "UnclaimedRewards",
      "msg": "Cannot close a stake position with unclaimed rewards."
    },
    {
      "code": 6027,
      "name": "SelfReferral",
      "msg": "A referrer cannot be the same wallet as the referred user."
    },
    {
      "code": 6028,
      "name": "InvalidReferrer",
      "msg": "The provided referral vault does not match the market's creator referrer."
    },
    {
      "code": 6029,
      "name": "CreationCostBelowRent",
      "msg": "The fixed creation cost is lower than the rent of the accounts being created."
    },
    {
      "code": 6030,
      "name": "InvalidWithdrawDestination",
      "msg": "The withdrawal destination cannot be one of the program accounts this instruction already holds."
    },
    {
      "code": 6031,
      "name": "InvalidTokenName",
      "msg": "Token name must be 1-32 bytes, without surrounding whitespace or characters that alter how it renders."
    },
    {
      "code": 6032,
      "name": "InvalidTokenSymbol",
      "msg": "Token symbol must be 2-3 characters of uppercase letters and digits, starting with a letter."
    },
    {
      "code": 6033,
      "name": "MetadataAuthorityInvalid",
      "msg": "The market PDA could not be set as the mint metadata update authority."
    },
    {
      "code": 6034,
      "name": "MarketNotStarted",
      "msg": "Trading on this market has not opened yet."
    },
    {
      "code": 6035,
      "name": "InvalidMarketStart",
      "msg": "A scheduled trading start must be in the future."
    },
    {
      "code": 6036,
      "name": "MarketStartTooFar",
      "msg": "The trading start is scheduled further out than the maximum allowed delay."
    },
    {
      "code": 6037,
      "name": "InvalidFeeSplitMarket",
      "msg": "The provided market is not the one the fee split names."
    },
    {
      "code": 6038,
      "name": "WithdrawalTooSmallToSplit",
      "msg": "The withdrawal is too small to carry the stakers' share; it would route zero."
    },
    {
      "code": 6039,
      "name": "RewardCommitmentTooSmall",
      "msg": "A reward commitment must be at least 0.1 SOL."
    }
  ],
  "types": [
    {
      "name": "CreateMarketArgs",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "slug",
            "type": "string"
          },
          {
            "name": "name",
            "docs": [
              "What wallets show for this market's token. Supplied by the creator",
              "rather than derived from the slug: the slug is a url path segment",
              "(lowercase, hyphenated) and reads as one, whereas this is a display",
              "name."
            ],
            "type": "string"
          },
          {
            "name": "symbol",
            "docs": [
              "The ticker. Chosen by the creator because every market minting the",
              "same symbol makes a wallet holding several of them unreadable."
            ],
            "type": "string"
          },
          {
            "name": "metadata_uri",
            "type": "string"
          },
          {
            "name": "start_ts",
            "docs": [
              "When trading opens. `None` opens it at once, in this transaction.",
              "`Some(ts)` schedules it: `ts` must be in the future and at most",
              "`MAX_START_DELAY_SECONDS` away, and until then the market is upcoming —",
              "buys and sells are refused."
            ],
            "type": {
              "option": "i64"
            }
          },
          {
            "name": "end_ts",
            "docs": [
              "When trading closes. The trading window `end_ts - start_ts` is what the",
              "duration bounds apply to, not the time since creation."
            ],
            "type": "i64"
          },
          {
            "name": "referral",
            "docs": [
              "Affiliation: the creator's referrer, from the app's off-chain attribution.",
              "`Pubkey::default()` = none. Stored immutably as `market.creator_referrer`",
              "and credited to that referrer's vault at settle."
            ],
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "FeeSplit",
      "docs": [
        "Which market's stakers receive `PROTOCOL_FEE_HOLDER_BPS` of every protocol fee",
        "withdrawal, and what is owed to them but not yet distributable.",
        "",
        "It lives in its own PDA rather than as a field on `ProtocolTreasury`, and",
        "that is not a matter of taste. The treasury account is already live on",
        "mainnet at its original 73 bytes. Adding fields to that struct would make",
        "every deployed copy the wrong length for the code reading it, so Anchor",
        "would refuse to deserialise it and `create_market`, `settle_market` and",
        "`withdraw_protocol_fees` would all revert from the instant the upgrade",
        "landed until a realloc migration ran. A separate account costs one",
        "rent-exempt minimum and no downtime.",
        "",
        "The account is what makes `PROTOCOL_FEE_HOLDER_BPS` enforceable: because",
        "`withdraw_protocol_fees` requires it — not `Option`, required — the split",
        "cannot be skipped by omitting an account, and the recipient market is read",
        "from here rather than passed in, so it cannot be redirected at call time."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "docs": [
              "The market whose stakers are paid. Never `Pubkey::default()`:",
              "`configure_fee_split` takes a deserialised market account, so an",
              "unconfigured split cannot exist."
            ],
            "type": "pubkey"
          },
          {
            "name": "pending_unallocated",
            "docs": [
              "The stakers' share collected while nobody was staked, held here until a",
              "withdrawal finds someone to pay.",
              "",
              "It exists because the share is theirs from the moment it is taken, and a",
              "withdrawal must not fail — nor quietly hand it to the authority — just",
              "because the market happens to be empty at that instant. Holding it",
              "apart is what keeps the arithmetic honest across withdrawals: the",
              "authority's `withdrawable` is computed net of this figure, so the same",
              "lamports cannot be taxed twice and cannot drift to the wrong party.",
              "",
              "This mirrors `Market::holder_fees_unallocated`, which does the same job",
              "for sell fees, and for the same reason: fees with no holder are not a",
              "prize for whoever stakes next, and they are not the protocol's either."
            ],
            "type": "u64"
          },
          {
            "name": "total_routed",
            "docs": [
              "Total accrued to stakers through this split, modulo 2^64. Maintained for",
              "indexers and transparency. Nothing resets it and no logic reads it back;",
              "it wraps rather than overflows so it can never block a withdrawal."
            ],
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          },
          {
            "name": "_reserved",
            "docs": [
              "Padding, so a future field costs an upgrade instead of a migration.",
              "",
              "This account exists BECAUSE that distinction was expensive once already:",
              "the split could not go on `ProtocolTreasury` precisely because that",
              "struct has no room and is already live. Repeating the mistake on the",
              "account created to avoid it would be hard to defend.",
              "",
              "Same two rules as `Market::_reserved`: this array stays last, and a",
              "new field must treat 0 as a valid initial value."
            ],
            "type": {
              "array": [
                "u8",
                64
              ]
            }
          }
        ]
      }
    },
    {
      "name": "FeeSplitConfigured",
      "docs": [
        "The paid market was set for the first time, or moved."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "type": "pubkey"
          },
          {
            "name": "previous",
            "docs": [
              "What the market was before this call, or `Pubkey::default()` when the",
              "split account did not exist yet."
            ],
            "type": "pubkey"
          },
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "pending_unallocated",
            "docs": [
              "Carried over unchanged. A move hands whatever was held back to the new",
              "market's stakers."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "Market",
      "docs": [
        "Persisted market state."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "creator",
            "type": "pubkey"
          },
          {
            "name": "creator_referrer",
            "docs": [
              "Referrer of the market creator. Set once at `create_market` from the",
              "app's off-chain attribution; `Pubkey::default()` means none. Read at",
              "`settle_market` to credit `REFERRAL_SETTLE_BPS` of the protocol's share to that",
              "referrer's vault. Immutable after creation."
            ],
            "type": "pubkey"
          },
          {
            "name": "protocol_treasury",
            "type": "pubkey"
          },
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "vault",
            "type": "pubkey"
          },
          {
            "name": "rewards_vault",
            "docs": [
              "Set to the RewardsVault PDA at `create_market` (the vault is created",
              "up front so revenue can be deposited during the trading window).",
              "`deposit_rewards` and `claim_rewards` validate against this stored key",
              "in addition to the canonical PDA seeds."
            ],
            "type": "pubkey"
          },
          {
            "name": "slug",
            "type": "string"
          },
          {
            "name": "start_ts",
            "docs": [
              "When trading opens. Creation time for a market that opens at once;",
              "a later, creator-chosen instant for a scheduled one. Before it the",
              "market is upcoming — the phase is read off the clock, never stored,",
              "so nothing has to be called at `start_ts` for trading to open."
            ],
            "type": "i64"
          },
          {
            "name": "end_ts",
            "docs": [
              "When trading closes and settlement becomes possible."
            ],
            "type": "i64"
          },
          {
            "name": "settled_at",
            "type": "i64"
          },
          {
            "name": "status",
            "type": {
              "defined": {
                "name": "MarketStatus"
              }
            }
          },
          {
            "name": "virtual_token_reserves",
            "type": "u64"
          },
          {
            "name": "virtual_sol_reserves",
            "type": "u64"
          },
          {
            "name": "real_token_reserves",
            "type": "u64"
          },
          {
            "name": "real_sol_reserves",
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "Total tokens currently staked across all `StakePosition`s — the",
              "denominator of the reward accumulator, maintained by `stake`/`unstake`."
            ],
            "type": "u64"
          },
          {
            "name": "reward_per_token_accumulator",
            "docs": [
              "Per-token reward accumulator (REWARD_SCALE-scaled). Advanced by `sell`,",
              "`deposit_rewards`, `withdraw_protocol_fees` (fee split), and once by",
              "`settle_market` for the committed rewards. It counts modulo 2^128 and",
              "only differences of it are ever read (see `rewards::settle_core`). A",
              "staker's claimable lamports since their last mark =",
              "`staked_amount × accumulator.wrapping_sub(reward_checkpoint) / SCALE`,",
              "where `reward_checkpoint` (see StakePosition) stores the accumulator",
              "value last settled against — not `staked × accumulator` — so the",
              "`/ SCALE` flooring happens exactly once at credit time and a tiny-",
              "`total_staked` deposit can't overflow the checkpoint."
            ],
            "type": "u128"
          },
          {
            "name": "carry_rewards_scaled",
            "docs": [
              "Rounding-dust carry, held in the same REWARD_SCALE domain as the",
              "accumulator (not lamports). The remainder of a deposit that cannot be",
              "assigned per-token (`(amount × SCALE + carry) % total_staked`) is kept",
              "here and rolled into the next deposit's `delta` so no value is lost.",
              "Keeping it scaled — rather than re-expressing it as redistributable",
              "lamports — is what stops the fractional part of each `delta` from being",
              "counted twice (once in the carry, again by the once-at-claim flooring),",
              "which previously left the RewardsVault short for the final claimant.",
              "Always strictly less than `total_staked` after an accrue with stakers."
            ],
            "type": "u128"
          },
          {
            "name": "holder_fees_unallocated",
            "docs": [
              "The same fee, collected while nobody was staked. It has no holder to pay,",
              "so it goes to the creator at settlement.",
              "",
              "It is kept apart rather than pooled because pooling it would hand it to",
              "whoever staked next: the carry is flushed on the following accrual, so a",
              "bot could stake one raw unit, wait for a single sell, and take everything",
              "collected before it arrived. Fees with no holder are not a prize."
            ],
            "type": "u64"
          },
          {
            "name": "pending_protocol_revenue",
            "docs": [
              "Accumulator for the protocol portion of sell fees (SELL_FEE_PROTOCOL_BPS),",
              "swept to the treasury at settle. Held on the market rather than paid",
              "out per sell, and it",
              "exists for a throughput reason rather than an accounting one.",
              "",
              "Paying the treasury at sell time put a write lock on one global account in",
              "every sell of every market. Solana serialises transactions that share a",
              "writable account, so each sell queued behind every other sell in the whole",
              "protocol — markets that have nothing to do with each other contending on",
              "a single hot account. Accruing here instead means a sell writes only",
              "market-scoped accounts and sells parallelise across markets; the",
              "treasury is touched once per market, at settle.",
              "",
              "Buys never touched the treasury (no buy fee), so they were already free."
            ],
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          },
          {
            "name": "committed_rewards",
            "docs": [
              "Rewards promised to whoever is staked at settlement, through",
              "`commit_rewards`. The lamports are already in the RewardsVault; what",
              "waits is the accumulator, which `settle_market` moves by this amount.",
              "Zero after a settle that found stakers.",
              "",
              "After a settle that found nobody staked it stays non-zero and counts",
              "down as each depositor takes their commitment back through",
              "`close_reward_commitment`."
            ],
            "type": "u64"
          },
          {
            "name": "commitments_refundable",
            "docs": [
              "Set by a settle that found committed rewards and nobody staked: the",
              "commitments had no recipient, so each depositor is refunded instead."
            ],
            "type": "bool"
          },
          {
            "name": "_reserved",
            "docs": [
              "Padding, so a future field costs an upgrade instead of a migration.",
              "",
              "A Solana account's size is fixed at creation. Adding a field to this",
              "struct after launch would make every existing market the wrong length",
              "and unreadable, and recovering would mean an instruction that grows each",
              "live account one at a time. Reserving the bytes up front means the next",
              "field is taken from this array — `pub new_field: u64` plus",
              "`_reserved: [u8; 56]` — leaving the total unchanged and old accounts",
              "readable.",
              "",
              "Two rules for whoever spends it: this array stays last, and a new field",
              "must treat 0 as a valid initial value, because that is what pre-existing",
              "accounts will hold.",
              "",
              "Costs ~0.00045 SOL of rent per market, out of the protocol's share",
              "since the creation price is fixed."
            ],
            "type": {
              "array": [
                "u8",
                55
              ]
            }
          }
        ]
      }
    },
    {
      "name": "MarketBuy",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "buyer",
            "type": "pubkey"
          },
          {
            "name": "token_amount",
            "type": "u64"
          },
          {
            "name": "sol_amount",
            "type": "u64"
          },
          {
            "name": "virtual_sol_reserves",
            "docs": [
              "Market `virtual_sol_reserves` after this trade was applied.",
              "Emitted so off-chain indexers can price each trade independently,",
              "without replaying the whole trade history in order — a replay is",
              "order-sensitive and a late-arriving trade silently mis-attributes",
              "prices to timestamps."
            ],
            "type": "u64"
          },
          {
            "name": "virtual_token_reserves",
            "docs": [
              "Market `virtual_token_reserves` after this trade was applied.",
              "Together with `virtual_sol_reserves` this fully determines the",
              "marginal price at this trade, making the event self-describing."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "MarketCreated",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "creator",
            "type": "pubkey"
          },
          {
            "name": "slug",
            "type": "string"
          },
          {
            "name": "end_ts",
            "type": "i64"
          },
          {
            "name": "creation_fee",
            "docs": [
              "Flat creation fee routed to the protocol treasury (the remainder of the",
              "fixed `CREATE_MARKET_COST_LAMPORTS` over the accounts' rent)."
            ],
            "type": "u64"
          },
          {
            "name": "mint",
            "docs": [
              "The market's SPL mint. Written once at creation and never mutated."
            ],
            "type": "pubkey"
          },
          {
            "name": "metadata_uri",
            "docs": [
              "The market's off-chain metadata URI (`MAX_URI_LEN` bytes at most).",
              "Written once at creation and never mutated. Emitted with `mint` so an",
              "indexer can render a new market straight from the event, instead of",
              "polling the market account until it lands."
            ],
            "type": "string"
          },
          {
            "name": "creator_referrer",
            "docs": [
              "The creator's referrer, or `Pubkey::default()` if none. Written once at",
              "creation and never mutated. The client needs it to derive the referral",
              "vault when building the settle transaction."
            ],
            "type": "pubkey"
          },
          {
            "name": "start_ts",
            "docs": [
              "When trading opens. Equal to the creation time for a market that opens",
              "at once; later for a scheduled one, which is upcoming until then."
            ],
            "type": "i64"
          }
        ]
      }
    },
    {
      "name": "MarketSell",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "seller",
            "type": "pubkey"
          },
          {
            "name": "token_amount",
            "type": "u64"
          },
          {
            "name": "sol_amount",
            "docs": [
              "What the seller actually received (gross − protocol_fee − holder_fee)."
            ],
            "type": "u64"
          },
          {
            "name": "protocol_fee",
            "docs": [
              "The protocol's share of this sell. Accrued on the market — see",
              "`pending_protocol_revenue` below — and swept to `protocol_treasury` at",
              "settle, not transferred here. Sells carry no affiliation cut: paying",
              "anyone to bring a seller would subsidise exits."
            ],
            "type": "u64"
          },
          {
            "name": "holder_fee",
            "docs": [
              "Assigned to the stakers present at this sell, or held for the creator",
              "when nobody was staked. See the two market totals below."
            ],
            "type": "u64"
          },
          {
            "name": "virtual_sol_reserves",
            "docs": [
              "Market `virtual_sol_reserves` after this trade was applied.",
              "Emitted so off-chain indexers can price each trade independently,",
              "without replaying the whole trade history in order — a replay is",
              "order-sensitive and a late-arriving trade silently mis-attributes",
              "prices to timestamps."
            ],
            "type": "u64"
          },
          {
            "name": "virtual_token_reserves",
            "docs": [
              "Market `virtual_token_reserves` after this trade was applied.",
              "Together with `virtual_sol_reserves` this fully determines the",
              "marginal price at this trade, making the event self-describing."
            ],
            "type": "u64"
          },
          {
            "name": "holder_fees_unallocated",
            "docs": [
              "Market total after this sell of the holder cut collected while nobody",
              "was staked — the part that goes to the creator at settlement. Unchanged",
              "from the previous sell means this one's `holder_fee` went to the stakers",
              "instead, which is the only way to tell the two paths apart."
            ],
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "`total_staked` at the instant this sell was assigned, and the accumulators",
              "after it. A sell now does what a deposit does — it advances",
              "`reward_per_token_accumulator` — so it has to report the same three",
              "numbers `RewardsDeposited` reports, and for the same reason: an",
              "accumulator can only be followed, never recomputed. An indexer that misses",
              "one write never catches up, because every later sell adds to a number it",
              "no longer knows."
            ],
            "type": "u64"
          },
          {
            "name": "reward_per_token_accumulator",
            "type": "u128"
          },
          {
            "name": "carry_rewards_scaled",
            "type": "u128"
          },
          {
            "name": "pending_protocol_revenue",
            "docs": [
              "Market `pending_protocol_revenue` after `protocol_fee` was accrued.",
              "The protocol's cut is no longer paid out at sell time — see the field's",
              "doc on `Market` for why — so this is what the treasury will receive at",
              "settle, not what it received now."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "MarketSettled",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "total_staked",
            "type": "u64"
          },
          {
            "name": "creator_cut",
            "type": "u64"
          },
          {
            "name": "protocol_cut",
            "docs": [
              "Protocol share at settle, already net of `referral_settle`."
            ],
            "type": "u64"
          },
          {
            "name": "referral_settle",
            "docs": [
              "Creator-side affiliation cut, credited to the referrer's vault (not their",
              "wallet) out of the protocol share. Zero when the market has no referrer."
            ],
            "type": "u64"
          },
          {
            "name": "referrer",
            "docs": [
              "The market's creator referrer, or `Pubkey::default()` if none."
            ],
            "type": "pubkey"
          },
          {
            "name": "caller_bounty",
            "docs": [
              "Lamports paid to the wallet that signed the settle TX. Paid on every",
              "settle, including when the creator settles their own market — the",
              "handler has no branch on caller identity. Only floors to zero when",
              "`real_sol_reserves` is small enough that 100 bps rounds down."
            ],
            "type": "u64"
          },
          {
            "name": "caller",
            "docs": [
              "The wallet that signed the settle TX. Equals `market.creator` when",
              "the creator self-settles."
            ],
            "type": "pubkey"
          },
          {
            "name": "settled_at",
            "type": "i64"
          },
          {
            "name": "creator_folded",
            "docs": [
              "What the creator was owed but could not be credited, because the payment",
              "would have left their wallet below the rent-exempt minimum. Folded to the",
              "treasury. Zero on every ordinary settle."
            ],
            "type": "u64"
          },
          {
            "name": "protocol_revenue_swept",
            "docs": [
              "Sell fees accrued to the protocol across the trading window and swept to",
              "the treasury by this settle. Separate from `protocol_cut`, which is the",
              "settlement share of `real_sol_reserves`; the treasury receives both."
            ],
            "type": "u64"
          },
          {
            "name": "holder_fees_unallocated",
            "docs": [
              "Holder fees collected while nobody was staked, paid to the creator here."
            ],
            "type": "u64"
          },
          {
            "name": "reward_per_token_accumulator",
            "docs": [
              "Market accumulators after settlement. Settle moves them only to assign",
              "`committed_rewards_distributed`; everything else was fixed when the money",
              "arrived. An indexer following sells, deposits and this settle can",
              "reconcile its running total against them here, once per market."
            ],
            "type": "u128"
          },
          {
            "name": "carry_rewards_scaled",
            "type": "u128"
          },
          {
            "name": "committed_rewards_distributed",
            "docs": [
              "Committed rewards assigned to the stakers present at this settle. Zero",
              "when nothing was committed, or when nobody was staked."
            ],
            "type": "u64"
          },
          {
            "name": "committed_rewards_refundable",
            "docs": [
              "Committed rewards that found nobody staked and are now refundable to",
              "their depositors through `close_reward_commitment`."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "MarketStatus",
      "type": {
        "kind": "enum",
        "variants": [
          {
            "name": "Active"
          },
          {
            "name": "Settled"
          }
        ]
      }
    },
    {
      "name": "ProtocolAuthorityRotated",
      "docs": [
        "Emitted by `accept_protocol_authority` (step 2): the staged authority has",
        "co-signed and is now the effective authority."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "previous",
            "type": "pubkey"
          },
          {
            "name": "new",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "ProtocolAuthorityRotationProposed",
      "docs": [
        "Emitted by `rotate_protocol_authority` (step 1 of the two-step rotation):",
        "the new authority is only staged here, not yet effective."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "current",
            "type": "pubkey"
          },
          {
            "name": "pending",
            "type": "pubkey"
          }
        ]
      }
    },
    {
      "name": "ProtocolFeesWithdrawn",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "type": "pubkey"
          },
          {
            "name": "destination",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "docs": [
              "What reached `destination` — the withdrawal MINUS the stakers' share,",
              "not the whole amount that left the treasury."
            ],
            "type": "u64"
          },
          {
            "name": "market",
            "docs": [
              "The market whose stakers were paid, from `FeeSplit`."
            ],
            "type": "pubkey"
          },
          {
            "name": "stakers_amount",
            "docs": [
              "Accrued to that market's stakers in this same instruction: this",
              "withdrawal's `PROTOCOL_FEE_HOLDER_BPS` plus anything held back from earlier",
              "withdrawals that found nobody staked. Zero when nobody is staked now,",
              "in which case the share moved to `pending_unallocated_after` instead."
            ],
            "type": "u64"
          },
          {
            "name": "pending_unallocated_after",
            "docs": [
              "`FeeSplit::pending_unallocated` after this withdrawal."
            ],
            "type": "u64"
          },
          {
            "name": "total_routed_to_stakers",
            "docs": [
              "`FeeSplit::total_routed` after this withdrawal."
            ],
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "`market.total_staked` at the instant the share was assigned, and the",
              "market's accumulators after it. A withdrawal that routes a share moves",
              "`reward_per_token_accumulator` exactly as a deposit does, so it reports",
              "the same numbers `RewardsDeposited` and `MarketSell` report: an",
              "accumulator can only be followed, never recomputed, and the split may",
              "name a settled market that no later sell or settle will ever report",
              "again. Unchanged when nobody was staked and the share was held back."
            ],
            "type": "u64"
          },
          {
            "name": "reward_per_token_accumulator",
            "type": "u128"
          },
          {
            "name": "carry_rewards_scaled",
            "type": "u128"
          }
        ]
      }
    },
    {
      "name": "ProtocolTreasury",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "authority",
            "type": "pubkey"
          },
          {
            "name": "pending_authority",
            "docs": [
              "Staged next authority for the two-step rotation (Ownable2Step). Set by",
              "`rotate_protocol_authority`; promoted to `authority` only when this key",
              "co-signs `accept_protocol_authority`. `Pubkey::default()` when no",
              "rotation is pending. This guarantees a mistyped or non-signable address",
              "can never irrecoverably brick the treasury, since the current authority",
              "keeps control until the new key proves it can sign."
            ],
            "type": "pubkey"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "ReferralRewardsClaimed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "referrer",
            "type": "pubkey"
          },
          {
            "name": "destination",
            "docs": [
              "Where the referrer chose to send the swept balance."
            ],
            "type": "pubkey"
          },
          {
            "name": "amount",
            "docs": [
              "Swept amount, i.e. the vault balance above its rent-exempt minimum."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "ReferralVault",
      "docs": [
        "Per-referrer escrow for the creator-side affiliation cut.",
        "",
        "Settlement credits this program-owned PDA instead of paying the referrer's",
        "wallet directly. Two properties follow, and both are the reason it exists:",
        "",
        "1. The address is derived from the referrer's key, so it can never be a",
        "program, a reserved account, or anything whose lamport balance the runtime",
        "refuses to change. Settle is the only instruction that can close a",
        "market, and a referrer address travels in through a referral link the",
        "creator did not author — without this indirection, a poisoned link would",
        "freeze a market whose creator did nothing wrong.",
        "2. Because the vault is rent-exempt once and then reused, individual cuts are",
        "no longer gated on leaving a wallet rent-exempt. Small commissions",
        "accumulate instead of being dropped.",
        "",
        "The referrer sweeps the balance with `claim_referral_rewards`, signing for",
        "themselves and naming their own destination. That claim step is deliberate:",
        "the cut is a meaningful share of a whole raise and is earned rarely, so one",
        "extra transaction is a fair price for the two guarantees above."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "referrer",
            "docs": [
              "The wallet this vault accrues for. Written once at creation from the same",
              "key used as the PDA seed, so the stored value and the derivation can never",
              "disagree."
            ],
            "type": "pubkey"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "RewardCommitment",
      "docs": [
        "One depositor's promise to a market's stakers, made with `commit_rewards`.",
        "",
        "The lamports themselves sit in the market's RewardsVault from the moment of",
        "the commitment; this account records whose they were. That record is what",
        "makes a refund possible when settlement finds nobody staked — the program",
        "keeps no other list of depositors, and iterating one inside `settle_market`",
        "would not fit in a transaction anyway.",
        "",
        "One per (market, depositor). A later commitment by the same depositor adds",
        "to `amount`. Closed by its depositor after settlement, through",
        "`close_reward_commitment`, which returns the rent and, when the market is",
        "refundable, the commitment."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "depositor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "docs": [
              "Total committed by this depositor to this market."
            ],
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "RewardCommitmentClosed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "depositor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "docs": [
              "What the depositor had committed."
            ],
            "type": "u64"
          },
          {
            "name": "refunded",
            "docs": [
              "What came back to them on top of the account's rent: `amount` when the",
              "market settled with nobody staked, zero when it was distributed."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "RewardsClaimed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "user",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "staked_amount",
            "docs": [
              "The claimer's `StakePosition` after settling and paying out. Emitted so",
              "an indexer can serve a wallet's positions without reading every",
              "StakePosition account back, which needs a getProgramAccounts scan."
            ],
            "type": "u64"
          },
          {
            "name": "pending_rewards",
            "type": "u64"
          },
          {
            "name": "reward_checkpoint",
            "type": "u128"
          }
        ]
      }
    },
    {
      "name": "RewardsCommitted",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "depositor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "depositor_total",
            "docs": [
              "This depositor's running total for this market, `amount` included."
            ],
            "type": "u64"
          },
          {
            "name": "total_committed",
            "docs": [
              "The market's running total of committed rewards, `amount` included —",
              "what the app shows as promised to the stakers at settlement."
            ],
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "RewardsDeposited",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "depositor",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "`total_staked` used as the distribution denominator for this deposit."
            ],
            "type": "u64"
          },
          {
            "name": "new_accumulator",
            "type": "u128"
          },
          {
            "name": "carry_scaled_after",
            "docs": [
              "Rounding-dust carry after this deposit, in the REWARD_SCALE domain",
              "(matches `Market.carry_rewards_scaled`, not lamports). Strictly less",
              "than `total_staked`, in both phases: `deposit_rewards` accrues on",
              "arrival whether or not the market is settled, and refuses a deposit",
              "with nobody staked, so every deposit reaching this field went through",
              "the accrue."
            ],
            "type": "u128"
          }
        ]
      }
    },
    {
      "name": "RewardsVault",
      "docs": [
        "Per-market revenue pool. Holds SOL beyond its rent-exempt minimum; the",
        "excess is what stakers are collectively owed.",
        "",
        "Money reaches it from three places. The holder share of a sell and a",
        "`deposit_rewards` behave the same way: the lamports arrive and",
        "`reward_per_token_accumulator` moves in the same instruction, so the balance",
        "and the entitlements it backs never drift apart, which is what lets",
        "`claim_rewards` run in either phase.",
        "",
        "A `commit_rewards` is the exception, by design. Its lamports arrive at once",
        "but are assigned only at `settle_market`, so until then the vault holds",
        "`market.committed_rewards` more than the stakers are owed. Claims are paid",
        "from what the accumulator says, never from the balance, so that surplus is",
        "out of their reach. Settlement assigns it, or leaves it refundable to the",
        "depositors when nobody is staked.",
        "",
        "`total_deposited` counts committed rewards when they are assigned, not when",
        "they are committed, and never counts a refund.",
        "",
        "`total_deposited` and `total_claimed` are maintained for indexers and",
        "transparency, and no logic reads them. They count modulo 2^64: they wrap",
        "rather than overflow, because a recycled deposit → claim loop can push them",
        "past u64::MAX at no cost, and an overflow used to revert the instruction",
        "moving the funds. `total_deposited.wrapping_sub(total_claimed)` is still the",
        "exact amount outstanding, since that amount is lamports held here. The live",
        "distributable balance is derived from `lamports - rent_exempt_minimum`,",
        "never from these fields."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "total_deposited",
            "type": "u64"
          },
          {
            "name": "total_claimed",
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "StakePosition",
      "docs": [
        "Per-(market, owner) staking position. `staked_amount` is what the owner has",
        "explicitly deposited into the market stake vault — it does not mirror an ATA",
        "balance. Because staked tokens are custodied by the program, the amount can",
        "only change via `stake`/`unstake` (never a silent burn or an outside transfer),",
        "so reward settling is always exact — no burn-aware variant is needed.",
        "",
        "The position carries no timestamp: rewards are a pure function of",
        "`staked_amount` and the accumulator delta since `reward_checkpoint`, with no",
        "weighting for how long the tokens sat here."
      ],
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "owner",
            "type": "pubkey"
          },
          {
            "name": "staked_amount",
            "docs": [
              "Tokens currently staked by this owner (held in the market stake vault)."
            ],
            "type": "u64"
          },
          {
            "name": "pending_rewards",
            "docs": [
              "Claimable lamports accrued and not yet withdrawn."
            ],
            "type": "u64"
          },
          {
            "name": "reward_checkpoint",
            "docs": [
              "The per-token accumulator value this position last settled against. The",
              "reward owed since then is `staked_amount × (accumulator − reward_checkpoint)`,",
              "floored to lamports once at credit time. Storing the checkpoint (which always",
              "fits u128) instead of `staked × accumulator` keeps settle overflow-free even",
              "if the accumulator was inflated by a deposit made against a tiny",
              "`total_staked`. See `rewards::settle_core`."
            ],
            "type": "u128"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "Staked",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "owner",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "Market-wide total, not this owner's stake."
            ],
            "type": "u64"
          },
          {
            "name": "staked_amount",
            "docs": [
              "This owner's `StakePosition` after the stake was applied. `amount` is a",
              "delta and `total_staked` belongs to the market, so neither yields the",
              "owner's own position; emitting it removes the account read."
            ],
            "type": "u64"
          },
          {
            "name": "pending_rewards",
            "type": "u64"
          },
          {
            "name": "reward_checkpoint",
            "type": "u128"
          }
        ]
      }
    },
    {
      "name": "Unstaked",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "market",
            "type": "pubkey"
          },
          {
            "name": "owner",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          },
          {
            "name": "total_staked",
            "docs": [
              "Market-wide total, not this owner's stake."
            ],
            "type": "u64"
          },
          {
            "name": "staked_amount",
            "docs": [
              "This owner's `StakePosition` after the unstake was applied. Same",
              "reasoning as `Staked`."
            ],
            "type": "u64"
          },
          {
            "name": "pending_rewards",
            "type": "u64"
          },
          {
            "name": "reward_checkpoint",
            "type": "u128"
          }
        ]
      }
    }
  ]
}