aboutsummaryrefslogtreecommitdiffstats
path: root/packages/asset-buyer/src/constants.ts
diff options
context:
space:
mode:
authorRemco Bloemen <remco@wicked.ventures>2018-11-09 01:32:40 +0800
committerRemco Bloemen <remco@wicked.ventures>2018-11-09 01:32:40 +0800
commitd71362af993d3797dbdbfcac245ad57f0086bce3 (patch)
tree888826fe23c2d06d6c9191fb3a238e14f9fe4aac /packages/asset-buyer/src/constants.ts
parenta5665a68756c905637c551fc48c9b7011a55c237 (diff)
parentf6abc007ffb249e4bbf85b8a7a77309d43e0a147 (diff)
downloaddexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.gz
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.bz2
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.lz
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.xz
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.tar.zst
dexon-sol-tools-d71362af993d3797dbdbfcac245ad57f0086bce3.zip
Merge remote-tracking branch 'origin/development' into feature/utils/prettybignum
Diffstat (limited to 'packages/asset-buyer/src/constants.ts')
-rw-r--r--packages/asset-buyer/src/constants.ts40
1 files changed, 40 insertions, 0 deletions
diff --git a/packages/asset-buyer/src/constants.ts b/packages/asset-buyer/src/constants.ts
new file mode 100644
index 000000000..c0e1bf27d
--- /dev/null
+++ b/packages/asset-buyer/src/constants.ts
@@ -0,0 +1,40 @@
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+
+import { AssetBuyerOpts, BuyQuoteExecutionOpts, BuyQuoteRequestOpts, OrdersAndFillableAmounts } from './types';
+
+const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
+const MAINNET_NETWORK_ID = 1;
+
+const DEFAULT_ASSET_BUYER_OPTS: AssetBuyerOpts = {
+ networkId: MAINNET_NETWORK_ID,
+ orderRefreshIntervalMs: 10000, // 10 seconds
+ expiryBufferSeconds: 120, // 2 minutes
+};
+
+const DEFAULT_BUY_QUOTE_REQUEST_OPTS: BuyQuoteRequestOpts = {
+ feePercentage: 0,
+ shouldForceOrderRefresh: false,
+ slippagePercentage: 0.2, // 20% slippage protection
+};
+
+// Other default values are dynamically determined
+const DEFAULT_BUY_QUOTE_EXECUTION_OPTS: BuyQuoteExecutionOpts = {
+ feeRecipient: NULL_ADDRESS,
+};
+
+const EMPTY_ORDERS_AND_FILLABLE_AMOUNTS: OrdersAndFillableAmounts = {
+ orders: [] as SignedOrder[],
+ remainingFillableMakerAssetAmounts: [] as BigNumber[],
+};
+
+export const constants = {
+ ZERO_AMOUNT: new BigNumber(0),
+ NULL_ADDRESS,
+ MAINNET_NETWORK_ID,
+ ETHER_TOKEN_DECIMALS: 18,
+ DEFAULT_ASSET_BUYER_OPTS,
+ DEFAULT_BUY_QUOTE_EXECUTION_OPTS,
+ DEFAULT_BUY_QUOTE_REQUEST_OPTS,
+ EMPTY_ORDERS_AND_FILLABLE_AMOUNTS,
+};