Merge branch 'development' into 3.0
This commit is contained in:
@@ -176,6 +176,34 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1565296576,
|
||||
"version": "2.1.11",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"version": "2.1.10",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies.",
|
||||
"pr": 1995
|
||||
}
|
||||
],
|
||||
"timestamp": 1564607468
|
||||
},
|
||||
{
|
||||
"timestamp": 1563957393,
|
||||
"version": "2.1.9",
|
||||
"changes": [
|
||||
{
|
||||
"note": "Dependencies updated"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"timestamp": 1563193019,
|
||||
"version": "2.1.8",
|
||||
|
@@ -5,6 +5,18 @@ Edit the package's CHANGELOG.json file only.
|
||||
|
||||
CHANGELOG
|
||||
|
||||
## v2.1.11 - _August 8, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.10 - _July 31, 2019_
|
||||
|
||||
* Updated calls to <contract wrapper>.deployFrom0xArtifactAsync to include artifact dependencies. (#1995)
|
||||
|
||||
## v2.1.9 - _July 24, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
||||
## v2.1.8 - _July 15, 2019_
|
||||
|
||||
* Dependencies updated
|
||||
|
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@0x/contracts-exchange",
|
||||
"version": "2.1.8",
|
||||
"version": "2.1.11",
|
||||
"engines": {
|
||||
"node": ">=6.12"
|
||||
},
|
||||
@@ -47,20 +47,21 @@
|
||||
},
|
||||
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/protocol/README.md",
|
||||
"devDependencies": {
|
||||
"@0x/abi-gen": "^2.1.1",
|
||||
"@0x/contracts-gen": "^1.0.10",
|
||||
"@0x/contracts-test-utils": "^3.1.10",
|
||||
"@0x/dev-utils": "^2.2.4",
|
||||
"@0x/sol-compiler": "^3.1.9",
|
||||
"@0x/abi-gen": "^4.1.0",
|
||||
"@0x/contracts-gen": "^1.0.13",
|
||||
"@0x/contracts-test-utils": "^3.1.13",
|
||||
"@0x/dev-utils": "^2.3.0",
|
||||
"@0x/sol-compiler": "^3.1.12",
|
||||
"@0x/tslint-config": "^3.0.1",
|
||||
"@types/lodash": "4.14.104",
|
||||
"@types/mocha": "^5.2.7",
|
||||
"@types/node": "*",
|
||||
"chai": "^4.0.1",
|
||||
"chai-as-promised": "^7.1.0",
|
||||
"chai-bignumber": "^3.0.0",
|
||||
"dirty-chai": "^2.0.1",
|
||||
"make-promises-safe": "^1.1.0",
|
||||
"mocha": "^4.1.0",
|
||||
"mocha": "^6.2.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
"shx": "^0.2.2",
|
||||
"solhint": "^1.4.1",
|
||||
@@ -68,19 +69,19 @@
|
||||
"typescript": "3.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@0x/base-contract": "^5.1.1",
|
||||
"@0x/contracts-asset-proxy": "^2.2.2",
|
||||
"@0x/contracts-erc1155": "^1.1.9",
|
||||
"@0x/contracts-erc20": "^2.2.8",
|
||||
"@0x/contracts-erc721": "^2.1.9",
|
||||
"@0x/contracts-exchange-libs": "^3.0.2",
|
||||
"@0x/contracts-utils": "^3.1.9",
|
||||
"@0x/order-utils": "^8.2.2",
|
||||
"@0x/types": "^2.4.0",
|
||||
"@0x/typescript-typings": "^4.2.3",
|
||||
"@0x/utils": "^4.4.0",
|
||||
"@0x/web3-wrapper": "^6.0.7",
|
||||
"ethereum-types": "^2.1.3",
|
||||
"@0x/base-contract": "^5.3.1",
|
||||
"@0x/contracts-asset-proxy": "^2.2.5",
|
||||
"@0x/contracts-erc1155": "^1.1.12",
|
||||
"@0x/contracts-erc20": "^2.2.11",
|
||||
"@0x/contracts-erc721": "^2.1.12",
|
||||
"@0x/contracts-exchange-libs": "^3.0.5",
|
||||
"@0x/contracts-utils": "^3.2.1",
|
||||
"@0x/order-utils": "^8.2.5",
|
||||
"@0x/types": "^2.4.1",
|
||||
"@0x/typescript-typings": "^4.2.4",
|
||||
"@0x/utils": "^4.5.0",
|
||||
"@0x/web3-wrapper": "^6.0.10",
|
||||
"ethereum-types": "^2.1.4",
|
||||
"ethereumjs-util": "^5.1.1",
|
||||
"lodash": "^4.17.11"
|
||||
},
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
artifacts as proxyArtifacts,
|
||||
ERC1155ProxyContract,
|
||||
ERC1155ProxyWrapper,
|
||||
ERC20ProxyContract,
|
||||
ERC20Wrapper,
|
||||
@@ -67,7 +68,7 @@ blockchainTests.resets('Exchange core', () => {
|
||||
let exchange: ExchangeContract;
|
||||
let erc20Proxy: ERC20ProxyContract;
|
||||
let erc721Proxy: ERC721ProxyContract;
|
||||
let erc1155Proxy: ERC721ProxyContract;
|
||||
let erc1155Proxy: ERC1155ProxyContract;
|
||||
let multiAssetProxy: MultiAssetProxyContract;
|
||||
let validatorWallet: TestValidatorWalletContract;
|
||||
let erc1155Contract: ERC1155MintableContract;
|
||||
@@ -111,11 +112,13 @@ blockchainTests.resets('Exchange core', () => {
|
||||
proxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
staticCallProxy = await StaticCallProxyContract.deployFrom0xArtifactAsync(
|
||||
proxyArtifacts.StaticCallProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
const numDummyErc20ToDeploy = 3;
|
||||
[erc20TokenA, erc20TokenB, feeToken] = await erc20Wrapper.deployDummyTokensAsync(
|
||||
@@ -126,12 +129,13 @@ blockchainTests.resets('Exchange core', () => {
|
||||
erc20Artifacts.DummyNoReturnERC20Token,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
constants.DUMMY_TOKEN_NAME,
|
||||
constants.DUMMY_TOKEN_SYMBOL,
|
||||
constants.DUMMY_TOKEN_DECIMALS,
|
||||
constants.DUMMY_TOKEN_TOTAL_SUPPLY,
|
||||
);
|
||||
erc20Wrapper.addDummyTokenContract(noReturnErc20Token);
|
||||
erc20Wrapper.addDummyTokenContract((noReturnErc20Token as any) as DummyERC20TokenContract);
|
||||
[erc721Token] = await erc721Wrapper.deployDummyTokensAsync();
|
||||
erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync();
|
||||
[erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync();
|
||||
@@ -140,12 +144,14 @@ blockchainTests.resets('Exchange core', () => {
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
validatorWallet = await TestValidatorWalletContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestValidatorWallet,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
exchange.address,
|
||||
);
|
||||
// Configure ERC20Proxy
|
||||
@@ -1067,6 +1073,7 @@ blockchainTests.resets('Exchange core', () => {
|
||||
proxyArtifacts.TestStaticCallTarget,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
});
|
||||
it('should revert if the staticcall is unsuccessful', async () => {
|
||||
|
@@ -29,6 +29,8 @@ import {
|
||||
TestAssetProxyDispatcherContract,
|
||||
} from '../src';
|
||||
|
||||
import { dependencyArtifacts } from './utils/dependency_artifacts';
|
||||
|
||||
chaiSetup.configure();
|
||||
const expect = chai.expect;
|
||||
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
|
||||
@@ -76,6 +78,7 @@ describe('AssetProxyDispatcher', () => {
|
||||
artifacts.TestAssetProxyDispatcher,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyDispatcher.address, {
|
||||
from: owner,
|
||||
@@ -126,6 +129,7 @@ describe('AssetProxyDispatcher', () => {
|
||||
proxyArtifacts.ERC20Proxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
dependencyArtifacts,
|
||||
);
|
||||
const expectedError = new ExchangeRevertErrors.AssetProxyExistsError(proxyAddress);
|
||||
const tx = assetProxyDispatcher.registerAssetProxy.sendTransactionAsync(newErc20TransferProxy.address, {
|
||||
|
@@ -32,6 +32,7 @@ blockchainTests('Exchange core internal functions', env => {
|
||||
artifacts.TestExchangeInternals,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
new BigNumber(CHAIN_ID),
|
||||
);
|
||||
logDecoder = new LogDecoder(env.web3Wrapper, artifacts);
|
||||
|
@@ -16,6 +16,7 @@ blockchainTests.resets('LibExchangeRichErrorDecoder', ({ provider, txDefaults })
|
||||
artifacts.TestLibExchangeRichErrorDecoder,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -117,7 +117,7 @@ describe('matchOrders', () => {
|
||||
await erc721Wrapper.setBalancesAndAllowancesAsync();
|
||||
// Deploy ERC1155 token and proxy
|
||||
[erc1155Wrapper] = await erc1155ProxyWrapper.deployDummyContractsAsync();
|
||||
erc1155Token = erc1155Wrapper.getContract();
|
||||
erc1155Token = (erc1155Wrapper.getContract() as any) as ERC1155TokenContract;
|
||||
erc1155Proxy = await erc1155ProxyWrapper.deployProxyAsync();
|
||||
await erc1155ProxyWrapper.setBalancesAndAllowancesAsync();
|
||||
// Deploy MultiAssetProxy.
|
||||
@@ -125,12 +125,14 @@ describe('matchOrders', () => {
|
||||
assetProxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
// Depoy exchange
|
||||
exchange = await ExchangeContract.deployFrom0xArtifactAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchange, provider);
|
||||
|
@@ -93,6 +93,7 @@ blockchainTests.resets('Reentrancy Tests', env => {
|
||||
artifacts.ReentrancyTester,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
);
|
||||
});
|
||||
|
||||
|
@@ -50,12 +50,14 @@ blockchainTests.resets('MixinSignatureValidator', env => {
|
||||
artifacts.TestSignatureValidator,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
validatorWallet = await TestValidatorWalletContract.deployFrom0xArtifactAsync(
|
||||
artifacts.TestValidatorWallet,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
signatureValidator.address,
|
||||
);
|
||||
validatorWalletRevertReason = await validatorWallet.REVERT_REASON.callAsync();
|
||||
|
@@ -103,6 +103,7 @@ blockchainTests.resets('Exchange transactions', env => {
|
||||
artifacts.Exchange,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchangeInstance, env.provider);
|
||||
@@ -976,6 +977,7 @@ blockchainTests.resets('Exchange transactions', env => {
|
||||
artifacts.ExchangeWrapper,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
exchangeInstance.address,
|
||||
);
|
||||
});
|
||||
@@ -1078,6 +1080,7 @@ blockchainTests.resets('Exchange transactions', env => {
|
||||
artifacts.Whitelist,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
exchangeInstance.address,
|
||||
);
|
||||
const isApproved = true;
|
||||
|
9
contracts/exchange/test/utils/dependency_artifacts.ts
Normal file
9
contracts/exchange/test/utils/dependency_artifacts.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import { artifacts as erc1155Artifacts } from '@0x/contracts-erc1155';
|
||||
import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
|
||||
import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
|
||||
|
||||
export const dependencyArtifacts = {
|
||||
...erc20Artifacts,
|
||||
...erc721Artifacts,
|
||||
...erc1155Artifacts,
|
||||
};
|
@@ -21,6 +21,7 @@ import { AbiDecodedFillOrderData } from './types';
|
||||
|
||||
export class ExchangeWrapper {
|
||||
private readonly _exchange: ExchangeContract;
|
||||
// tslint:disable no-unused-variable
|
||||
private readonly _web3Wrapper: Web3Wrapper;
|
||||
private readonly _logDecoder: LogDecoder;
|
||||
constructor(exchangeContract: ExchangeContract, provider: Web3ProviderEngine | ZeroExProvider) {
|
||||
@@ -39,20 +40,18 @@ export class ExchangeWrapper {
|
||||
opts: { takerAssetFillAmount?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const txHash = await this._exchange.fillOrder.sendTransactionAsync(
|
||||
const txReceipt = await this._exchange.fillOrder.awaitTransactionSuccessAsync(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
{ from },
|
||||
);
|
||||
const txReceipt = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return txReceipt;
|
||||
}
|
||||
public async cancelOrderAsync(signedOrder: SignedOrder, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createCancel(signedOrder);
|
||||
const txHash = await this._exchange.cancelOrder.sendTransactionAsync(params.order, { from });
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
const txReceipt = await this._exchange.cancelOrder.awaitTransactionSuccessAsync(params.order, { from });
|
||||
return txReceipt;
|
||||
}
|
||||
public async fillOrKillOrderAsync(
|
||||
signedOrder: SignedOrder,
|
||||
@@ -60,14 +59,13 @@ export class ExchangeWrapper {
|
||||
opts: { takerAssetFillAmount?: BigNumber } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const txHash = await this._exchange.fillOrKillOrder.sendTransactionAsync(
|
||||
const txReceipt = await this._exchange.fillOrKillOrder.awaitTransactionSuccessAsync(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
{ from },
|
||||
);
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
return txReceipt;
|
||||
}
|
||||
public async fillOrderNoThrowAsync(
|
||||
signedOrder: SignedOrder,
|
||||
@@ -75,14 +73,13 @@ export class ExchangeWrapper {
|
||||
opts: { takerAssetFillAmount?: BigNumber; gas?: number } = {},
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createFill(signedOrder, opts.takerAssetFillAmount);
|
||||
const txHash = await this._exchange.fillOrderNoThrow.sendTransactionAsync(
|
||||
const txReceipt = await this._exchange.fillOrderNoThrow.awaitTransactionSuccessAsync(
|
||||
params.order,
|
||||
params.takerAssetFillAmount,
|
||||
params.signature,
|
||||
{ from, gas: opts.gas },
|
||||
);
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
return txReceipt;
|
||||
}
|
||||
public async batchFillOrdersAsync(
|
||||
orders: SignedOrder[],
|
||||
@@ -169,17 +166,17 @@ export class ExchangeWrapper {
|
||||
return tx;
|
||||
}
|
||||
public async cancelOrdersUpToAsync(salt: BigNumber, from: string): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const txHash = await this._exchange.cancelOrdersUpTo.sendTransactionAsync(salt, { from });
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
const txReceipt = await this._exchange.cancelOrdersUpTo.awaitTransactionSuccessAsync(salt, { from });
|
||||
return txReceipt;
|
||||
}
|
||||
public async registerAssetProxyAsync(
|
||||
assetProxyAddress: string,
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const txHash = await this._exchange.registerAssetProxy.sendTransactionAsync(assetProxyAddress, { from });
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
const txReceipt = await this._exchange.registerAssetProxy.awaitTransactionSuccessAsync(assetProxyAddress, {
|
||||
from,
|
||||
});
|
||||
return txReceipt;
|
||||
}
|
||||
public async executeTransactionAsync(
|
||||
signedTransaction: SignedZeroExTransaction,
|
||||
@@ -324,15 +321,14 @@ export class ExchangeWrapper {
|
||||
from: string,
|
||||
): Promise<TransactionReceiptWithDecodedLogs> {
|
||||
const params = orderUtils.createMatchOrders(signedOrderLeft, signedOrderRight);
|
||||
const txHash = await this._exchange.matchOrders.sendTransactionAsync(
|
||||
const txReceipt = await this._exchange.matchOrders.awaitTransactionSuccessAsync(
|
||||
params.left,
|
||||
params.right,
|
||||
params.leftSignature,
|
||||
params.rightSignature,
|
||||
{ from },
|
||||
);
|
||||
const tx = await this._logDecoder.getTxWithDecodedLogsAsync(txHash);
|
||||
return tx;
|
||||
return txReceipt;
|
||||
}
|
||||
public async getMatchOrdersResultsAsync(
|
||||
signedOrderLeft: SignedOrder,
|
||||
|
@@ -102,6 +102,7 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
|
||||
assetProxyArtifacts.MultiAssetProxy,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
|
||||
const assetWrapper = new AssetWrapper([erc20Wrapper, erc721Wrapper, erc1155Wrapper], burnerAddress);
|
||||
@@ -110,6 +111,7 @@ export async function fillOrderCombinatorialUtilsFactoryAsync(
|
||||
artifacts.Exchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
const exchangeWrapper = new ExchangeWrapper(exchangeContract, provider);
|
||||
|
@@ -53,6 +53,7 @@ export class IsolatedExchangeWrapper {
|
||||
artifacts.IsolatedExchange,
|
||||
provider,
|
||||
txDefaults,
|
||||
{},
|
||||
);
|
||||
return new IsolatedExchangeWrapper(web3Wrapper, instance);
|
||||
}
|
||||
|
@@ -82,6 +82,7 @@ blockchainTests.resets('Exchange wrappers', env => {
|
||||
artifacts.Exchange,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
new BigNumber(chainId),
|
||||
);
|
||||
exchangeWrapper = new ExchangeWrapper(exchange, env.provider);
|
||||
|
@@ -43,6 +43,7 @@ blockchainTests('Exchange wrapper functions unit tests.', env => {
|
||||
artifacts.TestWrapperFunctions,
|
||||
env.provider,
|
||||
env.txDefaults,
|
||||
{},
|
||||
);
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user