self-lending does not work with paired tokens that have a transfer tax because addLiquidityV2 does not account for fee-on-transfer on the PAIRED_LP_TOKEN
When adding liquidity, the contract transfers a paired LP token that charges a transfer tax, so the pod receives slightly less than the amount it then tries to add to the DEX. The DEX call reverts, meaning self-lending cannot be set up for paired LP token pods that have a transfer tax enabled.
Source: https://github.com/sherlock-audit/2025-01-peapods-finance-judging/issues/300
The protocol has acknowledged this issue.
Found by
Schnilch, X77, pkqs90
Summary
addLiquidityV2 transfers PAIRED_LP_TOKEN and pTKN from the address that wants to add liquidity. The issue, however, is that the PAIRED_LP_TOKEN can also be a fee-on-transfer token in a self-lending system where the fTKN is podded. When addLiquidity is called on the DEX_HANDLER, there are not enough tokens in the pod, and the call reverts. As a result, the self-lending system cannot be used for PAIRED_LP_TOKEN pods that have transfer tax enabled.
Root Cause
During addLeverage in the LeverageManager, the function addLPAndStake from IndexUtils is used to add liquidity to the UniV2 pool and receive the LP tokens:
https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/contracts/contracts/IndexUtils.sol#L82-L87
addLiquidityV2 then transfers the PAIRED_LP_TOKEN and the pTKN into the pod, and uses the DEX_HANDLER to add liquidity:
https://github.com/sherlock-audit/2025-01-peapods-finance/blob/main/contracts/contracts/DecentralizedIndex.sol#L341-L357
The issue here is when it is a self-lending system with a podded fTKN that has transfer tax enabled. In this case, the DEX_HANDLER will revert, as the PAIRED_LP_TOKEN is slightly reduced due to the tax when transferring into the pod. However, the same amount of liquidity is still intended to be added (see lines 345 and 352).
Internal Pre-conditions
- hasTransferTax must be true for the paired LP token pod in the self-lending system
External Pre-conditions
No external pre-conditions
Attack Path
- There is pod1 and pod2, where pod2 has the fTKN as its underlying token. Pod2 is the PAIRED_LP_TOKEN of pod1. Pod2 also has a transfer tax enabled.
- A user now wants to call
addLeveragewith their pTKNs, which they received from bonding in pod1 - The call fails because there are not enough tokens in pod1 due to the transfer tax in pod2 when liquidity is supposed to be added
Impact
Self-lending cannot be set up for a PAIRED_LP_TOKEN pod that has transfer tax enabled. As a result, an important feature of the protocol may not be available for certain pods.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the code assumes the full transferred amount arrives, without measuring the actual balance received, so a fee-on-transfer token leaves the pod short of the amount it tries to add to the DEX.
Impact
Self-lending cannot be set up for a paired LP token pod that has a transfer tax enabled, so an important feature may be unavailable for certain pods.
What the attacker needed
Paired LP token pod has transfer tax enabled; self-lending system with podded fTKN
The fix
The code should measure the amount actually received after the transfer and add liquidity based on that amount rather than the intended amount.
How it was found
- Have two pods where the second pod is the paired LP token of the first and has a transfer tax enabled.
- Call addLeverage with pTKNs obtained from bonding in the first pod.
- Observe the call fail because the pod holds fewer tokens than needed after the transfer tax is taken.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Some tokens take a small cut every time they are moved between wallets, like a built-in fee. This code moves such a token into a pod and then tries to use the full original amount, but less actually arrived, so the next step fails and the whole action is undone. The result is that a feature simply cannot be used with those tokens.
What is Business logic?
The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.