> For the complete documentation index, see [llms.txt](https://sommelier-finance.gitbook.io/sommelier-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sommelier-finance.gitbook.io/sommelier-documentation/smart-contracts/external-protocol-integration.md).

# External Protocol Integration

The Sommelier protocol is fully decentralized and open-sourced, and thus anyone can submit PRs and/or governance proposals to implement any change. That said, the current vault (Cellar) architecture typically requires two types of integrative smart contracts to be made in order to integrate into a new protocol. These are:

1. Adaptors, and
2. Pricing Extensions

Adaptors, as outlined in ["Protocol (V2) Contract Architecture,"](/sommelier-documentation/smart-contracts/protocol-v2-contract-architecture.md) are smart contracts that allow Cellars to get in and out of positions with a respective protocol (ex. [FTokenAdaptor.sol](https://github.com/PeggyJV/cellar-contracts/blob/main/src/modules/adaptors/Frax/FTokenAdaptor.sol)) or token (ex. [ERC20Adaptor.sol](https://github.com/PeggyJV/cellar-contracts/blob/main/src/modules/adaptors/ERC20Adaptor.sol)). A simplified outlook for adaptors is that they are ERC4626 Integration contracts to a specific protocol and/or general functionality (such as holding ERC20s).&#x20;

> *NOTE: The adaptor contracts used within the Sommelier protocol today can actually be generalized to be ERC4626 agnostic by removing Sommelier-specific concepts such as the `PriceRouter` and `Registry`.* [*These ERC4626 agnostic adaptors are being explored currently as a public goods effort to the DeFi space.*](https://github.com/PeggyJV/cellar-contracts/pull/143)

Pricing `extensions` are part of the `PriceRouterV2` design, where custom `extensions` are used to price assets involved with a Cellar's adaptor position. When interacting with external protocols, it is common to see receipt ERC20 tokens sent or minted to the Cellar from the respective protocol. These need to be priced with respect to the base asset. An example of this is the [Balancer Pricing Extensions](https://github.com/PeggyJV/cellar-contracts/tree/main/src/modules/price-router/Extensions/Balancer) that price Stable Pool BPTs.&#x20;


---

# 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://sommelier-finance.gitbook.io/sommelier-documentation/smart-contracts/external-protocol-integration.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.
