Move OrderValidator to extensions

This commit is contained in:
Amir Bandeali 2018-12-20 09:08:38 -08:00
parent bc3093e635
commit f7fd9789ba
15 changed files with 30 additions and 22 deletions

View File

@ -9,6 +9,10 @@
{
"note": "Add OrderMatcher",
"pr": 1117
},
{
"note": "Add OrderValidator",
"pr": 1464
}
]
},

View File

@ -18,5 +18,5 @@
}
}
},
"contracts": ["BalanceThresholdFilter", "DutchAuction", "Forwarder", "OrderMatcher"]
"contracts": ["BalanceThresholdFilter", "DutchAuction", "Forwarder", "OrderMatcher", "OrderValidator"]
}

View File

@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|Forwarder|OrderMatcher).json"
"abis": "generated-artifacts/@(BalanceThresholdFilter|DutchAuction|Forwarder|OrderMatcher|OrderValidator).json"
},
"repository": {
"type": "git",

View File

@ -4,10 +4,12 @@ import * as BalanceThresholdFilter from '../../generated-artifacts/BalanceThresh
import * as DutchAuction from '../../generated-artifacts/DutchAuction.json';
import * as Forwarder from '../../generated-artifacts/Forwarder.json';
import * as OrderMatcher from '../../generated-artifacts/OrderMatcher.json';
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
export const artifacts = {
BalanceThresholdFilter: BalanceThresholdFilter as ContractArtifact,
DutchAuction: DutchAuction as ContractArtifact,
Forwarder: Forwarder as ContractArtifact,
OrderMatcher: OrderMatcher as ContractArtifact,
OrderValidator: OrderValidator as ContractArtifact,
};

View File

@ -2,3 +2,4 @@ export * from '../../generated-wrappers/balance_threshold_filter';
export * from '../../generated-wrappers/dutch_auction';
export * from '../../generated-wrappers/forwarder';
export * from '../../generated-wrappers/order_matcher';
export * from '../../generated-wrappers/order_validator';

View File

@ -1,3 +1,12 @@
import {
artifacts as protocolArtifacts,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
ExchangeContract,
ExchangeWrapper,
} from '@0x/contracts-protocol';
import {
chaiSetup,
constants,
@ -15,16 +24,8 @@ import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import * as _ from 'lodash';
import {
artifacts,
ERC20ProxyContract,
ERC20Wrapper,
ERC721ProxyContract,
ERC721Wrapper,
ExchangeContract,
ExchangeWrapper,
OrderValidatorContract,
} from '../../src';
import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
import { artifacts } from '../../src/artifacts/index';
chaiSetup.configure();
const expect = chai.expect;
@ -80,7 +81,7 @@ describe('OrderValidator', () => {
const zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
artifacts.Exchange,
protocolArtifacts.Exchange,
provider,
txDefaults,
zrxAssetData,

View File

@ -10,7 +10,8 @@
"./generated-artifacts/BalanceThresholdFilter.json",
"./generated-artifacts/DutchAuction.json",
"./generated-artifacts/Forwarder.json",
"./generated-artifacts/OrderMatcher.json"
"./generated-artifacts/OrderMatcher.json",
"./generated-artifacts/OrderValidator.json"
],
"exclude": ["./deploy/solc/solc_bin"]
}

View File

@ -9,6 +9,10 @@
{
"note": "Add validation and comments to MultiAssetProxy",
"pr": 1455
},
{
"note": "Move OrderValidator to extensions",
"pr": 1464
}
]
},

View File

@ -25,7 +25,6 @@
"Exchange",
"MixinAuthorizable",
"MultiAssetProxy",
"OrderValidator",
"TestAssetProxyOwner",
"TestAssetProxyDispatcher",
"TestExchangeInternals",

View File

@ -34,8 +34,8 @@ contract MultiAssetProxy is
external
{
// NOTE: The below assembly assumes that clients do some input validation and that the input is properly encoded according to the AbiV2 specification.
// It is technically possible for inputs with very large lengths and offsets to cause overflows. However, this would make the calldata prohibitively expensive
// and we therefore do not check for overflows in these scenarios.
// It is technically possible for inputs with very large lengths and offsets to cause overflows. However, this would make the calldata prohibitively
// expensive and we therefore do not check for overflows in these scenarios.
assembly {
// The first 4 bytes of calldata holds the function selector
let selector := and(calldataload(0), 0xffffffff00000000000000000000000000000000000000000000000000000000)

View File

@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
"abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|OrderValidator|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json"
"abis": "generated-artifacts/@(AssetProxyOwner|ERC20Proxy|ERC721Proxy|Exchange|MixinAuthorizable|MultiAssetProxy|TestSignatureValidator|TestAssetProxyOwner|TestAssetProxyDispatcher|TestExchangeInternals|TestStaticCallReceiver).json"
},
"repository": {
"type": "git",

View File

@ -6,7 +6,6 @@ import * as ERC721Proxy from '../../generated-artifacts/ERC721Proxy.json';
import * as Exchange from '../../generated-artifacts/Exchange.json';
import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
@ -20,7 +19,6 @@ export const artifacts = {
Exchange: Exchange as ContractArtifact,
MixinAuthorizable: MixinAuthorizable as ContractArtifact,
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
OrderValidator: OrderValidator as ContractArtifact,
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
TestExchangeInternals: TestExchangeInternals as ContractArtifact,

View File

@ -3,7 +3,6 @@ export * from '../../generated-wrappers/erc20_proxy';
export * from '../../generated-wrappers/erc721_proxy';
export * from '../../generated-wrappers/exchange';
export * from '../../generated-wrappers/mixin_authorizable';
export * from '../../generated-wrappers/order_validator';
export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
export * from '../../generated-wrappers/test_asset_proxy_owner';
export * from '../../generated-wrappers/test_exchange_internals';

View File

@ -13,7 +13,6 @@
"./generated-artifacts/Exchange.json",
"./generated-artifacts/MixinAuthorizable.json",
"./generated-artifacts/MultiAssetProxy.json",
"./generated-artifacts/OrderValidator.json",
"./generated-artifacts/TestAssetProxyDispatcher.json",
"./generated-artifacts/TestAssetProxyOwner.json",
"./generated-artifacts/TestExchangeInternals.json",