function withdrawForeignTokens(address _tokenContract) onlyOwner IsAuthenticate public returns (bool) {
        ERC223Interface token = ERC223Interface(_tokenContract);
        return token.transfer(owner,token.balanceOf(address(this)));

In above code IsAuthenticate is modifier to authenticate my current contract.

  • What does an attacker prevent to re-enter in other functions? It is hard to tell without the rest of the code. – Briomkez Mar 19 '19 at 15:18

No there is (kind of) no possibility for re-entrancy attack in the given code.

I'm saying "kind of" because there is a possibility for re-entrancy but it wouldn't really be an attack. The other contract you are calling may call your function again (at least if you didn't have all the modifier checks in place) which makes it re-entrancy. But there would be nothing to gain as the other contract can already execute whatever code they want in their own context.

It's impossible to know what the other contract does. I actually don't know what is ERC223 but it really doesn't make any difference - it can be implemented in any way.

So the bottom line is that you shouldn't trust the other contract blindly. Even if it follows some standard (ERC223) it doesn't say anything about how it's implemented.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.