# DexAggregatorUManager

[Git Source](https://github.com/Ion-Protocol/nucleus-boring-vault/blob/cc0b494b83e17b9b169a73b96050d2810b690477/src/micro-managers/DexAggregatorUManager.sol)

**Inherits:** UManager

Required Merkle Root Leaves

* ERC20 approves with `router` spender.
* AggregationRouterV5.swap, with all desired addresses.

## State Variables

### MAX\_SLIPPAGE

```solidity
uint256 internal constant MAX_SLIPPAGE = 0.1e4;
```

### allowedSlippage

Slippage check enforced after swaps.

```solidity
uint16 public allowedSlippage = 0.0005e4;
```

### router

The 1Inch Router.

```solidity
AggregationRouterV5 internal immutable router;
```

### priceRouter

The PriceRouter contract used to check slippage.

```solidity
PriceRouter internal immutable priceRouter;
```

## Functions

### constructor

```solidity
constructor(
    address _owner,
    address _manager,
    address _boringVault,
    address _router,
    address _priceRouter
)
    UManager(_owner, _manager, _boringVault);
```

### setAllowedSlippage

Sets the maximum allowed slippage during a swap.

*Callable by MULTISIG\_ROLE.*

```solidity
function setAllowedSlippage(uint16 _allowedSlippage) external requiresAuth;
```

### swapWith1Inch

Performs a swap using the 1inch Router, and enforces a slippage check.

*Callable by STRATEGIST\_ROLE.*

```solidity
function swapWith1Inch(
    bytes32[][] calldata manageProofs,
    address[] calldata decodersAndSanitizers,
    ERC20 tokenIn,
    uint256 amountIn,
    ERC20 tokenOut,
    bytes calldata data
)
    external
    requiresAuth
    enforceRateLimit;
```

**Parameters**

| Name                    | Type          | Description                                                                                                 |
| ----------------------- | ------------- | ----------------------------------------------------------------------------------------------------------- |
| `manageProofs`          | `bytes32[][]` | 2 manage proofs, the first one for the ERC20 approval, and the second for the router swap call              |
| `decodersAndSanitizers` | `address[]`   | 2 DecodersAndSanitizers one that implements ERC20 approve, and one that implements AggregationRouterV5.swap |
| `tokenIn`               | `ERC20`       |                                                                                                             |
| `amountIn`              | `uint256`     |                                                                                                             |
| `tokenOut`              | `ERC20`       |                                                                                                             |
| `data`                  | `bytes`       |                                                                                                             |

## Events

### SlippageUpdated

```solidity
event SlippageUpdated(uint16 oldSlippage, uint16 newSlippage);
```

## Errors

### DexAggregatorUManager\_\_Slippage

```solidity
error DexAggregatorUManager__Slippage();
```

### DexAggregatorUManager\_\_NewSlippageTooLarge

```solidity
error DexAggregatorUManager__NewSlippageTooLarge();
```


---

# 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://docs.nucleusearn.io/nucleus-architecture/smart-contracts/contracts/micro-managers/dexaggregatorumanager.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.
