From ebd328db0613a647e0f1436746333e4bf382d3c5 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 28 Sep 2019 17:25:21 -0700 Subject: [PATCH 01/12] Add getSelector helper function to Typescript templates --- .../partials/method_abi_helper.handlebars | 8 + .../output/typescript/abi_gen_dummy.ts | 240 ++++++++++++++++++ .../output/typescript/test_lib_dummy.ts | 16 ++ packages/migrations/src/testnet_migrations.ts | 21 ++ .../migrations/src/utils/provider_factory.ts | 6 +- 5 files changed, 288 insertions(+), 3 deletions(-) create mode 100644 packages/migrations/src/testnet_migrations.ts diff --git a/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars b/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars index 0c8f1893af..db442c706a 100644 --- a/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars +++ b/packages/abi-gen/templates/TypeScript/partials/method_abi_helper.handlebars @@ -43,3 +43,11 @@ getABIDecodedReturnData( const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<{{> return_type outputs=outputs}}>(returnData); return abiDecodedReturnData; }, +/** + * Returns the 4 byte function selector as a hex string. + */ +getSelector(): string { + const self = this as any as {{contractName}}Contract; + const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}'); + return abiEncoder.getSelector(); +} diff --git a/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts b/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts index c002380fc9..efdc6ae012 100644 --- a/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts +++ b/packages/abi-gen/test-cli/output/typescript/abi_gen_dummy.ts @@ -123,6 +123,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simpleRequire()'); + return abiEncoder.getSelector(); + }, }; /** * a method that accepts an array of bytes @@ -200,6 +208,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('acceptsAnArrayOfBytes(bytes[])'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when both input and output are non-empty. @@ -281,6 +297,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simpleInputSimpleOutput(uint256)'); + return abiEncoder.getSelector(); + }, }; public withdraw = { /** @@ -443,6 +467,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when the input and output are complex and have more than one argument. @@ -535,6 +567,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('multiInputMultiOutput(uint256,bytes,string)'); + return abiEncoder.getSelector(); + }, }; /** * test that devdocs will be generated and @@ -645,6 +685,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('ecrecoverFn(bytes32,uint8,bytes32,bytes32)'); + return abiEncoder.getSelector(); + }, }; public acceptsBytes = { /** @@ -717,6 +765,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('acceptsBytes(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when input is empty and output is non-empty. @@ -790,6 +846,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('noInputSimpleOutput()'); + return abiEncoder.getSelector(); + }, }; public revertWithConstant = { /** @@ -860,6 +924,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('revertWithConstant()'); + return abiEncoder.getSelector(); + }, }; public simpleRevert = { /** @@ -930,6 +1002,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simpleRevert()'); + return abiEncoder.getSelector(); + }, }; public methodUsingNestedStructWithInnerStructNotUsedElsewhere = { /** @@ -1011,6 +1091,14 @@ export class AbiGenDummyContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('methodUsingNestedStructWithInnerStructNotUsedElsewhere()'); + return abiEncoder.getSelector(); + }, }; public nestedStructOutput = { /** @@ -1098,6 +1186,14 @@ export class AbiGenDummyContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('nestedStructOutput()'); + return abiEncoder.getSelector(); + }, }; public requireWithConstant = { /** @@ -1168,6 +1264,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('requireWithConstant()'); + return abiEncoder.getSelector(); + }, }; public withAddressInput = { /** @@ -1262,6 +1366,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('withAddressInput(address,uint256,uint256,address,uint256)'); + return abiEncoder.getSelector(); + }, }; public structInput = { /** @@ -1348,6 +1460,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('structInput((bytes,uint32,bytes[],string))'); + return abiEncoder.getSelector(); + }, }; public nonPureMethod = { /** @@ -1504,6 +1624,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('nonPureMethod()'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when the input and output are complex. @@ -1603,6 +1731,14 @@ export class AbiGenDummyContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('complexInputComplexOutput((uint256,bytes,string))'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when both input and output are empty. @@ -1676,6 +1812,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('noInputNoOutput()'); + return abiEncoder.getSelector(); + }, }; public simplePureFunctionWithInput = { /** @@ -1748,6 +1892,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simplePureFunctionWithInput(uint256)'); + return abiEncoder.getSelector(); + }, }; public nonPureMethodThatReturnsNothing = { /** @@ -1904,6 +2056,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('nonPureMethodThatReturnsNothing()'); + return abiEncoder.getSelector(); + }, }; public simplePureFunction = { /** @@ -1974,6 +2134,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simplePureFunction()'); + return abiEncoder.getSelector(); + }, }; public nestedStructInput = { /** @@ -2089,6 +2257,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('nestedStructInput(((bytes,uint32,bytes[],string),string))'); + return abiEncoder.getSelector(); + }, }; public methodReturningMultipleValues = { /** @@ -2159,6 +2335,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('methodReturningMultipleValues()'); + return abiEncoder.getSelector(); + }, }; public methodReturningArrayOfStructs = { /** @@ -2238,6 +2422,14 @@ export class AbiGenDummyContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('methodReturningArrayOfStructs()'); + return abiEncoder.getSelector(); + }, }; public emitSimpleEvent = { /** @@ -2394,6 +2586,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('emitSimpleEvent()'); + return abiEncoder.getSelector(); + }, }; /** * a method that returns a struct @@ -2483,6 +2683,14 @@ export class AbiGenDummyContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('structOutput()'); + return abiEncoder.getSelector(); + }, }; public pureFunctionWithConstant = { /** @@ -2553,6 +2761,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('pureFunctionWithConstant()'); + return abiEncoder.getSelector(); + }, }; /** * Tests decoding when input is not empty but output is empty. @@ -2632,6 +2848,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('simpleInputNoOutput(uint256)'); + return abiEncoder.getSelector(); + }, }; public overloadedMethod2 = { /** @@ -2704,6 +2928,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('overloadedMethod(string)'); + return abiEncoder.getSelector(); + }, }; public overloadedMethod1 = { /** @@ -2776,6 +3008,14 @@ export class AbiGenDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AbiGenDummyContract; + const abiEncoder = self._lookupAbiEncoder('overloadedMethod(int256)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts b/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts index e914908a52..38e699849b 100644 --- a/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts +++ b/packages/abi-gen/test-cli/output/typescript/test_lib_dummy.ts @@ -101,6 +101,14 @@ export class TestLibDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestLibDummyContract; + const abiEncoder = self._lookupAbiEncoder('publicAddConstant(uint256)'); + return abiEncoder.getSelector(); + }, }; public publicAddOne = { /** @@ -173,6 +181,14 @@ export class TestLibDummyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as TestLibDummyContract; + const abiEncoder = self._lookupAbiEncoder('publicAddOne(uint256)'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts new file mode 100644 index 0000000000..466cbcb91f --- /dev/null +++ b/packages/migrations/src/testnet_migrations.ts @@ -0,0 +1,21 @@ +import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses'; +import { AssetProxyOwnerContract, ERC20ProxyContract } from '@0x/contract-wrappers'; +import { artifacts, AssetProxyOwnerContract as GovernanceMultisigContract } from '@0x/contracts-multisig'; +import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils'; +import { Web3Wrapper } from '@0x/web3-wrapper'; +import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; + +export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise { + const provider = providerUtils.standardizeOrThrow(supportedProvider); + const web3Wrapper = new Web3Wrapper(provider); + const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider)); + const networkId = await web3Wrapper.getNetworkIdAsync(); + const deployedAddresses = getContractAddressesForNetworkOrThrow(networkId); + // const noTimeLockMethods = [{destination: }] + const governanceMultisig = await GovernanceMultisigContract.deployFrom0xArtifactAsync( + artifacts.AssetProxyOwner, + provider, + txDefaults, + artifacts, + ); +} diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts index 330a263e87..6cb6b03031 100644 --- a/packages/migrations/src/utils/provider_factory.ts +++ b/packages/migrations/src/utils/provider_factory.ts @@ -13,15 +13,15 @@ async function ledgerEthereumNodeJsClientFactoryAsync(): Promise { + async getLedgerProviderAsync(networkId: number, rpcUrl: string): Promise { const provider = new Web3ProviderEngine(); const ledgerWalletConfigs = { - networkId: constants.KOVAN_NETWORK_ID, + networkId, ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync, }; const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs); provider.addProvider(ledgerSubprovider); - provider.addProvider(new RPCSubprovider(constants.KOVAN_RPC_URL)); + provider.addProvider(new RPCSubprovider(rpcUrl)); providerUtils.startProviderEngine(provider); return provider; }, From f4453c0966ac76135472cc1d63ecb5bb76d9c599 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sat, 28 Sep 2019 17:25:46 -0700 Subject: [PATCH 02/12] Regenerate abi-gen-wrappers --- .../generated-wrappers/asset_proxy_owner.ts | 208 ++++++++++ .../src/generated-wrappers/coordinator.ts | 68 ++++ .../coordinator_registry.ts | 16 + .../src/generated-wrappers/dev_utils.ts | 296 ++++++++++++++ .../generated-wrappers/dummy_erc20_token.ts | 112 ++++++ .../generated-wrappers/dummy_erc721_token.ts | 120 ++++++ .../src/generated-wrappers/dutch_auction.ts | 20 + .../src/generated-wrappers/erc1155_proxy.ts | 80 ++++ .../src/generated-wrappers/erc20_proxy.ts | 72 ++++ .../src/generated-wrappers/erc20_token.ts | 48 +++ .../src/generated-wrappers/erc721_proxy.ts | 72 ++++ .../src/generated-wrappers/erc721_token.ts | 72 ++++ .../generated-wrappers/eth_balance_checker.ts | 8 + .../src/generated-wrappers/exchange.ts | 378 ++++++++++++++++++ .../src/generated-wrappers/forwarder.ts | 52 +++ .../src/generated-wrappers/i_asset_proxy.ts | 16 + .../src/generated-wrappers/i_validator.ts | 8 + .../src/generated-wrappers/i_wallet.ts | 8 + .../generated-wrappers/multi_asset_proxy.ts | 96 +++++ .../src/generated-wrappers/order_validator.ts | 64 +++ .../generated-wrappers/static_call_proxy.ts | 16 + .../src/generated-wrappers/weth9.ts | 88 ++++ .../src/generated-wrappers/zrx_token.ts | 72 ++++ 23 files changed, 1990 insertions(+) diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts index 9592b48ee9..d42be9f75d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts @@ -204,6 +204,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Allows to remove an owner. Transaction has to be sent by wallet. @@ -376,6 +384,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); + return abiEncoder.getSelector(); + }, }; /** * Allows an owner to revoke a confirmation for a transaction. @@ -555,6 +571,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); + return abiEncoder.getSelector(); + }, }; public isOwner = { /** @@ -639,6 +663,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); + return abiEncoder.getSelector(); + }, }; public confirmations = { /** @@ -732,6 +764,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); + return abiEncoder.getSelector(); + }, }; public secondsTimeLocked = { /** @@ -810,6 +850,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); + return abiEncoder.getSelector(); + }, }; /** * Returns total number of transactions after filers are applied. @@ -908,6 +956,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); + return abiEncoder.getSelector(); + }, }; /** * Allows to add a new owner. Transaction has to be sent by wallet. @@ -1078,6 +1134,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); + return abiEncoder.getSelector(); + }, }; /** * Registers a custom timelock to a specific function selector / destination combo @@ -1352,6 +1416,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('registerFunctionCall(bool,bytes4,address,uint128)'); + return abiEncoder.getSelector(); + }, }; /** * Returns the confirmation status of a transaction. @@ -1442,6 +1514,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Changes the duration of the time lock for transactions. @@ -1629,6 +1709,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); + return abiEncoder.getSelector(); + }, }; public functionCallTimeLocks = { /** @@ -1722,6 +1810,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[boolean, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('functionCallTimeLocks(bytes4,address)'); + return abiEncoder.getSelector(); + }, }; /** * Returns number of confirmations of a transaction. @@ -1814,6 +1910,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); + return abiEncoder.getSelector(); + }, }; public transactions = { /** @@ -1900,6 +2004,14 @@ export class AssetProxyOwnerContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Returns list of owners. @@ -1982,6 +2094,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('getOwners()'); + return abiEncoder.getSelector(); + }, }; /** * Returns list of transaction IDs in defined range. @@ -2095,6 +2215,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); + return abiEncoder.getSelector(); + }, }; /** * Returns array with owner addresses, which confirmed transaction. @@ -2185,6 +2313,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); + return abiEncoder.getSelector(); + }, }; public transactionCount = { /** @@ -2263,6 +2399,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('transactionCount()'); + return abiEncoder.getSelector(); + }, }; /** * Allows to change the number of required confirmations. Transaction has to be sent by wallet. @@ -2440,6 +2584,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Allows an owner to confirm a transaction. @@ -2619,6 +2771,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Allows an owner to submit and confirm a transaction. @@ -2854,6 +3014,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); + return abiEncoder.getSelector(); + }, }; public confirmationTimes = { /** @@ -2938,6 +3106,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); + return abiEncoder.getSelector(); + }, }; public MAX_OWNER_COUNT = { /** @@ -3016,6 +3192,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); + return abiEncoder.getSelector(); + }, }; public required = { /** @@ -3094,6 +3278,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('required()'); + return abiEncoder.getSelector(); + }, }; /** * Allows to replace an owner with a new owner. Transaction has to be sent by wallet. @@ -3304,6 +3496,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); + return abiEncoder.getSelector(); + }, }; /** * Allows anyone to execute a confirmed transaction. @@ -3486,6 +3686,14 @@ export class AssetProxyOwnerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as AssetProxyOwnerContract; + const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts index b551fb32ae..f0e7c0421c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator.ts @@ -117,6 +117,14 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('getSignerAddress(bytes32,bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Calculates the EIP712 hash of a 0x transaction using the domain separator of the Exchange contract. @@ -214,6 +222,14 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('getTransactionHash((uint256,address,bytes))'); + return abiEncoder.getSelector(); + }, }; /** * Calculated the EIP712 hash of the Coordinator approval mesasage using the domain separator of this contract. @@ -332,6 +348,14 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('getCoordinatorApprovalHash((address,bytes32,bytes,uint256))'); + return abiEncoder.getSelector(); + }, }; /** * Executes a 0x transaction that has been signed by the feeRecipients that correspond to each order in the transaction's Exchange calldata. @@ -663,6 +687,16 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'executeTransaction((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { /** @@ -741,6 +775,14 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); + return abiEncoder.getSelector(); + }, }; /** * Validates that the 0x transaction has been approved by all of the feeRecipients @@ -891,6 +933,16 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'assertValidCoordinatorApprovals((uint256,address,bytes),address,bytes,uint256[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Decodes the orders from Exchange calldata representing any fill method. @@ -1033,6 +1085,14 @@ export class CoordinatorContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('decodeOrdersFromFillData(bytes)'); + return abiEncoder.getSelector(); + }, }; public EIP712_COORDINATOR_DOMAIN_HASH = { /** @@ -1111,6 +1171,14 @@ export class CoordinatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorContract; + const abiEncoder = self._lookupAbiEncoder('EIP712_COORDINATOR_DOMAIN_HASH()'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts index 67de768648..ebd54e9e18 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/coordinator_registry.ts @@ -225,6 +225,14 @@ export class CoordinatorRegistryContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorRegistryContract; + const abiEncoder = self._lookupAbiEncoder('setCoordinatorEndpoint(string)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the endpoint for a Coordinator. @@ -318,6 +326,14 @@ export class CoordinatorRegistryContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as CoordinatorRegistryContract; + const abiEncoder = self._lookupAbiEncoder('getCoordinatorEndpoint(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts index 2ba9b118cf..73d3808cc5 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dev_utils.ts @@ -111,6 +111,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, number]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeOrderStatusError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decode ERC-721 asset data from the format described in the AssetProxy contract specification. @@ -195,6 +203,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC721AssetData(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Calls getBalance() and getAllowance() for assetData. @@ -298,6 +314,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalanceAndAssetProxyAllowance(address,bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded IncompleteFillError. @@ -382,6 +406,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, BigNumber, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeIncompleteFillError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the amount of an asset transferable by the owner. @@ -485,6 +517,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getTransferableAssetAmount(address,bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded AssetProxyTransferError. @@ -569,6 +609,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyTransferError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded NegativeSpreadError. @@ -653,6 +701,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeNegativeSpreadError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded AssetProxyDispatchError. @@ -737,6 +793,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyDispatchError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded SignatureWalletError. @@ -823,6 +887,14 @@ export class DevUtilsContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeSignatureWalletError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded FillError. @@ -905,6 +977,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeFillError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Calls getAssetProxyAllowance() for each element of assetData. @@ -1008,6 +1088,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchAssetProxyAllowances(address,bytes[])'); + return abiEncoder.getSelector(); + }, }; /** * Encode ERC-20 asset data into the format described in the AssetProxy contract specification. @@ -1096,6 +1184,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC20AssetData(address)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded OrderEpochError. @@ -1178,6 +1274,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeOrderEpochError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decodes the call data for an Exchange contract method call. @@ -1352,6 +1456,14 @@ export class DevUtilsContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeZeroExTransactionData(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded AssetProxyExistsError. @@ -1436,6 +1548,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeAssetProxyExistsError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded SignatureValidatorNotApprovedError. @@ -1523,6 +1643,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeSignatureValidatorNotApprovedError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Returns the owner's balance of the assets(s) specified in assetData. When the asset data contains multiple assets (eg in ERC1155 or Multi-Asset), the return value indicates how many complete "baskets" of those assets are owned by owner. @@ -1626,6 +1754,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBalance(address,bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decode ERC-20 asset data from the format described in the AssetProxy contract specification. @@ -1708,6 +1844,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC20AssetData(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded SignatureError. @@ -1792,6 +1936,14 @@ export class DevUtilsContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeSignatureError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decode ERC-1155 asset data from the format described in the AssetProxy contract specification. @@ -1880,6 +2032,14 @@ export class DevUtilsContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeERC1155AssetData(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Batch fetches ETH balances @@ -1970,6 +2130,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); + return abiEncoder.getSelector(); + }, }; /** * Simulates all of the transfers for each given order and returns the indices of each first failed transfer. @@ -2355,6 +2523,16 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getSimulatedOrdersTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],address[],uint256[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Encode ERC-721 asset data into the format described in the AssetProxy specification. @@ -2450,6 +2628,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC721AssetData(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded SignatureValidatorError. @@ -2536,6 +2722,14 @@ export class DevUtilsContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeEIP1271SignatureError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Encode ERC-1155 asset data into the format described in the AssetProxy contract specification. @@ -2648,6 +2842,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeERC1155AssetData(address,uint256[],uint256[],bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decode multi-asset data from the format described in the AssetProxy contract specification. @@ -2732,6 +2934,14 @@ export class DevUtilsContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeMultiAssetData(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded TransactionExecutionError. @@ -2816,6 +3026,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeTransactionExecutionError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded TransactionError. @@ -2898,6 +3116,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeTransactionError(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Calls getBalance() for each element of assetData. @@ -3001,6 +3227,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalances(address,bytes[])'); + return abiEncoder.getSelector(); + }, }; /** * Returns the number of asset(s) (described by assetData) that the corresponding AssetProxy contract is authorized to spend. When the asset data contains multiple assets (eg for Multi-Asset), the return value indicates how many complete "baskets" of those assets may be spent by all of the corresponding AssetProxy contracts. @@ -3104,6 +3338,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getAssetProxyAllowance(address,bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Simulates all of the transfers within an order and returns the index of the first failed transfer. @@ -3477,6 +3719,16 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getSimulatedOrderTransferResults((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),address,uint256)', + ); + return abiEncoder.getSelector(); + }, }; /** * Encode data for multiple assets, per the AssetProxy contract specification. @@ -3572,6 +3824,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('encodeMultiAssetData(uint256[],bytes[])'); + return abiEncoder.getSelector(); + }, }; /** * Fetches all order-relevant information needed to validate if the supplied orders are fillable. @@ -3780,6 +4040,16 @@ export class DevUtilsContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantStates((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Calls getBatchBalances() and getBatchAllowances() for each element of assetData. @@ -3883,6 +4153,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('getBatchBalancesAndAssetProxyAllowances(address,bytes[])'); + return abiEncoder.getSelector(); + }, }; /** * Fetches all order-relevant information needed to validate if the supplied order is fillable. @@ -4073,6 +4351,16 @@ export class DevUtilsContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderRelevantState((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', + ); + return abiEncoder.getSelector(); + }, }; /** * Decompose an ABI-encoded OrderStatusError. @@ -4157,6 +4445,14 @@ export class DevUtilsContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[number, string, string]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DevUtilsContract; + const abiEncoder = self._lookupAbiEncoder('decodeExchangeInvalidContextError(bytes)'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts index 2892e15965..7227a59d37 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts @@ -133,6 +133,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('name()'); + return abiEncoder.getSelector(); + }, }; /** * `msg.sender` approves `_spender` to spend `_value` tokens @@ -344,6 +352,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Query total supply of token @@ -426,6 +442,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('totalSupply()'); + return abiEncoder.getSelector(); + }, }; /** * ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. See https://github.com/ethereum/EIPs/issues/717 @@ -661,6 +685,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; public decimals = { /** @@ -739,6 +771,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('decimals()'); + return abiEncoder.getSelector(); + }, }; /** * Query the balance of owner @@ -829,6 +869,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -907,6 +955,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; public symbol = { /** @@ -985,6 +1041,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('symbol()'); + return abiEncoder.getSelector(); + }, }; /** * Mints new tokens for sender @@ -1158,6 +1222,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * send `value` token to `to` from `msg.sender` @@ -1356,6 +1428,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public allowance = { /** @@ -1454,6 +1534,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); + return abiEncoder.getSelector(); + }, }; /** * Sets the balance of target address @@ -1664,6 +1752,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1828,6 +1924,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; public MAX_MINT_AMOUNT = { /** @@ -1906,6 +2010,14 @@ export class DummyERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts index 7dea2ffa46..90815bd46a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts @@ -143,6 +143,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('name()'); + return abiEncoder.getSelector(); + }, }; /** * Throws if `_tokenId` is not a valid NFT. @@ -233,6 +241,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * The zero address indicates there is no approved address. @@ -445,6 +461,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -682,6 +706,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Function to mint a new token @@ -884,6 +916,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * This works identically to the other function with an extra data parameter, @@ -1119,6 +1159,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * NFTs assigned to zero address are considered invalid, and queries @@ -1210,6 +1258,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * NFTs assigned to the zero address are considered invalid, and this @@ -1301,6 +1357,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -1379,6 +1443,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; public symbol = { /** @@ -1457,6 +1529,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('symbol()'); + return abiEncoder.getSelector(); + }, }; /** * Function to burn a token @@ -1659,6 +1739,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Emits the ApprovalForAll event. The contract MUST allow @@ -1874,6 +1962,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + return abiEncoder.getSelector(); + }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -2138,6 +2234,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + return abiEncoder.getSelector(); + }, }; public isApprovedForAll = { /** @@ -2236,6 +2340,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -2400,6 +2512,14 @@ export class DummyERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DummyERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts index 24bb4d63e6..d958edbacc 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts @@ -361,6 +361,16 @@ export class DutchAuctionContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DutchAuctionContract; + const abiEncoder = self._lookupAbiEncoder( + 'getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', + ); + return abiEncoder.getSelector(); + }, }; /** * Matches the buy and sell orders at an amount given the following: the current block time, the auction @@ -881,6 +891,16 @@ export class DutchAuctionContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as DutchAuctionContract; + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)', + ); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts index 11d53c51d4..eb63ce79d8 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc1155_proxy.ts @@ -227,6 +227,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public authorities = { /** @@ -311,6 +319,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -483,6 +499,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -561,6 +585,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -779,6 +811,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Transfers batch of ERC1155 assets. Either succeeds or throws. @@ -1041,6 +1081,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -1115,6 +1163,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public authorized = { /** @@ -1201,6 +1257,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + return abiEncoder.getSelector(); + }, }; /** * Gets all authorized addresses. @@ -1283,6 +1347,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1447,6 +1519,14 @@ export class ERC1155ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC1155ProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts index fa1552e437..b0f08a78cf 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts @@ -227,6 +227,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public authorities = { /** @@ -311,6 +319,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -483,6 +499,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -561,6 +585,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -779,6 +811,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -853,6 +893,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public authorized = { /** @@ -939,6 +987,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + return abiEncoder.getSelector(); + }, }; /** * Gets all authorized addresses. @@ -1021,6 +1077,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1185,6 +1249,14 @@ export class ERC20ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20ProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts index a3be8999e6..4182b0b3a3 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts @@ -266,6 +266,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Query total supply of token @@ -348,6 +356,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('totalSupply()'); + return abiEncoder.getSelector(); + }, }; /** * send `value` token to `to` from `from` on the condition it is approved by `from` @@ -583,6 +599,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Query the balance of owner @@ -673,6 +697,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; /** * send `value` token to `to` from `msg.sender` @@ -871,6 +903,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public allowance = { /** @@ -969,6 +1009,14 @@ export class ERC20TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC20TokenContract; + const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts index 267a0272b6..09440dd1ef 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts @@ -227,6 +227,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public authorities = { /** @@ -311,6 +319,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -483,6 +499,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -561,6 +585,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -779,6 +811,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -853,6 +893,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public authorized = { /** @@ -939,6 +987,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + return abiEncoder.getSelector(); + }, }; /** * Gets all authorized addresses. @@ -1021,6 +1077,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1185,6 +1249,14 @@ export class ERC721ProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721ProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts index 41f8ef098d..6135475b33 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts @@ -155,6 +155,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * The zero address indicates there is no approved address. @@ -367,6 +375,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -604,6 +620,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * This works identically to the other function with an extra data parameter, @@ -839,6 +863,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * NFTs assigned to zero address are considered invalid, and queries @@ -930,6 +962,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * NFTs assigned to the zero address are considered invalid, and this @@ -1021,6 +1061,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; /** * Emits the ApprovalForAll event. The contract MUST allow @@ -1236,6 +1284,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); + return abiEncoder.getSelector(); + }, }; /** * Throws unless `msg.sender` is the current owner, an authorized @@ -1500,6 +1556,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); + return abiEncoder.getSelector(); + }, }; public isApprovedForAll = { /** @@ -1598,6 +1662,14 @@ export class ERC721TokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ERC721TokenContract; + const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts index faea6c7071..0a033c5474 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/eth_balance_checker.ts @@ -119,6 +119,14 @@ export class EthBalanceCheckerContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as EthBalanceCheckerContract; + const abiEncoder = self._lookupAbiEncoder('getEthBalances(address[])'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts index 461e8cf4f0..c0a1b6ebd2 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts @@ -198,6 +198,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('transactionsExecuted(bytes32)'); + return abiEncoder.getSelector(); + }, }; public protocolFeeMultiplier = { /** @@ -276,6 +284,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('protocolFeeMultiplier()'); + return abiEncoder.getSelector(); + }, }; /** * Executes an Exchange method call in the context of signer. @@ -541,6 +557,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'executeTransaction((uint256,uint256,uint256,address,bytes),bytes)', + ); + return abiEncoder.getSelector(); + }, }; public filled = { /** @@ -625,6 +651,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); + return abiEncoder.getSelector(); + }, }; public cancelled = { /** @@ -709,6 +743,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); + return abiEncoder.getSelector(); + }, }; /** * After calling, the order can not be filled anymore. @@ -1033,6 +1075,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', + ); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of fillOrder until total amount of takerAsset is sold by taker. @@ -1431,6 +1483,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Approves a hash on-chain. @@ -1602,6 +1664,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('preSign(bytes32)'); + return abiEncoder.getSelector(); + }, }; /** * Cancels all orders created by makerAddress with a salt less than or equal to the targetOrderEpoch @@ -1787,6 +1857,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets an asset proxy. @@ -1877,6 +1955,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); + return abiEncoder.getSelector(); + }, }; /** * Match complementary orders that have a profitable spread. @@ -2444,6 +2530,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchMatchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Match complementary orders that have a profitable spread. @@ -3010,6 +3106,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchMatchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Approves/unnapproves a Validator contract to verify signatures on signer's behalf @@ -3229,6 +3335,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of fillOrder until total amount of makerAsset is bought by taker. @@ -3627,6 +3741,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', + ); + return abiEncoder.getSelector(); + }, }; public allowedValidators = { /** @@ -3720,6 +3844,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); + return abiEncoder.getSelector(); + }, }; /** * Verifies that a hash has been signed by the given signer. @@ -3827,6 +3959,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('isValidHashSignature(bytes32,address,bytes)'); + return abiEncoder.getSelector(); + }, }; public preSigned = { /** @@ -3920,6 +4060,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); + return abiEncoder.getSelector(); + }, }; public protocolFeeCollector = { /** @@ -3998,6 +4146,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('protocolFeeCollector()'); + return abiEncoder.getSelector(); + }, }; /** * Match two complementary orders that have a profitable spread. @@ -4537,6 +4693,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', + ); + return abiEncoder.getSelector(); + }, }; /** * Calls marketBuyOrdersNoThrow then reverts if < makerAssetFillAmount has been bought. @@ -4934,6 +5100,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Verifies that a signature for a transaction is valid. @@ -5068,6 +5244,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'isValidTransactionSignature((uint256,uint256,uint256,address,bytes),bytes)', + ); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -5146,6 +5332,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of fillOrder. If any fill reverts, the error is caught and ignored. @@ -5553,6 +5747,16 @@ export class ExchangeContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Allows the owner to update the protocol fee multiplier. @@ -5750,6 +5954,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('setProtocolFeeMultiplier(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of fillOrder. @@ -6157,6 +6369,16 @@ export class ExchangeContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Fills the input order. @@ -6541,6 +6763,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', + ); + return abiEncoder.getSelector(); + }, }; /** * Gets information about an order: status, hash, and amount filled. @@ -6713,6 +6945,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes))', + ); + return abiEncoder.getSelector(); + }, }; /** * Verifies that a signature for an order is valid. @@ -6883,6 +7125,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'isValidOrderSignature((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes)', + ); + return abiEncoder.getSelector(); + }, }; /** * Calls marketSellOrdersNoThrow then reverts if < takerAssetFillAmount has been sold. @@ -7280,6 +7532,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersFillOrKill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * This function may be used to simulate any amount of transfers As they would occur through the Exchange contract. Note that this function will always revert, even if all transfers are successful. However, it may be used with eth_call or with a try/catch pattern in order to simulate the results of the transfers. @@ -7570,6 +7832,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'simulateDispatchTransferFromCalls(bytes[],address[],address[],uint256[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Match two complementary orders that have a profitable spread. @@ -8115,6 +8387,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'matchOrdersWithMaximalFill((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),bytes,bytes)', + ); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of fillOrKillOrder. @@ -8522,6 +8804,16 @@ export class ExchangeContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Allows the owner to update the protocolFeeCollector address. @@ -8724,6 +9016,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('setProtocolFeeCollectorAddress(address)'); + return abiEncoder.getSelector(); + }, }; public EIP712_EXCHANGE_DOMAIN_HASH = { /** @@ -8802,6 +9102,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('EIP712_EXCHANGE_DOMAIN_HASH()'); + return abiEncoder.getSelector(); + }, }; /** * Registers an asset proxy to its asset proxy id. @@ -8982,6 +9290,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); + return abiEncoder.getSelector(); + }, }; public orderEpoch = { /** @@ -9075,6 +9391,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); + return abiEncoder.getSelector(); + }, }; public EIP1271_MAGIC_VALUE = { /** @@ -9153,6 +9477,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('EIP1271_MAGIC_VALUE()'); + return abiEncoder.getSelector(); + }, }; /** * Executes multiple calls of cancelOrder. @@ -9484,6 +9816,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[])', + ); + return abiEncoder.getSelector(); + }, }; /** * Fills the input order. Reverts if exact takerAssetFillAmount not filled. @@ -9872,6 +10214,16 @@ export class ExchangeContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes),uint256,bytes)', + ); + return abiEncoder.getSelector(); + }, }; public currentContextAddress = { /** @@ -9950,6 +10302,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -10114,6 +10474,14 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; /** * Executes a batch of Exchange method calls in the context of signer(s). @@ -10395,6 +10763,16 @@ export class ExchangeContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ExchangeContract; + const abiEncoder = self._lookupAbiEncoder( + 'batchExecuteTransactions((uint256,uint256,uint256,address,bytes)[],bytes[])', + ); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts index f41353fa3c..b2889a9415 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts @@ -206,6 +206,14 @@ export class ForwarderContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder('approveMakerAssetProxy(bytes)'); + return abiEncoder.getSelector(); + }, }; /** * Withdraws assets from this contract. The contract formerly required a ZRX balance in order @@ -409,6 +417,14 @@ export class ForwarderContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -487,6 +503,14 @@ export class ForwarderContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Attempt to buy makerAssetBuyAmount of makerAsset by selling ETH provided with transaction. @@ -927,6 +951,16 @@ export class ForwarderContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],uint256,bytes[],uint256,address)', + ); + return abiEncoder.getSelector(); + }, }; /** * Purchases as much of orders' makerAssets as possible by selling as much of the ETH value sent @@ -1344,6 +1378,16 @@ export class ForwarderContract extends BaseContract { ); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder( + 'marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes,bytes,bytes)[],bytes[],uint256,address)', + ); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1508,6 +1552,14 @@ export class ForwarderContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ForwarderContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts index c609bc220c..c84a9e9fba 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_asset_proxy.ts @@ -280,6 +280,14 @@ export class IAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as IAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -354,6 +362,14 @@ export class IAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as IAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts index 05a99e2ba2..dfc2526eaf 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts @@ -136,6 +136,14 @@ export class IValidatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as IValidatorContract; + const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts index 05e5680ed8..cf236cb184 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts @@ -126,6 +126,14 @@ export class IWalletContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as IWalletContract; + const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts index 37561182f3..8b8bdc372d 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts @@ -142,6 +142,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); + return abiEncoder.getSelector(); + }, }; /** * Authorizes an address. @@ -314,6 +322,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public authorities = { /** @@ -398,6 +414,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets an asset proxy. @@ -488,6 +512,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -660,6 +692,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); + return abiEncoder.getSelector(); + }, }; public owner = { /** @@ -738,6 +778,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('owner()'); + return abiEncoder.getSelector(); + }, }; /** * Removes authorizion of an address. @@ -956,6 +1004,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -1030,6 +1086,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public authorized = { /** @@ -1116,6 +1180,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('authorized(address)'); + return abiEncoder.getSelector(); + }, }; /** * Registers an asset proxy to its asset proxy id. @@ -1296,6 +1368,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); + return abiEncoder.getSelector(); + }, }; /** * Gets all authorized addresses. @@ -1378,6 +1458,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); + return abiEncoder.getSelector(); + }, }; public transferOwnership = { /** @@ -1542,6 +1630,14 @@ export class MultiAssetProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as MultiAssetProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts index b899390542..3d937dfda6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts @@ -246,6 +246,16 @@ export class OrderValidatorContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); + return abiEncoder.getSelector(); + }, }; public getBalanceAndAllowance = { /** @@ -339,6 +349,14 @@ export class OrderValidatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); + return abiEncoder.getSelector(); + }, }; public getOrdersAndTradersInfo = { /** @@ -559,6 +577,16 @@ export class OrderValidatorContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); + return abiEncoder.getSelector(); + }, }; public getTradersInfo = { /** @@ -761,6 +789,16 @@ export class OrderValidatorContract extends BaseContract { >(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', + ); + return abiEncoder.getSelector(); + }, }; public getERC721TokenOwner = { /** @@ -854,6 +892,14 @@ export class OrderValidatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public getBalancesAndAllowances = { /** @@ -947,6 +993,14 @@ export class OrderValidatorContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]]>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); + return abiEncoder.getSelector(); + }, }; public getTraderInfo = { /** @@ -1139,6 +1193,16 @@ export class OrderValidatorContract extends BaseContract { }>(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as OrderValidatorContract; + const abiEncoder = self._lookupAbiEncoder( + 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', + ); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts index 85b1510578..fc47480ae6 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/static_call_proxy.ts @@ -143,6 +143,14 @@ export class StaticCallProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as StaticCallProxyContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(bytes,address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; /** * Gets the proxy id associated with the proxy address. @@ -217,6 +225,14 @@ export class StaticCallProxyContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as StaticCallProxyContract; + const abiEncoder = self._lookupAbiEncoder('getProxyId()'); + return abiEncoder.getSelector(); + }, }; public static async deployFrom0xArtifactAsync( artifact: ContractArtifact | SimpleContractArtifact, diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts index 46cf789600..b41f62be0c 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts @@ -149,6 +149,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('name()'); + return abiEncoder.getSelector(); + }, }; public approve = { /** @@ -329,6 +337,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public totalSupply = { /** @@ -407,6 +423,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('totalSupply()'); + return abiEncoder.getSelector(); + }, }; public transferFrom = { /** @@ -623,6 +647,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; public withdraw = { /** @@ -785,6 +817,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); + return abiEncoder.getSelector(); + }, }; public decimals = { /** @@ -863,6 +903,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('decimals()'); + return abiEncoder.getSelector(); + }, }; public balanceOf = { /** @@ -949,6 +997,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; public symbol = { /** @@ -1027,6 +1083,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('symbol()'); + return abiEncoder.getSelector(); + }, }; public transfer = { /** @@ -1207,6 +1271,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public deposit = { /** @@ -1363,6 +1435,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('deposit()'); + return abiEncoder.getSelector(); + }, }; public allowance = { /** @@ -1456,6 +1536,14 @@ export class WETH9Contract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as WETH9Contract; + const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts index 74d1eb0f0a..b11022135a 100644 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts @@ -133,6 +133,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('name()'); + return abiEncoder.getSelector(); + }, }; public approve = { /** @@ -330,6 +338,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public totalSupply = { /** @@ -408,6 +424,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('totalSupply()'); + return abiEncoder.getSelector(); + }, }; /** * ERC20 transferFrom, modified such that an allowance of MAX_UINT represents an unlimited allowance. @@ -643,6 +667,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); + return abiEncoder.getSelector(); + }, }; public decimals = { /** @@ -721,6 +753,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('decimals()'); + return abiEncoder.getSelector(); + }, }; public balanceOf = { /** @@ -805,6 +845,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); + return abiEncoder.getSelector(); + }, }; public symbol = { /** @@ -883,6 +931,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('symbol()'); + return abiEncoder.getSelector(); + }, }; public transfer = { /** @@ -1067,6 +1123,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); + return abiEncoder.getSelector(); + }, }; public allowance = { /** @@ -1160,6 +1224,14 @@ export class ZRXTokenContract extends BaseContract { const abiDecodedReturnData = abiEncoder.strictDecodeReturnValue(returnData); return abiDecodedReturnData; }, + /** + * Returns the 4 byte function selector as a hex string. + */ + getSelector(): string { + const self = (this as any) as ZRXTokenContract; + const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); + return abiEncoder.getSelector(); + }, }; private readonly _subscriptionManager: SubscriptionManager; public static async deployFrom0xArtifactAsync( From b281b9aac8cbd59bd4cf0fdbfa07b226b62a9951 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 29 Sep 2019 23:06:21 -0700 Subject: [PATCH 03/12] Update 3.0 testnet addresses --- packages/contract-addresses/src/index.ts | 36 ++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 61320fcb0c..09bc80df65 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -6,6 +6,7 @@ export interface ContractAddresses { zrxToken: string; etherToken: string; exchange: string; + exchange_v3: string; assetProxyOwner: string; forwarder: string; orderValidator: string; @@ -16,6 +17,10 @@ export interface ContractAddresses { staticCallProxy: string; erc1155Proxy: string; devUtils: string; + zrxVault: string; + readOnlyProxy: string; + staking: string; + stakingProxy: string; } export enum NetworkId { @@ -31,6 +36,7 @@ const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; const networkToAddresses: { [networkId: number]: ContractAddresses } = { 1: { exchange: '0x080bf510fcbf18b91105470639e9561022937712', + exchange_v3: '', erc20Proxy: '0x95e6f48254609a6ee006f7d493c8e5fb97094cef', erc721Proxy: '0xefc70a1b18c432bdc64b596838b4d138f6bc6cad', forwarder: '0x76481caa104b5f6bccb540dae4cefaf1c398ebea', @@ -45,6 +51,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { staticCallProxy: '0x3517b88c19508c08650616019062b898ab65ed29', erc1155Proxy: '0x7eefbd48fd63d441ec7435d024ec7c5131019add', devUtils: '0x92d9a4d50190ae04e03914db2ee650124af844e6', + zrxVault: '', + readOnlyProxy: '', + staking: '', + stakingProxy: '', }, 3: { erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa', @@ -52,7 +62,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { zrxToken: '0xff67881f8d12f372d91baae9752eb3631ff0ed00', etherToken: '0xc778417e063141139fce010982780140aa0cd5ab', exchange: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', - assetProxyOwner: '0xf5fa5b5fed2727a0e44ac67f6772e97977aa358b', + exchange_v3: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6', + assetProxyOwner: '0xdcf20f7b447d51f2b3e5499b7f6cbbf7295a5d26', forwarder: '0x1ebdc9758e85c1c6a85af06cc96cf89000a31913', orderValidator: '0x6eb6237350f3c110c96223e6ff9db55532525d2b', dutchAuction: '0xe5f862f7811af180990025b6259b02feb0a0b8dc', @@ -62,14 +73,19 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { staticCallProxy: '0xe1b97e47aa3796276033a5341e884d2ba46b6ac1', erc1155Proxy: '0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d', devUtils: '0x3e0b46bad8e374e4a110c12b832cb120dbe4a479', + zrxVault: '0xffd161026865ad8b4ab28a76840474935eec4dfa', + readOnlyProxy: '0x8e1dfaf747b804d041adaed79d68dcef85b8de85', + staking: '0xb2ca5824630e526f0f3181a4ea0447c795a84411', + stakingProxy: '0x5d751aa855a1aee5fe44cf5350ed25b5727b66ae', }, 4: { exchange: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', + exchange_v3: '0x8e1dfaf747b804d041adaed79d68dcef85b8de85', erc20Proxy: '0x2f5ae4f6106e89b4147651688a92256885c5f410', erc721Proxy: '0x7656d773e11ff7383a14dcf09a9c50990481cd10', zrxToken: '0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa', etherToken: '0xc778417e063141139fce010982780140aa0cd5ab', - assetProxyOwner: '0xe1703da878afcebff5b7624a826902af475b9c03', + assetProxyOwner: '0x5d751aa855a1aee5fe44cf5350ed25b5727b66ae', forwarder: '0x1ebdc9758e85c1c6a85af06cc96cf89000a31913', orderValidator: '0x6eb6237350f3c110c96223e6ff9db55532525d2b', dutchAuction: '0xe5f862f7811af180990025b6259b02feb0a0b8dc', @@ -79,6 +95,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { staticCallProxy: '0xe1b97e47aa3796276033a5341e884d2ba46b6ac1', erc1155Proxy: '0x19bb6caa3bc34d39e5a23cedfa3e6c7e7f3c931d', devUtils: '0x2d4a9abda7b8b3605c8dbd34e3550a7467c78287', + zrxVault: '0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224', + readOnlyProxy: '0xffd161026865ad8b4ab28a76840474935eec4dfa', + staking: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6', + stakingProxy: '0xb2ca5824630e526f0f3181a4ea0447c795a84411', }, 42: { erc20Proxy: '0xf1ec01d6236d3cd881a0bf0130ea25fe4234003e', @@ -86,7 +106,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { zrxToken: '0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa', etherToken: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', exchange: '0x30589010550762d2f0d06f650d8e8b6ade6dbf4b', - assetProxyOwner: '0x2c824d2882baa668e0d5202b1e7f2922278703f8', + exchange_v3: '0x617602cd3f734cf1e028c96b3f54c0489bed8022', + assetProxyOwner: '0x3654e5363cd75c8974c76208137df9691e820e97', forwarder: '0x1ebdc9758e85c1c6a85af06cc96cf89000a31913', orderValidator: '0xbcd49bf9b75cab056610fab3c788e8ce1b209f30', dutchAuction: '0xe5f862f7811af180990025b6259b02feb0a0b8dc', @@ -96,6 +117,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { staticCallProxy: '0x48e94bdb9033640d45ea7c721e25f380f8bffa43', erc1155Proxy: '0x64517fa2b480ba3678a2a3c0cf08ef7fd4fad36f', devUtils: '0xb1863ac46ae23ec55d6eeb8ecc8815655ee638a8', + zrxVault: '0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291', + readOnlyProxy: '0x25397d8aa7e6844dae70ee658fe072d45d6cf528', + staking: '0xa9290221e4632394e0209abe893a90f5445e1f23', + stakingProxy: '0x9e7eef766702c3d9056a3de779e5d9d976bc3bdb', }, // NetworkId 50 represents our Ganache snapshot generated from migrations. 50: { @@ -105,6 +130,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c', etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082', exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788', + exchange_v3: '', assetProxyOwner: '0x8d42e38980ce74736c21c059b2240df09958d3c8', forwarder: '0xaa86dda78e9434aca114b6676fc742a18d15a1cc', orderValidator: '0x4d3d5c850dd5bd9d6f4adda3dd039a3c8054ca29', @@ -114,6 +140,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db', staticCallProxy: '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f', devUtils: '0x38ef19fdf8e8415f18c307ed71967e19aac28ba1', + zrxVault: '', + readOnlyProxy: '', + staking: '', + stakingProxy: '', }, }; From 57ec0858fe3f2f54bbb962301d717825fa381841 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 29 Sep 2019 23:07:13 -0700 Subject: [PATCH 04/12] Fix migrations build --- packages/migrations/src/migration.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index db3a1a7239..fb667c7665 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -317,6 +317,11 @@ export async function runMigrationsAsync( multiAssetProxy: multiAssetProxy.address, staticCallProxy: staticCallProxy.address, devUtils: devUtils.address, + exchange_v3: '', + zrxVault: '', + readOnlyProxy: '', + staking: '', + stakingProxy: '', }; return contractAddresses; From 76724a6c73c2d3711d5da614f347512bcbbd7cfd Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Sun, 29 Sep 2019 23:27:32 -0700 Subject: [PATCH 05/12] Implement initial 3.0 migrations script --- packages/migrations/package.json | 4 + packages/migrations/src/testnet_migrations.ts | 242 +++++++++++++++++- packages/migrations/src/utils/constants.ts | 1 + .../migrations/src/utils/provider_factory.ts | 14 - packages/order-utils/package.json | 1 - 5 files changed, 240 insertions(+), 22 deletions(-) diff --git a/packages/migrations/package.json b/packages/migrations/package.json index 35da5f5611..effa10c1ca 100644 --- a/packages/migrations/package.json +++ b/packages/migrations/package.json @@ -59,6 +59,10 @@ "@0x/base-contract": "^5.4.0", "@0x/contract-addresses": "^3.2.0", "@0x/contract-artifacts": "^2.2.2", + "@0x/contracts-multisig": "^3.1.14", + "@0x/contracts-staking": "^1.0.0", + "@0x/contracts-exchange": "^2.1.14", + "@0x/contracts-utils": "^3.2.4", "@0x/sol-compiler": "^3.1.15", "@0x/subproviders": "^5.0.4", "@0x/typescript-typings": "^4.3.0", diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index 466cbcb91f..f6f257a420 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -1,21 +1,249 @@ import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses'; -import { AssetProxyOwnerContract, ERC20ProxyContract } from '@0x/contract-wrappers'; -import { artifacts, AssetProxyOwnerContract as GovernanceMultisigContract } from '@0x/contracts-multisig'; -import { AbiEncoder, BigNumber, providerUtils } from '@0x/utils'; +import { artifacts as exchangeArtifacts, ExchangeContract } from '@0x/contracts-exchange'; +import { artifacts, AssetProxyOwnerContract, AssetProxyOwnerSubmissionEventArgs } from '@0x/contracts-multisig'; +import { + artifacts as stakingArtifacts, + ReadOnlyProxyContract, + StakingContract, + StakingProxyContract, + ZrxVaultContract, +} from '@0x/contracts-staking'; +import { IAuthorizableContract, IOwnableContract } from '@0x/contracts-utils'; +import { AbiEncoder, BigNumber, logUtils, providerUtils } from '@0x/utils'; import { Web3Wrapper } from '@0x/web3-wrapper'; -import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; +import { LogWithDecodedArgs, SupportedProvider, TxData } from 'ethereum-types'; + +import { constants } from './utils/constants'; +import { providerFactory } from './utils/provider_factory'; + +export async function submitAndExecuteTransactionAsync( + assetProxyOwner: AssetProxyOwnerContract, + destination: string, + data: string, +): Promise { + const txReceipt = await assetProxyOwner.submitTransaction.awaitTransactionSuccessAsync( + destination, + constants.ZERO_AMOUNT, + data, + ); + const txId = (txReceipt.logs[0] as LogWithDecodedArgs).args.transactionId; + logUtils.log(`${txId} submitted`); + await assetProxyOwner.executeTransaction.awaitTransactionSuccessAsync(txId); + logUtils.log(`${txId} executed`); +} export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise { const provider = providerUtils.standardizeOrThrow(supportedProvider); const web3Wrapper = new Web3Wrapper(provider); - const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider)); const networkId = await web3Wrapper.getNetworkIdAsync(); + const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider)); const deployedAddresses = getContractAddressesForNetworkOrThrow(networkId); - // const noTimeLockMethods = [{destination: }] - const governanceMultisig = await GovernanceMultisigContract.deployFrom0xArtifactAsync( + + const zrxVault = new ZrxVaultContract(deployedAddresses.zrxVault, provider, txDefaults); + + const stakingLogic = await StakingContract.deployFrom0xArtifactAsync( + stakingArtifacts.Staking, + provider, + txDefaults, + stakingArtifacts, + ); + + const exchange = await ExchangeContract.deployFrom0xArtifactAsync( + exchangeArtifacts.Exchange, + provider, + txDefaults, + exchangeArtifacts, + chainId, + ); + + const readOnlyProxy = await ReadOnlyProxyContract.deployFrom0xArtifactAsync( + stakingArtifacts.ReadOnlyProxy, + provider, + txDefaults, + stakingArtifacts, + ); + + const stakingProxy = await StakingProxyContract.deployFrom0xArtifactAsync( + stakingArtifacts.StakingProxy, + provider, + txDefaults, + stakingArtifacts, + stakingLogic.address, + readOnlyProxy.address, + ); + + const authorizableInterface = new IAuthorizableContract(constants.NULL_ADDRESS, provider, txDefaults); + const ownableInterface = new IOwnableContract(constants.NULL_ADDRESS, provider, txDefaults); + + const customTimeLocks = [ + { + destination: deployedAddresses.erc20Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddress.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.erc20Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddressAtIndex.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.erc721Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddress.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.erc721Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddressAtIndex.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.erc1155Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddress.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.erc1155Proxy, + functionSelector: authorizableInterface.removeAuthorizedAddressAtIndex.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.multiAssetProxy, + functionSelector: authorizableInterface.removeAuthorizedAddress.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.multiAssetProxy, + functionSelector: authorizableInterface.removeAuthorizedAddressAtIndex.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.stakingProxy, + functionSelector: stakingProxy.setReadOnlyMode.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.zrxVault, + functionSelector: zrxVault.enterCatastrophicFailure.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, + }, + { + destination: deployedAddresses.stakingProxy, + functionSelector: stakingProxy.attachStakingContract.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, // 3 epochs on mainnet + }, + { + destination: deployedAddresses.stakingProxy, + functionSelector: stakingLogic.setParams.getSelector(), + secondsTimeLocked: constants.ZERO_AMOUNT, // 1 epoch on mainnet + }, + ]; + + const assetProxyOwner = await AssetProxyOwnerContract.deployFrom0xArtifactAsync( artifacts.AssetProxyOwner, provider, txDefaults, artifacts, + customTimeLocks.map(timeLockInfo => timeLockInfo.functionSelector), + customTimeLocks.map(timeLockInfo => timeLockInfo.destination), + customTimeLocks.map(timeLockInfo => timeLockInfo.secondsTimeLocked), + constants.ASSET_PROXY_OWNER_OWNERS, + constants.ASSET_PROXY_OWNER_CONFIRMATIONS, + constants.ASSET_PROXY_OWNER_TIMELOCK, + ); + + logUtils.log('Configuring Exchange...'); + await exchange.setProtocolFeeCollectorAddress.awaitTransactionSuccessAsync(stakingProxy.address); + await exchange.setProtocolFeeMultiplier.awaitTransactionSuccessAsync(new BigNumber(150000)); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(deployedAddresses.erc20Proxy); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(deployedAddresses.erc721Proxy); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(deployedAddresses.erc1155Proxy); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(deployedAddresses.multiAssetProxy); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(deployedAddresses.staticCallProxy); + await exchange.transferOwnership.awaitTransactionSuccessAsync(assetProxyOwner.address); + logUtils.log('Exchange configured!'); + + logUtils.log('Configuring ZrxVault...'); + await zrxVault.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyOwner.address); + logUtils.log('ZrxVault configured!'); + + logUtils.log('Configuring StakingProxy...'); + await stakingProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(assetProxyOwner.address); + logUtils.log('StakingProxy configured!'); + + logUtils.log('Transfering ownership of 2.0 contracts...'); + const oldAssetProxyOwner = new AssetProxyOwnerContract(deployedAddresses.assetProxyOwner, provider, txDefaults); + await submitAndExecuteTransactionAsync( + oldAssetProxyOwner, + deployedAddresses.exchange, // Exchange 2.1 address + ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), + ); + await submitAndExecuteTransactionAsync( + oldAssetProxyOwner, + deployedAddresses.erc20Proxy, + ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), + ); + await submitAndExecuteTransactionAsync( + oldAssetProxyOwner, + deployedAddresses.erc721Proxy, + ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), ); + await submitAndExecuteTransactionAsync( + oldAssetProxyOwner, + deployedAddresses.erc1155Proxy, + ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), + ); + await submitAndExecuteTransactionAsync( + oldAssetProxyOwner, + deployedAddresses.multiAssetProxy, + ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), + ); + logUtils.log('Ownership transferred!'); + + const functionCalls = [ + { + destination: zrxVault.address, + data: zrxVault.setStakingProxy.getABIEncodedTransactionData(stakingProxy.address), + }, + { + destination: stakingProxy.address, + data: stakingLogic.addExchangeAddress.getABIEncodedTransactionData(exchange.address), + }, + { + destination: deployedAddresses.erc20Proxy, + data: authorizableInterface.addAuthorizedAddress.getABIEncodedTransactionData(exchange.address), + }, + { + destination: deployedAddresses.erc20Proxy, + data: authorizableInterface.addAuthorizedAddress.getABIEncodedTransactionData(zrxVault.address), + }, + { + destination: deployedAddresses.erc721Proxy, + data: authorizableInterface.addAuthorizedAddress.getABIEncodedTransactionData(exchange.address), + }, + { + destination: deployedAddresses.erc1155Proxy, + data: authorizableInterface.addAuthorizedAddress.getABIEncodedTransactionData(exchange.address), + }, + { + destination: deployedAddresses.multiAssetProxy, + data: authorizableInterface.addAuthorizedAddress.getABIEncodedTransactionData(exchange.address), + }, + ]; + const batchTransactionEncoder = AbiEncoder.create('(bytes[],address[],uint256[])'); + const batchTransactionData = batchTransactionEncoder.encode([ + functionCalls.map(item => item.data), + functionCalls.map(item => item.destination), + functionCalls.map(() => constants.ZERO_AMOUNT), + ]); + await submitAndExecuteTransactionAsync(assetProxyOwner, assetProxyOwner.address, batchTransactionData); } + +(async () => { + const networkId = 3; + const rpcUrl = 'https://ropsten.infura.io/v3/'; + const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl); + await runMigrationsAsync(provider, { from: constants.ASSET_PROXY_OWNER_OWNERS[0], gasPrice: 40000000000 }); +})().catch(err => { + logUtils.log(err); + process.exit(1); +}); diff --git a/packages/migrations/src/utils/constants.ts b/packages/migrations/src/utils/constants.ts index 8b16a0520b..15629e870e 100644 --- a/packages/migrations/src/utils/constants.ts +++ b/packages/migrations/src/utils/constants.ts @@ -15,4 +15,5 @@ export const constants = { KOVAN_NETWORK_ID: 42, MAINNET_RPC_URL: 'https://mainnet.infura.io/', MAINNET_NETWORK_ID: 1, + ZERO_AMOUNT: new BigNumber(0), }; diff --git a/packages/migrations/src/utils/provider_factory.ts b/packages/migrations/src/utils/provider_factory.ts index 6cb6b03031..0806981fb7 100644 --- a/packages/migrations/src/utils/provider_factory.ts +++ b/packages/migrations/src/utils/provider_factory.ts @@ -5,8 +5,6 @@ import Eth from '@ledgerhq/hw-app-eth'; import TransportNodeHid from '@ledgerhq/hw-transport-node-hid'; import { Provider } from 'ethereum-types'; -import { constants } from './constants'; - async function ledgerEthereumNodeJsClientFactoryAsync(): Promise { const ledgerConnection = await TransportNodeHid.create(); const ledgerEthClient = new Eth(ledgerConnection); @@ -25,16 +23,4 @@ export const providerFactory = { providerUtils.startProviderEngine(provider); return provider; }, - async getMainnetLedgerProviderAsync(): Promise { - const provider = new Web3ProviderEngine(); - const ledgerWalletConfigs = { - networkId: constants.MAINNET_NETWORK_ID, - ledgerEthereumClientFactoryAsync: ledgerEthereumNodeJsClientFactoryAsync, - }; - const ledgerSubprovider = new LedgerSubprovider(ledgerWalletConfigs); - provider.addProvider(ledgerSubprovider); - provider.addProvider(new RPCSubprovider(constants.MAINNET_RPC_URL)); - providerUtils.startProviderEngine(provider); - return provider; - }, }; diff --git a/packages/order-utils/package.json b/packages/order-utils/package.json index fc94fb7717..702502b5d1 100644 --- a/packages/order-utils/package.json +++ b/packages/order-utils/package.json @@ -40,7 +40,6 @@ "homepage": "https://github.com/0xProject/0x-monorepo/packages/order-utils/README.md", "devDependencies": { "@0x/dev-utils": "^2.3.3", - "@0x/migrations": "^4.3.2", "@0x/subproviders": "^5.0.4", "@0x/ts-doc-gen": "^0.0.22", "@0x/tslint-config": "^3.0.1", From b5492bb0239a8f8290f6cb311914e763a4c65f16 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 09:40:14 -0700 Subject: [PATCH 06/12] Add ZrxVault testnet addresses to deployment constants --- .../src/immutable/MixinDeploymentConstants.sol | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/contracts/staking/contracts/src/immutable/MixinDeploymentConstants.sol b/contracts/staking/contracts/src/immutable/MixinDeploymentConstants.sol index 6aa23444b3..70735152c7 100644 --- a/contracts/staking/contracts/src/immutable/MixinDeploymentConstants.sol +++ b/contracts/staking/contracts/src/immutable/MixinDeploymentConstants.sol @@ -28,16 +28,24 @@ contract MixinDeploymentConstants { // @TODO SET THESE VALUES FOR DEPLOYMENT // Mainnet WETH9 Address - address constant private WETH_ADDRESS = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); + // address constant private WETH_ADDRESS = address(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); // Kovan WETH9 Address - // address constant private WETH_ADDRESS = address(0xd0a1e359811322d97991e03f863a0c30c2cf029c); + // address constant private WETH_ADDRESS = address(0xd0A1E359811322d97991E03f863a0C30C2cF029C); // Ropsten & Rinkeby WETH9 Address - // address constant private WETH_ADDRESS = address(0xc778417e063141139fce010982780140aa0cd5ab); + address constant private WETH_ADDRESS = address(0xc778417E063141139Fce010982780140Aa0cD5Ab); // @TODO SET THESE VALUES FOR DEPLOYMENT - address constant private ZRX_VAULT_ADDRESS = address(1); + + // Kovan ZrxVault address + // address constant private ZRX_VAULT_ADDRESS = address(0xf36eabdFE986B35b62c8FD5a98A7f2aEBB79B291); + + // Ropsten ZrxVault address + address constant private ZRX_VAULT_ADDRESS = address(0xffD161026865Ad8B4aB28a76840474935eEc4DfA); + + // Rinkeby ZrxVault address + // address constant private ZRX_VAULT_ADDRESS = address(0xA5Bf6aC73bC40790FC6Ffc9DBbbCE76c9176e224); /// @dev An overridable way to access the deployed WETH contract. /// Must be view to allow overrides to access state. From 9d4010299a7c0122cfe180353dc2a247ba441495 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 09:51:28 -0700 Subject: [PATCH 07/12] Cleanup migration scripts --- packages/contract-addresses/src/index.ts | 16 ++-- packages/migrations/src/migration.ts | 81 ++++++------------- packages/migrations/src/testnet_migrations.ts | 4 + 3 files changed, 36 insertions(+), 65 deletions(-) diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 09bc80df65..52449c9415 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -51,10 +51,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { staticCallProxy: '0x3517b88c19508c08650616019062b898ab65ed29', erc1155Proxy: '0x7eefbd48fd63d441ec7435d024ec7c5131019add', devUtils: '0x92d9a4d50190ae04e03914db2ee650124af844e6', - zrxVault: '', - readOnlyProxy: '', - staking: '', - stakingProxy: '', + zrxVault: NULL_ADDRESS, + readOnlyProxy: NULL_ADDRESS, + staking: NULL_ADDRESS, + stakingProxy: NULL_ADDRESS, }, 3: { erc20Proxy: '0xb1408f4c245a23c31b98d2c626777d4c0d766caa', @@ -140,10 +140,10 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { multiAssetProxy: '0xcfc18cec799fbd1793b5c43e773c98d4d61cc2db', staticCallProxy: '0x6dfff22588be9b3ef8cf0ad6dc9b84796f9fb45f', devUtils: '0x38ef19fdf8e8415f18c307ed71967e19aac28ba1', - zrxVault: '', - readOnlyProxy: '', - staking: '', - stakingProxy: '', + zrxVault: NULL_ADDRESS, + readOnlyProxy: NULL_ADDRESS, + staking: NULL_ADDRESS, + stakingProxy: NULL_ADDRESS, }, }; diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index fb667c7665..9fc228034b 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -7,6 +7,7 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { MethodAbi, SupportedProvider, TxData } from 'ethereum-types'; import * as _ from 'lodash'; +import { constants } from './utils/constants'; import { erc20TokenInfo, erc721TokenInfo } from './utils/token_info'; // HACK (xianny): Copied from @0x/order-utils to get rid of circular dependency @@ -142,58 +143,26 @@ export async function runMigrationsAsync( artifacts, ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, txDefaults), - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, txDefaults); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, txDefaults); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, txDefaults); + await multiAssetProxy.addAuthorizedAddress.awaitTransactionSuccessAsync(exchange.address, txDefaults); // MultiAssetProxy - await web3Wrapper.awaitTransactionSuccessAsync( - await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await erc1155Proxy.addAuthorizedAddress.sendTransactionAsync(multiAssetProxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(erc1155Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await multiAssetProxy.registerAssetProxy.sendTransactionAsync(staticCallProxy.address, txDefaults), - ); + await erc20Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, txDefaults); + await erc721Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, txDefaults); + await erc1155Proxy.addAuthorizedAddress.awaitTransactionSuccessAsync(multiAssetProxy.address, txDefaults); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, txDefaults); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, txDefaults); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address, txDefaults); + await multiAssetProxy.registerAssetProxy.awaitTransactionSuccessAsync(staticCallProxy.address, txDefaults); // Register the Asset Proxies to the Exchange - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync(erc20Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync(erc721Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync(erc1155Proxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync(multiAssetProxy.address, txDefaults), - ); - await web3Wrapper.awaitTransactionSuccessAsync( - await exchange.registerAssetProxy.sendTransactionAsync(staticCallProxy.address, txDefaults), - ); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc20Proxy.address, txDefaults); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc721Proxy.address, txDefaults); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(erc1155Proxy.address, txDefaults); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(multiAssetProxy.address, txDefaults); + await exchange.registerAssetProxy.awaitTransactionSuccessAsync(staticCallProxy.address, txDefaults); // Forwarder const forwarder = await wrappers.ForwarderContract.deployFrom0xArtifactAsync( @@ -270,9 +239,7 @@ export async function runMigrationsAsync( // Fund the Forwarder with ZRX const zrxDecimals = await zrxToken.decimals.callAsync(); const zrxForwarderAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(5000), zrxDecimals); - await web3Wrapper.awaitTransactionSuccessAsync( - await zrxToken.transfer.sendTransactionAsync(forwarder.address, zrxForwarderAmount, txDefaults), - ); + await zrxToken.transfer.awaitTransactionSuccessAsync(forwarder.address, zrxForwarderAmount, txDefaults); // CoordinatorRegistry const coordinatorRegistry = await wrappers.CoordinatorRegistryContract.deployFrom0xArtifactAsync( @@ -308,7 +275,7 @@ export async function runMigrationsAsync( etherToken: etherToken.address, exchange: exchange.address, // TODO (xianny): figure out how to deploy AssetProxyOwnerContract - assetProxyOwner: '0x0000000000000000000000000000000000000000', + assetProxyOwner: constants.NULL_ADDRESS, forwarder: forwarder.address, orderValidator: orderValidator.address, dutchAuction: dutchAuction.address, @@ -317,11 +284,11 @@ export async function runMigrationsAsync( multiAssetProxy: multiAssetProxy.address, staticCallProxy: staticCallProxy.address, devUtils: devUtils.address, - exchange_v3: '', - zrxVault: '', - readOnlyProxy: '', - staking: '', - stakingProxy: '', + exchange_v3: constants.NULL_ADDRESS, + zrxVault: constants.NULL_ADDRESS, + readOnlyProxy: constants.NULL_ADDRESS, + staking: constants.NULL_ADDRESS, + stakingProxy: constants.NULL_ADDRESS, }; return contractAddresses; diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index f6f257a420..679ad6d7ac 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -39,8 +39,12 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t const chainId = new BigNumber(await providerUtils.getChainIdAsync(provider)); const deployedAddresses = getContractAddressesForNetworkOrThrow(networkId); + // NOTE: This must be deployed before running these migrations, since its address is hard coded in the + // staking logic contract. const zrxVault = new ZrxVaultContract(deployedAddresses.zrxVault, provider, txDefaults); + // NOTE: This may need to be deployed in its own step, since this contract requires a smaller + // amount of optimizer runs in order to deploy below the codesize limit. const stakingLogic = await StakingContract.deployFrom0xArtifactAsync( stakingArtifacts.Staking, provider, From ba5c702a9e16265918b7c280ee0b67feba1edb42 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 09:57:13 -0700 Subject: [PATCH 08/12] Update CHANGELOGs --- packages/abi-gen/CHANGELOG.json | 9 +++++++++ packages/contract-addresses/CHANGELOG.json | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/packages/abi-gen/CHANGELOG.json b/packages/abi-gen/CHANGELOG.json index 72342560f5..556623cd7e 100644 --- a/packages/abi-gen/CHANGELOG.json +++ b/packages/abi-gen/CHANGELOG.json @@ -1,4 +1,13 @@ [ + { + "version": "4.3.0", + "changes": [ + { + "note": "Add `getSelector` method to all functions", + "pr": 2224 + } + ] + }, { "version": "4.2.1", "changes": [ diff --git a/packages/contract-addresses/CHANGELOG.json b/packages/contract-addresses/CHANGELOG.json index 52e66e4cf2..784a6273a3 100644 --- a/packages/contract-addresses/CHANGELOG.json +++ b/packages/contract-addresses/CHANGELOG.json @@ -5,6 +5,14 @@ { "note": "Removed `getNetworkIdByExchangeAddressOrThrow`. It's not needed with V3 tooling.", "pr": 2170 + }, + { + "note": "Add `zrxVault`, `readOnlyProxy`, `staking`, and `stakingProxy` schema with addresses for each tesnet", + "pr": 2224 + }, + { + "note": "Update `assetProxyOwner` address for each testnet", + "pr": 2224 } ] }, From cfb099c65c4fabdf1df0e647271d662a5bbd6b77 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 10:02:48 -0700 Subject: [PATCH 09/12] Fix linting errors --- packages/migrations/src/testnet_migrations.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index 679ad6d7ac..587079dfc6 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -16,7 +16,7 @@ import { LogWithDecodedArgs, SupportedProvider, TxData } from 'ethereum-types'; import { constants } from './utils/constants'; import { providerFactory } from './utils/provider_factory'; -export async function submitAndExecuteTransactionAsync( +async function submitAndExecuteTransactionAsync( assetProxyOwner: AssetProxyOwnerContract, destination: string, data: string, @@ -26,12 +26,18 @@ export async function submitAndExecuteTransactionAsync( constants.ZERO_AMOUNT, data, ); + // tslint:disable-next-line:no-unnecessary-type-assertion const txId = (txReceipt.logs[0] as LogWithDecodedArgs).args.transactionId; logUtils.log(`${txId} submitted`); await assetProxyOwner.executeTransaction.awaitTransactionSuccessAsync(txId); logUtils.log(`${txId} executed`); } +/** + * Deploys all 3.0 contracts and reconfigures existing 2.0 contracts. + * @param supportedProvider Web3 provider instance. Your provider instance should connect to the testnet you want to deploy to. + * @param txDefaults Default transaction values to use when deploying contracts (e.g., specify the desired contract creator with the `from` parameter). + */ export async function runMigrationsAsync(supportedProvider: SupportedProvider, txDefaults: TxData): Promise { const provider = providerUtils.standardizeOrThrow(supportedProvider); const web3Wrapper = new Web3Wrapper(provider); From ffcd297e5b4ccaf14c03264fba53ce54b867ef42 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Mon, 30 Sep 2019 21:03:27 -0700 Subject: [PATCH 10/12] Rename old exchange address to exchangeV2 --- packages/contract-addresses/src/index.ts | 22 +++++++++---------- packages/migrations/src/migration.ts | 2 +- packages/migrations/src/testnet_migrations.ts | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index 52449c9415..cfc3af8bb9 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -5,8 +5,8 @@ export interface ContractAddresses { erc721Proxy: string; zrxToken: string; etherToken: string; + exchangeV2: string; exchange: string; - exchange_v3: string; assetProxyOwner: string; forwarder: string; orderValidator: string; @@ -35,8 +35,8 @@ const NULL_ADDRESS = '0x0000000000000000000000000000000000000000'; const networkToAddresses: { [networkId: number]: ContractAddresses } = { 1: { - exchange: '0x080bf510fcbf18b91105470639e9561022937712', - exchange_v3: '', + exchangeV2: '0x080bf510fcbf18b91105470639e9561022937712', + exchange: NULL_ADDRESS, erc20Proxy: '0x95e6f48254609a6ee006f7d493c8e5fb97094cef', erc721Proxy: '0xefc70a1b18c432bdc64b596838b4d138f6bc6cad', forwarder: '0x76481caa104b5f6bccb540dae4cefaf1c398ebea', @@ -61,8 +61,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { erc721Proxy: '0xe654aac058bfbf9f83fcaee7793311dd82f6ddb4', zrxToken: '0xff67881f8d12f372d91baae9752eb3631ff0ed00', etherToken: '0xc778417e063141139fce010982780140aa0cd5ab', - exchange: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', - exchange_v3: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6', + exchangeV2: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', + exchange: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6', assetProxyOwner: '0xdcf20f7b447d51f2b3e5499b7f6cbbf7295a5d26', forwarder: '0x1ebdc9758e85c1c6a85af06cc96cf89000a31913', orderValidator: '0x6eb6237350f3c110c96223e6ff9db55532525d2b', @@ -79,8 +79,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { stakingProxy: '0x5d751aa855a1aee5fe44cf5350ed25b5727b66ae', }, 4: { - exchange: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', - exchange_v3: '0x8e1dfaf747b804d041adaed79d68dcef85b8de85', + exchangeV2: '0xbff9493f92a3df4b0429b6d00743b3cfb4c85831', + exchange: '0x8e1dfaf747b804d041adaed79d68dcef85b8de85', erc20Proxy: '0x2f5ae4f6106e89b4147651688a92256885c5f410', erc721Proxy: '0x7656d773e11ff7383a14dcf09a9c50990481cd10', zrxToken: '0x8080c7e4b81ecf23aa6f877cfbfd9b0c228c6ffa', @@ -105,8 +105,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { erc721Proxy: '0x2a9127c745688a165106c11cd4d647d2220af821', zrxToken: '0x2002d3812f58e35f0ea1ffbf80a75a38c32175fa', etherToken: '0xd0a1e359811322d97991e03f863a0c30c2cf029c', - exchange: '0x30589010550762d2f0d06f650d8e8b6ade6dbf4b', - exchange_v3: '0x617602cd3f734cf1e028c96b3f54c0489bed8022', + exchangeV2: '0x30589010550762d2f0d06f650d8e8b6ade6dbf4b', + exchange: '0x617602cd3f734cf1e028c96b3f54c0489bed8022', assetProxyOwner: '0x3654e5363cd75c8974c76208137df9691e820e97', forwarder: '0x1ebdc9758e85c1c6a85af06cc96cf89000a31913', orderValidator: '0xbcd49bf9b75cab056610fab3c788e8ce1b209f30', @@ -129,8 +129,8 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { erc1155Proxy: '0x6a4a62e5a7ed13c361b176a5f62c2ee620ac0df8', zrxToken: '0x871dd7c2b4b25e1aa18728e9d5f2af4c4e431f5c', etherToken: '0x0b1ba0af832d7c05fd64161e0db78e85978e8082', - exchange: '0x48bacb9266a570d521063ef5dd96e61686dbe788', - exchange_v3: '', + exchangeV2: '0x48bacb9266a570d521063ef5dd96e61686dbe788', + exchange: NULL_ADDRESS, assetProxyOwner: '0x8d42e38980ce74736c21c059b2240df09958d3c8', forwarder: '0xaa86dda78e9434aca114b6676fc742a18d15a1cc', orderValidator: '0x4d3d5c850dd5bd9d6f4adda3dd039a3c8054ca29', diff --git a/packages/migrations/src/migration.ts b/packages/migrations/src/migration.ts index 9fc228034b..79a5bcdc70 100644 --- a/packages/migrations/src/migration.ts +++ b/packages/migrations/src/migration.ts @@ -284,7 +284,7 @@ export async function runMigrationsAsync( multiAssetProxy: multiAssetProxy.address, staticCallProxy: staticCallProxy.address, devUtils: devUtils.address, - exchange_v3: constants.NULL_ADDRESS, + exchangeV2: constants.NULL_ADDRESS, zrxVault: constants.NULL_ADDRESS, readOnlyProxy: constants.NULL_ADDRESS, staking: constants.NULL_ADDRESS, diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index 587079dfc6..7d185953fe 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -184,7 +184,7 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t const oldAssetProxyOwner = new AssetProxyOwnerContract(deployedAddresses.assetProxyOwner, provider, txDefaults); await submitAndExecuteTransactionAsync( oldAssetProxyOwner, - deployedAddresses.exchange, // Exchange 2.1 address + deployedAddresses.exchangeV2, // Exchange 2.1 address ownableInterface.transferOwnership.getABIEncodedTransactionData(assetProxyOwner.address), ); await submitAndExecuteTransactionAsync( From 650efb95e224696fa60db641a21dd77237f30aa0 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Tue, 1 Oct 2019 22:18:09 -0700 Subject: [PATCH 11/12] Add more contract configs tests --- packages/contract-addresses/src/index.ts | 4 +- .../migrations/src/test_contract_configs.ts | 362 +++++++++++------- packages/migrations/src/testnet_migrations.ts | 6 +- 3 files changed, 235 insertions(+), 137 deletions(-) diff --git a/packages/contract-addresses/src/index.ts b/packages/contract-addresses/src/index.ts index cfc3af8bb9..d0bf29f7e0 100644 --- a/packages/contract-addresses/src/index.ts +++ b/packages/contract-addresses/src/index.ts @@ -97,7 +97,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { devUtils: '0x2d4a9abda7b8b3605c8dbd34e3550a7467c78287', zrxVault: '0xa5bf6ac73bc40790fc6ffc9dbbbce76c9176e224', readOnlyProxy: '0xffd161026865ad8b4ab28a76840474935eec4dfa', - staking: '0x725bc2f8c85ed0289d3da79cde3125d33fc1d7e6', + staking: '0x8ec5a989a06432dace637c8d592727627a45a592', stakingProxy: '0xb2ca5824630e526f0f3181a4ea0447c795a84411', }, 42: { @@ -119,7 +119,7 @@ const networkToAddresses: { [networkId: number]: ContractAddresses } = { devUtils: '0xb1863ac46ae23ec55d6eeb8ecc8815655ee638a8', zrxVault: '0xf36eabdfe986b35b62c8fd5a98a7f2aebb79b291', readOnlyProxy: '0x25397d8aa7e6844dae70ee658fe072d45d6cf528', - staking: '0xa9290221e4632394e0209abe893a90f5445e1f23', + staking: '0xd67f2f346f6e85db70632d9f18f50e04192ab54d', stakingProxy: '0x9e7eef766702c3d9056a3de779e5d9d976bc3bdb', }, // NetworkId 50 represents our Ganache snapshot generated from migrations. diff --git a/packages/migrations/src/test_contract_configs.ts b/packages/migrations/src/test_contract_configs.ts index 08ad3cfe4e..ea145bc975 100644 --- a/packages/migrations/src/test_contract_configs.ts +++ b/packages/migrations/src/test_contract_configs.ts @@ -1,6 +1,8 @@ #!/usr/bin/env node import * as wrappers from '@0x/abi-gen-wrappers'; import { getContractAddressesForNetworkOrThrow } from '@0x/contract-addresses'; +import { ExchangeContract } from '@0x/contracts-exchange'; +import { StakingContract, StakingProxyContract, ZrxVaultContract } from '@0x/contracts-staking'; import { EmptyWalletSubprovider, RPCSubprovider, Web3ProviderEngine } from '@0x/subproviders'; import { AssetProxyId } from '@0x/types'; import { logUtils, providerUtils } from '@0x/utils'; @@ -8,11 +10,13 @@ import { Web3Wrapper } from '@0x/web3-wrapper'; import { SupportedProvider } from 'ethereum-types'; // NOTE: add your own Infura Project ID to RPC urls before running +const INFURA_PROJECT_ID = ''; + const networkIdToRpcUrl = { - 1: 'https://mainnet.infura.io/v3/', - 3: 'https://ropsten.infura.io/v3/', - 4: 'https://rinkeby.infura.io/v3/', - 42: 'https://kovan.infura.io/v3/', + 1: `https://mainnet.infura.io/v3/${INFURA_PROJECT_ID}`, + 3: `https://ropsten.infura.io/v3/${INFURA_PROJECT_ID}`, + 4: `https://rinkeby.infura.io/v3/${INFURA_PROJECT_ID}`, + 42: `https://kovan.infura.io/v3/${INFURA_PROJECT_ID}`, }; async function testContractConfigsAsync(provider: SupportedProvider): Promise { @@ -26,140 +30,234 @@ async function testContractConfigsAsync(provider: SupportedProvider): Promise { + const exchangeOwner = await exchangeV2.owner.callAsync(); + warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected ExchangeV2 owner'); + + const registeredERC20Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC20); + warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in ExchangeV2'); + + const registeredERC721Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC721); + warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in ExchangeV2'); + + const registeredERC1155Proxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.ERC1155); + warnIfMismatch( + registeredERC1155Proxy, + erc1155Proxy.address, + 'Unexpected ERC1155Proxy registered in ExchangeV2', + ); + + const registeredMultiAssetProxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.MultiAsset); + warnIfMismatch( + registeredMultiAssetProxy, + multiAssetProxy.address, + 'Unexpected MultiAssetProxy registered in ExchangeV2', + ); + + const registeredStaticCallProxy = await exchangeV2.getAssetProxy.callAsync(AssetProxyId.StaticCall); + warnIfMismatch( + registeredStaticCallProxy, + addresses.staticCallProxy, + 'Unexpected StaticCallProxy registered in ExchangeV2', + ); + } + + async function verifyExchangeV3ConfigsAsync(): Promise { + const exchangeOwner = await exchange.owner.callAsync(); + warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected Exchange owner'); + + const registeredERC20Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20); + warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in Exchange'); + + const registeredERC721Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721); + warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in Exchange'); + + const registeredERC1155Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155); + warnIfMismatch(registeredERC1155Proxy, erc1155Proxy.address, 'Unexpected ERC1155Proxy registered in Exchange'); + + const registeredMultiAssetProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.MultiAsset); + warnIfMismatch( + registeredMultiAssetProxy, + multiAssetProxy.address, + 'Unexpected MultiAssetProxy registered in Exchange', + ); + + const registeredStaticCallProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall); + warnIfMismatch( + registeredStaticCallProxy, + addresses.staticCallProxy, + 'Unexpected StaticCallProxy registered in Exchange', + ); + + const protocolFeeCollector = await exchange.protocolFeeCollector.callAsync(); + warnIfMismatch(protocolFeeCollector, addresses.stakingProxy, 'Unexpected StakingProxy attached to Exchange'); + + const protocolFeeMultiplier = await exchange.protocolFeeMultiplier.callAsync(); + warnIfMismatch(protocolFeeMultiplier.toString(), '150000', 'Unexpected protocolFeeMultiplier in Exchange'); + } + + async function verifyAssetProxyConfigsAsync(): Promise { + // Verify ERC20Proxy configs + const erc20ProxyOwner = await erc20Proxy.owner.callAsync(); + warnIfMismatch(erc20ProxyOwner, assetProxyOwner.address, 'Unexpected ERC20Proxy owner'); + + const erc20AuthorizedAddresses = await erc20Proxy.getAuthorizedAddresses.callAsync(); + warnIfMismatch(erc20AuthorizedAddresses.length, 4, 'Unexpected number of authorized addresses in ERC20Proxy'); + + const isExchangeV2AuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchangeV2.address); + warnIfMismatch(isExchangeV2AuthorizedInERC20Proxy, true, 'ExchangeV2 not authorized in ERC20Proxy'); + + const isExchangeAuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchange.address); + warnIfMismatch(isExchangeAuthorizedInERC20Proxy, true, 'Exchange not authorized in ERC20Proxy'); + + const isMAPAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(multiAssetProxy.address); + warnIfMismatch(isMAPAuthorizedInER20Proxy, true, 'MultiAssetProxy not authorized in ERC20Proxy'); + + const isZrxVaultAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(zrxVault.address); + warnIfMismatch(isZrxVaultAuthorizedInER20Proxy, true, 'ZrxVault not authorized in ERC20Proxy'); + + // Verify ERC721Proxy configs + const erc721ProxyOwner = await erc721Proxy.owner.callAsync(); + warnIfMismatch(erc721ProxyOwner, assetProxyOwner.address, 'Unexpected ERC721Proxy owner'); + + const erc721AuthorizedAddresses = await erc721Proxy.getAuthorizedAddresses.callAsync(); + warnIfMismatch(erc721AuthorizedAddresses.length, 3, 'Unexpected number of authorized addresses in ERC721Proxy'); + + const isExchangeV2AuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchangeV2.address); + warnIfMismatch(isExchangeV2AuthorizedInERC721Proxy, true, 'ExchangeV2 not authorized in ERC721Proxy'); + + const isExchangeAuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchange.address); + warnIfMismatch(isExchangeAuthorizedInERC721Proxy, true, 'Exchange not authorized in ERC721Proxy'); + + const isMAPAuthorizedInER721Proxy = await erc721Proxy.authorized.callAsync(multiAssetProxy.address); + warnIfMismatch(isMAPAuthorizedInER721Proxy, true, 'MultiAssetProxy not authorized in ERC721Proxy'); + + // Verify ERC1155Proxy configs + const erc1155ProxyOwner = await erc1155Proxy.owner.callAsync(); + warnIfMismatch(erc1155ProxyOwner, assetProxyOwner.address, 'Unexpected ERC1155Proxy owner'); + + const erc1155AuthorizedAddresses = await erc1155Proxy.getAuthorizedAddresses.callAsync(); + warnIfMismatch( + erc1155AuthorizedAddresses.length, + 3, + 'Unexpected number of authorized addresses in ERC1155Proxy', + ); + + const isExchangeV2AuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchangeV2.address); + warnIfMismatch(isExchangeV2AuthorizedInERC1155Proxy, true, 'ExchangeV2 not authorized in ERC1155Proxy'); + + const isExchangeAuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchange.address); + warnIfMismatch(isExchangeAuthorizedInERC1155Proxy, true, 'Exchange not authorized in ERC1155Proxy'); + + const isMAPAuthorizedInER1155Proxy = await erc1155Proxy.authorized.callAsync(multiAssetProxy.address); + warnIfMismatch(isMAPAuthorizedInER1155Proxy, true, 'MultiAssetProxy not authorized in ERC1155Proxy'); + + // Verify MultiAssetProxy configs + const multiAssetProxyOwner = await multiAssetProxy.owner.callAsync(); + warnIfMismatch(multiAssetProxyOwner, assetProxyOwner.address, 'Unexpected MultiAssetProxy owner'); + + const multiAssetProxyAuthorizedAddresses = await multiAssetProxy.getAuthorizedAddresses.callAsync(); + warnIfMismatch( + multiAssetProxyAuthorizedAddresses.length, + 2, + 'Unexpected number of authorized addresses in MultiAssetProxy', + ); + + const isExchangeV2AuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchangeV2.address); + warnIfMismatch(isExchangeV2AuthorizedInMultiAssetProxy, true, 'ExchangeV2 not authorized in MultiAssetProxy'); + + const isExchangeAuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchange.address); + warnIfMismatch(isExchangeAuthorizedInMultiAssetProxy, true, 'Exchange not authorized in MultiAssetProxy'); + + const registeredERC20ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC20); + warnIfMismatch( + registeredERC20ProxyInMAP, + erc20Proxy.address, + 'Unexpected ERC20Proxy registered in MultiAssetProxy', + ); + + const registeredERC721ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC721); + warnIfMismatch( + registeredERC721ProxyInMAP, + erc721Proxy.address, + 'Unexpected ERC721Proxy registered in MultiAssetProxy', + ); + + const registeredERC1155ProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.ERC1155); + warnIfMismatch( + registeredERC1155ProxyInMAP, + erc1155Proxy.address, + 'Unexpected ERC1155Proxy registered in MultiAssetProxy', + ); + + const registeredStaticCallProxyInMAP = await multiAssetProxy.getAssetProxy.callAsync(AssetProxyId.StaticCall); + warnIfMismatch( + registeredStaticCallProxyInMAP, + addresses.staticCallProxy, + 'Unexpected StaticCallProxy registered in MultiAssetProxy', + ); + } + + async function verifyStakingConfigsAsync(): Promise { + const stakingLogicAddress = await stakingProxy.stakingContract.callAsync(); + warnIfMismatch(stakingLogicAddress, addresses.staking, 'Unexpected Staking contract attached to StakingProxy'); + + const readOnlyProxy = await stakingProxy.readOnlyProxy.callAsync(); + warnIfMismatch(readOnlyProxy, addresses.readOnlyProxy, 'Unexpected ReadOnlyProxy set in StakingProxy'); + + const readOnlyCallee = await stakingProxy.readOnlyProxyCallee.callAsync(); + warnIfMismatch(readOnlyCallee, addresses.staking, 'Unexpected readOnlyProxyCallee'); + + const zrxVaultAddress = await stakingContract.getZrxVault.callAsync(); + warnIfMismatch(zrxVaultAddress, addresses.zrxVault, 'Unexpected ZrxVault set in Staking contract'); + + const wethAddress = await stakingContract.getWethContract.callAsync(); + warnIfMismatch(wethAddress, addresses.etherToken, 'Unexpected WETH contract set in Staking contract'); + + const stakingProxyOwner = await stakingProxy.owner.callAsync(); + warnIfMismatch(stakingProxyOwner, addresses.assetProxyOwner, 'Unexpected StakingProxy owner'); + + const zrxVaultOwner = await zrxVault.owner.callAsync(); + warnIfMismatch(zrxVaultOwner, addresses.assetProxyOwner, 'Unexpected ZrxVault owner'); + + const stakingProxyAuthorizedAddresses = await stakingProxy.getAuthorizedAddresses.callAsync(); + warnIfMismatch( + stakingProxyAuthorizedAddresses.length, + 1, + 'Unexpected number of authorized addresses in StakingProxy', + ); + const isAssetProxyOwnerAuthorizedInStakingProxy = await stakingProxy.authorized.callAsync( + addresses.assetProxyOwner, + ); + warnIfMismatch( + isAssetProxyOwnerAuthorizedInStakingProxy, + true, + 'AssetProxyOwner not authorized in StakingProxy', + ); + + const zrxVaultAuthorizedAddresses = await zrxVault.getAuthorizedAddresses.callAsync(); + warnIfMismatch(zrxVaultAuthorizedAddresses.length, 1, 'Unexpected number of authorized addresses in ZrxVault'); + const isAssetProxyOwnerAuthorizedInZrxVault = await zrxVault.authorized.callAsync(addresses.assetProxyOwner); + warnIfMismatch(isAssetProxyOwnerAuthorizedInZrxVault, true, 'AssetProxyOwner not authorized in ZrxVault'); + } + + async function verifyAssetProxyOwnerConfigsAsync(): Promise {} - // Verify Exchange configs - const exchangeOwner = await exchange.owner.callAsync(); - warnIfMismatch(exchangeOwner, assetProxyOwner.address, 'Unexpected Exchange owner'); - - const registeredERC20Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20); - warnIfMismatch(registeredERC20Proxy, erc20Proxy.address, 'Unexpected ERC20Proxy registered in Exchange'); - - const registeredERC721Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721); - warnIfMismatch(registeredERC721Proxy, erc721Proxy.address, 'Unexpected ERC721Proxy registered in Exchange'); - - const registeredERC1155Proxy = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155); - warnIfMismatch(registeredERC1155Proxy, erc1155Proxy.address, 'Unexpected ERC1155Proxy registered in Exchange'); - - const registeredMultiAssetProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.MultiAsset); - warnIfMismatch( - registeredMultiAssetProxy, - multiAssetProxy.address, - 'Unexpected MultiAssetProxy registered in Exchange', - ); - - const registeredStaticCallProxy = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall); - warnIfMismatch( - registeredStaticCallProxy, - addresses.staticCallProxy, - 'Unexpected StaticCallProxy registered in Exchange', - ); - - // Verify ERC20Proxy configs - const erc20ProxyOwner = await erc20Proxy.owner.callAsync(); - warnIfMismatch(erc20ProxyOwner, assetProxyOwner.address, 'Unexpected ERC20Proxy owner'); - - const erc20AuthorizedAddresses = await erc20Proxy.getAuthorizedAddresses.callAsync(); - warnIfMismatch(erc20AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC20Proxy'); - - const isExchangeAuthorizedInERC20Proxy = await erc20Proxy.authorized.callAsync(exchange.address); - warnIfMismatch(isExchangeAuthorizedInERC20Proxy, true, 'Exchange not authorized in ERC20Proxy'); - - const isMAPAuthorizedInER20Proxy = await erc20Proxy.authorized.callAsync(multiAssetProxy.address); - warnIfMismatch(isMAPAuthorizedInER20Proxy, true, 'MultiAssetProxy not authorized in ERC20Proxy'); - - // Verify ERC721Proxy configs - const erc721ProxyOwner = await erc721Proxy.owner.callAsync(); - warnIfMismatch(erc721ProxyOwner, assetProxyOwner.address, 'Unexpected ERC721Proxy owner'); - - const erc721AuthorizedAddresses = await erc721Proxy.getAuthorizedAddresses.callAsync(); - warnIfMismatch(erc721AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC721Proxy'); - - const isExchangeAuthorizedInERC721Proxy = await erc721Proxy.authorized.callAsync(exchange.address); - warnIfMismatch(isExchangeAuthorizedInERC721Proxy, true, 'Exchange not authorized in ERC721Proxy'); - - const isMAPAuthorizedInER721Proxy = await erc721Proxy.authorized.callAsync(multiAssetProxy.address); - warnIfMismatch(isMAPAuthorizedInER721Proxy, true, 'MultiAssetProxy not authorized in ERC721Proxy'); - - // Verify ERC1155Proxy configs - const erc1155ProxyOwner = await erc1155Proxy.owner.callAsync(); - warnIfMismatch(erc1155ProxyOwner, assetProxyOwner.address, 'Unexpected ERC1155Proxy owner'); - - const erc1155AuthorizedAddresses = await erc1155Proxy.getAuthorizedAddresses.callAsync(); - warnIfMismatch(erc1155AuthorizedAddresses.length, 2, 'Unexpected number of authorized addresses in ERC1155Proxy'); - - const isExchangeAuthorizedInERC1155Proxy = await erc1155Proxy.authorized.callAsync(exchange.address); - warnIfMismatch(isExchangeAuthorizedInERC1155Proxy, true, 'Exchange not authorized in ERC1155Proxy'); - - const isMAPAuthorizedInER1155Proxy = await erc1155Proxy.authorized.callAsync(multiAssetProxy.address); - warnIfMismatch(isMAPAuthorizedInER1155Proxy, true, 'MultiAssetProxy not authorized in ERC1155Proxy'); - - // Verify MultiAssetProxy configs - const multiAssetProxyOwner = await multiAssetProxy.owner.callAsync(); - warnIfMismatch(multiAssetProxyOwner, assetProxyOwner.address, 'Unexpected MultiAssetProxy owner'); - - const multiAssetProxyAuthorizedAddresses = await multiAssetProxy.getAuthorizedAddresses.callAsync(); - warnIfMismatch( - multiAssetProxyAuthorizedAddresses.length, - 1, - 'Unexpected number of authorized addresses in MultiAssetProxy', - ); - - const isExchangeAuthorizedInMultiAssetProxy = await multiAssetProxy.authorized.callAsync(exchange.address); - warnIfMismatch(isExchangeAuthorizedInMultiAssetProxy, true, 'Exchange not authorized in MultiAssetProxy'); - - const registeredERC20ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC20); - warnIfMismatch( - registeredERC20ProxyInMAP, - erc20Proxy.address, - 'Unexpected ERC20Proxy registered in MultiAssetProxy', - ); - - const registeredERC721ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC721); - warnIfMismatch( - registeredERC721ProxyInMAP, - erc721Proxy.address, - 'Unexpected ERC721Proxy registered in MultiAssetProxy', - ); - - const registeredERC1155ProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.ERC1155); - warnIfMismatch( - registeredERC1155ProxyInMAP, - erc1155Proxy.address, - 'Unexpected ERC1155Proxy registered in MultiAssetProxy', - ); - - const registeredStaticCallProxyInMAP = await exchange.getAssetProxy.callAsync(AssetProxyId.StaticCall); - warnIfMismatch( - registeredStaticCallProxyInMAP, - addresses.staticCallProxy, - 'Unexpected StaticCallProxy registered in MultiAssetProxy', - ); - - // Verify AssetProxyOwner configs - // TODO (xianny): re-enable when AssetProxyOwner contract is finalised - // const isERC20ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync(erc20Proxy.address); - // warnIfMismatch(isERC20ProxyRegisteredInAPOwner, true, 'ERC20Proxy not registered in AssetProxyOwner'); - - // const isERC721ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync( - // erc721Proxy.address, - // ); - // warnIfMismatch(isERC721ProxyRegisteredInAPOwner, true, 'ERC721Proxy not registered in AssetProxyOwner'); - - // const isERC1155ProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync( - // erc1155Proxy.address, - // ); - // warnIfMismatch(isERC1155ProxyRegisteredInAPOwner, true, 'ERC1155Proxy not registered in AssetProxyOwner'); - - // const isMultiAssetProxyRegisteredInAPOwner = await assetProxyOwner.getAssetProxy.callAsync( - // multiAssetProxy.address, - // ); - // warnIfMismatch(isMultiAssetProxyRegisteredInAPOwner, true, 'MultiAssetProxy not registered in AssetProxyOwner'); + await verifyExchangeV2ConfigsAsync(); + await verifyExchangeV3ConfigsAsync(); + await verifyAssetProxyConfigsAsync(); + await verifyStakingConfigsAsync(); } (async () => { diff --git a/packages/migrations/src/testnet_migrations.ts b/packages/migrations/src/testnet_migrations.ts index 7d185953fe..49c086a2d9 100644 --- a/packages/migrations/src/testnet_migrations.ts +++ b/packages/migrations/src/testnet_migrations.ts @@ -249,10 +249,10 @@ export async function runMigrationsAsync(supportedProvider: SupportedProvider, t } (async () => { - const networkId = 3; - const rpcUrl = 'https://ropsten.infura.io/v3/'; + const networkId = 4; + const rpcUrl = 'https://rinkeby.infura.io/v3/'; const provider = await providerFactory.getLedgerProviderAsync(networkId, rpcUrl); - await runMigrationsAsync(provider, { from: constants.ASSET_PROXY_OWNER_OWNERS[0], gasPrice: 40000000000 }); + await runMigrationsAsync(provider, { from: constants.ASSET_PROXY_OWNER_OWNERS[0], gasPrice: 60000000000 }); })().catch(err => { logUtils.log(err); process.exit(1); From 6be5552944fd7225adb6f8bb50b5a7577a92dda7 Mon Sep 17 00:00:00 2001 From: Amir Bandeali Date: Fri, 4 Oct 2019 17:17:07 -0700 Subject: [PATCH 12/12] fix static tests --- contracts/staking/package.json | 1 - packages/migrations/src/test_contract_configs.ts | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/contracts/staking/package.json b/contracts/staking/package.json index a168d7e721..838a32239c 100644 --- a/contracts/staking/package.json +++ b/contracts/staking/package.json @@ -55,7 +55,6 @@ "@0x/dev-utils": "^2.4.0-beta.0", "@0x/sol-compiler": "^3.2.0-beta.0", "@0x/tslint-config": "^3.0.1", - "@0x/utils": "^4.5.2", "@types/lodash": "4.14.104", "@types/node": "*", "chai": "^4.0.1", diff --git a/packages/migrations/src/test_contract_configs.ts b/packages/migrations/src/test_contract_configs.ts index ea145bc975..f22a601131 100644 --- a/packages/migrations/src/test_contract_configs.ts +++ b/packages/migrations/src/test_contract_configs.ts @@ -19,6 +19,7 @@ const networkIdToRpcUrl = { 42: `https://kovan.infura.io/v3/${INFURA_PROJECT_ID}`, }; +// tslint:disable:custom-no-magic-numbers async function testContractConfigsAsync(provider: SupportedProvider): Promise { const web3Wrapper = new Web3Wrapper(provider); const networkId = await web3Wrapper.getNetworkIdAsync(); @@ -252,12 +253,13 @@ async function testContractConfigsAsync(provider: SupportedProvider): Promise {} + // TODO: implement AssetProxyOwner config tests + // async function verifyAssetProxyOwnerConfigsAsync(): Promise {} await verifyExchangeV2ConfigsAsync(); await verifyExchangeV3ConfigsAsync(); - await verifyAssetProxyConfigsAsync(); await verifyStakingConfigsAsync(); + await verifyAssetProxyConfigsAsync(); } (async () => {