Skip to content

Conversation

@clement-ux
Copy link
Contributor

@clement-ux clement-ux commented Nov 3, 2025

Description

Allow aggregators and MEV bots to better route swaps through the ARMs by returning the output amounts from the swapExactTokensForTokens and swapTokensForExactTokens functions. This is the same interface as the Uniswap V2 Router

Note the swapTokensForExactTokens and swapTokensForExactTokens overrides with the path parameter already returned the input and output amounts.

/**
     * @notice Swaps an exact amount of input tokens for as many output tokens as possible.
     * msg.sender should have already given the ARM contract an allowance of
     * at least amountIn on the input token.
     *
     * @param inToken Input token.
     * @param outToken Output token.
     * @param amountIn The amount of input tokens to send.
     * @param amountOutMin The minimum amount of output tokens that must be received for the transaction not to revert.
     * @param to Recipient of the output tokens.
     * @return amounts The input and output token amounts.
     */
    function swapExactTokensForTokens(
        IERC20 inToken,
        IERC20 outToken,
        uint256 amountIn,
        uint256 amountOutMin,
        address to
    ) external returns (uint256[] memory amounts);

    /**
     * @notice Receive an exact amount of output tokens for as few input tokens as possible.
     * msg.sender should have already given the router an allowance of
     * at least amountInMax on the input token.
     *
     * @param inToken Input token.
     * @param outToken Output token.
     * @param amountOut The amount of output tokens to receive.
     * @param amountInMax The maximum amount of input tokens that can be required before the transaction reverts.
     * @param to Recipient of the output tokens.
     * @return amounts The input and output token amounts.
     */
    function swapTokensForExactTokens(
        IERC20 inToken,
        IERC20 outToken,
        uint256 amountOut,
        uint256 amountInMax,
        address to
    ) external returns (uint256[] memory amounts);

Contract Interface Changes

  • Updated the swap functions in AbstractARM to return an array of input and output amounts, improving composability and clarity for integrators. [1] [2]

Deployment Script Updates

  • Added a new deployment script 012_UpgradeEtherFiARMScript.sol and integrated it into the DeployManager to support upgrading the EtherFiARM contract implementation. [1] [2] [3]

Copy link
Collaborator

@naddison36 naddison36 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A number of aggregators have confirmed this is not a problem for them.

@naddison36 naddison36 merged commit 9a3eb69 into main Nov 5, 2025
5 of 6 checks passed
@naddison36 naddison36 deleted the clement/add-returns branch November 5, 2025 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants