From 6943bbcacbd9a1df0cdddb2696a768aec4b3d2c4 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 4 Feb 2019 10:12:49 +0100 Subject: Temp --- contracts/exchange-forwarder/compiler.json | 13 ++++++++----- contracts/exchange-forwarder/package.json | 5 ++++- contracts/exchange-forwarder/src/artifacts.ts | 15 +++++++++++++++ contracts/exchange-forwarder/src/artifacts/index.ts | 7 ------- contracts/exchange-forwarder/src/wrappers.ts | 6 ++++++ contracts/exchange-forwarder/src/wrappers/index.ts | 1 - contracts/exchange-forwarder/test/forwarder.ts | 20 +++++++++++++------- .../test/utils/forwarder_wrapper.ts | 10 +--------- contracts/exchange-forwarder/tsconfig.json | 14 ++++++++------ 9 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 contracts/exchange-forwarder/src/artifacts.ts delete mode 100644 contracts/exchange-forwarder/src/artifacts/index.ts create mode 100644 contracts/exchange-forwarder/src/wrappers.ts delete mode 100644 contracts/exchange-forwarder/src/wrappers/index.ts (limited to 'contracts/exchange-forwarder') 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 73a30e851..388980177 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", @@ -50,6 +52,7 @@ "@0x/dev-utils": "^1.0.24", "@0x/sol-compiler": "^2.0.2", "@0x/tslint-config": "^2.0.2", + "@0x/contracts-gen": "^1.0.0", "@types/lodash": "4.14.104", "@types/node": "*", "chai": "^4.0.1", diff --git a/contracts/exchange-forwarder/src/artifacts.ts b/contracts/exchange-forwarder/src/artifacts.ts new file mode 100644 index 000000000..39295b797 --- /dev/null +++ b/contracts/exchange-forwarder/src/artifacts.ts @@ -0,0 +1,15 @@ +// 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..a023f878c --- /dev/null +++ b/contracts/exchange-forwarder/src/wrappers.ts @@ -0,0 +1,6 @@ +// 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"] } -- cgit v1.2.3 From 1a88eac9c7e8f30f5d1f57132a48e59abd912d41 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 4 Feb 2019 13:00:15 +0100 Subject: Make the banner more visible --- contracts/exchange-forwarder/src/artifacts.ts | 6 +++++- contracts/exchange-forwarder/src/wrappers.ts | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'contracts/exchange-forwarder') diff --git a/contracts/exchange-forwarder/src/artifacts.ts b/contracts/exchange-forwarder/src/artifacts.ts index 39295b797..94bcdf84a 100644 --- a/contracts/exchange-forwarder/src/artifacts.ts +++ b/contracts/exchange-forwarder/src/artifacts.ts @@ -1,4 +1,8 @@ -// This file is auto-generated by contracts-gen. Don't edit manually. +/* + * ----------------------------------------------------------------------------- + * 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'; diff --git a/contracts/exchange-forwarder/src/wrappers.ts b/contracts/exchange-forwarder/src/wrappers.ts index a023f878c..cbe72c5cf 100644 --- a/contracts/exchange-forwarder/src/wrappers.ts +++ b/contracts/exchange-forwarder/src/wrappers.ts @@ -1,4 +1,8 @@ -// This file is auto-generated by contracts-gen. Don't edit manually. +/* + * ----------------------------------------------------------------------------- + * 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'; -- cgit v1.2.3 From 88432a5e673e0b98aa45145394e6b6fe1bedf20d Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Thu, 7 Feb 2019 11:49:59 +0100 Subject: Fix deps versions --- contracts/exchange-forwarder/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'contracts/exchange-forwarder') diff --git a/contracts/exchange-forwarder/package.json b/contracts/exchange-forwarder/package.json index 511d749f7..1ed3bee3a 100644 --- a/contracts/exchange-forwarder/package.json +++ b/contracts/exchange-forwarder/package.json @@ -81,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" -- cgit v1.2.3