diff options
author | Bryan Stitt <bryan@stitthappens.com> | 2018-11-13 01:10:40 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-11-13 01:10:40 +0800 |
commit | 789f57345298f2700a56f329ba0873c1f623ce8b (patch) | |
tree | 51b04785b13a9945ffdd15d0b67f564163a146d0 /packages/contracts | |
parent | 22f217807d44e364cad6ebe90560326a755cdd11 (diff) | |
parent | 0ebbbdfca49028f196853bbfb082a1378c09f441 (diff) | |
download | dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar.gz dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar.bz2 dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar.lz dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar.xz dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.tar.zst dexon-sol-tools-789f57345298f2700a56f329ba0873c1f623ce8b.zip |
Merge branch 'development' into patch-1
Diffstat (limited to 'packages/contracts')
-rw-r--r-- | packages/contracts/CHANGELOG.json | 115 | ||||
-rw-r--r-- | packages/contracts/README.md | 2 | ||||
-rw-r--r-- | packages/contracts/package.json | 16 | ||||
-rw-r--r-- | packages/contracts/test/utils/exchange_wrapper.ts | 6 | ||||
-rw-r--r-- | packages/contracts/test/utils/fill_order_combinatorial_utils.ts | 2 | ||||
-rw-r--r-- | packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts | 13 |
6 files changed, 140 insertions, 14 deletions
diff --git a/packages/contracts/CHANGELOG.json b/packages/contracts/CHANGELOG.json new file mode 100644 index 000000000..3f57a33d6 --- /dev/null +++ b/packages/contracts/CHANGELOG.json @@ -0,0 +1,115 @@ +[ + { + "name": "Forwarder", + "version": "1.1.0", + "changes": [ + { + "note": "Round up when calculating remaining amounts in marketBuy functions", + "pr": 1162, + "networks": { + "1": "0x5468a1dc173652ee28d249c271fa9933144746b1", + "3": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e", + "42": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6" + } + } + ] + }, + { + "name": "Forwarder", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x7afc2d5107af94c462a194d2c21b5bdd238709d6", + "3": "0x3983e204b12b3c02fb0638caf2cd406a62e0ead3", + "42": "0xd85e2fa7e7e252b27b01bf0d65c946959d2f45b8" + } + } + ] + }, + { + "name": "OrderValidator", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x9463e518dea6810309563c81d5266c1b1d149138", + "3": "0x90431a90516ab49af23a0530e04e8c7836e7122f", + "42": "0xb389da3d204b412df2f75c6afb3d0a7ce0bc283d" + } + } + ] + }, + { + "name": "Exchange", + "version": "2.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x4f833a24e1f95d70f028921e27040ca56e09ab0b", + "3": "0x4530c0483a1633c7a1c97d2c53721caff2caaaaf", + "42": "0x35dd2932454449b14cee11a94d3674a936d5d7b2" + } + } + ] + }, + { + "name": "ERC20Proxy", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x2240dab907db71e64d3e0dba4800c83b5c502d4e", + "3": "0xb1408f4c245a23c31b98d2c626777d4c0d766caa", + "42": "0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e" + } + } + ] + }, + { + "name": "ERC721Proxy", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x208e41fb445f1bb1b6780d58356e81405f3e6127", + "3": "0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4", + "42": "0x2a9127c745688a165106c11cd4d647d2220af821" + } + } + ] + }, + { + "name": "AssetProxyOwner", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v2 deploy", + "networks": { + "1": "0x17992e4ffb22730138e4b62aaa6367fa9d3699a6", + "3": "0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b", + "42": "0x2c824d2882baa668e0d5202b1e7f2922278703f8" + } + } + ] + }, + { + "name": "ZRXToken", + "version": "1.0.0", + "changes": [ + { + "note": "protocol v1 deploy", + "networks": { + "1": "0xe41d2489571d322189246dafa5ebde1f4699f498", + "3": "0xff67881f8d12f372d91baae9752eb3631ff0ed00", + "42": "0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa" + } + } + ] + } +] diff --git a/packages/contracts/README.md b/packages/contracts/README.md index 5aedb249f..97a2816ff 100644 --- a/packages/contracts/README.md +++ b/packages/contracts/README.md @@ -1,6 +1,6 @@ ## Contracts -Smart contracts that implement the 0x protocol. Addresses of the deployed contracts can be found [here](https://0xproject.com/wiki#Deployed-Addresses). +Smart contracts that implement the 0x protocol. Addresses of the deployed contracts can be found in the 0x [wiki](https://0xproject.com/wiki#Deployed-Addresses) or the [CHANGELOG](./CHANGELOG.json) of this package. ## Usage diff --git a/packages/contracts/package.json b/packages/contracts/package.json index bf9bb4826..3e08ea2c4 100644 --- a/packages/contracts/package.json +++ b/packages/contracts/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "contracts", - "version": "2.1.51", + "version": "2.1.52", "engines": { "node": ">=6.12" }, @@ -46,10 +46,10 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/contracts/README.md", "devDependencies": { "@0x/abi-gen": "^1.0.15", - "@0x/dev-utils": "^1.0.14", - "@0x/sol-compiler": "^1.1.9", - "@0x/sol-cov": "^2.1.9", - "@0x/subproviders": "^2.1.1", + "@0x/dev-utils": "^1.0.15", + "@0x/sol-compiler": "^1.1.10", + "@0x/sol-cov": "^2.1.10", + "@0x/subproviders": "^2.1.2", "@0x/tslint-config": "^1.0.10", "@types/bn.js": "^4.11.0", "@types/ethereumjs-abi": "^0.6.0", @@ -71,12 +71,12 @@ "yargs": "^10.0.3" }, "dependencies": { - "@0x/base-contract": "^3.0.3", - "@0x/order-utils": "^2.0.1", + "@0x/base-contract": "^3.0.4", + "@0x/order-utils": "^3.0.0", "@0x/types": "^1.2.1", "@0x/typescript-typings": "^3.0.4", "@0x/utils": "^2.0.4", - "@0x/web3-wrapper": "^3.1.1", + "@0x/web3-wrapper": "^3.1.2", "@types/js-combinatorics": "^0.5.29", "bn.js": "^4.11.8", "ethereum-types": "^1.1.2", diff --git a/packages/contracts/test/utils/exchange_wrapper.ts b/packages/contracts/test/utils/exchange_wrapper.ts index 29dba690a..c28989d3f 100644 --- a/packages/contracts/test/utils/exchange_wrapper.ts +++ b/packages/contracts/test/utils/exchange_wrapper.ts @@ -212,13 +212,17 @@ export class ExchangeWrapper { return tx; } public async getTakerAssetFilledAmountAsync(orderHashHex: string): Promise<BigNumber> { - const filledAmount = new BigNumber(await this._exchange.filled.callAsync(orderHashHex)); + const filledAmount = await this._exchange.filled.callAsync(orderHashHex); return filledAmount; } public async isCancelledAsync(orderHashHex: string): Promise<boolean> { const isCancelled = await this._exchange.cancelled.callAsync(orderHashHex); return isCancelled; } + public async getOrderEpochAsync(makerAddress: string, senderAddress: string): Promise<BigNumber> { + const orderEpoch = await this._exchange.orderEpoch.callAsync(makerAddress, senderAddress); + return orderEpoch; + } public async getOrderInfoAsync(signedOrder: SignedOrder): Promise<OrderInfo> { const orderInfo = (await this._exchange.getOrderInfo.callAsync(signedOrder)) as OrderInfo; return orderInfo; diff --git a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts index 81bb33318..8046771f9 100644 --- a/packages/contracts/test/utils/fill_order_combinatorial_utils.ts +++ b/packages/contracts/test/utils/fill_order_combinatorial_utils.ts @@ -392,7 +392,7 @@ export class FillOrderCombinatorialUtils { ); // 5. If I fill it by X, what are the resulting balances/allowances/filled amounts expected? - const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher); + const orderValidationUtils = new OrderValidationUtils(orderFilledCancelledFetcher, provider); const lazyStore = new BalanceAndProxyAllowanceLazyStore(balanceAndProxyAllowanceFetcher); const exchangeTransferSimulator = new ExchangeTransferSimulator(lazyStore); diff --git a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts index 5f5575c7b..af959e00e 100644 --- a/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts +++ b/packages/contracts/test/utils/simple_order_filled_cancelled_fetcher.ts @@ -1,4 +1,5 @@ -import { AbstractOrderFilledCancelledFetcher } from '@0x/order-utils'; +import { AbstractOrderFilledCancelledFetcher, orderHashUtils } from '@0x/order-utils'; +import { SignedOrder } from '@0x/types'; import { BigNumber } from '@0x/utils'; import { ExchangeWrapper } from './exchange_wrapper'; @@ -14,9 +15,15 @@ export class SimpleOrderFilledCancelledFetcher implements AbstractOrderFilledCan const filledTakerAmount = new BigNumber(await this._exchangeWrapper.getTakerAssetFilledAmountAsync(orderHash)); return filledTakerAmount; } - public async isOrderCancelledAsync(orderHash: string): Promise<boolean> { + public async isOrderCancelledAsync(signedOrder: SignedOrder): Promise<boolean> { + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); const isCancelled = await this._exchangeWrapper.isCancelledAsync(orderHash); - return isCancelled; + const orderEpoch = await this._exchangeWrapper.getOrderEpochAsync( + signedOrder.makerAddress, + signedOrder.senderAddress, + ); + const isCancelledByOrderEpoch = orderEpoch > signedOrder.salt; + return isCancelled || isCancelledByOrderEpoch; } public getZRXAssetData(): string { return this._zrxAssetData; |