contract CompoundPrizePoolBuilder is PrizePoolBuilder {
  using SafeMathUpgradeable for uint256;
  using SafeCastUpgradeable for uint256;

  /// @notice The configuration used to initialize the Compound Prize Pool
  struct CompoundPrizePoolConfig {
    CTokenInterface cToken;
    uint256 maxExitFeeMantissa;
    uint256 maxTimelockDuration;
  }

  RegistryInterface public reserveRegistry;
  CompoundPrizePoolProxyFactory public compoundPrizePoolProxyFactory;

  constructor (
    RegistryInterface _reserveRegistry,
    CompoundPrizePoolProxyFactory _compoundPrizePoolProxyFactory
  ) public {
    require(address(_reserveRegistry) != address(0), "CompoundPrizePoolBuilder/reserveRegistry-not-zero");
    require(address(_compoundPrizePoolProxyFactory) != address(0), "CompoundPrizePoolBuilder/compound-prize-pool-builder-not-zero");
    reserveRegistry = _reserveRegistry;
    compoundPrizePoolProxyFactory = _compoundPrizePoolProxyFactory;
  }

  /// @notice Creates a new Compound Prize Pool with a preconfigured prize strategy.
  /// @param config The config to use to initialize the Compound Prize Pool
  /// @return The Compound Prize Pool
  function createCompoundPrizePool(
    CompoundPrizePoolConfig calldata config
  )
    external
    returns (CompoundPrizePool)
  {
    CompoundPrizePool prizePool = compoundPrizePoolProxyFactory.create();

    ControlledTokenInterface[] memory tokens;

    prizePool.initialize(
      reserveRegistry,
      tokens,
      config.maxExitFeeMantissa,
      config.maxTimelockDuration,
      config.cToken
    );

    prizePool.transferOwnership(msg.sender);

    emit PrizePoolCreated(msg.sender, address(prizePool));

    return prizePool;
  }
}
/* solium-disable security/no-block-members */
function createCompoundPrizePool(
  CompoundPrizePoolConfig calldata config
)
  external
  returns (CompoundPrizePool)
{
  CompoundPrizePool prizePool = compoundPrizePoolProxyFactory.create();

  ControlledTokenInterface[] memory tokens;

  prizePool.initialize(
    reserveRegistry,
    tokens,
    config.maxExitFeeMantissa,
    config.maxTimelockDuration,
    config.cToken
  );

  prizePool.transferOwnership(msg.sender);

  emit PrizePoolCreated(msg.sender, address(prizePool));

  return prizePool;
}

/// @notice Creates a new Compound Prize Pool with a preconfigured prize strategy.
/// @param config The config to use to initialize the Compound Prize Pool
/// @return The Compound Prize Pool