StandardMarketWithPriceLogger¶
-
contract
StandardMarketWithPriceLogger
is StandardMarket, StandardMarketWithPriceLoggerData¶ -
function
buy
(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost)¶
public
returns (uint cost)
¶ Allows to buy outcome tokens from market maker
Parameters: - outcomeTokenIndex – Index of the outcome token to buy
- outcomeTokenCount – Amount of outcome tokens to buy
- maxCost – The maximum cost in collateral tokens to pay for outcome tokens
Return: Cost in collateral tokens
-
function
sell
(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)¶
public
returns (uint profit)
¶ Allows to sell outcome tokens to market maker
Parameters: - outcomeTokenIndex – Index of the outcome token to sell
- outcomeTokenCount – Amount of outcome tokens to sell
- minProfit – The minimum profit in collateral tokens to earn for outcome tokens
Return: Profit in collateral tokens
-
function
shortSell
(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit)¶
public
returns (uint cost)
¶ Buys all outcomes, then sells all shares of selected outcome which were bought, keeping shares of all other outcome tokens.
Parameters: - outcomeTokenIndex – Index of the outcome token to short sell
- outcomeTokenCount – Amount of outcome tokens to short sell
- minProfit – The minimum profit in collateral tokens to earn for short sold outcome tokens
Return: Cost to short sell outcome in collateral tokens
-
function
trade
(int[] memory outcomeTokenAmounts, int collateralLimit)¶
public
returns (int netCost)
¶ Allows to trade outcome tokens with market maker
Parameters: - outcomeTokenAmounts – Amounts of outcome tokens to trade
- collateralLimit – The maximum cost or minimum profit in collateral tokens
Return: Cost/profit in collateral tokens
-
function
close
()¶
public
¶ Allows market creator to close the markets by transferring all remaining outcome tokens to the creator
-
function
getAvgPrice
()¶
public
view
returns (uint)
¶ Calculates average price for long tokens based on price integral
Return: Average price for long tokens over time
-
function