> For the complete documentation index, see [llms.txt](https://gamza-net.gitbook.io/gamza.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://gamza-net.gitbook.io/gamza.net/quick-start/tutorials.md).

# Tutorials

## Inspection Methods Based on User Input

To utilize Herbicide, users can select between two input methods.

### PoolKey

<figure><img src="https://959484927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYohyEukRkFCG7BpCwUW%2Fuploads%2FwI9JD3Z6ve8lOKbfWO5O%2Fmaster_page_m%20%E2%80%93%20PF%20-%204.png?alt=media&amp;token=40daae4a-70d5-4014-a9c8-a88e9b56ccb3" alt="" width="563"><figcaption></figcaption></figure>

* The Hook Contract must be deployed on the Unichain.
* The specified Hook should be initialized (or be eligible for initialization) with the Pool Manager at [`0x38EB8B22Df3Ae7fb21e92881151B365Df14ba967`](https://unichain-sepolia.blockscout.com/address/0x38EB8B22Df3Ae7fb21e92881151B365Df14ba967) using the provided PoolKey.
* The PoolKey includes the two token addresses to be exchanged (currency0, currency1), LP fees, tick spacing, and the Hook Contract address.
* To run an Initialize Test with a specific deployer address, provide the address as an additional parameter. If omitted, the test will default to the standard address for execution.

**Detection Available**

1. **Malicious Hook Detection**: Issues a warning if the Hook attempts to misappropriate user funds or withdraws more tokens than the user intended.
2. **Price Abnormality Detection**: Alerts users if there is a significant discrepancy between the simulated price calculated by Herbicide and the actual swap price.
3. **Hook Delta Simulation**: Simulates the amounts transferred during Swap/ModifyLiquidity operations, allowing users to understand the specific fund flow characteristics of the Hook.
4. **Static Analysis with Slither**: Provides security inspections and detailed contract information using [Slither](https://github.com/crytic/slither) on verified Hook Contracts from BlockScout, facilitating efficient auditing of the Hook Contract.

### Hook Contract written in Solidity

<figure><img src="https://959484927-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVYohyEukRkFCG7BpCwUW%2Fuploads%2FqAz1DIi0EpbZZCH4ddPY%2Fmaster_page_m%20%E2%80%93%20PF%20-%205.png?alt=media&amp;token=c948e98c-859c-4fb0-a420-4879f2b541c0" alt="" width="563"><figcaption></figcaption></figure>

When a Hook Contract is provided, Herbicide uses its Semgrep script to perform static analysis, detecting potential threats and processing Hook Contract information for review.

#### Detection Available

* **onlyPoolManager:** Confirms that onlyPoolManager is implemented to ensure access control for hook functions.
* **Double Initialize Storage Check:** Verifies if the Storage accessed by `beforeInitialize/afterInitialize` functions is managed by PoolId during Hook initialization.
* **tx.origin Warning:** Issues a warning if access control relies on `tx.origin`, which can introduce security vulnerabilities.

{% hint style="info" %}
All tests are conducted without impacting the actual chain.
{% endhint %}

### Types of integrations

<table data-card-size="large" data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type="content-ref"></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden></th></tr></thead><tbody><tr><td><strong>Analytics</strong></td><td>Track analytics from your docs</td><td><a href="https://www.gitbook.com/integrations#analytics">https://www.gitbook.com/integrations#analytics</a></td><td></td><td></td></tr><tr><td><strong>Support</strong></td><td>Add support widgets to your docs</td><td><a href="https://www.gitbook.com/integrations#support">https://www.gitbook.com/integrations#support</a></td><td></td><td></td></tr><tr><td><strong>Interactive</strong></td><td>Add extra functionality to your docs</td><td><a href="https://www.gitbook.com/integrations#interactive">https://www.gitbook.com/integrations#interactive</a></td><td></td><td></td></tr><tr><td><strong>Visitor Authentication</strong></td><td>Protect your docs and require sign-in</td><td><a href="https://www.gitbook.com/integrations#visitor-authentication">https://www.gitbook.com/integrations#visitor-authentication</a></td><td></td><td></td></tr></tbody></table>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://gamza-net.gitbook.io/gamza.net/quick-start/tutorials.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
