Hey there guys how are u , can someone help me on this ?
I want to do a REENTRANCY on this Dex , how can i change the code on sell function to stell ETH ,when somebody wanna sell theyr token throught sell function ?
https://ethereum.org/en/developers/tutorials/transfers-and-approval-of-erc-20-tokens-from-a-solidity-smart-contract/
The function is this :
function sell(uint256 amount) public {
require(amount > 0, "You need to sell at least some tokens");
uint256 allowance = token.allowance(msg.sender, address(this));
require(allowance >= amount, "Check the token allowance");
token.transferFrom(msg.sender, address(this), amount);
msg.sender.transfer(amount);
emit Sold(amount);
}
How To Modify this function to make it vulnerable to reentrancy ? #PLEASEHELP