> For the complete documentation index, see [llms.txt](https://build.sovryn.com/builder-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://build.sovryn.com/builder-portal/smart-contracts/amm/wrapper/swaps.md).

# Swaps

convertByPath converts the token to any other token in the sovryn swap network by following a predefined conversion path and transfers the result tokens to a target account. Please note that either the source or target token address has to be WRBTC. If the source is not RBTC, the wrapper contract should already have been given allowance of the source token. The wrapping or unwrapping of WRBTC is handled the wrapper contract.

```solidity
function convertByPath(IERC20Token[] memory _path, uint256 _amount, uint256 _minReturn) 
returns(uint256) 
```

**Arguments**

<table><thead><tr><th width="180.33333333333334">Name</th><th width="161">Type</th><th>Description</th></tr></thead><tbody><tr><td>_path</td><td>IERC20Token[]</td><td>conversion path, see conversion path format <a href="/pages/U9uUNV2bfCBsr8Z1HLPj">here</a></td></tr><tr><td>_amount</td><td>uint256</td><td>amount to convert from, in the source token</td></tr><tr><td>_minReturn</td><td>uint256</td><td>if the conversion results in an amount smaller than the minimum return - it is cancelled, must be greater than zero</td></tr></tbody></table>

**Returns**

The amount of tokens to receive from the conversion.


---

# 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:

```
GET https://build.sovryn.com/builder-portal/smart-contracts/amm/wrapper/swaps.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.
