Merge branch 'development' into feature/instant/tell-amount-available

This commit is contained in:
Steve Klebanoff
2019-01-09 08:54:55 -08:00
510 changed files with 21915 additions and 2639 deletions

View File

@@ -4,7 +4,7 @@ jobs:
build:
resource_class: medium+
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
environment:
CONTRACTS_COMMIT_HASH: '9ed05f5'
working_directory: ~/repo
@@ -16,7 +16,7 @@ jobs:
command: sudo npm install --global yarn@1.9.4
- run:
name: yarn
command: yarn --frozen-lockfile install || yarn --frozen-lockfile install
command: yarn --frozen-lockfile --ignore-engines install || yarn --frozen-lockfile --ignore-engines install
- run: yarn build:ci:no_website
- run: yarn build:ts
- save_cache:
@@ -26,7 +26,7 @@ jobs:
build-website:
resource_class: medium+
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
working_directory: ~/repo
steps:
- restore_cache:
@@ -35,7 +35,7 @@ jobs:
- run: cd packages/website && yarn build:prod
test-contracts-ganache:
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
working_directory: ~/repo
steps:
- restore_cache:
@@ -49,7 +49,7 @@ jobs:
- run: yarn wsrun test:circleci @0x/contracts-protocol
test-contracts-geth:
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
- image: 0xorg/devnet
working_directory: ~/repo
steps:
@@ -67,7 +67,7 @@ jobs:
test-publish:
resource_class: medium+
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
- image: 0xorg/verdaccio
working_directory: ~/repo
steps:
@@ -77,7 +77,7 @@ jobs:
- run: yarn test:publish:circleci
test-doc-generation:
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
working_directory: ~/repo
steps:
- restore_cache:
@@ -100,7 +100,7 @@ jobs:
- ~/repo/packages/pipeline/coverage/lcov.info
test-rest:
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
working_directory: ~/repo
steps:
- restore_cache:
@@ -188,9 +188,7 @@ jobs:
working_directory: ~/repo
docker:
- image: circleci/python
- image: 0xorg/ganache-cli
command: |
ganache-cli --gasLimit 10000000 --noVMErrorsOnRPCResponse --db /snapshot --noVMErrorsOnRPCResponse -p 8545 --networkId 50 -m "concert load couple harbor equip island argue ramp clarify fence smart topic"
- image: 0xorg/ganache-cli:2.2.2
- image: 0xorg/launch-kit-ci
command: |
yarn start:ts -p 3000:3000
@@ -202,31 +200,34 @@ jobs:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages/order_utils
cd python-packages
python -m ensurepip
python -m pip install -e .[dev]
- run:
command: |
cd python-packages/sra_client
python -m ensurepip
python -m pip install -e .
./install
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- '/usr/local/bin'
- '/usr/local/lib/python3.7/site-packages'
- '.eggs'
- '.mypy_cache'
- '.pytest_cache'
- '.tox'
- run:
command: |
cd python-packages/order_utils
coverage run setup.py test
- run:
command: |
cd python-packages/sra_client
coverage run setup.py test
cd python-packages
./cmd_pkgs_in_dep_order.py coverage run setup.py test
- save_cache:
key: coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_addresses/.coverage
- save_cache:
key: coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_artifacts/.coverage
- save_cache:
key: coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/contract_demo/.coverage
- save_cache:
key: coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/repo/python-packages/json_schemas/.coverage
- save_cache:
key: coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -249,7 +250,7 @@ jobs:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
python -m pip install .
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
@@ -275,22 +276,14 @@ jobs:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
- run:
command: |
cd python-packages/order_utils
python -m ensurepip
python -m pip install -e .[dev]
- save_cache:
key: deps9-{{ .Branch }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- '/usr/local/bin'
- '/usr/local/lib/python3.7/site-packages'
- run:
command: |
cd python-packages/order_utils
python setup.py lint
cd python-packages
./install
./lint
static-tests:
working_directory: ~/repo
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
steps:
- restore_cache:
keys:
@@ -301,7 +294,7 @@ jobs:
- run: yarn bundlewatch
submit-coverage:
docker:
- image: circleci/node:9
- image: circleci/node:9-browsers
working_directory: ~/repo
steps:
- restore_cache:
@@ -355,6 +348,21 @@ jobs:
- restore_cache:
keys:
- coverage-contracts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-json-schemas-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-addresses-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-artifacts-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-contract-demo-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-sra-client-{{ .Environment.CIRCLE_SHA1 }}
- restore_cache:
keys:
- coverage-python-order-utils-{{ .Environment.CIRCLE_SHA1 }}
@@ -392,7 +400,9 @@ workflows:
requires:
- test-rest
- test-python
- static-tests-python:
requires:
- test-python
- test-python
- static-tests-python
# skip python tox run for now, as we don't yet have multiple test environments to support.
#- test-rest-python

View File

@@ -18,12 +18,16 @@ lib
/contracts/extensions/generated-artifacts
/packages/abi-gen-wrappers/src/generated-wrappers
/packages/contract-artifacts/artifacts
/python-packages/order_utils/src/zero_ex/contract_artifacts/artifacts
/python-packages/contract_artifacts/src/zero_ex/contract_artifacts/artifacts
/packages/json-schemas/schemas
/python-packages/order_utils/src/zero_ex/json_schemas/schemas
/python-packages/json_schemas/src/zero_ex/json_schemas/schemas
/packages/metacoin/src/contract_wrappers
/packages/metacoin/artifacts
/packages/sra-spec/public/
/packages/dev-tools-pages/ts/**/data.json
package.json
scripts/postpublish_utils.js
packages/sol-cov/test/fixtures/artifacts
.pytest_cache
.mypy_cache
.tox

View File

@@ -1,4 +1,4 @@
<img src="https://github.com/0xProject/branding/blob/master/0x_Black_CMYK.png" width="200px" >
<img src="https://github.com/0xProject/branding/blob/master/0x%20Logo/PNG/0x-Logo-Black.png" width="150px" >
---
@@ -24,10 +24,13 @@ Visit our [developer portal](https://0xproject.com/docs/order-utils) for a compr
### Python Packages
| Package | Version | Description |
| ------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
| Package | Version | Description |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [`0x-contract-addresses`](/python-packages/contract_addresses) | [![PyPI](https://img.shields.io/pypi/v/0x-contract-addresses.svg)](https://pypi.org/project/0x-contract-addresses/) | A tiny utility library for getting known deployed contract addresses for a particular network |
| [`0x-contract-artifacts`](/python-packages/contract_artifacts) | [![PyPI](https://img.shields.io/pypi/v/0x-contract-artifacts.svg)](https://pypi.org/project/0x-contract-artifacts/) | 0x smart contract compilation artifacts |
| [`0x-json-schemas`](/python-packages/json_schemas) | [![PyPI](https://img.shields.io/pypi/v/0x-json-schemas.svg)](https://pypi.org/project/0x-json-schemas/) | 0x-related JSON schemas |
| [`0x-order-utils`](/python-packages/order_utils) | [![PyPI](https://img.shields.io/pypi/v/0x-order-utils.svg)](https://pypi.org/project/0x-order-utils/) | A set of utilities for generating, parsing, signing and validating 0x orders |
| [`0x-sra-client`](/python-packages/sra_client) | [![PyPI](https://img.shields.io/pypi/v/0x-sra-client.svg)](https://pypi.org/project/0x-sra-client/) | A Python client for interacting with servers conforming to the Standard Relayer API specification |
### Typescript/Javascript Packages

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-examples",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -33,12 +33,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/examples/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -53,24 +53,23 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,4 +1,14 @@
[
{
"version": "1.2.0",
"changes": [
{
"note": "Added Dutch Auction Wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "1.1.0",
"changes": [

View File

@@ -5,6 +5,16 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.2.0 - _January 9, 2019_
* Added Dutch Auction Wrapper (#1465)
## v1.1.0 - _Invalid date_
* Added Balance Threshold Filter (#1383)
* Add OrderMatcher (#1117)
* Add OrderValidator (#1464)
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-extensions",
"version": "1.0.2",
"version": "1.2.0",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,13 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contract-wrappers": "^4.2.0",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,24 +65,23 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-protocol": "^2.1.59",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-protocol": "^2.2.0",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,3 +1,4 @@
import { DutchAuctionWrapper } from '@0x/contract-wrappers';
import {
artifacts as protocolArtifacts,
ERC20Wrapper,
@@ -29,12 +30,11 @@ import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import ethAbi = require('ethereumjs-abi');
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
import { artifacts } from '../../src/artifacts';
import { DutchAuctionTestWrapper } from '../utils/dutch_auction_test_wrapper';
chaiSetup.configure();
const expect = chai.expect;
@@ -68,19 +68,8 @@ describe(ContractName.DutchAuction, () => {
let erc721MakerAssetIds: BigNumber[];
const tenMinutesInSeconds = 10 * 60;
function extendMakerAssetData(makerAssetData: string, beginTimeSeconds: BigNumber, beginAmount: BigNumber): string {
return ethUtil.bufferToHex(
Buffer.concat([
ethUtil.toBuffer(makerAssetData),
ethUtil.toBuffer(
(ethAbi as any).rawEncode(
['uint256', 'uint256'],
[beginTimeSeconds.toString(), beginAmount.toString()],
),
),
]),
);
}
let dutchAuctionTestWrapper: DutchAuctionTestWrapper;
let defaultERC20MakerAssetData: string;
before(async () => {
await blockchainLifecycle.startAsync();
@@ -136,6 +125,7 @@ describe(ContractName.DutchAuction, () => {
dutchAuctionInstance.address,
provider,
);
dutchAuctionTestWrapper = new DutchAuctionTestWrapper(dutchAuctionInstance, provider);
defaultMakerAssetAddress = erc20TokenA.address;
const defaultTakerAssetAddress = wethContract.address;
@@ -174,7 +164,7 @@ describe(ContractName.DutchAuction, () => {
feeRecipientAddress,
// taker address or sender address should be set to the ducth auction contract
takerAddress: dutchAuctionContract.address,
makerAssetData: extendMakerAssetData(
makerAssetData: DutchAuctionWrapper.encodeDutchAuctionAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
@@ -199,6 +189,7 @@ describe(ContractName.DutchAuction, () => {
const takerPrivateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(takerAddress)];
sellerOrderFactory = new OrderFactory(makerPrivateKey, sellerDefaultOrderParams);
buyerOrderFactory = new OrderFactory(takerPrivateKey, buyerDefaultOrderParams);
defaultERC20MakerAssetData = assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress);
});
after(async () => {
await blockchainLifecycle.revertAsync();
@@ -215,49 +206,41 @@ describe(ContractName.DutchAuction, () => {
describe('matchOrders', () => {
it('should be worth the begin price at the begining of the auction', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp + 2);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
});
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({ makerAssetData });
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.lte(auctionBeginTimeSeconds);
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionBeginAmount);
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
});
it('should be be worth the end price at the end of the auction', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
expirationTimeSeconds: auctionEndTimeSeconds,
});
const auctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const auctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(auctionDetails.currentTimeSeconds).to.be.bignumber.gte(auctionEndTimeSeconds);
expect(auctionDetails.currentAmount).to.be.bignumber.equal(auctionEndAmount);
expect(auctionDetails.beginAmount).to.be.bignumber.equal(auctionBeginAmount);
});
it('should match orders at current amount and send excess to buyer', async () => {
const beforeAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const beforeAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
makerAssetAmount: beforeAuctionDetails.currentAmount.times(2),
});
await web3Wrapper.awaitTransactionSuccessAsync(
await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances[dutchAuctionContract.address][wethContract.address]).to.be.bignumber.equal(
constants.ZERO_AMOUNT,
@@ -276,17 +259,8 @@ describe(ContractName.DutchAuction, () => {
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerFee: new BigNumber(1),
});
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
@@ -299,18 +273,9 @@ describe(ContractName.DutchAuction, () => {
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
makerFee: new BigNumber(1),
});
const txHash = await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
);
await web3Wrapper.awaitTransactionSuccessAsync(txHash);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const newBalances = await erc20Wrapper.getBalancesAsync();
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
expect(newBalances[makerAddress][wethContract.address]).to.be.bignumber.gte(
erc20Balances[makerAddress][wethContract.address].plus(afterAuctionDetails.currentAmount),
);
@@ -321,24 +286,17 @@ describe(ContractName.DutchAuction, () => {
it('should revert when auction expires', async () => {
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds * 2);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
expirationTimeSeconds: auctionEndTimeSeconds,
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionExpired,
);
});
@@ -347,15 +305,7 @@ describe(ContractName.DutchAuction, () => {
makerAssetAmount: sellOrder.takerAssetAmount,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidAmount,
);
});
@@ -364,38 +314,23 @@ describe(ContractName.DutchAuction, () => {
takerAssetAmount: auctionBeginAmount.plus(1),
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidAmount,
);
});
it('begin time is less than end time', async () => {
auctionBeginTimeSeconds = new BigNumber(auctionEndTimeSeconds).plus(tenMinutesInSeconds);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
defaultERC20MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
expirationTimeSeconds: auctionEndTimeSeconds,
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.AuctionInvalidBeginTime,
);
});
@@ -404,45 +339,30 @@ describe(ContractName.DutchAuction, () => {
makerAssetData: assetDataUtils.encodeERC20AssetData(defaultMakerAssetAddress),
});
return expectTransactionFailedAsync(
dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress),
RevertReason.InvalidAssetData,
);
});
describe('ERC721', () => {
it('should match orders when ERC721', async () => {
const makerAssetId = erc721MakerAssetIds[0];
const erc721MakerAssetData = assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId);
const makerAssetData = DutchAuctionWrapper.encodeDutchAuctionAssetData(
erc721MakerAssetData,
auctionBeginTimeSeconds,
auctionBeginAmount,
);
sellOrder = await sellerOrderFactory.newSignedOrderAsync({
makerAssetAmount: new BigNumber(1),
makerAssetData: extendMakerAssetData(
assetDataUtils.encodeERC721AssetData(erc721Token.address, makerAssetId),
auctionBeginTimeSeconds,
auctionBeginAmount,
),
makerAssetData,
});
buyOrder = await buyerOrderFactory.newSignedOrderAsync({
takerAssetAmount: new BigNumber(1),
takerAssetData: sellOrder.makerAssetData,
});
await web3Wrapper.awaitTransactionSuccessAsync(
await dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: takerAddress,
},
),
);
const afterAuctionDetails = await dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
await dutchAuctionTestWrapper.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
const afterAuctionDetails = await dutchAuctionTestWrapper.getAuctionDetailsAsync(sellOrder);
const newBalances = await erc20Wrapper.getBalancesAsync();
// HACK gte used here due to a bug in ganache where the timestamp can change
// between multiple calls to the same block. Which can move the amount in our case

View File

@@ -0,0 +1,62 @@
import { artifacts as protocolArtifacts } from '@0x/contracts-protocol';
import { LogDecoder } from '@0x/contracts-test-utils';
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionContract } from '../../generated-wrappers/dutch_auction';
import { artifacts } from '../../src/artifacts';
export class DutchAuctionTestWrapper {
private readonly _dutchAuctionContract: DutchAuctionContract;
private readonly _web3Wrapper: Web3Wrapper;
private readonly _logDecoder: LogDecoder;
constructor(contractInstance: DutchAuctionContract, provider: Provider) {
this._dutchAuctionContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
this._logDecoder = new LogDecoder(this._web3Wrapper, {
...artifacts,
...tokensArtifacts,
...protocolArtifacts,
});
}
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
* start time and the auction begin amount. The sell order is a an order at the lowest amount
* at the end of the auction. Excess from the match is transferred to the seller.
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
* @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @param from Address the transaction is being sent from.
* @return Transaction receipt with decoded logs.
*/
public async matchOrdersAsync(
buyOrder: SignedOrder,
sellOrder: SignedOrder,
from: string,
): Promise<TransactionReceiptWithDecodedLogs> {
const txHash = await this._dutchAuctionContract.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from,
},
);
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
return tx;
}
/**
* Calculates the Auction Details for the given order
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @return The dutch auction details.
*/
public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
const auctionDetails = await this._dutchAuctionContract.getAuctionDetails.callAsync(sellOrder);
return auctionDetails;
}
}

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-interfaces",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -30,8 +30,8 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/interfaces/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/sol-compiler": "^1.1.16",
"@0x/abi-gen": "^1.0.20",
"@0x/sol-compiler": "^2.0.0",
"@0x/tslint-config": "^2.0.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
@@ -41,13 +41,13 @@
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-libs",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/libs/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,21 +64,20 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-multisig",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/multisig/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
@@ -64,19 +64,18 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -14,7 +14,8 @@
"note": "Move OrderValidator to extensions",
"pr": 1464
}
]
],
"timestamp": 1547040760
},
{
"timestamp": 1544741676,

View File

@@ -5,6 +5,12 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.2.0 - _January 9, 2019_
* Added LibAddressArray (#1383)
* Add validation and comments to MultiAssetProxy (#1455)
* Move OrderValidator to extensions (#1464)
## v2.1.59 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-protocol",
"version": "2.1.59",
"version": "2.2.0",
"engines": {
"node": ">=6.12"
},
@@ -44,11 +44,11 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -63,26 +63,25 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-examples": "^1.0.2",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/contracts-tokens": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-examples": "^1.0.3",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/contracts-tokens": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -715,7 +715,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -778,7 +778,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -811,7 +811,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -849,7 +849,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc721Amount];
const nestedAssetData = [erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -881,7 +881,7 @@ describe('Asset Transfer Proxies', () => {
const erc721Amount = new BigNumber(1);
const amounts = [erc721Amount, erc721Amount];
const nestedAssetData = [erc721AssetData1, erc721AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -913,7 +913,7 @@ describe('Asset Transfer Proxies', () => {
const erc721Amount = new BigNumber(1);
const amounts = [erc721Amount, erc721Amount];
const nestedAssetData = [erc721AssetData1, erc721AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -946,7 +946,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -984,10 +984,7 @@ describe('Asset Transfer Proxies', () => {
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const extraData = '0102030405060708';
const assetData = `${assetDataInterface.MultiAsset.getABIEncodedTransactionData(
amounts,
nestedAssetData,
)}${extraData}`;
const assetData = `${assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData)}${extraData}`;
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1024,7 +1021,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData2 = assetDataUtils.encodeERC20AssetData(erc20TokenB.address);
const amounts = [erc20Amount1, erc20Amount2];
const nestedAssetData = [erc20AssetData1, erc20AssetData2];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1085,7 +1082,7 @@ describe('Asset Transfer Proxies', () => {
erc721AssetData3,
erc721AssetData4,
];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1143,7 +1140,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1169,6 +1166,7 @@ describe('Asset Transfer Proxies', () => {
const invalidErc721AssetData = `${invalidProxyId}${erc721AssetData.slice(10)}`;
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, invalidErc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1192,6 +1190,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1214,7 +1213,7 @@ describe('Asset Transfer Proxies', () => {
const erc20AssetData = assetDataUtils.encodeERC20AssetData(erc20TokenA.address);
const amounts = [erc20Amount];
const nestedAssetData = [erc20AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,
@@ -1238,6 +1237,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = '0x123456';
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
// HACK: This is used to get around validation built into assetDataUtils
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
@@ -1262,7 +1262,7 @@ describe('Asset Transfer Proxies', () => {
const erc721AssetData = assetDataUtils.encodeERC721AssetData(erc721TokenA.address, erc721AFromTokenId);
const amounts = [erc20Amount, erc721Amount];
const nestedAssetData = [erc20AssetData, erc721AssetData];
const assetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(amounts, nestedAssetData);
const assetData = assetDataUtils.encodeMultiAssetData(amounts, nestedAssetData);
const data = assetProxyInterface.transferFrom.getABIEncodedTransactionData(
assetData,
fromAddress,

View File

@@ -1,4 +1,3 @@
import { artifacts as interfacesArtifacts, IAssetDataContract } from '@0x/contracts-interfaces';
import {
chaiSetup,
constants,
@@ -43,11 +42,6 @@ import { ExchangeWrapper } from '../utils/exchange_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const assetDataInterface = new IAssetDataContract(
interfacesArtifacts.IAssetData.compilerOutput.abi,
constants.NULL_ADDRESS,
provider,
);
// tslint:disable:no-unnecessary-type-assertion
describe('Exchange core', () => {
let makerAddress: string;
@@ -777,10 +771,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(1);
const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const takerAssetAmount = new BigNumber(10);
@@ -830,10 +821,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(1);
const takerAmounts = [new BigNumber(10), new BigNumber(1)];
const takerAssetId = erc721TakerAssetIds[0];
@@ -841,10 +829,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(zrxToken.address),
assetDataUtils.encodeERC721AssetData(erc721Token.address, takerAssetId),
];
const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
takerAmounts,
takerNestedAssetData,
);
const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
const takerAssetAmount = new BigNumber(1);
signedOrder = await orderFactory.newSignedOrderAsync({
makerAssetData,
@@ -900,10 +885,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const makerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
makerAmounts,
makerNestedAssetData,
);
const makerAssetData = assetDataUtils.encodeMultiAssetData(makerAmounts, makerNestedAssetData);
const makerAssetAmount = new BigNumber(30);
const takerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const takerAssetAmount = new BigNumber(10);
@@ -980,10 +962,7 @@ describe('Exchange core', () => {
assetDataUtils.encodeERC20AssetData(erc20TokenA.address),
assetDataUtils.encodeERC20AssetData(erc20TokenB.address),
];
const takerAssetData = assetDataInterface.MultiAsset.getABIEncodedTransactionData(
takerAmounts,
takerNestedAssetData,
);
const takerAssetData = assetDataUtils.encodeMultiAssetData(takerAmounts, takerNestedAssetData);
const takerAssetAmount = new BigNumber(30);
const makerAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const makerAssetAmount = new BigNumber(10);

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-test-utils",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -40,17 +40,17 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/dev-utils": "^1.0.21",
"@0x/order-utils": "^3.0.7",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/dev-utils": "^1.0.22",
"@0x/order-utils": "^3.1.0",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@0x/types": "^1.4.1",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/bn.js": "^4.11.0",
"@types/ethereumjs-abi": "^0.6.0",
"@types/js-combinatorics": "^0.5.29",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-tokens",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/tokens/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -64,23 +64,22 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-interfaces": "^1.0.2",
"@0x/contracts-libs": "^1.0.2",
"@0x/contracts-multisig": "^1.0.2",
"@0x/contracts-utils": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-interfaces": "^1.0.3",
"@0x/contracts-libs": "^1.0.3",
"@0x/contracts-multisig": "^1.0.3",
"@0x/contracts-utils": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/js-combinatorics": "^0.5.29",
"bn.js": "^4.11.8",
"ethereum-types": "^1.1.4",

View File

@@ -22,6 +22,7 @@ import * as UnlimitedAllowanceToken_v1 from '../../generated-artifacts/Unlimited
import * as WETH9 from '../../generated-artifacts/WETH9.json';
import * as ZRXToken from '../../generated-artifacts/ZRXToken.json';
// tslint:disable:no-unnecessary-type-assertion
export const artifacts = {
DummyERC20Token: DummyERC20Token as ContractArtifact,
DummyMultipleReturnERC20Token: DummyMultipleReturnERC20Token as ContractArtifact,

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.3",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"timestamp": 1544741676,
"version": "1.0.2",

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.3 - _January 9, 2019_
* Dependencies updated
## v1.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contracts-utils",
"version": "1.0.2",
"version": "1.0.3",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/utils/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/contracts-test-utils": "^1.0.2",
"@0x/dev-utils": "^1.0.21",
"@0x/sol-compiler": "^1.1.16",
"@0x/sol-cov": "^2.1.16",
"@0x/subproviders": "^2.1.8",
"@0x/abi-gen": "^1.0.20",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/dev-utils": "^1.0.22",
"@0x/sol-compiler": "^2.0.0",
"@0x/sol-cov": "^2.1.17",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/bn.js": "^4.11.0",
"@types/lodash": "4.14.104",
@@ -65,20 +65,19 @@
"mocha": "^4.1.0",
"npm-run-all": "^4.1.2",
"shx": "^0.2.2",
"solc": "^0.4.24",
"solhint": "^1.4.1",
"tslint": "5.11.0",
"typescript": "3.0.1",
"yargs": "^10.0.3"
},
"dependencies": {
"@0x/base-contract": "^3.0.10",
"@0x/contracts-multisig": "^1.0.2",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/base-contract": "^3.0.11",
"@0x/contracts-multisig": "^1.0.3",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethereumjs-util": "^5.1.1",
"lodash": "^4.17.5"

View File

@@ -62,6 +62,9 @@
"repoBranchBase": "development"
}
},
"resolutions": {
"graceful-fs": "4.1.15"
},
"devDependencies": {
"@0x-lerna-fork/lerna": "3.0.0-beta.26",
"@0xproject/npm-cli-login": "^0.0.11",

View File

@@ -1,4 +1,15 @@
[
{
"version": "3.0.0",
"changes": [
{
"note":
"Export `MultiAssetData`, `MultiAssetDataWithRecursiveDecoding`, `ObjectMap`, and `SingleAssetData` from types. No longer export `AssetData`.",
"pr": 1363
}
],
"timestamp": 1547040760
},
{
"version": "2.0.8",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.0 - _January 9, 2019_
* Export `MultiAssetData`, `MultiAssetDataWithRecursiveDecoding`, `ObjectMap`, and `SingleAssetData` from types. No longer export `AssetData`. (#1363)
## v2.0.8 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "0x.js",
"version": "2.0.8",
"version": "3.0.0",
"engines": {
"node": ">=6.12"
},
@@ -42,10 +42,10 @@
},
"license": "Apache-2.0",
"devDependencies": {
"@0x/abi-gen-wrappers": "^2.0.2",
"@0x/contract-addresses": "^2.0.0",
"@0x/dev-utils": "^1.0.21",
"@0x/migrations": "^2.2.2",
"@0x/abi-gen-wrappers": "^2.1.0",
"@0x/contract-addresses": "^2.1.0",
"@0x/dev-utils": "^1.0.22",
"@0x/migrations": "^2.3.0",
"@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -72,16 +72,16 @@
"webpack": "^4.20.2"
},
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/base-contract": "^3.0.10",
"@0x/contract-wrappers": "^4.1.3",
"@0x/order-utils": "^3.0.7",
"@0x/order-watcher": "^2.2.8",
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/base-contract": "^3.0.11",
"@0x/contract-wrappers": "^4.2.0",
"@0x/order-utils": "^3.1.0",
"@0x/order-watcher": "^2.4.0",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"@types/web3-provider-engine": "^14.0.0",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",

View File

@@ -4,6 +4,7 @@ export { assetDataUtils, signatureUtils, generatePseudoRandomSalt, orderHashUtil
export {
ContractWrappers,
DutchAuctionWrapper,
ERC20TokenWrapper,
ERC721TokenWrapper,
EtherTokenWrapper,
@@ -27,6 +28,7 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
DutchAuctionData,
} from '@0x/contract-wrappers';
export {
@@ -80,11 +82,16 @@ export {
OrderState,
AssetProxyId,
AssetData,
SingleAssetData,
ERC20AssetData,
ERC721AssetData,
MultiAssetData,
MultiAssetDataWithRecursiveDecoding,
SignatureType,
ObjectMap,
OrderRelevantState,
Stats,
DutchAuctionDetails,
} from '@0x/types';
export {

View File

@@ -1,4 +1,14 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "Added Dutch Auction Wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "2.0.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.0 - _January 9, 2019_
* Added Dutch Auction Wrapper (#1465)
## v2.0.2 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen-wrappers",
"version": "2.0.2",
"version": "2.1.0",
"engines": {
"node": ">=6.12"
},
@@ -18,7 +18,7 @@
"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 src/generated-wrappers --backend ethers"
},
"config": {
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
"abis": "../contract-artifacts/artifacts/@(AssetProxyOwner|DutchAuction|DummyERC20Token|DummyERC721Token|ERC20Proxy|ERC20Token|ERC721Proxy|ERC721Token|Exchange|Forwarder|IValidator|IWallet|OrderValidator|WETH9|ZRXToken).json"
},
"repository": {
"type": "git",
@@ -30,19 +30,19 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen-wrappers/README.md",
"devDependencies": {
"@0x/abi-gen": "^1.0.19",
"@0x/abi-gen": "^1.0.20",
"@0x/abi-gen-templates": "^1.0.1",
"@0x/tslint-config": "^2.0.0",
"@0x/types": "^1.4.1",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/types": "^1.5.0",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5",
"shx": "^0.2.2"
},
"dependencies": {
"@0x/base-contract": "^3.0.10"
"@0x/base-contract": "^3.0.11"
},
"publishConfig": {
"access": "public"

View File

@@ -0,0 +1,322 @@
// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name
// tslint:disable:no-unused-variable
// tslint:disable:no-unbound-method
import { BaseContract } from '@0x/base-contract';
import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types';
import { BigNumber, classUtils, logUtils } from '@0x/utils';
import { SimpleContractArtifact } from '@0x/types';
import { Web3Wrapper } from '@0x/web3-wrapper';
import * as ethers from 'ethers';
import * as _ from 'lodash';
// tslint:enable:no-unused-variable
/* istanbul ignore next */
// tslint:disable:no-parameter-reassignment
// tslint:disable-next-line:class-name
export class DutchAuctionContract extends BaseContract {
public getAuctionDetails = {
async sendTransactionAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [order
]);
const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
self.getAuctionDetails.estimateGasAsync.bind(
self,
order
),
);
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
async estimateGasAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString);
const encodedData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
getABIEncodedTransactionData(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
): string {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString);
const abiEncodedTransactionData = self._lookupEthersInterface('getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.getAuctionDetails.encode([order
]);
return abiEncodedTransactionData;
},
async callAsync(
order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber}
> {
const self = this as any as DutchAuctionContract;
const functionSignature = 'getAuctionDetails({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[order
] = BaseContract._formatABIDataItemList(inputAbi, [order
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [order
]);
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuctionDetails;
const encodedData = ethersFunction.encode([order
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
let resultArray = ethersFunction.decode(rawCallResult);
const outputAbi = (_.find(self.abi, {name: 'getAuctionDetails'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public matchOrders = {
async sendTransactionAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
txData: Partial<TxData> = {},
): Promise<string> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
self.matchOrders.estimateGasAsync.bind(
self,
buyOrder,
sellOrder,
buySignature,
sellSignature
),
);
const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults);
return txHash;
},
async estimateGasAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString);
const encodedData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...txData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
return gas;
},
getABIEncodedTransactionData(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
): string {
const self = this as any as DutchAuctionContract;
const inputAbi = self._lookupAbi('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString);
const abiEncodedTransactionData = self._lookupEthersInterface('matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)').functions.matchOrders.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
return abiEncodedTransactionData;
},
async callAsync(
buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
buySignature: string,
sellSignature: string,
callData: Partial<CallData> = {},
defaultBlock?: BlockParam,
): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
> {
const self = this as any as DutchAuctionContract;
const functionSignature = 'matchOrders({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},{address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},bytes,bytes)';
const inputAbi = self._lookupAbi(functionSignature).inputs;
[buyOrder,
sellOrder,
buySignature,
sellSignature
] = BaseContract._formatABIDataItemList(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
], BaseContract._bigNumberToString.bind(self));
BaseContract.strictArgumentEncodingCheck(inputAbi, [buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders;
const encodedData = ethersFunction.encode([buyOrder,
sellOrder,
buySignature,
sellSignature
]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
...callData,
data: encodedData,
},
self._web3Wrapper.getContractDefaults(),
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
let resultArray = ethersFunction.decode(rawCallResult);
const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs;
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this));
resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this));
return resultArray[0];
},
};
public static async deployFrom0xArtifactAsync(
artifact: ContractArtifact | SimpleContractArtifact,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
): Promise<DutchAuctionContract> {
if (_.isUndefined(artifact.compilerOutput)) {
throw new Error('Compiler output not found in the artifact file');
}
const bytecode = artifact.compilerOutput.evm.bytecode.object;
const abi = artifact.compilerOutput.abi;
return DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange
);
}
public static async deployAsync(
bytecode: string,
abi: ContractAbi,
provider: Provider,
txDefaults: Partial<TxData>,
_exchange: string,
): Promise<DutchAuctionContract> {
const constructorAbi = BaseContract._lookupConstructorAbi(abi);
[_exchange
] = BaseContract._formatABIDataItemList(
constructorAbi.inputs,
[_exchange
],
BaseContract._bigNumberToString,
);
const iface = new ethers.utils.Interface(abi);
const deployInfo = iface.deployFunction;
const txData = deployInfo.encode(bytecode, [_exchange
]);
const web3Wrapper = new Web3Wrapper(provider);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{data: txData},
txDefaults,
web3Wrapper.estimateGasAsync.bind(web3Wrapper),
);
const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults);
logUtils.log(`transactionHash: ${txHash}`);
const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash);
logUtils.log(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`);
const contractInstance = new DutchAuctionContract(abi, txReceipt.contractAddress as string, provider, txDefaults);
contractInstance.constructorArgs = [_exchange
];
return contractInstance;
}
constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) {
super('DutchAuction', abi, address, provider, txDefaults);
classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']);
}
} // tslint:disable:max-file-line-count
// tslint:enable:no-unbound-method

View File

@@ -1,6 +1,7 @@
export * from './generated-wrappers/asset_proxy_owner';
export * from './generated-wrappers/dummy_erc20_token';
export * from './generated-wrappers/dummy_erc721_token';
export * from './generated-wrappers/dutch_auction';
export * from './generated-wrappers/erc20_proxy';
export * from './generated-wrappers/erc20_token';
export * from './generated-wrappers/erc721_proxy';

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.20",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.19",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.20 - _January 9, 2019_
* Dependencies updated
## v1.0.19 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/abi-gen",
"version": "1.0.19",
"version": "1.0.20",
"engines": {
"node": ">=6.12"
},
@@ -32,7 +32,7 @@
"homepage": "https://github.com/0xProject/0x-monorepo/packages/abi-gen/README.md",
"dependencies": {
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"chalk": "^2.3.0",
"ethereum-types": "^1.1.4",
"glob": "^7.1.2",

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "1.0.21",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "1.0.20",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.0.21 - _January 9, 2019_
* Dependencies updated
## v1.0.20 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/assert",
"version": "1.0.20",
"version": "1.0.21",
"engines": {
"node": ">=6.12"
},
@@ -44,9 +44,9 @@
"typescript": "3.0.1"
},
"dependencies": {
"@0x/json-schemas": "^2.1.4",
"@0x/json-schemas": "^2.1.5",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"lodash": "^4.17.5",
"valid-url": "^1.0.9"
},

View File

@@ -8,6 +8,15 @@
}
]
},
{
"timestamp": 1547040760,
"version": "3.0.5",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.4",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.5 - _January 9, 2019_
* Dependencies updated
## v3.0.4 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,7 +1,5 @@
## @0x/asset-buyer
**Warning: In Beta, has not been extensively tested.**
Convenience package for buying assets represented on the Ethereum blockchain using 0x. In its simplest form, the package helps in the usage of the [0x forwarder contract](https://github.com/0xProject/0x-protocol-specification/blob/master/v2/forwarder-specification.md), which allows users to execute [Wrapped Ether](https://weth.io/) based 0x orders without having to set allowances, wrap Ether or own ZRX, meaning they can buy tokens with Ether alone. Given some liquidity (0x signed orders), it helps estimate the Ether cost of buying a certain asset (giving a range) and then buying that asset.
In its more advanced and useful form, it integrates with the [Standard Relayer API](https://github.com/0xProject/standard-relayer-api) and takes care of sourcing liquidity for you given an SRA compliant endpoint. The final result is a library that tells you what assets are available, provides an Ether based quote for any asset desired, and allows you to buy that asset using Ether alone.

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-buyer",
"version": "3.0.4",
"version": "3.0.5",
"engines": {
"node": ">=6.12"
},
@@ -36,16 +36,16 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/asset-buyer/README.md",
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/connect": "^3.0.10",
"@0x/contract-wrappers": "^4.1.3",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/subproviders": "^2.1.8",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/connect": "^3.0.11",
"@0x/contract-wrappers": "^4.2.0",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/subproviders": "^2.1.9",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"lodash": "^4.17.5"
},

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "3.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.11 - _January 9, 2019_
* Dependencies updated
## v3.0.10 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/base-contract",
"version": "3.0.10",
"version": "3.0.11",
"engines": {
"node": ">=6.12"
},
@@ -41,8 +41,8 @@
},
"dependencies": {
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethers": "~4.0.4",
"lodash": "^4.17.5"

View File

@@ -1,4 +1,13 @@
[
{
"timestamp": 1547040760,
"version": "3.0.11",
"changes": [
{
"note": "Dependencies updated"
}
]
},
{
"version": "3.0.10",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v3.0.11 - _January 9, 2019_
* Dependencies updated
## v3.0.10 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/connect",
"version": "3.0.10",
"version": "3.0.11",
"engines": {
"node": ">=6.12"
},
@@ -44,12 +44,12 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/packages/connect/README.md",
"dependencies": {
"@0x/assert": "^1.0.20",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/assert": "^1.0.21",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/utils": "^2.1.1",
"lodash": "^4.17.5",
"query-string": "^5.0.1",
"sinon": "^4.0.0",

View File

@@ -1,4 +1,14 @@
[
{
"version": "2.1.0",
"changes": [
{
"note": "Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten)",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "2.0.0",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v2.1.0 - _January 9, 2019_
* Added testnet entries for Dutch Auction contract (kovan,rinkeby,ropsten) (#1465)
## v2.0.0 - _November 28, 2018_
* Redeployed Rinkeby with testnet Exchange artifact (#1318)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-addresses",
"version": "2.0.0",
"version": "2.1.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -9,6 +9,7 @@ export interface ContractAddresses {
assetProxyOwner: string;
forwarder: string;
orderValidator: string;
dutchAuction: string;
}
export enum NetworkId {
@@ -19,6 +20,8 @@ export enum NetworkId {
Ganache = 50,
}
const NULL_ADDRESS = '0x0000000000000000000000000000000000000000';
const networkToAddresses: { [networkId: number]: ContractAddresses } = {
1: {
erc20Proxy: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
@@ -29,6 +32,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
forwarder: '0x5468a1dc173652ee28d249c271fa9933144746b1',
orderValidator: '0x9463e518dea6810309563c81d5266c1b1d149138',
// @todo hysz/dekz: Add mainnet address once deployed.
dutchAuction: NULL_ADDRESS,
},
3: {
erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa',
@@ -39,6 +44,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b',
forwarder: '0x2240dab907db71e64d3e0dba4800c83b5c502d4e',
orderValidator: '0x90431a90516ab49af23a0530e04e8c7836e7122f',
dutchAuction: '0x2df6b59309f35ada230ec7d61d7d97355017a1df',
},
4: {
exchange: '0xbce0b5f6eb618c565c3e5f5cd69652bbc279f44e',
@@ -49,6 +55,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0xe1703da878afcebff5b7624a826902af475b9c03',
forwarder: '0x2d40589abbdee84961f3a7656b9af7adb0ee5ab4',
orderValidator: '0x0c5173a51e26b29d6126c686756fb9fbef71f762',
dutchAuction: '0xdd7bd6437e67c422879364740ab5855fe3dc41f7',
},
42: {
erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e',
@@ -59,6 +66,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8',
forwarder: '0x17992e4ffb22730138e4b62aaa6367fa9d3699a6',
orderValidator: '0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d',
dutchAuction: '0xe11667fb51f34c5367f40d7e379327ce32ee7150',
},
// NetworkId 50 represents our Ganache snapshot generated from migrations.
50: {
@@ -70,6 +78,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = {
assetProxyOwner: '0x34d402f14d58e001d8efbe6585051bf9706aa064',
forwarder: '0xb69e673309512a9d726f87304c6984054f87a93b',
orderValidator: '0xe86bb98fcf9bff3512c74589b78fb168200cc546',
dutchAuction: '0xdc688d29394a3f1e6f1e5100862776691afaf3d2',
},
};

View File

@@ -1,4 +1,14 @@
[
{
"version": "1.2.0",
"changes": [
{
"pr": 1465,
"note": "Added artifact for Dutch Auction contract"
}
],
"timestamp": 1547040760
},
{
"version": "1.1.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v1.2.0 - _January 9, 2019_
* Added artifact for Dutch Auction contract (#1465)
## v1.1.2 - _November 28, 2018_
* Update Exchange artifact to receive ZRX asset data as a constructor argument (#1309)

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-artifacts",
"version": "1.1.2",
"version": "1.2.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -1,4 +1,5 @@
import * as AssetProxyOwner from '../artifacts/AssetProxyOwner.json';
import * as DutchAuction from '../artifacts/DutchAuction.json';
import * as DummyERC20Token from '../artifacts/DummyERC20Token.json';
import * as DummyERC721Token from '../artifacts/DummyERC721Token.json';
import * as ERC20Proxy from '../artifacts/ERC20Proxy.json';
@@ -15,6 +16,7 @@ import * as ZRXToken from '../artifacts/ZRXToken.json';
export {
AssetProxyOwner,
DutchAuction,
DummyERC20Token,
DummyERC721Token,
ERC20Proxy,

View File

@@ -8,6 +8,7 @@
"include": ["./src/**/*"],
"files": [
"./artifacts/AssetProxyOwner.json",
"./artifacts/DutchAuction.json",
"./artifacts/DummyERC20Token.json",
"./artifacts/DummyERC721Token.json",
"./artifacts/ERC20Proxy.json",

View File

@@ -1,9 +1,23 @@
[
{
"version": "4.2.0",
"changes": [
{
"note": "Added Dutch Auction wrapper",
"pr": 1465
}
],
"timestamp": 1547040760
},
{
"version": "4.1.4",
"changes": [
{
"note": "Add support for Trust Wallet signature denial error"
},
{
"note": "Add balance and allowance queries for `MultiAssetProxy`",
"pr": 1363
}
]
},

View File

@@ -5,6 +5,15 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v4.2.0 - _January 9, 2019_
* Added Dutch Auction wrapper (#1465)
## v4.1.4 - _Invalid date_
* Add support for Trust Wallet signature denial error
* Add balance and allowance queries for `MultiAssetProxy` (#1363)
## v4.1.3 - _December 13, 2018_
* Dependencies updated

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/contract-wrappers",
"version": "4.1.3",
"version": "4.2.0",
"description": "Smart TS wrappers for 0x smart contracts",
"keywords": [
"0xproject",
@@ -37,9 +37,9 @@
"node": ">=6.0.0"
},
"devDependencies": {
"@0x/dev-utils": "^1.0.21",
"@0x/migrations": "^2.2.2",
"@0x/subproviders": "^2.1.8",
"@0x/dev-utils": "^1.0.22",
"@0x/migrations": "^2.3.0",
"@0x/subproviders": "^2.1.9",
"@0x/tslint-config": "^2.0.0",
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
@@ -65,18 +65,20 @@
"web3-provider-engine": "14.0.6"
},
"dependencies": {
"@0x/abi-gen-wrappers": "^2.0.2",
"@0x/assert": "^1.0.20",
"@0x/contract-addresses": "^2.0.0",
"@0x/contract-artifacts": "^1.1.2",
"@0x/fill-scenarios": "^1.0.16",
"@0x/json-schemas": "^2.1.4",
"@0x/order-utils": "^3.0.7",
"@0x/types": "^1.4.1",
"@0x/abi-gen-wrappers": "^2.1.0",
"@0x/assert": "^1.0.21",
"@0x/contract-addresses": "^2.1.0",
"@0x/contract-artifacts": "^1.2.0",
"@0x/contracts-test-utils": "^1.0.3",
"@0x/fill-scenarios": "^1.1.0",
"@0x/json-schemas": "^2.1.5",
"@0x/order-utils": "^3.1.0",
"@0x/types": "^1.5.0",
"@0x/typescript-typings": "^3.0.6",
"@0x/utils": "^2.0.8",
"@0x/web3-wrapper": "^3.2.1",
"@0x/utils": "^2.1.1",
"@0x/web3-wrapper": "^3.2.2",
"ethereum-types": "^1.1.4",
"ethereumjs-abi": "0.6.5",
"ethereumjs-blockstream": "6.0.0",
"ethereumjs-util": "^5.1.1",
"ethers": "~4.0.4",

View File

@@ -12,6 +12,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import { Provider } from 'ethereum-types';
import * as _ from 'lodash';
import { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
import { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
import { ERC20TokenWrapper } from './contract_wrappers/erc20_token_wrapper';
import { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
@@ -65,6 +66,10 @@ export class ContractWrappers {
* An instance of the OrderValidatorWrapper class containing methods for interacting with any OrderValidator smart contract.
*/
public orderValidator: OrderValidatorWrapper;
/**
* An instance of the DutchAuctionWrapper class containing methods for interacting with any DutchAuction smart contract.
*/
public dutchAuction: DutchAuctionWrapper;
private readonly _web3Wrapper: Web3Wrapper;
/**
@@ -141,6 +146,11 @@ export class ContractWrappers {
config.networkId,
contractAddresses.orderValidator,
);
this.dutchAuction = new DutchAuctionWrapper(
this._web3Wrapper,
config.networkId,
contractAddresses.dutchAuction,
);
}
/**
* Unsubscribes from all subscriptions for all contracts.

View File

@@ -0,0 +1,182 @@
import { DutchAuctionContract } from '@0x/abi-gen-wrappers';
import { DutchAuction } from '@0x/contract-artifacts';
import { schemas } from '@0x/json-schemas';
import { assetDataUtils } from '@0x/order-utils';
import { DutchAuctionDetails, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { ContractAbi } from 'ethereum-types';
import * as ethAbi from 'ethereumjs-abi';
import * as ethUtil from 'ethereumjs-util';
import * as _ from 'lodash';
import { orderTxOptsSchema } from '../schemas/order_tx_opts_schema';
import { txOptsSchema } from '../schemas/tx_opts_schema';
import { DutchAuctionData, DutchAuctionWrapperError, OrderTransactionOpts } from '../types';
import { assert } from '../utils/assert';
import { _getDefaultContractAddresses } from '../utils/contract_addresses';
import { ContractWrapper } from './contract_wrapper';
export class DutchAuctionWrapper extends ContractWrapper {
public abi: ContractAbi = DutchAuction.compilerOutput.abi;
public address: string;
private _dutchAuctionContractIfExists?: DutchAuctionContract;
/**
* Dutch auction details are encoded with the asset data for a 0x order. This function produces a hex
* encoded assetData string, containing information both about the asset being traded and the
* dutch auction; which is usable in the makerAssetData or takerAssetData fields in a 0x order.
* @param assetData Hex encoded assetData string for the asset being auctioned.
* @param beginTimeSeconds Begin time of the dutch auction.
* @param beginAmount Starting amount being sold in the dutch auction.
* @return The hex encoded assetData string.
*/
public static encodeDutchAuctionAssetData(
assetData: string,
beginTimeSeconds: BigNumber,
beginAmount: BigNumber,
): string {
const assetDataBuffer = ethUtil.toBuffer(assetData);
const abiEncodedAuctionData = (ethAbi as any).rawEncode(
['uint256', 'uint256'],
[beginTimeSeconds.toString(), beginAmount.toString()],
);
const abiEncodedAuctionDataBuffer = ethUtil.toBuffer(abiEncodedAuctionData);
const dutchAuctionDataBuffer = Buffer.concat([assetDataBuffer, abiEncodedAuctionDataBuffer]);
const dutchAuctionData = ethUtil.bufferToHex(dutchAuctionDataBuffer);
return dutchAuctionData;
}
/**
* Dutch auction details are encoded with the asset data for a 0x order. This function decodes a hex
* encoded assetData string, containing information both about the asset being traded and the
* dutch auction.
* @param dutchAuctionData Hex encoded assetData string for the asset being auctioned.
* @return An object containing the auction asset, auction begin time and auction begin amount.
*/
public static decodeDutchAuctionData(dutchAuctionData: string): DutchAuctionData {
const dutchAuctionDataBuffer = ethUtil.toBuffer(dutchAuctionData);
// Decode asset data
const dutchAuctionDataLengthInBytes = 64;
const assetDataBuffer = dutchAuctionDataBuffer.slice(
0,
dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
);
const assetDataHex = ethUtil.bufferToHex(assetDataBuffer);
const assetData = assetDataUtils.decodeAssetDataOrThrow(assetDataHex);
// Decode auction details
const dutchAuctionDetailsBuffer = dutchAuctionDataBuffer.slice(
dutchAuctionDataBuffer.byteLength - dutchAuctionDataLengthInBytes,
);
const [beginTimeSecondsAsBN, beginAmountAsBN] = ethAbi.rawDecode(
['uint256', 'uint256'],
dutchAuctionDetailsBuffer,
);
const beginTimeSeconds = new BigNumber(`0x${beginTimeSecondsAsBN.toString()}`);
const beginAmount = new BigNumber(`0x${beginAmountAsBN.toString()}`);
return {
assetData,
beginTimeSeconds,
beginAmount,
};
}
/**
* Instantiate DutchAuctionWrapper
* @param web3Wrapper Web3Wrapper instance to use.
* @param networkId Desired networkId.
* @param address The address of the Dutch Auction contract. If undefined, will
* default to the known address corresponding to the networkId.
*/
public constructor(web3Wrapper: Web3Wrapper, networkId: number, address?: string) {
super(web3Wrapper, networkId);
this.address = _.isUndefined(address) ? _getDefaultContractAddresses(networkId).dutchAuction : address;
}
/**
* Matches the buy and sell orders at an amount given the following: the current block time, the auction
* start time and the auction begin amount. The sell order is a an order at the lowest amount
* at the end of the auction. Excess from the match is transferred to the seller.
* Over time the price moves from beginAmount to endAmount given the current block.timestamp.
* @param buyOrder The Buyer's order. This order is for the current expected price of the auction.
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @param takerAddress The user Ethereum address who would like to fill this order. Must be available via the supplied
* Provider provided at instantiation.
* @return Transaction hash.
*/
public async matchOrdersAsync(
buyOrder: SignedOrder,
sellOrder: SignedOrder,
takerAddress: string,
orderTransactionOpts: OrderTransactionOpts = { shouldValidate: true },
): Promise<string> {
// type assertions
assert.doesConformToSchema('buyOrder', buyOrder, schemas.signedOrderSchema);
assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
await assert.isSenderAddressAsync('takerAddress', takerAddress, this._web3Wrapper);
assert.doesConformToSchema('orderTransactionOpts', orderTransactionOpts, orderTxOptsSchema, [txOptsSchema]);
const normalizedTakerAddress = takerAddress.toLowerCase();
// other assertions
if (
sellOrder.makerAssetData !== buyOrder.takerAssetData ||
sellOrder.takerAssetData !== buyOrder.makerAssetData
) {
throw new Error(DutchAuctionWrapperError.AssetDataMismatch);
}
// get contract
const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
// validate transaction
if (orderTransactionOpts.shouldValidate) {
await dutchAuctionInstance.matchOrders.callAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
nonce: orderTransactionOpts.nonce,
},
);
}
// send transaction
const txHash = await dutchAuctionInstance.matchOrders.sendTransactionAsync(
buyOrder,
sellOrder,
buyOrder.signature,
sellOrder.signature,
{
from: normalizedTakerAddress,
gas: orderTransactionOpts.gasLimit,
gasPrice: orderTransactionOpts.gasPrice,
nonce: orderTransactionOpts.nonce,
},
);
return txHash;
}
/**
* Fetches the Auction Details for the given order
* @param sellOrder The Seller's order. This order is for the lowest amount (at the end of the auction).
* @return The dutch auction details.
*/
public async getAuctionDetailsAsync(sellOrder: SignedOrder): Promise<DutchAuctionDetails> {
// type assertions
assert.doesConformToSchema('sellOrder', sellOrder, schemas.signedOrderSchema);
// get contract
const dutchAuctionInstance = await this._getDutchAuctionContractAsync();
// call contract
const auctionDetails = await dutchAuctionInstance.getAuctionDetails.callAsync(sellOrder);
return auctionDetails;
}
private async _getDutchAuctionContractAsync(): Promise<DutchAuctionContract> {
if (!_.isUndefined(this._dutchAuctionContractIfExists)) {
return this._dutchAuctionContractIfExists;
}
const contractInstance = new DutchAuctionContract(
this.abi,
this.address,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
this._dutchAuctionContractIfExists = contractInstance;
return this._dutchAuctionContractIfExists;
}
}

View File

@@ -1,8 +1,7 @@
// tslint:disable:no-unnecessary-type-assertion
import { AbstractBalanceAndProxyAllowanceFetcher, assetDataUtils } from '@0x/order-utils';
import { AssetProxyId, ERC20AssetData, ERC721AssetData } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParamLiteral } from 'ethereum-types';
import * as _ from 'lodash';
import { ERC20TokenWrapper } from '../contract_wrappers/erc20_token_wrapper';
import { ERC721TokenWrapper } from '../contract_wrappers/erc721_token_wrapper';
@@ -18,42 +17,45 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
}
public async getBalanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const balance = await this._erc20Token.getBalanceAsync(decodedERC20AssetData.tokenAddress, userAddress, {
let balance: BigNumber | undefined;
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
balance = await this._erc20Token.getBalanceAsync(decodedAssetData.tokenAddress, userAddress, {
defaultBlock: this._stateLayer,
});
return balance;
} else {
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const tokenOwner = await this._erc721Token.getOwnerOfAsync(
decodedERC721AssetData.tokenAddress,
decodedERC721AssetData.tokenId,
decodedAssetData.tokenAddress,
decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
const balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
return balance;
balance = tokenOwner === userAddress ? new BigNumber(1) : new BigNumber(0);
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
// The `balance` for MultiAssetData is the total units of the entire `assetData` that are held by the `userAddress`.
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
const nestedAmountElement = decodedAssetData.amounts[index];
const nestedAssetBalance = (await this.getBalanceAsync(
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
if (_.isUndefined(balance) || nestedAssetBalance.lessThan(balance)) {
balance = nestedAssetBalance;
}
}
}
return balance as BigNumber;
}
public async getProxyAllowanceAsync(assetData: string, userAddress: string): Promise<BigNumber> {
const decodedAssetData = assetDataUtils.decodeAssetDataOrThrow(assetData);
if (decodedAssetData.assetProxyId === AssetProxyId.ERC20) {
const decodedERC20AssetData = decodedAssetData as ERC20AssetData;
const proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(
decodedERC20AssetData.tokenAddress,
userAddress,
{
defaultBlock: this._stateLayer,
},
);
return proxyAllowance;
} else {
const decodedERC721AssetData = decodedAssetData as ERC721AssetData;
let proxyAllowance: BigNumber | undefined;
if (assetDataUtils.isERC20AssetData(decodedAssetData)) {
proxyAllowance = await this._erc20Token.getProxyAllowanceAsync(decodedAssetData.tokenAddress, userAddress, {
defaultBlock: this._stateLayer,
});
} else if (assetDataUtils.isERC721AssetData(decodedAssetData)) {
const isApprovedForAll = await this._erc721Token.isProxyApprovedForAllAsync(
decodedERC721AssetData.tokenAddress,
decodedAssetData.tokenAddress,
userAddress,
{
defaultBlock: this._stateLayer,
@@ -63,15 +65,27 @@ export class AssetBalanceAndProxyAllowanceFetcher implements AbstractBalanceAndP
return new BigNumber(this._erc20Token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS);
} else {
const isApproved = await this._erc721Token.isProxyApprovedAsync(
decodedERC721AssetData.tokenAddress,
decodedERC721AssetData.tokenId,
decodedAssetData.tokenAddress,
decodedAssetData.tokenId,
{
defaultBlock: this._stateLayer,
},
);
const proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
return proxyAllowance;
proxyAllowance = isApproved ? new BigNumber(1) : new BigNumber(0);
}
} else if (assetDataUtils.isMultiAssetData(decodedAssetData)) {
// The `proxyAllowance` for MultiAssetData is the total units of the entire `assetData` that the proxies have been approved to spend by the `userAddress`.
for (const [index, nestedAssetDataElement] of decodedAssetData.nestedAssetData.entries()) {
const nestedAmountElement = decodedAssetData.amounts[index];
const nestedAssetAllowance = (await this.getProxyAllowanceAsync(
nestedAssetDataElement,
userAddress,
)).dividedToIntegerBy(nestedAmountElement);
if (_.isUndefined(proxyAllowance) || nestedAssetAllowance.lessThan(proxyAllowance)) {
proxyAllowance = nestedAssetAllowance;
}
}
}
return proxyAllowance as BigNumber;
}
}

View File

@@ -34,6 +34,7 @@ export { ERC20ProxyWrapper } from './contract_wrappers/erc20_proxy_wrapper';
export { ERC721ProxyWrapper } from './contract_wrappers/erc721_proxy_wrapper';
export { ForwarderWrapper } from './contract_wrappers/forwarder_wrapper';
export { OrderValidatorWrapper } from './contract_wrappers/order_validator_wrapper';
export { DutchAuctionWrapper } from './contract_wrappers/dutch_auction_wrapper';
export { TransactionEncoder } from './utils/transaction_encoder';
@@ -54,9 +55,21 @@ export {
OrderAndTraderInfo,
TraderInfo,
ValidateOrderFillableOpts,
DutchAuctionData,
} from './types';
export { Order, SignedOrder, AssetProxyId } from '@0x/types';
export {
AssetData,
ERC20AssetData,
ERC721AssetData,
SingleAssetData,
MultiAssetData,
MultiAssetDataWithRecursiveDecoding,
DutchAuctionDetails,
Order,
SignedOrder,
AssetProxyId,
} from '@0x/types';
export {
BlockParamLiteral,

View File

@@ -9,7 +9,7 @@ import {
WETH9Events,
} from '@0x/abi-gen-wrappers';
import { ContractAddresses } from '@0x/contract-addresses';
import { OrderState, SignedOrder } from '@0x/types';
import { AssetData, OrderState, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { BlockParam, ContractEventArg, DecodedLogArgs, LogEntryEvent, LogWithDecodedArgs } from 'ethereum-types';
@@ -206,3 +206,13 @@ export interface BalanceAndAllowance {
balance: BigNumber;
allowance: BigNumber;
}
export enum DutchAuctionWrapperError {
AssetDataMismatch = 'ASSET_DATA_MISMATCH',
}
export interface DutchAuctionData {
assetData: AssetData;
beginTimeSeconds: BigNumber;
beginAmount: BigNumber;
}

View File

@@ -0,0 +1,128 @@
import { expectTransactionFailedAsync, getLatestBlockTimestampAsync } from '@0x/contracts-test-utils';
import { BlockchainLifecycle } from '@0x/dev-utils';
import { assetDataUtils } from '@0x/order-utils';
import { RevertReason, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import * as chai from 'chai';
import 'mocha';
import { ContractWrappers } from '../src';
import { chaiSetup } from './utils/chai_setup';
import { constants } from './utils/constants';
import { DutchAuctionUtils } from './utils/dutch_auction_utils';
import { migrateOnceAsync } from './utils/migrate';
import { tokenUtils } from './utils/token_utils';
import { provider, web3Wrapper } from './utils/web3_wrapper';
chaiSetup.configure();
const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
// tslint:disable:custom-no-magic-numbers
describe('DutchAuctionWrapper', () => {
const makerAssetAmount = new BigNumber(5);
const auctionEndTakerAmount = new BigNumber(10);
const auctionBeginTakerAmount = auctionEndTakerAmount.times(2);
const tenMinutesInSeconds = 10 * 60;
let contractWrappers: ContractWrappers;
let exchangeContractAddress: string;
let userAddresses: string[];
let makerAddress: string;
let takerAddress: string;
let makerTokenAddress: string;
let takerTokenAddress: string;
let buyOrder: SignedOrder;
let sellOrder: SignedOrder;
let makerTokenAssetData: string;
let takerTokenAssetData: string;
let auctionBeginTimeSeconds: BigNumber;
let auctionEndTimeSeconds: BigNumber;
before(async () => {
// setup contract wrappers & addresses
const contractAddresses = await migrateOnceAsync();
await blockchainLifecycle.startAsync();
const config = {
networkId: constants.TESTRPC_NETWORK_ID,
contractAddresses,
blockPollingIntervalMs: 10,
};
contractWrappers = new ContractWrappers(provider, config);
exchangeContractAddress = contractWrappers.exchange.address;
userAddresses = await web3Wrapper.getAvailableAddressesAsync();
[, makerAddress, takerAddress] = userAddresses;
[makerTokenAddress, takerTokenAddress] = tokenUtils.getDummyERC20TokenAddresses();
// construct asset data for tokens being swapped
[makerTokenAssetData, takerTokenAssetData] = [
assetDataUtils.encodeERC20AssetData(makerTokenAddress),
assetDataUtils.encodeERC20AssetData(takerTokenAddress),
];
// setup auction details in maker asset data
const currentBlockTimestamp: number = await getLatestBlockTimestampAsync();
auctionBeginTimeSeconds = new BigNumber(currentBlockTimestamp - tenMinutesInSeconds);
auctionEndTimeSeconds = new BigNumber(currentBlockTimestamp + tenMinutesInSeconds);
// create auction orders
const coinbase = userAddresses[0];
const dutchAuctionUtils = new DutchAuctionUtils(
web3Wrapper,
coinbase,
exchangeContractAddress,
contractWrappers.erc20Proxy.address,
);
sellOrder = await dutchAuctionUtils.createSignedSellOrderAsync(
auctionBeginTimeSeconds,
auctionEndTimeSeconds,
auctionBeginTakerAmount,
auctionEndTakerAmount,
makerAssetAmount,
makerTokenAssetData,
takerTokenAssetData,
makerAddress,
constants.NULL_ADDRESS,
);
buyOrder = await dutchAuctionUtils.createSignedBuyOrderAsync(sellOrder, takerAddress);
});
after(async () => {
await blockchainLifecycle.revertAsync();
});
beforeEach(async () => {
await blockchainLifecycle.startAsync();
});
afterEach(async () => {
await blockchainLifecycle.revertAsync();
});
describe('#matchOrdersAsync', () => {
it('should match two orders', async () => {
const txHash = await contractWrappers.dutchAuction.matchOrdersAsync(buyOrder, sellOrder, takerAddress);
await web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
});
it('should throw when invalid transaction and shouldValidate is true', async () => {
// request match with bad buy/sell orders
const badSellOrder = buyOrder;
const badBuyOrder = sellOrder;
return expectTransactionFailedAsync(
contractWrappers.dutchAuction.matchOrdersAsync(badBuyOrder, badSellOrder, takerAddress, {
shouldValidate: true,
}),
RevertReason.InvalidAssetData,
);
});
});
describe('#getAuctionDetailsAsync', () => {
it('should get auction details', async () => {
// get auction details
const auctionDetails = await contractWrappers.dutchAuction.getAuctionDetailsAsync(sellOrder);
// run some basic sanity checks on the return value
expect(auctionDetails.beginTimeSeconds, 'auctionDetails.beginTimeSeconds').to.be.bignumber.equal(
auctionBeginTimeSeconds,
);
expect(auctionDetails.beginAmount, 'auctionDetails.beginAmount').to.be.bignumber.equal(
auctionBeginTakerAmount,
);
expect(auctionDetails.endTimeSeconds, 'auctionDetails.endTimeSeconds').to.be.bignumber.equal(
auctionEndTimeSeconds,
);
});
});
});

View File

@@ -0,0 +1,153 @@
import { DummyERC20TokenContract } from '@0x/abi-gen-wrappers';
import * as artifacts from '@0x/contract-artifacts';
import { assetDataUtils } from '@0x/order-utils';
import { orderFactory } from '@0x/order-utils/lib/src/order_factory';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
import { DutchAuctionWrapper } from '../../src/contract_wrappers/dutch_auction_wrapper';
import { constants } from './constants';
export class DutchAuctionUtils {
private readonly _web3Wrapper: Web3Wrapper;
private readonly _coinbase: string;
private readonly _exchangeAddress: string;
private readonly _erc20ProxyAddress: string;
constructor(web3Wrapper: Web3Wrapper, coinbase: string, exchangeAddress: string, erc20ProxyAddress: string) {
this._web3Wrapper = web3Wrapper;
this._coinbase = coinbase;
this._exchangeAddress = exchangeAddress;
this._erc20ProxyAddress = erc20ProxyAddress;
}
public async createSignedSellOrderAsync(
auctionBeginTimeSections: BigNumber,
acutionEndTimeSeconds: BigNumber,
auctionBeginTakerAssetAmount: BigNumber,
auctionEndTakerAssetAmount: BigNumber,
makerAssetAmount: BigNumber,
makerAssetData: string,
takerAssetData: string,
makerAddress: string,
takerAddress: string,
senderAddress?: string,
makerFee?: BigNumber,
takerFee?: BigNumber,
feeRecipientAddress?: string,
): Promise<SignedOrder> {
// Notes on sell order:
// - The `takerAssetAmount` is set to the `auctionEndTakerAssetAmount`, which is the lowest amount the
// the seller can expect to receive
// - The `makerAssetData` is overloaded to include the auction begin time and begin taker asset amount
const makerAssetDataWithAuctionDetails = DutchAuctionWrapper.encodeDutchAuctionAssetData(
makerAssetData,
auctionBeginTimeSections,
auctionBeginTakerAssetAmount,
);
const signedOrder = await orderFactory.createSignedOrderAsync(
this._web3Wrapper.getProvider(),
makerAddress,
makerAssetAmount,
makerAssetDataWithAuctionDetails,
auctionEndTakerAssetAmount,
takerAssetData,
this._exchangeAddress,
{
takerAddress,
senderAddress,
makerFee,
takerFee,
feeRecipientAddress,
expirationTimeSeconds: acutionEndTimeSeconds,
},
);
const erc20AssetData = assetDataUtils.decodeERC20AssetData(makerAssetData);
await this._increaseERC20BalanceAndAllowanceAsync(erc20AssetData.tokenAddress, makerAddress, makerAssetAmount);
return signedOrder;
}
public async createSignedBuyOrderAsync(
sellOrder: SignedOrder,
buyerAddress: string,
senderAddress?: string,
makerFee?: BigNumber,
takerFee?: BigNumber,
feeRecipientAddress?: string,
expirationTimeSeconds?: BigNumber,
): Promise<SignedOrder> {
const dutchAuctionData = DutchAuctionWrapper.decodeDutchAuctionData(sellOrder.makerAssetData);
// Notes on buy order:
// - The `makerAssetAmount` is set to `dutchAuctionData.beginAmount`, which is
// the highest amount the buyer would have to pay out at any point during the auction.
// - The `takerAssetAmount` is set to the seller's `makerAssetAmount`, as the buyer
// receives the entire amount being sold by the seller.
// - The `makerAssetData`/`takerAssetData` are reversed from the sell order
const signedOrder = await orderFactory.createSignedOrderAsync(
this._web3Wrapper.getProvider(),
buyerAddress,
dutchAuctionData.beginAmount,
sellOrder.takerAssetData,
sellOrder.makerAssetAmount,
sellOrder.makerAssetData,
sellOrder.exchangeAddress,
{
senderAddress,
makerFee,
takerFee,
feeRecipientAddress,
expirationTimeSeconds,
},
);
const buyerERC20AssetData = assetDataUtils.decodeERC20AssetData(sellOrder.takerAssetData);
await this._increaseERC20BalanceAndAllowanceAsync(
buyerERC20AssetData.tokenAddress,
buyerAddress,
dutchAuctionData.beginAmount,
);
return signedOrder;
}
private async _increaseERC20BalanceAndAllowanceAsync(
tokenAddress: string,
address: string,
amount: BigNumber,
): Promise<void> {
if (amount.isZero() || address === constants.NULL_ADDRESS) {
return; // noop
}
await Promise.all([
this._increaseERC20BalanceAsync(tokenAddress, address, amount),
this._increaseERC20AllowanceAsync(tokenAddress, address, amount),
]);
}
private async _increaseERC20BalanceAsync(tokenAddress: string, address: string, amount: BigNumber): Promise<void> {
const erc20Token = new DummyERC20TokenContract(
artifacts.DummyERC20Token.compilerOutput.abi,
tokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
const txHash = await erc20Token.transfer.sendTransactionAsync(address, amount, {
from: this._coinbase,
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
private async _increaseERC20AllowanceAsync(
tokenAddress: string,
address: string,
amount: BigNumber,
): Promise<void> {
const erc20Token = new DummyERC20TokenContract(
artifacts.DummyERC20Token.compilerOutput.abi,
tokenAddress,
this._web3Wrapper.getProvider(),
this._web3Wrapper.getContractDefaults(),
);
const oldMakerAllowance = await erc20Token.allowance.callAsync(address, this._erc20ProxyAddress);
const newMakerAllowance = oldMakerAllowance.plus(amount);
const txHash = await erc20Token.approve.sendTransactionAsync(this._erc20ProxyAddress, newMakerAllowance, {
from: address,
});
await this._web3Wrapper.awaitTransactionSuccessAsync(txHash, constants.AWAIT_TRANSACTION_MINED_MS);
}
}

3
packages/dev-tools-pages/.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
public
assets/fonts/*.woff
assets/fonts/*.woff2

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<ul>
<li><a href="/compiler">Compiler</a></li>
<li><a href="/cov">Cov</a></li>
<li><a href="/profiler">Profiler</a></li>
<li><a href="/trace">Trace</a></li>
</ul>
</body>
</html>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View File

@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="preload" href="/fonts/MaisonNeue-Book-subset.woff2" as="font" type="font/woff2" crossorigin>
<link rel="preload" href="/fonts/MaisonNeue-Bold-subset.woff2" as="font" type="font/woff2" crossorigin>
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
</body>
</html>

View File

@@ -1,13 +1,13 @@
{
"name": "@0x/dev-tools-pages",
"version": "0.0.10",
"version": "0.0.11",
"engines": {
"node": ">=6.12"
},
"private": true,
"description": "0x Dev tools pages",
"scripts": {
"build": "node --max_old_space_size=8192 ../../node_modules/.bin/webpack --mode production",
"build": "node --max_old_space_size=8192 ../../node_modules/.bin/webpack --mode production && react-snap",
"build:ci": "yarn build",
"build:dev": "../../node_modules/.bin/webpack --mode development",
"clean": "shx rm -f public/bundle*",
@@ -16,33 +16,43 @@
},
"license": "Apache-2.0",
"dependencies": {
"@0x/react-shared": "^1.0.25",
"@0x/react-shared": "^1.1.0",
"basscss": "^8.0.3",
"bowser": "^1.9.3",
"highlight.js": "^9.13.1",
"less": "^2.7.2",
"lodash": "^4.17.5",
"polished": "^1.9.2",
"react": "^16.4.2",
"react-document-title": "^2.0.3",
"react-dom": "^16.4.2",
"react-helmet": "^5.2.0",
"styled-components": "^3.3.0"
"react": "^16.5.2",
"react-dom": "^16.5.2",
"react-loadable": "^5.5.0",
"react-lottie": "^1.2.3",
"react-tabs": "^2.3.0",
"styled-components": "^4.1.1",
"styled-normalize": "^8.0.1"
},
"devDependencies": {
"@types/highlight.js": "^9.12.3",
"@types/lodash": "4.14.104",
"@types/node": "*",
"@types/react": "^16.4.2",
"@types/react-dom": "^16.0.7",
"@types/react-helmet": "^5.0.6",
"@types/react-loadable": "^5.4.1",
"@types/react-lottie": "^1.2.0",
"@types/react-router-dom": "^4.0.4",
"@types/react-tabs": "^2.3.0",
"@types/react-tap-event-plugin": "0.0.30",
"@types/styled-components": "^4.0.0",
"@types/styled-components": "4.1.1",
"awesome-typescript-loader": "^5.2.1",
"clean-webpack-plugin": "^0.1.19",
"copy-webpack-plugin": "^4.5.4",
"copyfiles": "^2.0.0",
"css-loader": "0.23.x",
"html-webpack-plugin": "^3.2.0",
"less-loader": "^4.1.0",
"make-promises-safe": "^1.1.0",
"raw-loader": "^0.5.1",
"react-snap": "^1.19.0",
"react-svg-loader": "^2.1.0",
"shx": "^0.2.2",
"source-map-loader": "^0.2.4",
"style-loader": "0.23.x",
@@ -52,7 +62,15 @@
"typescript": "3.0.1",
"uglifyjs-webpack-plugin": "^2.0.1",
"webpack": "^4.20.2",
"webpack-bundle-analyzer": "^3.0.3",
"webpack-cli": "3.1.2",
"webpack-dev-server": "^3.1.9"
},
"reactSnap": {
"source": "public",
"puppeteerArgs": [
"--no-sandbox",
"--disable-setuid-sandbox"
]
}
}

View File

@@ -0,0 +1,72 @@
const pages = [
{
title: 'sol-compiler',
filename: 'compiler/index.html',
template: 'assets/index.html',
chunks: ['compiler'],
favicon: 'assets/favicons/compiler.ico',
minify: true,
meta: {
description: 'Solidity compilation that just works',
'og-title': { property: 'og:title', content: 'sol-compiler' },
'og-description': { property: 'og:description', content: 'Solidity compilation that just works' },
'og-type': { property: 'og:type', content: 'website' },
'og-image': { property: 'og:image', content: '/images/og-compiler' },
'twitter:site': '@0xproject',
'twitter:image': '/images/og-compiler',
},
},
{
title: 'sol-cov',
filename: 'cov/index.html',
template: 'assets/index.html',
chunks: ['cov'],
favicon: 'assets/favicons/cov.ico',
minify: true,
meta: {
description: 'Solidity code coverage',
'og-title': { property: 'og:title', content: 'sol-cov' },
'og-description': { property: 'og:description', content: 'Solidity code coverage' },
'og-type': { property: 'og:type', content: 'website' },
'og-image': { property: 'og:image', content: '/images/og-cov' },
'twitter:site': '@0xproject',
'twitter:image': '/images/og-cov',
},
},
{
title: 'sol-profiler',
filename: 'profiler/index.html',
template: 'assets/index.html',
chunks: ['profiler'],
favicon: 'assets/favicons/profiler.ico',
minify: true,
meta: {
description: 'Gas profiling for Solidity',
'og-title': { property: 'og:title', content: 'sol-profiler' },
'og-description': { property: 'og:description', content: 'Gas profiling for Solidity' },
'og-type': { property: 'og:type', content: 'website' },
'og-image': { property: 'og:image', content: '/images/og-profiler' },
'twitter:site': '@0xproject',
'twitter:image': '/images/og-profiler',
},
},
{
title: 'sol-trace',
filename: 'trace/index.html',
template: 'assets/index.html',
chunks: ['trace'],
favicon: 'assets/favicons/trace.ico',
minify: true,
meta: {
description: 'Human-readable stack traces',
'og-title': { property: 'og:title', content: 'sol-trace' },
'og-description': { property: 'og:description', content: 'Human-readable stack traces' },
'og-type': { property: 'og:type', content: 'website' },
'og-image': { property: 'og:image', content: '/images/og-trace' },
'twitter:site': '@0xproject',
'twitter:image': '/images/og-trace',
},
},
];
module.exports = pages;

View File

@@ -1,85 +0,0 @@
/* Custom Basscss Responsive Utilities */
@media (max-width: 52em) {
.sm-center {
text-align: center;
}
.sm-align-middle {
vertical-align: middle;
}
.sm-align-top {
vertical-align: top;
}
.sm-left-align {
text-align: left;
}
.sm-right-align {
text-align: right;
}
.sm-table-cell {
display: table-cell;
}
.sm-mx-auto {
margin-left: auto;
margin-right: auto;
}
.sm-right {
float: right;
}
}
@media (min-width: 52em) {
.md-center {
text-align: center;
}
.md-align-middle {
vertical-align: middle;
}
.md-align-top {
vertical-align: top;
}
.md-left-align {
text-align: left;
}
.md-right-align {
text-align: right;
}
.md-table-cell {
display: table-cell;
}
.md-mx-auto {
margin-left: auto;
margin-right: auto;
}
.md-right {
float: right;
}
}
@media (min-width: 64em) {
.lg-center {
text-align: center;
}
.lg-align-middle {
vertical-align: middle;
}
.lg-align-top {
vertical-align: top;
}
.lg-left-align {
text-align: left;
}
.lg-right-align {
text-align: right;
}
.lg-table-cell {
display: table-cell;
}
.lg-mx-auto {
margin-left: auto;
margin-right: auto;
}
.lg-right {
float: right;
}
}

View File

@@ -1,453 +0,0 @@
/* Basscss Responsive Margin */
@media (max-width: 52em) {
/* Modified by Fabio Berger to max-width from min-width */
.sm-m0 {
margin: 0;
}
.sm-mt0 {
margin-top: 0;
}
.sm-mr0 {
margin-right: 0;
}
.sm-mb0 {
margin-bottom: 0;
}
.sm-ml0 {
margin-left: 0;
}
.sm-mx0 {
margin-left: 0;
margin-right: 0;
}
.sm-my0 {
margin-top: 0;
margin-bottom: 0;
}
.sm-m1 {
margin: 0.5rem;
}
.sm-mt1 {
margin-top: 0.5rem;
}
.sm-mr1 {
margin-right: 0.5rem;
}
.sm-mb1 {
margin-bottom: 0.5rem;
}
.sm-ml1 {
margin-left: 0.5rem;
}
.sm-mx1 {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.sm-my1 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.sm-m2 {
margin: 1rem;
}
.sm-mt2 {
margin-top: 1rem;
}
.sm-mr2 {
margin-right: 1rem;
}
.sm-mb2 {
margin-bottom: 1rem;
}
.sm-ml2 {
margin-left: 1rem;
}
.sm-mx2 {
margin-left: 1rem;
margin-right: 1rem;
}
.sm-my2 {
margin-top: 1rem;
margin-bottom: 1rem;
}
.sm-m3 {
margin: 2rem;
}
.sm-mt3 {
margin-top: 2rem;
}
.sm-mr3 {
margin-right: 2rem;
}
.sm-mb3 {
margin-bottom: 2rem;
}
.sm-ml3 {
margin-left: 2rem;
}
.sm-mx3 {
margin-left: 2rem;
margin-right: 2rem;
}
.sm-my3 {
margin-top: 2rem;
margin-bottom: 2rem;
}
.sm-m4 {
margin: 4rem;
}
.sm-mt4 {
margin-top: 4rem;
}
.sm-mr4 {
margin-right: 4rem;
}
.sm-mb4 {
margin-bottom: 4rem;
}
.sm-ml4 {
margin-left: 4rem;
}
.sm-mx4 {
margin-left: 4rem;
margin-right: 4rem;
}
.sm-my4 {
margin-top: 4rem;
margin-bottom: 4rem;
}
.sm-mxn1 {
margin-left: -0.5rem;
margin-right: -0.5rem;
}
.sm-mxn2 {
margin-left: -1rem;
margin-right: -1rem;
}
.sm-mxn3 {
margin-left: -2rem;
margin-right: -2rem;
}
.sm-mxn4 {
margin-left: -4rem;
margin-right: -4rem;
}
.sm-ml-auto {
margin-left: auto;
}
.sm-mr-auto {
margin-right: auto;
}
.sm-mx-auto {
margin-left: auto;
margin-right: auto;
}
}
@media (min-width: 52em) {
.md-m0 {
margin: 0;
}
.md-mt0 {
margin-top: 0;
}
.md-mr0 {
margin-right: 0;
}
.md-mb0 {
margin-bottom: 0;
}
.md-ml0 {
margin-left: 0;
}
.md-mx0 {
margin-left: 0;
margin-right: 0;
}
.md-my0 {
margin-top: 0;
margin-bottom: 0;
}
.md-m1 {
margin: 0.5rem;
}
.md-mt1 {
margin-top: 0.5rem;
}
.md-mr1 {
margin-right: 0.5rem;
}
.md-mb1 {
margin-bottom: 0.5rem;
}
.md-ml1 {
margin-left: 0.5rem;
}
.md-mx1 {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.md-my1 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.md-m2 {
margin: 1rem;
}
.md-mt2 {
margin-top: 1rem;
}
.md-mr2 {
margin-right: 1rem;
}
.md-mb2 {
margin-bottom: 1rem;
}
.md-ml2 {
margin-left: 1rem;
}
.md-mx2 {
margin-left: 1rem;
margin-right: 1rem;
}
.md-my2 {
margin-top: 1rem;
margin-bottom: 1rem;
}
.md-m3 {
margin: 2rem;
}
.md-mt3 {
margin-top: 2rem;
}
.md-mr3 {
margin-right: 2rem;
}
.md-mb3 {
margin-bottom: 2rem;
}
.md-ml3 {
margin-left: 2rem;
}
.md-mx3 {
margin-left: 2rem;
margin-right: 2rem;
}
.md-my3 {
margin-top: 2rem;
margin-bottom: 2rem;
}
.md-m4 {
margin: 4rem;
}
.md-mt4 {
margin-top: 4rem;
}
.md-mr4 {
margin-right: 4rem;
}
.md-mb4 {
margin-bottom: 4rem;
}
.md-ml4 {
margin-left: 4rem;
}
.md-mx4 {
margin-left: 4rem;
margin-right: 4rem;
}
.md-my4 {
margin-top: 4rem;
margin-bottom: 4rem;
}
.md-mxn1 {
margin-left: -0.5rem;
margin-right: -0.5rem;
}
.md-mxn2 {
margin-left: -1rem;
margin-right: -1rem;
}
.md-mxn3 {
margin-left: -2rem;
margin-right: -2rem;
}
.md-mxn4 {
margin-left: -4rem;
margin-right: -4rem;
}
.md-ml-auto {
margin-left: auto;
}
.md-mr-auto {
margin-right: auto;
}
.md-mx-auto {
margin-left: auto;
margin-right: auto;
}
}
@media (min-width: 64em) {
.lg-m0 {
margin: 0;
}
.lg-mt0 {
margin-top: 0;
}
.lg-mr0 {
margin-right: 0;
}
.lg-mb0 {
margin-bottom: 0;
}
.lg-ml0 {
margin-left: 0;
}
.lg-mx0 {
margin-left: 0;
margin-right: 0;
}
.lg-my0 {
margin-top: 0;
margin-bottom: 0;
}
.lg-m1 {
margin: 0.5rem;
}
.lg-mt1 {
margin-top: 0.5rem;
}
.lg-mr1 {
margin-right: 0.5rem;
}
.lg-mb1 {
margin-bottom: 0.5rem;
}
.lg-ml1 {
margin-left: 0.5rem;
}
.lg-mx1 {
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.lg-my1 {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
.lg-m2 {
margin: 1rem;
}
.lg-mt2 {
margin-top: 1rem;
}
.lg-mr2 {
margin-right: 1rem;
}
.lg-mb2 {
margin-bottom: 1rem;
}
.lg-ml2 {
margin-left: 1rem;
}
.lg-mx2 {
margin-left: 1rem;
margin-right: 1rem;
}
.lg-my2 {
margin-top: 1rem;
margin-bottom: 1rem;
}
.lg-m3 {
margin: 2rem;
}
.lg-mt3 {
margin-top: 2rem;
}
.lg-mr3 {
margin-right: 2rem;
}
.lg-mb3 {
margin-bottom: 2rem;
}
.lg-ml3 {
margin-left: 2rem;
}
.lg-mx3 {
margin-left: 2rem;
margin-right: 2rem;
}
.lg-my3 {
margin-top: 2rem;
margin-bottom: 2rem;
}
.lg-m4 {
margin: 4rem;
}
.lg-mt4 {
margin-top: 4rem;
}
.lg-mr4 {
margin-right: 4rem;
}
.lg-mb4 {
margin-bottom: 4rem;
}
.lg-ml4 {
margin-left: 4rem;
}
.lg-mx4 {
margin-left: 4rem;
margin-right: 4rem;
}
.lg-my4 {
margin-top: 4rem;
margin-bottom: 4rem;
}
.lg-mxn1 {
margin-left: -0.5rem;
margin-right: -0.5rem;
}
.lg-mxn2 {
margin-left: -1rem;
margin-right: -1rem;
}
.lg-mxn3 {
margin-left: -2rem;
margin-right: -2rem;
}
.lg-mxn4 {
margin-left: -4rem;
margin-right: -4rem;
}
.lg-ml-auto {
margin-left: auto;
}
.lg-mr-auto {
margin-right: auto;
}
.lg-mx-auto {
margin-left: auto;
margin-right: auto;
}
}

View File

@@ -1,134 +0,0 @@
/* Basscss Responsive Padding */
/* Modified by Fabio Berger to include xs prefix */
@media (max-width: 52em) { /* Modified by Fabio Berger to max-width from min-width */
.sm-p0 { padding: 0 }
.sm-pt0 { padding-top: 0 }
.sm-pr0 { padding-right: 0 }
.sm-pb0 { padding-bottom: 0 }
.sm-pl0 { padding-left: 0 }
.sm-px0 { padding-left: 0; padding-right: 0 }
.sm-py0 { padding-top: 0; padding-bottom: 0 }
.sm-p1 { padding: .5rem }
.sm-pt1 { padding-top: .5rem }
.sm-pr1 { padding-right: .5rem }
.sm-pb1 { padding-bottom: .5rem }
.sm-pl1 { padding-left: .5rem }
.sm-px1 { padding-left: .5rem; padding-right: .5rem }
.sm-py1 { padding-top: .5rem; padding-bottom: .5rem }
.sm-p2 { padding: 1rem }
.sm-pt2 { padding-top: 1rem }
.sm-pr2 { padding-right: 1rem }
.sm-pb2 { padding-bottom: 1rem }
.sm-pl2 { padding-left: 1rem }
.sm-px2 { padding-left: 1rem; padding-right: 1rem }
.sm-py2 { padding-top: 1rem; padding-bottom: 1rem }
.sm-p3 { padding: 2rem }
.sm-pt3 { padding-top: 2rem }
.sm-pr3 { padding-right: 2rem }
.sm-pb3 { padding-bottom: 2rem }
.sm-pl3 { padding-left: 2rem }
.sm-px3 { padding-left: 2rem; padding-right: 2rem }
.sm-py3 { padding-top: 2rem; padding-bottom: 2rem }
.sm-p4 { padding: 4rem }
.sm-pt4 { padding-top: 4rem }
.sm-pr4 { padding-right: 4rem }
.sm-pb4 { padding-bottom: 4rem }
.sm-pl4 { padding-left: 4rem }
.sm-px4 { padding-left: 4rem; padding-right: 4rem }
.sm-py4 { padding-top: 4rem; padding-bottom: 4rem }
}
@media (min-width: 52em) {
.md-p0 { padding: 0 }
.md-pt0 { padding-top: 0 }
.md-pr0 { padding-right: 0 }
.md-pb0 { padding-bottom: 0 }
.md-pl0 { padding-left: 0 }
.md-px0 { padding-left: 0; padding-right: 0 }
.md-py0 { padding-top: 0; padding-bottom: 0 }
.md-p1 { padding: .5rem }
.md-pt1 { padding-top: .5rem }
.md-pr1 { padding-right: .5rem }
.md-pb1 { padding-bottom: .5rem }
.md-pl1 { padding-left: .5rem }
.md-px1 { padding-left: .5rem; padding-right: .5rem }
.md-py1 { padding-top: .5rem; padding-bottom: .5rem }
.md-p2 { padding: 1rem }
.md-pt2 { padding-top: 1rem }
.md-pr2 { padding-right: 1rem }
.md-pb2 { padding-bottom: 1rem }
.md-pl2 { padding-left: 1rem }
.md-px2 { padding-left: 1rem; padding-right: 1rem }
.md-py2 { padding-top: 1rem; padding-bottom: 1rem }
.md-p3 { padding: 2rem }
.md-pt3 { padding-top: 2rem }
.md-pr3 { padding-right: 2rem }
.md-pb3 { padding-bottom: 2rem }
.md-pl3 { padding-left: 2rem }
.md-px3 { padding-left: 2rem; padding-right: 2rem }
.md-py3 { padding-top: 2rem; padding-bottom: 2rem }
.md-p4 { padding: 4rem }
.md-pt4 { padding-top: 4rem }
.md-pr4 { padding-right: 4rem }
.md-pb4 { padding-bottom: 4rem }
.md-pl4 { padding-left: 4rem }
.md-px4 { padding-left: 4rem; padding-right: 4rem }
.md-py4 { padding-top: 4rem; padding-bottom: 4rem }
}
@media (min-width: 64em) {
.lg-p0 { padding: 0 }
.lg-pt0 { padding-top: 0 }
.lg-pr0 { padding-right: 0 }
.lg-pb0 { padding-bottom: 0 }
.lg-pl0 { padding-left: 0 }
.lg-px0 { padding-left: 0; padding-right: 0 }
.lg-py0 { padding-top: 0; padding-bottom: 0 }
.lg-p1 { padding: .5rem }
.lg-pt1 { padding-top: .5rem }
.lg-pr1 { padding-right: .5rem }
.lg-pb1 { padding-bottom: .5rem }
.lg-pl1 { padding-left: .5rem }
.lg-px1 { padding-left: .5rem; padding-right: .5rem }
.lg-py1 { padding-top: .5rem; padding-bottom: .5rem }
.lg-p2 { padding: 1rem }
.lg-pt2 { padding-top: 1rem }
.lg-pr2 { padding-right: 1rem }
.lg-pb2 { padding-bottom: 1rem }
.lg-pl2 { padding-left: 1rem }
.lg-px2 { padding-left: 1rem; padding-right: 1rem }
.lg-py2 { padding-top: 1rem; padding-bottom: 1rem }
.lg-p3 { padding: 2rem }
.lg-pt3 { padding-top: 2rem }
.lg-pr3 { padding-right: 2rem }
.lg-pb3 { padding-bottom: 2rem }
.lg-pl3 { padding-left: 2rem }
.lg-px3 { padding-left: 2rem; padding-right: 2rem }
.lg-py3 { padding-top: 2rem; padding-bottom: 2rem }
.lg-p4 { padding: 4rem }
.lg-pt4 { padding-top: 4rem }
.lg-pr4 { padding-right: 4rem }
.lg-pb4 { padding-bottom: 4rem }
.lg-pl4 { padding-left: 4rem }
.lg-px4 { padding-left: 4rem; padding-right: 4rem }
.lg-py4 { padding-top: 4rem; padding-bottom: 4rem }
}

View File

@@ -1,35 +0,0 @@
/* Basscss Responsive Type Scale */
/* Modified by Fabio Berger to include xs prefix */
@media (max-width: 52em) { /* Modified by Fabio Berger to max-width from min-width */
.sm-h00 { font-size: 4rem }
.sm-h0 { font-size: 3rem }
.sm-h1 { font-size: 2rem }
.sm-h2 { font-size: 1.5rem }
.sm-h3 { font-size: 1.25rem }
.sm-h4 { font-size: 1rem }
.sm-h5 { font-size: .875rem }
.sm-h6 { font-size: .75rem }
}
@media (min-width: 52em) {
.md-h00 { font-size: 4rem }
.md-h0 { font-size: 3rem }
.md-h1 { font-size: 2rem }
.md-h2 { font-size: 1.5rem }
.md-h3 { font-size: 1.25rem }
.md-h4 { font-size: 1rem }
.md-h5 { font-size: .875rem }
.md-h6 { font-size: .75rem }
}
@media (min-width: 64em) {
.lg-h00 { font-size: 4rem }
.lg-h0 { font-size: 3rem }
.lg-h1 { font-size: 2rem }
.lg-h2 { font-size: 1.5rem }
.lg-h3 { font-size: 1.25rem }
.lg-h4 { font-size: 1rem }
.lg-h5 { font-size: .875rem }
.lg-h6 { font-size: .75rem }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 684 B

Some files were not shown because too many files have changed in this diff Show More