3

I was just recently going through programtheblockchain.com posts which are really helpful in terms of learning.

I am currently struggling to deploy Token Market Contract (https://programtheblockchain.com/posts/2018/02/27/writing-a-token-market-contract/) which uses import function to import part of a code from separate file. Seems like remix not finding tokenmarket contract to deploy (parserError: Expected token Semicolon got 'Interface' interface IERC20Token { ) Any change anyone knows what is the issue here, maybe there is an issue in the code itself? Although I bet it is me not knowing how to deploy multiple files.

Thanks,

0

Looks like they have a couple errors in their code. First off, you need to have a semicolon after import statements:

import "./ierc20token.sol";

Also, they are attempting to import an interface (IERC20Token) and declare one with the same name.

EDIT - The tutorial has been updated. Try the latest version and see if that resolves your issue.

  • 1
    Sorry about the bad edit there. We introduced "ierc20token.sol" later and apparently botched editing old posts. :-( I've just fixed up the code in that post, and we'll take a look at the rest of that diff and see if we can spot any other mistakes. Apologies for the trouble and wasted time! – smarx Mar 31 '18 at 8:37
  • 1
    I found two more errors in that diff, hopefully all is fixed now. Thanks for spotting the issue! – smarx Mar 31 '18 at 8:43
  • 1
    I usually stick to Remix for trying this stuff out so I can deploy to the JavaScript VM, which seems like the lightest weight way to try things out. I don't think my partner (who wrote the post) or I ever deployed it to a live network. We deployed it to the JavaScript VM in Remix and to a local network to run tests on it. – smarx Apr 3 '18 at 3:27
  • 1
    As to the sequence, you should deploy the token contract, then deploy the token market contract, then (in either order) approve tokens for the contract to spend and call list to list them for sale. Finally, call buy, passing the ID you got back from list and passing the amount to buy and attaching the right amount of ether. It's a bit tricky to get all those things done. Feel free to ask a new question (and flag me in the comments with @smarx!) if you're still stuck on a specific step. – smarx Apr 3 '18 at 3:29
  • 1
    No, you need to deploy an actual ERC20 token, with a full implementation. We have one such implementation on the blog: programtheblockchain.com/posts/2018/01/30/…. – smarx Apr 3 '18 at 22:33

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.