# Adapters

Adapters allow for the integration of several external liquidation markets, and are based on a BaseAdapter contract that contains generic liquidation functionality. As of today, Unlockd's primary adapter used for liquidations is Reservoir

## Reservoir Adapter

Reservoir adapter aims at leveraging Reservoir's powerful infrastructure for trading NFTs across major marketplaces and chains. It liquidates NFT's seeking for the best offers accross different marketplaces, such as OpenSea, LooksRare and X2Y2. The liquidation process is as follows:

1. Trigger \`liquidateReservoir()\`, passing the specific calldata which holds the transfer of the NFT to reservoir's Router contract

{% hint style="info" %}
\`liquidateReservoir()\` is note permissionless, effectively enabling only Unlockd specific addresses to execute liquidations on Reservoir
{% endhint %}

2. Validate the calldata specifically designed to:
   1. Transfer the NFT in a safely manner to the specific reservoir module the NFT should be liquidated in
   2. Execute Reservoir router's \`execute()\` function with the specific calldata
3. Transfer the NFT to Reservoir's target module, where the NFT will be "automatically" liquidated
4. Validate the amount liquidated matches the expected liquidation price
5. Settle liquidation

### Write methods

`function liquidateReservoir(address nftAsset, address reserveAsset, bytes calldata data, uint256 expectedLiquidateAmount) external`

Liquidates an unhealthy loan in reservoir.

#### Call params

| Name                    | Type    | Description                                                               |
| ----------------------- | ------- | ------------------------------------------------------------------------- |
| nftAsset                | address | The address of the NFT to be liquidated                                   |
| reserveAsset            | address | The reserve for the liquidation                                           |
| data                    | bytes   | The data to execute, containing the execution data for reservoir's module |
| expectedLiquidateAmount | uint256 | The amount the NFT is expected to be exchanged for                        |


---

# 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://devs.unlockd.finance/unlockd-for-devs-v1/the-core-protocol/adapters.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.
