Skip to content
This repository has been archived by the owner on Oct 17, 2022. It is now read-only.

Token Example Error #893

Open
ccconnor opened this issue Aug 16, 2018 · 7 comments
Open

Token Example Error #893

ccconnor opened this issue Aug 16, 2018 · 7 comments

Comments

@ccconnor
Copy link

ccconnor commented Aug 16, 2018

Hello,
I'm trying to learn smart contract according to https://www.ethereum.org/token. I'm using remix IDE, and the enviroment option is JavaScript VM. The contract is deployed succefully, but when I try to buy tokens, remix shows errors "the constructor should be payable if you send value". After I added payable keyword, the buy function still failed. The code I'm using is just the same as the above url shows, or https://gist.github.com/6d78ad3e351cb8799339d99a9c3def51.
Can someone offer any suggestions?

@ccconnor
Copy link
Author

By the way, when value is less than sellPrice, "buy" succeeded, when eual or large, failed.
https://monosnap.com/file/LWGKLZCdZNAiDj3nfrdKZzsmy4GrH3

@yann300
Copy link

yann300 commented Aug 17, 2018

buyPrice is by default 0, this is why the tx fails, try calling setPrices before

@ccconnor
Copy link
Author

First thanks for you reply. But I've already set price.

@Aniket-Engg
Copy link

@heyconnor Have you got it worked?

@ccconnor
Copy link
Author

@Aniket-Engg Finally I didn't use buy and sell interface.

@Aniket-Engg
Copy link

Okay. Your gist is broken. Are you still looking to get it worked?

@ccconnor
Copy link
Author

@Aniket-Engg That gist was the same as official site's. I used a simple one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants