You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Aamirusmani1552 - The protocol does not account for dual fee on fee on transfer token both stable fee currency and stable origin tokens are equal.
#229
The protocol does not account for dual fee on fee on transfer token both stable fee currency and stable origin tokens are equal.
Summary
When user want to do the defiSwap first and then stable swap, there might be situation where the stable origin token and stable fee tokens are the same tokens. And if that token is a fee on transfer token then it will cause issue:
function _stablecoinSwap(addresswallet, StablecoinSwap memoryss) internal {
if (ss.stablecoinFeeCurrency !=address(0) && ss.stablecoinFeeSafe !=address(0)) {
ERC20PermitUpgradeable(ss.stablecoinFeeCurrency).safeTransferFrom(
wallet, ss.stablecoinFeeSafe, ss.feeAmount
);
}
// Handle the transfer or burning of the origin currency:// If the origin is a recognized stablecoin (XYZ), burn the specified amount from the wallet.if (isXYZ(ss.origin)) {
Stablecoin(ss.origin).burnFrom(wallet, ss.oAmount);
} else {
ERC20PermitUpgradeable(ss.origin).safeTransferFrom(wallet, ss.liquiditySafe, ss.oAmount);
}
// Handle the minting or transferring of the target currency:// If the target is a recognized stablecoin (XYZ), mint the required amount to the destination address.if (isXYZ(ss.target)) {
Stablecoin(ss.target).mintTo(ss.destination, ss.tAmount);
} else {
// @audit so the liquidity safe is going to give approval every time?ERC20PermitUpgradeable(ss.target).safeTransferFrom(ss.liquiditySafe, ss.destination, ss.tAmount);
}
}
```
Github: [link](https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/StablecoinHandler.sol#L148C1-L165C1)
For example if user wants to perform the defi to stable swap, the balance of origin token from the defi swap will not account for fee on the transfers double time. first when fee is transferred and second when the actual tokens is transferred. So it migh cause dos.
### Root Cause
_No response_
### Internal pre-conditions
_No response_
### External pre-conditions
_No response_
### Attack Path
_No response_
### Impact
_No response_
### PoC
I am submitting this on last minute. that is why there is no POC. will provide later if necessary.
### Mitigation
Perform the neccessary check to make it work
The text was updated successfully, but these errors were encountered:
sherlock-admin3
changed the title
Passive Mango Rabbit - The protocol does not account for dual fee on fee on transfer token both stable fee currency and stable origin tokens are equal.
Aamirusmani1552 - The protocol does not account for dual fee on fee on transfer token both stable fee currency and stable origin tokens are equal.
Nov 17, 2024
Aamirusmani1552
Medium
The protocol does not account for dual fee on fee on transfer token both stable fee currency and stable origin tokens are equal.
Summary
When user want to do the defiSwap first and then stable swap, there might be situation where the stable origin token and stable fee tokens are the same tokens. And if that token is a fee on transfer token then it will cause issue:
The text was updated successfully, but these errors were encountered: