Mellow Protocol
  • 💡Overview
  • 🎛️MELLOW LRT PRIMITIVE
    • Overview
    • MultiVault
    • Simple-LRT
    • Interoperable vaults
    • Contract deployments
    • Security
    • Loyalty Points
      • Points in Symbiotic pre-deposit contracts
      • DeFi points integration instructions
    • User Tutorials
      • Deposit guide
      • Withdrawal guide
      • Emergency withdrawal guide (advanced)
    • API
  • 💧DVstETH vault
    • Overview
    • Contracts
      • 🏦Vault
      • 🔧VaultConfigurator
      • ⚖️Validators
        • ManagedValidator
        • ERC20SwapValidator
        • DefaultBondValidator
        • AllowAllValidator
      • 🧬Strategies
        • DefaultBondStrategy
        • SimpleDVTStakingStrategy
      • 🔎Oracles
        • ChainlinkOracle
        • ManagedRatiosOracle
      • 🧱Modules
        • DelegateModules
          • ERC20SwapModule
          • DefaultBondModule
          • StakingModule
        • ExternalModules
        • TvlModules
          • DefaultBondTvlModule
          • ERC20TvlModule
          • ManagedTvlModule
      • 🪛Utils
        • DepositWrapper
        • DefaultAccessControl
      • 🔐Security
        • AdminProxy
  • 🤖MELLOW ALM
    • Mellow permissionless vaults
      • Overview
      • Core
      • Contracts API
      • Strategies
        • Fearless Gearbox strategy
        • LStrategy
        • Uni V3 Boosted strategy
        • Pulse strategy
        • Pulse strategy V2
        • Tamper strategy
      • Governance parameters
      • Contracts specs
      • Tutorials
        • Contracts deployments
        • Deploy your own strategy
        • wstETH strategies deposit guide
      • Mellow contracts addresses
        • Mellow Protocol Addresses (Polygon)
        • Mellow Protocol Addresses (Mainnet)
        • Gearbox Fearless Strategy
        • Tamper Strategy
        • UniV3 Pulse wstETH-USDC
        • UniV3 Pulse V2 wstETH-USDC
        • Velodrome CL strategies
        • Aerodrome CL strategies
      • Glossary
      • FAQ
    • Mellow ALM Toolkit
      • Overview
      • 📘Domain objects
      • 🧩Components
      • 🍜Processes
      • 💎Core
      • 🔮Oracles
        • VeloOracle
      • 🎯Strategy
        • PulseStrategyModule
      • 🔌AMM Adapters
        • VeloAmmModule
      • 🚙Utility contracts
        • AmmDepositWithdrawModule
        • Counter
        • LpWrapper
        • VeloDeployFactory
    • Mellow Backtesting SDK
  • 🗄️Resources
    • Media kit
    • Twitter
    • Discord
Powered by GitBook
On this page
  • Overview
  • Key Features
  • Error Definitions
  • Core Methods
  • Events
  1. DVstETH vault
  2. Contracts
  3. Validators

ERC20SwapValidator

Overview

ERC20SwapValidator ensures that only authorized routers and tokens are used for ERC20 token swaps. It provides validation methods, mappings to track supported routers/tokens, and emits relevant events to keep track of changes.

Key Features

  • Router and Token Support: Controls which routers and tokens are authorized for swap operations.

  • Swap Validation: Enforces rules for swap operations, ensuring compliance with authorized routers and tokens.

  • Error Reporting: Raises specific errors when a swap operation fails validation.

Error Definitions

  • InvalidLength: Raised when the data length for a swap operation is incorrect.

  • InvalidSelector: The function selector provided is not recognized.

  • UnsupportedToken: The token used is not on the supported list.

  • UnsupportedRouter: The router used is not on the supported list.

Core Methods

  1. View Functions

    • isSupportedRouter(address): Checks if a router is supported for swaps.

    • isSupportedToken(address): Checks if a token is supported for swaps.

  2. Configuration Functions

    • setSupportedRouter(address, bool): Sets a router's supported status.

    • setSupportedToken(address, bool): Sets a token's supported status.

  3. Validation Function

    • validate(address, address, bytes): Validates that the swap operation complies with the rules:

      • Checks function signatures.

      • Verifies swap parameters.

      • Ensures routers and tokens are authorized.

Events

  1. Router Updates:

    • ERC20SwapValidatorSetSupportedRouter(address, bool, uint256): Emitted when a router's support status is updated.

      • router: Address of the router.

      • flag: Boolean indicating support status.

      • timestamp: Timestamp of the action.

  2. Token Updates:

    • ERC20SwapValidatorSetSupportedToken(address, bool, uint256): Emitted when a token's support status is updated.

      • token: Address of the token.

      • flag: Boolean indicating support status.

      • timestamp: Timestamp of the action.

PreviousManagedValidatorNextDefaultBondValidator
💧
⚖️