pragma solidity ^0.5.16; // Inheritance import "./Owned.sol"; import "./MixinResolver.sol"; // Internal references import "./BinaryOptionMarket.sol"; // https://docs.synthetix.io/contracts/source/contracts/binaryoptionmarketfactory contract BinaryOptionMarketFactory is Owned, MixinResolver { /* ========== STATE VARIABLES ========== */ /* ---------- Address Resolver Configuration ---------- */ bytes32 internal constant CONTRACT_BINARYOPTIONMARKETMANAGER = "BinaryOptionMarketManager"; /* ========== CONSTRUCTOR ========== */ constructor(address _owner, address _resolver) public Owned(_owner) MixinResolver(_resolver) {} /* ========== VIEWS ========== */ function resolverAddressesRequired() public view returns (bytes32[] memory addresses) { addresses = new bytes32[](1); addresses[0] = CONTRACT_BINARYOPTIONMARKETMANAGER; } /* ---------- Related Contracts ---------- */ function _manager() internal view returns (address) { return requireAndGetAddress(CONTRACT_BINARYOPTIONMARKETMANAGER); } /* ========== MUTATIVE FUNCTIONS ========== */ function createMarket( address creator, uint[2] calldata creatorLimits, bytes32 oracleKey, uint strikePrice, bool refundsEnabled, uint[3] calldata times, // [biddingEnd, maturity, expiry] uint[2] calldata bids, // [longBid, shortBid] uint[3] calldata fees // [poolFee, creatorFee, refundFee] ) external returns (BinaryOptionMarket) { address manager = _manager(); require(address(manager) == msg.sender, "Only permitted by the manager."); return new BinaryOptionMarket( manager, creator, address(resolver), creatorLimits, oracleKey, strikePrice, refundsEnabled, times, bids, fees ); } }