You can understand some codes by reading them but sometimes you get proven wrong when you actually interact with them. “automatic-selling-and-buying” tutorial of Ethereum is one of these things. Here is my “not” walking through video…
What I thought I understood before was
- You can set buy/sell price at “setPrice()” function.
- If you select “buy()” function, it lets you exchange ETHER to your Token with the price you set.
- If you select “sell(amount)” function, it lets you exchange your Token to EITHER with the price you set.
When I actully tried however, I could not excute “buy()” function due to some error message (see the screen capture below), and “sell()” did not seem to do anything.
I would appreciate a lot if someone more experienced than me can spot where I’ve done wrong.