# Hooks

<figure><img src="/files/DfPq86OKSk2GYDsdmUrY" alt=""><figcaption></figcaption></figure>

## What are Hooks?

Hooks are customizable smart contracts to enhance interoperability and create advanced strategies with 3rd party protocols. They provide a powerful tool for developers to enhance the functionality of isolated modules in decentralized finance (DeFi) platforms by attaching customizable smart contracts. These hooks enable not only a high degree of customization but also significantly extend the operational capabilities of the modules. They are commonly used to implement [automated investment](https://www.investopedia.com/what-is-automated-investing-7569400) strategies directly within an isolated module. This allows for the [auto-compounding](https://docs.bancor.network/about-bancor-network/resources-for-daos/liquidity-mining/auto-compounding-rewards) of yields and their reinjection back into the position, optimizing the yield farming results for users.

## What Can Hooks Do?

By leveraging hooks, users can engage in staking and [farming](https://coinmarketcap.com/academy/article/what-is-yield-farming) activities while simultaneously using their deposited tokens as collateral for obtaining loans or creating [leverage](/protocol/hooks/looping-leverage.md) positions. This dual functionality addresses a major limitation faced by many money markets, where liquidity provider ([LP](https://coinmarketcap.com/academy/glossary/liquidity-provider-tokens-lp-tokens)) tokens are not accepted as collateral because they need to be actively staked to generate rewards. Traditionally, this forced users to choose between unlocking capital by depositing LP tokens or staking them to accrue rewards. Hooks cleverly eliminate this trade-off, allowing both actions to coexist.

Moreover, hooks can range from straightforward applications like staking tokens on another protocol when they are deposited as collateral, to more complex scenarios involving algorithms that automatically identify and aggregate the highest yields based on the chosen strategy. This flexibility explains why there may be multiple isolated modules for the same asset, each tailored to different yield-generating strategies.

The introduction of hooks represents a significant evolution in the programmability and efficiency of DeFi platforms, enabling money markets tailored to the strategic needs of the user.

<figure><img src="/files/R6xpDKVS1Q3fQvBuFYka" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

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

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tren.finance/protocol/hooks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
