diff options
author | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-03 04:25:53 +0800 |
---|---|---|
committer | Alex Browne <stephenalexbrowne@gmail.com> | 2018-10-16 04:36:10 +0800 |
commit | 2aa73fc83962d421eae4447108a07a5d952b569d (patch) | |
tree | 04207da685b28ee3e8aa7b80a2e4a7624766d843 /packages/contracts | |
parent | 33335a67911655e7fedf723fc54ad09a1af73272 (diff) | |
download | dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar.gz dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar.bz2 dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar.lz dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar.xz dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.tar.zst dexon-sol-tools-2aa73fc83962d421eae4447108a07a5d952b569d.zip |
Add generated contract wrappers in contracts package to gitignore
Diffstat (limited to 'packages/contracts')
34 files changed, 0 insertions, 30010 deletions
diff --git a/packages/contracts/generated-wrappers/asset_proxy_owner.ts b/packages/contracts/generated-wrappers/asset_proxy_owner.ts deleted file mode 100644 index 4ecce79cf..000000000 --- a/packages/contracts/generated-wrappers/asset_proxy_owner.ts +++ /dev/null @@ -1,1876 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type AssetProxyOwnerEventArgs = - | AssetProxyOwnerAssetProxyRegistrationEventArgs - | AssetProxyOwnerConfirmationTimeSetEventArgs - | AssetProxyOwnerTimeLockChangeEventArgs - | AssetProxyOwnerConfirmationEventArgs - | AssetProxyOwnerRevocationEventArgs - | AssetProxyOwnerSubmissionEventArgs - | AssetProxyOwnerExecutionEventArgs - | AssetProxyOwnerExecutionFailureEventArgs - | AssetProxyOwnerDepositEventArgs - | AssetProxyOwnerOwnerAdditionEventArgs - | AssetProxyOwnerOwnerRemovalEventArgs - | AssetProxyOwnerRequirementChangeEventArgs; - -export enum AssetProxyOwnerEvents { - AssetProxyRegistration = 'AssetProxyRegistration', - ConfirmationTimeSet = 'ConfirmationTimeSet', - TimeLockChange = 'TimeLockChange', - Confirmation = 'Confirmation', - Revocation = 'Revocation', - Submission = 'Submission', - Execution = 'Execution', - ExecutionFailure = 'ExecutionFailure', - Deposit = 'Deposit', - OwnerAddition = 'OwnerAddition', - OwnerRemoval = 'OwnerRemoval', - RequirementChange = 'RequirementChange', -} - -export interface AssetProxyOwnerAssetProxyRegistrationEventArgs extends DecodedLogArgs { - assetProxyContract: string; - isRegistered: boolean; -} - -export interface AssetProxyOwnerConfirmationTimeSetEventArgs extends DecodedLogArgs { - transactionId: BigNumber; - confirmationTime: BigNumber; -} - -export interface AssetProxyOwnerTimeLockChangeEventArgs extends DecodedLogArgs { - secondsTimeLocked: BigNumber; -} - -export interface AssetProxyOwnerConfirmationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface AssetProxyOwnerRevocationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface AssetProxyOwnerSubmissionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface AssetProxyOwnerExecutionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface AssetProxyOwnerExecutionFailureEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface AssetProxyOwnerDepositEventArgs extends DecodedLogArgs { - sender: string; - value: BigNumber; -} - -export interface AssetProxyOwnerOwnerAdditionEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface AssetProxyOwnerOwnerRemovalEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface AssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArgs { - required: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class AssetProxyOwnerContract extends BaseContract { - public owners = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'owners(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'removeOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'revokeConfirmation(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isOwner = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmations = { - async callAsync( - index_0: BigNumber, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmations(uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeRemoveAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeRemoveAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public secondsTimeLocked = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'secondsTimeLocked()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionCount = { - async callAsync( - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getTransactionCount(bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount; - const encodedData = ethersFunction.encode([pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxyContract: string, - isRegistered: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxyContract, - isRegistered - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetProxyContract: string, - isRegistered: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetProxyContract: string, - isRegistered: boolean, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxyContract: string, - isRegistered: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'registerAssetProxy(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxyContract, - isRegistered - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public addOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'addOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isConfirmed = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isConfirmed(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeTimeLock = { - async sendTransactionAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind( - self, - _secondsTimeLocked - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _secondsTimeLocked: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'changeTimeLock(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock; - const encodedData = ethersFunction.encode([_secondsTimeLocked - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isAssetProxyRegistered = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'isAssetProxyRegistered(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isAssetProxyRegistered; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isAssetProxyRegistered'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmationCount = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getConfirmationCount(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'transactions(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOwners = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getOwners()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOwners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionIds = { - async callAsync( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber[] - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [from, - to, - pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [from, - to, - pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [from, - to, - pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds; - const encodedData = ethersFunction.encode([from, - to, - pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmations = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'getConfirmations(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactionCount = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'transactionCount()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _required: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'changeRequirement(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement; - const encodedData = ethersFunction.encode([_required - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public submitTransaction = { - async sendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, - destination, - value, - data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - destination: string, - value: BigNumber, - data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'submitTransaction(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction; - const encodedData = ethersFunction.encode([destination, - value, - data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmationTimes = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'confirmationTimes(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmationTimes; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'MAX_OWNER_COUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public required = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'required()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'required'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public replaceOwner = { - async sendTransactionAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, - owner, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'replaceOwner(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner; - const encodedData = ethersFunction.encode([owner, - newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as AssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const functionSignature = 'executeTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<AssetProxyOwnerContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return AssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, _owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<AssetProxyOwnerContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`AssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new AssetProxyOwnerContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('AssetProxyOwner', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/dummy_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_erc20_token.ts deleted file mode 100644 index bc463b5c8..000000000 --- a/packages/contracts/generated-wrappers/dummy_erc20_token.ts +++ /dev/null @@ -1,1044 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type DummyERC20TokenEventArgs = - | DummyERC20TokenTransferEventArgs - | DummyERC20TokenApprovalEventArgs; - -export enum DummyERC20TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface DummyERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface DummyERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyERC20TokenContract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'mint(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setBalance = { - async sendTransactionAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind( - self, - _target, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _target: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'setBalance(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance; - const encodedData = ethersFunction.encode([_target, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setBalance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as DummyERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const functionSignature = 'MAX_MINT_AMOUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyERC20TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return DummyERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name, -_symbol, -_decimals, -_totalSupply -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyERC20TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol, -_decimals, -_totalSupply -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, -_symbol, -_decimals, -_totalSupply -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol, -_decimals, -_totalSupply -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`DummyERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_name, -_symbol, -_decimals, -_totalSupply -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DummyERC20Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/dummy_erc721_receiver.ts b/packages/contracts/generated-wrappers/dummy_erc721_receiver.ts deleted file mode 100644 index 989b63824..000000000 --- a/packages/contracts/generated-wrappers/dummy_erc721_receiver.ts +++ /dev/null @@ -1,231 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type DummyERC721ReceiverEventArgs = - | DummyERC721ReceiverTokenReceivedEventArgs; - -export enum DummyERC721ReceiverEvents { - TokenReceived = 'TokenReceived', -} - -export interface DummyERC721ReceiverTokenReceivedEventArgs extends DecodedLogArgs { - operator: string; - from: string; - tokenId: BigNumber; - data: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyERC721ReceiverContract extends BaseContract { - public onERC721Received = { - async sendTransactionAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _from, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.onERC721Received.estimateGasAsync.bind( - self, - _operator, - _from, - _tokenId, - _data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - ): string { - const self = this as any as DummyERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721ReceiverContract; - const functionSignature = 'onERC721Received(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _from, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.onERC721Received; - const encodedData = ethersFunction.encode([_operator, - _from, - _tokenId, - _data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'onERC721Received'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<DummyERC721ReceiverContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return DummyERC721ReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<DummyERC721ReceiverContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`DummyERC721Receiver successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721ReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DummyERC721Receiver', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/dummy_erc721_token.ts b/packages/contracts/generated-wrappers/dummy_erc721_token.ts deleted file mode 100644 index b2110984d..000000000 --- a/packages/contracts/generated-wrappers/dummy_erc721_token.ts +++ /dev/null @@ -1,1326 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type DummyERC721TokenEventArgs = - | DummyERC721TokenTransferEventArgs - | DummyERC721TokenApprovalEventArgs - | DummyERC721TokenApprovalForAllEventArgs; - -export enum DummyERC721TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', - ApprovalForAll = 'ApprovalForAll', -} - -export interface DummyERC721TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _tokenId: BigNumber; -} - -export interface DummyERC721TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _approved: string; - _tokenId: BigNumber; -} - -export interface DummyERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { - _owner: string; - _operator: string; - _approved: boolean; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyERC721TokenContract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getApproved = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'getApproved(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved; - const encodedData = ethersFunction.encode([_tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getApproved'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _approved, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _approved: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_approved, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public mint = { - async sendTransactionAsync( - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _to, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _tokenId: BigNumber, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('mint(address,uint256)').inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(address,uint256)').functions.mint.encode([_to, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'mint(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_to, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public safeTransferFrom1 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public ownerOf = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'ownerOf(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf; - const encodedData = ethersFunction.encode([_tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public burn = { - async sendTransactionAsync( - _owner: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.burn.estimateGasAsync.bind( - self, - _owner, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _owner: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _owner: string, - _tokenId: BigNumber, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('burn(address,uint256)').inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('burn(address,uint256)').functions.burn.encode([_owner, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _owner: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'burn(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.burn; - const encodedData = ethersFunction.encode([_owner, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'burn'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public setApprovalForAll = { - async sendTransactionAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, - _operator, - _approved - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _operator: string, - _approved: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'setApprovalForAll(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll; - const encodedData = ethersFunction.encode([_operator, - _approved - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public safeTransferFrom2 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId, - _data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId, - _data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isApprovedForAll = { - async callAsync( - _owner: string, - _operator: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'isApprovedForAll(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _operator - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _operator - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _operator - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll; - const encodedData = ethersFunction.encode([_owner, - _operator - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as DummyERC721TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - ): Promise<DummyERC721TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return DummyERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name, -_symbol -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - ): Promise<DummyERC721TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, -_symbol -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`DummyERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyERC721TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_name, -_symbol -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DummyERC721Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts deleted file mode 100644 index dbfdcf061..000000000 --- a/packages/contracts/generated-wrappers/dummy_multiple_return_erc20_token.ts +++ /dev/null @@ -1,1044 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type DummyMultipleReturnERC20TokenEventArgs = - | DummyMultipleReturnERC20TokenTransferEventArgs - | DummyMultipleReturnERC20TokenApprovalEventArgs; - -export enum DummyMultipleReturnERC20TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface DummyMultipleReturnERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface DummyMultipleReturnERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyMultipleReturnERC20TokenContract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'mint(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setBalance = { - async sendTransactionAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind( - self, - _target, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _target: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'setBalance(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance; - const encodedData = ethersFunction.encode([_target, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setBalance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyMultipleReturnERC20TokenContract; - const functionSignature = 'MAX_MINT_AMOUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyMultipleReturnERC20TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return DummyMultipleReturnERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name, -_symbol, -_decimals, -_totalSupply -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyMultipleReturnERC20TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol, -_decimals, -_totalSupply -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, -_symbol, -_decimals, -_totalSupply -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol, -_decimals, -_totalSupply -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`DummyMultipleReturnERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyMultipleReturnERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_name, -_symbol, -_decimals, -_totalSupply -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DummyMultipleReturnERC20Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/dummy_no_return_erc20_token.ts b/packages/contracts/generated-wrappers/dummy_no_return_erc20_token.ts deleted file mode 100644 index ab5e2293d..000000000 --- a/packages/contracts/generated-wrappers/dummy_no_return_erc20_token.ts +++ /dev/null @@ -1,1044 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type DummyNoReturnERC20TokenEventArgs = - | DummyNoReturnERC20TokenTransferEventArgs - | DummyNoReturnERC20TokenApprovalEventArgs; - -export enum DummyNoReturnERC20TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface DummyNoReturnERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface DummyNoReturnERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class DummyNoReturnERC20TokenContract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.mint.estimateGasAsync.bind( - self, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _value: BigNumber, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('mint(uint256)').inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('mint(uint256)').functions.mint.encode([_value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'mint(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_value - ] = BaseContract._formatABIDataItemList(inputAbi, [_value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.mint; - const encodedData = ethersFunction.encode([_value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'mint'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setBalance = { - async sendTransactionAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setBalance.estimateGasAsync.bind( - self, - _target, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _target: string, - _value: BigNumber, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('setBalance(address,uint256)').inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setBalance(address,uint256)').functions.setBalance.encode([_target, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _target: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'setBalance(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_target, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_target, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_target, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setBalance; - const encodedData = ethersFunction.encode([_target, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setBalance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as DummyNoReturnERC20TokenContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyNoReturnERC20TokenContract; - const functionSignature = 'MAX_MINT_AMOUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_MINT_AMOUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_MINT_AMOUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyNoReturnERC20TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return DummyNoReturnERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _name, -_symbol, -_decimals, -_totalSupply -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _name: string, - _symbol: string, - _decimals: BigNumber, - _totalSupply: BigNumber, - ): Promise<DummyNoReturnERC20TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_name, -_symbol, -_decimals, -_totalSupply -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_name, -_symbol, -_decimals, -_totalSupply -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_name, -_symbol, -_decimals, -_totalSupply -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`DummyNoReturnERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DummyNoReturnERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_name, -_symbol, -_decimals, -_totalSupply -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DummyNoReturnERC20Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/erc20_proxy.ts b/packages/contracts/generated-wrappers/erc20_proxy.ts deleted file mode 100644 index f8c583c04..000000000 --- a/packages/contracts/generated-wrappers/erc20_proxy.ts +++ /dev/null @@ -1,649 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ERC20ProxyEventArgs = - | ERC20ProxyAuthorizedAddressAddedEventArgs - | ERC20ProxyAuthorizedAddressRemovedEventArgs; - -export enum ERC20ProxyEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', -} - -export interface ERC20ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ERC20ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC20ProxyContract extends BaseContract { - public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'addAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'authorities(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'removeAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - target, - index - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([target, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'getProxyId()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'authorized(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'getAuthorizedAddresses()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as ERC20ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC20ProxyContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ERC20ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC20ProxyContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ERC20Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ERC20Proxy', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/erc20_token.ts b/packages/contracts/generated-wrappers/erc20_token.ts deleted file mode 100644 index 3f8f9cd92..000000000 --- a/packages/contracts/generated-wrappers/erc20_token.ts +++ /dev/null @@ -1,556 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ERC20TokenEventArgs = - | ERC20TokenTransferEventArgs - | ERC20TokenApprovalEventArgs; - -export enum ERC20TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface ERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface ERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC20TokenContract extends BaseContract { - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC20TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC20TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ERC20Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/erc721_proxy.ts b/packages/contracts/generated-wrappers/erc721_proxy.ts deleted file mode 100644 index 5a2b38aec..000000000 --- a/packages/contracts/generated-wrappers/erc721_proxy.ts +++ /dev/null @@ -1,649 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ERC721ProxyEventArgs = - | ERC721ProxyAuthorizedAddressAddedEventArgs - | ERC721ProxyAuthorizedAddressRemovedEventArgs; - -export enum ERC721ProxyEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', -} - -export interface ERC721ProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface ERC721ProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC721ProxyContract extends BaseContract { - public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'addAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'authorities(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'removeAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - target, - index - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([target, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'getProxyId()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'authorized(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'getAuthorizedAddresses()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as ERC721ProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC721ProxyContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ERC721ProxyContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC721ProxyContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ERC721Proxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721ProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ERC721Proxy', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/erc721_token.ts b/packages/contracts/generated-wrappers/erc721_token.ts deleted file mode 100644 index 6c4aa644b..000000000 --- a/packages/contracts/generated-wrappers/erc721_token.ts +++ /dev/null @@ -1,893 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ERC721TokenEventArgs = - | ERC721TokenTransferEventArgs - | ERC721TokenApprovalEventArgs - | ERC721TokenApprovalForAllEventArgs; - -export enum ERC721TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', - ApprovalForAll = 'ApprovalForAll', -} - -export interface ERC721TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _tokenId: BigNumber; -} - -export interface ERC721TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _approved: string; - _tokenId: BigNumber; -} - -export interface ERC721TokenApprovalForAllEventArgs extends DecodedLogArgs { - _owner: string; - _operator: string; - _approved: boolean; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ERC721TokenContract extends BaseContract { - public getApproved = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'getApproved(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getApproved; - const encodedData = ethersFunction.encode([_tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getApproved'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _approved, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _approved: string, - _tokenId: BigNumber, - ): string { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_approved, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _approved: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_approved, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_approved, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_approved, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_approved, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public safeTransferFrom1 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom1.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - ): string { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256)').inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public ownerOf = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'ownerOf(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [_tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ownerOf; - const encodedData = ethersFunction.encode([_tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ownerOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setApprovalForAll = { - async sendTransactionAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setApprovalForAll.estimateGasAsync.bind( - self, - _operator, - _approved - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _operator: string, - _approved: boolean, - ): string { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('setApprovalForAll(address,bool)').inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setApprovalForAll(address,bool)').functions.setApprovalForAll.encode([_operator, - _approved - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _operator: string, - _approved: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'setApprovalForAll(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _approved - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _approved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _approved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setApprovalForAll; - const encodedData = ethersFunction.encode([_operator, - _approved - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setApprovalForAll'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public safeTransferFrom2 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.safeTransferFrom2.estimateGasAsync.bind( - self, - _from, - _to, - _tokenId, - _data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - ): string { - const self = this as any as ERC721TokenContract; - const inputAbi = self._lookupAbi('safeTransferFrom(address,address,uint256,bytes)').inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('safeTransferFrom(address,address,uint256,bytes)').functions.safeTransferFrom.encode([_from, - _to, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - _data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.safeTransferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _tokenId, - _data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'safeTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isApprovedForAll = { - async callAsync( - _owner: string, - _operator: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC721TokenContract; - const functionSignature = 'isApprovedForAll(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _operator - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _operator - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _operator - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isApprovedForAll; - const encodedData = ethersFunction.encode([_owner, - _operator - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isApprovedForAll'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC721TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ERC721TokenContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ERC721TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ERC721Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ERC721TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ERC721Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/exchange.ts b/packages/contracts/generated-wrappers/exchange.ts deleted file mode 100644 index 5d31030ce..000000000 --- a/packages/contracts/generated-wrappers/exchange.ts +++ /dev/null @@ -1,3079 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ExchangeEventArgs = - | ExchangeSignatureValidatorApprovalEventArgs - | ExchangeFillEventArgs - | ExchangeCancelEventArgs - | ExchangeCancelUpToEventArgs - | ExchangeAssetProxyRegisteredEventArgs; - -export enum ExchangeEvents { - SignatureValidatorApproval = 'SignatureValidatorApproval', - Fill = 'Fill', - Cancel = 'Cancel', - CancelUpTo = 'CancelUpTo', - AssetProxyRegistered = 'AssetProxyRegistered', -} - -export interface ExchangeSignatureValidatorApprovalEventArgs extends DecodedLogArgs { - signerAddress: string; - validatorAddress: string; - approved: boolean; -} - -export interface ExchangeFillEventArgs extends DecodedLogArgs { - makerAddress: string; - feeRecipientAddress: string; - takerAddress: string; - senderAddress: string; - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - orderHash: string; - makerAssetData: string; - takerAssetData: string; -} - -export interface ExchangeCancelEventArgs extends DecodedLogArgs { - makerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - orderHash: string; - makerAssetData: string; - takerAssetData: string; -} - -export interface ExchangeCancelUpToEventArgs extends DecodedLogArgs { - makerAddress: string; - senderAddress: string; - orderEpoch: BigNumber; -} - -export interface ExchangeAssetProxyRegisteredEventArgs extends DecodedLogArgs { - id: string; - assetProxy: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ExchangeContract extends BaseContract { - public filled = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ExchangeContract; - const functionSignature = 'filled(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.filled; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'filled'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public batchFillOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelled = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const functionSignature = 'cancelled(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelled; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelled'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public preSign = { - async sendTransactionAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind( - self, - hash, - signerAddress, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'preSign(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public matchOrders = { - async sendTransactionAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - leftOrder, - rightOrder, - leftSignature, - rightSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = '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)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders; - const encodedData = ethersFunction.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrderNoThrow = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderNoThrow; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public assetProxies = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'assetProxies(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public batchCancelOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind( - self, - orders - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'batchCancelOrders(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchCancelOrders; - const encodedData = ethersFunction.encode([orders - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public batchFillOrKillOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrKillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrKillOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind( - self, - targetOrderEpoch - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - targetOrderEpoch: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - return abiEncodedTransactionData; - }, - async callAsync( - targetOrderEpoch: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'cancelOrdersUpTo(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo; - const encodedData = ethersFunction.encode([targetOrderEpoch - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public batchFillOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'batchFillOrdersNoThrow(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAssetProxy = { - async callAsync( - assetProxyId: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'getAssetProxy(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyId - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy; - const encodedData = ethersFunction.encode([assetProxyId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const functionSignature = 'transactions(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrKillOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrKillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setSignatureValidatorApproval = { - async sendTransactionAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, - validatorAddress, - approval - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - return abiEncodedTransactionData; - }, - async callAsync( - validatorAddress: string, - approval: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'setSignatureValidatorApproval(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval; - const encodedData = ethersFunction.encode([validatorAddress, - approval - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public allowedValidators = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const functionSignature = 'allowedValidators(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketSellOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'marketSellOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getOrdersInfo = { - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}> - > { - const self = this as any as ExchangeContract; - const functionSignature = 'getOrdersInfo(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersInfo; - const encodedData = ethersFunction.encode([orders - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public preSigned = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const functionSignature = 'preSigned(bytes32,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isValidSignature = { - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketBuyOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'marketBuyOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - makerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - salt, - signerAddress, - data, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([salt, - signerAddress, - data, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxy: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'registerAssetProxy(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxy - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOrderInfo = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'getOrderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderInfo; - const encodedData = ethersFunction.encode([order - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind( - self, - order - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrder; - const encodedData = ethersFunction.encode([order - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public orderEpoch = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ExchangeContract; - const functionSignature = 'orderEpoch(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.orderEpoch; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public ZRX_ASSET_DATA = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'ZRX_ASSET_DATA()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ZRX_ASSET_DATA; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketSellOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'marketSellOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'EIP712_DOMAIN_HASH()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketBuyOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as ExchangeContract; - const functionSignature = 'marketBuyOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrders; - const encodedData = ethersFunction.encode([orders, - makerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public currentContextAddress = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'currentContextAddress()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as ExchangeContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public VERSION = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const functionSignature = 'VERSION()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.VERSION; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'VERSION'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _zrxAssetData: string, - ): Promise<ExchangeContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ExchangeContract.deployAsync(bytecode, abi, provider, txDefaults, _zrxAssetData -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _zrxAssetData: string, - ): Promise<ExchangeContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_zrxAssetData -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_zrxAssetData -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_zrxAssetData -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`Exchange successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_zrxAssetData -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('Exchange', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/exchange_wrapper.ts b/packages/contracts/generated-wrappers/exchange_wrapper.ts deleted file mode 100644 index 6e02e7c7b..000000000 --- a/packages/contracts/generated-wrappers/exchange_wrapper.ts +++ /dev/null @@ -1,378 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ExchangeWrapperContract extends BaseContract { - public fillOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - takerSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - takerSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - takerSignature: string, - ): string { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - takerSignature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeWrapperContract; - const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - salt, - orderSignature, - takerSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - salt: BigNumber, - makerSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs; - [targetOrderEpoch, - salt, - makerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ]); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch, - salt, - makerSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind( - self, - targetOrderEpoch, - salt, - makerSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - targetOrderEpoch: BigNumber, - salt: BigNumber, - makerSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs; - [targetOrderEpoch, - salt, - makerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch, - salt, - makerSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - salt: BigNumber, - makerSignature: string, - ): string { - const self = this as any as ExchangeWrapperContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256,uint256,bytes)').inputs; - [targetOrderEpoch, - salt, - makerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256,uint256,bytes)').functions.cancelOrdersUpTo.encode([targetOrderEpoch, - salt, - makerSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - targetOrderEpoch: BigNumber, - salt: BigNumber, - makerSignature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeWrapperContract; - const functionSignature = 'cancelOrdersUpTo(uint256,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [targetOrderEpoch, - salt, - makerSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch, - salt, - makerSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo; - const encodedData = ethersFunction.encode([targetOrderEpoch, - salt, - makerSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<ExchangeWrapperContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ExchangeWrapperContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<ExchangeWrapperContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ExchangeWrapper successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ExchangeWrapperContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ExchangeWrapper', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/forwarder.ts b/packages/contracts/generated-wrappers/forwarder.ts deleted file mode 100644 index 0dd04c6bb..000000000 --- a/packages/contracts/generated-wrappers/forwarder.ts +++ /dev/null @@ -1,730 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ForwarderContract extends BaseContract { - public marketBuyOrdersWithEth = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData: Partial<TxDataPayable> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersWithEth.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)').functions.marketBuyOrdersWithEth.encode([orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - > { - const self = this as any as ForwarderContract; - const functionSignature = 'marketBuyOrdersWithEth(tuple[],uint256,bytes[],tuple[],bytes[],uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersWithEth; - const encodedData = ethersFunction.encode([orders, - makerAssetFillAmount, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersWithEth'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public withdrawAsset = { - async sendTransactionAsync( - assetData: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - amount - ]); - const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdrawAsset.estimateGasAsync.bind( - self, - assetData, - amount - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetData: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetData: string, - amount: BigNumber, - ): string { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('withdrawAsset(bytes,uint256)').inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('withdrawAsset(bytes,uint256)').functions.withdrawAsset.encode([assetData, - amount - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetData: string, - amount: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ForwarderContract; - const functionSignature = 'withdrawAsset(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetData, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - amount - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdrawAsset; - const encodedData = ethersFunction.encode([assetData, - amount - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'withdrawAsset'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ForwarderContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketSellOrdersWithEth = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData: Partial<TxDataPayable> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersWithEth.estimateGasAsync.bind( - self, - orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - ): string { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)').functions.marketSellOrdersWithEth.encode([orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - signatures: string[], - feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - feeSignatures: string[], - feePercentage: BigNumber, - feeRecipient: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - > { - const self = this as any as ForwarderContract; - const functionSignature = 'marketSellOrdersWithEth(tuple[],bytes[],tuple[],bytes[],uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersWithEth; - const encodedData = ethersFunction.encode([orders, - signatures, - feeOrders, - feeSignatures, - feePercentage, - feeRecipient - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersWithEth'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as ForwarderContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ForwarderContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, - ): Promise<ForwarderContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ForwarderContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange, -_zrxAssetData, -_wethAssetData -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - _zrxAssetData: string, - _wethAssetData: string, - ): Promise<ForwarderContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData, -_wethAssetData -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange, -_zrxAssetData, -_wethAssetData -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData, -_wethAssetData -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`Forwarder successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ForwarderContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData, -_wethAssetData -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('Forwarder', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/i_asset_data.ts b/packages/contracts/generated-wrappers/i_asset_data.ts deleted file mode 100644 index a6a33e5ab..000000000 --- a/packages/contracts/generated-wrappers/i_asset_data.ts +++ /dev/null @@ -1,143 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class IAssetDataContract extends BaseContract { - public ERC721Token = { - async callAsync( - tokenContract: string, - tokenId: BigNumber, - receiverData: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetDataContract; - const functionSignature = 'ERC721Token(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [tokenContract, - tokenId, - receiverData - ] = BaseContract._formatABIDataItemList(inputAbi, [tokenContract, - tokenId, - receiverData - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [tokenContract, - tokenId, - receiverData - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ERC721Token; - const encodedData = ethersFunction.encode([tokenContract, - tokenId, - receiverData - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ERC721Token'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public ERC20Token = { - async callAsync( - tokenContract: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetDataContract; - const functionSignature = 'ERC20Token(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [tokenContract - ] = BaseContract._formatABIDataItemList(inputAbi, [tokenContract - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [tokenContract - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ERC20Token; - const encodedData = ethersFunction.encode([tokenContract - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ERC20Token'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IAssetDataContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return IAssetDataContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IAssetDataContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`IAssetData successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetDataContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('IAssetData', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/i_asset_proxy.ts b/packages/contracts/generated-wrappers/i_asset_proxy.ts deleted file mode 100644 index 21c2bfe64..000000000 --- a/packages/contracts/generated-wrappers/i_asset_proxy.ts +++ /dev/null @@ -1,684 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class IAssetProxyContract extends BaseContract { - public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'addAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'removeAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - target, - index - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([target, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferFrom = { - async sendTransactionAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - from, - to, - amount - ]); - const encodedData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData, - from, - to, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - assetData, - from, - to, - amount - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData, - from, - to, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetData: string, - from: string, - to: string, - amount: BigNumber, - ): string { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(bytes,address,address,uint256)').functions.transferFrom.encode([assetData, - from, - to, - amount - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'transferFrom(bytes,address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - from, - to, - amount - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([assetData, - from, - to, - amount - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'getProxyId()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getProxyId; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getProxyId'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'getAuthorizedAddresses()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as IAssetProxyContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as IAssetProxyContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IAssetProxyContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return IAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IAssetProxyContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`IAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('IAssetProxy', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/invalid_erc721_receiver.ts b/packages/contracts/generated-wrappers/invalid_erc721_receiver.ts deleted file mode 100644 index 348a0a4df..000000000 --- a/packages/contracts/generated-wrappers/invalid_erc721_receiver.ts +++ /dev/null @@ -1,231 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type InvalidERC721ReceiverEventArgs = - | InvalidERC721ReceiverTokenReceivedEventArgs; - -export enum InvalidERC721ReceiverEvents { - TokenReceived = 'TokenReceived', -} - -export interface InvalidERC721ReceiverTokenReceivedEventArgs extends DecodedLogArgs { - operator: string; - from: string; - tokenId: BigNumber; - data: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class InvalidERC721ReceiverContract extends BaseContract { - public onERC721Received = { - async sendTransactionAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as InvalidERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _from, - _tokenId, - _data - ]); - const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.onERC721Received.estimateGasAsync.bind( - self, - _operator, - _from, - _tokenId, - _data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as InvalidERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - ): string { - const self = this as any as InvalidERC721ReceiverContract; - const inputAbi = self._lookupAbi('onERC721Received(address,address,uint256,bytes)').inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('onERC721Received(address,address,uint256,bytes)').functions.onERC721Received.encode([_operator, - _from, - _tokenId, - _data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _operator: string, - _from: string, - _tokenId: BigNumber, - _data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as InvalidERC721ReceiverContract; - const functionSignature = 'onERC721Received(address,address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_operator, - _from, - _tokenId, - _data - ] = BaseContract._formatABIDataItemList(inputAbi, [_operator, - _from, - _tokenId, - _data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_operator, - _from, - _tokenId, - _data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.onERC721Received; - const encodedData = ethersFunction.encode([_operator, - _from, - _tokenId, - _data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'onERC721Received'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<InvalidERC721ReceiverContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return InvalidERC721ReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<InvalidERC721ReceiverContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`InvalidERC721Receiver successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new InvalidERC721ReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('InvalidERC721Receiver', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/mixin_authorizable.ts b/packages/contracts/generated-wrappers/mixin_authorizable.ts deleted file mode 100644 index 0a511df5a..000000000 --- a/packages/contracts/generated-wrappers/mixin_authorizable.ts +++ /dev/null @@ -1,619 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type MixinAuthorizableEventArgs = - | MixinAuthorizableAuthorizedAddressAddedEventArgs - | MixinAuthorizableAuthorizedAddressRemovedEventArgs; - -export enum MixinAuthorizableEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', -} - -export interface MixinAuthorizableAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface MixinAuthorizableAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class MixinAuthorizableContract extends BaseContract { - public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('addAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addAuthorizedAddress(address)').functions.addAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'addAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'authorities(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorities; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorities'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddress.estimateGasAsync.bind( - self, - target - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - ): string { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddress(address)').inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddress(address)').functions.removeAuthorizedAddress.encode([target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'removeAuthorizedAddress(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target - ] = BaseContract._formatABIDataItemList(inputAbi, [target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddress; - const encodedData = ethersFunction.encode([target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - target, - index - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - index: BigNumber, - ): string { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('removeAuthorizedAddressAtIndex(address,uint256)').inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeAuthorizedAddressAtIndex(address,uint256)').functions.removeAuthorizedAddressAtIndex.encode([target, - index - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([target, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'authorized(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.authorized; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'authorized'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'getAuthorizedAddresses()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAuthorizedAddresses; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAuthorizedAddresses'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as MixinAuthorizableContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MixinAuthorizableContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<MixinAuthorizableContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return MixinAuthorizableContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<MixinAuthorizableContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`MixinAuthorizable successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MixinAuthorizableContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('MixinAuthorizable', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/multi_sig_wallet.ts b/packages/contracts/generated-wrappers/multi_sig_wallet.ts deleted file mode 100644 index b84e18836..000000000 --- a/packages/contracts/generated-wrappers/multi_sig_wallet.ts +++ /dev/null @@ -1,1432 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type MultiSigWalletEventArgs = - | MultiSigWalletConfirmationEventArgs - | MultiSigWalletRevocationEventArgs - | MultiSigWalletSubmissionEventArgs - | MultiSigWalletExecutionEventArgs - | MultiSigWalletExecutionFailureEventArgs - | MultiSigWalletDepositEventArgs - | MultiSigWalletOwnerAdditionEventArgs - | MultiSigWalletOwnerRemovalEventArgs - | MultiSigWalletRequirementChangeEventArgs; - -export enum MultiSigWalletEvents { - Confirmation = 'Confirmation', - Revocation = 'Revocation', - Submission = 'Submission', - Execution = 'Execution', - ExecutionFailure = 'ExecutionFailure', - Deposit = 'Deposit', - OwnerAddition = 'OwnerAddition', - OwnerRemoval = 'OwnerRemoval', - RequirementChange = 'RequirementChange', -} - -export interface MultiSigWalletConfirmationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface MultiSigWalletRevocationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface MultiSigWalletSubmissionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletExecutionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletExecutionFailureEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletDepositEventArgs extends DecodedLogArgs { - sender: string; - value: BigNumber; -} - -export interface MultiSigWalletOwnerAdditionEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface MultiSigWalletOwnerRemovalEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface MultiSigWalletRequirementChangeEventArgs extends DecodedLogArgs { - required: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class MultiSigWalletContract extends BaseContract { - public owners = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'owners(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'removeOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'revokeConfirmation(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isOwner = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'isOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmations = { - async callAsync( - index_0: BigNumber, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'confirmations(uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionCount = { - async callAsync( - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'getTransactionCount(bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount; - const encodedData = ethersFunction.encode([pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public addOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'addOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isConfirmed = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'isConfirmed(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmationCount = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'getConfirmationCount(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'transactions(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOwners = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'getOwners()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOwners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionIds = { - async callAsync( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber[] - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [from, - to, - pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [from, - to, - pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [from, - to, - pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds; - const encodedData = ethersFunction.encode([from, - to, - pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmations = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'getConfirmations(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactionCount = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'transactionCount()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _required: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'changeRequirement(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement; - const encodedData = ethersFunction.encode([_required - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'confirmTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public submitTransaction = { - async sendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, - destination, - value, - data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - destination: string, - value: BigNumber, - data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'submitTransaction(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction; - const encodedData = ethersFunction.encode([destination, - value, - data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'MAX_OWNER_COUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public required = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'required()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'required'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public replaceOwner = { - async sendTransactionAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, - owner, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'replaceOwner(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner; - const encodedData = ethersFunction.encode([owner, - newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletContract; - const functionSignature = 'executeTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _required: BigNumber, - ): Promise<MultiSigWalletContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return MultiSigWalletContract.deployAsync(bytecode, abi, provider, txDefaults, _owners, -_required -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _required: BigNumber, - ): Promise<MultiSigWalletContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_required -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_owners, -_required -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_required -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`MultiSigWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiSigWalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_owners, -_required -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('MultiSigWallet', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts b/packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts deleted file mode 100644 index 028a4db37..000000000 --- a/packages/contracts/generated-wrappers/multi_sig_wallet_with_time_lock.ts +++ /dev/null @@ -1,1614 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type MultiSigWalletWithTimeLockEventArgs = - | MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs - | MultiSigWalletWithTimeLockTimeLockChangeEventArgs - | MultiSigWalletWithTimeLockConfirmationEventArgs - | MultiSigWalletWithTimeLockRevocationEventArgs - | MultiSigWalletWithTimeLockSubmissionEventArgs - | MultiSigWalletWithTimeLockExecutionEventArgs - | MultiSigWalletWithTimeLockExecutionFailureEventArgs - | MultiSigWalletWithTimeLockDepositEventArgs - | MultiSigWalletWithTimeLockOwnerAdditionEventArgs - | MultiSigWalletWithTimeLockOwnerRemovalEventArgs - | MultiSigWalletWithTimeLockRequirementChangeEventArgs; - -export enum MultiSigWalletWithTimeLockEvents { - ConfirmationTimeSet = 'ConfirmationTimeSet', - TimeLockChange = 'TimeLockChange', - Confirmation = 'Confirmation', - Revocation = 'Revocation', - Submission = 'Submission', - Execution = 'Execution', - ExecutionFailure = 'ExecutionFailure', - Deposit = 'Deposit', - OwnerAddition = 'OwnerAddition', - OwnerRemoval = 'OwnerRemoval', - RequirementChange = 'RequirementChange', -} - -export interface MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs extends DecodedLogArgs { - transactionId: BigNumber; - confirmationTime: BigNumber; -} - -export interface MultiSigWalletWithTimeLockTimeLockChangeEventArgs extends DecodedLogArgs { - secondsTimeLocked: BigNumber; -} - -export interface MultiSigWalletWithTimeLockConfirmationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface MultiSigWalletWithTimeLockRevocationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface MultiSigWalletWithTimeLockSubmissionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletWithTimeLockExecutionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletWithTimeLockExecutionFailureEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface MultiSigWalletWithTimeLockDepositEventArgs extends DecodedLogArgs { - sender: string; - value: BigNumber; -} - -export interface MultiSigWalletWithTimeLockOwnerAdditionEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface MultiSigWalletWithTimeLockOwnerRemovalEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface MultiSigWalletWithTimeLockRequirementChangeEventArgs extends DecodedLogArgs { - required: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class MultiSigWalletWithTimeLockContract extends BaseContract { - public owners = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'owners(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'removeOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'revokeConfirmation(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isOwner = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'isOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmations = { - async callAsync( - index_0: BigNumber, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'confirmations(uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public secondsTimeLocked = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'secondsTimeLocked()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionCount = { - async callAsync( - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'getTransactionCount(bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount; - const encodedData = ethersFunction.encode([pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public addOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'addOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isConfirmed = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'isConfirmed(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeTimeLock = { - async sendTransactionAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind( - self, - _secondsTimeLocked - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _secondsTimeLocked: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'changeTimeLock(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock; - const encodedData = ethersFunction.encode([_secondsTimeLocked - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getConfirmationCount = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'getConfirmationCount(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'transactions(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOwners = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'getOwners()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOwners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionIds = { - async callAsync( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber[] - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [from, - to, - pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [from, - to, - pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [from, - to, - pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds; - const encodedData = ethersFunction.encode([from, - to, - pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmations = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'getConfirmations(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactionCount = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'transactionCount()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _required: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'changeRequirement(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement; - const encodedData = ethersFunction.encode([_required - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'confirmTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public submitTransaction = { - async sendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, - destination, - value, - data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - destination: string, - value: BigNumber, - data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'submitTransaction(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction; - const encodedData = ethersFunction.encode([destination, - value, - data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmationTimes = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'confirmationTimes(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmationTimes; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'MAX_OWNER_COUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public required = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'required()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'required'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public replaceOwner = { - async sendTransactionAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, - owner, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'replaceOwner(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner; - const encodedData = ethersFunction.encode([owner, - newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as MultiSigWalletWithTimeLockContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiSigWalletWithTimeLockContract; - const functionSignature = 'executeTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<MultiSigWalletWithTimeLockContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return MultiSigWalletWithTimeLockContract.deployAsync(bytecode, abi, provider, txDefaults, _owners, -_required, -_secondsTimeLocked -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<MultiSigWalletWithTimeLockContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_required, -_secondsTimeLocked -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_owners, -_required, -_secondsTimeLocked -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_required, -_secondsTimeLocked -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`MultiSigWalletWithTimeLock successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiSigWalletWithTimeLockContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_owners, -_required, -_secondsTimeLocked -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('MultiSigWalletWithTimeLock', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/order_validator.ts b/packages/contracts/generated-wrappers/order_validator.ts deleted file mode 100644 index ff5d487a2..000000000 --- a/packages/contracts/generated-wrappers/order_validator.ts +++ /dev/null @@ -1,357 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class OrderValidatorContract extends BaseContract { - public getOrderAndTraderInfo = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getOrderAndTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAddress - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderAndTraderInfo; - const encodedData = ethersFunction.encode([order, - takerAddress - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderAndTraderInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getBalanceAndAllowance = { - async callAsync( - target: string, - assetData: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber] - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getBalanceAndAllowance(address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - assetData - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - assetData - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - assetData - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalanceAndAllowance; - const encodedData = ethersFunction.encode([target, - assetData - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getBalanceAndAllowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOrdersAndTradersInfo = { - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getOrdersAndTradersInfo(tuple[],address[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAddresses - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAddresses - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAddresses - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersAndTradersInfo; - const encodedData = ethersFunction.encode([orders, - takerAddresses - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrdersAndTradersInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getTradersInfo = { - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAddresses: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}> - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getTradersInfo(tuple[],address[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAddresses - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAddresses - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAddresses - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTradersInfo; - const encodedData = ethersFunction.encode([orders, - takerAddresses - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTradersInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getERC721TokenOwner = { - async callAsync( - token: string, - tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getERC721TokenOwner(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [token, - tokenId - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - tokenId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [token, - tokenId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getERC721TokenOwner; - const encodedData = ethersFunction.encode([token, - tokenId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getERC721TokenOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getBalancesAndAllowances = { - async callAsync( - target: string, - assetData: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]] - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getBalancesAndAllowances(address,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - assetData - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - assetData - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - assetData - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getBalancesAndAllowances; - const encodedData = ethersFunction.encode([target, - assetData - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getBalancesAndAllowances'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getTraderInfo = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - > { - const self = this as any as OrderValidatorContract; - const functionSignature = 'getTraderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAddress - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTraderInfo; - const encodedData = ethersFunction.encode([order, - takerAddress - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTraderInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - _zrxAssetData: string, - ): Promise<OrderValidatorContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return OrderValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange, -_zrxAssetData -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - _zrxAssetData: string, - ): Promise<OrderValidatorContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange, -_zrxAssetData -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange, -_zrxAssetData -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange, -_zrxAssetData -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`OrderValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new OrderValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange, -_zrxAssetData -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('OrderValidator', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/reentrant_erc20_token.ts b/packages/contracts/generated-wrappers/reentrant_erc20_token.ts deleted file mode 100644 index 73474f5d1..000000000 --- a/packages/contracts/generated-wrappers/reentrant_erc20_token.ts +++ /dev/null @@ -1,660 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ReentrantERC20TokenEventArgs = - | ReentrantERC20TokenTransferEventArgs - | ReentrantERC20TokenApprovalEventArgs; - -export enum ReentrantERC20TokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface ReentrantERC20TokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface ReentrantERC20TokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ReentrantERC20TokenContract extends BaseContract { - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setCurrentFunction = { - async sendTransactionAsync( - _currentFunctionId: number|BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs; - [_currentFunctionId - ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_currentFunctionId - ]); - const encodedData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setCurrentFunction.estimateGasAsync.bind( - self, - _currentFunctionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _currentFunctionId: number|BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs; - [_currentFunctionId - ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _currentFunctionId: number|BigNumber, - ): string { - const self = this as any as ReentrantERC20TokenContract; - const inputAbi = self._lookupAbi('setCurrentFunction(uint8)').inputs; - [_currentFunctionId - ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setCurrentFunction(uint8)').functions.setCurrentFunction.encode([_currentFunctionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _currentFunctionId: number|BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'setCurrentFunction(uint8)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_currentFunctionId - ] = BaseContract._formatABIDataItemList(inputAbi, [_currentFunctionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_currentFunctionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setCurrentFunction; - const encodedData = ethersFunction.encode([_currentFunctionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setCurrentFunction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ReentrantERC20TokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<ReentrantERC20TokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ReentrantERC20TokenContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<ReentrantERC20TokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ReentrantERC20Token successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ReentrantERC20TokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ReentrantERC20Token', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts b/packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts deleted file mode 100644 index ec93df706..000000000 --- a/packages/contracts/generated-wrappers/test_asset_proxy_dispatcher.ts +++ /dev/null @@ -1,523 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type TestAssetProxyDispatcherEventArgs = - | TestAssetProxyDispatcherAssetProxyRegisteredEventArgs; - -export enum TestAssetProxyDispatcherEvents { - AssetProxyRegistered = 'AssetProxyRegistered', -} - -export interface TestAssetProxyDispatcherAssetProxyRegisteredEventArgs extends DecodedLogArgs { - id: string; - assetProxy: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestAssetProxyDispatcherContract extends BaseContract { - public assetProxies = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'assetProxies(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAssetProxy = { - async callAsync( - assetProxyId: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'getAssetProxy(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyId - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy; - const encodedData = ethersFunction.encode([assetProxyId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicDispatchTransferFrom = { - async sendTransactionAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - from, - to, - amount - ]); - const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData, - from, - to, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.publicDispatchTransferFrom.estimateGasAsync.bind( - self, - assetData, - from, - to, - amount - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData, - from, - to, - amount - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetData: string, - from: string, - to: string, - amount: BigNumber, - ): string { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('publicDispatchTransferFrom(bytes,address,address,uint256)').inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('publicDispatchTransferFrom(bytes,address,address,uint256)').functions.publicDispatchTransferFrom.encode([assetData, - from, - to, - amount - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetData: string, - from: string, - to: string, - amount: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'publicDispatchTransferFrom(bytes,address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetData, - from, - to, - amount - ] = BaseContract._formatABIDataItemList(inputAbi, [assetData, - from, - to, - amount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetData, - from, - to, - amount - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDispatchTransferFrom; - const encodedData = ethersFunction.encode([assetData, - from, - to, - amount - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicDispatchTransferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxy: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'registerAssetProxy(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxy - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as TestAssetProxyDispatcherContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyDispatcherContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestAssetProxyDispatcherContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestAssetProxyDispatcherContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestAssetProxyDispatcherContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestAssetProxyDispatcher successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestAssetProxyDispatcherContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestAssetProxyDispatcher', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_asset_proxy_owner.ts b/packages/contracts/generated-wrappers/test_asset_proxy_owner.ts deleted file mode 100644 index 9c536963d..000000000 --- a/packages/contracts/generated-wrappers/test_asset_proxy_owner.ts +++ /dev/null @@ -1,1946 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type TestAssetProxyOwnerEventArgs = - | TestAssetProxyOwnerAssetProxyRegistrationEventArgs - | TestAssetProxyOwnerConfirmationTimeSetEventArgs - | TestAssetProxyOwnerTimeLockChangeEventArgs - | TestAssetProxyOwnerConfirmationEventArgs - | TestAssetProxyOwnerRevocationEventArgs - | TestAssetProxyOwnerSubmissionEventArgs - | TestAssetProxyOwnerExecutionEventArgs - | TestAssetProxyOwnerExecutionFailureEventArgs - | TestAssetProxyOwnerDepositEventArgs - | TestAssetProxyOwnerOwnerAdditionEventArgs - | TestAssetProxyOwnerOwnerRemovalEventArgs - | TestAssetProxyOwnerRequirementChangeEventArgs; - -export enum TestAssetProxyOwnerEvents { - AssetProxyRegistration = 'AssetProxyRegistration', - ConfirmationTimeSet = 'ConfirmationTimeSet', - TimeLockChange = 'TimeLockChange', - Confirmation = 'Confirmation', - Revocation = 'Revocation', - Submission = 'Submission', - Execution = 'Execution', - ExecutionFailure = 'ExecutionFailure', - Deposit = 'Deposit', - OwnerAddition = 'OwnerAddition', - OwnerRemoval = 'OwnerRemoval', - RequirementChange = 'RequirementChange', -} - -export interface TestAssetProxyOwnerAssetProxyRegistrationEventArgs extends DecodedLogArgs { - assetProxyContract: string; - isRegistered: boolean; -} - -export interface TestAssetProxyOwnerConfirmationTimeSetEventArgs extends DecodedLogArgs { - transactionId: BigNumber; - confirmationTime: BigNumber; -} - -export interface TestAssetProxyOwnerTimeLockChangeEventArgs extends DecodedLogArgs { - secondsTimeLocked: BigNumber; -} - -export interface TestAssetProxyOwnerConfirmationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface TestAssetProxyOwnerRevocationEventArgs extends DecodedLogArgs { - sender: string; - transactionId: BigNumber; -} - -export interface TestAssetProxyOwnerSubmissionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface TestAssetProxyOwnerExecutionEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface TestAssetProxyOwnerExecutionFailureEventArgs extends DecodedLogArgs { - transactionId: BigNumber; -} - -export interface TestAssetProxyOwnerDepositEventArgs extends DecodedLogArgs { - sender: string; - value: BigNumber; -} - -export interface TestAssetProxyOwnerOwnerAdditionEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface TestAssetProxyOwnerOwnerRemovalEventArgs extends DecodedLogArgs { - owner: string; -} - -export interface TestAssetProxyOwnerRequirementChangeEventArgs extends DecodedLogArgs { - required: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestAssetProxyOwnerContract extends BaseContract { - public owners = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'owners(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owners; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public removeOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.removeOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('removeOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('removeOwner(address)').functions.removeOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'removeOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.removeOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'removeOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.revokeConfirmation.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('revokeConfirmation(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('revokeConfirmation(uint256)').functions.revokeConfirmation.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'revokeConfirmation(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.revokeConfirmation; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'revokeConfirmation'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isOwner = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'isOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isOwner; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmations = { - async callAsync( - index_0: BigNumber, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'confirmations(uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmations; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeRemoveAuthorizedAddressAtIndex.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeRemoveAuthorizedAddressAtIndex(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeRemoveAuthorizedAddressAtIndex(uint256)').functions.executeRemoveAuthorizedAddressAtIndex.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeRemoveAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeRemoveAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public secondsTimeLocked = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'secondsTimeLocked()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.secondsTimeLocked; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'secondsTimeLocked'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionCount = { - async callAsync( - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'getTransactionCount(bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionCount; - const encodedData = ethersFunction.encode([pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxyContract: string, - isRegistered: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxyContract, - isRegistered - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetProxyContract: string, - isRegistered: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetProxyContract: string, - isRegistered: boolean, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address,bool)').inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address,bool)').functions.registerAssetProxy.encode([assetProxyContract, - isRegistered - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxyContract: string, - isRegistered: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'registerAssetProxy(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyContract, - isRegistered - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyContract, - isRegistered - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyContract, - isRegistered - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxyContract, - isRegistered - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public addOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.addOwner.estimateGasAsync.bind( - self, - owner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('addOwner(address)').inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('addOwner(address)').functions.addOwner.encode([owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'addOwner(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.addOwner; - const encodedData = ethersFunction.encode([owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'addOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isFunctionRemoveAuthorizedAddressAtIndex = { - async callAsync( - data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'isFunctionRemoveAuthorizedAddressAtIndex(bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [data - ] = BaseContract._formatABIDataItemList(inputAbi, [data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isFunctionRemoveAuthorizedAddressAtIndex; - const encodedData = ethersFunction.encode([data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isFunctionRemoveAuthorizedAddressAtIndex'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isConfirmed = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'isConfirmed(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isConfirmed; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isConfirmed'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeTimeLock = { - async sendTransactionAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeTimeLock.estimateGasAsync.bind( - self, - _secondsTimeLocked - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _secondsTimeLocked: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeTimeLock(uint256)').inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeTimeLock(uint256)').functions.changeTimeLock.encode([_secondsTimeLocked - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _secondsTimeLocked: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'changeTimeLock(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_secondsTimeLocked - ] = BaseContract._formatABIDataItemList(inputAbi, [_secondsTimeLocked - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_secondsTimeLocked - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeTimeLock; - const encodedData = ethersFunction.encode([_secondsTimeLocked - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeTimeLock'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isAssetProxyRegistered = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'isAssetProxyRegistered(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isAssetProxyRegistered; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isAssetProxyRegistered'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmationCount = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'getConfirmationCount(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmationCount; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmationCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, BigNumber, string, boolean] - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'transactions(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOwners = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'getOwners()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOwners; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOwners'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getTransactionIds = { - async callAsync( - from: BigNumber, - to: BigNumber, - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber[] - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [from, - to, - pending, - executed - ] = BaseContract._formatABIDataItemList(inputAbi, [from, - to, - pending, - executed - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [from, - to, - pending, - executed - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getTransactionIds; - const encodedData = ethersFunction.encode([from, - to, - pending, - executed - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getTransactionIds'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getConfirmations = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'getConfirmations(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getConfirmations; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getConfirmations'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactionCount = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'transactionCount()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactionCount; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactionCount'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.changeRequirement.estimateGasAsync.bind( - self, - _required - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _required: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('changeRequirement(uint256)').inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('changeRequirement(uint256)').functions.changeRequirement.encode([_required - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _required: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'changeRequirement(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_required - ] = BaseContract._formatABIDataItemList(inputAbi, [_required - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_required - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.changeRequirement; - const encodedData = ethersFunction.encode([_required - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'changeRequirement'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.confirmTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('confirmTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('confirmTransaction(uint256)').functions.confirmTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'confirmTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public testValidRemoveAuthorizedAddressAtIndexTx = { - async callAsync( - id: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'testValidRemoveAuthorizedAddressAtIndexTx(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [id - ] = BaseContract._formatABIDataItemList(inputAbi, [id - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [id - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.testValidRemoveAuthorizedAddressAtIndexTx; - const encodedData = ethersFunction.encode([id - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'testValidRemoveAuthorizedAddressAtIndexTx'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public submitTransaction = { - async sendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.submitTransaction.estimateGasAsync.bind( - self, - destination, - value, - data - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - destination: string, - value: BigNumber, - data: string, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('submitTransaction(address,uint256,bytes)').inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('submitTransaction(address,uint256,bytes)').functions.submitTransaction.encode([destination, - value, - data - ]); - return abiEncodedTransactionData; - }, - async callAsync( - destination: string, - value: BigNumber, - data: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'submitTransaction(address,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [destination, - value, - data - ] = BaseContract._formatABIDataItemList(inputAbi, [destination, - value, - data - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [destination, - value, - data - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.submitTransaction; - const encodedData = ethersFunction.encode([destination, - value, - data - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'submitTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public confirmationTimes = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'confirmationTimes(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.confirmationTimes; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'confirmationTimes'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'MAX_OWNER_COUNT()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAX_OWNER_COUNT; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAX_OWNER_COUNT'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public required = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'required()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.required; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'required'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public replaceOwner = { - async sendTransactionAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.replaceOwner.estimateGasAsync.bind( - self, - owner, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - owner: string, - newOwner: string, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('replaceOwner(address,address)').inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('replaceOwner(address,address)').functions.replaceOwner.encode([owner, - newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'replaceOwner(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [owner, - newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [owner, - newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [owner, - newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.replaceOwner; - const encodedData = ethersFunction.encode([owner, - newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'replaceOwner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - transactionId - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - transactionId: BigNumber, - ): string { - const self = this as any as TestAssetProxyOwnerContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256)').inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256)').functions.executeTransaction.encode([transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestAssetProxyOwnerContract; - const functionSignature = 'executeTransaction(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [transactionId - ] = BaseContract._formatABIDataItemList(inputAbi, [transactionId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [transactionId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([transactionId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<TestAssetProxyOwnerContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestAssetProxyOwnerContract.deployAsync(bytecode, abi, provider, txDefaults, _owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _owners: string[], - _assetProxyContracts: string[], - _required: BigNumber, - _secondsTimeLocked: BigNumber, - ): Promise<TestAssetProxyOwnerContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestAssetProxyOwner successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestAssetProxyOwnerContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_owners, -_assetProxyContracts, -_required, -_secondsTimeLocked -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestAssetProxyOwner', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_constants.ts b/packages/contracts/generated-wrappers/test_constants.ts deleted file mode 100644 index a5ffe2338..000000000 --- a/packages/contracts/generated-wrappers/test_constants.ts +++ /dev/null @@ -1,123 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestConstantsContract extends BaseContract { - public assertValidZrxAssetData = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestConstantsContract; - const functionSignature = 'assertValidZrxAssetData()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assertValidZrxAssetData; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'assertValidZrxAssetData'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public MAINNET_ZRX_ASSET_DATA = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestConstantsContract; - const functionSignature = 'MAINNET_ZRX_ASSET_DATA()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.MAINNET_ZRX_ASSET_DATA; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'MAINNET_ZRX_ASSET_DATA'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestConstantsContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestConstantsContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestConstantsContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestConstants successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestConstantsContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestConstants', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_exchange_internals.ts b/packages/contracts/generated-wrappers/test_exchange_internals.ts deleted file mode 100644 index 447a64c5b..000000000 --- a/packages/contracts/generated-wrappers/test_exchange_internals.ts +++ /dev/null @@ -1,3595 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type TestExchangeInternalsEventArgs = - | TestExchangeInternalsSignatureValidatorApprovalEventArgs - | TestExchangeInternalsFillEventArgs - | TestExchangeInternalsCancelEventArgs - | TestExchangeInternalsCancelUpToEventArgs - | TestExchangeInternalsAssetProxyRegisteredEventArgs; - -export enum TestExchangeInternalsEvents { - SignatureValidatorApproval = 'SignatureValidatorApproval', - Fill = 'Fill', - Cancel = 'Cancel', - CancelUpTo = 'CancelUpTo', - AssetProxyRegistered = 'AssetProxyRegistered', -} - -export interface TestExchangeInternalsSignatureValidatorApprovalEventArgs extends DecodedLogArgs { - signerAddress: string; - validatorAddress: string; - approved: boolean; -} - -export interface TestExchangeInternalsFillEventArgs extends DecodedLogArgs { - makerAddress: string; - feeRecipientAddress: string; - takerAddress: string; - senderAddress: string; - makerAssetFilledAmount: BigNumber; - takerAssetFilledAmount: BigNumber; - makerFeePaid: BigNumber; - takerFeePaid: BigNumber; - orderHash: string; - makerAssetData: string; - takerAssetData: string; -} - -export interface TestExchangeInternalsCancelEventArgs extends DecodedLogArgs { - makerAddress: string; - feeRecipientAddress: string; - senderAddress: string; - orderHash: string; - makerAssetData: string; - takerAssetData: string; -} - -export interface TestExchangeInternalsCancelUpToEventArgs extends DecodedLogArgs { - makerAddress: string; - senderAddress: string; - orderEpoch: BigNumber; -} - -export interface TestExchangeInternalsAssetProxyRegisteredEventArgs extends DecodedLogArgs { - id: string; - assetProxy: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestExchangeInternalsContract extends BaseContract { - public publicIsRoundingErrorFloor = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicIsRoundingErrorFloor(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorFloor; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicIsRoundingErrorFloor'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicUpdateFilledState = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - orderHash: string, - orderTakerAssetFilledAmount: BigNumber, - fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs; - [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - const encodedData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.publicUpdateFilledState.estimateGasAsync.bind( - self, - order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - orderHash: string, - orderTakerAssetFilledAmount: BigNumber, - fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs; - [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - orderHash: string, - orderTakerAssetFilledAmount: BigNumber, - fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').inputs; - [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})').functions.publicUpdateFilledState.encode([order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAddress: string, - orderHash: string, - orderTakerAssetFilledAmount: BigNumber, - fillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicUpdateFilledState({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},address,bytes32,uint256,{uint256,uint256,uint256,uint256})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicUpdateFilledState; - const encodedData = ethersFunction.encode([order, - takerAddress, - orderHash, - orderTakerAssetFilledAmount, - fillResults - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicUpdateFilledState'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public publicGetPartialAmountCeil = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicGetPartialAmountCeil(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountCeil; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicGetPartialAmountCeil'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public filled = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'filled(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.filled; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'filled'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public batchFillOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'batchFillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelled = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'cancelled(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelled; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelled'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public preSign = { - async sendTransactionAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind( - self, - hash, - signerAddress, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'preSign(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public matchOrders = { - async sendTransactionAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - leftOrder, - rightOrder, - leftSignature, - rightSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('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)').inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('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)').functions.matchOrders.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - leftSignature: string, - rightSignature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = '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)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [leftOrder, - rightOrder, - leftSignature, - rightSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.matchOrders; - const encodedData = ethersFunction.encode([leftOrder, - rightOrder, - leftSignature, - rightSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'matchOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrderNoThrow = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderNoThrow.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrderNoThrow.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'fillOrderNoThrow({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderNoThrow; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrderNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public assetProxies = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'assetProxies(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.assetProxies; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'assetProxies'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public batchCancelOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchCancelOrders.estimateGasAsync.bind( - self, - orders - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchCancelOrders(tuple[])').inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchCancelOrders(tuple[])').functions.batchCancelOrders.encode([orders - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'batchCancelOrders(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchCancelOrders; - const encodedData = ethersFunction.encode([orders - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchCancelOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public batchFillOrKillOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrKillOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrKillOrders(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrKillOrders(tuple[],uint256[],bytes[])').functions.batchFillOrKillOrders.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'batchFillOrKillOrders(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrKillOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrKillOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrdersUpTo.estimateGasAsync.bind( - self, - targetOrderEpoch - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - targetOrderEpoch: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - targetOrderEpoch: BigNumber, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrdersUpTo(uint256)').inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrdersUpTo(uint256)').functions.cancelOrdersUpTo.encode([targetOrderEpoch - ]); - return abiEncodedTransactionData; - }, - async callAsync( - targetOrderEpoch: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'cancelOrdersUpTo(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [targetOrderEpoch - ] = BaseContract._formatABIDataItemList(inputAbi, [targetOrderEpoch - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [targetOrderEpoch - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrdersUpTo; - const encodedData = ethersFunction.encode([targetOrderEpoch - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrdersUpTo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public batchFillOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.batchFillOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmounts, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('batchFillOrdersNoThrow(tuple[],uint256[],bytes[])').functions.batchFillOrdersNoThrow.encode([orders, - takerAssetFillAmounts, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmounts: BigNumber[], - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'batchFillOrdersNoThrow(tuple[],uint256[],bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmounts, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmounts, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.batchFillOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmounts, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'batchFillOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getAssetProxy = { - async callAsync( - assetProxyId: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'getAssetProxy(bytes4)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxyId - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxyId - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxyId - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getAssetProxy; - const encodedData = ethersFunction.encode([assetProxyId - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transactions = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'transactions(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrKillOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrKillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrKillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'fillOrKillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrKillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrKillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicAddFillResults = { - async callAsync( - totalFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - singleFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicAddFillResults({uint256,uint256,uint256,uint256},{uint256,uint256,uint256,uint256})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [totalFillResults, - singleFillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [totalFillResults, - singleFillResults - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [totalFillResults, - singleFillResults - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicAddFillResults; - const encodedData = ethersFunction.encode([totalFillResults, - singleFillResults - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicAddFillResults'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicIsRoundingErrorCeil = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicIsRoundingErrorCeil(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorCeil; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicIsRoundingErrorCeil'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setSignatureValidatorApproval = { - async sendTransactionAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, - validatorAddress, - approval - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - return abiEncodedTransactionData; - }, - async callAsync( - validatorAddress: string, - approval: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'setSignatureValidatorApproval(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval; - const encodedData = ethersFunction.encode([validatorAddress, - approval - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public allowedValidators = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'allowedValidators(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketSellOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrders.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrders(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrders(tuple[],uint256,bytes[])').functions.marketSellOrders.encode([orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'marketSellOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrders; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getOrdersInfo = { - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}> - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'getOrdersInfo(tuple[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders - ] = BaseContract._formatABIDataItemList(inputAbi, [orders - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrdersInfo; - const encodedData = ethersFunction.encode([orders - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrdersInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public preSigned = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'preSigned(bytes32,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isValidSignature = { - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketBuyOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketBuyOrdersNoThrow.encode([orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'marketBuyOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - makerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public fillOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrder.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)').functions.fillOrder.encode([order, - takerAssetFillAmount, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'fillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicGetPartialAmountFloor = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicGetPartialAmountFloor(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountFloor; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicGetPartialAmountFloor'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - salt, - signerAddress, - data, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([salt, - signerAddress, - data, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.registerAssetProxy.estimateGasAsync.bind( - self, - assetProxy - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - assetProxy: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('registerAssetProxy(address)').inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('registerAssetProxy(address)').functions.registerAssetProxy.encode([assetProxy - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxy: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'registerAssetProxy(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [assetProxy - ] = BaseContract._formatABIDataItemList(inputAbi, [assetProxy - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [assetProxy - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.registerAssetProxy; - const encodedData = ethersFunction.encode([assetProxy - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'registerAssetProxy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public getOrderInfo = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'getOrderInfo({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderInfo; - const encodedData = ethersFunction.encode([order - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderInfo'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public cancelOrder = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.cancelOrder.estimateGasAsync.bind( - self, - order - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})').functions.cancelOrder.encode([order - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'cancelOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.cancelOrder; - const encodedData = ethersFunction.encode([order - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'cancelOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public orderEpoch = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'orderEpoch(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.orderEpoch; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'orderEpoch'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public ZRX_ASSET_DATA = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'ZRX_ASSET_DATA()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.ZRX_ASSET_DATA; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'ZRX_ASSET_DATA'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketSellOrdersNoThrow = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketSellOrdersNoThrow.estimateGasAsync.bind( - self, - orders, - takerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketSellOrdersNoThrow(tuple[],uint256,bytes[])').functions.marketSellOrdersNoThrow.encode([orders, - takerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - takerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'marketSellOrdersNoThrow(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - takerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - takerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - takerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketSellOrdersNoThrow; - const encodedData = ethersFunction.encode([orders, - takerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketSellOrdersNoThrow'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicSafeGetPartialAmountFloor = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicSafeGetPartialAmountFloor(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicSafeGetPartialAmountFloor; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicSafeGetPartialAmountFloor'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicSafeGetPartialAmountCeil = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicSafeGetPartialAmountCeil(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicSafeGetPartialAmountCeil; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicSafeGetPartialAmountCeil'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicCalculateFillResults = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFilledAmount: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'publicCalculateFillResults({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFilledAmount - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFilledAmount - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFilledAmount - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicCalculateFillResults; - const encodedData = ethersFunction.encode([order, - takerAssetFilledAmount - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicCalculateFillResults'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'EIP712_DOMAIN_HASH()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public marketBuyOrders = { - async sendTransactionAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.marketBuyOrders.estimateGasAsync.bind( - self, - orders, - makerAssetFillAmount, - signatures - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('marketBuyOrders(tuple[],uint256,bytes[])').inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('marketBuyOrders(tuple[],uint256,bytes[])').functions.marketBuyOrders.encode([orders, - makerAssetFillAmount, - signatures - ]); - return abiEncodedTransactionData; - }, - async callAsync( - orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>, - makerAssetFillAmount: BigNumber, - signatures: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'marketBuyOrders(tuple[],uint256,bytes[])'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [orders, - makerAssetFillAmount, - signatures - ] = BaseContract._formatABIDataItemList(inputAbi, [orders, - makerAssetFillAmount, - signatures - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [orders, - makerAssetFillAmount, - signatures - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.marketBuyOrders; - const encodedData = ethersFunction.encode([orders, - makerAssetFillAmount, - signatures - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'marketBuyOrders'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public currentContextAddress = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'currentContextAddress()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as TestExchangeInternalsContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public VERSION = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestExchangeInternalsContract; - const functionSignature = 'VERSION()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.VERSION; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'VERSION'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestExchangeInternalsContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestExchangeInternalsContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestExchangeInternalsContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestExchangeInternals successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestExchangeInternalsContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestExchangeInternals', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_lib_bytes.ts b/packages/contracts/generated-wrappers/test_lib_bytes.ts deleted file mode 100644 index ef0003b80..000000000 --- a/packages/contracts/generated-wrappers/test_lib_bytes.ts +++ /dev/null @@ -1,683 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestLibBytesContract extends BaseContract { - public publicPopLastByte = { - async callAsync( - b: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, string] - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicPopLastByte(bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b - ] = BaseContract._formatABIDataItemList(inputAbi, [b - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLastByte; - const encodedData = ethersFunction.encode([b - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicPopLastByte'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public publicReadBytesWithLength = { - async callAsync( - b: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicReadBytesWithLength(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytesWithLength; - const encodedData = ethersFunction.encode([b, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicReadBytesWithLength'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicDeepCopyBytes = { - async callAsync( - dest: string, - source: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicDeepCopyBytes(bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [dest, - source - ] = BaseContract._formatABIDataItemList(inputAbi, [dest, - source - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dest, - source - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicDeepCopyBytes; - const encodedData = ethersFunction.encode([dest, - source - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicDeepCopyBytes'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicWriteAddress = { - async callAsync( - b: string, - index: BigNumber, - input: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicWriteAddress(bytes,uint256,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index, - input - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index, - input - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index, - input - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteAddress; - const encodedData = ethersFunction.encode([b, - index, - input - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicWriteAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicWriteBytesWithLength = { - async callAsync( - b: string, - index: BigNumber, - input: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicWriteBytesWithLength(bytes,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index, - input - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index, - input - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index, - input - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytesWithLength; - const encodedData = ethersFunction.encode([b, - index, - input - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicWriteBytesWithLength'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public testMemcpy = { - async callAsync( - mem: string, - dest: BigNumber, - source: BigNumber, - length: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'testMemcpy(bytes,uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [mem, - dest, - source, - length - ] = BaseContract._formatABIDataItemList(inputAbi, [mem, - dest, - source, - length - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [mem, - dest, - source, - length - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.testMemcpy; - const encodedData = ethersFunction.encode([mem, - dest, - source, - length - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'testMemcpy'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicReadAddress = { - async callAsync( - b: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicReadAddress(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadAddress; - const encodedData = ethersFunction.encode([b, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicReadAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicWriteBytes32 = { - async callAsync( - b: string, - index: BigNumber, - input: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicWriteBytes32(bytes,uint256,bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index, - input - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index, - input - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index, - input - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteBytes32; - const encodedData = ethersFunction.encode([b, - index, - input - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicWriteBytes32'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicPopLast20Bytes = { - async callAsync( - b: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[string, string] - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicPopLast20Bytes(bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b - ] = BaseContract._formatABIDataItemList(inputAbi, [b - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicPopLast20Bytes; - const encodedData = ethersFunction.encode([b - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicPopLast20Bytes'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public publicEqualsPop1 = { - async callAsync( - lhs: string, - rhs: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicEqualsPop1(bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [lhs, - rhs - ] = BaseContract._formatABIDataItemList(inputAbi, [lhs, - rhs - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs, - rhs - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEqualsPop1; - const encodedData = ethersFunction.encode([lhs, - rhs - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicEqualsPop1'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicWriteUint256 = { - async callAsync( - b: string, - index: BigNumber, - input: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicWriteUint256(bytes,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index, - input - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index, - input - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index, - input - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicWriteUint256; - const encodedData = ethersFunction.encode([b, - index, - input - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicWriteUint256'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicReadBytes32 = { - async callAsync( - b: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicReadBytes32(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes32; - const encodedData = ethersFunction.encode([b, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicReadBytes32'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicReadBytes4 = { - async callAsync( - b: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicReadBytes4(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadBytes4; - const encodedData = ethersFunction.encode([b, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicReadBytes4'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicReadUint256 = { - async callAsync( - b: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicReadUint256(bytes,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [b, - index - ] = BaseContract._formatABIDataItemList(inputAbi, [b, - index - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [b, - index - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicReadUint256; - const encodedData = ethersFunction.encode([b, - index - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicReadUint256'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicEquals = { - async callAsync( - lhs: string, - rhs: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestLibBytesContract; - const functionSignature = 'publicEquals(bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [lhs, - rhs - ] = BaseContract._formatABIDataItemList(inputAbi, [lhs, - rhs - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [lhs, - rhs - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicEquals; - const encodedData = ethersFunction.encode([lhs, - rhs - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicEquals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestLibBytesContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestLibBytesContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestLibBytesContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestLibBytes successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestLibBytesContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestLibBytes', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_libs.ts b/packages/contracts/generated-wrappers/test_libs.ts deleted file mode 100644 index f69c2c2c2..000000000 --- a/packages/contracts/generated-wrappers/test_libs.ts +++ /dev/null @@ -1,453 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestLibsContract extends BaseContract { - public publicIsRoundingErrorFloor = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicIsRoundingErrorFloor(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorFloor; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicIsRoundingErrorFloor'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicGetPartialAmountCeil = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicGetPartialAmountCeil(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountCeil; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicGetPartialAmountCeil'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getDomainSeparatorSchemaHash = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibsContract; - const functionSignature = 'getDomainSeparatorSchemaHash()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getDomainSeparatorSchemaHash; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getDomainSeparatorSchemaHash'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicAddFillResults = { - async callAsync( - totalFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - singleFillResults: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicAddFillResults({uint256,uint256,uint256,uint256},{uint256,uint256,uint256,uint256})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [totalFillResults, - singleFillResults - ] = BaseContract._formatABIDataItemList(inputAbi, [totalFillResults, - singleFillResults - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [totalFillResults, - singleFillResults - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicAddFillResults; - const encodedData = ethersFunction.encode([totalFillResults, - singleFillResults - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicAddFillResults'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicIsRoundingErrorCeil = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicIsRoundingErrorCeil(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsRoundingErrorCeil; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicIsRoundingErrorCeil'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public getOrderSchemaHash = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibsContract; - const functionSignature = 'getOrderSchemaHash()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.getOrderSchemaHash; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'getOrderSchemaHash'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicGetPartialAmountFloor = { - async callAsync( - numerator: BigNumber, - denominator: BigNumber, - target: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicGetPartialAmountFloor(uint256,uint256,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [numerator, - denominator, - target - ] = BaseContract._formatABIDataItemList(inputAbi, [numerator, - denominator, - target - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [numerator, - denominator, - target - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetPartialAmountFloor; - const encodedData = ethersFunction.encode([numerator, - denominator, - target - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicGetPartialAmountFloor'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicGetOrderHash = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicGetOrderHash({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes})'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order - ] = BaseContract._formatABIDataItemList(inputAbi, [order - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicGetOrderHash; - const encodedData = ethersFunction.encode([order - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicGetOrderHash'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibsContract; - const functionSignature = 'EIP712_DOMAIN_HASH()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicAbiEncodeFillOrder = { - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestLibsContract; - const functionSignature = 'publicAbiEncodeFillOrder({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicAbiEncodeFillOrder; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicAbiEncodeFillOrder'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestLibsContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestLibsContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestLibsContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestLibs successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestLibsContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestLibs', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_signature_validator.ts b/packages/contracts/generated-wrappers/test_signature_validator.ts deleted file mode 100644 index 8aaf16b3f..000000000 --- a/packages/contracts/generated-wrappers/test_signature_validator.ts +++ /dev/null @@ -1,746 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type TestSignatureValidatorEventArgs = - | TestSignatureValidatorSignatureValidatorApprovalEventArgs; - -export enum TestSignatureValidatorEvents { - SignatureValidatorApproval = 'SignatureValidatorApproval', -} - -export interface TestSignatureValidatorSignatureValidatorApprovalEventArgs extends DecodedLogArgs { - signerAddress: string; - validatorAddress: string; - approved: boolean; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestSignatureValidatorContract extends BaseContract { - public preSign = { - async sendTransactionAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.preSign.estimateGasAsync.bind( - self, - hash, - signerAddress, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('preSign(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('preSign(bytes32,address,bytes)').functions.preSign.encode([hash, - signerAddress, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'preSign(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSign; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSign'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transactions = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'transactions(bytes32)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transactions; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transactions'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public setSignatureValidatorApproval = { - async sendTransactionAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.setSignatureValidatorApproval.estimateGasAsync.bind( - self, - validatorAddress, - approval - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - validatorAddress: string, - approval: boolean, - ): string { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('setSignatureValidatorApproval(address,bool)').inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('setSignatureValidatorApproval(address,bool)').functions.setSignatureValidatorApproval.encode([validatorAddress, - approval - ]); - return abiEncodedTransactionData; - }, - async callAsync( - validatorAddress: string, - approval: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'setSignatureValidatorApproval(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [validatorAddress, - approval - ] = BaseContract._formatABIDataItemList(inputAbi, [validatorAddress, - approval - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [validatorAddress, - approval - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.setSignatureValidatorApproval; - const encodedData = ethersFunction.encode([validatorAddress, - approval - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'setSignatureValidatorApproval'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public allowedValidators = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'allowedValidators(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowedValidators; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowedValidators'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public preSigned = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'preSigned(bytes32,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.preSigned; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'preSigned'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isValidSignature = { - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public publicIsValidSignature = { - async callAsync( - hash: string, - signer: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'publicIsValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signer, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signer, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signer, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.publicIsValidSignature; - const encodedData = ethersFunction.encode([hash, - signer, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'publicIsValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.executeTransaction.estimateGasAsync.bind( - self, - salt, - signerAddress, - data, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - ): string { - const self = this as any as TestSignatureValidatorContract; - const inputAbi = self._lookupAbi('executeTransaction(uint256,address,bytes,bytes)').inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('executeTransaction(uint256,address,bytes,bytes)').functions.executeTransaction.encode([salt, - signerAddress, - data, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - salt: BigNumber, - signerAddress: string, - data: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [salt, - signerAddress, - data, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [salt, - signerAddress, - data, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [salt, - signerAddress, - data, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.executeTransaction; - const encodedData = ethersFunction.encode([salt, - signerAddress, - data, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'executeTransaction'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'EIP712_DOMAIN_HASH()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.EIP712_DOMAIN_HASH; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'EIP712_DOMAIN_HASH'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public currentContextAddress = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as TestSignatureValidatorContract; - const functionSignature = 'currentContextAddress()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.currentContextAddress; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'currentContextAddress'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestSignatureValidatorContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestSignatureValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestSignatureValidatorContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestSignatureValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestSignatureValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestSignatureValidator', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/test_static_call_receiver.ts b/packages/contracts/generated-wrappers/test_static_call_receiver.ts deleted file mode 100644 index 14cdf53c2..000000000 --- a/packages/contracts/generated-wrappers/test_static_call_receiver.ts +++ /dev/null @@ -1,449 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class TestStaticCallReceiverContract extends BaseContract { - public isValidSignature2 = { - async sendTransactionAsync( - hash: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs; - [hash, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signature - ]); - const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.isValidSignature2.estimateGasAsync.bind( - self, - hash, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - hash: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs; - [hash, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - hash: string, - signature: string, - ): string { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,bytes)').inputs; - [hash, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,bytes)').functions.isValidSignature.encode([hash, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - hash: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestStaticCallReceiverContract; - const functionSignature = 'isValidSignature(bytes32,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isValidSignature1 = { - async sendTransactionAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.isValidSignature1.estimateGasAsync.bind( - self, - hash, - signerAddress, - signature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash, - signerAddress, - signature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - hash: string, - signerAddress: string, - signature: string, - ): string { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('isValidSignature(bytes32,address,bytes)').inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('isValidSignature(bytes32,address,bytes)').functions.isValidSignature.encode([hash, - signerAddress, - signature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as TestStaticCallReceiverContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approveERC20 = { - async sendTransactionAsync( - token: string, - spender: string, - value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs; - [token, - spender, - value - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - spender, - value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [token, - spender, - value - ]); - const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token, - spender, - value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approveERC20.estimateGasAsync.bind( - self, - token, - spender, - value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - token: string, - spender: string, - value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs; - [token, - spender, - value - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - spender, - value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token, - spender, - value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - token: string, - spender: string, - value: BigNumber, - ): string { - const self = this as any as TestStaticCallReceiverContract; - const inputAbi = self._lookupAbi('approveERC20(address,address,uint256)').inputs; - [token, - spender, - value - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - spender, - value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approveERC20(address,address,uint256)').functions.approveERC20.encode([token, - spender, - value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - token: string, - spender: string, - value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as TestStaticCallReceiverContract; - const functionSignature = 'approveERC20(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [token, - spender, - value - ] = BaseContract._formatABIDataItemList(inputAbi, [token, - spender, - value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [token, - spender, - value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approveERC20; - const encodedData = ethersFunction.encode([token, - spender, - value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approveERC20'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestStaticCallReceiverContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return TestStaticCallReceiverContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<TestStaticCallReceiverContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`TestStaticCallReceiver successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new TestStaticCallReceiverContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('TestStaticCallReceiver', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/validator.ts b/packages/contracts/generated-wrappers/validator.ts deleted file mode 100644 index 3e67f571c..000000000 --- a/packages/contracts/generated-wrappers/validator.ts +++ /dev/null @@ -1,115 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ValidatorContract extends BaseContract { - public isValidSignature = { - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ValidatorContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - validSigner: string, - ): Promise<ValidatorContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, validSigner -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - validSigner: string, - ): Promise<ValidatorContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [validSigner -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [validSigner -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [validSigner -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`Validator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [validSigner -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('Validator', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/wallet.ts b/packages/contracts/generated-wrappers/wallet.ts deleted file mode 100644 index 955376fcf..000000000 --- a/packages/contracts/generated-wrappers/wallet.ts +++ /dev/null @@ -1,110 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class WalletContract extends BaseContract { - public isValidSignature = { - async callAsync( - hash: string, - eip712Signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WalletContract; - const functionSignature = 'isValidSignature(bytes32,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - eip712Signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - eip712Signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - eip712Signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - eip712Signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - walletOwner: string, - ): Promise<WalletContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return WalletContract.deployAsync(bytecode, abi, provider, txDefaults, walletOwner -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - walletOwner: string, - ): Promise<WalletContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [walletOwner -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [walletOwner -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [walletOwner -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`Wallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [walletOwner -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('Wallet', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/weth9.ts b/packages/contracts/generated-wrappers/weth9.ts deleted file mode 100644 index 9e2d44e4e..000000000 --- a/packages/contracts/generated-wrappers/weth9.ts +++ /dev/null @@ -1,835 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type WETH9EventArgs = - | WETH9ApprovalEventArgs - | WETH9TransferEventArgs - | WETH9DepositEventArgs - | WETH9WithdrawalEventArgs; - -export enum WETH9Events { - Approval = 'Approval', - Transfer = 'Transfer', - Deposit = 'Deposit', - Withdrawal = 'Withdrawal', -} - -export interface WETH9ApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - -export interface WETH9TransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface WETH9DepositEventArgs extends DecodedLogArgs { - _owner: string; - _value: BigNumber; -} - -export interface WETH9WithdrawalEventArgs extends DecodedLogArgs { - _owner: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class WETH9Contract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as WETH9Contract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - guy: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [guy, - wad - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - guy, - wad - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - guy: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - guy: string, - wad: BigNumber, - ): string { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([guy, - wad - ]); - return abiEncodedTransactionData; - }, - async callAsync( - guy: string, - wad: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WETH9Contract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [guy, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [guy, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [guy, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([guy, - wad - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as WETH9Contract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - src: string, - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [src, - dst, - wad - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, - dst, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - src, - dst, - wad - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - src: string, - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, - dst, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - src: string, - dst: string, - wad: BigNumber, - ): string { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([src, - dst, - wad - ]); - return abiEncodedTransactionData; - }, - async callAsync( - src: string, - dst: string, - wad: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WETH9Contract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [src, - dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [src, - dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [src, - dst, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([src, - dst, - wad - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public withdraw = { - async sendTransactionAsync( - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [wad - ]); - const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.withdraw.estimateGasAsync.bind( - self, - wad - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - wad: BigNumber, - ): string { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('withdraw(uint256)').inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('withdraw(uint256)').functions.withdraw.encode([wad - ]); - return abiEncodedTransactionData; - }, - async callAsync( - wad: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WETH9Contract; - const functionSignature = 'withdraw(uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [wad - ] = BaseContract._formatABIDataItemList(inputAbi, [wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.withdraw; - const encodedData = ethersFunction.encode([wad - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'withdraw'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<number - > { - const self = this as any as WETH9Contract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as WETH9Contract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as WETH9Contract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transfer = { - async sendTransactionAsync( - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dst, - wad - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - dst, - wad - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, - wad - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - dst: string, - wad: BigNumber, - ): string { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([dst, - wad - ]); - return abiEncodedTransactionData; - }, - async callAsync( - dst: string, - wad: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WETH9Contract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [dst, - wad - ] = BaseContract._formatABIDataItemList(inputAbi, [dst, - wad - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [dst, - wad - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([dst, - wad - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public deposit = { - async sendTransactionAsync( - txData: Partial<TxDataPayable> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.deposit.estimateGasAsync.bind( - self, - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - ): string { - const self = this as any as WETH9Contract; - const inputAbi = self._lookupAbi('deposit()').inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('deposit()').functions.deposit.encode([]); - return abiEncodedTransactionData; - }, - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WETH9Contract; - const functionSignature = 'deposit()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.deposit; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'deposit'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public allowance = { - async callAsync( - index_0: string, - index_1: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as WETH9Contract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0, - index_1 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0, - index_1 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0, - index_1 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([index_0, - index_1 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<WETH9Contract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return WETH9Contract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<WETH9Contract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`WETH9 successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WETH9Contract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('WETH9', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/whitelist.ts b/packages/contracts/generated-wrappers/whitelist.ts deleted file mode 100644 index 3370e2435..000000000 --- a/packages/contracts/generated-wrappers/whitelist.ts +++ /dev/null @@ -1,547 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class WhitelistContract extends BaseContract { - public fillOrderIfWhitelisted = { - async sendTransactionAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ]); - const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order, - takerAssetFillAmount, - salt, - orderSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.fillOrderIfWhitelisted.estimateGasAsync.bind( - self, - order, - takerAssetFillAmount, - salt, - orderSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order, - takerAssetFillAmount, - salt, - orderSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - ): string { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)').functions.fillOrderIfWhitelisted.encode([order, - takerAssetFillAmount, - salt, - orderSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - takerAssetFillAmount: BigNumber, - salt: BigNumber, - orderSignature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WhitelistContract; - const functionSignature = 'fillOrderIfWhitelisted({address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes},uint256,uint256,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [order, - takerAssetFillAmount, - salt, - orderSignature - ] = BaseContract._formatABIDataItemList(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [order, - takerAssetFillAmount, - salt, - orderSignature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.fillOrderIfWhitelisted; - const encodedData = ethersFunction.encode([order, - takerAssetFillAmount, - salt, - orderSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'fillOrderIfWhitelisted'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public isWhitelisted = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WhitelistContract; - const functionSignature = 'isWhitelisted(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [index_0 - ] = BaseContract._formatABIDataItemList(inputAbi, [index_0 - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [index_0 - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isWhitelisted; - const encodedData = ethersFunction.encode([index_0 - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isWhitelisted'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as WhitelistContract; - const functionSignature = 'owner()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.owner; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'owner'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public isValidSignature = { - async callAsync( - hash: string, - signerAddress: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as WhitelistContract; - const functionSignature = 'isValidSignature(bytes32,address,bytes)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [hash, - signerAddress, - signature - ] = BaseContract._formatABIDataItemList(inputAbi, [hash, - signerAddress, - signature - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [hash, - signerAddress, - signature - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.isValidSignature; - const encodedData = ethersFunction.encode([hash, - signerAddress, - signature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'isValidSignature'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public updateWhitelistStatus = { - async sendTransactionAsync( - target: string, - isApproved: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs; - [target, - isApproved - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - isApproved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - isApproved - ]); - const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target, - isApproved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.updateWhitelistStatus.estimateGasAsync.bind( - self, - target, - isApproved - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - target: string, - isApproved: boolean, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs; - [target, - isApproved - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - isApproved - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target, - isApproved - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - target: string, - isApproved: boolean, - ): string { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('updateWhitelistStatus(address,bool)').inputs; - [target, - isApproved - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - isApproved - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('updateWhitelistStatus(address,bool)').functions.updateWhitelistStatus.encode([target, - isApproved - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - isApproved: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WhitelistContract; - const functionSignature = 'updateWhitelistStatus(address,bool)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [target, - isApproved - ] = BaseContract._formatABIDataItemList(inputAbi, [target, - isApproved - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [target, - isApproved - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.updateWhitelistStatus; - const encodedData = ethersFunction.encode([target, - isApproved - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'updateWhitelistStatus'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferOwnership.estimateGasAsync.bind( - self, - newOwner - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - newOwner: string, - ): string { - const self = this as any as WhitelistContract; - const inputAbi = self._lookupAbi('transferOwnership(address)').inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferOwnership(address)').functions.transferOwnership.encode([newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WhitelistContract; - const functionSignature = 'transferOwnership(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [newOwner - ] = BaseContract._formatABIDataItemList(inputAbi, [newOwner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [newOwner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferOwnership; - const encodedData = ethersFunction.encode([newOwner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferOwnership'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<WhitelistContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return WhitelistContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<WhitelistContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, [_exchange -]); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`Whitelist successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new WhitelistContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('Whitelist', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/contracts/generated-wrappers/zrx_token.ts b/packages/contracts/generated-wrappers/zrx_token.ts deleted file mode 100644 index 8f5aa0d45..000000000 --- a/packages/contracts/generated-wrappers/zrx_token.ts +++ /dev/null @@ -1,646 +0,0 @@ -// tslint:disable:no-consecutive-blank-lines ordered-imports align trailing-comma whitespace class-name -// tslint:disable:no-unused-variable -// tslint:disable:no-unbound-method -import { BaseContract } from '@0xproject/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0xproject/utils'; -import { Web3Wrapper } from '@0xproject/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type ZRXTokenEventArgs = - | ZRXTokenTransferEventArgs - | ZRXTokenApprovalEventArgs; - -export enum ZRXTokenEvents { - Transfer = 'Transfer', - Approval = 'Approval', -} - -export interface ZRXTokenTransferEventArgs extends DecodedLogArgs { - _from: string; - _to: string; - _value: BigNumber; -} - -export interface ZRXTokenApprovalEventArgs extends DecodedLogArgs { - _owner: string; - _spender: string; - _value: BigNumber; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class ZRXTokenContract extends BaseContract { - public name = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'name()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.name; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'name'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.approve.estimateGasAsync.bind( - self, - _spender, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _spender: string, - _value: BigNumber, - ): string { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('approve(address,uint256)').inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('approve(address,uint256)').functions.approve.encode([_spender, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _spender: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'approve(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_spender, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_spender, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_spender, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.approve; - const encodedData = ethersFunction.encode([_spender, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'approve'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'totalSupply()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.totalSupply; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'totalSupply'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transferFrom.estimateGasAsync.bind( - self, - _from, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _from: string, - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transferFrom(address,address,uint256)').inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transferFrom(address,address,uint256)').functions.transferFrom.encode([_from, - _to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _from: string, - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'transferFrom(address,address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_from, - _to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_from, - _to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_from, - _to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transferFrom; - const encodedData = ethersFunction.encode([_from, - _to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transferFrom'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<number - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'decimals()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.decimals; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'decimals'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'balanceOf(address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.balanceOf; - const encodedData = ethersFunction.encode([_owner - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'balanceOf'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'symbol()'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [] = BaseContract._formatABIDataItemList(inputAbi, [], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, []); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.symbol; - const encodedData = ethersFunction.encode([]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'symbol'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.transfer.estimateGasAsync.bind( - self, - _to, - _value - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const encodedData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - _to: string, - _value: BigNumber, - ): string { - const self = this as any as ZRXTokenContract; - const inputAbi = self._lookupAbi('transfer(address,uint256)').inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString); - const abiEncodedTransactionData = self._lookupEthersInterface('transfer(address,uint256)').functions.transfer.encode([_to, - _value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _to: string, - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'transfer(address,uint256)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_to, - _value - ] = BaseContract._formatABIDataItemList(inputAbi, [_to, - _value - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_to, - _value - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.transfer; - const encodedData = ethersFunction.encode([_to, - _value - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'transfer'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const functionSignature = 'allowance(address,address)'; - const inputAbi = self._lookupAbi(functionSignature).inputs; - [_owner, - _spender - ] = BaseContract._formatABIDataItemList(inputAbi, [_owner, - _spender - ], BaseContract._bigNumberToString.bind(self)); - BaseContract.strictArgumentEncodingCheck(inputAbi, [_owner, - _spender - ]); - const ethersFunction = self._lookupEthersInterface(functionSignature).functions.allowance; - const encodedData = ethersFunction.encode([_owner, - _spender - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - let resultArray = ethersFunction.decode(rawCallResult); - const outputAbi = (_.find(self.abi, {name: 'allowance'}) as MethodAbi).outputs; - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._lowercaseAddress.bind(this)); - resultArray = BaseContract._formatABIDataItemList(outputAbi, resultArray, BaseContract._bnToBigNumber.bind(this)); - return resultArray[0]; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ZRXTokenContract> { - if (_.isUndefined(artifact.compilerOutput)) { - throw new Error('Compiler output not found in the artifact file'); - } - const bytecode = artifact.compilerOutput.evm.bytecode.object; - const abi = artifact.compilerOutput.abi; - return ZRXTokenContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<ZRXTokenContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.Interface(abi); - const deployInfo = iface.deployFunction; - const txData = deployInfo.encode(bytecode, []); - const web3Wrapper = new Web3Wrapper(provider); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - {data: txData}, - txDefaults, - web3Wrapper.estimateGasAsync.bind(web3Wrapper), - ); - const txHash = await web3Wrapper.sendTransactionAsync(txDataWithDefaults); - logUtils.log(`transactionHash: ${txHash}`); - const txReceipt = await web3Wrapper.awaitTransactionSuccessAsync(txHash); - logUtils.log(`ZRXToken successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new ZRXTokenContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('ZRXToken', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_ethersInterfacesByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method |