diff options
Diffstat (limited to 'contracts/protocol')
-rw-r--r-- | contracts/protocol/CHANGELOG.json | 3 | ||||
-rw-r--r-- | contracts/protocol/CHANGELOG.md | 6 | ||||
-rw-r--r-- | contracts/protocol/package.json | 37 | ||||
-rw-r--r-- | contracts/protocol/test/asset_proxy/proxies.ts | 32 | ||||
-rw-r--r-- | contracts/protocol/test/exchange/core.ts | 31 |
5 files changed, 47 insertions, 62 deletions
diff --git a/contracts/protocol/CHANGELOG.json b/contracts/protocol/CHANGELOG.json index e283d7917..6672ce9c3 100644 --- a/contracts/protocol/CHANGELOG.json +++ b/contracts/protocol/CHANGELOG.json @@ -14,7 +14,8 @@ "note": "Move OrderValidator to extensions", "pr": 1464 } - ] + ], + "timestamp": 1547040760 }, { "timestamp": 1544741676, diff --git a/contracts/protocol/CHANGELOG.md b/contracts/protocol/CHANGELOG.md index d90b1b2cc..a8ad921a2 100644 --- a/contracts/protocol/CHANGELOG.md +++ b/contracts/protocol/CHANGELOG.md @@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v2.2.0 - _January 9, 2019_ + + * Added LibAddressArray (#1383) + * Add validation and comments to MultiAssetProxy (#1455) + * Move OrderValidator to extensions (#1464) + ## v2.1.59 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/protocol/package.json b/contracts/protocol/package.json index 891838e54..02e1934d7 100644 --- a/contracts/protocol/package.json +++ b/contracts/protocol/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-protocol", - "version": "2.1.59", + "version": "2.2.0", "engines": { "node": ">=6.12" }, @@ -44,11 +44,11 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/dev-utils": "^1.0.21", - "@0x/sol-compiler": "^1.1.16", - "@0x/sol-cov": "^2.1.16", - "@0x/subproviders": "^2.1.8", + "@0x/abi-gen": "^1.0.20", + "@0x/dev-utils": "^1.0.22", + "@0x/sol-compiler": "^2.0.0", + "@0x/sol-cov": "^2.1.17", + "@0x/subproviders": "^2.1.9", "@0x/tslint-config": "^2.0.0", "@types/bn.js": "^4.11.0", "@types/lodash": "4.14.104", @@ -63,26 +63,25 @@ "mocha": "^4.1.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", - "solc": "^0.4.24", "solhint": "^1.4.1", "tslint": "5.11.0", "typescript": "3.0.1", "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^3.0.10", - "@0x/contracts-examples": "^1.0.2", - "@0x/contracts-interfaces": "^1.0.2", - "@0x/contracts-libs": "^1.0.2", - "@0x/contracts-multisig": "^1.0.2", - "@0x/contracts-test-utils": "^1.0.2", - "@0x/contracts-tokens": "^1.0.2", - "@0x/contracts-utils": "^1.0.2", - "@0x/order-utils": "^3.0.7", - "@0x/types": "^1.4.1", + "@0x/base-contract": "^3.0.11", + "@0x/contracts-examples": "^1.0.3", + "@0x/contracts-interfaces": "^1.0.3", + "@0x/contracts-libs": "^1.0.3", + "@0x/contracts-multisig": "^1.0.3", + "@0x/contracts-test-utils": "^1.0.3", + "@0x/contracts-tokens": "^1.0.3", + "@0x/contracts-utils": "^1.0.3", + "@0x/order-utils": "^3.1.0", + "@0x/types": "^1.5.0", "@0x/typescript-typings": "^3.0.6", - "@0x/utils": "^2.0.8", - "@0x/web3-wrapper": "^3.2.1", + "@0x/utils": "^2.1.1", + "@0x/web3-wrapper": "^3.2.2", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", "ethereum-types": "^1.1.4", diff --git a/contracts/protocol/test/asset_proxy/proxies.ts b/contracts/protocol/test/asset_proxy/proxies.ts index 89c8b390c..bbb44f402 100644 --- a/contracts/protocol/test/asset_proxy/proxies.ts +++ b/contracts/protocol/test/asset_proxy/proxies.ts @@ -715,7 +715,7 @@ describe('Asset Transfer Proxies', () => { const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); const amounts = [erc20Amount]; const nestedAssetData = [erc20AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -778,7 +778,7 @@ describe('Asset Transfer Proxies', () => { const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); const amounts = [erc20Amount1, erc20Amount2]; const nestedAssetData = [erc20AssetData1, erc20AssetData2]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -811,7 +811,7 @@ describe('Asset Transfer Proxies', () => { const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address); const amounts = [erc20Amount1, erc20Amount2]; const nestedAssetData = [erc20AssetData1, erc20AssetData2]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -849,7 +849,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc721Amount]; const nestedAssetData = [erc721AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -881,7 +881,7 @@ describe('Asset Transfer Proxies', () => { const erc721Amount = new BigNumber(1); const amounts = [erc721Amount, erc721Amount]; const nestedAssetData = [erc721AssetData1, erc721AssetData2]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -913,7 +913,7 @@ describe('Asset Transfer Proxies', () => { const erc721Amount = new BigNumber(1); const amounts = [erc721Amount, erc721Amount]; const nestedAssetData = [erc721AssetData1, erc721AssetData2]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -946,7 +946,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -984,10 +984,7 @@ describe('Asset Transfer Proxies', () => { const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; const extraData = '0102030405060708'; - const assetData = `${assetDataInterface.MultiAsset.getABIEncodedTransactionData( - amounts, - nestedAssetData, - )}${extraData}`; + const assetData = `${assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData)}${extraData}`; const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -1024,7 +1021,7 @@ describe('Asset Transfer Proxies', () => { const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address); const amounts = [erc20Amount1, erc20Amount2]; const nestedAssetData = [erc20AssetData1, erc20AssetData2]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -1085,7 +1082,7 @@ describe('Asset Transfer Proxies', () => { erc721AssetData3, erc721AssetData4, ]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -1143,7 +1140,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -1169,6 +1166,7 @@ describe('Asset Transfer Proxies', () => { const invalidErc721AssetData = `${invalidProxyId}${erc721AssetData.slice(10)}`; const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, invalidErc721AssetData]; + // HACK: This is used to get around validation built into assetDataUtils const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, @@ -1192,6 +1190,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc20Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; + // HACK: This is used to get around validation built into assetDataUtils const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, @@ -1214,7 +1213,7 @@ describe('Asset Transfer Proxies', () => { const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address); const amounts = [erc20Amount]; const nestedAssetData = [erc20AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, @@ -1238,6 +1237,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = '0x123456'; const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; + // HACK: This is used to get around validation built into assetDataUtils const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, @@ -1262,7 +1262,7 @@ describe('Asset Transfer Proxies', () => { const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId); const amounts = [erc20Amount, erc721Amount]; const nestedAssetData = [erc20AssetData, erc721AssetData]; - const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData); + const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData); const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData( assetData, fromAddress, diff --git a/contracts/protocol/test/exchange/core.ts b/contracts/protocol/test/exchange/core.ts index 9b948f991..42db8623d 100644 --- a/contracts/protocol/test/exchange/core.ts +++ b/contracts/protocol/test/exchange/core.ts @@ -1,4 +1,3 @@ -import { artifacts as interfacesArtifacts, IAssetDataContract } from '@0x/contracts-interfaces'; import { chaiSetup, constants, @@ -43,11 +42,6 @@ import { ExchangeWrapper } from '../utils/exchange_wrapper'; chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); -const assetDataInterface = new IAssetDataContract( - interfacesArtifacts.IAssetData.compilerOutput.abi, - constants.NULL_ADDRESS, - provider, -); // tslint:disable:no-unnecessary-type-assertion describe('Exchange core', () => { let makerAddress: string; @@ -777,10 +771,7 @@ describe('Exchange core', () => { assetDataUtils.encodeERC20AssetData(erc20TokenA.address), assetDataUtils.encodeERC20AssetData(erc20TokenB.address), ]; - const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData( - makerAmounts, - makerNestedAssetData, - ); + const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData); const makerAssetAmount = new BigNumber(1); const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const takerAssetAmount = new BigNumber(10); @@ -830,10 +821,7 @@ describe('Exchange core', () => { assetDataUtils.encodeERC20AssetData(erc20TokenA.address), assetDataUtils.encodeERC20AssetData(erc20TokenB.address), ]; - const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData( - makerAmounts, - makerNestedAssetData, - ); + const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData); const makerAssetAmount = new BigNumber(1); const takerAmounts = [new BigNumber(10), new BigNumber(1)]; const takerAssetId = erc721TakerAssetIds[0]; @@ -841,10 +829,7 @@ describe('Exchange core', () => { assetDataUtils.encodeERC20AssetData(zrxToken.address), assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId), ]; - const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData( - takerAmounts, - takerNestedAssetData, - ); + const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData); const takerAssetAmount = new BigNumber(1); signedOrder = await orderFactory.newSignedOrderAsync({ makerAssetData, @@ -900,10 +885,7 @@ describe('Exchange core', () => { assetDataUtils.encodeERC20AssetData(erc20TokenA.address), assetDataUtils.encodeERC20AssetData(erc20TokenB.address), ]; - const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData( - makerAmounts, - makerNestedAssetData, - ); + const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData); const makerAssetAmount = new BigNumber(30); const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const takerAssetAmount = new BigNumber(10); @@ -980,10 +962,7 @@ describe('Exchange core', () => { assetDataUtils.encodeERC20AssetData(erc20TokenA.address), assetDataUtils.encodeERC20AssetData(erc20TokenB.address), ]; - const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData( - takerAmounts, - takerNestedAssetData, - ); + const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData); const takerAssetAmount = new BigNumber(30); const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address); const makerAssetAmount = new BigNumber(10); |