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
Best Answer
That's because the contract does not have enough
LINK
. You have to pre-fund it with at least anamount_
number of tokens if you want to be able to callLINK.transfer
inside it.You can transfer tokens to the smart contract by using any Ethereum wallet, e.g. MetaMask.