aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-23 09:23:02 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commitb06f8239e1fe75703f88d34c0d225701406e28c2 (patch)
tree9beb83b64b37fb6ad67d066f089b868a8ad25fcb
parent7991de9ed0b5f1e8a38097d902eae09cc6b5cf11 (diff)
downloaddexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.gz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.bz2
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.lz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.xz
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.tar.zst
dexon-sol-tools-b06f8239e1fe75703f88d34c0d225701406e28c2.zip
Finished porting new abi encoder to contracts
-rw-r--r--contracts/libs/contracts/test/TestLibs/TestLibs.sol26
-rw-r--r--packages/abi-gen-templates/partials/callAsync.handlebars5
-rw-r--r--packages/abi-gen-templates/partials/tx.handlebars9
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts1473
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts818
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts1000
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts524
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts430
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts524
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts665
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts2266
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts525
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_validator.ts94
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts92
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts274
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts661
-rw-r--r--packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts502
-rw-r--r--packages/base-contract/src/index.ts27
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts2
-rw-r--r--packages/utils/src/abi_encoder/abstract_data_types/types/set.ts9
-rw-r--r--packages/utils/src/abi_encoder/evm_data_types/method.ts6
-rw-r--r--packages/utils/test/abi_encoder/evm_data_types_test.ts15
22 files changed, 38 insertions, 9909 deletions
diff --git a/contracts/libs/contracts/test/TestLibs/TestLibs.sol b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
index 7a090adfb..bd5f9f9da 100644
--- a/contracts/libs/contracts/test/TestLibs/TestLibs.sol
+++ b/contracts/libs/contracts/test/TestLibs/TestLibs.sol
@@ -48,32 +48,6 @@ contract TestLibs is
return fillOrderCalldata;
}
- function publicAbiDecodeFillOrder(
- bytes memory fillOrderCalldata
- )
- public
- pure
- returns (
- Order memory order,
- uint256 takerAssetFillAmount,
- bytes memory signature
- )
- {
- (
- order,
- takerAssetFillAmount,
- signature
- ) = abi.decode(
- fillOrderCalldata,
- "((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)"
- );
- return (
- order,
- takerAssetFillAmount,
- signature
- );
- }
-
function publicGetPartialAmountFloor(
uint256 numerator,
uint256 denominator,
diff --git a/packages/abi-gen-templates/partials/callAsync.handlebars b/packages/abi-gen-templates/partials/callAsync.handlebars
index d4fb772c7..e978f577d 100644
--- a/packages/abi-gen-templates/partials/callAsync.handlebars
+++ b/packages/abi-gen-templates/partials/callAsync.handlebars
@@ -4,9 +4,7 @@ async callAsync(
defaultBlock?: BlockParam,
): Promise<{{> return_type outputs=outputs}}> {
const self = this as any as {{contractName}}Contract;
- const functionSignature = '{{this.functionSignature}}';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([{{> params inputs=inputs}}]);
+ const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]);
const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -17,6 +15,7 @@ async callAsync(
);
const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
+ const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
return resultArray{{#singleReturnValue}}[0]{{/singleReturnValue}};
},
diff --git a/packages/abi-gen-templates/partials/tx.handlebars b/packages/abi-gen-templates/partials/tx.handlebars
index 102316b44..0f1027fae 100644
--- a/packages/abi-gen-templates/partials/tx.handlebars
+++ b/packages/abi-gen-templates/partials/tx.handlebars
@@ -9,8 +9,7 @@ public {{this.tsName}} = {
{{/this.payable}}
): Promise<string> {
const self = this as any as {{contractName}}Contract;
- const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
- const encodedData = abiEncoder.encode([{{> params inputs=inputs}}], {optimize: false});
+ const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -31,8 +30,7 @@ public {{this.tsName}} = {
txData: Partial<TxData> = {},
): Promise<number> {
const self = this as any as {{contractName}}Contract;
- const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
- const encodedData = abiEncoder.encode([{{> params inputs=inputs}}]);
+ const encodedData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]);
const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
{
to: self.address,
@@ -48,8 +46,7 @@ public {{this.tsName}} = {
{{> typed_params inputs=inputs}}
): string {
const self = this as any as {{contractName}}Contract;
- const abiEncoder = self._lookupAbiEncoder('{{this.functionSignature}}');
- const abiEncodedTransactionData = abiEncoder.encode([{{> params inputs=inputs}}]);
+ const abiEncodedTransactionData = self._strictEncodeArguments('{{this.functionSignature}}', [{{> params inputs=inputs}}]);
return abiEncodedTransactionData;
},
{{> callAsync}}
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 4257004fd..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/asset_proxy_owner.ts
+++ /dev/null
@@ -1,1473 +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 functionSignature = 'owners(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public removeOwner = {
- async sendTransactionAsync(
- owner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('removeOwner(address)');
- const encodedData = abiEncoder.encode([owner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('removeOwner(address)');
- const encodedData = abiEncoder.encode([owner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- owner: string,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('removeOwner(address)');
- const abiEncodedTransactionData = abiEncoder.encode([owner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'removeOwner(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public revokeConfirmation = {
- async sendTransactionAsync(
- transactionId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- transactionId: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('revokeConfirmation(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([transactionId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'revokeConfirmation(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public isOwner = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isOwner(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public confirmations = {
- async callAsync(
- index_0: BigNumber,
- index_1: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmations(uint256,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0,
- index_1
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public executeRemoveAuthorizedAddressAtIndex = {
- async sendTransactionAsync(
- transactionId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- transactionId: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('executeRemoveAuthorizedAddressAtIndex(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([transactionId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'executeRemoveAuthorizedAddressAtIndex(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public secondsTimeLocked = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'secondsTimeLocked()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getTransactionCount = {
- async callAsync(
- pending: boolean,
- executed: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getTransactionCount(bool,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([pending,
- executed
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public registerAssetProxy = {
- async sendTransactionAsync(
- assetProxyContract: string,
- isRegistered: boolean,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)');
- const encodedData = abiEncoder.encode([assetProxyContract,
- isRegistered
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)');
- const encodedData = abiEncoder.encode([assetProxyContract,
- isRegistered
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- assetProxyContract: string,
- isRegistered: boolean,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address,bool)');
- const abiEncodedTransactionData = abiEncoder.encode([assetProxyContract,
- isRegistered
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- assetProxyContract: string,
- isRegistered: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'registerAssetProxy(address,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([assetProxyContract,
- isRegistered
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public addOwner = {
- async sendTransactionAsync(
- owner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('addOwner(address)');
- const encodedData = abiEncoder.encode([owner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('addOwner(address)');
- const encodedData = abiEncoder.encode([owner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- owner: string,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('addOwner(address)');
- const abiEncodedTransactionData = abiEncoder.encode([owner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'addOwner(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public isConfirmed = {
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isConfirmed(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public changeTimeLock = {
- async sendTransactionAsync(
- _secondsTimeLocked: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)');
- const encodedData = abiEncoder.encode([_secondsTimeLocked
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)');
- const encodedData = abiEncoder.encode([_secondsTimeLocked
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _secondsTimeLocked: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('changeTimeLock(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_secondsTimeLocked
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _secondsTimeLocked: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'changeTimeLock(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_secondsTimeLocked
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public isAssetProxyRegistered = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'isAssetProxyRegistered(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getConfirmationCount = {
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getConfirmationCount(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transactions = {
- async callAsync(
- index_0: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[string, BigNumber, string, boolean]
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'transactions(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getOwners = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string[]
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getOwners()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getTransactionIds = {
- async callAsync(
- from: BigNumber,
- to: BigNumber,
- pending: boolean,
- executed: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber[]
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getTransactionIds(uint256,uint256,bool,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([from,
- to,
- pending,
- executed
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getConfirmations = {
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string[]
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'getConfirmations(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transactionCount = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'transactionCount()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public changeRequirement = {
- async sendTransactionAsync(
- _required: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)');
- const encodedData = abiEncoder.encode([_required
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)');
- const encodedData = abiEncoder.encode([_required
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _required: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('changeRequirement(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_required
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _required: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'changeRequirement(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_required
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public confirmTransaction = {
- async sendTransactionAsync(
- transactionId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- transactionId: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('confirmTransaction(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([transactionId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmTransaction(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public submitTransaction = {
- async sendTransactionAsync(
- destination: string,
- value: BigNumber,
- data: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)');
- const encodedData = abiEncoder.encode([destination,
- value,
- data
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)');
- const encodedData = abiEncoder.encode([destination,
- value,
- data
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- destination: string,
- value: BigNumber,
- data: string,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('submitTransaction(address,uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([destination,
- value,
- data
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- destination: string,
- value: BigNumber,
- data: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'submitTransaction(address,uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([destination,
- value,
- data
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public confirmationTimes = {
- async callAsync(
- index_0: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'confirmationTimes(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public MAX_OWNER_COUNT = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'MAX_OWNER_COUNT()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public required = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'required()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public replaceOwner = {
- async sendTransactionAsync(
- owner: string,
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)');
- const encodedData = abiEncoder.encode([owner,
- newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)');
- const encodedData = abiEncoder.encode([owner,
- newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- owner: string,
- newOwner: string,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('replaceOwner(address,address)');
- const abiEncodedTransactionData = abiEncoder.encode([owner,
- newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- owner: string,
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'replaceOwner(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([owner,
- newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public executeTransaction = {
- async sendTransactionAsync(
- transactionId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)');
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- transactionId: BigNumber,
- ): string {
- const self = this as any as AssetProxyOwnerContract;
- const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([transactionId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- transactionId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as AssetProxyOwnerContract;
- const functionSignature = 'executeTransaction(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([transactionId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- 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 6df58be56..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc20_token.ts
+++ /dev/null
@@ -1,818 +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 functionSignature = 'name()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public approve = {
- async sendTransactionAsync(
- _spender: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _spender: string,
- _value: BigNumber,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_spender,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _spender: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public totalSupply = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'totalSupply()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public decimals = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'decimals()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- _owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public symbol = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'symbol()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public mint = {
- async sendTransactionAsync(
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('mint(uint256)');
- const encodedData = abiEncoder.encode([_value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('mint(uint256)');
- const encodedData = abiEncoder.encode([_value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _value: BigNumber,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('mint(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'mint(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public transfer = {
- async sendTransactionAsync(
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public allowance = {
- async callAsync(
- _owner: string,
- _spender: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'allowance(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _spender
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public setBalance = {
- async sendTransactionAsync(
- _target: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)');
- const encodedData = abiEncoder.encode([_target,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)');
- const encodedData = abiEncoder.encode([_target,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _target: string,
- _value: BigNumber,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setBalance(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_target,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _target: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'setBalance(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_target,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as DummyERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public MAX_MINT_AMOUNT = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC20TokenContract;
- const functionSignature = 'MAX_MINT_AMOUNT()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 7ac08e61f..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/dummy_erc721_token.ts
+++ /dev/null
@@ -1,1000 +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 functionSignature = 'name()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getApproved = {
- async callAsync(
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'getApproved(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public approve = {
- async sendTransactionAsync(
- _approved: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _approved: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _approved: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public mint = {
- async sendTransactionAsync(
- _to: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('mint(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _to: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('mint(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_to,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _to: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'mint(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_to,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public safeTransferFrom1 = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'safeTransferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public ownerOf = {
- async callAsync(
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'ownerOf(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- _owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public symbol = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'symbol()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public burn = {
- async sendTransactionAsync(
- _owner: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)');
- const encodedData = abiEncoder.encode([_owner,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('burn(address,uint256)');
- const encodedData = abiEncoder.encode([_owner,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _owner: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('burn(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_owner,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _owner: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'burn(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public setApprovalForAll = {
- async sendTransactionAsync(
- _operator: string,
- _approved: boolean,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _operator: string,
- _approved: boolean,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const abiEncodedTransactionData = abiEncoder.encode([_operator,
- _approved
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _operator: string,
- _approved: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'setApprovalForAll(address,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public safeTransferFrom2 = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public isApprovedForAll = {
- async callAsync(
- _owner: string,
- _operator: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'isApprovedForAll(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _operator
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as DummyERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as DummyERC721TokenContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- 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/erc20_proxy.ts b/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
deleted file mode 100644
index 8f910eaf9..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_proxy.ts
+++ /dev/null
@@ -1,524 +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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- ): string {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const abiEncodedTransactionData = abiEncoder.encode([target
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'addAuthorizedAddress(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public authorities = {
- async callAsync(
- index_0: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'authorities(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public removeAuthorizedAddress = {
- async sendTransactionAsync(
- target: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- ): string {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const abiEncodedTransactionData = abiEncoder.encode([target
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'removeAuthorizedAddress(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public removeAuthorizedAddressAtIndex = {
- async sendTransactionAsync(
- target: string,
- index: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const encodedData = abiEncoder.encode([target,
- index
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const encodedData = abiEncoder.encode([target,
- index
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- index: BigNumber,
- ): string {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([target,
- index
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- index: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target,
- index
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getProxyId = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'getProxyId()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public authorized = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'authorized(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getAuthorizedAddresses = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string[]
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'getAuthorizedAddresses()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as ERC20ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC20ProxyContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- 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 b9aa50429..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc20_token.ts
+++ /dev/null
@@ -1,430 +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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _spender: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_spender,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _spender: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public totalSupply = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'totalSupply()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- _owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transfer = {
- async sendTransactionAsync(
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ERC20TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public allowance = {
- async callAsync(
- _owner: string,
- _spender: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ERC20TokenContract;
- const functionSignature = 'allowance(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _spender
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 5ff11f35f..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_proxy.ts
+++ /dev/null
@@ -1,524 +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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- ): string {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('addAuthorizedAddress(address)');
- const abiEncodedTransactionData = abiEncoder.encode([target
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'addAuthorizedAddress(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public authorities = {
- async callAsync(
- index_0: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'authorities(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public removeAuthorizedAddress = {
- async sendTransactionAsync(
- target: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const encodedData = abiEncoder.encode([target
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- ): string {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddress(address)');
- const abiEncodedTransactionData = abiEncoder.encode([target
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'removeAuthorizedAddress(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public removeAuthorizedAddressAtIndex = {
- async sendTransactionAsync(
- target: string,
- index: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const encodedData = abiEncoder.encode([target,
- index
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const encodedData = abiEncoder.encode([target,
- index
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- target: string,
- index: BigNumber,
- ): string {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('removeAuthorizedAddressAtIndex(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([target,
- index
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- target: string,
- index: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'removeAuthorizedAddressAtIndex(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target,
- index
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getProxyId = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'getProxyId()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public authorized = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'authorized(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getAuthorizedAddresses = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string[]
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'getAuthorizedAddresses()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as ERC721ProxyContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721ProxyContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- 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 83951cef8..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/erc721_token.ts
+++ /dev/null
@@ -1,665 +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 functionSignature = 'getApproved(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public approve = {
- async sendTransactionAsync(
- _approved: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _approved: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _approved: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_approved,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public safeTransferFrom1 = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- ): string {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'safeTransferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public ownerOf = {
- async callAsync(
- _tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'ownerOf(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- _owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public setApprovalForAll = {
- async sendTransactionAsync(
- _operator: string,
- _approved: boolean,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _operator: string,
- _approved: boolean,
- ): string {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('setApprovalForAll(address,bool)');
- const abiEncodedTransactionData = abiEncoder.encode([_operator,
- _approved
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _operator: string,
- _approved: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'setApprovalForAll(address,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_operator,
- _approved
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public safeTransferFrom2 = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- ): string {
- const self = this as any as ERC721TokenContract;
- const abiEncoder = self._lookupAbiEncoder('safeTransferFrom(address,address,uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _tokenId: BigNumber,
- _data: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'safeTransferFrom(address,address,uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _tokenId,
- _data
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public isApprovedForAll = {
- async callAsync(
- _owner: string,
- _operator: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ERC721TokenContract;
- const functionSignature = 'isApprovedForAll(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _operator
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 f4cdeaaf9..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/exchange.ts
+++ /dev/null
@@ -1,2266 +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 functionSignature = 'filled(bytes32)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public batchFillOrders = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public cancelled = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'cancelled(bytes32)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public preSign = {
- async sendTransactionAsync(
- hash: string,
- signerAddress: string,
- signature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)');
- const encodedData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)');
- const encodedData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- hash: string,
- signerAddress: string,
- signature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('preSign(bytes32,address,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- hash: string,
- signerAddress: string,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'preSign(bytes32,address,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public matchOrders = {
- async sendTransactionAsync(
- leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- leftSignature: string,
- rightSignature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const 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)');
- const encodedData = abiEncoder.encode([leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ], {optimize: false});
- 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 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)');
- const encodedData = abiEncoder.encode([leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- leftSignature: string,
- rightSignature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const 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)');
- const abiEncodedTransactionData = abiEncoder.encode([leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- leftOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- rightOrder: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- leftSignature: string,
- rightSignature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{left: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};right: {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber};leftMakerAssetSpreadAmount: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'matchOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),(address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),bytes,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([leftOrder,
- rightOrder,
- leftSignature,
- rightSignature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public fillOrderNoThrow = {
- async sendTransactionAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrderNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public assetProxies = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'assetProxies(bytes4)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public batchCancelOrders = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])');
- const encodedData = abiEncoder.encode([orders
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])');
- const encodedData = abiEncoder.encode([orders
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'batchCancelOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public batchFillOrKillOrders = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrKillOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public cancelOrdersUpTo = {
- async sendTransactionAsync(
- targetOrderEpoch: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)');
- const encodedData = abiEncoder.encode([targetOrderEpoch
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)');
- const encodedData = abiEncoder.encode([targetOrderEpoch
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- targetOrderEpoch: BigNumber,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('cancelOrdersUpTo(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([targetOrderEpoch
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- targetOrderEpoch: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'cancelOrdersUpTo(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([targetOrderEpoch
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public batchFillOrdersNoThrow = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmounts: BigNumber[],
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'batchFillOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256[],bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmounts,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getAssetProxy = {
- async callAsync(
- assetProxyId: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'getAssetProxy(bytes4)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([assetProxyId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transactions = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'transactions(bytes32)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public fillOrKillOrder = {
- async sendTransactionAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrKillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public setSignatureValidatorApproval = {
- async sendTransactionAsync(
- validatorAddress: string,
- approval: boolean,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)');
- const encodedData = abiEncoder.encode([validatorAddress,
- approval
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)');
- const encodedData = abiEncoder.encode([validatorAddress,
- approval
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- validatorAddress: string,
- approval: boolean,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('setSignatureValidatorApproval(address,bool)');
- const abiEncodedTransactionData = abiEncoder.encode([validatorAddress,
- approval
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- validatorAddress: string,
- approval: boolean,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'setSignatureValidatorApproval(address,bool)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([validatorAddress,
- approval
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public allowedValidators = {
- async callAsync(
- index_0: string,
- index_1: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'allowedValidators(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0,
- index_1
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public marketSellOrders = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'marketSellOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getOrdersInfo = {
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'getOrdersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public preSigned = {
- async callAsync(
- index_0: string,
- index_1: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'preSigned(bytes32,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0,
- index_1
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public isValidSignature = {
- async callAsync(
- hash: string,
- signerAddress: string,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'isValidSignature(bytes32,address,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public marketBuyOrdersNoThrow = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'marketBuyOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public fillOrder = {
- async sendTransactionAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAssetFillAmount: BigNumber,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'fillOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),uint256,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order,
- takerAssetFillAmount,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public executeTransaction = {
- async sendTransactionAsync(
- salt: BigNumber,
- signerAddress: string,
- data: string,
- signature: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)');
- const encodedData = abiEncoder.encode([salt,
- signerAddress,
- data,
- signature
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)');
- const encodedData = abiEncoder.encode([salt,
- signerAddress,
- data,
- signature
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- salt: BigNumber,
- signerAddress: string,
- data: string,
- signature: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('executeTransaction(uint256,address,bytes,bytes)');
- const abiEncodedTransactionData = abiEncoder.encode([salt,
- signerAddress,
- data,
- signature
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- salt: BigNumber,
- signerAddress: string,
- data: string,
- signature: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'executeTransaction(uint256,address,bytes,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([salt,
- signerAddress,
- data,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public registerAssetProxy = {
- async sendTransactionAsync(
- assetProxy: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)');
- const encodedData = abiEncoder.encode([assetProxy
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)');
- const encodedData = abiEncoder.encode([assetProxy
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- assetProxy: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('registerAssetProxy(address)');
- const abiEncodedTransactionData = abiEncoder.encode([assetProxy
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- assetProxy: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'registerAssetProxy(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([assetProxy
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getOrderInfo = {
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'getOrderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public cancelOrder = {
- async sendTransactionAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
- const encodedData = abiEncoder.encode([order
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
- const encodedData = abiEncoder.encode([order
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))');
- const abiEncodedTransactionData = abiEncoder.encode([order
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'cancelOrder((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes))';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public orderEpoch = {
- async callAsync(
- index_0: string,
- index_1: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'orderEpoch(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0,
- index_1
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public ZRX_ASSET_DATA = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'ZRX_ASSET_DATA()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public marketSellOrdersNoThrow = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAssetFillAmount: BigNumber,
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'marketSellOrdersNoThrow((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAssetFillAmount,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public EIP712_DOMAIN_HASH = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'EIP712_DOMAIN_HASH()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public marketBuyOrders = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'marketBuyOrders((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],uint256,bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public currentContextAddress = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'currentContextAddress()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as ExchangeContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public VERSION = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ExchangeContract;
- const functionSignature = 'VERSION()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 d0797eccd..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/forwarder.ts
+++ /dev/null
@@ -1,525 +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 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)');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], {optimize: false});
- 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 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)');
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- feeSignatures: string[],
- feePercentage: BigNumber,
- feeRecipient: string,
- ): string {
- const self = this as any as ForwarderContract;
- const 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)');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- makerAssetFillAmount: BigNumber,
- signatures: string[],
- feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- feeSignatures: string[],
- feePercentage: BigNumber,
- feeRecipient: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
- > {
- const self = this as any as ForwarderContract;
- const functionSignature = 'marketBuyOrdersWithEth((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)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- makerAssetFillAmount,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public withdrawAsset = {
- async sendTransactionAsync(
- assetData: string,
- amount: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ForwarderContract;
- const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)');
- const encodedData = abiEncoder.encode([assetData,
- amount
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)');
- const encodedData = abiEncoder.encode([assetData,
- amount
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- assetData: string,
- amount: BigNumber,
- ): string {
- const self = this as any as ForwarderContract;
- const abiEncoder = self._lookupAbiEncoder('withdrawAsset(bytes,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([assetData,
- amount
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- assetData: string,
- amount: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ForwarderContract;
- const functionSignature = 'withdrawAsset(bytes,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([assetData,
- amount
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public owner = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ForwarderContract;
- const functionSignature = 'owner()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public marketSellOrdersWithEth = {
- async sendTransactionAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- signatures: string[],
- feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- feeSignatures: string[],
- feePercentage: BigNumber,
- feeRecipient: string,
- txData: Partial<TxDataPayable> = {},
- ): Promise<string> {
- const self = this as any as ForwarderContract;
- const 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)');
- const encodedData = abiEncoder.encode([orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ], {optimize: false});
- 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 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)');
- const encodedData = abiEncoder.encode([orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- signatures: string[],
- feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- feeSignatures: string[],
- feePercentage: BigNumber,
- feeRecipient: string,
- ): string {
- const self = this as any as ForwarderContract;
- const 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)');
- const abiEncodedTransactionData = abiEncoder.encode([orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- signatures: string[],
- feeOrders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- feeSignatures: string[],
- feePercentage: BigNumber,
- feeRecipient: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[{makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}, {makerAssetFilledAmount: BigNumber;takerAssetFilledAmount: BigNumber;makerFeePaid: BigNumber;takerFeePaid: BigNumber}]
- > {
- const self = this as any as ForwarderContract;
- const functionSignature = 'marketSellOrdersWithEth((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)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- signatures,
- feeOrders,
- feeSignatures,
- feePercentage,
- feeRecipient
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public transferOwnership = {
- async sendTransactionAsync(
- newOwner: string,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ForwarderContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- newOwner: string,
- ): string {
- const self = this as any as ForwarderContract;
- const abiEncoder = self._lookupAbiEncoder('transferOwnership(address)');
- const abiEncodedTransactionData = abiEncoder.encode([newOwner
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- newOwner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as ForwarderContract;
- const functionSignature = 'transferOwnership(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([newOwner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- 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 cabaeeb98..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/i_validator.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 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 functionSignature = 'isValidSignature(bytes32,address,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([hash,
- signerAddress,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 9d54ca0c1..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/i_wallet.ts
+++ /dev/null
@@ -1,92 +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 functionSignature = 'isValidSignature(bytes32,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([hash,
- signature
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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/order_validator.ts b/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
deleted file mode 100644
index 5740af4ab..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/order_validator.ts
+++ /dev/null
@@ -1,274 +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 functionSignature = 'getOrderAndTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order,
- takerAddress
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getBalanceAndAllowance = {
- async callAsync(
- target: string,
- assetData: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[BigNumber, BigNumber]
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getBalanceAndAllowance(address,bytes)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target,
- assetData
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getOrdersAndTradersInfo = {
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAddresses: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[Array<{orderStatus: number;orderHash: string;orderTakerAssetFilledAmount: BigNumber}>, Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>]
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getOrdersAndTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAddresses
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getTradersInfo = {
- async callAsync(
- orders: Array<{makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string}>,
- takerAddresses: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<Array<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}>
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getTradersInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes)[],address[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([orders,
- takerAddresses
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getERC721TokenOwner = {
- async callAsync(
- token: string,
- tokenId: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getERC721TokenOwner(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([token,
- tokenId
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public getBalancesAndAllowances = {
- async callAsync(
- target: string,
- assetData: string[],
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<[BigNumber[], BigNumber[]]
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getBalancesAndAllowances(address,bytes[])';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([target,
- assetData
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public getTraderInfo = {
- async callAsync(
- order: {makerAddress: string;takerAddress: string;feeRecipientAddress: string;senderAddress: string;makerAssetAmount: BigNumber;takerAssetAmount: BigNumber;makerFee: BigNumber;takerFee: BigNumber;expirationTimeSeconds: BigNumber;salt: BigNumber;makerAssetData: string;takerAssetData: string},
- takerAddress: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<{makerBalance: BigNumber;makerAllowance: BigNumber;takerBalance: BigNumber;takerAllowance: BigNumber;makerZrxBalance: BigNumber;makerZrxAllowance: BigNumber;takerZrxBalance: BigNumber;takerZrxAllowance: BigNumber}
- > {
- const self = this as any as OrderValidatorContract;
- const functionSignature = 'getTraderInfo((address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256,bytes,bytes),address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([order,
- takerAddress
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 773ecb9d3..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/weth9.ts
+++ /dev/null
@@ -1,661 +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 functionSignature = 'name()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public approve = {
- async sendTransactionAsync(
- guy: string,
- wad: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([guy,
- wad
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([guy,
- wad
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- guy: string,
- wad: BigNumber,
- ): string {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([guy,
- wad
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- guy: string,
- wad: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([guy,
- wad
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public totalSupply = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'totalSupply()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- src: string,
- dst: string,
- wad: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([src,
- dst,
- wad
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([src,
- dst,
- wad
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- src: string,
- dst: string,
- wad: BigNumber,
- ): string {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([src,
- dst,
- wad
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- src: string,
- dst: string,
- wad: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([src,
- dst,
- wad
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public withdraw = {
- async sendTransactionAsync(
- wad: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
- const encodedData = abiEncoder.encode([wad
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
- const encodedData = abiEncoder.encode([wad
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- wad: BigNumber,
- ): string {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('withdraw(uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([wad
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- wad: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'withdraw(uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([wad
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public decimals = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<number
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'decimals()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- index_0: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public symbol = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'symbol()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transfer = {
- async sendTransactionAsync(
- dst: string,
- wad: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([dst,
- wad
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([dst,
- wad
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- dst: string,
- wad: BigNumber,
- ): string {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([dst,
- wad
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- dst: string,
- wad: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'transfer(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([dst,
- wad
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public deposit = {
- async sendTransactionAsync(
- txData: Partial<TxDataPayable> = {},
- ): Promise<string> {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('deposit()');
- const encodedData = abiEncoder.encode([], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('deposit()');
- const encodedData = abiEncoder.encode([]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- ): string {
- const self = this as any as WETH9Contract;
- const abiEncoder = self._lookupAbiEncoder('deposit()');
- const abiEncodedTransactionData = abiEncoder.encode([]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<void
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'deposit()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray;
- },
- };
- public allowance = {
- async callAsync(
- index_0: string,
- index_1: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as WETH9Contract;
- const functionSignature = 'allowance(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([index_0,
- index_1
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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 afa80f368..000000000
--- a/packages/abi-gen-wrappers/src/generated-wrappers/zrx_token.ts
+++ /dev/null
@@ -1,502 +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 functionSignature = 'name()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public approve = {
- async sendTransactionAsync(
- _spender: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _spender: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('approve(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_spender,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _spender: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'approve(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_spender,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public totalSupply = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'totalSupply()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transferFrom = {
- async sendTransactionAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _from: string,
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('transferFrom(address,address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _from: string,
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'transferFrom(address,address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_from,
- _to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public decimals = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<number
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'decimals()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public balanceOf = {
- async callAsync(
- _owner: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'balanceOf(address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public symbol = {
- async callAsync(
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<string
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'symbol()';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public transfer = {
- async sendTransactionAsync(
- _to: string,
- _value: BigNumber,
- txData: Partial<TxData> = {},
- ): Promise<string> {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ], {optimize: false});
- 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 abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const txDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...txData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const gas = await self._web3Wrapper.estimateGasAsync(txDataWithDefaults);
- return gas;
- },
- getABIEncodedTransactionData(
- _to: string,
- _value: BigNumber,
- ): string {
- const self = this as any as ZRXTokenContract;
- const abiEncoder = self._lookupAbiEncoder('transfer(address,uint256)');
- const abiEncodedTransactionData = abiEncoder.encode([_to,
- _value
- ]);
- return abiEncodedTransactionData;
- },
- async callAsync(
- _to: string,
- _value: BigNumber,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<boolean
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'transfer(address,uint256)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_to,
- _value
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- public allowance = {
- async callAsync(
- _owner: string,
- _spender: string,
- callData: Partial<CallData> = {},
- defaultBlock?: BlockParam,
- ): Promise<BigNumber
- > {
- const self = this as any as ZRXTokenContract;
- const functionSignature = 'allowance(address,address)';
- const abiEncoder = self._lookupAbiEncoder(functionSignature);
- const encodedData = abiEncoder.encode([_owner,
- _spender
- ]);
- const callDataWithDefaults = await BaseContract._applyDefaultsToTxDataAsync(
- {
- to: self.address,
- ...callData,
- data: encodedData,
- },
- self._web3Wrapper.getContractDefaults(),
- );
- const rawCallResult = await self._web3Wrapper.callAsync(callDataWithDefaults, defaultBlock);
- BaseContract._throwIfRevertWithReasonCallResult(rawCallResult);
- let resultArray = abiEncoder.decodeReturnValuesAsArrayOrNull(rawCallResult);
- return resultArray[0];
- },
- };
- 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
diff --git a/packages/base-contract/src/index.ts b/packages/base-contract/src/index.ts
index 2fd50b941..aeb90e6f7 100644
--- a/packages/base-contract/src/index.ts
+++ b/packages/base-contract/src/index.ts
@@ -91,10 +91,7 @@ export class BaseContract {
}
protected static _throwIfRevertWithReasonCallResult(rawCallResult: string): void {
if (rawCallResult.slice(REVERT_ERROR_SELECTOR_OFFSET, REVERT_ERROR_SELECTOR_END) === REVERT_ERROR_SELECTOR) {
- const revertReason = ethers.utils.defaultAbiCoder.decode(
- ['string'],
- ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH),
- );
+ const revertReason = AbiEncoder.create('(string)').decode(ethers.utils.hexDataSlice(rawCallResult, REVERT_ERROR_SELECTOR_BYTES_LENGTH));
throw new Error(revertReason);
}
}
@@ -140,6 +137,28 @@ export class BaseContract {
}) as MethodAbi;
return methodAbi;
}
+ protected _strictEncodeArguments(functionSignature: string, functionArguments: any): string {
+ const abiEncoder = this._lookupAbiEncoder(functionSignature);
+ const inputAbi = abiEncoder.getDataItem().components;
+ if (inputAbi === undefined) {
+ throw new Error(`Undefined Method Input ABI`);
+ }
+ const params = abiUtils.parseEthersParams(inputAbi);
+ const rawEncoded = abiEncoder.encode(functionArguments);
+ const rawDecoded = abiEncoder.decodeAsArray(rawEncoded);
+ for (let i = 0; i < rawDecoded.length; i++) {
+ const original = functionArguments[i];
+ const decoded = rawDecoded[i];
+ if (!abiUtils.isAbiDataEqual(params.names[i], params.types[i], original, decoded)) {
+ throw new Error(
+ `Cannot safely encode argument: ${params.names[i]} (${original}) of type ${
+ params.types[i]
+ }. (Possible type overflow or other encoding error)`,
+ );
+ }
+ }
+ return rawEncoded;
+ }
constructor(
contractName: string,
abi: ContractAbi,
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
index a091e55b9..4252b782c 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/blob.ts
@@ -9,6 +9,8 @@ import { DecodingRules } from '../../utils/rules';
import { DataType } from '../data_type';
import { DataTypeFactory } from '../interfaces';
+import * as ethUtil from 'ethereumjs-util';
+
export abstract class AbstractBlobDataType extends DataType {
protected _sizeKnownAtCompileTime: boolean;
diff --git a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
index d7105ff5f..5eb29c47b 100644
--- a/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
+++ b/packages/utils/src/abi_encoder/abstract_data_types/types/set.ts
@@ -13,6 +13,7 @@ import { DataType } from '../data_type';
import { DataTypeFactory, MemberIndexByName } from '../interfaces';
import { AbstractPointerDataType } from './pointer';
+import { logUtils } from '../../../log_utils';
export abstract class AbstractSetDataType extends DataType {
protected readonly _arrayLength: number | undefined;
@@ -134,22 +135,16 @@ export abstract class AbstractSetDataType extends DataType {
const block = new SetCalldataBlock(this.getDataItem().name, this.getSignature(), parentName);
// Create blocks for members of set.
const memberCalldataBlocks: CalldataBlock[] = [];
- let duplicateObj = _.cloneDeep(obj) as {[key:string]: any};
_.forEach(this._memberIndexByName, (memberIndex: number, memberName: string) => {
if (!(memberName in obj)) {
throw new Error(
`Could not assign tuple to object: missing key '${memberName}' in object ${JSON.stringify(obj)}`,
);
}
- const memberValue: any = duplicateObj[memberName];
+ const memberValue: any = (obj as {[key:string]: any})[memberName];
const memberBlock = this._members[memberIndex].generateCalldataBlock(memberValue, block);
memberCalldataBlocks.push(memberBlock);
- delete duplicateObj[memberName];
});
- // Sanity check that all members have been included.
- if (Object.keys(duplicateObj).length !== 0) {
- throw new Error(`Could not assign tuple to object: unrecognized keys ${Object.keys(duplicateObj)}`);
- }
// Associate member blocks with Set block.
block.setMembers(memberCalldataBlocks);
return block;
diff --git a/packages/utils/src/abi_encoder/evm_data_types/method.ts b/packages/utils/src/abi_encoder/evm_data_types/method.ts
index 44456cd0a..212e2ca6b 100644
--- a/packages/utils/src/abi_encoder/evm_data_types/method.ts
+++ b/packages/utils/src/abi_encoder/evm_data_types/method.ts
@@ -35,6 +35,12 @@ export class MethodDataType extends AbstractSetDataType {
return value;
}
+ public decodeAsArray(returndata: string, rules?: DecodingRules): any {
+ const value = this.decode(returndata, rules);
+ const valuesAsArray = _.isObject(value) ? _.values(value) : [value];
+ return valuesAsArray;
+ }
+
public encodeReturnValues(value: any, rules?: EncodingRules): string {
const returnData = this._returnDataType.encode(value, rules);
return returnData;
diff --git a/packages/utils/test/abi_encoder/evm_data_types_test.ts b/packages/utils/test/abi_encoder/evm_data_types_test.ts
index 919b71c55..3c7bafc0a 100644
--- a/packages/utils/test/abi_encoder/evm_data_types_test.ts
+++ b/packages/utils/test/abi_encoder/evm_data_types_test.ts
@@ -407,21 +407,6 @@ describe('ABI Encoder: EVM Data Type Encoding/Decoding', () => {
dataType.encode(args, encodingRules);
}).to.throw('Could not assign tuple to object: missing key \'field_2\' in object {"field_1":"-5"}');
});
- it('Bad Key', async () => {
- // Create DataType object
- const testDataItem = {
- name: 'Tuple',
- type: 'tuple',
- components: [{name: 'field_1', type: 'bool' }],
- };
- const dataType = new AbiEncoder.Tuple(testDataItem);
- // Construct args to be encoded
- const args = { field_1: true, unknown_field: new BigNumber(-5) };
- // Encode Args and validate result
- expect(() => {
- dataType.encode(args, encodingRules);
- }).to.throw("Could not assign tuple to object: unrecognized keys unknown_field");
- });
});
describe('Address', () => {