aboutsummaryrefslogtreecommitdiffstats
path: root/packages/forwarder-helper/src
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-08-16 06:20:25 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-08-23 06:39:03 +0800
commit2ef867f398db381ebd8ec715bd108b46d8fa60f3 (patch)
tree6edcb499c5a969e07f504821cde57a8ffe010fc7 /packages/forwarder-helper/src
parent90f2813d0e3cf61c63b308d5cfe738b7beba8c94 (diff)
downloaddexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar.gz
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar.bz2
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar.lz
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar.xz
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.tar.zst
dexon-sol-tools-2ef867f398db381ebd8ec715bd108b46d8fa60f3.zip
Add stubs for ForwarderHelper interface in ForwarderHelperImpl
Diffstat (limited to 'packages/forwarder-helper/src')
-rw-r--r--packages/forwarder-helper/src/forwarder_helper_impl.ts50
-rw-r--r--packages/forwarder-helper/src/types.ts2
2 files changed, 51 insertions, 1 deletions
diff --git a/packages/forwarder-helper/src/forwarder_helper_impl.ts b/packages/forwarder-helper/src/forwarder_helper_impl.ts
index e69de29bb..1069bca73 100644
--- a/packages/forwarder-helper/src/forwarder_helper_impl.ts
+++ b/packages/forwarder-helper/src/forwarder_helper_impl.ts
@@ -0,0 +1,50 @@
+import { SignedOrder } from '@0xproject/types';
+import { BigNumber } from '@0xproject/utils';
+
+import {
+ ForwarderHelper,
+ MarketBuyOrdersInfo,
+ MarketBuyOrdersInfoRequest,
+ MarketSellOrdersInfo,
+ MarketSellOrdersInfoRequest,
+} from './types';
+
+export class ForwarderHelperImpl implements ForwarderHelper {
+ private _orders: SignedOrder[];
+ private _feeOrders: SignedOrder[];
+ private _remainingFillableMakerAssetAmountsIfExists?: BigNumber[];
+ private _remainingFillableFeeAmountsIfExists?: BigNumber[];
+ constructor(
+ orders: SignedOrder[],
+ feeOrders: SignedOrder[] = [] as SignedOrder[],
+ remainingFillableMakerAssetAmounts?: BigNumber[],
+ remainingFillableFeeAmounts?: BigNumber[],
+ ) {
+ this._orders = orders;
+ this._feeOrders = feeOrders;
+ this._remainingFillableMakerAssetAmountsIfExists = remainingFillableMakerAssetAmounts;
+ this._remainingFillableFeeAmountsIfExists = remainingFillableFeeAmounts;
+ }
+ public getMarketBuyOrdersInfo(request: MarketBuyOrdersInfoRequest): MarketBuyOrdersInfo {
+ const { makerAssetFillAmount, feePercentage, acceptableEthAmountRange } = request;
+ return {
+ makerAssetFillAmount,
+ orders: this._orders,
+ feeOrders: this._feeOrders,
+ minEthAmount: new BigNumber(0),
+ maxEthAmount: new BigNumber(0),
+ feePercentage,
+ };
+ }
+ public getMarketSellOrdersInfo(request: MarketSellOrdersInfoRequest): MarketSellOrdersInfo {
+ const { ethAmount, feePercentage, acceptableFillAmountRange } = request;
+ return {
+ ethAmount,
+ orders: this._orders,
+ feeOrders: this._feeOrders,
+ minFillAmount: new BigNumber(0),
+ maxFillAmount: new BigNumber(0),
+ feePercentage,
+ };
+ }
+}
diff --git a/packages/forwarder-helper/src/types.ts b/packages/forwarder-helper/src/types.ts
index 23eaa1281..c6d4083a9 100644
--- a/packages/forwarder-helper/src/types.ts
+++ b/packages/forwarder-helper/src/types.ts
@@ -46,9 +46,9 @@ export interface MarketBuyOrdersInfo {
makerAssetFillAmount: BigNumber;
orders: SignedOrder[];
feeOrders: SignedOrder[];
- feePercentage?: BigNumber;
minEthAmount: BigNumber;
maxEthAmount: BigNumber;
+ feePercentage?: BigNumber;
}
/**