DexAggregatorUManager

Git Source

Inherits: UManager

Required Merkle Root Leaves

  • ERC20 approves with router spender.

  • AggregationRouterV5.swap, with all desired addresses.

State Variables

MAX_SLIPPAGE

uint256 internal constant MAX_SLIPPAGE = 0.1e4;

allowedSlippage

Slippage check enforced after swaps.

uint16 public allowedSlippage = 0.0005e4;

router

The 1Inch Router.

AggregationRouterV5 internal immutable router;

priceRouter

The PriceRouter contract used to check slippage.

PriceRouter internal immutable priceRouter;

Functions

constructor

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.

function setAllowedSlippage(uint16 _allowedSlippage) external requiresAuth;

swapWith1Inch

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

Callable by STRATEGIST_ROLE.

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

Parameters

NameTypeDescription

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

event SlippageUpdated(uint16 oldSlippage, uint16 newSlippage);

Errors

DexAggregatorUManager__Slippage

error DexAggregatorUManager__Slippage();

DexAggregatorUManager__NewSlippageTooLarge

error DexAggregatorUManager__NewSlippageTooLarge();