{
  "address": "hookhR5JaFX7Y5WdEDZJLNiQCrPksEb2aZGYsxcY9xj",
  "metadata": {
    "name": "abyss_hook",
    "version": "0.2.0",
    "spec": "0.1.0",
    "description": "Abyss Token-2022 transfer hook: taint system (Pinocchio). Tokens leaving a hot token account (>= 1% of supply before the transfer, tainted, admin-flagged, or the vesting vault) taint the account they land in; curve and pool throttle tainted/flagged sellers on the max tier. Taint is keyed by token account and decays 30 days after it last arrived."
  },
  "instructions": [
    {
      "name": "execute",
      "discriminator": [
        105,
        37,
        101,
        197,
        75,
        251,
        102,
        26
      ],
      "docs": [
        "Called by Token-2022 on every transfer. Rejects direct calls (200): both token accounts must have the `transferring` flag set and the mint's hook must be this program."
      ],
      "accounts": [
        {
          "name": "source"
        },
        {
          "name": "mint"
        },
        {
          "name": "destination"
        },
        {
          "name": "authority"
        },
        {
          "name": "extra_metas",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "extra-account-metas"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "sender_taint",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint"
              },
              {
                "kind": "account",
                "path": "source"
              }
            ]
          }
        },
        {
          "name": "recipient_taint",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint"
              },
              {
                "kind": "account",
                "path": "destination"
              }
            ]
          },
          "docs": [
            "Must exist (open_taint) when the source is hot and the destination is not a program vault, else 201"
          ]
        }
      ],
      "args": [
        {
          "name": "amount",
          "type": "u64"
        }
      ]
    },
    {
      "name": "initialize_extra_account_meta_list",
      "discriminator": [
        43,
        34,
        13,
        49,
        167,
        88,
        235,
        235
      ],
      "docs": [
        "Permissionless, once per mint; curve.create_launch calls it by CPI. Writes the 2 extra account metas and the vault whitelist of the mint (launch / pool / vesting PDAs derived from the program ids in the config)."
      ],
      "accounts": [
        {
          "name": "payer",
          "writable": true,
          "signer": true
        },
        {
          "name": "extra_metas",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "extra-account-metas"
              },
              {
                "kind": "account",
                "path": "mint"
              }
            ]
          }
        },
        {
          "name": "mint"
        },
        {
          "name": "config",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint_config"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "open_taint",
      "discriminator": [
        0
      ],
      "docs": [
        "Permissionless, idempotent. Opens the (clean) taint PDA of a token account so it can receive tokens from a hot account. Rent paid by payer."
      ],
      "accounts": [
        {
          "name": "payer",
          "writable": true,
          "signer": true
        },
        {
          "name": "token_account"
        },
        {
          "name": "taint",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint"
              },
              {
                "kind": "account",
                "path": "token_account"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "init_config",
      "discriminator": [
        1
      ],
      "docs": [
        "Only the program's upgrade authority (checked against ProgramData). Stores the program ids whose PDAs are trusted vaults."
      ],
      "accounts": [
        {
          "name": "admin",
          "writable": true,
          "signer": true
        },
        {
          "name": "config",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint_config"
              }
            ]
          }
        },
        {
          "name": "curve_program"
        },
        {
          "name": "pool_program"
        },
        {
          "name": "vesting_program"
        },
        {
          "name": "program_data",
          "docs": [
            "PDA [program_id] under BPFLoaderUpgradeab1e11111111111111111111111"
          ]
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": []
    },
    {
      "name": "set_flag",
      "discriminator": [
        2
      ],
      "docs": [
        "Admin marks/unmarks a token account (KOL list). A flagged account taints everyone it sends to and sells on the max tier."
      ],
      "accounts": [
        {
          "name": "admin",
          "writable": true,
          "signer": true
        },
        {
          "name": "config",
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint_config"
              }
            ]
          }
        },
        {
          "name": "token_account"
        },
        {
          "name": "taint",
          "writable": true,
          "pda": {
            "seeds": [
              {
                "kind": "const",
                "value": "taint"
              },
              {
                "kind": "account",
                "path": "token_account"
              }
            ]
          }
        },
        {
          "name": "system_program",
          "address": "11111111111111111111111111111111"
        }
      ],
      "args": [
        {
          "name": "flagged",
          "type": "u8"
        }
      ]
    }
  ],
  "accounts": [
    {
      "name": "Taint"
    },
    {
      "name": "HookConfig"
    }
  ],
  "types": [
    {
      "name": "Taint",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "tainted",
            "type": "u64",
            "docs": [
              "counts only while now - last_ts <= 30 days"
            ]
          },
          {
            "name": "last_ts",
            "type": "i64",
            "docs": [
              "unix time taint last arrived"
            ]
          },
          {
            "name": "flagged",
            "type": "u8"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    },
    {
      "name": "HookConfig",
      "type": {
        "kind": "struct",
        "fields": [
          {
            "name": "admin",
            "type": "pubkey"
          },
          {
            "name": "curve_program",
            "type": "pubkey"
          },
          {
            "name": "pool_program",
            "type": "pubkey"
          },
          {
            "name": "vesting_program",
            "type": "pubkey"
          },
          {
            "name": "bump",
            "type": "u8"
          }
        ]
      }
    }
  ],
  "errors": [
    {
      "code": 200,
      "name": "NotTransferring",
      "msg": "Execute called outside a genuine Token-2022 transfer of a mint that uses this hook"
    },
    {
      "code": 201,
      "name": "RecipientNotOpen",
      "msg": "source is hot: open the recipient's taint PDA first (open_taint)"
    },
    {
      "code": 202,
      "name": "Unauthorized",
      "msg": "signer is not the upgrade authority / admin"
    }
  ]
}
