Nucleus
  • Overview
    • Welcome to Nucleus
    • Official Links
    • FAQ
  • Nucleus Architecture
    • Overview
    • Vault Framework
    • Cross-chain Infrastructure
    • Withdrawals
    • Revenue Strategies
      • Market-agnostic Lending
      • Cross-chain Intents
      • Ownership by Default
    • Reward Distribution
    • Nucleus Points
    • Deployed Assets
    • Smart Contracts
      • README
      • CONTRACTS
        • contents
        • atomic-queue
          • Contents
          • AtomicQueue
          • AtomicSolver
          • AtomicSolverV2
          • AtomicSolverV3
          • IAtomicSolver
        • base
          • Boring Vault
            • BoringVault
          • Decoders and Sanitizers
            • Contents
            • IonPoolDecoderAndSanitizer
          • Roles
            • Contents
            • Cross Chain
              • Cross Chain OP Teller With Multi Asset Support
                • CrossChainOPTellerWithMultiAssetSupport
                • ICrossDomainMessenger
              • Cross Chain Teller Base
                • BridgeData
                • CrossChainTellerBase
              • MultiChainLayerZeroTellerWithMultiAssetSupport
              • Multi Chain Teller Base
                • Chain
                • MultiChainTellerBase
                • MultiChainTellerBase_GasLimitExceeded
                • MultiChainTellerBase_GasTooLow
                • MultiChainTellerBase_MessagesNotAllowedFrom
                • MultiChainTellerBase_MessagesNotAllowedFromSender
                • MultiChainTellerBase_MessagesNotAllowedTo
                • MultiChainTellerBase_ZeroMessageGasLimit
              • OAppAuth
                • Contents
                • OAppAuth
                • OAppAuthCore
                • OAppAuthReceiver
                • OAppAuthSender
            • AccountantWithRateProviders
            • ManagerWithMerkleVerification
            • TellerWithMultiAssetSupport
        • helper
          • Contents
          • Constants
          • ArcticArchitectureLens
          • Deployer
          • GenericRateProvider
        • interfaces
          • BalancerVault
          • AggregationRouterV5
          • BeforeTransferHook
          • DecoderCustomTypes
          • ICreateX
          • IPriceFeed
          • PriceRouter
          • IRateProvider
          • INonFungiblePositionManager
          • Contents
          • IStaking
            • ILiquidityPool
            • ILRTDepositPool
            • IRestakeManager
            • IStaderConfig
            • IStakePoolManager
            • ISTETH
            • ISWETH
            • IUNSTETH
            • IUserWithdrawManager
            • IWEETH
            • IWithdrawRequestNft
            • IWSTETH
          • IUniswap v3 Router
            • IUniswapV3Router
            • IUniswapV3SwapCallback
        • micro-managers
          • Contents
          • DexSwapperUManager
          • DexAggregatorUManager
          • UManager
        • migration
          • Contents
          • CellarMigrationAdaptor
        • oracles
          • EthPerTokenRateProvider
          • Contents
          • EthPerWstEthRateProvider
  • Security
    • Audits
Powered by GitBook
On this page
  • State Variables
  • MAX_SLIPPAGE
  • allowedSlippage
  • router
  • priceRouter
  • Functions
  • constructor
  • setAllowedSlippage
  • swapWith1Inch
  • Events
  • SlippageUpdated
  • Errors
  • DexAggregatorUManager__Slippage
  • DexAggregatorUManager__NewSlippageTooLarge

Was this helpful?

  1. Nucleus Architecture
  2. Smart Contracts
  3. CONTRACTS
  4. micro-managers

DexAggregatorUManager

PreviousDexSwapperUManagerNextUManager

Was this helpful?

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

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

event SlippageUpdated(uint16 oldSlippage, uint16 newSlippage);

Errors

DexAggregatorUManager__Slippage

error DexAggregatorUManager__Slippage();

DexAggregatorUManager__NewSlippageTooLarge

error DexAggregatorUManager__NewSlippageTooLarge();
Git Source