58552 sc insight single transfer instead of multiple saves gas

Submitted on Nov 3rd 2025 at 07:34:28 UTC by @SAAJ for Audit Comp | Alchemix V3arrow-up-right

  • Report ID: #58552

  • Report Type: Smart Contract

  • Report severity: Insight

  • Target: https://github.com/alchemix-finance/v3-poc/blob/immunefi_audit/src/Transmuter.sol

  • Impacts:

Description

Summary

createRedemption function have multiple transfers to same addresses which consumes more gas.

Vulnerability Details

createRedemption function in Transmuter contract carries out transfer of yield and fees to msg.sender and protocolFeeReceiver respectively.

        TokenUtils.safeTransfer(alchemist.myt(), msg.sender, claimYield);
        TokenUtils.safeTransfer(alchemist.myt(), protocolFeeReceiver, feeYield);

        TokenUtils.safeTransfer(syntheticToken, msg.sender, syntheticReturned);
        TokenUtils.safeTransfer(syntheticToken, protocolFeeReceiver, syntheticFee);

However the transfer of amount carried out twice instead of a single transfer which leads to more gas consumption.

Code Reference

https://github.com/alchemix-finance/v3-poc/blob/a192ab313c81ba3ab621d9ca1ee000110fbdd1e9/src/Transmuter.sol#L250C68-L254C84

Recommendation

The recommendation is made to transfer the amount on a single transfer call instead of multiple to reduce gas consumption.

Proof of Concept

POC

Here is a Test demonstrating the higher amount of gas consumed when transfer of amounts are carried out multiple times.

The result of above test shows the gas consumption for testClaimRedemptionFromAlchemist function have 1406546 when transfer is called multiple times.

However, when we called the testClaimRedemptionFromAlchemist function when amount transferred is carried out on a single call it reduces the gas consumption to 1388993.

Was this helpful?