First pass contracts-* separation of test and publish artifacts/wrappers
This commit is contained in:
parent
4767882ed3
commit
9e6ab9f585
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"artifactsDir": "./generated-artifacts",
|
"artifactsDir": "./test/generated-artifacts",
|
||||||
"contractsDir": "./contracts",
|
"contractsDir": "./contracts",
|
||||||
"useDockerisedSolc": false,
|
"useDockerisedSolc": false,
|
||||||
"isOfflineMode": false,
|
"isOfflineMode": false,
|
||||||
|
@ -19,12 +19,16 @@
|
|||||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||||
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
"run_mocha": "mocha --require source-map-support/register --require make-promises-safe 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||||
"compile": "sol-compiler",
|
"compile": "run-s compile:test compile:src",
|
||||||
|
"compile:test": "sol-compiler",
|
||||||
|
"compile:src": "sol-compiler --artifacts-dir generated-artifacts --contracts ${npm_package_config_whitelistedContracts}",
|
||||||
"watch": "sol-compiler -w",
|
"watch": "sol-compiler -w",
|
||||||
"clean": "shx rm -rf lib generated-artifacts generated-wrappers",
|
"clean": "shx rm -rf lib test/generated-artifacts test/generated-wrappers generated-artifacts generated-wrappers",
|
||||||
"generate_contract_wrappers": "abi-gen --debug --abis ${npm_package_config_abis} --output generated-wrappers --backend ethers",
|
"generate_contract_wrappers": "run-s generate_contract_wrappers:test generate_contract_wrappers:src",
|
||||||
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
"generate_contract_wrappers:test": "abi-gen --debug --abis ${npm_package_config_test_abis} --output test/generated-wrappers --backend ethers",
|
||||||
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
"generate_contract_wrappers:src": "abi-gen --debug --abis ${npm_package_config_src_abis} --output generated-wrappers --backend ethers",
|
||||||
|
"lint": "tslint --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./test/generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||||
|
"fix": "tslint --fix --format stylish --project . --exclude ./generated-wrappers/**/* --exclude ./generated-artifacts/**/* --exclude ./test/generated-wrappers/**/* --exclude ./test/generated-artifacts/**/* --exclude **/lib/**/* && yarn lint-contracts",
|
||||||
"coverage:report:text": "istanbul report text",
|
"coverage:report:text": "istanbul report text",
|
||||||
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
"coverage:report:html": "istanbul report html && open coverage/index.html",
|
||||||
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
"profiler:report:html": "istanbul report html && open coverage/index.html",
|
||||||
@ -35,8 +39,11 @@
|
|||||||
"compile:truffle": "truffle compile"
|
"compile:truffle": "truffle compile"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"abis": "./generated-artifacts/@(Exchange|IAssetProxy|IAssetProxyDispatcher|IEIP1271Data|IEIP1271Wallet|IExchange|IExchangeCore|IMatchOrders|IProtocolFees|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinProtocolFees|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrancyTester|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestProtocolFeeCollector|TestProtocolFees|TestProtocolFeesReceiver|TestSignatureValidator|TestTransactions|TestValidatorWallet|TestWrapperFunctions).json",
|
"whitelistedContracts": "Exchange,IExchange",
|
||||||
"abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually."
|
"test-abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
|
"test-abis": "./test/generated-artifacts/@(Exchange|IAssetProxy|IAssetProxyDispatcher|IEIP1271Data|IEIP1271Wallet|IExchange|IExchangeCore|IMatchOrders|IProtocolFees|ISignatureValidator|ITransactions|ITransferSimulator|IWallet|IWrapperFunctions|IsolatedExchange|LibExchangeRichErrorDecoder|MixinAssetProxyDispatcher|MixinExchangeCore|MixinMatchOrders|MixinProtocolFees|MixinSignatureValidator|MixinTransactions|MixinTransferSimulator|MixinWrapperFunctions|ReentrancyTester|TestAssetProxyDispatcher|TestExchangeInternals|TestLibExchangeRichErrorDecoder|TestProtocolFeeCollector|TestProtocolFees|TestProtocolFeesReceiver|TestSignatureValidator|TestTransactions|TestValidatorWallet|TestWrapperFunctions).json",
|
||||||
|
"src-abis:comment": "This list is auto-generated by contracts-gen. Don't edit manually.",
|
||||||
|
"src-abis": "./generated-artifacts/@(Exchange|IExchange).json"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -6,74 +6,5 @@
|
|||||||
import { ContractArtifact } from 'ethereum-types';
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
import * as Exchange from '../generated-artifacts/Exchange.json';
|
import * as Exchange from '../generated-artifacts/Exchange.json';
|
||||||
import * as IAssetProxy from '../generated-artifacts/IAssetProxy.json';
|
|
||||||
import * as IAssetProxyDispatcher from '../generated-artifacts/IAssetProxyDispatcher.json';
|
|
||||||
import * as IEIP1271Data from '../generated-artifacts/IEIP1271Data.json';
|
|
||||||
import * as IEIP1271Wallet from '../generated-artifacts/IEIP1271Wallet.json';
|
|
||||||
import * as IExchange from '../generated-artifacts/IExchange.json';
|
import * as IExchange from '../generated-artifacts/IExchange.json';
|
||||||
import * as IExchangeCore from '../generated-artifacts/IExchangeCore.json';
|
export const artifacts = { Exchange: Exchange as ContractArtifact, IExchange: IExchange as ContractArtifact };
|
||||||
import * as IMatchOrders from '../generated-artifacts/IMatchOrders.json';
|
|
||||||
import * as IProtocolFees from '../generated-artifacts/IProtocolFees.json';
|
|
||||||
import * as ISignatureValidator from '../generated-artifacts/ISignatureValidator.json';
|
|
||||||
import * as IsolatedExchange from '../generated-artifacts/IsolatedExchange.json';
|
|
||||||
import * as ITransactions from '../generated-artifacts/ITransactions.json';
|
|
||||||
import * as ITransferSimulator from '../generated-artifacts/ITransferSimulator.json';
|
|
||||||
import * as IWallet from '../generated-artifacts/IWallet.json';
|
|
||||||
import * as IWrapperFunctions from '../generated-artifacts/IWrapperFunctions.json';
|
|
||||||
import * as LibExchangeRichErrorDecoder from '../generated-artifacts/LibExchangeRichErrorDecoder.json';
|
|
||||||
import * as MixinAssetProxyDispatcher from '../generated-artifacts/MixinAssetProxyDispatcher.json';
|
|
||||||
import * as MixinExchangeCore from '../generated-artifacts/MixinExchangeCore.json';
|
|
||||||
import * as MixinMatchOrders from '../generated-artifacts/MixinMatchOrders.json';
|
|
||||||
import * as MixinProtocolFees from '../generated-artifacts/MixinProtocolFees.json';
|
|
||||||
import * as MixinSignatureValidator from '../generated-artifacts/MixinSignatureValidator.json';
|
|
||||||
import * as MixinTransactions from '../generated-artifacts/MixinTransactions.json';
|
|
||||||
import * as MixinTransferSimulator from '../generated-artifacts/MixinTransferSimulator.json';
|
|
||||||
import * as MixinWrapperFunctions from '../generated-artifacts/MixinWrapperFunctions.json';
|
|
||||||
import * as ReentrancyTester from '../generated-artifacts/ReentrancyTester.json';
|
|
||||||
import * as TestAssetProxyDispatcher from '../generated-artifacts/TestAssetProxyDispatcher.json';
|
|
||||||
import * as TestExchangeInternals from '../generated-artifacts/TestExchangeInternals.json';
|
|
||||||
import * as TestLibExchangeRichErrorDecoder from '../generated-artifacts/TestLibExchangeRichErrorDecoder.json';
|
|
||||||
import * as TestProtocolFeeCollector from '../generated-artifacts/TestProtocolFeeCollector.json';
|
|
||||||
import * as TestProtocolFees from '../generated-artifacts/TestProtocolFees.json';
|
|
||||||
import * as TestProtocolFeesReceiver from '../generated-artifacts/TestProtocolFeesReceiver.json';
|
|
||||||
import * as TestSignatureValidator from '../generated-artifacts/TestSignatureValidator.json';
|
|
||||||
import * as TestTransactions from '../generated-artifacts/TestTransactions.json';
|
|
||||||
import * as TestValidatorWallet from '../generated-artifacts/TestValidatorWallet.json';
|
|
||||||
import * as TestWrapperFunctions from '../generated-artifacts/TestWrapperFunctions.json';
|
|
||||||
export const artifacts = {
|
|
||||||
Exchange: Exchange as ContractArtifact,
|
|
||||||
MixinAssetProxyDispatcher: MixinAssetProxyDispatcher as ContractArtifact,
|
|
||||||
MixinExchangeCore: MixinExchangeCore as ContractArtifact,
|
|
||||||
MixinMatchOrders: MixinMatchOrders as ContractArtifact,
|
|
||||||
MixinProtocolFees: MixinProtocolFees as ContractArtifact,
|
|
||||||
MixinSignatureValidator: MixinSignatureValidator as ContractArtifact,
|
|
||||||
MixinTransactions: MixinTransactions as ContractArtifact,
|
|
||||||
MixinTransferSimulator: MixinTransferSimulator as ContractArtifact,
|
|
||||||
MixinWrapperFunctions: MixinWrapperFunctions as ContractArtifact,
|
|
||||||
IAssetProxy: IAssetProxy as ContractArtifact,
|
|
||||||
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
|
|
||||||
IEIP1271Data: IEIP1271Data as ContractArtifact,
|
|
||||||
IEIP1271Wallet: IEIP1271Wallet as ContractArtifact,
|
|
||||||
IExchange: IExchange as ContractArtifact,
|
|
||||||
IExchangeCore: IExchangeCore as ContractArtifact,
|
|
||||||
IMatchOrders: IMatchOrders as ContractArtifact,
|
|
||||||
IProtocolFees: IProtocolFees as ContractArtifact,
|
|
||||||
ISignatureValidator: ISignatureValidator as ContractArtifact,
|
|
||||||
ITransactions: ITransactions as ContractArtifact,
|
|
||||||
ITransferSimulator: ITransferSimulator as ContractArtifact,
|
|
||||||
IWallet: IWallet as ContractArtifact,
|
|
||||||
IWrapperFunctions: IWrapperFunctions as ContractArtifact,
|
|
||||||
LibExchangeRichErrorDecoder: LibExchangeRichErrorDecoder as ContractArtifact,
|
|
||||||
IsolatedExchange: IsolatedExchange as ContractArtifact,
|
|
||||||
ReentrancyTester: ReentrancyTester as ContractArtifact,
|
|
||||||
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
|
|
||||||
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
|
|
||||||
TestLibExchangeRichErrorDecoder: TestLibExchangeRichErrorDecoder as ContractArtifact,
|
|
||||||
TestProtocolFeeCollector: TestProtocolFeeCollector as ContractArtifact,
|
|
||||||
TestProtocolFees: TestProtocolFees as ContractArtifact,
|
|
||||||
TestProtocolFeesReceiver: TestProtocolFeesReceiver as ContractArtifact,
|
|
||||||
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
|
|
||||||
TestTransactions: TestTransactions as ContractArtifact,
|
|
||||||
TestValidatorWallet: TestValidatorWallet as ContractArtifact,
|
|
||||||
TestWrapperFunctions: TestWrapperFunctions as ContractArtifact,
|
|
||||||
};
|
|
||||||
|
@ -4,37 +4,4 @@
|
|||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
export * from '../generated-wrappers/exchange';
|
export * from '../generated-wrappers/exchange';
|
||||||
export * from '../generated-wrappers/i_asset_proxy';
|
|
||||||
export * from '../generated-wrappers/i_asset_proxy_dispatcher';
|
|
||||||
export * from '../generated-wrappers/i_e_i_p1271_data';
|
|
||||||
export * from '../generated-wrappers/i_e_i_p1271_wallet';
|
|
||||||
export * from '../generated-wrappers/i_exchange';
|
export * from '../generated-wrappers/i_exchange';
|
||||||
export * from '../generated-wrappers/i_exchange_core';
|
|
||||||
export * from '../generated-wrappers/i_match_orders';
|
|
||||||
export * from '../generated-wrappers/i_protocol_fees';
|
|
||||||
export * from '../generated-wrappers/i_signature_validator';
|
|
||||||
export * from '../generated-wrappers/i_transactions';
|
|
||||||
export * from '../generated-wrappers/i_transfer_simulator';
|
|
||||||
export * from '../generated-wrappers/i_wallet';
|
|
||||||
export * from '../generated-wrappers/i_wrapper_functions';
|
|
||||||
export * from '../generated-wrappers/isolated_exchange';
|
|
||||||
export * from '../generated-wrappers/lib_exchange_rich_error_decoder';
|
|
||||||
export * from '../generated-wrappers/mixin_asset_proxy_dispatcher';
|
|
||||||
export * from '../generated-wrappers/mixin_exchange_core';
|
|
||||||
export * from '../generated-wrappers/mixin_match_orders';
|
|
||||||
export * from '../generated-wrappers/mixin_protocol_fees';
|
|
||||||
export * from '../generated-wrappers/mixin_signature_validator';
|
|
||||||
export * from '../generated-wrappers/mixin_transactions';
|
|
||||||
export * from '../generated-wrappers/mixin_transfer_simulator';
|
|
||||||
export * from '../generated-wrappers/mixin_wrapper_functions';
|
|
||||||
export * from '../generated-wrappers/reentrancy_tester';
|
|
||||||
export * from '../generated-wrappers/test_asset_proxy_dispatcher';
|
|
||||||
export * from '../generated-wrappers/test_exchange_internals';
|
|
||||||
export * from '../generated-wrappers/test_lib_exchange_rich_error_decoder';
|
|
||||||
export * from '../generated-wrappers/test_protocol_fee_collector';
|
|
||||||
export * from '../generated-wrappers/test_protocol_fees';
|
|
||||||
export * from '../generated-wrappers/test_protocol_fees_receiver';
|
|
||||||
export * from '../generated-wrappers/test_signature_validator';
|
|
||||||
export * from '../generated-wrappers/test_transactions';
|
|
||||||
export * from '../generated-wrappers/test_validator_wallet';
|
|
||||||
export * from '../generated-wrappers/test_wrapper_functions';
|
|
||||||
|
79
contracts/exchange/test/artifacts.ts
Normal file
79
contracts/exchange/test/artifacts.ts
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
/*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
import { ContractArtifact } from 'ethereum-types';
|
||||||
|
|
||||||
|
import * as Exchange from '../test/generated-artifacts/Exchange.json';
|
||||||
|
import * as IAssetProxy from '../test/generated-artifacts/IAssetProxy.json';
|
||||||
|
import * as IAssetProxyDispatcher from '../test/generated-artifacts/IAssetProxyDispatcher.json';
|
||||||
|
import * as IEIP1271Data from '../test/generated-artifacts/IEIP1271Data.json';
|
||||||
|
import * as IEIP1271Wallet from '../test/generated-artifacts/IEIP1271Wallet.json';
|
||||||
|
import * as IExchange from '../test/generated-artifacts/IExchange.json';
|
||||||
|
import * as IExchangeCore from '../test/generated-artifacts/IExchangeCore.json';
|
||||||
|
import * as IMatchOrders from '../test/generated-artifacts/IMatchOrders.json';
|
||||||
|
import * as IProtocolFees from '../test/generated-artifacts/IProtocolFees.json';
|
||||||
|
import * as ISignatureValidator from '../test/generated-artifacts/ISignatureValidator.json';
|
||||||
|
import * as IsolatedExchange from '../test/generated-artifacts/IsolatedExchange.json';
|
||||||
|
import * as ITransactions from '../test/generated-artifacts/ITransactions.json';
|
||||||
|
import * as ITransferSimulator from '../test/generated-artifacts/ITransferSimulator.json';
|
||||||
|
import * as IWallet from '../test/generated-artifacts/IWallet.json';
|
||||||
|
import * as IWrapperFunctions from '../test/generated-artifacts/IWrapperFunctions.json';
|
||||||
|
import * as LibExchangeRichErrorDecoder from '../test/generated-artifacts/LibExchangeRichErrorDecoder.json';
|
||||||
|
import * as MixinAssetProxyDispatcher from '../test/generated-artifacts/MixinAssetProxyDispatcher.json';
|
||||||
|
import * as MixinExchangeCore from '../test/generated-artifacts/MixinExchangeCore.json';
|
||||||
|
import * as MixinMatchOrders from '../test/generated-artifacts/MixinMatchOrders.json';
|
||||||
|
import * as MixinProtocolFees from '../test/generated-artifacts/MixinProtocolFees.json';
|
||||||
|
import * as MixinSignatureValidator from '../test/generated-artifacts/MixinSignatureValidator.json';
|
||||||
|
import * as MixinTransactions from '../test/generated-artifacts/MixinTransactions.json';
|
||||||
|
import * as MixinTransferSimulator from '../test/generated-artifacts/MixinTransferSimulator.json';
|
||||||
|
import * as MixinWrapperFunctions from '../test/generated-artifacts/MixinWrapperFunctions.json';
|
||||||
|
import * as ReentrancyTester from '../test/generated-artifacts/ReentrancyTester.json';
|
||||||
|
import * as TestAssetProxyDispatcher from '../test/generated-artifacts/TestAssetProxyDispatcher.json';
|
||||||
|
import * as TestExchangeInternals from '../test/generated-artifacts/TestExchangeInternals.json';
|
||||||
|
import * as TestLibExchangeRichErrorDecoder from '../test/generated-artifacts/TestLibExchangeRichErrorDecoder.json';
|
||||||
|
import * as TestProtocolFeeCollector from '../test/generated-artifacts/TestProtocolFeeCollector.json';
|
||||||
|
import * as TestProtocolFees from '../test/generated-artifacts/TestProtocolFees.json';
|
||||||
|
import * as TestProtocolFeesReceiver from '../test/generated-artifacts/TestProtocolFeesReceiver.json';
|
||||||
|
import * as TestSignatureValidator from '../test/generated-artifacts/TestSignatureValidator.json';
|
||||||
|
import * as TestTransactions from '../test/generated-artifacts/TestTransactions.json';
|
||||||
|
import * as TestValidatorWallet from '../test/generated-artifacts/TestValidatorWallet.json';
|
||||||
|
import * as TestWrapperFunctions from '../test/generated-artifacts/TestWrapperFunctions.json';
|
||||||
|
export const artifacts = {
|
||||||
|
Exchange: Exchange as ContractArtifact,
|
||||||
|
MixinAssetProxyDispatcher: MixinAssetProxyDispatcher as ContractArtifact,
|
||||||
|
MixinExchangeCore: MixinExchangeCore as ContractArtifact,
|
||||||
|
MixinMatchOrders: MixinMatchOrders as ContractArtifact,
|
||||||
|
MixinProtocolFees: MixinProtocolFees as ContractArtifact,
|
||||||
|
MixinSignatureValidator: MixinSignatureValidator as ContractArtifact,
|
||||||
|
MixinTransactions: MixinTransactions as ContractArtifact,
|
||||||
|
MixinTransferSimulator: MixinTransferSimulator as ContractArtifact,
|
||||||
|
MixinWrapperFunctions: MixinWrapperFunctions as ContractArtifact,
|
||||||
|
IAssetProxy: IAssetProxy as ContractArtifact,
|
||||||
|
IAssetProxyDispatcher: IAssetProxyDispatcher as ContractArtifact,
|
||||||
|
IEIP1271Data: IEIP1271Data as ContractArtifact,
|
||||||
|
IEIP1271Wallet: IEIP1271Wallet as ContractArtifact,
|
||||||
|
IExchange: IExchange as ContractArtifact,
|
||||||
|
IExchangeCore: IExchangeCore as ContractArtifact,
|
||||||
|
IMatchOrders: IMatchOrders as ContractArtifact,
|
||||||
|
IProtocolFees: IProtocolFees as ContractArtifact,
|
||||||
|
ISignatureValidator: ISignatureValidator as ContractArtifact,
|
||||||
|
ITransactions: ITransactions as ContractArtifact,
|
||||||
|
ITransferSimulator: ITransferSimulator as ContractArtifact,
|
||||||
|
IWallet: IWallet as ContractArtifact,
|
||||||
|
IWrapperFunctions: IWrapperFunctions as ContractArtifact,
|
||||||
|
LibExchangeRichErrorDecoder: LibExchangeRichErrorDecoder as ContractArtifact,
|
||||||
|
IsolatedExchange: IsolatedExchange as ContractArtifact,
|
||||||
|
ReentrancyTester: ReentrancyTester as ContractArtifact,
|
||||||
|
TestAssetProxyDispatcher: TestAssetProxyDispatcher as ContractArtifact,
|
||||||
|
TestExchangeInternals: TestExchangeInternals as ContractArtifact,
|
||||||
|
TestLibExchangeRichErrorDecoder: TestLibExchangeRichErrorDecoder as ContractArtifact,
|
||||||
|
TestProtocolFeeCollector: TestProtocolFeeCollector as ContractArtifact,
|
||||||
|
TestProtocolFees: TestProtocolFees as ContractArtifact,
|
||||||
|
TestProtocolFeesReceiver: TestProtocolFeesReceiver as ContractArtifact,
|
||||||
|
TestSignatureValidator: TestSignatureValidator as ContractArtifact,
|
||||||
|
TestTransactions: TestTransactions as ContractArtifact,
|
||||||
|
TestValidatorWallet: TestValidatorWallet as ContractArtifact,
|
||||||
|
TestWrapperFunctions: TestWrapperFunctions as ContractArtifact,
|
||||||
|
};
|
40
contracts/exchange/test/wrappers.ts
Normal file
40
contracts/exchange/test/wrappers.ts
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
/*
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
* Warning: This file is auto-generated by contracts-gen. Don't edit manually.
|
||||||
|
* -----------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
export * from '../test/generated-wrappers/exchange';
|
||||||
|
export * from '../test/generated-wrappers/i_asset_proxy';
|
||||||
|
export * from '../test/generated-wrappers/i_asset_proxy_dispatcher';
|
||||||
|
export * from '../test/generated-wrappers/i_e_i_p1271_data';
|
||||||
|
export * from '../test/generated-wrappers/i_e_i_p1271_wallet';
|
||||||
|
export * from '../test/generated-wrappers/i_exchange';
|
||||||
|
export * from '../test/generated-wrappers/i_exchange_core';
|
||||||
|
export * from '../test/generated-wrappers/i_match_orders';
|
||||||
|
export * from '../test/generated-wrappers/i_protocol_fees';
|
||||||
|
export * from '../test/generated-wrappers/i_signature_validator';
|
||||||
|
export * from '../test/generated-wrappers/i_transactions';
|
||||||
|
export * from '../test/generated-wrappers/i_transfer_simulator';
|
||||||
|
export * from '../test/generated-wrappers/i_wallet';
|
||||||
|
export * from '../test/generated-wrappers/i_wrapper_functions';
|
||||||
|
export * from '../test/generated-wrappers/isolated_exchange';
|
||||||
|
export * from '../test/generated-wrappers/lib_exchange_rich_error_decoder';
|
||||||
|
export * from '../test/generated-wrappers/mixin_asset_proxy_dispatcher';
|
||||||
|
export * from '../test/generated-wrappers/mixin_exchange_core';
|
||||||
|
export * from '../test/generated-wrappers/mixin_match_orders';
|
||||||
|
export * from '../test/generated-wrappers/mixin_protocol_fees';
|
||||||
|
export * from '../test/generated-wrappers/mixin_signature_validator';
|
||||||
|
export * from '../test/generated-wrappers/mixin_transactions';
|
||||||
|
export * from '../test/generated-wrappers/mixin_transfer_simulator';
|
||||||
|
export * from '../test/generated-wrappers/mixin_wrapper_functions';
|
||||||
|
export * from '../test/generated-wrappers/reentrancy_tester';
|
||||||
|
export * from '../test/generated-wrappers/test_asset_proxy_dispatcher';
|
||||||
|
export * from '../test/generated-wrappers/test_exchange_internals';
|
||||||
|
export * from '../test/generated-wrappers/test_lib_exchange_rich_error_decoder';
|
||||||
|
export * from '../test/generated-wrappers/test_protocol_fee_collector';
|
||||||
|
export * from '../test/generated-wrappers/test_protocol_fees';
|
||||||
|
export * from '../test/generated-wrappers/test_protocol_fees_receiver';
|
||||||
|
export * from '../test/generated-wrappers/test_signature_validator';
|
||||||
|
export * from '../test/generated-wrappers/test_transactions';
|
||||||
|
export * from '../test/generated-wrappers/test_validator_wallet';
|
||||||
|
export * from '../test/generated-wrappers/test_wrapper_functions';
|
@ -4,40 +4,42 @@
|
|||||||
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
|
||||||
"files": [
|
"files": [
|
||||||
"generated-artifacts/Exchange.json",
|
"generated-artifacts/Exchange.json",
|
||||||
"generated-artifacts/IAssetProxy.json",
|
|
||||||
"generated-artifacts/IAssetProxyDispatcher.json",
|
|
||||||
"generated-artifacts/IEIP1271Data.json",
|
|
||||||
"generated-artifacts/IEIP1271Wallet.json",
|
|
||||||
"generated-artifacts/IExchange.json",
|
"generated-artifacts/IExchange.json",
|
||||||
"generated-artifacts/IExchangeCore.json",
|
"test/generated-artifacts/Exchange.json",
|
||||||
"generated-artifacts/IMatchOrders.json",
|
"test/generated-artifacts/IAssetProxy.json",
|
||||||
"generated-artifacts/IProtocolFees.json",
|
"test/generated-artifacts/IAssetProxyDispatcher.json",
|
||||||
"generated-artifacts/ISignatureValidator.json",
|
"test/generated-artifacts/IEIP1271Data.json",
|
||||||
"generated-artifacts/ITransactions.json",
|
"test/generated-artifacts/IEIP1271Wallet.json",
|
||||||
"generated-artifacts/ITransferSimulator.json",
|
"test/generated-artifacts/IExchange.json",
|
||||||
"generated-artifacts/IWallet.json",
|
"test/generated-artifacts/IExchangeCore.json",
|
||||||
"generated-artifacts/IWrapperFunctions.json",
|
"test/generated-artifacts/IMatchOrders.json",
|
||||||
"generated-artifacts/IsolatedExchange.json",
|
"test/generated-artifacts/IProtocolFees.json",
|
||||||
"generated-artifacts/LibExchangeRichErrorDecoder.json",
|
"test/generated-artifacts/ISignatureValidator.json",
|
||||||
"generated-artifacts/MixinAssetProxyDispatcher.json",
|
"test/generated-artifacts/ITransactions.json",
|
||||||
"generated-artifacts/MixinExchangeCore.json",
|
"test/generated-artifacts/ITransferSimulator.json",
|
||||||
"generated-artifacts/MixinMatchOrders.json",
|
"test/generated-artifacts/IWallet.json",
|
||||||
"generated-artifacts/MixinProtocolFees.json",
|
"test/generated-artifacts/IWrapperFunctions.json",
|
||||||
"generated-artifacts/MixinSignatureValidator.json",
|
"test/generated-artifacts/IsolatedExchange.json",
|
||||||
"generated-artifacts/MixinTransactions.json",
|
"test/generated-artifacts/LibExchangeRichErrorDecoder.json",
|
||||||
"generated-artifacts/MixinTransferSimulator.json",
|
"test/generated-artifacts/MixinAssetProxyDispatcher.json",
|
||||||
"generated-artifacts/MixinWrapperFunctions.json",
|
"test/generated-artifacts/MixinExchangeCore.json",
|
||||||
"generated-artifacts/ReentrancyTester.json",
|
"test/generated-artifacts/MixinMatchOrders.json",
|
||||||
"generated-artifacts/TestAssetProxyDispatcher.json",
|
"test/generated-artifacts/MixinProtocolFees.json",
|
||||||
"generated-artifacts/TestExchangeInternals.json",
|
"test/generated-artifacts/MixinSignatureValidator.json",
|
||||||
"generated-artifacts/TestLibExchangeRichErrorDecoder.json",
|
"test/generated-artifacts/MixinTransactions.json",
|
||||||
"generated-artifacts/TestProtocolFeeCollector.json",
|
"test/generated-artifacts/MixinTransferSimulator.json",
|
||||||
"generated-artifacts/TestProtocolFees.json",
|
"test/generated-artifacts/MixinWrapperFunctions.json",
|
||||||
"generated-artifacts/TestProtocolFeesReceiver.json",
|
"test/generated-artifacts/ReentrancyTester.json",
|
||||||
"generated-artifacts/TestSignatureValidator.json",
|
"test/generated-artifacts/TestAssetProxyDispatcher.json",
|
||||||
"generated-artifacts/TestTransactions.json",
|
"test/generated-artifacts/TestExchangeInternals.json",
|
||||||
"generated-artifacts/TestValidatorWallet.json",
|
"test/generated-artifacts/TestLibExchangeRichErrorDecoder.json",
|
||||||
"generated-artifacts/TestWrapperFunctions.json"
|
"test/generated-artifacts/TestProtocolFeeCollector.json",
|
||||||
|
"test/generated-artifacts/TestProtocolFees.json",
|
||||||
|
"test/generated-artifacts/TestProtocolFeesReceiver.json",
|
||||||
|
"test/generated-artifacts/TestSignatureValidator.json",
|
||||||
|
"test/generated-artifacts/TestTransactions.json",
|
||||||
|
"test/generated-artifacts/TestValidatorWallet.json",
|
||||||
|
"test/generated-artifacts/TestWrapperFunctions.json"
|
||||||
],
|
],
|
||||||
"exclude": ["./deploy/solc/solc_bin"]
|
"exclude": ["./deploy/solc/solc_bin"]
|
||||||
}
|
}
|
||||||
|
@ -12,9 +12,13 @@ import * as prettier from 'prettier';
|
|||||||
import toSnakeCase = require('to-snake-case');
|
import toSnakeCase = require('to-snake-case');
|
||||||
|
|
||||||
const SOLIDITY_EXTENSION = '.sol';
|
const SOLIDITY_EXTENSION = '.sol';
|
||||||
const DEFAULT_ARTIFACTS_DIR = 'artifacts';
|
const DEFAULT_ARTIFACTS_DIR = 'test/artifacts';
|
||||||
const DEFAULT_CONTRACTS_DIR = 'contracts';
|
const DEFAULT_CONTRACTS_DIR = 'contracts';
|
||||||
const DEFAULT_WRAPPERS_DIR = 'generated-wrappers';
|
const DEFAULT_WRAPPERS_DIR = 'test/generated-wrappers';
|
||||||
|
const SRC_ARTIFACTS_TS_FILE_PATH = 'src/artifacts.ts';
|
||||||
|
const TEST_ARTIFACTS_TS_FILE_PATH = 'test/artifacts.ts';
|
||||||
|
const SRC_WRAPPERS_TS_FILE_PATH = 'src/wrappers.ts';
|
||||||
|
const TEST_WRAPPERS_TS_FILE_PATH = 'test/wrappers.ts';
|
||||||
const AUTO_GENERATED_BANNER = `/*
|
const AUTO_GENERATED_BANNER = `/*
|
||||||
* -----------------------------------------------------------------------------
|
* -----------------------------------------------------------------------------
|
||||||
* Warning: 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.
|
||||||
@ -27,25 +31,52 @@ const ALL_CONTRACTS_IDENTIFIER = '*';
|
|||||||
const packageDir = process.cwd();
|
const packageDir = process.cwd();
|
||||||
const compilerJSON = readJSONFile<CompilerOptions>('compiler.json');
|
const compilerJSON = readJSONFile<CompilerOptions>('compiler.json');
|
||||||
const compiler = new Compiler(compilerJSON);
|
const compiler = new Compiler(compilerJSON);
|
||||||
const contracts = compiler.getContractNamesToCompile();
|
const testContracts = compiler.getContractNamesToCompile();
|
||||||
const contractsDir = compilerJSON.contractsDir || DEFAULT_CONTRACTS_DIR;
|
if (!_.isArray(testContracts)) {
|
||||||
const artifactsDir = compilerJSON.artifactsDir || DEFAULT_ARTIFACTS_DIR;
|
|
||||||
const wrappersDir = DEFAULT_WRAPPERS_DIR;
|
|
||||||
if (!_.isArray(contracts)) {
|
|
||||||
throw new Error('Unable to run the generator bacause contracts key in compiler.json is not of type array');
|
throw new Error('Unable to run the generator bacause contracts key in compiler.json is not of type array');
|
||||||
}
|
}
|
||||||
|
const packageJSON = readJSONFile<PackageJSON>('package.json');
|
||||||
|
let srcContracts = testContracts;
|
||||||
|
if (packageJSON.config !== undefined && packageJSON.config !== undefined) {
|
||||||
|
srcContracts = (packageJSON.config as any).whitelistedContracts.split(',');
|
||||||
|
}
|
||||||
|
const testContractsDir = compilerJSON.contractsDir || DEFAULT_CONTRACTS_DIR;
|
||||||
|
const testArtifactsDir = compilerJSON.artifactsDir || DEFAULT_ARTIFACTS_DIR;
|
||||||
|
const testWrappersDir = DEFAULT_WRAPPERS_DIR;
|
||||||
const prettierConfig = await prettier.resolveConfig(packageDir);
|
const prettierConfig = await prettier.resolveConfig(packageDir);
|
||||||
generateCompilerJSONContractsList(contracts, contractsDir, prettierConfig);
|
generateCompilerJSONContractsList(testContracts, testContractsDir, prettierConfig);
|
||||||
generateArtifactsTs(contracts, artifactsDir, prettierConfig);
|
generateArtifactsTs(testContracts, testArtifactsDir, TEST_ARTIFACTS_TS_FILE_PATH, prettierConfig);
|
||||||
generateWrappersTs(contracts, wrappersDir, prettierConfig);
|
const srcArtifactsDir = convertToTopLevelDir('testArtifactsDir', testArtifactsDir);
|
||||||
generateTsConfigJSONFilesList(contracts, artifactsDir, prettierConfig);
|
generateArtifactsTs(srcContracts, srcArtifactsDir, SRC_ARTIFACTS_TS_FILE_PATH, prettierConfig);
|
||||||
generatePackageJSONABIConfig(contracts, artifactsDir, prettierConfig);
|
const srcWrappersDir = convertToTopLevelDir('testWrappersDir', testWrappersDir);
|
||||||
|
generateWrappersTs(testContracts, testWrappersDir, TEST_WRAPPERS_TS_FILE_PATH, prettierConfig);
|
||||||
|
generateWrappersTs(srcContracts, srcWrappersDir, SRC_WRAPPERS_TS_FILE_PATH, prettierConfig);
|
||||||
|
generateTsConfigJSONFilesList(testContracts, testArtifactsDir, srcContracts, srcArtifactsDir, prettierConfig);
|
||||||
|
generatePackageJSONABIConfig(testContracts, 'test-abis', testArtifactsDir, prettierConfig);
|
||||||
|
generatePackageJSONABIConfig(srcContracts, 'src-abis', srcArtifactsDir, prettierConfig);
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
})().catch(err => {
|
})().catch(err => {
|
||||||
logUtils.log(err);
|
logUtils.log(err);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
function convertToTopLevelDir(name: string, aPath: string): string {
|
||||||
|
let finalPath = aPath;
|
||||||
|
const hasDotPrefix = aPath.startsWith('./');
|
||||||
|
if (hasDotPrefix) {
|
||||||
|
finalPath = aPath.substr(2);
|
||||||
|
}
|
||||||
|
const segments = finalPath.split('/');
|
||||||
|
if (segments.length === 0) {
|
||||||
|
throw new Error(`Cannot have empty path for ${name}`);
|
||||||
|
}
|
||||||
|
if (segments.length === 1) {
|
||||||
|
return aPath;
|
||||||
|
}
|
||||||
|
segments.shift();
|
||||||
|
return `${hasDotPrefix ? './' : ''}${segments.join('/')}`;
|
||||||
|
}
|
||||||
|
|
||||||
function generateCompilerJSONContractsList(
|
function generateCompilerJSONContractsList(
|
||||||
contracts: string[],
|
contracts: string[],
|
||||||
contractsDir: string,
|
contractsDir: string,
|
||||||
@ -73,7 +104,7 @@ function generateCompilerJSONContractsList(
|
|||||||
fs.writeFileSync(COMPILER_JSON_FILE_PATH, formattedCompilerJSON);
|
fs.writeFileSync(COMPILER_JSON_FILE_PATH, formattedCompilerJSON);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateArtifactsTs(contracts: string[], artifactsDir: string, prettierConfig: prettier.Options | null): void {
|
function generateArtifactsTs(contracts: string[], artifactsDir: string, artifactsTsFilePath: string, prettierConfig: prettier.Options | null): void {
|
||||||
const imports = _.map(contracts, contract => {
|
const imports = _.map(contracts, contract => {
|
||||||
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
||||||
const importPath = path.join('..', artifactsDir, `${contractName}.json`);
|
const importPath = path.join('..', artifactsDir, `${contractName}.json`);
|
||||||
@ -97,12 +128,11 @@ function generateArtifactsTs(contracts: string[], artifactsDir: string, prettier
|
|||||||
${sortedImports.join('\n')}
|
${sortedImports.join('\n')}
|
||||||
export const artifacts = {${artifacts.join('\n')}};
|
export const artifacts = {${artifacts.join('\n')}};
|
||||||
`;
|
`;
|
||||||
const ARTIFACTS_TS_FILE_PATH = 'src/artifacts.ts';
|
const formattedArtifactsTs = prettier.format(artifactsTs, { ...prettierConfig, filepath: artifactsTsFilePath });
|
||||||
const formattedArtifactsTs = prettier.format(artifactsTs, { ...prettierConfig, filepath: ARTIFACTS_TS_FILE_PATH });
|
fs.writeFileSync(artifactsTsFilePath, formattedArtifactsTs);
|
||||||
fs.writeFileSync(ARTIFACTS_TS_FILE_PATH, formattedArtifactsTs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateWrappersTs(contracts: string[], wrappersDir: string, prettierConfig: prettier.Options | null): void {
|
function generateWrappersTs(contracts: string[], wrappersDir: string, wrappersTsFilePath: string, prettierConfig: prettier.Options | null): void {
|
||||||
const imports = _.map(contracts, contract => {
|
const imports = _.map(contracts, contract => {
|
||||||
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
||||||
const outputFileName = makeOutputFileName(contractName);
|
const outputFileName = makeOutputFileName(contractName);
|
||||||
@ -114,23 +144,30 @@ function generateWrappersTs(contracts: string[], wrappersDir: string, prettierCo
|
|||||||
${AUTO_GENERATED_BANNER}
|
${AUTO_GENERATED_BANNER}
|
||||||
${sortedImports.join('\n')}
|
${sortedImports.join('\n')}
|
||||||
`;
|
`;
|
||||||
const WRAPPERS_TS_FILE_PATH = 'src/wrappers.ts';
|
const formattedArtifactsTs = prettier.format(wrappersTs, { ...prettierConfig, filepath: wrappersTsFilePath });
|
||||||
const formattedArtifactsTs = prettier.format(wrappersTs, { ...prettierConfig, filepath: WRAPPERS_TS_FILE_PATH });
|
fs.writeFileSync(wrappersTsFilePath, formattedArtifactsTs);
|
||||||
fs.writeFileSync(WRAPPERS_TS_FILE_PATH, formattedArtifactsTs);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateTsConfigJSONFilesList(
|
function generateTsConfigJSONFilesList(
|
||||||
contracts: string[],
|
testContracts: string[],
|
||||||
artifactsDir: string,
|
testArtifactsDir: string,
|
||||||
|
srcContracts: string[],
|
||||||
|
srcArtifactsDir: string,
|
||||||
prettierConfig: prettier.Options | null,
|
prettierConfig: prettier.Options | null,
|
||||||
): void {
|
): void {
|
||||||
const TS_CONFIG_FILE_PATH = 'tsconfig.json';
|
const TS_CONFIG_FILE_PATH = 'tsconfig.json';
|
||||||
const tsConfig = readJSONFile<any>(TS_CONFIG_FILE_PATH);
|
const tsConfig = readJSONFile<any>(TS_CONFIG_FILE_PATH);
|
||||||
tsConfig.files = _.map(contracts, contract => {
|
const testFiles = _.map(testContracts, contract => {
|
||||||
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
||||||
const artifactPath = path.join(artifactsDir, `${contractName}.json`);
|
const artifactPath = path.join(testArtifactsDir, `${contractName}.json`);
|
||||||
return artifactPath;
|
return artifactPath;
|
||||||
});
|
});
|
||||||
|
const srcFiles = _.map(srcContracts, contract => {
|
||||||
|
const contractName = path.basename(contract, SOLIDITY_EXTENSION);
|
||||||
|
const artifactPath = path.join(srcArtifactsDir, `${contractName}.json`);
|
||||||
|
return artifactPath;
|
||||||
|
});
|
||||||
|
tsConfig.files = [...testFiles, ...srcFiles];
|
||||||
tsConfig.files = _.sortBy(tsConfig.files);
|
tsConfig.files = _.sortBy(tsConfig.files);
|
||||||
const tsConfigString = JSON.stringify(tsConfig);
|
const tsConfigString = JSON.stringify(tsConfig);
|
||||||
const formattedTsConfig = prettier.format(tsConfigString, { ...prettierConfig, filepath: TS_CONFIG_FILE_PATH });
|
const formattedTsConfig = prettier.format(tsConfigString, { ...prettierConfig, filepath: TS_CONFIG_FILE_PATH });
|
||||||
@ -139,6 +176,7 @@ function generateTsConfigJSONFilesList(
|
|||||||
|
|
||||||
function generatePackageJSONABIConfig(
|
function generatePackageJSONABIConfig(
|
||||||
contracts: string[],
|
contracts: string[],
|
||||||
|
configName: string,
|
||||||
artifactsDir: string,
|
artifactsDir: string,
|
||||||
prettierConfig: prettier.Options | null,
|
prettierConfig: prettier.Options | null,
|
||||||
): void {
|
): void {
|
||||||
@ -152,8 +190,8 @@ function generatePackageJSONABIConfig(
|
|||||||
...packageJSON,
|
...packageJSON,
|
||||||
config: {
|
config: {
|
||||||
...packageJSON.config,
|
...packageJSON.config,
|
||||||
'abis:comment': AUTO_GENERATED_BANNER_FOR_LISTS,
|
[`${configName}:comment`]: AUTO_GENERATED_BANNER_FOR_LISTS,
|
||||||
abis: `${artifactsDir}/@(${sortedContractNames.join('|')}).json`,
|
[configName]: `${artifactsDir}/@(${sortedContractNames.join('|')}).json`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
const PACKAGE_JSON_FILE_PATH = 'package.json';
|
const PACKAGE_JSON_FILE_PATH = 'package.json';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user