Market interaction
This page will make a brief example of how to interact with an already available Helena Market, where we will bet on YES outcome, 1 Proton in a categorical market.
Last updated
Was this helpful?
This page will make a brief example of how to interact with an already available Helena Market, where we will bet on YES outcome, 1 Proton in a categorical market.
Last updated
Was this helpful?
Instantiating a Market is the first step to interact with Helena Markets. Given a well known Helena Market address, it is easily accessible via:
For reference, all contract instances, will have the contract functions (for both read and write operations) you can check which ones in the . There are also more advanced functions that we will explain later (e.g buy and sell shares).
Every market has an easy to access endpoint on our REST API. In the case of our previously defined market, market information can be found at:
First of all, you will probably have an amount of Protons you will want to allocate to a prediction market. In order to buy outcomes and interact with the Smart Contract, you will need to know in advance the amount of protons you want to buy. This is possible via calcLMSROutcomeTokenCount` function. Let's say we want to bet on YES outcome (outcome index 0).
Let's say now that you've decided that these outcome tokens are worth purchasing. To buy these outcome tokens, you can use the following code:
f you want to sell the outcome tokens you have bought, you can do the following:
First of all, you will probably have an amount of Protons you will want to allocate to a prediction market. In order to buy outcomes and interact with the Smart Contract, you will need to know in advance the amount of protons you want to buy. This is possible via calcLMSROutcomeTokenCount` function. Let's say we want to bet on YES outcome (outcome index 0).