Reports

Smart Contract Security Assessment

Twyne AAVE operators

Twyne is a credit delegation protocol that lets borrowers rent unused borrowing power from other lenders to boost their Liquidation LTV. Lenders earn additional yield while borrowers get to ramp up their leverage or insulate their debt.

6
Issues
0
C/H/M
Period
Nov 24, 2025 - Nov 24, 2025
Auditors
Adriro, HHK

Review Summary

Protocol Overview

Twyne is a credit delegation protocol that lets borrowers rent unused borrowing power from other lenders to boost their Liquidation LTV. Lenders earn additional yield while borrowers get to ramp up their leverage or insulate their debt.

Protocol
Twyne
Timeline
Nov 24, 2025 - Nov 24, 2025
Audit Team
Adriro, HHK

Audit Overview

Scope and Resources

Scope

This audit covers 5 smart contracts totaling approximately 541 lines of code across 1 day of review.

Overall Assessment

The audit of Twyne's Aave operators identified no critical or high-severity vulnerabilities, indicating a solid implementation that maintains the security standards of the protocol's foundation. The informational and gas findings outlined mostly minor improvements, with the exception of one finding where the Euler controller was not deactivated properly. No funds were at risk from this issue.

Evaluation Matrix

access control

mathematics

complexity

libraries

decentralization

code stability

documentation

monitoring

testing

Key Findings

Findings Summary

0
Critical
0
High
0
Medium
1
Low
4
Informational
1
Gas
L-1 Finding

L-1: Incorrect disable controller call

Low

Description:

The leverage and deleverage operators that use Euler as the flashloan provider first enable the controller via EVC.enableController() and then disable it via EVC.disableController(), which is incorrect, since the controller must disable itself.

120:         eulerFL_items[0] = IEVC.BatchItem({
121:             targetContract: address(EULER_EVC),
122:             onBehalfOfAccount: address(0),
123:             value: 0,
124:             data: abi.encodeCall(IEVC.enableController, (address(this), address(targetVault)))
125:         });
...          ...
147:         // 5) Disable controller
148:         eulerFL_items[4] = IEVC.BatchItem({
149:             targetContract: address(EULER_EVC),
150:             onBehalfOfAccount: address(0),
151:             value: 0,
152:             data: abi.encodeCall(IEVC.disableController, (address(this)))
153:         });

Impact:

Low. The controller is not properly disabled and will remain enabled after the leverage or deleverage call.

Recommendation:

In LeverageOperator_EulerFL and DeleverageOperator_EulerFL, change the last element of the Euler batch and call disableController() directly through the targetVault / collateralAsset.

Developer Response:

Fixed in PR#204.

I-1 Finding

I-1: Inaccurate comment in `DeleverageOperator_EulerFL`

Informational

Description:

The following comment in onFlashLoan() hints that an automatic pull of assets would settle the Euler debt. However, repayment is explicitly performed using collateralAsset.repay().

177:         // Collateral asset will automatically pull the repayment amount

Impact:

Informational.

Recommendation:

Remove the comment.

Developer Response:

Fixed in PR#206.

I-2 Finding

I-2: Unbounded debt repayment in AaveV3TeleportOperator

Informational

Description:

The teleport operation takes the debtAmount as user input and forwards that amount when repaying the debt using AAVE_POOL.repay(). Given that the inner implementation of repay() silently limits the repayment amount to the actual debt, using a higher amount would result in a leftover in the operator.

Impact:

Informational.

Recommendation:

Cap debtAmount to the user's current debt.

Developer Response:

Fixed in PR#208.

I-3 Finding

I-3: Morpho references in Euler flashloan operators

Informational

Description:

The LeverageOperator_EulerFL and DeleverageOperator_EulerFL contracts refer to Morpho when checking the caller in the flashloan callbacks.

Impact:

Informational.

Recommendation:

Rename the error.

Developer Response:

Fixed in PR#207.

I-4 Finding

I-4: Unnecessary 10 wei addition to flashloan amount

Informational

Description:

The executeTeleport() function inside AaveV3TeleportOperator adds 10 wei to the Morpho flashloan amount. It's unclear why this value is added, especially if a user already provides the full debt amount or type(uint256).max.

Inside onMorphoFlashLoan(), debtAmount is used for repayment which ignores this 10 wei addition, resulting in useless extra wei being flashloaned.

Impact:

Informational.

Recommendation:

Remove the + 10 from the call.

Developer Response:

Fixed in PR#205.

G-1 Finding

G-1: Potential zero value transfers in `DeleverageOperator_EulerFL`

Gas

Description:

The implementation of executeDeleverage() returns the leftovers to the caller without checking if the actual amounts are zero.

134:         IERC20(targetAsset).safeTransfer(msgSender, IERC20(targetAsset).balanceOf(address(this)));
135:         IERC20(underlyingCollateral).safeTransfer(msgSender, IERC20(underlyingCollateral).balanceOf(address(this)));

Impact:

Gas savings.

Recommendation:

Check if balances are zero before transferring the assets.

Developer Response:

Acknowledged.

Final Remarks

The review focused on new operators for AAVE as well as rework on Euler operators. The AAVE operators will be a welcome addition to Twyne's new AAVE integration, while the Euler operators update will allow the use of Euler directly for flashloans instead of Morpho as in the previous version. The review did not discover any medium severity or above issues, highlighting the seriousness of the Twyne team.

Methodology

Severity Classification

Critical

Immediate threat to user funds or protocol integrity

Direct loss of funds, protocol compromise

High

Significant security risk requiring urgent attention

Potential fund loss, major functionality disruption

Medium

Important issue that should be addressed

Limited fund risk, functionality concerns

Low

Minor issue with minimal impact

Best practice violations, minor inefficiencies

Gas

Findings that improve gas efficiency

Increased transaction costs

Informational

Code quality and best practice recommendations

Reduced maintainability and readability