diff options
Diffstat (limited to 'packages/abi-gen-wrappers/src/generated-wrappers')
16 files changed, 0 insertions, 10867 deletions
diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts b/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts deleted file mode 100644 index cc42e7fb5..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts +++ /dev/null @@ -1,1494 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('owners(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('owners(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [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 encodedData = self._strictEncodeArguments('removeOwner(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('removeOwner(address)', [owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('removeOwner(address)', [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); - const abiEncoder = self._lookupAbiEncoder('removeOwner(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public revokeConfirmation = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [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 encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('revokeConfirmation(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('revokeConfirmation(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isOwner = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isOwner(address)', [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); - const abiEncoder = self._lookupAbiEncoder('isOwner(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('confirmations(uint256,address)', [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); - const abiEncoder = self._lookupAbiEncoder('confirmations(uint256,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public executeRemoveAuthorizedAddressAtIndex = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [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 encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeRemoveAuthorizedAddressAtIndex(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public secondsTimeLocked = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('secondsTimeLocked()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getTransactionCount = { - async callAsync( - pending: boolean, - executed: boolean, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getTransactionCount(bool,bool)', [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); - const abiEncoder = self._lookupAbiEncoder('getTransactionCount(bool,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxyContract: string, - isRegistered: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [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 encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [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 abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [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 encodedData = self._strictEncodeArguments('registerAssetProxy(address,bool)', [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); - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public addOwner = { - async sendTransactionAsync( - owner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [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 encodedData = self._strictEncodeArguments('addOwner(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('addOwner(address)', [owner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('addOwner(address)', [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); - const abiEncoder = self._lookupAbiEncoder('addOwner(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isConfirmed = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isConfirmed(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('isConfirmed(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public changeTimeLock = { - async sendTransactionAsync( - _secondsTimeLocked: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_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 encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('changeTimeLock(uint256)', [_secondsTimeLocked - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _secondsTimeLocked: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeTimeLock(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isAssetProxyRegistered = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('isAssetProxyRegistered(address)', [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); - const abiEncoder = self._lookupAbiEncoder('isAssetProxyRegistered(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getConfirmationCount = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmationCount(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('getConfirmationCount(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('transactions(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('transactions(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[string, BigNumber, string, boolean] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getOwners = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getOwners()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getOwners()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getTransactionIds(uint256,uint256,bool,bool)', [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); - const abiEncoder = self._lookupAbiEncoder('getTransactionIds(uint256,uint256,bool,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getConfirmations = { - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('getConfirmations(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('getConfirmations(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transactionCount = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('transactionCount()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('transactionCount()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public changeRequirement = { - async sendTransactionAsync( - _required: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_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 encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('changeRequirement(uint256)', [_required - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _required: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('changeRequirement(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public confirmTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [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 encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('confirmTransaction(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmTransaction(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public submitTransaction = { - async sendTransactionAsync( - destination: string, - value: BigNumber, - data: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [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 encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [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 encodedData = self._strictEncodeArguments('submitTransaction(address,uint256,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public confirmationTimes = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('confirmationTimes(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('confirmationTimes(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public MAX_OWNER_COUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('MAX_OWNER_COUNT()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('MAX_OWNER_COUNT()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public required = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('required()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public replaceOwner = { - async sendTransactionAsync( - owner: string, - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [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 encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('replaceOwner(address,address)', [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 encodedData = self._strictEncodeArguments('replaceOwner(address,address)', [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); - const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public executeTransaction = { - async sendTransactionAsync( - transactionId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [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 encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256)', [transactionId - ]); - return abiEncodedTransactionData; - }, - async callAsync( - transactionId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as AssetProxyOwnerContract; - const encodedData = self._strictEncodeArguments('executeTransaction(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts deleted file mode 100644 index cab09c4d2..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts +++ /dev/null @@ -1,828 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('name()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('totalSupply()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('decimals()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('symbol()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public mint = { - async sendTransactionAsync( - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_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 encodedData = self._strictEncodeArguments('mint(uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('mint(uint256)', [_value - ]); - return abiEncodedTransactionData; - }, - async callAsync( - _value: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('mint(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('mint(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_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); - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public setBalance = { - async sendTransactionAsync( - _target: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_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 encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('setBalance(address,uint256)', [_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 encodedData = self._strictEncodeArguments('setBalance(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public MAX_MINT_AMOUNT = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC20TokenContract; - const encodedData = self._strictEncodeArguments('MAX_MINT_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); - const abiEncoder = self._lookupAbiEncoder('MAX_MINT_AMOUNT()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts deleted file mode 100644 index 9cb54442b..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts +++ /dev/null @@ -1,1006 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('name()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getApproved = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('getApproved(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public approve = { - async sendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public mint = { - async sendTransactionAsync( - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('mint(address,uint256)', [_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 encodedData = self._strictEncodeArguments('mint(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('mint(address,uint256)', [_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 encodedData = self._strictEncodeArguments('mint(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public safeTransferFrom1 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public ownerOf = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('symbol()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public burn = { - async sendTransactionAsync( - _owner: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('burn(address,uint256)', [_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 encodedData = self._strictEncodeArguments('burn(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('burn(address,uint256)', [_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 encodedData = self._strictEncodeArguments('burn(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public setApprovalForAll = { - async sendTransactionAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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); - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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); - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isApprovedForAll = { - async callAsync( - _owner: string, - _operator: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_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); - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as DummyERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts b/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts deleted file mode 100644 index 9be95af65..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/dutch_auction.ts +++ /dev/null @@ -1,250 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 DutchAuctionContract extends BaseContract { - public getAuctionDetails = { - 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 DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [order - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.getAuctionDetails.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 DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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 DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - > { - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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); - const abiEncoder = self._lookupAbiEncoder('getAuctionDetails((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{beginTimeSeconds: BigNumber;endTimeSeconds: BigNumber;beginAmount: BigNumber;endAmount: BigNumber;currentAmount: BigNumber;currentTimeSeconds: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public matchOrders = { - async sendTransactionAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('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)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - self.matchOrders.estimateGasAsync.bind( - self, - buyOrder, - sellOrder, - buySignature, - sellSignature - ), - ); - const txHash = await self._web3Wrapper.sendTransactionAsync(txDataWithDefaults); - return txHash; - }, - async estimateGasAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - txData: Partial<TxData> = {}, - ): Promise<number> { - const self = this as any as DutchAuctionContract; - const encodedData = self._strictEncodeArguments('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)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...txData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults); - return gas; - }, - getABIEncodedTransactionData( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: string, - ): string { - const self = this as any as DutchAuctionContract; - const abiEncodedTransactionData = self._strictEncodeArguments('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)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - return abiEncodedTransactionData; - }, - async callAsync( - buyOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - sellOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}, - buySignature: string, - sellSignature: 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 DutchAuctionContract; - const encodedData = self._strictEncodeArguments('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)', [buyOrder, - sellOrder, - buySignature, - sellSignature - ]); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<DutchAuctionContract> { - 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 DutchAuctionContract.deployAsync(bytecode, abi, provider, txDefaults, _exchange -); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - _exchange: string, - ): Promise<DutchAuctionContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [_exchange -] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [_exchange -], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.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(`DutchAuction successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new DutchAuctionContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = [_exchange -]; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('DutchAuction', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts deleted file mode 100644 index 1d53df6b8..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts +++ /dev/null @@ -1,530 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('getProxyId()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [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); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC20ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts deleted file mode 100644 index 5070111e1..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts +++ /dev/null @@ -1,433 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('totalSupply()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC20TokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_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); - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts deleted file mode 100644 index 5a9fcc7d1..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts +++ /dev/null @@ -1,530 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('getProxyId()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [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); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ERC721ProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts deleted file mode 100644 index aaae2ab76..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts +++ /dev/null @@ -1,668 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('getApproved(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('getApproved(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public approve = { - async sendTransactionAsync( - _approved: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public safeTransferFrom1 = { - async sendTransactionAsync( - _from: string, - _to: string, - _tokenId: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public ownerOf = { - async callAsync( - _tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('ownerOf(uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('ownerOf(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public setApprovalForAll = { - async sendTransactionAsync( - _operator: string, - _approved: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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 encodedData = self._strictEncodeArguments('setApprovalForAll(address,bool)', [_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); - const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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 encodedData = self._strictEncodeArguments('safeTransferFrom(address,address,uint256,bytes)', [_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); - const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public isApprovedForAll = { - async callAsync( - _owner: string, - _operator: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ERC721TokenContract; - const encodedData = self._strictEncodeArguments('isApprovedForAll(address,address)', [_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); - const abiEncoder = self._lookupAbiEncoder('isApprovedForAll(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts b/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts deleted file mode 100644 index 146fa7c2a..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts +++ /dev/null @@ -1,2279 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('filled(bytes32)', [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); - const abiEncoder = self._lookupAbiEncoder('filled(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public cancelled = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelled(bytes32)', [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); - const abiEncoder = self._lookupAbiEncoder('cancelled(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public preSign = { - async sendTransactionAsync( - hash: string, - signerAddress: string, - signature: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [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 encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [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 encodedData = self._strictEncodeArguments('preSign(bytes32,address,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('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)', [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 encodedData = self._strictEncodeArguments('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)', [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 abiEncodedTransactionData = self._strictEncodeArguments('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)', [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 encodedData = self._strictEncodeArguments('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)', [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); - const abiEncoder = self._lookupAbiEncoder('matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public assetProxies = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [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); - const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [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 encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [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 encodedData = self._strictEncodeArguments('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [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); - const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public cancelOrdersUpTo = { - async sendTransactionAsync( - targetOrderEpoch: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [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 encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [targetOrderEpoch - ]); - return abiEncodedTransactionData; - }, - async callAsync( - targetOrderEpoch: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('cancelOrdersUpTo(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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 encodedData = self._strictEncodeArguments('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getAssetProxy = { - async callAsync( - assetProxyId: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [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); - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transactions = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transactions(bytes32)', [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); - const abiEncoder = self._lookupAbiEncoder('transactions(bytes32)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public setSignatureValidatorApproval = { - async sendTransactionAsync( - validatorAddress: string, - approval: boolean, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [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 encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [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 abiEncodedTransactionData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [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 encodedData = self._strictEncodeArguments('setSignatureValidatorApproval(address,bool)', [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); - const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('allowedValidators(address,address)', [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); - const abiEncoder = self._lookupAbiEncoder('allowedValidators(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])', [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); - const abiEncoder = self._lookupAbiEncoder('getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}> - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('preSigned(bytes32,address)', [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); - const abiEncoder = self._lookupAbiEncoder('preSigned(bytes32,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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 encodedData = self._strictEncodeArguments('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [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 encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [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 abiEncodedTransactionData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [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 encodedData = self._strictEncodeArguments('executeTransaction(uint256,address,bytes,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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 encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxy: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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); - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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); - const abiEncoder = self._lookupAbiEncoder('getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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 encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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 abiEncodedTransactionData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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 encodedData = self._strictEncodeArguments('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))', [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); - const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('orderEpoch(address,address)', [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); - const abiEncoder = self._lookupAbiEncoder('orderEpoch(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public ZRX_ASSET_DATA = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('ZRX_ASSET_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); - const abiEncoder = self._lookupAbiEncoder('ZRX_ASSET_DATA()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public EIP712_DOMAIN_HASH = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('EIP712_DOMAIN_HASH()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('EIP712_DOMAIN_HASH()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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 encodedData = self._strictEncodeArguments('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public currentContextAddress = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('currentContextAddress()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('currentContextAddress()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public VERSION = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ExchangeContract; - const encodedData = self._strictEncodeArguments('VERSION()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('VERSION()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts b/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts deleted file mode 100644 index 530320792..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 encodedData = self._strictEncodeArguments('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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); - const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public withdrawAsset = { - async sendTransactionAsync( - assetData: string, - amount: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [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 encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [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 encodedData = self._strictEncodeArguments('withdrawAsset(bytes,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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 encodedData = self._strictEncodeArguments('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)', [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); - const abiEncoder = self._lookupAbiEncoder('marketSellOrdersWithEth((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],bytes[],uint256,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as ForwarderContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts deleted file mode 100644 index 6cb9f64fb..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts +++ /dev/null @@ -1,96 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 IValidatorContract 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 IValidatorContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,address,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,address,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IValidatorContract> { - 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 IValidatorContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IValidatorContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.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(`IValidator successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IValidatorContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('IValidator', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts b/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts deleted file mode 100644 index 2185c7999..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts +++ /dev/null @@ -1,94 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 IWalletContract extends BaseContract { - public isValidSignature = { - async callAsync( - hash: string, - signature: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as IWalletContract; - const encodedData = self._strictEncodeArguments('isValidSignature(bytes32,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('isValidSignature(bytes32,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IWalletContract> { - 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 IWalletContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<IWalletContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.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(`IWallet successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new IWalletContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('IWallet', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts deleted file mode 100644 index 418cab6a0..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/multi_asset_proxy.ts +++ /dev/null @@ -1,669 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/web3-wrapper'; -import * as ethers from 'ethers'; -import * as _ from 'lodash'; -// tslint:enable:no-unused-variable - -export type MultiAssetProxyEventArgs = - | MultiAssetProxyAuthorizedAddressAddedEventArgs - | MultiAssetProxyAuthorizedAddressRemovedEventArgs - | MultiAssetProxyAssetProxyRegisteredEventArgs; - -export enum MultiAssetProxyEvents { - AuthorizedAddressAdded = 'AuthorizedAddressAdded', - AuthorizedAddressRemoved = 'AuthorizedAddressRemoved', - AssetProxyRegistered = 'AssetProxyRegistered', -} - -export interface MultiAssetProxyAuthorizedAddressAddedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface MultiAssetProxyAuthorizedAddressRemovedEventArgs extends DecodedLogArgs { - target: string; - caller: string; -} - -export interface MultiAssetProxyAssetProxyRegisteredEventArgs extends DecodedLogArgs { - id: string; - assetProxy: string; -} - - -/* istanbul ignore next */ -// tslint:disable:no-parameter-reassignment -// tslint:disable-next-line:class-name -export class MultiAssetProxyContract extends BaseContract { - public assetProxies = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('assetProxies(bytes4)', [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); - const abiEncoder = self._lookupAbiEncoder('assetProxies(bytes4)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public addAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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 MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('addAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('addAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorities = { - async callAsync( - index_0: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorities(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('authorities(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getAssetProxy = { - async callAsync( - assetProxyId: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAssetProxy(bytes4)', [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); - const abiEncoder = self._lookupAbiEncoder('getAssetProxy(bytes4)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddress = { - async sendTransactionAsync( - target: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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 MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [target - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddress(address)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public owner = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('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); - const abiEncoder = self._lookupAbiEncoder('owner()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public removeAuthorizedAddressAtIndex = { - async sendTransactionAsync( - target: string, - index: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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 MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [target, - index - ]); - return abiEncodedTransactionData; - }, - async callAsync( - target: string, - index: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('removeAuthorizedAddressAtIndex(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getProxyId = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getProxyId()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getProxyId()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public authorized = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<boolean - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('authorized(address)', [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); - const abiEncoder = self._lookupAbiEncoder('authorized(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public registerAssetProxy = { - async sendTransactionAsync( - assetProxy: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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 MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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 MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('registerAssetProxy(address)', [assetProxy - ]); - return abiEncodedTransactionData; - }, - async callAsync( - assetProxy: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('registerAssetProxy(address)', [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); - const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getAuthorizedAddresses = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string[] - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('getAuthorizedAddresses()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('getAuthorizedAddresses()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string[] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferOwnership = { - async sendTransactionAsync( - newOwner: string, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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 MultiAssetProxyContract; - const abiEncodedTransactionData = self._strictEncodeArguments('transferOwnership(address)', [newOwner - ]); - return abiEncodedTransactionData; - }, - async callAsync( - newOwner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as MultiAssetProxyContract; - const encodedData = self._strictEncodeArguments('transferOwnership(address)', [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); - const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<MultiAssetProxyContract> { - 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 MultiAssetProxyContract.deployAsync(bytecode, abi, provider, txDefaults, ); - } - public static async deployAsync( - bytecode: string, - abi: ContractAbi, - provider: Provider, - txDefaults: Partial<TxData>, - ): Promise<MultiAssetProxyContract> { - const constructorAbi = BaseContract._lookupConstructorAbi(abi); - [] = BaseContract._formatABIDataItemList( - constructorAbi.inputs, - [], - BaseContract._bigNumberToString, - ); - const iface = new ethers.utils.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(`MultiAssetProxy successfully deployed at ${txReceipt.contractAddress}`); - const contractInstance = new MultiAssetProxyContract(abi, txReceipt.contractAddress as string, provider, txDefaults); - contractInstance.constructorArgs = []; - return contractInstance; - } - constructor(abi: ContractAbi, address: string, provider: Provider, txDefaults?: Partial<TxData>) { - super('MultiAssetProxy', abi, address, provider, txDefaults); - classUtils.bindAll(this, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts deleted file mode 100644 index 366b207ad..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts +++ /dev/null @@ -1,288 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [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); - const abiEncoder = self._lookupAbiEncoder('getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}, {makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getBalanceAndAllowance = { - async callAsync( - target: string, - assetData: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber, BigNumber] - > { - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalanceAndAllowance(address,bytes)', [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); - const abiEncoder = self._lookupAbiEncoder('getBalanceAndAllowance(address,bytes)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber, BigNumber] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [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); - const abiEncoder = self._lookupAbiEncoder('getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])', [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); - const abiEncoder = self._lookupAbiEncoder('getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}> - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getERC721TokenOwner = { - async callAsync( - token: string, - tokenId: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getERC721TokenOwner(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('getERC721TokenOwner(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public getBalancesAndAllowances = { - async callAsync( - target: string, - assetData: string[], - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<[BigNumber[], BigNumber[]] - > { - const self = this as any as OrderValidatorContract; - const encodedData = self._strictEncodeArguments('getBalancesAndAllowances(address,bytes[])', [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); - const abiEncoder = self._lookupAbiEncoder('getBalancesAndAllowances(address,bytes[])'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<[BigNumber[], BigNumber[]] - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)', [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); - const abiEncoder = self._lookupAbiEncoder('getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber} - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts b/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts deleted file mode 100644 index 5af169e03..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts +++ /dev/null @@ -1,668 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('name()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public approve = { - async sendTransactionAsync( - guy: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('totalSupply()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - src: string, - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public withdraw = { - async sendTransactionAsync( - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [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 encodedData = self._strictEncodeArguments('withdraw(uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('withdraw(uint256)', [wad - ]); - return abiEncodedTransactionData; - }, - async callAsync( - wad: BigNumber, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('withdraw(uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<number - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('decimals()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<number - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - index_0: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('symbol()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transfer = { - async sendTransactionAsync( - dst: string, - wad: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [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); - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public deposit = { - async sendTransactionAsync( - txData: Partial<TxDataPayable> = {}, - ): Promise<string> { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - 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 encodedData = self._strictEncodeArguments('deposit()', []); - 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 abiEncodedTransactionData = self._strictEncodeArguments('deposit()', []); - return abiEncodedTransactionData; - }, - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<void - > { - const self = this as any as WETH9Contract; - const encodedData = self._strictEncodeArguments('deposit()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('deposit()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<void - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - 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 encodedData = self._strictEncodeArguments('allowance(address,address)', [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); - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method diff --git a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts b/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts deleted file mode 100644 index 4f5d7f4c5..000000000 --- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts +++ /dev/null @@ -1,511 +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 '@0x/base-contract'; -import { BlockParam, BlockParamLiteral, CallData, ContractAbi, ContractArtifact, DecodedLogArgs, MethodAbi, Provider, TxData, TxDataPayable } from 'ethereum-types'; -import { BigNumber, classUtils, logUtils } from '@0x/utils'; -import { SimpleContractArtifact } from '@0x/types'; -import { Web3Wrapper } from '@0x/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 encodedData = self._strictEncodeArguments('name()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('name()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public approve = { - async sendTransactionAsync( - _spender: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('approve(address,uint256)', [_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 encodedData = self._strictEncodeArguments('approve(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public totalSupply = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('totalSupply()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('totalSupply()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transferFrom = { - async sendTransactionAsync( - _from: string, - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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 encodedData = self._strictEncodeArguments('transferFrom(address,address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public decimals = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<number - > { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('decimals()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('decimals()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<number - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public balanceOf = { - async callAsync( - _owner: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('balanceOf(address)', [_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); - const abiEncoder = self._lookupAbiEncoder('balanceOf(address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public symbol = { - async callAsync( - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<string - > { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('symbol()', []); - const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync( - { - to: self.address, - ...callData, - data: encodedData, - }, - self._web3Wrapper.getContractDefaults(), - ); - const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock); - BaseContract._throwIfRevertWithReasonCallResult(rawCallResult); - const abiEncoder = self._lookupAbiEncoder('symbol()'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<string - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public transfer = { - async sendTransactionAsync( - _to: string, - _value: BigNumber, - txData: Partial<TxData> = {}, - ): Promise<string> { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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 abiEncodedTransactionData = self._strictEncodeArguments('transfer(address,uint256)', [_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 encodedData = self._strictEncodeArguments('transfer(address,uint256)', [_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); - const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<boolean - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public allowance = { - async callAsync( - _owner: string, - _spender: string, - callData: Partial<CallData> = {}, - defaultBlock?: BlockParam, - ): Promise<BigNumber - > { - const self = this as any as ZRXTokenContract; - const encodedData = self._strictEncodeArguments('allowance(address,address)', [_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); - const abiEncoder = self._lookupAbiEncoder('allowance(address,address)'); - // tslint:disable boolean-naming - const result = abiEncoder.strictDecodeReturnValue<BigNumber - >(rawCallResult); - // tslint:enable boolean-naming - return result; - }, - }; - public static async deployFrom0xArtifactAsync( - artifact: ContractArtifact | SimpleContractArtifact, - 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.utils.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, ['_abiEncoderByFunctionSignature', 'address', 'abi', '_web3Wrapper']); - } -} // tslint:disable:max-file-line-count -// tslint:enable:no-unbound-method |