Withdraw Token from a contract?

Hi everyone,

My problem is,
I am sending token from my token smart contract B to smart contract A,
how do I withdraw my token from smart contract A to other address?

What function I need to implement over my smart contract A, so that I could avoid other to sent the token to my contract and even if it did, I could withdraw it?

Is there any documents that I could refer?

Cheers,
Liang

Hey @liang
you can try with something similar.

function withdrawTokens(address wallewt, uint amount) external{
    IERC20(tokenAddress).transfer(wallet, amount);
 }
1 Like

Hi Freezy,

I found the solution. You need to create a function over the smart contract that approve contract address first and then only use transfer from function. Then problem solved.

Anyway thanks FreezyEx.

Cheers
Liang