{
 "address": "4PGcu4SonW3t8jo6V4uzzmTthFg8spDJdC8ANYZNwhog",
 "metadata": {
  "name": "hooked_bridge",
  "version": "0.1.0",
  "spec": "0.1.0",
  "description": "The Hooked bridge: wraps SPL Token and Token-2022 mints and native SOL into Hooked Token Standard mints one for one, and unwraps them."
 },
 "docs": [
  "Instructions of the bridge."
 ],
 "instructions": [
  {
   "name": "init_config",
   "docs": [
    "Creates the config; signed by the program's upgrade authority, once."
   ],
   "discriminator": [
    23,
    235,
    115,
    232,
    168,
    96,
    1,
    231
   ],
   "accounts": [
    {
     "name": "authority",
     "docs": [
      "The upgrade authority, paying the rent."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "program_data"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "args",
     "type": {
      "defined": {
       "name": "ConfigArgs"
      }
     }
    }
   ]
  },
  {
   "name": "register",
   "docs": [
    "Registers an SPL Token or Token-2022 mint: creates its wrapper, vault and wrapped mint.",
    "Permissionless."
   ],
   "discriminator": [
    211,
    124,
    67,
    15,
    211,
    194,
    178,
    240
   ],
   "accounts": [
    {
     "name": "payer",
     "docs": [
      "Pays the rent."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "underlying_mint"
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "account",
        "path": "underlying_mint"
       }
      ]
     }
    },
    {
     "name": "wrapped_mint",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         100
        ]
       },
       {
        "kind": "account",
        "path": "underlying_mint"
       }
      ]
     }
    },
    {
     "name": "vault",
     "writable": true
    },
    {
     "name": "underlying_program"
    },
    {
     "name": "ata_program",
     "address": "ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
    },
    {
     "name": "token_program",
     "address": "FRxxeTHBMsdHpJ9oiHHSMpGFCJ2yNuxQcyQYkCJawTYh"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "args",
     "type": {
      "defined": {
       "name": "RegisterArgs"
      }
     }
    }
   ]
  },
  {
   "name": "register_sol",
   "docs": [
    "Registers native SOL (the wSOL mint address stands for it). Permissionless, once."
   ],
   "discriminator": [
    17,
    123,
    22,
    240,
    124,
    124,
    42,
    200
   ],
   "accounts": [
    {
     "name": "payer",
     "docs": [
      "Pays the rent."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "const",
        "value": [
         6,
         155,
         136,
         87,
         254,
         171,
         129,
         132,
         251,
         104,
         127,
         99,
         70,
         24,
         192,
         53,
         218,
         196,
         57,
         220,
         26,
         235,
         59,
         85,
         152,
         160,
         240,
         0,
         0,
         0,
         0,
         1
        ]
       }
      ]
     }
    },
    {
     "name": "wrapped_mint",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         100
        ]
       },
       {
        "kind": "const",
        "value": [
         6,
         155,
         136,
         87,
         254,
         171,
         129,
         132,
         251,
         104,
         127,
         99,
         70,
         24,
         192,
         53,
         218,
         196,
         57,
         220,
         26,
         235,
         59,
         85,
         152,
         160,
         240,
         0,
         0,
         0,
         0,
         1
        ]
       }
      ]
     }
    },
    {
     "name": "sol_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         115,
         111,
         108,
         45,
         118,
         97,
         117,
         108,
         116
        ]
       }
      ]
     }
    },
    {
     "name": "token_program",
     "address": "FRxxeTHBMsdHpJ9oiHHSMpGFCJ2yNuxQcyQYkCJawTYh"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": []
  },
  {
   "name": "set_config",
   "docs": [
    "Admin: changes the config."
   ],
   "discriminator": [
    108,
    158,
    154,
    175,
    212,
    98,
    52,
    66
   ],
   "accounts": [
    {
     "name": "admin",
     "docs": [
      "The admin."
     ],
     "signer": true,
     "relations": [
      "config"
     ]
    },
    {
     "name": "config",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "args",
     "type": {
      "defined": {
       "name": "ConfigArgs"
      }
     }
    }
   ]
  },
  {
   "name": "unwrap",
   "docs": [
    "Burns `amount` of the wrapped mint and pays the underlying out of the vault."
   ],
   "discriminator": [
    126,
    175,
    198,
    14,
    212,
    69,
    50,
    44
   ],
   "accounts": [
    {
     "name": "user",
     "docs": [
      "The user."
     ],
     "signer": true
    },
    {
     "name": "config",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "account",
        "path": "wrapper.underlying_mint",
        "account": "Wrapper"
       }
      ]
     }
    },
    {
     "name": "underlying_mint"
    },
    {
     "name": "user_underlying",
     "writable": true
    },
    {
     "name": "vault",
     "writable": true
    },
    {
     "name": "wrapped_mint",
     "writable": true
    },
    {
     "name": "user_wrapped",
     "writable": true
    },
    {
     "name": "underlying_program"
    },
    {
     "name": "token_program"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "amount",
     "type": "u64"
    }
   ]
  },
  {
   "name": "unwrap_sol",
   "docs": [
    "Burns `amount` of wrapped SOL (`u64::MAX` for the whole holding) and pays the lamports out."
   ],
   "discriminator": [
    99,
    40,
    14,
    105,
    45,
    107,
    172,
    201
   ],
   "accounts": [
    {
     "name": "user",
     "docs": [
      "The user (pays or receives the lamports)."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "const",
        "value": [
         6,
         155,
         136,
         87,
         254,
         171,
         129,
         132,
         251,
         104,
         127,
         99,
         70,
         24,
         192,
         53,
         218,
         196,
         57,
         220,
         26,
         235,
         59,
         85,
         152,
         160,
         240,
         0,
         0,
         0,
         0,
         1
        ]
       }
      ]
     }
    },
    {
     "name": "sol_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         115,
         111,
         108,
         45,
         118,
         97,
         117,
         108,
         116
        ]
       }
      ]
     }
    },
    {
     "name": "wrapped_mint",
     "writable": true
    },
    {
     "name": "user_wrapped",
     "writable": true
    },
    {
     "name": "token_program"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "amount",
     "type": "u64"
    }
   ]
  },
  {
   "name": "unwrap_sol_above",
   "docs": [
    "Burns everything above `keep` of the user's wrapped SOL and pays the lamports out: what a",
    "trade just delivered, leaving what was held before it."
   ],
   "discriminator": [
    50,
    22,
    233,
    71,
    66,
    107,
    210,
    141
   ],
   "accounts": [
    {
     "name": "user",
     "docs": [
      "The user (pays or receives the lamports)."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "const",
        "value": [
         6,
         155,
         136,
         87,
         254,
         171,
         129,
         132,
         251,
         104,
         127,
         99,
         70,
         24,
         192,
         53,
         218,
         196,
         57,
         220,
         26,
         235,
         59,
         85,
         152,
         160,
         240,
         0,
         0,
         0,
         0,
         1
        ]
       }
      ]
     }
    },
    {
     "name": "sol_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         115,
         111,
         108,
         45,
         118,
         97,
         117,
         108,
         116
        ]
       }
      ]
     }
    },
    {
     "name": "wrapped_mint",
     "writable": true
    },
    {
     "name": "user_wrapped",
     "writable": true
    },
    {
     "name": "token_program"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "keep",
     "type": "u64"
    }
   ]
  },
  {
   "name": "wrap",
   "docs": [
    "Moves `amount` of the underlying into the vault and mints what arrived."
   ],
   "discriminator": [
    178,
    40,
    10,
    189,
    228,
    129,
    186,
    140
   ],
   "accounts": [
    {
     "name": "user",
     "docs": [
      "The user."
     ],
     "signer": true
    },
    {
     "name": "config",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "account",
        "path": "wrapper.underlying_mint",
        "account": "Wrapper"
       }
      ]
     }
    },
    {
     "name": "underlying_mint"
    },
    {
     "name": "user_underlying",
     "writable": true
    },
    {
     "name": "vault",
     "writable": true
    },
    {
     "name": "wrapped_mint",
     "writable": true
    },
    {
     "name": "user_wrapped",
     "writable": true
    },
    {
     "name": "underlying_program"
    },
    {
     "name": "token_program"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "amount",
     "type": "u64"
    }
   ]
  },
  {
   "name": "wrap_sol",
   "docs": [
    "Moves `lamports` into the SOL vault and mints as much wrapped SOL."
   ],
   "discriminator": [
    47,
    62,
    155,
    172,
    131,
    205,
    37,
    201
   ],
   "accounts": [
    {
     "name": "user",
     "docs": [
      "The user (pays or receives the lamports)."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "config",
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         99,
         111,
         110,
         102,
         105,
         103
        ]
       }
      ]
     }
    },
    {
     "name": "wrapper",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         119,
         114,
         97,
         112,
         112,
         101,
         114
        ]
       },
       {
        "kind": "const",
        "value": [
         6,
         155,
         136,
         87,
         254,
         171,
         129,
         132,
         251,
         104,
         127,
         99,
         70,
         24,
         192,
         53,
         218,
         196,
         57,
         220,
         26,
         235,
         59,
         85,
         152,
         160,
         240,
         0,
         0,
         0,
         0,
         1
        ]
       }
      ]
     }
    },
    {
     "name": "sol_vault",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         115,
         111,
         108,
         45,
         118,
         97,
         117,
         108,
         116
        ]
       }
      ]
     }
    },
    {
     "name": "wrapped_mint",
     "writable": true
    },
    {
     "name": "user_wrapped",
     "writable": true
    },
    {
     "name": "token_program"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    },
    {
     "name": "event_authority"
    },
    {
     "name": "program"
    }
   ],
   "args": [
    {
     "name": "lamports",
     "type": "u64"
    }
   ]
  }
 ],
 "accounts": [
  {
   "name": "Config",
   "discriminator": [
    155,
    12,
    170,
    224,
    30,
    250,
    204,
    130
   ]
  },
  {
   "name": "Wrapper",
   "discriminator": [
    161,
    11,
    109,
    119,
    86,
    61,
    163,
    136
   ]
  }
 ],
 "events": [
  {
   "name": "ConfigSet",
   "discriminator": [
    15,
    104,
    59,
    16,
    236,
    241,
    8,
    6
   ]
  },
  {
   "name": "Unwrapped",
   "discriminator": [
    25,
    86,
    93,
    80,
    145,
    113,
    86,
    93
   ]
  },
  {
   "name": "Wrapped",
   "discriminator": [
    11,
    127,
    145,
    31,
    206,
    134,
    73,
    130
   ]
  },
  {
   "name": "WrapperRegistered",
   "discriminator": [
    166,
    36,
    70,
    179,
    107,
    90,
    218,
    234
   ]
  }
 ],
 "errors": [
  {
   "code": 6000,
   "name": "ZeroAmount",
   "msg": "the amount is zero"
  },
  {
   "code": 6001,
   "name": "NotUpgradeAuthority",
   "msg": "not the upgrade authority"
  },
  {
   "code": 6002,
   "name": "NotAdmin",
   "msg": "not the admin"
  },
  {
   "code": 6003,
   "name": "Paused",
   "msg": "the bridge is paused"
  },
  {
   "code": 6004,
   "name": "NotAMint",
   "msg": "the underlying is not an SPL Token or Token-2022 mint"
  },
  {
   "code": 6005,
   "name": "WrongTokenProgram",
   "msg": "the token program passed is not the mint's"
  },
  {
   "code": 6006,
   "name": "WrongVault",
   "msg": "the vault passed is not the wrapper's"
  },
  {
   "code": 6007,
   "name": "WrongTokenAccount",
   "msg": "the token account passed is for another mint"
  },
  {
   "code": 6008,
   "name": "NothingReceived",
   "msg": "nothing arrived in the vault"
  },
  {
   "code": 6009,
   "name": "InsufficientVault",
   "msg": "the vault does not hold enough"
  },
  {
   "code": 6010,
   "name": "InvalidMetadata",
   "msg": "invalid metadata"
  },
  {
   "code": 6011,
   "name": "NativeWrapper",
   "msg": "this wrapper is native SOL; use wrap_sol and unwrap_sol"
  },
  {
   "code": 6012,
   "name": "NotNativeWrapper",
   "msg": "this wrapper is not native SOL"
  },
  {
   "code": 6013,
   "name": "MathOverflow",
   "msg": "math overflow"
  }
 ],
 "types": [
  {
   "name": "Config",
   "docs": [
    "Program configuration at `[\"config\"]`."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "version",
      "docs": [
       "Layout version."
      ],
      "type": "u8"
     },
     {
      "name": "bump",
      "docs": [
       "Bump."
      ],
      "type": "u8"
     },
     {
      "name": "admin",
      "docs": [
       "May change the config and fix wrapped mints' metadata."
      ],
      "type": "pubkey"
     },
     {
      "name": "paused",
      "docs": [
       "Stops wrapping (unwrapping always works)."
      ],
      "type": "bool"
     },
     {
      "name": "wrappers",
      "docs": [
       "Wrappers registered so far."
      ],
      "type": "u64"
     },
     {
      "name": "reserved",
      "docs": [
       "Reserved."
      ],
      "type": {
       "array": [
        "u8",
        32
       ]
      }
     }
    ]
   }
  },
  {
   "name": "ConfigArgs",
   "docs": [
    "Arguments of `init_config` and `set_config`."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "admin",
      "docs": [
       "The admin."
      ],
      "type": "pubkey"
     },
     {
      "name": "paused",
      "docs": [
       "Stops wrapping."
      ],
      "type": "bool"
     }
    ]
   }
  },
  {
   "name": "ConfigSet",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "admin",
      "type": "pubkey"
     },
     {
      "name": "paused",
      "type": "bool"
     },
     {
      "name": "ts",
      "type": "i64"
     }
    ]
   }
  },
  {
   "name": "RegisterArgs",
   "docs": [
    "Arguments of `register`: the wrapped mint's metadata, which should mirror the underlying's",
    "(the admin can correct it later)."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "name",
      "docs": [
       "Name."
      ],
      "type": "string"
     },
     {
      "name": "symbol",
      "docs": [
       "Symbol."
      ],
      "type": "string"
     },
     {
      "name": "uri",
      "docs": [
       "Metadata URI."
      ],
      "type": "string"
     }
    ]
   }
  },
  {
   "name": "Unwrapped",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "wrapper",
      "type": "pubkey"
     },
     {
      "name": "underlying_mint",
      "type": "pubkey"
     },
     {
      "name": "wrapped_mint",
      "type": "pubkey"
     },
     {
      "name": "user",
      "type": "pubkey"
     },
     {
      "name": "amount_burned",
      "type": "u64"
     },
     {
      "name": "total_wrapped",
      "type": "u64"
     },
     {
      "name": "slot",
      "type": "u64"
     },
     {
      "name": "ts",
      "type": "i64"
     }
    ]
   }
  },
  {
   "name": "Wrapped",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "wrapper",
      "type": "pubkey"
     },
     {
      "name": "underlying_mint",
      "type": "pubkey"
     },
     {
      "name": "wrapped_mint",
      "type": "pubkey"
     },
     {
      "name": "user",
      "type": "pubkey"
     },
     {
      "name": "amount_sent",
      "type": "u64"
     },
     {
      "name": "amount_minted",
      "type": "u64"
     },
     {
      "name": "total_wrapped",
      "type": "u64"
     },
     {
      "name": "slot",
      "type": "u64"
     },
     {
      "name": "ts",
      "type": "i64"
     }
    ]
   }
  },
  {
   "name": "Wrapper",
   "docs": [
    "A wrapper at `[\"wrapper\", underlying_mint]`."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "version",
      "docs": [
       "Layout version."
      ],
      "type": "u8"
     },
     {
      "name": "bump",
      "docs": [
       "Bump."
      ],
      "type": "u8"
     },
     {
      "name": "wrapped_mint_bump",
      "docs": [
       "Bump of the wrapped mint PDA."
      ],
      "type": "u8"
     },
     {
      "name": "native",
      "docs": [
       "True for native SOL."
      ],
      "type": "bool"
     },
     {
      "name": "underlying_mint",
      "docs": [
       "The underlying mint (the wSOL mint for native SOL)."
      ],
      "type": "pubkey"
     },
     {
      "name": "underlying_program",
      "docs": [
       "The underlying's token program (the system program for native SOL)."
      ],
      "type": "pubkey"
     },
     {
      "name": "wrapped_mint",
      "docs": [
       "The BTS mint."
      ],
      "type": "pubkey"
     },
     {
      "name": "vault",
      "docs": [
       "The vault: the wrapper's associated token account, or the SOL vault PDA."
      ],
      "type": "pubkey"
     },
     {
      "name": "decimals",
      "docs": [
       "Decimals (the same on both sides)."
      ],
      "type": "u8"
     },
     {
      "name": "total_wrapped",
      "docs": [
       "Wrapped and not yet unwrapped."
      ],
      "type": "u64"
     },
     {
      "name": "registered_at",
      "docs": [
       "Registration time."
      ],
      "type": "i64"
     },
     {
      "name": "registrar",
      "docs": [
       "Who registered it."
      ],
      "type": "pubkey"
     },
     {
      "name": "reserved",
      "docs": [
       "Reserved."
      ],
      "type": {
       "array": [
        "u8",
        32
       ]
      }
     }
    ]
   }
  },
  {
   "name": "WrapperRegistered",
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "wrapper",
      "type": "pubkey"
     },
     {
      "name": "underlying_mint",
      "type": "pubkey"
     },
     {
      "name": "underlying_program",
      "type": "pubkey"
     },
     {
      "name": "wrapped_mint",
      "type": "pubkey"
     },
     {
      "name": "vault",
      "type": "pubkey"
     },
     {
      "name": "decimals",
      "type": "u8"
     },
     {
      "name": "native",
      "type": "bool"
     },
     {
      "name": "name",
      "type": "string"
     },
     {
      "name": "symbol",
      "type": "string"
     },
     {
      "name": "uri",
      "type": "string"
     },
     {
      "name": "registrar",
      "type": "pubkey"
     },
     {
      "name": "ts",
      "type": "i64"
     }
    ]
   }
  }
 ]
}