{
 "address": "FfHZmEAZm9RyygvPN9rY4kZkQbrEXj5W1Tih3cGegU1",
 "metadata": {
  "name": "tax_hook",
  "version": "0.1.0",
  "spec": "0.1.0",
  "description": "An example Hooked token hook: a programmable transfer fee paid to a collector, with a maximum wallet size. What a transfer hook on Token-2022 cannot do, in forty lines."
 },
 "docs": [
  "Instructions of the example hook."
 ],
 "instructions": [
  {
   "name": "before_transfer",
   "docs": [
    "`before_transfer`: the fee (one delta to the collector), and the wallet cap."
   ],
   "discriminator": [
    23,
    118,
    189,
    23,
    179,
    222,
    94,
    146
   ],
   "accounts": [
    {
     "name": "hook_signer",
     "signer": true,
     "address": "EJUzdiazmu5kk9A4amtPzLUTxyw6e3u6vKK4m14W1BYR"
    },
    {
     "name": "mint"
    },
    {
     "name": "source"
    },
    {
     "name": "destination"
    },
    {
     "name": "authority"
    },
    {
     "name": "tax",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         116,
         97,
         120
        ]
       },
       {
        "kind": "account",
        "path": "mint"
       }
      ]
     }
    },
    {
     "name": "collector_holding",
     "writable": true
    }
   ],
   "args": [
    {
     "name": "args",
     "type": {
      "defined": {
       "name": "TokenHookArgs"
      }
     }
    }
   ],
   "returns": {
    "defined": {
     "name": "HookReturn"
    }
   }
  },
  {
   "name": "install",
   "docs": [
    "Installs the hook on `mint`: the mint's hook authority signs."
   ],
   "discriminator": [
    15,
    83,
    235,
    237,
    55,
    135,
    112,
    250
   ],
   "accounts": [
    {
     "name": "authority",
     "docs": [
      "The mint's hook authority; pays the rent."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "mint",
     "writable": true
    },
    {
     "name": "tax",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         116,
         97,
         120
        ]
       },
       {
        "kind": "account",
        "path": "mint"
       }
      ]
     }
    },
    {
     "name": "collector_holding"
    },
    {
     "name": "registry",
     "writable": true
    },
    {
     "name": "token_program",
     "address": "FRxxeTHBMsdHpJ9oiHHSMpGFCJ2yNuxQcyQYkCJawTYh"
    },
    {
     "name": "token_event_authority"
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    }
   ],
   "args": [
    {
     "name": "fee_bps",
     "type": "u16"
    },
    {
     "name": "max_wallet_bps",
     "type": "u16"
    }
   ]
  },
  {
   "name": "prepare",
   "docs": [
    "Prepares the hook for `mint`, which need not exist yet (a launch's mint: the launchpad",
    "creates it with this program as its hook, `FLAGS` and no hook authority, from a",
    "`LaunchConfig` that names it): the tax config and the registry, with the collector's",
    "future holding of the mint (`holding(mint, collector)`) as the fee's destination. Create",
    "that holding once the mint exists; transfers before that pay no fee."
   ],
   "discriminator": [
    121,
    155,
    156,
    90,
    164,
    252,
    220,
    109
   ],
   "accounts": [
    {
     "name": "authority",
     "docs": [
      "Whoever prepares the hook (the launch's creator); pays the rent."
     ],
     "writable": true,
     "signer": true
    },
    {
     "name": "mint"
    },
    {
     "name": "collector"
    },
    {
     "name": "tax",
     "writable": true,
     "pda": {
      "seeds": [
       {
        "kind": "const",
        "value": [
         116,
         97,
         120
        ]
       },
       {
        "kind": "account",
        "path": "mint"
       }
      ]
     }
    },
    {
     "name": "registry",
     "writable": true
    },
    {
     "name": "system_program",
     "address": "11111111111111111111111111111111"
    }
   ],
   "args": [
    {
     "name": "fee_bps",
     "type": "u16"
    },
    {
     "name": "max_wallet_bps",
     "type": "u16"
    }
   ]
  }
 ],
 "accounts": [
  {
   "name": "TaxConfig",
   "discriminator": [
    38,
    187,
    35,
    231,
    115,
    102,
    30,
    82
   ]
  }
 ],
 "errors": [
  {
   "code": 6000,
   "name": "BadParams",
   "msg": "bad parameters"
  },
  {
   "code": 6001,
   "name": "WrongHolding",
   "msg": "the holding is for another mint"
  },
  {
   "code": 6002,
   "name": "BadHookSigner",
   "msg": "the hook signer is not the token program's signer for this hook"
  },
  {
   "code": 6003,
   "name": "WalletTooLarge",
   "msg": "the destination would hold more than the maximum"
  },
  {
   "code": 6004,
   "name": "Overflow",
   "msg": "math overflow"
  },
  {
   "code": 6005,
   "name": "WrongMint",
   "msg": "the arguments are for another mint"
  }
 ],
 "types": [
  {
   "name": "Delta",
   "docs": [
    "One cut an answer takes from the amount."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "amount",
      "docs": [
       "How much (above zero)."
      ],
      "type": "u64"
     },
     {
      "name": "account",
      "docs": [
       "Index in the callback's account list (prefix first, then extras) of the holding that",
       "receives it. Must be an extra."
      ],
      "type": "u8"
     }
    ]
   }
  },
  {
   "name": "HookReturn",
   "docs": [
    "What a callback may answer in its return data. Which fields a callback may fill depends on the",
    "callback and the flags ([`Allowed`]); the calling program refuses an answer that fills any",
    "other field."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "deltas",
      "docs": [
       "Cuts from the amount (the transfer; a swap's input before, its output after), at most",
       "[`MAX_DELTAS`]."
      ],
      "type": {
       "vec": {
        "defined": {
         "name": "Delta"
        }
       }
      }
     },
     {
      "name": "burn",
      "docs": [
       "Pool swap callbacks only: an amount to burn from the same side."
      ],
      "type": "u64"
     },
     {
      "name": "lp_fee_bps",
      "docs": [
       "`before_swap` only: the LP fee to apply instead of the pool's."
      ],
      "type": {
       "option": "u16"
      }
     },
     {
      "name": "source_hook_data",
      "docs": [
       "Token callbacks only (`before_transfer`, `before_burn`): the source holding's new hook data",
       "([`HOOK_DATA_LEN`] bytes)."
      ],
      "type": {
       "option": {
        "array": [
         "u8",
         64
        ]
       }
      }
     },
     {
      "name": "destination_hook_data",
      "docs": [
       "Token callbacks only (`before_transfer`, `before_mint`): the destination holding's new hook",
       "data."
      ],
      "type": {
       "option": {
        "array": [
         "u8",
         64
        ]
       }
      }
     }
    ]
   }
  },
  {
   "name": "Mint",
   "docs": [
    "A mint. Address: any signer at creation (a keypair, or a PDA of the creating program)."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "version",
      "docs": [
       "Layout version."
      ],
      "type": "u8"
     },
     {
      "name": "decimals",
      "docs": [
       "Decimals."
      ],
      "type": "u8"
     },
     {
      "name": "supply",
      "docs": [
       "Current supply."
      ],
      "type": "u64"
     },
     {
      "name": "max_supply",
      "docs": [
       "Largest supply ever allowed; 0 means unlimited."
      ],
      "type": "u64"
     },
     {
      "name": "mint_authority",
      "docs": [
       "May mint; `None` once revoked."
      ],
      "type": {
       "option": "pubkey"
      }
     },
     {
      "name": "freeze_authority",
      "docs": [
       "May freeze and thaw holdings; `None` once revoked."
      ],
      "type": {
       "option": "pubkey"
      }
     },
     {
      "name": "hook_authority",
      "docs": [
       "May change the hook; `None` locks the hook for ever."
      ],
      "type": {
       "option": "pubkey"
      }
     },
     {
      "name": "metadata_authority",
      "docs": [
       "May change the metadata; `None` fixes it for ever."
      ],
      "type": {
       "option": "pubkey"
      }
     },
     {
      "name": "hook_program",
      "docs": [
       "The hook program, if any."
      ],
      "type": {
       "option": "pubkey"
      }
     },
     {
      "name": "hook_flags",
      "docs": [
       "Which callbacks run (`hooked_hook::token_flags`)."
      ],
      "type": "u16"
     },
     {
      "name": "name",
      "docs": [
       "Name."
      ],
      "type": "string"
     },
     {
      "name": "symbol",
      "docs": [
       "Symbol."
      ],
      "type": "string"
     },
     {
      "name": "uri",
      "docs": [
       "Metadata URI."
      ],
      "type": "string"
     },
     {
      "name": "created_at",
      "docs": [
       "Creation time."
      ],
      "type": "i64"
     },
     {
      "name": "creator",
      "docs": [
       "Who paid for the creation."
      ],
      "type": "pubkey"
     },
     {
      "name": "hook_signer_bump",
      "docs": [
       "Bump of `[\"hook-authority\", hook_program]`, this program's signer of every callback to the",
       "hook (one per hook program, so a hook can tell its own callbacks from a signer another hook",
       "passed on); 0 without a hook. Set with the hook."
      ],
      "type": "u8"
     },
     {
      "name": "reserved",
      "docs": [
       "Reserved."
      ],
      "type": {
       "array": [
        "u8",
        31
       ]
      }
     }
    ]
   }
  },
  {
   "name": "Phase",
   "docs": [
    "Before or after the operation."
   ],
   "type": {
    "kind": "enum",
    "variants": [
     {
      "name": "Before"
     },
     {
      "name": "After"
     }
    ]
   }
  },
  {
   "name": "TaxConfig",
   "docs": [
    "The hook's settings for one mint, at `[\"tax\", mint]`."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "bump",
      "type": "u8"
     },
     {
      "name": "mint",
      "type": "pubkey"
     },
     {
      "name": "authority",
      "type": "pubkey"
     },
     {
      "name": "fee_bps",
      "type": "u16"
     },
     {
      "name": "max_wallet_bps",
      "type": "u16"
     },
     {
      "name": "collector_holding",
      "type": "pubkey"
     },
     {
      "name": "collector_owner",
      "type": "pubkey"
     },
     {
      "name": "collected",
      "type": "u64"
     }
    ]
   }
  },
  {
   "name": "TokenHookArgs",
   "docs": [
    "Arguments of a token hook callback. Balances and hook data are those of the holdings before",
    "(`Before`) or after (`After`) the operation; `delta` is what the deltas took, known only after."
   ],
   "type": {
    "kind": "struct",
    "fields": [
     {
      "name": "op",
      "docs": [
       "The operation."
      ],
      "type": {
       "defined": {
        "name": "TokenOp"
       }
      }
     },
     {
      "name": "phase",
      "docs": [
       "Before or after it."
      ],
      "type": {
       "defined": {
        "name": "Phase"
       }
      }
     },
     {
      "name": "mint",
      "docs": [
       "The mint."
      ],
      "type": "pubkey"
     },
     {
      "name": "source",
      "docs": [
       "Source holding (the mint for a mint)."
      ],
      "type": "pubkey"
     },
     {
      "name": "destination",
      "docs": [
       "Destination holding (the mint for a burn)."
      ],
      "type": "pubkey"
     },
     {
      "name": "source_owner",
      "docs": [
       "Owner of the source holding (default for a mint)."
      ],
      "type": "pubkey"
     },
     {
      "name": "destination_owner",
      "docs": [
       "Owner of the destination holding (default for a burn)."
      ],
      "type": "pubkey"
     },
     {
      "name": "authority",
      "docs": [
       "Who signed."
      ],
      "type": "pubkey"
     },
     {
      "name": "authority_is_delegate",
      "docs": [
       "Whether the signer acted as a delegate rather than the owner."
      ],
      "type": "bool"
     },
     {
      "name": "amount",
      "docs": [
       "The amount of the operation."
      ],
      "type": "u64"
     },
     {
      "name": "delta",
      "docs": [
       "The sum of the deltas a `before_transfer` answer took (zero before)."
      ],
      "type": "u64"
     },
     {
      "name": "source_balance",
      "docs": [
       "Source balance."
      ],
      "type": "u64"
     },
     {
      "name": "destination_balance",
      "docs": [
       "Destination balance."
      ],
      "type": "u64"
     },
     {
      "name": "decimals",
      "docs": [
       "Decimals of the mint."
      ],
      "type": "u8"
     },
     {
      "name": "supply",
      "docs": [
       "Supply of the mint."
      ],
      "type": "u64"
     },
     {
      "name": "source_hook_data",
      "docs": [
       "The source holding's hook data (zeros for a mint)."
      ],
      "type": {
       "array": [
        "u8",
        64
       ]
      }
     },
     {
      "name": "destination_hook_data",
      "docs": [
       "The destination holding's hook data (zeros for a burn)."
      ],
      "type": {
       "array": [
        "u8",
        64
       ]
      }
     }
    ]
   }
  },
  {
   "name": "TokenOp",
   "docs": [
    "What a token hook is being told about."
   ],
   "type": {
    "kind": "enum",
    "variants": [
     {
      "name": "Transfer"
     },
     {
      "name": "Mint"
     },
     {
      "name": "Burn"
     }
    ]
   }
  }
 ]
}