Approve USDC using IERC20.approve

Hi @jj7302,

Welcome to the community forum :wave:

Thanks for posting here.

A token holder can approve an allowance for another contract to use by directly calling approve on the token contract. The holder can then call a function on the other contract which will be able to transferFrom the holder with the amount of the approved allowance.

See the following example:
Example on how to use ERC20 token in another contract

To withdraw tokens from a contract, the contract can just use transfer in a function to withdraw. Though the withdraw function should be protected by some form of access control otherwise any address can call.

See the following example:
Example of withdrawing an ERC20 from another contract

1 Like