2018-10-24 12:52:11 +00:00
|
|
|
pragma solidity >=0.0;
|
2017-07-12 13:46:33 +00:00
|
|
|
import "../Events/Event.sol";
|
|
|
|
import "../MarketMakers/MarketMaker.sol";
|
|
|
|
|
|
|
|
|
|
|
|
/// @title Abstract market contract - Functions to be implemented by market contracts
|
2019-10-23 20:10:12 +00:00
|
|
|
abstract contract Market {
|
2017-07-12 13:46:33 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Events
|
|
|
|
*/
|
|
|
|
event MarketFunding(uint funding);
|
|
|
|
event MarketClosing();
|
|
|
|
event FeeWithdrawal(uint fees);
|
|
|
|
event OutcomeTokenPurchase(address indexed buyer, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint cost);
|
|
|
|
event OutcomeTokenSale(address indexed seller, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint profit);
|
|
|
|
event OutcomeTokenShortSale(address indexed buyer, uint8 outcomeTokenIndex, uint outcomeTokenCount, uint cost);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Storage
|
|
|
|
*/
|
|
|
|
address public creator;
|
|
|
|
uint public createdAtBlock;
|
|
|
|
Event public eventContract;
|
|
|
|
MarketMaker public marketMaker;
|
|
|
|
uint24 public fee;
|
|
|
|
uint public funding;
|
|
|
|
int[] public netOutcomeTokensSold;
|
|
|
|
Stages public stage;
|
|
|
|
|
|
|
|
enum Stages {
|
|
|
|
MarketCreated,
|
|
|
|
MarketFunded,
|
|
|
|
MarketClosed
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Public functions
|
|
|
|
*/
|
2019-11-05 17:25:34 +00:00
|
|
|
function fund(uint _funding) virtual public;
|
|
|
|
function close() virtual public;
|
|
|
|
function withdrawFees() virtual public returns (uint);
|
|
|
|
function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) virtual public returns (uint);
|
|
|
|
function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) virtual public returns (uint);
|
|
|
|
function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) virtual public returns (uint);
|
|
|
|
function calcMarketFee(uint outcomeTokenCost) virtual public view returns (uint);
|
2017-07-12 13:46:33 +00:00
|
|
|
}
|