# BridgeReceiver

Currently integrated with LayerZero v1, v2 and Stargate v1, v2.

***

An internal Replete contract which proxies all communications from [RepletePool](/contracts/repletepool.md) to the Pool contract on Pool Chain. A mapping of `bridgeModules` are stored in the contract which are [IBridgeModule](https://github.com/RepleteFinance/replete-protocol/blob/main/src/interfaces/IBridgeModule.sol) adapters, allowing to bridge assets from Pool Chain to any remote chain, most likely used by `{*AndBridgeVia*}` methods on [RepletePool](/contracts/repletepool.md).

Whilst the [BridgeReceiver](https://github.com/RepleteFinance/replete-protocol/blob/main/src/hosted/BridgeReceiver.sol) performs actions on behalf of the user, some safety features exist to protect user funds. All assets are supplied on behalf of the user, rather than the [BridgeReceiver](https://github.com/RepleteFinance/replete-protocol/blob/main/src/hosted/BridgeReceiver.sol) contract, so users are able to withdraw assets, in the case of an emergency, by withdrawing directly on the Pool contract. This also means that Replete is unable to directly create a borrow position on your behalf or withdraw your assets.

When you borrow through [RepletePool](/contracts/repletepool.md), you sign a credit delegation signature `bridgeDelegationData` which allows the [BridgeReceiver](https://github.com/RepleteFinance/replete-protocol/blob/main/src/hosted/BridgeReceiver.sol) contract to create a borrow position from your collateral for the amount you allowed. These signatures are one time use and expire if unused. This also prevents replay attacks if the underlying cross chain messaging service is compromised. Read more about [Borrowing Security](/developers/how-to-borrow.md#borrowing-security).

When you withdraw through [RepletePool](/contracts/repletepool.md), you sign a permit signature `permitSignature` which allows the [BridgeReceiver](https://github.com/RepleteFinance/replete-protocol/blob/main/src/hosted/BridgeReceiver.sol) contract to withdraw your assets for up to the amount you allowed. These signatures are one time use and expire if unused. This also prevents replay attacks if the underlying cross chain messaging service is compromised. Read more about [Withdrawing Security](/developers/how-to-withdraw.md#withdrawing-security).


---

# 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.replete.fi/contracts/bridgereceiver.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.
