aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.circleci/config.yml2
-rw-r--r--.gitignore2
-rw-r--r--.prettierignore2
-rw-r--r--contracts/core/compiler.json1
-rw-r--r--contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol2
-rw-r--r--contracts/core/contracts/examples/Whitelist/Whitelist.sol2
-rw-r--r--contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol2
-rw-r--r--contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol8
-rw-r--r--contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol6
-rw-r--r--contracts/core/contracts/extensions/Forwarder/MixinWeth.sol2
-rw-r--r--contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol4
-rw-r--r--contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol4
-rw-r--r--contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol2
-rw-r--r--contracts/core/contracts/protocol/Exchange/Exchange.sol2
-rw-r--r--contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol8
-rw-r--r--contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol8
-rw-r--r--contracts/core/contracts/protocol/Exchange/MixinTransactions.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol8
-rw-r--r--contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol4
-rw-r--r--contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol4
-rw-r--r--contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol2
-rw-r--r--contracts/core/package.json3
-rw-r--r--contracts/core/src/artifacts/index.ts2
-rw-r--r--contracts/core/src/wrappers/index.ts1
-rw-r--r--contracts/core/test/extensions/dutch_auction.ts39
-rw-r--r--contracts/core/test/utils/fill_order_combinatorial_utils.ts8
-rw-r--r--contracts/core/tsconfig.json1
-rw-r--r--contracts/libs/.solhint.json20
-rw-r--r--contracts/libs/README.md70
-rw-r--r--contracts/libs/compiler.json22
-rw-r--r--contracts/libs/contracts/libs/LibAbiEncoder.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibAbiEncoder.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibAssetProxyErrors.sol (renamed from contracts/core/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibConstants.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibConstants.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibEIP712.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibEIP712.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibExchangeErrors.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibExchangeErrors.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibFillResults.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibFillResults.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibMath.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibMath.sol)0
-rw-r--r--contracts/libs/contracts/libs/LibOrder.sol (renamed from contracts/core/contracts/protocol/Exchange/libs/LibOrder.sol)0
-rw-r--r--contracts/libs/contracts/test/TestLibs/TestLibs.sol (renamed from contracts/core/contracts/test/TestLibs/TestLibs.sol)8
-rw-r--r--contracts/libs/package.json92
-rw-r--r--contracts/libs/src/artifacts/index.ts17
-rw-r--r--contracts/libs/src/index.ts2
-rw-r--r--contracts/libs/src/wrappers/index.ts6
-rw-r--r--contracts/libs/test/exchange/libs.ts (renamed from contracts/core/test/exchange/libs.ts)0
-rw-r--r--contracts/libs/test/global_hooks.ts17
-rw-r--r--contracts/libs/tsconfig.json18
-rw-r--r--contracts/libs/tslint.json6
-rw-r--r--packages/instant/.DS_Storebin0 -> 8196 bytes
-rw-r--r--packages/instant/.dogfood.discharge.json2
-rw-r--r--packages/instant/.production.discharge.json2
-rw-r--r--packages/instant/.staging.discharge.json2
-rw-r--r--packages/instant/src/components/buy_order_progress.tsx2
-rw-r--r--packages/instant/src/components/instant_heading.tsx2
-rw-r--r--packages/instant/src/components/order_details.tsx2
-rw-r--r--packages/instant/src/components/payment_method.tsx10
-rw-r--r--packages/instant/src/components/scaling_amount_input.tsx5
-rw-r--r--packages/instant/src/components/ui/overlay.tsx2
-rw-r--r--packages/instant/src/components/wallet_prompt.tsx4
-rw-r--r--packages/instant/src/components/zero_ex_instant_container.tsx2
-rw-r--r--packages/instant/src/components/zero_ex_instant_overlay.tsx10
-rw-r--r--packages/instant/src/constants.ts5
-rw-r--r--packages/instant/src/index.umd.ts12
-rw-r--r--packages/instant/src/redux/analytics_middleware.ts18
-rw-r--r--packages/instant/src/style/theme.ts4
-rw-r--r--packages/instant/src/util/analytics.ts12
-rw-r--r--packages/instant/src/util/error_reporter.ts4
-rw-r--r--packages/website/translations/chinese.json6
-rw-r--r--packages/website/translations/english.json2
-rw-r--r--packages/website/translations/korean.json2
-rw-r--r--packages/website/translations/russian.json6
-rw-r--r--packages/website/translations/spanish.json6
-rw-r--r--packages/website/ts/components/footer.tsx4
-rw-r--r--packages/website/ts/pages/faq/faq.tsx2
-rw-r--r--packages/website/ts/types.ts2
-rw-r--r--packages/website/ts/utils/constants.ts2
79 files changed, 418 insertions, 141 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml
index eab912934..d11c7fcae 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -42,6 +42,7 @@ jobs:
- repo-{{ .Environment.CIRCLE_SHA1 }}
- run: yarn wsrun test:circleci @0x/contracts-multisig
- run: yarn wsrun test:circleci @0x/contracts-utils
+ - run: yarn wsrun test:circleci @0x/contracts-libs
- run: yarn wsrun test:circleci @0x/contracts-core
test-contracts-geth:
docker:
@@ -56,6 +57,7 @@ jobs:
# initialized
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test @0x/contracts-multisig
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-utils
+ - run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-libs
- run: TEST_PROVIDER=geth yarn wsrun test @0x/contracts-core
test-publish:
resource_class: medium+
diff --git a/.gitignore b/.gitignore
index 7db118507..da7620a78 100644
--- a/.gitignore
+++ b/.gitignore
@@ -86,6 +86,7 @@ packages/testnet-faucets/server/
contracts/core/generated-artifacts/
contracts/multisig/generated-artifacts/
contracts/utils/generated-artifacts/
+contracts/libs/generated-artifacts/
packages/sol-cov/test/fixtures/artifacts/
packages/metacoin/artifacts/
@@ -94,6 +95,7 @@ packages/abi-gen-wrappers/wrappers
contracts/core/generated-wrappers/
contracts/multisig/generated-wrappers/
contracts/utils/generated-wrappers/
+contracts/libs/generated-wrappers/
packages/metacoin/src/contract_wrappers
# solc-bin in sol-compiler
diff --git a/.prettierignore b/.prettierignore
index 9684a83b7..43c8015fd 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -6,6 +6,8 @@ lib
/contracts/multisig/generated-artifacts
/contracts/utils/generated-wrappers
/contracts/utils/generated-artifacts
+/contracts/libs/generated-wrappers
+/contracts/libs/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
diff --git a/contracts/core/compiler.json b/contracts/core/compiler.json
index 8d9732794..7e527130a 100644
--- a/contracts/core/compiler.json
+++ b/contracts/core/compiler.json
@@ -44,7 +44,6 @@
"ReentrantERC20Token",
"TestAssetProxyOwner",
"TestAssetProxyDispatcher",
- "TestLibs",
"TestExchangeInternals",
"TestSignatureValidator",
"TestStaticCallReceiver",
diff --git a/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol b/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
index 2fa0e3c5e..ca5a64a26 100644
--- a/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
+++ b/contracts/core/contracts/examples/ExchangeWrapper/ExchangeWrapper.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
contract ExchangeWrapper {
diff --git a/contracts/core/contracts/examples/Whitelist/Whitelist.sol b/contracts/core/contracts/examples/Whitelist/Whitelist.sol
index 61c21c095..cfcddddd3 100644
--- a/contracts/core/contracts/examples/Whitelist/Whitelist.sol
+++ b/contracts/core/contracts/examples/Whitelist/Whitelist.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
diff --git a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol b/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
index dfd4c46dc..a40991ae7 100644
--- a/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
+++ b/contracts/core/contracts/extensions/DutchAuction/DutchAuction.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "../../tokens/ERC20Token/IERC20Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol b/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
index 4991c0ea5..210eb14c2 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
+++ b/contracts/core/contracts/extensions/Forwarder/MixinExchangeWrapper.sol
@@ -21,10 +21,10 @@ pragma experimental ABIEncoderV2;
import "./libs/LibConstants.sol";
import "./mixins/MExchangeWrapper.sol";
-import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
contract MixinExchangeWrapper is
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol b/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol
index a5dd99225..bab78d79b 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol
+++ b/contracts/core/contracts/extensions/Forwarder/MixinForwarderCore.sol
@@ -25,9 +25,9 @@ import "./mixins/MAssets.sol";
import "./mixins/MExchangeWrapper.sol";
import "./interfaces/IForwarderCore.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
contract MixinForwarderCore is
diff --git a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol b/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol
index d2814a49b..2a281f3ae 100644
--- a/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol
+++ b/contracts/core/contracts/extensions/Forwarder/MixinWeth.sol
@@ -18,7 +18,7 @@
pragma solidity 0.4.24;
-import "../../protocol/Exchange/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
import "./libs/LibConstants.sol";
import "./mixins/MWeth.sol";
diff --git a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol b/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
index 74c7da01d..eede20bb8 100644
--- a/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
+++ b/contracts/core/contracts/extensions/Forwarder/interfaces/IForwarderCore.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../../protocol/Exchange/libs/LibOrder.sol";
-import "../../../protocol/Exchange/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
contract IForwarderCore {
diff --git a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol b/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
index 13c26b03a..d9e71786a 100644
--- a/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
+++ b/contracts/core/contracts/extensions/Forwarder/mixins/MExchangeWrapper.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../../protocol/Exchange/libs/LibOrder.sol";
-import "../../../protocol/Exchange/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
contract MExchangeWrapper {
diff --git a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol b/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
index e3f4f6832..9e9e63e9b 100644
--- a/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
+++ b/contracts/core/contracts/extensions/OrderValidator/OrderValidator.sol
@@ -20,7 +20,7 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
import "../../tokens/ERC20Token/IERC20Token.sol";
import "../../tokens/ERC721Token/IERC721Token.sol";
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/Exchange.sol b/contracts/core/contracts/protocol/Exchange/Exchange.sol
index ead36009f..65ca742ea 100644
--- a/contracts/core/contracts/protocol/Exchange/Exchange.sol
+++ b/contracts/core/contracts/protocol/Exchange/Exchange.sol
@@ -19,7 +19,7 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "./libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
import "./MixinExchangeCore.sol";
import "./MixinSignatureValidator.sol";
import "./MixinWrapperFunctions.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol b/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol
index da721f78f..68d6a3897 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol
+++ b/contracts/core/contracts/protocol/Exchange/MixinExchangeCore.sol
@@ -20,10 +20,10 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibConstants.sol";
-import "./libs/LibFillResults.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol b/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol
index da1e9d270..fc6d73482 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol
+++ b/contracts/core/contracts/protocol/Exchange/MixinMatchOrders.sol
@@ -15,10 +15,10 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibConstants.sol";
-import "./libs/LibMath.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MMatchOrders.sol";
import "./mixins/MTransactions.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol b/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol
index 3a76ca202..87c614382 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol
+++ b/contracts/core/contracts/protocol/Exchange/MixinTransactions.sol
@@ -17,10 +17,10 @@
*/
pragma solidity 0.4.24;
-import "./libs/LibExchangeErrors.sol";
+import "@0x/contracts-libs/contracts/libs/LibExchangeErrors.sol";
import "./mixins/MSignatureValidator.sol";
import "./mixins/MTransactions.sol";
-import "./libs/LibEIP712.sol";
+import "@0x/contracts-libs/contracts/libs/LibEIP712.sol";
contract MixinTransactions is
diff --git a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol b/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol
index 415246358..2d43432ff 100644
--- a/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol
+++ b/contracts/core/contracts/protocol/Exchange/MixinWrapperFunctions.sol
@@ -20,10 +20,10 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
-import "./libs/LibMath.sol";
-import "./libs/LibOrder.sol";
-import "./libs/LibFillResults.sol";
-import "./libs/LibAbiEncoder.sol";
+import "@0x/contracts-libs/contracts/libs/LibMath.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
import "./mixins/MExchangeCore.sol";
import "./mixins/MWrapperFunctions.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol b/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
index 9995e0385..0da73529c 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
+++ b/contracts/core/contracts/protocol/Exchange/interfaces/IExchangeCore.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
contract IExchangeCore {
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol b/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
index 73447f3ae..b88e158c3 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
+++ b/contracts/core/contracts/protocol/Exchange/interfaces/IMatchOrders.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
contract IMatchOrders {
diff --git a/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol b/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
index 56a533646..833bb7e88 100644
--- a/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
+++ b/contracts/core/contracts/protocol/Exchange/interfaces/IWrapperFunctions.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
contract IWrapperFunctions {
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol b/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol
index 742499568..099bdcc33 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol
+++ b/contracts/core/contracts/protocol/Exchange/mixins/MExchangeCore.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
import "../interfaces/IExchangeCore.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol b/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol
index 96fa34bc0..bb285de03 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol
+++ b/contracts/core/contracts/protocol/Exchange/mixins/MMatchOrders.sol
@@ -18,8 +18,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
import "../interfaces/IMatchOrders.sol";
diff --git a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol b/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
index 4adfbde01..2d21bf057 100644
--- a/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
+++ b/contracts/core/contracts/protocol/Exchange/mixins/MWrapperFunctions.sol
@@ -19,8 +19,8 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../libs/LibOrder.sol";
-import "../libs/LibFillResults.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
import "../interfaces/IWrapperFunctions.sol";
diff --git a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol b/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
index 3e9091931..8e077e3e8 100644
--- a/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
+++ b/contracts/core/contracts/test/ReentrantERC20Token/ReentrantERC20Token.sol
@@ -22,7 +22,7 @@ pragma experimental ABIEncoderV2;
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
import "../../tokens/ERC20Token/ERC20Token.sol";
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
+import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
// solhint-disable no-unused-vars
diff --git a/contracts/core/package.json b/contracts/core/package.json
index 701e1866e..43fa9370e 100644
--- a/contracts/core/package.json
+++ b/contracts/core/package.json
@@ -33,7 +33,7 @@
"lint-contracts": "solhint contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DutchAuction|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiAssetProxy|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json"
+ "abis": "generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DutchAuction|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiAssetProxy|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
@@ -76,6 +76,7 @@
"@0x/order-utils": "^3.0.4",
"@0x/contracts-multisig": "^1.0.0",
"@0x/contracts-utils": "^1.0.0",
+ "@0x/contracts-libs": "^1.0.0",
"@0x/types": "^1.3.0",
"@0x/typescript-typings": "^3.0.4",
"@0x/utils": "^2.0.6",
diff --git a/contracts/core/src/artifacts/index.ts b/contracts/core/src/artifacts/index.ts
index b925ec87f..d578c36fe 100644
--- a/contracts/core/src/artifacts/index.ts
+++ b/contracts/core/src/artifacts/index.ts
@@ -26,7 +26,6 @@ import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20To
import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
-import * as TestLibs from '../../generated-artifacts/TestLibs.json';
import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
import * as Validator from '../../generated-artifacts/Validator.json';
@@ -62,7 +61,6 @@ export const artifacts = {
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
- TestLibs: TestLibs as ContractArtifact,
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
Validator: Validator as ContractArtifact,
diff --git a/contracts/core/src/wrappers/index.ts b/contracts/core/src/wrappers/index.ts
index 0a64a4db0..ed9d8ef47 100644
--- a/contracts/core/src/wrappers/index.ts
+++ b/contracts/core/src/wrappers/index.ts
@@ -21,7 +21,6 @@ export * from '../../generated-wrappers/reentrant_erc20_token';
export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
export * from '../../generated-wrappers/test_asset_proxy_owner';
export * from '../../generated-wrappers/test_exchange_internals';
-export * from '../../generated-wrappers/test_libs';
export * from '../../generated-wrappers/test_signature_validator';
export * from '../../generated-wrappers/test_static_call_receiver';
export * from '../../generated-wrappers/validator';
diff --git a/contracts/core/test/extensions/dutch_auction.ts b/contracts/core/test/extensions/dutch_auction.ts
index 6bed222f4..54e6092d7 100644
--- a/contracts/core/test/extensions/dutch_auction.ts
+++ b/contracts/core/test/extensions/dutch_auction.ts
@@ -62,16 +62,6 @@ describe(ContractName.DutchAuction, () => {
let erc721MakerAssetIds: BigNumber[];
const tenMinutesInSeconds = 10 * 60;
- async function increaseTimeAsync(): Promise<void> {
- const timestampBefore = await getLatestBlockTimestampAsync();
- await web3Wrapper.increaseTimeAsync(5);
- const timestampAfter = await getLatestBlockTimestampAsync();
- // HACK send some transactions when a time increase isn't supported
- if (timestampAfter === timestampBefore) {
- await web3Wrapper.sendTransactionAsync({ to: makerAddress, from: makerAddress, value: new BigNumber(1) });
- }
- }
-
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
return ethUtil.bufferToHex(
Buffer.concat([
@@ -276,34 +266,6 @@ describe(ContractName.DutchAuction, () => {
erc20Balances[takerAddress][wethContract.address].minus(beforeAuctionDetails.currentAmount),
);
});
- it('should have valid getAuctionDetails at some block in the future', async () => {
- let auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
- const beforeAmount = auctionDetails.currentAmount;
- await increaseTimeAsync();
- auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
- const currentAmount = auctionDetails.currentAmount;
- expect(beforeAmount).to.be.bignumber.greaterThan(currentAmount);
-
- buyOrder = await buyerOrderFactory.newSignedOrderAsync({
- makerAssetAmount: currentAmount,
- });
- const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
- buyOrder,
- sellOrder,
- buyOrder.signature,
- sellOrder.signature,
- {
- from: takerAddress,
- // HACK geth seems to miscalculate the gas required intermittently
- gas: 400000,
- },
- );
- await web3Wrapper.awaitTransactionSuccessAsync(txHash);
- const newBalances = await erc20Wrapper.getBalancesAsync();
- expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.equal(
- erc20Balances[makerAddress][wethContract.address].plus(currentAmount),
- );
- });
it('maker fees on sellOrder are paid to the fee receipient', async () => {
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerFee: new BigNumber(1),
@@ -375,7 +337,6 @@ describe(ContractName.DutchAuction, () => {
);
});
it('cannot be filled for less than the current price', async () => {
- await increaseTimeAsync();
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
makerAssetAmount: sellOrder.takerAssetAmount,
});
diff --git a/contracts/core/test/utils/fill_order_combinatorial_utils.ts b/contracts/core/test/utils/fill_order_combinatorial_utils.ts
index 6372ad29a..5d0ea07a8 100644
--- a/contracts/core/test/utils/fill_order_combinatorial_utils.ts
+++ b/contracts/core/test/utils/fill_order_combinatorial_utils.ts
@@ -1,3 +1,4 @@
+import { artifacts as libsArtifacts, TestLibsContract } from '@0x/contracts-libs';
import {
AllowanceAmountScenario,
AssetDataScenario,
@@ -32,7 +33,6 @@ import * as _ from 'lodash';
import 'make-promises-safe';
import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
-import { TestLibsContract } from '../../generated-wrappers/test_libs';
import { artifacts } from '../../src/artifacts';
import { AssetWrapper } from './asset_wrapper';
@@ -131,7 +131,11 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
exchangeContract.address,
);
- const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
+ const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(
+ libsArtifacts.TestLibs,
+ provider,
+ txDefaults,
+ );
const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
orderFactory,
diff --git a/contracts/core/tsconfig.json b/contracts/core/tsconfig.json
index 82d37b51e..f2f3c4e97 100644
--- a/contracts/core/tsconfig.json
+++ b/contracts/core/tsconfig.json
@@ -33,7 +33,6 @@
"./generated-artifacts/TestAssetProxyDispatcher.json",
"./generated-artifacts/TestAssetProxyOwner.json",
"./generated-artifacts/TestExchangeInternals.json",
- "./generated-artifacts/TestLibs.json",
"./generated-artifacts/TestSignatureValidator.json",
"./generated-artifacts/TestStaticCallReceiver.json",
"./generated-artifacts/Validator.json",
diff --git a/contracts/libs/.solhint.json b/contracts/libs/.solhint.json
new file mode 100644
index 000000000..076afe9f3
--- /dev/null
+++ b/contracts/libs/.solhint.json
@@ -0,0 +1,20 @@
+{
+ "extends": "default",
+ "rules": {
+ "avoid-low-level-calls": false,
+ "avoid-tx-origin": "warn",
+ "bracket-align": false,
+ "code-complexity": false,
+ "const-name-snakecase": "error",
+ "expression-indent": "error",
+ "function-max-lines": false,
+ "func-order": "error",
+ "indent": ["error", 4],
+ "max-line-length": ["warn", 160],
+ "no-inline-assembly": false,
+ "quotes": ["error", "double"],
+ "separate-by-one-line-in-contract": "error",
+ "space-after-comma": "error",
+ "statement-indent": "error"
+ }
+}
diff --git a/contracts/libs/README.md b/contracts/libs/README.md
new file mode 100644
index 000000000..66eedf6be
--- /dev/null
+++ b/contracts/libs/README.md
@@ -0,0 +1,70 @@
+## Contracts libs
+
+Smart contracts libs used in the 0x protocol.
+
+## Usage
+
+Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
+
+* [libs](./contracts/protocol)
+ * This directory contains the libs.
+* [test](./contracts/test)
+ * This directory contains mocks and other contracts that are used solely for testing contracts within the other directories.
+
+## Contributing
+
+We strongly recommend that the community help us make improvements and determine the future direction of the protocol. To report bugs within this package, please create an issue in this repository.
+
+For proposals regarding the 0x protocol's smart contract architecture, message format, or additional functionality, go to the [0x Improvement Proposals (ZEIPs)](https://github.com/0xProject/ZEIPs) repository and follow the contribution guidelines provided therein.
+
+Please read our [contribution guidelines](../../CONTRIBUTING.md) before getting started.
+
+### Install Dependencies
+
+If you don't have yarn workspaces enabled (Yarn < v1.0) - enable them:
+
+```bash
+yarn config set workspaces-experimental true
+```
+
+Then install dependencies
+
+```bash
+yarn install
+```
+
+### Build
+
+To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
+
+```bash
+PKG=@0x/contracts-libs yarn build
+```
+
+Or continuously rebuild on change:
+
+```bash
+PKG=@0x/contracts-libs yarn watch
+```
+
+### Clean
+
+```bash
+yarn clean
+```
+
+### Lint
+
+```bash
+yarn lint
+```
+
+### Run Tests
+
+```bash
+yarn test
+```
+
+#### Testing options
+
+Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
diff --git a/contracts/libs/compiler.json b/contracts/libs/compiler.json
new file mode 100644
index 000000000..cf7c52a73
--- /dev/null
+++ b/contracts/libs/compiler.json
@@ -0,0 +1,22 @@
+{
+ "artifactsDir": "./generated-artifacts",
+ "contractsDir": "./contracts",
+ "compilerSettings": {
+ "optimizer": {
+ "enabled": true,
+ "runs": 1000000
+ },
+ "outputSelection": {
+ "*": {
+ "*": [
+ "abi",
+ "evm.bytecode.object",
+ "evm.bytecode.sourceMap",
+ "evm.deployedBytecode.object",
+ "evm.deployedBytecode.sourceMap"
+ ]
+ }
+ }
+ },
+ "contracts": ["TestLibs", "LibOrder", "LibMath", "LibFillResults", "LibAbiEncoder", "LibEIP712"]
+}
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibAbiEncoder.sol b/contracts/libs/contracts/libs/LibAbiEncoder.sol
index 4aad37709..4aad37709 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibAbiEncoder.sol
+++ b/contracts/libs/contracts/libs/LibAbiEncoder.sol
diff --git a/contracts/core/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol b/contracts/libs/contracts/libs/LibAssetProxyErrors.sol
index 1d9a70cc1..1d9a70cc1 100644
--- a/contracts/core/contracts/protocol/AssetProxy/libs/LibAssetProxyErrors.sol
+++ b/contracts/libs/contracts/libs/LibAssetProxyErrors.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibConstants.sol b/contracts/libs/contracts/libs/LibConstants.sol
index 8d2732cd3..8d2732cd3 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibConstants.sol
+++ b/contracts/libs/contracts/libs/LibConstants.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibEIP712.sol b/contracts/libs/contracts/libs/LibEIP712.sol
index 203edc1fd..203edc1fd 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibEIP712.sol
+++ b/contracts/libs/contracts/libs/LibEIP712.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibExchangeErrors.sol b/contracts/libs/contracts/libs/LibExchangeErrors.sol
index a0f75bc06..a0f75bc06 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibExchangeErrors.sol
+++ b/contracts/libs/contracts/libs/LibExchangeErrors.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibFillResults.sol b/contracts/libs/contracts/libs/LibFillResults.sol
index fbd9950bf..fbd9950bf 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibFillResults.sol
+++ b/contracts/libs/contracts/libs/LibFillResults.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibMath.sol b/contracts/libs/contracts/libs/LibMath.sol
index b24876a9c..b24876a9c 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibMath.sol
+++ b/contracts/libs/contracts/libs/LibMath.sol
diff --git a/contracts/core/contracts/protocol/Exchange/libs/LibOrder.sol b/contracts/libs/contracts/libs/LibOrder.sol
index 0fe7c2161..0fe7c2161 100644
--- a/contracts/core/contracts/protocol/Exchange/libs/LibOrder.sol
+++ b/contracts/libs/contracts/libs/LibOrder.sol
diff --git a/contracts/core/contracts/test/TestLibs/TestLibs.sol b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
index a10f981fc..bd5f9f9da 100644
--- a/contracts/core/contracts/test/TestLibs/TestLibs.sol
+++ b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
@@ -19,10 +19,10 @@
pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
-import "../../protocol/Exchange/libs/LibMath.sol";
-import "../../protocol/Exchange/libs/LibOrder.sol";
-import "../../protocol/Exchange/libs/LibFillResults.sol";
-import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
+import "../../libs/LibMath.sol";
+import "../../libs/LibOrder.sol";
+import "../../libs/LibFillResults.sol";
+import "../../libs/LibAbiEncoder.sol";
contract TestLibs is
diff --git a/contracts/libs/package.json b/contracts/libs/package.json
new file mode 100644
index 000000000..74288be76
--- /dev/null
+++ b/contracts/libs/package.json
@@ -0,0 +1,92 @@
+{
+ "private": true,
+ "name": "@0x/contracts-libs",
+ "version": "1.0.0",
+ "engines": {
+ "node": ">=6.12"
+ },
+ "description": "Smart contract libs of 0x protocol",
+ "main": "lib/src/index.js",
+ "directories": {
+ "test": "test"
+ },
+ "scripts": {
+ "build": "yarn pre_build && tsc -b",
+ "build:ci": "yarn build",
+ "pre_build": "run-s compile generate_contract_wrappers",
+ "test": "yarn run_mocha",
+ "rebuild_and_test": "run-s build test",
+ "test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
+ "test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
+ "test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
+ "run_mocha":
+ "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
+ "compile": "sol-compiler --contracts-dir contracts",
+ "clean": "shx rm -rf lib generated-artifacts generated-wrappers",
+ "generate_contract_wrappers": "abi-gen --abis ${npm_package_config_abis} --template ../../node_modules/@0x/abi-gen-templates/contract.handlebars --partials '../../node_modules/@0x/abi-gen-templates/partials/**/*.handlebars' --output generated-wrappers --backend ethers",
+ "lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
+ "coverage:report:text": "istanbul report text",
+ "coverage:report:html": "istanbul report html && open coverage/index.html",
+ "profiler:report:html": "istanbul report html && open coverage/index.html",
+ "coverage:report:lcov": "istanbul report lcov",
+ "test:circleci": "yarn test",
+ "lint-contracts": "solhint contracts/**/**/**/**/*.sol"
+ },
+ "config": {
+ "abis": "generated-artifacts/@(LibMath|LibOrder|LibFillResults|LibAbiEncoder|TestLibs|LibEIP712).json"
+ },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/0xProject/0x-monorepo.git"
+ },
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/0xProject/0x-monorepo/issues"
+ },
+ "homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
+ "devDependencies": {
+ "@0x/contracts-test-utils": "^1.0.0",
+ "@0x/abi-gen": "^1.0.17",
+ "@0x/dev-utils": "^1.0.19",
+ "@0x/sol-compiler": "^1.1.14",
+ "@0x/sol-cov": "^2.1.14",
+ "@0x/subproviders": "^2.1.6",
+ "@0x/tslint-config": "^1.0.10",
+ "@types/bn.js": "^4.11.0",
+ "@types/lodash": "4.14.104",
+ "@types/node": "*",
+ "@types/yargs": "^10.0.0",
+ "chai": "^4.0.1",
+ "chai-as-promised": "^7.1.0",
+ "chai-bignumber": "^2.0.1",
+ "dirty-chai": "^2.0.1",
+ "make-promises-safe": "^1.1.0",
+ "ethereumjs-abi": "0.6.5",
+ "mocha": "^4.1.0",
+ "npm-run-all": "^4.1.2",
+ "shx": "^0.2.2",
+ "solc": "^0.4.24",
+ "solhint": "^1.2.1",
+ "tslint": "5.11.0",
+ "typescript": "3.0.1",
+ "yargs": "^10.0.3"
+ },
+ "dependencies": {
+ "@0x/base-contract": "^3.0.8",
+ "@0x/order-utils": "^3.0.4",
+ "@0x/contracts-multisig": "^1.0.0",
+ "@0x/contracts-utils": "^1.0.0",
+ "@0x/types": "^1.3.0",
+ "@0x/typescript-typings": "^3.0.4",
+ "@0x/utils": "^2.0.6",
+ "@0x/web3-wrapper": "^3.1.6",
+ "@types/js-combinatorics": "^0.5.29",
+ "bn.js": "^4.11.8",
+ "ethereum-types": "^1.1.2",
+ "ethereumjs-util": "^5.1.1",
+ "lodash": "^4.17.5"
+ },
+ "publishConfig": {
+ "access": "public"
+ }
+}
diff --git a/contracts/libs/src/artifacts/index.ts b/contracts/libs/src/artifacts/index.ts
new file mode 100644
index 000000000..3955bbe2b
--- /dev/null
+++ b/contracts/libs/src/artifacts/index.ts
@@ -0,0 +1,17 @@
+import { ContractArtifact } from 'ethereum-types';
+
+import * as LibAbiEncoder from '../../generated-artifacts/LibAbiEncoder.json';
+import * as LibEIP721 from '../../generated-artifacts/LibEIP712.json';
+import * as LibFillResults from '../../generated-artifacts/LibFillResults.json';
+import * as LibMath from '../../generated-artifacts/LibMath.json';
+import * as LibOrder from '../../generated-artifacts/LibOrder.json';
+import * as TestLibs from '../../generated-artifacts/TestLibs.json';
+
+export const artifacts = {
+ TestLibs: TestLibs as ContractArtifact,
+ LibAbiEncoder: LibAbiEncoder as ContractArtifact,
+ LibFillResults: LibFillResults as ContractArtifact,
+ LibMath: LibMath as ContractArtifact,
+ LibOrder: LibOrder as ContractArtifact,
+ LibEIP721: LibEIP721 as ContractArtifact,
+};
diff --git a/contracts/libs/src/index.ts b/contracts/libs/src/index.ts
new file mode 100644
index 000000000..d55f08ea2
--- /dev/null
+++ b/contracts/libs/src/index.ts
@@ -0,0 +1,2 @@
+export * from './artifacts';
+export * from './wrappers';
diff --git a/contracts/libs/src/wrappers/index.ts b/contracts/libs/src/wrappers/index.ts
new file mode 100644
index 000000000..baaae6e34
--- /dev/null
+++ b/contracts/libs/src/wrappers/index.ts
@@ -0,0 +1,6 @@
+export * from '../../generated-wrappers/test_libs';
+export * from '../../generated-wrappers/lib_abi_encoder';
+export * from '../../generated-wrappers/lib_fill_results';
+export * from '../../generated-wrappers/lib_math';
+export * from '../../generated-wrappers/lib_order';
+export * from '../../generated-wrappers/lib_e_i_p712';
diff --git a/contracts/core/test/exchange/libs.ts b/contracts/libs/test/exchange/libs.ts
index 44ff6a844..44ff6a844 100644
--- a/contracts/core/test/exchange/libs.ts
+++ b/contracts/libs/test/exchange/libs.ts
diff --git a/contracts/libs/test/global_hooks.ts b/contracts/libs/test/global_hooks.ts
new file mode 100644
index 000000000..f8ace376a
--- /dev/null
+++ b/contracts/libs/test/global_hooks.ts
@@ -0,0 +1,17 @@
+import { env, EnvVars } from '@0x/dev-utils';
+
+import { coverage, profiler, provider } from '@0x/contracts-test-utils';
+before('start web3 provider', () => {
+ provider.start();
+});
+after('generate coverage report', async () => {
+ if (env.parseBoolean(EnvVars.SolidityCoverage)) {
+ const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
+ await coverageSubprovider.writeCoverageAsync();
+ }
+ if (env.parseBoolean(EnvVars.SolidityProfiler)) {
+ const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
+ await profilerSubprovider.writeProfilerOutputAsync();
+ }
+ provider.stop();
+});
diff --git a/contracts/libs/tsconfig.json b/contracts/libs/tsconfig.json
new file mode 100644
index 000000000..27ca35085
--- /dev/null
+++ b/contracts/libs/tsconfig.json
@@ -0,0 +1,18 @@
+{
+ "extends": "../../tsconfig",
+ "compilerOptions": {
+ "outDir": "lib",
+ "rootDir": ".",
+ "resolveJsonModule": true
+ },
+ "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
+ "files": [
+ "./generated-artifacts/TestLibs.json",
+ "./generated-artifacts/LibOrder.json",
+ "./generated-artifacts/LibFillResults.json",
+ "./generated-artifacts/LibAbiEncoder.json",
+ "./generated-artifacts/LibEIP712.json",
+ "./generated-artifacts/LibMath.json"
+ ],
+ "exclude": ["./deploy/solc/solc_bin"]
+}
diff --git a/contracts/libs/tslint.json b/contracts/libs/tslint.json
new file mode 100644
index 000000000..1bb3ac2a2
--- /dev/null
+++ b/contracts/libs/tslint.json
@@ -0,0 +1,6 @@
+{
+ "extends": ["@0x/tslint-config"],
+ "rules": {
+ "custom-no-magic-numbers": false
+ }
+}
diff --git a/packages/instant/.DS_Store b/packages/instant/.DS_Store
new file mode 100644
index 000000000..9a0cceca6
--- /dev/null
+++ b/packages/instant/.DS_Store
Binary files differ
diff --git a/packages/instant/.dogfood.discharge.json b/packages/instant/.dogfood.discharge.json
index 5d6a09a16..651b3daa6 100644
--- a/packages/instant/.dogfood.discharge.json
+++ b/packages/instant/.dogfood.discharge.json
@@ -1,6 +1,6 @@
{
"domain": "0x-instant-dogfood",
- "build_command": "WEBPACK_OUTPUT_PATH=public dotenv yarn build --env.discharge_target=dogfood",
+ "build_command": "WEBPACK_OUTPUT_PATH=public dotenv yarn build -- --env.discharge_target=dogfood",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
diff --git a/packages/instant/.production.discharge.json b/packages/instant/.production.discharge.json
index 947f68b1a..1ce39fdd8 100644
--- a/packages/instant/.production.discharge.json
+++ b/packages/instant/.production.discharge.json
@@ -1,6 +1,6 @@
{
"domain": "instant.0xproject.com",
- "build_command": "dotenv yarn build --env.discharge_target=production",
+ "build_command": "dotenv yarn build -- --env.discharge_target=production",
"upload_directory": "umd",
"index_key": "instant.js",
"error_key": "404.html",
diff --git a/packages/instant/.staging.discharge.json b/packages/instant/.staging.discharge.json
index bd5f28ba8..844e3ca4e 100644
--- a/packages/instant/.staging.discharge.json
+++ b/packages/instant/.staging.discharge.json
@@ -1,6 +1,6 @@
{
"domain": "0x-instant-staging",
- "build_command": "dotenv WEBPACK_OUTPUT_PATH=public yarn build --env.discharge_target=staging",
+ "build_command": "WEBPACK_OUTPUT_PATH=public dotenv yarn build -- --env.discharge_target=staging",
"upload_directory": "public",
"index_key": "index.html",
"error_key": "index.html",
diff --git a/packages/instant/src/components/buy_order_progress.tsx b/packages/instant/src/components/buy_order_progress.tsx
index 6568de91b..a19f5a4d0 100644
--- a/packages/instant/src/components/buy_order_progress.tsx
+++ b/packages/instant/src/components/buy_order_progress.tsx
@@ -21,7 +21,7 @@ export const BuyOrderProgress: React.StatelessComponent<BuyOrderProgressProps> =
const hasEnded = buyOrderState.processState !== OrderProcessState.Processing;
const expectedTimeMs = progress.expectedEndTimeUnix - progress.startTimeUnix;
return (
- <Container padding="20px 20px 0px 20px" width="100%">
+ <Container width="100%" padding="20px 20px 0px 20px">
<Container marginBottom="5px">
<TimeCounter estimatedTimeMs={expectedTimeMs} hasEnded={hasEnded} key={progress.startTimeUnix} />
</Container>
diff --git a/packages/instant/src/components/instant_heading.tsx b/packages/instant/src/components/instant_heading.tsx
index 808c6dc7f..117f9dd5f 100644
--- a/packages/instant/src/components/instant_heading.tsx
+++ b/packages/instant/src/components/instant_heading.tsx
@@ -32,7 +32,7 @@ export class InstantHeading extends React.Component<InstantHeadingProps, {}> {
public render(): React.ReactNode {
const iconOrAmounts = this._renderIcon() || this._renderAmountsSection();
return (
- <Container backgroundColor={ColorOption.primaryColor} padding="20px" width="100%">
+ <Container backgroundColor={ColorOption.primaryColor} width="100%" padding="20px">
<Container marginBottom="5px">
<Text
letterSpacing="1px"
diff --git a/packages/instant/src/components/order_details.tsx b/packages/instant/src/components/order_details.tsx
index 5fc956e1c..a8e0e2513 100644
--- a/packages/instant/src/components/order_details.tsx
+++ b/packages/instant/src/components/order_details.tsx
@@ -34,7 +34,7 @@ export class OrderDetails extends React.Component<OrderDetailsProps> {
? assetEthBaseUnitAmount.div(selectedAssetUnitAmount).ceil()
: undefined;
return (
- <Container padding="20px" width="100%" flexGrow={1}>
+ <Container width="100%" flexGrow={1} padding="20px 20px 0px 20px">
<Container marginBottom="10px">
<Text
letterSpacing="1px"
diff --git a/packages/instant/src/components/payment_method.tsx b/packages/instant/src/components/payment_method.tsx
index 4efe5b28e..7c93f1d1c 100644
--- a/packages/instant/src/components/payment_method.tsx
+++ b/packages/instant/src/components/payment_method.tsx
@@ -26,7 +26,7 @@ export interface PaymentMethodProps {
export class PaymentMethod extends React.Component<PaymentMethodProps> {
public render(): React.ReactNode {
return (
- <Container padding="20px" width="100%" height="133px">
+ <Container width="100%" height="120px" padding="20px 20px 0px 20px">
<Container marginBottom="12px">
<Flex justify="space-between">
<Text
@@ -88,10 +88,14 @@ export class PaymentMethod extends React.Component<PaymentMethodProps> {
return (
<WalletPrompt
onClick={this.props.onUnlockWalletClick}
- image={<Icon width={13} icon="lock" color={ColorOption.black} />}
+ image={
+ <Container position="relative" top="2px">
+ <Icon width={13} icon="lock" color={ColorOption.black} />
+ </Container>
+ }
{...colors}
>
- Please Unlock {this.props.walletDisplayName}
+ Click to Connect {this.props.walletDisplayName}
</WalletPrompt>
);
case AccountState.None:
diff --git a/packages/instant/src/components/scaling_amount_input.tsx b/packages/instant/src/components/scaling_amount_input.tsx
index 0861bbe05..86aca5a65 100644
--- a/packages/instant/src/components/scaling_amount_input.tsx
+++ b/packages/instant/src/components/scaling_amount_input.tsx
@@ -4,6 +4,7 @@ import * as React from 'react';
import { Maybe } from '../types';
+import { GIT_SHA, MAGIC_TRIGGER_ERROR_INPUT, MAGIC_TRIGGER_ERROR_MESSAGE, NPM_PACKAGE_VERSION } from '../constants';
import { ColorOption } from '../style/theme';
import { maybeBigNumberUtil } from '../util/maybe_big_number';
import { util } from '../util/util';
@@ -71,6 +72,10 @@ export class ScalingAmountInput extends React.Component<ScalingAmountInputProps,
);
}
private readonly _handleChange = (event: React.ChangeEvent<HTMLInputElement>): void => {
+ if (event.target.value === MAGIC_TRIGGER_ERROR_INPUT) {
+ throw new Error(`${MAGIC_TRIGGER_ERROR_MESSAGE} git: ${GIT_SHA}, npm: ${NPM_PACKAGE_VERSION}`);
+ }
+
const sanitizedValue = event.target.value.replace(/[^0-9.]/g, ''); // only allow numbers and "."
this.setState({
stringValue: sanitizedValue,
diff --git a/packages/instant/src/components/ui/overlay.tsx b/packages/instant/src/components/ui/overlay.tsx
index 7d311dc2f..0b5eaf299 100644
--- a/packages/instant/src/components/ui/overlay.tsx
+++ b/packages/instant/src/components/ui/overlay.tsx
@@ -33,7 +33,7 @@ export const Overlay =
Overlay.defaultProps = {
zIndex: zIndex.overlayDefault,
- backgroundColor: generateOverlayBlack(0.9),
+ backgroundColor: generateOverlayBlack(0.7),
};
Overlay.displayName = 'Overlay';
diff --git a/packages/instant/src/components/wallet_prompt.tsx b/packages/instant/src/components/wallet_prompt.tsx
index a0b3ae457..c07cfe7b5 100644
--- a/packages/instant/src/components/wallet_prompt.tsx
+++ b/packages/instant/src/components/wallet_prompt.tsx
@@ -21,7 +21,7 @@ export const WalletPrompt: React.StatelessComponent<WalletPromptProps> = ({
primaryColor,
}) => (
<Container
- padding="14.5px"
+ padding="10px"
border={`1px solid ${primaryColor}`}
backgroundColor={secondaryColor}
width="100%"
@@ -33,7 +33,7 @@ export const WalletPrompt: React.StatelessComponent<WalletPromptProps> = ({
<Flex>
{image}
<Container marginLeft="10px">
- <Text fontSize="16px" fontColor={primaryColor}>
+ <Text fontSize="16px" fontColor={primaryColor} fontWeight="500">
{children}
</Text>
</Container>
diff --git a/packages/instant/src/components/zero_ex_instant_container.tsx b/packages/instant/src/components/zero_ex_instant_container.tsx
index 8a809ee31..0337c7714 100644
--- a/packages/instant/src/components/zero_ex_instant_container.tsx
+++ b/packages/instant/src/components/zero_ex_instant_container.tsx
@@ -70,7 +70,7 @@ export class ZeroExInstantContainer extends React.Component<ZeroExInstantContain
marginTop="10px"
marginLeft="auto"
marginRight="auto"
- width="140px"
+ width="108px"
>
<a href={ZERO_EX_SITE_URL} target="_blank">
<PoweredByLogo />
diff --git a/packages/instant/src/components/zero_ex_instant_overlay.tsx b/packages/instant/src/components/zero_ex_instant_overlay.tsx
index b3fb57dd6..96e560691 100644
--- a/packages/instant/src/components/zero_ex_instant_overlay.tsx
+++ b/packages/instant/src/components/zero_ex_instant_overlay.tsx
@@ -1,7 +1,7 @@
import * as React from 'react';
import { ZeroExInstantContainer } from '../components/zero_ex_instant_container';
-import { MAIN_CONTAINER_DIV_CLASS, OVERLAY_DIV_CLASS } from '../constants';
+import { MAIN_CONTAINER_DIV_CLASS, OVERLAY_CLOSE_BUTTON_DIV_CLASS, OVERLAY_DIV_CLASS } from '../constants';
import { ColorOption } from '../style/theme';
import { Container } from './ui/container';
@@ -21,7 +21,13 @@ export const ZeroExInstantOverlay: React.StatelessComponent<ZeroExInstantOverlay
<ZeroExInstantProvider {...rest}>
<Overlay zIndex={zIndex} className={OVERLAY_DIV_CLASS}>
<Flex height="100vh">
- <Container position="absolute" top="0px" right="0px" display={{ default: 'initial', sm: 'none' }}>
+ <Container
+ className={OVERLAY_CLOSE_BUTTON_DIV_CLASS}
+ position="absolute"
+ top="0px"
+ right="0px"
+ display={{ default: 'initial', sm: 'none' }}
+ >
<Icon
height={18}
width={18}
diff --git a/packages/instant/src/constants.ts b/packages/instant/src/constants.ts
index 2439c7349..506348092 100644
--- a/packages/instant/src/constants.ts
+++ b/packages/instant/src/constants.ts
@@ -8,15 +8,20 @@ export const DEFAULT_ZERO_EX_CONTAINER_SELECTOR = '#zeroExInstantContainer';
export const INJECTED_DIV_CLASS = 'zeroExInstantResetRoot';
export const INJECTED_DIV_ID = 'zeroExInstant';
export const OVERLAY_DIV_CLASS = 'zeroExInstantOverlay';
+export const OVERLAY_CLOSE_BUTTON_DIV_CLASS = 'zeroExInstantOverlayCloseButton';
export const MAIN_CONTAINER_DIV_CLASS = 'zeroExInstantMainContainer';
export const WEB_3_WRAPPER_TRANSACTION_FAILED_ERROR_MSG_PREFIX = 'Transaction failed';
export const GWEI_IN_WEI = new BigNumber(1000000000);
export const ONE_SECOND_MS = 1000;
export const ONE_MINUTE_MS = ONE_SECOND_MS * 60;
+export const GIT_SHA = process.env.GIT_SHA;
+export const NPM_PACKAGE_VERSION = process.env.NPM_PACKAGE_VERSION;
export const ACCOUNT_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 5;
export const BUY_QUOTE_UPDATE_INTERVAL_TIME_MS = ONE_SECOND_MS * 15;
export const DEFAULT_GAS_PRICE = GWEI_IN_WEI.mul(6);
export const DEFAULT_ESTIMATED_TRANSACTION_TIME_MS = ONE_MINUTE_MS * 2;
+export const MAGIC_TRIGGER_ERROR_INPUT = '0€';
+export const MAGIC_TRIGGER_ERROR_MESSAGE = 'Triggered error';
export const ETH_GAS_STATION_API_BASE_URL = 'https://ethgasstation.info';
export const HEAP_ANALYTICS_ID = process.env.HEAP_ANALYTICS_ID;
export const HEAP_ENABLED = process.env.HEAP_ENABLED;
diff --git a/packages/instant/src/index.umd.ts b/packages/instant/src/index.umd.ts
index b92fa3a7c..d172f4145 100644
--- a/packages/instant/src/index.umd.ts
+++ b/packages/instant/src/index.umd.ts
@@ -2,7 +2,13 @@ import * as _ from 'lodash';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
-import { DEFAULT_ZERO_EX_CONTAINER_SELECTOR, INJECTED_DIV_CLASS, INJECTED_DIV_ID } from './constants';
+import {
+ DEFAULT_ZERO_EX_CONTAINER_SELECTOR,
+ GIT_SHA as GIT_SHA_FROM_CONSTANT,
+ INJECTED_DIV_CLASS,
+ INJECTED_DIV_ID,
+ NPM_PACKAGE_VERSION,
+} from './constants';
import { ZeroExInstantOverlay, ZeroExInstantOverlayProps } from './index';
import { analytics } from './util/analytics';
import { assert } from './util/assert';
@@ -117,5 +123,5 @@ export const render = (config: ZeroExInstantConfig, selector: string = DEFAULT_Z
};
// Write version info to the exported object for debugging
-export const GIT_SHA = process.env.GIT_SHA;
-export const NPM_VERSION = process.env.NPM_PACKAGE_VERSION;
+export const GIT_SHA = GIT_SHA_FROM_CONSTANT;
+export const NPM_VERSION = NPM_PACKAGE_VERSION;
diff --git a/packages/instant/src/redux/analytics_middleware.ts b/packages/instant/src/redux/analytics_middleware.ts
index 47876ca2d..3f7a51707 100644
--- a/packages/instant/src/redux/analytics_middleware.ts
+++ b/packages/instant/src/redux/analytics_middleware.ts
@@ -1,10 +1,11 @@
+import { AssetProxyId } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import { Middleware } from 'redux';
import { ETH_DECIMALS } from '../constants';
import { AccountState, StandardSlidingPanelContent } from '../types';
-import { analytics } from '../util/analytics';
+import { analytics, AnalyticsEventOptions } from '../util/analytics';
import { Action, ActionTypes } from './actions';
@@ -29,9 +30,11 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
if (didJustTurnReady) {
analytics.trackAccountReady(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
} else if (didJustUpdateAddress) {
analytics.trackAccountAddressChanged(ethAddress);
analytics.addUserProperties({ lastKnownEthAddress: ethAddress });
+ analytics.addEventProperties({ ethAddress });
}
}
break;
@@ -51,7 +54,8 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
curAccount.ethBalanceInWei,
ETH_DECIMALS,
).toString();
- analytics.addUserProperties({ ethBalanceInUnitAmount });
+ analytics.addUserProperties({ lastEthBalanceInUnitAmount: ethBalanceInUnitAmount });
+ analytics.addEventProperties({ ethBalanceInUnitAmount });
}
break;
case ActionTypes.UPDATE_SELECTED_ASSET:
@@ -63,10 +67,16 @@ export const analyticsMiddleware: Middleware = store => next => middlewareAction
assetName,
assetData,
});
- analytics.addEventProperties({
+
+ const selectedAssetEventProperties: AnalyticsEventOptions = {
selectedAssetName: assetName,
selectedAssetData: assetData,
- });
+ };
+ if (selectedAsset.metaData.assetProxyId === AssetProxyId.ERC20) {
+ selectedAssetEventProperties.selectedAssetDecimals = selectedAsset.metaData.decimals;
+ selectedAssetEventProperties.selectedAssetSymbol = selectedAsset.metaData.symbol;
+ }
+ analytics.addEventProperties(selectedAssetEventProperties);
}
break;
case ActionTypes.SET_AVAILABLE_ASSETS:
diff --git a/packages/instant/src/style/theme.ts b/packages/instant/src/style/theme.ts
index 71e4b7052..fd3f03c3f 100644
--- a/packages/instant/src/style/theme.ts
+++ b/packages/instant/src/style/theme.ts
@@ -38,8 +38,8 @@ export const theme: Theme = {
lightestGrey: '#EEEEEE',
darkGrey: '#333333',
white: 'white',
- lightOrange: '#F9F2ED',
- darkOrange: '#F2994C',
+ lightOrange: '#FFF8F2',
+ darkOrange: '#F7A24F',
green: '#3CB34F',
red: '#D00000',
darkBlue: '#135df6',
diff --git a/packages/instant/src/util/analytics.ts b/packages/instant/src/util/analytics.ts
index 760ec8b5c..6da37bedb 100644
--- a/packages/instant/src/util/analytics.ts
+++ b/packages/instant/src/util/analytics.ts
@@ -2,7 +2,7 @@ import { BuyQuote } from '@0x/asset-buyer';
import { BigNumber } from '@0x/utils';
import * as _ from 'lodash';
-import { HEAP_ENABLED, INSTANT_DISCHARGE_TARGET } from '../constants';
+import { GIT_SHA, HEAP_ENABLED, INSTANT_DISCHARGE_TARGET, NPM_PACKAGE_VERSION } from '../constants';
import {
AffiliateInfo,
Asset,
@@ -97,11 +97,13 @@ const buyQuoteEventProperties = (buyQuote: BuyQuote) => {
export interface AnalyticsUserOptions {
lastKnownEthAddress?: string;
- ethBalanceInUnitAmount?: string;
+ lastEthBalanceInUnitAmount?: string;
}
export interface AnalyticsEventOptions {
embeddedHost?: string;
embeddedUrl?: string;
+ ethBalanceInUnitAmount?: string;
+ ethAddress?: string;
networkId?: number;
providerName?: string;
gitSha?: string;
@@ -112,7 +114,9 @@ export interface AnalyticsEventOptions {
affiliateFeePercent?: number;
numberAvailableAssets?: number;
selectedAssetName?: string;
+ selectedAssetSymbol?: string;
selectedAssetData?: string;
+ selectedAssetDecimals?: number;
}
export enum TokenSelectorClosedVia {
ClickedX = 'Clicked X',
@@ -145,8 +149,8 @@ export const analytics = {
embeddedUrl: window.location.href,
networkId: network,
providerName: providerState.name,
- gitSha: process.env.GIT_SHA,
- npmVersion: process.env.NPM_PACKAGE_VERSION,
+ gitSha: GIT_SHA,
+ npmVersion: NPM_PACKAGE_VERSION,
orderSource: orderSourceName,
affiliateAddress,
affiliateFeePercent,
diff --git a/packages/instant/src/util/error_reporter.ts b/packages/instant/src/util/error_reporter.ts
index 3ec7b6daa..b1824eaf9 100644
--- a/packages/instant/src/util/error_reporter.ts
+++ b/packages/instant/src/util/error_reporter.ts
@@ -1,7 +1,7 @@
import { logUtils } from '@0x/utils';
import * as _ from 'lodash';
-import { HOST_DOMAINS, INSTANT_DISCHARGE_TARGET, ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENABLED } from '../constants';
+import { GIT_SHA, HOST_DOMAINS, INSTANT_DISCHARGE_TARGET, ROLLBAR_CLIENT_TOKEN, ROLLBAR_ENABLED } from '../constants';
// Import version of Rollbar designed for embedded components
// See https://docs.rollbar.com/docs/using-rollbarjs-inside-an-embedded-component
@@ -24,7 +24,7 @@ export const setupRollbar = (): any => {
client: {
javascript: {
source_map_enabled: true,
- code_version: process.env.GIT_SHA,
+ code_version: GIT_SHA,
guess_uncaught_frames: true,
},
},
diff --git a/packages/website/translations/chinese.json b/packages/website/translations/chinese.json
index eb88b43d0..2b1f2a3f5 100644
--- a/packages/website/translations/chinese.json
+++ b/packages/website/translations/chinese.json
@@ -76,9 +76,9 @@
"STANDARD_RELAYER_API": "中继方标准API",
"PORTAL_DAPP": "去中心化应用门户",
"WEBSITE": "网站",
- "DEVELOPERS": "首页",
- "HOME": "Rocket.chat",
- "ROCKETCHAT": "开发人员",
+ "DEVELOPERS": "开发人员",
+ "HOME": "首页",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
diff --git a/packages/website/translations/english.json b/packages/website/translations/english.json
index 5fba7a0ff..b2799e264 100644
--- a/packages/website/translations/english.json
+++ b/packages/website/translations/english.json
@@ -81,7 +81,7 @@
"WEBSITE": "website",
"DEVELOPERS": "developers",
"HOME": "home",
- "ROCKETCHAT": "rocket.chat",
+ "DISCORD": "discord chat",
"TRADE_CALL_TO_ACTION": "trade on 0x",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
diff --git a/packages/website/translations/korean.json b/packages/website/translations/korean.json
index e3ce74676..61c431a5a 100644
--- a/packages/website/translations/korean.json
+++ b/packages/website/translations/korean.json
@@ -77,7 +77,7 @@
"PORTAL_DAPP": "포털 dApp",
"WEBSITE": "Website",
"HOME": "홈",
- "ROCKETCHAT": "Rocket.chat",
+ "DISCORD": "discord chat",
"DEVELOPERS": "개발자",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
diff --git a/packages/website/translations/russian.json b/packages/website/translations/russian.json
index c74fb5e32..3180d4a8e 100644
--- a/packages/website/translations/russian.json
+++ b/packages/website/translations/russian.json
@@ -76,9 +76,9 @@
"STANDARD_RELAYER_API": "standard relayer API",
"PORTAL_DAPP": "DApp-портал",
"WEBSITE": "Веб-сайт",
- "DEVELOPERS": "Домашняя страница",
- "HOME": "Rocket.chat",
- "ROCKETCHAT": "Для разработчиков",
+ "DEVELOPERS": "Для разработчиков",
+ "HOME": "Домашняя страница",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
diff --git a/packages/website/translations/spanish.json b/packages/website/translations/spanish.json
index e29db711b..c23bd609b 100644
--- a/packages/website/translations/spanish.json
+++ b/packages/website/translations/spanish.json
@@ -77,9 +77,9 @@
"STANDARD_RELAYER_API": "API de transmisión estándar",
"PORTAL_DAPP": "portal dApp",
"WEBSITE": "website",
- "DEVELOPERS": "inicio",
- "HOME": "rocket.chat",
- "ROCKETCHAT": "desarrolladores",
+ "DEVELOPERS": "desarrolladores",
+ "HOME": "inicio",
+ "DISCORD": "discord chat",
"BUILD_A_RELAYER": "build a relayer",
"BUILD_A_RELAYER_DESCRIPTION": "Learn how to build your own 0x relayer from scratch",
"DEVELOP_ON_ETHEREUM": "develop on Ethereum",
diff --git a/packages/website/ts/components/footer.tsx b/packages/website/ts/components/footer.tsx
index e10005a0a..57071ee29 100644
--- a/packages/website/ts/components/footer.tsx
+++ b/packages/website/ts/components/footer.tsx
@@ -71,7 +71,7 @@ export class Footer extends React.Component<FooterProps, FooterState> {
],
[Key.Community]: [
{
- title: this.props.translate.get(Key.RocketChat, Deco.Cap),
+ title: this.props.translate.get(Key.Discord, Deco.Cap),
to: constants.URL_ZEROEX_CHAT,
shouldOpenInNewTab: true,
},
@@ -177,7 +177,7 @@ export class Footer extends React.Component<FooterProps, FooterState> {
}
private _renderMenuItem(link: ALink): React.ReactNode {
const titleToIcon: { [title: string]: string } = {
- [this.props.translate.get(Key.RocketChat, Deco.Cap)]: 'rocketchat.png',
+ [this.props.translate.get(Key.Discord, Deco.Cap)]: 'rocketchat.png',
[this.props.translate.get(Key.Blog, Deco.Cap)]: 'medium.png',
Twitter: 'twitter.png',
Reddit: 'reddit.png',
diff --git a/packages/website/ts/pages/faq/faq.tsx b/packages/website/ts/pages/faq/faq.tsx
index 10d91bae8..c4965e61c 100644
--- a/packages/website/ts/pages/faq/faq.tsx
+++ b/packages/website/ts/pages/faq/faq.tsx
@@ -379,7 +379,7 @@ const sections: FAQSection[] = [
<div>
Join our{' '}
<a href={constants.URL_ZEROEX_CHAT} target="_blank">
- Rocket.chat
+ Discord
</a>! As an open source project, 0x will rely on a worldwide community of passionate developers
to contribute proposals, ideas and code.
</div>
diff --git a/packages/website/ts/types.ts b/packages/website/ts/types.ts
index 9c4b8a018..d2914dbfe 100644
--- a/packages/website/ts/types.ts
+++ b/packages/website/ts/types.ts
@@ -463,7 +463,7 @@ export enum Key {
Website = 'WEBSITE',
Developers = 'DEVELOPERS',
Home = 'HOME',
- RocketChat = 'ROCKETCHAT',
+ Discord = 'DISCORD',
TradeCallToAction = 'TRADE_CALL_TO_ACTION',
OurMissionAndValues = 'OUR_MISSION_AND_VALUES',
BuildARelayer = 'BUILD_A_RELAYER',
diff --git a/packages/website/ts/utils/constants.ts b/packages/website/ts/utils/constants.ts
index e9afc8763..6597d51b4 100644
--- a/packages/website/ts/utils/constants.ts
+++ b/packages/website/ts/utils/constants.ts
@@ -3,7 +3,7 @@ import { BigNumber } from '@0x/utils';
import { Key, WebsitePaths } from 'ts/types';
const URL_FORUM = 'https://forum.0xproject.com';
-const URL_ZEROEX_CHAT = 'https://chat.0xproject.com';
+const URL_ZEROEX_CHAT = 'https://discord.gg/d3FTX3M';
export const constants = {
DECIMAL_PLACES_ETH: 18,