diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-10 00:54:55 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-10 00:54:55 +0800 |
commit | fb3605026ef63ef6897010a52bf3f4c116cdf271 (patch) | |
tree | af3887e5f785e049daeaf795e0f3e4a9ad370d93 /contracts | |
parent | 76dde294f10bb3d5c1074cd6599668bcb1cdd8ec (diff) | |
parent | 5b8c9122a292f6558c45440b053ceae52d36d495 (diff) | |
download | dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.gz dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.bz2 dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.lz dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.xz dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.tar.zst dexon-sol-tools-fb3605026ef63ef6897010a52bf3f4c116cdf271.zip |
Merge branch 'development' into feature/instant/tell-amount-available
Diffstat (limited to 'contracts')
32 files changed, 387 insertions, 313 deletions
diff --git a/contracts/examples/CHANGELOG.json b/contracts/examples/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/examples/CHANGELOG.json +++ b/contracts/examples/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/examples/CHANGELOG.md b/contracts/examples/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/examples/CHANGELOG.md +++ b/contracts/examples/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/examples/package.json b/contracts/examples/package.json index 37b73f98c..b556d72d8 100644 --- a/contracts/examples/package.json +++ b/contracts/examples/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-examples", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -33,12 +33,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contracts-test-utils": "^1.0.3", + "@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", @@ -53,24 +53,23 @@ "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-interfaces": "^1.0.2", - "@0x/contracts-libs": "^1.0.2", - "@0x/contracts-multisig": "^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-interfaces": "^1.0.3", + "@0x/contracts-libs": "^1.0.3", + "@0x/contracts-multisig": "^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/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json index 083ad33fb..de1ada0a8 100644 --- a/contracts/extensions/CHANGELOG.json +++ b/contracts/extensions/CHANGELOG.json @@ -1,5 +1,15 @@ [ { + "version": "1.2.0", + "changes": [ + { + "note": "Added Dutch Auction Wrapper", + "pr": 1465 + } + ], + "timestamp": 1547040760 + }, + { "version": "1.1.0", "changes": [ { diff --git a/contracts/extensions/CHANGELOG.md b/contracts/extensions/CHANGELOG.md index 716353d05..452cc8e82 100644 --- a/contracts/extensions/CHANGELOG.md +++ b/contracts/extensions/CHANGELOG.md @@ -5,6 +5,16 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.2.0 - _January 9, 2019_ + + * Added Dutch Auction Wrapper (#1465) + +## v1.1.0 - _Invalid date_ + + * Added Balance Threshold Filter (#1383) + * Add OrderMatcher (#1117) + * Add OrderValidator (#1464) + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 069b5d2d5..05c066fc8 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-extensions", - "version": "1.0.2", + "version": "1.2.0", "engines": { "node": ">=6.12" }, @@ -44,12 +44,13 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contract-wrappers": "^4.2.0", + "@0x/contracts-test-utils": "^1.0.3", + "@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", @@ -64,24 +65,23 @@ "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-interfaces": "^1.0.2", - "@0x/contracts-libs": "^1.0.2", - "@0x/contracts-protocol": "^2.1.59", - "@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-interfaces": "^1.0.3", + "@0x/contracts-libs": "^1.0.3", + "@0x/contracts-protocol": "^2.2.0", + "@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/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index 6c3b2f0f3..22b3caa16 100644 --- a/contracts/extensions/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/extensions/dutch_auction.ts @@ -1,3 +1,4 @@ +import { DutchAuctionWrapper } from '@0x/contract-wrappers'; import { artifacts as protocolArtifacts, ERC20Wrapper, @@ -29,12 +30,11 @@ import { RevertReason, SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; import * as chai from 'chai'; -import ethAbi = require('ethereumjs-abi'); -import * as ethUtil from 'ethereumjs-util'; import * as _ from 'lodash'; import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; import { artifacts } from '../../src/artifacts'; +import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -68,19 +68,8 @@ describe(ContractName.DutchAuction, () => { let erc721MakerAssetIds: BigNumber[]; const tenMinutesInSeconds = 10 * 60; - function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string { - return ethUtil.bufferToHex( - Buffer.concat([ - ethUtil.toBuffer(makerAssetData), - ethUtil.toBuffer( - (ethAbi as any).rawEncode( - ['uint256', 'uint256'], - [beginTimeSeconds.toString(), beginAmount.toString()], - ), - ), - ]), - ); - } + let dutchAuctionTestWrapper: DutchAuctionTestWrapper; + let defaultERC20MakerAssetData: string; before(async () => { await blockchainLifecycle.startAsync(); @@ -136,6 +125,7 @@ describe(ContractName.DutchAuction, () => { dutchAuctionInstance.address, provider, ); + dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider); defaultMakerAssetAddress = erc20TokenA.address; const defaultTakerAssetAddress = wethContract.address; @@ -174,7 +164,7 @@ describe(ContractName.DutchAuction, () => { feeRecipientAddress, // taker address or sender address should be set to the ducth auction contract takerAddress: dutchAuctionContract.address, - makerAssetData: extendMakerAssetData( + makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData( assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), auctionBeginTimeSeconds, auctionBeginAmount, @@ -199,6 +189,7 @@ describe(ContractName.DutchAuction, () => { const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)]; sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams); buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams); + defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress); }); after(async () => { await blockchainLifecycle.revertAsync(); @@ -215,49 +206,41 @@ describe(ContractName.DutchAuction, () => { describe('matchOrders', () => { it('should be worth the begin price at the begining of the auction', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2); - sellOrder = await sellerOrderFactory.newSignedOrderAsync({ - makerAssetData: extendMakerAssetData( - assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), - auctionBeginTimeSeconds, - auctionBeginAmount, - ), - }); - const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( + defaultERC20MakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); + sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData }); + const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); + expect(auctionDetails.currentTimeSeconds).to.be.bignumber.lte(auctionBeginTimeSeconds); expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount); expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount); }); it('should be be worth the end price at the end of the auction', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( + defaultERC20MakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ - makerAssetData: extendMakerAssetData( - assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), - auctionBeginTimeSeconds, - auctionBeginAmount, - ), + makerAssetData, expirationTimeSeconds: auctionEndTimeSeconds, }); - const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); + expect(auctionDetails.currentTimeSeconds).to.be.bignumber.gte(auctionEndTimeSeconds); expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount); expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount); }); it('should match orders at current amount and send excess to buyer', async () => { - const beforeAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); buyOrder = await buyerOrderFactory.newSignedOrderAsync({ makerAssetAmount: beforeAuctionDetails.currentAmount.times(2), }); - await web3Wrapper.awaitTransactionSuccessAsync( - await dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), - ); - const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal( constants.ZERO_AMOUNT, @@ -276,17 +259,8 @@ describe(ContractName.DutchAuction, () => { sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerFee: new BigNumber(1), }); - const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); - const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte( erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount), @@ -299,18 +273,9 @@ describe(ContractName.DutchAuction, () => { buyOrder = await buyerOrderFactory.newSignedOrderAsync({ makerFee: new BigNumber(1), }); - const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ); - await web3Wrapper.awaitTransactionSuccessAsync(txHash); + await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); const newBalances = await erc20Wrapper.getBalancesAsync(); - const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte( erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount), ); @@ -321,24 +286,17 @@ describe(ContractName.DutchAuction, () => { it('should revert when auction expires', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( + defaultERC20MakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ expirationTimeSeconds: auctionEndTimeSeconds, - makerAssetData: extendMakerAssetData( - assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), - auctionBeginTimeSeconds, - auctionBeginAmount, - ), + makerAssetData, }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionExpired, ); }); @@ -347,15 +305,7 @@ describe(ContractName.DutchAuction, () => { makerAssetAmount: sellOrder.takerAssetAmount, }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidAmount, ); }); @@ -364,38 +314,23 @@ describe(ContractName.DutchAuction, () => { takerAssetAmount: auctionBeginAmount.plus(1), }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidAmount, ); }); it('begin time is less than end time', async () => { auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds); + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( + defaultERC20MakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ expirationTimeSeconds: auctionEndTimeSeconds, - makerAssetData: extendMakerAssetData( - assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), - auctionBeginTimeSeconds, - auctionBeginAmount, - ), + makerAssetData, }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidBeginTime, ); }); @@ -404,45 +339,30 @@ describe(ContractName.DutchAuction, () => { makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.InvalidAssetData, ); }); + describe('ERC721', () => { it('should match orders when ERC721', async () => { const makerAssetId = erc721MakerAssetIds[0]; + const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId); + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( + erc721MakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetAmount: new BigNumber(1), - makerAssetData: extendMakerAssetData( - assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId), - auctionBeginTimeSeconds, - auctionBeginAmount, - ), + makerAssetData, }); buyOrder = await buyerOrderFactory.newSignedOrderAsync({ takerAssetAmount: new BigNumber(1), takerAssetData: sellOrder.makerAssetData, }); - await web3Wrapper.awaitTransactionSuccessAsync( - await dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), - ); - const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); const newBalances = await erc20Wrapper.getBalancesAsync(); // HACK gte used here due to a bug in ganache where the timestamp can change // between multiple calls to the same block. Which can move the amount in our case diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts new file mode 100644 index 000000000..c1e2f2070 --- /dev/null +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -0,0 +1,62 @@ +import { artifacts as protocolArtifacts } from '@0x/contracts-protocol'; +import { LogDecoder } from '@0x/contracts-test-utils'; +import { artifacts as tokensArtifacts } from '@0x/contracts-tokens'; +import { DutchAuctionDetails, SignedOrder } from '@0x/types'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; +import * as _ from 'lodash'; + +import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; +import { artifacts } from '../../src/artifacts'; + +export class DutchAuctionTestWrapper { + private readonly _dutchAuctionContract: DutchAuctionContract; + private readonly _web3Wrapper: Web3Wrapper; + private readonly _logDecoder: LogDecoder; + + constructor(contractInstance: DutchAuctionContract, provider: Provider) { + this._dutchAuctionContract = contractInstance; + this._web3Wrapper = new Web3Wrapper(provider); + this._logDecoder = new LogDecoder(this._web3Wrapper, { + ...artifacts, + ...tokensArtifacts, + ...protocolArtifacts, + }); + } + /** + * Matches the buy and sell orders at an amount given the following: the current block time, the auction + * start time and the auction begin amount. The sell order is a an order at the lowest amount + * at the end of the auction. Excess from the match is transferred to the seller. + * Over time the price moves from beginAmount to endAmount given the current block.timestamp. + * @param buyOrder The Buyer's order. This order is for the current expected price of the auction. + * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction). + * @param from Address the transaction is being sent from. + * @return Transaction receipt with decoded logs. + */ + public async matchOrdersAsync( + buyOrder: SignedOrder, + sellOrder: SignedOrder, + from: string, + ): Promise<TransactionReceiptWithDecodedLogs> { + const txHash = await this._dutchAuctionContract.matchOrders.sendTransactionAsync( + buyOrder, + sellOrder, + buyOrder.signature, + sellOrder.signature, + { + from, + }, + ); + const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash); + return tx; + } + /** + * Calculates the Auction Details for the given order + * @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction). + * @return The dutch auction details. + */ + public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> { + const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + return auctionDetails; + } +} diff --git a/contracts/interfaces/CHANGELOG.json b/contracts/interfaces/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/interfaces/CHANGELOG.json +++ b/contracts/interfaces/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/interfaces/CHANGELOG.md b/contracts/interfaces/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/interfaces/CHANGELOG.md +++ b/contracts/interfaces/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/interfaces/package.json b/contracts/interfaces/package.json index 15385a154..9017f0a73 100644 --- a/contracts/interfaces/package.json +++ b/contracts/interfaces/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-interfaces", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -30,8 +30,8 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/sol-compiler": "^1.1.16", + "@0x/abi-gen": "^1.0.20", + "@0x/sol-compiler": "^2.0.0", "@0x/tslint-config": "^2.0.0", "npm-run-all": "^4.1.2", "shx": "^0.2.2", @@ -41,13 +41,13 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^3.0.10", - "@0x/contracts-libs": "^1.0.2", - "@0x/contracts-utils": "^1.0.2", - "@0x/types": "^1.4.1", + "@0x/base-contract": "^3.0.11", + "@0x/contracts-libs": "^1.0.3", + "@0x/contracts-utils": "^1.0.3", + "@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", "ethereum-types": "^1.1.4", "lodash": "^4.17.5" }, diff --git a/contracts/libs/CHANGELOG.json b/contracts/libs/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/libs/CHANGELOG.json +++ b/contracts/libs/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/libs/CHANGELOG.md b/contracts/libs/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/libs/CHANGELOG.md +++ b/contracts/libs/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/libs/package.json b/contracts/libs/package.json index ce7b97502..ed9d408ff 100644 --- a/contracts/libs/package.json +++ b/contracts/libs/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-libs", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -44,12 +44,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contracts-test-utils": "^1.0.3", + "@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", @@ -64,21 +64,20 @@ "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-multisig": "^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-multisig": "^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/multisig/CHANGELOG.json b/contracts/multisig/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/multisig/CHANGELOG.json +++ b/contracts/multisig/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/multisig/CHANGELOG.md b/contracts/multisig/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/multisig/CHANGELOG.md +++ b/contracts/multisig/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/multisig/package.json b/contracts/multisig/package.json index 2d7b4aa05..63b6de6f2 100644 --- a/contracts/multisig/package.json +++ b/contracts/multisig/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-multisig", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -44,12 +44,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contracts-test-utils": "^1.0.3", + "@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/ethereumjs-abi": "^0.6.0", @@ -64,19 +64,18 @@ "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/order-utils": "^3.0.7", - "@0x/types": "^1.4.1", + "@0x/base-contract": "^3.0.11", + "@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", "ethereum-types": "^1.1.4", "lodash": "^4.17.5" }, 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); diff --git a/contracts/test-utils/CHANGELOG.json b/contracts/test-utils/CHANGELOG.json index 6e4682b7e..8ba8d179a 100644 --- a/contracts/test-utils/CHANGELOG.json +++ b/contracts/test-utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "version": "1.0.2", "changes": [ { diff --git a/contracts/test-utils/CHANGELOG.md b/contracts/test-utils/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/test-utils/CHANGELOG.md +++ b/contracts/test-utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/test-utils/package.json b/contracts/test-utils/package.json index 18ec8f6a8..852985636 100644 --- a/contracts/test-utils/package.json +++ b/contracts/test-utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-test-utils", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -40,17 +40,17 @@ "typescript": "3.0.1" }, "dependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/dev-utils": "^1.0.21", - "@0x/order-utils": "^3.0.7", - "@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/order-utils": "^3.1.0", + "@0x/sol-compiler": "^2.0.0", + "@0x/sol-cov": "^2.1.17", + "@0x/subproviders": "^2.1.9", "@0x/tslint-config": "^2.0.0", - "@0x/types": "^1.4.1", + "@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/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", "@types/js-combinatorics": "^0.5.29", diff --git a/contracts/tokens/CHANGELOG.json b/contracts/tokens/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/tokens/CHANGELOG.json +++ b/contracts/tokens/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/tokens/CHANGELOG.md b/contracts/tokens/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/tokens/CHANGELOG.md +++ b/contracts/tokens/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/tokens/package.json b/contracts/tokens/package.json index 79afc4820..2fc5013a0 100644 --- a/contracts/tokens/package.json +++ b/contracts/tokens/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-tokens", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -44,12 +44,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contracts-test-utils": "^1.0.3", + "@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", @@ -64,23 +64,22 @@ "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-interfaces": "^1.0.2", - "@0x/contracts-libs": "^1.0.2", - "@0x/contracts-multisig": "^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-interfaces": "^1.0.3", + "@0x/contracts-libs": "^1.0.3", + "@0x/contracts-multisig": "^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/tokens/src/artifacts/index.ts b/contracts/tokens/src/artifacts/index.ts index 63b808748..977d01c3e 100644 --- a/contracts/tokens/src/artifacts/index.ts +++ b/contracts/tokens/src/artifacts/index.ts @@ -22,6 +22,7 @@ import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/Unlimited import * as WETH9 from '../../generated-artifacts/WETH9.json'; import * as ZRXToken from '../../generated-artifacts/ZRXToken.json'; +// tslint:disable:no-unnecessary-type-assertion export const artifacts = { DummyERC20Token: DummyERC20Token as ContractArtifact, DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact, diff --git a/contracts/utils/CHANGELOG.json b/contracts/utils/CHANGELOG.json index 19ac770af..50872eb07 100644 --- a/contracts/utils/CHANGELOG.json +++ b/contracts/utils/CHANGELOG.json @@ -1,5 +1,14 @@ [ { + "timestamp": 1547040760, + "version": "1.0.3", + "changes": [ + { + "note": "Dependencies updated" + } + ] + }, + { "timestamp": 1544741676, "version": "1.0.2", "changes": [ diff --git a/contracts/utils/CHANGELOG.md b/contracts/utils/CHANGELOG.md index 716353d05..4732f1746 100644 --- a/contracts/utils/CHANGELOG.md +++ b/contracts/utils/CHANGELOG.md @@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only. CHANGELOG +## v1.0.3 - _January 9, 2019_ + + * Dependencies updated + ## v1.0.2 - _December 13, 2018_ * Dependencies updated diff --git a/contracts/utils/package.json b/contracts/utils/package.json index cf94af0f6..58a7b3a71 100644 --- a/contracts/utils/package.json +++ b/contracts/utils/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-utils", - "version": "1.0.2", + "version": "1.0.3", "engines": { "node": ">=6.12" }, @@ -44,12 +44,12 @@ }, "homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md", "devDependencies": { - "@0x/abi-gen": "^1.0.19", - "@0x/contracts-test-utils": "^1.0.2", - "@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/contracts-test-utils": "^1.0.3", + "@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", @@ -65,20 +65,19 @@ "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-multisig": "^1.0.2", - "@0x/order-utils": "^3.0.7", - "@0x/types": "^1.4.1", + "@0x/base-contract": "^3.0.11", + "@0x/contracts-multisig": "^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", "ethereum-types": "^1.1.4", "ethereumjs-util": "^5.1.1", "lodash": "^4.17.5" |