# Sovryn Protocol

<figure><img src="/files/KIhlmgifx9aYzk403KQM" alt=""><figcaption><p>The Sovryn Protocol and its connection to other parts of the system.</p></figcaption></figure>

The user interacts with the loan token contracts (aka lending pools) in order to borrow or margin trade. The lending pools provide the loan and open a position on the Sovryn Protocol. The Sovryn Protocol is responsible for holding the collateral and swap between the collateral and loan currency on the AMM. It also provides the interface to modify existing positions.&#x20;

The source code resides in our [github](https://github.com/DistributedCollective/Sovryn-smart-contracts/).

This builder portal focuses on the most relevant functionality. A complete documentation of all contracts and their functions can be found [here](https://github.com/DistributedCollective/Sovryn-smart-contracts/tree/development/docs).&#x20;


---

# 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://build.sovryn.com/builder-portal/smart-contracts/lending-and-margin-trading-protocol.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.
