{
  "address": "7q7cns2MDf2sNVtwGHczub2oTrz8YjqFutEHHJZuQKqc",
  "metadata": {
    "name": "rwa_exit",
    "version": "0.1.0",
    "spec": "0.1.0",
    "description": "RWA exit program (claim-based redemption)"
  },
  "instructions": [
    {
      "name": "claim",
      "docs": [
        "Holder claim: burn `amount` RWA tokens, receive the pro-rata payout. Signed by the",
        "holder. Payout comes from the exit escrow (a payout-mint token account owned by the",
        "ExitState PDA, funded before claims open).",
        "",
        "payout (payout smallest units) =",
        "amount * final_price_cents * 10^payout_decimals / (100 * 10^rwa_decimals)",
        "where final_price_cents is USD cents per WHOLE rwa token. Computed in u128."
      ],
      "discriminator": [
        62,
        198,
        214,
        193,
        213,
        159,
        108,
        210
      ],
      "accounts": [
        {
          "name": "holder",
          "signer": true
        },
        {
          "name": "state",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  101,
                  120,
                  105,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "state.mint",
                "account": "ExitState"
              }
            ]
          }
        },
        {
          "name": "rwa_mint",
          "writable": true
        },
        {
          "name": "holder_rwa_account",
          "writable": true
        },
        {
          "name": "payout_mint"
        },
        {
          "name": "escrow_payout_account",
          "writable": true
        },
        {
          "name": "holder_payout_account",
          "writable": true
        },
        {
          "name": "rwa_token_program",
          "docs": [
            "Token program for the RWA mint (Token-2022)."
          ]
        },
        {
          "name": "payout_token_program",
          "docs": [
            "Token program for the payout mint (SPL Token or Token-2022)."
          ]
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "initiate_exit",
      "docs": [
        "Begin an exit: fix the redemption price and open claims. Admin (multisig) only.",
        "Assumes the vault has been funded with enough payout token for the supply."
      ],
      "discriminator": [
        15,
        194,
        144,
        7,
        247,
        94,
        48,
        161
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true
        },
        {
          "name": "mint"
        },
        {
          "name": "payout_mint",
          "docs": [
            "Payout token mint (the RWA token's payout_token). Recorded for claim()."
          ]
        },
        {
          "name": "state",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  101,
                  120,
                  105,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "payer",
          "writable": true,
          "signer": true
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "final_price_cents",
          "type": "u64"
        }
      ]
    },
    {
      "name": "set_treasury",
      "docs": [
        "Update treasury (sweep destination for post-deadline dust). Admin only."
      ],
      "discriminator": [
        57,
        97,
        196,
        95,
        195,
        206,
        106,
        136
      ],
      "accounts": [
        {
          "name": "admin",
          "signer": true
        },
        {
          "name": "state",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": [
                  101,
                  120,
                  105,
                  116
                ]
              },
              {
                "kind": "account",
                "path": "state.mint",
                "account": "ExitState"
              }
            ]
          }
        }
      ],
      "args": [
        {
          "name": "treasury",
          "type": "pubkey"
        }
      ]
    }
  ],
  "accounts": [
    {
      "name": "ExitState",
      "discriminator": [
        228,
        34,
        202,
        229,
        148,
        42,
        89,
        194
      ]
    }
  ],
  "events": [
    {
      "name": "Claimed",
      "discriminator": [
        217,
        192,
        123,
        72,
        108,
        150,
        248,
        33
      ]
    },
    {
      "name": "ExitInitiated",
      "discriminator": [
        231,
        181,
        41,
        200,
        30,
        79,
        20,
        73
      ]
    }
  ],
  "errors": [
    {
      "code": 6000,
      "name": "Unauthorized",
      "msg": "caller is not authorized for this action"
    },
    {
      "code": 6001,
      "name": "AlreadyInitiated",
      "msg": "exit already initiated"
    },
    {
      "code": 6002,
      "name": "NotClaimable",
      "msg": "exit is not open for claims"
    },
    {
      "code": 6003,
      "name": "MathOverflow",
      "msg": "payout math overflow"
    }
  ],
  "types": [
    {
      "name": "Claimed",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "holder",
            "type": "pubkey"
          },
          {
            "name": "amount",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "ExitInitiated",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "final_price_cents",
            "type": "u64"
          }
        ]
      }
    },
    {
      "name": "ExitState",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "mint",
            "type": "pubkey"
          },
          {
            "name": "payout_mint",
            "type": "pubkey"
          },
          {
            "name": "admin",
            "type": "pubkey"
          },
          {
            "name": "treasury",
            "type": "pubkey"
          },
          {
            "name": "final_price_cents",
            "type": "u64"
          },
          {
            "name": "initiated",
            "type": "bool"
          },
          {
            "name": "completed",
            "type": "bool"
          },
          {
            "name": "total_paid_out",
            "type": "u64"
          },
          {
            "name": "total_burned",
            "type": "u64"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    }
  ]
}