0

I'm trying to write a smart contract that can send ERC20 / ERC677 tokens from one user to another. For example send LINK from one address to another. I deployed my contract on the kovan network but it is not working.

Im using these addresses: 1)0xC2BD595E642889Fd8130A2eA57Cb820Eb7F66D60 2)0x6BbD26ae05Ac2C69532D2c679CB693F01FD6F49f Address: 0xC2BD595E642889Fd8130A2eA57Cb820Eb7F66D60 has 100 test LINK.

When I call transferToken(0xC2BD595E642889Fd8130A2eA57Cb820Eb7F66D60,0x6BbD26ae05Ac2C69532D2c679CB693F01FD6F49f,1) I get an error "false Transaction mined but execution" and the tokens are not transferred.

The transaction can be found at ( https://kovan.etherscan.io/tx/0x36752d523894e395feabee55c0f13cb02ef92684c5ec4383d77c94a41f1709e7p ).

I'm using remix btw.

What am i doing wrong?

This is my contract:

pragma solidity >=0.4.22 <0.7.0;

import "LinkInterfacee.sol";
contract Test{
    
  //kovan contract of chainlink token
   address linkAdr = 0xa36085F69e2889c224210F603D836748e7dC0088;

    IERC20 link = IERC20(linkAdr);    

    
    function transferToken(address sender, address recipient, uint256 amount) external payable returns(string memory){
        link.approve(address(this),amount);
        link.transferFrom(sender, recipient, amount);
    }
    

    function getBalanceOf(address _address)public view returns(uint256){
        return link.balanceOf(_address);
    }
    
    
}


4
  • Is import "LinkInterfacee.sol"; correct? Are you looking for transfer instead of transferFrom? Dec 6 '20 at 17:58
  • Yes, cause I can call getBalanceOf() Dec 6 '20 at 18:08
  • Could you please turn your code into a minimal reproducible code? Right now there is a lot going on. Dec 6 '20 at 19:43
  • @PatrickCollins my bad, I edited my question. Your help would be much appreciated Dec 7 '20 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.