From 2134537bc37ae724aa4a48b4964f2bd25fafb19f Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 20 Aug 2019 12:46:50 -0700 Subject: [PATCH] Add TransactionGasPriceError to LibExchangeRichErrors --- .../contracts/src/LibExchangeRichErrors.sol | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol b/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol index 29490a2431..b1f6885821 100644 --- a/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol +++ b/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol @@ -131,6 +131,10 @@ library LibExchangeRichErrors { // bytes4(keccak256("TransactionExecutionError(bytes32,bytes)")) bytes4 internal constant TRANSACTION_EXECUTION_ERROR_SELECTOR = 0x20d11f61; + + // bytes4(keccak256("TransactionGasPriceError(bytes32,unt256,uint256)")) + bytes4 internal constant TRANSACTION_GAS_PRICE_ERROR_SELECTOR = + 0xa26dac09; // bytes4(keccak256("IncompleteFillError(uint8,uint256,uint256)")) bytes4 internal constant INCOMPLETE_FILL_ERROR_SELECTOR = @@ -293,6 +297,14 @@ library LibExchangeRichErrors { return BATCH_MATCH_ORDERS_ERROR_SELECTOR; } + function TransactionGasPriceErrorSelector() + internal + pure + returns (bytes4) + { + return TRANSACTION_GAS_PRICE_ERROR_SELECTOR; + } + function BatchMatchOrdersError( BatchMatchOrdersErrorCodes errorCode ) @@ -581,6 +593,23 @@ library LibExchangeRichErrors { ); } + function TransactionGasPriceError( + bytes32 transactionHash, + uint256 actualGasPrice, + uint256 requiredGasPrice + ) + internal + pure + returns (bytes memory) + { + return abi.encodeWithSelector( + TRANSACTION_GAS_PRICE_ERROR_SELECTOR, + transactionHash, + actualGasPrice, + requiredGasPrice + ); + } + function IncompleteFillError( IncompleteFillErrorCode errorCode, uint256 expectedAssetFillAmount,