Move EIP1271 selectors to their own interface
This commit is contained in:
parent
87c9f9af71
commit
5f8e092c96
@ -30,6 +30,7 @@ import "@0x/contracts-exchange-libs/contracts/src/LibExchangeRichErrors.sol";
|
||||
import "./interfaces/IWallet.sol";
|
||||
import "./interfaces/IEIP1271Wallet.sol";
|
||||
import "./interfaces/ISignatureValidator.sol";
|
||||
import "./interfaces/IEIP1271Data.sol";
|
||||
import "./MixinTransactions.sol";
|
||||
|
||||
|
||||
@ -221,7 +222,7 @@ contract MixinSignatureValidator is
|
||||
// The entire order is verified by a validator contract.
|
||||
isValid = _validateBytesWithValidator(
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).OrderWithHash.selector,
|
||||
IEIP1271Data(address(0)).OrderWithHash.selector,
|
||||
order,
|
||||
orderHash
|
||||
),
|
||||
@ -233,7 +234,7 @@ contract MixinSignatureValidator is
|
||||
// The entire order is verified by a wallet contract.
|
||||
isValid = _validateBytesWithWallet(
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).OrderWithHash.selector,
|
||||
IEIP1271Data(address(0)).OrderWithHash.selector,
|
||||
order,
|
||||
orderHash
|
||||
),
|
||||
@ -277,7 +278,7 @@ contract MixinSignatureValidator is
|
||||
// The entire transaction is verified by a validator contract.
|
||||
isValid = _validateBytesWithValidator(
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).ZeroExTransactionWithHash.selector,
|
||||
IEIP1271Data(address(0)).ZeroExTransactionWithHash.selector,
|
||||
transaction,
|
||||
transactionHash
|
||||
),
|
||||
@ -289,7 +290,7 @@ contract MixinSignatureValidator is
|
||||
// The entire transaction is verified by a wallet contract.
|
||||
isValid = _validateBytesWithWallet(
|
||||
abi.encodeWithSelector(
|
||||
IEIP1271Wallet(address(0)).ZeroExTransactionWithHash.selector,
|
||||
IEIP1271Data(address(0)).ZeroExTransactionWithHash.selector,
|
||||
transaction,
|
||||
transactionHash
|
||||
),
|
||||
|
47
contracts/exchange/contracts/src/interfaces/IEIP1271Data.sol
Normal file
47
contracts/exchange/contracts/src/interfaces/IEIP1271Data.sol
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
|
||||
Copyright 2019 ZeroEx Intl.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibZeroExTransaction.sol";
|
||||
|
||||
|
||||
contract IEIP1271Data {
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the order
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function OrderWithHash(
|
||||
LibOrder.Order calldata order,
|
||||
bytes32 orderHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the transaction
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function ZeroExTransactionWithHash(
|
||||
LibZeroExTransaction.ZeroExTransaction calldata transaction,
|
||||
bytes32 transactionHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
}
|
@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
pragma solidity ^0.5.9;
|
||||
pragma experimental ABIEncoderV2;
|
||||
|
||||
import "@0x/contracts-utils/contracts/src/LibEIP1271.sol";
|
||||
import "@0x/contracts-exchange-libs/contracts/src/LibOrder.sol";
|
||||
@ -38,24 +37,4 @@ contract IEIP1271Wallet is
|
||||
external
|
||||
view
|
||||
returns (bytes4 magicValue);
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the order
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function OrderWithHash(
|
||||
LibOrder.Order calldata order,
|
||||
bytes32 orderHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
|
||||
/// @dev This function's selector is used when ABI encoding the transaction
|
||||
/// and hash into a byte array before calling `isValidSignature`.
|
||||
/// This function serves no other purpose.
|
||||
function ZeroExTransactionWithHash(
|
||||
LibZeroExTransaction.ZeroExTransaction calldata transaction,
|
||||
bytes32 transactionHash
|
||||
)
|
||||
external
|
||||
pure;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@
|
||||
"compile:truffle": "truffle compile"
|
||||
},
|
||||
"config": {
|
||||
"abis": "./generated-artifacts/@(Exchange|IAssetProxy|IAssetProxyDispatcher|IEIP1271Wallet|IExchange|IExchangeCore|IMatchOrders|IProtocolFees|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinProtocolFees|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrancyTester|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestProtocolFees|TestProtocolFeesReceiver|TestSignatureValidator|TestTransactions|TestValidatorWallet|TestWrapperFunctions).json",
|
||||
"abis": "./generated-artifacts/@(Exchange|IAssetProxy|IAssetProxyDispatcher|IEIP1271Data|IEIP1271Wallet|IExchange|IExchangeCore|IMatchOrders|IProtocolFees|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinProtocolFees|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrancyTester|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestProtocolFees|TestProtocolFeesReceiver|TestSignatureValidator|TestTransactions|TestValidatorWallet|TestWrapperFunctions).json",
|
||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
||||
},
|
||||
"repository": {
|
||||
|
@ -8,6 +8,7 @@ import { ContractArtifact } from 'ethereum-types';
|
||||
import * as Exchange from '../generated-artifacts/Exchange.json';
|
||||
import * as IAssetProxy from '../generated-artifacts/IAssetProxy.json';
|
||||
import * as IAssetProxyDispatcher from '../generated-artifacts/IAssetProxyDispatcher.json';
|
||||
import * as IEIP1271Data from '../generated-artifacts/IEIP1271Data.json';
|
||||
import * as IEIP1271Wallet from '../generated-artifacts/IEIP1271Wallet.json';
|
||||
import * as IExchange from '../generated-artifacts/IExchange.json';
|
||||
import * as IExchangeCore from '../generated-artifacts/IExchangeCore.json';
|
||||
@ -50,6 +51,7 @@ export const artifacts = {
|
||||
MixinWrapperFunctions: MixinWrapperFunctions as ContractArtifact,
|
||||
IAssetProxy: IAssetProxy as ContractArtifact,
|
||||
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
|
||||
IEIP1271Data: IEIP1271Data as ContractArtifact,
|
||||
IEIP1271Wallet: IEIP1271Wallet as ContractArtifact,
|
||||
IExchange: IExchange as ContractArtifact,
|
||||
IExchangeCore: IExchangeCore as ContractArtifact,
|
||||
|
@ -6,6 +6,7 @@
|
||||
export * from '../generated-wrappers/exchange';
|
||||
export * from '../generated-wrappers/i_asset_proxy';
|
||||
export * from '../generated-wrappers/i_asset_proxy_dispatcher';
|
||||
export * from '../generated-wrappers/i_e_i_p1271_data';
|
||||
export * from '../generated-wrappers/i_e_i_p1271_wallet';
|
||||
export * from '../generated-wrappers/i_exchange';
|
||||
export * from '../generated-wrappers/i_exchange_core';
|
||||
|
@ -6,6 +6,7 @@
|
||||
"generated-artifacts/Exchange.json",
|
||||
"generated-artifacts/IAssetProxy.json",
|
||||
"generated-artifacts/IAssetProxyDispatcher.json",
|
||||
"generated-artifacts/IEIP1271Data.json",
|
||||
"generated-artifacts/IEIP1271Wallet.json",
|
||||
"generated-artifacts/IExchange.json",
|
||||
"generated-artifacts/IExchangeCore.json",
|
||||
|
Loading…
x
Reference in New Issue
Block a user