aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/exchange-forwarder
diff options
context:
space:
mode:
Diffstat (limited to 'contracts/exchange-forwarder')
-rw-r--r--contracts/exchange-forwarder/compiler.json13
-rw-r--r--contracts/exchange-forwarder/package.json7
-rw-r--r--contracts/exchange-forwarder/src/artifacts.ts19
-rw-r--r--contracts/exchange-forwarder/src/artifacts/index.ts7
-rw-r--r--contracts/exchange-forwarder/src/wrappers.ts10
-rw-r--r--contracts/exchange-forwarder/src/wrappers/index.ts1
-rw-r--r--contracts/exchange-forwarder/test/forwarder.ts20
-rw-r--r--contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts10
-rw-r--r--contracts/exchange-forwarder/tsconfig.json14
9 files changed, 64 insertions, 37 deletions
diff --git a/contracts/exchange-forwarder/compiler.json b/contracts/exchange-forwarder/compiler.json
index e93eb4bdd..051e81de5 100644
--- a/contracts/exchange-forwarder/compiler.json
+++ b/contracts/exchange-forwarder/compiler.json
@@ -3,10 +3,7 @@
"contractsDir": "./contracts",
"useDockerisedSolc": true,
"compilerSettings": {
- "optimizer": {
- "enabled": true,
- "runs": 1000000
- },
+ "optimizer": { "enabled": true, "runs": 1000000 },
"outputSelection": {
"*": {
"*": [
@@ -19,5 +16,11 @@
}
}
},
- "contracts": ["Forwarder"]
+ "contracts": [
+ "@0x/contracts-erc20/contracts/src/WETH9.sol",
+ "@0x/contracts-erc20/contracts/test/DummyERC20Token.sol",
+ "@0x/contracts-erc721/contracts/test/DummyERC721Token.sol",
+ "@0x/contracts-exchange/contracts/src/Exchange.sol",
+ "src/Forwarder.sol"
+ ]
}
diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json
index 015e48460..e71409c82 100644
--- a/contracts/exchange-forwarder/package.json
+++ b/contracts/exchange-forwarder/package.json
@@ -29,10 +29,12 @@
"profiler:report:html": "istanbul report html && open coverage/index.html",
"coverage:report:lcov": "istanbul report lcov",
"test:circleci": "yarn test",
+ "contracts:gen": "contracts-gen",
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
},
"config": {
- "abis": "generated-artifacts/@(Forwarder).json"
+ "abis": "./generated-artifacts/@(DummyERC20Token|DummyERC721Token|Exchange|Forwarder|WETH9).json",
+ "abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
},
"repository": {
"type": "git",
@@ -44,6 +46,7 @@
},
"homepage": "https://github.com/0xProject/0x-monorepo/contracts/extensions/README.md",
"devDependencies": {
+ "@0x/contracts-gen": "^1.0.0",
"@0x/abi-gen": "^2.0.1",
"@0x/contract-wrappers": "^7.0.1",
"@0x/contracts-test-utils": "^3.0.2",
@@ -78,7 +81,7 @@
"@0x/utils": "^4.0.2",
"@0x/web3-wrapper": "^4.0.1",
"ethereum-types": "^2.0.0",
- "lodash": "^4.17.5"
+ "lodash": "^4.17.11"
},
"publishConfig": {
"access": "public"
diff --git a/contracts/exchange-forwarder/src/artifacts.ts b/contracts/exchange-forwarder/src/artifacts.ts
new file mode 100644
index 000000000..94bcdf84a
--- /dev/null
+++ b/contracts/exchange-forwarder/src/artifacts.ts
@@ -0,0 +1,19 @@
+/*
+ * -----------------------------------------------------------------------------
+ * Warning: This file is auto-generated by contracts-gen. Don't edit manually.
+ * -----------------------------------------------------------------------------
+ */
+import { ContractArtifact } from 'ethereum-types';
+
+import * as DummyERC20Token from '../generated-artifacts/DummyERC20Token.json';
+import * as DummyERC721Token from '../generated-artifacts/DummyERC721Token.json';
+import * as Exchange from '../generated-artifacts/Exchange.json';
+import * as Forwarder from '../generated-artifacts/Forwarder.json';
+import * as WETH9 from '../generated-artifacts/WETH9.json';
+export const artifacts = {
+ WETH9: WETH9 as ContractArtifact,
+ DummyERC20Token: DummyERC20Token as ContractArtifact,
+ DummyERC721Token: DummyERC721Token as ContractArtifact,
+ Exchange: Exchange as ContractArtifact,
+ Forwarder: Forwarder as ContractArtifact,
+};
diff --git a/contracts/exchange-forwarder/src/artifacts/index.ts b/contracts/exchange-forwarder/src/artifacts/index.ts
deleted file mode 100644
index f15dac49a..000000000
--- a/contracts/exchange-forwarder/src/artifacts/index.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import { ContractArtifact } from 'ethereum-types';
-
-import * as Forwarder from '../../generated-artifacts/Forwarder.json';
-
-export const artifacts = {
- Forwarder: Forwarder as ContractArtifact,
-};
diff --git a/contracts/exchange-forwarder/src/wrappers.ts b/contracts/exchange-forwarder/src/wrappers.ts
new file mode 100644
index 000000000..cbe72c5cf
--- /dev/null
+++ b/contracts/exchange-forwarder/src/wrappers.ts
@@ -0,0 +1,10 @@
+/*
+ * -----------------------------------------------------------------------------
+ * Warning: This file is auto-generated by contracts-gen. Don't edit manually.
+ * -----------------------------------------------------------------------------
+ */
+export * from '../generated-wrappers/dummy_erc20_token';
+export * from '../generated-wrappers/dummy_erc721_token';
+export * from '../generated-wrappers/exchange';
+export * from '../generated-wrappers/forwarder';
+export * from '../generated-wrappers/weth9';
diff --git a/contracts/exchange-forwarder/src/wrappers/index.ts b/contracts/exchange-forwarder/src/wrappers/index.ts
deleted file mode 100644
index 89dff9e74..000000000
--- a/contracts/exchange-forwarder/src/wrappers/index.ts
+++ /dev/null
@@ -1 +0,0 @@
-export * from '../../generated-wrappers/forwarder';
diff --git a/contracts/exchange-forwarder/test/forwarder.ts b/contracts/exchange-forwarder/test/forwarder.ts
index 24c219563..5acf113dd 100644
--- a/contracts/exchange-forwarder/test/forwarder.ts
+++ b/contracts/exchange-forwarder/test/forwarder.ts
@@ -1,7 +1,5 @@
import { ERC20Wrapper, ERC721Wrapper } from '@0x/contracts-asset-proxy';
-import { artifacts as erc20Artifacts, DummyERC20TokenContract, WETH9Contract } from '@0x/contracts-erc20';
-import { DummyERC721TokenContract } from '@0x/contracts-erc721';
-import { artifacts as exchangeArtifacts, ExchangeContract, ExchangeWrapper } from '@0x/contracts-exchange';
+import { ExchangeWrapper } from '@0x/contracts-exchange';
import {
chaiSetup,
constants,
@@ -23,7 +21,15 @@ import { Web3Wrapper } from '@0x/web3-wrapper';
import * as chai from 'chai';
import { TransactionReceiptWithDecodedLogs } from 'ethereum-types';
-import { artifacts, ForwarderContract, ForwarderWrapper } from '../src';
+import {
+ artifacts,
+ DummyERC20TokenContract,
+ DummyERC721TokenContract,
+ ExchangeContract,
+ ForwarderContract,
+ ForwarderWrapper,
+ WETH9Contract,
+} from '../src';
chaiSetup.configure();
const expect = chai.expect;
@@ -88,14 +94,14 @@ describe(ContractName.Forwarder, () => {
const erc721Balances = await erc721Wrapper.getBalancesAsync();
erc721MakerAssetIds = erc721Balances[makerAddress][erc721Token.address];
- wethContract = await WETH9Contract.deployFrom0xArtifactAsync(erc20Artifacts.WETH9, provider, txDefaults);
+ wethContract = await WETH9Contract.deployFrom0xArtifactAsync(artifacts.WETH9, provider, txDefaults);
weth = new DummyERC20TokenContract(wethContract.abi, wethContract.address, provider);
erc20Wrapper.addDummyTokenContract(weth);
wethAssetData = assetDataUtils.encodeERC20AssetData(wethContract.address);
zrxAssetData = assetDataUtils.encodeERC20AssetData(zrxToken.address);
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- exchangeArtifacts.Exchange,
+ artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
@@ -166,7 +172,7 @@ describe(ContractName.Forwarder, () => {
describe('constructor', () => {
it('should revert if assetProxy is unregistered', async () => {
const exchangeInstance = await ExchangeContract.deployFrom0xArtifactAsync(
- exchangeArtifacts.Exchange,
+ artifacts.Exchange,
provider,
txDefaults,
zrxAssetData,
diff --git a/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts b/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts
index 207106852..4f9f6110a 100644
--- a/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts
+++ b/contracts/exchange-forwarder/test/utils/forwarder_wrapper.ts
@@ -1,6 +1,3 @@
-import { artifacts as erc20Artifacts } from '@0x/contracts-erc20';
-import { artifacts as erc721Artifacts } from '@0x/contracts-erc721';
-import { artifacts as exchangeArtifacts } from '@0x/contracts-exchange';
import { constants, formatters, LogDecoder, MarketSellOrders } from '@0x/contracts-test-utils';
import { SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
@@ -61,12 +58,7 @@ export class ForwarderWrapper {
constructor(contractInstance: ForwarderContract, provider: Provider) {
this._forwarderContract = contractInstance;
this._web3Wrapper = new Web3Wrapper(provider);
- this._logDecoder = new LogDecoder(this._web3Wrapper, {
- ...artifacts,
- ...erc20Artifacts,
- ...erc721Artifacts,
- ...exchangeArtifacts,
- });
+ this._logDecoder = new LogDecoder(this._web3Wrapper, artifacts);
}
public async marketSellOrdersWithEthAsync(
orders: SignedOrder[],
diff --git a/contracts/exchange-forwarder/tsconfig.json b/contracts/exchange-forwarder/tsconfig.json
index cd80b5a5f..92c3a0475 100644
--- a/contracts/exchange-forwarder/tsconfig.json
+++ b/contracts/exchange-forwarder/tsconfig.json
@@ -1,11 +1,13 @@
{
"extends": "../../tsconfig",
- "compilerOptions": {
- "outDir": "lib",
- "rootDir": ".",
- "resolveJsonModule": true
- },
+ "compilerOptions": { "outDir": "lib", "rootDir": ".", "resolveJsonModule": true },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
- "files": ["./generated-artifacts/Forwarder.json"],
+ "files": [
+ "generated-artifacts/DummyERC20Token.json",
+ "generated-artifacts/DummyERC721Token.json",
+ "generated-artifacts/Exchange.json",
+ "generated-artifacts/Forwarder.json",
+ "generated-artifacts/WETH9.json"
+ ],
"exclude": ["./deploy/solc/solc_bin"]
}