2018-10-24 12:52:11 +00:00
|
|
|
pragma solidity >=0.0;
|
2017-07-12 13:46:33 +00:00
|
|
|
import "../Oracles/FutarchyOracle.sol";
|
|
|
|
|
|
|
|
|
|
|
|
/// @title Futarchy oracle factory contract - Allows to create Futarchy oracle contracts
|
|
|
|
/// @author Stefan George - <stefan@gnosis.pm>
|
|
|
|
contract FutarchyOracleFactory {
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Events
|
|
|
|
*/
|
|
|
|
event FutarchyOracleCreation(
|
|
|
|
address indexed creator,
|
|
|
|
FutarchyOracle futarchyOracle,
|
|
|
|
Token collateralToken,
|
|
|
|
Oracle oracle,
|
|
|
|
uint8 outcomeCount,
|
|
|
|
int lowerBound,
|
|
|
|
int upperBound,
|
|
|
|
MarketFactory marketFactory,
|
|
|
|
MarketMaker marketMaker,
|
|
|
|
uint24 fee,
|
|
|
|
uint deadline
|
|
|
|
);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Storage
|
|
|
|
*/
|
|
|
|
EventFactory eventFactory;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Public functions
|
|
|
|
*/
|
|
|
|
/// @dev Constructor sets event factory contract
|
|
|
|
/// @param _eventFactory Event factory contract
|
2018-06-25 13:02:20 +00:00
|
|
|
constructor(EventFactory _eventFactory)
|
2017-07-12 13:46:33 +00:00
|
|
|
{
|
2018-06-12 09:05:49 +00:00
|
|
|
require(address(_eventFactory) != address(0));
|
2017-07-12 13:46:33 +00:00
|
|
|
eventFactory = _eventFactory;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// @dev Creates a new Futarchy oracle contract
|
|
|
|
/// @param collateralToken Tokens used as collateral in exchange for outcome tokens
|
|
|
|
/// @param oracle Oracle contract used to resolve the event
|
|
|
|
/// @param outcomeCount Number of event outcomes
|
|
|
|
/// @param lowerBound Lower bound for event outcome
|
|
|
|
/// @param upperBound Lower bound for event outcome
|
|
|
|
/// @param marketFactory Market factory contract
|
|
|
|
/// @param marketMaker Market maker contract
|
|
|
|
/// @param fee Market fee
|
|
|
|
/// @param deadline Decision deadline
|
2019-10-21 22:05:34 +00:00
|
|
|
/// @return futarchyOracle Oracle contract
|
2017-07-12 13:46:33 +00:00
|
|
|
function createFutarchyOracle(
|
|
|
|
Token collateralToken,
|
|
|
|
Oracle oracle,
|
|
|
|
uint8 outcomeCount,
|
|
|
|
int lowerBound,
|
|
|
|
int upperBound,
|
|
|
|
MarketFactory marketFactory,
|
|
|
|
MarketMaker marketMaker,
|
|
|
|
uint24 fee,
|
|
|
|
uint deadline
|
|
|
|
)
|
|
|
|
public
|
|
|
|
returns (FutarchyOracle futarchyOracle)
|
|
|
|
{
|
|
|
|
futarchyOracle = new FutarchyOracle(
|
|
|
|
msg.sender,
|
|
|
|
eventFactory,
|
|
|
|
collateralToken,
|
|
|
|
oracle,
|
|
|
|
outcomeCount,
|
|
|
|
lowerBound,
|
|
|
|
upperBound,
|
|
|
|
marketFactory,
|
|
|
|
marketMaker,
|
|
|
|
fee,
|
|
|
|
deadline
|
|
|
|
);
|
2018-06-27 08:35:38 +00:00
|
|
|
emit FutarchyOracleCreation(
|
2017-07-12 13:46:33 +00:00
|
|
|
msg.sender,
|
|
|
|
futarchyOracle,
|
|
|
|
collateralToken,
|
|
|
|
oracle,
|
|
|
|
outcomeCount,
|
|
|
|
lowerBound,
|
|
|
|
upperBound,
|
|
|
|
marketFactory,
|
|
|
|
marketMaker,
|
|
|
|
fee,
|
|
|
|
deadline
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|