pragma solidity ^0.6.2;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract MyContract {  
    IERC20  LINK;
    constructor(address token) public {
             LINK = IERC20(token);
    function transfertip(address to_, uint256 amount_) public {
        LINK.transfer( to_, amount_);

I was able to compile and deploy the contract,but when I try to call transfer function on remix , it throws gas estimation error


That's because the contract does not have enough LINK. You have to pre-fund it with at least an amount_ number of tokens if you want to be able to call LINK.transfer inside it.

You can transfer tokens to the smart contract by using any Ethereum wallet, e.g. MetaMask.

  • yep ,it worked ,thanks for the help Oct 1 at 14:08
  • Glad to hear. Don't forget to upvote my answer and mark it as accepted if it helped you. Oct 1 at 14:10

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.