Using ERC20 transferFrom on Remix

@abcoathup Thanks for your response. I tried same link (Example on how to use ERC20 token in another contract) which you have provided. Your example works fine without issue. I have deployed my own smart contract (I have added below) into ethereum using remix IDE. When I try to verify and publish, it is not allowing import statement. So I removed import statement and replaced with IERC20 interface.

    interface IERC20 {
        function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    }

Because we need only transferFrom function, I removed rest of them. Now I tried to compile it in remix. It compiled successfully. But When I try to deploy it, it says the following information in pop-up window of remix IDE.
This contract may be abstract, not implement an abstract parent's methods completely or not invoke an inherited contract's constructor correctly.

The following is the smart I tried to deploy,

    pragma solidity >=0.4.23 <0.6.0;

    interface IERC20 {

        function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
    }

    contract SmartMatrix {
        IERC20 private _token;
        constructor(address token) public {
            _token = IERC20(token);
        }
        function sendERC20TokeToDnividends(address sender, address recipient, uint256 amount) public returns (bool) {    
            _token.transferFrom(sender, recipient, amount);
            return true;
        }
    }
1 Like