contract Marketplace is MarketplaceCommon {

  function Marketplace(address _resolver) public
  {
    require(init(CONTRACT_INTERACTIVE_MARKETPLACE, _resolver));
  }

  /// @dev purchase DGX gold
  /// @param _block_number Block number from DTPO (Digix Trusted Price Oracle)
  /// @param _nonce Nonce from DTPO
  /// @param _wei_per_dgx_mg Price in wei for one milligram of DGX
  /// @param _signer Address of the DTPO signer
  /// @param _signature Signature of the payload
  /// @return {
  ///   "_success": "returns true if operation is successful",
  ///   "_purchased_amount": "DGX nanograms received"
  /// }
  function purchase(uint256 _block_number, uint256 _nonce, uint256 _wei_per_dgx_mg, address _signer, bytes _signature)
           payable
           public
           returns (bool _success, uint256 _purchased_amount)
  {
    address _sender = msg.sender;

    (_success, _purchased_amount) =
      marketplace_controller().put_purchase_for.value(msg.value).gas(600000)(msg.value, _sender, _sender, _block_number,
                                                                             _nonce, _wei_per_dgx_mg, _signer, _signature);
    require(_success);
  }
}
/// @title Digix's Marketplace
/// @author Digix Holdings Pte Ltd
/// @notice This contract is for KYC-approved users to purchase DGX using ETH
function purchase(uint256 _block_number, uint256 _nonce, uint256 _wei_per_dgx_mg, address _signer, bytes _signature)
         payable
         public
         returns (bool _success, uint256 _purchased_amount)
{
  address _sender = msg.sender;

  (_success, _purchased_amount) =
    marketplace_controller().put_purchase_for.value(msg.value).gas(600000)(msg.value, _sender, _sender, _block_number,
                                                                           _nonce, _wei_per_dgx_mg, _signer, _signature);
  require(_success);
}

/// @dev purchase DGX gold
/// @param _block_number Block number from DTPO (Digix Trusted Price Oracle)
/// @param _nonce Nonce from DTPO
/// @param _wei_per_dgx_mg Price in wei for one milligram of DGX
/// @param _signer Address of the DTPO signer
/// @param _signature Signature of the payload
/// @return {
///   "_success": "returns true if operation is successful",
///   "_purchased_amount": "DGX nanograms received"
/// }