Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/website/instant-configurator
This commit is contained in:
commit
f9e73d2a6f
@ -40,7 +40,10 @@ jobs:
|
|||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn wsrun test:circleci contracts
|
- 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:
|
test-contracts-geth:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:9
|
- image: circleci/node:9
|
||||||
@ -52,7 +55,10 @@ jobs:
|
|||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
# HACK(albrow): we need to sleep 10 seconds to ensure the devnet is
|
||||||
# initialized
|
# initialized
|
||||||
- run: sleep 10 && TEST_PROVIDER=geth yarn wsrun test contracts
|
- 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:
|
test-publish:
|
||||||
resource_class: medium+
|
resource_class: medium+
|
||||||
docker:
|
docker:
|
||||||
@ -73,6 +79,20 @@ jobs:
|
|||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
- run: yarn test:generate_docs:circleci
|
- run: yarn test:generate_docs:circleci
|
||||||
|
test-pipeline:
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:9
|
||||||
|
- image: postgres:11-alpine
|
||||||
|
working_directory: ~/repo
|
||||||
|
steps:
|
||||||
|
- restore_cache:
|
||||||
|
keys:
|
||||||
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
- run: ZEROEX_DATA_PIPELINE_TEST_DB_URL='postgresql://postgres@localhost/postgres' yarn wsrun test:circleci @0x/pipeline
|
||||||
|
- save_cache:
|
||||||
|
key: coverage-pipeline-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
paths:
|
||||||
|
- ~/repo/packages/pipeline/coverage/lcov.info
|
||||||
test-rest:
|
test-rest:
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:9
|
- image: circleci/node:9
|
||||||
@ -81,6 +101,7 @@ jobs:
|
|||||||
- restore_cache:
|
- restore_cache:
|
||||||
keys:
|
keys:
|
||||||
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
- repo-{{ .Environment.CIRCLE_SHA1 }}
|
||||||
|
- run: yarn wsrun test:circleci @0x/contracts-test-utils
|
||||||
- run: yarn wsrun test:circleci @0x/abi-gen
|
- run: yarn wsrun test:circleci @0x/abi-gen
|
||||||
- run: yarn wsrun test:circleci @0x/assert
|
- run: yarn wsrun test:circleci @0x/assert
|
||||||
- run: yarn wsrun test:circleci @0x/base-contract
|
- run: yarn wsrun test:circleci @0x/base-contract
|
||||||
@ -331,6 +352,9 @@ workflows:
|
|||||||
- test-contracts-geth:
|
- test-contracts-geth:
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
|
- test-pipeline:
|
||||||
|
requires:
|
||||||
|
- build
|
||||||
- test-rest:
|
- test-rest:
|
||||||
requires:
|
requires:
|
||||||
- build
|
- build
|
||||||
|
10
.gitignore
vendored
10
.gitignore
vendored
@ -11,6 +11,10 @@ pids
|
|||||||
*.seed
|
*.seed
|
||||||
*.pid.lock
|
*.pid.lock
|
||||||
|
|
||||||
|
# SQLite database files
|
||||||
|
*.db
|
||||||
|
*.sqlite
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
lib-cov
|
lib-cov
|
||||||
|
|
||||||
@ -80,12 +84,18 @@ packages/testnet-faucets/server/
|
|||||||
|
|
||||||
# generated contract artifacts/
|
# generated contract artifacts/
|
||||||
contracts/core/generated-artifacts/
|
contracts/core/generated-artifacts/
|
||||||
|
contracts/multisig/generated-artifacts/
|
||||||
|
contracts/utils/generated-artifacts/
|
||||||
|
contracts/libs/generated-artifacts/
|
||||||
packages/sol-cov/test/fixtures/artifacts/
|
packages/sol-cov/test/fixtures/artifacts/
|
||||||
packages/metacoin/artifacts/
|
packages/metacoin/artifacts/
|
||||||
|
|
||||||
# generated contract wrappers
|
# generated contract wrappers
|
||||||
packages/abi-gen-wrappers/wrappers
|
packages/abi-gen-wrappers/wrappers
|
||||||
contracts/core/generated-wrappers/
|
contracts/core/generated-wrappers/
|
||||||
|
contracts/multisig/generated-wrappers/
|
||||||
|
contracts/utils/generated-wrappers/
|
||||||
|
contracts/libs/generated-wrappers/
|
||||||
packages/metacoin/src/contract_wrappers
|
packages/metacoin/src/contract_wrappers
|
||||||
|
|
||||||
# solc-bin in sol-compiler
|
# solc-bin in sol-compiler
|
||||||
|
@ -2,6 +2,12 @@ lib
|
|||||||
.nyc_output
|
.nyc_output
|
||||||
/contracts/core/generated-wrappers
|
/contracts/core/generated-wrappers
|
||||||
/contracts/core/generated-artifacts
|
/contracts/core/generated-artifacts
|
||||||
|
/contracts/multisig/generated-wrappers
|
||||||
|
/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/abi-gen-wrappers/src/generated-wrappers
|
||||||
/packages/contract-artifacts/artifacts
|
/packages/contract-artifacts/artifacts
|
||||||
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
|
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
|
||||||
|
@ -14,7 +14,7 @@ packages/website/ @BMillman19 @fragosti @fabioberger @steveklebanoff
|
|||||||
packages/abi-gen/ @LogvinovLeon
|
packages/abi-gen/ @LogvinovLeon
|
||||||
packages/base-contract/ @LogvinovLeon
|
packages/base-contract/ @LogvinovLeon
|
||||||
packages/connect/ @fragosti
|
packages/connect/ @fragosti
|
||||||
packages/contract_templates/ @LogvinovLeon
|
packages/abi-gen-templates/ @LogvinovLeon
|
||||||
packages/contract-addresses/ @albrow
|
packages/contract-addresses/ @albrow
|
||||||
packages/contract-artifacts/ @albrow
|
packages/contract-artifacts/ @albrow
|
||||||
packages/dev-utils/ @LogvinovLeon @fabioberger
|
packages/dev-utils/ @LogvinovLeon @fabioberger
|
||||||
|
48
contracts/TESTING.md
Normal file
48
contracts/TESTING.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Contracts testing options
|
||||||
|
|
||||||
|
## Revert stack traces
|
||||||
|
|
||||||
|
If you want to see helpful stack traces (incl. line number, code snippet) for smart contract reverts, run the tests with:
|
||||||
|
|
||||||
|
```
|
||||||
|
yarn test:trace
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** This currently slows down the test runs and is therefore not enabled by default.
|
||||||
|
|
||||||
|
## Backing Ethereum node
|
||||||
|
|
||||||
|
By default, our tests run against an in-process [Ganache](https://github.com/trufflesuite/ganache-core) instance. In order to run the tests against [Geth](https://github.com/ethereum/go-ethereum), first follow the instructions in the README for the devnet package to start the devnet Geth node. Then run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
TEST_PROVIDER=geth yarn test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Code coverage
|
||||||
|
|
||||||
|
In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
|
||||||
|
|
||||||
|
```
|
||||||
|
yarn test:coverage
|
||||||
|
```
|
||||||
|
|
||||||
|
## Gas profiler
|
||||||
|
|
||||||
|
In order to profile the gas costs for a specific smart contract call/transaction, you can run the tests in `profiler` mode.
|
||||||
|
|
||||||
|
**Note:** Traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling.
|
||||||
|
|
||||||
|
```
|
||||||
|
TEST_PROVIDER=geth yarn test:profiler
|
||||||
|
```
|
||||||
|
|
||||||
|
You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { profiler } from './utils/profiler';
|
||||||
|
profiler.start();
|
||||||
|
// Some call to a smart contract
|
||||||
|
profiler.stop();
|
||||||
|
```
|
||||||
|
|
||||||
|
Without explicitly starting and stopping the profiler, the profiler output will be too busy, and therefore unusable.
|
@ -14,8 +14,6 @@ Contracts that make up and interact with version 2.0.0 of the protocol can be fo
|
|||||||
* This directory contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
|
* This directory contains example implementations of contracts that interact with the protocol but are _not_ intended for use in production. Examples include [filter](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#filter-contracts) contracts, a [Wallet](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#wallet) contract, and a [Validator](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/v2-specification.md#validator) contract, among others.
|
||||||
* [tokens](./contracts/tokens)
|
* [tokens](./contracts/tokens)
|
||||||
* This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
|
* This directory contains implementations of different tokens and token standards, including [wETH](https://weth.io/), ZRX, [ERC20](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md), and [ERC721](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-721.md).
|
||||||
* [multisig](./contracts/multisig)
|
|
||||||
* This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
|
|
||||||
* [utils](./contracts/utils)
|
* [utils](./contracts/utils)
|
||||||
* This directory contains libraries and utils that are shared across all of the other directories.
|
* This directory contains libraries and utils that are shared across all of the other directories.
|
||||||
* [test](./contracts/test)
|
* [test](./contracts/test)
|
||||||
@ -52,13 +50,13 @@ yarn install
|
|||||||
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
To build this package and all other monorepo packages that it depends on, run the following from the monorepo root directory:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=contracts yarn build
|
PKG=@0x/contracts-core yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Or continuously rebuild on change:
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
PKG=contracts yarn watch
|
PKG=@0x/contracts-core yarn watch
|
||||||
```
|
```
|
||||||
|
|
||||||
### Clean
|
### Clean
|
||||||
@ -81,49 +79,4 @@ yarn test
|
|||||||
|
|
||||||
#### Testing options
|
#### Testing options
|
||||||
|
|
||||||
###### Revert stack traces
|
Contracts testing options like coverage, profiling, revert traces or backing node choosing - are described [here](../TESTING.md).
|
||||||
|
|
||||||
If you want to see helpful stack traces (incl. line number, code snippet) for smart contract reverts, run the tests with:
|
|
||||||
|
|
||||||
```
|
|
||||||
yarn test:trace
|
|
||||||
```
|
|
||||||
|
|
||||||
**Note:** This currently slows down the test runs and is therefore not enabled by default.
|
|
||||||
|
|
||||||
###### Backing Ethereum node
|
|
||||||
|
|
||||||
By default, our tests run against an in-process [Ganache](https://github.com/trufflesuite/ganache-core) instance. In order to run the tests against [Geth](https://github.com/ethereum/go-ethereum), first follow the instructions in the README for the devnet package to start the devnet Geth node. Then run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
TEST_PROVIDER=geth yarn test
|
|
||||||
```
|
|
||||||
|
|
||||||
###### Code coverage
|
|
||||||
|
|
||||||
In order to see the Solidity code coverage output generated by `@0x/sol-cov`, run:
|
|
||||||
|
|
||||||
```
|
|
||||||
yarn test:coverage
|
|
||||||
```
|
|
||||||
|
|
||||||
###### Gas profiler
|
|
||||||
|
|
||||||
In order to profile the gas costs for a specific smart contract call/transaction, you can run the tests in `profiler` mode.
|
|
||||||
|
|
||||||
**Note:** Traces emitted by ganache have incorrect gas costs so we recommend using Geth for profiling.
|
|
||||||
|
|
||||||
```
|
|
||||||
TEST_PROVIDER=geth yarn test:profiler
|
|
||||||
```
|
|
||||||
|
|
||||||
You'll see a warning that you need to explicitly enable and disable the profiler before and after the block of code you want to profile.
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { profiler } from './utils/profiler';
|
|
||||||
profiler.start();
|
|
||||||
// Some call to a smart contract
|
|
||||||
profiler.stop();
|
|
||||||
```
|
|
||||||
|
|
||||||
Without explicitly starting and stopping the profiler, the profiler output will be too busy, and therefore unusable.
|
|
||||||
|
@ -40,15 +40,10 @@
|
|||||||
"IWallet",
|
"IWallet",
|
||||||
"MixinAuthorizable",
|
"MixinAuthorizable",
|
||||||
"MultiAssetProxy",
|
"MultiAssetProxy",
|
||||||
"MultiSigWallet",
|
|
||||||
"MultiSigWalletWithTimeLock",
|
|
||||||
"OrderValidator",
|
"OrderValidator",
|
||||||
"ReentrantERC20Token",
|
"ReentrantERC20Token",
|
||||||
"TestAssetProxyOwner",
|
"TestAssetProxyOwner",
|
||||||
"TestAssetProxyDispatcher",
|
"TestAssetProxyDispatcher",
|
||||||
"TestConstants",
|
|
||||||
"TestLibBytes",
|
|
||||||
"TestLibs",
|
|
||||||
"TestExchangeInternals",
|
"TestExchangeInternals",
|
||||||
"TestSignatureValidator",
|
"TestSignatureValidator",
|
||||||
"TestStaticCallReceiver",
|
"TestStaticCallReceiver",
|
||||||
|
@ -20,7 +20,7 @@ pragma solidity 0.4.24;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
||||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ExchangeWrapper {
|
contract ExchangeWrapper {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../protocol/Exchange/interfaces/IWallet.sol";
|
import "../../protocol/Exchange/interfaces/IWallet.sol";
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
|
|
||||||
|
|
||||||
contract Wallet is
|
contract Wallet is
|
||||||
|
@ -20,8 +20,8 @@ pragma solidity 0.4.24;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
||||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
|
|
||||||
|
|
||||||
contract Whitelist is
|
contract Whitelist is
|
||||||
|
@ -20,10 +20,10 @@ pragma solidity 0.4.24;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
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/ERC20Token/IERC20Token.sol";
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract DutchAuction is
|
contract DutchAuction is
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
import "../../tokens/ERC20Token/IERC20Token.sol";
|
import "../../tokens/ERC20Token/IERC20Token.sol";
|
||||||
import "../../tokens/ERC721Token/IERC721Token.sol";
|
import "../../tokens/ERC721Token/IERC721Token.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
|
@ -21,10 +21,10 @@ pragma experimental ABIEncoderV2;
|
|||||||
|
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./mixins/MExchangeWrapper.sol";
|
import "./mixins/MExchangeWrapper.sol";
|
||||||
import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
|
||||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinExchangeWrapper is
|
contract MixinExchangeWrapper is
|
||||||
|
@ -24,10 +24,10 @@ import "./mixins/MWeth.sol";
|
|||||||
import "./mixins/MAssets.sol";
|
import "./mixins/MAssets.sol";
|
||||||
import "./mixins/MExchangeWrapper.sol";
|
import "./mixins/MExchangeWrapper.sol";
|
||||||
import "./interfaces/IForwarderCore.sol";
|
import "./interfaces/IForwarderCore.sol";
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinForwarderCore is
|
contract MixinForwarderCore is
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "./libs/LibConstants.sol";
|
||||||
import "./mixins/MWeth.sol";
|
import "./mixins/MWeth.sol";
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../../../protocol/Exchange/libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IForwarderCore {
|
contract IForwarderCore {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../../protocol/Exchange/interfaces/IExchange.sol";
|
import "../../../protocol/Exchange/interfaces/IExchange.sol";
|
||||||
import "../../../tokens/EtherToken/IEtherToken.sol";
|
import "../../../tokens/EtherToken/IEtherToken.sol";
|
||||||
import "../../../tokens/ERC20Token/IERC20Token.sol";
|
import "../../../tokens/ERC20Token/IERC20Token.sol";
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../../protocol/Exchange/libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../../../protocol/Exchange/libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MExchangeWrapper {
|
contract MExchangeWrapper {
|
||||||
|
@ -20,10 +20,10 @@ pragma solidity 0.4.24;
|
|||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../protocol/Exchange/interfaces/IExchange.sol";
|
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/ERC20Token/IERC20Token.sol";
|
||||||
import "../../tokens/ERC721Token/IERC721Token.sol";
|
import "../../tokens/ERC721Token/IERC721Token.sol";
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
|
|
||||||
|
|
||||||
contract OrderValidator {
|
contract OrderValidator {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
import "./mixins/MAuthorizable.sol";
|
import "./mixins/MAuthorizable.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../../utils/Ownable/IOwnable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/IOwnable.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IAuthorizable is
|
contract IAuthorizable is
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../multisig/MultiSigWalletWithTimeLock.sol";
|
import "@0x/contracts-multisig/contracts/multisig/MultiSigWalletWithTimeLock.sol";
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
|
|
||||||
|
|
||||||
contract AssetProxyOwner is
|
contract AssetProxyOwner is
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "./libs/LibConstants.sol";
|
import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
|
||||||
import "./MixinExchangeCore.sol";
|
import "./MixinExchangeCore.sol";
|
||||||
import "./MixinSignatureValidator.sol";
|
import "./MixinSignatureValidator.sol";
|
||||||
import "./MixinWrapperFunctions.sol";
|
import "./MixinWrapperFunctions.sol";
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
import "./mixins/MAssetProxyDispatcher.sol";
|
import "./mixins/MAssetProxyDispatcher.sol";
|
||||||
import "../AssetProxy/interfaces/IAssetProxy.sol";
|
import "../AssetProxy/interfaces/IAssetProxy.sol";
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
|
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
|
||||||
import "./libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "./libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "./libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
import "./mixins/MExchangeCore.sol";
|
import "./mixins/MExchangeCore.sol";
|
||||||
import "./mixins/MSignatureValidator.sol";
|
import "./mixins/MSignatureValidator.sol";
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
|
@ -14,11 +14,11 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
|
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
|
||||||
import "./libs/LibConstants.sol";
|
import "@0x/contracts-libs/contracts/libs/LibConstants.sol";
|
||||||
import "./libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
import "./libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "./libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "./mixins/MExchangeCore.sol";
|
import "./mixins/MExchangeCore.sol";
|
||||||
import "./mixins/MMatchOrders.sol";
|
import "./mixins/MMatchOrders.sol";
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
|
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
|
||||||
import "./mixins/MSignatureValidator.sol";
|
import "./mixins/MSignatureValidator.sol";
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
import "./interfaces/IWallet.sol";
|
import "./interfaces/IWallet.sol";
|
||||||
@ -239,18 +239,18 @@ contract MixinSignatureValidator is
|
|||||||
view
|
view
|
||||||
returns (bool isValid)
|
returns (bool isValid)
|
||||||
{
|
{
|
||||||
bytes memory calldata = abi.encodeWithSelector(
|
bytes memory callData = abi.encodeWithSelector(
|
||||||
IWallet(walletAddress).isValidSignature.selector,
|
IWallet(walletAddress).isValidSignature.selector,
|
||||||
hash,
|
hash,
|
||||||
signature
|
signature
|
||||||
);
|
);
|
||||||
assembly {
|
assembly {
|
||||||
let cdStart := add(calldata, 32)
|
let cdStart := add(callData, 32)
|
||||||
let success := staticcall(
|
let success := staticcall(
|
||||||
gas, // forward all gas
|
gas, // forward all gas
|
||||||
walletAddress, // address of Wallet contract
|
walletAddress, // address of Wallet contract
|
||||||
cdStart, // pointer to start of input
|
cdStart, // pointer to start of input
|
||||||
mload(calldata), // length of input
|
mload(callData), // length of input
|
||||||
cdStart, // write output over input
|
cdStart, // write output over input
|
||||||
32 // output size is 32 bytes
|
32 // output size is 32 bytes
|
||||||
)
|
)
|
||||||
@ -288,19 +288,19 @@ contract MixinSignatureValidator is
|
|||||||
view
|
view
|
||||||
returns (bool isValid)
|
returns (bool isValid)
|
||||||
{
|
{
|
||||||
bytes memory calldata = abi.encodeWithSelector(
|
bytes memory callData = abi.encodeWithSelector(
|
||||||
IValidator(signerAddress).isValidSignature.selector,
|
IValidator(signerAddress).isValidSignature.selector,
|
||||||
hash,
|
hash,
|
||||||
signerAddress,
|
signerAddress,
|
||||||
signature
|
signature
|
||||||
);
|
);
|
||||||
assembly {
|
assembly {
|
||||||
let cdStart := add(calldata, 32)
|
let cdStart := add(callData, 32)
|
||||||
let success := staticcall(
|
let success := staticcall(
|
||||||
gas, // forward all gas
|
gas, // forward all gas
|
||||||
validatorAddress, // address of Validator contract
|
validatorAddress, // address of Validator contract
|
||||||
cdStart, // pointer to start of input
|
cdStart, // pointer to start of input
|
||||||
mload(calldata), // length of input
|
mload(callData), // length of input
|
||||||
cdStart, // write output over input
|
cdStart, // write output over input
|
||||||
32 // output size is 32 bytes
|
32 // output size is 32 bytes
|
||||||
)
|
)
|
||||||
|
@ -17,10 +17,10 @@
|
|||||||
*/
|
*/
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "./libs/LibExchangeErrors.sol";
|
import "@0x/contracts-libs/contracts/libs/LibExchangeErrors.sol";
|
||||||
import "./mixins/MSignatureValidator.sol";
|
import "./mixins/MSignatureValidator.sol";
|
||||||
import "./mixins/MTransactions.sol";
|
import "./mixins/MTransactions.sol";
|
||||||
import "./libs/LibEIP712.sol";
|
import "@0x/contracts-libs/contracts/libs/LibEIP712.sol";
|
||||||
|
|
||||||
|
|
||||||
contract MixinTransactions is
|
contract MixinTransactions is
|
||||||
|
@ -19,11 +19,11 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../utils/ReentrancyGuard/ReentrancyGuard.sol";
|
import "@0x/contracts-utils/contracts/utils/ReentrancyGuard/ReentrancyGuard.sol";
|
||||||
import "./libs/LibMath.sol";
|
import "@0x/contracts-libs/contracts/libs/LibMath.sol";
|
||||||
import "./libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "./libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "./libs/LibAbiEncoder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibAbiEncoder.sol";
|
||||||
import "./mixins/MExchangeCore.sol";
|
import "./mixins/MExchangeCore.sol";
|
||||||
import "./mixins/MWrapperFunctions.sol";
|
import "./mixins/MWrapperFunctions.sol";
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IExchangeCore {
|
contract IExchangeCore {
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IMatchOrders {
|
contract IMatchOrders {
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
|
|
||||||
|
|
||||||
contract IWrapperFunctions {
|
contract IWrapperFunctions {
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "../interfaces/IExchangeCore.sol";
|
import "../interfaces/IExchangeCore.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,8 +18,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "../interfaces/IMatchOrders.sol";
|
import "../interfaces/IMatchOrders.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../libs/LibOrder.sol";
|
import "@0x/contracts-libs/contracts/libs/LibOrder.sol";
|
||||||
import "../libs/LibFillResults.sol";
|
import "@0x/contracts-libs/contracts/libs/LibFillResults.sol";
|
||||||
import "../interfaces/IWrapperFunctions.sol";
|
import "../interfaces/IWrapperFunctions.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
import "../../tokens/ERC20Token/MintableERC20Token.sol";
|
import "../../tokens/ERC20Token/MintableERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../tokens/ERC721Token/MintableERC721Token.sol";
|
import "../../tokens/ERC721Token/MintableERC721Token.sol";
|
||||||
import "../../utils/Ownable/Ownable.sol";
|
import "@0x/contracts-utils/contracts/utils/Ownable/Ownable.sol";
|
||||||
|
|
||||||
|
|
||||||
// solhint-disable no-empty-blocks
|
// solhint-disable no-empty-blocks
|
||||||
|
@ -19,10 +19,10 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../utils/LibBytes/LibBytes.sol";
|
import "@0x/contracts-utils/contracts/utils/LibBytes/LibBytes.sol";
|
||||||
import "../../tokens/ERC20Token/ERC20Token.sol";
|
import "../../tokens/ERC20Token/ERC20Token.sol";
|
||||||
import "../../protocol/Exchange/interfaces/IExchange.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
|
// solhint-disable no-unused-vars
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||||
import "./UnlimitedAllowanceERC20Token.sol";
|
import "./UnlimitedAllowanceERC20Token.sol";
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ pragma solidity 0.4.24;
|
|||||||
|
|
||||||
import "./IERC721Token.sol";
|
import "./IERC721Token.sol";
|
||||||
import "./IERC721Receiver.sol";
|
import "./IERC721Receiver.sol";
|
||||||
import "../../utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract ERC721Token is
|
contract ERC721Token is
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"private": true,
|
"private": true,
|
||||||
"name": "contracts",
|
"name": "@0x/contracts-core",
|
||||||
"version": "2.1.56",
|
"version": "2.1.56",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.12"
|
"node": ">=6.12"
|
||||||
@ -33,20 +33,19 @@
|
|||||||
"lint-contracts": "solhint contracts/**/**/**/**/*.sol"
|
"lint-contracts": "solhint contracts/**/**/**/**/*.sol"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"abis":
|
"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"
|
||||||
"generated-artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Receiver|DummyERC721Token|DummyMultipleReturnERC20Token|DummyNoReturnERC20Token|DutchAuction|ERC20Token|ERC20Proxy|ERC721Token|ERC721Proxy|Forwarder|Exchange|ExchangeWrapper|IAssetData|IAssetProxy|InvalidERC721Receiver|MixinAuthorizable|MultiAssetProxy|MultiSigWallet|MultiSigWalletWithTimeLock|OrderValidator|ReentrantERC20Token|TestAssetProxyOwner|TestAssetProxyDispatcher|TestConstants|TestExchangeInternals|TestLibBytes|TestLibs|TestSignatureValidator|TestStaticCallReceiver|Validator|Wallet|Whitelist|WETH9|ZRXToken).json"
|
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/0xProject/0x-monorepo.git"
|
"url": "https://github.com/0xProject/0x-monorepo.git"
|
||||||
},
|
},
|
||||||
"author": "Amir Bandeali",
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
"url": "https://github.com/0xProject/0x-monorepo/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md",
|
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/core/README.md",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@0x/contracts-test-utils": "^1.0.0",
|
||||||
"@0x/abi-gen": "^1.0.17",
|
"@0x/abi-gen": "^1.0.17",
|
||||||
"@0x/dev-utils": "^1.0.19",
|
"@0x/dev-utils": "^1.0.19",
|
||||||
"@0x/sol-compiler": "^1.1.14",
|
"@0x/sol-compiler": "^1.1.14",
|
||||||
@ -54,7 +53,6 @@
|
|||||||
"@0x/subproviders": "^2.1.6",
|
"@0x/subproviders": "^2.1.6",
|
||||||
"@0x/tslint-config": "^1.0.10",
|
"@0x/tslint-config": "^1.0.10",
|
||||||
"@types/bn.js": "^4.11.0",
|
"@types/bn.js": "^4.11.0",
|
||||||
"@types/ethereumjs-abi": "^0.6.0",
|
|
||||||
"@types/lodash": "4.14.104",
|
"@types/lodash": "4.14.104",
|
||||||
"@types/node": "*",
|
"@types/node": "*",
|
||||||
"@types/yargs": "^10.0.0",
|
"@types/yargs": "^10.0.0",
|
||||||
@ -63,6 +61,7 @@
|
|||||||
"chai-bignumber": "^2.0.1",
|
"chai-bignumber": "^2.0.1",
|
||||||
"dirty-chai": "^2.0.1",
|
"dirty-chai": "^2.0.1",
|
||||||
"make-promises-safe": "^1.1.0",
|
"make-promises-safe": "^1.1.0",
|
||||||
|
"ethereumjs-abi": "0.6.5",
|
||||||
"mocha": "^4.1.0",
|
"mocha": "^4.1.0",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
"shx": "^0.2.2",
|
"shx": "^0.2.2",
|
||||||
@ -75,6 +74,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@0x/base-contract": "^3.0.8",
|
"@0x/base-contract": "^3.0.8",
|
||||||
"@0x/order-utils": "^3.0.4",
|
"@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/types": "^1.3.0",
|
||||||
"@0x/typescript-typings": "^3.0.4",
|
"@0x/typescript-typings": "^3.0.4",
|
||||||
"@0x/utils": "^2.0.6",
|
"@0x/utils": "^2.0.6",
|
||||||
@ -82,10 +84,7 @@
|
|||||||
"@types/js-combinatorics": "^0.5.29",
|
"@types/js-combinatorics": "^0.5.29",
|
||||||
"bn.js": "^4.11.8",
|
"bn.js": "^4.11.8",
|
||||||
"ethereum-types": "^1.1.2",
|
"ethereum-types": "^1.1.2",
|
||||||
"ethereumjs-abi": "0.6.5",
|
|
||||||
"ethereumjs-util": "^5.1.1",
|
"ethereumjs-util": "^5.1.1",
|
||||||
"ethers": "~4.0.4",
|
|
||||||
"js-combinatorics": "^0.5.3",
|
|
||||||
"lodash": "^4.17.5"
|
"lodash": "^4.17.5"
|
||||||
},
|
},
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
|
@ -21,16 +21,11 @@ import * as IValidator from '../../generated-artifacts/IValidator.json';
|
|||||||
import * as IWallet from '../../generated-artifacts/IWallet.json';
|
import * as IWallet from '../../generated-artifacts/IWallet.json';
|
||||||
import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
|
import * as MixinAuthorizable from '../../generated-artifacts/MixinAuthorizable.json';
|
||||||
import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
|
import * as MultiAssetProxy from '../../generated-artifacts/MultiAssetProxy.json';
|
||||||
import * as MultiSigWallet from '../../generated-artifacts/MultiSigWallet.json';
|
|
||||||
import * as MultiSigWalletWithTimeLock from '../../generated-artifacts/MultiSigWalletWithTimeLock.json';
|
|
||||||
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
|
import * as OrderValidator from '../../generated-artifacts/OrderValidator.json';
|
||||||
import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
|
import * as ReentrantERC20Token from '../../generated-artifacts/ReentrantERC20Token.json';
|
||||||
import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
|
import * as TestAssetProxyDispatcher from '../../generated-artifacts/TestAssetProxyDispatcher.json';
|
||||||
import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
|
import * as TestAssetProxyOwner from '../../generated-artifacts/TestAssetProxyOwner.json';
|
||||||
import * as TestConstants from '../../generated-artifacts/TestConstants.json';
|
|
||||||
import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
|
import * as TestExchangeInternals from '../../generated-artifacts/TestExchangeInternals.json';
|
||||||
import * as TestLibBytes from '../../generated-artifacts/TestLibBytes.json';
|
|
||||||
import * as TestLibs from '../../generated-artifacts/TestLibs.json';
|
|
||||||
import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
|
import * as TestSignatureValidator from '../../generated-artifacts/TestSignatureValidator.json';
|
||||||
import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
|
import * as TestStaticCallReceiver from '../../generated-artifacts/TestStaticCallReceiver.json';
|
||||||
import * as Validator from '../../generated-artifacts/Validator.json';
|
import * as Validator from '../../generated-artifacts/Validator.json';
|
||||||
@ -61,16 +56,11 @@ export const artifacts = {
|
|||||||
InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
|
InvalidERC721Receiver: InvalidERC721Receiver as ContractArtifact,
|
||||||
MixinAuthorizable: MixinAuthorizable as ContractArtifact,
|
MixinAuthorizable: MixinAuthorizable as ContractArtifact,
|
||||||
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
|
MultiAssetProxy: MultiAssetProxy as ContractArtifact,
|
||||||
MultiSigWallet: MultiSigWallet as ContractArtifact,
|
|
||||||
MultiSigWalletWithTimeLock: MultiSigWalletWithTimeLock as ContractArtifact,
|
|
||||||
OrderValidator: OrderValidator as ContractArtifact,
|
OrderValidator: OrderValidator as ContractArtifact,
|
||||||
ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
|
ReentrantERC20Token: ReentrantERC20Token as ContractArtifact,
|
||||||
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
|
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
|
||||||
TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
|
TestAssetProxyOwner: TestAssetProxyOwner as ContractArtifact,
|
||||||
TestConstants: TestConstants as ContractArtifact,
|
|
||||||
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
|
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
|
||||||
TestLibBytes: TestLibBytes as ContractArtifact,
|
|
||||||
TestLibs: TestLibs as ContractArtifact,
|
|
||||||
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
|
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
|
||||||
TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
|
TestStaticCallReceiver: TestStaticCallReceiver as ContractArtifact,
|
||||||
Validator: Validator as ContractArtifact,
|
Validator: Validator as ContractArtifact,
|
||||||
|
@ -16,16 +16,11 @@ export * from '../../generated-wrappers/i_asset_data';
|
|||||||
export * from '../../generated-wrappers/i_asset_proxy';
|
export * from '../../generated-wrappers/i_asset_proxy';
|
||||||
export * from '../../generated-wrappers/invalid_erc721_receiver';
|
export * from '../../generated-wrappers/invalid_erc721_receiver';
|
||||||
export * from '../../generated-wrappers/mixin_authorizable';
|
export * from '../../generated-wrappers/mixin_authorizable';
|
||||||
export * from '../../generated-wrappers/multi_sig_wallet';
|
|
||||||
export * from '../../generated-wrappers/multi_sig_wallet_with_time_lock';
|
|
||||||
export * from '../../generated-wrappers/order_validator';
|
export * from '../../generated-wrappers/order_validator';
|
||||||
export * from '../../generated-wrappers/reentrant_erc20_token';
|
export * from '../../generated-wrappers/reentrant_erc20_token';
|
||||||
export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
|
export * from '../../generated-wrappers/test_asset_proxy_dispatcher';
|
||||||
export * from '../../generated-wrappers/test_asset_proxy_owner';
|
export * from '../../generated-wrappers/test_asset_proxy_owner';
|
||||||
export * from '../../generated-wrappers/test_constants';
|
|
||||||
export * from '../../generated-wrappers/test_exchange_internals';
|
export * from '../../generated-wrappers/test_exchange_internals';
|
||||||
export * from '../../generated-wrappers/test_lib_bytes';
|
|
||||||
export * from '../../generated-wrappers/test_libs';
|
|
||||||
export * from '../../generated-wrappers/test_signature_validator';
|
export * from '../../generated-wrappers/test_signature_validator';
|
||||||
export * from '../../generated-wrappers/test_static_call_receiver';
|
export * from '../../generated-wrappers/test_static_call_receiver';
|
||||||
export * from '../../generated-wrappers/validator';
|
export * from '../../generated-wrappers/validator';
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -6,10 +14,6 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
|
import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
expectTransactionFailedWithoutReasonAsync,
|
||||||
|
LogDecoder,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
@ -16,13 +26,8 @@ import { IAssetDataContract } from '../../generated-wrappers/i_asset_data';
|
|||||||
import { IAssetProxyContract } from '../../generated-wrappers/i_asset_proxy';
|
import { IAssetProxyContract } from '../../generated-wrappers/i_asset_proxy';
|
||||||
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
|
import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_proxy';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { LogDecoder } from '../utils/log_decoder';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -553,7 +558,7 @@ describe('Asset Transfer Proxies', () => {
|
|||||||
erc721Receiver.address,
|
erc721Receiver.address,
|
||||||
amount,
|
amount,
|
||||||
);
|
);
|
||||||
const logDecoder = new LogDecoder(web3Wrapper);
|
const logDecoder = new LogDecoder(web3Wrapper, artifacts);
|
||||||
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
const tx = await logDecoder.getTxWithDecodedLogsAsync(
|
||||||
await web3Wrapper.sendTransactionAsync({
|
await web3Wrapper.sendTransactionAsync({
|
||||||
to: erc721Proxy.address,
|
to: erc721Proxy.address,
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
getLatestBlockTimestampAsync,
|
||||||
|
increaseTimeAndMineBlockAsync,
|
||||||
|
OrderFactory,
|
||||||
|
OrderStatus,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
|
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
|
||||||
@ -19,16 +32,9 @@ import { MultiAssetProxyContract } from '../../generated-wrappers/multi_asset_pr
|
|||||||
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
||||||
import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
|
import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_static_call_receiver';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { ERC20BalancesByOwner, OrderStatus } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
LogDecoder,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, RevertReason } from '@0x/types';
|
import { AssetProxyId, RevertReason } from '@0x/types';
|
||||||
@ -14,13 +23,8 @@ import {
|
|||||||
TestAssetProxyDispatcherContract,
|
TestAssetProxyDispatcherContract,
|
||||||
} from '../../generated-wrappers/test_asset_proxy_dispatcher';
|
} from '../../generated-wrappers/test_asset_proxy_dispatcher';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { LogDecoder } from '../utils/log_decoder';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -145,7 +149,7 @@ describe('AssetProxyDispatcher', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should log an event with correct arguments when an asset proxy is registered', async () => {
|
it('should log an event with correct arguments when an asset proxy is registered', async () => {
|
||||||
const logDecoder = new LogDecoder(web3Wrapper);
|
const logDecoder = new LogDecoder(web3Wrapper, artifacts);
|
||||||
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
|
const txReceipt = await logDecoder.getTxWithDecodedLogsAsync(
|
||||||
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
|
await assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, { from: owner }),
|
||||||
);
|
);
|
||||||
|
@ -1,23 +1,25 @@
|
|||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
|
||||||
import * as _ from 'lodash';
|
|
||||||
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import {
|
|
||||||
FillOrderCombinatorialUtils,
|
|
||||||
fillOrderCombinatorialUtilsFactoryAsync,
|
|
||||||
} from '../utils/fill_order_combinatorial_utils';
|
|
||||||
import {
|
import {
|
||||||
AllowanceAmountScenario,
|
AllowanceAmountScenario,
|
||||||
AssetDataScenario,
|
AssetDataScenario,
|
||||||
BalanceAmountScenario,
|
BalanceAmountScenario,
|
||||||
|
chaiSetup,
|
||||||
ExpirationTimeSecondsScenario,
|
ExpirationTimeSecondsScenario,
|
||||||
FeeRecipientAddressScenario,
|
FeeRecipientAddressScenario,
|
||||||
FillScenario,
|
FillScenario,
|
||||||
OrderAssetAmountScenario,
|
OrderAssetAmountScenario,
|
||||||
|
provider,
|
||||||
TakerAssetFillAmountScenario,
|
TakerAssetFillAmountScenario,
|
||||||
TakerScenario,
|
TakerScenario,
|
||||||
} from '../utils/types';
|
txDefaults,
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import {
|
||||||
|
FillOrderCombinatorialUtils,
|
||||||
|
fillOrderCombinatorialUtilsFactoryAsync,
|
||||||
|
} from '../utils/fill_order_combinatorial_utils';
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
import {
|
||||||
|
bytes32Values,
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
FillResults,
|
||||||
|
getRevertReasonOrErrorMessageForSendTransactionAsync,
|
||||||
|
provider,
|
||||||
|
testCombinatoriallyWithReferenceFuncAsync,
|
||||||
|
txDefaults,
|
||||||
|
uint256Values,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { Order, RevertReason, SignedOrder } from '@0x/types';
|
import { Order, RevertReason, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -6,12 +18,6 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
|
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { getRevertReasonOrErrorMessageForSendTransactionAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { bytes32Values, testCombinatoriallyWithReferenceFuncAsync, uint256Values } from '../utils/combinatorial_utils';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { FillResults } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
ERC721TokenIdsByOwner,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
OrderFactory,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
@ -14,16 +25,10 @@ import { ExchangeContract } from '../../generated-wrappers/exchange';
|
|||||||
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
||||||
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
|
import { TestExchangeInternalsContract } from '../../generated-wrappers/test_exchange_internals';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { MatchOrderTester } from '../utils/match_order_tester';
|
import { MatchOrderTester } from '../utils/match_order_tester';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { ERC20BalancesByOwner, ERC721TokenIdsByOwner } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
|
@ -1,3 +1,14 @@
|
|||||||
|
import {
|
||||||
|
addressUtils,
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectContractCallFailedAsync,
|
||||||
|
LogDecoder,
|
||||||
|
OrderFactory,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils, signatureUtils } from '@0x/order-utils';
|
||||||
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
|
import { RevertReason, SignatureType, SignedOrder } from '@0x/types';
|
||||||
@ -13,13 +24,6 @@ import { TestStaticCallReceiverContract } from '../../generated-wrappers/test_st
|
|||||||
import { ValidatorContract } from '../../generated-wrappers/validator';
|
import { ValidatorContract } from '../../generated-wrappers/validator';
|
||||||
import { WalletContract } from '../../generated-wrappers/wallet';
|
import { WalletContract } from '../../generated-wrappers/wallet';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { addressUtils } from '../utils/address_utils';
|
|
||||||
import { expectContractCallFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { LogDecoder } from '../utils/log_decoder';
|
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -73,7 +77,7 @@ describe('MixinSignatureValidator', () => {
|
|||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
);
|
);
|
||||||
signatureValidatorLogDecoder = new LogDecoder(web3Wrapper);
|
signatureValidatorLogDecoder = new LogDecoder(web3Wrapper, artifacts);
|
||||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||||
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
|
await signatureValidator.setSignatureValidatorApproval.sendTransactionAsync(testValidator.address, true, {
|
||||||
from: signerAddress,
|
from: signerAddress,
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
OrderFactory,
|
||||||
|
orderUtils,
|
||||||
|
provider,
|
||||||
|
SignedTransaction,
|
||||||
|
TransactionFactory,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
|
import { OrderWithoutExchangeAddress, RevertReason, SignedOrder } from '@0x/types';
|
||||||
@ -11,16 +24,8 @@ import { ExchangeContract } from '../../generated-wrappers/exchange';
|
|||||||
import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper';
|
import { ExchangeWrapperContract } from '../../generated-wrappers/exchange_wrapper';
|
||||||
import { WhitelistContract } from '../../generated-wrappers/whitelist';
|
import { WhitelistContract } from '../../generated-wrappers/whitelist';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { orderUtils } from '../utils/order_utils';
|
|
||||||
import { TransactionFactory } from '../utils/transaction_factory';
|
|
||||||
import { ERC20BalancesByOwner, SignedTransaction } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
getLatestBlockTimestampAsync,
|
||||||
|
increaseTimeAndMineBlockAsync,
|
||||||
|
OrderFactory,
|
||||||
|
OrderStatus,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { RevertReason, SignedOrder } from '@0x/types';
|
import { RevertReason, SignedOrder } from '@0x/types';
|
||||||
@ -13,16 +26,9 @@ import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
|||||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||||
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
import { ReentrantERC20TokenContract } from '../../generated-wrappers/reentrant_erc20_token';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { getLatestBlockTimestampAsync, increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { ERC20BalancesByOwner, OrderStatus } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,15 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ContractName,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
getLatestBlockTimestampAsync,
|
||||||
|
OrderFactory,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { RevertReason, SignedOrder } from '@0x/types';
|
import { RevertReason, SignedOrder } from '@0x/types';
|
||||||
@ -14,16 +26,9 @@ import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
|
|||||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||||
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync } from '../utils/assertions';
|
|
||||||
import { getLatestBlockTimestampAsync } from '../utils/block_timestamp';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { ContractName, ERC20BalancesByOwner } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -57,16 +62,6 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
let erc721MakerAssetIds: BigNumber[];
|
let erc721MakerAssetIds: BigNumber[];
|
||||||
const tenMinutesInSeconds = 10 * 60;
|
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 {
|
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
|
||||||
return ethUtil.bufferToHex(
|
return ethUtil.bufferToHex(
|
||||||
Buffer.concat([
|
Buffer.concat([
|
||||||
@ -271,34 +266,6 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
erc20Balances[takerAddress][wethContract.address].minus(beforeAuctionDetails.currentAmount),
|
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 () => {
|
it('maker fees on sellOrder are paid to the fee receipient', async () => {
|
||||||
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
|
||||||
makerFee: new BigNumber(1),
|
makerFee: new BigNumber(1),
|
||||||
@ -370,7 +337,6 @@ describe(ContractName.DutchAuction, () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('cannot be filled for less than the current price', async () => {
|
it('cannot be filled for less than the current price', async () => {
|
||||||
await increaseTimeAsync();
|
|
||||||
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
|
||||||
makerAssetAmount: sellOrder.takerAssetAmount,
|
makerAssetAmount: sellOrder.takerAssetAmount,
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
ContractName,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
expectContractCreationFailedAsync,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
OrderFactory,
|
||||||
|
provider,
|
||||||
|
sendTransactionResult,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { RevertReason, SignedOrder } from '@0x/types';
|
import { RevertReason, SignedOrder } from '@0x/types';
|
||||||
@ -12,20 +25,10 @@ import { ExchangeContract } from '../../generated-wrappers/exchange';
|
|||||||
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
||||||
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import {
|
|
||||||
expectContractCreationFailedAsync,
|
|
||||||
expectTransactionFailedAsync,
|
|
||||||
sendTransactionResult,
|
|
||||||
} from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { ForwarderWrapper } from '../utils/forwarder_wrapper';
|
import { ForwarderWrapper } from '../utils/forwarder_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { ContractName, ERC20BalancesByOwner } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
OrderFactory,
|
||||||
|
OrderStatus,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
@ -12,14 +21,9 @@ import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
|||||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||||
import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
|
import { OrderValidatorContract } from '../../generated-wrappers/order_validator';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
import { ERC20Wrapper } from '../utils/erc20_wrapper';
|
||||||
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
import { ERC721Wrapper } from '../utils/erc721_wrapper';
|
||||||
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
import { ExchangeWrapper } from '../utils/exchange_wrapper';
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { OrderStatus } from '../utils/types';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
import { env, EnvVars } from '@0x/dev-utils';
|
import { env, EnvVars } from '@0x/dev-utils';
|
||||||
|
|
||||||
import { coverage } from './utils/coverage';
|
import { coverage, profiler, provider } from '@0x/contracts-test-utils';
|
||||||
import { profiler } from './utils/profiler';
|
before('start web3 provider', () => {
|
||||||
|
provider.start();
|
||||||
|
});
|
||||||
after('generate coverage report', async () => {
|
after('generate coverage report', async () => {
|
||||||
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
if (env.parseBoolean(EnvVars.SolidityCoverage)) {
|
||||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||||
@ -12,4 +13,5 @@ after('generate coverage report', async () => {
|
|||||||
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
const profilerSubprovider = profiler.getProfilerSubproviderSingleton();
|
||||||
await profilerSubprovider.writeProfilerOutputAsync();
|
await profilerSubprovider.writeProfilerOutputAsync();
|
||||||
}
|
}
|
||||||
|
provider.stop();
|
||||||
});
|
});
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectContractCallFailedAsync,
|
||||||
|
expectContractCreationFailedAsync,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
expectTransactionFailedWithoutReasonAsync,
|
||||||
|
increaseTimeAndMineBlockAsync,
|
||||||
|
provider,
|
||||||
|
sendTransactionResult,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -14,18 +27,7 @@ import {
|
|||||||
import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
|
import { MixinAuthorizableContract } from '../../generated-wrappers/mixin_authorizable';
|
||||||
import { TestAssetProxyOwnerContract } from '../../generated-wrappers/test_asset_proxy_owner';
|
import { TestAssetProxyOwnerContract } from '../../generated-wrappers/test_asset_proxy_owner';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import {
|
import { AssetProxyOwnerWrapper } from '../utils/asset_proxy_owner_wrapper';
|
||||||
expectContractCallFailedAsync,
|
|
||||||
expectContractCreationFailedAsync,
|
|
||||||
expectTransactionFailedAsync,
|
|
||||||
expectTransactionFailedWithoutReasonAsync,
|
|
||||||
sendTransactionResult,
|
|
||||||
} from '../utils/assertions';
|
|
||||||
import { increaseTimeAndMineBlockAsync } from '../utils/block_timestamp';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { MultiSigWrapper } from '../utils/multi_sig_wrapper';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -41,7 +43,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
let erc20Proxy: MixinAuthorizableContract;
|
let erc20Proxy: MixinAuthorizableContract;
|
||||||
let erc721Proxy: MixinAuthorizableContract;
|
let erc721Proxy: MixinAuthorizableContract;
|
||||||
let testAssetProxyOwner: TestAssetProxyOwnerContract;
|
let testAssetProxyOwner: TestAssetProxyOwnerContract;
|
||||||
let multiSigWrapper: MultiSigWrapper;
|
let assetProxyOwnerWrapper: AssetProxyOwnerWrapper;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
@ -75,7 +77,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
REQUIRED_APPROVALS,
|
REQUIRED_APPROVALS,
|
||||||
SECONDS_TIME_LOCKED,
|
SECONDS_TIME_LOCKED,
|
||||||
);
|
);
|
||||||
multiSigWrapper = new MultiSigWrapper(testAssetProxyOwner, provider);
|
assetProxyOwnerWrapper = new AssetProxyOwnerWrapper(testAssetProxyOwner, provider);
|
||||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||||
await erc20Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
|
await erc20Proxy.transferOwnership.sendTransactionAsync(testAssetProxyOwner.address, {
|
||||||
from: initialOwner,
|
from: initialOwner,
|
||||||
@ -172,7 +174,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
addressToRegister,
|
addressToRegister,
|
||||||
isRegistered,
|
isRegistered,
|
||||||
);
|
);
|
||||||
const submitTxRes = await multiSigWrapper.submitTransactionAsync(
|
const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
testAssetProxyOwner.address,
|
testAssetProxyOwner.address,
|
||||||
registerAssetProxyData,
|
registerAssetProxyData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -181,10 +183,10 @@ describe('AssetProxyOwner', () => {
|
|||||||
const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = log.args.transactionId;
|
const txId = log.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
||||||
|
|
||||||
const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]);
|
const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]);
|
||||||
const registerLog = executeTxRes.logs[0] as LogWithDecodedArgs<
|
const registerLog = executeTxRes.logs[0] as LogWithDecodedArgs<
|
||||||
AssetProxyOwnerAssetProxyRegistrationEventArgs
|
AssetProxyOwnerAssetProxyRegistrationEventArgs
|
||||||
>;
|
>;
|
||||||
@ -204,7 +206,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
addressToRegister,
|
addressToRegister,
|
||||||
isRegistered,
|
isRegistered,
|
||||||
);
|
);
|
||||||
const submitTxRes = await multiSigWrapper.submitTransactionAsync(
|
const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
testAssetProxyOwner.address,
|
testAssetProxyOwner.address,
|
||||||
registerAssetProxyData,
|
registerAssetProxyData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -212,10 +214,10 @@ describe('AssetProxyOwner', () => {
|
|||||||
const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const log = submitTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = log.args.transactionId;
|
const txId = log.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
||||||
|
|
||||||
const executeTxRes = await multiSigWrapper.executeTransactionAsync(txId, owners[0]);
|
const executeTxRes = await assetProxyOwnerWrapper.executeTransactionAsync(txId, owners[0]);
|
||||||
const failureLog = executeTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerExecutionFailureEventArgs>;
|
const failureLog = executeTxRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerExecutionFailureEventArgs>;
|
||||||
expect(failureLog.args.transactionId).to.be.bignumber.equal(txId);
|
expect(failureLog.args.transactionId).to.be.bignumber.equal(txId);
|
||||||
|
|
||||||
@ -237,7 +239,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
addressToRegister,
|
addressToRegister,
|
||||||
isRegistered,
|
isRegistered,
|
||||||
);
|
);
|
||||||
const registerAssetProxySubmitRes = await multiSigWrapper.submitTransactionAsync(
|
const registerAssetProxySubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
testAssetProxyOwner.address,
|
testAssetProxyOwner.address,
|
||||||
registerAssetProxyData,
|
registerAssetProxyData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -247,12 +249,12 @@ describe('AssetProxyOwner', () => {
|
|||||||
>;
|
>;
|
||||||
|
|
||||||
const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(authorized);
|
const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(authorized);
|
||||||
const erc20AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync(
|
const erc20AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
addAuthorizedAddressData,
|
addAuthorizedAddressData,
|
||||||
owners[0],
|
owners[0],
|
||||||
);
|
);
|
||||||
const erc721AddAuthorizedAddressSubmitRes = await multiSigWrapper.submitTransactionAsync(
|
const erc721AddAuthorizedAddressSubmitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc721Proxy.address,
|
erc721Proxy.address,
|
||||||
addAuthorizedAddressData,
|
addAuthorizedAddressData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -267,15 +269,15 @@ describe('AssetProxyOwner', () => {
|
|||||||
const erc20AddAuthorizedAddressTxId = erc20AddAuthorizedAddressSubmitLog.args.transactionId;
|
const erc20AddAuthorizedAddressTxId = erc20AddAuthorizedAddressSubmitLog.args.transactionId;
|
||||||
const erc721AddAuthorizedAddressTxId = erc721AddAuthorizedAddressSubmitLog.args.transactionId;
|
const erc721AddAuthorizedAddressTxId = erc721AddAuthorizedAddressSubmitLog.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(registerAssetProxyTxId, owners[1]);
|
||||||
await multiSigWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(erc20AddAuthorizedAddressTxId, owners[1]);
|
||||||
await multiSigWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(erc721AddAuthorizedAddressTxId, owners[1]);
|
||||||
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
await increaseTimeAndMineBlockAsync(SECONDS_TIME_LOCKED.toNumber());
|
||||||
await multiSigWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]);
|
await assetProxyOwnerWrapper.executeTransactionAsync(registerAssetProxyTxId, owners[0]);
|
||||||
await multiSigWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], {
|
await assetProxyOwnerWrapper.executeTransactionAsync(erc20AddAuthorizedAddressTxId, owners[0], {
|
||||||
gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
|
gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
|
||||||
});
|
});
|
||||||
await multiSigWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], {
|
await assetProxyOwnerWrapper.executeTransactionAsync(erc721AddAuthorizedAddressTxId, owners[0], {
|
||||||
gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
|
gas: constants.MAX_EXECUTE_TRANSACTION_GAS,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -285,7 +287,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
|
const notRemoveAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
|
||||||
authorized,
|
authorized,
|
||||||
);
|
);
|
||||||
const submitTxRes = await multiSigWrapper.submitTransactionAsync(
|
const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
notRemoveAuthorizedAddressData,
|
notRemoveAuthorizedAddressData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -303,7 +305,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc20Index,
|
erc20Index,
|
||||||
);
|
);
|
||||||
const submitTxRes = await multiSigWrapper.submitTransactionAsync(
|
const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -321,7 +323,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc721Index,
|
erc721Index,
|
||||||
);
|
);
|
||||||
const submitTxRes = await multiSigWrapper.submitTransactionAsync(
|
const submitTxRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc721Proxy.address,
|
erc721Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -341,7 +343,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc20Index,
|
erc20Index,
|
||||||
);
|
);
|
||||||
const res = await multiSigWrapper.submitTransactionAsync(
|
const res = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -362,7 +364,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc721Index,
|
erc721Index,
|
||||||
);
|
);
|
||||||
const res = await multiSigWrapper.submitTransactionAsync(
|
const res = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc721Proxy.address,
|
erc721Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -370,7 +372,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = log.args.transactionId;
|
const txId = log.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
|
|
||||||
return expectTransactionFailedAsync(
|
return expectTransactionFailedAsync(
|
||||||
testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
|
testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
|
||||||
@ -385,7 +387,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
|
const addAuthorizedAddressData = erc20Proxy.addAuthorizedAddress.getABIEncodedTransactionData(
|
||||||
newAuthorized,
|
newAuthorized,
|
||||||
);
|
);
|
||||||
const res = await multiSigWrapper.submitTransactionAsync(
|
const res = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
addAuthorizedAddressData,
|
addAuthorizedAddressData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -393,7 +395,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const log = res.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = log.args.transactionId;
|
const txId = log.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
|
|
||||||
return expectTransactionFailedAsync(
|
return expectTransactionFailedAsync(
|
||||||
testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
|
testAssetProxyOwner.executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(txId, {
|
||||||
@ -411,7 +413,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc20Index,
|
erc20Index,
|
||||||
);
|
);
|
||||||
const submitRes = await multiSigWrapper.submitTransactionAsync(
|
const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -419,9 +421,12 @@ describe('AssetProxyOwner', () => {
|
|||||||
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = submitLog.args.transactionId;
|
const txId = submitLog.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
|
|
||||||
const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]);
|
const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(
|
||||||
|
txId,
|
||||||
|
owners[0],
|
||||||
|
);
|
||||||
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
||||||
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
||||||
|
|
||||||
@ -441,7 +446,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc20Index,
|
erc20Index,
|
||||||
);
|
);
|
||||||
const submitRes = await multiSigWrapper.submitTransactionAsync(
|
const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -449,9 +454,9 @@ describe('AssetProxyOwner', () => {
|
|||||||
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = submitLog.args.transactionId;
|
const txId = submitLog.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
|
|
||||||
const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner);
|
const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, notOwner);
|
||||||
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
||||||
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
||||||
|
|
||||||
@ -468,7 +473,7 @@ describe('AssetProxyOwner', () => {
|
|||||||
authorized,
|
authorized,
|
||||||
erc20Index,
|
erc20Index,
|
||||||
);
|
);
|
||||||
const submitRes = await multiSigWrapper.submitTransactionAsync(
|
const submitRes = await assetProxyOwnerWrapper.submitTransactionAsync(
|
||||||
erc20Proxy.address,
|
erc20Proxy.address,
|
||||||
removeAuthorizedAddressAtIndexData,
|
removeAuthorizedAddressAtIndexData,
|
||||||
owners[0],
|
owners[0],
|
||||||
@ -476,9 +481,12 @@ describe('AssetProxyOwner', () => {
|
|||||||
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
const submitLog = submitRes.logs[0] as LogWithDecodedArgs<AssetProxyOwnerSubmissionEventArgs>;
|
||||||
const txId = submitLog.args.transactionId;
|
const txId = submitLog.args.transactionId;
|
||||||
|
|
||||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
await assetProxyOwnerWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||||
|
|
||||||
const execRes = await multiSigWrapper.executeRemoveAuthorizedAddressAtIndexAsync(txId, owners[0]);
|
const execRes = await assetProxyOwnerWrapper.executeRemoveAuthorizedAddressAtIndexAsync(
|
||||||
|
txId,
|
||||||
|
owners[0],
|
||||||
|
);
|
||||||
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
const execLog = execRes.logs[1] as LogWithDecodedArgs<AssetProxyOwnerExecutionEventArgs>;
|
||||||
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
expect(execLog.args.transactionId).to.be.bignumber.equal(txId);
|
||||||
|
|
||||||
@ -495,4 +503,4 @@ describe('AssetProxyOwner', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// tslint:enable:no-unnecessary-type-assertion
|
// tslint:disable-line max-file-line-count
|
||||||
|
@ -1,3 +1,13 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
expectTransactionFailedWithoutReasonAsync,
|
||||||
|
LogDecoder,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -14,11 +24,6 @@ import {
|
|||||||
} from '../../generated-wrappers/dummy_erc721_token';
|
} from '../../generated-wrappers/dummy_erc721_token';
|
||||||
import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
|
import { InvalidERC721ReceiverContract } from '../../generated-wrappers/invalid_erc721_receiver';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectTransactionFailedAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { LogDecoder } from '../utils/log_decoder';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -53,7 +58,7 @@ describe('ERC721Token', () => {
|
|||||||
provider,
|
provider,
|
||||||
txDefaults,
|
txDefaults,
|
||||||
);
|
);
|
||||||
logDecoder = new LogDecoder(web3Wrapper);
|
logDecoder = new LogDecoder(web3Wrapper, artifacts);
|
||||||
await web3Wrapper.awaitTransactionSuccessAsync(
|
await web3Wrapper.awaitTransactionSuccessAsync(
|
||||||
await token.mint.sendTransactionAsync(owner, tokenId, { from: owner }),
|
await token.mint.sendTransactionAsync(owner, tokenId, { from: owner }),
|
||||||
constants.AWAIT_TRANSACTION_MINED_MS,
|
constants.AWAIT_TRANSACTION_MINED_MS,
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectContractCallFailedAsync,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { RevertReason } from '@0x/types';
|
import { RevertReason } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -5,10 +13,6 @@ import * as chai from 'chai';
|
|||||||
|
|
||||||
import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
|
import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectContractCallFailedAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectInsufficientFundsAsync,
|
||||||
|
expectTransactionFailedWithoutReasonAsync,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -5,10 +14,6 @@ import * as chai from 'chai';
|
|||||||
|
|
||||||
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
import { WETH9Contract } from '../../generated-wrappers/weth9';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { expectInsufficientFundsAsync, expectTransactionFailedWithoutReasonAsync } from '../utils/assertions';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { chaiSetup, constants, provider, txDefaults, web3Wrapper } from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -5,9 +6,6 @@ import * as chai from 'chai';
|
|||||||
|
|
||||||
import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
|
import { ZRXTokenContract } from '../../generated-wrappers/zrx_token';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
|
69
contracts/core/test/utils/asset_proxy_owner_wrapper.ts
Normal file
69
contracts/core/test/utils/asset_proxy_owner_wrapper.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { LogDecoder } from '@0x/contracts-test-utils';
|
||||||
|
import { BigNumber } from '@0x/utils';
|
||||||
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
|
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
|
import { AssetProxyOwnerContract } from '../../generated-wrappers/asset_proxy_owner';
|
||||||
|
import { artifacts } from '../../src/artifacts';
|
||||||
|
|
||||||
|
export class AssetProxyOwnerWrapper {
|
||||||
|
private readonly _assetProxyOwner: AssetProxyOwnerContract;
|
||||||
|
private readonly _web3Wrapper: Web3Wrapper;
|
||||||
|
private readonly _logDecoder: LogDecoder;
|
||||||
|
constructor(assetproxyOwnerContract: AssetProxyOwnerContract, provider: Provider) {
|
||||||
|
this._assetProxyOwner = assetproxyOwnerContract;
|
||||||
|
this._web3Wrapper = new Web3Wrapper(provider);
|
||||||
|
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
|
||||||
|
}
|
||||||
|
public async submitTransactionAsync(
|
||||||
|
destination: string,
|
||||||
|
data: string,
|
||||||
|
from: string,
|
||||||
|
opts: { value?: BigNumber } = {},
|
||||||
|
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
const value = _.isUndefined(opts.value) ? new BigNumber(0) : opts.value;
|
||||||
|
const txHash = await this._assetProxyOwner.submitTransaction.sendTransactionAsync(destination, value, data, {
|
||||||
|
from,
|
||||||
|
});
|
||||||
|
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
public async confirmTransactionAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
const txHash = await this._assetProxyOwner.confirmTransaction.sendTransactionAsync(txId, { from });
|
||||||
|
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
public async revokeConfirmationAsync(txId: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
const txHash = await this._assetProxyOwner.revokeConfirmation.sendTransactionAsync(txId, { from });
|
||||||
|
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
public async executeTransactionAsync(
|
||||||
|
txId: BigNumber,
|
||||||
|
from: string,
|
||||||
|
opts: { gas?: number } = {},
|
||||||
|
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
const txHash = await this._assetProxyOwner.executeTransaction.sendTransactionAsync(txId, {
|
||||||
|
from,
|
||||||
|
gas: opts.gas,
|
||||||
|
});
|
||||||
|
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
public async executeRemoveAuthorizedAddressAtIndexAsync(
|
||||||
|
txId: BigNumber,
|
||||||
|
from: string,
|
||||||
|
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||||
|
// tslint:disable-next-line:no-unnecessary-type-assertion
|
||||||
|
const txHash = await (this
|
||||||
|
._assetProxyOwner as AssetProxyOwnerContract).executeRemoveAuthorizedAddressAtIndex.sendTransactionAsync(
|
||||||
|
txId,
|
||||||
|
{
|
||||||
|
from,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||||
|
return tx;
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,9 @@
|
|||||||
|
import { AbstractAssetWrapper, constants } from '@0x/contracts-test-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId } from '@0x/types';
|
import { AssetProxyId } from '@0x/types';
|
||||||
import { BigNumber, errorUtils } from '@0x/utils';
|
import { BigNumber, errorUtils } from '@0x/utils';
|
||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { AbstractAssetWrapper } from './abstract_asset_wrapper';
|
|
||||||
import { constants } from './constants';
|
|
||||||
import { ERC20Wrapper } from './erc20_wrapper';
|
import { ERC20Wrapper } from './erc20_wrapper';
|
||||||
import { ERC721Wrapper } from './erc721_wrapper';
|
import { ERC721Wrapper } from './erc721_wrapper';
|
||||||
|
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { constants, ERC20BalancesByOwner, txDefaults } from '@0x/contracts-test-utils';
|
||||||
import { assetDataUtils } from '@0x/order-utils';
|
import { assetDataUtils } from '@0x/order-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -8,10 +9,6 @@ import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_to
|
|||||||
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
|
import { ERC20ProxyContract } from '../../generated-wrappers/erc20_proxy';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
|
|
||||||
import { constants } from './constants';
|
|
||||||
import { ERC20BalancesByOwner } from './types';
|
|
||||||
import { txDefaults } from './web3_wrapper';
|
|
||||||
|
|
||||||
export class ERC20Wrapper {
|
export class ERC20Wrapper {
|
||||||
private readonly _tokenOwnerAddresses: string[];
|
private readonly _tokenOwnerAddresses: string[];
|
||||||
private readonly _contractOwnerAddress: string;
|
private readonly _contractOwnerAddress: string;
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { constants, ERC721TokenIdsByOwner, txDefaults } from '@0x/contracts-test-utils';
|
||||||
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
import { generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -8,10 +9,6 @@ import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_
|
|||||||
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
import { ERC721ProxyContract } from '../../generated-wrappers/erc721_proxy';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
|
|
||||||
import { constants } from './constants';
|
|
||||||
import { ERC721TokenIdsByOwner } from './types';
|
|
||||||
import { txDefaults } from './web3_wrapper';
|
|
||||||
|
|
||||||
export class ERC721Wrapper {
|
export class ERC721Wrapper {
|
||||||
private readonly _tokenOwnerAddresses: string[];
|
private readonly _tokenOwnerAddresses: string[];
|
||||||
private readonly _contractOwnerAddress: string;
|
private readonly _contractOwnerAddress: string;
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
|
import {
|
||||||
|
FillResults,
|
||||||
|
formatters,
|
||||||
|
LogDecoder,
|
||||||
|
OrderInfo,
|
||||||
|
orderUtils,
|
||||||
|
SignedTransaction,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
|
||||||
|
|
||||||
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
import { ExchangeContract } from '../../generated-wrappers/exchange';
|
||||||
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { formatters } from './formatters';
|
|
||||||
import { LogDecoder } from './log_decoder';
|
|
||||||
import { orderUtils } from './order_utils';
|
|
||||||
import { FillResults, OrderInfo, SignedTransaction } from './types';
|
|
||||||
|
|
||||||
export class ExchangeWrapper {
|
export class ExchangeWrapper {
|
||||||
private readonly _exchange: ExchangeContract;
|
private readonly _exchange: ExchangeContract;
|
||||||
@ -17,7 +21,7 @@ export class ExchangeWrapper {
|
|||||||
constructor(exchangeContract: ExchangeContract, provider: Provider) {
|
constructor(exchangeContract: ExchangeContract, provider: Provider) {
|
||||||
this._exchange = exchangeContract;
|
this._exchange = exchangeContract;
|
||||||
this._web3Wrapper = new Web3Wrapper(provider);
|
this._web3Wrapper = new Web3Wrapper(provider);
|
||||||
this._logDecoder = new LogDecoder(this._web3Wrapper);
|
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
|
||||||
}
|
}
|
||||||
public async fillOrderAsync(
|
public async fillOrderAsync(
|
||||||
signedOrder: SignedOrder,
|
signedOrder: SignedOrder,
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
import { artifacts as libsArtifacts, TestLibsContract } from '@0x/contracts-libs';
|
||||||
|
import {
|
||||||
|
AllowanceAmountScenario,
|
||||||
|
AssetDataScenario,
|
||||||
|
BalanceAmountScenario,
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
expectTransactionFailedAsync,
|
||||||
|
ExpirationTimeSecondsScenario,
|
||||||
|
FeeRecipientAddressScenario,
|
||||||
|
FillScenario,
|
||||||
|
OrderAssetAmountScenario,
|
||||||
|
orderUtils,
|
||||||
|
signingUtils,
|
||||||
|
TakerAssetFillAmountScenario,
|
||||||
|
TakerScenario,
|
||||||
|
TraderStateScenario,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import {
|
import {
|
||||||
assetDataUtils,
|
assetDataUtils,
|
||||||
BalanceAndProxyAllowanceLazyStore,
|
BalanceAndProxyAllowanceLazyStore,
|
||||||
@ -15,33 +33,15 @@ import * as _ from 'lodash';
|
|||||||
import 'make-promises-safe';
|
import 'make-promises-safe';
|
||||||
|
|
||||||
import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
|
import { ExchangeContract, ExchangeFillEventArgs } from '../../generated-wrappers/exchange';
|
||||||
import { TestLibsContract } from '../../generated-wrappers/test_libs';
|
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
|
|
||||||
import { expectTransactionFailedAsync } from './assertions';
|
|
||||||
import { AssetWrapper } from './asset_wrapper';
|
import { AssetWrapper } from './asset_wrapper';
|
||||||
import { chaiSetup } from './chai_setup';
|
|
||||||
import { constants } from './constants';
|
|
||||||
import { ERC20Wrapper } from './erc20_wrapper';
|
import { ERC20Wrapper } from './erc20_wrapper';
|
||||||
import { ERC721Wrapper } from './erc721_wrapper';
|
import { ERC721Wrapper } from './erc721_wrapper';
|
||||||
import { ExchangeWrapper } from './exchange_wrapper';
|
import { ExchangeWrapper } from './exchange_wrapper';
|
||||||
import { OrderFactoryFromScenario } from './order_factory_from_scenario';
|
import { OrderFactoryFromScenario } from './order_factory_from_scenario';
|
||||||
import { orderUtils } from './order_utils';
|
|
||||||
import { signingUtils } from './signing_utils';
|
|
||||||
import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher';
|
import { SimpleAssetBalanceAndProxyAllowanceFetcher } from './simple_asset_balance_and_proxy_allowance_fetcher';
|
||||||
import { SimpleOrderFilledCancelledFetcher } from './simple_order_filled_cancelled_fetcher';
|
import { SimpleOrderFilledCancelledFetcher } from './simple_order_filled_cancelled_fetcher';
|
||||||
import {
|
|
||||||
AllowanceAmountScenario,
|
|
||||||
AssetDataScenario,
|
|
||||||
BalanceAmountScenario,
|
|
||||||
ExpirationTimeSecondsScenario,
|
|
||||||
FeeRecipientAddressScenario,
|
|
||||||
FillScenario,
|
|
||||||
OrderAssetAmountScenario,
|
|
||||||
TakerAssetFillAmountScenario,
|
|
||||||
TakerScenario,
|
|
||||||
TraderStateScenario,
|
|
||||||
} from './types';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -131,7 +131,11 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
|
|||||||
exchangeContract.address,
|
exchangeContract.address,
|
||||||
);
|
);
|
||||||
|
|
||||||
const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
const testLibsContract = await TestLibsContract.deployFrom0xArtifactAsync(
|
||||||
|
libsArtifacts.TestLibs,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
);
|
||||||
|
|
||||||
const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
|
const fillOrderCombinatorialUtils = new FillOrderCombinatorialUtils(
|
||||||
orderFactory,
|
orderFactory,
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import { Web3Wrapper } from '@0x/web3-wrapper';
|
import { Web3Wrapper } from '@0x/web3-wrapper';
|
||||||
@ -5,11 +6,7 @@ import { Provider, TransactionReceiptWithDecodedLogs, TxDataPayable } from 'ethe
|
|||||||
import * as _ from 'lodash';
|
import * as _ from 'lodash';
|
||||||
|
|
||||||
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
import { ForwarderContract } from '../../generated-wrappers/forwarder';
|
||||||
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { constants } from './constants';
|
|
||||||
import { formatters } from './formatters';
|
|
||||||
import { LogDecoder } from './log_decoder';
|
|
||||||
import { MarketSellOrders } from './types';
|
|
||||||
|
|
||||||
export class ForwarderWrapper {
|
export class ForwarderWrapper {
|
||||||
private readonly _web3Wrapper: Web3Wrapper;
|
private readonly _web3Wrapper: Web3Wrapper;
|
||||||
@ -61,7 +58,7 @@ export class ForwarderWrapper {
|
|||||||
constructor(contractInstance: ForwarderContract, provider: Provider) {
|
constructor(contractInstance: ForwarderContract, provider: Provider) {
|
||||||
this._forwarderContract = contractInstance;
|
this._forwarderContract = contractInstance;
|
||||||
this._web3Wrapper = new Web3Wrapper(provider);
|
this._web3Wrapper = new Web3Wrapper(provider);
|
||||||
this._logDecoder = new LogDecoder(this._web3Wrapper);
|
this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
|
||||||
}
|
}
|
||||||
public async marketSellOrdersWithEthAsync(
|
public async marketSellOrdersWithEthAsync(
|
||||||
orders: SignedOrder[],
|
orders: SignedOrder[],
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
|
import {
|
||||||
|
chaiSetup,
|
||||||
|
ERC20BalancesByOwner,
|
||||||
|
ERC721TokenIdsByOwner,
|
||||||
|
OrderInfo,
|
||||||
|
OrderStatus,
|
||||||
|
TransferAmountsByMatchOrders as TransferAmounts,
|
||||||
|
TransferAmountsLoggedByMatchOrders as LoggedTransferAmounts,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { AssetProxyId, SignedOrder } from '@0x/types';
|
import { AssetProxyId, SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
@ -6,18 +15,9 @@ import * as _ from 'lodash';
|
|||||||
|
|
||||||
import { TransactionReceiptWithDecodedLogs } from '../../../../node_modules/ethereum-types';
|
import { TransactionReceiptWithDecodedLogs } from '../../../../node_modules/ethereum-types';
|
||||||
|
|
||||||
import { chaiSetup } from './chai_setup';
|
|
||||||
import { ERC20Wrapper } from './erc20_wrapper';
|
import { ERC20Wrapper } from './erc20_wrapper';
|
||||||
import { ERC721Wrapper } from './erc721_wrapper';
|
import { ERC721Wrapper } from './erc721_wrapper';
|
||||||
import { ExchangeWrapper } from './exchange_wrapper';
|
import { ExchangeWrapper } from './exchange_wrapper';
|
||||||
import {
|
|
||||||
ERC20BalancesByOwner,
|
|
||||||
ERC721TokenIdsByOwner,
|
|
||||||
OrderInfo,
|
|
||||||
OrderStatus,
|
|
||||||
TransferAmountsByMatchOrders as TransferAmounts,
|
|
||||||
TransferAmountsLoggedByMatchOrders as LoggedTransferAmounts,
|
|
||||||
} from './types';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -270,18 +270,14 @@ export class MatchOrderTester {
|
|||||||
const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)
|
const leftExpectedStatus = expectedTransferAmounts.amountBoughtByLeftMaker.equals(maxAmountBoughtByLeftMaker)
|
||||||
? OrderStatus.FULLY_FILLED
|
? OrderStatus.FULLY_FILLED
|
||||||
: OrderStatus.FILLABLE;
|
: OrderStatus.FILLABLE;
|
||||||
expect(leftOrderInfo.orderStatus as OrderStatus, 'Checking exchange status for left order').to.be.equal(
|
expect(leftOrderInfo.orderStatus, 'Checking exchange status for left order').to.be.equal(leftExpectedStatus);
|
||||||
leftExpectedStatus,
|
|
||||||
);
|
|
||||||
// Assert right order status
|
// Assert right order status
|
||||||
const maxAmountBoughtByRightMaker = signedOrderRight.takerAssetAmount.minus(initialRightOrderFilledAmount);
|
const maxAmountBoughtByRightMaker = signedOrderRight.takerAssetAmount.minus(initialRightOrderFilledAmount);
|
||||||
const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight);
|
const rightOrderInfo: OrderInfo = await this._exchangeWrapper.getOrderInfoAsync(signedOrderRight);
|
||||||
const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)
|
const rightExpectedStatus = expectedTransferAmounts.amountBoughtByRightMaker.equals(maxAmountBoughtByRightMaker)
|
||||||
? OrderStatus.FULLY_FILLED
|
? OrderStatus.FULLY_FILLED
|
||||||
: OrderStatus.FILLABLE;
|
: OrderStatus.FILLABLE;
|
||||||
expect(rightOrderInfo.orderStatus as OrderStatus, 'Checking exchange status for right order').to.be.equal(
|
expect(rightOrderInfo.orderStatus, 'Checking exchange status for right order').to.be.equal(rightExpectedStatus);
|
||||||
rightExpectedStatus,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
/// @dev Asserts account balances after matching orders.
|
/// @dev Asserts account balances after matching orders.
|
||||||
/// @param signedOrderLeft First matched order.
|
/// @param signedOrderLeft First matched order.
|
||||||
|
@ -1,19 +1,18 @@
|
|||||||
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
|
||||||
import { Order } from '@0x/types';
|
|
||||||
import { BigNumber, errorUtils } from '@0x/utils';
|
|
||||||
|
|
||||||
import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
|
|
||||||
|
|
||||||
import { constants } from './constants';
|
|
||||||
import {
|
import {
|
||||||
AssetDataScenario,
|
AssetDataScenario,
|
||||||
|
constants,
|
||||||
ERC721TokenIdsByOwner,
|
ERC721TokenIdsByOwner,
|
||||||
ExpirationTimeSecondsScenario,
|
ExpirationTimeSecondsScenario,
|
||||||
FeeRecipientAddressScenario,
|
FeeRecipientAddressScenario,
|
||||||
OrderAssetAmountScenario,
|
OrderAssetAmountScenario,
|
||||||
OrderScenario,
|
OrderScenario,
|
||||||
TakerScenario,
|
TakerScenario,
|
||||||
} from './types';
|
} from '@0x/contracts-test-utils';
|
||||||
|
import { assetDataUtils, generatePseudoRandomSalt } from '@0x/order-utils';
|
||||||
|
import { Order } from '@0x/types';
|
||||||
|
import { BigNumber, errorUtils } from '@0x/utils';
|
||||||
|
|
||||||
|
import { DummyERC721TokenContract } from '../../generated-wrappers/dummy_erc721_token';
|
||||||
|
|
||||||
const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
|
const TEN_UNITS_EIGHTEEN_DECIMALS = new BigNumber(10_000_000_000_000_000_000);
|
||||||
const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
|
const FIVE_UNITS_EIGHTEEN_DECIMALS = new BigNumber(5_000_000_000_000_000_000);
|
||||||
|
@ -28,16 +28,11 @@
|
|||||||
"./generated-artifacts/InvalidERC721Receiver.json",
|
"./generated-artifacts/InvalidERC721Receiver.json",
|
||||||
"./generated-artifacts/MixinAuthorizable.json",
|
"./generated-artifacts/MixinAuthorizable.json",
|
||||||
"./generated-artifacts/MultiAssetProxy.json",
|
"./generated-artifacts/MultiAssetProxy.json",
|
||||||
"./generated-artifacts/MultiSigWallet.json",
|
|
||||||
"./generated-artifacts/MultiSigWalletWithTimeLock.json",
|
|
||||||
"./generated-artifacts/OrderValidator.json",
|
"./generated-artifacts/OrderValidator.json",
|
||||||
"./generated-artifacts/ReentrantERC20Token.json",
|
"./generated-artifacts/ReentrantERC20Token.json",
|
||||||
"./generated-artifacts/TestAssetProxyDispatcher.json",
|
"./generated-artifacts/TestAssetProxyDispatcher.json",
|
||||||
"./generated-artifacts/TestAssetProxyOwner.json",
|
"./generated-artifacts/TestAssetProxyOwner.json",
|
||||||
"./generated-artifacts/TestConstants.json",
|
|
||||||
"./generated-artifacts/TestExchangeInternals.json",
|
"./generated-artifacts/TestExchangeInternals.json",
|
||||||
"./generated-artifacts/TestLibBytes.json",
|
|
||||||
"./generated-artifacts/TestLibs.json",
|
|
||||||
"./generated-artifacts/TestSignatureValidator.json",
|
"./generated-artifacts/TestSignatureValidator.json",
|
||||||
"./generated-artifacts/TestStaticCallReceiver.json",
|
"./generated-artifacts/TestStaticCallReceiver.json",
|
||||||
"./generated-artifacts/Validator.json",
|
"./generated-artifacts/Validator.json",
|
||||||
|
20
contracts/libs/.solhint.json
Normal file
20
contracts/libs/.solhint.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
70
contracts/libs/README.md
Normal file
70
contracts/libs/README.md
Normal file
@ -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).
|
22
contracts/libs/compiler.json
Normal file
22
contracts/libs/compiler.json
Normal file
@ -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"]
|
||||||
|
}
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../../utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract LibFillResults is
|
contract LibFillResults is
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
import "../../../utils/SafeMath/SafeMath.sol";
|
import "@0x/contracts-utils/contracts/utils/SafeMath/SafeMath.sol";
|
||||||
|
|
||||||
|
|
||||||
contract LibMath is
|
contract LibMath is
|
@ -19,10 +19,10 @@
|
|||||||
pragma solidity 0.4.24;
|
pragma solidity 0.4.24;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import "../../protocol/Exchange/libs/LibMath.sol";
|
import "../../libs/LibMath.sol";
|
||||||
import "../../protocol/Exchange/libs/LibOrder.sol";
|
import "../../libs/LibOrder.sol";
|
||||||
import "../../protocol/Exchange/libs/LibFillResults.sol";
|
import "../../libs/LibFillResults.sol";
|
||||||
import "../../protocol/Exchange/libs/LibAbiEncoder.sol";
|
import "../../libs/LibAbiEncoder.sol";
|
||||||
|
|
||||||
|
|
||||||
contract TestLibs is
|
contract TestLibs is
|
92
contracts/libs/package.json
Normal file
92
contracts/libs/package.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
17
contracts/libs/src/artifacts/index.ts
Normal file
17
contracts/libs/src/artifacts/index.ts
Normal file
@ -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,
|
||||||
|
};
|
2
contracts/libs/src/index.ts
Normal file
2
contracts/libs/src/index.ts
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
export * from './artifacts';
|
||||||
|
export * from './wrappers';
|
6
contracts/libs/src/wrappers/index.ts
Normal file
6
contracts/libs/src/wrappers/index.ts
Normal file
@ -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';
|
@ -1,17 +1,20 @@
|
|||||||
|
import {
|
||||||
|
addressUtils,
|
||||||
|
chaiSetup,
|
||||||
|
constants,
|
||||||
|
OrderFactory,
|
||||||
|
provider,
|
||||||
|
txDefaults,
|
||||||
|
web3Wrapper,
|
||||||
|
} from '@0x/contracts-test-utils';
|
||||||
import { BlockchainLifecycle } from '@0x/dev-utils';
|
import { BlockchainLifecycle } from '@0x/dev-utils';
|
||||||
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
import { assetDataUtils, orderHashUtils } from '@0x/order-utils';
|
||||||
import { SignedOrder } from '@0x/types';
|
import { SignedOrder } from '@0x/types';
|
||||||
import { BigNumber } from '@0x/utils';
|
import { BigNumber } from '@0x/utils';
|
||||||
import * as chai from 'chai';
|
import * as chai from 'chai';
|
||||||
|
|
||||||
import { TestConstantsContract } from '../../generated-wrappers/test_constants';
|
|
||||||
import { TestLibsContract } from '../../generated-wrappers/test_libs';
|
import { TestLibsContract } from '../../generated-wrappers/test_libs';
|
||||||
import { artifacts } from '../../src/artifacts';
|
import { artifacts } from '../../src/artifacts';
|
||||||
import { addressUtils } from '../utils/address_utils';
|
|
||||||
import { chaiSetup } from '../utils/chai_setup';
|
|
||||||
import { constants } from '../utils/constants';
|
|
||||||
import { OrderFactory } from '../utils/order_factory';
|
|
||||||
import { provider, txDefaults, web3Wrapper } from '../utils/web3_wrapper';
|
|
||||||
|
|
||||||
chaiSetup.configure();
|
chaiSetup.configure();
|
||||||
const expect = chai.expect;
|
const expect = chai.expect;
|
||||||
@ -22,7 +25,6 @@ describe('Exchange libs', () => {
|
|||||||
let signedOrder: SignedOrder;
|
let signedOrder: SignedOrder;
|
||||||
let orderFactory: OrderFactory;
|
let orderFactory: OrderFactory;
|
||||||
let libs: TestLibsContract;
|
let libs: TestLibsContract;
|
||||||
let testConstants: TestConstantsContract;
|
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await blockchainLifecycle.startAsync();
|
await blockchainLifecycle.startAsync();
|
||||||
@ -34,11 +36,6 @@ describe('Exchange libs', () => {
|
|||||||
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
const accounts = await web3Wrapper.getAvailableAddressesAsync();
|
||||||
const makerAddress = accounts[0];
|
const makerAddress = accounts[0];
|
||||||
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
libs = await TestLibsContract.deployFrom0xArtifactAsync(artifacts.TestLibs, provider, txDefaults);
|
||||||
testConstants = await TestConstantsContract.deployFrom0xArtifactAsync(
|
|
||||||
artifacts.TestConstants,
|
|
||||||
provider,
|
|
||||||
txDefaults,
|
|
||||||
);
|
|
||||||
|
|
||||||
const defaultOrderParams = {
|
const defaultOrderParams = {
|
||||||
...constants.STATIC_ORDER_PARAMS,
|
...constants.STATIC_ORDER_PARAMS,
|
||||||
@ -58,15 +55,6 @@ describe('Exchange libs', () => {
|
|||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await blockchainLifecycle.revertAsync();
|
await blockchainLifecycle.revertAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('LibConstants', () => {
|
|
||||||
describe('ZRX_ASSET_DATA', () => {
|
|
||||||
it('should have the correct ZRX_ASSET_DATA', async () => {
|
|
||||||
const isValid = await testConstants.assertValidZrxAssetData.callAsync();
|
|
||||||
expect(isValid).to.be.equal(true);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// Note(albrow): These tests are designed to be supplemental to the
|
// Note(albrow): These tests are designed to be supplemental to the
|
||||||
// combinatorial tests in test/exchange/internal. They test specific edge
|
// combinatorial tests in test/exchange/internal. They test specific edge
|
||||||
// cases that are not covered by the combinatorial tests.
|
// cases that are not covered by the combinatorial tests.
|
17
contracts/libs/test/global_hooks.ts
Normal file
17
contracts/libs/test/global_hooks.ts
Normal file
@ -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();
|
||||||
|
});
|
18
contracts/libs/tsconfig.json
Normal file
18
contracts/libs/tsconfig.json
Normal file
@ -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"]
|
||||||
|
}
|
6
contracts/libs/tslint.json
Normal file
6
contracts/libs/tslint.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"extends": ["@0x/tslint-config"],
|
||||||
|
"rules": {
|
||||||
|
"custom-no-magic-numbers": false
|
||||||
|
}
|
||||||
|
}
|
20
contracts/multisig/.solhint.json
Normal file
20
contracts/multisig/.solhint.json
Normal file
@ -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"
|
||||||
|
}
|
||||||
|
}
|
1
contracts/multisig/CHANGELOG.json
Normal file
1
contracts/multisig/CHANGELOG.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
[]
|
70
contracts/multisig/README.md
Normal file
70
contracts/multisig/README.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
## MultisSig Contracts
|
||||||
|
|
||||||
|
MultiSig smart contracts
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Contracts can be found in the [contracts](./contracts) directory. The contents of this directory are broken down into the following subdirectories:
|
||||||
|
|
||||||
|
* [multisig](./contracts/multisig)
|
||||||
|
* This directory contains the [Gnosis MultiSigWallet](https://github.com/gnosis/MultiSigWallet) and a custom extension that adds a timelock to transactions within the MultiSigWallet.
|
||||||
|
* [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-multisig yarn build
|
||||||
|
```
|
||||||
|
|
||||||
|
Or continuously rebuild on change:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
PKG=@0x/contracts-multisig 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).
|
22
contracts/multisig/compiler.json
Normal file
22
contracts/multisig/compiler.json
Normal file
@ -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": ["MultiSigWallet", "MultiSigWalletWithTimeLock", "TestRejectEther"]
|
||||||
|
}
|
@ -0,0 +1,23 @@
|
|||||||
|
/*
|
||||||
|
|
||||||
|
Copyright 2018 ZeroEx Intl.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
pragma solidity 0.4.24;
|
||||||
|
|
||||||
|
|
||||||
|
// solhint-disable no-empty-blocks
|
||||||
|
contract TestRejectEther {}
|
86
contracts/multisig/package.json
Normal file
86
contracts/multisig/package.json
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"name": "@0x/contracts-multisig",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=6.12"
|
||||||
|
},
|
||||||
|
"description": "Multisig contracts used by 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 ../../packages/abi-gen-templates/contract.handlebars --partials '../../packages/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/@(MultiSigWallet|MultiSigWalletWithTimeLock|TestRejectEther).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/core/README.md",
|
||||||
|
"devDependencies": {
|
||||||
|
"@0x/contracts-test-utils": "^1.0.0",
|
||||||
|
"@0x/abi-gen": "^1.0.17",
|
||||||
|
"@0x/dev-utils": "^1.0.18",
|
||||||
|
"@0x/sol-compiler": "^1.1.13",
|
||||||
|
"@0x/sol-cov": "^2.1.13",
|
||||||
|
"@0x/subproviders": "^2.1.5",
|
||||||
|
"@0x/tslint-config": "^1.0.10",
|
||||||
|
"@types/bn.js": "^4.11.0",
|
||||||
|
"@types/ethereumjs-abi": "^0.6.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",
|
||||||
|
"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.7",
|
||||||
|
"@0x/order-utils": "^3.0.3",
|
||||||
|
"@0x/types": "^1.3.0",
|
||||||
|
"@0x/typescript-typings": "^3.0.4",
|
||||||
|
"@0x/utils": "^2.0.6",
|
||||||
|
"@0x/web3-wrapper": "^3.1.5",
|
||||||
|
"ethereum-types": "^1.1.2",
|
||||||
|
"lodash": "^4.17.5"
|
||||||
|
},
|
||||||
|
"publishConfig": {
|
||||||
|
"access": "public"
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user