> For the complete documentation index, see [llms.txt](https://docs.zivoe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zivoe.com/developer-docs/lockers/zivoeswapper.sol.md).

# ZivoeSwapper.sol

1INCH v5 Integration

## Introduction

OneInchPrototype contract integrates with 1INCH to support custom data input.

#### State Variables

<table><thead><tr><th width="144.33333333333331">Type</th><th width="163">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>router1INCH_V5</td><td>The 1INCH v5 Router.</td></tr><tr><td>uint256</td><td>_ONE_FOR_ZERO_MASK</td><td>Private constant</td></tr><tr><td>uint256</td><td>_REVERSE_MASK</td><td>Private constant</td></tr></tbody></table>

#### OrderRFQ

This struct contains information for an OrderRFQ type transaction.

<table><thead><tr><th width="144.33333333333331">Type</th><th width="233">Name</th></tr></thead><tbody><tr><td>uint256</td><td>info</td></tr><tr><td>address</td><td>makerAsset</td></tr><tr><td>address</td><td>takerAsset</td></tr><tr><td>address</td><td>maker</td></tr><tr><td>address</td><td>allowedSender</td></tr><tr><td>uint256</td><td>makingAmount</td></tr><tr><td>uint256</td><td>takingAmount</td></tr></tbody></table>

#### SwapDescription

This struct contains information for a swap type transaction.

<table><thead><tr><th width="144.33333333333331">Type</th><th width="233">Name</th><th>Description</th></tr></thead><tbody><tr><td>IERC20</td><td>srcToken</td><td>Source token.</td></tr><tr><td>IERC20</td><td>dstToken</td><td>Destination token.</td></tr><tr><td>address payable</td><td>srcReceiver</td><td>Source receiver.</td></tr><tr><td>address payable</td><td>dstReceiver</td><td>Destination receiver.</td></tr><tr><td>uint256</td><td>amount</td><td>Amount of srcToken.</td></tr><tr><td>uint256</td><td>minReturnAmount</td><td>Minimum amount returnable of dstToken.</td></tr><tr><td>uint256</td><td>flags</td><td>Additional flags for swap.</td></tr></tbody></table>

## **Sections**

[#read-functions](#read-functions "mention")

* [#handle\_validation\_12aa3caf](#handle_validation_12aa3caf "mention") - Will validate the data retrieved from 1inch API triggering a `swap()` function in 1inch router. The swap() function will execute a swap through multiple sources.
* [#handle\_validation\_e449022e](#handle_validation_e449022e "mention") - Will validate the data retrieved from 1inch API triggering an `uniswapV3Swap()` function in 1inch router. The `uniswapV3Swap()` function will execute a swap through Uniswap V3 pools.
* [#handle\_validation\_0502b1c5](#handle_validation_0502b1c5 "mention") - Will validate the data retrieved from 1inch API triggering an unoswap() function in 1inch router.
* [#handle\_validation\_3eca9c0a](#handle_validation_3eca9c0a "mention") - Will validate the data retrieved from 1inch API triggering a `fillOrderRFQ()` function in 1inch router.

[#write-functions](#write-functions "mention")

* [#convertasset](#convertasset "mention") - Executes a conversion via 1INCH v5.

## Read Functions

#### `handle_validation_12aa3caf()`

Will validate the data retrieved from 1inch API triggering a `swap()` function in 1inch router. The swap() function will execute a swap through multiple sources.

```solidity
function handle_validation_12aa3caf(
    bytes calldata data, 
    address assetIn, 
    address assetOut, 
    uint256 amountIn
) internal view;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>bytes</td><td>data</td><td>Payload for 1INCH v5 router, data regarding swap.</td></tr><tr><td>address</td><td>assetIn</td><td>The asset that will be converted.</td></tr><tr><td>address</td><td>assetOut</td><td>The asset that "assetIn" will be converted to.</td></tr><tr><td>uint256</td><td>amountIn</td><td>The amount of "assetIn" that will be converted.</td></tr></tbody></table>

#### `handle_validation_e449022e()`

Will validate the data retrieved from 1inch API triggering an `uniswapV3Swap()` function in 1inch router. The `uniswapV3Swap()` function will execute a swap through Uniswap V3 pools.

```solidity
function handle_validation_e449022e(
    bytes calldata data,
    address assetIn,
    address assetOut,
    uint256 amountIn
) internal;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>bytes</td><td>data</td><td>Payload for 1INCH v5 router, data regarding swap.</td></tr><tr><td>address</td><td>assetIn</td><td>The asset that will be converted.</td></tr><tr><td>address</td><td>assetOut</td><td>The asset that "assetIn" will be converted to.</td></tr><tr><td>uint256</td><td>amountIn</td><td>The amount of "assetIn" that will be converted.</td></tr></tbody></table>

#### `handle_validation_0502b1c5()`

Will validate the data retrieved from 1inch API triggering an unoswap() function in 1inch router.

```solidity
function handle_validation_0502b1c5(
    bytes calldata data, 
    address assetIn, 
    address assetOut, 
    uint256 amountIn
) internal view;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>bytes</td><td>data</td><td>Payload for 1INCH v5 router, data regarding swap.</td></tr><tr><td>address</td><td>assetIn</td><td>The asset that will be converted.</td></tr><tr><td>address</td><td>assetOut</td><td>The asset that "assetIn" will be converted to.</td></tr><tr><td>uint256</td><td>amountIn</td><td>The amount of "assetIn" that will be converted.</td></tr></tbody></table>

#### `handle_validation_3eca9c0a()`

Will validate the data retrieved from 1inch API triggering a `fillOrderRFQ()` function in 1inch router.

```solidity
function handle_validation_3eca9c0a(
    bytes calldata data, 
    address assetIn, 
    address assetOut, 
    uint256 amountIn
) internal pure;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>bytes</td><td>data</td><td>Payload for 1INCH v5 router, data regarding swap.</td></tr><tr><td>address</td><td>assetIn</td><td>The asset that will be converted.</td></tr><tr><td>address</td><td>assetOut</td><td>The asset that "assetIn" will be converted to.</td></tr><tr><td>uint256</td><td>amountIn</td><td>The amount of "assetIn" that will be converted.</td></tr></tbody></table>

## Write Functions

#### `convertAsset()`

Executes a conversion via 1INCH v5.

```solidity
function convertAsset(
    address assetIn,
    address assetOut,
    uint256 amountIn,
    bytes calldata data
) internal;
```

<table><thead><tr><th width="156.33333333333331">Type</th><th width="160">Name</th><th>Description</th></tr></thead><tbody><tr><td>address</td><td>assetIn</td><td>The asset that will be converted.</td></tr><tr><td>address</td><td>assetOut</td><td>The asset that "assetIn" will be converted to.</td></tr><tr><td>uint256</td><td>amountIn</td><td>The amount of "assetIn" that will be converted.</td></tr><tr><td>bytes</td><td>data</td><td>Payload for 1INCH v5 router, data regarding swap.</td></tr></tbody></table>


---

# 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://docs.zivoe.com/developer-docs/lockers/zivoeswapper.sol.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.
