From 44753bb168adef30c04e59398e21b73004022f2c Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Thu, 22 Aug 2019 15:46:28 -0700 Subject: [PATCH] Add TransactionInvalidContextError and remove NO_REENTRANCY errorCode --- .../contracts/src/LibExchangeRichErrors.sol | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol b/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol index b1f6885821..04ce429e21 100644 --- a/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol +++ b/contracts/exchange-libs/contracts/src/LibExchangeRichErrors.sol @@ -53,7 +53,6 @@ library LibExchangeRichErrors { } enum TransactionErrorCodes { - NO_REENTRANCY, ALREADY_EXECUTED, EXPIRED } @@ -136,6 +135,10 @@ library LibExchangeRichErrors { bytes4 internal constant TRANSACTION_GAS_PRICE_ERROR_SELECTOR = 0xa26dac09; + // bytes4(keccak256("TransactionInvalidContextError(bytes32,address)")) + bytes4 internal constant TRANSACTION_INVALID_CONTEXT_ERROR_SELECTOR = + 0xdec4aedf; + // bytes4(keccak256("IncompleteFillError(uint8,uint256,uint256)")) bytes4 internal constant INCOMPLETE_FILL_ERROR_SELECTOR = 0x18e4b141; @@ -610,6 +613,21 @@ library LibExchangeRichErrors { ); } + function TransactionInvalidContextError( + bytes32 transactionHash, + address currentContextAddress + ) + internal + pure + returns (bytes memory) + { + return abi.encodeWithSelector( + TRANSACTION_INVALID_CONTEXT_ERROR_SELECTOR, + transactionHash, + currentContextAddress + ); + } + function IncompleteFillError( IncompleteFillErrorCode errorCode, uint256 expectedAssetFillAmount,