/** * Copyright 2017–2019, LaborX PTY * Licensed under the AGPL Version 3 license. */ pragma solidity ^0.4.25; import "./FeeManager.sol"; contract EscrowBase { mapping(bytes32 => bool) internal _saltWithEscrow2flagMapping; EscrowFeeManagerInterface internal _feeManager; function getFeeManager() external view returns (address) { return address(_feeManager); } /// @notice Gets balance locked on escrow. /// @param _tradeRecordId identifier of escrow record /// @param _seller who will mainly deposit to escrow /// @param _buyer who will eventually is going to receive payment /// @return currency symbol /// @return currence balance on escrow function getBalanceOf( bytes32 _tradeRecordId, address _seller, address _buyer ) external view returns (bytes32, uint) { bytes32 _escrowHash = _getEscrowHash(_tradeRecordId, _seller, _buyer); return (_getEscrowSymbol(_escrowHash), _getEscrowValue(_escrowHash)); } function getFeeInfo( bytes32 _tradeRecordId, address _seller, address _buyer ) external view returns (uint16, uint16, uint) { bytes32 _escrowHash = _getEscrowHash(_tradeRecordId, _seller, _buyer); (uint16 _sellerFee, uint16 _buyerFee) = _getEscrowFees(_escrowHash); return (_sellerFee, _buyerFee, _feeManager.getServiceFeePrecision()); } function getSellerFeeInfo(address _seller) external view returns (uint16, uint) { return _feeManager.getSellerFee(_seller); } function getBuyerFeeInfo(address _buyer) external view returns (uint16, uint) { return _feeManager.getBuyerFee(_buyer); } /// @notice Hashes the values and returns the escrow hash. /// @param _tradeRecordId identifier of escrow record /// @param _seller who will mainly deposit to escrow /// @param _buyer who will eventually is going to receive payment /// @return returns escrow hash function _getEscrowHash( bytes32 _tradeRecordId, address _seller, address _buyer ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_tradeRecordId, _seller, _buyer)); } function _getEncodedSaltWithEscrowHash(uint _salt, bytes32 _escrowHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_salt, _escrowHash)); } function _getEscrowExists(bytes32 _escrowHash) internal view returns (bool); function _getEscrowDisputed(bytes32 _escrowHash) internal view returns (bool); function _getEscrowSymbol(bytes32 _escrowHash) internal view returns (bytes32); function _getEscrowValue(bytes32 _escrowHash) internal view returns (uint); function _getEscrowArbiter(bytes32 _escrowHash) internal view returns (address); function _getEscrowFees(bytes32 _escrowHash) internal view returns (uint16, uint16); }