How do I buy an outcome Token?

I managed to create a contract with the following function

await createDescription(title, deadline)
      .then(hash => createOracle(hash))
      .then(oracle => createEvent(oracle))
      .then(categoryEvent => createMarket(categoryEvent))
      .then(market => {
        this.setState({ market });
        this.calcBuyAndSell(market);
      })
      .catch(error => console.error(error));

I imported each of the functions as described in the following tutorial http://bit.ly/2xArJBy and I know it is working because this.calcBuyAndSell(market); creates a market with a cost and profit. As you can see below:

When I try and buy an outcome token I get the following error:

Error: could not find any logs in transaction 0x44536919ca32ca94bc8bdeb79c240bd0d86eaddfce2c5406c6c78288f4c33feb corresponding to event OutcomeTokenPurchase

Can someone please explain what this means?

What am I doing wrong?

Iā€™m creating the market on ganache. Is this connected? Do I need to use a different account to buy token or can the market creator buy outcome tokens?

So I managed to figure it out. When we created the market we created x amount of tokens. I was trying to sell more tokens than were created. I changed the defaults in the code and it works fine.

1 Like