From c850046ea0b302f61a5fd24f77bab19784a2adc0 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Wed, 19 Dec 2018 16:08:59 -0800 Subject: Dutch Auction Contract Wrapper --- contracts/extensions/CHANGELOG.json | 9 + .../extensions/test/extensions/dutch_auction.ts | 195 ++++++--------------- .../extensions/test/utils/dutch_auction_wrapper.ts | 62 +++++++ 3 files changed, 129 insertions(+), 137 deletions(-) create mode 100644 contracts/extensions/test/utils/dutch_auction_wrapper.ts (limited to 'contracts/extensions') diff --git a/contracts/extensions/CHANGELOG.json b/contracts/extensions/CHANGELOG.json index 083ad33fb..40e25565e 100644 --- a/contracts/extensions/CHANGELOG.json +++ b/contracts/extensions/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "1.2.0", + "changes": [ + { + "note": "Added Dutch Auction Wrapper", + "pr": 1465 + } + ] + }, { "version": "1.1.0", "changes": [ diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index 6c3b2f0f3..7a1a546e7 100644 --- a/contracts/extensions/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/extensions/dutch_auction.ts @@ -29,13 +29,13 @@ 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 { DutchAuctionWrapper } from '../utils/dutch_auction_wrapper'; + chaiSetup.configure(); const expect = chai.expect; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); @@ -68,19 +68,9 @@ 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 dutchAuctionInstance: DutchAuctionContract; + let dutchAuctionWrapper: DutchAuctionWrapper; + let defaultMakerAssetData: string; before(async () => { await blockchainLifecycle.startAsync(); @@ -136,6 +126,7 @@ describe(ContractName.DutchAuction, () => { dutchAuctionInstance.address, provider, ); + dutchAuctionWrapper = new DutchAuctionWrapper(dutchAuctionInstance, provider); defaultMakerAssetAddress = erc20TokenA.address; const defaultTakerAssetAddress = wethContract.address; @@ -174,7 +165,7 @@ describe(ContractName.DutchAuction, () => { feeRecipientAddress, // taker address or sender address should be set to the ducth auction contract takerAddress: dutchAuctionContract.address, - makerAssetData: extendMakerAssetData( + makerAssetData: assetDataUtils.encodeDutchAuctionAssetData( assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), auctionBeginTimeSeconds, auctionBeginAmount, @@ -199,6 +190,7 @@ describe(ContractName.DutchAuction, () => { const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)]; sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams); buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams); + defaultMakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress); }); after(async () => { await blockchainLifecycle.revertAsync(); @@ -215,49 +207,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 = assetDataUtils.encodeDutchAuctionAssetData( + defaultMakerAssetData, + auctionBeginTimeSeconds, + auctionBeginAmount, + ); + sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData }); + const auctionDetails = await dutchAuctionWrapper.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 = assetDataUtils.encodeDutchAuctionAssetData( + defaultMakerAssetData, + 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 dutchAuctionWrapper.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 dutchAuctionWrapper.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 dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(sellOrder); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal( constants.ZERO_AMOUNT, @@ -276,17 +260,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 dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionWrapper.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 +274,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 dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); const newBalances = await erc20Wrapper.getBalancesAsync(); - const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(sellOrder); expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte( erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount), ); @@ -321,24 +287,17 @@ describe(ContractName.DutchAuction, () => { it('should revert when auction expires', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); + const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( + defaultMakerAssetData, + 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, - }, - ), + dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionExpired, ); }); @@ -347,15 +306,7 @@ describe(ContractName.DutchAuction, () => { makerAssetAmount: sellOrder.takerAssetAmount, }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidAmount, ); }); @@ -364,38 +315,23 @@ describe(ContractName.DutchAuction, () => { takerAssetAmount: auctionBeginAmount.plus(1), }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidAmount, ); }); it('begin time is less than end time', async () => { auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds); + const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( + defaultMakerAssetData, + 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, - }, - ), + dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidBeginTime, ); }); @@ -404,45 +340,30 @@ describe(ContractName.DutchAuction, () => { makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), }); return expectTransactionFailedAsync( - dutchAuctionContract.matchOrders.sendTransactionAsync( - buyOrder, - sellOrder, - buyOrder.signature, - sellOrder.signature, - { - from: takerAddress, - }, - ), + dutchAuctionWrapper.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 = assetDataUtils.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 dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + const afterAuctionDetails = await dutchAuctionWrapper.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_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_wrapper.ts new file mode 100644 index 000000000..138b40ca9 --- /dev/null +++ b/contracts/extensions/test/utils/dutch_auction_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 DutchAuctionWrapper { + 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 { + 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 { + const afterAuctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + return afterAuctionDetails; + } +} -- cgit v1.2.3 From 89fcbec43b04a49c45786067f61c539128e1c507 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 20 Dec 2018 10:53:50 -0800 Subject: changed name for confusion --- contracts/extensions/test/extensions/dutch_auction.ts | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index 7a1a546e7..5e1534594 100644 --- a/contracts/extensions/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/extensions/dutch_auction.ts @@ -68,9 +68,8 @@ describe(ContractName.DutchAuction, () => { let erc721MakerAssetIds: BigNumber[]; const tenMinutesInSeconds = 10 * 60; - let dutchAuctionInstance: DutchAuctionContract; let dutchAuctionWrapper: DutchAuctionWrapper; - let defaultMakerAssetData: string; + let defaultERC20MakerAssetData: string; before(async () => { await blockchainLifecycle.startAsync(); @@ -190,7 +189,7 @@ describe(ContractName.DutchAuction, () => { const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)]; sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams); buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams); - defaultMakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress); + defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress); }); after(async () => { await blockchainLifecycle.revertAsync(); @@ -208,7 +207,7 @@ describe(ContractName.DutchAuction, () => { it('should be worth the begin price at the begining of the auction', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2); const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( - defaultMakerAssetData, + defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, ); @@ -222,7 +221,7 @@ describe(ContractName.DutchAuction, () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( - defaultMakerAssetData, + defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, ); @@ -288,7 +287,7 @@ describe(ContractName.DutchAuction, () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( - defaultMakerAssetData, + defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, ); @@ -322,7 +321,7 @@ describe(ContractName.DutchAuction, () => { it('begin time is less than end time', async () => { auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds); const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( - defaultMakerAssetData, + defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, ); -- cgit v1.2.3 From 43b648e7dc1ea49aff3ab1e6883aa6e069fae72f Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Thu, 20 Dec 2018 15:39:19 -0800 Subject: Dutch wrapper --- .../extensions/test/extensions/dutch_auction.ts | 50 +++++++------- .../test/utils/dutch_auction_test_wrapper.ts | 76 ++++++++++++++++++++++ .../extensions/test/utils/dutch_auction_wrapper.ts | 62 ------------------ 3 files changed, 101 insertions(+), 87 deletions(-) create mode 100644 contracts/extensions/test/utils/dutch_auction_test_wrapper.ts delete mode 100644 contracts/extensions/test/utils/dutch_auction_wrapper.ts (limited to 'contracts/extensions') diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index 5e1534594..cd5816810 100644 --- a/contracts/extensions/test/extensions/dutch_auction.ts +++ b/contracts/extensions/test/extensions/dutch_auction.ts @@ -34,7 +34,7 @@ import * as _ from 'lodash'; import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; import { artifacts } from '../../src/artifacts'; -import { DutchAuctionWrapper } from '../utils/dutch_auction_wrapper'; +import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper'; chaiSetup.configure(); const expect = chai.expect; @@ -68,7 +68,7 @@ describe(ContractName.DutchAuction, () => { let erc721MakerAssetIds: BigNumber[]; const tenMinutesInSeconds = 10 * 60; - let dutchAuctionWrapper: DutchAuctionWrapper; + let dutchAuctionTestWrapper: DutchAuctionTestWrapper; let defaultERC20MakerAssetData: string; before(async () => { @@ -125,7 +125,7 @@ describe(ContractName.DutchAuction, () => { dutchAuctionInstance.address, provider, ); - dutchAuctionWrapper = new DutchAuctionWrapper(dutchAuctionInstance, provider); + dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider); defaultMakerAssetAddress = erc20TokenA.address; const defaultTakerAssetAddress = wethContract.address; @@ -164,7 +164,7 @@ describe(ContractName.DutchAuction, () => { feeRecipientAddress, // taker address or sender address should be set to the ducth auction contract takerAddress: dutchAuctionContract.address, - makerAssetData: assetDataUtils.encodeDutchAuctionAssetData( + makerAssetData: DutchAuctionTestWrapper.encodeDutchAuctionAssetData( assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), auctionBeginTimeSeconds, auctionBeginAmount, @@ -206,13 +206,13 @@ describe(ContractName.DutchAuction, () => { describe('matchOrders', () => { it('should be worth the begin price at the begining of the auction', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2); - const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, ); sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData }); - const auctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(sellOrder); + 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); @@ -220,7 +220,7 @@ describe(ContractName.DutchAuction, () => { 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 = assetDataUtils.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -229,18 +229,18 @@ describe(ContractName.DutchAuction, () => { makerAssetData, expirationTimeSeconds: auctionEndTimeSeconds, }); - const auctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(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 dutchAuctionWrapper.getAuctionDetailsAsync(sellOrder); + const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); buyOrder = await buyerOrderFactory.newSignedOrderAsync({ makerAssetAmount: beforeAuctionDetails.currentAmount.times(2), }); - await dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); - const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(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, @@ -259,8 +259,8 @@ describe(ContractName.DutchAuction, () => { sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerFee: new BigNumber(1), }); - await dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); - const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(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), @@ -273,9 +273,9 @@ describe(ContractName.DutchAuction, () => { buyOrder = await buyerOrderFactory.newSignedOrderAsync({ makerFee: new BigNumber(1), }); - await dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); + await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); const newBalances = await erc20Wrapper.getBalancesAsync(); - const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(sellOrder); + const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder); expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte( erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount), ); @@ -286,7 +286,7 @@ describe(ContractName.DutchAuction, () => { it('should revert when auction expires', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); - const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -296,7 +296,7 @@ describe(ContractName.DutchAuction, () => { makerAssetData, }); return expectTransactionFailedAsync( - dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionExpired, ); }); @@ -305,7 +305,7 @@ describe(ContractName.DutchAuction, () => { makerAssetAmount: sellOrder.takerAssetAmount, }); return expectTransactionFailedAsync( - dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidAmount, ); }); @@ -314,13 +314,13 @@ describe(ContractName.DutchAuction, () => { takerAssetAmount: auctionBeginAmount.plus(1), }); return expectTransactionFailedAsync( - dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, 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 = assetDataUtils.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -330,7 +330,7 @@ describe(ContractName.DutchAuction, () => { makerAssetData, }); return expectTransactionFailedAsync( - dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.AuctionInvalidBeginTime, ); }); @@ -339,7 +339,7 @@ describe(ContractName.DutchAuction, () => { makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), }); return expectTransactionFailedAsync( - dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), + dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress), RevertReason.InvalidAssetData, ); }); @@ -348,7 +348,7 @@ describe(ContractName.DutchAuction, () => { it('should match orders when ERC721', async () => { const makerAssetId = erc721MakerAssetIds[0]; const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId); - const makerAssetData = assetDataUtils.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( erc721MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -361,8 +361,8 @@ describe(ContractName.DutchAuction, () => { takerAssetAmount: new BigNumber(1), takerAssetData: sellOrder.makerAssetData, }); - await dutchAuctionWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress); - const afterAuctionDetails = await dutchAuctionWrapper.getAuctionDetailsAsync(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..653b9136c --- /dev/null +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -0,0 +1,76 @@ +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 { BigNumber } from '@0x/utils'; + +import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; +import { artifacts } from '../../src/artifacts'; +import { DutchAuctionWrapper } from '@0x/contract-wrappers'; + +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 { + 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 { + const afterAuctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + return afterAuctionDetails; + } + /** + * Dutch auction details are encoded with the asset data for a 0x order. This function produces a hex + * encoded assetData string, containing information both about the asset being traded and the + * dutch auction; which is usable in the makerAssetData or takerAssetData fields in a 0x order. + * @param assetData Hex encoded assetData string for the asset being auctioned. + * @param beginTimeSeconds Begin time of the dutch auction. + * @param beginAmount Starting amount being sold in the dutch auction. + * @return The hex encoded assetData string. + */ + public static encodeDutchAuctionAssetData(assetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string { + return DutchAuctionWrapper.encodeDutchAuctionAssetData(assetData, beginTimeSeconds, beginAmount); + }; +} diff --git a/contracts/extensions/test/utils/dutch_auction_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_wrapper.ts deleted file mode 100644 index 138b40ca9..000000000 --- a/contracts/extensions/test/utils/dutch_auction_wrapper.ts +++ /dev/null @@ -1,62 +0,0 @@ -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 DutchAuctionWrapper { - 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 { - 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 { - const afterAuctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); - return afterAuctionDetails; - } -} -- cgit v1.2.3 From b249a50d8f0054328a901525af6316133ed64023 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 21 Dec 2018 16:40:11 -0800 Subject: ran prettier --- contracts/extensions/test/utils/dutch_auction_test_wrapper.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts index 653b9136c..ae8f53aa5 100644 --- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -70,7 +70,11 @@ export class DutchAuctionTestWrapper { * @param beginAmount Starting amount being sold in the dutch auction. * @return The hex encoded assetData string. */ - public static encodeDutchAuctionAssetData(assetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string { + public static encodeDutchAuctionAssetData( + assetData: string, + beginTimeSeconds: BigNumber, + beginAmount: BigNumber, + ): string { return DutchAuctionWrapper.encodeDutchAuctionAssetData(assetData, beginTimeSeconds, beginAmount); - }; + } } -- cgit v1.2.3 From cb1bfa0f9790706bf9ce08aad0bf8fd9e2621ce9 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 21 Dec 2018 17:04:17 -0800 Subject: ran prettier + added changelog entry for contract wrappers --- contracts/extensions/package.json | 1 + contracts/extensions/test/extensions/dutch_auction.ts | 14 +++++++------- .../test/utils/dutch_auction_test_wrapper.ts | 18 ------------------ 3 files changed, 8 insertions(+), 25 deletions(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 069b5d2d5..ad45073dc 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -45,6 +45,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md", "devDependencies": { "@0x/abi-gen": "^1.0.19", + "@0x/contract-wrappers": "^4.2.0", "@0x/contracts-test-utils": "^1.0.2", "@0x/dev-utils": "^1.0.21", "@0x/sol-compiler": "^1.1.16", diff --git a/contracts/extensions/test/extensions/dutch_auction.ts b/contracts/extensions/test/extensions/dutch_auction.ts index cd5816810..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, @@ -33,7 +34,6 @@ 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(); @@ -164,7 +164,7 @@ describe(ContractName.DutchAuction, () => { feeRecipientAddress, // taker address or sender address should be set to the ducth auction contract takerAddress: dutchAuctionContract.address, - makerAssetData: DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData( assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress), auctionBeginTimeSeconds, auctionBeginAmount, @@ -206,7 +206,7 @@ describe(ContractName.DutchAuction, () => { describe('matchOrders', () => { it('should be worth the begin price at the begining of the auction', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2); - const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -220,7 +220,7 @@ describe(ContractName.DutchAuction, () => { 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 = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -286,7 +286,7 @@ describe(ContractName.DutchAuction, () => { it('should revert when auction expires', async () => { auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2); auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds); - const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -320,7 +320,7 @@ describe(ContractName.DutchAuction, () => { }); it('begin time is less than end time', async () => { auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds); - const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( defaultERC20MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, @@ -348,7 +348,7 @@ describe(ContractName.DutchAuction, () => { it('should match orders when ERC721', async () => { const makerAssetId = erc721MakerAssetIds[0]; const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId); - const makerAssetData = DutchAuctionTestWrapper.encodeDutchAuctionAssetData( + const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData( erc721MakerAssetData, auctionBeginTimeSeconds, auctionBeginAmount, diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts index ae8f53aa5..4dc83a5e7 100644 --- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -5,11 +5,9 @@ import { DutchAuctionDetails, SignedOrder } from '@0x/types'; import { Web3Wrapper } from '@0x/web3-wrapper'; import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types'; import * as _ from 'lodash'; -import { BigNumber } from '@0x/utils'; import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction'; import { artifacts } from '../../src/artifacts'; -import { DutchAuctionWrapper } from '@0x/contract-wrappers'; export class DutchAuctionTestWrapper { private readonly _dutchAuctionContract: DutchAuctionContract; @@ -61,20 +59,4 @@ export class DutchAuctionTestWrapper { const afterAuctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); return afterAuctionDetails; } - /** - * Dutch auction details are encoded with the asset data for a 0x order. This function produces a hex - * encoded assetData string, containing information both about the asset being traded and the - * dutch auction; which is usable in the makerAssetData or takerAssetData fields in a 0x order. - * @param assetData Hex encoded assetData string for the asset being auctioned. - * @param beginTimeSeconds Begin time of the dutch auction. - * @param beginAmount Starting amount being sold in the dutch auction. - * @return The hex encoded assetData string. - */ - public static encodeDutchAuctionAssetData( - assetData: string, - beginTimeSeconds: BigNumber, - beginAmount: BigNumber, - ): string { - return DutchAuctionWrapper.encodeDutchAuctionAssetData(assetData, beginTimeSeconds, beginAmount); - } } -- cgit v1.2.3 From 6de3a33f365bc73d9c592e96b0d17c7940297613 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Fri, 21 Dec 2018 17:15:43 -0800 Subject: updated relevant changelogs --- contracts/extensions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index ad45073dc..25c2843e8 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" }, -- cgit v1.2.3 From 61a33688264d31be063cd11260d9f37f3774975b Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Sat, 22 Dec 2018 13:11:14 -0800 Subject: `afterAuctionDetails` -> `auctionDetails` --- contracts/extensions/test/utils/dutch_auction_test_wrapper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts index 4dc83a5e7..c1e2f2070 100644 --- a/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts +++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts @@ -56,7 +56,7 @@ export class DutchAuctionTestWrapper { * @return The dutch auction details. */ public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise { - const afterAuctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); - return afterAuctionDetails; + const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder); + return auctionDetails; } } -- cgit v1.2.3 From 5f2a7cb78fd8b937bcecf962071d59a08e46dec5 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Sun, 23 Dec 2018 16:13:43 -0800 Subject: removed manual updte of package.json version --- contracts/extensions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index 25c2843e8..ad45073dc 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -1,6 +1,6 @@ { "name": "@0x/contracts-extensions", - "version": "1.2.0", + "version": "1.0.2", "engines": { "node": ">=6.12" }, -- cgit v1.2.3 From 641685a41e46fe2587699199b5f4ade739bb1fd6 Mon Sep 17 00:00:00 2001 From: Greg Hysen Date: Sun, 23 Dec 2018 16:34:08 -0800 Subject: relaxed version on contract-extension dependencies --- contracts/extensions/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/extensions') diff --git a/contracts/extensions/package.json b/contracts/extensions/package.json index ad45073dc..aee995645 100644 --- a/contracts/extensions/package.json +++ b/contracts/extensions/package.json @@ -45,7 +45,7 @@ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md", "devDependencies": { "@0x/abi-gen": "^1.0.19", - "@0x/contract-wrappers": "^4.2.0", + "@0x/contract-wrappers": "^4.1.3", "@0x/contracts-test-utils": "^1.0.2", "@0x/dev-utils": "^1.0.21", "@0x/sol-compiler": "^1.1.16", -- cgit v1.2.3