aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/extensions/test/utils
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-21 07:39:19 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-08 07:50:48 +0800
commit43b648e7dc1ea49aff3ab1e6883aa6e069fae72f (patch)
tree7db4b13135cc91a1c217c78766667e85cfc62e14 /contracts/extensions/test/utils
parent89fcbec43b04a49c45786067f61c539128e1c507 (diff)
downloaddexon-0x-contracts-43b648e7dc1ea49aff3ab1e6883aa6e069fae72f.tar.gz
dexon-0x-contracts-43b648e7dc1ea49aff3ab1e6883aa6e069fae72f.tar.zst
dexon-0x-contracts-43b648e7dc1ea49aff3ab1e6883aa6e069fae72f.zip
Dutch wrapper
Diffstat (limited to 'contracts/extensions/test/utils')
-rw-r--r--contracts/extensions/test/utils/dutch_auction_test_wrapper.ts (renamed from contracts/extensions/test/utils/dutch_auction_wrapper.ts)16
1 files changed, 15 insertions, 1 deletions
diff --git a/contracts/extensions/test/utils/dutch_auction_wrapper.ts b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
index 138b40ca9..653b9136c 100644
--- a/contracts/extensions/test/utils/dutch_auction_wrapper.ts
+++ b/contracts/extensions/test/utils/dutch_auction_test_wrapper.ts
@@ -5,11 +5,13 @@ 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 DutchAuctionWrapper {
+export class DutchAuctionTestWrapper {
private readonly _dutchAuctionContract: DutchAuctionContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
@@ -59,4 +61,16 @@ export class DutchAuctionWrapper {
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);
+ };
}