• Resolved shyheim103

    (@shyheim103)


    It has worked fine with ETH but it does not work with ERC20 token. It sends the deposit, but it fails when I try to release the funds. I am on the ropsten testnet and have cleared the cache.

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author ethereumicoio

    (@ethereumicoio)

    Hi @shyheim103,
    Thank you for your interest!
    I’ll check this issue on my side.
    If you can share your site address to test it on your side it would help a lot.
    Also, have you tried it with the test token that is suggested on the Testing paragraph in the readme.txt file, or with your own token?

    Thread Starter shyheim103

    (@shyheim103)

    For more specifics, please visit https://egoods.co/shop/ and try to buy something. It’s all set for the ropsten network. The ETH works fine, but using TTME tokens does not work at all (I guess you’d need TTME tokens to try?)

    Thread Starter shyheim103

    (@shyheim103)

    I actually just have a question, when we’re specifying the accepted ERC20 tokens, what address do we put in there? I was under the assumptions that it should be the token’s smart contract, but looking up your examples it appears to just be wallets. Do we put in the smart contract’s owner’s address? Or just any random address?

    Thread Starter shyheim103

    (@shyheim103)

    The website is https://www.egoods.co/shop/

    But I’m going to try the test token. I just read the readme file. Will let you know what happens, thanks!

    Thread Starter shyheim103

    (@shyheim103)

    OK, the test coin works. I’m wondering if it could be something in the code of my token? Is that possible?

    Thread Starter shyheim103

    (@shyheim103)

    It has to be something with the way my token is coded. Here is the repository: https://github.com/IntraCoin/IntraCoin/blob/master/Contracts/IntraCoinToken.sol

    The token’s features shouldn’t stop your contract from interacting with it. I thought it might be because I had the TransferFrom function as an owner only function but after changing that it still failed to pay.

    What do you think the problem could be?

    Plugin Author ethereumicoio

    (@ethereumicoio)

    The problem is with your token.
    It does not supply approve and allowance methods. Also, it has onlyOwner transferFrom method. You can not just remove the onlyOwner modifier, since it would allow anyone to transfer tokens of any other user.
    You need a fully functional implementation of the ERC20 interface:

    /**
     * @title ERC20 interface
     * @dev see https://github.com/ethereum/EIPs/issues/20
     */
    contract ERC20 is ERC20Basic {
      function allowance(address owner, address spender) public constant returns (uint256);
      function transferFrom(address from, address to, uint256 value) public returns (bool);
      function approve(address spender, uint256 value) public returns (bool);
      event Approval(address indexed owner, address indexed spender, uint256 value);
    }
    Thread Starter shyheim103

    (@shyheim103)

    Exactly. I didn’t plan on removing onlyOwner permenantly, just to see if that was the issue. But got it! I’m going to modify the token code now and see if it works. Thanks for your help! I figured it was probably my code!

    Plugin Author ethereumicoio

    (@ethereumicoio)

    Glad it helped!

    Thread Starter shyheim103

    (@shyheim103)

    OK, I changed everything. The problem is your plugin requires that my TransferFrom function be open to the public as we discussed earlier that poses a problem. Leaving it an ownerOnly function causes the transaction to fail. If I remove the onlyOwner modifier it works fine.

    The only thing I can come up with at the moment is to give your contract temporary ownership and then it gives it right back to me.

    How else can I fix this?

    • This reply was modified 6 years, 6 months ago by shyheim103.
    • This reply was modified 6 years, 6 months ago by shyheim103.
    Plugin Author ethereumicoio

    (@ethereumicoio)

    Your transferFrom should never be onlyOwner. It is the same as to have the transfer function onlyOwner.

    Look at this implementation please: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/c05918c3cc10d9394fd5fb95deb04036204ac896/contracts/token/ERC20/StandardToken.sol

    You need to have this or very similar implementation in your token. Otherwise your token is not ERC20 token.

    Thread Starter shyheim103

    (@shyheim103)

    I got it. The key element was the line that gives the allowance to someone to execute that function. Yes, it would be detrimental without that line but with it no one can use that function without permission first. Thanks for your response!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Does not work with ERC20 Token’ is closed to new replies.