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
  • Methods
  • Event
  1. DVstETH vault
  2. Contracts
  3. Modules
  4. DelegateModules

ERC20SwapModule

Overview

ERC20SwapModule contract facilitates ERC20 token swaps based on predefined parameters.

Key Features

  • Secure ERC20 Swaps: Enables ERC20 swaps with security checks on input and output amounts.

  • Parameter Validation: Ensures swap parameters like deadlines and minimum amounts are respected.

  • Allowance Management: Uses forceApprove to manage allowances securely after swaps.

Error Definitions

  • Deadline: Raised when the swap operation exceeds the specified deadline.

  • SwapFailed: The swap operation did not execute successfully.

  • InvalidSwapAmounts: Input or output amounts don't meet the expected values.

Methods

  1. Swap Function

    • swap(SwapParams, address, bytes): Executes a token swap based on provided parameters.

      • params: Contains details of the swap operation:

        • tokenIn: The address of the input token.

        • tokenOut: The address of the output token.

        • amountIn: The amount of the input token to swap.

        • minAmountOut: The minimum acceptable amount of the output token.

        • deadline: The deadline for completing the swap.

      • to: Address of the swap target.

      • data: Call data required to execute the swap operation.

      • Returns: The response from the swap call.

      • Errors:

        • Deadline: If the current timestamp is past the deadline.

        • InvalidSwapAmounts: If the amount of tokens swapped does not match the specified input or output criteria.

        • SwapFailed: The swap operation failed to execute successfully.

Event

  • ERC20SwapModuleSwap(SwapParams, address, bytes, uint256, bytes): Emitted after a swap is successfully executed.

    • params: The parameters used for the swap.

    • to: The address of the swap target.

    • data: The call data used for the swap.

    • timestamp: The timestamp when the swap was completed.

    • response: The response data returned from the swap operation.

PreviousDelegateModulesNextDefaultBondModule
💧
🧱