Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0xlucky - If Fee token would be Buy Token, then StableCoinSwap will revert #225

Open
sherlock-admin4 opened this issue Nov 13, 2024 · 0 comments

Comments

@sherlock-admin4
Copy link

sherlock-admin4 commented Nov 13, 2024

0xlucky

High

If Fee token would be Buy Token, then StableCoinSwap will revert

Summary

In StableCoinSwap, in codebase feetoken is being transfered to safe first and then buyToken is being minted to user.
So there can be case in both defiToStable and normal stablecoinswap that, feetoken will not be there with user in stablecoin swap if fee token would be buy token or lets say Target Token. then it would revert as low balance would be there in wallet

Root Cause

https://github.com/sherlock-audit/2024-11-telcoin/blob/main/telcoin-audit/contracts/stablecoin/StablecoinHandler.sol#L144C4-L181C6

in both the case lets say there can be the case, in defitoSablecoin swap and in direct stable coin swap.

in user will swap AAve --> usdc --> eMXn

And if fee token would be eMxn , then in stableCoinSwap eMxn would not be minted to user before , as fee token would be transfered first and it would not be there with user as it i being minted later

Internal pre-conditions

No response

External pre-conditions

No response

Attack Path

No response

Impact

both functions could revert due to minting of token is done after fee token is transfered

PoC

No response

Mitigation

FeeToken means target token should be minted first and then fee should be supplied to feeSafe.

@sherlock-admin3 sherlock-admin3 changed the title Shambolic Fiery Rook - If Fee token would be Buy Token, then StableCoinSwap will revert 0xlucky - If Fee token would be Buy Token, then StableCoinSwap will revert Nov 17, 2024
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

No branches or pull requests

1 participant