> For the complete documentation index, see [llms.txt](https://docs.protocolink.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.protocolink.com/smart-contract/overview/callback.md).

# Callback

Protocolink blocks reentrancy in the middle of a transaction for security reasons. However, blocking reentrancy stops Protocolink from supporting flash loan protocols. To support them without sacrificing security, Protocolink employs the Callback which is shown below.

<figure><img src="/files/ymQ75VmJPIv2DJdULyIa" alt=""><figcaption><p>Callback Call Flow</p></figcaption></figure>

The Callback plays the receiver role to flash loan services. When users try to borrow a flash loan within Protocolink, they must provide the corresponding callback address in the [callback field](https://github.com/dinngo/protocolink-contract/blob/4b765ea9da53fc02b4bce890676cf080206fd00e/src/libraries/DataType.sol#L26).

Currently, the supported callbacks are:

* [AaveV2FlashLoanCallback](https://github.com/dinngo/protocolink-contract/blob/master/src/callbacks/AaveV2FlashLoanCallback.sol)
* [AaveV3FlashLoanCallback](https://github.com/dinngo/protocolink-contract/blob/master/src/callbacks/AaveV3FlashLoanCallback.sol)
* [BalancerV2FlashLoanCallback](https://github.com/dinngo/protocolink-contract/blob/master/src/callbacks/BalancerV2FlashLoanCallback.sol)
* [RadiantV2FlashLoanCallback](https://github.com/dinngo/protocolink-contract/blob/master/src/callbacks/RadiantV2FlashLoanCallback.sol)

Check how the AaveV2 callback is used in this [example](https://github.com/dinngo/protocolink-contract/blob/cba23729be7acb7fd41e72d22d6652e03f34bdc2/test/integration/AaveV2.t.sol#L126).


---

# 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 dynamically by asking a question.

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

```
GET https://docs.protocolink.com/smart-contract/overview/callback.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
